@narumitw/pi-sync 0.70.5 → 0.70.7

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +2 -0
  3. package/dist/chunks/{chunk-3XN4FR72.ts → chunk-4A34OGXY.ts} +9 -9
  4. package/dist/chunks/{chunk-7NQ7SFZK.ts → chunk-5BE6LBDC.ts} +15 -15
  5. package/dist/chunks/chunk-A43CJYG4.ts +26 -0
  6. package/dist/chunks/chunk-A43CJYG4.ts.map +7 -0
  7. package/dist/chunks/{chunk-JPTI4HFC.ts → chunk-AXN3B5KC.ts} +22 -22
  8. package/dist/chunks/{chunk-SPXEDJ2G.ts → chunk-HCXPNKPU.ts} +61 -59
  9. package/dist/chunks/chunk-HCXPNKPU.ts.map +7 -0
  10. package/dist/chunks/{chunk-N24HEZSA.ts → chunk-VERMBZGL.ts} +7 -7
  11. package/dist/chunks/{chunk-LSIUAXE4.ts → chunk-WE3KJ7JS.ts} +8 -8
  12. package/dist/chunks/{chunk-5T4ZOHYF.ts → chunk-WRS3SUNZ.ts} +4 -18
  13. package/dist/chunks/chunk-WRS3SUNZ.ts.map +7 -0
  14. package/dist/chunks/client-debug-F4WFP2YJ.ts +40 -0
  15. package/dist/chunks/client-debug-F4WFP2YJ.ts.map +7 -0
  16. package/dist/chunks/{command-handler-PT2KVTLD.ts → command-handler-DWWFIXSC.ts} +34 -32
  17. package/dist/chunks/{command-handler-PT2KVTLD.ts.map → command-handler-DWWFIXSC.ts.map} +1 -1
  18. package/dist/chunks/{conflict-review-QI77P7KL.ts → conflict-review-HSERM245.ts} +3 -3
  19. package/dist/chunks/debug-tool-execution-7N4H6K3X.ts +67 -0
  20. package/dist/chunks/debug-tool-execution-7N4H6K3X.ts.map +7 -0
  21. package/dist/chunks/{diff-review-SOLP33TQ.ts → diff-review-6IUIOYST.ts} +3 -3
  22. package/dist/chunks/{diff-review-ILRZDQ4S.ts → diff-review-GB4NO53B.ts} +4 -4
  23. package/dist/chunks/{file-selection-2H3J2HTX.ts → file-selection-DGC5UJVI.ts} +9 -9
  24. package/dist/chunks/{manager-result-dispatcher-75FS46JP.ts → manager-result-dispatcher-6MOJPLIS.ts} +7 -7
  25. package/dist/chunks/{manager-ui-HW3ZAEVK.ts → manager-ui-3CQU37XY.ts} +52 -50
  26. package/dist/chunks/{manager-ui-HW3ZAEVK.ts.map → manager-ui-3CQU37XY.ts.map} +1 -1
  27. package/dist/chunks/{remote-selection-ui-AE6FOEXH.ts → remote-selection-ui-2V53UBHM.ts} +6 -6
  28. package/dist/chunks/{setup-switch-LJPEZONY.ts → setup-switch-WSKVGW7L.ts} +4 -4
  29. package/dist/chunks/{setup-wizard-FBX7RTZ6.ts → setup-wizard-FRIR2EOR.ts} +9 -9
  30. package/dist/chunks/{sync-inspection-TZ4EMSBN.ts → sync-inspection-CQDNC542.ts} +6 -6
  31. package/dist/chunks/{sync-operations-QIQ3G66S.ts → sync-operations-IF7LMWK6.ts} +4 -4
  32. package/dist/chunks/sync-state-store-TZE7XDV5.ts +23 -0
  33. package/dist/chunks/sync-state-store-TZE7XDV5.ts.map +7 -0
  34. package/dist/daemon/dist/build-id.json +1 -1
  35. package/dist/daemon/dist/cli.js +3 -2
  36. package/dist/daemon/dist/client.js +55 -14
  37. package/dist/daemon/dist/daemon-startup.js +2 -14
  38. package/dist/daemon/dist/daemon-upgrade-error.js +14 -0
  39. package/dist/daemon/dist/index.js +20 -3
  40. package/dist/daemon/package.json +1 -1
  41. package/dist/index.ts +278 -248
  42. package/dist/index.ts.map +2 -2
  43. package/docs/daemon-migration.md +2 -0
  44. package/package.json +2 -2
  45. package/src/daemon/client-debug.ts +2 -0
  46. package/src/daemon/pi-client.ts +60 -22
  47. package/src/sync/automatic-sync.ts +5 -3
  48. package/src/sync/debug-tool-execution.ts +66 -0
  49. package/src/sync/debug-tool.ts +8 -56
  50. package/src/sync/startup-check.ts +3 -1
  51. package/src/sync-extension.ts +252 -166
  52. package/dist/chunks/chunk-5T4ZOHYF.ts.map +0 -7
  53. package/dist/chunks/chunk-SPXEDJ2G.ts.map +0 -7
  54. /package/dist/chunks/{chunk-3XN4FR72.ts.map → chunk-4A34OGXY.ts.map} +0 -0
  55. /package/dist/chunks/{chunk-7NQ7SFZK.ts.map → chunk-5BE6LBDC.ts.map} +0 -0
  56. /package/dist/chunks/{chunk-JPTI4HFC.ts.map → chunk-AXN3B5KC.ts.map} +0 -0
  57. /package/dist/chunks/{chunk-N24HEZSA.ts.map → chunk-VERMBZGL.ts.map} +0 -0
  58. /package/dist/chunks/{chunk-LSIUAXE4.ts.map → chunk-WE3KJ7JS.ts.map} +0 -0
  59. /package/dist/chunks/{conflict-review-QI77P7KL.ts.map → conflict-review-HSERM245.ts.map} +0 -0
  60. /package/dist/chunks/{diff-review-SOLP33TQ.ts.map → diff-review-6IUIOYST.ts.map} +0 -0
  61. /package/dist/chunks/{diff-review-ILRZDQ4S.ts.map → diff-review-GB4NO53B.ts.map} +0 -0
  62. /package/dist/chunks/{file-selection-2H3J2HTX.ts.map → file-selection-DGC5UJVI.ts.map} +0 -0
  63. /package/dist/chunks/{manager-result-dispatcher-75FS46JP.ts.map → manager-result-dispatcher-6MOJPLIS.ts.map} +0 -0
  64. /package/dist/chunks/{remote-selection-ui-AE6FOEXH.ts.map → remote-selection-ui-2V53UBHM.ts.map} +0 -0
  65. /package/dist/chunks/{setup-switch-LJPEZONY.ts.map → setup-switch-WSKVGW7L.ts.map} +0 -0
  66. /package/dist/chunks/{setup-wizard-FBX7RTZ6.ts.map → setup-wizard-FRIR2EOR.ts.map} +0 -0
  67. /package/dist/chunks/{sync-inspection-TZ4EMSBN.ts.map → sync-inspection-CQDNC542.ts.map} +0 -0
  68. /package/dist/chunks/{sync-operations-QIQ3G66S.ts.map → sync-operations-IF7LMWK6.ts.map} +0 -0
@@ -5,25 +5,25 @@ import {
5
5
  showGitSetup,
6
6
  showS3Setup,
7
7
  showWebDavSetup
8
- } from "./chunk-JPTI4HFC.ts";
8
+ } from "./chunk-AXN3B5KC.ts";
9
+ import "./chunk-HFMGK6A6.ts";
10
+ import {
11
+ localConfigPath
12
+ } from "./chunk-IBXEM35O.ts";
13
+ import "./chunk-NXWHPVXR.ts";
9
14
  import {
10
15
  validateConfigName
11
16
  } from "./chunk-APZVJAEW.ts";
12
17
  import "./chunk-R7PN3KIY.ts";
18
+ import "./chunk-GELYN4UC.ts";
13
19
  import {
14
20
  throwIfAborted
15
21
  } from "./chunk-UMPA5S7X.ts";
22
+ import "./chunk-R3SAMXB6.ts";
16
23
  import "./chunk-VQTYTUBU.ts";
17
- import "./chunk-HFMGK6A6.ts";
18
- import "./chunk-NXWHPVXR.ts";
19
- import "./chunk-GELYN4UC.ts";
20
- import {
21
- localConfigPath
22
- } from "./chunk-IBXEM35O.ts";
23
24
  import {
24
25
  errorMessage
25
26
  } from "./chunk-6YKOHBSC.ts";
26
- import "./chunk-R3SAMXB6.ts";
27
27
  import {
28
28
  safeTerminalText
29
29
  } from "./chunk-AMJRUXFT.ts";
@@ -89,4 +89,4 @@ async function showSetupWizard(ctx, signal) {
89
89
  export {
90
90
  showSetupWizard
91
91
  };
92
- //# sourceMappingURL=setup-wizard-FBX7RTZ6.ts.map
92
+ //# sourceMappingURL=setup-wizard-FRIR2EOR.ts.map
@@ -1,15 +1,15 @@
1
1
  // @generated by scripts/build-runtime.mjs; do not edit.
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
- import {
4
- syncCheckConfigFingerprint
5
- } from "./chunk-LNZRNXNQ.ts";
6
3
  import {
7
4
  currentPiDaemonClient
8
- } from "./chunk-SPXEDJ2G.ts";
5
+ } from "./chunk-HCXPNKPU.ts";
9
6
  import "./chunk-H7VOTY5N.ts";
10
- import "./chunk-6YKOHBSC.ts";
11
7
  import "./chunk-R3SAMXB6.ts";
8
+ import "./chunk-6YKOHBSC.ts";
12
9
  import "./chunk-AMJRUXFT.ts";
10
+ import {
11
+ syncCheckConfigFingerprint
12
+ } from "./chunk-LNZRNXNQ.ts";
13
13
 
14
14
  // src/sync/sync-inspection.ts
15
15
  var inspectSync = async (config, _options, signal) => await currentPiDaemonClient().run(
@@ -20,4 +20,4 @@ var inspectSync = async (config, _options, signal) => await currentPiDaemonClien
20
20
  export {
21
21
  inspectSync
22
22
  };
23
- //# sourceMappingURL=sync-inspection-TZ4EMSBN.ts.map
23
+ //# sourceMappingURL=sync-inspection-CQDNC542.ts.map
@@ -2,10 +2,10 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  remoteOperation
5
- } from "./chunk-SPXEDJ2G.ts";
5
+ } from "./chunk-HCXPNKPU.ts";
6
6
  import "./chunk-H7VOTY5N.ts";
7
- import "./chunk-6YKOHBSC.ts";
8
7
  import "./chunk-R3SAMXB6.ts";
8
+ import "./chunk-6YKOHBSC.ts";
9
9
  import "./chunk-AMJRUXFT.ts";
10
10
 
11
11
  // src/sync/sync-operations.ts
@@ -27,7 +27,7 @@ async function rollback(ctx, options) {
27
27
  function diff(ctx, options) {
28
28
  if (ctx.mode !== "tui" || !ctx.hasUI) return remoteOperation(ctx, "diff", options).then(() => {
29
29
  });
30
- return Promise.all([import("./diff-review-SOLP33TQ.ts"), import("./diff-review-ILRZDQ4S.ts")]).then(
30
+ return Promise.all([import("./diff-review-6IUIOYST.ts"), import("./diff-review-GB4NO53B.ts")]).then(
31
31
  ([{ openDiffReview }, { showSyncDiffReview }]) => {
32
32
  options.signal?.throwIfAborted();
33
33
  return showSyncDiffReview(
@@ -49,4 +49,4 @@ export {
49
49
  rollback,
50
50
  syncBoth
51
51
  };
52
- //# sourceMappingURL=sync-operations-QIQ3G66S.ts.map
52
+ //# sourceMappingURL=sync-operations-IF7LMWK6.ts.map
@@ -0,0 +1,23 @@
1
+ // @generated by scripts/build-runtime.mjs; do not edit.
2
+ // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
+ import {
4
+ ensureStateDir,
5
+ lockPath,
6
+ readState,
7
+ readStateForConfig,
8
+ statePathForConfig,
9
+ syncStateFingerprint,
10
+ writeState,
11
+ writeStateForConfig
12
+ } from "./chunk-A43CJYG4.ts";
13
+ export {
14
+ ensureStateDir,
15
+ lockPath,
16
+ readState,
17
+ readStateForConfig,
18
+ statePathForConfig,
19
+ syncStateFingerprint,
20
+ writeState,
21
+ writeStateForConfig
22
+ };
23
+ //# sourceMappingURL=sync-state-store-TZE7XDV5.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1 +1 @@
1
- "83f08657a9031f4688ee5a922b53dee44e7c10809b27dfb65bf1ac91695a7315"
1
+ "00a2012761e53b860b9ac8d9ac0da8c64979559ed8e9e3ccf435913377445350"
@@ -3,8 +3,7 @@ import "./child-sdk.mjs";
3
3
  import { setTimeout as delay } from "node:timers/promises";
4
4
  import { DAEMON_BUILD_ID, DAEMON_BUILD_VERSION } from "./build-version.js";
5
5
  import { requestDaemon } from "./client-transport.js";
6
- import { DaemonUpgradeBlockedError, ensureDaemon, restartDaemon } from "./daemon-startup.js";
7
- import { inspectDaemonStatus } from "./daemon-status.js";
6
+ import { DaemonUpgradeBlockedError } from "./daemon-upgrade-error.js";
8
7
  import { privateDirectory, readIdentity, runtimePaths } from "./identity.js";
9
8
  import { openLifecycleLog } from "./lifecycle-log.js";
10
9
  async function retiredPolicyBlocker(root) {
@@ -112,11 +111,13 @@ export async function main(args) {
112
111
  return;
113
112
  }
114
113
  if (command === "start" || command === "restart") {
114
+ const { ensureDaemon, restartDaemon } = await import("./daemon-startup.js");
115
115
  const { identity } = await (command === "start" ? ensureDaemon(root) : restartDaemon(root));
116
116
  console.log(JSON.stringify({ running: true, root: identity.root, instance: identity.instance, pid: identity.pid }));
117
117
  return;
118
118
  }
119
119
  if (command === "status") {
120
+ const { inspectDaemonStatus } = await import("./daemon-status.js");
120
121
  const status = await inspectDaemonStatus(root);
121
122
  const retiredPolicy = await retiredPolicyBlocker(status.root);
122
123
  console.log(JSON.stringify({ ...status, ...(retiredPolicy ? { retiredPolicy } : {}) }));
@@ -1,13 +1,11 @@
1
1
  import { createHash, randomUUID } from "node:crypto";
2
2
  import { setTimeout as delay } from "node:timers/promises";
3
3
  import { DaemonError, requestDaemon } from "./client-transport.js";
4
- import { stopDaemonAfterForegroundQueueFailure } from "./daemon-recovery.js";
5
4
  import { sameDiffReviewBinding } from "./diff-review-binding.js";
6
5
  import { DIFF_REVIEW_REQUEST_MS, isDiffReviewId, parseDiffReviewInventory, readDiffReviewPreview, } from "./diff-review-protocol.js";
7
6
  import { isForegroundDirection, isForegroundQueueOutcome } from "./foreground-queue-outcome.js";
8
7
  import { canonicalRootGuard, readProcessBirth } from "./identity.js";
9
8
  import { withCleanup } from "./lifecycle.js";
10
- import { presentPagedReview, reviewScope } from "./paged-review.js";
11
9
  import { MAX_REVIEW_BYTES, OWNERSHIP_CLEANUP_REQUIRED, operationPrefix, REVIEW_PAGE_CHARS, record, UNKNOWN_JOB_RESULT, } from "./protocol.js";
12
10
  import { STATE_WAIT_FAILURE_LIMIT, stateWaitJobs, stateWaitResult } from "./state-wait-jobs.js";
13
11
  export { DaemonError, hello, requestDaemon } from "./client-transport.js";
@@ -490,11 +488,13 @@ export class DaemonConnection {
490
488
  });
491
489
  }
492
490
  canRecoverForeground(job) {
491
+ return !this.foregroundRecovery?.attempted && this.ownsForegroundRecovery(job);
492
+ }
493
+ ownsForegroundRecovery(job) {
493
494
  const target = this.foregroundRecovery;
494
495
  return (!!target &&
495
496
  target.job === job &&
496
497
  target.generation === this.facts.generation &&
497
- !target.attempted &&
498
498
  this.attached &&
499
499
  !this.closed &&
500
500
  !this.admitting &&
@@ -511,8 +511,18 @@ export class DaemonConnection {
511
511
  throw new Error("The current Pi session could not verify a completed transfer for daemon recovery.");
512
512
  target.assertRoot();
513
513
  target.attempted = true;
514
+ const facts = { ...this.facts };
515
+ const lifecycle = this.lifecycleRevision;
514
516
  const owned = AbortSignal.any([signal, this.controller.signal, AbortSignal.timeout(FOREGROUND_RECOVERY_MS)]);
515
- await stopDaemonAfterForegroundQueueFailure(this.paths, this.identity, { ...target, client: this.facts.id }, owned);
517
+ const { stopDaemonAfterForegroundQueueFailure } = await import("./daemon-recovery.js");
518
+ owned.throwIfAborted();
519
+ if (lifecycle !== this.lifecycleRevision ||
520
+ !sameDiffReviewBinding(facts, this.facts) ||
521
+ this.foregroundRecovery !== target ||
522
+ !this.ownsForegroundRecovery(job))
523
+ throw new Error("The current Pi session could not verify a completed transfer for daemon recovery.");
524
+ target.assertRoot();
525
+ await stopDaemonAfterForegroundQueueFailure(this.paths, this.identity, { ...target, client: facts.id }, owned);
516
526
  await this.closeLocal();
517
527
  target.assertRoot();
518
528
  }
@@ -584,7 +594,9 @@ export class DaemonConnection {
584
594
  this.uncertain = true;
585
595
  const controller = new AbortController();
586
596
  const foreground = this.pendingJobs.has(callback.job);
587
- const reviewGeneration = callback.review?.offer !== undefined ? this.facts.generation : undefined;
597
+ const reviewOwner = callback.review?.offer !== undefined
598
+ ? { facts: { ...this.facts }, lifecycle: this.lifecycleRevision }
599
+ : undefined;
588
600
  this.callbacks.set(callback.id, {
589
601
  controller,
590
602
  kind: callback.kind,
@@ -597,7 +609,9 @@ export class DaemonConnection {
597
609
  try {
598
610
  if ((this.uncertain || this.resumeUncertain) && callback.kind !== "queue-release")
599
611
  throw new Error("Client is draining uncertain work.");
600
- value = await this.performCallback(callback, controller.signal);
612
+ value = await (reviewOwner
613
+ ? this.performExactReview(callback, controller.signal, reviewOwner)
614
+ : this.performCallback(callback, controller.signal));
601
615
  }
602
616
  catch {
603
617
  failed = true;
@@ -611,10 +625,10 @@ export class DaemonConnection {
611
625
  }
612
626
  try {
613
627
  await requestDaemon(this.paths, this.identity, "answer", {
614
- client: this.facts.id,
628
+ client: reviewOwner?.facts.id ?? this.facts.id,
615
629
  id: callback.id,
616
- ...(reviewGeneration !== undefined ? { generation: reviewGeneration } : {}),
617
- ...(failed || (reviewGeneration !== undefined && controller.signal.aborted)
630
+ ...(reviewOwner ? { generation: reviewOwner.facts.generation } : {}),
631
+ ...(failed || (reviewOwner && !this.ownsExactReview(callback, controller.signal, reviewOwner))
618
632
  ? { error: "Client callback cancelled or failed." }
619
633
  : { value }),
620
634
  }, this.callbackIO.signal);
@@ -702,15 +716,42 @@ export class DaemonConnection {
702
716
  this.reportRelease(callback, foreground, state);
703
717
  }
704
718
  }
719
+ ownsExactReview(callback, signal, owner) {
720
+ return (!signal.aborted &&
721
+ !this.callbackIO.signal.aborted &&
722
+ owner.lifecycle === this.lifecycleRevision &&
723
+ !this.closed &&
724
+ !this.pausing &&
725
+ !this.disposing &&
726
+ !this.uncertain &&
727
+ this.contactResumeState === "idle" &&
728
+ this.contactState !== "expired" &&
729
+ this.contactState !== "inactive" &&
730
+ this.callbacks.get(callback.id)?.controller.signal === signal &&
731
+ sameDiffReviewBinding(owner.facts, this.facts));
732
+ }
733
+ async performExactReview(callback, signal, owner) {
734
+ const present = this.options.mergeReview;
735
+ if (!present)
736
+ throw new Error("Exact review offer requires an opted-in presenter.");
737
+ const owned = AbortSignal.any([signal, this.callbackIO.signal]);
738
+ const requireCurrent = () => {
739
+ owned.throwIfAborted();
740
+ if (!this.ownsExactReview(callback, signal, owner))
741
+ throw new Error("Exact review participant changed.");
742
+ };
743
+ owned.throwIfAborted();
744
+ const { presentPagedReview, reviewScope } = await import("./paged-review.js");
745
+ requireCurrent();
746
+ return presentPagedReview(reviewScope(this.identity, owner.facts, callback), callback, owned, present, (params, pageSignal) => {
747
+ requireCurrent();
748
+ return requestDaemon(this.paths, this.identity, "review-page", params, pageSignal);
749
+ });
750
+ }
705
751
  async performCallback(callback, signal) {
706
752
  const reference = callback.review;
707
753
  if (!reference)
708
754
  return this.options.callback(callback, signal);
709
- if (reference.offer !== undefined) {
710
- if (!this.options.mergeReview)
711
- throw new Error("Exact review offer requires an opted-in presenter.");
712
- return presentPagedReview(reviewScope(this.identity, this.facts, callback), callback, AbortSignal.any([signal, this.callbackIO.signal]), this.options.mergeReview, (params, owned) => requestDaemon(this.paths, this.identity, "review-page", params, owned));
713
- }
714
755
  if (callback.kind !== "merge-review" ||
715
756
  !record(callback.payload) ||
716
757
  !Number.isSafeInteger(reference.pages) ||
@@ -6,22 +6,10 @@ import lockfile from "proper-lockfile";
6
6
  import { gt } from "semver";
7
7
  import { DAEMON_BUILD_ID, DAEMON_BUILD_VERSION, readInstalledDaemonBuild } from "./build-version.js";
8
8
  import { DaemonError, hello, requestDaemon } from "./client-transport.js";
9
+ import { DaemonUpgradeBlockedError, upgradeBlockers } from "./daemon-upgrade-error.js";
9
10
  import { canonicalRootGuard, clearUpgradeOwner, daemonPaths, privateDirectory, processExists, processExited, readIdentity, readProcessBirth, readUpgradeOwner, recordUpgradeOwner, runtimePaths, upgradeRepairStarted, } from "./identity.js";
10
11
  import { OWNERSHIP_CLEANUP_REQUIRED, record } from "./protocol.js";
11
- const upgradeBlockers = {
12
- busy: "Daemon update deferred while sync work is active. Let it finish, then use /reload or retry the daemon CLI.",
13
- repair: "Daemon update blocked by uncertain consent or queue cleanup. Follow the daemon recovery guide before retrying.",
14
- unattended: "Review or revoke unattended Pi Sync permission before stopping or replacing the daemon.",
15
- legacy: "This older daemon does not support guarded upgrades. Let sync work finish, run restart from the intended daemon CLI, then /reload.",
16
- };
17
- export class DaemonUpgradeBlockedError extends Error {
18
- instance;
19
- constructor(instance, reason) {
20
- super(upgradeBlockers[reason]);
21
- this.instance = instance;
22
- this.name = "DaemonUpgradeBlockedError";
23
- }
24
- }
12
+ export { DaemonUpgradeBlockedError } from "./daemon-upgrade-error.js";
25
13
  function matchesBuild(version, id) {
26
14
  return version === DAEMON_BUILD_VERSION && id === DAEMON_BUILD_ID;
27
15
  }
@@ -0,0 +1,14 @@
1
+ export const upgradeBlockers = {
2
+ busy: "Daemon update deferred while sync work is active. Let it finish, then use /reload or retry the daemon CLI.",
3
+ repair: "Daemon update blocked by uncertain consent or queue cleanup. Follow the daemon recovery guide before retrying.",
4
+ unattended: "Review or revoke unattended Pi Sync permission before stopping or replacing the daemon.",
5
+ legacy: "This older daemon does not support guarded upgrades. Let sync work finish, run restart from the intended daemon CLI, then /reload.",
6
+ };
7
+ export class DaemonUpgradeBlockedError extends Error {
8
+ instance;
9
+ constructor(instance, reason) {
10
+ super(upgradeBlockers[reason]);
11
+ this.instance = instance;
12
+ this.name = "DaemonUpgradeBlockedError";
13
+ }
14
+ }
@@ -1,10 +1,27 @@
1
1
  export { DaemonConnection, DaemonError, ensureDaemon, findDaemon, requestDaemon, stopDaemon, waitForDaemonExit, } from "./client.js";
2
- export { inspectDaemonRecovery, stopDaemonForRecovery, } from "./daemon-recovery.js";
3
- export { DaemonUpgradeBlockedError } from "./daemon-startup.js";
4
- export { inspectDaemonStatus } from "./daemon-status.js";
2
+ export { DaemonUpgradeBlockedError } from "./daemon-upgrade-error.js";
5
3
  export { parseDiffReviewInventory } from "./diff-review-protocol.js";
6
4
  export { documentFingerprint } from "./document.js";
7
5
  export { isDestinationConflict } from "./foreground-transfer.js";
8
6
  export { modelSignature } from "./model-signature.js";
9
7
  export { MAX_SETTINGS_BYTES, OWNERSHIP_CLEANUP_REQUIRED, PROTOCOL_VERSION } from "./protocol.js";
10
8
  export { createSessionPresence } from "./session-presence.js";
9
+ export async function inspectDaemonStatus(root, signal) {
10
+ signal?.throwIfAborted();
11
+ const { inspectDaemonStatus } = await import("./daemon-status.js");
12
+ signal?.throwIfAborted();
13
+ return inspectDaemonStatus(root, signal);
14
+ }
15
+ export async function inspectDaemonRecovery(root, signal) {
16
+ signal?.throwIfAborted();
17
+ const { inspectDaemonRecovery } = await import("./daemon-recovery.js");
18
+ signal?.throwIfAborted();
19
+ return inspectDaemonRecovery(root, signal);
20
+ }
21
+ export async function stopDaemonForRecovery(target, signal) {
22
+ signal?.throwIfAborted();
23
+ const reviewed = { ...target };
24
+ const { stopDaemonForRecovery } = await import("./daemon-recovery.js");
25
+ signal?.throwIfAborted();
26
+ return stopDaemonForRecovery(reviewed, signal);
27
+ }
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.16.4"
2
+ "version": "0.16.5"
3
3
  }