@lmzhen/dsh-evolution-core 0.40.1 → 0.42.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 (62) hide show
  1. package/lib/composition/index.js +2 -2
  2. package/lib/{composition-dy0gJWDd.js → composition-CVafrlEw.js} +2 -2
  3. package/lib/{ensure-B4fjEI0w.js → ensure-BjToTMMj.js} +2 -2
  4. package/lib/errors-BxzLTVbS.js +399 -0
  5. package/lib/guards-3f02mnf2.js +29 -0
  6. package/lib/http-routes.js +205 -1
  7. package/lib/index.js +3588 -15049
  8. package/lib/mutations-jUuOPaCn.js +718 -0
  9. package/lib/platform/index.js +2 -2
  10. package/lib/{platform-CFp373_0.js → platform-B06_h8t-.js} +4 -1
  11. package/lib/restrictor.js +1 -1
  12. package/lib/runtime/plugin.js +2 -2
  13. package/lib/{session-projection-CXUNPkq9.js → session-projection-EB7mUOlJ.js} +63 -63
  14. package/lib/skill-health-BLGZTIv8.js +3773 -0
  15. package/lib/skill-history-_Cssts5o.js +1912 -0
  16. package/lib/skills.js +4067 -0
  17. package/lib/subagent/index.js +1 -1
  18. package/lib/types/errors.d.ts +12 -0
  19. package/lib/types/errors.js +17 -0
  20. package/lib/types/generated/errors.localized.d.ts +320 -0
  21. package/lib/types/generated/errors.localized.js +318 -0
  22. package/lib/types/home-fence.d.ts +7 -0
  23. package/lib/types/home-fence.js +58 -3
  24. package/lib/types/index.d.ts +1 -18
  25. package/lib/types/index.js +1 -18
  26. package/lib/types/io.js +1 -1
  27. package/lib/types/mutation-authority.d.ts +14 -37
  28. package/lib/types/mutation-authority.js +16 -103
  29. package/lib/types/mutation-storage-adapter.js +9 -6
  30. package/lib/types/mutation-unit.d.ts +14 -0
  31. package/lib/types/mutation-unit.js +30 -10
  32. package/lib/types/opt-in.js +1 -1
  33. package/lib/types/platform/index.d.ts +8 -1
  34. package/lib/types/platform/index.js +3 -0
  35. package/lib/types/review-channel.js +3 -1
  36. package/lib/types/review-context.js +3 -1
  37. package/lib/types/run-registry.d.ts +2 -24
  38. package/lib/types/scope.js +1 -1
  39. package/lib/types/signals.d.ts +1 -1
  40. package/lib/types/skill-store.d.ts +7 -1
  41. package/lib/types/skill-store.js +43 -80
  42. package/lib/types/skills.d.ts +11 -0
  43. package/lib/types/skills.js +11 -0
  44. package/lib/types/subagent/types.d.ts +3 -3
  45. package/lib/types/tree-lock.js +4 -1
  46. package/lib/types/unit-claim.d.ts +8 -0
  47. package/lib/types/unit-claim.js +3 -0
  48. package/lib/types/unit-journal.d.ts +3 -1
  49. package/lib/types/unit-journal.js +12 -3
  50. package/lib/types/unit-storage.d.ts +1 -0
  51. package/lib/types/write-gates.d.ts +1 -1
  52. package/lib/types/write-gates.js +3 -1
  53. package/lib/types/write.d.ts +11 -0
  54. package/lib/types/write.js +11 -0
  55. package/lib/write.js +357 -0
  56. package/package.json +16 -4
  57. package/lib/errors-DUcEoTLR.js +0 -58
  58. package/lib/http-routes-_anZVlPf.js +0 -233
  59. package/lib/types/unit-backend.d.ts +0 -5
  60. package/lib/types/unit-backend.js +0 -55
  61. package/lib/types/unit-transaction.d.ts +0 -225
  62. package/lib/types/unit-transaction.js +0 -501
@@ -1,4 +1,4 @@
1
1
  import { t as presetsPort } from "../presets-C8vuCuNA.js";
2
- import { a as defineTool, c as modelRoute, i as createUserMessage, l as projectionPort, n as SessionId, o as EvolutionLlmError, r as createToolResultMessage, s as llmPort, t as BlockAssembler } from "../platform-CFp373_0.js";
2
+ import { a as createUserMessage, c as domainTable, d as EvolutionLlmError, f as llmPort, i as createToolResultMessage, l as escapeText, m as projectionPort, n as DomainError, o as defineDomain, p as modelRoute, r as SessionId, s as defineTool, t as BlockAssembler, u as scopeOf } from "../platform-B06_h8t-.js";
3
3
  import { n as toolsPort, t as registerEvolutionTool } from "../tools-DzcNFex2.js";
4
- export { BlockAssembler, EvolutionLlmError, SessionId, createToolResultMessage, createUserMessage, defineTool, llmPort, modelRoute, presetsPort, projectionPort, registerEvolutionTool, toolsPort };
4
+ export { BlockAssembler, DomainError, EvolutionLlmError, SessionId, createToolResultMessage, createUserMessage, defineDomain, defineTool, domainTable, escapeText, llmPort, modelRoute, presetsPort, projectionPort, registerEvolutionTool, scopeOf, toolsPort };
@@ -1,4 +1,7 @@
1
1
  import { defineTool } from "@deepseek-ai/dsh-tools";
2
+ import { scopeOf } from "@deepseek-ai/dsh-scope";
3
+ import { DomainError, defineDomain, domainTable } from "@deepseek-ai/dsh-storage-domain";
4
+ import { escapeText } from "@deepseek-ai/dsh-skill";
2
5
  import { BlockAssembler, createToolResultMessage, createUserMessage } from "@deepseek-ai/dsh-llm";
3
6
  import { SessionId } from "@deepseek-ai/dsh-session";
4
7
  //#region lib/types/platform/projections.js
@@ -112,4 +115,4 @@ function modelRoute(ctx, agent, session) {
112
115
  };
113
116
  }
114
117
  //#endregion
115
- export { defineTool as a, modelRoute as c, createUserMessage as i, projectionPort as l, SessionId as n, EvolutionLlmError as o, createToolResultMessage as r, llmPort as s, BlockAssembler as t };
118
+ export { createUserMessage as a, domainTable as c, EvolutionLlmError as d, llmPort as f, createToolResultMessage as i, escapeText as l, projectionPort as m, DomainError as n, defineDomain as o, modelRoute as p, SessionId as r, defineTool as s, BlockAssembler as t, scopeOf as u };
package/lib/restrictor.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as errorText } from "./errors-DUcEoTLR.js";
1
+ import { n as errorText } from "./errors-BxzLTVbS.js";
2
2
  import { t as presetsPort } from "./presets-C8vuCuNA.js";
3
3
  import { n as toolsPort } from "./tools-DzcNFex2.js";
4
4
  //#region lib/types/restrictor.js
@@ -1,6 +1,6 @@
1
- import { a as evolutionSignalsProjection, i as evolutionReadsProjection, n as evolutionEvidenceProjection, r as evolutionProjectionHistoryProjection, t as evolutionActivityProjection } from "../session-projection-CXUNPkq9.js";
1
+ import { a as evolutionSignalsProjection, i as evolutionReadsProjection, n as evolutionEvidenceProjection, r as evolutionProjectionHistoryProjection, t as evolutionActivityProjection } from "../session-projection-EB7mUOlJ.js";
2
2
  import { t as presetsPort } from "../presets-C8vuCuNA.js";
3
- import { c as modelRoute, l as projectionPort, o as EvolutionLlmError, s as llmPort } from "../platform-CFp373_0.js";
3
+ import { d as EvolutionLlmError, f as llmPort, m as projectionPort, p as modelRoute } from "../platform-B06_h8t-.js";
4
4
  import { n as toolsPort } from "../tools-DzcNFex2.js";
5
5
  import { Service } from "@deepseek-ai/cordis";
6
6
  //#region lib/types/runtime/llm.js
@@ -697,6 +697,68 @@ function countDispatches(events) {
697
697
  return foldToolDispatches(events).length;
698
698
  }
699
699
  //#endregion
700
+ //#region lib/types/evidence.js
701
+ /**
702
+ * Which session frames are EVIDENCE, and which are bookkeeping.
703
+ *
704
+ * The session's evidence index answers "does this seq carry content"; a bare range check used
705
+ * to accept any integer inside the authoring window. A boundary frame satisfies that while carrying
706
+ * nothing a claim can rest on: the `turn/start` seq is the frame a claim about that turn was
707
+ * most likely read out of, and citing it is indistinguishable from citing a real exchange. This
708
+ * module owns the ONE classification of a session frame by what it CARRIES, so the plan path can
709
+ * report an op whose whole citation list is bookkeeping (design
710
+ * `dsh-evolution-skill-history-design.md` §3D, phase 1: report only — no op is refused here).
711
+ *
712
+ * The classification is a DENY list of the pure bookends, not an allow list of content frames.
713
+ * The platform's own vocabulary (`KNOWN_SESSION_EVENT_TYPES`, 57 members at 0.1.5-rc.2) mixes
714
+ * content frames with state-change frames, and out-of-repo plugins append types the family cannot
715
+ * enumerate; an unknown frame is therefore treated as carrying content, because a report that
716
+ * fires on an unclassifiable frame is a false positive and phase 1 exists to measure how many TRUE
717
+ * ones there are. Tightening — a narrower definition, or an allow list built from the platform's
718
+ * vocabulary — changes this table and nothing else (`evidenceKindIndex` is the only reader).
719
+ * @module @lmzhen/dsh-evolution-core
720
+ */
721
+ /** The frame types that record a boundary and carry no content: the turn and step bookends. */
722
+ const BOOKKEEPING_FRAME_TYPES = new Set([
723
+ "turn/start",
724
+ "turn/end",
725
+ "step/start",
726
+ "step/end"
727
+ ]);
728
+ /**
729
+ * Whether one frame type records a boundary and carries no content.
730
+ *
731
+ * The classification table's SECOND reader: the live projection unit
732
+ * (`session-projection.ts`) folds the same answer per event, so the rule stays one table.
733
+ * @param type - a platform session-event type.
734
+ * @returns true for the turn/step bookends.
735
+ */
736
+ function isBookkeepingFrame(type) {
737
+ return BOOKKEEPING_FRAME_TYPES.has(type);
738
+ }
739
+ /**
740
+ * The seqs of the frames that carry content.
741
+ *
742
+ * @param events - the session's frames, oldest first (any iterable; nothing is retained).
743
+ * @returns the substantive seqs, or `undefined` when NO frame carried a usable seq. The two
744
+ * answers are different facts: an empty SET says "every sequenced frame is a boundary", while
745
+ * `undefined` says "this log cannot tell a boundary from a message" (a stub session in a test,
746
+ * a composition whose events carry no seq). A caller that cannot classify must stay silent
747
+ * rather than report every op — the same three-state posture as `sessionReadSkillNames`.
748
+ */
749
+ function evidenceKindIndex(events) {
750
+ const substantive = /* @__PURE__ */ new Set();
751
+ let sequenced = 0;
752
+ for (const event of events) {
753
+ const seq = event.seq;
754
+ if (typeof seq !== "number" || !Number.isInteger(seq)) continue;
755
+ sequenced += 1;
756
+ if (typeof event.type === "string" && BOOKKEEPING_FRAME_TYPES.has(event.type)) continue;
757
+ substantive.add(seq);
758
+ }
759
+ return sequenced === 0 ? void 0 : substantive;
760
+ }
761
+ //#endregion
700
762
  //#region lib/types/signals.js
701
763
  /**
702
764
  * Deterministic review signal gate.
@@ -874,68 +936,6 @@ function foldTurnEvents(events, fromSeq = 0) {
874
936
  };
875
937
  }
876
938
  //#endregion
877
- //#region lib/types/evidence.js
878
- /**
879
- * Which session frames are EVIDENCE, and which are bookkeeping.
880
- *
881
- * The session's evidence index answers "does this seq carry content"; a bare range check used
882
- * to accept any integer inside the authoring window. A boundary frame satisfies that while carrying
883
- * nothing a claim can rest on: the `turn/start` seq is the frame a claim about that turn was
884
- * most likely read out of, and citing it is indistinguishable from citing a real exchange. This
885
- * module owns the ONE classification of a session frame by what it CARRIES, so the plan path can
886
- * report an op whose whole citation list is bookkeeping (design
887
- * `dsh-evolution-skill-history-design.md` §3D, phase 1: report only — no op is refused here).
888
- *
889
- * The classification is a DENY list of the pure bookends, not an allow list of content frames.
890
- * The platform's own vocabulary (`KNOWN_SESSION_EVENT_TYPES`, 57 members at 0.1.5-rc.2) mixes
891
- * content frames with state-change frames, and out-of-repo plugins append types the family cannot
892
- * enumerate; an unknown frame is therefore treated as carrying content, because a report that
893
- * fires on an unclassifiable frame is a false positive and phase 1 exists to measure how many TRUE
894
- * ones there are. Tightening — a narrower definition, or an allow list built from the platform's
895
- * vocabulary — changes this table and nothing else (`evidenceKindIndex` is the only reader).
896
- * @module @lmzhen/dsh-evolution-core
897
- */
898
- /** The frame types that record a boundary and carry no content: the turn and step bookends. */
899
- const BOOKKEEPING_FRAME_TYPES = new Set([
900
- "turn/start",
901
- "turn/end",
902
- "step/start",
903
- "step/end"
904
- ]);
905
- /**
906
- * Whether one frame type records a boundary and carries no content.
907
- *
908
- * The classification table's SECOND reader: the live projection unit
909
- * (`session-projection.ts`) folds the same answer per event, so the rule stays one table.
910
- * @param type - a platform session-event type.
911
- * @returns true for the turn/step bookends.
912
- */
913
- function isBookkeepingFrame(type) {
914
- return BOOKKEEPING_FRAME_TYPES.has(type);
915
- }
916
- /**
917
- * The seqs of the frames that carry content.
918
- *
919
- * @param events - the session's frames, oldest first (any iterable; nothing is retained).
920
- * @returns the substantive seqs, or `undefined` when NO frame carried a usable seq. The two
921
- * answers are different facts: an empty SET says "every sequenced frame is a boundary", while
922
- * `undefined` says "this log cannot tell a boundary from a message" (a stub session in a test,
923
- * a composition whose events carry no seq). A caller that cannot classify must stay silent
924
- * rather than report every op — the same three-state posture as `sessionReadSkillNames`.
925
- */
926
- function evidenceKindIndex(events) {
927
- const substantive = /* @__PURE__ */ new Set();
928
- let sequenced = 0;
929
- for (const event of events) {
930
- const seq = event.seq;
931
- if (typeof seq !== "number" || !Number.isInteger(seq)) continue;
932
- sequenced += 1;
933
- if (typeof event.type === "string" && BOOKKEEPING_FRAME_TYPES.has(event.type)) continue;
934
- substantive.add(seq);
935
- }
936
- return sequenced === 0 ? void 0 : substantive;
937
- }
938
- //#endregion
939
939
  //#region lib/types/session-projection.js
940
940
  /**
941
941
  * The family's session projections: the per-session facts the family used to re-read the log for.
@@ -1247,4 +1247,4 @@ function sessionEvidenceIndex(ctx, session) {
1247
1247
  return { has: (seq) => Number.isInteger(seq) && seq >= 0 && seq <= through && !bookkeeping.includes(seq) };
1248
1248
  }
1249
1249
  //#endregion
1250
- export { countDispatches as A, supportFileReadFromPath as B, PTC_DISPATCH_EVENT as C, assertDispatchPayload as D, ToolDispatchPayloadError as E, isProgramToolName as F, KEEP_LINE_RE as G, CITATION_SUPPORT_DIRS as H, isSkillReadToolName as I, scanBodyHooks as J, isFileShapedPath as K, isSkillToolName as L, dispatchPathOf as M, dispatchStepOf as N, collectReadSkillNames as O, foldToolDispatches as P, readDispatchSignal as R, NATIVE_RESULT_EVENT as S, ToolDispatchNormalizer as T, DEFAULT_CITATION_REF_BUDGET as U, supportFileReadOf as V, HOOK_LINE_RE as W, observeEvent as _, evolutionSignalsProjection as a, MODEL_SESSION_EVENT_TYPES as b, sessionLastEventTime as c, evidenceKindIndex as d, isBookkeepingFrame as f, initialTurnFold as g, foldTurnEvents as h, evolutionReadsProjection as i, dispatchKeyOf as j, collectReadSupportFiles as k, sessionReadNames as l, foldTurnEvent as m, evolutionEvidenceProjection as n, isProjectableSession as o, advanceReview as p, resolveCitations as q, evolutionProjectionHistoryProjection as r, sessionEvidenceIndex as s, evolutionActivityProjection as t, sessionTurnSignals as u, DEFAULT_SUPPORT_READ_TOOL_NAMES as v, PTC_DISPATCH_START_EVENT as w, NATIVE_CALL_EVENT as x, DISPATCH_EVENT_TYPES as y, skillReadNameOf as z };
1250
+ export { countDispatches as A, supportFileReadFromPath as B, PTC_DISPATCH_EVENT as C, assertDispatchPayload as D, ToolDispatchPayloadError as E, isProgramToolName as F, KEEP_LINE_RE as G, CITATION_SUPPORT_DIRS as H, isSkillReadToolName as I, scanBodyHooks as J, isFileShapedPath as K, isSkillToolName as L, dispatchPathOf as M, dispatchStepOf as N, collectReadSkillNames as O, foldToolDispatches as P, readDispatchSignal as R, NATIVE_RESULT_EVENT as S, ToolDispatchNormalizer as T, DEFAULT_CITATION_REF_BUDGET as U, supportFileReadOf as V, HOOK_LINE_RE as W, isBookkeepingFrame as _, evolutionSignalsProjection as a, MODEL_SESSION_EVENT_TYPES as b, sessionLastEventTime as c, advanceReview as d, foldTurnEvent as f, evidenceKindIndex as g, observeEvent as h, evolutionReadsProjection as i, dispatchKeyOf as j, collectReadSupportFiles as k, sessionReadNames as l, initialTurnFold as m, evolutionEvidenceProjection as n, isProjectableSession as o, foldTurnEvents as p, resolveCitations as q, evolutionProjectionHistoryProjection as r, sessionEvidenceIndex as s, evolutionActivityProjection as t, sessionTurnSignals as u, DEFAULT_SUPPORT_READ_TOOL_NAMES as v, PTC_DISPATCH_START_EVENT as w, NATIVE_CALL_EVENT as x, DISPATCH_EVENT_TYPES as y, skillReadNameOf as z };