soulbridge 0.0.109 → 0.0.110

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.
@@ -930,14 +930,17 @@ export function openSqlite(file) {
930
930
  return rows.map((row) => rowToFact(row, slots));
931
931
  },
932
932
  supersedeFact(oldId, newId) {
933
- // The old claim stopped holding when the new one was recorded. `valid_until` is the
934
- // time axis; `status` is the lifecycle — both are written, and they answer different
935
- // questions ("was it ever true?" vs "is it still the current state?").
936
- const recordedAt = Number(db.prepare('SELECT created_at FROM facts WHERE id = ?').get(newId)?.created_at ??
937
- Date.now());
933
+ // A new claim ends the old one when the new claim became true — not when we happened to
934
+ // record it. "小林在 A 公司" ends at the layoff (10-24), not at the moment the layoff was
935
+ // mentioned. Falls back to the record time only when the successor has no validity start
936
+ // (an undated claim still replaces the old one now).
937
+ const successor = db
938
+ .prepare('SELECT created_at, valid_from FROM facts WHERE id = ?')
939
+ .get(newId);
940
+ const endedAt = Number(successor?.valid_from ?? successor?.created_at ?? Date.now());
938
941
  withRetry(() => db
939
942
  .prepare(`UPDATE facts SET status = '${FACT_STATUS.retracted}', superseded_by = ?, valid_until = ? WHERE id = ?`)
940
- .run(newId, recordedAt, oldId));
943
+ .run(newId, endedAt, oldId));
941
944
  },
942
945
  /* ---------------- gaps ---------------- */
943
946
  putGap(spec) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soulbridge",
3
- "version": "0.0.109",
3
+ "version": "0.0.110",
4
4
  "description": "A personality layer for any agent: continuity, forgetting, and growth across tools.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",