@sema-agent/server 7.136.0 → 7.138.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 (327) hide show
  1. package/MIGRATION.md +501 -139
  2. package/README.md +1 -0
  3. package/README.zh-CN.md +1 -0
  4. package/USAGE.md +149 -34
  5. package/deploy/sema-up/README.md +14 -0
  6. package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +7 -1
  7. package/deploy/sema-up/stack/sema-stack-cluster.yaml +7 -1
  8. package/dist/approval-card.d.ts +21 -14
  9. package/dist/approval-card.js +1 -0
  10. package/dist/approval-content-kind.d.ts +6 -0
  11. package/dist/approval-content-kind.js +7 -0
  12. package/dist/approval-gate-currency.d.ts +48 -6
  13. package/dist/approval-gate-currency.js +16 -9
  14. package/dist/approval-hmac.d.ts +13 -1
  15. package/dist/approval-hmac.js +1 -1
  16. package/dist/approval.js +3 -3
  17. package/dist/audit.js +1 -0
  18. package/dist/auth-bridge.js +2 -2
  19. package/dist/background-agent-name.d.ts +5 -0
  20. package/dist/background-agent-name.js +5 -0
  21. package/dist/boot/budget-tracing.d.ts +1 -12
  22. package/dist/boot/deployment-mods.d.ts +46 -16
  23. package/dist/boot/deployment-mods.js +82 -6
  24. package/dist/boot/execution-env.d.ts +24 -1
  25. package/dist/boot/execution-env.js +69 -6
  26. package/dist/boot/governance-seams.d.ts +10 -17
  27. package/dist/boot/governance-seams.js +5 -17
  28. package/dist/boot/leader.d.ts +3 -0
  29. package/dist/boot/leader.js +1 -0
  30. package/dist/boot/org-delivery.js +15 -2
  31. package/dist/boot/reapers.d.ts +3 -0
  32. package/dist/boot/reapers.js +15 -1
  33. package/dist/boot/resolve-spec.d.ts +7 -0
  34. package/dist/boot/resolve-spec.js +36 -26
  35. package/dist/boot/retention-lane.d.ts +11 -5
  36. package/dist/boot/retention-lane.js +2 -2
  37. package/dist/boot/runner-deps.d.ts +7 -3
  38. package/dist/boot/runner-deps.js +1 -0
  39. package/dist/boot/stage-03-store-backend.d.ts +1 -1
  40. package/dist/boot/stage-04-stores.d.ts +2 -13
  41. package/dist/boot/stage-05-execution-env.d.ts +6 -13
  42. package/dist/boot/stage-05-execution-env.js +17 -5
  43. package/dist/boot/stage-06-runners.d.ts +6 -13
  44. package/dist/boot/stage-06-runners.js +10 -3
  45. package/dist/boot/stage-07-capability-layer.d.ts +7 -13
  46. package/dist/boot/stage-07-capability-layer.js +3 -3
  47. package/dist/boot/stage-08-reapers.d.ts +7 -13
  48. package/dist/boot/stage-08-reapers.js +2 -1
  49. package/dist/boot/stage-09-leader.d.ts +7 -13
  50. package/dist/boot/stage-09-leader.js +2 -2
  51. package/dist/boot/stage-10-http-server.d.ts +7 -13
  52. package/dist/boot/stage-10-http-server.js +6 -3
  53. package/dist/boot/stores.d.ts +1 -1
  54. package/dist/boot/web-admin.d.ts +5 -2
  55. package/dist/boot/web-admin.js +3 -3
  56. package/dist/brain.js +5 -5
  57. package/dist/broker/broker.d.ts +89 -0
  58. package/dist/broker/broker.js +287 -0
  59. package/dist/broker/constants.d.ts +39 -0
  60. package/dist/broker/constants.js +15 -0
  61. package/dist/broker/http1.d.ts +111 -0
  62. package/dist/broker/http1.js +256 -0
  63. package/dist/broker/lease-book.d.ts +87 -0
  64. package/dist/broker/lease-book.js +142 -0
  65. package/dist/broker/lease-file.d.ts +60 -0
  66. package/dist/broker/lease-file.js +127 -0
  67. package/dist/broker/main.d.ts +2 -0
  68. package/dist/broker/main.js +20 -0
  69. package/dist/budget.d.ts +17 -15
  70. package/dist/budget.js +2 -2
  71. package/dist/capabilities/composite-members.d.ts +2 -1
  72. package/dist/capabilities/composite-members.js +2 -1
  73. package/dist/capabilities/engine-capabilities.js +1 -0
  74. package/dist/capabilities/mcp-probe.d.ts +36 -11
  75. package/dist/capabilities/mcp-probe.js +44 -5
  76. package/dist/capabilities/scenarios.d.ts +23 -8
  77. package/dist/capabilities/scenarios.js +13 -8
  78. package/dist/capabilities/skills.d.ts +28 -5
  79. package/dist/capabilities/skills.js +8 -0
  80. package/dist/capability-facts.d.ts +6 -0
  81. package/dist/capability-facts.js +5 -0
  82. package/dist/center-credential-renewer.js +5 -1
  83. package/dist/checkpoint-ctx-seal-m28.d.ts +3 -10
  84. package/dist/checkpoint-ctx-seal-m28.js +1 -1
  85. package/dist/checkpoint-identity.d.ts +13 -6
  86. package/dist/config-catalog.js +16 -7
  87. package/dist/config-types.d.ts +24 -7
  88. package/dist/config.d.ts +1 -1
  89. package/dist/config.js +42 -13
  90. package/dist/deployment-governance.d.ts +2 -2
  91. package/dist/deployment-governance.js +7 -9
  92. package/dist/deployment-shape.d.ts +6 -6
  93. package/dist/device-ws-protocol.d.ts +1 -0
  94. package/dist/device-ws-protocol.js +2 -1
  95. package/dist/file-history-disclosure.d.ts +4 -2
  96. package/dist/file-history-disclosure.js +2 -0
  97. package/dist/gate-settlement.d.ts +71 -0
  98. package/dist/gate-settlement.js +40 -0
  99. package/dist/hooks/classic-stations.d.ts +12 -54
  100. package/dist/hooks/classic-stations.js +1 -0
  101. package/dist/hooks/command-spawn.d.ts +2 -2
  102. package/dist/hooks/hook-runner.js +14 -14
  103. package/dist/http/admission.js +14 -9
  104. package/dist/http/approval-sweeps.js +4 -3
  105. package/dist/http/caller-trust.d.ts +2 -1
  106. package/dist/http/caller-trust.js +1 -3
  107. package/dist/http/checkpoint-ctx.d.ts +48 -7
  108. package/dist/http/checkpoint-ctx.js +40 -0
  109. package/dist/http/dispatch.d.ts +4 -0
  110. package/dist/http/dispatch.js +18 -10
  111. package/dist/http/durable-run-leg.d.ts +5 -1
  112. package/dist/http/durable-run-leg.js +5 -3
  113. package/dist/http/health-self-report.d.ts +2 -2
  114. package/dist/http/memory-compliance-failure-reply.js +3 -0
  115. package/dist/http/principal-gate.d.ts +15 -10
  116. package/dist/http/principal-gate.js +48 -9
  117. package/dist/http/resume-legs.d.ts +7 -31
  118. package/dist/http/resume-legs.js +185 -126
  119. package/dist/http/route-ctx.d.ts +38 -53
  120. package/dist/http/route-ctx.js +2 -5
  121. package/dist/http/routes/a2a-serve.js +10 -4
  122. package/dist/http/routes/agents-roster.d.ts +1 -1
  123. package/dist/http/routes/agents-roster.js +5 -1
  124. package/dist/http/routes/approvals-assistant.js +24 -10
  125. package/dist/http/routes/capabilities.js +23 -11
  126. package/dist/http/routes/mcp-reconnect.d.ts +3 -2
  127. package/dist/http/routes/mcp-reconnect.js +7 -7
  128. package/dist/http/routes/memory-consolidation.d.ts +1 -1
  129. package/dist/http/routes/memory-origin.d.ts +1 -1
  130. package/dist/http/routes/rules.js +3 -3
  131. package/dist/http/routes/runs.js +13 -8
  132. package/dist/http/routes/session-sync.js +42 -6
  133. package/dist/http/routes/sessions.js +6 -3
  134. package/dist/http/routes/side-query.js +2 -3
  135. package/dist/http/routes/tasks.js +794 -780
  136. package/dist/http/server.d.ts +35 -25
  137. package/dist/http/stored-body-replay.d.ts +3 -3
  138. package/dist/http/stored-body-replay.js +6 -1
  139. package/dist/http/wire-types.d.ts +66 -33
  140. package/dist/identity-source.d.ts +65 -0
  141. package/dist/identity-source.js +45 -0
  142. package/dist/index.d.ts +2 -0
  143. package/dist/index.js +1 -0
  144. package/dist/leader/wire.d.ts +7 -0
  145. package/dist/leader/wire.js +5 -4
  146. package/dist/mcp-assertion-header.d.ts +51 -40
  147. package/dist/mcp-assertion-header.js +10 -11
  148. package/dist/mcp-authorization-face.d.ts +27 -0
  149. package/dist/mcp-authorization-face.js +15 -0
  150. package/dist/memory-operator-faces.d.ts +13 -4
  151. package/dist/memory-operator-faces.js +1 -17
  152. package/dist/memory-store-refusal.d.ts +3 -3
  153. package/dist/memory-sync-client.js +72 -57
  154. package/dist/memory-sync.d.ts +1 -1
  155. package/dist/model-entry-refusal.d.ts +2 -0
  156. package/dist/model-entry-refusal.js +11 -0
  157. package/dist/model-route-gap.d.ts +6 -22
  158. package/dist/model-route-gap.js +7 -5
  159. package/dist/model-select.d.ts +6 -17
  160. package/dist/model-select.js +0 -3
  161. package/dist/mods-declaration.d.ts +110 -0
  162. package/dist/mods-declaration.js +109 -0
  163. package/dist/namespaced-rule-name.d.ts +1 -1
  164. package/dist/observability/err-text.d.ts +5 -0
  165. package/dist/observability/err-text.js +9 -0
  166. package/dist/observability/fail-open.d.ts +17 -1
  167. package/dist/observability/fail-open.js +17 -1
  168. package/dist/observability/metrics.js +1 -1
  169. package/dist/observability/run-terminal.js +1 -0
  170. package/dist/observability/secret-env-scrub.d.ts +1 -1
  171. package/dist/observability/secret-env-scrub.js +1 -1
  172. package/dist/operator-ask.d.ts +2 -2
  173. package/dist/org-delivery-gate.js +1 -1
  174. package/dist/org-memory-admission.d.ts +2 -2
  175. package/dist/org-memory-admission.js +39 -2
  176. package/dist/parked-decide.d.ts +15 -2
  177. package/dist/parked-decide.js +17 -10
  178. package/dist/peer-directory.js +2 -0
  179. package/dist/peer-seat.d.ts +150 -0
  180. package/dist/peer-seat.js +239 -0
  181. package/dist/permission-rule-list.d.ts +2 -2
  182. package/dist/permission-rule-vocab.d.ts +7 -7
  183. package/dist/permission-rule-vocab.js +3 -3
  184. package/dist/plain-string-record.d.ts +38 -0
  185. package/dist/plain-string-record.js +38 -0
  186. package/dist/plugins/background-agent-store-sql.js +6 -3
  187. package/dist/plugins/caching-session-store.d.ts +5 -0
  188. package/dist/plugins/caching-session-store.js +6 -0
  189. package/dist/plugins/checkpoint-store-sql.d.ts +34 -29
  190. package/dist/plugins/checkpoint-store-sql.js +14 -14
  191. package/dist/plugins/file-history-store-sql.js +10 -16
  192. package/dist/plugins/file-run-store.js +8 -2
  193. package/dist/plugins/k8s-exec-protocol.d.ts +69 -13
  194. package/dist/plugins/k8s-exec-protocol.js +116 -28
  195. package/dist/plugins/k8s-pod-delete-failure.d.ts +25 -0
  196. package/dist/plugins/k8s-pod-delete-failure.js +17 -0
  197. package/dist/plugins/k8s-pod-reaper.d.ts +106 -0
  198. package/dist/plugins/k8s-pod-reaper.js +122 -0
  199. package/dist/plugins/local-checkpoint-store.d.ts +4 -17
  200. package/dist/plugins/local-checkpoint-store.js +3 -4
  201. package/dist/plugins/local-session-store.d.ts +66 -27
  202. package/dist/plugins/local-session-store.js +60 -28
  203. package/dist/plugins/mailbox-store-sql.d.ts +11 -3
  204. package/dist/plugins/mailbox-store-sql.js +103 -15
  205. package/dist/plugins/memory-run-store.js +2 -0
  206. package/dist/plugins/memory-sync-store-pg.d.ts +16 -5
  207. package/dist/plugins/memory-sync-store-tidb.d.ts +3 -3
  208. package/dist/plugins/one-time-migrations.d.ts +34 -12
  209. package/dist/plugins/one-time-migrations.js +51 -9
  210. package/dist/plugins/permission-rule-store-file.js +2 -2
  211. package/dist/plugins/permission-rule-store-sql.d.ts +17 -17
  212. package/dist/plugins/permission-rule-store-sql.js +37 -30
  213. package/dist/plugins/pg-pool.js +4 -0
  214. package/dist/plugins/pg-session-storage.d.ts +10 -2
  215. package/dist/plugins/pg-session-storage.js +20 -7
  216. package/dist/plugins/remote-env-adb.d.ts +6 -1
  217. package/dist/plugins/remote-env-adb.js +2 -1
  218. package/dist/plugins/remote-env-device.d.ts +6 -1
  219. package/dist/plugins/remote-env-device.js +5 -1
  220. package/dist/plugins/remote-env-e2b.d.ts +5 -0
  221. package/dist/plugins/remote-env-e2b.js +2 -1
  222. package/dist/plugins/remote-env-file-error.d.ts +8 -1
  223. package/dist/plugins/remote-env-file-error.js +7 -1
  224. package/dist/plugins/remote-env-host.d.ts +10 -2
  225. package/dist/plugins/remote-env-host.js +8 -2
  226. package/dist/plugins/remote-env-k8s.d.ts +140 -11
  227. package/dist/plugins/remote-env-k8s.js +277 -15
  228. package/dist/plugins/remote-env-local-docker.d.ts +5 -0
  229. package/dist/plugins/remote-env-local-docker.js +2 -1
  230. package/dist/plugins/remote-env-ssh.d.ts +6 -1
  231. package/dist/plugins/remote-env-ssh.js +2 -1
  232. package/dist/plugins/retention-store-sql.d.ts +14 -2
  233. package/dist/plugins/retention-store-sql.js +6 -0
  234. package/dist/plugins/run-store-sql.js +10 -4
  235. package/dist/plugins/session-fork.d.ts +10 -13
  236. package/dist/plugins/session-fork.js +5 -25
  237. package/dist/plugins/session-ownership.d.ts +24 -3
  238. package/dist/plugins/session-ownership.js +24 -5
  239. package/dist/plugins/session-workspace-cell.d.ts +17 -0
  240. package/dist/plugins/session-workspace-cell.js +38 -0
  241. package/dist/plugins/sql-errors.d.ts +23 -2
  242. package/dist/plugins/sql-errors.js +15 -0
  243. package/dist/plugins/store-backend.js +7 -7
  244. package/dist/plugins/store-contracts.d.ts +10 -1
  245. package/dist/plugins/store-fault.d.ts +2 -2
  246. package/dist/plugins/store-fault.js +4 -2
  247. package/dist/plugins/tidb-pool.js +13 -0
  248. package/dist/plugins/tidb-session-store.d.ts +17 -2
  249. package/dist/plugins/tidb-session-store.js +18 -7
  250. package/dist/plugins/tool-result-store-sql.d.ts +13 -6
  251. package/dist/plugins/tool-result-store-sql.js +8 -7
  252. package/dist/plugins/worktree-isolation.d.ts +3 -2
  253. package/dist/plugins/worktree-isolation.js +1 -7
  254. package/dist/project-identity.d.ts +1 -14
  255. package/dist/project-identity.js +0 -4
  256. package/dist/request-key-closure.js +1 -1
  257. package/dist/request-value-closure.d.ts +31 -2
  258. package/dist/request-value-closure.js +7 -1
  259. package/dist/rule-entry-list.d.ts +3 -2
  260. package/dist/rule-entry-list.js +2 -2
  261. package/dist/rules-consent.js +12 -7
  262. package/dist/run-local.d.ts +2 -2
  263. package/dist/run-local.js +12 -6
  264. package/dist/runs.d.ts +7 -1
  265. package/dist/runs.js +8 -2
  266. package/dist/runtime-governance.d.ts +5 -5
  267. package/dist/sandbox-git-lease.d.ts +49 -0
  268. package/dist/sandbox-git-lease.js +60 -0
  269. package/dist/sandbox-git-plane.d.ts +84 -0
  270. package/dist/sandbox-git-plane.js +105 -0
  271. package/dist/security.d.ts +16 -4
  272. package/dist/security.js +8 -3
  273. package/dist/server-secret-env.d.ts +12 -3
  274. package/dist/server-secret-env.js +18 -2
  275. package/dist/session-error-wire.d.ts +14 -6
  276. package/dist/session-error-wire.js +2 -1
  277. package/dist/session-incarnation.d.ts +4 -5
  278. package/dist/session-incarnation.js +2 -2
  279. package/dist/session-policy-wire.d.ts +1 -1
  280. package/dist/session-policy-wire.js +2 -2
  281. package/dist/session-sync.d.ts +1 -1
  282. package/dist/session-workspace.d.ts +130 -0
  283. package/dist/session-workspace.js +83 -0
  284. package/dist/spec-fields.d.ts +44 -14
  285. package/dist/spec-fields.js +33 -12
  286. package/dist/standing-answer-grant.d.ts +2 -13
  287. package/dist/standing-answer-grant.js +0 -7
  288. package/dist/stored-request-prompt-profile-m30.d.ts +49 -0
  289. package/dist/stored-request-prompt-profile-m30.js +25 -0
  290. package/dist/task-a2a.d.ts +44 -14
  291. package/dist/task-a2a.js +46 -20
  292. package/dist/task-mcp.d.ts +34 -21
  293. package/dist/task-mcp.js +46 -22
  294. package/dist/task-settings.d.ts +2 -2
  295. package/dist/tool-approval.d.ts +43 -9
  296. package/dist/tool-approval.js +57 -15
  297. package/dist/tool-rule-names.d.ts +5 -0
  298. package/dist/trace/core-keyset-guard.d.ts +34 -19
  299. package/dist/trace/engine-notice-wire.d.ts +1 -1
  300. package/dist/trace/engine-notice-wire.js +4 -0
  301. package/dist/trace/exit-seat.d.ts +20 -1
  302. package/dist/trace/exit-seat.js +5 -2
  303. package/dist/trace/extension-call-face.d.ts +33 -0
  304. package/dist/trace/extension-call-face.js +39 -0
  305. package/dist/trace/ledger-sink.d.ts +4 -5
  306. package/dist/trace/ledger-sink.js +3 -7
  307. package/dist/trace/project.d.ts +62 -10
  308. package/dist/trace/project.js +49 -9
  309. package/dist/trace/redact.d.ts +18 -6
  310. package/dist/trace/redact.js +154 -60
  311. package/dist/trace/self-minted-wire.d.ts +500 -7
  312. package/dist/trace/self-minted-wire.js +182 -1
  313. package/dist/trace/wire-projection-faces.d.ts +7 -5
  314. package/dist/trace/wire-projection-faces.js +9 -4
  315. package/dist/user-authored-text.d.ts +2 -2
  316. package/dist/user-authored-text.js +16 -1
  317. package/dist/web-admin-client/apply-effective.js +0 -1
  318. package/dist/web-admin-client/center-request.d.ts +23 -4
  319. package/dist/web-admin-client/center-request.js +42 -8
  320. package/dist/web-admin-client/http-client.js +6 -6
  321. package/dist/web-admin-client/skills-mcp.d.ts +8 -4
  322. package/dist/web-admin-client/skills-mcp.js +31 -18
  323. package/dist/web-admin-client/types.d.ts +10 -5
  324. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +11 -5
  325. package/package.json +3 -3
  326. package/wire-changes/server@7.137.0.json +825 -0
  327. package/wire-changes/server@7.138.0.json +446 -0
@@ -10,7 +10,10 @@ import { injectionTierOrAbsent } from "./injection-tier.js";
10
10
  import { semaProvenanceOrAbsent } from "./sema-provenance.js";
11
11
  import { resupplyFields, terminalFrameFacetFields } from "./task-notification-facets.js";
12
12
  import { dropProjectedFace } from "./projection-drop.js";
13
+ import { extensionAnswererOf, extensionRequesterOf, toolInputRewriteOf } from "./extension-call-face.js";
13
14
  import { projectByTable } from "./projection-table.js";
15
+ import { durableRowIdentity } from "../checkpoint-identity.js";
16
+ import { projectMcpAuthorization } from "../mcp-authorization-face.js";
14
17
  export async function appendModelUsageDelta(append, modelUsage, taskId) {
15
18
  const delta = modelUsage?.drain(taskId);
16
19
  if (delta) {
@@ -94,13 +97,18 @@ function identityKey(v) {
94
97
  export function modelTextEventData(ev) {
95
98
  return { text: ev.text, ...(ev.eventId ? { eventId: ev.eventId } : {}) };
96
99
  }
100
+ function toolArgsOnWire(args) {
101
+ return redactDeep(args);
102
+ }
97
103
  export function toolStartEventData(ev) {
104
+ const requestedBy = extensionRequesterOf(ev.requestedBy, "tool_start");
98
105
  return {
99
106
  toolCallId: ev.toolCallId,
100
107
  toolName: ev.toolName,
101
108
  ...(ev.label !== undefined ? { label: ev.label } : {}),
102
- args: redactDeep(ev.args),
109
+ args: toolArgsOnWire(ev.args),
103
110
  ...(ev.recovered === true ? { recovered: true } : {}),
111
+ ...(requestedBy !== undefined ? { requestedBy } : {}),
104
112
  ...identityFields(ev),
105
113
  };
106
114
  }
@@ -165,6 +173,7 @@ function screenedGateOrThrow(v) {
165
173
  ...(d.mode === undefined ? {} : { mode: d.mode }),
166
174
  ...(d.askClass === undefined ? {} : { askClass: d.askClass }),
167
175
  ...(d.classes === undefined ? {} : { classes: [...d.classes] }),
176
+ ...(d.extension === undefined ? {} : { extension: seatText("trace-frame-text", d.extension) }),
168
177
  }
169
178
  : { kind: "allowed", ...(classifier === undefined ? {} : { classifier }), ...(released === undefined ? {} : { released }), ...(clearedBy === undefined ? {} : { clearedBy }) },
170
179
  ...(settlement === undefined ? {} : { settlement }),
@@ -224,6 +233,9 @@ export function reasoningEndEventData(ev) {
224
233
  }
225
234
  export function toolEndEventData(ev) {
226
235
  const gate = ev.gate === undefined ? undefined : screenedGate(ev.gate);
236
+ const answeredBy = extensionAnswererOf(ev.answeredBy, "tool_end");
237
+ const requestedBy = extensionRequesterOf(ev.requestedBy, "tool_end");
238
+ const rewrite = toolInputRewriteOf(ev.rewrite, "tool_end", toolArgsOnWire);
227
239
  return {
228
240
  toolCallId: ev.toolCallId,
229
241
  toolName: ev.toolName,
@@ -239,6 +251,9 @@ export function toolEndEventData(ev) {
239
251
  ...(typeof ev.gatedCallId === "string" && ev.gatedCallId !== "" ? { gatedCallId: ev.gatedCallId } : {}),
240
252
  ...(typeof ev.wireName === "string" && ev.wireName !== "" ? { wireName: ev.wireName } : {}),
241
253
  ...(ev.notExecuted === true ? { notExecuted: true } : {}),
254
+ ...(answeredBy !== undefined ? { answeredBy } : {}),
255
+ ...(requestedBy !== undefined ? { requestedBy } : {}),
256
+ ...(rewrite !== undefined ? { rewrite } : {}),
242
257
  ...identityFields(ev),
243
258
  };
244
259
  }
@@ -292,6 +307,16 @@ export function taskProgressEventData(ev) {
292
307
  ...identityFields(ev),
293
308
  };
294
309
  }
310
+ export function parkEventData(result, reopened) {
311
+ const r = (result ?? {});
312
+ const paused = r.terminal?.kind === "paused" ? r.terminal : undefined;
313
+ return {
314
+ gate: paused !== undefined ? paused.gate : null,
315
+ ...(typeof r.toolCallId === "string" ? { toolCallId: r.toolCallId } : {}),
316
+ ...(paused !== undefined ? durableRowIdentity("run-events-park", paused.checkpointId, paused.token) : {}),
317
+ ...(reopened !== undefined ? { reopened } : {}),
318
+ };
319
+ }
295
320
  export function taskStartedEventData(ev) {
296
321
  return {
297
322
  taskId: ev.taskId,
@@ -445,6 +470,7 @@ export function projectWiringManifestMcpRows(mcpIn) {
445
470
  ...(str(e.errorCode) !== undefined ? { errorCode: e.errorCode } : {}),
446
471
  ...(typeof e.delivered === "string" && MCP_DELIVERY_VERDICTS.includes(e.delivered) ? { delivered: e.delivered } : {}),
447
472
  ...(num(e.httpStatus) !== undefined ? { httpStatus: e.httpStatus } : {}),
473
+ ...((a) => (a !== undefined ? { authorization: a } : {}))(projectMcpAuthorization(e.authorization)),
448
474
  ...(liveness !== undefined ? { liveness } : {}),
449
475
  });
450
476
  }
@@ -460,7 +486,7 @@ export function toolRosterDeltaEventData(ev) {
460
486
  export const WIRING_SESSION_RULES_DISPOSITIONS = {
461
487
  childrenReadLive: { forward: (raw) => typeof raw === "boolean" },
462
488
  };
463
- export function wiringManifestEventData(ev, instructions) {
489
+ export function wiringManifestEventData(ev, minted) {
464
490
  const str = (v) => (typeof v === "string" && v.length > 0 ? v : undefined);
465
491
  const bool = (v) => (typeof v === "boolean" ? v : undefined);
466
492
  const num = (v) => (typeof v === "number" && Number.isFinite(v) ? v : undefined);
@@ -559,10 +585,11 @@ export function wiringManifestEventData(ev, instructions) {
559
585
  dropProjectedFace("wiring_manifest.mods[] row is missing name/seat/tier");
560
586
  continue;
561
587
  }
588
+ const provenance = e.provenance === undefined ? undefined : (registrantText(e.provenance) ?? dropProjectedFace("wiring_manifest.mods[].provenance is not a string"));
562
589
  const refusedBy = registrantText(e.refusedBy);
563
590
  const reason = registrantText(e.reason);
564
591
  if (refusedBy !== undefined && reason !== undefined) {
565
- rows.push({ name, seat, tier, refusedBy, reason });
592
+ rows.push({ name, seat, tier, ...(provenance !== undefined ? { provenance } : {}), refusedBy, reason });
566
593
  continue;
567
594
  }
568
595
  const events = strList(e.events);
@@ -586,7 +613,7 @@ export function wiringManifestEventData(ev, instructions) {
586
613
  return [{ registration, cause, reason: why }];
587
614
  })
588
615
  : dropProjectedFace("wiring_manifest.mods[].skipped is not an array");
589
- rows.push({ name, seat, tier, events, ...(observe !== undefined ? { observe } : {}), ...(skipped !== undefined && skipped.length > 0 ? { skipped } : {}) });
616
+ rows.push({ name, seat, tier, ...(provenance !== undefined ? { provenance } : {}), events, ...(observe !== undefined ? { observe } : {}), ...(skipped !== undefined && skipped.length > 0 ? { skipped } : {}) });
590
617
  }
591
618
  return rows.length > 0 ? rows : undefined;
592
619
  })();
@@ -695,12 +722,15 @@ export function wiringManifestEventData(ev, instructions) {
695
722
  ...(lsp !== undefined ? { lsp } : {}),
696
723
  ...(hands !== undefined ? { hands } : {}),
697
724
  ...(writeProtection !== undefined ? { writeProtection } : {}),
698
- ...(instructions !== undefined ? { instructions: { selected: [...instructions.selected] } } : {}),
725
+ ...(minted.instructions !== undefined ? { instructions: { selected: [...minted.instructions.selected] } } : {}),
726
+ ...(minted.skills !== undefined && typeof ev.parentToolCallId !== "string"
727
+ ? { skills: minted.skills.map((e) => ({ name: e.name, description: sanitizeWireText(e.description), source: e.source })) }
728
+ : {}),
699
729
  ...identityFields(ev),
700
730
  };
701
731
  }
702
- export function wiringManifestOperatorEventData(ev, instructions) {
703
- const tenant = wiringManifestEventData(ev, instructions);
732
+ export function wiringManifestOperatorEventData(ev, minted) {
733
+ const tenant = wiringManifestEventData(ev, minted);
704
734
  const str = (v) => (typeof v === "string" && v.length > 0 ? v : undefined);
705
735
  const bool = (v) => (typeof v === "boolean" ? v : undefined);
706
736
  const sec = (v) => (typeof v === "object" && v !== null && !Array.isArray(v) ? { ...v } : undefined);
@@ -744,8 +774,8 @@ export function wiringManifestOperatorEventData(ev, instructions) {
744
774
  ...(str(m.configFingerprint) !== undefined ? { configFingerprint: m.configFingerprint } : {}),
745
775
  };
746
776
  }
747
- export function wiringManifestFaceEventData(ev, operatorFace, instructions) {
748
- return operatorFace ? wiringManifestOperatorEventData(ev, instructions) : wiringManifestEventData(ev, instructions);
777
+ export function wiringManifestFaceEventData(ev, operatorFace, minted) {
778
+ return operatorFace ? wiringManifestOperatorEventData(ev, minted) : wiringManifestEventData(ev, minted);
749
779
  }
750
780
  export function humanInputEventData(ev) {
751
781
  const str = (v) => (typeof v === "string" && v.length > 0 ? v : undefined);
@@ -790,6 +820,8 @@ export function brainStatusEventData(ev) {
790
820
  ...(num(ev.retryAtMs) ? { retryAtMs: ev.retryAtMs } : {}),
791
821
  ...(num(ev.elapsedMs) ? { elapsedMs: ev.elapsedMs } : {}),
792
822
  ...(num(ev.timeoutMs) ? { timeoutMs: ev.timeoutMs } : {}),
823
+ ...(typeof ev.waitSegment === "string" && ev.waitSegment.length > 0 ? { waitSegment: ev.waitSegment } : {}),
824
+ ...(num(ev.sleptMs) ? { sleptMs: ev.sleptMs } : {}),
793
825
  ...(num(ev.errorStatus) ? { errorStatus: ev.errorStatus } : {}),
794
826
  ...(typeof ev.errClass === "string" && ev.errClass.length > 0 ? { errClass: ev.errClass } : {}),
795
827
  ...(typeof ev.providerCondition === "string" && ev.providerCondition.length > 0 ? { providerCondition: ev.providerCondition } : {}),
@@ -915,17 +947,22 @@ export function toContractTokens(usage, usageMissing) {
915
947
  };
916
948
  }
917
949
  export function toolCallFieldsOf(d) {
950
+ const requestedBy = extensionRequesterOf(d.requestedBy, "tool_start row");
918
951
  return {
919
952
  id: String(d.toolCallId ?? ""),
920
953
  name: String(d.toolName ?? ""),
921
954
  ...(typeof d.label === "string" ? { label: d.label } : {}),
922
955
  input: d.args,
923
956
  ...(d.recovered === true ? { recovered: true } : {}),
957
+ ...(requestedBy !== undefined ? { requestedBy } : {}),
924
958
  ...identityFields(d),
925
959
  };
926
960
  }
927
961
  export function toolResultFieldsOf(d) {
928
962
  const gate = d.gate === undefined ? undefined : screenedGate(d.gate);
963
+ const answeredBy = extensionAnswererOf(d.answeredBy, "tool_end row");
964
+ const requestedBy = extensionRequesterOf(d.requestedBy, "tool_end row");
965
+ const rewrite = toolInputRewriteOf(d.rewrite, "tool_end row", toolArgsOnWire);
929
966
  return {
930
967
  callId: String(d.toolCallId ?? ""),
931
968
  ...(typeof d.label === "string" ? { label: d.label } : {}),
@@ -938,6 +975,9 @@ export function toolResultFieldsOf(d) {
938
975
  ...(typeof d.gatedCallId === "string" && d.gatedCallId !== "" ? { gatedCallId: d.gatedCallId } : {}),
939
976
  ...(typeof d.wireName === "string" && d.wireName !== "" ? { wireName: d.wireName } : {}),
940
977
  ...(d.notExecuted === true ? { notExecuted: true } : {}),
978
+ ...(answeredBy !== undefined ? { answeredBy } : {}),
979
+ ...(requestedBy !== undefined ? { requestedBy } : {}),
980
+ ...(rewrite !== undefined ? { rewrite } : {}),
941
981
  ...identityFields(d),
942
982
  };
943
983
  }
@@ -126,19 +126,31 @@ export declare function setRedactionObserver(fn: ((patternLabel: string, count:
126
126
  */
127
127
  export type RedactionLayout = "multi-line" | "single-line";
128
128
  /**
129
- * 一段文本相对「它所在的那一整段」的**范围**(闭集两词;调用方对自己交来的文本的陈述,不是旋钮):
129
+ * 一段文本相对「它所在的那一整段」的**范围**(闭集两形;调用方对自己交来的文本的陈述,不是旋钮):
130
130
  * · `whole`:这就是全部。所有「见收尾才认」的结构臂走到末尾仍没见收尾 ⇒ 这一起点不成 —— 判据 = 声明正则(`test/trace-redact.test.ts` 的真值表钉着扫描器与声明正则逐跨度等价);
131
- * · `head`:这只是更长文本的头一段(出口座对有界行只扫一段头,见 `trace/exit-seat.ts` 的扫描窗)。**一条律:结构的判定走到这一段末尾还没走完 ⇒ 判定在更远处(未决)⇒ 从结构起点遮到这一段的末尾**
132
- * (fail-closed:起点在、判定要看窗外,明文不许出门)。未决只有两种,同读一条臂:
131
+ * · `head`:这只是更长文本的头一段(出口座对有界行只扫一段头,见 `trace/exit-seat.ts` 的扫描窗),并带 **`emitEnd`** —— 调用方真会往外交的那一段的终点(**原文下标**;出口座的出门区终点,
132
+ * 其后的窗内余量只喂脱敏器、不出门)。窗几何只有调用方知道,脱敏器不猜、不抄第二份。**一条律,所有臂同读:结构的判定走到这一段末尾还没走完 ⇒ 判定在更远处(未决)⇒ 从结构起点遮到这一段的末尾
133
+ * (fail-closed:起点在、判定要看窗外,明文不许出门);而未决尾只在它的起点 `< emitEnd` 时才算** —— 起点在余量里的,对出门字节零作用(出门的至多到 `emitEnd`;余量只喂脱敏器、不出门,
134
+ * 其后的原文也不再被扫):不产跨度、不记 `redactions_applied_total`、不参与解重叠、也不参与档位盖章(候选不存在,所以不盖住也不截断别的候选)。取舍在池收尾的一处({@link armPool}:收集之后、解重叠之前;读的是臂收上来的原始起点,经 {@link StartReach} 问回原文下标),
135
+ * 臂自己只管把未决那一支标出来({@link SecretSpan.undecided})。
136
+ * 未决只有两种,同读一条臂:
133
137
  * ① **收尾没见到** —— JSON 串值(要收尾引号)· URL authority(要 `@`;authority 一路走到末尾没有 `/` / 空白,里面有没有 `@` 都读成还在 userinfo 里)·
134
138
  * SSH2 / PEM 栅栏(要收尾栅栏)· 带引号的强锚值(要收尾引号)· PuTTY 容器(终止符之后到末尾没见下一个版本头);
135
139
  * ② **起头没读完**(起头本身不设长度上界,起点可以离末尾很远)—— PEM 起始栅栏行(标签之后到末尾一枚 `-----` 都没有,已读到的部分也还可能是合法栅栏行的前缀)· PuTTY 版本头(`<数字串>: ` 没写完)·
136
- * 无头 .ppk 字段(`Private-Lines: <数字串>` 之后下一个体行的判定没走完)。
140
+ * 无头 .ppk 字段(`Private-Lines: <数字串>` 之后下一个体行的判定没走完)· 词法关键字臂(`Bearer` / `Basic` / `token`)的起头(完整关键字之后跟着不设长度上界的分隔段、值被窗尾切在窗外,见 {@link undecidedKeywordStart};
141
+ * 关键字写了一半 / 关键字紧贴值的起点离窗尾至多几十个字符,不另立一支)。
137
142
  * PuTTY 容器臂的「无合格终止 ⇒ 吃到输入末尾」本来就是这一律在整段文本上的形,两种范围都吃到末尾;区别只在留痕 —— 整段读法上它是兜底(记 `server.redact.ppk-eat-to-end`),
138
143
  * head 读法上终止可能在更远处,是未决(不记)。**未决一律不记 fail-open**:它是这一律的正常读数,不是回退;
139
- * 由裸形 / 关键字 / 查询参数 / 环境变量赋值等**不靠收尾**的臂认出的凭据(值到字符类的自然右界)两种范围读法逐字相同。
144
+ * 由裸形 / 关键字 / 查询参数 / 环境变量赋值等**不靠收尾**的臂认出的凭据(值到字符类的自然右界)两种范围读法逐字相同;关键字臂只多上面 ② 里那一条未决尾。
140
145
  */
141
- export type RedactionExtent = "whole" | "head";
146
+ export type RedactionExtent = {
147
+ readonly kind: "whole";
148
+ } | {
149
+ readonly kind: "head";
150
+ readonly emitEnd: number;
151
+ };
152
+ /** 整段读法(`RedactionExtent` 的 `whole` 形;不带数据,一个值)。 */
153
+ export declare const WHOLE_EXTENT: RedactionExtent;
142
154
  /**
143
155
  * 🔴 **出口座扫描窗的单位 = 读法单元,不是原始码元**(修复验证腿 high ①):从 `from`(缺省 0)起数 `units` 个**读法单元**(各读法里最少的那一读 —— 删得最多的 —— 剩下的码元),
144
156
  * 返回原文里的终点(含 `≥ units` 个读法单元的前缀,至多是最短那一个的两倍;文本不够长 ⇒ `text.length`)。格式字符 / 控制字符 / 转义写法的不可见字符不计数:它们在读法格里被删,