opencode-self-improvement 0.14.20 → 0.14.21
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/package.json +1 -1
- package/src/index.ts +19 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-self-improvement",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.21",
|
|
4
4
|
"description": "Durable memory for opencode: remember facts, decisions, and commands across sessions, plus a one-command per-repo setup (/repo-init).",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"exports": {
|
package/src/index.ts
CHANGED
|
@@ -755,8 +755,20 @@ const impl = {
|
|
|
755
755
|
// a human (or an update on the survivor) decides.
|
|
756
756
|
const survivorTs = outcome.collapsedWith;
|
|
757
757
|
if (target && survivorTs && survivorTs !== target.ts) {
|
|
758
|
-
|
|
758
|
+
// #175: the gate can observe a session move after this call captured
|
|
759
|
+
// its reader. Recheck before trusting or describing the survivor.
|
|
760
|
+
const survivor = (await loadAll()).find(
|
|
761
|
+
(m) => m.ts === survivorTs && !m.superseded_by && isVisibleTo(m, reader),
|
|
762
|
+
);
|
|
759
763
|
if (survivor) {
|
|
764
|
+
// #175: private rows are visible by key OR path. Equal keys alone
|
|
765
|
+
// can drop another checkout's access after an origin change.
|
|
766
|
+
// For global rows, isVisibleTo ignores paths.
|
|
767
|
+
// Match raw paths like isVisibleTo; filesystem aliases need not
|
|
768
|
+
// grant the same readers access. This restricts automatic folds;
|
|
769
|
+
// explicit merge_review authorizes both seats under #131 instead.
|
|
770
|
+
const samePathVisibility = requested.repo === "global" ||
|
|
771
|
+
(target.repoPath ?? "") === (survivor.repoPath ?? "");
|
|
760
772
|
// The predicate is the REQUESTED state vs the survivor
|
|
761
773
|
// (round 3): content equality is already proven by the
|
|
762
774
|
// collapse, so the fold is loss-free only when the
|
|
@@ -771,7 +783,8 @@ const impl = {
|
|
|
771
783
|
sameStrList(requested.tags, survivor.tags) &&
|
|
772
784
|
requested.issue === survivor.issue &&
|
|
773
785
|
requested.status === (survivor.status ?? "settled") &&
|
|
774
|
-
requested.repo === (survivor.repo ?? "global")
|
|
786
|
+
requested.repo === (survivor.repo ?? "global") &&
|
|
787
|
+
samePathVisibility
|
|
775
788
|
) {
|
|
776
789
|
const done = await markSuperseded(target.ts, {
|
|
777
790
|
superseded_by: survivorTs,
|
|
@@ -799,12 +812,14 @@ const impl = {
|
|
|
799
812
|
differs.push(`tags [${(requested.tags ?? []).join(", ") || "-"}] vs [${(survivor.tags ?? []).join(", ") || "-"}]`);
|
|
800
813
|
if (requested.repo !== (survivor.repo ?? "global"))
|
|
801
814
|
differs.push(`visibility ${requested.repo} vs ${survivor.repo ?? "global"}`);
|
|
815
|
+
if (!samePathVisibility) differs.push("repository path visibility differs");
|
|
802
816
|
return {
|
|
803
817
|
content:
|
|
804
818
|
`Duplicate: ${args.type}/${args.scope} stands active as ${survivorTs}, but ${target.ts} ` +
|
|
805
819
|
`was NOT retired — the survivor does not carry what this update asked for ` +
|
|
806
|
-
`(${differs.join("; ")}), and the fold would drop it. Both stay active
|
|
807
|
-
`
|
|
820
|
+
`(${differs.join("; ")}), and the fold would drop it. Both stay active. To deliberately ` +
|
|
821
|
+
`keep only the survivor, use memory_merge_review with loser="${target.ts}", ` +
|
|
822
|
+
`survivor="${survivorTs}", and an explicit reason. This keeps the survivor's metadata and visibility.`,
|
|
808
823
|
};
|
|
809
824
|
}
|
|
810
825
|
}
|