@sema-agent/mods-kernel 7.65.0 → 7.66.1

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.
@@ -8,6 +8,7 @@ export type ModFrame = {
8
8
  readonly kind: "handler";
9
9
  readonly plugin: string;
10
10
  readonly handler: number;
11
+ readonly event: ModEventName;
11
12
  };
12
13
  export interface ModBottomContext {
13
14
  readonly frames: readonly ModFrame[];
package/dist/dispatch.js CHANGED
@@ -2,6 +2,9 @@ import { CATCH_BUDGET_MS, createSelfBudget, POST_ABORT_GRACE_MS, RUNAWAY_AFTER_M
2
2
  import { expandOnSide, failureRefuses, isModEventName, MOD_SEATS, nextToRefusal, stationOn } from "./events.js";
3
3
  import { ENGINE_ORIGIN, modsInvalid, screenModSeats, } from "./registration.js";
4
4
  import { answerUpward, answerViolation, detachedCopy, engineObjectsOnce, handedOn, handOnViolation, matcherMatches, matcherViolation, methodAnswerViolation, NEXT_IN_FLIGHT, receiveAnswer, receiveEvent, receivePayload, sealedObjects, } from "./site-rules.js";
5
+ function handlerFrame(below, plugin, handler, event) {
6
+ return Object.freeze([...below, Object.freeze({ kind: "handler", plugin, handler, event })]);
7
+ }
5
8
  const TIER_RANK = { prepend: 0, user: 1, append: 2, builtin: 3, core: 4 };
6
9
  const bypassed = (floors, tier) => floors.some((f) => TIER_RANK[f.from] < TIER_RANK[tier] && TIER_RANK[tier] < TIER_RANK[f.to]);
7
10
  export async function admitMods(input) {
@@ -501,7 +504,7 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
501
504
  live.add(ac);
502
505
  const budgetMs = ownMs(h.reg.budgetMs);
503
506
  const budget = createSelfBudget(budgetMs, () => ac.abort(new Error(`${name} ran past its ${budgetMs}ms budget`)));
504
- const myFrames = Object.freeze([...fr, Object.freeze({ kind: "handler", plugin: name, handler: h.index })]);
507
+ const myFrames = handlerFrame(fr, name, h.index, event);
505
508
  const state = {
506
509
  pending: 0,
507
510
  called: false,
@@ -672,7 +675,7 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
672
675
  live.add(ac);
673
676
  const budgetMs = ownMs(h.reg.budgetMs);
674
677
  const budget = createSelfBudget(budgetMs, () => ac.abort(new Error(`${name} ran past its ${budgetMs}ms budget`)));
675
- const myFrames = Object.freeze([...fr, Object.freeze({ kind: "handler", plugin: name, handler: h.index })]);
678
+ const myFrames = handlerFrame(fr, name, h.index, event);
676
679
  const refuse = () => Promise.reject(new Error(`${name}: an observe handler is not in the chain; next() is unavailable`));
677
680
  const next = makeNext({ budget, signal: ac.signal, trace: () => Object.freeze([]) }, refuse, refuse);
678
681
  const verdict = (r) => {
package/dist/events.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const KERNEL_CONTRACT_VERSION = 8;
1
+ export declare const KERNEL_CONTRACT_VERSION = 9;
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 = 8;
1
+ export const KERNEL_CONTRACT_VERSION = 9;
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"]);
@@ -94,7 +94,7 @@ export const MOD_EVENT_TABLE = Object.freeze({
94
94
  "ui.focus": surface(station("skip", "grace", ["component", "requestId", "plugin", "origin", "element"], { call: true })),
95
95
  "agent.offer": engine(station("skip", "grace", ["agent", "provider"])),
96
96
  "agent.spawn": engine(station("refuse_until_run", "immediate", AGENT_SPAWN_PINNED, { call: true })),
97
- "prompt.submit": engine(station("refuse", "immediate", ["source", "inputId", "actor"])),
97
+ "prompt.submit": engine(station("refuse", "immediate", ["source", "inputId", "actor", "author", "extension"], { call: true })),
98
98
  "prompt.fill": surface(station("skip", "grace", ["origin", "mode"], { call: true })),
99
99
  "prompt.suggest": surface(station("skip", "grace", ["origin"], { call: true })),
100
100
  "prompt.edit": surface(station("skip", "grace", ["origin", "key"], { budgetMs: PROMPT_EDIT_BUDGET_MS })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/mods-kernel",
3
- "version": "7.65.0",
3
+ "version": "7.66.1",
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": "5ab3f8045ee0d9965d58344531544df295422b69"
34
+ "gitHead": "705805c625d29655f7fb8ba35c32345b753eeea2"
35
35
  }