opencode2-cow-worktree 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -148,7 +148,11 @@ clone (default `"none"`):
148
148
  - `"none"`: a request for `cow` produces a Deep clone or fails. Never a
149
149
  shallow worktree.
150
150
  - `"git"`: on a non-CoW filesystem the tool may build a regular `git`
151
- worktree instead and report `mechanism: "git"`.
151
+ worktree instead and report `mechanism: "git"`. This works on opencode2
152
+ builds whose worktree create still accepts a `strategy` request
153
+ (2.0.2-era). From the projectID-era API onward (20260915 nightlies,
154
+ v2.0.3+) the create always runs the selected strategy and ignores the
155
+ field, so the non-CoW refusal surfaces and the fallback cannot engage.
152
156
 
153
157
  **`targetRoot`** — where `spawn_workspace` places the worktree. Unset (the
154
158
  default) means a sibling of the source, on the source's filesystem by
@@ -237,8 +241,10 @@ regardless of `fallback`. Only `spawn_workspace` consults the policy.
237
241
  - **"the target is on a different filesystem"** — set `worktree.directory` as
238
242
  shown above, or point `targetRoot` at the source's filesystem.
239
243
  - **`cow` fails on an ext4 or tmpfs project** — expected: that filesystem
240
- cannot clone. Use the `git` fallback for tool calls, or let the project use
241
- the built-in strategy.
244
+ cannot clone. On opencode2 builds from the projectID era (20260915
245
+ nightlies, v2.0.3+) the `git` fallback cannot be requested through the
246
+ create API, so the refusal is final; on 2.0.2-era builds the `fallback:
247
+ "git"` option produces a regular git worktree for tool calls.
242
248
  - **The plugin is stuck on an old version** — opencode2 caches the package
243
249
  under `~/.cache/opencode/node_modules/`. Remove the plugin's cache
244
250
  directory and restart: `rm -rf ~/.cache/opencode/node_modules/opencode2-cow-worktree`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode2-cow-worktree",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Copy-on-write worktree strategy for opencode2: a Deep clone of the whole working directory, ignored files included, so parallel agents start ready to run",
5
5
  "type": "module",
6
6
  "exports": {
package/src/plugin.ts CHANGED
@@ -146,21 +146,27 @@ function liveDeps(
146
146
  return {
147
147
  probe: probeCowCapability,
148
148
  probeDevice: deviceOf,
149
- listWorktrees: () => ctx.worktree.list(),
149
+ // The projectID-era API (20260915 nightlies onward) requires the project
150
+ // id on every worktree call and no longer accepts a `location` query, so
151
+ // all three seams derive it from the plugin's own location context.
152
+ listWorktrees: () => ctx.worktree.list({ projectID: ctx.location.project.id }),
150
153
  isDirectory,
151
154
  createWorktree: (input) =>
152
155
  ctx.worktree.create({
153
- strategy: input.strategy,
154
- name: input.name,
155
- location: { directory: input.sourceDirectory },
156
+ projectID: ctx.location.project.id,
157
+ from: input.sourceDirectory,
156
158
  directory: input.parentDirectory,
159
+ name: input.name,
160
+ // Ignored by projectID-era binaries (the selected strategy wins);
161
+ // honored by the 2.0.2-era API, where the git fallback needs it.
162
+ strategy: input.strategy,
157
163
  }),
158
164
  createSession: async (directory, name) => {
159
165
  const session = await ctx.session.create({ title: name, location: { directory } });
160
166
  return session.id;
161
167
  },
162
168
  removeWorktree: (directory) =>
163
- ctx.worktree.remove({ directory, force: true }),
169
+ ctx.worktree.remove({ projectID: ctx.location.project.id, directory, force: true }),
164
170
  // `ctx.session.get` exists on the v2 runtime but is untyped in the
165
171
  // installed beta; types/opencode2-worktree.d.ts declares the verified
166
172
  // `{ sessionID }` shape and the structural record slice the occupancy
@@ -179,9 +185,11 @@ function liveDeps(
179
185
  *
180
186
  * `setup` registers the `cow` Strategy through the worktree seam, and the
181
187
  * `spawn_workspace` and `list_worktrees` tools through the tool seam.
182
- * Registering the Strategy also selects it as the Location default; opencode2's
183
- * registry still lets a caller name the built-in `git` strategy explicitly, so
184
- * this module does not touch that behavior.
188
+ * Registering the Strategy also selects it as the default; the projectID-era
189
+ * create API has no per-request strategy field, so the selected strategy is
190
+ * what every create uses. The create call still carries `strategy` for
191
+ * 2.0.2-era binaries, where it is what lets the tool's opt-in `git` fallback
192
+ * name the built-in git strategy.
185
193
  */
186
194
  export default {
187
195
  id: "opencode2-cow-worktree",
@@ -252,7 +260,7 @@ export default {
252
260
  // the inventory and one stat per row, none of spawn_workspace's
253
261
  // other seams. (Option validation happens once in setup, so there
254
262
  // is no validation side effect to dodge either way.)
255
- listWorktrees: () => ctx.worktree.list(),
263
+ listWorktrees: () => ctx.worktree.list({ projectID: ctx.location.project.id }),
256
264
  statEntry: stat,
257
265
  });
258
266
  const summary =