@narumitw/pi-sync-daemon 0.6.2 → 0.8.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 +19 -0
- package/README.md +17 -3
- package/dist/consent.js +26 -1
- package/dist/engine/backends/git/git-backend.d.ts +1 -1
- package/dist/engine/backends/git/git-backend.js +17 -2
- package/dist/engine/backends/git/git-storage.d.ts +1 -1
- package/dist/engine/backends/git/git-storage.js +39 -13
- package/dist/engine/backends/s3/s3-backend.js +8 -0
- package/dist/engine/backends/sync-backend.d.ts +1 -0
- package/dist/engine/backends/webdav/webdav-backend.js +8 -0
- package/dist/engine/ignore/effective-ignore-policy.d.ts +10 -0
- package/dist/engine/ignore/effective-ignore-policy.js +33 -0
- package/dist/engine/ignore/ignore-edit.d.ts +13 -0
- package/dist/engine/ignore/ignore-edit.js +102 -0
- package/dist/engine/ignore/ignore-initialization.d.ts +6 -0
- package/dist/engine/ignore/ignore-initialization.js +186 -0
- package/dist/engine/ignore/ignore-migration-prompt.d.ts +7 -0
- package/dist/engine/ignore/ignore-migration-prompt.js +139 -0
- package/dist/engine/ignore/ignore-settings.d.ts +15 -0
- package/dist/engine/ignore/ignore-settings.js +322 -0
- package/dist/engine/ignore/ignore-source.d.ts +27 -0
- package/dist/engine/ignore/ignore-source.js +250 -0
- package/dist/engine/paths.js +1 -1
- package/dist/engine/settings/config-file.d.ts +9 -2
- package/dist/engine/settings/config-file.js +126 -28
- package/dist/engine/settings/config.d.ts +5 -4
- package/dist/engine/settings/config.js +114 -13
- package/dist/engine/settings/settings-management.js +34 -32
- package/dist/engine/settings/settings-types.d.ts +40 -5
- package/dist/engine/settings/settings-validation.js +52 -24
- package/dist/engine/snapshot/session-paths.d.ts +6 -4
- package/dist/engine/snapshot/session-paths.js +84 -15
- package/dist/engine/snapshot/snapshot-apply.d.ts +7 -8
- package/dist/engine/snapshot/snapshot-apply.js +107 -21
- package/dist/engine/snapshot/snapshot-bounds.d.ts +4 -0
- package/dist/engine/snapshot/snapshot-bounds.js +20 -0
- package/dist/engine/snapshot/snapshot-codec.d.ts +1 -1
- package/dist/engine/snapshot/snapshot-codec.js +15 -7
- package/dist/engine/snapshot/snapshot-entry-projection.d.ts +10 -0
- package/dist/engine/snapshot/snapshot-entry-projection.js +78 -0
- package/dist/engine/snapshot/snapshot-exclude-safety.d.ts +9 -2
- package/dist/engine/snapshot/snapshot-exclude-safety.js +239 -24
- package/dist/engine/snapshot/snapshot-payload.d.ts +2 -0
- package/dist/engine/snapshot/snapshot-payload.js +10 -0
- package/dist/engine/snapshot/snapshot-reviewed-preimages.d.ts +2 -0
- package/dist/engine/snapshot/snapshot-reviewed-preimages.js +60 -0
- package/dist/engine/snapshot/snapshot-root-transition.d.ts +4 -0
- package/dist/engine/snapshot/snapshot-root-transition.js +16 -0
- package/dist/engine/snapshot/snapshot-transaction-images.d.ts +39 -0
- package/dist/engine/snapshot/snapshot-transaction-images.js +387 -0
- package/dist/engine/snapshot/snapshot-transaction-policy.d.ts +73 -0
- package/dist/engine/snapshot/snapshot-transaction-policy.js +276 -0
- package/dist/engine/snapshot/snapshot-transaction-stage.d.ts +32 -0
- package/dist/engine/snapshot/snapshot-transaction-stage.js +303 -0
- package/dist/engine/snapshot/snapshot-transaction-verification.d.ts +7 -0
- package/dist/engine/snapshot/snapshot-transaction-verification.js +78 -0
- package/dist/engine/snapshot/snapshot-transaction.d.ts +1 -11
- package/dist/engine/snapshot/snapshot-transaction.js +390 -364
- package/dist/engine/snapshot/snapshot-types.d.ts +47 -2
- package/dist/engine/snapshot/snapshot-types.js +9 -1
- package/dist/engine/snapshot/snapshot.d.ts +22 -3
- package/dist/engine/snapshot/snapshot.js +357 -43
- package/dist/engine/state/merge-baseline-store.js +20 -9
- package/dist/engine/state/state-types.d.ts +3 -0
- package/dist/engine/sync/apply-review.d.ts +3 -3
- package/dist/engine/sync/apply-review.js +5 -4
- package/dist/engine/sync/continuous-sync.js +37 -12
- package/dist/engine/sync/continuous-watch.d.ts +4 -1
- package/dist/engine/sync/continuous-watch.js +90 -15
- package/dist/engine/sync/exclude-policy.d.ts +4 -0
- package/dist/engine/sync/exclude-policy.js +8 -1
- package/dist/engine/sync/initialization.js +9 -4
- package/dist/engine/sync/local-fields.d.ts +3 -1
- package/dist/engine/sync/local-fields.js +88 -8
- package/dist/engine/sync/merge-apply.js +190 -47
- package/dist/engine/sync/merge-journal.d.ts +18 -4
- package/dist/engine/sync/merge-journal.js +126 -10
- package/dist/engine/sync/merged-sync.d.ts +1 -1
- package/dist/engine/sync/merged-sync.js +124 -68
- package/dist/engine/sync/partial-progress.js +5 -3
- package/dist/engine/sync/remote-snapshot.d.ts +10 -2
- package/dist/engine/sync/remote-snapshot.js +59 -17
- package/dist/engine/sync/session-push.js +7 -6
- package/dist/engine/sync/sync-decision.d.ts +4 -0
- package/dist/engine/sync/sync-decision.js +17 -2
- package/dist/engine/sync/sync-inspection.js +8 -6
- package/dist/engine/sync/sync-mutations.d.ts +10 -2
- package/dist/engine/sync/sync-mutations.js +245 -101
- package/dist/engine/sync/sync-policy.d.ts +36 -10
- package/dist/engine/sync/sync-policy.js +285 -20
- package/dist/engine/sync/sync-queries.js +49 -32
- package/dist/engine/sync/sync-state.d.ts +11 -0
- package/dist/engine/sync/sync-state.js +42 -5
- package/dist/engine/ui/sync-format.js +22 -7
- package/dist/engine-service.js +24 -2
- package/docs/architecture.md +28 -0
- package/package.json +2 -1
|
@@ -3,15 +3,50 @@ export interface SnapshotFile {
|
|
|
3
3
|
contentBase64: string;
|
|
4
4
|
sha256: string;
|
|
5
5
|
}
|
|
6
|
+
export interface EffectiveIgnorePolicy {
|
|
7
|
+
filename: string;
|
|
8
|
+
sourceDigest: string;
|
|
9
|
+
fingerprint: string;
|
|
10
|
+
sessions: boolean;
|
|
11
|
+
reservedNames: readonly string[];
|
|
12
|
+
matches(path: string, directory?: boolean): boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface DirectoryScope {
|
|
15
|
+
scope?: "agent-directory";
|
|
16
|
+
reinclude?: readonly string[];
|
|
17
|
+
ignorePolicy?: EffectiveIgnorePolicy;
|
|
18
|
+
reservedIgnoreNames?: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
export declare const IGNORE_SNAPSHOT_VERSION = 6;
|
|
21
|
+
export declare function isSupportedSnapshotVersion(version: unknown): version is 1 | 2 | 3 | 4 | 5 | 6;
|
|
22
|
+
export interface IgnoreSnapshotSelection {
|
|
23
|
+
version: 4;
|
|
24
|
+
scope: "agent-directory";
|
|
25
|
+
fingerprint: string;
|
|
26
|
+
sessions: boolean;
|
|
27
|
+
include?: never;
|
|
28
|
+
exclude?: never;
|
|
29
|
+
reinclude?: never;
|
|
30
|
+
}
|
|
6
31
|
export type SnapshotSelection = {
|
|
7
32
|
version: 1;
|
|
8
33
|
include: string[];
|
|
9
34
|
exclude?: never;
|
|
35
|
+
scope?: never;
|
|
36
|
+
reinclude?: never;
|
|
10
37
|
} | {
|
|
11
38
|
version: 2;
|
|
12
39
|
include: string[];
|
|
13
40
|
exclude: string[];
|
|
14
|
-
|
|
41
|
+
scope?: never;
|
|
42
|
+
reinclude?: never;
|
|
43
|
+
} | {
|
|
44
|
+
version: 3;
|
|
45
|
+
scope: "agent-directory";
|
|
46
|
+
include: string[];
|
|
47
|
+
exclude: string[];
|
|
48
|
+
reinclude: string[];
|
|
49
|
+
} | IgnoreSnapshotSelection;
|
|
15
50
|
export interface Snapshot {
|
|
16
51
|
version: number;
|
|
17
52
|
id: string;
|
|
@@ -25,10 +60,20 @@ export interface Snapshot {
|
|
|
25
60
|
localFields?: string[];
|
|
26
61
|
files: SnapshotFile[];
|
|
27
62
|
}
|
|
28
|
-
export interface
|
|
63
|
+
export interface AgentDirectoryInventory {
|
|
64
|
+
root: string;
|
|
65
|
+
sessionRoot: string;
|
|
66
|
+
scanSessions: boolean;
|
|
67
|
+
entries: ReadonlyMap<string, "file" | "directory" | "unreviewed">;
|
|
68
|
+
fileSizes: ReadonlyMap<string, number>;
|
|
69
|
+
walkedDirectories: ReadonlySet<string>;
|
|
70
|
+
routingDirectories: ReadonlySet<string>;
|
|
71
|
+
}
|
|
72
|
+
export interface SnapshotOptions extends DirectoryScope {
|
|
29
73
|
signal?: AbortSignal;
|
|
30
74
|
/** Caller-owned session/generation guard, rechecked at file-mutation boundaries. */
|
|
31
75
|
validateMutation?: () => void;
|
|
76
|
+
validateIgnorePolicy?: () => Promise<void>;
|
|
32
77
|
/** Reviewed regular-file preimages; null means the path was absent. Checked under mutation queues. */
|
|
33
78
|
expectedFileHashes?: Readonly<Record<string, string | null>>;
|
|
34
79
|
include?: string[];
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
+
import { reservedIgnoreTargetGuard } from "./snapshot-exclude-safety.js";
|
|
1
2
|
export { isDeniedPath } from "../paths.js";
|
|
2
3
|
export { sessionStorageRoot } from "./snapshot-paths.js";
|
|
3
4
|
import { type SyncSelectionConfig } from "../sync/sync-policy.js";
|
|
4
|
-
import type
|
|
5
|
+
import { type AgentDirectoryInventory, type Snapshot, type SnapshotFile, type SnapshotOptions } from "./snapshot-types.js";
|
|
5
6
|
export { canonicalSnapshotPathForConfig, isConfiguredSnapshotPath } from "../sync/sync-policy.js";
|
|
7
|
+
export declare function agentDirectoryInventory(snapshot: Pick<Snapshot, "files">): AgentDirectoryInventory | undefined;
|
|
6
8
|
export declare function regenerateSnapshotIdentity(snapshot: Snapshot): Snapshot;
|
|
7
9
|
export declare function createSnapshot(profile: string, options?: SnapshotOptions): Promise<Snapshot>;
|
|
8
|
-
export declare function collectFiles(root: string, options?: SnapshotOptions, excluded?: (relativePath: string) => boolean): Promise<SnapshotFile[]>;
|
|
10
|
+
export declare function collectFiles(root: string, options?: SnapshotOptions, excluded?: (relativePath: string, directory?: boolean) => boolean): Promise<SnapshotFile[]>;
|
|
11
|
+
export declare function agentDirectoryConfiguredSessionDir(signal?: AbortSignal, root?: string, options?: Pick<SnapshotOptions, "reservedIgnoreNames">): Promise<string | undefined>;
|
|
12
|
+
export declare function readAgentDirectorySettings(signal?: AbortSignal, root?: string, options?: Pick<SnapshotOptions, "reservedIgnoreNames">): Promise<Buffer<ArrayBuffer> | undefined>;
|
|
13
|
+
export declare function agentDirectorySessionDirFromSettings(content: Buffer): string | undefined;
|
|
14
|
+
export type AgentDirectoryScanOptions = SyncSelectionConfig & Pick<SnapshotOptions, "sessionDir" | "signal" | "validateMutation">;
|
|
15
|
+
export declare function scanAgentDirectoryInventory(root: string, options: AgentDirectoryScanOptions, pendingStateEntry?: string): Promise<{
|
|
16
|
+
root: string;
|
|
17
|
+
sessionRoot: string;
|
|
18
|
+
scanSessions: boolean;
|
|
19
|
+
entries: Map<string, "directory" | "file" | "unreviewed">;
|
|
20
|
+
fileSizes: Map<string, number>;
|
|
21
|
+
walkedDirectories: Set<string>;
|
|
22
|
+
routingDirectories: Set<string>;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function readLegacySnapshotSource(absolutePath: string, guardReserved: ReturnType<typeof reservedIgnoreTargetGuard>, signal?: AbortSignal): Promise<Buffer<ArrayBuffer>>;
|
|
9
25
|
export declare function isSessionPath(relativePath: string): boolean;
|
|
10
26
|
export declare function isSessionFilePath(relativePath: string): boolean;
|
|
11
27
|
export declare function sessionSnapshotPathFromAbsolute(sessionFile: string, configuredSessionDir?: string): string | undefined;
|
|
@@ -13,6 +29,7 @@ export declare function snapshotTarget(root: string, relativePath: string, confi
|
|
|
13
29
|
export declare function snapshotIncludesSessions(snapshot: Snapshot): boolean;
|
|
14
30
|
export declare function filterSnapshotForConfigPolicy(snapshot: Snapshot, config: SyncSelectionConfig, options?: {
|
|
15
31
|
regenerateId?: boolean;
|
|
32
|
+
sessionDir?: string;
|
|
16
33
|
}): {
|
|
17
34
|
id: string;
|
|
18
35
|
createdAt: string;
|
|
@@ -26,5 +43,7 @@ export declare function filterSnapshotForConfigPolicy(snapshot: Snapshot, config
|
|
|
26
43
|
};
|
|
27
44
|
export declare function snapshotWithoutSessions(snapshot: Snapshot): Snapshot;
|
|
28
45
|
export declare function scanSnapshot(snapshot: Snapshot): string[];
|
|
29
|
-
export declare function mergeRemotePreservedFiles(local: Snapshot, remote: Snapshot, config: SyncSelectionConfig
|
|
46
|
+
export declare function mergeRemotePreservedFiles(local: Snapshot, remote: Snapshot, config: SyncSelectionConfig, options?: {
|
|
47
|
+
sessionDir?: string;
|
|
48
|
+
}): Snapshot;
|
|
30
49
|
export declare function mergeRemoteSessionFiles(local: Snapshot, remote: Snapshot): Snapshot;
|