@lmzhen/dsh-evolution-core 0.49.0 → 0.50.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 (93) hide show
  1. package/lib/authority-plugin.js +2 -1
  2. package/lib/citations-CZKTUGQF.js +198 -0
  3. package/lib/composition/index.js +2 -2
  4. package/lib/{composition-Cqjbho0t.js → composition-DA8XPfMc.js} +1 -1
  5. package/lib/connection-DAJy7Xjm.js +28 -0
  6. package/lib/{ensure-CAjLGd9f.js → ensure-Bx4ksgJk.js} +15 -5
  7. package/lib/errors.js +2 -0
  8. package/lib/extract-plan-Bru3c9ec.js +271 -0
  9. package/lib/extract.js +240 -0
  10. package/lib/http-routes.js +27 -7
  11. package/lib/index.js +41 -800
  12. package/lib/{numeric-D8js3sqC.js → limits-C9jfvxBl.js} +1 -43
  13. package/lib/{mutation-authority-l57R626O.js → mutation-authority-DQfpXs1O.js} +2 -54
  14. package/lib/numeric-Dc53KQoe.js +43 -0
  15. package/lib/platform/index.js +4 -3
  16. package/lib/platform-DyHnHUmQ.js +251 -0
  17. package/lib/policy.js +3 -2
  18. package/lib/quality-WAU6YatF.js +554 -0
  19. package/lib/restrictor.js +1 -1
  20. package/lib/result.js +33 -0
  21. package/lib/runtime/plugin.js +97 -43
  22. package/lib/{session-projection-DSXnUNZG.js → session-projection-ByNxQi9O.js} +2 -198
  23. package/lib/skill-health-Bl-MdXZ4.js +1409 -0
  24. package/lib/skills.js +7 -4
  25. package/lib/state-store-Jpa-iYIZ.js +54 -0
  26. package/lib/subagent/index.js +214 -176
  27. package/lib/{tools-DzcNFex2.js → tools-BrUswg8v.js} +3 -1
  28. package/lib/types/composition/ensure.js +21 -7
  29. package/lib/types/extract-plan.d.ts +2 -0
  30. package/lib/types/extract.d.ts +12 -0
  31. package/lib/types/extract.js +12 -0
  32. package/lib/types/http-routes.js +32 -9
  33. package/lib/types/index.d.ts +0 -3
  34. package/lib/types/index.js +0 -3
  35. package/lib/types/opt-in.js +4 -3
  36. package/lib/types/params.js +2 -1
  37. package/lib/types/platform/agents.d.ts +32 -0
  38. package/lib/types/platform/agents.js +26 -0
  39. package/lib/types/platform/commands.d.ts +14 -0
  40. package/lib/types/platform/commands.js +9 -0
  41. package/lib/types/platform/connection.d.ts +26 -0
  42. package/lib/types/platform/connection.js +27 -0
  43. package/lib/types/platform/index.d.ts +26 -0
  44. package/lib/types/platform/index.js +13 -0
  45. package/lib/types/platform/llm.d.ts +3 -1
  46. package/lib/types/platform/llm.js +1 -0
  47. package/lib/types/platform/platformView.d.ts +21 -0
  48. package/lib/types/platform/platformView.js +29 -0
  49. package/lib/types/platform/profileContext.d.ts +16 -0
  50. package/lib/types/platform/profileContext.js +14 -0
  51. package/lib/types/platform/sessionQuery.d.ts +14 -0
  52. package/lib/types/platform/sessionQuery.js +9 -0
  53. package/lib/types/platform/settings.d.ts +22 -0
  54. package/lib/types/platform/settings.js +14 -0
  55. package/lib/types/platform/skills.d.ts +16 -0
  56. package/lib/types/platform/skills.js +9 -0
  57. package/lib/types/platform/storageDomain.d.ts +13 -0
  58. package/lib/types/platform/storageDomain.js +9 -0
  59. package/lib/types/platform/subagents.d.ts +25 -0
  60. package/lib/types/platform/subagents.js +17 -0
  61. package/lib/types/platform/systemPrompt.d.ts +16 -0
  62. package/lib/types/platform/systemPrompt.js +13 -0
  63. package/lib/types/platform/tools.d.ts +4 -0
  64. package/lib/types/platform/tools.js +2 -0
  65. package/lib/types/platform/userQuestions.d.ts +33 -0
  66. package/lib/types/platform/userQuestions.js +9 -0
  67. package/lib/types/platform/workingDirectory.d.ts +14 -0
  68. package/lib/types/platform/workingDirectory.js +9 -0
  69. package/lib/types/platform-line.generated.d.ts +5 -5
  70. package/lib/types/platform-line.generated.js +5 -5
  71. package/lib/types/platform-services.js +3 -0
  72. package/lib/types/result.d.ts +35 -0
  73. package/lib/types/result.js +25 -0
  74. package/lib/types/runtime/llm.d.ts +2 -2
  75. package/lib/types/runtime/llm.js +5 -8
  76. package/lib/types/runtime/platform.d.ts +37 -4
  77. package/lib/types/runtime/platform.js +40 -5
  78. package/lib/types/runtime/projections.d.ts +9 -4
  79. package/lib/types/runtime/projections.js +64 -28
  80. package/lib/types/subagent/channel.d.ts +1 -3
  81. package/lib/types/subagent/channel.js +2 -332
  82. package/lib/types/subagent/index.d.ts +2 -0
  83. package/lib/types/subagent/index.js +2 -0
  84. package/lib/types/subagent/kernel.d.ts +4 -0
  85. package/lib/types/subagent/kernel.js +234 -0
  86. package/lib/types/subagent/readiness.js +5 -7
  87. package/lib/types/subagent/run.d.ts +53 -0
  88. package/lib/types/subagent/run.js +125 -0
  89. package/lib/types/subagent/types.d.ts +2 -2
  90. package/lib/usage-DdjIBAkm.js +1252 -0
  91. package/package.json +37 -25
  92. package/lib/platform-Cc9cNt5j.js +0 -111
  93. package/lib/skill-health-DP8z9TPf.js +0 -2923
package/lib/index.js CHANGED
@@ -1,18 +1,23 @@
1
1
  import { S as reportTime, _ as probeMtime, a as isProcessAlive, b as probeText, c as transactIo, d as isAbsent, f as isMissingPath, g as probeList, h as probeAbsent, i as isCommittedWarning, l as writeDurableTmp, m as isUnknown, n as atomicWriteFiles, o as nodeEvolutionIo, p as isPresent, r as evolutionIoAdapter, s as renameWithRetry, t as TransactionNotInvokedError, u as declaredReportStamp, v as probePresent, x as probeUnknown, y as probeReason } from "./io-GxghO3Ip.js";
2
- import { a as leaseFile, c as evolutionHome, d as AuthorityOrderError, f as AuthorityReentryError, h as leaseAsTreeLock, i as LeaseStore, l as evolutionRoot, m as authorityHolder, n as mutationLockFrom, o as HomeFence, p as HomeAuthority, r as DEFAULT_LEASE_TTL_MS, s as HomeFenceError, t as MutationAuthority, u as AuthorityBusyError } from "./mutation-authority-l57R626O.js";
3
- import { A as dispatchKeyOf, B as CITATION_SUPPORT_DIRS, C as PTC_DISPATCH_EVENT, D as assertDispatchPayload, E as ToolDispatchPayloadError, F as isSkillToolName, G as resolveCitations, H as HOOK_LINE_RE, I as readDispatchSignal, K as scanBodyHooks, L as skillReadNameOf, M as dispatchStepOf, N as foldToolDispatches, O as collectReadSkillNames, P as isSkillReadToolName, R as supportFileReadFromPath, S as NATIVE_RESULT_EVENT, T as ToolDispatchNormalizer, U as KEEP_LINE_RE, V as DEFAULT_CITATION_REF_BUDGET, W as isFileShapedPath, _ as isBookkeepingFrame, a as evolutionSignalsProjection, b as MODEL_SESSION_EVENT_TYPES, c as sessionLastEventTime, d as advanceReview, f as foldTurnEvent, g as evidenceKindIndex, h as observeEvent, i as evolutionReadsProjection, j as dispatchPathOf, k as collectReadSupportFiles, l as sessionReadNames, m as initialTurnFold, n as evolutionEvidenceProjection, o as isProjectableSession, p as foldTurnEvents, 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 supportFileReadOf } from "./session-projection-DSXnUNZG.js";
4
- import { A as DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, B as MAX_SKILL_NAME_LENGTH, C as DEFAULT_REVIEW_TIMEOUT_MS, D as DEFAULT_SKILL_VERSION_KEEP, E as DEFAULT_SKILL_REVIEW_TRIGGER, F as EVOLUTION_WRITE_TOOLS, G as SKILL_ACTION_REQUIRED_FIELDS, H as MEMORY_GUIDANCE_SECTION_ORDER, I as FORBIDDEN_CONTROL_KEYS, J as SUPPORT_SPRAWL_FILES, K as SKILL_NAME_RE, L as MAX_DESCRIPTION_LENGTH, M as DEFAULT_THREAT_MAX_SCAN_CHARS, N as DEFAULT_USER_CHAR_LIMIT, O as DEFAULT_STALE_AFTER_DAYS, P as ENTRY_DELIMITER, R as MAX_SKILL_CONTENT_CHARS, S as DEFAULT_REVIEW_SKILL_INTERVAL, T as DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, U as PROTECTED_BUILTIN_SKILLS, V as MAX_TIMER_DELAY_MS, W as SKILLS_GUIDANCE_SECTION_ORDER, Y as UPSTREAM_LIMIT_CHARS_PER_TOKEN, _ as DEFAULT_CURATOR_REVIEW_MAX_TOKENS, a as DEFAULT_SKILL_LIMITS, b as DEFAULT_PROBE_TIMEOUT_MS, c as policyStageLimits, d as CONTENT_SPLIT_HINT, f as DEFAULT_ARCHIVE_AFTER_DAYS, g as DEFAULT_CURATOR_MODEL, h as DEFAULT_CURATOR_INTERVAL_HOURS, i as DEFAULT_REFERENCE_REWRITE_POLICY, j as DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, k as DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, l as AUTHORING_DESCRIPTION_BAR, m as DEFAULT_CURATOR_BOOT_GRACE_SECONDS, n as DEFAULT_ARCHIVE_RETENTION_POLICY, o as DEFAULT_SUPPORT_FILE_CHAR_POLICY, p as DEFAULT_CONSOLIDATION_FAILURES, q as SUPPORT_DIRS, r as DEFAULT_CITATION_POLICY, s as POLICY_STAGE_DEFAULTS, t as clampedNumber, u as AUTHORING_SPLIT_LINE_CHARS, v as DEFAULT_MEMORY_CHAR_LIMIT, w as DEFAULT_SKILL_CONTENT_CHARS, x as DEFAULT_REVIEW_MEMORY_INTERVAL, y as DEFAULT_MIN_IDLE_HOURS, z as MAX_SKILL_FILE_BYTES } from "./numeric-D8js3sqC.js";
5
- import { c as MAINTAINER_PRESET_ID, d as RESTRICTOR_MODULE, f as REVIEWER_PRESET_ID, g as scopedPackageName, h as scopeOfNearestManifest, l as RESTRICTED_PRESET_DISPLAY, s as EVOLUTION_PRESET_IDS, u as RESTRICTED_TOOLS_ROW_ID } from "./ensure-CAjLGd9f.js";
6
- import { $ as bumpView, A as listEventArchives, B as COST_CJK_TOKEN_HIGH, Bt as planRehoming, C as EVENT_ARCHIVE_PREFIX, D as appendEvolutionEvent, E as EVENT_LOG_VERSION, F as RULES, Ft as externalRefs, G as tokenLineFor, H as TOKEN_ASCII_WEIGHT, It as supportRefs, J as applyCuratorLifecycleFields, Jt as authorityFrom, K as MAX_SUPPORT_READ_PATHS, Kt as DEFAULT_WRITE_CONFIRM_MODE, L as lintSkill, Lt as applyReferenceRewrite, M as readEvolutionEvents, N as readEvolutionTimeline, O as eventsFile, P as retainEventArchives, Q as bumpUse, R as COST_ASCII_TOKEN_HIGH, Rt as describeReferenceRewrite, S as trimPatternBoundaries, St as readingStats, T as EVENT_LOG_ROTATE_AT, U as TOKEN_CJK_WEIGHT, Ut as isUnreadWrite, V as COST_CJK_TOKEN_LOW, W as bodyCost, X as bumpPatch, Y as applyCuratorMetaFields, Z as bumpSupportRead, _ as scanThreats, _t as planExtract, at as latestActivityAt, b as FUZZY_MAX_WORK, bt as displayBodyOf, c as clearReviewChannel, ct as markAgentCreated, d as sweepReviewChannelSessions, dt as saveSuppressedNames, et as daysSinceIso, f as PATTERN_OVERLAP, ft as saveUsage, g as scanMemoryThreats, gt as usageObserved, h as scanContentThreats, ht as usageFile, i as assessStructureHealth, it as idleDays, j as parseEvolutionEvents, k as evolutionEventPayloadIssue, kt as parseFrontmatter, l as isReviewChannelSession, lt as mutateUsage, m as evaluateThreat, mt as updateSuppressedNames, nt as foldCuratorFields, o as currentReviewContext, ot as loadSuppressedNames, p as THREAT_EXEMPTION_HINT, pt as suppressedFile, q as SUPPRESSED_FILE_VERSION, qt as DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, rt as getRecord, s as withReviewContext, st as loadUsage, t as DEFAULT_HEALTH_THRESHOLDS, tt as emptyRecord, u as markReviewChannel, ut as normalizeUsageRecord, v as makeSerialQueue, vt as projectExtractBodies, w as EVENT_LOG_RETAIN_ARCHIVES, x as fuzzyPatch, xt as h2Sections, y as FUZZY_MAX_PATTERN_CHARS, yt as selectSections, z as COST_ASCII_TOKEN_LOW, zt as planReferenceRewrite } from "./skill-health-DP8z9TPf.js";
2
+ import { a as leaseFile, c as AuthorityBusyError, d as HomeAuthority, f as authorityHolder, i as LeaseStore, l as AuthorityOrderError, n as mutationLockFrom, o as HomeFence, p as leaseAsTreeLock, r as DEFAULT_LEASE_TTL_MS, s as HomeFenceError, t as MutationAuthority, u as AuthorityReentryError } from "./mutation-authority-DQfpXs1O.js";
3
+ import { a as isFileShapedPath, i as KEEP_LINE_RE, n as DEFAULT_CITATION_REF_BUDGET, o as resolveCitations, r as HOOK_LINE_RE, s as scanBodyHooks, t as CITATION_SUPPORT_DIRS } from "./citations-CZKTUGQF.js";
4
+ import { A as DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, B as MAX_TIMER_DELAY_MS, C as DEFAULT_SKILL_CONTENT_CHARS, D as DEFAULT_STALE_AFTER_DAYS, E as DEFAULT_SKILL_VERSION_KEEP, F as FORBIDDEN_CONTROL_KEYS, G as SKILL_NAME_RE, H as PROTECTED_BUILTIN_SKILLS, I as MAX_DESCRIPTION_LENGTH, J as UPSTREAM_LIMIT_CHARS_PER_TOKEN, K as SUPPORT_DIRS, L as MAX_SKILL_CONTENT_CHARS, M as DEFAULT_USER_CHAR_LIMIT, N as ENTRY_DELIMITER, O as DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, P as EVOLUTION_WRITE_TOOLS, R as MAX_SKILL_FILE_BYTES, S as DEFAULT_REVIEW_TIMEOUT_MS, T as DEFAULT_SKILL_REVIEW_TRIGGER, U as SKILLS_GUIDANCE_SECTION_ORDER, V as MEMORY_GUIDANCE_SECTION_ORDER, W as SKILL_ACTION_REQUIRED_FIELDS, _ as DEFAULT_MEMORY_CHAR_LIMIT, a as DEFAULT_SUPPORT_FILE_CHAR_POLICY, b as DEFAULT_REVIEW_MEMORY_INTERVAL, c as AUTHORING_DESCRIPTION_BAR, d as DEFAULT_ARCHIVE_AFTER_DAYS, f as DEFAULT_CONSOLIDATION_FAILURES, g as DEFAULT_CURATOR_REVIEW_MAX_TOKENS, h as DEFAULT_CURATOR_MODEL, i as DEFAULT_SKILL_LIMITS, j as DEFAULT_THREAT_MAX_SCAN_CHARS, k as DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, l as AUTHORING_SPLIT_LINE_CHARS, m as DEFAULT_CURATOR_INTERVAL_HOURS, n as DEFAULT_CITATION_POLICY, o as POLICY_STAGE_DEFAULTS, p as DEFAULT_CURATOR_BOOT_GRACE_SECONDS, q as SUPPORT_SPRAWL_FILES, r as DEFAULT_REFERENCE_REWRITE_POLICY, s as policyStageLimits, t as DEFAULT_ARCHIVE_RETENTION_POLICY, u as CONTENT_SPLIT_HINT, v as DEFAULT_MIN_IDLE_HOURS, w as DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, x as DEFAULT_REVIEW_SKILL_INTERVAL, y as DEFAULT_PROBE_TIMEOUT_MS, z as MAX_SKILL_NAME_LENGTH } from "./limits-C9jfvxBl.js";
5
+ import { c as MAINTAINER_PRESET_ID, d as RESTRICTOR_MODULE, f as REVIEWER_PRESET_ID, g as scopedPackageName, h as scopeOfNearestManifest, l as RESTRICTED_PRESET_DISPLAY, s as EVOLUTION_PRESET_IDS, u as RESTRICTED_TOOLS_ROW_ID } from "./ensure-Bx4ksgJk.js";
6
+ import { $ as authorityFrom, A as listEventArchives, B as COST_CJK_TOKEN_HIGH, C as EVENT_ARCHIVE_PREFIX, D as appendEvolutionEvent, E as EVENT_LOG_VERSION, F as RULES, G as tokenLineFor, H as TOKEN_ASCII_WEIGHT, J as isUnreadWrite, L as lintSkill, M as readEvolutionEvents, N as readEvolutionTimeline, O as eventsFile, P as retainEventArchives, Q as DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, R as COST_ASCII_TOKEN_HIGH, S as trimPatternBoundaries, T as EVENT_LOG_ROTATE_AT, U as TOKEN_CJK_WEIGHT, V as COST_CJK_TOKEN_LOW, W as bodyCost, Z as DEFAULT_WRITE_CONFIRM_MODE, _ as scanThreats, b as FUZZY_MAX_WORK, c as clearReviewChannel, d as sweepReviewChannelSessions, f as PATTERN_OVERLAP, g as scanMemoryThreats, h as scanContentThreats, i as assessStructureHealth, j as parseEvolutionEvents, k as evolutionEventPayloadIssue, l as isReviewChannelSession, m as evaluateThreat, o as currentReviewContext, p as THREAT_EXEMPTION_HINT, s as withReviewContext, t as DEFAULT_HEALTH_THRESHOLDS, u as markReviewChannel, v as makeSerialQueue, w as EVENT_LOG_RETAIN_ARCHIVES, x as fuzzyPatch, y as FUZZY_MAX_PATTERN_CHARS, z as COST_ASCII_TOKEN_LOW } from "./skill-health-Bl-MdXZ4.js";
7
7
  import { i as HOST_LOCALES, n as errorText, r as errorTextIn, t as EVOLUTION_ERRORS } from "./errors-BxzLTVbS.js";
8
+ import { A as dispatchKeyOf, C as PTC_DISPATCH_EVENT, D as assertDispatchPayload, E as ToolDispatchPayloadError, F as isSkillToolName, I as readDispatchSignal, L as skillReadNameOf, M as dispatchStepOf, N as foldToolDispatches, O as collectReadSkillNames, P as isSkillReadToolName, R as supportFileReadFromPath, S as NATIVE_RESULT_EVENT, T as ToolDispatchNormalizer, _ as isBookkeepingFrame, a as evolutionSignalsProjection, b as MODEL_SESSION_EVENT_TYPES, c as sessionLastEventTime, d as advanceReview, f as foldTurnEvent, g as evidenceKindIndex, h as observeEvent, i as evolutionReadsProjection, j as dispatchPathOf, k as collectReadSupportFiles, l as sessionReadNames, m as initialTurnFold, n as evolutionEvidenceProjection, o as isProjectableSession, p as foldTurnEvents, 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 supportFileReadOf } from "./session-projection-ByNxQi9O.js";
9
+ import { C as updateSuppressedNames, D as displayBodyOf, E as selectSections, G as describeReferenceRewrite, H as externalRefs, K as planReferenceRewrite, O as h2Sections, S as suppressedFile, T as usageObserved, U as supportRefs, W as applyReferenceRewrite, _ as markAgentCreated, a as bumpPatch, b as saveSuppressedNames, c as bumpView, d as foldCuratorFields, f as getRecord, g as loadUsage, h as loadSuppressedNames, i as applyCuratorMetaFields, k as readingStats, l as daysSinceIso, m as latestActivityAt, n as SUPPRESSED_FILE_VERSION, o as bumpSupportRead, p as idleDays, q as planRehoming, r as applyCuratorLifecycleFields, s as bumpUse, t as MAX_SUPPORT_READ_PATHS, u as emptyRecord, v as mutateUsage, w as usageFile, x as saveUsage, y as normalizeUsageRecord } from "./usage-DdjIBAkm.js";
8
10
  import { n as isRecord, t as asRecord } from "./guards-3f02mnf2.js";
9
- import { a as mutationsFile, i as loadMutations, n as MUTATIONS_FILE_VERSION, o as recordMutation, r as contentHash, t as DEFAULT_MUTATION_CAP } from "./mutations-DQXddSJd.js";
11
+ import { T as ownerCandidatesFromSummaries, _ as readProposalReport, a as SUMMARY_DUPLICATE_HINT_THRESHOLD, b as proposalFromPlan, c as computePrefixClusters, d as nearDuplicateSummaries, f as projectionText, g as proposalReportName, h as proposalReportDir, i as QUALITY_WEIGHTS, l as computeQualityScores, m as readExternalSupport, n as DEDUP_SIMILARITY_THRESHOLD, o as affinity, p as vocabulary, r as LOW_QUALITY_THRESHOLD, s as computeDedupGroups, t as DEDUP_MAX_PAIR_COMPARISONS, u as identity, v as readProposalReports, w as findOwnerCandidate, y as writeProposalReport } from "./quality-WAU6YatF.js";
12
+ import { n as evolutionRoot, t as evolutionHome } from "./state-store-Jpa-iYIZ.js";
10
13
  import { HOST_ROUTES, MAX_REQUEST_BODY_BYTES, hostSurface, json, methodNotAllowed, readJsonObject, registerHostRoutes } from "./http-routes.js";
11
- import { w as allowRowCollisions } from "./composition-Cqjbho0t.js";
12
- import { u as scopeOf } from "./platform-Cc9cNt5j.js";
13
- import { createSubagentChannel, probeChannelState } from "./subagent/index.js";
14
- import { readFile, realpath, stat } from "node:fs/promises";
15
- import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
14
+ import { w as allowRowCollisions } from "./composition-DA8XPfMc.js";
15
+ import { t as clampedNumber } from "./numeric-Dc53KQoe.js";
16
+ import { a as mutationsFile, i as loadMutations, n as MUTATIONS_FILE_VERSION, o as recordMutation, r as contentHash, t as DEFAULT_MUTATION_CAP } from "./mutations-DQXddSJd.js";
17
+ import { u as scopeOf, y as settingsPort } from "./platform-DyHnHUmQ.js";
18
+ import { n as toolsPort } from "./tools-BrUswg8v.js";
19
+ import { abortLink, createSubagentChannel as createSubagentKernel, createSubagentRun, probeChannelState, textOfValue, waitForSubagentEnd } from "./subagent/index.js";
20
+ import { basename, join } from "node:path";
16
21
  import { readFileSync } from "node:fs";
17
22
  import { createHash, randomUUID } from "node:crypto";
18
23
  import { fileURLToPath } from "node:url";
@@ -308,785 +313,6 @@ async function runWriteGates(context) {
308
313
  return null;
309
314
  }
310
315
  //#endregion
311
- //#region lib/types/owner-resolver.js
312
- /**
313
- * Project the current library listing into owner candidates.
314
- *
315
- * The source is excluded; a skill with an empty description is named in
316
- * excluded rather than silently dropped. Protected candidates remain visible
317
- * (so a caller can explain why it refused), but are marked for the writer's
318
- * protection gate. Headings reuse h2Sections; no second heading scanner.
319
- * @param source - skill being extracted from.
320
- * @param summaries - SkillLibrary.list({ withContent: true, withFrontmatter: true }).
321
- * @returns stable-name-ordered candidates plus explicit exclusions.
322
- */
323
- function ownerCandidatesFromSummaries(source, summaries) {
324
- const normalized = source.trim();
325
- const candidates = [];
326
- const excluded = [];
327
- for (const summary of summaries) {
328
- if (summary.name === normalized) {
329
- excluded.push({
330
- name: summary.name,
331
- reason: "source"
332
- });
333
- continue;
334
- }
335
- if (summary.description.trim() === "") {
336
- excluded.push({
337
- name: summary.name,
338
- reason: "unreadable"
339
- });
340
- continue;
341
- }
342
- candidates.push({
343
- name: summary.name,
344
- description: summary.description,
345
- ...summary.whenToUse === void 0 ? {} : { whenToUse: summary.whenToUse },
346
- headings: h2Sections(summary.content ?? "").map((section) => section.title),
347
- protectedBy: summary.protectedBy,
348
- protectionUnknown: summary.protectionUnknown,
349
- managed: summary.managed
350
- });
351
- }
352
- candidates.sort((left, right) => left.name.localeCompare(right.name));
353
- excluded.sort((left, right) => left.name.localeCompare(right.name));
354
- return {
355
- source: normalized,
356
- candidates,
357
- excluded
358
- };
359
- }
360
- /**
361
- * Find one named candidate in a lookup.
362
- * @param lookup - projection from ownerCandidatesFromSummaries.
363
- * @param name - exact skill name.
364
- * @returns the candidate, or undefined when absent.
365
- */
366
- function findOwnerCandidate(lookup, name) {
367
- return lookup.candidates.find((candidate) => candidate.name === name);
368
- }
369
- //#endregion
370
- //#region lib/types/quality.js
371
- /**
372
- * Quality scoring and near-duplicate detection for the curated skill library.
373
- *
374
- * Pure functions over data inputs so the scoring policy is unit-testable and
375
- * the same math feeds the usage sidecar, the `skill_manage review` surface and
376
- * the learning graph. Weights follow the Hermes/hermes-claw six-factor model;
377
- * mutation maturity is a documented DSH approximation (single per-month patch
378
- * trend ratio replaces the claw timestamp-trend formula, since DSH usage
379
- * records only carry the last patched timestamp).
380
- *
381
- * Batch C (2026-09-27): the similarity half of this module is now TWO NAMED
382
- * QUESTIONS plus a declared projection — {@link identity} ("is it the same
383
- * text?") and {@link affinity} ("how much vocabulary do these two share?") asked
384
- * over {@link projectionText}. Callers name the question and the projection
385
- * instead of growing a fourth unnamed ruler (design §3C / §1 I2).
386
- * @module @lmzhen/dsh-evolution-core
387
- */
388
- const QUALITY_WEIGHTS = {
389
- usageFrequency: .25,
390
- stability: .2,
391
- recency: .2,
392
- references: .1,
393
- mutationMaturity: .2,
394
- richness: .05
395
- };
396
- /** Score below which a skill is flagged for review. */
397
- const LOW_QUALITY_THRESHOLD = .3;
398
- function clamp01(value) {
399
- return Math.max(0, Math.min(1, value));
400
- }
401
- function daysBetween(from, now) {
402
- const t = Date.parse(from);
403
- if (!Number.isFinite(t)) return 0;
404
- return Math.max(0, (now.getTime() - t) / 864e5);
405
- }
406
- function computeQualityScores(input) {
407
- const now = input.now ?? /* @__PURE__ */ new Date();
408
- const scores = /* @__PURE__ */ new Map();
409
- for (const [name, record] of input.usage) {
410
- const ageDays = Math.max(1, daysBetween(record.created_at, now));
411
- const idleDays = daysBetween(latestActivityAt(record) ?? record.created_at, now);
412
- const patchCount = record.patch_count;
413
- const loadCount = record.use_count + record.view_count;
414
- const usageFrequency = clamp01(loadCount / ageDays);
415
- const stability = loadCount === 0 ? 1 : clamp01(1 - patchCount / loadCount);
416
- const recency = idleDays < 30 ? 1 : clamp01(1 - (idleDays - 30) / 150);
417
- const references = clamp01((input.referenceCounts?.get(name) ?? 0) / 3);
418
- const mutationMaturity = patchCount === 0 ? .3 : patchCount === 1 ? .4 : clamp01((patchCount - 1) / Math.max(1, ageDays / 30));
419
- const richness = clamp01((input.supportDirs?.get(name) ?? 0) * .175);
420
- const factors = {
421
- usageFrequency,
422
- stability,
423
- recency,
424
- references,
425
- mutationMaturity,
426
- richness
427
- };
428
- const score = usageFrequency * QUALITY_WEIGHTS.usageFrequency + stability * QUALITY_WEIGHTS.stability + recency * QUALITY_WEIGHTS.recency + references * QUALITY_WEIGHTS.references + mutationMaturity * QUALITY_WEIGHTS.mutationMaturity + richness * QUALITY_WEIGHTS.richness;
429
- scores.set(name, {
430
- score,
431
- factors,
432
- warn: score < LOW_QUALITY_THRESHOLD
433
- });
434
- }
435
- return scores;
436
- }
437
- function normalize(content) {
438
- return content.toLowerCase().replace(/\s+/g, " ").trim();
439
- }
440
- /** Named similarity question 1 — "is it the same text?" — as a normalized
441
- * content hash: case- and whitespace-insensitive, so two texts that differ only
442
- * in formatting are the SAME text here. Invariant under which projection the
443
- * caller read the text from.
444
- *
445
- * C-26 (v10 audit): NOT named `contentHash` — mutations.ts exports a
446
- * contentHash of RAW bytes, this one hashes the NORMALIZED text for dedup
447
- * grouping. Same helper as that rename, now a named question. */
448
- function identity(text) {
449
- return createHash("sha256").update(normalize(text)).digest("hex");
450
- }
451
- /**
452
- * The declared projection: WHICH text a comparison weighs.
453
- *
454
- * `body` is the library-wide scan's projection (whole SKILL.md, read by the
455
- * caller). `summary` is name + description in one string — the projection a
456
- * listing already publishes (`SkillSummary` carries both fields, and a body is
457
- * attached only when the caller asks for it) — so a summary comparison never
458
- * reads a body OF ITS OWN: the create-time hint is fed by the listing pass the
459
- * tool already pays for its frontmatter, and calls no read of its own.
460
- */
461
- function projectionText(projection, input) {
462
- switch (projection) {
463
- case "body": return input.content ?? "";
464
- case "summary": return `${input.name ?? ""} ${input.description ?? ""}`;
465
- }
466
- }
467
- /** The comparable vocabulary of one text: lowercase alphanumeric runs, plus
468
- * whole CJK runs (a Chinese description tokenizes by punctuation, not by word —
469
- * deliberately: the ruler is one home, and a real tokenizer is a different
470
- * question than "do these two share vocabulary?"). */
471
- function vocabulary(text) {
472
- return new Set(normalize(text).split(/[^a-z0-9\u4e00-\u9fff]+/).filter(Boolean));
473
- }
474
- /** Named similarity question 2 — "how much vocabulary do these two share?" —
475
- * Jaccard over two {@link vocabulary} sets, 0 (nothing in common, or either side
476
- * empty) to 1 (identical vocabulary). Set-based on purpose: the bulk scan
477
- * memoizes each name's set once and only the comparisons are budgeted. */
478
- function affinity(a, b) {
479
- if (a.size === 0 || b.size === 0) return 0;
480
- let intersection = 0;
481
- for (const token of a) if (b.has(token)) intersection += 1;
482
- return intersection / (a.size + b.size - intersection);
483
- }
484
- /** The `affinity` level at which two bodies are treated as the same skill
485
- * (design §3C: the default is unchanged at 0.95 — it is now a NAME, because the
486
- * docblock below has linked it since PLAN-R2 while the code carried a bare
487
- * literal). Callers may still pass their own level. */
488
- const DEDUP_SIMILARITY_THRESHOLD = .95;
489
- /** PLAN-R2 P2-8 (2026-09-16): default cap on two-name comparisons in
490
- * {@link computeDedupGroups}. A 2000-skill library is ~2M pairs; the old
491
- * unbounded two-two Jaccard ran seconds to tens of seconds per
492
- * review/`dedup_group` probe. 250k comparisons bounds that to well under a
493
- * second while staying far above every real library's pair count. Only
494
- * pairwise comparisons are budgeted — materializing a name's token set
495
- * (memoized, once per name) and the exact-hash pre-union phase are not. */
496
- const DEDUP_MAX_PAIR_COMPARISONS = 25e4;
497
- /**
498
- * Two-phase near-duplicate clustering: exact normalized-hash groups first,
499
- * then token-Jaccard edges at {@link DEDUP_SIMILARITY_THRESHOLD} with a token
500
- * ratio guard, union-find across the whole set.
501
- *
502
- * PLAN-R2 P2-8 (2026-09-16): each name's token set is materialized once
503
- * (memoized map), each pair takes an O(1) size-ratio short-circuit before the
504
- * intersection, and the pairwise loop is bounded by
505
- * `maxPairComparisons` (default {@link DEDUP_MAX_PAIR_COMPARISONS}); hitting
506
- * the budget stops the scan and `truncated: true` says so. Small libraries
507
- * (below the budget) behave exactly as the unbounded scan did.
508
- */
509
- function computeDedupGroups(input) {
510
- const threshold = input.threshold ?? .95;
511
- const maxPairComparisons = input.maxPairComparisons ?? 25e4;
512
- const names = [...input.contents.keys()];
513
- const hashes = /* @__PURE__ */ new Map();
514
- for (const name of names) {
515
- const hash = identity(projectionText("body", { content: input.contents.get(name) ?? "" }));
516
- const bucket = hashes.get(hash);
517
- if (bucket) bucket.push(name);
518
- else hashes.set(hash, [name]);
519
- }
520
- const parent = /* @__PURE__ */ new Map();
521
- const find = (x) => {
522
- const root = parent.get(x) ?? x;
523
- if (root !== x) parent.set(x, find(root));
524
- return parent.get(x) ?? x;
525
- };
526
- const union = (a, b) => {
527
- const [ra, rb] = [find(a), find(b)];
528
- if (ra !== rb) parent.set(rb, ra);
529
- };
530
- for (const [, bucketNames] of hashes) {
531
- const first = bucketNames[0];
532
- if (first === void 0 || bucketNames.length === 1) continue;
533
- for (let index = 1; index < bucketNames.length; index += 1) {
534
- const peer = bucketNames[index];
535
- if (peer) union(first, peer);
536
- }
537
- }
538
- const tokens = /* @__PURE__ */ new Map();
539
- const tokenSet = (name) => {
540
- let set = tokens.get(name);
541
- if (!set) {
542
- set = vocabulary(projectionText("body", { content: input.contents.get(name) ?? "" }));
543
- tokens.set(name, set);
544
- }
545
- return set;
546
- };
547
- let compared = 0;
548
- let truncated = false;
549
- for (let index = 0; index < names.length && !truncated; index += 1) {
550
- const a = names[index];
551
- if (a === void 0) continue;
552
- for (let other = index + 1; other < names.length; other += 1) {
553
- const b = names[other];
554
- if (b === void 0) continue;
555
- if (compared >= maxPairComparisons) {
556
- truncated = true;
557
- break;
558
- }
559
- compared += 1;
560
- const [ta, tb] = [tokenSet(a), tokenSet(b)];
561
- if (Math.max(ta.size, tb.size) / Math.max(1, Math.min(ta.size, tb.size)) > 5) continue;
562
- if (affinity(ta, tb) >= threshold) union(a, b);
563
- }
564
- }
565
- const groups = /* @__PURE__ */ new Map();
566
- for (const name of names) {
567
- const root = find(name);
568
- const group = groups.get(root);
569
- if (group) group.push(name);
570
- else groups.set(root, [name]);
571
- }
572
- return {
573
- groups: [...groups.values()].filter((group) => group.length > 1),
574
- truncated
575
- };
576
- }
577
- /**
578
- * The create-time near-duplicate question (batch C, design §3C-2): WHICH
579
- * existing skills is this authoring candidate about to near-copy?
580
- *
581
- * It is the SAME {@link affinity} question as the library-wide scan, asked over
582
- * the `summary` projection — the one a listing already publishes
583
- * (`SkillSummary` carries `name` and `description`; nothing here can see a
584
- * body, which is the point: a create must not pay a SECOND whole-tree pass — the
585
- * listing's own frontmatter read is what feeds this comparison). Deliberately hint-only: the caller writes regardless, and the
586
- * matches are news, not a gate (G4 — the create-time foreground behavior is
587
- * unchanged).
588
- *
589
- * The default level is far below the scan's {@link DEDUP_SIMILARITY_THRESHOLD}
590
- * because the projection is thinner: a name plus one sentence shares far fewer
591
- * tokens than two bodies, and a hint that fires on every new skill is noise.
592
- * Exact same-name candidates are skipped — the library's own create refuses
593
- * those, and this line must not repeat that refusal.
594
- */
595
- const SUMMARY_DUPLICATE_HINT_THRESHOLD = .5;
596
- function nearDuplicateSummaries(input) {
597
- const threshold = input.threshold ?? .5;
598
- const limit = input.limit ?? 3;
599
- const candidateTokens = vocabulary(projectionText("summary", input.candidate));
600
- const matches = [];
601
- for (const existing of input.existing) {
602
- if (existing.name === input.candidate.name) continue;
603
- const score = affinity(candidateTokens, vocabulary(projectionText("summary", existing)));
604
- if (score >= threshold) matches.push({
605
- name: existing.name,
606
- score
607
- });
608
- }
609
- return matches.sort((a, b) => b.score - a.score || a.name.localeCompare(b.name)).slice(0, limit);
610
- }
611
- /**
612
- * Prefix-cluster index over a name set (rc.67 merge heuristic, input side):
613
- * the curator prompt asks the model to identify "prefix clusters — skills
614
- * sharing a first word or domain keyword"; the deterministic index supplies
615
- * stable ground truth instead of letting the model infer clusters from the
616
- * raw list. Key = first alphanumeric run of the lowercased name; groups with
617
- * at least two members, largest first then alphabetical. Orientation-only:
618
- * nomination authority stays with the LLM and the candidate-pool gates.
619
- */
620
- function computePrefixClusters(names) {
621
- const groups = /* @__PURE__ */ new Map();
622
- for (const name of names) {
623
- const key = name.toLowerCase().split(/[^a-z0-9]+/)[0];
624
- if (!key) continue;
625
- const bucket = groups.get(key);
626
- if (bucket) bucket.push(name);
627
- else groups.set(key, [name]);
628
- }
629
- return [...groups.entries()].filter(([, members]) => members.length >= 2).map(([key, members]) => ({
630
- key,
631
- members
632
- })).sort((a, b) => b.members.length - a.members.length || a.key.localeCompare(b.key));
633
- }
634
- //#endregion
635
- //#region lib/types/external-support.js
636
- const MAX_FILE_BYTES = 1024 * 1024;
637
- const MAX_TOTAL_BYTES = 4 * 1024 * 1024;
638
- function targetPathFor(ref) {
639
- let value = ref.replace(/^\/+/, "");
640
- while (value.startsWith("../")) value = value.slice(3);
641
- const support = value.match(/(?:^|\/)(references|templates|scripts|assets)\/(.+)$/);
642
- if (support !== null) return support[1] + "/" + support[2];
643
- return "references/" + basename(value);
644
- }
645
- function annotate(content, originalPath) {
646
- const note = "external source: " + originalPath;
647
- const extension = originalPath.slice(originalPath.lastIndexOf(".")).toLowerCase();
648
- if (extension === ".md") return "<!-- " + note + " -->\n\n" + content;
649
- const prefix = extension === ".py" || extension === ".sh" || extension === ".rb" ? "# " : "// ";
650
- if (extension === ".js" || extension === ".mjs" || extension === ".cjs" || extension === ".ts" || extension === ".tsx" || extension === ".py" || extension === ".sh" || extension === ".rb") {
651
- if (content.startsWith("#!")) {
652
- const end = content.indexOf(String.fromCharCode(10));
653
- if (end >= 0) return content.slice(0, end + 1) + prefix + note + String.fromCharCode(10) + content.slice(end + 1);
654
- }
655
- return prefix + note + String.fromCharCode(10) + content;
656
- }
657
- return content;
658
- }
659
- function inside(root, candidate) {
660
- const rel = relative(root, candidate);
661
- return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
662
- }
663
- /**
664
- * Read and annotate external support files under one explicit root. The caller owns
665
- * the root choice; this module only enforces containment, target-path safety, size
666
- * limits and determinism.
667
- * @param body - selected source markdown body.
668
- * @param sourceDir - source skill directory.
669
- * @param allowedRoot - canonical root external files must stay under.
670
- * @param targetFiles - existing target support paths.
671
- * @returns resolved external entries, or a refusal.
672
- */
673
- async function readExternalSupport(body, sourceDir, allowedRoot, targetFiles) {
674
- const refs = externalRefs(body);
675
- if (refs.length === 0) return {
676
- ok: true,
677
- files: []
678
- };
679
- let root;
680
- try {
681
- root = await realpath(allowedRoot);
682
- } catch {
683
- return {
684
- ok: false,
685
- message: "external support 根目录不可读:" + allowedRoot
686
- };
687
- }
688
- const files = [];
689
- const targets = new Set(targetFiles);
690
- let total = 0;
691
- for (const ref of refs) {
692
- const candidate = isAbsolute(ref) ? resolve(ref) : resolve(sourceDir, ref);
693
- let canonical;
694
- try {
695
- canonical = await realpath(candidate);
696
- } catch {
697
- return {
698
- ok: false,
699
- message: "external support 文件不存在:" + ref
700
- };
701
- }
702
- if (!inside(root, canonical)) return {
703
- ok: false,
704
- message: "external support 越界:" + ref
705
- };
706
- const info = await stat(canonical);
707
- if (!info.isFile()) return {
708
- ok: false,
709
- message: "external support 不是普通文件:" + ref
710
- };
711
- if (info.size > MAX_FILE_BYTES) return {
712
- ok: false,
713
- message: "external support 超过单文件上限:" + ref
714
- };
715
- total += info.size;
716
- if (total > MAX_TOTAL_BYTES) return {
717
- ok: false,
718
- message: "external support 超过总上限:" + ref
719
- };
720
- const targetPath = targetPathFor(ref);
721
- if (targets.has(targetPath)) return {
722
- ok: false,
723
- message: "external support 目标冲突:" + targetPath
724
- };
725
- targets.add(targetPath);
726
- const annotated = annotate(await readFile(canonical, "utf8"), canonical);
727
- files.push({
728
- ref,
729
- originalPath: canonical,
730
- targetPath,
731
- content: annotated,
732
- sha256: createHash("sha256").update(annotated).digest("hex"),
733
- provenance: "external:" + canonical
734
- });
735
- }
736
- return {
737
- ok: true,
738
- files
739
- };
740
- }
741
- //#endregion
742
- //#region lib/types/extract-request.js
743
- /** The one human-readable owner decision shared by tool and CLI. */
744
- function ownerDecisionText(owner) {
745
- return owner.mode === "covered" ? "covered by " + (owner.name ?? "unknown") : "owner-gap, neededOwner=" + (owner.neededOwner ?? "unknown");
746
- }
747
- /** Build the one extract plan both the tool and CLI consume. */
748
- async function buildExtractPlanFromLibrary(library, input) {
749
- const source = input.source.trim();
750
- const raw = input.items;
751
- if (source === "" || raw.length === 0) return {
752
- ok: false,
753
- message: "extract 需要 name 与至少一个 extract 项。"
754
- };
755
- const requests = [];
756
- let target = "";
757
- for (const item of raw) {
758
- if (item === null || typeof item !== "object") return {
759
- ok: false,
760
- message: "extract 的每一项都必须是对象。"
761
- };
762
- const heading = typeof item.heading === "string" ? item.heading.trim().replace(/^#+\s*/, "") : "";
763
- const toSkill = typeof item.to_skill === "string" ? item.to_skill.trim() : "";
764
- if (heading === "" || toSkill === "") return {
765
- ok: false,
766
- message: "extract 的每一项都需要 heading 与 to_skill。"
767
- };
768
- if (target === "") target = toSkill;
769
- if (target !== toSkill) return {
770
- ok: false,
771
- message: "一次 extract 只能有一个 to_skill;多目标请分多次调用。"
772
- };
773
- const toHeading = typeof item.to_heading === "string" ? item.to_heading.trim().replace(/^#+\s*/, "") : void 0;
774
- if (toHeading !== void 0 && toHeading !== heading) return {
775
- ok: false,
776
- message: "to_heading 暂不支持改名;G3 要求 heading 与 to_heading 相同。"
777
- };
778
- requests.push({
779
- heading,
780
- ...typeof item.start === "string" ? { start: item.start } : {},
781
- ...typeof item.end === "string" ? { end: item.end } : {}
782
- });
783
- }
784
- const sourceMd = await library.read(source);
785
- if (sourceMd === null) return {
786
- ok: false,
787
- message: "技能「" + source + "」不存在。"
788
- };
789
- if (source === target) return {
790
- ok: false,
791
- message: "source 与 target 不能相同。"
792
- };
793
- const summaries = await library.model.list({
794
- withContent: true,
795
- withFrontmatter: true
796
- });
797
- const lookup = ownerCandidatesFromSummaries(source, summaries);
798
- const candidateNames = lookup.candidates.map((candidate) => candidate.name);
799
- const candidateHint = candidateNames.length === 0 ? "当前没有可用 owner candidate(描述为空或被排除)。" : "候选 owner:" + candidateNames.slice(0, 8).join("、") + (candidateNames.length > 8 ? " 等" : "") + "。";
800
- const targetMd = await library.read(target);
801
- if (targetMd === null) {
802
- const parsed = parseFrontmatter(sourceMd);
803
- if (parsed === null) return {
804
- ok: false,
805
- message: "技能「" + source + "」没有可读取的正文。"
806
- };
807
- const sourceProbe = await library.listSupportFiles(source);
808
- if (!isPresent(sourceProbe)) return {
809
- ok: false,
810
- message: "支撑文件列表不可读;拒绝在不确定的闭包上提取。"
811
- };
812
- const external = await readExternalSupport(parsed.body, join(library.root, source), dirname(library.root), []);
813
- if (!external.ok) return {
814
- ok: false,
815
- message: external.message
816
- };
817
- const plan = planExtract({
818
- body: parsed.body,
819
- sourceName: source,
820
- targetName: target,
821
- targetExists: false,
822
- outcome: "owner-gap",
823
- owner: {
824
- mode: "owner-gap",
825
- neededOwner: target,
826
- triggerCovers: true,
827
- outcomeCovers: false,
828
- reason: "target missing; no auto create"
829
- },
830
- requests,
831
- sourceFiles: sourceProbe.value,
832
- targetFiles: [],
833
- external: external.files
834
- });
835
- if (!plan.ok) return {
836
- ok: false,
837
- message: plan.message + candidateHint
838
- };
839
- return {
840
- ok: true,
841
- plan: plan.plan,
842
- candidates: lookup.candidates
843
- };
844
- }
845
- if (targetMd.length > DEFAULT_SKILL_LIMITS.maxSkillContentChars) return {
846
- ok: false,
847
- message: "目标技能「" + target + "」已超过 " + DEFAULT_SKILL_LIMITS.maxSkillContentChars + " 字符,拒绝继续提取。"
848
- };
849
- const candidate = findOwnerCandidate(lookup, target);
850
- if (candidate === void 0) return {
851
- ok: false,
852
- message: "目标「" + target + "」不是可用的 owner candidate(描述为空或已排除);owner-gap,不自动 create。" + candidateHint
853
- };
854
- if (!candidate.managed) return {
855
- ok: false,
856
- message: "目标「" + target + "」不是家族 managed 技能;拒绝把可复用部分写进不受管目录。"
857
- };
858
- if (input.ownerCovers !== true) {
859
- const parsed = parseFrontmatter(sourceMd);
860
- if (parsed === null) return {
861
- ok: false,
862
- message: "技能「" + source + "」没有可读取的正文。"
863
- };
864
- const sourceProbe = await library.listSupportFiles(source);
865
- if (!isPresent(sourceProbe)) return {
866
- ok: false,
867
- message: "支撑文件列表不可读;拒绝在不确定的闭包上提取。"
868
- };
869
- const external = await readExternalSupport(parsed.body, join(library.root, source), dirname(library.root), []);
870
- if (!external.ok) return {
871
- ok: false,
872
- message: external.message
873
- };
874
- const plan = planExtract({
875
- body: parsed.body,
876
- sourceName: source,
877
- targetName: target,
878
- targetExists: true,
879
- outcome: "owner-gap",
880
- owner: {
881
- mode: "owner-gap",
882
- neededOwner: target,
883
- triggerCovers: false,
884
- outcomeCovers: false,
885
- reason: "agent judged the target does not cover this part"
886
- },
887
- requests,
888
- sourceFiles: sourceProbe.value,
889
- targetFiles: [],
890
- external: external.files
891
- });
892
- if (!plan.ok) return {
893
- ok: false,
894
- message: plan.message + candidateHint
895
- };
896
- return {
897
- ok: true,
898
- plan: plan.plan,
899
- candidates: lookup.candidates
900
- };
901
- }
902
- const overlaps = nearDuplicateSummaries({
903
- candidate: {
904
- name: target,
905
- description: candidate.description
906
- },
907
- existing: summaries.filter((summary) => summary.name !== source && summary.name !== target)
908
- });
909
- const overlapWarnings = overlaps.length === 0 ? [] : ["目标「" + target + "」描述与邻技能重叠:" + overlaps.map((match) => match.name + " (" + match.score.toFixed(2) + ")").join("、") + ";请确认 owner 覆盖,提取仍可继续。"];
910
- if (candidate.protectionUnknown || candidate.protectedBy !== null) return {
911
- ok: false,
912
- message: "目标「" + target + "」受保护(" + (candidate.protectedBy ?? "未知") + "),拒绝提取。"
913
- };
914
- const parsed = parseFrontmatter(sourceMd);
915
- if (parsed === null) return {
916
- ok: false,
917
- message: "技能「" + source + "」没有可读取的正文。"
918
- };
919
- const sourceProbe = await library.listSupportFiles(source);
920
- const targetProbe = await library.listSupportFiles(target);
921
- if (!isPresent(sourceProbe) || !isPresent(targetProbe)) return {
922
- ok: false,
923
- message: "支撑文件列表不可读;拒绝在不确定的闭包上提取。"
924
- };
925
- const external = await readExternalSupport(parsed.body, join(library.root, source), dirname(library.root), targetProbe.value);
926
- if (!external.ok) return {
927
- ok: false,
928
- message: external.message
929
- };
930
- if (input.outcome !== void 0 && input.outcome !== "extract" && input.outcome !== "mixed") return {
931
- ok: false,
932
- message: "outcome 只能是 extract 或 mixed;owner-gap 由缺失 target 的路径自动决定。"
933
- };
934
- const outcome = input.outcome ?? "extract";
935
- const plan = planExtract({
936
- body: parsed.body,
937
- sourceName: source,
938
- targetName: target,
939
- targetExists: true,
940
- outcome,
941
- owner: {
942
- mode: "covered",
943
- name: target,
944
- triggerCovers: true,
945
- outcomeCovers: true,
946
- reason: "explicit target"
947
- },
948
- requests,
949
- sourceFiles: sourceProbe.value,
950
- targetFiles: targetProbe.value,
951
- external: external.files,
952
- anchors: {
953
- sourceMdSha256: contentHash(sourceMd),
954
- targetMdSha256: contentHash(targetMd)
955
- }
956
- });
957
- if (!plan.ok) return {
958
- ok: false,
959
- message: plan.message
960
- };
961
- const projectedChars = targetMd.length + plan.plan.parts.reduce((sum, part) => sum + part.movedText.length + 2, 0);
962
- if (projectedChars > DEFAULT_SKILL_LIMITS.maxSkillContentChars) return {
963
- ok: false,
964
- message: "目标「" + target + "」投影后约 " + projectedChars + " 字符,超过 " + DEFAULT_SKILL_LIMITS.maxSkillContentChars + " 上限;拒绝提取。"
965
- };
966
- return {
967
- ok: true,
968
- plan: plan.plan,
969
- candidates: lookup.candidates,
970
- ...overlapWarnings.length === 0 ? {} : { warnings: overlapWarnings }
971
- };
972
- }
973
- //#endregion
974
- //#region lib/types/extract-prompt.js
975
- /**
976
- * The frozen semantic prompt for skill extraction. One constant, consumed by
977
- * explicit extract agents and tests; it is deliberately not part of the review
978
- * prompt bundle, and no review path injects it.
979
- */
980
- const EXTRACT_PROMPT_VERSION = "v1";
981
- const EXTRACT_PROMPT_V1 = `Inspect the source skill, its linked support files, and the candidate owners
982
- in the library. A part of the skill (one or more sections) is a separate
983
- capability when it has its own trigger and outcome, can be used without the
984
- parent context, and leaves the parent coherent. If it is separate and a
985
- class-level owner covers it, extract that part. If no owner covers it, report
986
- the owner gap and name the class-level owner that would be needed. If it mixes
987
- a reusable capability with parent-specific facts, return mixed and name only
988
- the reusable part. Otherwise keep it. Keep, extract, mixed, and owner-gap are
989
- all valid outcomes; no split is required.`;
990
- const EXTRACT_PROMPT_HASH = createHash("sha256").update(EXTRACT_PROMPT_V1, "utf8").digest("hex");
991
- //#endregion
992
- //#region lib/types/proposal-view.js
993
- /**
994
- * Project a pure ExtractPlan into the proposal record every read-only surface consumes.
995
- *
996
- * This is a projection, not a second evaluator: it keeps the plan's owner decision,
997
- * support closure and warnings. It never writes and never invents coverage.
998
- * @param plan - plan produced by planExtract.
999
- * @param provenance - run id and timestamp for the proposing pass.
1000
- * @returns a proposal with status proposed.
1001
- */
1002
- function proposalFromPlan(plan, provenance) {
1003
- return {
1004
- version: 1,
1005
- id: "extract-" + provenance.runId + "-" + plan.source,
1006
- source: plan.source,
1007
- outcome: plan.outcome,
1008
- parts: plan.parts.map((part) => ({
1009
- heading: part.heading,
1010
- anchor: part.anchor,
1011
- reason: part.sourceText.slice(0, 160)
1012
- })),
1013
- owner: plan.owner,
1014
- support: plan.support,
1015
- residual: plan.residual,
1016
- warnings: plan.warnings,
1017
- provenance: {
1018
- promptVersion: "v1",
1019
- promptHash: EXTRACT_PROMPT_HASH,
1020
- runId: provenance.runId,
1021
- at: provenance.at ?? Date.now()
1022
- },
1023
- status: "proposed"
1024
- };
1025
- }
1026
- //#endregion
1027
- //#region lib/types/proposal-report.js
1028
- /** Directory for the one proposal lane; reports are retention-swept with the other run reports. */
1029
- function proposalReportDir() {
1030
- return join(evolutionHome(), "reports");
1031
- }
1032
- /** Stable report filename for one proposal; the id may carry path separators. */
1033
- function proposalReportName(proposal) {
1034
- return "extract-proposal-" + encodeURIComponent(proposal.id) + ".json";
1035
- }
1036
- /**
1037
- * Persist one proposal as a report. Best-effort: a failed write never blocks the extract.
1038
- * @param io - evolution IO seam.
1039
- * @param proposal - proposal to persist.
1040
- * @param dir - reports directory (tests pass a temp dir).
1041
- * @returns the written path.
1042
- */
1043
- async function writeProposalReport(io, proposal, dir = proposalReportDir()) {
1044
- const path = join(dir, proposalReportName(proposal));
1045
- await io.writeText(path, JSON.stringify(proposal));
1046
- return path;
1047
- }
1048
- function isProposal(value) {
1049
- if (value === null || typeof value !== "object") return false;
1050
- const candidate = value;
1051
- return candidate.version === 1 && typeof candidate.id === "string" && typeof candidate.source === "string" && (candidate.outcome === "keep" || candidate.outcome === "extract" || candidate.outcome === "mixed" || candidate.outcome === "owner-gap");
1052
- }
1053
- /**
1054
- * Read the newest proposals. Missing/unreadable reports are skipped, never guessed.
1055
- * @param io - evolution IO seam.
1056
- * @param dir - reports directory.
1057
- * @param limit - newest rows to return.
1058
- * @returns valid proposals, newest filename first.
1059
- */
1060
- async function readProposalReport(io, id, dir = proposalReportDir()) {
1061
- const raw = await probeText(io, join(dir, proposalReportName({ id })));
1062
- if (!isPresent(raw)) return null;
1063
- try {
1064
- const parsed = JSON.parse(raw.value);
1065
- return isProposal(parsed) ? parsed : null;
1066
- } catch {
1067
- return null;
1068
- }
1069
- }
1070
- async function readProposalReports(io, dir = proposalReportDir(), limit = 10) {
1071
- const listed = await probeList(io, dir);
1072
- if (isUnknown(listed) || !isPresent(listed)) return [];
1073
- const names = listed.value.filter((name) => name.startsWith("extract-proposal-") && name.endsWith(".json"));
1074
- names.sort((a, b) => b.localeCompare(a));
1075
- const proposals = [];
1076
- for (const name of names.slice(0, limit)) {
1077
- const raw = await probeText(io, join(dir, name));
1078
- if (!isPresent(raw)) continue;
1079
- let parsed;
1080
- try {
1081
- parsed = JSON.parse(raw.value);
1082
- } catch {
1083
- continue;
1084
- }
1085
- if (isProposal(parsed)) proposals.push(parsed);
1086
- }
1087
- return proposals;
1088
- }
1089
- //#endregion
1090
316
  //#region lib/types/health-baseline.js
1091
317
  function buildHealthBaseline(skills) {
1092
318
  const values = {};
@@ -3230,6 +2456,11 @@ const PLATFORM_SERVICE_PROBES = Object.freeze([
3230
2456
  feature: "the /skill-domain confirmation command surface",
3231
2457
  side: "host"
3232
2458
  },
2459
+ {
2460
+ service: "connection",
2461
+ feature: "the platform exact-route carrier for family host routes",
2462
+ side: "host"
2463
+ },
3233
2464
  {
3234
2465
  service: "configEditor",
3235
2466
  feature: "the params view inherited-vs-override column",
@@ -3355,6 +2586,11 @@ const PLATFORM_SERVICE_PROBES = Object.freeze([
3355
2586
  feature: "the storage-domain state provider",
3356
2587
  side: "host"
3357
2588
  },
2589
+ {
2590
+ service: "subagents",
2591
+ feature: "the review/curator subagent execution kernel",
2592
+ side: "host"
2593
+ },
3358
2594
  {
3359
2595
  service: "systemPrompt",
3360
2596
  feature: "the protected-skills prompt variable",
@@ -3365,6 +2601,11 @@ const PLATFORM_SERVICE_PROBES = Object.freeze([
3365
2601
  feature: "tool registration and the guard seam",
3366
2602
  side: "host"
3367
2603
  },
2604
+ {
2605
+ service: "userQuestions",
2606
+ feature: "the owner confirmation prompt behind skill writes",
2607
+ side: "host"
2608
+ },
3368
2609
  {
3369
2610
  service: "workingDirectory",
3370
2611
  feature: "the cwd used for skill snapshots and per-view policy files",
@@ -5536,7 +4777,7 @@ function paramSettingsId(owner) {
5536
4777
  * @returns the keys present in that row's user layer.
5537
4778
  */
5538
4779
  function userSetKeys(ctx, rowId) {
5539
- const entry = ctx.get("settings")?.describe?.({ redactSecrets: false }).find((item) => item.ns === rowId);
4780
+ const entry = settingsPort(ctx)?.describe?.({ redactSecrets: false }).find((item) => item.ns === rowId);
5540
4781
  return new Set(Object.keys(entry?.user ?? {}));
5541
4782
  }
5542
4783
  /** ONE key's effective value, in the design's precedence (G1 §8.4-A): the user layer (whose value
@@ -5894,10 +5135,10 @@ function scopedProbeReport() {
5894
5135
  * @returns true when at least one family model tool is visible to that session.
5895
5136
  */
5896
5137
  function sessionSeesFamilyTools(ctx, sessionId) {
5897
- const probe = ctx;
5898
- const tools = probe.get("tools");
5138
+ const platform = ctx.get("evolutionPlatform");
5139
+ const tools = platform?.ports.tools ?? toolsPort(ctx);
5899
5140
  if (tools === void 0) return false;
5900
- const agent = probe.get("agents")?.get(sessionId);
5141
+ const agent = platform?.ports.agents?.get(sessionId);
5901
5142
  const scope = agent?.ctx === void 0 ? void 0 : scopeOf(agent.ctx);
5902
5143
  return FAMILY_SESSION_TOOL_NAMES.some((name) => tools.get(name, scope) !== void 0);
5903
5144
  }
@@ -5964,12 +5205,12 @@ const DIAGNOSTICS_RUNTIME_KEYS = [
5964
5205
  //#region lib/types/platform-line.generated.js
5965
5206
  /** The frozen platform line this release targets (peers/engines/anchors derived from version+floor). */
5966
5207
  const PLATFORM_LINE = {
5967
- version: "0.2.2-rc.1",
5968
- floor: "0.2.2-rc.0",
5208
+ version: "0.2.2-rc.3",
5209
+ floor: "0.2.2-rc.3",
5969
5210
  previousAnchor: "0.2.1-rc.2",
5970
- peersRange: "^0.2.2-rc.0",
5971
- enginesRange: ">=0.2.2-rc.0 <0.2.3-0",
5972
- upstreamRef: "dsh-v0.2.2-rc.1"
5211
+ peersRange: "^0.2.2-rc.3",
5212
+ enginesRange: ">=0.2.2-rc.3 <0.2.3-0",
5213
+ upstreamRef: "dsh-v0.2.2-rc.3"
5973
5214
  };
5974
5215
  //#endregion
5975
5216
  //#region lib/types/session-fold.js
@@ -5982,4 +5223,4 @@ function classifySessionEvent(event) {
5982
5223
  return MODEL_EVENT_TYPES.has(type) ? "model" : "unknown";
5983
5224
  }
5984
5225
  //#endregion
5985
- export { AUTHORING_DESCRIPTION_BAR, AUTHORING_SPLIT_LINE_CHARS, AuthorityBusyError, AuthorityOrderError, AuthorityReentryError, CITATION_SUPPORT_DIRS, 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_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_LEASE_TTL_MS, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_PROBE_TIMEOUT_MS, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_REVIEW_MEMORY_INTERVAL, 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, HOOK_LINE_RE, HOST_LOCALES, HOST_ROUTES, HomeAuthority, HomeFence, HomeFenceError, INJECT_COMBINED_REVIEW_PROMPT, INJECT_COMPLETION_SKILL_REVIEW_PROMPT, INJECT_MEMORY_REVIEW_PROMPT, INJECT_SKILL_REVIEW_PROMPT, INSTANCE_KEYS, KEEP_LINE_RE, LONG_RUNS, LOW_QUALITY_THRESHOLD, LeaseStore, MAINTAINER_PRESET_ID, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_REQUEST_BODY_BYTES, 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, MODEL_SESSION_EVENT_TYPES, MUTATIONS_FILE_VERSION, MemoryStore, MutationAuthority, NAMESPACE_MIGRATIONS, NATIVE_CALL_EVENT, NATIVE_RESULT_EVENT, PARAM_ALIASES, PARAM_EXPOSURE, PARAM_GROUP_LABELS, PARAM_NAMESPACES, PATTERN_OVERLAP, 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, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, REVIEWER_PRESET_ID, RUNS_SCHEMA_VERSION, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, SKILL_NAME_RE, SKILL_REVIEW_PROMPT, STORE_LEDGER, SUMMARY_DUPLICATE_HINT_THRESHOLD, SUPPORT_DIRS, SUPPORT_SPRAWL_FILES, SUPPRESSED_FILE_VERSION, THREAT_EXEMPTION_HINT, TOKEN_ASCII_WEIGHT, TOKEN_CJK_WEIGHT, ToolDispatchNormalizer, ToolDispatchPayloadError, TransactionNotInvokedError, UPSTREAM_LIMIT_CHARS_PER_TOKEN, absentHostServices, advanceReview, affinity, allowRowCollisions, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, applyNamespaceMigration, applyReferenceRewrite, asRecord, assertDispatchPayload, atomicWriteFiles, authorityFrom, authorityHolder, backupsReachability, bodyCost, buildCuratorRunReport, buildExtractPlanFromLibrary, buildHealthBaseline, buildLearnPrompt, bumpPatch, bumpSupportRead, bumpUse, bumpView, callingScope, claimInstance, clampOnce, clampedNumber, classifyNamespaceMigration, classifySessionEvent, clearReviewChannel, collectReadSkillNames, collectReadSupportFiles, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, createSubagentChannel, currentReviewContext, daysSinceIso, declaredReportStamp, describeReferenceRewrite, dispatchKeyOf, dispatchPathOf, dispatchStepOf, displayBodyOf, duplicateHeadings, emptyRecord, errorText, errorTextIn, evaluateThreat, eventsFile, evidenceKindIndex, evolutionActivityProjection, evolutionEventPayloadIssue, evolutionEvidenceProjection, evolutionHome, evolutionIoAdapter, evolutionProjectionHistoryProjection, evolutionReadsProjection, evolutionRoot, evolutionSignalsProjection, externalRefs, findDriftSignal, findOwnerCandidate, foldCuratorFields, foldToolDispatches, foldTurnEvent, foldTurnEvents, fuzzyPatch, getRecord, h2Sections, historyReachability, hostSurface, identity, idleDays, initialTurnFold, instanceClaimKey, instanceHolder, isAbsent, isBookkeepingFrame, isCommittedWarning, isDeprecatedParamId, isFileShapedPath, isMissingPath, isPresent, isProcessAlive, isProjectableSession, isRecord, isReviewChannelSession, isSkillReadToolName, isSkillToolName, isUnknown, json, latestActivityAt, leaseAsTreeLock, leaseFile, lifecycleCandidate, listEventArchives, liveBool, liveNumber, loadMutations, loadSuppressedNames, loadUsage, makeSerialQueue, markAgentCreated, markReviewChannel, memoryRoot, methodNotAllowed, missingSupportPointers, mutateUsage, mutationLockFrom, mutationsFile, narrowNameMatches, nearDuplicateSummaries, newRunRegistry, nodeEvolutionIo, normalizeUsageRecord, observeEvent, overlongLines, ownerCandidatesFromSummaries, ownerDecisionText, paramRowId, paramSettingsId, parseCuratorNominations, parseEvolutionEvents, payloadText, persistedWriteSites, pickWithPolicy, planExtract, planNamespaceMigration, planReferenceRewrite, planRehoming, policyStageLimits, probeAbsent, probeChannelState, probeList, probeMtime, probePresent, probeReason, probeText, probeUnknown, projectExtractBodies, projectionText, proposalFromPlan, proposalReportDir, proposalReportName, protectedSkillNamesOf, readDispatchSignal, readEvolutionEvents, readEvolutionTimeline, readExternalSupport, readJsonObject, readNumberParam, readParam, readProposalReport, readProposalReports, readingStats, recordMutation, redactSecrets, referencedBlobs, registerHostRoutes, releaseInstance, renameWithRetry, renderCuratorReportMarkdown, reportTime, reportsReachability, reportsSweepLockTarget, resolveCitations, resolveParamId, retainEventArchives, retirementReport, reviewPrompt, runWriteGates, runsFile, saveSuppressedNames, saveUsage, scanBodyHooks, scanContentThreats, scanMemoryThreats, scanThreats, scopeOfNearestManifest, scopedPackageName, scopedProbeReport, selectSections, sessionAudited, sessionEvidenceIndex, sessionLastEventTime, sessionReadNames, sessionSeesFamilyTools, sessionTurnSignals, skillReadNameOf, skillWriteGateContext, supportFileReadFromPath, supportFileReadOf, supportRefs, suppressedFile, sweepReports, sweepReviewChannelSessions, tokenLineFor, transactIo, trimPatternBoundaries, unhookedSupportPointers, unwrapLive, updateSuppressedNames, usageFile, usageObserved, userSetKeys, verifyPromptBundle, vocabulary, withReviewContext, withTreeWrite, writeDurableTmp, writeProposalReport };
5226
+ export { AUTHORING_DESCRIPTION_BAR, AUTHORING_SPLIT_LINE_CHARS, AuthorityBusyError, AuthorityOrderError, AuthorityReentryError, CITATION_SUPPORT_DIRS, 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_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_LEASE_TTL_MS, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_PROBE_TIMEOUT_MS, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_REVIEW_MEMORY_INTERVAL, 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, EvolutionGateSet, FAMILY_SESSION_TOOL_NAMES, FORBIDDEN_CONTROL_KEYS, FUZZY_MAX_PATTERN_CHARS, FUZZY_MAX_WORK, HOOK_LINE_RE, HOST_LOCALES, HOST_ROUTES, HomeAuthority, HomeFence, HomeFenceError, INJECT_COMBINED_REVIEW_PROMPT, INJECT_COMPLETION_SKILL_REVIEW_PROMPT, INJECT_MEMORY_REVIEW_PROMPT, INJECT_SKILL_REVIEW_PROMPT, INSTANCE_KEYS, KEEP_LINE_RE, LONG_RUNS, LOW_QUALITY_THRESHOLD, LeaseStore, MAINTAINER_PRESET_ID, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_REQUEST_BODY_BYTES, 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, MODEL_SESSION_EVENT_TYPES, MUTATIONS_FILE_VERSION, MemoryStore, MutationAuthority, NAMESPACE_MIGRATIONS, NATIVE_CALL_EVENT, NATIVE_RESULT_EVENT, PARAM_ALIASES, PARAM_EXPOSURE, PARAM_GROUP_LABELS, PARAM_NAMESPACES, PATTERN_OVERLAP, 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, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, REVIEWER_PRESET_ID, RUNS_SCHEMA_VERSION, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, SKILL_NAME_RE, SKILL_REVIEW_PROMPT, STORE_LEDGER, SUMMARY_DUPLICATE_HINT_THRESHOLD, SUPPORT_DIRS, SUPPORT_SPRAWL_FILES, SUPPRESSED_FILE_VERSION, THREAT_EXEMPTION_HINT, TOKEN_ASCII_WEIGHT, TOKEN_CJK_WEIGHT, ToolDispatchNormalizer, ToolDispatchPayloadError, TransactionNotInvokedError, UPSTREAM_LIMIT_CHARS_PER_TOKEN, abortLink, absentHostServices, advanceReview, affinity, allowRowCollisions, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, applyNamespaceMigration, applyReferenceRewrite, asRecord, assertDispatchPayload, atomicWriteFiles, authorityFrom, authorityHolder, backupsReachability, bodyCost, buildCuratorRunReport, buildHealthBaseline, buildLearnPrompt, bumpPatch, bumpSupportRead, bumpUse, bumpView, callingScope, claimInstance, clampOnce, clampedNumber, classifyNamespaceMigration, classifySessionEvent, clearReviewChannel, collectReadSkillNames, collectReadSupportFiles, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, createSubagentKernel as createSubagentChannel, createSubagentKernel, createSubagentRun, currentReviewContext, daysSinceIso, declaredReportStamp, describeReferenceRewrite, dispatchKeyOf, dispatchPathOf, dispatchStepOf, displayBodyOf, duplicateHeadings, emptyRecord, errorText, errorTextIn, evaluateThreat, eventsFile, evidenceKindIndex, evolutionActivityProjection, evolutionEventPayloadIssue, evolutionEvidenceProjection, evolutionHome, evolutionIoAdapter, evolutionProjectionHistoryProjection, evolutionReadsProjection, evolutionRoot, evolutionSignalsProjection, externalRefs, findDriftSignal, findOwnerCandidate, foldCuratorFields, foldToolDispatches, foldTurnEvent, foldTurnEvents, fuzzyPatch, getRecord, h2Sections, historyReachability, hostSurface, identity, idleDays, initialTurnFold, instanceClaimKey, instanceHolder, isAbsent, isBookkeepingFrame, isCommittedWarning, isDeprecatedParamId, isFileShapedPath, isMissingPath, isPresent, isProcessAlive, isProjectableSession, isRecord, isReviewChannelSession, isSkillReadToolName, isSkillToolName, isUnknown, json, latestActivityAt, leaseAsTreeLock, leaseFile, lifecycleCandidate, listEventArchives, liveBool, liveNumber, loadMutations, loadSuppressedNames, loadUsage, makeSerialQueue, markAgentCreated, markReviewChannel, memoryRoot, methodNotAllowed, missingSupportPointers, mutateUsage, mutationLockFrom, mutationsFile, narrowNameMatches, nearDuplicateSummaries, newRunRegistry, nodeEvolutionIo, normalizeUsageRecord, observeEvent, overlongLines, ownerCandidatesFromSummaries, paramRowId, paramSettingsId, parseCuratorNominations, parseEvolutionEvents, payloadText, persistedWriteSites, pickWithPolicy, planNamespaceMigration, planReferenceRewrite, planRehoming, policyStageLimits, probeAbsent, probeChannelState, probeList, probeMtime, probePresent, probeReason, probeText, probeUnknown, projectionText, proposalFromPlan, proposalReportDir, proposalReportName, protectedSkillNamesOf, readDispatchSignal, readEvolutionEvents, readEvolutionTimeline, readExternalSupport, readJsonObject, readNumberParam, readParam, readProposalReport, readProposalReports, readingStats, recordMutation, redactSecrets, referencedBlobs, registerHostRoutes, releaseInstance, renameWithRetry, renderCuratorReportMarkdown, reportTime, reportsReachability, reportsSweepLockTarget, resolveCitations, resolveParamId, retainEventArchives, retirementReport, reviewPrompt, runWriteGates, runsFile, saveSuppressedNames, saveUsage, scanBodyHooks, scanContentThreats, scanMemoryThreats, scanThreats, scopeOfNearestManifest, scopedPackageName, scopedProbeReport, selectSections, sessionAudited, sessionEvidenceIndex, sessionLastEventTime, sessionReadNames, sessionSeesFamilyTools, sessionTurnSignals, skillReadNameOf, skillWriteGateContext, supportFileReadFromPath, supportFileReadOf, supportRefs, suppressedFile, sweepReports, sweepReviewChannelSessions, textOfValue, tokenLineFor, transactIo, trimPatternBoundaries, unhookedSupportPointers, unwrapLive, updateSuppressedNames, usageFile, usageObserved, userSetKeys, verifyPromptBundle, vocabulary, waitForSubagentEnd, withReviewContext, withTreeWrite, writeDurableTmp, writeProposalReport };