@lmzhen/dsh-evolution-core 0.54.0 → 0.55.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/lib/{extract-plan-D4zO7dmD.js → extract-plan-BxDhKSki.js} +2 -1
  2. package/lib/extract.js +7 -7
  3. package/lib/index.js +830 -546
  4. package/lib/{limits-TD4Pv92Q.js → limits-CO4JGSJL.js} +20 -6
  5. package/lib/{skill-history-CZp8vhyL.js → mutation-storage-adapter-7R3ra0wj.js} +4 -647
  6. package/lib/mutations-mvTnWkua.js +592 -0
  7. package/lib/policy.js +9 -3
  8. package/lib/{quality-BLc6UQQb.js → quality-CREp6s1G.js} +1 -1
  9. package/lib/{skill-health-BIpiPvw6.js → review-context-70XYS11J.js} +124 -183
  10. package/lib/runtime/plugin.js +1 -1
  11. package/lib/{session-projection-ByNxQi9O.js → session-projection-CbIKvDfJ.js} +3 -2
  12. package/lib/skill-history-YX84wO20.js +647 -0
  13. package/lib/skills.js +16 -11
  14. package/lib/text-metrics-CyJhxWBs.js +132 -0
  15. package/lib/types/constants.d.ts +19 -5
  16. package/lib/types/constants.js +19 -5
  17. package/lib/types/drift-signals.d.ts +1 -4
  18. package/lib/types/drift-signals.js +14 -23
  19. package/lib/types/extract-request.js +3 -2
  20. package/lib/types/frontmatter.js +12 -8
  21. package/lib/types/index.d.ts +2 -1
  22. package/lib/types/index.js +2 -1
  23. package/lib/types/memory-store.d.ts +32 -6
  24. package/lib/types/memory-store.js +86 -30
  25. package/lib/types/mutation-unit.js +2 -1
  26. package/lib/types/params.js +6 -3
  27. package/lib/types/policy.d.ts +5 -0
  28. package/lib/types/policy.js +8 -2
  29. package/lib/types/prompts.d.ts +1 -1
  30. package/lib/types/prompts.js +1 -1
  31. package/lib/types/signals.js +3 -2
  32. package/lib/types/skill-health.d.ts +8 -5
  33. package/lib/types/skill-health.js +27 -28
  34. package/lib/types/skill-history.d.ts +2 -2
  35. package/lib/types/skill-history.js +9 -8
  36. package/lib/types/skill-lint.d.ts +1 -1
  37. package/lib/types/skill-lint.js +4 -4
  38. package/lib/types/skill-stats.d.ts +3 -1
  39. package/lib/types/skill-stats.js +7 -3
  40. package/lib/types/skill-store.js +2 -1
  41. package/lib/types/text-budgets.d.ts +185 -0
  42. package/lib/types/text-budgets.js +70 -0
  43. package/lib/types/text-metrics.d.ts +88 -0
  44. package/lib/types/text-metrics.js +131 -0
  45. package/lib/{usage-B1qveKi9.js → usage-DrczLTP4.js} +2 -515
  46. package/lib/write.js +3 -2
  47. package/package.json +1 -1
  48. package/lib/mutations-DQXddSJd.js +0 -75
  49. package/lib/types/cost.d.ts +0 -63
  50. package/lib/types/cost.js +0 -67
@@ -87,6 +87,15 @@ const DEFAULT_SKILL_VERSION_KEEP = 20;
87
87
  * standard — deriving the band from the ceiling is exactly what let a 40k
88
88
  * ceiling hide a 99k body without a single signal saying "split me" (V3). */
89
89
  const AUTHORING_SPLIT_LINE_CHARS = 2e4;
90
+ /** Display-only truncation caps. They are answers about what a reader gets, never
91
+ * write limits; every one is measured in graphemes and declared in TEXT_BUDGETS.
92
+ * Keeping them here is what lets the route, the activity store, the memory tool
93
+ * and the merge panel stop carrying private copies of the same number. */
94
+ const TEXT_DIFF_MAX_GRAPHEMES = 4e3;
95
+ const REVIEW_TEXT_PREVIEW_GRAPHEMES = 2e3;
96
+ const MEMORY_ENTRY_PREVIEW_GRAPHEMES = 200;
97
+ const VERSION_BODY_PREVIEW_GRAPHEMES = 2e4;
98
+ const MERGE_BODY_PREVIEW_BYTES = 64 * 1024;
90
99
  /** Upstream's conversion basis for CHARACTER LIMITS: 2.75 chars/token, labelled
91
100
  * model-independent in the config template (\`cli-config.yaml.example:538\`), and the
92
101
  * basis behind every quoted token figure there — memory 2200 chars ≈ 800 tokens,
@@ -94,11 +103,13 @@ const AUTHORING_SPLIT_LINE_CHARS = 2e4;
94
103
  * Limits are deliberately conservative, so this is the basis a BORROWED LIMIT must
95
104
  * be converted with. */
96
105
  const UPSTREAM_LIMIT_CHARS_PER_TOKEN = 2.75;
97
- /** The platform's own estimate basis: \`CHARS_PER_TOKEN = 4\` in
98
- * \`@deepseek-ai/dsh-token-meter/estimate.ts\` (its comment reads "used until exact
99
- * tokenization is needed"), matching upstream's ESTIMATE-side heuristic — "~4
100
- * chars/token is the usual English heuristic" (\`agent/prompt_builder.py:1179\`).
101
- * Estimates use this; limits use the constant above. */
106
+ /** Default soft body budget in tokens: the upstream 20k-character authoring line
107
+ * converted on the documented 2.75 chars/token basis. Judged as a fixed token
108
+ * budget, not as a per-body character line (see text-metrics). */
109
+ const DEFAULT_SOFT_BODY_TOKENS = Math.round(AUTHORING_SPLIT_LINE_CHARS / UPSTREAM_LIMIT_CHARS_PER_TOKEN);
110
+ /** Hard storage cap for one skill file, in bytes. The platform token meter's
111
+ * `CHARS_PER_TOKEN = 4` is a session-pressure estimate only; plugin gates use
112
+ * `text-metrics` (see docs/text-budgets.md), not this byte cap, as a token meter. */
102
113
  const MAX_SKILL_FILE_BYTES = 1048576;
103
114
  const DEFAULT_REVIEW_MEMORY_INTERVAL = 10;
104
115
  const DEFAULT_REVIEW_SKILL_INTERVAL = 10;
@@ -126,6 +137,9 @@ const DEFAULT_ARCHIVE_AFTER_DAYS = 90;
126
137
  const SUPPORT_SPRAWL_FILES = 60;
127
138
  const DEFAULT_MEMORY_CHAR_LIMIT = 2200;
128
139
  const DEFAULT_USER_CHAR_LIMIT = 1375;
140
+ /** Token budgets derived from the legacy character limits on the 2.75 basis. */
141
+ const DEFAULT_MEMORY_TOKENS = Math.round(DEFAULT_MEMORY_CHAR_LIMIT / UPSTREAM_LIMIT_CHARS_PER_TOKEN);
142
+ const DEFAULT_USER_TOKENS = Math.round(DEFAULT_USER_CHAR_LIMIT / UPSTREAM_LIMIT_CHARS_PER_TOKEN);
129
143
  /** Consolidation-failure backoff cap, shared by MemoryStore and memory-files' Config default. */
130
144
  const DEFAULT_CONSOLIDATION_FAILURES = 3;
131
145
  /** F-20 (v18): the authored-body budget and the hard ceiling are the same
@@ -274,4 +288,4 @@ const DEFAULT_SKILL_LIMITS = {
274
288
  versionKeep: 20
275
289
  };
276
290
  //#endregion
277
- export { DEFAULT_SUBSTANTIVE_MIN_USER_CHARS as A, MAX_TIMER_DELAY_MS as B, DEFAULT_SKILL_CONTENT_CHARS as C, DEFAULT_STALE_AFTER_DAYS as D, DEFAULT_SKILL_VERSION_KEEP as E, FORBIDDEN_CONTROL_KEYS as F, SKILL_NAME_RE as G, PROTECTED_BUILTIN_SKILLS as H, MAX_DESCRIPTION_LENGTH as I, UPSTREAM_LIMIT_CHARS_PER_TOKEN as J, SUPPORT_DIRS as K, MAX_SKILL_CONTENT_CHARS as L, DEFAULT_USER_CHAR_LIMIT as M, ENTRY_DELIMITER as N, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS as O, EVOLUTION_WRITE_TOOLS as P, MAX_SKILL_FILE_BYTES as R, DEFAULT_REVIEW_TIMEOUT_MS as S, DEFAULT_SKILL_REVIEW_TRIGGER as T, SKILLS_GUIDANCE_SECTION_ORDER as U, MEMORY_GUIDANCE_SECTION_ORDER as V, SKILL_ACTION_REQUIRED_FIELDS as W, DEFAULT_MEMORY_CHAR_LIMIT as _, DEFAULT_SUPPORT_FILE_CHAR_POLICY as a, DEFAULT_REVIEW_MEMORY_INTERVAL as b, AUTHORING_DESCRIPTION_BAR as c, DEFAULT_ARCHIVE_AFTER_DAYS as d, DEFAULT_CONSOLIDATION_FAILURES as f, DEFAULT_CURATOR_REVIEW_MAX_TOKENS as g, DEFAULT_CURATOR_MODEL as h, DEFAULT_SKILL_LIMITS as i, DEFAULT_THREAT_MAX_SCAN_CHARS as j, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS as k, AUTHORING_SPLIT_LINE_CHARS as l, DEFAULT_CURATOR_INTERVAL_HOURS as m, DEFAULT_CITATION_POLICY as n, POLICY_STAGE_DEFAULTS as o, DEFAULT_CURATOR_BOOT_GRACE_SECONDS as p, SUPPORT_SPRAWL_FILES as q, DEFAULT_REFERENCE_REWRITE_POLICY as r, policyStageLimits as s, DEFAULT_ARCHIVE_RETENTION_POLICY as t, CONTENT_SPLIT_HINT as u, DEFAULT_MIN_IDLE_HOURS as v, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS as w, DEFAULT_REVIEW_SKILL_INTERVAL as x, DEFAULT_PROBE_TIMEOUT_MS as y, MAX_SKILL_NAME_LENGTH as z };
291
+ export { SUPPORT_SPRAWL_FILES as $, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS as A, MAX_SKILL_CONTENT_CHARS as B, DEFAULT_REVIEW_TIMEOUT_MS as C, DEFAULT_SKILL_VERSION_KEEP as D, DEFAULT_SKILL_REVIEW_TRIGGER as E, DEFAULT_USER_TOKENS as F, MEMORY_GUIDANCE_SECTION_ORDER as G, MAX_SKILL_NAME_LENGTH as H, ENTRY_DELIMITER as I, REVIEW_TEXT_PREVIEW_GRAPHEMES as J, MERGE_BODY_PREVIEW_BYTES as K, EVOLUTION_WRITE_TOOLS as L, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS as M, DEFAULT_THREAT_MAX_SCAN_CHARS as N, DEFAULT_SOFT_BODY_TOKENS as O, DEFAULT_USER_CHAR_LIMIT as P, SUPPORT_DIRS as Q, FORBIDDEN_CONTROL_KEYS as R, DEFAULT_REVIEW_SKILL_INTERVAL as S, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS as T, MAX_TIMER_DELAY_MS as U, MAX_SKILL_FILE_BYTES as V, MEMORY_ENTRY_PREVIEW_GRAPHEMES as W, SKILL_ACTION_REQUIRED_FIELDS as X, SKILLS_GUIDANCE_SECTION_ORDER as Y, SKILL_NAME_RE as Z, DEFAULT_MEMORY_CHAR_LIMIT as _, DEFAULT_SUPPORT_FILE_CHAR_POLICY as a, DEFAULT_PROBE_TIMEOUT_MS as b, AUTHORING_DESCRIPTION_BAR as c, DEFAULT_ARCHIVE_AFTER_DAYS as d, TEXT_DIFF_MAX_GRAPHEMES as et, DEFAULT_CONSOLIDATION_FAILURES as f, DEFAULT_CURATOR_REVIEW_MAX_TOKENS as g, DEFAULT_CURATOR_MODEL as h, DEFAULT_SKILL_LIMITS as i, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS as j, DEFAULT_STALE_AFTER_DAYS as k, AUTHORING_SPLIT_LINE_CHARS as l, DEFAULT_CURATOR_INTERVAL_HOURS as m, DEFAULT_CITATION_POLICY as n, VERSION_BODY_PREVIEW_GRAPHEMES as nt, POLICY_STAGE_DEFAULTS as o, DEFAULT_CURATOR_BOOT_GRACE_SECONDS as p, PROTECTED_BUILTIN_SKILLS as q, DEFAULT_REFERENCE_REWRITE_POLICY as r, policyStageLimits as s, DEFAULT_ARCHIVE_RETENTION_POLICY as t, UPSTREAM_LIMIT_CHARS_PER_TOKEN as tt, CONTENT_SPLIT_HINT as u, DEFAULT_MEMORY_TOKENS as v, DEFAULT_SKILL_CONTENT_CHARS as w, DEFAULT_REVIEW_MEMORY_INTERVAL as x, DEFAULT_MIN_IDLE_HOURS as y, MAX_DESCRIPTION_LENGTH as z };