peaks-loop-shared-channel 0.0.57 → 0.0.59
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/dist/file-lock.d.ts.map +1 -1
- package/dist/file-lock.js +0 -3
- package/dist/shared-channel-internals.d.ts.map +1 -1
- package/dist/shared-channel-internals.js +0 -2
- package/dist/shared-channel.d.ts +0 -1
- package/dist/shared-channel.d.ts.map +1 -1
- package/dist/shared-channel.js +0 -3
- package/package.json +1 -1
package/dist/file-lock.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-lock.d.ts","sourceRoot":"","sources":["../src/file-lock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-lock.d.ts","sourceRoot":"","sources":["../src/file-lock.ts"],"names":[],"mappings":"AAgCA,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBACd,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAQ/C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAoFpE"}
|
package/dist/file-lock.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Used by writeSharedEntry (shared-channel.ts) and appendHeartbeat /
|
|
5
5
|
* markCompleted (dispatch-record-writer.ts) to guard the
|
|
6
6
|
* read-modify-write sequence against lost updates from concurrent
|
|
7
|
-
* writers (slice 2026-06-23-audit-3rd finding #2 + #3).
|
|
8
7
|
*
|
|
9
8
|
* Mechanism: write a sidecar `.lock` file next to the target via
|
|
10
9
|
* `fs.openSync(path, 'wx')`. The `wx` flag maps to O_CREAT|O_EXCL on
|
|
@@ -54,11 +53,9 @@ export function withFileLockSync(filePath, fn) {
|
|
|
54
53
|
if (!existsSync(dir)) {
|
|
55
54
|
mkdirSync(dir, { recursive: true });
|
|
56
55
|
}
|
|
57
|
-
// Wall-clock guard (slice 014): in pathological slow-system cases, the
|
|
58
56
|
// retry backoff could push wall-clock above LOCK_STALE_MS. Cap the loop at
|
|
59
57
|
// LOCK_STALE_MS regardless of attempts; throw the existing LockTimeoutError.
|
|
60
58
|
//
|
|
61
|
-
// Slice 2026-07-12-fix note: the slice 014 implementation re-checked
|
|
62
59
|
// `isStaleLock(lockPath)` at the TOP of every loop iteration. Under
|
|
63
60
|
// vitest-on-Windows slowdown (each `spinSleep` actually waits hundreds of
|
|
64
61
|
// ms because of event-loop preemption), the wall clock would cross
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-channel-internals.d.ts","sourceRoot":"","sources":["../src/shared-channel-internals.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,kBAAkB;
|
|
1
|
+
{"version":3,"file":"shared-channel-internals.d.ts","sourceRoot":"","sources":["../src/shared-channel-internals.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,kBAAkB;IAIjC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;CAChE;AAED,MAAM,MAAM,sBAAsB,GAC9B;IACE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B,GACD;IACE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,aAAa,CAAC;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEN,iBAAS,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CA4B/E;AAyBD,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAY/D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAU3E;AAED,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -43,7 +43,6 @@ function readChannelOrEmpty(channelFile, batchId) {
|
|
|
43
43
|
function isValidEntry(v) {
|
|
44
44
|
if (!isObject(v))
|
|
45
45
|
return false;
|
|
46
|
-
// Slice 2026-06-23-audit-4th #E2: pre-versioning records (no
|
|
47
46
|
// `version` field) are still accepted on read for backward compat.
|
|
48
47
|
// The writer stamps `version: 1` going forward; readers default
|
|
49
48
|
// missing/legacy entries to version 1 in memory.
|
|
@@ -63,7 +62,6 @@ function isObject(v) {
|
|
|
63
62
|
}
|
|
64
63
|
function writeAtomic(path, channel) {
|
|
65
64
|
const dir = dirname(path);
|
|
66
|
-
// Slice 2026-06-23-audit-3rd #11: skip mkdirSync when the dir already
|
|
67
65
|
// exists. The `recursive: true` mkdir is a syscall (~50µs on macOS,
|
|
68
66
|
// ~10ms on cold Windows cache); the `existsSync` short-circuit saves
|
|
69
67
|
// it on the hot path (every `peaks sub-agent share` + every
|
package/dist/shared-channel.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export declare function readSharedChannel(opts: {
|
|
|
40
40
|
}): SharedChannel;
|
|
41
41
|
/**
|
|
42
42
|
* Garbage-collect a single channel. Returns true if the file was
|
|
43
|
-
* deleted, false if it did not exist.
|
|
44
43
|
*/
|
|
45
44
|
export declare function gcChannel(opts: {
|
|
46
45
|
projectRoot: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-channel.d.ts","sourceRoot":"","sources":["../src/shared-channel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared-channel.d.ts","sourceRoot":"","sources":["../src/shared-channel.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,iBAAiB,EAGjB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC;AAE1E,eAAO,MAAM,8BAA8B,QAAY,CAAC;AACxD,eAAO,MAAM,8BAA8B,OAAO,CAAC;AACnD,eAAO,MAAM,6BAA6B,QAAc,CAAC;AACzD,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,GAAG,sBAAsB,CAgIzB;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,aAAa,CAoBhB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAcV;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ,GAAG,OAAO,CAUV"}
|
package/dist/shared-channel.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* G8 — cross sub-agent shared channel (RL-23..RL-26, AC-47..AC-49).
|
|
3
2
|
*
|
|
4
3
|
* Dispatcher-mediated indirect signal: sub-agent A writes a shared entry,
|
|
5
4
|
* the dispatcher stores it in a per-batch JSON file, sub-agent B (still
|
|
@@ -60,7 +59,6 @@ export function writeSharedEntry(opts) {
|
|
|
60
59
|
const softWarning = valueSize > SHARED_CHANNEL_SOFT_VALUE_WARN;
|
|
61
60
|
const channelFile = sharedChannelPath(opts.projectRoot, opts.sid, opts.rid, opts.batchId);
|
|
62
61
|
assertSafeSharedChannelPath(channelFile, opts.projectRoot);
|
|
63
|
-
// Slice 2026-06-23-audit-3rd #2: the read-modify-write sequence below
|
|
64
62
|
// is wrapped in withFileLockSync to prevent lost updates from two
|
|
65
63
|
// concurrent `peaks sub-agent share` calls landing on the same batch.
|
|
66
64
|
// Without the lock, the second writer's read sees a stale channel,
|
|
@@ -190,7 +188,6 @@ export function readSharedChannel(opts) {
|
|
|
190
188
|
}
|
|
191
189
|
/**
|
|
192
190
|
* Garbage-collect a single channel. Returns true if the file was
|
|
193
|
-
* deleted, false if it did not exist.
|
|
194
191
|
*/
|
|
195
192
|
export function gcChannel(opts) {
|
|
196
193
|
const channelFile = sharedChannelPath(opts.projectRoot, opts.sid, opts.rid, opts.batchId);
|