@sema-agent/core 7.23.4 → 7.24.0

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/dist/agents/list-agents-tool.d.ts +8 -1
  3. package/dist/agents/list-agents-tool.js +26 -3
  4. package/dist/agents/observer.js +5 -8
  5. package/dist/agents/subagent.js +2 -2
  6. package/dist/agents/team.js +9 -0
  7. package/dist/brain/anthropic.js +3 -2
  8. package/dist/brain/circuit-breaker.js +3 -3
  9. package/dist/brain/degrading.js +11 -14
  10. package/dist/brain/errors.d.ts +35 -18
  11. package/dist/brain/errors.js +49 -31
  12. package/dist/brain/failover.js +2 -3
  13. package/dist/brain/open-responses.js +6 -5
  14. package/dist/brain/openai.js +6 -5
  15. package/dist/brain/route-adjudicator.d.ts +50 -15
  16. package/dist/brain/route-adjudicator.js +112 -20
  17. package/dist/brain/route-conformance.js +9 -0
  18. package/dist/brain/stream-engine.js +18 -10
  19. package/dist/core/arg-summary.js +17 -6
  20. package/dist/core/auto-compaction.d.ts +42 -1
  21. package/dist/core/auto-compaction.js +21 -1
  22. package/dist/core/auto-mode.js +2 -8
  23. package/dist/core/checkpoint-store.d.ts +4 -6
  24. package/dist/core/checkpoint-store.js +2 -2
  25. package/dist/core/exec-gate.js +3 -5
  26. package/dist/core/file-history-store.js +11 -10
  27. package/dist/core/hooks.d.ts +7 -0
  28. package/dist/core/mcp.js +7 -5
  29. package/dist/core/memory-engine/distiller.d.ts +7 -4
  30. package/dist/core/memory-engine/distiller.js +11 -3
  31. package/dist/core/memory.js +1 -0
  32. package/dist/core/permission-rule-model.js +8 -5
  33. package/dist/core/runner/assemble-result.js +12 -19
  34. package/dist/core/runner/contracts.d.ts +1 -0
  35. package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
  36. package/dist/core/runner/prepare-delegation-surface.js +1 -0
  37. package/dist/core/runner/prepare-file-history.js +19 -0
  38. package/dist/core/runner/prepare-hands-readface.d.ts +4 -1
  39. package/dist/core/runner/prepare-hands-readface.js +4 -0
  40. package/dist/core/runner/prepare-task.js +2 -2
  41. package/dist/core/runner/run-leg.js +2 -13
  42. package/dist/core/runner/run-recovery-lanes.js +4 -20
  43. package/dist/core/runner/run-settle-and-teardown.js +2 -16
  44. package/dist/core/runner/run-turn-boundary.js +4 -20
  45. package/dist/core/runner/runtask.js +3 -5
  46. package/dist/core/runner/stream-settle-backstop.js +5 -5
  47. package/dist/core/runner/tool-end-body.js +5 -4
  48. package/dist/core/runner/tool-output-projection.js +3 -2
  49. package/dist/core/runner/turn-attachments.d.ts +0 -20
  50. package/dist/core/runner/turn-attachments.js +41 -36
  51. package/dist/core/session-store.js +2 -4
  52. package/dist/core/session.d.ts +4 -1
  53. package/dist/core/session.js +2 -1
  54. package/dist/core/task-event.d.ts +19 -9
  55. package/dist/core/task-registry-shared.js +1 -0
  56. package/dist/core/thrown-value.d.ts +52 -11
  57. package/dist/core/thrown-value.js +35 -1
  58. package/dist/core/tool-catalog-entries.js +1 -1
  59. package/dist/core/tool-errors.d.ts +6 -0
  60. package/dist/core/tool-errors.js +6 -14
  61. package/dist/core/tool-model-gate.js +3 -15
  62. package/dist/core/tools.js +15 -16
  63. package/dist/core/untrusted-text.d.ts +6 -0
  64. package/dist/core/untrusted-text.js +1 -0
  65. package/dist/core/workflow-run-store-contract.js +13 -0
  66. package/dist/core/workflow-run-store.d.ts +15 -0
  67. package/dist/core/workflow-run-store.js +1 -0
  68. package/dist/engine/llm/types.d.ts +4 -4
  69. package/dist/engine/loop/agent-loop.js +10 -24
  70. package/dist/index.d.ts +1 -1
  71. package/dist/index.js +1 -1
  72. package/dist/orchestration/workflow.js +44 -23
  73. package/dist/stores/file/file-history-store.js +12 -11
  74. package/dist/tools/fs/bash-program-position.d.ts +23 -0
  75. package/dist/tools/fs/bash-program-position.js +11 -0
  76. package/dist/tools/fs/bash-readonly-classifier.d.ts +30 -7
  77. package/dist/tools/fs/bash-readonly-classifier.js +31 -10
  78. package/dist/tools/fs/fs-bash.d.ts +30 -1
  79. package/dist/tools/fs/fs-bash.js +123 -54
  80. package/dist/tools/fs/read-deny.d.ts +14 -0
  81. package/dist/tools/fs/read-deny.js +5 -0
  82. package/dist/tools/fs/safety.d.ts +1 -1
  83. package/dist/tools/fs/safety.js +2 -1
  84. package/dist/tools/monitor.d.ts +5 -0
  85. package/dist/tools/monitor.js +7 -0
  86. package/package.json +1 -1
  87. package/test/export-surface.snapshot.json +7 -3
  88. package/wire-changes/core@7.23.5.json +133 -0
  89. package/wire-changes/core@7.24.0.json +249 -0
@@ -42,6 +42,7 @@ import type { AgentTool, ExecutionEnv } from "../internal/harness-types.js";
42
42
  import { type MonitorTimers, type TaskRegistry } from "../core/task-registry.js";
43
43
  import type { TaskNotificationPayload } from "../core/task-notification.js";
44
44
  import type { ToolResultStore } from "../core/tool-result-store.js";
45
+ import type { BashReadonlyRootBoundary } from "./fs/bash-readonly-classifier.js";
45
46
  export interface MonitorToolOptions {
46
47
  registry: TaskRegistry;
47
48
  /** Fallbacks when the runtime ctx carries no identity (direct mounts) — same posture as createBashTool. */
@@ -68,6 +69,10 @@ export interface MonitorToolOptions {
68
69
  * task-registry-monitor.ts's spill helper). Absent ⇒ legal degrade, byte-identical rolling (no spill,
69
70
  * same loss shape as before this design). */
70
71
  toolResultStore?: ToolResultStore;
72
+ /** The deployment's shell READ BOUNDARY — the SAME option `createBashTool` takes: this face spawns a
73
+ * shell command too, so the seat that judges the WRITTEN spelling needs the leg that re-judges where the
74
+ * kernel takes it. BUILT here, so a library mount is not fail-open on one face and closed on the other. */
75
+ readBoundary?: BashReadonlyRootBoundary | (() => BashReadonlyRootBoundary | undefined);
71
76
  /** RB-465-b (HRD-PTL-3 残件): spec-level retain (`TaskSpec.retainBackgroundProcesses`) — the SECOND
72
77
  * retain lane, OR-composed with the env capability at the teardown sweep. Without this bit the mount
73
78
  * could only see the env lane, so a deployment retaining per spec still got the "session ends it"
@@ -3,6 +3,7 @@ import { defineTool, errorResult } from "../core/tools.js";
3
3
  import { hasBackgroundShell } from "../core/background-shell.js";
4
4
  import { MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_MAX_TIMEOUT_MS, } from "../core/task-registry.js";
5
5
  import { toolFace } from "../core/tool-catalog-entries.js";
6
+ import { createShellCanonicalRecheck, MONITOR_ESCAPE_PROSE } from "./fs/fs-bash.js";
6
7
  import { thrownText } from "../core/thrown-value.js";
7
8
  const MONITOR_DESCRIPTION = "Run a shell command in the background and watch its stdout as a stream of events.\n" +
8
9
  "\n" +
@@ -42,6 +43,7 @@ function envBackgroundWallSec(caps, requestedSec) {
42
43
  return Math.min(base, cap);
43
44
  }
44
45
  export function createMonitorTool(env, opts) {
46
+ const canonicalRecheck = opts.readBoundary === undefined ? undefined : createShellCanonicalRecheck(env, opts.readBoundary, MONITOR_ESCAPE_PROSE);
45
47
  return defineTool({
46
48
  name: "Monitor",
47
49
  ...toolFace("monitor"),
@@ -68,6 +70,11 @@ export function createMonitorTool(env, opts) {
68
70
  const isPersistent = persistent === true;
69
71
  const timeoutMs = Math.min(MONITOR_MAX_TIMEOUT_MS, Math.max(1, Math.floor(timeout_ms ?? MONITOR_DEFAULT_TIMEOUT_MS)));
70
72
  const spawnTimeoutSec = isPersistent ? undefined : Math.ceil(timeoutMs / 1000) + 5;
73
+ const escape = await canonicalRecheck?.(command, ctx.signal);
74
+ if (escape !== undefined)
75
+ return escape;
76
+ if (ctx.signal?.aborted === true)
77
+ return errorResult("Error (Monitor): the call was cancelled before the watch started.");
71
78
  const spawn = await env.spawnBackground(command, {
72
79
  ...(opts.cwdRef !== undefined ? { cwd: opts.cwdRef.current } : {}),
73
80
  ...(spawnTimeoutSec !== undefined ? { timeout: spawnTimeoutSec } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/core",
3
- "version": "7.23.4",
3
+ "version": "7.24.0",
4
4
  "description": "Stateless, task-oriented AI agent core",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_comment": "design/87 L3 — frozen public export surface of src/index.ts (name -> kind). DO NOT edit by hand to silence a red test. A removed/changed entry = a SemVer-BREAKING change; bump MAJOR and update this fixture in the SAME commit (design/87 §4.2 / §5.2). Regenerate via REGEN in test/export-surface.test.ts.",
3
3
  "_tierComment": "#435 v1 — machine-readable layering of the public surface: stable = demonstrated by README.md / src/examples; internal = an `Internal`-marked name or a runner/engine deep-subtree declaration (the model seam src/engine/llm is excluded — it is the BYOM contract, not an engine internal); advanced = a supported export the front door does not walk you through. THIS IS AN INITIAL HEURISTIC, derived mechanically and expected to be refined ticket by ticket: no human reviewed these 1700+ entries one by one, and nothing here claims otherwise. Known bias: a short or English-word export name (ok, err, Result, Usage) can match ordinary prose in README.md and land `stable` on a coincidence. Every export MUST carry a tier — a new export with no row fails the gate in export-surface.test.ts.",
4
- "count": 2395,
4
+ "count": 2397,
5
5
  "exports": {
6
6
  "A2ATaskState": "type",
7
7
  "A2ATaskStateReversal": "type",
@@ -1867,6 +1867,7 @@
1867
1867
  "devWorkflowScriptRunner": "variable",
1868
1868
  "diffToolRoster": "function",
1869
1869
  "directoryRuleAdmits": "function",
1870
+ "displayUrlOf": "function",
1870
1871
  "distilledEquals": "function",
1871
1872
  "dotAtOrBelowFrontier": "function",
1872
1873
  "drainMemoryAnnouncements": "function",
@@ -2076,7 +2077,6 @@
2076
2077
  "namespacedRuleNameCovers": "function",
2077
2078
  "nextSyncBaseline": "function",
2078
2079
  "normalizeAgentName": "function",
2079
- "normalizeBaseUrl": "function",
2080
2080
  "normalizeForExactMatch": "function",
2081
2081
  "normalizeMemorySpec": "function",
2082
2082
  "normalizePeerName": "function",
@@ -2242,6 +2242,7 @@
2242
2242
  "resolveReadDenyBuiltins": "function",
2243
2243
  "resolveReasoning": "function",
2244
2244
  "resolveReasoningProfile": "function",
2245
+ "resolveRequestRoot": "function",
2245
2246
  "resolveRouteCredential": "function",
2246
2247
  "resolveSubagentTranscriptTier": "function",
2247
2248
  "resolveTaskLimits": "function",
@@ -2255,6 +2256,7 @@
2255
2256
  "retryBackoffMs": "function",
2256
2257
  "riskSeverity": "function",
2257
2258
  "rosterMemberBoundProblem": "function",
2259
+ "routeKeyOf": "function",
2258
2260
  "routePairingStatus": "function",
2259
2261
  "routePeerDeliveryReceipt": "function",
2260
2262
  "routePeerDroppedReceipt": "function",
@@ -4264,6 +4266,7 @@
4264
4266
  "devWorkflowScriptRunner": "stable",
4265
4267
  "diffToolRoster": "advanced",
4266
4268
  "directoryRuleAdmits": "advanced",
4269
+ "displayUrlOf": "advanced",
4267
4270
  "distilledEquals": "stable",
4268
4271
  "dotAtOrBelowFrontier": "advanced",
4269
4272
  "drainMemoryAnnouncements": "advanced",
@@ -4473,7 +4476,6 @@
4473
4476
  "namespacedRuleNameCovers": "advanced",
4474
4477
  "nextSyncBaseline": "advanced",
4475
4478
  "normalizeAgentName": "advanced",
4476
- "normalizeBaseUrl": "advanced",
4477
4479
  "normalizeForExactMatch": "internal",
4478
4480
  "normalizeMemorySpec": "advanced",
4479
4481
  "normalizePeerName": "advanced",
@@ -4639,6 +4641,7 @@
4639
4641
  "resolveReadDenyBuiltins": "advanced",
4640
4642
  "resolveReasoning": "advanced",
4641
4643
  "resolveReasoningProfile": "advanced",
4644
+ "resolveRequestRoot": "stable",
4642
4645
  "resolveRouteCredential": "advanced",
4643
4646
  "resolveSubagentTranscriptTier": "advanced",
4644
4647
  "resolveTaskLimits": "internal",
@@ -4652,6 +4655,7 @@
4652
4655
  "retryBackoffMs": "advanced",
4653
4656
  "riskSeverity": "advanced",
4654
4657
  "rosterMemberBoundProblem": "advanced",
4658
+ "routeKeyOf": "advanced",
4655
4659
  "routePairingStatus": "advanced",
4656
4660
  "routePeerDeliveryReceipt": "advanced",
4657
4661
  "routePeerDroppedReceipt": "advanced",
@@ -0,0 +1,133 @@
1
+ {
2
+ "repo": "core",
3
+ "version": "7.23.5",
4
+ "from": "0a77a55f973aa9bc0d816abcf25cccb21039bda6",
5
+ "to": "v7.23.5",
6
+ "added": [],
7
+ "removed": [],
8
+ "changed": [],
9
+ "narrowed": [
10
+ {
11
+ "id": "F3",
12
+ "source": "behaviorFlips.summary",
13
+ "text": "NARROWING of the retry ladder, no key change (#933): a fetch throw the RUNTIME raised while BUILDING the request (a base URL carrying userinfo, a malformed URL/method/header name, a GET with a body) is classified by `classifyFetchThrow` (`src/brain/errors.ts:328`) as `invalid_request` — not `network` — and never retried; `AssistantMessage.isApiErrorMessage` is deliberately absent on this class (nothing reached the wire). A base URL with userinfo is refused at brain CONSTRUCTION by `assertBaseUrlWithoutCredentials` (`src/brain/route-adjudicator.ts:91`) in all three factories and in the shared `resolveRequestRoot` for `Model.baseUrl` (rules −2; the message never echoes the password). Structural discriminator, two evidence forms: a transport error carries a `cause` with a connect code, or the `fetch failed` shell sentence; a bare `TypeError` with neither is a build refusal. WHO IS AFFECTED: an operator who saw a ~3-minute retry ladder on a deterministic configuration error (deploy on cli 1.0.121)."
14
+ },
15
+ {
16
+ "id": "F7",
17
+ "source": "behaviorFlips.summary",
18
+ "text": "NARROWING, `Monitor` tool (#938): the shell faces' execute-time canonical recheck (`createShellCanonicalRecheck`, `src/tools/fs/fs-bash.ts`, extracted verbatim from the Bash tool) is mounted on `Monitor` from the same `readBoundary` option; a watch whose established operands resolve outside the roots or onto a deny row is refused as the whole call result before `registerMonitor` (no task_id, no stream), with a pre-spawn cancellation guard. WHO IS AFFECTED: a deployment that watched a symlinked or globbed deny-listed file through Monitor at zero refusals."
19
+ }
20
+ ],
21
+ "closedSetMembers": [
22
+ {
23
+ "set": "FetchThrowClass",
24
+ "at": [
25
+ "src/brain/errors.ts:327"
26
+ ],
27
+ "newSet": true,
28
+ "added": [
29
+ "request_unbuildable",
30
+ "transport"
31
+ ],
32
+ "removed": [],
33
+ "breaking": false,
34
+ "criteriaCovered": false
35
+ }
36
+ ],
37
+ "closedSetsUnreadable": [],
38
+ "typeKeys": [
39
+ {
40
+ "type": "MonitorToolOptions",
41
+ "at": [
42
+ "src/tools/monitor.ts:61"
43
+ ],
44
+ "added": [
45
+ "readBoundary"
46
+ ],
47
+ "removed": [],
48
+ "breaking": false,
49
+ "criteriaCovered": false
50
+ },
51
+ {
52
+ "type": "WorkflowRunSummary",
53
+ "at": [
54
+ "src/core/workflow-run-store.ts:35"
55
+ ],
56
+ "added": [
57
+ "errorCode"
58
+ ],
59
+ "removed": [],
60
+ "breaking": false,
61
+ "criteriaCovered": true
62
+ }
63
+ ],
64
+ "declarationMoves": [
65
+ {
66
+ "name": "PROBE_REASON_MAX",
67
+ "kind": null,
68
+ "onSurface": false,
69
+ "from": [
70
+ "src/core/checkpoint-store.ts"
71
+ ],
72
+ "to": [
73
+ "src/core/checkpoint-store.ts",
74
+ "src/core/untrusted-text.ts"
75
+ ]
76
+ }
77
+ ],
78
+ "mintMoves": [],
79
+ "criteriaObserves": [
80
+ {
81
+ "kind": "taskEventField",
82
+ "name": "tool_end.isError",
83
+ "assertions": [
84
+ "G2.a",
85
+ "G2.b",
86
+ "G4.a",
87
+ "G4.b"
88
+ ]
89
+ },
90
+ {
91
+ "kind": "taskEventField",
92
+ "name": "tool_end.structured",
93
+ "assertions": [
94
+ "G1.b"
95
+ ]
96
+ },
97
+ {
98
+ "kind": "typeMember",
99
+ "name": "PersistedRule.rule",
100
+ "assertions": [
101
+ "G3.a"
102
+ ]
103
+ },
104
+ {
105
+ "kind": "typeMember",
106
+ "name": "ReversibilityVerdict.boundaryDeclined",
107
+ "assertions": [
108
+ "G3.b"
109
+ ]
110
+ },
111
+ {
112
+ "kind": "typeMember",
113
+ "name": "WorkflowRunSummary.errorCode",
114
+ "assertions": [
115
+ "G1.a"
116
+ ]
117
+ }
118
+ ],
119
+ "consumersHint": {
120
+ "cli": [],
121
+ "server": [
122
+ "MonitorToolOptions",
123
+ "WorkflowRunSummary"
124
+ ],
125
+ "sdk": [
126
+ "WorkflowRunSummary"
127
+ ],
128
+ "note": "scanned cli@c38ebaf9 server@3793eaf4 sdk@ace0d09 — a name listed is MENTIONED there today, which is evidence of consumption, not proof of it"
129
+ },
130
+ "breakingCount": 0,
131
+ "breakingItems": [],
132
+ "toResolvedAt": "a11cee1b37ecec0004b3b2e31a6d5d51370dfa52"
133
+ }
@@ -0,0 +1,249 @@
1
+ {
2
+ "repo": "core",
3
+ "version": "7.24.0",
4
+ "from": "6b1dcaefbdd7abf1a39f17d67c3b926a94ddc75f",
5
+ "to": "v7.24.0",
6
+ "added": [
7
+ {
8
+ "name": "displayUrlOf",
9
+ "kind": "function",
10
+ "tier": "advanced",
11
+ "at": [
12
+ "src/brain/route-adjudicator.ts:136",
13
+ "src/index.ts:3207"
14
+ ],
15
+ "criteriaCovered": false,
16
+ "breaking": false
17
+ },
18
+ {
19
+ "name": "resolveRequestRoot",
20
+ "kind": "function",
21
+ "tier": "stable",
22
+ "at": [
23
+ "src/brain/route-adjudicator.ts:230",
24
+ "src/index.ts:3209"
25
+ ],
26
+ "criteriaCovered": false,
27
+ "breaking": false
28
+ },
29
+ {
30
+ "name": "routeKeyOf",
31
+ "kind": "function",
32
+ "tier": "advanced",
33
+ "at": [
34
+ "src/brain/route-adjudicator.ts:96",
35
+ "src/index.ts:3206"
36
+ ],
37
+ "criteriaCovered": false,
38
+ "breaking": false
39
+ }
40
+ ],
41
+ "removed": [
42
+ {
43
+ "name": "normalizeBaseUrl",
44
+ "kind": "function",
45
+ "tier": "advanced",
46
+ "at": [
47
+ "src/brain/route-adjudicator.ts:60",
48
+ "src/index.ts:3206"
49
+ ],
50
+ "breaking": true
51
+ }
52
+ ],
53
+ "changed": [],
54
+ "narrowed": [
55
+ {
56
+ "id": "F1",
57
+ "source": "behaviorFlips.summary",
58
+ "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."
59
+ },
60
+ {
61
+ "id": "F2",
62
+ "source": "behaviorFlips.summary",
63
+ "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."
64
+ },
65
+ {
66
+ "id": "F4",
67
+ "source": "behaviorFlips.summary",
68
+ "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."
69
+ },
70
+ {
71
+ "id": "F5",
72
+ "source": "behaviorFlips.summary",
73
+ "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."
74
+ },
75
+ {
76
+ "id": "F6",
77
+ "source": "behaviorFlips.summary",
78
+ "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."
79
+ },
80
+ {
81
+ "id": "F9",
82
+ "source": "behaviorFlips.summary",
83
+ "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."
84
+ }
85
+ ],
86
+ "closedSetMembers": [],
87
+ "closedSetsUnreadable": [],
88
+ "typeKeys": [
89
+ {
90
+ "type": "PostCompactContext",
91
+ "at": [
92
+ "src/core/hooks.ts:711"
93
+ ],
94
+ "added": [
95
+ "freedTokens"
96
+ ],
97
+ "removed": [],
98
+ "breaking": false,
99
+ "criteriaCovered": true
100
+ },
101
+ {
102
+ "type": "TaskEvent",
103
+ "at": [
104
+ "src/core/task-event.ts:265"
105
+ ],
106
+ "added": [
107
+ "compacted.freedTokens"
108
+ ],
109
+ "removed": [],
110
+ "breaking": false,
111
+ "criteriaCovered": true
112
+ }
113
+ ],
114
+ "declarationMoves": [
115
+ {
116
+ "name": "resolveRequestRoot",
117
+ "kind": "function",
118
+ "onSurface": true,
119
+ "from": [
120
+ "src/brain/route-adjudicator.ts"
121
+ ],
122
+ "to": [
123
+ "src/brain/route-adjudicator.ts",
124
+ "src/index.ts"
125
+ ]
126
+ }
127
+ ],
128
+ "mintMoves": [],
129
+ "criteriaObserves": [
130
+ {
131
+ "kind": "engineNoticeCode",
132
+ "name": "route.base_url_changed_key_unchanged",
133
+ "assertions": [
134
+ "G1.b"
135
+ ]
136
+ },
137
+ {
138
+ "kind": "taskEventField",
139
+ "name": "compacted.freedTokens",
140
+ "assertions": [
141
+ "G2.a"
142
+ ]
143
+ },
144
+ {
145
+ "kind": "taskEventField",
146
+ "name": "task_progress.currentAction",
147
+ "assertions": [
148
+ "G6.a"
149
+ ]
150
+ },
151
+ {
152
+ "kind": "taskEventField",
153
+ "name": "tool_end.errorCode",
154
+ "assertions": [
155
+ "G6.b"
156
+ ]
157
+ },
158
+ {
159
+ "kind": "taskEventField",
160
+ "name": "tool_end.isError",
161
+ "assertions": [
162
+ "G4.a",
163
+ "G6.b"
164
+ ]
165
+ },
166
+ {
167
+ "kind": "taskEventField",
168
+ "name": "tool_end.output",
169
+ "assertions": [
170
+ "G3.b",
171
+ "G6.a"
172
+ ]
173
+ },
174
+ {
175
+ "kind": "taskEventField",
176
+ "name": "tool_end.structured",
177
+ "assertions": [
178
+ "G3.b"
179
+ ]
180
+ },
181
+ {
182
+ "kind": "typeMember",
183
+ "name": "ListAgentsRow.state",
184
+ "assertions": [
185
+ "G3.a"
186
+ ]
187
+ },
188
+ {
189
+ "kind": "typeMember",
190
+ "name": "PostCompactContext.freedTokens",
191
+ "assertions": [
192
+ "G2.b"
193
+ ]
194
+ },
195
+ {
196
+ "kind": "typeMember",
197
+ "name": "RouteRefusalDetail.entryBaseUrl",
198
+ "assertions": [
199
+ "G1.a"
200
+ ]
201
+ },
202
+ {
203
+ "kind": "typeMember",
204
+ "name": "RouteRefusalDetail.fixHint",
205
+ "assertions": [
206
+ "G1.a"
207
+ ]
208
+ },
209
+ {
210
+ "kind": "typeMember",
211
+ "name": "RouteRefusalDetail.requestBaseUrl",
212
+ "assertions": [
213
+ "G1.b"
214
+ ]
215
+ },
216
+ {
217
+ "kind": "typeMember",
218
+ "name": "RunnerDeps.memoryConsolidationDriver",
219
+ "assertions": [
220
+ "G5.a"
221
+ ]
222
+ },
223
+ {
224
+ "kind": "typeMember",
225
+ "name": "RunnerDeps.onError",
226
+ "assertions": [
227
+ "G5.b"
228
+ ]
229
+ },
230
+ {
231
+ "kind": "typeMember",
232
+ "name": "TaskResult.terminal.code",
233
+ "assertions": [
234
+ "G4.b"
235
+ ]
236
+ }
237
+ ],
238
+ "consumersHint": {
239
+ "cli": [],
240
+ "server": [],
241
+ "sdk": [],
242
+ "note": "NOT SCANNED: sema-cli, sema-server, sema-sdk — an empty list for those repos means \"not checked out\", not \"no consumer\""
243
+ },
244
+ "breakingCount": 1,
245
+ "breakingItems": [
246
+ "export removed: normalizeBaseUrl (function)"
247
+ ],
248
+ "toResolvedAt": "f1abe12bc6c9dfcc40b6c68dde97c4b7a201284f"
249
+ }