@arcforge/types 2.0.170 → 2.0.172

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcforge/types",
3
- "version": "2.0.170",
3
+ "version": "2.0.172",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./src/index.ts",
package/src/scope.ts CHANGED
@@ -21,26 +21,6 @@ export type AxonScopeModule = {
21
21
  description?: string
22
22
  members: readonly AxonScopeMember[]
23
23
  ambientTypes?: readonly string[]
24
- /**
25
- * How these members are ADDRESSED — flat globals, or under `name`.
26
- *
27
- * Derived from the tool's origin at `toScopeModule()`: the agent's own
28
- * src/tools and the shared workspace's are flat, a MODULE's live under the
29
- * module's name, so an installed module cannot claim a bare name in the
30
- * author's scope.
31
- *
32
- * Carried on the scope rather than re-derived by each renderer, because
33
- * three surfaces spell this one decision — the model's `<scope>` block,
34
- * the editor's `tool-globals.d.ts`, and the runtime's actual global
35
- * installation — and they must not be able to disagree. They did: both
36
- * renderers declared every tool flat while the runtime namespaced module
37
- * ones, so the model was told `openPr()` for a function that only ever
38
- * existed as `github.openPr()`.
39
- *
40
- * Optional, defaulting to flat where absent, so a hand-built scope in a
41
- * test need not state it.
42
- */
43
- flat?: boolean
44
24
  }
45
25
 
46
26
  /** The complete TypeScript scope implemented by one live capsule. */
@@ -49,6 +49,21 @@ export type AxonEventContext = {
49
49
  spanId?: string
50
50
  }
51
51
 
52
+ /**
53
+ * The correlation half of the context, as a COMMITTER supplies it.
54
+ *
55
+ * `agentId` and `sessionId` are the session's own identity and are stamped by
56
+ * the writer, so a caller never supplies them. What a caller can know is which
57
+ * request and which logical operation its event belongs to — and those are
58
+ * exactly the two fields that must survive every seam an event crosses.
59
+ *
60
+ * Named here rather than inside the session package because it now travels:
61
+ * a confined agent commits over the supervisor link, and a context that is not
62
+ * part of the wire contract is a context that gets dropped at the boundary.
63
+ * That is not hypothetical — it is the bug this type exists to prevent.
64
+ */
65
+ export type AxonCommitContext = Partial<Pick<AxonEventContext, "runId" | "spanId">>
66
+
52
67
  /**
53
68
  * The envelope. `M` is a registry map (event name → payload shape);
54
69
  * `K` narrows to one event type.
@@ -1,5 +1,6 @@
1
1
  export type {
2
2
  AxonEvent,
3
+ AxonCommitContext,
3
4
  AxonEventContext,
4
5
  AxonEventUnion,
5
6
  AxonIngestedEvent,
package/src/supervisor.ts CHANGED
@@ -2,6 +2,7 @@ import type { AxonEngineRawEvent, AxonEngineRequest } from "./engine"
2
2
  import type { AxonRunResult } from "./kernel/abi"
3
3
  import type { AxonBlueprint } from "./blueprint"
4
4
  import type { AxonEventMap } from "./session/session"
5
+ import type { AxonCommitContext } from "./session/envelope"
5
6
  import type { AxonStimulusEntry } from "./session/events/stdio/stimuli"
6
7
  import type { EscalationCall } from "./policy"
7
8
 
@@ -225,8 +226,16 @@ export type AgentToSupervisor = {
225
226
  * The event NAMES are unchanged (`capsule:*` included) — Fleet folds the
226
227
  * flame graph and the process tree straight out of this stream, so keeping
227
228
  * the vocabulary keeps every existing surface working across the move.
229
+ *
230
+ * `ctx` carries the event's correlation ids across the seam, and is part
231
+ * of this contract rather than of the payload. The agent's kernel mints a
232
+ * spanId per engine call, and start/input/complete are correlated by
233
+ * nothing else — so when this verb could only carry `(type, data)`, moving
234
+ * agents into subprocesses silently un-correlated every span in the
235
+ * system and the Engine view rendered empty for every session. Absent
236
+ * means the committer had no context, never that the wire dropped it.
228
237
  */
229
- commit<K extends keyof AxonEventMap>(type: K, data: AxonEventMap[K]): void
238
+ commit<K extends keyof AxonEventMap>(type: K, data: AxonEventMap[K], ctx?: AxonCommitContext): void
230
239
 
231
240
  /**
232
241
  * Ask a human about one call. Resolves with the verdict.