@hmharness/cognitive 0.23.52 → 0.23.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/evalset.js CHANGED
@@ -20,7 +20,7 @@
20
20
  import { createHash } from 'node:crypto';
21
21
  /** Canonical JSON: tasks sorted by id, key order fixed — the hash basis. */
22
22
  export function canonicalTaskSet(set) {
23
- const tasks = [...set.tasks].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
23
+ const tasks = set.tasks.toSorted((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
24
24
  return JSON.stringify({ kind: set.kind, version: set.version, id: set.id, revision: set.revision, tasks: tasks.map((t) => ({ id: t.id, prompt: t.prompt, assertion: t.assertion, holdout: t.holdout === true })) });
25
25
  }
26
26
  /** sha256 over the canonical form — order-independent, content-sensitive. */
package/dist/rlm.js CHANGED
@@ -85,9 +85,14 @@ export class RLMRuntime {
85
85
  createdAt: new Date().toISOString(),
86
86
  stateHash: stableHash({ vars: this.vars, log: this.log }),
87
87
  snapshot: {
88
+ // vars is `Record<string, unknown>` and the stateHash above is taken over
89
+ // the JSON serialization: the snapshot must be the JSON-normalized form
90
+ // (undefined keys dropped, Dates as ISO strings), so the JSON round-trip
91
+ // stays. materializeBudget() is a fresh literal of plain numbers, so there
92
+ // structuredClone() is exactly equivalent and reads as what it is: a copy.
88
93
  vars: JSON.parse(JSON.stringify(this.vars)),
89
94
  log: [...this.log],
90
- budget: JSON.parse(JSON.stringify(this.materializeBudget())),
95
+ budget: structuredClone(this.materializeBudget()),
91
96
  },
92
97
  };
93
98
  this.checkpoints.push(cp);
@@ -124,7 +124,7 @@ export function minePreconditions(candidate, train, opts = {}) {
124
124
  ...(used >= minBandSupport && ratios.length > 0
125
125
  ? {
126
126
  positionBand: (() => {
127
- const s = [...ratios].sort((a, b) => a - b);
127
+ const s = ratios.toSorted((a, b) => a - b);
128
128
  const q = (p) => Number(s[Math.min(s.length - 1, Math.max(0, Math.ceil(p * s.length) - 1))].toFixed(2));
129
129
  return { p10: q(0.1), p90: q(0.9) };
130
130
  })(),
package/dist/wm-causal.js CHANGED
@@ -16,7 +16,7 @@ function deltaKeys(t) {
16
16
  export function mineCausalLinks(transitions, opts = {}) {
17
17
  const minSupport = opts.minSupport ?? 2;
18
18
  const minLift = opts.minLift ?? 0.2;
19
- const chronological = [...transitions].sort((a, b) => String(a.observation.timestamp).localeCompare(String(b.observation.timestamp)));
19
+ const chronological = transitions.toSorted((a, b) => String(a.observation.timestamp).localeCompare(String(b.observation.timestamp)));
20
20
  // runs per action type
21
21
  const runs = new Map();
22
22
  for (const t of chronological)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/cognitive",
3
- "version": "0.23.52",
3
+ "version": "0.23.53",
4
4
  "description": "hmharness Cognitive OS core: Environment protocol, World Model, Goal system, Exploration, RLM runtime, five-layer memory, Skill Compiler, Continual Learning control plane, Evolution 2.0 governance, Multi-Agent topology, Transfer lab and GeneralBench schema. Cognitive strategy layer per the HMH Cognitive OS blueprint (2026-09).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,6 +26,6 @@
26
26
  "node": ">=22"
27
27
  },
28
28
  "dependencies": {
29
- "@hmharness/kernel": "0.23.52"
29
+ "@hmharness/kernel": "0.23.53"
30
30
  }
31
31
  }