opencode-self-improvement 0.15.13 → 0.15.14

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-self-improvement",
3
- "version": "0.15.13",
3
+ "version": "0.15.14",
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": {
@@ -6,7 +6,7 @@ import { pruneMemory } from "../store/prune.ts";
6
6
  import { ForgetArgs, validated } from "./schema.ts";
7
7
 
8
8
  export const register: ToolRegister = (editor, deps) => {
9
- const { toolIds, direct } = deps;
9
+ const { toolIds, bindSessionIdentity, direct } = deps;
10
10
  editor.add(validated(ForgetArgs, {
11
11
  name: "memory_forget",
12
12
  description:
@@ -14,6 +14,11 @@ export const register: ToolRegister = (editor, deps) => {
14
14
  options: direct,
15
15
  async execute(args, context): Promise<{ content: string }> {
16
16
  const { sid } = toolIds(context);
17
+ // Identity before the prune's repo floor (#260): resolve the session
18
+ // from the host (messages, then session row) before pruneMemory
19
+ // captures the Reader, so an unseen serve-host session is partitioned
20
+ // by its own repository, not the instance's provisional binding.
21
+ await bindSessionIdentity(sid);
17
22
  const res = await pruneMemory(args.scope, args.type, args.reason, sid);
18
23
  if (res.error) return { content: `memory_forget PARTIAL: deleted row(s) ${res.deleted.map((d) => d.memory.ts).join(", ")}; stopped: ${res.error}. Rejection tombstones or audit lines may be incomplete. Inspect memory_evidence / memory_undo before retrying.` };
19
24
  if (!res.deleted.length) return { content: `No memories found for ${args.type} in ${args.scope}` };
@@ -11,7 +11,7 @@ import { MergeReviewArgs, validated } from "./schema.ts";
11
11
  import { join } from "node:path";
12
12
 
13
13
  export const register: ToolRegister = (editor, deps) => {
14
- const { toolIds, direct } = deps;
14
+ const { toolIds, bindSessionIdentity, direct } = deps;
15
15
  editor.add(validated(MergeReviewArgs, {
16
16
  name: "memory_merge_review",
17
17
  description:
@@ -19,6 +19,12 @@ export const register: ToolRegister = (editor, deps) => {
19
19
  options: direct,
20
20
  async execute(args, context): Promise<{ content: string }> {
21
21
  const { sid } = toolIds(context);
22
+ // Identity before authorization (#260): the entry binding is only
23
+ // provisional on the INSTANCE's directory. On a serve host the session
24
+ // row is the sole truth, and a tool call can be the first thing this
25
+ // instance sees for a session — resolve it like the write tools do
26
+ // before the Reader below partitions the seats.
27
+ await bindSessionIdentity(sid);
22
28
  if (!args.loser || !args.survivor || !args.reason) {
23
29
  return { content: "merge_review blocked: loser, survivor, and reason are all required (fail-closed)." };
24
30
  }
package/src/tools/undo.ts CHANGED
@@ -9,7 +9,7 @@ import { listSnapshots, restoreSnapshot } from "../store/undo.ts";
9
9
  import { basename } from "node:path";
10
10
 
11
11
  export const register: ToolRegister = (editor, deps) => {
12
- const { toolIds, direct } = deps;
12
+ const { toolIds, bindSessionIdentity, direct } = deps;
13
13
  editor.add(validated(UndoArgs, {
14
14
  name: "memory_undo",
15
15
  description:
@@ -22,6 +22,12 @@ export const register: ToolRegister = (editor, deps) => {
22
22
  // carries the CALLER's reader, so rows another repo owns survive
23
23
  // untouched in every mode instead of riding the snapshot wholesale.
24
24
  const { sid } = toolIds(context);
25
+ // Identity before ownership partitioning (#260): the caller's
26
+ // repository must be resolved from the host before the Reader
27
+ // decides which lines are foreign, exactly as merge and forget now
28
+ // do; the day file is shared (#153) and a wrong reader is a write
29
+ // into another repository's history.
30
+ await bindSessionIdentity(sid);
25
31
  const res = await restoreSnapshot(args.snapshot, memoryRoot(), mode, readerFromSid(sid));
26
32
  if (!res.restored) {
27
33
  const parts = [...res.concurrentAdded, ...res.concurrentChanged];