@reinsjs/core 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # @reinsjs/core
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - First public release.
8
+
9
+ - **Timeline first.** Append-only event log with `schemaVersion` on every event and fail-closed upcast on read; projection decides what the model sees each turn; replay and fork from the log alone.
10
+ - **A loop you can copy.** `runLoop` as an exported async generator: pause/resume is a return value with a small signed state, bounded retry on transient failures only while nothing has been written, tool pipeline `beforeTool → validate → approval → execute → afterTool`, sub-agent pause bubbling (`Interruption { kind: "subagent" }`).
11
+ - **Tools** can declare `resultTrust` (e.g. `"system"` for host-authored content such as skills); successful results then carry that trust instead of the default `untrusted`, and the lowering layer skips the `<untrusted>` marker. `SkillSource = Pick<MemoryStore, "list" | "read">` names the read-only store subset the brain's `skills()` module consumes.
12
+ - **Brain modules** (`@reinsjs/brain`): perception, compact (with folded-result manifest and `recall`; recommended on after measuring 100% recall at lower token cost on two model families), pins, spill, handoff, memory (`memory_20250818` shape, namespace isolation), approval (deny → ask → allow, fail-closed), budget (five limits, sub-agent usage included).
13
+ - **Lowering** (`@reinsjs/lowering-pi`): Anthropic Messages and OpenAI Responses via pi-ai with a declared loss matrix, trust markers on untrusted content, cache-breakpoint handling.
14
+ - **Serving** (`@reinsjs/server`, `@reinsjs/ui-agui`): Web-standard handler with SSE replay from `lastSeq`, per-session run lock, `authorizeSession` (only `true` allows), AG-UI as the first-class UI protocol.
15
+ - **Stores**: SQLite (`node:sqlite` / `bun:sqlite`) and Postgres (`pg` / PGlite), conformance-tested; configurable memory table for per-role isolation.
16
+ - **Tools**: MCP servers as one socket (`@reinsjs/tools-mcp`, tools bound per run, annotations as defaults not permissions); `asTool(agent)` in `reins`.
17
+ - **TanStack AI** middleware (`@reinsjs/adapter-tanstack-ai`): the brain on TanStack's loop with the log as the single source of truth; idempotent client-message import; runtime check for the approval interrupt.
18
+ - **Eval harness** (`@reinsjs/eval`): fixtures from real recordings, recorded tools, arm-vs-arm runner, metrics, the four-rule gate.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NewRate Limited
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # @reinsjs/core
2
+
3
+ The kernel of [reins](../../README.md): an append-only event timeline, the projection that decides what the model sees on each turn, a loop of a few hundred lines you can read and copy, a serializable run state for pause/resume across processes, and the `Socket` seam that everything else plugs into. Zero dependencies, zero `node:*` — Web standards only; verified on Node 22 and Cloudflare workerd, Bun / Deno / Vercel Edge not yet tested.
4
+
5
+ Two principles shape every type in here:
6
+
7
+ 1. **Decisions default to the model.** The loop lets the model see (projection, perception notes), gives it means (tools), gives it bounds (budgets, approval, safety nets) and records everything. It does not decide on the model's behalf.
8
+ 2. **The timeline is the single source of truth; roles are a translation.** There is one kind of data: an `Event` with an `actor` (`user` / `model` / `tool` / `system` / `host`). Provider message roles only appear in the lowering layer, and every lossy landing is declared.
9
+
10
+ ```bash
11
+ pnpm add @reinsjs/core
12
+ ```
13
+
14
+ Most applications import the umbrella package `reins` instead; `@reinsjs/core` is for people who bring their own loop, transport or lowering layer.
15
+
16
+ ## What is in the box
17
+
18
+ | module | exports | purpose |
19
+ | --- | --- | --- |
20
+ | `events/` | `Event`, `EventDraft`, `createCoreRegistry`, `createEvent`, `CoreEvent` types | Event shell + payloads, `schemaVersion` on every type, upcast-on-read (unknown types are rejected, not skipped) |
21
+ | `store/` | `EventLog`, `BlobStore`, `MemoryStore`, `InMemory*`, `memoryStore()`, `readTimeline` | Storage contracts. `EventLog.append` is the only write; `seq` is assigned by the caller and must be contiguous (optimistic concurrency) |
22
+ | `projection/` | `project`, `ProjectionStrategy`, `DEFAULT_MODEL_INVISIBLE_TYPES` | Pure function: timeline → what the model sees this turn (filter → fold → pin → trim to budget). Strategies may create events, but they go through the loop into the log first |
23
+ | `lowering/` | `Lowering`, `LoweredRequest`, `LandingRecord`, `markUntrusted` | Interface to a provider wire protocol plus the loss matrix types; implementation in `@reinsjs/lowering-pi` |
24
+ | `loop/` | `runLoop`, `Socket`, `Tool`, `defineTool`, `RunResult`, `SerializedRunState`, `Interruption`, `subagentPause`, `retry` | The default loop and its seams |
25
+ | `replay/` | `replayTurns` | Recompute what the model saw on every turn from the log alone (audit UIs, eval) |
26
+ | `@reinsjs/core/testing` | `ScriptedLowering`, `callTool`, `say`, `think`, store conformance suites | Deterministic model scripts and a suite any `EventLog` / `BlobStore` / `MemoryStore` implementation should pass |
27
+
28
+ ## The loop in one paragraph
29
+
30
+ `runLoop(config)` is an exported async generator. Each iteration reads the timeline, projects it, lets every `Socket.beforeModel` patch the view / tools / system prompt, asks the model (with bounded retry on transient failures only while no output has landed), appends each output block as it arrives, runs the tools through `beforeTool` → `validate` → approval → `execute` → `afterTool`, appends a `budget_usage`, and asks `onTurnEnd` whether to continue, stop, pause or hand off. It returns one of four results:
31
+
32
+ ```ts
33
+ type RunResult =
34
+ | { status: "done"; sessionId; lastSeq }
35
+ | { status: "paused"; sessionId; lastSeq; reason: "approval" | "budget" | "host"; interruptions: Interruption[]; state: SerializedRunState }
36
+ | { status: "handoff"; sessionId; lastSeq; toSessionId }
37
+ | { status: "error"; sessionId; lastSeq; error }
38
+ ```
39
+
40
+ Pausing is a return value, not a blocking callback. `state` is small (ids and hashes, HMAC-signed when you pass `secret`) and enough to resume in another process: `runLoop({ ...config, resume: state, decisions: [...] })` re-validates it against the log (config drift, pending-call digest) before writing anything.
41
+
42
+ ## Tools
43
+
44
+ ```ts
45
+ import { defineTool } from "@reinsjs/core"
46
+
47
+ const deploy = defineTool<{ env: "staging" | "prod" }>({
48
+ name: "deploy",
49
+ description: "Ship the current build",
50
+ inputSchema: { type: "object", properties: { env: { type: "string", enum: ["staging", "prod"] } }, required: ["env"] },
51
+ needsApproval: true, // the model may decide to call it; a person must confirm before it runs
52
+ risk: "high",
53
+ execute: ({ env }, ctx) => `deployed to ${env}`,
54
+ })
55
+ ```
56
+
57
+ `validate` runs before the approval check so the approver sees exactly the input that will execute. Tools without `execute` (or with `side: "client"`) pause the run until the host appends the `tool_result`. Tool output is `untrusted` by default and is wrapped in `<untrusted source="tool:…">` when lowered to the model. A tool may declare `resultTrust: "system"` to opt its **successful** results out of that wrapper — reserve it for content the host itself authored (this is how `@reinsjs/brain`'s `skill_read` works); error results and thrown exceptions stay `untrusted` regardless, and the same rule applies to client-tool results the host appends.
58
+
59
+ A tool can also *be* another agent: return `subagentPause(...)` from `execute` and the run pauses with `Interruption { kind: "subagent" }`, carrying the child session's own interruptions and state. `reins` ships `asTool(agent, opts)` on top of this.
60
+
61
+ ## Sockets
62
+
63
+ A `Socket` is the seam brain modules use — five hooks (`beforeModel`, `afterModel`, `beforeTool`, `afterTool`, `onTurnEnd`) plus two static contributions (`tools`, `systemPrompt`, resolved once per run so prompt caches stay warm). Anything a socket wants the model to see is emitted as an event and lands in the log first; nothing is injected around the log.
64
+
65
+ ## Guarantees worth knowing
66
+
67
+ - **Append-only.** Compaction, spill and handoff are all expressed as appended events. Forking a session copies a prefix verbatim (ids and `seq` kept), so references such as `recall({ seq })` survive.
68
+ - **Fail-closed reads.** An event type the registry does not know, or a version it cannot upgrade, is rejected before anything is written.
69
+ - **Bounded retry only on zero output.** A transient failure (network, 5xx, 429 — decided from the status code first, keywords only as a fallback) is retried up to 3 times, but never after a partial response has been appended: the log must not contain two half answers.
70
+ - **Deterministic given the log.** Time and ids are injected (`now`, `newId`), so a recorded session replays byte-for-byte in tests.
71
+
72
+ ## Documentation
73
+
74
+ The design documents live in `docs/` at the repository root and are written in Chinese: `docs/技术方案.md` (spec, §6 run state, §7 sockets, §10 tools), `docs/模块盘点/core.md` (file-by-file map), `docs/DECISIONS.md`.
75
+
76
+ MIT © 2026 NewRate Limited.
@@ -0,0 +1,205 @@
1
+ // src/events/base.ts
2
+ var DEFAULT_TRUST = {
3
+ user: "principal",
4
+ system: "system",
5
+ host: "system",
6
+ model: "model",
7
+ tool: "untrusted"
8
+ };
9
+
10
+ // src/events/id.ts
11
+ function uuidv7(now = Date.now()) {
12
+ const bytes = new Uint8Array(16);
13
+ crypto.getRandomValues(bytes);
14
+ let ts = now;
15
+ for (let i = 5; i >= 0; i--) {
16
+ bytes[i] = ts & 255;
17
+ ts = Math.floor(ts / 256);
18
+ }
19
+ bytes[6] = bytes[6] & 15 | 112;
20
+ bytes[8] = bytes[8] & 63 | 128;
21
+ const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
22
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
23
+ }
24
+
25
+ // src/events/create.ts
26
+ function createEvent(registry, input) {
27
+ const at = input.at ?? Date.now();
28
+ const base = {
29
+ id: input.id ?? uuidv7(at),
30
+ sessionId: input.sessionId,
31
+ seq: input.seq,
32
+ at,
33
+ type: input.type,
34
+ schemaVersion: registry.currentVersion(input.type),
35
+ actor: input.actor,
36
+ trust: input.trust ?? DEFAULT_TRUST[input.actor]
37
+ };
38
+ if (input.parentId !== void 0) base.parentId = input.parentId;
39
+ if (input.provenance !== void 0) base.provenance = input.provenance;
40
+ if (input.replay !== void 0) base.replay = input.replay;
41
+ return { ...base, type: input.type, payload: input.payload };
42
+ }
43
+ function createCoreEvent(registry, input) {
44
+ return createEvent(registry, input);
45
+ }
46
+
47
+ // src/events/registry.ts
48
+ var SchemaError = class extends Error {
49
+ constructor(code, message, context = {}) {
50
+ super(`[${code}] ${message}`);
51
+ this.code = code;
52
+ this.context = context;
53
+ this.name = "SchemaError";
54
+ }
55
+ code;
56
+ context;
57
+ };
58
+ var ACTORS = /* @__PURE__ */ new Set(["user", "model", "tool", "system", "host"]);
59
+ var TRUSTS = /* @__PURE__ */ new Set(["principal", "system", "model", "untrusted"]);
60
+ var EventSchemaRegistry = class {
61
+ schemas = /* @__PURE__ */ new Map();
62
+ constructor(schemas = []) {
63
+ for (const s of schemas) this.register(s);
64
+ }
65
+ /** 登记一个 type。重复登记同一 type 视为错误,避免两处定义互相覆盖。 */
66
+ register(schema) {
67
+ if (!schema.type || !/^(core|ext)\.[a-z][a-z0-9_]*$/.test(schema.type)) {
68
+ throw new SchemaError("invalid_schema", `type \u5FC5\u987B\u5F62\u5982 "core.xxx" \u6216 "ext.xxx"\uFF1A${schema.type}`, {
69
+ type: schema.type
70
+ });
71
+ }
72
+ if (!Number.isInteger(schema.version) || schema.version < 1) {
73
+ throw new SchemaError("invalid_schema", `version \u5FC5\u987B\u662F \u22651 \u7684\u6574\u6570\uFF1A${schema.version}`, {
74
+ type: schema.type,
75
+ version: schema.version
76
+ });
77
+ }
78
+ if (this.schemas.has(schema.type)) {
79
+ throw new SchemaError("invalid_schema", `type \u5DF2\u767B\u8BB0\uFF1A${schema.type}`, { type: schema.type });
80
+ }
81
+ for (let v = 1; v < schema.version; v++) {
82
+ if (typeof schema.upcasters?.[v] !== "function") {
83
+ throw new SchemaError(
84
+ "invalid_schema",
85
+ `${schema.type} \u5F53\u524D\u7248\u672C ${schema.version}\uFF0C\u4F46\u7F3A\u5C11 v${v}\u2192v${v + 1} \u7684\u5347\u7EA7\u51FD\u6570`,
86
+ { type: schema.type, version: v }
87
+ );
88
+ }
89
+ }
90
+ this.schemas.set(schema.type, schema);
91
+ return this;
92
+ }
93
+ has(type) {
94
+ return this.schemas.has(type);
95
+ }
96
+ /** 该 type 当前应写入的版本号;未登记则抛 unknown_type。 */
97
+ currentVersion(type) {
98
+ const s = this.schemas.get(type);
99
+ if (!s) throw new SchemaError("unknown_type", `\u672A\u767B\u8BB0\u7684\u4E8B\u4EF6\u7C7B\u578B\uFF1A${type}`, { type });
100
+ return s.version;
101
+ }
102
+ /**
103
+ * 从存储读出的原始对象 → 当前版本的事件。
104
+ * 泛型只是给调用方的类型提示(如 read<CoreEvent>),运行时校验的是壳与版本,不校验 payload 形状 ——
105
+ * payload 的正确性由写入方与升级函数负责。
106
+ */
107
+ read(raw) {
108
+ const base = assertBase(raw);
109
+ const schema = this.schemas.get(base.type);
110
+ if (!schema) {
111
+ throw new SchemaError("unknown_type", `\u672A\u767B\u8BB0\u7684\u4E8B\u4EF6\u7C7B\u578B\uFF1A${base.type}`, { type: base.type });
112
+ }
113
+ if (base.schemaVersion > schema.version) {
114
+ throw new SchemaError(
115
+ "future_version",
116
+ `${base.type} v${base.schemaVersion} \u6BD4\u672C\u5730\u5DF2\u77E5\u7684 v${schema.version} \u66F4\u65B0\uFF0C\u8BF7\u5347\u7EA7\u4EE3\u7801`,
117
+ { type: base.type, version: base.schemaVersion }
118
+ );
119
+ }
120
+ let payload = raw.payload;
121
+ for (let v = base.schemaVersion; v < schema.version; v++) {
122
+ const up = schema.upcasters?.[v];
123
+ if (!up) {
124
+ throw new SchemaError("missing_upcaster", `${base.type} \u7F3A\u5C11 v${v}\u2192v${v + 1} \u7684\u5347\u7EA7\u51FD\u6570`, {
125
+ type: base.type,
126
+ version: v
127
+ });
128
+ }
129
+ try {
130
+ payload = up(payload);
131
+ } catch (cause) {
132
+ throw new SchemaError(
133
+ "upcaster_failed",
134
+ `${base.type} v${v}\u2192v${v + 1} \u5347\u7EA7\u5931\u8D25\uFF1A${cause instanceof Error ? cause.message : String(cause)}`,
135
+ { type: base.type, version: v }
136
+ );
137
+ }
138
+ }
139
+ return { ...base, schemaVersion: schema.version, payload };
140
+ }
141
+ };
142
+ function assertBase(raw) {
143
+ if (typeof raw !== "object" || raw === null) {
144
+ throw new SchemaError("malformed_base", "\u4E8B\u4EF6\u5FC5\u987B\u662F\u5BF9\u8C61");
145
+ }
146
+ const r = raw;
147
+ const fail = (field, expect) => {
148
+ throw new SchemaError(
149
+ "malformed_base",
150
+ `\u5B57\u6BB5 ${field} \u5E94\u4E3A ${expect}`,
151
+ typeof r.type === "string" ? { type: r.type } : {}
152
+ );
153
+ };
154
+ if (typeof r.id !== "string" || r.id === "") fail("id", "\u975E\u7A7A\u5B57\u7B26\u4E32");
155
+ if (typeof r.sessionId !== "string" || r.sessionId === "") fail("sessionId", "\u975E\u7A7A\u5B57\u7B26\u4E32");
156
+ if (!Number.isInteger(r.seq) || r.seq < 1) fail("seq", "\u22651 \u7684\u6574\u6570");
157
+ if (typeof r.at !== "number" || !Number.isFinite(r.at)) fail("at", "\u6709\u9650\u6570\u5B57");
158
+ if (typeof r.type !== "string" || r.type === "") fail("type", "\u975E\u7A7A\u5B57\u7B26\u4E32");
159
+ if (!Number.isInteger(r.schemaVersion) || r.schemaVersion < 1)
160
+ fail("schemaVersion", "\u22651 \u7684\u6574\u6570");
161
+ if (typeof r.actor !== "string" || !ACTORS.has(r.actor)) fail("actor", "user|model|tool|system|host");
162
+ if (typeof r.trust !== "string" || !TRUSTS.has(r.trust)) fail("trust", "principal|system|model|untrusted");
163
+ if (r.parentId !== void 0 && typeof r.parentId !== "string") fail("parentId", "\u5B57\u7B26\u4E32\u6216\u7F3A\u7701");
164
+ if (r.provenance !== void 0) {
165
+ const p = r.provenance;
166
+ if (typeof p !== "object" || p === null || typeof p.source !== "string")
167
+ fail("provenance", "{ source: string }");
168
+ }
169
+ if (r.replay !== void 0 && (typeof r.replay !== "object" || r.replay === null))
170
+ fail("replay", "\u5BF9\u8C61\u6216\u7F3A\u7701");
171
+ return r;
172
+ }
173
+ var CORE_SCHEMAS = [
174
+ "core.user_message",
175
+ "core.model_text",
176
+ "core.model_thinking",
177
+ "core.tool_call",
178
+ "core.tool_result",
179
+ "core.system_note",
180
+ "core.approval_request",
181
+ "core.approval_decision",
182
+ "core.compaction",
183
+ "core.handoff",
184
+ "core.memory_op",
185
+ "core.budget_usage",
186
+ "core.run_paused",
187
+ "core.run_resumed",
188
+ "core.tools_bound",
189
+ "core.error"
190
+ ].map((type) => ({ type, version: 1 }));
191
+ function createCoreRegistry(extra = []) {
192
+ return new EventSchemaRegistry([...CORE_SCHEMAS, ...extra]);
193
+ }
194
+
195
+ export {
196
+ DEFAULT_TRUST,
197
+ uuidv7,
198
+ createEvent,
199
+ createCoreEvent,
200
+ SchemaError,
201
+ EventSchemaRegistry,
202
+ CORE_SCHEMAS,
203
+ createCoreRegistry
204
+ };
205
+ //# sourceMappingURL=chunk-BOJD54XN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/events/base.ts","../src/events/id.ts","../src/events/create.ts","../src/events/registry.ts"],"sourcesContent":["/**\n * 事件基础类型(技术方案 §4)。\n *\n * 宪法二:时间线是唯一真源,角色只是翻译。内部只有一种数据 —— 带发起者的事件。\n * 本文件只定义\"所有事件共有的壳\",具体载荷见 ./core.ts(内置 core.*)与宿主自定义的 ext.*。\n */\n\n/** 事件发起者。用户打断、脑子注入、宿主插话都只是不同 actor 的一次 append。 */\nexport type Actor = \"user\" | \"model\" | \"tool\" | \"system\" | \"host\"\n\n/**\n * 信任等级,供投影层与安全网判断\"这段内容能不能当指令\"。\n * - principal:主事人(用户)说的\n * - system:库或宿主注入的\n * - model:模型自己产出的\n * - untrusted:工具输出、外部抓取内容(默认值,防提示注入)\n */\nexport type Trust = \"principal\" | \"system\" | \"model\" | \"untrusted\"\n\n/** 来源:哪个工具、哪个 URL、哪个用户。用于审计与信任判断。 */\nexport interface Provenance {\n source: string\n ref?: string\n}\n\n/**\n * 所有事件的公共字段。\n * 载荷放在 payload 下(而不是平铺),这样 schema 升级函数只碰 payload,壳永远稳定。\n */\nexport interface EventBase {\n /** uuidv7,时间有序;会话内唯一。fork 复制的事件保留原 id,以维持 parentId / pinsKept 等引用 */\n id: string\n sessionId: string\n /** 会话内单调递增,从 1 起;是会话内排序的唯一依据 */\n seq: number\n /** Unix 毫秒 */\n at: number\n /** 命名空间化:内置 \"core.*\",宿主扩展 \"ext.*\" */\n type: string\n /** 该 type 自己的 schema 版本,从 1 起;读时按注册表升级(P9) */\n schemaVersion: number\n actor: Actor\n /** 因果链或分叉点:回答哪条消息、由哪次 tool_call 产生 */\n parentId?: string\n trust: Trust\n provenance?: Provenance\n /** 厂商专有回放数据(thinking signature、encrypted reasoning),不进通用字段 */\n replay?: Record<string, unknown>\n}\n\n/** 带类型载荷的事件。T 为 type 字面量,P 为 payload 形状。 */\nexport type Event<T extends string = string, P = unknown> = EventBase & {\n type: T\n payload: P\n}\n\n/**\n * 内容片段。用户消息、工具结果都由它组成;投影/降级时再翻译成各家 API 的 content block。\n * 第一版只有文本与图片;大结果不塞进片段,走 tool_result.spilled 外溢到 BlobStore。\n */\nexport type ContentPart = TextPart | ImagePart\n\nexport interface TextPart {\n type: \"text\"\n text: string\n}\n\nexport interface ImagePart {\n type: \"image\"\n mime: string\n /** base64 编码的图片字节 */\n data: string\n}\n\n/** 各 actor 的默认信任等级;工厂函数在未显式给出 trust 时使用。 */\nexport const DEFAULT_TRUST: Readonly<Record<Actor, Trust>> = {\n user: \"principal\",\n system: \"system\",\n host: \"system\",\n model: \"model\",\n tool: \"untrusted\",\n}\n","/**\n * UUID v7 生成(RFC 9562):前 48 位为 Unix 毫秒时间戳,字典序即时间序。\n * 只用 Web 标准 crypto.getRandomValues,不引依赖(P5)。\n *\n * 同一毫秒内的多个 id 之间顺序随机 —— 会话内排序以 seq 为准,id 只需全局唯一且大致有序。\n */\nexport function uuidv7(now: number = Date.now()): string {\n const bytes = new Uint8Array(16)\n crypto.getRandomValues(bytes)\n\n // 48 位时间戳,大端写入 bytes[0..5]\n let ts = now\n for (let i = 5; i >= 0; i--) {\n bytes[i] = ts & 0xff\n ts = Math.floor(ts / 256)\n }\n // 版本位:byte6 高 4 位 = 0111\n bytes[6] = ((bytes[6] as number) & 0x0f) | 0x70\n // 变体位:byte8 高 2 位 = 10\n bytes[8] = ((bytes[8] as number) & 0x3f) | 0x80\n\n const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\")\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`\n}\n","/**\n * 事件工厂:补齐 id / at / schemaVersion / trust,调用方只关心\"谁、在哪个会话、第几条、说了什么\"。\n * seq 由 EventLog 的 append 方决定(T4),这里要求显式传入,不替存储层做主。\n */\nimport { type Actor, DEFAULT_TRUST, type Event, type EventBase, type Provenance, type Trust } from \"./base.js\"\nimport type { CoreEventOf, CoreEventPayloads, CoreEventType } from \"./core.js\"\nimport { uuidv7 } from \"./id.js\"\nimport type { EventSchemaRegistry } from \"./registry.js\"\n\n/**\n * 事件草稿:还没进日志的事件,缺 id / seq / at / sessionId / schemaVersion。\n * 降级层(模型输出)与脑子模块(注入的 system_note)都只产出草稿,由循环补齐后 append ——\n * 谁分配 seq 只有循环知道,草稿不替它做主。\n */\nexport interface EventDraft<T extends string = string, P = unknown> {\n type: T\n payload: P\n actor: Actor\n /** 缺省按 DEFAULT_TRUST[actor] */\n trust?: Trust\n parentId?: string\n provenance?: Provenance\n replay?: Record<string, unknown>\n}\n\n/** 内置事件的草稿联合,type 与 payload 联动 */\nexport type CoreEventDraft = { [T in CoreEventType]: EventDraft<T, CoreEventPayloads[T]> }[CoreEventType]\n\nexport interface CreateEventInput<T extends string, P> extends EventDraft<T, P> {\n sessionId: string\n seq: number\n /** 测试注入用;缺省 Date.now() */\n at?: number\n id?: string\n}\n\n/**\n * 通用工厂。schemaVersion 从注册表取当前版本,所以未登记的 type 会在这里就被拒绝,\n * 而不是写进日志后读不出来。\n */\nexport function createEvent<T extends string, P>(\n registry: EventSchemaRegistry,\n input: CreateEventInput<T, P>,\n): Event<T, P> {\n const at = input.at ?? Date.now()\n const base: EventBase = {\n id: input.id ?? uuidv7(at),\n sessionId: input.sessionId,\n seq: input.seq,\n at,\n type: input.type,\n schemaVersion: registry.currentVersion(input.type),\n actor: input.actor,\n trust: input.trust ?? DEFAULT_TRUST[input.actor],\n }\n // 可选字段只在有值时写入,避免日志里出现一堆 undefined(exactOptionalPropertyTypes 也不允许)\n if (input.parentId !== undefined) base.parentId = input.parentId\n if (input.provenance !== undefined) base.provenance = input.provenance\n if (input.replay !== undefined) base.replay = input.replay\n return { ...base, type: input.type, payload: input.payload }\n}\n\n/** 内置事件的强类型版本:type 与 payload 联动校验。 */\nexport function createCoreEvent<T extends CoreEventType>(\n registry: EventSchemaRegistry,\n input: CreateEventInput<T, CoreEventPayloads[T]>,\n): CoreEventOf<T> {\n return createEvent(registry, input) as CoreEventOf<T>\n}\n","/**\n * 事件 schema 注册表(P9:schema 有版本,读时升级,查不到即拒绝)。\n *\n * 职责:\n * 1. 登记每个 type 的当前版本与逐级升级函数 upcast(v → v+1)\n * 2. read(raw):校验壳字段 → 查 type → 逐级升级到当前版本 → 返回类型化事件\n * 3. 任何一步查不到都抛 SchemaError(fail-closed),绝不静默返回半个事件\n *\n * 日志文件不做原地迁移:存的永远是写入时的版本,读时升级。\n */\nimport type { Actor, Event, EventBase, Trust } from \"./base.js\"\nimport type { CoreEventType } from \"./core.js\"\n\n/** 把 payload 从版本 from 升到 from+1。只碰 payload,壳字段由注册表保证不变。 */\nexport type Upcaster = (payload: unknown) => unknown\n\nexport interface EventSchema {\n type: string\n /** 当前版本;新写入的事件一律打这个版本号 */\n version: number\n /**\n * 升级函数表,键为\"起点版本\":upcasters[1] 把 v1 升到 v2。\n * version 为 n 时必须覆盖 1..n-1 全部键,缺一个即注册失败 —— 宁可启动时报错,不要读到一半才发现。\n */\n upcasters?: Readonly<Record<number, Upcaster>>\n}\n\nexport type SchemaErrorCode =\n | \"malformed_base\" // 壳字段缺失或类型不对\n | \"unknown_type\" // 没登记的 type\n | \"future_version\" // 版本比注册表还新(旧代码读新日志)\n | \"missing_upcaster\" // 升级链断了\n | \"upcaster_failed\" // 升级函数自己抛了\n | \"invalid_schema\" // 登记时的定义不合法\n\nexport class SchemaError extends Error {\n constructor(\n readonly code: SchemaErrorCode,\n message: string,\n readonly context: { type?: string; version?: number } = {},\n ) {\n super(`[${code}] ${message}`)\n this.name = \"SchemaError\"\n }\n}\n\nconst ACTORS: ReadonlySet<string> = new Set<Actor>([\"user\", \"model\", \"tool\", \"system\", \"host\"])\nconst TRUSTS: ReadonlySet<string> = new Set<Trust>([\"principal\", \"system\", \"model\", \"untrusted\"])\n\nexport class EventSchemaRegistry {\n private readonly schemas = new Map<string, EventSchema>()\n\n constructor(schemas: Iterable<EventSchema> = []) {\n for (const s of schemas) this.register(s)\n }\n\n /** 登记一个 type。重复登记同一 type 视为错误,避免两处定义互相覆盖。 */\n register(schema: EventSchema): this {\n if (!schema.type || !/^(core|ext)\\.[a-z][a-z0-9_]*$/.test(schema.type)) {\n throw new SchemaError(\"invalid_schema\", `type 必须形如 \"core.xxx\" 或 \"ext.xxx\":${schema.type}`, {\n type: schema.type,\n })\n }\n if (!Number.isInteger(schema.version) || schema.version < 1) {\n throw new SchemaError(\"invalid_schema\", `version 必须是 ≥1 的整数:${schema.version}`, {\n type: schema.type,\n version: schema.version,\n })\n }\n if (this.schemas.has(schema.type)) {\n throw new SchemaError(\"invalid_schema\", `type 已登记:${schema.type}`, { type: schema.type })\n }\n for (let v = 1; v < schema.version; v++) {\n if (typeof schema.upcasters?.[v] !== \"function\") {\n throw new SchemaError(\n \"invalid_schema\",\n `${schema.type} 当前版本 ${schema.version},但缺少 v${v}→v${v + 1} 的升级函数`,\n { type: schema.type, version: v },\n )\n }\n }\n this.schemas.set(schema.type, schema)\n return this\n }\n\n has(type: string): boolean {\n return this.schemas.has(type)\n }\n\n /** 该 type 当前应写入的版本号;未登记则抛 unknown_type。 */\n currentVersion(type: string): number {\n const s = this.schemas.get(type)\n if (!s) throw new SchemaError(\"unknown_type\", `未登记的事件类型:${type}`, { type })\n return s.version\n }\n\n /**\n * 从存储读出的原始对象 → 当前版本的事件。\n * 泛型只是给调用方的类型提示(如 read<CoreEvent>),运行时校验的是壳与版本,不校验 payload 形状 ——\n * payload 的正确性由写入方与升级函数负责。\n */\n read<E extends Event = Event>(raw: unknown): E {\n const base = assertBase(raw)\n const schema = this.schemas.get(base.type)\n if (!schema) {\n throw new SchemaError(\"unknown_type\", `未登记的事件类型:${base.type}`, { type: base.type })\n }\n if (base.schemaVersion > schema.version) {\n throw new SchemaError(\n \"future_version\",\n `${base.type} v${base.schemaVersion} 比本地已知的 v${schema.version} 更新,请升级代码`,\n { type: base.type, version: base.schemaVersion },\n )\n }\n\n let payload = (raw as { payload?: unknown }).payload\n for (let v = base.schemaVersion; v < schema.version; v++) {\n const up = schema.upcasters?.[v]\n if (!up) {\n // register() 已保证不会走到这里,留作防御\n throw new SchemaError(\"missing_upcaster\", `${base.type} 缺少 v${v}→v${v + 1} 的升级函数`, {\n type: base.type,\n version: v,\n })\n }\n try {\n payload = up(payload)\n } catch (cause) {\n throw new SchemaError(\n \"upcaster_failed\",\n `${base.type} v${v}→v${v + 1} 升级失败:${cause instanceof Error ? cause.message : String(cause)}`,\n { type: base.type, version: v },\n )\n }\n }\n\n return { ...base, schemaVersion: schema.version, payload } as E\n }\n}\n\n/** 校验壳字段。只看公共字段,payload 不管。 */\nfunction assertBase(raw: unknown): EventBase {\n if (typeof raw !== \"object\" || raw === null) {\n throw new SchemaError(\"malformed_base\", \"事件必须是对象\")\n }\n const r = raw as Record<string, unknown>\n const fail = (field: string, expect: string): never => {\n throw new SchemaError(\n \"malformed_base\",\n `字段 ${field} 应为 ${expect}`,\n typeof r.type === \"string\" ? { type: r.type } : {},\n )\n }\n if (typeof r.id !== \"string\" || r.id === \"\") fail(\"id\", \"非空字符串\")\n if (typeof r.sessionId !== \"string\" || r.sessionId === \"\") fail(\"sessionId\", \"非空字符串\")\n if (!Number.isInteger(r.seq) || (r.seq as number) < 1) fail(\"seq\", \"≥1 的整数\")\n if (typeof r.at !== \"number\" || !Number.isFinite(r.at)) fail(\"at\", \"有限数字\")\n if (typeof r.type !== \"string\" || r.type === \"\") fail(\"type\", \"非空字符串\")\n if (!Number.isInteger(r.schemaVersion) || (r.schemaVersion as number) < 1)\n fail(\"schemaVersion\", \"≥1 的整数\")\n if (typeof r.actor !== \"string\" || !ACTORS.has(r.actor)) fail(\"actor\", \"user|model|tool|system|host\")\n if (typeof r.trust !== \"string\" || !TRUSTS.has(r.trust)) fail(\"trust\", \"principal|system|model|untrusted\")\n if (r.parentId !== undefined && typeof r.parentId !== \"string\") fail(\"parentId\", \"字符串或缺省\")\n if (r.provenance !== undefined) {\n const p = r.provenance as Record<string, unknown> | null\n if (typeof p !== \"object\" || p === null || typeof p.source !== \"string\")\n fail(\"provenance\", \"{ source: string }\")\n }\n if (r.replay !== undefined && (typeof r.replay !== \"object\" || r.replay === null))\n fail(\"replay\", \"对象或缺省\")\n return r as unknown as EventBase\n}\n\n/** 全部内置事件当前都是 v1。升版本时在此加 upcasters,并在 core.ts 改载荷类型。 */\nexport const CORE_SCHEMAS: readonly EventSchema[] = (\n [\n \"core.user_message\",\n \"core.model_text\",\n \"core.model_thinking\",\n \"core.tool_call\",\n \"core.tool_result\",\n \"core.system_note\",\n \"core.approval_request\",\n \"core.approval_decision\",\n \"core.compaction\",\n \"core.handoff\",\n \"core.memory_op\",\n \"core.budget_usage\",\n \"core.run_paused\",\n \"core.run_resumed\",\n \"core.tools_bound\",\n \"core.error\",\n ] satisfies CoreEventType[]\n).map((type) => ({ type, version: 1 }))\n\n/** 预装了全部 core.* 的注册表。宿主要加 ext.* 时 new 一个并传入 [...CORE_SCHEMAS, ...自己的]。 */\nexport function createCoreRegistry(extra: Iterable<EventSchema> = []): EventSchemaRegistry {\n return new EventSchemaRegistry([...CORE_SCHEMAS, ...extra])\n}\n"],"mappings":";AA2EO,IAAM,gBAAgD;AAAA,EAC3D,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AACR;;;AC3EO,SAAS,OAAO,MAAc,KAAK,IAAI,GAAW;AACvD,QAAM,QAAQ,IAAI,WAAW,EAAE;AAC/B,SAAO,gBAAgB,KAAK;AAG5B,MAAI,KAAK;AACT,WAAS,IAAI,GAAG,KAAK,GAAG,KAAK;AAC3B,UAAM,CAAC,IAAI,KAAK;AAChB,SAAK,KAAK,MAAM,KAAK,GAAG;AAAA,EAC1B;AAEA,QAAM,CAAC,IAAM,MAAM,CAAC,IAAe,KAAQ;AAE3C,QAAM,CAAC,IAAM,MAAM,CAAC,IAAe,KAAQ;AAE3C,QAAM,MAAM,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE;AAC7E,SAAO,GAAG,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,IAAI,IAAI,MAAM,IAAI,EAAE,CAAC,IAAI,IAAI,MAAM,IAAI,EAAE,CAAC,IAAI,IAAI,MAAM,EAAE,CAAC;AAC1G;;;ACiBO,SAAS,YACd,UACA,OACa;AACb,QAAM,KAAK,MAAM,MAAM,KAAK,IAAI;AAChC,QAAM,OAAkB;AAAA,IACtB,IAAI,MAAM,MAAM,OAAO,EAAE;AAAA,IACzB,WAAW,M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