@sema-agent/mods-kernel 7.66.1 → 7.67.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.
package/LICENSE CHANGED
@@ -5,7 +5,8 @@ Parameters
5
5
  Licensor: clay (github.com/clayboby)
6
6
  Licensed Work: @sema-agent/core (sema-core) and the satellite packages
7
7
  published from this repository (currently
8
- @sema-agent/mods-kernel, @sema-agent/primitives and @sema-agent/core-stores-sql)
8
+ @sema-agent/mods-kernel, @sema-agent/primitives,
9
+ @sema-agent/core-stores-sql and @sema-agent/wiki-gate)
9
10
  (formerly published as @sema-ai/core)
10
11
  The Licensed Work is (c) 2026 clay.
11
12
  Additional Use Grant: You may make production use of the Licensed Work for
package/README.md CHANGED
@@ -57,11 +57,11 @@ contract; a removed or re-kinded export is named as breaking in the `@sema-agent
57
57
  | Contract and closed sets | `KERNEL_CONTRACT_VERSION` `MOD_TIERS` `MOD_SEATS` `MOD_EVENT_SIDES` `MOD_FAILURE_ANSWERS` `MOD_ABORT_POSTURES` `NEXT_TO_TABLE` `SEAT_TIER_TABLE` |
58
58
  | Event table and readers | `MOD_EVENT_TABLE` `isModEventName` `expandModPattern` `expandOnSide` `stationOn` `readOnSide` `failureRefuses` `nextToRefusal` |
59
59
  | Event table types | `ModTier` `ModRegistrationTier` `ModSeat` `ModEventSide` `ModBusSide` `ModFailureAnswer` `ModAbortPosture` `ModStation` `ModEventRow` `ModEventName` |
60
- | Budgets | `DEFAULT_MOD_BUDGET_MS` `CATCH_BUDGET_MS` `RUNAWAY_AFTER_MS` `POST_ABORT_GRACE_MS` `MAX_TIMER_MS` `resolveModBudgetMs` `ModBudgetReading` |
60
+ | Budgets | `DEFAULT_MOD_BUDGET_MS` `CATCH_BUDGET_MS` `RUNAWAY_AFTER_MS` `POST_ABORT_GRACE_MS` `MAX_TIMER_MS` `clockMsRefusal` `resolveModBudgetMs` `ModBudgetReading` |
61
61
  | Failure causes and site rules | `MOD_FAILURE_CAUSES` `ModFailureCause` `ModEventPayload` `ModAnswerCheck` `ModAnswerRanks` `ModDispatchRun` `ModAnswerer` `ModMatcher` `ModSkip` |
62
62
  | Registration | `ENGINE_ORIGIN` `MODS_INVALID_CODE` `MODS_REGISTRATION_REFUSED_CODE` `MOD_TRACE_OUTCOMES` `ModTraceOutcome` `ModUses` `ModOrigin` `ModPluginFacts` `ModDollarBase` `ModTraceEntry` `ModCaughtError` `ModNext` `ModHandler` `ModHandlerOptions` `On` `ModRegistration` `ModAdmissionRecord` `ModSeats` |
63
63
  | Typed event maps | `ModEventPair` `ModEventMap` `ModTypedNext` `ModTypedHandler` `MappedOn` |
64
- | Admission and the bus | `admitMods` `ModFrame` `ModBottomContext` `ModMethodBottom` `ModMethodSeat` `ModMethodBottoms` `ModCallEntry` `ModCallEntries` `ModDispatchOutcome` `ModDispatchOptions` `ModBus` `ModMountedHandler` `ModBusInput` |
64
+ | Admission and the bus | `admitMods` `ModFrame` `ModBottomContext` `ModMethodBottom` `ModMethodSeat` `ModMethodBottoms` `ModCallEntry` `ModCallEntries` `ModDispatchOutcome` `ModDispatchOptions` `ModBus` `ModMountedHandler` `ModBusInput` `ModTimer` |
65
65
 
66
66
  ## License
67
67
 
package/dist/budget.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const CATCH_BUDGET_MS = 1000;
3
3
  export declare const RUNAWAY_AFTER_MS = 5000;
4
4
  export declare const POST_ABORT_GRACE_MS = 1000;
5
5
  export declare const MAX_TIMER_MS = 2147483647;
6
+ export declare function clockMsRefusal(ms: unknown): string | undefined;
6
7
  export interface ModBudgetReading {
7
8
  readonly ms: number;
8
9
  readonly remainingMs: number;
package/dist/budget.js CHANGED
@@ -3,6 +3,12 @@ export const CATCH_BUDGET_MS = 1_000;
3
3
  export const RUNAWAY_AFTER_MS = 5_000;
4
4
  export const POST_ABORT_GRACE_MS = 1_000;
5
5
  export const MAX_TIMER_MS = 2_147_483_647;
6
+ export function clockMsRefusal(ms) {
7
+ if (typeof ms === "number" && Number.isFinite(ms) && ms >= 0 && ms <= MAX_TIMER_MS)
8
+ return undefined;
9
+ const got = typeof ms === "number" ? String(ms) : typeof ms;
10
+ return `takes { ms }, a non-negative number of milliseconds no greater than ${MAX_TIMER_MS} (got ${got})`;
11
+ }
6
12
  export function resolveModBudgetMs(supplied, report, name) {
7
13
  if (supplied === undefined)
8
14
  return DEFAULT_MOD_BUDGET_MS;
@@ -37,6 +37,11 @@ export type ModDispatchOutcome = {
37
37
  readonly bottomStarted?: true;
38
38
  } | {
39
39
  readonly kind: "aborted";
40
+ readonly skipped: readonly ModSkip[];
41
+ readonly lastAnswer?: {
42
+ readonly answer: unknown;
43
+ readonly answeredBy?: string;
44
+ };
40
45
  readonly bottomStarted?: true;
41
46
  };
42
47
  export interface ModParticipant {
@@ -77,5 +82,9 @@ export interface ModBusInput<D extends ModDollarBase = ModDollarBase> {
77
82
  readonly describeThrown: (err: unknown) => string;
78
83
  readonly isProxy?: ProxyProbe;
79
84
  readonly signal?: AbortSignal;
85
+ readonly lifetime?: AbortSignal;
86
+ }
87
+ export interface ModTimer {
88
+ cancel(): void;
80
89
  }
81
90
  export declare function admitMods<D extends ModDollarBase = ModDollarBase>(input: ModBusInput<D>): Promise<ModBus>;
package/dist/dispatch.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CATCH_BUDGET_MS, createSelfBudget, POST_ABORT_GRACE_MS, RUNAWAY_AFTER_MS, unrefTimer, watchRunaway } from "./budget.js";
1
+ import { CATCH_BUDGET_MS, clockMsRefusal, createSelfBudget, POST_ABORT_GRACE_MS, RUNAWAY_AFTER_MS, unrefTimer, watchRunaway } from "./budget.js";
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";
@@ -13,7 +13,7 @@ export async function admitMods(input) {
13
13
  const mounted = [];
14
14
  const records = [];
15
15
  const describe = safeDescribe(input.describeThrown);
16
- const bus = createBus(input.side, mounted, input.bottoms, input.entries ?? {}, report, records, describe, input.isProxy);
16
+ const bus = createBus(input.side, mounted, input.bottoms, input.entries ?? {}, report, records, describe, input.isProxy, input.lifetime);
17
17
  const admitted = Object.freeze({ admitted: true });
18
18
  for (const cand of screened) {
19
19
  if (input.signal?.aborted === true)
@@ -177,7 +177,14 @@ function handlerOptions(opts) {
177
177
  }
178
178
  const HA = "skipped; what is below it ran in its place";
179
179
  const MA = "skipped; its last next() run's result stands";
180
- function createBus(side, mounted, bottoms, entries, report, records, describe, isProxy) {
180
+ function createBus(side, mounted, bottoms, entries, report, records, describe, isProxy, lifetime) {
181
+ const life = lifetime ?? new AbortController().signal;
182
+ const timers = new Set();
183
+ life.addEventListener("abort", () => {
184
+ for (const t of timers)
185
+ t.abort(life.reason);
186
+ timers.clear();
187
+ }, { once: true });
181
188
  const reaches = new Map();
182
189
  for (const name of Object.keys(bottoms)) {
183
190
  if (!isModEventName(name))
@@ -265,30 +272,45 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
265
272
  throw new Error(`${caller.origin.plugin}: $.${event}: ${deny}`);
266
273
  return typeof answer === "object" && answer !== null ? Reflect.get(answer, "value") : undefined;
267
274
  }
268
- function dollarFor(reg, frames, budget, signal, engines) {
275
+ function dollarFor(reg, frames, budget, signal, engines, running) {
269
276
  const origin = Object.freeze({ plugin: reg.name, tier: reg.tier });
270
- const caller = Object.freeze({ frames: Object.freeze([...frames, Object.freeze({ kind: "dollar", plugin: reg.name })]), origin, signal });
277
+ const ownFrame = Object.freeze({ kind: "dollar", plugin: reg.name });
278
+ const held = Object.freeze({ frames: Object.freeze([...frames, ownFrame]), origin, signal });
279
+ const later = Object.freeze({ frames: Object.freeze([ownFrame]), origin, signal: life });
271
280
  const namespaces = new Map();
272
281
  for (const event of new Set([...reaches.keys(), ...reg.callsBound])) {
273
282
  const dot = event.indexOf(".");
274
283
  const ns = namespaces.get(event.slice(0, dot)) ?? {};
275
284
  namespaces.set(event.slice(0, dot), ns);
276
- ns[event.slice(dot + 1)] = async (args) => {
285
+ const reachOf = () => {
277
286
  if (!reg.callsBound.has(event))
278
287
  throw new Error(`${reg.name}: $.${event}: not declared in uses.calls`);
279
288
  const reach = reaches.get(event);
280
289
  if (reach === undefined)
281
290
  throw new Error(`${reg.name}: $.${event}: not callable on the ${side} bus in this version`);
291
+ return reach;
292
+ };
293
+ if (stationOn(event, side)?.method?.timer !== undefined) {
294
+ ns[event.slice(dot + 1)] = (args, fn) => startTimer(reg, event, reachOf(), args, fn, origin, later.frames, engines);
295
+ continue;
296
+ }
297
+ ns[event.slice(dot + 1)] = async (args) => {
298
+ const reach = reachOf();
282
299
  const received = receivePayload(args === undefined ? {} : args, isProxy, engines());
283
300
  if ("refusal" in received)
284
301
  throw new TypeError(`${reg.name}: $.${event}: takes one object — ${received.refusal}`);
285
- if (reach.pauses)
302
+ const now = running.now;
303
+ if (!now && life.aborted)
304
+ throw lifeEnded(reg, event);
305
+ const caller = now ? held : later;
306
+ const pauses = now && reach.pauses;
307
+ if (pauses)
286
308
  budget.pause();
287
309
  try {
288
310
  return reach.kind === "method" ? await callMethod(event, reach, received.payload, caller) : await reach.entry(received.payload, caller);
289
311
  }
290
312
  finally {
291
- if (reach.pauses)
313
+ if (pauses)
292
314
  budget.resume();
293
315
  }
294
316
  };
@@ -298,6 +320,68 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
298
320
  out[ns] = Object.freeze(fns);
299
321
  return Object.freeze({ ...out, plugin: Object.freeze({ ...(namespaces.get("plugin") ?? {}), name: reg.name }) });
300
322
  }
323
+ function lifeEnded(reg, event) {
324
+ const err = new Error(`${reg.name}: $.${event}: the leg this registration runs in has stopped (or its bus was admitted outside any leg) — ` +
325
+ `a timer, and a $ call made after its handler settled, run only while its leg runs`);
326
+ report(err);
327
+ return err;
328
+ }
329
+ function startTimer(reg, event, reach, args, fn, origin, frames, engines) {
330
+ const repeats = reach.kind === "method" ? reach.st.method?.timer?.repeats : undefined;
331
+ if (reach.kind !== "method" || repeats === undefined)
332
+ throw new Error(`${reg.name}: $.${event}: not a timer on the ${side} bus in this version`);
333
+ const received = receivePayload(args === undefined ? {} : args, isProxy, engines());
334
+ if ("refusal" in received)
335
+ throw new TypeError(`${reg.name}: $.${event}: takes { ms } and a callback — ${received.refusal}`);
336
+ const ms = received.payload["ms"];
337
+ const why = clockMsRefusal(ms);
338
+ if (why !== undefined || typeof ms !== "number")
339
+ throw new TypeError(`${reg.name}: $.${event}: ${why ?? "takes { ms }"}`);
340
+ if (typeof fn !== "function")
341
+ throw new TypeError(`${reg.name}: $.${event}: takes a callback function after { ms }`);
342
+ if (life.aborted)
343
+ throw lifeEnded(reg, event);
344
+ const payload = repeats ? Object.freeze({ ...received.payload, ms: Math.max(1, ms) }) : received.payload;
345
+ const ac = new AbortController();
346
+ timers.add(ac);
347
+ const ctx = Object.freeze({ frames, origin, signal: ac.signal });
348
+ const end = (reason) => {
349
+ timers.delete(ac);
350
+ if (!ac.signal.aborted)
351
+ ac.abort(reason);
352
+ };
353
+ const tick = () => {
354
+ if (ac.signal.aborted)
355
+ return;
356
+ callMethod(event, reach, payload, ctx).then(() => {
357
+ if (ac.signal.aborted)
358
+ return;
359
+ if (!repeats)
360
+ end(new Error(`${reg.name}: $.${event}: fired`));
361
+ invokeNow(() => Reflect.apply(fn, undefined, [])).catch((err) => {
362
+ report(new Error(`${reg.name}: $.${event}: its callback threw ${describe(err)}${repeats ? " — the timer runs on" : ""}`));
363
+ });
364
+ if (repeats)
365
+ setTimeout(tick, 0);
366
+ }, (err) => {
367
+ if (ac.signal.aborted)
368
+ return;
369
+ end(err);
370
+ report(new Error(`${reg.name}: $.${event}: a tick was refused (${describe(err)}) — the timer stopped`));
371
+ });
372
+ };
373
+ setTimeout(tick, 0);
374
+ return Object.freeze({ cancel: () => end(new Error(`${reg.name}: $.${event}: cancelled`)) });
375
+ }
376
+ function runWithDollar(reg, frames, budget, signal, engines, run) {
377
+ const running = { now: true };
378
+ const p = invokeNow(() => run(dollarFor(reg, frames, budget, signal, engines, running)));
379
+ const settle = () => {
380
+ running.now = false;
381
+ };
382
+ p.then(settle, settle);
383
+ return p;
384
+ }
301
385
  function runDispatch(event, st, e0, options) {
302
386
  const frames = options.frames ?? [];
303
387
  const origin = options.origin ?? ENGINE_ORIGIN;
@@ -334,7 +418,11 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
334
418
  rejectOut = rej;
335
419
  });
336
420
  const signal = options.signal;
337
- const aborted = () => (bottomStarted ? { kind: "aborted", bottomStarted: true } : { kind: "aborted" });
421
+ let reached;
422
+ const aborted = () => {
423
+ const last = reached === undefined ? undefined : Object.freeze({ answer: reached.answer, ...(producers.has(reached.answer) ? { answeredBy: producers.get(reached.answer) } : {}) });
424
+ return { kind: "aborted", skipped: Object.freeze([...skipped]), ...(last !== undefined ? { lastAnswer: last } : {}), ...(bottomStarted ? { bottomStarted: true } : {}) };
425
+ };
338
426
  const onAbort = () => {
339
427
  if (settled)
340
428
  return;
@@ -451,6 +539,8 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
451
539
  run.then((v) => {
452
540
  state.lastValue = { v };
453
541
  state.answers.push(v);
542
+ if (reached === undefined || i < reached.at)
543
+ reached = { at: i, answer: v };
454
544
  state.sealed = new Set([...(state.sealed ?? []), ...sealedObjects([v])]);
455
545
  stopCounting();
456
546
  }, (err) => {
@@ -541,8 +631,7 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
541
631
  }
542
632
  else {
543
633
  const next = makeNext({ budget, signal: ac.signal, trace: () => Object.freeze([...state.below]) }, (x) => descend(x, floors), to);
544
- const $ = dollarFor(h.reg, myFrames, budget, ac.signal, engines);
545
- handlerP = invokeNow(() => h.fn($, e, next));
634
+ handlerP = runWithDollar(h.reg, myFrames, budget, ac.signal, engines, ($) => h.fn($, e, next));
546
635
  try {
547
636
  const raced = await Promise.race([handlerP, budget.expired]);
548
637
  if (raced === "expired" && budget.isExpired())
@@ -651,7 +740,7 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
651
740
  return why !== undefined ? Promise.reject(new Error(`${h.reg.name}: ${why}`)) : replay(x, [...floors, { from: h.reg.tier, to: tier }]);
652
741
  }, { error, called: state.called });
653
742
  try {
654
- const raced = await Promise.race([invokeNow(() => onCatch(dollarFor(h.reg, myFrames, budget, ac.signal, engines), e, next)), budget.expired]);
743
+ const raced = await Promise.race([runWithDollar(h.reg, myFrames, budget, ac.signal, engines, ($) => onCatch($, e, next)), budget.expired]);
655
744
  if (raced === "expired" && budget.isExpired())
656
745
  return { problem: `its .catch ran past its ${catchMs}ms budget` };
657
746
  if (violated !== undefined)
@@ -684,7 +773,7 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
684
773
  report(new Error(`${name}: ${event}: an observe handler returned a verdict — not adopted; an observe handler answers undefined`), "observational-hook-verdict-ignored");
685
774
  };
686
775
  try {
687
- const raced = await Promise.race([invokeNow(() => h.fn(dollarFor(h.reg, myFrames, budget, ac.signal, engines), detachedCopy(e0), next)), budget.expired]);
776
+ const raced = await Promise.race([runWithDollar(h.reg, myFrames, budget, ac.signal, engines, ($) => h.fn($, detachedCopy(e0), next)), budget.expired]);
688
777
  if (raced === "expired" && budget.isExpired())
689
778
  throw new Error(`ran past its ${budgetMs}ms budget`);
690
779
  verdict(raced);
@@ -706,7 +795,7 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
706
795
  called: false,
707
796
  });
708
797
  try {
709
- const caught = await Promise.race([invokeNow(() => onCatch(dollarFor(h.reg, myFrames, catchBudget, cac.signal, engines), detachedCopy(e0), cnext)), catchBudget.expired]);
798
+ const caught = await Promise.race([runWithDollar(h.reg, myFrames, catchBudget, cac.signal, engines, ($) => onCatch($, detachedCopy(e0), cnext)), catchBudget.expired]);
710
799
  if (!(caught === "expired" && catchBudget.isExpired()))
711
800
  verdict(caught);
712
801
  }
@@ -726,7 +815,7 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
726
815
  }
727
816
  }
728
817
  if (signal?.aborted === true && st.abort !== "grace") {
729
- finish({ kind: "aborted" });
818
+ finish(aborted());
730
819
  return out;
731
820
  }
732
821
  const root = [];
package/dist/events.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const KERNEL_CONTRACT_VERSION = 9;
1
+ export declare const KERNEL_CONTRACT_VERSION = 10;
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">;
@@ -36,6 +36,9 @@ export interface ModStation {
36
36
  readonly pinned: readonly string[];
37
37
  readonly method?: {
38
38
  readonly pausesCallerBudget: boolean;
39
+ readonly timer?: {
40
+ readonly repeats: boolean;
41
+ };
39
42
  };
40
43
  readonly call?: {
41
44
  readonly pausesCallerBudget: boolean;
package/dist/events.js CHANGED
@@ -1,4 +1,4 @@
1
- export const KERNEL_CONTRACT_VERSION = 9;
1
+ export const KERNEL_CONTRACT_VERSION = 10;
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"]);
@@ -38,6 +38,7 @@ const station = (failure, abort, pinned = [], more = {}) => Object.freeze({
38
38
  ...(more.budgetMs !== undefined ? { budgetMs: more.budgetMs } : {}),
39
39
  });
40
40
  const method = (pausesCallerBudget) => Object.freeze({ failure: "skip", abort: "caller", pinned: Object.freeze([]), method: Object.freeze({ pausesCallerBudget }) });
41
+ const timer = (repeats) => Object.freeze({ failure: "skip", abort: "caller", pinned: Object.freeze([]), method: Object.freeze({ pausesCallerBudget: false, timer: Object.freeze({ repeats }) }) });
41
42
  const engine = (s) => Object.freeze(s === undefined ? { side: "engine" } : { side: "engine", station: s });
42
43
  const surface = (s) => Object.freeze(s === undefined ? { side: "surface" } : { side: "surface", station: s });
43
44
  const RENDER_PINNED = ["surface", "component", "requestId", "viewport"];
@@ -80,7 +81,7 @@ export const MOD_EVENT_TABLE = Object.freeze({
80
81
  "classic.CwdChanged": engine(),
81
82
  "classic.FileChanged": engine(),
82
83
  "classic.DirectoryAdded": engine(),
83
- "classic.MessageDisplay": engine(),
84
+ "classic.MessageDisplay": engine(station("skip", "immediate", ["messageId", "turn", "index", "final", "agentId"], { budgetMs: 10_000 })),
84
85
  "tool.call": engine(station("refuse", "immediate", ["tool", "tool_use_id", "agentId", "input"], { call: true })),
85
86
  "tool.check": engine(station("refuse", "immediate", ["tool", "input", "tool_use_id", "agentId", "ceiling"])),
86
87
  "ui.render": surface(station("skip", "grace", RENDER_PINNED)),
@@ -94,7 +95,7 @@ export const MOD_EVENT_TABLE = Object.freeze({
94
95
  "ui.focus": surface(station("skip", "grace", ["component", "requestId", "plugin", "origin", "element"], { call: true })),
95
96
  "agent.offer": engine(station("skip", "grace", ["agent", "provider"])),
96
97
  "agent.spawn": engine(station("refuse_until_run", "immediate", AGENT_SPAWN_PINNED, { call: true })),
97
- "prompt.submit": engine(station("refuse", "immediate", ["source", "inputId", "actor", "author", "extension"], { call: true })),
98
+ "prompt.submit": engine(station("refuse", "immediate", ["source", "inputId", "actor", "author", "extension", "replyable"], { call: true })),
98
99
  "prompt.fill": surface(station("skip", "grace", ["origin", "mode"], { call: true })),
99
100
  "prompt.suggest": surface(station("skip", "grace", ["origin"], { call: true })),
100
101
  "prompt.edit": surface(station("skip", "grace", ["origin", "key"], { budgetMs: PROMPT_EDIT_BUDGET_MS })),
@@ -148,7 +149,7 @@ export const MOD_EVENT_TABLE = Object.freeze({
148
149
  "session.identity": engine(),
149
150
  "session.usage": engine(method(true)),
150
151
  "session.version": engine(method(true)),
151
- "turn.abort": engine(),
152
+ "turn.abort": engine(method(false)),
152
153
  "prompt.read": surface(method(true)),
153
154
  "flag.value": engine(),
154
155
  "tool.list": engine(method(true)),
@@ -185,8 +186,8 @@ export const MOD_EVENT_TABLE = Object.freeze({
185
186
  "state.set": engine(),
186
187
  "clock.now": engine(method(false)),
187
188
  "clock.sleep": engine(method(false)),
188
- "clock.after": engine(),
189
- "clock.every": engine(),
189
+ "clock.after": engine(timer(false)),
190
+ "clock.every": engine(timer(true)),
190
191
  "http.fetch": engine(),
191
192
  "process.run": engine(method(true)),
192
193
  "process.spawn": engine(),
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { KERNEL_CONTRACT_VERSION, MOD_TIERS, MOD_SEATS, MOD_EVENT_SIDES, MOD_FAILURE_ANSWERS, MOD_ABORT_POSTURES, NEXT_TO_TABLE, SEAT_TIER_TABLE, MOD_EVENT_TABLE, nextToRefusal, expandModPattern, expandOnSide, failureRefuses, isModEventName, stationOn, readOnSide, type ModTier, type ModRegistrationTier, type ModSeat, type ModEventSide, type ModBusSide, type ModFailureAnswer, type ModAbortPosture, type ModStation, type ModEventRow, type ModEventName, } from "./events.js";
2
- export { DEFAULT_MOD_BUDGET_MS, CATCH_BUDGET_MS, RUNAWAY_AFTER_MS, POST_ABORT_GRACE_MS, MAX_TIMER_MS, resolveModBudgetMs, type ModBudgetReading, } from "./budget.js";
2
+ export { DEFAULT_MOD_BUDGET_MS, CATCH_BUDGET_MS, RUNAWAY_AFTER_MS, POST_ABORT_GRACE_MS, MAX_TIMER_MS, clockMsRefusal, resolveModBudgetMs, type ModBudgetReading, } from "./budget.js";
3
3
  export { MOD_FAILURE_CAUSES, type ModFailureCause, type ModEventPayload, type ModAnswerCheck, type ModAnswerRanks, type ModDispatchRun, type ModAnswerer, type ModMatcher, type ModSkip, } from "./site-rules.js";
4
4
  export { ENGINE_ORIGIN, MODS_INVALID_CODE, MODS_REGISTRATION_REFUSED_CODE, MOD_TRACE_OUTCOMES, type ModTraceOutcome, type ModUses, type ModOrigin, type ModPluginFacts, type ModDollarBase, type ModTraceEntry, type ModCaughtError, type ModNext, type ModHandler, type ModHandlerOptions, type ModEventPair, type ModEventMap, type ModTypedNext, type ModTypedHandler, type On, type MappedOn, type ModRegistration, type ModAdmissionRecord, type ModSeats, } from "./registration.js";
5
- export { admitMods, type ModFrame, type ModBottomContext, type ModMethodBottom, type ModMethodSeat, type ModMethodBottoms, type ModCallEntry, type ModCallEntries, type ModDispatchOutcome, type ModDispatchOptions, type ModBus, type ModMountedHandler, type ModBusInput, } from "./dispatch.js";
5
+ export { admitMods, type ModFrame, type ModBottomContext, type ModMethodBottom, type ModMethodSeat, type ModMethodBottoms, type ModCallEntry, type ModCallEntries, type ModDispatchOutcome, type ModDispatchOptions, type ModBus, type ModMountedHandler, type ModBusInput, type ModTimer, } from "./dispatch.js";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { KERNEL_CONTRACT_VERSION, MOD_TIERS, MOD_SEATS, MOD_EVENT_SIDES, MOD_FAILURE_ANSWERS, MOD_ABORT_POSTURES, NEXT_TO_TABLE, SEAT_TIER_TABLE, MOD_EVENT_TABLE, nextToRefusal, expandModPattern, expandOnSide, failureRefuses, isModEventName, stationOn, readOnSide, } from "./events.js";
2
- export { DEFAULT_MOD_BUDGET_MS, CATCH_BUDGET_MS, RUNAWAY_AFTER_MS, POST_ABORT_GRACE_MS, MAX_TIMER_MS, resolveModBudgetMs, } from "./budget.js";
2
+ export { DEFAULT_MOD_BUDGET_MS, CATCH_BUDGET_MS, RUNAWAY_AFTER_MS, POST_ABORT_GRACE_MS, MAX_TIMER_MS, clockMsRefusal, resolveModBudgetMs, } from "./budget.js";
3
3
  export { MOD_FAILURE_CAUSES, } from "./site-rules.js";
4
4
  export { ENGINE_ORIGIN, MODS_INVALID_CODE, MODS_REGISTRATION_REFUSED_CODE, MOD_TRACE_OUTCOMES, } from "./registration.js";
5
5
  export { admitMods, } from "./dispatch.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/mods-kernel",
3
- "version": "7.66.1",
3
+ "version": "7.67.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": "705805c625d29655f7fb8ba35c32345b753eeea2"
34
+ "gitHead": "f37485960eb53ae879d3f16fa176ecc0ea1506c8"
35
35
  }