@cortexkit/common-auth 0.2.8 → 0.2.9

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.
@@ -68,9 +68,13 @@ export function diffDumpBodies(previous, current) {
68
68
  currentBytes: current.length,
69
69
  };
70
70
  }
71
+ // Shared by every dumper in the process. A plugin may create one dumper per
72
+ // project, and two of them writing the same session in the same millisecond
73
+ // would otherwise both number their dump 1 and pick the same file name; the
74
+ // exclusive create then drops the second dump.
75
+ let processDumpCounter = 0;
71
76
  export function createDumper(options) {
72
77
  let enabled = options.enabled === true;
73
- let counter = 0;
74
78
  const pid = options.pid ?? process.pid;
75
79
  const now = options.now ?? Date.now;
76
80
  const log = options.logger;
@@ -189,7 +193,7 @@ export function createDumper(options) {
189
193
  async function dump(input) {
190
194
  if (!enabled)
191
195
  return undefined;
192
- counter++;
196
+ const counter = ++processDumpCounter;
193
197
  const session = input.session?.trim() || UNKNOWN_SESSION;
194
198
  const dir = resolveDir();
195
199
  const createdAt = new Date(now()).toISOString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/common-auth",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Shared code for the CortexKit auth plugins: account pool, quota and routing, commands and auth menu, OpenCode 2 hooks, Claustrum custody, and plumbing (loopback RPC, file locks, logger, sidebar state, TUI preferences and build).",
5
5
  "license": "MIT",
6
6
  "repository": {