@narumitw/pi-sync 0.68.1 → 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 +22 -0
- package/README.md +35 -21
- package/dist/chunks/{chunk-AYGMIMCV.ts → chunk-4KGDPLQ4.ts} +2 -2
- package/dist/chunks/chunk-4KGDPLQ4.ts.map +7 -0
- package/dist/chunks/{chunk-FR6A7ASZ.ts → chunk-EG6BUOUQ.ts} +3 -3
- package/dist/chunks/{chunk-WQXUZSY5.ts → chunk-EI2J5Z4Q.ts} +13 -6
- package/dist/chunks/chunk-EI2J5Z4Q.ts.map +7 -0
- package/dist/chunks/{chunk-BCDBT4X3.ts → chunk-GXB74FYB.ts} +4 -4
- package/dist/chunks/{chunk-J52GYZO6.ts → chunk-LNZRNXNQ.ts} +2 -4
- package/dist/chunks/{chunk-FQKWGVMA.ts → chunk-OWSKD5XG.ts} +10 -7
- package/dist/chunks/chunk-OWSKD5XG.ts.map +7 -0
- package/dist/chunks/{chunk-WCGLU526.ts → chunk-RXZVLBPU.ts} +3 -3
- package/dist/chunks/{chunk-KAIVTJIQ.ts → chunk-RZB2DPVU.ts} +2 -2
- package/dist/chunks/{chunk-335XTMMZ.ts → chunk-VQTYTUBU.ts} +24 -26
- package/dist/chunks/chunk-VQTYTUBU.ts.map +7 -0
- package/dist/chunks/{chunk-TLYT6HVI.ts → chunk-YX6DCQ7P.ts} +2 -2
- package/dist/chunks/{command-handler-5LDTCUJE.ts → command-handler-ZR26OSBX.ts} +39 -143
- package/dist/chunks/command-handler-ZR26OSBX.ts.map +7 -0
- package/dist/chunks/{conflict-review-SZ3AWTX6.ts → conflict-review-W5BCZIZG.ts} +2 -2
- package/dist/chunks/{file-selection-4BOQBXS7.ts → file-selection-STCIRKF6.ts} +3 -3
- package/dist/chunks/{manager-result-dispatcher-A4IWLS4J.ts → manager-result-dispatcher-MPLPDR2P.ts} +5 -5
- package/dist/chunks/{manager-ui-KHMCSLLV.ts → manager-ui-OMZOBGYT.ts} +99 -96
- package/dist/chunks/manager-ui-OMZOBGYT.ts.map +7 -0
- package/dist/chunks/{merge-review-LWMUE5IW.ts → merge-review-KTIQBRLL.ts} +2 -2
- package/dist/chunks/{remote-selection-ui-F6NJBQ3Y.ts → remote-selection-ui-CCHMCAHQ.ts} +4 -4
- package/dist/chunks/{setup-switch-7LMIRMZ7.ts → setup-switch-J3YLBB6N.ts} +4 -4
- package/dist/chunks/{setup-wizard-2NRPR433.ts → setup-wizard-J3YOR7BR.ts} +3 -4
- package/dist/chunks/{setup-wizard-2NRPR433.ts.map → setup-wizard-J3YOR7BR.ts.map} +1 -1
- package/dist/chunks/{sync-inspection-OTI4JDQ2.ts → sync-inspection-7OADBR57.ts} +3 -3
- package/dist/chunks/{sync-operations-ZUYJLWUN.ts → sync-operations-3K6WLPXY.ts} +2 -10
- package/dist/chunks/{sync-operations-ZUYJLWUN.ts.map → sync-operations-3K6WLPXY.ts.map} +2 -2
- package/dist/daemon/dist/build-id.json +1 -1
- package/dist/daemon/dist/daemon-debug.js +13 -6
- package/dist/daemon/dist/engine/backends/git/git-backend.js +1 -1
- package/dist/daemon/dist/engine/backends/s3/s3-backend.js +2 -2
- package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +67 -6
- package/dist/daemon/dist/engine/debug-check.js +59 -0
- package/dist/daemon/dist/engine/debug-log.js +100 -1
- package/dist/daemon/dist/engine/sync/directional-conflict.js +31 -0
- package/dist/daemon/dist/engine/sync/push-review.js +1 -1
- package/dist/daemon/dist/engine/sync/sync-error-guidance.js +6 -5
- package/dist/daemon/dist/engine/sync/sync-inspection.js +5 -1
- package/dist/daemon/dist/engine/sync/sync-mutations.js +40 -7
- package/dist/daemon/dist/engine/sync/sync-queries.js +99 -25
- package/dist/daemon/dist/engine/sync/sync-state.js +1 -1
- package/dist/daemon/dist/engine/ui/transfer-review.js +2 -3
- package/dist/daemon/dist/engine-service.js +100 -25
- package/dist/daemon/dist/foreground-transfer.js +10 -0
- package/dist/daemon/dist/index.js +1 -0
- package/dist/daemon/dist/server.js +17 -9
- package/dist/daemon/package.json +1 -1
- package/dist/index.ts +111 -10
- package/dist/index.ts.map +3 -3
- package/docs/daemon-migration.md +2 -2
- package/docs/tui-contract.md +7 -7
- package/package.json +7 -4
- package/skills/configure-pi-sync/SKILL.md +4 -7
- package/skills/configure-pi-sync/references/configuration.md +20 -19
- package/src/commands/command-execution.ts +36 -136
- package/src/commands/command-handler.ts +3 -3
- package/src/commands/command.ts +28 -26
- package/src/daemon/directional-recovery.ts +3 -1
- package/src/daemon/pi-client.ts +6 -0
- package/src/sync/debug-tool.ts +96 -0
- package/src/sync/startup-check.ts +1 -1
- package/src/sync/sync-operations.ts +0 -6
- package/src/sync-extension.ts +13 -1
- package/src/ui/cancellable-operation.ts +11 -4
- package/src/ui/manager-state.ts +13 -12
- package/src/ui/manager-ui.ts +96 -81
- package/src/ui/operation-dialogs.ts +1 -1
- package/src/ui/settings-ui.ts +2 -3
- package/src/ui/setup/webdav-ui.ts +1 -1
- package/dist/chunks/chunk-335XTMMZ.ts.map +0 -7
- package/dist/chunks/chunk-AYGMIMCV.ts.map +0 -7
- package/dist/chunks/chunk-ECYCNZOE.ts +0 -12
- package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
- package/dist/chunks/chunk-FQKWGVMA.ts.map +0 -7
- package/dist/chunks/chunk-WQXUZSY5.ts.map +0 -7
- package/dist/chunks/command-handler-5LDTCUJE.ts.map +0 -7
- package/dist/chunks/manager-ui-KHMCSLLV.ts.map +0 -7
- /package/dist/chunks/{chunk-FR6A7ASZ.ts.map → chunk-EG6BUOUQ.ts.map} +0 -0
- /package/dist/chunks/{chunk-BCDBT4X3.ts.map → chunk-GXB74FYB.ts.map} +0 -0
- /package/dist/chunks/{chunk-J52GYZO6.ts.map → chunk-LNZRNXNQ.ts.map} +0 -0
- /package/dist/chunks/{chunk-WCGLU526.ts.map → chunk-RXZVLBPU.ts.map} +0 -0
- /package/dist/chunks/{chunk-KAIVTJIQ.ts.map → chunk-RZB2DPVU.ts.map} +0 -0
- /package/dist/chunks/{chunk-TLYT6HVI.ts.map → chunk-YX6DCQ7P.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-SZ3AWTX6.ts.map → conflict-review-W5BCZIZG.ts.map} +0 -0
- /package/dist/chunks/{file-selection-4BOQBXS7.ts.map → file-selection-STCIRKF6.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-A4IWLS4J.ts.map → manager-result-dispatcher-MPLPDR2P.ts.map} +0 -0
- /package/dist/chunks/{merge-review-LWMUE5IW.ts.map → merge-review-KTIQBRLL.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-F6NJBQ3Y.ts.map → remote-selection-ui-CCHMCAHQ.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-7LMIRMZ7.ts.map → setup-switch-J3YLBB6N.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-OTI4JDQ2.ts.map → sync-inspection-7OADBR57.ts.map} +0 -0
|
@@ -68,14 +68,11 @@ Explain that **Autonomous sync** and **Continuous sync** are retired and that th
|
|
|
68
68
|
Inspect only the necessary local metadata and relevant non-secret configuration facts; do not expose raw settings, credentials, session contents, daemon records, journals, or backups in tool output or chat.
|
|
69
69
|
Do not ask the user to paste those contents or execute text copied from them.
|
|
70
70
|
|
|
71
|
-
For relevant startup
|
|
72
|
-
|
|
73
|
-
Parse the JSON lines locally, filter by `source` (`pi-sync` for the client, `pi-sync-daemon` for the daemon), and report only relevant non-secret events and outcomes, never raw log lines.
|
|
74
|
-
Missing records do not rule out a failure; do not enable Debug mode or start a transfer just to collect evidence.
|
|
71
|
+
For relevant startup or transfer symptoms, use `pi_sync_debug` with `latest` if the tool is available. It reads bounded summaries from the [private local log](references/configuration.md#shared-log) without contacting the daemon. Report only relevant outcomes, never raw log lines. Missing records do not rule out a failure; do not enable Debug mode or start a transfer just to collect evidence.
|
|
72
|
+
If the user requests a fresh comparison, use `pi_sync_debug` with `recheck` only when available. It reads the configured remote and returns a sanitized summary without a confirmation prompt. If it is unavailable, do not use another tool to make the read. Point the user to **View differences** for a manual file comparison.
|
|
75
73
|
|
|
76
74
|
Leave operations that Pi Sync requires the user to review in `/sync`, including initial setup, credential and destination changes, reviewed legacy path selection and policy changes, session opt-in, secret-scan bypass, enabling automatic behavior, upgrading the settings document to enable a [transfer size limit](references/configuration.md#transfer-size-limits), and remote policy publication.
|
|
77
75
|
Use the masked credential input in Pi; do not infer transfer or model consent from a settings edit.
|
|
78
|
-
Do not start sync, run
|
|
76
|
+
Do not start sync, run backend/network commands, remove locks or recovery evidence, or bypass scan checks. Leave any WebDAV history repair to the user in **/sync → History**.
|
|
79
77
|
|
|
80
|
-
Report what changed or what was verified
|
|
81
|
-
State that no sync or remote connectivity check was performed; do not claim a live runtime update without evidence.
|
|
78
|
+
Report what changed or what was verified, whether anything remains uncertain, and the next step if blocked. Distinguish local evidence from a confirmed remote comparison. Do not claim a live runtime update without evidence.
|
|
@@ -79,13 +79,13 @@ Escape closes the screen without undoing successful saves.
|
|
|
79
79
|
Complex values retain their input/review flows.
|
|
80
80
|
This navigation change does not alter schema, defaults, automatic-sync behavior, or explicit opt-ins.
|
|
81
81
|
|
|
82
|
-
The main menu shows cached status separately from transfer, inspection, and management actions. **
|
|
83
|
-
**Last applied** shows
|
|
82
|
+
The main menu shows cached status separately from transfer, inspection, and management actions. **View differences** (`/sync diff`) reads current file differences only when selected. It works with Debug mode off and is not a comparison against the last sync.
|
|
83
|
+
**Last applied snapshot** shows an ID, not an application time. The menu shortens long IDs; **History** shows the full IDs.
|
|
84
84
|
See the [TUI behavior contract](https://github.com/narumiruna/pi-extensions/blob/main/packages/pi-sync/docs/tui-contract.md) for scopes and transfer branches.
|
|
85
85
|
|
|
86
86
|
RPC reports the manual settings path and offers the existing setup/connection catalog dialogs, not the TUI preference or masked-credential editors.
|
|
87
87
|
Print/JSON do not support `/sync`; use the private settings file directly.
|
|
88
|
-
|
|
88
|
+
Use `/sync help` to list supported commands.
|
|
89
89
|
|
|
90
90
|
### Complete version 3 example
|
|
91
91
|
|
|
@@ -192,7 +192,7 @@ The setting still permits automatic shutdown pushes of selected content when `se
|
|
|
192
192
|
Reload skips shutdown push.
|
|
193
193
|
Settings changes apply to subsequent operations; changing this setting does not schedule another startup check until the next session start.
|
|
194
194
|
Foreground `/sync` cancels a pending check before opening Settings.
|
|
195
|
-
The check deadline is 30 seconds plus bounded cleanup
|
|
195
|
+
The check deadline is 30 seconds plus bounded cleanup. This one-shot policy has no polling. For a fresh baseline-relative comparison, ask Pi to recheck in [Debug mode](#debug-mode).
|
|
196
196
|
See [Background startup checks](https://github.com/narumiruna/pi-extensions/blob/main/packages/pi-sync/README.md#background-startup-checks) for recovery and Git cache exceptions.
|
|
197
197
|
|
|
198
198
|
New TUI setups recommend **Selected paths**: Recommended includes the nine non-session Pi roots below, and Minimal includes only `settings.json` and `AGENTS.md`. Agent-directory scope is an explicit alternative.
|
|
@@ -236,7 +236,7 @@ This is not permission to sync, change retry policy, or erase recovery evidence.
|
|
|
236
236
|
Retry and blocked states keep a short reason: `temp` (temporary service/network failure), `busy` (lock contention), `stale` (changed evidence), `auth` (authentication), `storage` (local storage), `review` (safety barrier), `model` (resolver/model failure or exhausted candidate attempts), `limit` (request-window allowance), or `unknown` (unclassified failure).
|
|
237
237
|
Settings or private-state repair uses `repair`.
|
|
238
238
|
A request-window limit is not a currency budget; exhausted attempts for one candidate remain a model block, not a timer-based allowance reset.
|
|
239
|
-
Use the
|
|
239
|
+
Use the manager and [local troubleshooting](#local-troubleshooting) to inspect recovery requirements rather than treating a short marker as a complete diagnosis.
|
|
240
240
|
|
|
241
241
|
<a id="debug-startup-timings"></a>
|
|
242
242
|
|
|
@@ -244,7 +244,13 @@ Use the existing manager and **Check remote status** guidance to inspect recover
|
|
|
244
244
|
|
|
245
245
|
The top-level user setting `debug` is an optional boolean and defaults to `false` for every setup. Use **/sync → Settings → Debug mode** or edit `<getAgentDir()>/pi-sync.json` (normally `~/.pi/agent/pi-sync.json`). UI changes save immediately through the existing ordered, atomic settings writer. There is no project or environment override.
|
|
246
246
|
|
|
247
|
-
Pi uses the saved value from session start, including `/reload`, new, resume, and fork, for client logging and
|
|
247
|
+
Pi uses the saved value from session start, including `/reload`, new, resume, and fork, for client logging, timing display, and `pi_sync_debug` availability in TUI and RPC. The daemon uses the agent directory's validated setting for file logging, not a connected client's value. It applies changes at the next applicable owner or job boundary without a restart. A missing or false `debug` value does not enable logging; the daemon can skip records when it cannot validate settings. Turning on Debug mode does not start a new check or transfer, or grant permission for work after Pi exits.
|
|
248
|
+
|
|
249
|
+
#### Ask Pi to explain a check
|
|
250
|
+
|
|
251
|
+
`pi_sync_debug` is available only in TUI and RPC sessions started or reloaded with Debug mode on, subject to Pi's tool allowlist. `latest` reads the most recent matching summary within the last 64 KiB of the private log. `recheck` reads the current setup's remote storage and returns a sanitized summary without prompting. The tool does not publish, apply, test writes, or repair History.
|
|
252
|
+
|
|
253
|
+
A summary can include times, where the check came from, whether a previous sync was recorded, which side changed, whether file selections agree, file counts, and fixed failure categories. Stale, unavailable, and not-run results are not evidence of equality. Results omit secrets, setup names and fingerprints, addresses, paths, device names, snapshot IDs, content, and raw errors or log lines.
|
|
248
254
|
|
|
249
255
|
#### Shared log
|
|
250
256
|
|
|
@@ -284,17 +290,12 @@ The global `skipSecretScan` setting accepts a boolean and defaults to `false`, i
|
|
|
284
290
|
Set it through **/sync → Settings → Skip secret scan**; changes are saved immediately and apply to subsequent pushes for every sync setup, including automatic pushes.
|
|
285
291
|
When `true`, pushes skip the local secret scan; other safety checks and confirmations remain unchanged.
|
|
286
292
|
Enable it only after reviewing the destination and selected content because files containing secrets can be uploaded.
|
|
287
|
-
`/sync doctor` still scans and reports possible secrets regardless of this setting.
|
|
288
293
|
|
|
289
294
|
### Diagnostics
|
|
290
295
|
|
|
291
|
-
**/sync →
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
`NoSuchKey` indicates no snapshot at the path; `NoSuchBucket` indicates a missing bucket; other 404 responses cannot distinguish the two.
|
|
295
|
-
Authentication and transport failures give credentials/permissions or address/network guidance.
|
|
296
|
-
Git reads remote snapshots and checks its local cache; write access is not tested.
|
|
297
|
-
WebDAV retains its isolated conditional-write/cleanup probe and repair of a missing active-snapshot history entry.
|
|
296
|
+
Use **/sync → Settings** to review sync setups and storage connections. Use **View differences** to compare files without transferring them, or ask Pi to use the [Debug tool](#ask-pi-to-explain-a-check) for a baseline-relative check. Neither read proves that storage accepts writes. Push keeps its existing safety checks, including temporary conditional-write probes on WebDAV and S3/R2.
|
|
297
|
+
|
|
298
|
+
If a WebDAV publication activated a snapshot but left its entry missing, open **/sync → History** and select **Repair active snapshot history** when offered. The confirmation names the setup, destination, and snapshot. After approval, Pi Sync runs an isolated conditional-write probe and cleans it up, then adds the missing entry if it is still needed and safe. The active snapshot and local files stay unchanged. This action is separate from diagnostics and is never automatic.
|
|
298
299
|
|
|
299
300
|
### Local troubleshooting
|
|
300
301
|
|
|
@@ -306,9 +307,9 @@ Use the first concrete error, not a generic recovery hint appended to it. Start
|
|
|
306
307
|
| **Agent directory changed or has an unsafe filesystem layout** | The local scan could not establish a stable filesystem view. Use file metadata to check the agent root, Pi's `settings.json`, the effective session directory (including any `--session-dir` override), and in-scope paths. Symlinks in the session directory path and hard-linked candidate files can trigger this error; ordinary symlinks encountered in the directory scan are skipped. Check whether another Pi process or editor is changing files during the scan. Do not change synchronization settings unless the evidence identifies a relevant setting; this error alone does not identify a path or field. |
|
|
307
308
|
| **Transfer blocked by size limits** | Check the reported paths and byte counts. Use `/sync diff`, then narrow the selection or review a different source. See [transfer size limits](#transfer-size-limits). |
|
|
308
309
|
| **Malformed or unsupported settings** | Check the canonical path and documented version and field constraints. Preserve the original private bytes and follow [settings recovery](#unsupported-old-settings-and-recovery); do not replace the document with defaults. |
|
|
309
|
-
| **Backend access or publication failure** | Use the reported error class to distinguish credentials, a missing location, transport, and publication safety. A 404 alone does not identify which remote resource is missing. If local checks are insufficient, explain the
|
|
310
|
+
| **Backend access or publication failure** | Use the reported error class to distinguish credentials, a missing location, transport, and publication safety. A 404 alone does not identify which remote resource is missing. If local checks are insufficient, explain the [read and recovery options](#diagnostics). Do not treat a successful read as proof of write access. |
|
|
310
311
|
|
|
311
|
-
A local check does not verify remote connectivity or permissions.
|
|
312
|
+
A local check does not verify remote connectivity or permissions. A fresh comparison can also stop at a local scan error before contacting storage.
|
|
312
313
|
|
|
313
314
|
### Retired ignore-file policy
|
|
314
315
|
|
|
@@ -759,7 +760,7 @@ Keep the directory as private evidence; do not delete it to repair a transfer.
|
|
|
759
760
|
|
|
760
761
|
The existing raw status key shows waiting, checking/syncing, scheduled retry, another local owner, or a stable blocked reason.
|
|
761
762
|
A compatible Statusline uses the [quiet presentation described above](#status-display); normal hidden standby does not mean monitoring or another owner's work has stopped.
|
|
762
|
-
|
|
763
|
+
The manager shows cached observations and safe next actions; use `/sync daemon status` for current daemon ownership.
|
|
763
764
|
Status also shows normalized rolling-window usage, the next window allowance, exhausted-candidate counts, serialized accounting bytes/capacity and on-disk bytes.
|
|
764
765
|
Window allowance is not dispatch permission: candidate, capacity, ownership and safety checks still apply.
|
|
765
766
|
Status normalization affects only the detached read; it does not expire durable calls, reserve requests, create private directories or reset limits.
|
|
@@ -863,7 +864,7 @@ Older codecs refuse version-3 partial snapshots and older settings readers refus
|
|
|
863
864
|
`/sync conflicts` (also the conditional main **Review unresolved conflicts** action) shows private versions only when requested, in TUI or paginated RPC.
|
|
864
865
|
It rejects confirmation/force bypass flags, reviews an entire group, then separately asks for local or remote authority.
|
|
865
866
|
It revalidates the reviewed artifact fingerprint, group versions, baseline, configuration, ownership and current observed head before apply; stale/cancelled review performs no transfer.
|
|
866
|
-
The manager always reports unresolved groups and the observed head separately from Last applied
|
|
867
|
+
The manager always reports unresolved groups and the observed head separately from **Last applied snapshot**.
|
|
867
868
|
Repeated unchanged conflicts retain one stable opaque identity rather than creating more evidence or modal reviews.
|
|
868
869
|
|
|
869
870
|
Artifacts are private immutable records below denied state storage with a 192 MiB/record cap; accepted ancestor records use the same bound, and actual content strategies have smaller limits.
|
|
@@ -889,7 +890,7 @@ Recovery:
|
|
|
889
890
|
1. retain the old file byte-for-byte;
|
|
890
891
|
2. move it aside manually;
|
|
891
892
|
3. create a new version 3 document or run the setup manager;
|
|
892
|
-
4.
|
|
893
|
+
4. review **Storage location** in **/sync → Settings**, inspect file differences with `/sync diff`, and review the first pull or push;
|
|
893
894
|
5. restore the retained file and a compatible older package only if rolling back.
|
|
894
895
|
|
|
895
896
|
If your processes reject a newer settings version, keep the document and use compatible Pi Sync and daemon builds. In particular, [clearing transfer size limits](#transfer-size-limits) never downgrades version 9. Do not use the recovery steps above to replace a newer document.
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import type { ExtensionCommandContext, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { isDestinationConflict } from "@narumitw/pi-sync-daemon";
|
|
2
3
|
import { showDaemonStatus } from "../daemon/daemon-status-ui.js";
|
|
3
4
|
import { CompletedDirectionalRecoveryError } from "../daemon/directional-recovery.js";
|
|
4
5
|
import { type PiDaemonClient, piDaemonClient, remoteOperation } from "../daemon/pi-client.js";
|
|
5
|
-
import { loadSettingsConfig, sessionTokenWarnings, syncSessionsWarnings } from "../settings/config.js";
|
|
6
6
|
import { activeLocalConfigPath, createLocalConfigDocument, localConfigPath } from "../settings/config-file.js";
|
|
7
7
|
import { localConfigTemplate, readLocalConfigObject } from "../settings/settings-store.js";
|
|
8
|
-
import type { AnySyncConfig } from "../settings/settings-types.js";
|
|
9
8
|
import { throwIfAborted } from "../sync/signals.js";
|
|
10
9
|
import { syncErrorGuidance } from "../sync/sync-error-guidance.js";
|
|
11
10
|
import { errorMessage, isSyncDecisionRequiredError, SetupPullRequiresUiError } from "../sync/sync-errors.js";
|
|
12
11
|
import type { SyncLoaders } from "../sync/sync-loaders.js";
|
|
13
|
-
import { RemoteSelectionMismatchError
|
|
14
|
-
import {
|
|
15
|
-
import type { RunRouteResult } from "../ui/cancellable-operation.js";
|
|
12
|
+
import { RemoteSelectionMismatchError } from "../sync/sync-policy.js";
|
|
13
|
+
import type { DirectionalIntent, RunRouteResult } from "../ui/cancellable-operation.js";
|
|
16
14
|
import { trackOperationDialogs } from "../ui/operation-dialogs.js";
|
|
17
|
-
import { startupTransferSummary } from "../ui/sync-behavior.js";
|
|
18
15
|
import { setSyncStatus } from "../ui/sync-status.js";
|
|
19
16
|
import { safeTerminalText } from "../ui/terminal-text.js";
|
|
20
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
parseOptions,
|
|
19
|
+
resolveSyncCommand,
|
|
20
|
+
retiredSyncCommandGuidance,
|
|
21
|
+
splitArgs,
|
|
22
|
+
usage,
|
|
23
|
+
validateCommandOptions,
|
|
24
|
+
} from "./command.js";
|
|
21
25
|
import type { CommandOptions } from "./command-types.js";
|
|
22
26
|
|
|
23
27
|
export async function executeRecoveryCommand(
|
|
@@ -75,26 +79,23 @@ export async function executeCommand(
|
|
|
75
79
|
setup?: string,
|
|
76
80
|
onDialog?: (active: boolean) => void,
|
|
77
81
|
retryRefusal = false,
|
|
78
|
-
|
|
82
|
+
directional?: DirectionalIntent,
|
|
79
83
|
): Promise<RunRouteResult> {
|
|
80
84
|
ctx = trackOperationDialogs(ctx, onDialog);
|
|
81
85
|
try {
|
|
82
|
-
const directionalClient =
|
|
86
|
+
const directionalClient = directional === undefined ? undefined : piDaemonClient(ctx);
|
|
83
87
|
const command = await resolveSyncCommand(rawArgs, ctx);
|
|
84
88
|
if (signal?.aborted || !command) return { kind: "completed" };
|
|
85
89
|
const { subcommand, rest } = command;
|
|
86
|
-
|
|
90
|
+
const retired = retiredSyncCommandGuidance(subcommand);
|
|
91
|
+
if (retired) {
|
|
92
|
+
ctx.ui.notify(retired, "warning");
|
|
93
|
+
return { kind: "failed" };
|
|
94
|
+
}
|
|
95
|
+
if (directionalClient && directional) {
|
|
87
96
|
if ((subcommand !== "push" && subcommand !== "pull") || rest.length || !setup || retryRefusal)
|
|
88
97
|
throw new Error("Invalid directional action.");
|
|
89
|
-
return await runDirectionalAction(
|
|
90
|
-
directionalClient,
|
|
91
|
-
ctx,
|
|
92
|
-
subcommand,
|
|
93
|
-
setup,
|
|
94
|
-
directionalFingerprint,
|
|
95
|
-
signal,
|
|
96
|
-
onCommit,
|
|
97
|
-
);
|
|
98
|
+
return await runDirectionalAction(directionalClient, ctx, subcommand, setup, directional, signal, onCommit);
|
|
98
99
|
}
|
|
99
100
|
const options = parseOptions(rest);
|
|
100
101
|
if (setup !== undefined) options.setup = setup;
|
|
@@ -146,21 +147,12 @@ export async function executeCommand(
|
|
|
146
147
|
case "init":
|
|
147
148
|
await initConfig(ctx, signal);
|
|
148
149
|
return { kind: "completed" };
|
|
149
|
-
case "config":
|
|
150
|
-
await showConfig(ctx, options);
|
|
151
|
-
return { kind: "completed" };
|
|
152
150
|
case "files": {
|
|
153
151
|
const { showFileSelection } = await import("../ui/file-selection.js");
|
|
154
152
|
throwIfAborted(options.signal);
|
|
155
153
|
await showFileSelection(ctx, options.setup, options.signal);
|
|
156
154
|
return { kind: "completed" };
|
|
157
155
|
}
|
|
158
|
-
case "status": {
|
|
159
|
-
const operations = await loaders.operations();
|
|
160
|
-
throwIfAborted(options.signal);
|
|
161
|
-
await operations.status(ctx, options);
|
|
162
|
-
return { kind: "completed" };
|
|
163
|
-
}
|
|
164
156
|
case "diff": {
|
|
165
157
|
const operations = await loaders.operations();
|
|
166
158
|
throwIfAborted(options.signal);
|
|
@@ -173,12 +165,6 @@ export async function executeCommand(
|
|
|
173
165
|
await showConflicts(ctx, options);
|
|
174
166
|
return { kind: "completed" };
|
|
175
167
|
}
|
|
176
|
-
case "doctor": {
|
|
177
|
-
const operations = await loaders.operations();
|
|
178
|
-
throwIfAborted(options.signal);
|
|
179
|
-
await operations.doctor(ctx, options);
|
|
180
|
-
return { kind: "completed" };
|
|
181
|
-
}
|
|
182
168
|
case "push": {
|
|
183
169
|
const operations = await loaders.operations();
|
|
184
170
|
throwIfAborted(options.signal);
|
|
@@ -222,7 +208,7 @@ export async function executeCommand(
|
|
|
222
208
|
} catch (error) {
|
|
223
209
|
if (signal?.aborted) return { kind: "failed" };
|
|
224
210
|
setSyncStatus(ctx, undefined);
|
|
225
|
-
if (
|
|
211
|
+
if (directional) {
|
|
226
212
|
ctx.ui.notify(safeTerminalText(errorMessage(error)).slice(0, 1200), "error");
|
|
227
213
|
return { kind: "failed" };
|
|
228
214
|
}
|
|
@@ -243,26 +229,32 @@ async function runDirectionalAction(
|
|
|
243
229
|
ctx: ExtensionCommandContext,
|
|
244
230
|
direction: "push" | "pull",
|
|
245
231
|
setup: string,
|
|
246
|
-
|
|
232
|
+
directional: DirectionalIntent,
|
|
247
233
|
signal: AbortSignal | undefined,
|
|
248
234
|
onCommit: (() => void) | undefined,
|
|
249
235
|
): Promise<RunRouteResult> {
|
|
250
236
|
try {
|
|
251
237
|
const operation = `${direction}.foreground`;
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
238
|
+
const result = await client.run(operation, { setup, ...directional }, signal, ctx, onCommit);
|
|
239
|
+
if (!client.canReportDirectionalResult()) return { kind: "failed" };
|
|
240
|
+
if (
|
|
241
|
+
signal?.aborted &&
|
|
242
|
+
!(result && typeof result === "object" && "outcome" in result && result.outcome === "applied")
|
|
243
|
+
)
|
|
257
244
|
return { kind: "failed" };
|
|
245
|
+
if (directional.intent === "reject-conflicts" && isDestinationConflict(result))
|
|
246
|
+
return { kind: "destination-conflict" };
|
|
258
247
|
if (
|
|
259
|
-
|
|
248
|
+
typeof result !== "object" ||
|
|
249
|
+
result === null ||
|
|
250
|
+
!("outcome" in result) ||
|
|
260
251
|
(result.outcome !== "applied" && result.outcome !== "cancelled") ||
|
|
261
|
-
(
|
|
252
|
+
("message" in result && typeof result.message !== "string")
|
|
262
253
|
) {
|
|
263
254
|
throw new Error("Invalid result from directional synchronization.");
|
|
264
255
|
}
|
|
265
|
-
if (
|
|
256
|
+
if ("message" in result && typeof result.message === "string" && result.message)
|
|
257
|
+
ctx.ui.notify(safeTerminalText(result.message), "info");
|
|
266
258
|
return signal?.aborted ? { kind: "failed" } : { kind: "completed", outcome: result.outcome };
|
|
267
259
|
} catch (error) {
|
|
268
260
|
const completed = error instanceof CompletedDirectionalRecoveryError;
|
|
@@ -306,95 +298,3 @@ async function initConfig(ctx: ExtensionCommandContext, signal?: AbortSignal) {
|
|
|
306
298
|
throwIfAborted(signal);
|
|
307
299
|
ctx.ui.notify(`Created ${configPath}. Add a storage connection and sync setup before syncing.`, "info");
|
|
308
300
|
}
|
|
309
|
-
|
|
310
|
-
async function showConfig(ctx: ExtensionCommandContext, options: CommandOptions) {
|
|
311
|
-
const config = await loadSettingsConfig(options.setup);
|
|
312
|
-
throwIfAborted(options.signal);
|
|
313
|
-
const warnings = [
|
|
314
|
-
...(config.backend.type === "s3" ? sessionTokenWarnings(config.backend.profile) : []),
|
|
315
|
-
...syncSessionsWarnings(config),
|
|
316
|
-
];
|
|
317
|
-
const storageLines = configStorageLines(config);
|
|
318
|
-
ctx.ui.notify(
|
|
319
|
-
[
|
|
320
|
-
"pi-sync config:",
|
|
321
|
-
`sync setup: ${config.setupName}`,
|
|
322
|
-
`storage connection: ${config.connectionName}`,
|
|
323
|
-
...storageLines,
|
|
324
|
-
`storage path: ${config.storagePath}`,
|
|
325
|
-
`automatic sync: ${automaticSyncSummary(config.automatic)}`,
|
|
326
|
-
`settings field merge: ${config.mergeSettings ? "On" : "Off"}`,
|
|
327
|
-
`machine-local settings.json fields: ${(config.localFields ?? []).map(safeTerminalText).join(", ") || "none"}`,
|
|
328
|
-
`startup transfer: ${startupTransferSummary(config)}`,
|
|
329
|
-
"Autonomous sync and Continuous sync are retired. Saved legacy flags have no effect.",
|
|
330
|
-
config.scope ? "sync scope: Pi agent directory" : `included content: ${config.include.join(", ") || "none"}`,
|
|
331
|
-
...(config.scope
|
|
332
|
-
? [
|
|
333
|
-
`excluded paths: ${config.exclude?.map(safeTerminalText).join(", ") || "none"}`,
|
|
334
|
-
`re-included paths: ${config.reinclude?.map(safeTerminalText).join(", ") || "none"}`,
|
|
335
|
-
]
|
|
336
|
-
: []),
|
|
337
|
-
`sessions: ${syncSessionsSelected(config) ? "included" : "not included"}`,
|
|
338
|
-
`settings file: ${localConfigPath()}`,
|
|
339
|
-
...warnings,
|
|
340
|
-
].join("\n"),
|
|
341
|
-
warnings.length > 0 ? "warning" : "info",
|
|
342
|
-
);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
function configStorageLines(config: AnySyncConfig) {
|
|
346
|
-
switch (config.backend.type) {
|
|
347
|
-
case "git":
|
|
348
|
-
return [
|
|
349
|
-
"kind: git",
|
|
350
|
-
`remote: ${displayGitRemote(config.backend.profile.remote)}`,
|
|
351
|
-
"authentication: existing Git/SSH credentials (not stored)",
|
|
352
|
-
`branch: ${config.backend.destination.branch}`,
|
|
353
|
-
];
|
|
354
|
-
case "webdav":
|
|
355
|
-
return [
|
|
356
|
-
"kind: webdav",
|
|
357
|
-
`url: ${displayWebDavUrl(config.backend.profile.url, config.backend.profile.username)}`,
|
|
358
|
-
"username: configured (value hidden)",
|
|
359
|
-
"password: configured",
|
|
360
|
-
];
|
|
361
|
-
case "s3":
|
|
362
|
-
return [
|
|
363
|
-
"kind: s3",
|
|
364
|
-
`endpoint: ${config.backend.profile.endpoint}`,
|
|
365
|
-
`bucket: ${config.backend.destination.bucket}`,
|
|
366
|
-
`region: ${config.backend.profile.region}`,
|
|
367
|
-
"access key id: configured",
|
|
368
|
-
"secret access key: configured",
|
|
369
|
-
`session token: ${config.backend.profile.sessionToken ? "configured" : "not configured"}`,
|
|
370
|
-
];
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
function displayGitRemote(value: string | undefined) {
|
|
375
|
-
if (!value) return "missing";
|
|
376
|
-
try {
|
|
377
|
-
const url = new URL(value);
|
|
378
|
-
url.username = "";
|
|
379
|
-
url.password = "";
|
|
380
|
-
url.search = "";
|
|
381
|
-
url.hash = "";
|
|
382
|
-
return url.toString();
|
|
383
|
-
} catch {
|
|
384
|
-
return value.replace(/^(?:[^@\s]+@)?(?<host>[^:]+):.+$/u, "$<host>:…");
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function displayWebDavUrl(value: string | undefined, username: string | undefined) {
|
|
389
|
-
if (!value) return "missing";
|
|
390
|
-
try {
|
|
391
|
-
const url = new URL(value);
|
|
392
|
-
url.username = "";
|
|
393
|
-
url.password = "";
|
|
394
|
-
url.search = "";
|
|
395
|
-
url.hash = "";
|
|
396
|
-
return username ? `${url.origin}/…` : `${url.origin}${url.pathname}`;
|
|
397
|
-
} catch {
|
|
398
|
-
return "invalid (value hidden)";
|
|
399
|
-
}
|
|
400
|
-
}
|
|
@@ -5,7 +5,7 @@ import { combineSignals } from "../sync/signals.js";
|
|
|
5
5
|
import { errorMessage } from "../sync/sync-errors.js";
|
|
6
6
|
import type { SyncLoaders } from "../sync/sync-loaders.js";
|
|
7
7
|
import { formatRemoteSelectionMismatch } from "../sync/sync-policy.js";
|
|
8
|
-
import type { RunRouteResult } from "../ui/cancellable-operation.js";
|
|
8
|
+
import type { DirectionalIntent, RunRouteResult } from "../ui/cancellable-operation.js";
|
|
9
9
|
import {
|
|
10
10
|
observationMatchesConfig,
|
|
11
11
|
type SyncAttentionController,
|
|
@@ -39,7 +39,7 @@ export async function handleCommand(
|
|
|
39
39
|
target?: string,
|
|
40
40
|
onDialog?: (active: boolean) => void,
|
|
41
41
|
retryRefusal = false,
|
|
42
|
-
|
|
42
|
+
directional?: DirectionalIntent,
|
|
43
43
|
) => {
|
|
44
44
|
const [command, ...args] = splitArgs(route);
|
|
45
45
|
if (command === "sync" && !retryRefusal) {
|
|
@@ -60,7 +60,7 @@ export async function handleCommand(
|
|
|
60
60
|
target,
|
|
61
61
|
onDialog,
|
|
62
62
|
retryRefusal,
|
|
63
|
-
|
|
63
|
+
directional,
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
66
|
if (!rawArgs.trim()) {
|
package/src/commands/command.ts
CHANGED
|
@@ -10,12 +10,9 @@ export const SYNC_COMMANDS = [
|
|
|
10
10
|
{ name: "help", description: "Show command usage" },
|
|
11
11
|
{ name: "use", description: "Switch the current sync setup", usageSuffix: " <setup>" },
|
|
12
12
|
{ name: "init", description: "Create local config template" },
|
|
13
|
-
{ name: "config", description: "Show resolved configuration" },
|
|
14
13
|
{ name: "files", description: "Choose included content" },
|
|
15
|
-
{ name: "status", description: "Show sync status" },
|
|
16
14
|
{ name: "diff", description: "Show local/remote diff" },
|
|
17
15
|
{ name: "conflicts", description: "Review private unresolved conflict groups" },
|
|
18
|
-
{ name: "doctor", description: "Check config, secrets, and lock state" },
|
|
19
16
|
{
|
|
20
17
|
name: "daemon",
|
|
21
18
|
description: "Review service handover and unattended permission",
|
|
@@ -48,12 +45,9 @@ const SETUP_FLAG_COMPLETION = {
|
|
|
48
45
|
description: "Address a sync setup without switching",
|
|
49
46
|
} as const;
|
|
50
47
|
const SYNC_FLAG_COMPLETIONS: Record<string, readonly CommandArgumentCompletion[]> = {
|
|
51
|
-
config: [SETUP_FLAG_COMPLETION],
|
|
52
48
|
files: [SETUP_FLAG_COMPLETION],
|
|
53
|
-
status: [SETUP_FLAG_COMPLETION],
|
|
54
49
|
diff: [SETUP_FLAG_COMPLETION],
|
|
55
50
|
conflicts: [SETUP_FLAG_COMPLETION],
|
|
56
|
-
doctor: [SETUP_FLAG_COMPLETION],
|
|
57
51
|
push: [
|
|
58
52
|
...YES_FLAG_COMPLETIONS,
|
|
59
53
|
{ value: "--force", label: "--force", description: "Overwrite visible remote changes" },
|
|
@@ -75,6 +69,10 @@ const SYNC_FLAG_COMPLETIONS: Record<string, readonly CommandArgumentCompletion[]
|
|
|
75
69
|
unlock: [{ value: "--stale", label: "--stale", description: "Remove only a stale lock" }],
|
|
76
70
|
};
|
|
77
71
|
|
|
72
|
+
function syncFlagCompletions(command: string) {
|
|
73
|
+
return Object.hasOwn(SYNC_FLAG_COMPLETIONS, command) ? SYNC_FLAG_COMPLETIONS[command] : undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
78
76
|
export function splitArgs(input: string) {
|
|
79
77
|
return input.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g)?.map((arg) => arg.replace(/^['"]|['"]$/g, "")) ?? [];
|
|
80
78
|
}
|
|
@@ -112,21 +110,21 @@ export function parseOptions(args: string[]): CommandOptions {
|
|
|
112
110
|
};
|
|
113
111
|
}
|
|
114
112
|
|
|
113
|
+
export function retiredSyncCommandGuidance(command: string | undefined): string | undefined {
|
|
114
|
+
if (command === "status") {
|
|
115
|
+
return "/sync status was retired. Use /sync diff to view file differences, or ask Pi to recheck the current setup in Debug mode.";
|
|
116
|
+
}
|
|
117
|
+
if (command === "doctor") {
|
|
118
|
+
return "/sync doctor was retired. Open /sync → Settings to review the setup, use /sync diff to check file differences, or open /sync → History for WebDAV history recovery.";
|
|
119
|
+
}
|
|
120
|
+
if (command === "config") {
|
|
121
|
+
return "/sync config was retired. Open /sync → Settings to review sync setups and storage connections.";
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
|
|
115
126
|
export function validateCommandOptions(command: string, options: CommandOptions) {
|
|
116
|
-
|
|
117
|
-
"config",
|
|
118
|
-
"files",
|
|
119
|
-
"status",
|
|
120
|
-
"diff",
|
|
121
|
-
"conflicts",
|
|
122
|
-
"doctor",
|
|
123
|
-
"push",
|
|
124
|
-
"pull",
|
|
125
|
-
"sync",
|
|
126
|
-
"history",
|
|
127
|
-
"rollback",
|
|
128
|
-
]);
|
|
129
|
-
if (options.setup && !setupAllowed.has(command)) {
|
|
127
|
+
if (options.setup && !syncFlagCompletions(command)?.includes(SETUP_FLAG_COMPLETION)) {
|
|
130
128
|
throw new Error(`--setup is not supported by /sync ${command}.`);
|
|
131
129
|
}
|
|
132
130
|
if (options.yes && !["push", "pull", "sync", "rollback", "migrate-state"].includes(command)) {
|
|
@@ -182,15 +180,18 @@ export function completeSyncArguments(argumentPrefix: string): CommandArgumentCo
|
|
|
182
180
|
? matches.map((action) => ({ value: `${base}${action}`, label: action, description: "Daemon control" }))
|
|
183
181
|
: null;
|
|
184
182
|
}
|
|
183
|
+
const flagCompletions = syncFlagCompletions(command);
|
|
184
|
+
if (!flagCompletions) return null;
|
|
185
185
|
const setupFlagIndex = args.lastIndexOf("--setup");
|
|
186
|
-
if (
|
|
186
|
+
if (
|
|
187
|
+
flagCompletions.includes(SETUP_FLAG_COMPLETION) &&
|
|
188
|
+
setupFlagIndex >= 0 &&
|
|
189
|
+
setupFlagIndex === args.length - (trailingSpace ? 1 : 2)
|
|
190
|
+
) {
|
|
187
191
|
const currentSetup = trailingSpace ? "" : (args.at(-1) ?? "");
|
|
188
192
|
if (!currentSetup.startsWith("-")) return completeSetupValue(prefix, currentSetup);
|
|
189
193
|
}
|
|
190
194
|
|
|
191
|
-
const flagCompletions = SYNC_FLAG_COMPLETIONS[command];
|
|
192
|
-
if (!flagCompletions) return null;
|
|
193
|
-
|
|
194
195
|
const completedArgs = trailingSpace ? args : args.slice(0, -1);
|
|
195
196
|
const completedValues = completedArgs.filter((arg) => !arg.startsWith("-"));
|
|
196
197
|
if (command === "rollback" ? completedValues.length > 1 : completedValues.length > 0) {
|
|
@@ -256,12 +257,13 @@ export function usage() {
|
|
|
256
257
|
"Usage: /sync <command>",
|
|
257
258
|
`Commands: ${commands}`,
|
|
258
259
|
"In the /sync manager, Push to remote and Pull from remote use the chosen source and preserve a restore point without a second confirmation. Direct commands retain their existing review and flags.",
|
|
259
|
-
"
|
|
260
|
+
"To review file differences without transferring files, use /sync diff. For check summaries or a fresh read-only recheck, start or /reload Pi with Debug mode enabled and ask Pi to use pi_sync_debug.",
|
|
261
|
+
"Daemon diagnostics: /sync daemon status shows service status. /sync daemon recover reviews and stops the existing daemon without starting a replacement or retrying a transfer.",
|
|
260
262
|
`Automatic sync: ${AUTOMATIC_SYNC_DESCRIPTION}`,
|
|
261
263
|
`Startup transfer: ${STARTUP_TRANSFER_DESCRIPTION}`,
|
|
262
264
|
"Automatic transfer at startup is a separate opt-in: one conflict-free established-baseline transfer at idle in TUI/RPC, with conditional/lease publication and no resource reload.",
|
|
263
265
|
"Autonomous sync and Continuous sync are retired. Saved flags no longer transfer files or call a model. Use Sync now to review a transfer or enable Startup transfer for one eligible startup sync.",
|
|
264
266
|
"New after-exit grants are not supported. Use /sync daemon revoke-after-exit to clear a retained grant.",
|
|
265
|
-
"Settings:
|
|
267
|
+
"Settings: open /sync → Settings to review sync setups and storage connections. Use /sync init or edit pi-sync.json in the Pi agent directory for manual setup. Version 1 and version 2 settings are unsupported and are never rewritten.",
|
|
266
268
|
].join("\n");
|
|
267
269
|
}
|
|
@@ -59,6 +59,7 @@ export async function runDirectionalRecovery(
|
|
|
59
59
|
run: (checkpoint: DirectionalCheckpoint, retryCheckpoint?: string) => Promise<unknown>,
|
|
60
60
|
recover: (connection: DaemonConnection, job: string, signal: AbortSignal) => Promise<DaemonConnection>,
|
|
61
61
|
markCleanupRequired: () => void,
|
|
62
|
+
allowRetry = true,
|
|
62
63
|
) {
|
|
63
64
|
signal.throwIfAborted();
|
|
64
65
|
const attempt = new DirectionalCheckpoint(connection);
|
|
@@ -88,7 +89,8 @@ export async function runDirectionalRecovery(
|
|
|
88
89
|
throw new Error(`No transfer was applied, but file-queue recovery stopped. ${detail}`, { cause: error });
|
|
89
90
|
}
|
|
90
91
|
if (primary.phase === "completed") return primary.result;
|
|
91
|
-
|
|
92
|
+
if (!allowRetry) throw new Error("No transfer was applied. Start a new review before forcing the transfer.");
|
|
93
|
+
const retryCheckpoint = attempt.fingerprint;
|
|
92
94
|
const retry = new DirectionalCheckpoint(replacement, retryCheckpoint);
|
|
93
95
|
const retried = await run(retry, retryCheckpoint);
|
|
94
96
|
const remaining = recoveryOutcome(retried);
|
package/src/daemon/pi-client.ts
CHANGED
|
@@ -324,6 +324,11 @@ export class PiDaemonClient {
|
|
|
324
324
|
get debugEnabled() {
|
|
325
325
|
return this.debug;
|
|
326
326
|
}
|
|
327
|
+
validateDebugTool() {
|
|
328
|
+
this.validate();
|
|
329
|
+
if (!this.debug || !this.ownsContactUI() || this.pendingReload)
|
|
330
|
+
throw new Error("Pi Sync debug is not available in this session.");
|
|
331
|
+
}
|
|
327
332
|
setDebugPreference(debug: boolean) {
|
|
328
333
|
this.debug = debug && this.ctx.hasUI && (this.ctx.mode === "tui" || this.ctx.mode === "rpc");
|
|
329
334
|
}
|
|
@@ -965,6 +970,7 @@ export class PiDaemonClient {
|
|
|
965
970
|
() => {
|
|
966
971
|
this.cleanupRequired = true;
|
|
967
972
|
},
|
|
973
|
+
!(intent && typeof intent === "object" && "intent" in intent && intent.intent === "review-force"),
|
|
968
974
|
)
|
|
969
975
|
: await connection.run(operation, payload, runSignal, onCommit, diagnostics?.onSubmit);
|
|
970
976
|
diagnostics?.returned(result, runSignal.aborted || reload?.signal.aborted);
|