@narumitw/pi-sync 0.69.0 → 0.69.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @narumitw/pi-sync
2
2
 
3
+ ## 0.69.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [3cbbbc5]
8
+ - @narumitw/pi-tui-kit@0.73.0
9
+
3
10
  ## 0.69.0
4
11
 
5
12
  ### Minor Changes
@@ -1 +1 @@
1
- "0ed048ebfe41646cc97f550817a6c72ba22e7df76d88ab990260d770a6a95552"
1
+ "2c3bfca03feef589cd4e4b0a4c69144f973a2bf06c0d9a7ef2cb0c4b84fd5f0a"
@@ -17,17 +17,24 @@ export function createDaemonDebug(root) {
17
17
  appendDebugEvent(root, "pi-sync-daemon", event);
18
18
  }
19
19
  }
20
- catch { }
20
+ catch {
21
+ }
22
+ finally {
23
+ for (const { complete } of batch)
24
+ complete();
25
+ }
21
26
  }
22
27
  flushing = false;
23
28
  }
24
29
  return (event, current) => {
25
30
  if (waiting.length >= 32)
26
31
  return;
27
- waiting.push({ event, current });
28
- if (flushing)
29
- return;
30
- flushing = true;
31
- queueMicrotask(() => void flush());
32
+ const { promise, resolve } = Promise.withResolvers();
33
+ waiting.push({ event, current, complete: resolve });
34
+ if (!flushing) {
35
+ flushing = true;
36
+ queueMicrotask(() => void flush());
37
+ }
38
+ return promise;
32
39
  };
33
40
  }
@@ -59,7 +59,7 @@ export async function startServer(root, execute, hooks = {}) {
59
59
  const debug = diagnostic
60
60
  ? (event, current) => {
61
61
  try {
62
- diagnostic(event, () => ownsLog() && (current?.() ?? true));
62
+ return diagnostic(event, () => ownsLog() && (current?.() ?? true))?.catch(() => { });
63
63
  }
64
64
  catch { }
65
65
  }
@@ -384,9 +384,10 @@ export async function startServer(root, execute, hooks = {}) {
384
384
  job.controller.abort(new DOMException("Operation cancelled before dispatch", "AbortError"));
385
385
  const execution = makeExecution(job);
386
386
  const kind = debug && debugOperation(operation);
387
- const note = (outcome) => {
387
+ const waitForInspectionLog = kind === "inspect";
388
+ const note = (outcome, current) => {
388
389
  if (kind)
389
- debug?.({ event: "job", operation: kind, outcome, operationId: id });
390
+ return debug?.({ event: "job", operation: kind, outcome, operationId: id }, current);
390
391
  };
391
392
  job.promise = queue
392
393
  .then(async () => {
@@ -404,21 +405,27 @@ export async function startServer(root, execute, hooks = {}) {
404
405
  });
405
406
  foregroundRecoveryJob ??= job;
406
407
  }
408
+ const logged = note(debugJobResult(operation, result) ?? job.debugOutcome ?? "completed", waitForInspectionLog ? () => !execution.signal.aborted : undefined);
409
+ if (waitForInspectionLog && logged) {
410
+ await logged;
411
+ execution.validate();
412
+ }
407
413
  job.view.result = result;
408
414
  job.view.phase = "done";
409
- note(debugJobResult(operation, result) ?? job.debugOutcome ?? "completed");
410
415
  })
411
- .catch((error) => {
416
+ .catch(async (error) => {
412
417
  if (error instanceof ConsentPublicationError)
413
418
  consentPublicationFailed = true;
414
- job.view.phase = "failed";
415
- job.view.error = remoteError(error);
416
- note(!job.committed && (job.controller.signal.aborted || (error instanceof Error && error.name === "AbortError"))
419
+ const logged = note(!job.committed && (job.controller.signal.aborted || (error instanceof Error && error.name === "AbortError"))
417
420
  ? "cancelled"
418
421
  : (job.debugOutcome ??
419
422
  (error instanceof SyncDecisionRequiredError || error instanceof DaemonStoppingError
420
423
  ? "blocked"
421
424
  : "failed")));
425
+ if (waitForInspectionLog && logged)
426
+ await logged;
427
+ job.view.phase = "failed";
428
+ job.view.error = remoteError(error);
422
429
  if (job.committed)
423
430
  for (const id of new Set([client, ...job.peers])) {
424
431
  const affected = participants.get(id);
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.15.0"
2
+ "version": "0.15.1"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-sync",
3
- "version": "0.69.0",
3
+ "version": "0.69.1",
4
4
  "description": "Pi extension that syncs Pi configuration through Git, WebDAV, Cloudflare R2, or S3-compatible storage.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@narumitw/sync-node-sdk": "npm:@earendil-works/pi-coding-agent@1.6.0",
50
- "@narumitw/pi-tui-kit": "^0.72.0",
50
+ "@narumitw/pi-tui-kit": "^0.73.0",
51
51
  "fast-xml-parser": "^5.12.1",
52
52
  "minimatch": "^11.0.9",
53
53
  "proper-lockfile": "^4.1.2",