pi-edit-fence 1.0.0 → 1.0.1
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 +1 -1
- package/extensions/edit-fence.ts +3 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ Edit the tunables at the top of `extensions/edit-fence.ts`:
|
|
|
64
64
|
| `SCOPE` | `"file"` | `"file"` locks the exact file. `"dir"` locks a subtree for area-level coordination. |
|
|
65
65
|
| `CLAIM_DEPTH` | `2` | Subtree depth when `SCOPE === "dir"` (2 keeps `src/api` and `src/ui` distinct). |
|
|
66
66
|
| `LEASE_MS` | `5 min` | Idle time before a lock auto-expires. |
|
|
67
|
-
| `CONTENDED_LEASE_MS` | `
|
|
67
|
+
| `CONTENDED_LEASE_MS` | `10 s` | Shorter idle lease applied while another session is waiting. |
|
|
68
68
|
| `WAIT_MS` | `15 s` | How long a blocked edit waits before returning the retry-later message. |
|
|
69
69
|
| `SHARED_PATTERNS` | configs, lockfiles | Glob patterns treated as warn-only shared zones. |
|
|
70
70
|
|
package/extensions/edit-fence.ts
CHANGED
|
@@ -63,7 +63,7 @@ const LEASE_MS = 5 * 60 * 1000;
|
|
|
63
63
|
// When another session is actively waiting on a subtree, the owner's idle lease
|
|
64
64
|
// shortens to this. A genuinely-done owner frees fast, but only under contention;
|
|
65
65
|
// a solo owner keeps the full LEASE_MS.
|
|
66
|
-
const CONTENDED_LEASE_MS =
|
|
66
|
+
const CONTENDED_LEASE_MS = 10 * 1000;
|
|
67
67
|
// On a blocked edit, wait this long for the owner to release/expire before giving
|
|
68
68
|
// the agent a retry-later message (transparently absorbs brief overlaps).
|
|
69
69
|
const WAIT_MS = 15 * 1000;
|
|
@@ -272,10 +272,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
272
272
|
return {
|
|
273
273
|
block: true,
|
|
274
274
|
reason:
|
|
275
|
-
`path-fence: ${SCOPE === "file" ? "file" : "area"} "${key}" is
|
|
276
|
-
`
|
|
277
|
-
`Do not loop-retry now. Instead: ${SCOPE === "file" ? "work on OTHER files" : `work on files OUTSIDE "${key}"`} first, then RETRY this edit LATER — it will succeed once the other session is done. ` +
|
|
278
|
-
`If you have no other work, tell the user "${key}" is held by another session (they can run "/steal ${key}" to force handover; you cannot run that yourself).`,
|
|
275
|
+
`path-fence: ${SCOPE === "file" ? "file" : "area"} "${key}" is locked by another active pi session (${result.owner.session}, pid ${result.owner.pid}). ` +
|
|
276
|
+
`Work on other files, or wait and retry this edit — the lock releases automatically when the other session is done.`,
|
|
279
277
|
};
|
|
280
278
|
}
|
|
281
279
|
if (result.kind === "warn" && ctx.hasUI) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-edit-fence",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Stop concurrent pi sessions from clobbering each other's edits. Per-file locks, auto-claim on edit, retry-later, lease expiry, crash recovery. No git worktrees.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|