@sema-agent/mods-kernel 7.58.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.
- package/README.md +3 -0
- package/dist/dispatch.d.ts +1 -0
- package/dist/dispatch.js +6 -5
- package/dist/events.d.ts +1 -1
- package/dist/events.js +11 -7
- package/dist/receive.d.ts +1 -0
- package/dist/receive.js +10 -0
- package/dist/registration.d.ts +1 -0
- package/dist/registration.js +3 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,6 +29,9 @@ package version; it moves only when the chain semantics, the registration form,
|
|
|
29
29
|
`side`) or the failure columns (failure, abort, pinned keys, an event's own budget ceiling, whether `$` may call it)
|
|
30
30
|
change — once per release, however many of them change in it.
|
|
31
31
|
|
|
32
|
+
`@sema-agent/core` does not depend on this package: it compiles the same source into its own build, so a process that
|
|
33
|
+
installs both holds two copies. This package is for a host that runs its own bus; the engine does not need it installed.
|
|
34
|
+
|
|
32
35
|
## Which side raises an event
|
|
33
36
|
|
|
34
37
|
Every name in `MOD_EVENT_TABLE` carries a `side` — `engine`, `surface` or `both`, the closed set `MOD_EVENT_SIDES` — and
|
package/dist/dispatch.d.ts
CHANGED
package/dist/dispatch.js
CHANGED
|
@@ -584,7 +584,8 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
|
|
|
584
584
|
if (caught !== undefined && "answer" in caught) {
|
|
585
585
|
if (failure.cause !== "violation" && failure.cause !== "reentry")
|
|
586
586
|
report(new Error(`${name}: ${event}: ${failure.reason}; its .catch answered`));
|
|
587
|
-
producers.
|
|
587
|
+
if (!(typeof caught.answer === "object" && caught.answer !== null && producers.has(caught.answer)))
|
|
588
|
+
producers.set(caught.answer, name);
|
|
588
589
|
traceOf(sink, i, name, h.reg.tier, "caught", ms);
|
|
589
590
|
return caught.answer;
|
|
590
591
|
}
|
|
@@ -595,12 +596,12 @@ function createBus(side, mounted, bottoms, entries, report, records, describe, i
|
|
|
595
596
|
throw failure.error;
|
|
596
597
|
}
|
|
597
598
|
const reason = caught !== undefined ? `${failure.reason}; ${caught.problem}` : failure.reason;
|
|
598
|
-
const
|
|
599
|
-
if (refusing && !
|
|
600
|
-
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)
|
|
601
602
|
report(new Error(`${name}: ${event}: ${reason} — failed closed: the dispatch ends here`));
|
|
602
603
|
traceOf(sink, i, name, h.reg.tier, "rejected", ms);
|
|
603
|
-
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 } : {}) });
|
|
604
605
|
throw terminal;
|
|
605
606
|
}
|
|
606
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 =
|
|
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 =
|
|
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")),
|
|
@@ -55,7 +59,7 @@ export const MOD_EVENT_TABLE = Object.freeze({
|
|
|
55
59
|
"classic.SessionEnd": engine(),
|
|
56
60
|
"classic.Stop": engine(station("skip", "immediate")),
|
|
57
61
|
"classic.StopFailure": engine(station("skip", "grace")),
|
|
58
|
-
"classic.SubagentStart": engine(),
|
|
62
|
+
"classic.SubagentStart": engine(station("skip", "immediate", ["agentId", "agentType"])),
|
|
59
63
|
"classic.SubagentStop": engine(station("skip", "immediate")),
|
|
60
64
|
"classic.PreCompact": engine(station("skip", "grace")),
|
|
61
65
|
"classic.PostCompact": 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("
|
|
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/dist/registration.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface ModOrigin {
|
|
|
12
12
|
readonly tier: ModTier;
|
|
13
13
|
}
|
|
14
14
|
export declare const ENGINE_ORIGIN: ModOrigin;
|
|
15
|
+
export declare function namedRegistration(registration: string | undefined): string | undefined;
|
|
15
16
|
export interface ModPluginFacts {
|
|
16
17
|
readonly name: string;
|
|
17
18
|
}
|
package/dist/registration.js
CHANGED
|
@@ -3,6 +3,9 @@ import { resolveModBudgetMs } from "./budget.js";
|
|
|
3
3
|
export const MODS_INVALID_CODE = "config.mods_invalid";
|
|
4
4
|
export const MODS_REGISTRATION_REFUSED_CODE = "mods.registration_refused";
|
|
5
5
|
export const ENGINE_ORIGIN = Object.freeze({ plugin: "engine", tier: "core" });
|
|
6
|
+
export function namedRegistration(registration) {
|
|
7
|
+
return registration === undefined || registration === ENGINE_ORIGIN.plugin ? undefined : registration;
|
|
8
|
+
}
|
|
6
9
|
export const MOD_TRACE_OUTCOMES = Object.freeze(["returned", "passed", "rejected", "caught", "expired", "kept", "skipped", "bypassed"]);
|
|
7
10
|
export function modsInvalid(message) {
|
|
8
11
|
return Object.assign(new Error(message), { code: MODS_INVALID_CODE });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/mods-kernel",
|
|
3
|
-
"version": "7.
|
|
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": "
|
|
34
|
+
"gitHead": "d3ee177a6006dbf76d7669ee15745d8cad4bca7b"
|
|
35
35
|
}
|