@sema-agent/mods-kernel 7.59.0 → 7.60.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.
@@ -33,6 +33,7 @@ export type ModDispatchOutcome = {
33
33
  readonly cause: ModFailureCause;
34
34
  readonly reason: string;
35
35
  readonly skipped: readonly ModSkip[];
36
+ readonly bottomStarted?: true;
36
37
  } | {
37
38
  readonly kind: "aborted";
38
39
  readonly bottomStarted?: true;
package/dist/dispatch.js CHANGED
@@ -596,12 +596,12 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
596
596
  throw failure.error;
597
597
  }
598
598
  const reason = caught !== undefined ? `${failure.reason}; ${caught.problem}` : failure.reason;
599
- const effectStands = st.failure === "refuse_until_run" && bottomStarted && state.last !== undefined;
600
- if (refusing && !effectStands) {
601
- if (failure.cause !== "violation")
599
+ const goAheadStands = st.failure === "refuse_until_run" && bottomStarted && state.last !== undefined;
600
+ if (refusing && !goAheadStands) {
601
+ if (failure.cause !== "violation" || bottomStarted)
602
602
  report(new Error(`${name}: ${event}: ${reason} — failed closed: the dispatch ends here`));
603
603
  traceOf(sink, i, name, h.reg.tier, "rejected", ms);
604
- finish({ kind: "failed", registration: name, cause: failure.cause, reason, skipped: Object.freeze([...skipped]) });
604
+ finish({ kind: "failed", registration: name, cause: failure.cause, reason, skipped: Object.freeze([...skipped]), ...(bottomStarted ? { bottomStarted: true } : {}) });
605
605
  throw terminal;
606
606
  }
607
607
  skipped.push(Object.freeze({ registration: name, cause: failure.cause, reason }));
package/dist/events.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const KERNEL_CONTRACT_VERSION = 5;
1
+ export declare const KERNEL_CONTRACT_VERSION = 6;
2
2
  export declare const MOD_TIERS: readonly ["prepend", "user", "append", "builtin", "core"];
3
3
  export type ModTier = (typeof MOD_TIERS)[number];
4
4
  export type ModRegistrationTier = Exclude<ModTier, "builtin" | "core">;
package/dist/events.js CHANGED
@@ -1,4 +1,4 @@
1
- export const KERNEL_CONTRACT_VERSION = 5;
1
+ export const KERNEL_CONTRACT_VERSION = 6;
2
2
  export const MOD_TIERS = Object.freeze(["prepend", "user", "append", "builtin", "core"]);
3
3
  export const MOD_SEATS = Object.freeze(["deployment", "task"]);
4
4
  export const MOD_EVENT_SIDES = Object.freeze(["engine", "surface", "both"]);
@@ -43,6 +43,10 @@ const surface = (s) => Object.freeze(s === undefined ? { side: "surface" } : { s
43
43
  const RENDER_PINNED = ["surface", "component", "requestId", "viewport"];
44
44
  const ELEMENT_PINNED = ["plugin", "element", "component", "requestId", "surface"];
45
45
  const PROMPT_EDIT_BUDGET_MS = 50;
46
+ const AGENT_SPAWN_PINNED = [
47
+ "tool_use_id", "name", "fork", "isTeammate", "workflow", "parentModel", "permissionMode", "parentAgentId", "provider",
48
+ "prompt", "description", "subagentType", "model", "background", "cwd", "identity",
49
+ ];
46
50
  export const MOD_EVENT_TABLE = Object.freeze({
47
51
  "classic.PreToolUse": engine(station("refuse", "immediate", ["tool", "tool_use_id", "agentId", "input"])),
48
52
  "classic.PostToolUse": engine(station("skip", "grace")),
@@ -77,7 +81,7 @@ export const MOD_EVENT_TABLE = Object.freeze({
77
81
  "classic.FileChanged": engine(),
78
82
  "classic.DirectoryAdded": engine(),
79
83
  "classic.MessageDisplay": engine(),
80
- "tool.call": engine(station("refuse_until_run", "immediate", ["tool", "tool_use_id", "agentId", "input"], { call: true })),
84
+ "tool.call": engine(station("refuse", "immediate", ["tool", "tool_use_id", "agentId", "input"], { call: true })),
81
85
  "tool.check": engine(station("refuse", "immediate", ["tool", "input", "tool_use_id", "agentId", "ceiling"])),
82
86
  "ui.render": surface(station("skip", "grace", RENDER_PINNED)),
83
87
  "ui.resolve": surface(station("skip", "grace", ["surface", "component"])),
@@ -88,8 +92,8 @@ export const MOD_EVENT_TABLE = Object.freeze({
88
92
  "ui.fault": surface(),
89
93
  "ui.scroll": surface(station("skip", "grace", ["component", "requestId", "by", "bodyRows", "contentRows", "origin", "pointer"], { call: true })),
90
94
  "ui.focus": surface(station("skip", "grace", ["component", "requestId", "plugin", "origin", "element"], { call: true })),
91
- "agent.offer": engine(),
92
- "agent.spawn": engine(),
95
+ "agent.offer": engine(station("skip", "grace", ["agent", "provider"])),
96
+ "agent.spawn": engine(station("refuse_until_run", "immediate", AGENT_SPAWN_PINNED)),
93
97
  "prompt.submit": engine(),
94
98
  "prompt.fill": surface(station("skip", "grace", ["origin", "mode"], { call: true })),
95
99
  "prompt.suggest": surface(station("skip", "grace", ["origin"], { call: true })),
@@ -117,11 +121,11 @@ export const MOD_EVENT_TABLE = Object.freeze({
117
121
  "session.attach": engine(),
118
122
  "session.detach": engine(),
119
123
  "session.measure": engine(),
120
- "session.end": engine(),
124
+ "session.end": engine(station("skip", "grace", ["reason", "sessionId", "agentId"])),
121
125
  "plugin.register": Object.freeze({ side: "both", station: station("refuse", "immediate", ["name", "seat", "tier", "uses"]) }),
122
126
  "turn.start": engine(),
123
127
  "turn.step": engine(),
124
- "turn.complete": engine(),
128
+ "turn.complete": engine(station("skip", "grace", ["answer", "agentId", "turn"])),
125
129
  "engine.create": engine(),
126
130
  "model.complete": engine(method(true)),
127
131
  "model.classify": engine(),
package/dist/receive.d.ts CHANGED
@@ -8,6 +8,7 @@ export interface ReceiptMode {
8
8
  readonly wire?: true;
9
9
  readonly leaves?: "cloned";
10
10
  readonly isProxy?: (value: object) => boolean;
11
+ readonly live?: readonly string[];
11
12
  }
12
13
  export declare const RECEIPT_FAULTS: readonly ["proxy", "accessor", "hidden", "getter-threw", "prototype-moved", "not-data", "cycle", "too-deep", "uncopyable"];
13
14
  export type ReceiptFaultKind = (typeof RECEIPT_FAULTS)[number];
package/dist/receive.js CHANGED
@@ -336,6 +336,16 @@ export function receive(value, mode, held) {
336
336
  if (f.list && key === "length")
337
337
  continue;
338
338
  captured = f.captured[key];
339
+ if (f.level === 0 && !f.list && mode.live?.includes(key) === true && !Object.hasOwn(captured, "value")) {
340
+ const get = Object.hasOwn(captured, "get") ? captured.get : undefined;
341
+ const holder = f.v;
342
+ const d = Object.create(null);
343
+ d.get = get === undefined ? () => undefined : () => Reflect.apply(get, holder, []);
344
+ d.enumerable = true;
345
+ d.configurable = true;
346
+ DEFINE(f.out, key, d);
347
+ continue;
348
+ }
339
349
  }
340
350
  if (key !== undefined) {
341
351
  path[path.length] = key;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/mods-kernel",
3
- "version": "7.59.0",
3
+ "version": "7.60.0",
4
4
  "private": false,
5
5
  "description": "The sema mods kernel: one extension bus (registration, admission, chain, failure and budget law) shared by the engine and the shell. Zero dependencies.",
6
6
  "type": "module",
@@ -31,5 +31,5 @@
31
31
  "scripts": {
32
32
  "build": "tsc -p tsconfig.json"
33
33
  },
34
- "gitHead": "66b1845c9644930fa7f43fd7c388316c3b060ee1"
34
+ "gitHead": "d3ee177a6006dbf76d7669ee15745d8cad4bca7b"
35
35
  }