@lmzhen/dsh-evolution-core 0.37.0 → 0.38.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.
Files changed (51) hide show
  1. package/README.md +3 -1
  2. package/lib/composition/index.js +2 -2
  3. package/lib/{composition-3QFfEe56.js → composition-dy0gJWDd.js} +1 -1
  4. package/lib/{ensure-C2tUoF5U.js → ensure-B4fjEI0w.js} +4 -11
  5. package/lib/{errors-DRZ9A187.js → errors-DUcEoTLR.js} +4 -4
  6. package/lib/index.js +37 -1305
  7. package/lib/platform/index.js +4 -0
  8. package/lib/platform-Be-_wSVz.js +113 -0
  9. package/lib/presets-C8vuCuNA.js +27 -0
  10. package/lib/restrictor.js +8 -8
  11. package/lib/runtime/plugin.js +197 -0
  12. package/lib/session-projection-CXUNPkq9.js +1250 -0
  13. package/lib/subagent/index.js +1 -1
  14. package/lib/tools-DzcNFex2.js +20 -0
  15. package/lib/types/composition/ensure.js +3 -13
  16. package/lib/types/errors.d.ts +4 -4
  17. package/lib/types/errors.js +4 -4
  18. package/lib/types/opt-in.d.ts +1 -1
  19. package/lib/types/opt-in.js +1 -1
  20. package/lib/types/params.js +7 -7
  21. package/lib/types/platform/index.d.ts +21 -0
  22. package/lib/types/platform/index.js +12 -0
  23. package/lib/types/platform/llm.d.ts +46 -0
  24. package/lib/types/platform/llm.js +75 -0
  25. package/lib/types/platform/presets.d.ts +31 -0
  26. package/lib/types/platform/presets.js +31 -0
  27. package/lib/types/platform/projections.d.ts +30 -0
  28. package/lib/types/platform/projections.js +31 -0
  29. package/lib/types/platform/tools.d.ts +23 -0
  30. package/lib/types/platform/tools.js +21 -0
  31. package/lib/types/platform-line.generated.d.ts +6 -6
  32. package/lib/types/platform-line.generated.js +6 -6
  33. package/lib/types/platform-services.d.ts +1 -1
  34. package/lib/types/platform-services.js +4 -1
  35. package/lib/types/restrictor.js +7 -9
  36. package/lib/types/runtime/llm.d.ts +34 -0
  37. package/lib/types/runtime/llm.js +71 -0
  38. package/lib/types/runtime/platform.d.ts +35 -0
  39. package/lib/types/runtime/platform.js +38 -0
  40. package/lib/types/runtime/plugin.d.ts +10 -0
  41. package/lib/types/runtime/plugin.js +11 -0
  42. package/lib/types/runtime/projections.d.ts +29 -0
  43. package/lib/types/runtime/projections.js +62 -0
  44. package/lib/types/scope.d.ts +1 -1
  45. package/lib/types/session-projection.d.ts +26 -53
  46. package/lib/types/session-projection.js +22 -58
  47. package/lib/types/skill-reads.js +3 -3
  48. package/lib/types/subagent/types.d.ts +1 -1
  49. package/lib/types/tool-dispatch.d.ts +2 -2
  50. package/lib/types/tool-dispatch.js +3 -3
  51. package/package.json +30 -16
package/lib/index.js CHANGED
@@ -1,7 +1,8 @@
1
- import { _ as scopedPackageName, c as MAINTAINER_PRESET_ID, d as RESTRICTED_TOOLS_ROW_ID, f as RESTRICTOR_MODULE, g as scopeOfNearestManifest, p as REVIEWER_PRESET_ID, s as EVOLUTION_PRESET_IDS, u as RESTRICTED_PRESET_DISPLAY } from "./ensure-C2tUoF5U.js";
1
+ import { A as countDispatches, B as supportFileReadFromPath, C as PTC_DISPATCH_EVENT, D as assertDispatchPayload, E as ToolDispatchPayloadError, F as isProgramToolName, G as KEEP_LINE_RE, H as CITATION_SUPPORT_DIRS, I as isSkillReadToolName, J as scanBodyHooks, K as isFileShapedPath, L as isSkillToolName, M as dispatchPathOf, N as dispatchStepOf, O as collectReadSkillNames, P as foldToolDispatches, R as readDispatchSignal, S as NATIVE_RESULT_EVENT, T as ToolDispatchNormalizer, U as DEFAULT_CITATION_REF_BUDGET, V as supportFileReadOf, W as HOOK_LINE_RE, _ as observeEvent, a as evolutionSignalsProjection, b as MODEL_SESSION_EVENT_TYPES, c as sessionLastEventTime, d as evidenceKindIndex, f as isBookkeepingFrame, g as initialTurnFold, h as foldTurnEvents, i as evolutionReadsProjection, j as dispatchKeyOf, k as collectReadSupportFiles, l as sessionReadNames, m as foldTurnEvent, n as evolutionEvidenceProjection, o as isProjectableSession, p as advanceReview, q as resolveCitations, r as evolutionProjectionHistoryProjection, s as sessionEvidenceIndex, t as evolutionActivityProjection, u as sessionTurnSignals, v as DEFAULT_SUPPORT_READ_TOOL_NAMES, w as PTC_DISPATCH_START_EVENT, x as NATIVE_CALL_EVENT, y as DISPATCH_EVENT_TYPES, z as skillReadNameOf } from "./session-projection-CXUNPkq9.js";
2
+ import { _ as scopedPackageName, c as MAINTAINER_PRESET_ID, d as RESTRICTED_TOOLS_ROW_ID, f as RESTRICTOR_MODULE, g as scopeOfNearestManifest, p as REVIEWER_PRESET_ID, s as EVOLUTION_PRESET_IDS, u as RESTRICTED_PRESET_DISPLAY } from "./ensure-B4fjEI0w.js";
2
3
  import { a as methodNotAllowed, c as asRecord, i as json, l as isRecord, n as MAX_REQUEST_BODY_BYTES, o as readJsonObject, r as hostSurface, s as registerHostRoutes, t as HOST_ROUTES } from "./http-routes-_anZVlPf.js";
3
- import { w as allowRowCollisions } from "./composition-3QFfEe56.js";
4
- import { n as errorText, t as EVOLUTION_ERRORS } from "./errors-DRZ9A187.js";
4
+ import { w as allowRowCollisions } from "./composition-dy0gJWDd.js";
5
+ import { n as errorText, t as EVOLUTION_ERRORS } from "./errors-DUcEoTLR.js";
5
6
  import { createSubagentChannel, probeChannelState, subagentChannelState } from "./subagent/index.js";
6
7
  import { createHash, randomBytes, randomUUID } from "node:crypto";
7
8
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
@@ -11,204 +12,6 @@ import { fileURLToPath } from "node:url";
11
12
  import { parse } from "yaml";
12
13
  import { homedir } from "node:os";
13
14
  import { scopeOf } from "@deepseek-ai/dsh-scope";
14
- import { z } from "zod";
15
- //#region lib/types/citations.js
16
- /**
17
- * Citation resolution for skill bodies and support files (design §5.2).
18
- *
19
- * WHY this exists beside `supportRefs` (skill-store.ts): that scanner answers
20
- * "does this text contain a path-shaped token", which is the right question
21
- * when a package is being ARCHIVED — every such path may dangle — and the wrong
22
- * one when a section is only being MOVED, where nothing leaves and the only
23
- * thing that changes is the directory a citation is read from. Measured false
24
- * positives of the token scan: a URL tail (`https://host/references/x.md`), a
25
- * category path the original Hermes documents as legitimate
26
- * (`skills/scripts/foo.py`), and a prose command line
27
- * (`npm run scripts/build.mjs`).
28
- *
29
- * CONTRACT: a token whose path STARTS WITH a support directory is a citation of
30
- * this skill and is resolved from the SKILL ROOT, in whichever file it is
31
- * written. A token that merely contains a support directory further along its
32
- * path belongs to something else: it is reported as `foreign` and never
33
- * resolved.
34
- *
35
- * PURE: existence is decided against the caller's file list, so identical
36
- * inputs always answer the same report.
37
- */
38
- /** Support directories that make a path a citation of the owning skill. */
39
- const CITATION_SUPPORT_DIRS = [
40
- "references",
41
- "templates",
42
- "scripts",
43
- "assets"
44
- ];
45
- /** Scan budget: bounded so a pathological body cannot stall a maintenance run. */
46
- const DEFAULT_CITATION_REF_BUDGET = 500;
47
- /** Words that introduce an executable command rather than a citation. */
48
- const PROSE_COMMAND_PREFIXES = [
49
- "npm",
50
- "pnpm",
51
- "yarn",
52
- "npx",
53
- "node",
54
- "python",
55
- "python3",
56
- "bash",
57
- "sh",
58
- "git",
59
- "gh",
60
- "run"
61
- ];
62
- const TOKEN_RE = /(?:references|templates|scripts|assets)\/[A-Za-z0-9._/-]+/g;
63
- const TOKEN_CHAR_RE = /[A-Za-z0-9._/-]/;
64
- const FENCE_RE = /^\s*(`{3,}|~{3,})/;
65
- const TRAILING_PUNCT_RE = /[.,;:]+$/;
66
- /** A citation's final segment must look like \u0060name.ext\u0060: a bare \u0060.\u0060 or a dotless
67
- * segment is a directory mention, not a file. */
68
- const FILE_SEGMENT_RE = /^[^.].*\.[^.]+$/;
69
- const FRAGMENT_RE = /^#([A-Za-z0-9._-]+)/;
70
- /** Whether the token starting at `start` is the argument of a shell command. */
71
- function isProseCommand(line, start) {
72
- const head = line.slice(0, start).trimEnd();
73
- if (head === "") return false;
74
- const word = head.split(/\s+/).pop() ?? "";
75
- return PROSE_COMMAND_PREFIXES.includes(word);
76
- }
77
- /** The token's final path segment (`references/a/b.md` -> `b.md`). */
78
- function lastSegmentOf(target) {
79
- return target.slice(target.lastIndexOf("/") + 1);
80
- }
81
- /** The token's parent directory within the skill (`references/a/b.md` -> `references/a`). */
82
- function parentDirOf(target) {
83
- const cut = target.lastIndexOf("/");
84
- return cut <= 0 ? "" : target.slice(0, cut);
85
- }
86
- /** Classify one token by its first path segment. */
87
- function classifyToken(token) {
88
- const head = token.split("/")[0] ?? "";
89
- return CITATION_SUPPORT_DIRS.includes(head) ? "citation" : "foreign";
90
- }
91
- /**
92
- * Resolve every path-shaped token in `content`.
93
- * @param input - content, the skill-root-relative path of its owner, the skill's
94
- * file list, and an optional scan budget.
95
- * @returns the refs plus the dangling and foreign subsets; `truncated` marks a
96
- * report that stopped at the budget.
97
- */
98
- function resolveCitations(input) {
99
- const budget = input.budget ?? 500;
100
- const files = new Set(input.files.map((path) => path.replace(/\\/g, "/")));
101
- const refs = [];
102
- const seen = /* @__PURE__ */ new Set();
103
- let truncated = false;
104
- let fence = null;
105
- const lines = input.content.split("\n");
106
- for (let index = 0; index < lines.length && !truncated; index += 1) {
107
- const rawLine = lines[index] ?? "";
108
- const line = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
109
- const fenceMark = FENCE_RE.exec(line);
110
- if (fenceMark) {
111
- const marker = fenceMark[1] ?? "";
112
- fence = fence === null ? marker.slice(0, 1) : null;
113
- continue;
114
- }
115
- for (const match of line.matchAll(TOKEN_RE)) {
116
- const matched = match[0];
117
- const matchedAt = match.index;
118
- let start = matchedAt;
119
- while (start > 0 && TOKEN_CHAR_RE.test(line[start - 1] ?? "")) start -= 1;
120
- const prefix = line.slice(0, start);
121
- const tail = line.slice(matchedAt + matched.length);
122
- const fragment = FRAGMENT_RE.exec(tail)?.[1];
123
- const token = matched.replace(TRAILING_PUNCT_RE, "");
124
- const scanned = line.slice(start, matchedAt + matched.length);
125
- const classified = fence !== null ? "fence" : prefix.endsWith(":") && line.slice(start, start + 2) === "//" ? "url" : isProseCommand(line, start) ? "prose" : classifyToken(scanned);
126
- const namesFile = !scanned.split("/").includes("..") && (FILE_SEGMENT_RE.test(lastSegmentOf(scanned)) || files.has(token));
127
- const kind = classified === "citation" && !namesFile ? "prose" : classified;
128
- const target = kind === "citation" ? token : null;
129
- const key = `${index}|${kind}|${target ?? token}`;
130
- if (seen.has(key)) continue;
131
- seen.add(key);
132
- refs.push({
133
- raw: token,
134
- line: index + 1,
135
- target,
136
- base: "root",
137
- kind,
138
- exists: target !== null && files.has(target),
139
- ...fragment === void 0 ? {} : { fragment }
140
- });
141
- if (refs.length >= budget) {
142
- truncated = true;
143
- break;
144
- }
145
- }
146
- }
147
- const citations = refs.filter((ref) => ref.kind === "citation");
148
- const undecidable = (ref) => {
149
- const target = ref.target;
150
- return target !== null && !ref.exists && files.has(parentDirOf(target));
151
- };
152
- return {
153
- refs,
154
- dangling: citations.filter((ref) => !ref.exists && !undecidable(ref)),
155
- unverified: citations.filter(undecidable),
156
- foreign: refs.filter((ref) => ref.kind !== "citation"),
157
- truncated
158
- };
159
- }
160
- /** The sanctioned body hook (design §5.6): a list item whose payload is
161
- * exactly one support-file path, so the file stays discoverable in the body. */
162
- const HOOK_LINE_RE = /^- [^\n]{1,60} → ((?:references|templates|scripts|assets)\/[a-z0-9][a-z0-9._/-]*)$/;
163
- /** The retirement escape hatch (design §5.6): a standalone body comment that
164
- * names the support file it exempts and the reason it must survive. The path
165
- * is part of the marker because the proposal list is per FILE, and a reason is
166
- * required — an unexplained exemption is what this hook exists to prevent. */
167
- const KEEP_LINE_RE = /^<!--\s*keep:\s*((?:references|templates|scripts|assets)\/[a-z0-9][a-z0-9._/-]*)\s+(\S[^>]*?)\s*-->$/;
168
- /** Whether a skill-relative path names a FILE rather than a directory: the same
169
- * rule the scanner applies to a token's final segment (`name.ext`). The support
170
- * listing is one level deep and includes directory entries (a real library has
171
- * `references/archive`), which no pointer or retirement list may treat as a file.
172
- * @param path - a skill-root-relative support path.
173
- * @returns true when the final segment is file-shaped.
174
- */
175
- function isFileShapedPath(path) {
176
- return FILE_SEGMENT_RE.test(path.slice(path.lastIndexOf("/") + 1));
177
- }
178
- /**
179
- * Scan a body for sanctioned hooks and `keep` markers.
180
- * @param content - the SKILL.md body (frontmatter included).
181
- * @returns hook targets plus the `keep` reasons keyed by target.
182
- */
183
- function scanBodyHooks(content) {
184
- const targets = [];
185
- const seen = /* @__PURE__ */ new Set();
186
- const kept = /* @__PURE__ */ new Map();
187
- let fence = null;
188
- for (const rawLine of content.split("\n")) {
189
- const line = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
190
- const fenceMark = FENCE_RE.exec(line);
191
- if (fenceMark) {
192
- fence = fence === null ? (fenceMark[1] ?? "").slice(0, 1) : null;
193
- continue;
194
- }
195
- if (fence !== null) continue;
196
- const keep = KEEP_LINE_RE.exec(line);
197
- if (keep?.[1] !== void 0) {
198
- kept.set(keep[1], (keep[2] ?? "").trim());
199
- continue;
200
- }
201
- const target = HOOK_LINE_RE.exec(line)?.[1];
202
- if (target === void 0 || seen.has(target)) continue;
203
- seen.add(target);
204
- targets.push(target);
205
- }
206
- return {
207
- targets,
208
- kept
209
- };
210
- }
211
- //#endregion
212
15
  //#region lib/types/tree-write.js
213
16
  /**
214
17
  * G1/1.5 (S7-09): the TYPED critical section around a tree write.
@@ -9085,7 +8888,7 @@ function renderLongRunTable() {
9085
8888
  * `client` probes run in the browser half, where the host has no view of the seats.
9086
8889
  * @module @lmzhen/dsh-evolution-core
9087
8890
  */
9088
- /** The 30 probes, in service-name order (the guard checks this list against the tree). */
8891
+ /** The probes, in service-name order (the guard checks this list against the tree). */
9089
8892
  const PLATFORM_SERVICE_PROBES = Object.freeze([
9090
8893
  {
9091
8894
  service: "agentDefaultModel",
@@ -9147,6 +8950,11 @@ const PLATFORM_SERVICE_PROBES = Object.freeze([
9147
8950
  feature: "the memory-budget divergence section of this report",
9148
8951
  side: "host"
9149
8952
  },
8953
+ {
8954
+ service: "evolutionPlatform",
8955
+ feature: "the single host edge object behind every family platform port",
8956
+ side: "host"
8957
+ },
9150
8958
  {
9151
8959
  service: "evolutionPolicy",
9152
8960
  feature: "the policy snapshot that shadows row knobs",
@@ -9192,6 +9000,16 @@ const PLATFORM_SERVICE_PROBES = Object.freeze([
9192
9000
  feature: "the domain-owned session units",
9193
9001
  side: "host"
9194
9002
  },
9003
+ {
9004
+ service: "evolutionProjections",
9005
+ feature: "the family-owned projection runtime behind the pure readers",
9006
+ side: "host"
9007
+ },
9008
+ {
9009
+ service: "evolutionLlm",
9010
+ feature: "the family LLM runtime for auxiliary model calls",
9011
+ side: "host"
9012
+ },
9195
9013
  {
9196
9014
  service: "sessionQuery",
9197
9015
  feature: "the session corpus behind /evolution sessions",
@@ -9566,1091 +9384,6 @@ function assessStructureHealth(snapshot, thresholds = DEFAULT_HEALTH_THRESHOLDS)
9566
9384
  };
9567
9385
  }
9568
9386
  //#endregion
9569
- //#region lib/types/tool-dispatch.js
9570
- /**
9571
- * The family's ONE reader of platform tool-dispatch events.
9572
- *
9573
- * The platform records a finished tool call under two different event
9574
- * vocabularies and only one of them is written per dispatch, chosen by the
9575
- * mounted tool runtime's mode:
9576
- *
9577
- * - native mode: \`tool/call\` (with \`callId\`) settled by \`tool/result\`, the
9578
- * write sites being core/agent-loop/src/tool-calls.ts:264 and :282.
9579
- * - PTC mode: \`tool/ptc-dispatch-start\` and \`tool/ptc-dispatch\` (with
9580
- * \`subCallId\`), the write sites being core/tools/src/ptc.ts:534 and :509.
9581
- *
9582
- * A consumer that matches a vocabulary directly therefore goes blind in the
9583
- * other mode while still appearing to work — the defect this module exists to
9584
- * make impossible. Every family consumer reads dispatches through
9585
- * \`ToolDispatchNormalizer\` (or the pure helpers below) and matches on
9586
- * \`ToolDispatchSignal\` fields only; \`verify-arch-guards\` rule N11 rejects a
9587
- * dispatch event-type comparison anywhere else.
9588
- *
9589
- * ## The one-dispatch invariant
9590
- *
9591
- * One dispatch produces exactly one \`ToolDispatchSignal\`, no matter how many
9592
- * events carry it: a start/settle pair for a PTC sub-dispatch, a call/result
9593
- * pair for a native call, or both vocabularies for the same call. Deduplication
9594
- * and outcome folding are keyed by the platform's own per-vocabulary call
9595
- * identity, which is stable across the pair (the platform's event JSDoc:
9596
- * "the pairing ids (matching the \`tool/ptc-dispatch-start\` with the same
9597
- * \`subCallId\`)").
9598
- *
9599
- * ## Layer
9600
- *
9601
- * Cross-cutting normalization: the reader half of the dispatch vocabulary,
9602
- * next to \`signals.ts\` (which folds the signals this module emits). Both are
9603
- * consumers; neither subscribes to the platform bus itself.
9604
- * @module
9605
- */
9606
- /** The platform event type carrying a PTC sub-dispatch start. */
9607
- const PTC_DISPATCH_START_EVENT = "tool/ptc-dispatch-start";
9608
- /** The platform event type carrying a PTC sub-dispatch settle. */
9609
- const PTC_DISPATCH_EVENT = "tool/ptc-dispatch";
9610
- /** The platform event type carrying a native tool call. */
9611
- const NATIVE_CALL_EVENT = "tool/call";
9612
- /** The platform event type carrying a native tool result. */
9613
- const NATIVE_RESULT_EVENT = "tool/result";
9614
- /**
9615
- * The dispatch vocabulary this module owns. A consumer must never compare
9616
- * against these literals itself (rule N11); it compares \`kind\` instead.
9617
- */
9618
- const DISPATCH_EVENT_TYPES = [
9619
- NATIVE_CALL_EVENT,
9620
- NATIVE_RESULT_EVENT,
9621
- PTC_DISPATCH_START_EVENT,
9622
- PTC_DISPATCH_EVENT
9623
- ];
9624
- /**
9625
- * Model-visible session frames: the message types plus the ONE dispatch vocabulary above.
9626
- * Consumers classify through this list instead of naming event literals (rule N11).
9627
- */
9628
- const MODEL_SESSION_EVENT_TYPES = [
9629
- "user/message",
9630
- "assistant/message",
9631
- ...DISPATCH_EVENT_TYPES
9632
- ];
9633
- /**
9634
- * \`TypeError\` thrown when a payload that claims to be a dispatch event
9635
- * violates the platform's event declaration. Named so a deployment can tell this
9636
- * refusal apart from a generic failure in a log line.
9637
- */
9638
- var ToolDispatchPayloadError = class extends TypeError {
9639
- name = "ToolDispatchPayloadError";
9640
- };
9641
- /** The dispatch event types this module recognizes, as a set. */
9642
- const DISPATCH_EVENT_TYPE_SET = new Set(DISPATCH_EVENT_TYPES);
9643
- /** \`name\`-less payloads: an external emitter or a corrupt log can produce these. */
9644
- const MALFORMED = "malformed";
9645
- /** One tool-result block of a native result payload, or \`null\` when the payload carries none. */
9646
- function firstResultBlock(data) {
9647
- const content = data.message?.content;
9648
- if (!Array.isArray(content)) return null;
9649
- for (const entry of content) {
9650
- if (entry === null || typeof entry !== "object") continue;
9651
- const block = entry;
9652
- if (block.type === "tool-result") return block;
9653
- }
9654
- return null;
9655
- }
9656
- /** Deterministic identity for a dispatch payload that carries no call id. */
9657
- function payloadIdentity(data) {
9658
- if (data === void 0) return "";
9659
- try {
9660
- return JSON.stringify(data);
9661
- } catch {
9662
- return "";
9663
- }
9664
- }
9665
- /** Read the payload of a recognized dispatch event, or \`null\` for any other event. */
9666
- function readDispatchRecord(event) {
9667
- if (!DISPATCH_EVENT_TYPE_SET.has(event.type)) return null;
9668
- const data = event.data ?? {};
9669
- if (event.type === "tool/result") {
9670
- const owner = data.message?.source?.callId;
9671
- const block = firstResultBlock(data);
9672
- const callId = typeof owner === "string" && owner !== "" ? owner : typeof block?.toolCallId === "string" && block.toolCallId !== "" ? block.toolCallId : void 0;
9673
- if (callId === void 0) return null;
9674
- return {
9675
- kind: "native",
9676
- callId,
9677
- rootCallId: callId,
9678
- name: "",
9679
- arguments: void 0,
9680
- outcome: { ok: data.isError !== true && data.error === void 0 && block?.isError !== true }
9681
- };
9682
- }
9683
- const isPtc = event.type === "tool/ptc-dispatch-start" || event.type === "tool/ptc-dispatch";
9684
- const identity = isPtc ? data.subCallId : data.callId;
9685
- const callId = typeof identity === "string" && identity !== "" ? identity : `${event.type}:${payloadIdentity(event.data)}`;
9686
- const parent = isPtc && typeof data.parentCallId === "string" && data.parentCallId !== "" ? data.parentCallId : void 0;
9687
- const name = typeof data.name === "string" && data.name !== "" ? data.name : MALFORMED;
9688
- return {
9689
- kind: isPtc ? "program" : "native",
9690
- callId,
9691
- rootCallId: typeof data.rootCallId === "string" && data.rootCallId !== "" ? data.rootCallId : parent ?? callId,
9692
- name,
9693
- arguments: data.arguments,
9694
- ...isPtc && event.type === "tool/ptc-dispatch" ? { outcome: { ok: data.isError !== true } } : {}
9695
- };
9696
- }
9697
- /**
9698
- * The ledger key of one dispatch: a scope-qualified call id.
9699
- *
9700
- * v43 audit (FLOW4-4): a normalizer shared by every session (skill-usage's live listener holds ONE
9701
- * process-wide instance) used the bare call id, so two sessions that produced the same id — PTC
9702
- * sub-call ids are short, and an id-less payload falls back to a type+payload key that is not
9703
- * unique by construction — collided: the second session's read was absorbed as "already seen" and
9704
- * never counted, and a settle in one session flipped the other's `ok`. Callers that span sessions
9705
- * pass the session id as `scope`.
9706
- * @param callId - the dispatch's call id (or its payload-derived fallback).
9707
- * @param scope - the owning session id, or '' for a fold that never leaves one session.
9708
- * @returns the key both the ledger and every projection fold dedupe on.
9709
- */
9710
- function dispatchKeyOf(callId, scope = "") {
9711
- return scope === "" ? callId : `${scope}:${callId}`;
9712
- }
9713
- /**
9714
- * The pure half of the ledger: what one event says about one dispatch.
9715
- *
9716
- * The DECISION (which dispatch, and whether this event is the one that opens it) lives here and
9717
- * only here; carriers differ in what they keep — the class below keeps consumer-visible mutable
9718
- * signals, the family's `evolutionReads`/`evolutionSignals` projection units keep plain-JSON
9719
- * ledgers. `name` is empty on an event that only settles an already-opened dispatch (a native
9720
- * `tool/result`), and `outcome` is present exactly when the event carried one.
9721
- * @param event - one session event; any non-dispatch event answers `null`.
9722
- * @param scope - the owning session id, or '' for a single-session fold.
9723
- * @returns the step, or `null` when the event is not a dispatch.
9724
- */
9725
- function dispatchStepOf(event, scope = "") {
9726
- const record = readDispatchRecord(event);
9727
- if (record === null) return null;
9728
- return {
9729
- key: dispatchKeyOf(record.callId, scope),
9730
- kind: record.kind,
9731
- callId: record.callId,
9732
- rootCallId: record.rootCallId,
9733
- name: record.name,
9734
- arguments: record.arguments,
9735
- ...record.outcome === void 0 ? {} : { outcome: record.outcome }
9736
- };
9737
- }
9738
- /**
9739
- * The family's single dispatch ledger: absorbs platform events in log order,
9740
- * emits one \`ToolDispatchSignal\` per dispatch, and folds later events of the
9741
- * same dispatch into the record it already emitted.
9742
- *
9743
- * Consumers keep the \`ToolDispatchSignal\` object they received and re-read it
9744
- * later; no consumer needs to correlate events itself.
9745
- */
9746
- var ToolDispatchNormalizer = class {
9747
- records = /* @__PURE__ */ new Map();
9748
- /** S2-P2-14: cap for the LEDGER (and the settle markers) — opt-in, meant for
9749
- * the long-lived live listener (skill-usage) whose ledger is pure dedup
9750
- * state and would otherwise grow with the process lifetime. `Infinity` (the
9751
- * default, used by whole-log folding) keeps every dispatch. Eviction is
9752
- * oldest-first: a call/result pair spans one tool call, so an evicted
9753
- * dispatch can never be re-paired within any realistic window. */
9754
- maxTracked;
9755
- /** S2-P2-12: call ids whose outcome has already been reported to the settle
9756
- * channel — a replayed result event must not settle the same dispatch twice. */
9757
- settledIds = /* @__PURE__ */ new Set();
9758
- constructor(options = {}) {
9759
- this.maxTracked = options.maxTracked ?? Number.POSITIVE_INFINITY;
9760
- }
9761
- /**
9762
- * Absorb one session event.
9763
- * @param event - the event to absorb; any non-dispatch event is ignored.
9764
- * @returns the dispatch's signal when this event FIRST reveals the dispatch,
9765
- * otherwise \`null\` (the paired event of an already-emitted dispatch, or a
9766
- * non-dispatch event). A \`null\` return is never a dispatch to count again.
9767
- */
9768
- advance(event, scope = "") {
9769
- const step = dispatchStepOf(event, scope);
9770
- if (step === null) return null;
9771
- const existing = this.records.get(step.key);
9772
- if (existing !== void 0) {
9773
- if (step.outcome !== void 0) existing.ok = step.outcome.ok;
9774
- return null;
9775
- }
9776
- if (step.name === "") return null;
9777
- const signal = {
9778
- kind: step.kind,
9779
- callId: step.callId,
9780
- rootCallId: step.rootCallId,
9781
- name: step.name,
9782
- arguments: step.arguments,
9783
- ok: step.outcome?.ok
9784
- };
9785
- this.records.set(step.key, signal);
9786
- this.evict();
9787
- return signal;
9788
- }
9789
- /**
9790
- * S2-P2-12: the SETTLE channel. \`advance\` answers \`null\` for the paired
9791
- * event that settles an already-emitted dispatch, so a consumer that must act
9792
- * on the OUTCOME (e.g. count successful skill reads only) cannot tell which
9793
- * dispatch a \`null\` belonged to. Call this with the same event AFTER
9794
- * \`advance\`: it answers the settled dispatch exactly once (replayed settle
9795
- * events answer \`null\`).
9796
- * @param event - the event already absorbed by \`advance\`.
9797
- * @returns the dispatch this event settled, or \`null\`.
9798
- */
9799
- settledSignalOf(event, scope = "") {
9800
- const step = dispatchStepOf(event, scope);
9801
- if (step?.outcome === void 0) return null;
9802
- if (this.settledIds.has(step.key)) return null;
9803
- const signal = this.records.get(step.key);
9804
- if (signal === void 0) return null;
9805
- this.settledIds.add(step.key);
9806
- this.evict();
9807
- return signal;
9808
- }
9809
- /** Oldest-first eviction once the ledger (or the settle markers) overflows. */
9810
- evict() {
9811
- while (this.records.size > this.maxTracked) {
9812
- const oldest = this.records.keys().next().value;
9813
- if (oldest === void 0) break;
9814
- this.records.delete(oldest);
9815
- this.settledIds.delete(oldest);
9816
- }
9817
- while (this.settledIds.size > this.maxTracked) {
9818
- const oldest = this.settledIds.values().next().value;
9819
- if (oldest === void 0) break;
9820
- this.settledIds.delete(oldest);
9821
- }
9822
- }
9823
- /** Every emitted dispatch, in first-seen order. */
9824
- get signals() {
9825
- return [...this.records.values()];
9826
- }
9827
- /**
9828
- * Fold every event of a session log, in order.
9829
- * @param events - the log, oldest first.
9830
- * @returns one signal per dispatch, in first-seen order.
9831
- */
9832
- foldAll(events) {
9833
- const emitted = [];
9834
- for (const event of events) {
9835
- const signal = this.advance(event);
9836
- if (signal !== null) emitted.push(signal);
9837
- }
9838
- return emitted;
9839
- }
9840
- };
9841
- /**
9842
- * Read one event into a dispatch record without a ledger (the pure half of the
9843
- * fold). Unlike the ledger it does NOT dedupe: a caller that walks a log and
9844
- * emits its own lines needs the call line on the event that opens the result.
9845
- * @param event - one session event; an absent event (an over-advanced index)
9846
- * answers \`null\` rather than throwing.
9847
- * @returns the dispatch this event opens, or \`null\` for any other event.
9848
- */
9849
- function readDispatchSignal(event) {
9850
- if (event?.type === void 0) return null;
9851
- const record = readDispatchRecord({
9852
- type: event.type,
9853
- ...event.data === void 0 ? {} : { data: event.data }
9854
- });
9855
- if (record === null || record.name === "") return null;
9856
- return {
9857
- kind: record.kind,
9858
- callId: record.callId,
9859
- rootCallId: record.rootCallId,
9860
- name: record.name,
9861
- arguments: record.arguments
9862
- };
9863
- }
9864
- /** Tool names that READ one skill. The single authority for skill-read detection. */
9865
- const SKILL_READ_TOOL_NAMES = new Set(["skill"]);
9866
- /**
9867
- * Is this dispatched tool name a single-skill read?
9868
- * @param name - the dispatched tool name.
9869
- * @returns \`true\` only for the read tool whose arguments name one skill.
9870
- */
9871
- function isSkillReadToolName(name) {
9872
- return SKILL_READ_TOOL_NAMES.has(name);
9873
- }
9874
- /** Tool names whose dispatch opens a code program, i.e. whose sub-dispatches are \`program\`. */
9875
- const PROGRAM_TOOL_NAMES = new Set(["run_code"]);
9876
- /**
9877
- * Does this signal read one skill, and did it not fail?
9878
- * @param signal - a normalized dispatch.
9879
- * @returns the skill name the dispatch read, or \`undefined\` when the dispatch
9880
- * is not a skill read or has failed. A dispatch whose outcome is still pending
9881
- * counts as a read: the platform settles every started sub-dispatch, so pending
9882
- * is a live-window state, not a failure.
9883
- */
9884
- /** Tool names whose dispatch reads one FILE — the deployment's file tool
9885
- * (default `read`). A differently named tool is configured, not guessed. */
9886
- const DEFAULT_SUPPORT_READ_TOOL_NAMES = ["read"];
9887
- /** Dispatch arguments: a JSON string in native mode and an already-parsed
9888
- * object in PTC mode (core/tools/src/types.ts:11-23) — parsed defensively so no
9889
- * consumer has to trust one modality's encoding. */
9890
- function parsedArguments(signal) {
9891
- let parsed = signal.arguments;
9892
- if (typeof parsed === "string") try {
9893
- parsed = JSON.parse(parsed);
9894
- } catch {
9895
- return null;
9896
- }
9897
- if (parsed === null || typeof parsed !== "object") return null;
9898
- return parsed;
9899
- }
9900
- /** The path-shaped argument of one already-parsed call, when it carries one. */
9901
- function readPathFromRecord(record) {
9902
- if (record === null) return null;
9903
- for (const key of [
9904
- "file_path",
9905
- "path",
9906
- "file",
9907
- "target"
9908
- ]) {
9909
- const value = record[key];
9910
- if (typeof value === "string" && value.trim() !== "") return value;
9911
- }
9912
- return null;
9913
- }
9914
- /** The path-shaped argument of a file tool, when it carries one. */
9915
- function readPathArgument(signal) {
9916
- return readPathFromRecord(parsedArguments(signal));
9917
- }
9918
- /** The path one dispatch names, for the read-evidence projection. */
9919
- function dispatchPathOf(step) {
9920
- let parsed = step.arguments;
9921
- if (typeof parsed === "string") try {
9922
- parsed = JSON.parse(parsed);
9923
- } catch {
9924
- return null;
9925
- }
9926
- return parsed !== null && typeof parsed === "object" ? readPathFromRecord(parsed) : null;
9927
- }
9928
- /**
9929
- * Read one dispatch as a SUPPORT-FILE read attributed to a skill: a read of
9930
- * `<root>/<skill>/<support dir>/…` is demand evidence for that one file, the
9931
- * way `skillReadNameOf` is demand evidence for a whole body.
9932
- * @param signal - a settled dispatch.
9933
- * @param options - the deployment's file-tool names and its skills root; an
9934
- * empty root falls back to the `/skills/` marker in the path.
9935
- * @returns the skill name and the skill-root-relative path, or `null` when the
9936
- * dispatch is not a support-file read. Pure: no IO, no service lookup.
9937
- */
9938
- /** Attribute one raw path string to a skill support file (pure; no IO). */
9939
- function supportFileReadFromPath(raw, options) {
9940
- const normalized = raw.replace(/\\/g, "/").trim();
9941
- if (normalized === "" || normalized.split("/").includes("..")) return null;
9942
- const root = options.root.replace(/\\/g, "/").replace(/\/+$/, "");
9943
- let relative = null;
9944
- if (root !== "") {
9945
- const lower = normalized.toLowerCase();
9946
- const lowerRoot = root.toLowerCase();
9947
- if (lower.startsWith(lowerRoot + "/")) relative = normalized.slice(root.length + 1);
9948
- }
9949
- if (relative === null) {
9950
- const at = normalized.toLowerCase().lastIndexOf("/skills/");
9951
- if (at === -1) return null;
9952
- relative = normalized.slice(at + 8);
9953
- }
9954
- const parts = relative.split("/").filter((part) => part !== "");
9955
- const skill = parts[0];
9956
- const dir = parts[1];
9957
- if (skill === void 0 || dir === void 0 || parts.length < 3) return null;
9958
- if (!CITATION_SUPPORT_DIRS.includes(dir)) return null;
9959
- return {
9960
- skill: skill.trim(),
9961
- rel: parts.slice(1).join("/")
9962
- };
9963
- }
9964
- function supportFileReadOf(signal, options) {
9965
- if (!options.toolNames.includes(signal.name)) return null;
9966
- if (signal.ok === false) return null;
9967
- const raw = readPathArgument(signal);
9968
- return raw === null ? null : supportFileReadFromPath(raw, options);
9969
- }
9970
- function skillReadNameOf(signal) {
9971
- if (!SKILL_READ_TOOL_NAMES.has(signal.name)) return void 0;
9972
- if (signal.ok === false) return void 0;
9973
- const candidate = parsedArguments(signal);
9974
- if (candidate === null) return void 0;
9975
- const name = typeof candidate.name === "string" ? candidate.name : typeof candidate.skill === "string" ? candidate.skill : "";
9976
- return name === "" ? void 0 : name;
9977
- }
9978
- /**
9979
- * Fold one session log into its deduplicated dispatches.
9980
- * @param events - the log, oldest first. Pass an array, not a live snapshot
9981
- * iterator, when the log can grow while folding.
9982
- * @returns one signal per dispatch, in first-seen order.
9983
- */
9984
- function foldToolDispatches(events) {
9985
- return new ToolDispatchNormalizer().foldAll(events);
9986
- }
9987
- /**
9988
- * Every skill name this log read through a dispatch, deduplicated by dispatch.
9989
- * @param events - the log, oldest first.
9990
- * @returns the names read by at least one non-failed skill dispatch.
9991
- */
9992
- function collectReadSkillNames(events) {
9993
- const names = /* @__PURE__ */ new Set();
9994
- for (const signal of foldToolDispatches(events)) {
9995
- const name = skillReadNameOf(signal);
9996
- if (name !== void 0) names.add(name);
9997
- }
9998
- return names;
9999
- }
10000
- /** Every skill support file this log read through a non-failed configured file tool. */
10001
- function collectReadSupportFiles(events, options) {
10002
- const reads = /* @__PURE__ */ new Map();
10003
- for (const signal of foldToolDispatches(events)) {
10004
- const hit = supportFileReadOf(signal, options);
10005
- if (hit === null) continue;
10006
- const set = reads.get(hit.skill) ?? /* @__PURE__ */ new Set();
10007
- set.add(hit.rel);
10008
- reads.set(hit.skill, set);
10009
- }
10010
- return reads;
10011
- }
10012
- /** Tool names that touch the skill library at all — the review's skill-signal set. */
10013
- const SKILL_TOOL_NAMES = new Set([...SKILL_READ_TOOL_NAMES, "skill_manage"]);
10014
- /**
10015
- * Does this dispatched tool name touch the skill library (read or mutate)?
10016
- * @param name - the dispatched tool name.
10017
- * @returns \`true\` for any skill-library tool. This is the review cadence's
10018
- * skill signal, which has always covered reads and writes alike.
10019
- */
10020
- function isSkillToolName(name) {
10021
- return SKILL_TOOL_NAMES.has(name);
10022
- }
10023
- /**
10024
- * Does this dispatched tool name open a code program?
10025
- * @param name - the dispatched tool name.
10026
- * @returns \`true\` for the tool whose sub-dispatches are \`program\` kind.
10027
- */
10028
- function isProgramToolName(name) {
10029
- return PROGRAM_TOOL_NAMES.has(name);
10030
- }
10031
- /**
10032
- * Assert that a payload really is the dispatch event it claims to be.
10033
- *
10034
- * The normalizer is deliberately lenient (it also folds persisted logs, where a
10035
- * payload may predate the current declaration). S1-E7 (honesty fix): this
10036
- * function is an OPT-IN gate — NO production consumer calls it; the shipped
10037
- * listeners fold tolerant (`'malformed'` synthesis) precisely because a
10038
- * throwing gate wired into every session event would brick the family on any
10039
- * upstream payload drift. Deployments that want fail-loud behavior call this
10040
- * from their own `session/event` listener. It never silently downgrades: an
10041
- * unrecognized event type or a payload missing a declared field throws a named
10042
- * \`ToolDispatchPayloadError\`.
10043
- * @param event - the session event to check.
10044
- * @returns nothing; throws when the payload violates the platform declaration.
10045
- */
10046
- function assertDispatchPayload(event) {
10047
- const data = event.data ?? {};
10048
- if (event.type === "tool/call") {
10049
- if (typeof data.name !== "string" || data.name === "" || typeof data.callId !== "string" || data.callId === "") throw new ToolDispatchPayloadError("tool/call carries no name/callId: the agent-loop write site is broken");
10050
- return;
10051
- }
10052
- if (event.type === "tool/ptc-dispatch-start" || event.type === "tool/ptc-dispatch") {
10053
- if (typeof data.subCallId !== "string" || data.subCallId === "" || typeof data.name !== "string" || data.name === "") throw new ToolDispatchPayloadError(`${event.type} carries no name/subCallId: the PTC bridge write site is broken`);
10054
- if (event.type === "tool/ptc-dispatch" && typeof data.isError !== "boolean") throw new ToolDispatchPayloadError("tool/ptc-dispatch carries no boolean isError: the settle outcome is unusable");
10055
- return;
10056
- }
10057
- if (event.type === "tool/result") return;
10058
- throw new ToolDispatchPayloadError(`${event.type} is not a platform dispatch event; compare signal.kind instead of event types`);
10059
- }
10060
- /**
10061
- * Total dispatches in a log, deduplicated.
10062
- * @param events - the log, oldest first.
10063
- * @returns the number of distinct dispatches, one per dispatch regardless of
10064
- * how many events carried it.
10065
- */
10066
- function countDispatches(events) {
10067
- return foldToolDispatches(events).length;
10068
- }
10069
- //#endregion
10070
- //#region lib/types/signals.js
10071
- /**
10072
- * Deterministic review signal gate.
10073
- *
10074
- * Scans a DSH session event log for durable learning signals before any LLM
10075
- * is spent. `turn/end` calls `observeEvent`; the returned review kind is
10076
- * accumulated until a configured interval fires.
10077
- */
10078
- const CORRECTION_PATTERNS = [
10079
- /(?:don'?t|do not|stop|never)\s+(?:do|use|format|explain|write|say)/i,
10080
- /(?:too|very|way\s+too)\s+(?:verbose|long|detailed|short|brief)/i,
10081
- /(?:I|we)\s+(?:prefer|like|want|need)\b/i,
10082
- /remember\s+(?:this|that|to)/i
10083
- ];
10084
- const FIX_PATTERNS = [/worked after|fixed by|the fix was|root cause/i, /retry(?:ing)? worked|workaround/i];
10085
- /** Text of one persisted content block, or `''` for any other shape.
10086
- *
10087
- * Content blocks cross the durable session-log boundary, so their runtime
10088
- * shape is `unknown` even where the static event type promises
10089
- * `{ type, text }`: a persisted `content: [null]` (A2-7, v18) used to throw a
10090
- * TypeError here and the review catch swallowed the whole turn's remaining
10091
- * signals. Keeping the guard in one helper also keeps the branches free of
10092
- * conditions the static type already excludes.
10093
- * @param block - one element of a persisted message `content` array.
10094
- * @returns the block's text when it is a text block, otherwise an empty string.
10095
- */
10096
- function textOfBlock(block) {
10097
- if (block === null || typeof block !== "object") return "";
10098
- const candidate = block;
10099
- return candidate.type === "text" && typeof candidate.text === "string" ? candidate.text : "";
10100
- }
10101
- /** The empty turn-window fold state. */
10102
- function initialTurnFold() {
10103
- return {
10104
- substantive: false,
10105
- toolCalls: 0,
10106
- userChars: 0,
10107
- assistantChars: 0,
10108
- memorySignal: false,
10109
- skillSignal: false,
10110
- opened: []
10111
- };
10112
- }
10113
- /**
10114
- * Fold ONE session event into a turn-window state, purely.
10115
- *
10116
- * The one fold behind all three readers: `observeEvent` (the mutating face the live `turn/end`
10117
- * path uses), `foldTurn` (a whole-log window fold, kept for structural test sessions) and the
10118
- * family's `evolutionSignals` projection unit. P1-1/N4 guards stay: events arrive from disk, so
10119
- * a persisted `data: null` / non-object or a malformed `content` skips instead of throwing.
10120
- * @param state - the window so far.
10121
- * @param event - the next committed session event.
10122
- * @returns the next state; the same reference when the event carries nothing this fold reads.
10123
- */
10124
- function foldTurnEvent(state, event) {
10125
- const data = event.data;
10126
- if (data === null || typeof data !== "object" || Array.isArray(data)) return state;
10127
- if (event.type === "user/message") {
10128
- const content = data.content;
10129
- if (!Array.isArray(content)) return state;
10130
- const text = content.map(textOfBlock).join(" ");
10131
- return {
10132
- ...state,
10133
- userChars: state.userChars + text.length,
10134
- memorySignal: state.memorySignal || CORRECTION_PATTERNS.some((pattern) => pattern.test(text)),
10135
- skillSignal: state.skillSignal || FIX_PATTERNS.some((pattern) => pattern.test(text))
10136
- };
10137
- }
10138
- if (event.type === "assistant/message") {
10139
- const message = data.message;
10140
- if (!message || !Array.isArray(message.content)) return state;
10141
- const text = message.content.map(textOfBlock).join(" ");
10142
- return {
10143
- ...state,
10144
- assistantChars: state.assistantChars + text.length
10145
- };
10146
- }
10147
- const dispatch = dispatchStepOf(event);
10148
- if (dispatch === null || dispatch.name === "" || state.opened.includes(dispatch.key)) return state;
10149
- let toolCalls = state.toolCalls;
10150
- if (dispatch.kind !== "program") toolCalls += 1;
10151
- return {
10152
- ...state,
10153
- opened: [...state.opened, dispatch.key],
10154
- toolCalls,
10155
- skillSignal: state.skillSignal || isSkillToolName(dispatch.name)
10156
- };
10157
- }
10158
- /**
10159
- * Per-turn dispatch ledgers, keyed by the signal object they feed.
10160
- *
10161
- * `observeEvent` folds ONE event at a time, so the ledger has to outlive the call. One WeakMap
10162
- * entry per `TurnSignals`, so a finished fold's ledger is collectable with the fold itself and two
10163
- * concurrent turns never share one.
10164
- */
10165
- const dispatchLedgers = /* @__PURE__ */ new WeakMap();
10166
- /** The ledger of the turn this signal is folding; empty before its first dispatch. */
10167
- function ledgerForSignal(signal) {
10168
- return dispatchLedgers.get(signal) ?? [];
10169
- }
10170
- /**
10171
- * Fold one session event into the current turn observation (the mutating face of
10172
- * {@link foldTurnEvent}: every reader shares the one fold, this one copies the result back onto
10173
- * the caller's signal object and keeps its ledger for the next event).
10174
- * @param signal - the turn observation to advance.
10175
- * @param event - the next committed session event.
10176
- */
10177
- function observeEvent(signal, event) {
10178
- const next = foldTurnEvent({
10179
- ...signal,
10180
- opened: [...ledgerForSignal(signal)]
10181
- }, event);
10182
- signal.substantive = next.substantive;
10183
- signal.toolCalls = next.toolCalls;
10184
- signal.userChars = next.userChars;
10185
- signal.assistantChars = next.assistantChars;
10186
- signal.memorySignal = next.memorySignal;
10187
- signal.skillSignal = next.skillSignal;
10188
- dispatchLedgers.set(signal, next.opened);
10189
- }
10190
- /** Compute review cadence after `turn/end`. */
10191
- function advanceReview(state, turn, signal, config) {
10192
- if (turn === state.lastTurn) return null;
10193
- state.lastTurn = turn;
10194
- signal.substantive = signal.toolCalls >= config.substantiveMinToolCalls || signal.userChars >= config.substantiveMinUserChars || signal.assistantChars >= config.substantiveMinAgentChars;
10195
- if (!signal.substantive) return null;
10196
- state.turnsSinceMemory += signal.memorySignal ? 1 : Math.max(1, signal.toolCalls);
10197
- state.turnsSinceSkill += signal.skillSignal ? 1 : Math.max(1, signal.toolCalls);
10198
- const memoryDue = state.turnsSinceMemory >= config.memoryInterval;
10199
- const skillDue = state.turnsSinceSkill >= config.skillInterval;
10200
- const zero = () => {
10201
- state.turnsSinceMemory = 0;
10202
- state.turnsSinceSkill = 0;
10203
- };
10204
- if (memoryDue && skillDue) {
10205
- if (config.resetOnFire !== false) zero();
10206
- return "combined";
10207
- }
10208
- if (memoryDue) {
10209
- if (config.resetOnFire !== false) state.turnsSinceMemory = 0;
10210
- return "memory";
10211
- }
10212
- if (skillDue) {
10213
- if (config.resetOnFire !== false) state.turnsSinceSkill = 0;
10214
- return "skill";
10215
- }
10216
- return null;
10217
- }
10218
- /**
10219
- * Fold a log slice into one turn window, purely.
10220
- *
10221
- * The whole-log reference for {@link foldTurnEvent}: a caller that holds events (a fixture, a
10222
- * structural view, a replay) reads a window without touching a platform Session. Production reads
10223
- * the same window live from the family's `evolutionSignals` projection (`sessionTurnSignals`),
10224
- * which folds `foldTurnEvent` once per committed event.
10225
- * @param events - the log, oldest first. Pass an array, not a live iterator, when it can grow.
10226
- * @param fromSeq - index of the first event of the window (0 for the whole log).
10227
- * @returns the window's signals.
10228
- */
10229
- function foldTurnEvents(events, fromSeq = 0) {
10230
- const list = [...events];
10231
- let state = initialTurnFold();
10232
- for (let index = Math.max(0, fromSeq); index < list.length; index += 1) {
10233
- const event = list[index];
10234
- if (event) state = foldTurnEvent(state, event);
10235
- }
10236
- const { substantive, toolCalls, userChars, assistantChars, memorySignal, skillSignal } = state;
10237
- return {
10238
- substantive,
10239
- toolCalls,
10240
- userChars,
10241
- assistantChars,
10242
- memorySignal,
10243
- skillSignal
10244
- };
10245
- }
10246
- //#endregion
10247
- //#region lib/types/evidence.js
10248
- /**
10249
- * Which session frames are EVIDENCE, and which are bookkeeping.
10250
- *
10251
- * The session's evidence index answers "does this seq carry content"; a bare range check used
10252
- * to accept any integer inside the authoring window. A boundary frame satisfies that while carrying
10253
- * nothing a claim can rest on: the `turn/start` seq is the frame a claim about that turn was
10254
- * most likely read out of, and citing it is indistinguishable from citing a real exchange. This
10255
- * module owns the ONE classification of a session frame by what it CARRIES, so the plan path can
10256
- * report an op whose whole citation list is bookkeeping (design
10257
- * `dsh-evolution-skill-history-design.md` §3D, phase 1: report only — no op is refused here).
10258
- *
10259
- * The classification is a DENY list of the pure bookends, not an allow list of content frames.
10260
- * The platform's own vocabulary (`KNOWN_SESSION_EVENT_TYPES`, 57 members at 0.1.5-rc.2) mixes
10261
- * content frames with state-change frames, and out-of-repo plugins append types the family cannot
10262
- * enumerate; an unknown frame is therefore treated as carrying content, because a report that
10263
- * fires on an unclassifiable frame is a false positive and phase 1 exists to measure how many TRUE
10264
- * ones there are. Tightening — a narrower definition, or an allow list built from the platform's
10265
- * vocabulary — changes this table and nothing else (`evidenceKindIndex` is the only reader).
10266
- * @module @lmzhen/dsh-evolution-core
10267
- */
10268
- /** The frame types that record a boundary and carry no content: the turn and step bookends. */
10269
- const BOOKKEEPING_FRAME_TYPES = new Set([
10270
- "turn/start",
10271
- "turn/end",
10272
- "step/start",
10273
- "step/end"
10274
- ]);
10275
- /**
10276
- * Whether one frame type records a boundary and carries no content.
10277
- *
10278
- * The classification table's SECOND reader: the live projection unit
10279
- * (`session-projection.ts`) folds the same answer per event, so the rule stays one table.
10280
- * @param type - a platform session-event type.
10281
- * @returns true for the turn/step bookends.
10282
- */
10283
- function isBookkeepingFrame(type) {
10284
- return BOOKKEEPING_FRAME_TYPES.has(type);
10285
- }
10286
- /**
10287
- * The seqs of the frames that carry content.
10288
- *
10289
- * @param events - the session's frames, oldest first (any iterable; nothing is retained).
10290
- * @returns the substantive seqs, or `undefined` when NO frame carried a usable seq. The two
10291
- * answers are different facts: an empty SET says "every sequenced frame is a boundary", while
10292
- * `undefined` says "this log cannot tell a boundary from a message" (a stub session in a test,
10293
- * a composition whose events carry no seq). A caller that cannot classify must stay silent
10294
- * rather than report every op — the same three-state posture as `sessionReadSkillNames`.
10295
- */
10296
- function evidenceKindIndex(events) {
10297
- const substantive = /* @__PURE__ */ new Set();
10298
- let sequenced = 0;
10299
- for (const event of events) {
10300
- const seq = event.seq;
10301
- if (typeof seq !== "number" || !Number.isInteger(seq)) continue;
10302
- sequenced += 1;
10303
- if (typeof event.type === "string" && BOOKKEEPING_FRAME_TYPES.has(event.type)) continue;
10304
- substantive.add(seq);
10305
- }
10306
- return sequenced === 0 ? void 0 : substantive;
10307
- }
10308
- //#endregion
10309
- //#region lib/types/session-projection.js
10310
- /**
10311
- * The family's session projections: the per-session facts the family used to re-read the log for.
10312
- *
10313
- * 0.2.x deprecates the synchronous log reads (`Session.snapshotEvents` — "existing logic may
10314
- * remain unmigrated for now, but new calls are prohibited",
10315
- * `core/session/src/index.ts:639-658`) and drives DOMAIN-OWNED units instead: a registered unit
10316
- * folds every committed event once, the registry owns the subscription and the per-session
10317
- * watermark, and a reader asks for the current state
10318
- * (`session/session-projection/src/index.ts` — `register`/`stateOf`). Each unit here carries
10319
- * exactly what one pure family reader derives from a log, so that reader keeps its pure form and
10320
- * gains a projection-backed one beside it.
10321
- *
10322
- * State stays bounded. The evidence unit keeps the SPARSE boundary seqs and answers the dense
10323
- * question by complement: a content-seq set grows with every session event, while a turn/step
10324
- * boundary set grows four entries per turn.
10325
- *
10326
- * The registry is part of the platform's BASE bundle (`packages/bundle/base/cordis.patch.yml:158`),
10327
- * so a real host always has it; a composition without it keeps loading (`ctx.inject` probe) and
10328
- * its readers report "cannot classify" instead of guessing — the same posture the pure readers
10329
- * document for a log with no seq.
10330
- * @module @lmzhen/dsh-evolution-core
10331
- */
10332
- const MAX_TIMESTAMP_MS = 864e13;
10333
- const activityStateSchema = z.object({ lastEventTime: z.number().nonnegative().max(MAX_TIMESTAMP_MS) }).strict();
10334
- const evidenceStateSchema = z.object({
10335
- sequenced: z.number().int().nonnegative(),
10336
- through: z.number().int().min(-1).max(Number.MAX_SAFE_INTEGER),
10337
- bookkeeping: z.array(z.number().int().nonnegative())
10338
- }).strict();
10339
- /** The `evolutionActivity` unit (host-only: no client view is registered for it). */
10340
- const evolutionActivityProjection = {
10341
- key: "evolutionActivity",
10342
- stateVersion: 1,
10343
- stateSchema: activityStateSchema,
10344
- init: () => ({ lastEventTime: 0 }),
10345
- apply: (state, event) => {
10346
- const time = typeof event.time === "number" ? event.time : state.lastEventTime;
10347
- return time === state.lastEventTime ? state : { lastEventTime: time };
10348
- }
10349
- };
10350
- /** The `evolutionEvidence` unit (host-only: no client view is registered for it). */
10351
- const evolutionEvidenceProjection = {
10352
- key: "evolutionEvidence",
10353
- stateVersion: 1,
10354
- stateSchema: evidenceStateSchema,
10355
- init: () => ({
10356
- sequenced: 0,
10357
- through: -1,
10358
- bookkeeping: []
10359
- }),
10360
- apply: (state, event) => {
10361
- const seq = event.seq;
10362
- if (typeof seq !== "number" || !Number.isInteger(seq)) return state;
10363
- const sequenced = state.sequenced + 1;
10364
- const through = seq > state.through ? seq : state.through;
10365
- if (typeof event.type !== "string" || !isBookkeepingFrame(event.type)) return {
10366
- sequenced,
10367
- through,
10368
- bookkeeping: state.bookkeeping
10369
- };
10370
- return {
10371
- sequenced,
10372
- through,
10373
- bookkeeping: [...state.bookkeeping, seq]
10374
- };
10375
- }
10376
- };
10377
- /**
10378
- * Whether one session object can be projected at all.
10379
- *
10380
- * The family's readers also take STRUCTURAL session views — `skill-reads.ts` documents the tool
10381
- * path's bare stub — while the registry folds a session's own log (`snapshotEvents(from, to)`,
10382
- * `eventAt(seq)`, `seq`, `inheritedEventCount`) whenever it has to build or advance a cell. A
10383
- * view without those members has no projection state to read, and asking for one would fold a
10384
- * log the unit cannot index.
10385
- * @param session - the value a caller holds as its session.
10386
- * @returns true when the registry can fold this object.
10387
- */
10388
- function isProjectableSession(session) {
10389
- if (session === null || typeof session !== "object") return false;
10390
- const candidate = session;
10391
- const folds = typeof candidate.eventAt === "function";
10392
- const logs = typeof candidate.snapshotEvents === "function";
10393
- return folds && logs && typeof candidate.seq === "number";
10394
- }
10395
- const projectionHistorySchema = z.object({
10396
- catalogs: z.array(z.object({
10397
- text: z.string(),
10398
- entries: z.array(z.object({
10399
- name: z.string(),
10400
- description: z.string()
10401
- }).strict()).max(512),
10402
- update: z.boolean()
10403
- }).strict()).max(8),
10404
- digests: z.array(z.string()).max(64)
10405
- }).strict();
10406
- const readsStateSchema = z.object({ reads: z.array(z.object({
10407
- key: z.string(),
10408
- skill: z.string().nullable(),
10409
- failed: z.boolean(),
10410
- file: z.string().nullable().optional(),
10411
- tool: z.string().optional()
10412
- }).strict()) }).strict();
10413
- const signalsStateSchema = z.object({
10414
- through: z.number().int().min(-1).max(Number.MAX_SAFE_INTEGER),
10415
- lastEventTime: z.number().nonnegative().max(MAX_TIMESTAMP_MS),
10416
- turnStartSeq: z.number().int().min(-1).max(Number.MAX_SAFE_INTEGER),
10417
- turn: z.object({
10418
- substantive: z.boolean(),
10419
- toolCalls: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
10420
- userChars: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
10421
- assistantChars: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
10422
- memorySignal: z.boolean(),
10423
- skillSignal: z.boolean(),
10424
- opened: z.array(z.string())
10425
- }).strict()
10426
- }).strict();
10427
- /** The `evolutionProjectionHistory` unit (host-only). */
10428
- const evolutionProjectionHistoryProjection = {
10429
- key: "evolutionProjectionHistory",
10430
- stateVersion: 1,
10431
- stateSchema: projectionHistorySchema,
10432
- init: () => ({
10433
- catalogs: [],
10434
- digests: []
10435
- }),
10436
- apply: (state, event) => {
10437
- const frame = event;
10438
- if (frame.type !== "user/message" || typeof frame.data !== "object" || frame.data === null) return state;
10439
- const message = frame.data;
10440
- const source = message.source;
10441
- if (source === void 0 || typeof source !== "object") return state;
10442
- if (source.kind === "evolution-skill-projection" && typeof source.digest === "string") {
10443
- if (state.digests.includes(source.digest)) return state;
10444
- return {
10445
- catalogs: state.catalogs,
10446
- digests: [...state.digests, source.digest].slice(-64)
10447
- };
10448
- }
10449
- if (source.kind !== "skill-catalog" || source.form !== "catalog" || !Array.isArray(source.entries)) return state;
10450
- if (!Array.isArray(message.content)) return state;
10451
- const text = message.content.map((block) => block !== null && typeof block === "object" && block.type === "text" ? String(block.text ?? "") : "").join("");
10452
- if (!text.includes("<available_skills>") || !text.includes("</available_skills>")) return state;
10453
- const entries = source.entries.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.name === "string" && typeof entry.description === "string").map((entry) => ({
10454
- name: entry.name,
10455
- description: entry.description
10456
- }));
10457
- return {
10458
- catalogs: [...state.catalogs, {
10459
- text,
10460
- entries,
10461
- update: source.update === true
10462
- }].slice(-8),
10463
- digests: state.digests
10464
- };
10465
- }
10466
- };
10467
- /** The `evolutionReads` unit (host-only: no client view is registered for it). */
10468
- const evolutionReadsProjection = {
10469
- key: "evolutionReads",
10470
- stateVersion: 1,
10471
- stateSchema: readsStateSchema,
10472
- init: () => ({ reads: [] }),
10473
- apply: (state, event) => {
10474
- const step = dispatchStepOf(event);
10475
- if (step === null) return state;
10476
- const at = state.reads.findIndex((entry) => entry.key === step.key);
10477
- const settled = () => {
10478
- const entry = at < 0 ? void 0 : state.reads[at];
10479
- if (entry === void 0 || step.outcome === void 0) return state;
10480
- const failed = !step.outcome.ok;
10481
- if (entry.failed === failed) return state;
10482
- const reads = [...state.reads];
10483
- reads[at] = {
10484
- key: entry.key,
10485
- skill: entry.skill,
10486
- failed,
10487
- ...entry.file === void 0 ? {} : { file: entry.file },
10488
- ...entry.tool === void 0 ? {} : { tool: entry.tool }
10489
- };
10490
- return { reads };
10491
- };
10492
- if (step.name === "") return settled();
10493
- if (at >= 0) return settled();
10494
- const file = dispatchPathOf(step);
10495
- if (file !== null) return { reads: [...state.reads.slice(-511), {
10496
- key: step.key,
10497
- skill: null,
10498
- failed: step.outcome?.ok === false,
10499
- file,
10500
- tool: step.name
10501
- }] };
10502
- if (!isSkillReadToolName(step.name)) return state;
10503
- const skill = skillReadNameOf({
10504
- kind: step.kind,
10505
- callId: step.callId,
10506
- rootCallId: step.rootCallId,
10507
- name: step.name,
10508
- arguments: step.arguments,
10509
- ok: step.outcome?.ok
10510
- }) ?? null;
10511
- return { reads: [...state.reads, {
10512
- key: step.key,
10513
- skill,
10514
- failed: step.outcome?.ok === false
10515
- }] };
10516
- }
10517
- };
10518
- /** The `evolutionSignals` unit (host-only: no client view is registered for it). */
10519
- const evolutionSignalsProjection = {
10520
- key: "evolutionSignals",
10521
- stateVersion: 1,
10522
- stateSchema: signalsStateSchema,
10523
- init: () => ({
10524
- through: -1,
10525
- lastEventTime: 0,
10526
- turnStartSeq: -1,
10527
- turn: initialTurnFold()
10528
- }),
10529
- apply: (state, event) => {
10530
- const start = event.type === "turn/start";
10531
- const turn = foldTurnEvent(start ? initialTurnFold() : state.turn, event);
10532
- const seq = typeof event.seq === "number" && Number.isInteger(event.seq) ? event.seq : state.through;
10533
- const time = typeof event.time === "number" ? event.time : state.lastEventTime;
10534
- const turnStartSeq = start ? seq : state.turnStartSeq;
10535
- if (turn === state.turn && seq === state.through && time === state.lastEventTime && turnStartSeq === state.turnStartSeq) return state;
10536
- return {
10537
- through: seq,
10538
- lastEventTime: time,
10539
- turnStartSeq,
10540
- turn
10541
- };
10542
- }
10543
- };
10544
- /**
10545
- * Register the family's units on the calling context's fiber.
10546
- *
10547
- * Called by the READERS (not by a plugin's mount) and idempotent by the registry's own reference
10548
- * count: the first read of a foldable session installs the definitions, later reads count as
10549
- * co-owners, and the keys survive until the last registrant unloads
10550
- * (`session-projection/src/index.ts:273-292`). Registering at the read is what keeps a session
10551
- * view the registry cannot fold (`isProjectableSession`) from ever reaching its drive — the
10552
- * registry folds the in-memory log on first touch, so a unit that appears mid-session is still
10553
- * correct (`:602-630`).
10554
- *
10555
- * Idempotent by design, so a plugin mounting later does not need its own call.
10556
- * @param ctx - the mounting plugin's context.
10557
- */
10558
- function installEvolutionProjections(ctx) {
10559
- const register = (registry) => {
10560
- registry.register(evolutionActivityProjection);
10561
- registry.register(evolutionEvidenceProjection);
10562
- registry.register(evolutionReadsProjection);
10563
- registry.register(evolutionProjectionHistoryProjection);
10564
- registry.register(evolutionSignalsProjection);
10565
- };
10566
- const mounted = ctx.get("sessionProjections");
10567
- if (mounted !== void 0) {
10568
- register(mounted);
10569
- return;
10570
- }
10571
- ctx.inject(["sessionProjections"], (injected) => {
10572
- register(injected.sessionProjections);
10573
- });
10574
- }
10575
- /**
10576
- * Time of one session's newest event, or `undefined` when the unit is not installed.
10577
- *
10578
- * The curator's idleness gate reads this instead of folding the session log; `undefined` is a
10579
- * measurement that did not happen, which the gate answers with the deployment's fail-open policy.
10580
- * @param ctx - a context of the runtime (the service is read from the global store).
10581
- * @param session - the session to ask about.
10582
- * @returns the newest event's milliseconds, or undefined with no unit or no event.
10583
- */
10584
- function sessionLastEventTime(ctx, session) {
10585
- if (!isProjectableSession(session)) return void 0;
10586
- installEvolutionProjections(ctx);
10587
- const state = ctx.get("sessionProjections")?.stateOf(session, "evolutionActivity");
10588
- if (state === void 0 || state.lastEventTime === 0) return void 0;
10589
- return state.lastEventTime;
10590
- }
10591
- /**
10592
- * The skill names one session read through a non-failed dispatch, or `undefined` when the session
10593
- * cannot be projected (a structural view, or a host without the registry).
10594
- *
10595
- * `undefined` is NOT an empty set: the tool path's read-before-write gate keeps its previous
10596
- * behavior rather than refusing every write in a composition whose session object is a bare stub
10597
- * (`skill-reads.ts` documents that three-state posture).
10598
- * @param ctx - a context of the runtime.
10599
- * @param session - the session whose reads are wanted.
10600
- * @returns the names read, or undefined when the log cannot be folded.
10601
- */
10602
- function sessionReadNames(ctx, session) {
10603
- if (!isProjectableSession(session)) return void 0;
10604
- installEvolutionProjections(ctx);
10605
- const state = ctx.get("sessionProjections")?.stateOf(session, "evolutionReads");
10606
- if (state === void 0) return void 0;
10607
- const names = /* @__PURE__ */ new Set();
10608
- for (const entry of state.reads) if (!entry.failed && entry.skill !== null) names.add(entry.skill);
10609
- return names;
10610
- }
10611
- /**
10612
- * The open turn's window signals, or `undefined` when the session cannot be projected.
10613
- *
10614
- * The window is the events since the newest `turn/start`, folded by the same `foldTurnEvent`
10615
- * `observeEvent` uses; `undefined` means the caller has no measurement (a structural view), not
10616
- * that the turn was empty.
10617
- * @param ctx - a context of the runtime.
10618
- * @param session - the session whose open turn is being judged.
10619
- * @returns the window signals, or undefined when the log cannot be folded.
10620
- */
10621
- function sessionTurnSignals(ctx, session) {
10622
- if (!isProjectableSession(session)) return void 0;
10623
- installEvolutionProjections(ctx);
10624
- const state = ctx.get("sessionProjections")?.stateOf(session, "evolutionSignals");
10625
- if (state === void 0) return void 0;
10626
- const { substantive, toolCalls, userChars, assistantChars, memorySignal, skillSignal } = state.turn;
10627
- return {
10628
- substantive,
10629
- toolCalls,
10630
- userChars,
10631
- assistantChars,
10632
- memorySignal,
10633
- skillSignal
10634
- };
10635
- }
10636
- /**
10637
- * The evidence index of one session, or `undefined` when the log cannot be classified.
10638
- *
10639
- * `undefined` covers both the missing unit and a log whose frames carry no seq: the plan path's
10640
- * `EVIDENCE_CLASS` row is report-only and must stay silent rather than report every op.
10641
- * @param ctx - a context of the runtime.
10642
- * @param session - the session the review plan is authored against.
10643
- * @returns an index answering "does this seq carry content?".
10644
- */
10645
- function sessionEvidenceIndex(ctx, session) {
10646
- if (!isProjectableSession(session)) return void 0;
10647
- installEvolutionProjections(ctx);
10648
- const state = ctx.get("sessionProjections")?.stateOf(session, "evolutionEvidence");
10649
- if (state === void 0 || state.sequenced === 0) return void 0;
10650
- const { through, bookkeeping } = state;
10651
- return { has: (seq) => Number.isInteger(seq) && seq >= 0 && seq <= through && !bookkeeping.includes(seq) };
10652
- }
10653
- //#endregion
10654
9387
  //#region lib/types/skill-reads.js
10655
9388
  /**
10656
9389
  * The skill names ONE session read, or `undefined` when its log is not readable.
@@ -10690,8 +9423,7 @@ function sessionReadSkillNames(ctx, session) {
10690
9423
  function sessionReadSupportFiles(ctx, session, options) {
10691
9424
  if (session === void 0) return void 0;
10692
9425
  if (isProjectableSession(session)) {
10693
- installEvolutionProjections(ctx);
10694
- const state = ctx.get("sessionProjections")?.stateOf(session, "evolutionReads");
9426
+ const state = ctx.get("evolutionProjections")?.reads(session);
10695
9427
  if (state !== void 0) {
10696
9428
  const toolNames = options.toolNames ?? DEFAULT_SUPPORT_READ_TOOL_NAMES;
10697
9429
  const reads = /* @__PURE__ */ new Map();
@@ -16849,7 +15581,7 @@ const PARAM_EXPOSURE = Object.freeze([
16849
15581
  docAnchor: "PARAMETERS.md#write-caps",
16850
15582
  summary: "Character cap on a SKILL.md body (tighten-only).",
16851
15583
  label: "技能文件正文上限",
16852
- hint: "技能 Markdown 正文最多多少字符(只能调小)。",
15584
+ hint: "技能 Markdown 正文最多多少字符(只能调小,不能超过出厂上限)。",
16853
15585
  control: "number",
16854
15586
  unit: "字符",
16855
15587
  values: "",
@@ -16865,7 +15597,7 @@ const PARAM_EXPOSURE = Object.freeze([
16865
15597
  docAnchor: "PARAMETERS.md#write-caps",
16866
15598
  summary: "Byte cap on one support file (tighten-only).",
16867
15599
  label: "附带文件大小上限",
16868
- hint: "技能附带文件单个最大多少字节(只能调小)。",
15600
+ hint: "技能附带文件单个最大多少字节(只能调小,不能超过出厂上限)。",
16869
15601
  control: "number",
16870
15602
  unit: "字节",
16871
15603
  values: "",
@@ -17243,8 +15975,8 @@ const PARAM_EXPOSURE = Object.freeze([
17243
15975
  applies: "live",
17244
15976
  docAnchor: "PARAMETERS.md#curator",
17245
15977
  summary: "Token budget of the curator LLM review.",
17246
- label: "模型处理上限",
17247
- hint: "每次用模型挑选时最多消耗多少 token。",
15978
+ label: "模型挑选的字数上限",
15979
+ hint: "每次用模型挑选时最多消耗多少 token(模型计费单位)。",
17248
15980
  control: "number",
17249
15981
  unit: "token",
17250
15982
  values: "",
@@ -17291,7 +16023,7 @@ const PARAM_EXPOSURE = Object.freeze([
17291
16023
  applies: "live",
17292
16024
  docAnchor: "PARAMETERS.md#curator",
17293
16025
  summary: "Stamp density per KB that flags log-like content in a body.",
17294
- label: "日志化判定阈值",
16026
+ label: "正文像日志的判定线",
17295
16027
  hint: "每 KB 出现多少个时间标记,就判为「像日志」。",
17296
16028
  control: "number",
17297
16029
  unit: "处/KB",
@@ -17752,7 +16484,7 @@ const PARAM_EXPOSURE = Object.freeze([
17752
16484
  applies: "live",
17753
16485
  docAnchor: "PARAMETERS.md#deployment",
17754
16486
  summary: "Master approval switch: run the approval pipeline for foreground writes.",
17755
- label: "启用批准流水线",
16487
+ label: "启用写入审批",
17756
16488
  hint: "关闭后前台写入不再经批准。",
17757
16489
  control: "switch",
17758
16490
  unit: "",
@@ -17780,7 +16512,7 @@ const PARAM_EXPOSURE = Object.freeze([
17780
16512
  docAnchor: "PARAMETERS.md#deployment",
17781
16513
  summary: "How long a staged write may wait before it expires: expired writes are closed as rejected and are NEVER executed; 0 (the default) means the window never expires.",
17782
16514
  label: "待批过期时间",
17783
- hint: "一条待批写入最多等多久:超时就按「拒绝」关掉(不会执行,写效果不会落地);0 = 永不过期(默认)。",
16515
+ hint: "一条待批写入最多等多久:超时后按「拒绝」处理,不会执行,也不会改动任何内容;0 表示一直保留(默认)。",
17784
16516
  control: "number",
17785
16517
  unit: "毫秒",
17786
16518
  values: "",
@@ -17857,7 +16589,7 @@ const PARAM_EXPOSURE = Object.freeze([
17857
16589
  docAnchor: "PARAMETERS.md#deployment",
17858
16590
  summary: "Hand the maintenance report to the model automatically once a scan settles successfully (the same injection as maintain handoff); off by default — enabling it costs one extra model call per successful run.",
17859
16591
  label: "扫描完成后自动交接",
17860
- hint: "维护扫描成功结束后,自动把报告交给模型(等同 maintain handoff);默认关闭,每次成功扫描会多花一次模型调用。",
16592
+ hint: "维护扫描成功结束后,自动把报告交给模型;默认关闭,每次成功扫描会多花一次模型调用。",
17861
16593
  control: "switch",
17862
16594
  unit: "",
17863
16595
  values: "",
@@ -18496,7 +17228,7 @@ function scopedProbeReport() {
18496
17228
  * Does this session's scope see the family's model tools?
18497
17229
  *
18498
17230
  * The scope is the live agent's — the platform's own addressing for "what does
18499
- * this session see" (`tools.get(name, scope)`, packages/core/tools/src/index.ts:1194).
17231
+ * this session see" (`tools.get(name, scope)`, packages/core/tools/src/index.ts:239).
18500
17232
  * A session with no live agent (a finished or cold session) has no scope to ask
18501
17233
  * in, so it resolves to false; the consumers this gate serves only run for live
18502
17234
  * agents.
@@ -18619,12 +17351,12 @@ const DIAGNOSTICS_RUNTIME_KEYS = [
18619
17351
  //#region lib/types/platform-line.generated.js
18620
17352
  /** The frozen platform line this release targets (peers/engines/anchors derived from version+floor). */
18621
17353
  const PLATFORM_LINE = {
18622
- version: "0.2.1-rc.3",
18623
- floor: "0.2.1-rc.2",
18624
- previousAnchor: "0.2.0-rc.2",
18625
- peersRange: "^0.2.1-rc.2",
18626
- enginesRange: ">=0.2.1-rc.2 <0.2.2-0",
18627
- upstreamRef: "dsh-v0.2.1-rc.3"
17354
+ version: "0.2.2-rc.1",
17355
+ floor: "0.2.2-rc.0",
17356
+ previousAnchor: "0.2.1-rc.2",
17357
+ peersRange: "^0.2.2-rc.0",
17358
+ enginesRange: ">=0.2.2-rc.0 <0.2.3-0",
17359
+ upstreamRef: "dsh-v0.2.2-rc.1"
18628
17360
  };
18629
17361
  //#endregion
18630
17362
  //#region lib/types/session-fold.js
@@ -18641,4 +17373,4 @@ function isIgnorableEvent(event) {
18641
17373
  return classifySessionEvent(event) !== "model";
18642
17374
  }
18643
17375
  //#endregion
18644
- export { AUTHORING_DESCRIPTION_BAR, AUTHORING_SPLIT_LINE_CHARS, BASELINE_ACTION, CITATION_SUPPORT_DIRS, COMBINED_REVIEW_PLAN_PROMPT, COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CONTENT_SPLIT_HINT, COST_ASCII_TOKEN_HIGH, COST_ASCII_TOKEN_LOW, COST_CJK_TOKEN_HIGH, COST_CJK_TOKEN_LOW, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEDUP_MAX_PAIR_COMPARISONS, DEDUP_SIMILARITY_THRESHOLD, DEFAULT_ADMISSION, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_ARCHIVE_RETENTION_POLICY, DEFAULT_CITATION_POLICY, DEFAULT_CITATION_REF_BUDGET, DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_CURATOR_BOOT_GRACE_SECONDS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_CURATOR_MODEL, DEFAULT_CURATOR_REVIEW_MAX_TOKENS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_PROBE_TIMEOUT_MS, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_REVIEW_CONTEXT_MESSAGES, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_MESSAGE_CHARS, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_REVIEW_TIMEOUT_MS, DEFAULT_RUN_RECORDS, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_SKILL_VERSION_KEEP, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_SUPPORT_FILE_CHAR_POLICY, DEFAULT_SUPPORT_READ_TOOL_NAMES, DEFAULT_THREAT_MAX_SCAN_CHARS, DEFAULT_USER_CHAR_LIMIT, DEFAULT_WRITE_CONFIRM_MODE, DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, DIAGNOSTICS_FACT_KEYS, DIAGNOSTICS_RUNTIME_KEYS, DIAGNOSTICS_VIEW_SCHEMA_VERSION, DISPATCH_EVENT_TYPES, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, EVENT_ARCHIVE_PREFIX, EVENT_LOG_RETAIN_ARCHIVES, EVENT_LOG_ROTATE_AT, EVENT_LOG_VERSION, EVOLUTION_ERRORS, EVOLUTION_PRESET_IDS, EVOLUTION_WRITE_TOOLS, EXTRACT_PROMPT_HASH, EXTRACT_PROMPT_V1, EXTRACT_PROMPT_VERSION, EvolutionGateSet, FAMILY_SESSION_TOOL_NAMES, FORBIDDEN_CONTROL_KEYS, FUZZY_MAX_PATTERN_CHARS, FUZZY_MAX_WORK, HEALTH_STAMP_RE, HISTORY_DIR, HISTORY_INDEX_VERSION, HOOK_LINE_RE, HOST_ROUTES, INSTANCE_KEYS, KEEP_LINE_RE, LONG_RUNS, LOW_QUALITY_THRESHOLD, MAINTAINER_PRESET_ID, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_REQUEST_BODY_BYTES, MAX_RESTRUCTURE_MOVES, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MAX_SUPPORT_READ_PATHS, MAX_TIMER_DELAY_MS, MEMORY_GUIDANCE_SECTION_ORDER, MEMORY_REVIEW_PROMPT, MIN_STAMP_BODY_CHARS, MODEL_SESSION_EVENT_TYPES as MODEL_SESSION_EVENTS, MODEL_SESSION_EVENT_TYPES, MUTATIONS_FILE_VERSION, MemoryStore, MutationUnit, NAMESPACE_MIGRATIONS, NATIVE_CALL_EVENT, NATIVE_RESULT_EVENT, PARAM_ALIASES, PARAM_EXPOSURE, PARAM_GROUP_LABELS, PARAM_NAMESPACES, PATTERN_OVERLAP, PLATFORM_CATALOG_DESCRIPTION_DEFAULT, PLATFORM_ESTIMATE_CHARS_PER_TOKEN, PLATFORM_LINE, PLATFORM_SERVICE_PROBES, POLICY_STAGE_DEFAULTS, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, PTC_DISPATCH_EVENT, PTC_DISPATCH_START_EVENT, QUALITY_WEIGHTS, READ_REQUIRED_ACTIONS, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, RESTRUCTURE_TARGET_RE, RETENTION_FEEDBACK_KEEP_RATIO, RETENTION_FEEDBACK_MIN_CHARS, REVIEWER_PRESET_ID, RULES, RUNS_SCHEMA_VERSION, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, SKILL_NAME_RE, SKILL_REVIEW_PLAN_PROMPT, SKILL_REVIEW_PROMPT, SNAPSHOT_EXTRA_NAME_RE, STORE_LEDGER, SUMMARY_DUPLICATE_HINT_THRESHOLD, SUPPORT_DIRS, SUPPORT_SPRAWL_FILES, SUPPRESSED_FILE_VERSION, SkillLibrary, SkillModel, TEXT_DIFF_MAX_CHARS, TEXT_DIFF_MAX_LINES, THREAT_EXEMPTION_HINT, TOKEN_ASCII_WEIGHT, TOKEN_CJK_WEIGHT, ToolDispatchNormalizer, ToolDispatchPayloadError, UNIT_JOURNAL_PHASES, UNIT_JOURNAL_SCHEMA_VERSION, UNIT_STORAGE_SCHEMA_VERSION, UNTRUSTED_LINE_BREAK, UNTRUSTED_LINE_MARK, UPSTREAM_LIMIT_CHARS_PER_TOKEN, UnitTransactions, VERSION_SUMMARY_MAX_CHARS, WriteKernel, absentHostServices, acquireTreeWriteLock, admissionVerdict, advanceReview, affinity, ageCopyKey, allowRowCollisions, anchorVerdict, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, applyNamespaceMigration, applyReferenceRewrite, asRecord, assertDispatchPayload, assertSkillsRootAliasRetired, assertUnitJournalTransition, assessStructureHealth, atomicWriteFiles, authoringFeedback, authorityFrom, backupsReachability, blobPath, bodyCost, buildCuratorRunReport, buildExtractPlanFromLibrary, buildHealthBaseline, buildLearnPrompt, bumpPatch, bumpSupportRead, bumpUse, bumpView, callingScope, candidateSkills, canonicalWriteId, claimInstance, clampOnce, clampedNumber, classifyNamespaceMigration, classifySessionEvent, clearReviewChannel, collectReadSkillNames, collectReadSupportFiles, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, contentRetentionFeedback, countDispatches, countReferenceFiles, createGateSet, createSubagentChannel, daysSinceIso, declaredReportStamp, describeReferenceRewrite, diffFindings, dispatchKeyOf, dispatchPathOf, dispatchStepOf, displayBodyOf, duplicateHeadings, elapsedSince, emptyRecord, ensureSkillFrontmatter, entryTarget, errorText, evaluateThreat, eventsFile, evidenceKindIndex, evolutionActivityProjection, evolutionEventPayloadIssue, evolutionEvidenceProjection, evolutionHome, evolutionIoAdapter, evolutionProjectionHistoryProjection, evolutionReadsProjection, evolutionRoot, evolutionSignalsProjection, executeUnitUndo, externalRefs, fileMutationLock, filterUnreadSkillOps, findDriftSignal, findOwnerCandidate, foldCuratorFields, foldToolDispatches, foldTurnEvent, foldTurnEvents, foldUntrustedLines, frontmatterBlock, frontmatterCatalogInvalid, fuzzyPatch, getRecord, h2Sections, historyIndexFile, historyReachability, historyRoot, hostSurface, identity, idleDays, initialTurnFold, installEvolutionProjections, instanceClaimKey, instanceClaimedWriteSites, instanceHolder, isAbsent, isBookkeepingFrame, isCommittedWarning, isDeprecatedParamId, isFileShapedPath, isIgnorableEvent, isLandmark, isMissingPath, isPresent, isProcessAlive, isProgramToolName, isProjectableSession, isRecord, isReviewChannelSession, isSkillReadToolName, isSkillToolName, isUnknown, isUnreadWrite, json, landmarkVerdict, latestActivityAt, latestVersionAt, lifecycleCandidate, lintBody, lintSkill, listEventArchives, liveBool, liveEnum, liveNumber, liveString, loadMutations, loadSuppressedNames, loadUsage, loadVersionContent, loadVersions, makeSerialQueue, mapProbe, markAgentCreated, markReviewChannel, markerEntryName, memoryRoot, methodNotAllowed, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nearDuplicateSummaries, newRunRegistry, newSkillLibrary, nextHistoryIndex, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, normalizeVersionSummary, observeEvent, orderVersions, overlongLines, ownerCandidatesFromSummaries, ownerDecisionText, paramNamespace, paramRowId, paramSettingsId, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, parseHistoryIndex, partitionVersions, payloadText, persistedWriteSite, persistedWriteSites, pickWithPolicy, planExtract, planNamespaceMigration, planReferenceRewrite, planRehoming, planUnitUndoAcross, policyStageLimits, probeAbsent, probeChannelState, probeList, probeMtime, probePresent, probeReason, probeText, probeUnknown, projectExtractBodies, projectionText, proposalFromPlan, proposalReportDir, proposalReportName, protectedSkillNamesOf, pruneTreeChangeUnits, readDispatchSignal, readEvolutionEvents, readEvolutionTimeline, readExternalSupport, readHistoryIndex, readJsonObject, readNumberParam, readParam, readProposalReports, readTreeLock, readUnitEvidence, readUnitIndex, readUnitJournal, readUnitReceipt, readUnitSnapshot, readingStats, recordMutation, recordVersions, redactSecrets, referencedBlobs, registerHostRoutes, registerOwnerSettings, relatedSkillNames, releaseInstance, renameWithRetry, renderCuratorReportMarkdown, renderLongRunTable, reportTime, reportsReachability, reportsSweepLockTarget, resolveCitations, resolveExecOrigins, resolveOrigins, resolveParamId, resolveRootConfig, resolveSkillsRoot, resolveUnitMembers, resolveUnitMembersFromIndexes, restructureCandidates, retainEventArchives, retirementReport, reviewPrompt, revisionAnchor, revisionAnchorOf, revisionFingerprint, revisionSupportDigest, runWriteGates, runsFile, saveSuppressedNames, saveUsage, scanBodyHooks, scanContentThreats, scanMemoryThreats, scanThreats, scopeOfNearestManifest, scopedPackageName, scopedProbeReport, selectSections, sessionAudited, sessionEvidenceIndex, sessionLastEventTime, sessionReadNames, sessionReadSkillNames, sessionReadSupportFiles, sessionSeesFamilyTools, sessionTurnSignals, skillLibraryUnitBackend, skillReadNameOf, skillRowCells, skillStateKey, skillWriteGateContext, skillsRoot, staleRouteStubs, subagentChannelState, supportFileReadFromPath, supportFileReadOf, supportRefs, suppressedFile, sweepReports, sweepReviewChannelSessions, textDiffFacts, tokenLineFor, transactIo, transactTaskGuard, treeLockFile, trimPatternBoundaries, unhookedSupportPointers, unitEvidenceDigest, unitEvidencePath, unitIndexPath, unitJournalPath, unitJournalPhaseRank, unitJournalPort, unitMembersAreComplete, unitReceiptPath, unitSnapshotPath, unitSnapshotPort, unitSnapshotsDir, unitStorageKey, unwrapLive, updateSuppressedNames, upsertUnitIndex, usageFile, usageObserved, userSetKeys, validateFrontmatter, validateMutationRequest, validateRestructureTarget, validateSupportPath, valueOr, verifyPromptBundle, versionActionKind, versionRowCells, versionSummaryPrompt, versionTarget, vocabulary, withTreeWrite, withTreeWriteLock, writeDurableTmp, writePathSymbols, writeProposalReport, writeUnitEvidence, writeUnitJournal, writeUnitReceipt, writeUnitSnapshot, yamlPlainScalarNeedsQuotes };
17376
+ export { AUTHORING_DESCRIPTION_BAR, AUTHORING_SPLIT_LINE_CHARS, BASELINE_ACTION, CITATION_SUPPORT_DIRS, COMBINED_REVIEW_PLAN_PROMPT, COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CONTENT_SPLIT_HINT, COST_ASCII_TOKEN_HIGH, COST_ASCII_TOKEN_LOW, COST_CJK_TOKEN_HIGH, COST_CJK_TOKEN_LOW, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEDUP_MAX_PAIR_COMPARISONS, DEDUP_SIMILARITY_THRESHOLD, DEFAULT_ADMISSION, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_ARCHIVE_RETENTION_POLICY, DEFAULT_CITATION_POLICY, DEFAULT_CITATION_REF_BUDGET, DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_CURATOR_BOOT_GRACE_SECONDS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_CURATOR_MODEL, DEFAULT_CURATOR_REVIEW_MAX_TOKENS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_PROBE_TIMEOUT_MS, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_REVIEW_CONTEXT_MESSAGES, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_MESSAGE_CHARS, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_REVIEW_TIMEOUT_MS, DEFAULT_RUN_RECORDS, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_SKILL_VERSION_KEEP, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_SUPPORT_FILE_CHAR_POLICY, DEFAULT_SUPPORT_READ_TOOL_NAMES, DEFAULT_THREAT_MAX_SCAN_CHARS, DEFAULT_USER_CHAR_LIMIT, DEFAULT_WRITE_CONFIRM_MODE, DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, DIAGNOSTICS_FACT_KEYS, DIAGNOSTICS_RUNTIME_KEYS, DIAGNOSTICS_VIEW_SCHEMA_VERSION, DISPATCH_EVENT_TYPES, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, EVENT_ARCHIVE_PREFIX, EVENT_LOG_RETAIN_ARCHIVES, EVENT_LOG_ROTATE_AT, EVENT_LOG_VERSION, EVOLUTION_ERRORS, EVOLUTION_PRESET_IDS, EVOLUTION_WRITE_TOOLS, EXTRACT_PROMPT_HASH, EXTRACT_PROMPT_V1, EXTRACT_PROMPT_VERSION, EvolutionGateSet, FAMILY_SESSION_TOOL_NAMES, FORBIDDEN_CONTROL_KEYS, FUZZY_MAX_PATTERN_CHARS, FUZZY_MAX_WORK, HEALTH_STAMP_RE, HISTORY_DIR, HISTORY_INDEX_VERSION, HOOK_LINE_RE, HOST_ROUTES, INSTANCE_KEYS, KEEP_LINE_RE, LONG_RUNS, LOW_QUALITY_THRESHOLD, MAINTAINER_PRESET_ID, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_REQUEST_BODY_BYTES, MAX_RESTRUCTURE_MOVES, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MAX_SUPPORT_READ_PATHS, MAX_TIMER_DELAY_MS, MEMORY_GUIDANCE_SECTION_ORDER, MEMORY_REVIEW_PROMPT, MIN_STAMP_BODY_CHARS, MODEL_SESSION_EVENT_TYPES as MODEL_SESSION_EVENTS, MODEL_SESSION_EVENT_TYPES, MUTATIONS_FILE_VERSION, MemoryStore, MutationUnit, NAMESPACE_MIGRATIONS, NATIVE_CALL_EVENT, NATIVE_RESULT_EVENT, PARAM_ALIASES, PARAM_EXPOSURE, PARAM_GROUP_LABELS, PARAM_NAMESPACES, PATTERN_OVERLAP, PLATFORM_CATALOG_DESCRIPTION_DEFAULT, PLATFORM_ESTIMATE_CHARS_PER_TOKEN, PLATFORM_LINE, PLATFORM_SERVICE_PROBES, POLICY_STAGE_DEFAULTS, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, PTC_DISPATCH_EVENT, PTC_DISPATCH_START_EVENT, QUALITY_WEIGHTS, READ_REQUIRED_ACTIONS, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, RESTRUCTURE_TARGET_RE, RETENTION_FEEDBACK_KEEP_RATIO, RETENTION_FEEDBACK_MIN_CHARS, REVIEWER_PRESET_ID, RULES, RUNS_SCHEMA_VERSION, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, SKILL_NAME_RE, SKILL_REVIEW_PLAN_PROMPT, SKILL_REVIEW_PROMPT, SNAPSHOT_EXTRA_NAME_RE, STORE_LEDGER, SUMMARY_DUPLICATE_HINT_THRESHOLD, SUPPORT_DIRS, SUPPORT_SPRAWL_FILES, SUPPRESSED_FILE_VERSION, SkillLibrary, SkillModel, TEXT_DIFF_MAX_CHARS, TEXT_DIFF_MAX_LINES, THREAT_EXEMPTION_HINT, TOKEN_ASCII_WEIGHT, TOKEN_CJK_WEIGHT, ToolDispatchNormalizer, ToolDispatchPayloadError, UNIT_JOURNAL_PHASES, UNIT_JOURNAL_SCHEMA_VERSION, UNIT_STORAGE_SCHEMA_VERSION, UNTRUSTED_LINE_BREAK, UNTRUSTED_LINE_MARK, UPSTREAM_LIMIT_CHARS_PER_TOKEN, UnitTransactions, VERSION_SUMMARY_MAX_CHARS, WriteKernel, absentHostServices, acquireTreeWriteLock, admissionVerdict, advanceReview, affinity, ageCopyKey, allowRowCollisions, anchorVerdict, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, applyNamespaceMigration, applyReferenceRewrite, asRecord, assertDispatchPayload, assertSkillsRootAliasRetired, assertUnitJournalTransition, assessStructureHealth, atomicWriteFiles, authoringFeedback, authorityFrom, backupsReachability, blobPath, bodyCost, buildCuratorRunReport, buildExtractPlanFromLibrary, buildHealthBaseline, buildLearnPrompt, bumpPatch, bumpSupportRead, bumpUse, bumpView, callingScope, candidateSkills, canonicalWriteId, claimInstance, clampOnce, clampedNumber, classifyNamespaceMigration, classifySessionEvent, clearReviewChannel, collectReadSkillNames, collectReadSupportFiles, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, contentRetentionFeedback, countDispatches, countReferenceFiles, createGateSet, createSubagentChannel, daysSinceIso, declaredReportStamp, describeReferenceRewrite, diffFindings, dispatchKeyOf, dispatchPathOf, dispatchStepOf, displayBodyOf, duplicateHeadings, elapsedSince, emptyRecord, ensureSkillFrontmatter, entryTarget, errorText, evaluateThreat, eventsFile, evidenceKindIndex, evolutionActivityProjection, evolutionEventPayloadIssue, evolutionEvidenceProjection, evolutionHome, evolutionIoAdapter, evolutionProjectionHistoryProjection, evolutionReadsProjection, evolutionRoot, evolutionSignalsProjection, executeUnitUndo, externalRefs, fileMutationLock, filterUnreadSkillOps, findDriftSignal, findOwnerCandidate, foldCuratorFields, foldToolDispatches, foldTurnEvent, foldTurnEvents, foldUntrustedLines, frontmatterBlock, frontmatterCatalogInvalid, fuzzyPatch, getRecord, h2Sections, historyIndexFile, historyReachability, historyRoot, hostSurface, identity, idleDays, initialTurnFold, instanceClaimKey, instanceClaimedWriteSites, instanceHolder, isAbsent, isBookkeepingFrame, isCommittedWarning, isDeprecatedParamId, isFileShapedPath, isIgnorableEvent, isLandmark, isMissingPath, isPresent, isProcessAlive, isProgramToolName, isProjectableSession, isRecord, isReviewChannelSession, isSkillReadToolName, isSkillToolName, isUnknown, isUnreadWrite, json, landmarkVerdict, latestActivityAt, latestVersionAt, lifecycleCandidate, lintBody, lintSkill, listEventArchives, liveBool, liveEnum, liveNumber, liveString, loadMutations, loadSuppressedNames, loadUsage, loadVersionContent, loadVersions, makeSerialQueue, mapProbe, markAgentCreated, markReviewChannel, markerEntryName, memoryRoot, methodNotAllowed, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nearDuplicateSummaries, newRunRegistry, newSkillLibrary, nextHistoryIndex, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, normalizeVersionSummary, observeEvent, orderVersions, overlongLines, ownerCandidatesFromSummaries, ownerDecisionText, paramNamespace, paramRowId, paramSettingsId, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, parseHistoryIndex, partitionVersions, payloadText, persistedWriteSite, persistedWriteSites, pickWithPolicy, planExtract, planNamespaceMigration, planReferenceRewrite, planRehoming, planUnitUndoAcross, policyStageLimits, probeAbsent, probeChannelState, probeList, probeMtime, probePresent, probeReason, probeText, probeUnknown, projectExtractBodies, projectionText, proposalFromPlan, proposalReportDir, proposalReportName, protectedSkillNamesOf, pruneTreeChangeUnits, readDispatchSignal, readEvolutionEvents, readEvolutionTimeline, readExternalSupport, readHistoryIndex, readJsonObject, readNumberParam, readParam, readProposalReports, readTreeLock, readUnitEvidence, readUnitIndex, readUnitJournal, readUnitReceipt, readUnitSnapshot, readingStats, recordMutation, recordVersions, redactSecrets, referencedBlobs, registerHostRoutes, registerOwnerSettings, relatedSkillNames, releaseInstance, renameWithRetry, renderCuratorReportMarkdown, renderLongRunTable, reportTime, reportsReachability, reportsSweepLockTarget, resolveCitations, resolveExecOrigins, resolveOrigins, resolveParamId, resolveRootConfig, resolveSkillsRoot, resolveUnitMembers, resolveUnitMembersFromIndexes, restructureCandidates, retainEventArchives, retirementReport, reviewPrompt, revisionAnchor, revisionAnchorOf, revisionFingerprint, revisionSupportDigest, runWriteGates, runsFile, saveSuppressedNames, saveUsage, scanBodyHooks, scanContentThreats, scanMemoryThreats, scanThreats, scopeOfNearestManifest, scopedPackageName, scopedProbeReport, selectSections, sessionAudited, sessionEvidenceIndex, sessionLastEventTime, sessionReadNames, sessionReadSkillNames, sessionReadSupportFiles, sessionSeesFamilyTools, sessionTurnSignals, skillLibraryUnitBackend, skillReadNameOf, skillRowCells, skillStateKey, skillWriteGateContext, skillsRoot, staleRouteStubs, subagentChannelState, supportFileReadFromPath, supportFileReadOf, supportRefs, suppressedFile, sweepReports, sweepReviewChannelSessions, textDiffFacts, tokenLineFor, transactIo, transactTaskGuard, treeLockFile, trimPatternBoundaries, unhookedSupportPointers, unitEvidenceDigest, unitEvidencePath, unitIndexPath, unitJournalPath, unitJournalPhaseRank, unitJournalPort, unitMembersAreComplete, unitReceiptPath, unitSnapshotPath, unitSnapshotPort, unitSnapshotsDir, unitStorageKey, unwrapLive, updateSuppressedNames, upsertUnitIndex, usageFile, usageObserved, userSetKeys, validateFrontmatter, validateMutationRequest, validateRestructureTarget, validateSupportPath, valueOr, verifyPromptBundle, versionActionKind, versionRowCells, versionSummaryPrompt, versionTarget, vocabulary, withTreeWrite, withTreeWriteLock, writeDurableTmp, writePathSymbols, writeProposalReport, writeUnitEvidence, writeUnitJournal, writeUnitReceipt, writeUnitSnapshot, yamlPlainScalarNeedsQuotes };