@narumitw/pi-sync 0.49.14 → 0.50.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/README.md +134 -241
- package/dist/chunks/chunk-2B2ELUF5.ts +29 -0
- package/dist/chunks/chunk-2B2ELUF5.ts.map +7 -0
- package/dist/chunks/chunk-6LP3MCR2.ts +115 -0
- package/dist/chunks/chunk-6LP3MCR2.ts.map +7 -0
- package/dist/chunks/chunk-6UHKGALE.ts +134 -0
- package/dist/chunks/chunk-6UHKGALE.ts.map +7 -0
- package/dist/chunks/{chunk-RGJ6SOYR.ts → chunk-AUSDLD6F.ts} +4 -4
- package/dist/chunks/chunk-AUSDLD6F.ts.map +7 -0
- package/dist/chunks/{chunk-3NDD5QPM.ts → chunk-AXXS2BPA.ts} +9 -9
- package/dist/chunks/chunk-AXXS2BPA.ts.map +7 -0
- package/dist/chunks/{chunk-APZVBSM6.ts → chunk-C7XY5NF5.ts} +214 -365
- package/dist/chunks/chunk-C7XY5NF5.ts.map +7 -0
- package/dist/chunks/{chunk-4U6AFLJB.ts → chunk-CHH26D4F.ts} +3 -2
- package/dist/chunks/chunk-CHH26D4F.ts.map +7 -0
- package/dist/chunks/chunk-CPEHGXJV.ts +50 -0
- package/dist/chunks/chunk-CPEHGXJV.ts.map +7 -0
- package/dist/chunks/{chunk-5MQ76BK5.ts → chunk-D5X27LCA.ts} +2 -2
- package/dist/chunks/chunk-D5X27LCA.ts.map +7 -0
- package/dist/chunks/{chunk-LJDSHNS3.ts → chunk-GWMHAQG4.ts} +4 -4
- package/dist/chunks/chunk-GWMHAQG4.ts.map +7 -0
- package/dist/chunks/{chunk-FR6CVXAL.ts → chunk-HUDQATCL.ts} +25 -25
- package/dist/chunks/chunk-HUDQATCL.ts.map +7 -0
- package/dist/chunks/{chunk-YQ6UW7IF.ts → chunk-JAAKLL6M.ts} +2 -2
- package/dist/chunks/chunk-JAAKLL6M.ts.map +7 -0
- package/dist/chunks/chunk-JSYMGJQQ.ts +51 -0
- package/dist/chunks/chunk-JSYMGJQQ.ts.map +7 -0
- package/dist/chunks/chunk-L7TBO32M.ts +25 -0
- package/dist/chunks/chunk-L7TBO32M.ts.map +7 -0
- package/dist/chunks/{chunk-4F3W4CSC.ts → chunk-LCRI3ABW.ts} +22 -8
- package/dist/chunks/chunk-LCRI3ABW.ts.map +7 -0
- package/dist/chunks/chunk-LTBWGSBV.ts +12 -0
- package/dist/chunks/chunk-LTBWGSBV.ts.map +7 -0
- package/dist/chunks/chunk-NJFUIVYL.ts +17 -0
- package/dist/chunks/chunk-NJFUIVYL.ts.map +7 -0
- package/dist/chunks/{chunk-EWX3TPLQ.ts → chunk-OEX4ABY6.ts} +39 -37
- package/dist/chunks/chunk-OEX4ABY6.ts.map +7 -0
- package/dist/chunks/chunk-OUHGBFYF.ts +1255 -0
- package/dist/chunks/chunk-OUHGBFYF.ts.map +7 -0
- package/dist/chunks/{chunk-HGV24P4T.ts → chunk-Q2TUM5X6.ts} +3 -3
- package/dist/chunks/chunk-Q2TUM5X6.ts.map +7 -0
- package/dist/chunks/{chunk-BHJUISB4.ts → chunk-SL64RLXR.ts} +8 -6
- package/dist/chunks/chunk-SL64RLXR.ts.map +7 -0
- package/dist/chunks/chunk-T3HH3UEJ.ts +96 -0
- package/dist/chunks/chunk-T3HH3UEJ.ts.map +7 -0
- package/dist/chunks/chunk-TEN2ZBJV.ts +101 -0
- package/dist/chunks/chunk-TEN2ZBJV.ts.map +7 -0
- package/dist/chunks/chunk-THMF4BVL.ts +18 -0
- package/dist/chunks/chunk-THMF4BVL.ts.map +7 -0
- package/dist/chunks/{chunk-LONPFFNP.ts → chunk-X5OM6GXT.ts} +9 -7
- package/dist/chunks/chunk-X5OM6GXT.ts.map +7 -0
- package/dist/chunks/chunk-XBX4HBLG.ts +57 -0
- package/dist/chunks/chunk-XBX4HBLG.ts.map +7 -0
- package/dist/chunks/{chunk-5WJNWFTG.ts → chunk-YKJHPTGO.ts} +23 -55
- package/dist/chunks/chunk-YKJHPTGO.ts.map +7 -0
- package/dist/chunks/chunk-Z4DQF6L3.ts +12 -0
- package/dist/chunks/chunk-Z4DQF6L3.ts.map +7 -0
- package/dist/chunks/{chunk-F5QL2GPY.ts → chunk-ZI5MXMEX.ts} +5 -99
- package/dist/chunks/chunk-ZI5MXMEX.ts.map +7 -0
- package/dist/chunks/{file-selection-4UABOP44.ts → file-selection-FTTKAOYX.ts} +10 -7
- package/dist/chunks/file-selection-FTTKAOYX.ts.map +7 -0
- package/dist/chunks/{git-backend-E3UOUUOM.ts → git-backend-OQW46G2X.ts} +42 -17
- package/dist/chunks/git-backend-OQW46G2X.ts.map +7 -0
- package/dist/chunks/manager-result-dispatcher-U23ODD32.ts +22 -0
- package/dist/chunks/manager-ui-ABATHC36.ts +1680 -0
- package/dist/chunks/manager-ui-ABATHC36.ts.map +7 -0
- package/dist/chunks/remote-selection-ui-ZE3TY67S.ts +21 -0
- package/dist/chunks/{s3-backend-3QZGO2EF.ts → s3-backend-3P33LQHU.ts} +96 -18
- package/dist/chunks/s3-backend-3P33LQHU.ts.map +7 -0
- package/dist/chunks/{setup-switch-X3W3FALZ.ts → setup-switch-IS2PEZ3J.ts} +9 -9
- package/dist/chunks/setup-wizard-VB3VDOV5.ts +89 -0
- package/dist/chunks/setup-wizard-VB3VDOV5.ts.map +7 -0
- package/dist/chunks/{snapshot-WBSV4MQG.ts → snapshot-HKEWCVK6.ts} +7 -6
- package/dist/chunks/sync-inspection-FEP4L5TR.ts +20 -0
- package/dist/chunks/{sync-operations-MPAFVVHA.ts → sync-operations-ONJ27QRL.ts} +381 -299
- package/dist/chunks/sync-operations-ONJ27QRL.ts.map +7 -0
- package/dist/chunks/{sync-state-36H7ULG2.ts → sync-state-Q2FTXTW6.ts} +6 -6
- package/dist/chunks/sync-state-Q2FTXTW6.ts.map +7 -0
- package/dist/chunks/{webdav-backend-ZD5RHRIU.ts → webdav-backend-ECIKD7SO.ts} +26 -13
- package/dist/chunks/webdav-backend-ECIKD7SO.ts.map +7 -0
- package/dist/index.ts +477 -342
- package/dist/index.ts.map +4 -4
- package/docs/settings.md +211 -0
- package/package.json +6 -8
- package/src/{backend-factory.ts → backends/backend-factory.ts} +4 -4
- package/src/backends/backend-identity.ts +40 -0
- package/src/backends/backend-types.ts +81 -0
- package/src/{git-backend.ts → backends/git/git-backend.ts} +43 -19
- package/src/{git-config.ts → backends/git/git-config.ts} +1 -0
- package/src/{git-storage.ts → backends/git/git-storage.ts} +2 -2
- package/src/{s3-backend.ts → backends/s3/s3-backend.ts} +45 -9
- package/src/{s3-client.ts → backends/s3/s3-client.ts} +56 -8
- package/src/{sync-backend.ts → backends/sync-backend.ts} +1 -1
- package/src/{webdav-backend.ts → backends/webdav/webdav-backend.ts} +22 -10
- package/src/{webdav-client.ts → backends/webdav/webdav-client.ts} +1 -1
- package/src/{webdav-config.ts → backends/webdav/webdav-config.ts} +1 -0
- package/src/commands/command-execution.ts +330 -0
- package/src/commands/command-handler.ts +201 -0
- package/src/commands/command-types.ts +18 -0
- package/src/{command.ts → commands/command.ts} +2 -1
- package/src/commands/setup-completions.ts +6 -0
- package/src/settings/config.ts +238 -0
- package/src/{settings-management.ts → settings/settings-management.ts} +40 -14
- package/src/settings/settings-store.ts +109 -0
- package/src/settings/settings-types.ts +128 -0
- package/src/settings/settings-validation.ts +443 -0
- package/src/snapshot/session-paths.ts +84 -0
- package/src/{snapshot-apply.ts → snapshot/snapshot-apply.ts} +3 -3
- package/src/{snapshot-codec.ts → snapshot/snapshot-codec.ts} +2 -2
- package/src/{snapshot-transaction.ts → snapshot/snapshot-transaction.ts} +5 -4
- package/src/snapshot/snapshot-types.ts +38 -0
- package/src/{snapshot.ts → snapshot/snapshot.ts} +39 -20
- package/src/state/json-file.ts +20 -0
- package/src/{lock.ts → state/lock.ts} +3 -2
- package/src/{operation-availability.ts → state/operation-availability.ts} +2 -2
- package/src/state/state-types.ts +20 -0
- package/src/state/sync-state-store.ts +62 -0
- package/src/sync/automatic-sync.ts +103 -0
- package/src/{remote-snapshot.ts → sync/remote-snapshot.ts} +27 -4
- package/src/{setup-switch.ts → sync/setup-switch.ts} +6 -7
- package/src/sync/signals.ts +10 -0
- package/src/sync/startup-check.ts +128 -0
- package/src/{sync-decision.ts → sync/sync-decision.ts} +6 -3
- package/src/sync/sync-error-guidance.ts +53 -0
- package/src/sync/sync-inspection.ts +51 -0
- package/src/sync/sync-loaders.ts +54 -0
- package/src/{sync-operations.ts → sync/sync-mutations.ts} +41 -330
- package/src/sync/sync-operations.ts +12 -0
- package/src/{sync-policy.ts → sync/sync-policy.ts} +2 -2
- package/src/sync/sync-queries.ts +235 -0
- package/src/{sync-state.ts → sync/sync-state.ts} +5 -4
- package/src/sync-extension.ts +64 -708
- package/src/sync.ts +8 -8
- package/src/types.ts +47 -284
- package/src/ui/automatic-sync-summary.ts +6 -0
- package/src/{cancellable-operation.ts → ui/cancellable-operation.ts} +4 -4
- package/src/{file-selection.ts → ui/file-selection.ts} +5 -3
- package/src/{manager-attention.ts → ui/manager-attention.ts} +5 -1
- package/src/{manager-recovery.ts → ui/manager-recovery.ts} +6 -2
- package/src/{manager-state.ts → ui/manager-state.ts} +35 -14
- package/src/ui/manager-ui.ts +386 -0
- package/src/{remote-selection-ui.ts → ui/remote-selection-ui.ts} +21 -13
- package/src/{secret-input.ts → ui/secret-input.ts} +22 -4
- package/src/{settings-ui.ts → ui/settings-ui.ts} +42 -11
- package/src/ui/setup/git-ui.ts +293 -0
- package/src/{s3-credentials-ui.ts → ui/setup/s3-credentials-ui.ts} +13 -21
- package/src/ui/setup/s3-ui.ts +217 -0
- package/src/ui/setup/setup-actions.ts +127 -0
- package/src/ui/setup/setup-location-ui.ts +167 -0
- package/src/ui/setup/setup-name-ui.ts +34 -0
- package/src/ui/setup/setup-prompts.ts +92 -0
- package/src/ui/setup/setup-review.ts +70 -0
- package/src/ui/setup/setup-switcher.ts +181 -0
- package/src/ui/setup/setup-wizard.ts +39 -0
- package/src/ui/setup/text-input.ts +78 -0
- package/src/ui/setup/webdav-ui.ts +330 -0
- package/src/{storage-connections-ui.ts → ui/storage-connections-ui.ts} +99 -69
- package/src/{sync-attention.ts → ui/sync-attention.ts} +75 -6
- package/src/{sync-format.ts → ui/sync-format.ts} +7 -13
- package/src/{sync-resolution-ui.ts → ui/sync-resolution-ui.ts} +4 -3
- package/src/{sync-setups-ui.ts → ui/sync-setups-ui.ts} +23 -10
- package/src/ui/terminal-text.ts +4 -0
- package/dist/chunks/chunk-3NDD5QPM.ts.map +0 -7
- package/dist/chunks/chunk-4F3W4CSC.ts.map +0 -7
- package/dist/chunks/chunk-4U6AFLJB.ts.map +0 -7
- package/dist/chunks/chunk-5MQ76BK5.ts.map +0 -7
- package/dist/chunks/chunk-5WJNWFTG.ts.map +0 -7
- package/dist/chunks/chunk-APZVBSM6.ts.map +0 -7
- package/dist/chunks/chunk-BHJUISB4.ts.map +0 -7
- package/dist/chunks/chunk-EWX3TPLQ.ts.map +0 -7
- package/dist/chunks/chunk-F5QL2GPY.ts.map +0 -7
- package/dist/chunks/chunk-FR6CVXAL.ts.map +0 -7
- package/dist/chunks/chunk-HGV24P4T.ts.map +0 -7
- package/dist/chunks/chunk-JNOOSPEW.ts +0 -82
- package/dist/chunks/chunk-JNOOSPEW.ts.map +0 -7
- package/dist/chunks/chunk-LJDSHNS3.ts.map +0 -7
- package/dist/chunks/chunk-LONPFFNP.ts.map +0 -7
- package/dist/chunks/chunk-RGJ6SOYR.ts.map +0 -7
- package/dist/chunks/chunk-W64NEHXT.ts +0 -167
- package/dist/chunks/chunk-W64NEHXT.ts.map +0 -7
- package/dist/chunks/chunk-YQ6UW7IF.ts.map +0 -7
- package/dist/chunks/file-selection-4UABOP44.ts.map +0 -7
- package/dist/chunks/git-backend-E3UOUUOM.ts.map +0 -7
- package/dist/chunks/manager-result-dispatcher-RNRQA3PW.ts +0 -18
- package/dist/chunks/manager-ui-QO2P4V3Z.ts +0 -2757
- package/dist/chunks/manager-ui-QO2P4V3Z.ts.map +0 -7
- package/dist/chunks/remote-selection-ui-LHSAGKGA.ts +0 -17
- package/dist/chunks/s3-backend-3QZGO2EF.ts.map +0 -7
- package/dist/chunks/sync-operations-MPAFVVHA.ts.map +0 -7
- package/dist/chunks/webdav-backend-ZD5RHRIU.ts.map +0 -7
- package/src/config.ts +0 -910
- package/src/git-ui.ts +0 -307
- package/src/manager-helpers.ts +0 -64
- package/src/manager-ui.ts +0 -997
- package/src/webdav-ui.ts +0 -421
- /package/dist/chunks/{manager-result-dispatcher-RNRQA3PW.ts.map → manager-result-dispatcher-U23ODD32.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-LHSAGKGA.ts.map → remote-selection-ui-ZE3TY67S.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-X3W3FALZ.ts.map → setup-switch-IS2PEZ3J.ts.map} +0 -0
- /package/dist/chunks/{snapshot-WBSV4MQG.ts.map → snapshot-HKEWCVK6.ts.map} +0 -0
- /package/dist/chunks/{sync-state-36H7ULG2.ts.map → sync-inspection-FEP4L5TR.ts.map} +0 -0
- /package/src/{git-runner.ts → backends/git/git-runner.ts} +0 -0
- /package/src/{config-errors.ts → settings/config-errors.ts} +0 -0
- /package/src/{config-file.ts → settings/config-file.ts} +0 -0
- /package/src/{snapshot-paths.ts → snapshot/snapshot-paths.ts} +0 -0
- /package/src/{lock-policy.ts → state/lock-policy.ts} +0 -0
- /package/src/{lockfile-fs.ts → state/lockfile-fs.ts} +0 -0
- /package/src/{state-directory.ts → state/state-directory.ts} +0 -0
- /package/src/{sync-errors.ts → sync/sync-errors.ts} +0 -0
- /package/src/{manager-result-dispatcher.ts → ui/manager-result-dispatcher.ts} +0 -0
package/src/sync.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { completeSyncArguments, parseOptions, splitArgs } from "./command.js";
|
|
1
|
+
export { completeSyncArguments, parseOptions, splitArgs } from "./commands/command.js";
|
|
2
|
+
export { encodeKey, posixJoin, safeJoin, safeName } from "./paths.js";
|
|
2
3
|
export {
|
|
3
|
-
isCloudflareR2Endpoint,
|
|
4
4
|
isEnabled,
|
|
5
5
|
isExplicitlyEnabled,
|
|
6
6
|
loadConfig,
|
|
7
7
|
sessionTokenWarnings,
|
|
8
|
-
} from "./config.js";
|
|
9
|
-
export {
|
|
8
|
+
} from "./settings/config.js";
|
|
9
|
+
export { isCloudflareR2Endpoint } from "./settings/settings-validation.js";
|
|
10
10
|
export {
|
|
11
11
|
canonicalSnapshotPathForConfig,
|
|
12
12
|
collectFiles,
|
|
@@ -19,14 +19,13 @@ export {
|
|
|
19
19
|
scanSnapshot,
|
|
20
20
|
sessionSnapshotPathFromAbsolute,
|
|
21
21
|
snapshotWithoutSessions,
|
|
22
|
-
} from "./snapshot.js";
|
|
22
|
+
} from "./snapshot/snapshot.js";
|
|
23
23
|
export {
|
|
24
24
|
addTopLevelCaseVariantDeletes,
|
|
25
25
|
appliedFileHashMap,
|
|
26
26
|
preflightSnapshotApply,
|
|
27
27
|
protectSnapshotApplyPlan,
|
|
28
|
-
} from "./snapshot-apply.js";
|
|
29
|
-
export { default, type SyncDependencies } from "./sync-extension.js";
|
|
28
|
+
} from "./snapshot/snapshot-apply.js";
|
|
30
29
|
export {
|
|
31
30
|
canPullRemoteSessionsOnFirstSync,
|
|
32
31
|
canPullRemoteSettingsOnFirstSync,
|
|
@@ -35,4 +34,5 @@ export {
|
|
|
35
34
|
settingsHashesMatchState,
|
|
36
35
|
settingsHashMap,
|
|
37
36
|
settingsHashMapFromState,
|
|
38
|
-
} from "./sync-state.js";
|
|
37
|
+
} from "./sync/sync-state.js";
|
|
38
|
+
export { default, type SyncDependencies } from "./sync-extension.js";
|
package/src/types.ts
CHANGED
|
@@ -1,284 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export type
|
|
48
|
-
| S3StorageConnectionSettings
|
|
49
|
-
| GitStorageConnectionSettings
|
|
50
|
-
| WebDavStorageConnectionSettings;
|
|
51
|
-
|
|
52
|
-
export interface CommonSyncSetupStorageSettings {
|
|
53
|
-
connection: string;
|
|
54
|
-
path: string;
|
|
55
|
-
[key: string]: unknown;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface S3SyncSetupStorageSettings extends CommonSyncSetupStorageSettings {
|
|
59
|
-
bucket: string;
|
|
60
|
-
branch?: never;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface GitSyncSetupStorageSettings extends CommonSyncSetupStorageSettings {
|
|
64
|
-
branch: string;
|
|
65
|
-
bucket?: never;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface WebDavSyncSetupStorageSettings extends CommonSyncSetupStorageSettings {
|
|
69
|
-
bucket?: never;
|
|
70
|
-
branch?: never;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export type SyncSetupStorageSettings =
|
|
74
|
-
| S3SyncSetupStorageSettings
|
|
75
|
-
| GitSyncSetupStorageSettings
|
|
76
|
-
| WebDavSyncSetupStorageSettings;
|
|
77
|
-
|
|
78
|
-
export interface SyncPolicySettings {
|
|
79
|
-
include: string[];
|
|
80
|
-
automatic: boolean;
|
|
81
|
-
[key: string]: unknown;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface SyncSetupSettings {
|
|
85
|
-
storage: SyncSetupStorageSettings;
|
|
86
|
-
sync: SyncPolicySettings;
|
|
87
|
-
[key: string]: unknown;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface PiSyncSettingsV3 {
|
|
91
|
-
version: 3;
|
|
92
|
-
activeSyncSetup?: string;
|
|
93
|
-
onSwitch: OnSwitchAction;
|
|
94
|
-
storageConnections: Record<string, StorageConnectionSettings>;
|
|
95
|
-
syncSetups: Record<string, SyncSetupSettings>;
|
|
96
|
-
[key: string]: unknown;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/** Backend-only resolved S3 connection fields. */
|
|
100
|
-
export interface ResolvedS3StorageProfile {
|
|
101
|
-
kind: "r2" | "s3-compatible";
|
|
102
|
-
endpoint: string;
|
|
103
|
-
region: string;
|
|
104
|
-
accessKeyId: string;
|
|
105
|
-
secretAccessKey: string;
|
|
106
|
-
sessionToken?: string;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/** Backend-only coordinates. `prefix` is the complete reviewed v3 storage path. */
|
|
110
|
-
export interface ResolvedS3Destination {
|
|
111
|
-
bucket: string;
|
|
112
|
-
prefix: string;
|
|
113
|
-
/** Snapshot/wire identity; never derived from the local setup name. */
|
|
114
|
-
namespace: string;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface ResolvedS3Backend {
|
|
118
|
-
type: "s3";
|
|
119
|
-
profile: ResolvedS3StorageProfile;
|
|
120
|
-
destination: ResolvedS3Destination;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface ResolvedWebDavStorageProfile {
|
|
124
|
-
kind: "webdav";
|
|
125
|
-
url: string;
|
|
126
|
-
username: string;
|
|
127
|
-
password: string;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** Backend-only coordinates. `path` is the complete reviewed v3 storage path. */
|
|
131
|
-
export interface ResolvedWebDavDestination {
|
|
132
|
-
path: string;
|
|
133
|
-
namespace: string;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export interface ResolvedWebDavBackend {
|
|
137
|
-
type: "webdav";
|
|
138
|
-
profile: ResolvedWebDavStorageProfile;
|
|
139
|
-
destination: ResolvedWebDavDestination;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export interface ResolvedGitStorageProfile {
|
|
143
|
-
kind: "git";
|
|
144
|
-
remote: string;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/** Backend-only coordinates. `directory` is the complete reviewed v3 storage path. */
|
|
148
|
-
export interface ResolvedGitDestination {
|
|
149
|
-
branch: string;
|
|
150
|
-
directory: string;
|
|
151
|
-
namespace: string;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export interface ResolvedGitBackend {
|
|
155
|
-
type: "git";
|
|
156
|
-
profile: ResolvedGitStorageProfile;
|
|
157
|
-
destination: ResolvedGitDestination;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export type ResolvedSyncBackend = ResolvedS3Backend | ResolvedWebDavBackend | ResolvedGitBackend;
|
|
161
|
-
|
|
162
|
-
export interface SyncConfig<Backend extends ResolvedSyncBackend = ResolvedS3Backend> {
|
|
163
|
-
setupName: string;
|
|
164
|
-
connectionName: string;
|
|
165
|
-
storagePath: string;
|
|
166
|
-
/** Snapshot/wire identity retained behind the settings normalization boundary. */
|
|
167
|
-
snapshotIdentity: string;
|
|
168
|
-
include: string[];
|
|
169
|
-
automatic: boolean;
|
|
170
|
-
onSwitch: OnSwitchAction;
|
|
171
|
-
backend: Backend;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export type AnySyncConfig = SyncConfig<ResolvedSyncBackend>;
|
|
175
|
-
export type CommonSyncConfig = Omit<AnySyncConfig, "backend">;
|
|
176
|
-
|
|
177
|
-
/** UI projection over a fully validated v3 setup; it is never persisted directly. */
|
|
178
|
-
export interface PartialConfig {
|
|
179
|
-
setupName: string;
|
|
180
|
-
connectionName: string;
|
|
181
|
-
storageKind: StorageConnectionType;
|
|
182
|
-
storagePath: string;
|
|
183
|
-
include: string[];
|
|
184
|
-
automatic: boolean;
|
|
185
|
-
onSwitch: OnSwitchAction;
|
|
186
|
-
bucket?: string;
|
|
187
|
-
branch?: string;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export interface SnapshotFile {
|
|
191
|
-
path: string;
|
|
192
|
-
contentBase64: string;
|
|
193
|
-
sha256: string;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export interface SnapshotSelection {
|
|
197
|
-
version: 1;
|
|
198
|
-
include: string[];
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export interface Snapshot {
|
|
202
|
-
version: number;
|
|
203
|
-
id: string;
|
|
204
|
-
createdAt: string;
|
|
205
|
-
machine: string;
|
|
206
|
-
/** Backend-scoped remote identity retained in the snapshot wire format. */
|
|
207
|
-
profile: string;
|
|
208
|
-
syncSessions?: boolean;
|
|
209
|
-
/** Portable, credential-free included-content intent. Absent on legacy snapshots. */
|
|
210
|
-
selection?: SnapshotSelection;
|
|
211
|
-
files: SnapshotFile[];
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export interface LatestPointer {
|
|
215
|
-
version: number;
|
|
216
|
-
profile: string;
|
|
217
|
-
snapshot: string;
|
|
218
|
-
sha256: string;
|
|
219
|
-
createdAt: string;
|
|
220
|
-
machine: string;
|
|
221
|
-
syncSessions?: boolean;
|
|
222
|
-
/** Lightweight projection; the immutable snapshot remains authoritative. */
|
|
223
|
-
selection?: SnapshotSelection;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export interface RemoteObject<T> {
|
|
227
|
-
value?: T;
|
|
228
|
-
etag?: string;
|
|
229
|
-
missing: boolean;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export interface SyncState {
|
|
233
|
-
version: number;
|
|
234
|
-
profile: string;
|
|
235
|
-
lastAppliedSnapshot?: string;
|
|
236
|
-
lastRemoteRevision?: string;
|
|
237
|
-
lastRemoteEtag?: string;
|
|
238
|
-
lastFileHashes: Record<string, string>;
|
|
239
|
-
include?: string[];
|
|
240
|
-
/** Legacy state fields are read only so v3 can detect and replace stale policy state. */
|
|
241
|
-
syncFiles?: string[];
|
|
242
|
-
syncSessions?: boolean;
|
|
243
|
-
extraFiles?: string[];
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export interface LockFile {
|
|
247
|
-
id: string;
|
|
248
|
-
pid: number;
|
|
249
|
-
command: string;
|
|
250
|
-
startedAt: string;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export interface CommandOptions {
|
|
254
|
-
yes: boolean;
|
|
255
|
-
force: boolean;
|
|
256
|
-
stale: boolean;
|
|
257
|
-
silent: boolean;
|
|
258
|
-
reload: boolean;
|
|
259
|
-
auto: boolean;
|
|
260
|
-
setup?: string;
|
|
261
|
-
signal?: AbortSignal;
|
|
262
|
-
onCommit?: () => void;
|
|
263
|
-
args: string[];
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export interface CommandArgumentCompletion {
|
|
267
|
-
value: string;
|
|
268
|
-
label: string;
|
|
269
|
-
description?: string;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
export interface SnapshotOptions {
|
|
273
|
-
include?: string[];
|
|
274
|
-
sessionDir?: string;
|
|
275
|
-
/** Temporary internal projections while snapshot storage remains wire-compatible. */
|
|
276
|
-
syncFiles?: string[];
|
|
277
|
-
syncSessions?: boolean;
|
|
278
|
-
extraFiles?: string[];
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
export interface SnapshotApplyPlan {
|
|
282
|
-
writes: Array<{ target: string; content: Buffer }>;
|
|
283
|
-
deletes: string[];
|
|
284
|
-
}
|
|
1
|
+
// Compatibility type surface; implementation modules import from the owning domain.
|
|
2
|
+
|
|
3
|
+
export type {
|
|
4
|
+
LatestPointer,
|
|
5
|
+
RemoteObject,
|
|
6
|
+
ResolvedGitBackend,
|
|
7
|
+
ResolvedGitDestination,
|
|
8
|
+
ResolvedGitStorageProfile,
|
|
9
|
+
ResolvedS3Backend,
|
|
10
|
+
ResolvedS3Destination,
|
|
11
|
+
ResolvedS3StorageProfile,
|
|
12
|
+
ResolvedSyncBackend,
|
|
13
|
+
ResolvedWebDavBackend,
|
|
14
|
+
ResolvedWebDavDestination,
|
|
15
|
+
ResolvedWebDavStorageProfile,
|
|
16
|
+
} from "./backends/backend-types.js";
|
|
17
|
+
export type { CommandArgumentCompletion, CommandOptions } from "./commands/command-types.js";
|
|
18
|
+
export type {
|
|
19
|
+
AnySyncConfig,
|
|
20
|
+
CommonSyncConfig,
|
|
21
|
+
CommonSyncSetupStorageSettings,
|
|
22
|
+
GitStorageConnectionSettings,
|
|
23
|
+
GitSyncSetupStorageSettings,
|
|
24
|
+
OnSwitchAction,
|
|
25
|
+
PartialConfig,
|
|
26
|
+
PiSyncSettingsV3,
|
|
27
|
+
S3CredentialsSettings,
|
|
28
|
+
S3StorageConnectionSettings,
|
|
29
|
+
S3SyncSetupStorageSettings,
|
|
30
|
+
StorageConnectionSettings,
|
|
31
|
+
StorageConnectionType,
|
|
32
|
+
SyncConfig,
|
|
33
|
+
SyncPolicySettings,
|
|
34
|
+
SyncSetupSettings,
|
|
35
|
+
SyncSetupStorageSettings,
|
|
36
|
+
WebDavCredentialsSettings,
|
|
37
|
+
WebDavStorageConnectionSettings,
|
|
38
|
+
WebDavSyncSetupStorageSettings,
|
|
39
|
+
} from "./settings/settings-types.js";
|
|
40
|
+
export type {
|
|
41
|
+
Snapshot,
|
|
42
|
+
SnapshotApplyPlan,
|
|
43
|
+
SnapshotFile,
|
|
44
|
+
SnapshotOptions,
|
|
45
|
+
SnapshotSelection,
|
|
46
|
+
} from "./snapshot/snapshot-types.js";
|
|
47
|
+
export type { LockFile, SyncState } from "./state/state-types.js";
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { Key, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
|
|
7
7
|
import { runCustomInteraction } from "@narumitw/pi-tui-kit";
|
|
8
|
-
import {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import
|
|
8
|
+
import type { SetupPullOutcome } from "../sync/setup-switch.js";
|
|
9
|
+
import type { SyncDecision } from "../sync/sync-decision.js";
|
|
10
|
+
import type { RemoteSelectionDecision } from "../sync/sync-policy.js";
|
|
11
|
+
import { safeTerminalText } from "./terminal-text.js";
|
|
12
12
|
|
|
13
13
|
export type RunRouteResult =
|
|
14
14
|
| { kind: "completed"; outcome?: SetupPullOutcome }
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { loadConfig } from "../settings/config.js";
|
|
5
|
+
import { localConfigPath } from "../settings/config-file.js";
|
|
6
|
+
import { updateSyncSetup } from "../settings/settings-management.js";
|
|
7
|
+
import { agentDir } from "../snapshot/session-paths.js";
|
|
6
8
|
import {
|
|
7
9
|
BUILT_IN_SYNC_ROOTS,
|
|
8
10
|
isSafeCustomIncludePath,
|
|
9
11
|
normalizeSyncInclude,
|
|
10
12
|
syncIncludeSelection,
|
|
11
|
-
} from "
|
|
13
|
+
} from "../sync/sync-policy.js";
|
|
12
14
|
|
|
13
15
|
const BUILT_IN_PREFIX = "builtin:";
|
|
14
16
|
const CUSTOM_PREFIX = "custom:";
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import type { ActionMenuItem } from "@narumitw/pi-tui-kit";
|
|
3
|
+
import type { StartupObservation } from "../sync/sync-inspection.js";
|
|
3
4
|
import type { RunRoute } from "./cancellable-operation.js";
|
|
4
5
|
import { dispatchManagerResult } from "./manager-result-dispatcher.js";
|
|
5
6
|
import type { ManagerDescription } from "./manager-state.js";
|
|
6
7
|
import type { SyncAttentionState } from "./sync-attention.js";
|
|
7
8
|
|
|
8
9
|
export interface SyncManagerAttentionOptions {
|
|
10
|
+
getObservation?: () => StartupObservation | undefined;
|
|
11
|
+
onObservationInvalidated?: () => void;
|
|
9
12
|
getAttention?: () => SyncAttentionState | undefined;
|
|
10
13
|
onSelectionResolved?: (expected: SyncAttentionState) => void;
|
|
11
14
|
}
|
|
@@ -13,7 +16,8 @@ export interface SyncManagerAttentionOptions {
|
|
|
13
16
|
export function attentionMainMenuItems(
|
|
14
17
|
manager: ManagerDescription,
|
|
15
18
|
): ActionMenuItem<"main" | "more" | "recovery", "review-attention">[] {
|
|
16
|
-
if (!manager.attention
|
|
19
|
+
if (!manager.attention && manager.observation?.inspection.selectionState?.kind !== "different")
|
|
20
|
+
return [];
|
|
17
21
|
const disabled = manager.attentionReviewDisabled === true;
|
|
18
22
|
return [
|
|
19
23
|
{
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { runConfirmation } from "@narumitw/pi-tui-kit";
|
|
3
|
+
import {
|
|
4
|
+
inspectOperationAvailability,
|
|
5
|
+
operationCanRecover,
|
|
6
|
+
} from "../state/operation-availability.js";
|
|
7
|
+
import { errorMessage } from "../sync/sync-errors.js";
|
|
3
8
|
import type { RunRoute } from "./cancellable-operation.js";
|
|
4
|
-
import { errorMessage, safeTerminalText } from "./manager-helpers.js";
|
|
5
9
|
import type { ManagerDescription } from "./manager-state.js";
|
|
6
|
-
import {
|
|
10
|
+
import { safeTerminalText } from "./terminal-text.js";
|
|
7
11
|
|
|
8
12
|
export type RecoveryDisposition = "restored" | "stay" | "close";
|
|
9
13
|
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readStateForConfig,
|
|
8
|
-
} from "./config.js";
|
|
9
|
-
import { errorMessage, ownRecord, safeTerminalText } from "./manager-helpers.js";
|
|
2
|
+
import { loadConfig } from "../settings/config.js";
|
|
3
|
+
import { activeLocalConfigPath } from "../settings/config-file.js";
|
|
4
|
+
import { readLocalConfigObject } from "../settings/settings-store.js";
|
|
5
|
+
import type { AnySyncConfig } from "../settings/settings-types.js";
|
|
6
|
+
import { isCloudflareR2Endpoint, ownRecord } from "../settings/settings-validation.js";
|
|
10
7
|
import {
|
|
11
8
|
inspectOperationAvailability,
|
|
12
9
|
type OperationAvailability,
|
|
13
10
|
operationBlocksChanges,
|
|
14
11
|
operationCanRecover,
|
|
15
|
-
} from "
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
12
|
+
} from "../state/operation-availability.js";
|
|
13
|
+
import { readStateForConfig, syncStateFingerprint } from "../state/sync-state-store.js";
|
|
14
|
+
import { errorMessage } from "../sync/sync-errors.js";
|
|
15
|
+
import type { StartupObservation } from "../sync/sync-inspection.js";
|
|
16
|
+
import { compareSyncInclude, syncIncludeSelection } from "../sync/sync-policy.js";
|
|
17
|
+
import { automaticSyncSummary } from "./automatic-sync-summary.js";
|
|
18
|
+
import {
|
|
19
|
+
observationMatchesConfig,
|
|
20
|
+
observationSummary,
|
|
21
|
+
type SyncAttentionState,
|
|
22
|
+
syncAttentionMatchesConfig,
|
|
23
|
+
} from "./sync-attention.js";
|
|
18
24
|
import { countValidSyncSetups } from "./sync-setups-ui.js";
|
|
19
|
-
import
|
|
25
|
+
import { safeTerminalText } from "./terminal-text.js";
|
|
20
26
|
|
|
21
27
|
export const MAIN_MENU_ACTIONS = [
|
|
22
28
|
"Sync now (recommended)",
|
|
@@ -31,6 +37,7 @@ export interface ManagerDescription {
|
|
|
31
37
|
actions: string[];
|
|
32
38
|
operation?: OperationAvailability;
|
|
33
39
|
attention?: SyncAttentionState;
|
|
40
|
+
observation?: StartupObservation;
|
|
34
41
|
attentionBlocksSync?: boolean;
|
|
35
42
|
attentionReviewDisabled?: boolean;
|
|
36
43
|
}
|
|
@@ -39,6 +46,7 @@ export async function describeManagerState(
|
|
|
39
46
|
signal?: AbortSignal,
|
|
40
47
|
attention?: SyncAttentionState,
|
|
41
48
|
inspectOperation: () => Promise<OperationAvailability> = inspectOperationAvailability,
|
|
49
|
+
observation?: StartupObservation,
|
|
42
50
|
): Promise<ManagerDescription> {
|
|
43
51
|
let raw: Record<string, unknown> | undefined;
|
|
44
52
|
try {
|
|
@@ -105,6 +113,13 @@ export async function describeManagerState(
|
|
|
105
113
|
const syncState = changesBlocked
|
|
106
114
|
? undefined
|
|
107
115
|
: await readStateForConfig(config).catch(() => undefined);
|
|
116
|
+
const currentObservation =
|
|
117
|
+
observation &&
|
|
118
|
+
observationMatchesConfig(observation, config) &&
|
|
119
|
+
syncState &&
|
|
120
|
+
syncStateFingerprint(syncState) === observation.inspection.stateIdentity
|
|
121
|
+
? observation
|
|
122
|
+
: undefined;
|
|
108
123
|
const lastAppliedSnapshot = changesBlocked
|
|
109
124
|
? "Unavailable while operations are locked"
|
|
110
125
|
: syncState?.lastAppliedSnapshot
|
|
@@ -122,7 +137,7 @@ export async function describeManagerState(
|
|
|
122
137
|
`Current sync setup: ${safeTerminalText(config.setupName)}`,
|
|
123
138
|
`Storage: ${backendStorageDescription(config)}`,
|
|
124
139
|
`Included: ${selection.builtIns.length} built-in group${selection.builtIns.length === 1 ? "" : "s"} · ${selection.custom.length} extra path${selection.custom.length === 1 ? "" : "s"} · Sessions ${selection.sessions ? "on" : "off"}`,
|
|
125
|
-
`Automatic sync: ${config.automatic
|
|
140
|
+
`Automatic sync: ${automaticSyncSummary(config.automatic)}`,
|
|
126
141
|
`Last applied: ${lastAppliedSnapshot}`,
|
|
127
142
|
...(currentAttention
|
|
128
143
|
? [
|
|
@@ -135,7 +150,12 @@ export async function describeManagerState(
|
|
|
135
150
|
: `Remote-only paths: ${attentionComparison?.remoteOnly.length ?? 0} · Device-only paths: ${attentionComparison?.localOnly.length ?? 0}`,
|
|
136
151
|
"Nothing has been changed.",
|
|
137
152
|
]
|
|
138
|
-
:
|
|
153
|
+
: currentObservation
|
|
154
|
+
? [
|
|
155
|
+
`Startup check (${safeTerminalText(currentObservation.checkedAt)}): ${observationSummary(currentObservation)}`,
|
|
156
|
+
"Check-time observation only; synchronization rechecks current content.",
|
|
157
|
+
]
|
|
158
|
+
: ["Remote status: Not checked"]),
|
|
139
159
|
...(noSyncedContent
|
|
140
160
|
? [
|
|
141
161
|
"",
|
|
@@ -152,6 +172,7 @@ export async function describeManagerState(
|
|
|
152
172
|
).join("\n"),
|
|
153
173
|
actions: operationActions(operation, noSyncedContent, canSwitch, mainActions),
|
|
154
174
|
operation,
|
|
175
|
+
...(currentObservation ? { observation: currentObservation } : {}),
|
|
155
176
|
...(currentAttention
|
|
156
177
|
? {
|
|
157
178
|
attention: currentAttention,
|