@narumitw/pi-sync 0.63.1 → 0.65.0
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 +21 -0
- package/README.md +86 -10
- package/dist/chunks/{chunk-CKUGCBHP.ts → chunk-AYGMIMCV.ts} +2 -2
- package/dist/chunks/chunk-AYGMIMCV.ts.map +7 -0
- package/dist/chunks/{chunk-27F5W7DX.ts → chunk-DAZZ5BEJ.ts} +3 -1
- package/dist/chunks/chunk-DAZZ5BEJ.ts.map +7 -0
- package/dist/chunks/{chunk-VQ47JBLF.ts → chunk-FI2F5JBS.ts} +2 -2
- package/dist/chunks/{chunk-V76KCWHO.ts → chunk-IOM6E5FW.ts} +4 -4
- package/dist/chunks/{chunk-B5F3JLD3.ts → chunk-JQ5BAWW2.ts} +482 -78
- package/dist/chunks/chunk-JQ5BAWW2.ts.map +7 -0
- package/dist/chunks/{chunk-LBNC5AOM.ts → chunk-OBVJTKVY.ts} +12 -12
- package/dist/chunks/{chunk-EXDWEFIJ.ts → chunk-OWEOZZZE.ts} +6 -6
- package/dist/chunks/{chunk-SXCH4Q5O.ts → chunk-SZJOUVCL.ts} +3 -3
- package/dist/chunks/{chunk-HSCAFOT5.ts → chunk-TZMVSTAM.ts} +5 -5
- package/dist/chunks/{chunk-POWOMJ7S.ts → chunk-WJQ4TGN5.ts} +58 -31
- package/dist/chunks/chunk-WJQ4TGN5.ts.map +7 -0
- package/dist/chunks/{chunk-HLCML3OW.ts → chunk-XUZV4OGI.ts} +5 -3
- package/dist/chunks/chunk-XUZV4OGI.ts.map +7 -0
- package/dist/chunks/{command-handler-GMRRFWOL.ts → command-handler-YZ4DXQ7N.ts} +81 -30
- package/dist/chunks/command-handler-YZ4DXQ7N.ts.map +7 -0
- package/dist/chunks/{conflict-review-JWEA7DPQ.ts → conflict-review-J7L7S4AR.ts} +2 -2
- package/dist/chunks/{file-selection-KID23GAD.ts → file-selection-DDQN4LVD.ts} +9 -9
- package/dist/chunks/{manager-result-dispatcher-GDB74IOP.ts → manager-result-dispatcher-XB75YLEG.ts} +5 -5
- package/dist/chunks/{manager-ui-T5J5WG7T.ts → manager-ui-RGA26Z6G.ts} +103 -83
- package/dist/chunks/manager-ui-RGA26Z6G.ts.map +7 -0
- package/dist/chunks/{merge-review-OQDXNTJU.ts → merge-review-AAC674C6.ts} +3 -2
- package/dist/chunks/ownership-recovery-UDDHSDSZ.ts +59 -0
- package/dist/chunks/ownership-recovery-UDDHSDSZ.ts.map +7 -0
- package/dist/chunks/{remote-selection-ui-GPITNEBF.ts → remote-selection-ui-WVMET5RI.ts} +4 -4
- package/dist/chunks/{setup-switch-L54X5U5I.ts → setup-switch-644T6KHG.ts} +4 -4
- package/dist/chunks/{setup-wizard-LL6YMGUR.ts → setup-wizard-YP2KF2WQ.ts} +9 -9
- package/dist/chunks/{sync-inspection-SRU6HGGK.ts → sync-inspection-NBBTSMKR.ts} +5 -5
- package/dist/chunks/{sync-operations-UGSCONZ7.ts → sync-operations-AIEM2KL2.ts} +2 -2
- package/dist/daemon/dist/cli.js +2 -0
- package/dist/daemon/dist/client-transport.js +66 -0
- package/dist/daemon/dist/client.js +222 -354
- package/dist/daemon/dist/consent.js +33 -11
- package/dist/daemon/dist/daemon-debug.js +33 -0
- package/dist/daemon/dist/daemon-recovery.js +158 -0
- package/dist/daemon/dist/daemon-startup.js +257 -0
- package/dist/daemon/dist/engine/backends/git/git-backend.js +49 -13
- package/dist/daemon/dist/engine/backends/git/git-runner.js +6 -1
- package/dist/daemon/dist/engine/backends/git/git-storage.js +5 -9
- package/dist/daemon/dist/engine/backends/publication-encoding.js +19 -0
- package/dist/daemon/dist/engine/backends/s3/s3-backend.js +30 -21
- package/dist/daemon/dist/engine/backends/sync-backend.js +16 -0
- package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +34 -32
- package/dist/daemon/dist/engine/backends/webdav/webdav-client.js +10 -0
- package/dist/daemon/dist/engine/debug-log.js +134 -0
- package/dist/daemon/dist/engine/paths.js +7 -1
- package/dist/daemon/dist/engine/settings/config-file.js +62 -17
- package/dist/daemon/dist/engine/settings/config.js +49 -14
- package/dist/daemon/dist/engine/snapshot/snapshot-apply.js +30 -8
- package/dist/daemon/dist/engine/snapshot/snapshot-codec.js +3 -1
- package/dist/daemon/dist/engine/snapshot/snapshot-payload.js +32 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-images.js +34 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction.js +50 -7
- package/dist/daemon/dist/engine/snapshot/snapshot.js +64 -25
- package/dist/daemon/dist/engine/state/lock.js +157 -17
- package/dist/daemon/dist/engine/sync/continuous-sync.js +35 -11
- package/dist/daemon/dist/engine/sync/directional-action.js +124 -0
- package/dist/daemon/dist/engine/sync/initialization.js +2 -2
- package/dist/daemon/dist/engine/sync/local-fields.js +42 -19
- package/dist/daemon/dist/engine/sync/merged-sync.js +13 -10
- package/dist/daemon/dist/engine/sync/remote-snapshot.js +21 -4
- package/dist/daemon/dist/engine/sync/session-push.js +13 -4
- package/dist/daemon/dist/engine/sync/startup-bootstrap.js +105 -0
- package/dist/daemon/dist/engine/sync/startup-recovery-evidence.js +37 -0
- package/dist/daemon/dist/engine/sync/startup-timings.js +80 -8
- package/dist/daemon/dist/engine/sync/sync-error-guidance.js +6 -1
- package/dist/daemon/dist/engine/sync/sync-errors.js +20 -0
- package/dist/daemon/dist/engine/sync/sync-inspection.js +4 -7
- package/dist/daemon/dist/engine/sync/sync-local.js +59 -4
- package/dist/daemon/dist/engine/sync/sync-mutations.js +309 -337
- package/dist/daemon/dist/engine/sync/sync-policy.js +9 -1
- package/dist/daemon/dist/engine/sync/sync-queries.js +2 -1
- package/dist/daemon/dist/engine/sync/sync-rollback.js +198 -0
- package/dist/daemon/dist/engine/sync/sync-state.js +12 -4
- package/dist/daemon/dist/engine/sync/transfer-freshness.js +11 -5
- package/dist/daemon/dist/engine-service.js +122 -10
- package/dist/daemon/dist/foreground-queue-outcome.js +9 -0
- package/dist/daemon/dist/identity.js +36 -6
- package/dist/daemon/dist/index.js +2 -1
- package/dist/daemon/dist/monitor.js +21 -1
- package/dist/daemon/dist/paged-review.js +177 -0
- package/dist/daemon/dist/participant-ledger.js +149 -0
- package/dist/daemon/dist/protocol.js +4 -0
- package/dist/daemon/dist/server.js +340 -127
- package/dist/daemon/dist/service-host.js +83 -15
- package/dist/daemon/dist/state-wait-jobs.js +23 -0
- package/dist/daemon/dist/state-wait.js +34 -0
- package/dist/daemon/package.json +1 -1
- package/dist/index.ts +128 -48
- package/dist/index.ts.map +2 -2
- package/docs/continuous-sync-verification.md +2 -0
- package/docs/daemon-migration.md +31 -6
- package/docs/tui-contract.md +7 -1
- package/package.json +2 -2
- package/skills/configure-pi-sync/references/configuration.md +23 -13
- package/src/commands/command-execution.ts +67 -5
- package/src/commands/command-handler.ts +12 -3
- package/src/commands/command.ts +4 -2
- package/src/daemon/client-debug.ts +45 -0
- package/src/daemon/directional-recovery.ts +103 -0
- package/src/daemon/ownership-recovery.ts +50 -0
- package/src/daemon/pi-client.ts +399 -71
- package/src/daemon/startup-bootstrap-client.ts +26 -0
- package/src/settings/config.ts +1 -0
- package/src/sync/automatic-sync.ts +61 -18
- package/src/sync/startup-check.ts +13 -5
- package/src/sync-extension.ts +46 -8
- package/src/ui/cancellable-operation.ts +5 -2
- package/src/ui/manager-state.ts +31 -23
- package/src/ui/manager-ui.ts +45 -25
- package/src/ui/merge-review.ts +53 -18
- package/src/ui/settings-ui.ts +2 -2
- package/src/ui/sync-confirmation.ts +14 -17
- package/src/ui/sync-setups-ui.ts +15 -12
- package/dist/chunks/chunk-27F5W7DX.ts.map +0 -7
- package/dist/chunks/chunk-B5F3JLD3.ts.map +0 -7
- package/dist/chunks/chunk-CKUGCBHP.ts.map +0 -7
- package/dist/chunks/chunk-HLCML3OW.ts.map +0 -7
- package/dist/chunks/chunk-POWOMJ7S.ts.map +0 -7
- package/dist/chunks/command-handler-GMRRFWOL.ts.map +0 -7
- package/dist/chunks/manager-ui-T5J5WG7T.ts.map +0 -7
- /package/dist/chunks/{chunk-VQ47JBLF.ts.map → chunk-FI2F5JBS.ts.map} +0 -0
- /package/dist/chunks/{chunk-V76KCWHO.ts.map → chunk-IOM6E5FW.ts.map} +0 -0
- /package/dist/chunks/{chunk-LBNC5AOM.ts.map → chunk-OBVJTKVY.ts.map} +0 -0
- /package/dist/chunks/{chunk-EXDWEFIJ.ts.map → chunk-OWEOZZZE.ts.map} +0 -0
- /package/dist/chunks/{chunk-SXCH4Q5O.ts.map → chunk-SZJOUVCL.ts.map} +0 -0
- /package/dist/chunks/{chunk-HSCAFOT5.ts.map → chunk-TZMVSTAM.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-JWEA7DPQ.ts.map → conflict-review-J7L7S4AR.ts.map} +0 -0
- /package/dist/chunks/{file-selection-KID23GAD.ts.map → file-selection-DDQN4LVD.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-GDB74IOP.ts.map → manager-result-dispatcher-XB75YLEG.ts.map} +0 -0
- /package/dist/chunks/{merge-review-OQDXNTJU.ts.map → merge-review-AAC674C6.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-GPITNEBF.ts.map → remote-selection-ui-WVMET5RI.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-L54X5U5I.ts.map → setup-switch-644T6KHG.ts.map} +0 -0
- /package/dist/chunks/{setup-wizard-LL6YMGUR.ts.map → setup-wizard-YP2KF2WQ.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-SRU6HGGK.ts.map → sync-inspection-NBBTSMKR.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-UGSCONZ7.ts.map → sync-operations-AIEM2KL2.ts.map} +0 -0
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
showRemoteSelectionReview
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-CKUGCBHP.ts";
|
|
5
|
+
} from "./chunk-OWEOZZZE.ts";
|
|
7
6
|
import "./chunk-UMPA5S7X.ts";
|
|
7
|
+
import "./chunk-AYGMIMCV.ts";
|
|
8
8
|
import "./chunk-NXWHPVXR.ts";
|
|
9
9
|
import "./chunk-GELYN4UC.ts";
|
|
10
10
|
import "./chunk-ZO52JM4H.ts";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-DAZZ5BEJ.ts";
|
|
12
12
|
import "./chunk-H7VOTY5N.ts";
|
|
13
13
|
import "./chunk-6YKOHBSC.ts";
|
|
14
14
|
import "./chunk-R3SAMXB6.ts";
|
|
@@ -16,4 +16,4 @@ import "./chunk-2JNFEZ3V.ts";
|
|
|
16
16
|
export {
|
|
17
17
|
showRemoteSelectionReview
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=remote-selection-ui-
|
|
19
|
+
//# sourceMappingURL=remote-selection-ui-WVMET5RI.ts.map
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
setupSwitchActionFromLabel,
|
|
7
7
|
setupSwitchActionLabel,
|
|
8
8
|
useSyncSetup
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SZJOUVCL.ts";
|
|
10
10
|
import "./chunk-APZVJAEW.ts";
|
|
11
11
|
import "./chunk-WBIOSK76.ts";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-XUZV4OGI.ts";
|
|
13
13
|
import "./chunk-GELYN4UC.ts";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-DAZZ5BEJ.ts";
|
|
15
15
|
import {
|
|
16
16
|
SetupPullRequiresUiError
|
|
17
17
|
} from "./chunk-6YKOHBSC.ts";
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
setupSwitchActionLabel,
|
|
25
25
|
useSyncSetup
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=setup-switch-
|
|
27
|
+
//# sourceMappingURL=setup-switch-644T6KHG.ts.map
|
|
@@ -5,24 +5,24 @@ import {
|
|
|
5
5
|
showGitSetup,
|
|
6
6
|
showS3Setup,
|
|
7
7
|
showWebDavSetup
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OBVJTKVY.ts";
|
|
9
9
|
import {
|
|
10
10
|
validateConfigName
|
|
11
11
|
} from "./chunk-APZVJAEW.ts";
|
|
12
12
|
import "./chunk-MANNB4WZ.ts";
|
|
13
13
|
import "./chunk-WBIOSK76.ts";
|
|
14
|
-
import "./chunk-HLCML3OW.ts";
|
|
15
|
-
import "./chunk-JREGWM2B.ts";
|
|
16
|
-
import {
|
|
17
|
-
localConfigPath
|
|
18
|
-
} from "./chunk-IBXEM35O.ts";
|
|
19
|
-
import "./chunk-B5F3JLD3.ts";
|
|
20
|
-
import "./chunk-CKUGCBHP.ts";
|
|
21
14
|
import {
|
|
22
15
|
throwIfAborted
|
|
23
16
|
} from "./chunk-UMPA5S7X.ts";
|
|
17
|
+
import "./chunk-XUZV4OGI.ts";
|
|
18
|
+
import "./chunk-AYGMIMCV.ts";
|
|
19
|
+
import "./chunk-JREGWM2B.ts";
|
|
24
20
|
import "./chunk-NXWHPVXR.ts";
|
|
25
21
|
import "./chunk-GELYN4UC.ts";
|
|
22
|
+
import {
|
|
23
|
+
localConfigPath
|
|
24
|
+
} from "./chunk-IBXEM35O.ts";
|
|
25
|
+
import "./chunk-JQ5BAWW2.ts";
|
|
26
26
|
import "./chunk-H7VOTY5N.ts";
|
|
27
27
|
import {
|
|
28
28
|
errorMessage
|
|
@@ -93,4 +93,4 @@ async function showSetupWizard(ctx, signal) {
|
|
|
93
93
|
export {
|
|
94
94
|
showSetupWizard
|
|
95
95
|
};
|
|
96
|
-
//# sourceMappingURL=setup-wizard-
|
|
96
|
+
//# sourceMappingURL=setup-wizard-YP2KF2WQ.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
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
|
-
currentPiDaemonClient
|
|
5
|
-
} from "./chunk-B5F3JLD3.ts";
|
|
6
3
|
import {
|
|
7
4
|
syncCheckConfigFingerprint
|
|
8
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DAZZ5BEJ.ts";
|
|
6
|
+
import {
|
|
7
|
+
currentPiDaemonClient
|
|
8
|
+
} from "./chunk-JQ5BAWW2.ts";
|
|
9
9
|
import "./chunk-H7VOTY5N.ts";
|
|
10
10
|
import "./chunk-6YKOHBSC.ts";
|
|
11
11
|
import "./chunk-R3SAMXB6.ts";
|
|
@@ -20,4 +20,4 @@ var inspectSync = async (config, _options, signal) => await currentPiDaemonClien
|
|
|
20
20
|
export {
|
|
21
21
|
inspectSync
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=sync-inspection-
|
|
23
|
+
//# sourceMappingURL=sync-inspection-NBBTSMKR.ts.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
remoteOperation
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JQ5BAWW2.ts";
|
|
6
6
|
import "./chunk-H7VOTY5N.ts";
|
|
7
7
|
import "./chunk-6YKOHBSC.ts";
|
|
8
8
|
import "./chunk-R3SAMXB6.ts";
|
|
@@ -46,4 +46,4 @@ export {
|
|
|
46
46
|
status,
|
|
47
47
|
syncBoth
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=sync-operations-
|
|
49
|
+
//# sourceMappingURL=sync-operations-AIEM2KL2.ts.map
|
package/dist/daemon/dist/cli.js
CHANGED
|
@@ -59,6 +59,7 @@ export async function main(args) {
|
|
|
59
59
|
log = openLifecycleLog(paths.directory);
|
|
60
60
|
}
|
|
61
61
|
catch (error) {
|
|
62
|
+
server.recordBootOutcome("failed");
|
|
62
63
|
await server.close();
|
|
63
64
|
throw error;
|
|
64
65
|
}
|
|
@@ -71,6 +72,7 @@ export async function main(args) {
|
|
|
71
72
|
throw error;
|
|
72
73
|
}
|
|
73
74
|
note("ready");
|
|
75
|
+
server.recordBootOutcome("ready");
|
|
74
76
|
let stopping;
|
|
75
77
|
const stop = () => {
|
|
76
78
|
stopping ??= server.close().catch(() => {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { request as httpRequest } from "node:http";
|
|
2
|
+
import { lt, valid } from "semver";
|
|
3
|
+
import { DAEMON_BUILD_VERSION } from "./build-version.js";
|
|
4
|
+
import { daemonPaths, readJsonBody } from "./identity.js";
|
|
5
|
+
import { MAX_MESSAGE_BYTES, record } from "./protocol.js";
|
|
6
|
+
export class DaemonError extends Error {
|
|
7
|
+
remote;
|
|
8
|
+
constructor(remote) {
|
|
9
|
+
super(remote.message);
|
|
10
|
+
this.name = remote.name;
|
|
11
|
+
this.remote = remote;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export async function requestDaemon(paths, identity, method, params, signal, options) {
|
|
15
|
+
signal?.throwIfAborted();
|
|
16
|
+
const body = JSON.stringify({
|
|
17
|
+
version: 1,
|
|
18
|
+
root: paths.root,
|
|
19
|
+
instance: identity.instance,
|
|
20
|
+
token: identity.token,
|
|
21
|
+
method,
|
|
22
|
+
params,
|
|
23
|
+
...(method === "attach" && options?.reviewDetails === 1 ? { reviewDetails: 1 } : {}),
|
|
24
|
+
});
|
|
25
|
+
if (Buffer.byteLength(body) > MAX_MESSAGE_BYTES)
|
|
26
|
+
throw new Error("Daemon request exceeds its byte limit.");
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const request = httpRequest({
|
|
29
|
+
socketPath: daemonPaths(paths, identity.instance).endpoint,
|
|
30
|
+
path: "/v1",
|
|
31
|
+
method: "POST",
|
|
32
|
+
signal,
|
|
33
|
+
headers: { "content-type": "application/json", "content-length": Buffer.byteLength(body) },
|
|
34
|
+
}, (response) => {
|
|
35
|
+
void readJsonBody(response)
|
|
36
|
+
.then((value) => {
|
|
37
|
+
if (!record(value))
|
|
38
|
+
throw new Error("Invalid daemon response.");
|
|
39
|
+
if (record(value.error) && typeof value.error.message === "string")
|
|
40
|
+
throw new DaemonError(value.error);
|
|
41
|
+
if (response.statusCode !== 200 || !Object.hasOwn(value, "result"))
|
|
42
|
+
throw new Error("Invalid daemon response.");
|
|
43
|
+
resolve(value.result);
|
|
44
|
+
})
|
|
45
|
+
.catch(reject);
|
|
46
|
+
});
|
|
47
|
+
request.setTimeout(method === "attach" || method === "resume-contact" ? 0 : 30_000, () => request.destroy(new Error("Daemon request timed out.")));
|
|
48
|
+
request.once("error", reject);
|
|
49
|
+
if (options?.onSocket)
|
|
50
|
+
request.once("socket", options.onSocket);
|
|
51
|
+
request.end(body);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export async function hello(paths, identity, signal) {
|
|
55
|
+
const value = await requestDaemon(paths, identity, "hello", {}, signal);
|
|
56
|
+
if (!record(value) ||
|
|
57
|
+
value.version !== 1 ||
|
|
58
|
+
value.root !== paths.root ||
|
|
59
|
+
value.instance !== identity.instance ||
|
|
60
|
+
value.pid !== identity.pid)
|
|
61
|
+
throw new Error("Daemon handshake mismatch.");
|
|
62
|
+
const version = value.buildVersion;
|
|
63
|
+
if (Object.hasOwn(value, "buildVersion") && (typeof version !== "string" || valid(version) !== version))
|
|
64
|
+
throw new Error("Invalid daemon build version.");
|
|
65
|
+
return { needsUpgrade: typeof version !== "string" || lt(version, DAEMON_BUILD_VERSION) };
|
|
66
|
+
}
|