@remnic/core 1.1.15 → 1.1.16
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/dist/access-cli.js +2 -2
- package/dist/access-http.d.ts +1 -1
- package/dist/access-http.js +5 -5
- package/dist/access-mcp.d.ts +1 -1
- package/dist/access-mcp.js +4 -4
- package/dist/access-schema.d.ts +17 -3
- package/dist/access-schema.js +3 -1
- package/dist/{access-service-BCMine1s.d.ts → access-service-DZXc7qwR.d.ts} +11 -1
- package/dist/access-service.d.ts +1 -1
- package/dist/access-service.js +2 -2
- package/dist/{chunk-GSP6ZKOY.js → chunk-2OZ6GP27.js} +81 -18
- package/dist/chunk-2OZ6GP27.js.map +1 -0
- package/dist/{chunk-VWFIQOTJ.js → chunk-66H2DZYB.js} +8 -1
- package/dist/chunk-66H2DZYB.js.map +1 -0
- package/dist/{chunk-ZYRMKWVW.js → chunk-HJILHQOR.js} +4 -4
- package/dist/{chunk-HJ2WMBFB.js → chunk-MTYLGYOQ.js} +15 -4
- package/dist/chunk-MTYLGYOQ.js.map +1 -0
- package/dist/{chunk-BNATB54A.js → chunk-SK42SSAN.js} +3 -3
- package/dist/{chunk-5D2G67ZQ.js → chunk-Y2YBRCEF.js} +29 -3
- package/dist/chunk-Y2YBRCEF.js.map +1 -0
- package/dist/{cli-B71zQ6XK.d.ts → cli-kVwab1_L.d.ts} +1 -1
- package/dist/cli.d.ts +2 -2
- package/dist/cli.js +6 -6
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/mcp-memory-inspector-app.d.ts +1 -1
- package/dist/offline-sync.d.ts +10 -1
- package/dist/offline-sync.js +3 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/transfer/types.d.ts +12 -12
- package/package.json +1 -1
- package/src/access-http.test.ts +73 -0
- package/src/access-http.ts +15 -0
- package/src/access-schema.ts +12 -0
- package/src/access-service-namespace.test.ts +64 -1
- package/src/access-service.ts +44 -0
- package/src/index.ts +1 -0
- package/src/offline-sync.test.ts +125 -0
- package/src/offline-sync.ts +107 -18
- package/dist/chunk-5D2G67ZQ.js.map +0 -1
- package/dist/chunk-GSP6ZKOY.js.map +0 -1
- package/dist/chunk-HJ2WMBFB.js.map +0 -1
- package/dist/chunk-VWFIQOTJ.js.map +0 -1
- /package/dist/{chunk-ZYRMKWVW.js.map → chunk-HJILHQOR.js.map} +0 -0
- /package/dist/{chunk-BNATB54A.js.map → chunk-SK42SSAN.js.map} +0 -0
package/dist/access-cli.js
CHANGED
|
@@ -135,7 +135,7 @@ import "./chunk-PVGDJXVK.js";
|
|
|
135
135
|
import "./chunk-NGAVDO7E.js";
|
|
136
136
|
import {
|
|
137
137
|
EngramAccessService
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-Y2YBRCEF.js";
|
|
139
139
|
import "./chunk-ZKSK55RC.js";
|
|
140
140
|
import "./chunk-WELDCG6C.js";
|
|
141
141
|
import "./chunk-ZYVPLJ4T.js";
|
|
@@ -149,7 +149,7 @@ import "./chunk-MGKYQQYF.js";
|
|
|
149
149
|
import "./chunk-GL6I6MEQ.js";
|
|
150
150
|
import "./chunk-3APJ5EVB.js";
|
|
151
151
|
import "./chunk-5UM2VJ6D.js";
|
|
152
|
-
import "./chunk-
|
|
152
|
+
import "./chunk-2OZ6GP27.js";
|
|
153
153
|
import "./chunk-65HQPW6O.js";
|
|
154
154
|
import "./chunk-EIR5VLIH.js";
|
|
155
155
|
import "./chunk-PCUKNJAZ.js";
|
package/dist/access-http.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IncomingMessage } from 'node:http';
|
|
2
|
-
import { E as EngramAccessService } from './access-service-
|
|
2
|
+
import { E as EngramAccessService } from './access-service-DZXc7qwR.js';
|
|
3
3
|
import { ResolvedIdentity } from './adapters/types.js';
|
|
4
4
|
import { AdapterRegistry } from './adapters/registry.js';
|
|
5
5
|
import './storage.js';
|
package/dist/access-http.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EngramAccessHttpServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MTYLGYOQ.js";
|
|
4
4
|
import "./chunk-SEDEKFYQ.js";
|
|
5
5
|
import "./chunk-6FC5EGNV.js";
|
|
6
6
|
import "./chunk-3Y4P7RXM.js";
|
|
@@ -8,10 +8,10 @@ import "./chunk-6LVVDPJ4.js";
|
|
|
8
8
|
import "./chunk-7MNMYOFP.js";
|
|
9
9
|
import "./chunk-FKFMOY3N.js";
|
|
10
10
|
import "./chunk-FAJ7FZYM.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-SK42SSAN.js";
|
|
12
12
|
import "./chunk-C5BCH4ZS.js";
|
|
13
13
|
import "./chunk-IQT3XTKW.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-Y2YBRCEF.js";
|
|
15
15
|
import "./chunk-ZKSK55RC.js";
|
|
16
16
|
import "./chunk-WELDCG6C.js";
|
|
17
17
|
import "./chunk-ZYVPLJ4T.js";
|
|
@@ -25,7 +25,7 @@ import "./chunk-MGKYQQYF.js";
|
|
|
25
25
|
import "./chunk-GL6I6MEQ.js";
|
|
26
26
|
import "./chunk-3APJ5EVB.js";
|
|
27
27
|
import "./chunk-5UM2VJ6D.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-2OZ6GP27.js";
|
|
29
29
|
import "./chunk-65HQPW6O.js";
|
|
30
30
|
import "./chunk-EIR5VLIH.js";
|
|
31
31
|
import "./chunk-PCUKNJAZ.js";
|
|
@@ -71,7 +71,7 @@ import "./chunk-TVVEYCNW.js";
|
|
|
71
71
|
import "./chunk-RFYAYKTD.js";
|
|
72
72
|
import "./chunk-LBLXEFWK.js";
|
|
73
73
|
import "./chunk-XKECPATV.js";
|
|
74
|
-
import "./chunk-
|
|
74
|
+
import "./chunk-66H2DZYB.js";
|
|
75
75
|
import "./chunk-QA2ZAPBU.js";
|
|
76
76
|
import "./chunk-WEHSQBFR.js";
|
|
77
77
|
import "./chunk-KNKUID7G.js";
|
package/dist/access-mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Readable, Writable } from 'node:stream';
|
|
2
|
-
import { E as EngramAccessService } from './access-service-
|
|
2
|
+
import { E as EngramAccessService } from './access-service-DZXc7qwR.js';
|
|
3
3
|
import './storage.js';
|
|
4
4
|
import './page-versioning.js';
|
|
5
5
|
import './consolidation-operator.js';
|
package/dist/access-mcp.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EngramMcpServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SK42SSAN.js";
|
|
4
4
|
import "./chunk-C5BCH4ZS.js";
|
|
5
5
|
import "./chunk-IQT3XTKW.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-Y2YBRCEF.js";
|
|
7
7
|
import "./chunk-ZKSK55RC.js";
|
|
8
8
|
import "./chunk-WELDCG6C.js";
|
|
9
9
|
import "./chunk-ZYVPLJ4T.js";
|
|
@@ -17,7 +17,7 @@ import "./chunk-MGKYQQYF.js";
|
|
|
17
17
|
import "./chunk-GL6I6MEQ.js";
|
|
18
18
|
import "./chunk-3APJ5EVB.js";
|
|
19
19
|
import "./chunk-5UM2VJ6D.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-2OZ6GP27.js";
|
|
21
21
|
import "./chunk-65HQPW6O.js";
|
|
22
22
|
import "./chunk-EIR5VLIH.js";
|
|
23
23
|
import "./chunk-PCUKNJAZ.js";
|
|
@@ -63,7 +63,7 @@ import "./chunk-TVVEYCNW.js";
|
|
|
63
63
|
import "./chunk-RFYAYKTD.js";
|
|
64
64
|
import "./chunk-LBLXEFWK.js";
|
|
65
65
|
import "./chunk-XKECPATV.js";
|
|
66
|
-
import "./chunk-
|
|
66
|
+
import "./chunk-66H2DZYB.js";
|
|
67
67
|
import "./chunk-QA2ZAPBU.js";
|
|
68
68
|
import "./chunk-WEHSQBFR.js";
|
|
69
69
|
import "./chunk-KNKUID7G.js";
|
package/dist/access-schema.d.ts
CHANGED
|
@@ -575,6 +575,19 @@ declare const offlineSyncApplyRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
575
575
|
namespace?: string | undefined;
|
|
576
576
|
changeset?: unknown;
|
|
577
577
|
}>;
|
|
578
|
+
declare const offlineSyncFilesRequestSchema: z.ZodObject<{
|
|
579
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
580
|
+
includeTranscripts: z.ZodOptional<z.ZodBoolean>;
|
|
581
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
582
|
+
}, "strip", z.ZodTypeAny, {
|
|
583
|
+
paths: string[];
|
|
584
|
+
namespace?: string | undefined;
|
|
585
|
+
includeTranscripts?: boolean | undefined;
|
|
586
|
+
}, {
|
|
587
|
+
paths: string[];
|
|
588
|
+
namespace?: string | undefined;
|
|
589
|
+
includeTranscripts?: boolean | undefined;
|
|
590
|
+
}>;
|
|
578
591
|
declare const actionConfidenceRequestSchema: z.ZodObject<{
|
|
579
592
|
intendedAction: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
580
593
|
confidence: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodNumber>>, number | undefined, number | null | undefined>;
|
|
@@ -743,9 +756,10 @@ type CapsuleExportRequest = z.infer<typeof capsuleExportRequestSchema>;
|
|
|
743
756
|
type CapsuleImportRequest = z.infer<typeof capsuleImportRequestSchema>;
|
|
744
757
|
type CapsuleListRequest = z.infer<typeof capsuleListRequestSchema>;
|
|
745
758
|
type OfflineSyncApplyRequest = z.infer<typeof offlineSyncApplyRequestSchema>;
|
|
759
|
+
type OfflineSyncFilesRequest = z.infer<typeof offlineSyncFilesRequestSchema>;
|
|
746
760
|
type ActionConfidenceRequest = z.infer<typeof actionConfidenceRequestSchema>;
|
|
747
|
-
type SchemaName = "recall" | "recallExplain" | "setCodingContext" | "observe" | "memoryStore" | "suggestionSubmit" | "reviewDisposition" | "trustZonePromote" | "trustZoneDemoSeed" | "lcmSearch" | "lcmCompactionFlush" | "lcmCompactionRecord" | "daySummary" | "capsuleExport" | "capsuleImport" | "capsuleList" | "offlineSyncApply" | "actionConfidence";
|
|
748
|
-
type SchemaTypeFor<N extends SchemaName> = N extends "recall" ? RecallRequest : N extends "recallExplain" ? RecallExplainRequest : N extends "setCodingContext" ? SetCodingContextRequest : N extends "observe" ? ObserveRequest : N extends "memoryStore" ? MemoryStoreRequest : N extends "suggestionSubmit" ? SuggestionSubmitRequest : N extends "reviewDisposition" ? ReviewDispositionRequest : N extends "trustZonePromote" ? TrustZonePromoteRequest : N extends "trustZoneDemoSeed" ? TrustZoneDemoSeedRequest : N extends "lcmSearch" ? LcmSearchRequest : N extends "lcmCompactionFlush" ? LcmCompactionFlushRequest : N extends "lcmCompactionRecord" ? LcmCompactionRecordRequest : N extends "daySummary" ? DaySummaryRequest : N extends "capsuleExport" ? CapsuleExportRequest : N extends "capsuleImport" ? CapsuleImportRequest : N extends "capsuleList" ? CapsuleListRequest : N extends "offlineSyncApply" ? OfflineSyncApplyRequest : N extends "actionConfidence" ? ActionConfidenceRequest : never;
|
|
761
|
+
type SchemaName = "recall" | "recallExplain" | "setCodingContext" | "observe" | "memoryStore" | "suggestionSubmit" | "reviewDisposition" | "trustZonePromote" | "trustZoneDemoSeed" | "lcmSearch" | "lcmCompactionFlush" | "lcmCompactionRecord" | "daySummary" | "capsuleExport" | "capsuleImport" | "capsuleList" | "offlineSyncFiles" | "offlineSyncApply" | "actionConfidence";
|
|
762
|
+
type SchemaTypeFor<N extends SchemaName> = N extends "recall" ? RecallRequest : N extends "recallExplain" ? RecallExplainRequest : N extends "setCodingContext" ? SetCodingContextRequest : N extends "observe" ? ObserveRequest : N extends "memoryStore" ? MemoryStoreRequest : N extends "suggestionSubmit" ? SuggestionSubmitRequest : N extends "reviewDisposition" ? ReviewDispositionRequest : N extends "trustZonePromote" ? TrustZonePromoteRequest : N extends "trustZoneDemoSeed" ? TrustZoneDemoSeedRequest : N extends "lcmSearch" ? LcmSearchRequest : N extends "lcmCompactionFlush" ? LcmCompactionFlushRequest : N extends "lcmCompactionRecord" ? LcmCompactionRecordRequest : N extends "daySummary" ? DaySummaryRequest : N extends "capsuleExport" ? CapsuleExportRequest : N extends "capsuleImport" ? CapsuleImportRequest : N extends "capsuleList" ? CapsuleListRequest : N extends "offlineSyncFiles" ? OfflineSyncFilesRequest : N extends "offlineSyncApply" ? OfflineSyncApplyRequest : N extends "actionConfidence" ? ActionConfidenceRequest : never;
|
|
749
763
|
/**
|
|
750
764
|
* Validate a request body against the named schema.
|
|
751
765
|
* Returns `{ success: true, data }` on pass or
|
|
@@ -759,4 +773,4 @@ declare function validateRequest<T = unknown>(schemaName: SchemaName, body: unkn
|
|
|
759
773
|
error: SchemaValidationError;
|
|
760
774
|
};
|
|
761
775
|
|
|
762
|
-
export { type ActionConfidenceRequest, type CapsuleExportRequest, type CapsuleImportRequest, type CapsuleListRequest, type DaySummaryRequest, type LcmCompactionFlushRequest, type LcmCompactionRecordRequest, type LcmSearchRequest, type MemoryStoreRequest, type ObserveRequest, type OfflineSyncApplyRequest, type RecallExplainRequest, type RecallRequest, type ReviewDispositionRequest, type SchemaName, type SchemaTypeFor, type SchemaValidationError, type SetCodingContextRequest, type SuggestionSubmitRequest, type TrustZoneDemoSeedRequest, type TrustZonePromoteRequest, actionConfidenceRequestSchema, capsuleExportRequestSchema, capsuleImportRequestSchema, capsuleListRequestSchema, codingContextSchema, daySummaryRequestSchema, formatZodError, lcmCompactionFlushRequestSchema, lcmCompactionRecordRequestSchema, lcmSearchRequestSchema, memoryStoreRequestSchema, observeRequestSchema, offlineSyncApplyRequestSchema, recallDisclosureSchema, recallExplainRequestSchema, recallRequestSchema, reviewDispositionRequestSchema, setCodingContextRequestSchema, suggestionSubmitRequestSchema, tagMatchSchema, trustZoneDemoSeedRequestSchema, trustZonePromoteRequestSchema, validateRequest };
|
|
776
|
+
export { type ActionConfidenceRequest, type CapsuleExportRequest, type CapsuleImportRequest, type CapsuleListRequest, type DaySummaryRequest, type LcmCompactionFlushRequest, type LcmCompactionRecordRequest, type LcmSearchRequest, type MemoryStoreRequest, type ObserveRequest, type OfflineSyncApplyRequest, type OfflineSyncFilesRequest, type RecallExplainRequest, type RecallRequest, type ReviewDispositionRequest, type SchemaName, type SchemaTypeFor, type SchemaValidationError, type SetCodingContextRequest, type SuggestionSubmitRequest, type TrustZoneDemoSeedRequest, type TrustZonePromoteRequest, actionConfidenceRequestSchema, capsuleExportRequestSchema, capsuleImportRequestSchema, capsuleListRequestSchema, codingContextSchema, daySummaryRequestSchema, formatZodError, lcmCompactionFlushRequestSchema, lcmCompactionRecordRequestSchema, lcmSearchRequestSchema, memoryStoreRequestSchema, observeRequestSchema, offlineSyncApplyRequestSchema, offlineSyncFilesRequestSchema, recallDisclosureSchema, recallExplainRequestSchema, recallRequestSchema, reviewDispositionRequestSchema, setCodingContextRequestSchema, suggestionSubmitRequestSchema, tagMatchSchema, trustZoneDemoSeedRequestSchema, trustZonePromoteRequestSchema, validateRequest };
|
package/dist/access-schema.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
memoryStoreRequestSchema,
|
|
13
13
|
observeRequestSchema,
|
|
14
14
|
offlineSyncApplyRequestSchema,
|
|
15
|
+
offlineSyncFilesRequestSchema,
|
|
15
16
|
recallDisclosureSchema,
|
|
16
17
|
recallExplainRequestSchema,
|
|
17
18
|
recallRequestSchema,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
trustZoneDemoSeedRequestSchema,
|
|
23
24
|
trustZonePromoteRequestSchema,
|
|
24
25
|
validateRequest
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-66H2DZYB.js";
|
|
26
27
|
import "./chunk-QA2ZAPBU.js";
|
|
27
28
|
import "./chunk-WEHSQBFR.js";
|
|
28
29
|
import "./chunk-KNKUID7G.js";
|
|
@@ -51,6 +52,7 @@ export {
|
|
|
51
52
|
memoryStoreRequestSchema,
|
|
52
53
|
observeRequestSchema,
|
|
53
54
|
offlineSyncApplyRequestSchema,
|
|
55
|
+
offlineSyncFilesRequestSchema,
|
|
54
56
|
recallDisclosureSchema,
|
|
55
57
|
recallExplainRequestSchema,
|
|
56
58
|
recallRequestSchema,
|
|
@@ -680,6 +680,12 @@ interface EngramAccessOfflineSyncSnapshotRequest {
|
|
|
680
680
|
includeTranscripts?: boolean;
|
|
681
681
|
includeContent?: boolean;
|
|
682
682
|
}
|
|
683
|
+
interface EngramAccessOfflineSyncFilesRequest {
|
|
684
|
+
namespace?: string;
|
|
685
|
+
principal?: string;
|
|
686
|
+
includeTranscripts?: boolean;
|
|
687
|
+
paths: string[];
|
|
688
|
+
}
|
|
683
689
|
interface EngramAccessOfflineSyncApplyRequest {
|
|
684
690
|
namespace?: string;
|
|
685
691
|
principal?: string;
|
|
@@ -688,6 +694,9 @@ interface EngramAccessOfflineSyncApplyRequest {
|
|
|
688
694
|
interface EngramAccessOfflineSyncSnapshotResponse extends OfflineSyncSnapshot {
|
|
689
695
|
namespace: string;
|
|
690
696
|
}
|
|
697
|
+
interface EngramAccessOfflineSyncFilesResponse extends OfflineSyncSnapshot {
|
|
698
|
+
namespace: string;
|
|
699
|
+
}
|
|
691
700
|
interface EngramAccessOfflineSyncApplyResponse extends OfflineSyncApplyChangesetResult {
|
|
692
701
|
namespace: string;
|
|
693
702
|
}
|
|
@@ -1535,6 +1544,7 @@ declare class EngramAccessService {
|
|
|
1535
1544
|
principal?: string;
|
|
1536
1545
|
}): Promise<EngramAccessCapsuleListResponse>;
|
|
1537
1546
|
offlineSyncSnapshot(options?: EngramAccessOfflineSyncSnapshotRequest): Promise<EngramAccessOfflineSyncSnapshotResponse>;
|
|
1547
|
+
offlineSyncFiles(options: EngramAccessOfflineSyncFilesRequest): Promise<EngramAccessOfflineSyncFilesResponse>;
|
|
1538
1548
|
offlineSyncApply(options: EngramAccessOfflineSyncApplyRequest): Promise<EngramAccessOfflineSyncApplyResponse>;
|
|
1539
1549
|
/**
|
|
1540
1550
|
* Return per-phase Dreams telemetry for the last N hours (default 24).
|
|
@@ -1559,4 +1569,4 @@ declare class EngramAccessService {
|
|
|
1559
1569
|
}): Promise<DreamsRunResult>;
|
|
1560
1570
|
}
|
|
1561
1571
|
|
|
1562
|
-
export { type
|
|
1572
|
+
export { type EngramAccessRecallRequest as $, type EngramAccessLcmCompactionFlushResponse as A, type EngramAccessLcmCompactionRecordRequest as B, type EngramAccessLcmCompactionRecordResponse as C, type EngramAccessLcmSearchRequest as D, EngramAccessService as E, type EngramAccessLcmSearchResponse as F, type EngramAccessLcmStatusResponse as G, type EngramAccessMaintenanceResponse as H, type EngramAccessMemoryBrowseRequest as I, type EngramAccessMemoryBrowseResponse as J, type EngramAccessMemoryRecord as K, type EngramAccessMemoryResponse as L, type EngramAccessMemoryStoreRequest as M, type EngramAccessMemorySummary as N, type EngramAccessObserveMessage as O, type PeerInteractionLogEntry as P, type EngramAccessObserveRequest as Q, type EngramAccessObserveResponse as R, type EngramAccessOfflineSyncApplyRequest as S, type EngramAccessOfflineSyncApplyResponse as T, type EngramAccessOfflineSyncFilesRequest as U, type EngramAccessOfflineSyncFilesResponse as V, type EngramAccessOfflineSyncSnapshotRequest as W, type EngramAccessOfflineSyncSnapshotResponse as X, type EngramAccessQualityResponse as Y, type EngramAccessRecallExplainRequest as Z, type EngramAccessRecallExplainResponse as _, type EngramAccessRecallResponse as a, type EngramAccessReviewDispositionRequest as a0, type EngramAccessReviewDispositionResponse as a1, type EngramAccessReviewQueueResponse as a2, type EngramAccessSetCodingContextRequest as a3, type EngramAccessSuggestionSubmitRequest as a4, type EngramAccessTimelineResponse as a5, type EngramAccessTrustZoneBrowseRequest as a6, type EngramAccessTrustZoneBrowseResponse as a7, type EngramAccessTrustZoneDemoSeedRequest as a8, type EngramAccessTrustZoneDemoSeedResponse as a9, type EngramAccessTrustZonePromoteRequest as aa, type EngramAccessTrustZonePromoteResponse as ab, type EngramAccessTrustZoneRecordSummary as ac, type EngramAccessTrustZoneStatusResponse as ad, type EngramAccessWriteEnvelope as ae, type EngramAccessWriteResponse as af, shapeMemorySummary as ag, type Peer as b, type PeerProfile as c, EngramAccessInputError as d, PEER_ID_MAX_LENGTH as e, PEER_ID_PATTERN as f, type PeerKind as g, type PeerProfileFieldProvenance as h, type ProcedureStatsConfigSnapshot as i, type ProcedureStatsRecent as j, type ProcedureStatsReport as k, type ProcedureStatusCounts as l, computeProcedureStats as m, formatProcedureStatsText as n, ENGRAM_ACCESS_WRITE_SCHEMA_VERSION as o, type EngramAccessActionConfidenceRequest as p, type EngramAccessActionConfidenceResponse as q, type EngramAccessBriefingRequest as r, type EngramAccessBriefingResponse as s, type EngramAccessCapsuleListResponse as t, type EngramAccessDaySummaryRequest as u, type EngramAccessEntityListResponse as v, type EngramAccessEntityResponse as w, type EngramAccessEntitySummary as x, type EngramAccessHealthResponse as y, type EngramAccessLcmCompactionFlushRequest as z };
|
package/dist/access-service.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './storage.js';
|
|
2
|
-
export { o as ENGRAM_ACCESS_WRITE_SCHEMA_VERSION, p as EngramAccessActionConfidenceRequest, q as EngramAccessActionConfidenceResponse, r as EngramAccessBriefingRequest, s as EngramAccessBriefingResponse, t as EngramAccessCapsuleListResponse, u as EngramAccessDaySummaryRequest, v as EngramAccessEntityListResponse, w as EngramAccessEntityResponse, x as EngramAccessEntitySummary, y as EngramAccessHealthResponse, d as EngramAccessInputError, z as EngramAccessLcmCompactionFlushRequest, A as EngramAccessLcmCompactionFlushResponse, B as EngramAccessLcmCompactionRecordRequest, C as EngramAccessLcmCompactionRecordResponse, D as EngramAccessLcmSearchRequest, F as EngramAccessLcmSearchResponse, G as EngramAccessLcmStatusResponse, H as EngramAccessMaintenanceResponse, I as EngramAccessMemoryBrowseRequest, J as EngramAccessMemoryBrowseResponse, K as EngramAccessMemoryRecord, L as EngramAccessMemoryResponse, M as EngramAccessMemoryStoreRequest, N as EngramAccessMemorySummary, O as EngramAccessObserveMessage, Q as EngramAccessObserveRequest, R as EngramAccessObserveResponse, S as EngramAccessOfflineSyncApplyRequest, T as EngramAccessOfflineSyncApplyResponse, U as
|
|
2
|
+
export { o as ENGRAM_ACCESS_WRITE_SCHEMA_VERSION, p as EngramAccessActionConfidenceRequest, q as EngramAccessActionConfidenceResponse, r as EngramAccessBriefingRequest, s as EngramAccessBriefingResponse, t as EngramAccessCapsuleListResponse, u as EngramAccessDaySummaryRequest, v as EngramAccessEntityListResponse, w as EngramAccessEntityResponse, x as EngramAccessEntitySummary, y as EngramAccessHealthResponse, d as EngramAccessInputError, z as EngramAccessLcmCompactionFlushRequest, A as EngramAccessLcmCompactionFlushResponse, B as EngramAccessLcmCompactionRecordRequest, C as EngramAccessLcmCompactionRecordResponse, D as EngramAccessLcmSearchRequest, F as EngramAccessLcmSearchResponse, G as EngramAccessLcmStatusResponse, H as EngramAccessMaintenanceResponse, I as EngramAccessMemoryBrowseRequest, J as EngramAccessMemoryBrowseResponse, K as EngramAccessMemoryRecord, L as EngramAccessMemoryResponse, M as EngramAccessMemoryStoreRequest, N as EngramAccessMemorySummary, O as EngramAccessObserveMessage, Q as EngramAccessObserveRequest, R as EngramAccessObserveResponse, S as EngramAccessOfflineSyncApplyRequest, T as EngramAccessOfflineSyncApplyResponse, U as EngramAccessOfflineSyncFilesRequest, V as EngramAccessOfflineSyncFilesResponse, W as EngramAccessOfflineSyncSnapshotRequest, X as EngramAccessOfflineSyncSnapshotResponse, Y as EngramAccessQualityResponse, Z as EngramAccessRecallExplainRequest, _ as EngramAccessRecallExplainResponse, $ as EngramAccessRecallRequest, a as EngramAccessRecallResponse, a0 as EngramAccessReviewDispositionRequest, a1 as EngramAccessReviewDispositionResponse, a2 as EngramAccessReviewQueueResponse, E as EngramAccessService, a3 as EngramAccessSetCodingContextRequest, a4 as EngramAccessSuggestionSubmitRequest, a5 as EngramAccessTimelineResponse, a6 as EngramAccessTrustZoneBrowseRequest, a7 as EngramAccessTrustZoneBrowseResponse, a8 as EngramAccessTrustZoneDemoSeedRequest, a9 as EngramAccessTrustZoneDemoSeedResponse, aa as EngramAccessTrustZonePromoteRequest, ab as EngramAccessTrustZonePromoteResponse, ac as EngramAccessTrustZoneRecordSummary, ad as EngramAccessTrustZoneStatusResponse, ae as EngramAccessWriteEnvelope, af as EngramAccessWriteResponse, ag as shapeMemorySummary } from './access-service-DZXc7qwR.js';
|
|
3
3
|
import './recall-explain-renderer.js';
|
|
4
4
|
import './types.js';
|
|
5
5
|
import './recall-audit-anomaly.js';
|
package/dist/access-service.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
EngramAccessInputError,
|
|
4
4
|
EngramAccessService,
|
|
5
5
|
shapeMemorySummary
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Y2YBRCEF.js";
|
|
7
7
|
import "./chunk-ZKSK55RC.js";
|
|
8
8
|
import "./chunk-WELDCG6C.js";
|
|
9
9
|
import "./chunk-ZYVPLJ4T.js";
|
|
@@ -17,7 +17,7 @@ import "./chunk-MGKYQQYF.js";
|
|
|
17
17
|
import "./chunk-GL6I6MEQ.js";
|
|
18
18
|
import "./chunk-3APJ5EVB.js";
|
|
19
19
|
import "./chunk-5UM2VJ6D.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-2OZ6GP27.js";
|
|
21
21
|
import "./chunk-65HQPW6O.js";
|
|
22
22
|
import "./chunk-EIR5VLIH.js";
|
|
23
23
|
import "./chunk-PCUKNJAZ.js";
|
|
@@ -264,6 +264,19 @@ function shouldExcludeRelPath(relPosix, includeTranscripts) {
|
|
|
264
264
|
function filterBaseFilesForMode(files, includeTranscripts) {
|
|
265
265
|
return files.filter((file) => !shouldExcludeRelPath(file.path, includeTranscripts));
|
|
266
266
|
}
|
|
267
|
+
async function readOfflineSyncFileRecord(options) {
|
|
268
|
+
const relPath = validateArchiveRelativePath(options.relPath, "offlineSyncFile.path");
|
|
269
|
+
const bytes = options.readFile ? await options.readFile({ root: options.root.abs, path: relPath, filePath: options.filePath }) : await readFile(options.filePath);
|
|
270
|
+
const digest = sha256Buffer(bytes);
|
|
271
|
+
const st = await stat(options.filePath);
|
|
272
|
+
return {
|
|
273
|
+
path: relPath,
|
|
274
|
+
sha256: digest.sha256,
|
|
275
|
+
bytes: digest.bytes,
|
|
276
|
+
mtimeMs: st.mtimeMs,
|
|
277
|
+
...options.includeContent ? { contentBase64: bytes.toString("base64") } : {}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
267
280
|
async function buildOfflineSyncSnapshot(options) {
|
|
268
281
|
const rootAbs = path.resolve(options.root);
|
|
269
282
|
const root = await prepareSafeArchiveRoot(rootAbs, "buildOfflineSyncSnapshot", "root");
|
|
@@ -282,16 +295,13 @@ async function buildOfflineSyncSnapshot(options) {
|
|
|
282
295
|
continue;
|
|
283
296
|
}
|
|
284
297
|
if (!entry.isFile()) continue;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
mtimeMs: st.mtimeMs,
|
|
293
|
-
...options.includeContent === true ? { contentBase64: bytes.toString("base64") } : {}
|
|
294
|
-
});
|
|
298
|
+
files.push(await readOfflineSyncFileRecord({
|
|
299
|
+
root,
|
|
300
|
+
relPath: relPosix,
|
|
301
|
+
filePath: abs,
|
|
302
|
+
includeContent: options.includeContent === true,
|
|
303
|
+
readFile: options.readFile
|
|
304
|
+
}));
|
|
295
305
|
}
|
|
296
306
|
}
|
|
297
307
|
await walk(root.abs);
|
|
@@ -304,6 +314,42 @@ async function buildOfflineSyncSnapshot(options) {
|
|
|
304
314
|
files: files.sort(compareByPath)
|
|
305
315
|
};
|
|
306
316
|
}
|
|
317
|
+
async function buildOfflineSyncSnapshotForPaths(options) {
|
|
318
|
+
const rootAbs = path.resolve(options.root);
|
|
319
|
+
const root = await prepareSafeArchiveRoot(rootAbs, "buildOfflineSyncSnapshotForPaths", "root");
|
|
320
|
+
const includeTranscripts = options.includeTranscripts !== false;
|
|
321
|
+
const files = [];
|
|
322
|
+
const seen = /* @__PURE__ */ new Set();
|
|
323
|
+
for (const rawPath of options.paths) {
|
|
324
|
+
const relPath = normalizeRelativePath(rawPath, "paths[]");
|
|
325
|
+
if (seen.has(relPath)) continue;
|
|
326
|
+
seen.add(relPath);
|
|
327
|
+
if (shouldExcludeRelPath(relPath, includeTranscripts)) {
|
|
328
|
+
throw new Error(`offline sync snapshot path is excluded: ${relPath}`);
|
|
329
|
+
}
|
|
330
|
+
const filePath = await resolveSafeArchiveTarget(root, relPath);
|
|
331
|
+
const st = await lstat(filePath).catch((error) => {
|
|
332
|
+
if (error.code === "ENOENT") return null;
|
|
333
|
+
throw error;
|
|
334
|
+
});
|
|
335
|
+
if (!st || st.isSymbolicLink() || !st.isFile()) continue;
|
|
336
|
+
files.push(await readOfflineSyncFileRecord({
|
|
337
|
+
root,
|
|
338
|
+
relPath,
|
|
339
|
+
filePath,
|
|
340
|
+
includeContent: options.includeContent === true,
|
|
341
|
+
readFile: options.readFile
|
|
342
|
+
}));
|
|
343
|
+
}
|
|
344
|
+
return {
|
|
345
|
+
format: OFFLINE_SYNC_SNAPSHOT_FORMAT,
|
|
346
|
+
schemaVersion: 1,
|
|
347
|
+
createdAt: (options.now ?? /* @__PURE__ */ new Date()).toISOString(),
|
|
348
|
+
sourceId: normalizeSourceId(options.sourceId, "sourceId"),
|
|
349
|
+
includeTranscripts,
|
|
350
|
+
files: files.sort(compareByPath)
|
|
351
|
+
};
|
|
352
|
+
}
|
|
307
353
|
async function buildOfflineSyncChangeset(options) {
|
|
308
354
|
const includeTranscripts = options.includeTranscripts !== false;
|
|
309
355
|
const base = byPath(filterBaseFilesForMode(
|
|
@@ -313,7 +359,7 @@ async function buildOfflineSyncChangeset(options) {
|
|
|
313
359
|
const current = await buildOfflineSyncSnapshot({
|
|
314
360
|
root: options.root,
|
|
315
361
|
sourceId: options.sourceId,
|
|
316
|
-
includeContent:
|
|
362
|
+
includeContent: false,
|
|
317
363
|
includeTranscripts,
|
|
318
364
|
now: options.now,
|
|
319
365
|
readFile: options.readFile
|
|
@@ -324,11 +370,24 @@ async function buildOfflineSyncChangeset(options) {
|
|
|
324
370
|
const baseEntry = base.get(relPath);
|
|
325
371
|
const currentEntry = currentMap.get(relPath);
|
|
326
372
|
if (currentEntry && currentEntry.sha256 !== baseEntry?.sha256) {
|
|
373
|
+
const file = await buildOfflineSyncSnapshotForPaths({
|
|
374
|
+
root: options.root,
|
|
375
|
+
sourceId: options.sourceId,
|
|
376
|
+
paths: [relPath],
|
|
377
|
+
includeContent: true,
|
|
378
|
+
includeTranscripts,
|
|
379
|
+
now: options.now,
|
|
380
|
+
readFile: options.readFile
|
|
381
|
+
});
|
|
382
|
+
const record = file.files[0];
|
|
383
|
+
if (!record || typeof record.contentBase64 !== "string" || record.sha256 !== currentEntry.sha256) {
|
|
384
|
+
throw new Error(`offline sync file changed while building changeset: ${relPath}`);
|
|
385
|
+
}
|
|
327
386
|
changes.push({
|
|
328
387
|
type: "upsert",
|
|
329
388
|
path: relPath,
|
|
330
389
|
...baseEntry ? { baseSha256: baseEntry.sha256 } : {},
|
|
331
|
-
file:
|
|
390
|
+
file: record
|
|
332
391
|
});
|
|
333
392
|
continue;
|
|
334
393
|
}
|
|
@@ -359,13 +418,15 @@ function summarizeOfflineSyncChangeset(changeset) {
|
|
|
359
418
|
};
|
|
360
419
|
}
|
|
361
420
|
async function applyOfflineSyncSnapshot(options) {
|
|
362
|
-
const snapshot = normalizeOfflineSyncSnapshot(options.snapshot
|
|
421
|
+
const snapshot = normalizeOfflineSyncSnapshot(options.snapshot);
|
|
363
422
|
const baseMap = byPath(filterBaseFilesForMode(
|
|
364
423
|
normalizeFileStates(options.baseFiles),
|
|
365
424
|
snapshot.includeTranscripts
|
|
366
425
|
));
|
|
367
426
|
const incomingMap = byPath(snapshot.files);
|
|
368
|
-
const incomingBuffers = verifyRecordContents(snapshot.files, "offline sync snapshot"
|
|
427
|
+
const incomingBuffers = verifyRecordContents(snapshot.files, "offline sync snapshot", {
|
|
428
|
+
requireContent: false
|
|
429
|
+
});
|
|
369
430
|
const root = await ensureSyncRoot(options.root, "applyOfflineSyncSnapshot");
|
|
370
431
|
const current = await buildOfflineSyncSnapshot({
|
|
371
432
|
root: root.abs,
|
|
@@ -404,7 +465,7 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
404
465
|
reason: "local_deleted_remote_modified",
|
|
405
466
|
baseSha256: base.sha256,
|
|
406
467
|
incomingSha256: incoming.sha256,
|
|
407
|
-
incomingBuffer: incomingBuffers.get(relPath),
|
|
468
|
+
incomingBuffer: options.writeConflictCopies === false ? incomingBuffers.get(relPath) : requiredBuffer(incomingBuffers, relPath),
|
|
408
469
|
writeConflictCopies: options.writeConflictCopies !== false,
|
|
409
470
|
sourceId: snapshot.sourceId,
|
|
410
471
|
writeFile: options.writeFile
|
|
@@ -437,7 +498,7 @@ async function applyOfflineSyncSnapshot(options) {
|
|
|
437
498
|
baseSha256: base?.sha256,
|
|
438
499
|
localSha256: currentEntry?.sha256,
|
|
439
500
|
incomingSha256: incoming.sha256,
|
|
440
|
-
incomingBuffer: incomingBuffers.get(relPath),
|
|
501
|
+
incomingBuffer: options.writeConflictCopies === false ? incomingBuffers.get(relPath) : requiredBuffer(incomingBuffers, relPath),
|
|
441
502
|
writeConflictCopies: options.writeConflictCopies !== false,
|
|
442
503
|
sourceId: snapshot.sourceId,
|
|
443
504
|
writeFile: options.writeFile
|
|
@@ -575,10 +636,11 @@ async function applyOfflineSyncChangeset(options) {
|
|
|
575
636
|
currentFiles: [...currentMap.values()].sort(compareByPath)
|
|
576
637
|
};
|
|
577
638
|
}
|
|
578
|
-
function verifyRecordContents(records, context) {
|
|
639
|
+
function verifyRecordContents(records, context, options = {}) {
|
|
579
640
|
const buffers = /* @__PURE__ */ new Map();
|
|
580
641
|
for (const record of records) {
|
|
581
642
|
if (typeof record.contentBase64 !== "string") {
|
|
643
|
+
if (options.requireContent === false) continue;
|
|
582
644
|
throw new Error(`${context}: contentBase64 is required for ${record.path}`);
|
|
583
645
|
}
|
|
584
646
|
const buffer = Buffer.from(record.contentBase64, "base64");
|
|
@@ -755,6 +817,7 @@ export {
|
|
|
755
817
|
normalizeOfflineSyncSnapshot,
|
|
756
818
|
normalizeOfflineSyncChangeset,
|
|
757
819
|
buildOfflineSyncSnapshot,
|
|
820
|
+
buildOfflineSyncSnapshotForPaths,
|
|
758
821
|
buildOfflineSyncChangeset,
|
|
759
822
|
summarizeOfflineSyncChangeset,
|
|
760
823
|
applyOfflineSyncSnapshot,
|
|
@@ -766,4 +829,4 @@ export {
|
|
|
766
829
|
normalizeOfflineSyncState,
|
|
767
830
|
fileStatesFromSnapshot
|
|
768
831
|
};
|
|
769
|
-
//# sourceMappingURL=chunk-
|
|
832
|
+
//# sourceMappingURL=chunk-2OZ6GP27.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/offline-sync.ts"],"sourcesContent":["import { createHash, randomUUID } from \"node:crypto\";\nimport {\n lstat,\n mkdir,\n readdir,\n readFile,\n rename,\n stat,\n unlink,\n writeFile,\n} from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n DEFAULT_TRANSFER_EXCLUDE_DIRS,\n} from \"./transfer/exclusions.js\";\nimport {\n prepareSafeArchiveRoot,\n resolveSafeArchiveTarget,\n sha256Bytes,\n validateArchiveRelativePath,\n type SafeArchiveRoot,\n} from \"./transfer/fs-utils.js\";\nimport { parseFlexibleIsoTimestamp } from \"./utils/iso-timestamp.js\";\n\nexport const OFFLINE_SYNC_SNAPSHOT_FORMAT = \"remnic.offline-sync.snapshot.v1\";\nexport const OFFLINE_SYNC_CHANGESET_FORMAT = \"remnic.offline-sync.changeset.v1\";\nexport const OFFLINE_SYNC_STATE_VERSION = 1;\n\nexport interface OfflineSyncFileState {\n path: string;\n sha256: string;\n /** Byte length of the transferable content, after any readFile hook such as secure-store decryption. */\n bytes: number;\n mtimeMs: number;\n}\n\nexport interface OfflineSyncFileRecord extends OfflineSyncFileState {\n contentBase64?: string;\n}\n\nexport interface OfflineSyncSnapshot {\n format: typeof OFFLINE_SYNC_SNAPSHOT_FORMAT;\n schemaVersion: 1;\n createdAt: string;\n sourceId: string;\n includeTranscripts: boolean;\n files: OfflineSyncFileRecord[];\n}\n\nexport type OfflineSyncChange =\n | {\n type: \"upsert\";\n path: string;\n baseSha256?: string;\n file: OfflineSyncFileRecord & { contentBase64: string };\n }\n | {\n type: \"delete\";\n path: string;\n baseSha256: string;\n };\n\nexport interface OfflineSyncChangeset {\n format: typeof OFFLINE_SYNC_CHANGESET_FORMAT;\n schemaVersion: 1;\n createdAt: string;\n sourceId: string;\n includeTranscripts: boolean;\n changes: OfflineSyncChange[];\n}\n\nexport interface OfflineSyncState {\n version: typeof OFFLINE_SYNC_STATE_VERSION;\n remoteId: string;\n namespace?: string;\n includeTranscripts: boolean;\n lastSyncedAt: string;\n baseFiles: OfflineSyncFileState[];\n}\n\nexport interface OfflineSyncConflict {\n path: string;\n reason:\n | \"both_modified\"\n | \"local_deleted_remote_modified\"\n | \"local_modified_remote_deleted\"\n | \"remote_exists_for_local_create\"\n | \"remote_changed_for_local_update\"\n | \"remote_deleted_for_local_update\"\n | \"remote_changed_for_local_delete\";\n baseSha256?: string;\n localSha256?: string;\n incomingSha256?: string;\n conflictPath?: string;\n}\n\nexport interface OfflineSyncApplySnapshotResult {\n upserted: number;\n deleted: number;\n skipped: number;\n pendingLocal: number;\n conflicts: OfflineSyncConflict[];\n nextBaseFiles: OfflineSyncFileState[];\n}\n\nexport interface OfflineSyncApplyChangesetResult {\n appliedUpserts: number;\n appliedDeletes: number;\n skipped: number;\n conflicts: OfflineSyncConflict[];\n currentFiles: OfflineSyncFileState[];\n}\n\nexport interface OfflineSyncChangesetSummary {\n upserts: number;\n deletes: number;\n total: number;\n}\n\nexport interface OfflineSyncFileTarget {\n root: string;\n path: string;\n filePath: string;\n}\n\nexport interface OfflineSyncFileWriteTarget extends OfflineSyncFileTarget {\n content: Buffer;\n}\n\ninterface OfflineSyncFileRecordOptions {\n root: SafeArchiveRoot;\n relPath: string;\n filePath: string;\n includeContent: boolean;\n readFile?: (target: OfflineSyncFileTarget) => Promise<Buffer>;\n}\n\nconst SYNC_INTERNAL_DIR = \".offline-sync\";\nconst EXCLUDED_FILE_NAMES = new Set([\n \".sync-state.json\",\n]);\n\nconst EXCLUDED_REL_PATHS = new Set([\n \"state/fact-hashes.ready\",\n \"state/fact-hashes.txt\",\n]);\n\nconst EXCLUDED_FILE_PREFIXES = [\n \".remnic-sync.\",\n \".remnic-sync-state.\",\n];\n\nfunction hashText(value: string): string {\n return createHash(\"sha256\").update(value).digest(\"hex\");\n}\n\nfunction sha256Buffer(buffer: Buffer): { sha256: string; bytes: number } {\n return sha256Bytes(buffer);\n}\n\nfunction compareByPath<T extends { path: string }>(left: T, right: T): number {\n return left.path.localeCompare(right.path);\n}\n\nfunction assertSha256(value: unknown, field: string): string {\n if (typeof value !== \"string\" || !/^[a-f0-9]{64}$/i.test(value)) {\n throw new Error(`${field} must be a 64-character sha256 hex string`);\n }\n return value.toLowerCase();\n}\n\nfunction assertNonNegativeInteger(value: unknown, field: string): number {\n if (\n typeof value !== \"number\" ||\n !Number.isFinite(value) ||\n !Number.isInteger(value) ||\n value < 0\n ) {\n throw new Error(`${field} must be a non-negative integer`);\n }\n return value;\n}\n\nfunction assertNonNegativeFinite(value: unknown, field: string): number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) {\n throw new Error(`${field} must be a non-negative finite number`);\n }\n return value;\n}\n\nfunction assertBoolean(value: unknown, field: string): boolean {\n if (typeof value !== \"boolean\") {\n throw new Error(`${field} must be a boolean`);\n }\n return value;\n}\n\nfunction normalizeSourceId(value: unknown, field: string): string {\n if (typeof value !== \"string\" || value.trim().length === 0 || value.length > 512) {\n throw new Error(`${field} must be a non-empty string no longer than 512 characters`);\n }\n return value.trim();\n}\n\nfunction normalizeFileState(input: unknown, fieldPrefix: string): OfflineSyncFileState {\n if (!input || typeof input !== \"object\" || Array.isArray(input)) {\n throw new Error(`${fieldPrefix} must be an object`);\n }\n const obj = input as Record<string, unknown>;\n const relPath = normalizeRelativePath(obj.path, `${fieldPrefix}.path`);\n return {\n path: relPath,\n sha256: assertSha256(obj.sha256, `${fieldPrefix}.sha256`),\n bytes: assertNonNegativeInteger(obj.bytes, `${fieldPrefix}.bytes`),\n mtimeMs: assertNonNegativeFinite(obj.mtimeMs, `${fieldPrefix}.mtimeMs`),\n };\n}\n\nfunction normalizeFileRecord(\n input: unknown,\n fieldPrefix: string,\n requireContent: boolean,\n): OfflineSyncFileRecord {\n const state = normalizeFileState(input, fieldPrefix);\n const obj = input as Record<string, unknown>;\n const contentBase64 = obj.contentBase64;\n if (requireContent && typeof contentBase64 !== \"string\") {\n throw new Error(`${fieldPrefix}.contentBase64 is required`);\n }\n if (contentBase64 !== undefined && typeof contentBase64 !== \"string\") {\n throw new Error(`${fieldPrefix}.contentBase64 must be a base64 string`);\n }\n return {\n ...state,\n ...(contentBase64 !== undefined ? { contentBase64 } : {}),\n };\n}\n\nfunction normalizeFileStates(input: readonly unknown[] | undefined): OfflineSyncFileState[] {\n if (!input) return [];\n if (!Array.isArray(input)) {\n throw new Error(\"baseFiles must be an array\");\n }\n return input.map((entry, index) => normalizeFileState(entry, `baseFiles[${index}]`));\n}\n\nexport function normalizeOfflineSyncSnapshot(\n input: unknown,\n options: { requireContent?: boolean } = {},\n): OfflineSyncSnapshot {\n if (!input || typeof input !== \"object\" || Array.isArray(input)) {\n throw new Error(\"offline sync snapshot must be an object\");\n }\n const obj = input as Record<string, unknown>;\n if (obj.format !== OFFLINE_SYNC_SNAPSHOT_FORMAT) {\n throw new Error(`offline sync snapshot format must be ${OFFLINE_SYNC_SNAPSHOT_FORMAT}`);\n }\n if (obj.schemaVersion !== 1) {\n throw new Error(\"offline sync snapshot schemaVersion must be 1\");\n }\n const createdAt = normalizeIsoString(obj.createdAt, \"createdAt\");\n const sourceId = normalizeSourceId(obj.sourceId, \"sourceId\");\n const includeTranscripts = assertBoolean(obj.includeTranscripts, \"includeTranscripts\");\n if (!Array.isArray(obj.files)) {\n throw new Error(\"offline sync snapshot files must be an array\");\n }\n const files = obj.files\n .map((entry, index) =>\n normalizeFileRecord(entry, `files[${index}]`, options.requireContent === true))\n .sort(compareByPath);\n assertUniquePaths(files, \"offline sync snapshot\");\n if (!includeTranscripts) {\n const transcriptPath = files.find((file) => file.path.split(\"/\")[0] === \"transcripts\")?.path;\n if (transcriptPath) {\n throw new Error(\n `offline sync snapshot includeTranscripts is false but contains transcript path: ${transcriptPath}`,\n );\n }\n }\n const excludedPath = files.find((file) => shouldExcludeRelPath(file.path, true))?.path;\n if (excludedPath) {\n throw new Error(`offline sync snapshot contains excluded path: ${excludedPath}`);\n }\n return {\n format: OFFLINE_SYNC_SNAPSHOT_FORMAT,\n schemaVersion: 1,\n createdAt,\n sourceId,\n includeTranscripts,\n files,\n };\n}\n\nexport function normalizeOfflineSyncChangeset(input: unknown): OfflineSyncChangeset {\n if (!input || typeof input !== \"object\" || Array.isArray(input)) {\n throw new Error(\"offline sync changeset must be an object\");\n }\n const obj = input as Record<string, unknown>;\n if (obj.format !== OFFLINE_SYNC_CHANGESET_FORMAT) {\n throw new Error(`offline sync changeset format must be ${OFFLINE_SYNC_CHANGESET_FORMAT}`);\n }\n if (obj.schemaVersion !== 1) {\n throw new Error(\"offline sync changeset schemaVersion must be 1\");\n }\n const createdAt = normalizeIsoString(obj.createdAt, \"createdAt\");\n const sourceId = normalizeSourceId(obj.sourceId, \"sourceId\");\n const includeTranscripts = assertBoolean(obj.includeTranscripts, \"includeTranscripts\");\n if (!Array.isArray(obj.changes)) {\n throw new Error(\"offline sync changeset changes must be an array\");\n }\n const changes = obj.changes.map((entry, index): OfflineSyncChange => {\n if (!entry || typeof entry !== \"object\" || Array.isArray(entry)) {\n throw new Error(`changes[${index}] must be an object`);\n }\n const change = entry as Record<string, unknown>;\n const type = change.type;\n const relPath = normalizeRelativePath(change.path, `changes[${index}].path`);\n if (type === \"upsert\") {\n const file = normalizeFileRecord(\n change.file,\n `changes[${index}].file`,\n true,\n ) as OfflineSyncFileRecord & { contentBase64: string };\n if (file.path !== relPath) {\n throw new Error(`changes[${index}].file.path must match changes[${index}].path`);\n }\n const baseSha256 =\n change.baseSha256 === undefined\n ? undefined\n : assertSha256(change.baseSha256, `changes[${index}].baseSha256`);\n return {\n type: \"upsert\",\n path: relPath,\n ...(baseSha256 ? { baseSha256 } : {}),\n file,\n };\n }\n if (type === \"delete\") {\n return {\n type: \"delete\",\n path: relPath,\n baseSha256: assertSha256(change.baseSha256, `changes[${index}].baseSha256`),\n };\n }\n throw new Error(`changes[${index}].type must be \"upsert\" or \"delete\"`);\n });\n assertUniquePaths(changes, \"offline sync changeset\");\n if (!includeTranscripts) {\n const transcriptPath = changes.find((change) => change.path.split(\"/\")[0] === \"transcripts\")?.path;\n if (transcriptPath) {\n throw new Error(\n `offline sync changeset includeTranscripts is false but contains transcript path: ${transcriptPath}`,\n );\n }\n }\n const excludedPath = changes.find((change) => shouldExcludeRelPath(change.path, true))?.path;\n if (excludedPath) {\n throw new Error(`offline sync changeset contains excluded path: ${excludedPath}`);\n }\n return {\n format: OFFLINE_SYNC_CHANGESET_FORMAT,\n schemaVersion: 1,\n createdAt,\n sourceId,\n includeTranscripts,\n changes: changes.sort(compareByPath),\n };\n}\n\nfunction normalizeIsoString(input: unknown, field: string): string {\n if (typeof input !== \"string\" || input.trim().length === 0) {\n throw new Error(`${field} must be an ISO timestamp string`);\n }\n const parsed = parseFlexibleIsoTimestamp(input.trim());\n if (parsed === null) {\n throw new Error(`${field} must be a parseable ISO timestamp`);\n }\n return new Date(parsed).toISOString();\n}\n\nfunction normalizeRelativePath(input: unknown, field: string): string {\n if (typeof input !== \"string\") {\n throw new Error(`${field} must be a POSIX relative path string`);\n }\n return validateArchiveRelativePath(input, field);\n}\n\nfunction assertUniquePaths(entries: readonly { path: string }[], context: string): void {\n const seen = new Set<string>();\n for (const entry of entries) {\n const key = entry.path.toLowerCase();\n if (seen.has(key)) {\n throw new Error(`${context} contains duplicate path: ${entry.path}`);\n }\n seen.add(key);\n }\n}\n\nfunction shouldExcludeRelPath(relPosix: string, includeTranscripts: boolean): boolean {\n const parts = relPosix.split(\"/\");\n if (parts.some((part) => DEFAULT_TRANSFER_EXCLUDE_DIRS.has(part))) return true;\n if (parts.some((part) => part === SYNC_INTERNAL_DIR)) return true;\n if (EXCLUDED_REL_PATHS.has(relPosix)) return true;\n if (!includeTranscripts && parts[0] === \"transcripts\") return true;\n const basename = parts[parts.length - 1] ?? \"\";\n if (EXCLUDED_FILE_NAMES.has(basename)) return true;\n return EXCLUDED_FILE_PREFIXES.some((prefix) => basename.startsWith(prefix));\n}\n\nfunction filterBaseFilesForMode(\n files: readonly OfflineSyncFileState[],\n includeTranscripts: boolean,\n): OfflineSyncFileState[] {\n return files.filter((file) => !shouldExcludeRelPath(file.path, includeTranscripts));\n}\n\nasync function readOfflineSyncFileRecord(\n options: OfflineSyncFileRecordOptions,\n): Promise<OfflineSyncFileRecord> {\n const relPath = validateArchiveRelativePath(options.relPath, \"offlineSyncFile.path\");\n const bytes = options.readFile\n ? await options.readFile({ root: options.root.abs, path: relPath, filePath: options.filePath })\n : await readFile(options.filePath);\n const digest = sha256Buffer(bytes);\n const st = await stat(options.filePath);\n return {\n path: relPath,\n sha256: digest.sha256,\n bytes: digest.bytes,\n mtimeMs: st.mtimeMs,\n ...(options.includeContent ? { contentBase64: bytes.toString(\"base64\") } : {}),\n };\n}\n\nexport async function buildOfflineSyncSnapshot(options: {\n root: string;\n sourceId: string;\n includeContent?: boolean;\n includeTranscripts?: boolean;\n now?: Date;\n readFile?: (target: OfflineSyncFileTarget) => Promise<Buffer>;\n}): Promise<OfflineSyncSnapshot> {\n const rootAbs = path.resolve(options.root);\n const root = await prepareSafeArchiveRoot(rootAbs, \"buildOfflineSyncSnapshot\", \"root\");\n const includeTranscripts = options.includeTranscripts !== false;\n const files: OfflineSyncFileRecord[] = [];\n\n async function walk(dirAbs: string): Promise<void> {\n let entries = await readdir(dirAbs, { withFileTypes: true });\n entries = entries.sort((left, right) => left.name.localeCompare(right.name));\n for (const entry of entries) {\n const abs = path.join(dirAbs, entry.name);\n const relPosix = path.relative(root.abs, abs).split(path.sep).join(\"/\");\n if (shouldExcludeRelPath(relPosix, includeTranscripts)) continue;\n if (entry.isSymbolicLink()) continue;\n if (entry.isDirectory()) {\n await walk(abs);\n continue;\n }\n if (!entry.isFile()) continue;\n files.push(await readOfflineSyncFileRecord({\n root,\n relPath: relPosix,\n filePath: abs,\n includeContent: options.includeContent === true,\n readFile: options.readFile,\n }));\n }\n }\n\n await walk(root.abs);\n\n return {\n format: OFFLINE_SYNC_SNAPSHOT_FORMAT,\n schemaVersion: 1,\n createdAt: (options.now ?? new Date()).toISOString(),\n sourceId: normalizeSourceId(options.sourceId, \"sourceId\"),\n includeTranscripts,\n files: files.sort(compareByPath),\n };\n}\n\nexport async function buildOfflineSyncSnapshotForPaths(options: {\n root: string;\n sourceId: string;\n paths: readonly string[];\n includeContent?: boolean;\n includeTranscripts?: boolean;\n now?: Date;\n readFile?: (target: OfflineSyncFileTarget) => Promise<Buffer>;\n}): Promise<OfflineSyncSnapshot> {\n const rootAbs = path.resolve(options.root);\n const root = await prepareSafeArchiveRoot(rootAbs, \"buildOfflineSyncSnapshotForPaths\", \"root\");\n const includeTranscripts = options.includeTranscripts !== false;\n const files: OfflineSyncFileRecord[] = [];\n const seen = new Set<string>();\n\n for (const rawPath of options.paths) {\n const relPath = normalizeRelativePath(rawPath, \"paths[]\");\n if (seen.has(relPath)) continue;\n seen.add(relPath);\n if (shouldExcludeRelPath(relPath, includeTranscripts)) {\n throw new Error(`offline sync snapshot path is excluded: ${relPath}`);\n }\n const filePath = await resolveSafeArchiveTarget(root, relPath);\n const st = await lstat(filePath).catch((error: unknown) => {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return null;\n throw error;\n });\n if (!st || st.isSymbolicLink() || !st.isFile()) continue;\n files.push(await readOfflineSyncFileRecord({\n root,\n relPath,\n filePath,\n includeContent: options.includeContent === true,\n readFile: options.readFile,\n }));\n }\n\n return {\n format: OFFLINE_SYNC_SNAPSHOT_FORMAT,\n schemaVersion: 1,\n createdAt: (options.now ?? new Date()).toISOString(),\n sourceId: normalizeSourceId(options.sourceId, \"sourceId\"),\n includeTranscripts,\n files: files.sort(compareByPath),\n };\n}\n\nexport async function buildOfflineSyncChangeset(options: {\n root: string;\n sourceId: string;\n baseFiles?: readonly OfflineSyncFileState[];\n includeTranscripts?: boolean;\n now?: Date;\n readFile?: (target: OfflineSyncFileTarget) => Promise<Buffer>;\n}): Promise<OfflineSyncChangeset> {\n const includeTranscripts = options.includeTranscripts !== false;\n const base = byPath(filterBaseFilesForMode(\n normalizeFileStates(options.baseFiles),\n includeTranscripts,\n ));\n const current = await buildOfflineSyncSnapshot({\n root: options.root,\n sourceId: options.sourceId,\n includeContent: false,\n includeTranscripts,\n now: options.now,\n readFile: options.readFile,\n });\n const currentMap = byPath(current.files);\n const changes: OfflineSyncChange[] = [];\n\n for (const relPath of unionPaths(base, currentMap)) {\n const baseEntry = base.get(relPath);\n const currentEntry = currentMap.get(relPath);\n if (currentEntry && currentEntry.sha256 !== baseEntry?.sha256) {\n const file = await buildOfflineSyncSnapshotForPaths({\n root: options.root,\n sourceId: options.sourceId,\n paths: [relPath],\n includeContent: true,\n includeTranscripts,\n now: options.now,\n readFile: options.readFile,\n });\n const record = file.files[0];\n if (!record || typeof record.contentBase64 !== \"string\" || record.sha256 !== currentEntry.sha256) {\n throw new Error(`offline sync file changed while building changeset: ${relPath}`);\n }\n changes.push({\n type: \"upsert\",\n path: relPath,\n ...(baseEntry ? { baseSha256: baseEntry.sha256 } : {}),\n file: record as OfflineSyncFileRecord & { contentBase64: string },\n });\n continue;\n }\n if (!currentEntry && baseEntry) {\n changes.push({\n type: \"delete\",\n path: relPath,\n baseSha256: baseEntry.sha256,\n });\n }\n }\n\n return {\n format: OFFLINE_SYNC_CHANGESET_FORMAT,\n schemaVersion: 1,\n createdAt: (options.now ?? new Date()).toISOString(),\n sourceId: normalizeSourceId(options.sourceId, \"sourceId\"),\n includeTranscripts: current.includeTranscripts,\n changes: changes.sort(compareByPath),\n };\n}\n\nexport function summarizeOfflineSyncChangeset(\n changeset: OfflineSyncChangeset,\n): OfflineSyncChangesetSummary {\n const upserts = changeset.changes.filter((change) => change.type === \"upsert\").length;\n const deletes = changeset.changes.filter((change) => change.type === \"delete\").length;\n return {\n upserts,\n deletes,\n total: changeset.changes.length,\n };\n}\n\nexport async function applyOfflineSyncSnapshot(options: {\n root: string;\n snapshot: unknown;\n baseFiles?: readonly OfflineSyncFileState[];\n writeConflictCopies?: boolean;\n readFile?: (target: OfflineSyncFileTarget) => Promise<Buffer>;\n writeFile?: (target: OfflineSyncFileWriteTarget) => Promise<void>;\n deleteFile?: (target: OfflineSyncFileTarget) => Promise<void>;\n}): Promise<OfflineSyncApplySnapshotResult> {\n const snapshot = normalizeOfflineSyncSnapshot(options.snapshot);\n const baseMap = byPath(filterBaseFilesForMode(\n normalizeFileStates(options.baseFiles),\n snapshot.includeTranscripts,\n ));\n const incomingMap = byPath(snapshot.files);\n const incomingBuffers = verifyRecordContents(snapshot.files, \"offline sync snapshot\", {\n requireContent: false,\n });\n const root = await ensureSyncRoot(options.root, \"applyOfflineSyncSnapshot\");\n const current = await buildOfflineSyncSnapshot({\n root: root.abs,\n sourceId: \"local\",\n includeContent: false,\n includeTranscripts: snapshot.includeTranscripts,\n readFile: options.readFile,\n });\n const currentMap = byPath(current.files);\n const nextBase = new Map(baseMap);\n const conflicts: OfflineSyncConflict[] = [];\n let upserted = 0;\n let deleted = 0;\n let skipped = 0;\n let pendingLocal = 0;\n\n for (const relPath of unionPaths(baseMap, incomingMap, currentMap)) {\n const base = baseMap.get(relPath);\n const incoming = incomingMap.get(relPath);\n const currentEntry = currentMap.get(relPath);\n\n if (incoming) {\n if (currentEntry?.sha256 === incoming.sha256) {\n nextBase.set(relPath, toFileState(incoming));\n skipped += 1;\n continue;\n }\n if (!currentEntry && base && incoming.sha256 === base.sha256) {\n nextBase.set(relPath, base);\n pendingLocal += 1;\n skipped += 1;\n continue;\n }\n if (!currentEntry && base && incoming.sha256 !== base.sha256) {\n conflicts.push(await recordConflict({\n root,\n relPath,\n reason: \"local_deleted_remote_modified\",\n baseSha256: base.sha256,\n incomingSha256: incoming.sha256,\n incomingBuffer: options.writeConflictCopies === false\n ? incomingBuffers.get(relPath)\n : requiredBuffer(incomingBuffers, relPath),\n writeConflictCopies: options.writeConflictCopies !== false,\n sourceId: snapshot.sourceId,\n writeFile: options.writeFile,\n }));\n nextBase.set(relPath, base);\n continue;\n }\n if (!currentEntry && !base) {\n await writeSafeFile(root, relPath, requiredBuffer(incomingBuffers, relPath), options.writeFile);\n nextBase.set(relPath, toFileState(incoming));\n upserted += 1;\n continue;\n }\n if (base && currentEntry && currentEntry.sha256 === base.sha256) {\n await writeSafeFile(root, relPath, requiredBuffer(incomingBuffers, relPath), options.writeFile);\n nextBase.set(relPath, toFileState(incoming));\n upserted += 1;\n continue;\n }\n if (base && incoming.sha256 === base.sha256) {\n nextBase.set(relPath, base);\n pendingLocal += 1;\n skipped += 1;\n continue;\n }\n conflicts.push(await recordConflict({\n root,\n relPath,\n reason: base ? \"both_modified\" : \"remote_exists_for_local_create\",\n baseSha256: base?.sha256,\n localSha256: currentEntry?.sha256,\n incomingSha256: incoming.sha256,\n incomingBuffer: options.writeConflictCopies === false\n ? incomingBuffers.get(relPath)\n : requiredBuffer(incomingBuffers, relPath),\n writeConflictCopies: options.writeConflictCopies !== false,\n sourceId: snapshot.sourceId,\n writeFile: options.writeFile,\n }));\n if (base) nextBase.set(relPath, base);\n continue;\n }\n\n if (!currentEntry) {\n nextBase.delete(relPath);\n skipped += 1;\n continue;\n }\n if (base && currentEntry.sha256 === base.sha256) {\n await deleteSafeFile(root, relPath, options.deleteFile);\n nextBase.delete(relPath);\n deleted += 1;\n continue;\n }\n if (base) {\n conflicts.push({\n path: relPath,\n reason: \"local_modified_remote_deleted\",\n baseSha256: base.sha256,\n localSha256: currentEntry.sha256,\n });\n nextBase.set(relPath, base);\n continue;\n }\n pendingLocal += 1;\n skipped += 1;\n }\n\n return {\n upserted,\n deleted,\n skipped,\n pendingLocal,\n conflicts,\n nextBaseFiles: [...nextBase.values()].sort(compareByPath),\n };\n}\n\nexport async function applyOfflineSyncChangeset(options: {\n root: string;\n changeset: unknown;\n writeConflictCopies?: boolean;\n readFile?: (target: OfflineSyncFileTarget) => Promise<Buffer>;\n writeFile?: (target: OfflineSyncFileWriteTarget) => Promise<void>;\n deleteFile?: (target: OfflineSyncFileTarget) => Promise<void>;\n}): Promise<OfflineSyncApplyChangesetResult> {\n let changeset: OfflineSyncChangeset;\n try {\n changeset = normalizeOfflineSyncChangeset(options.changeset);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(\n message.startsWith(\"offline sync\")\n ? message\n : `offline sync changeset invalid: ${message}`,\n );\n }\n const root = await ensureSyncRoot(options.root, \"applyOfflineSyncChangeset\");\n const records = changeset.changes\n .filter((change): change is Extract<OfflineSyncChange, { type: \"upsert\" }> => change.type === \"upsert\")\n .map((change) => change.file);\n const incomingBuffers = verifyRecordContents(records, \"offline sync changeset\");\n const current = await buildOfflineSyncSnapshot({\n root: root.abs,\n sourceId: \"local\",\n includeContent: false,\n includeTranscripts: changeset.includeTranscripts,\n readFile: options.readFile,\n });\n const currentMap = byPath(current.files);\n const conflicts: OfflineSyncConflict[] = [];\n let appliedUpserts = 0;\n let appliedDeletes = 0;\n let skipped = 0;\n\n for (const change of changeset.changes) {\n const currentEntry = currentMap.get(change.path);\n if (change.type === \"upsert\") {\n if (currentEntry?.sha256 === change.file.sha256) {\n skipped += 1;\n continue;\n }\n if (!change.baseSha256) {\n if (!currentEntry) {\n await writeSafeFile(root, change.path, requiredBuffer(incomingBuffers, change.path), options.writeFile);\n currentMap.set(change.path, toFileState(change.file));\n appliedUpserts += 1;\n continue;\n }\n conflicts.push(await recordConflict({\n root,\n relPath: change.path,\n reason: \"remote_exists_for_local_create\",\n localSha256: currentEntry.sha256,\n incomingSha256: change.file.sha256,\n incomingBuffer: incomingBuffers.get(change.path),\n writeConflictCopies: options.writeConflictCopies !== false,\n sourceId: changeset.sourceId,\n writeFile: options.writeFile,\n }));\n continue;\n }\n if (currentEntry?.sha256 === change.baseSha256) {\n await writeSafeFile(root, change.path, requiredBuffer(incomingBuffers, change.path), options.writeFile);\n currentMap.set(change.path, toFileState(change.file));\n appliedUpserts += 1;\n continue;\n }\n conflicts.push(await recordConflict({\n root,\n relPath: change.path,\n reason: currentEntry ? \"remote_changed_for_local_update\" : \"remote_deleted_for_local_update\",\n baseSha256: change.baseSha256,\n localSha256: currentEntry?.sha256,\n incomingSha256: change.file.sha256,\n incomingBuffer: incomingBuffers.get(change.path),\n writeConflictCopies: options.writeConflictCopies !== false,\n sourceId: changeset.sourceId,\n writeFile: options.writeFile,\n }));\n continue;\n }\n\n if (!currentEntry) {\n skipped += 1;\n continue;\n }\n if (currentEntry.sha256 === change.baseSha256) {\n await deleteSafeFile(root, change.path, options.deleteFile);\n currentMap.delete(change.path);\n appliedDeletes += 1;\n continue;\n }\n conflicts.push({\n path: change.path,\n reason: \"remote_changed_for_local_delete\",\n baseSha256: change.baseSha256,\n localSha256: currentEntry.sha256,\n });\n }\n\n return {\n appliedUpserts,\n appliedDeletes,\n skipped,\n conflicts,\n currentFiles: [...currentMap.values()].sort(compareByPath),\n };\n}\n\nfunction verifyRecordContents(\n records: readonly OfflineSyncFileRecord[],\n context: string,\n options: { requireContent?: boolean } = {},\n): Map<string, Buffer> {\n const buffers = new Map<string, Buffer>();\n for (const record of records) {\n if (typeof record.contentBase64 !== \"string\") {\n if (options.requireContent === false) continue;\n throw new Error(`${context}: contentBase64 is required for ${record.path}`);\n }\n const buffer = Buffer.from(record.contentBase64, \"base64\");\n const digest = sha256Buffer(buffer);\n if (digest.sha256 !== record.sha256 || digest.bytes !== record.bytes) {\n throw new Error(\n `${context}: content checksum mismatch for ${record.path}`,\n );\n }\n buffers.set(record.path, buffer);\n }\n return buffers;\n}\n\nfunction requiredBuffer(buffers: Map<string, Buffer>, relPath: string): Buffer {\n const buffer = buffers.get(relPath);\n if (!buffer) {\n throw new Error(`missing decoded content for ${relPath}`);\n }\n return buffer;\n}\n\nasync function ensureSyncRoot(rootPath: string, errorPrefix: string): Promise<SafeArchiveRoot> {\n const rootAbs = path.resolve(rootPath);\n await mkdir(rootAbs, { recursive: true });\n return prepareSafeArchiveRoot(rootAbs, errorPrefix, \"root\");\n}\n\nfunction byPath<T extends OfflineSyncFileState>(files: readonly T[]): Map<string, T> {\n const out = new Map<string, T>();\n for (const file of files) {\n out.set(validateArchiveRelativePath(file.path, \"offlineSync\"), file);\n }\n return out;\n}\n\nfunction unionPaths(...maps: Array<Map<string, unknown>>): string[] {\n const paths = new Set<string>();\n for (const map of maps) {\n for (const key of map.keys()) paths.add(key);\n }\n return [...paths].sort();\n}\n\nfunction toFileState(file: OfflineSyncFileState): OfflineSyncFileState {\n return {\n path: file.path,\n sha256: file.sha256,\n bytes: file.bytes,\n mtimeMs: file.mtimeMs,\n };\n}\n\nasync function writeSafeFile(\n root: SafeArchiveRoot,\n relPath: string,\n content: Buffer,\n writeFileHook?: (target: OfflineSyncFileWriteTarget) => Promise<void>,\n): Promise<void> {\n const target = await resolveSafeArchiveTarget(root, relPath);\n if (writeFileHook) {\n await writeFileHook({ root: root.abs, path: relPath, filePath: target, content });\n return;\n }\n await mkdir(path.dirname(target), { recursive: true });\n const tmp = path.join(\n path.dirname(target),\n `.remnic-sync.${process.pid}.${randomUUID()}.tmp`,\n );\n await writeFile(tmp, content);\n try {\n const targetStat = await lstat(target).catch((error: unknown) => {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return null;\n throw error;\n });\n if (targetStat?.isSymbolicLink()) {\n throw new Error(`offline sync target is a symlink: ${relPath}`);\n }\n await rename(tmp, target);\n } catch (error) {\n await unlink(tmp).catch(() => {});\n throw error;\n }\n}\n\nasync function deleteSafeFile(\n root: SafeArchiveRoot,\n relPath: string,\n deleteFile?: (target: OfflineSyncFileTarget) => Promise<void>,\n): Promise<void> {\n const target = await resolveSafeArchiveTarget(root, relPath);\n if (deleteFile) {\n await deleteFile({ root: root.abs, path: relPath, filePath: target });\n return;\n }\n await unlink(target).catch((error: unknown) => {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return;\n throw error;\n });\n}\n\nasync function recordConflict(options: {\n root: SafeArchiveRoot;\n relPath: string;\n reason: OfflineSyncConflict[\"reason\"];\n baseSha256?: string;\n localSha256?: string;\n incomingSha256?: string;\n incomingBuffer?: Buffer;\n writeConflictCopies: boolean;\n sourceId: string;\n writeFile?: (target: OfflineSyncFileWriteTarget) => Promise<void>;\n}): Promise<OfflineSyncConflict> {\n let conflictPath: string | undefined;\n if (options.writeConflictCopies && options.incomingBuffer) {\n const sourceHash = hashText(options.sourceId).slice(0, 12);\n const stamp = new Date().toISOString().replace(/[:.]/g, \"-\");\n conflictPath = `${SYNC_INTERNAL_DIR}/conflicts/${stamp}-${sourceHash}/${options.relPath}`;\n await writeSafeFile(options.root, conflictPath, options.incomingBuffer, options.writeFile);\n }\n return {\n path: options.relPath,\n reason: options.reason,\n baseSha256: options.baseSha256,\n localSha256: options.localSha256,\n incomingSha256: options.incomingSha256,\n ...(conflictPath ? { conflictPath } : {}),\n };\n}\n\nexport function defaultOfflineSyncStatePath(\n memoryDir: string,\n remoteId: string,\n namespace?: string,\n): string {\n const key = hashText(`${remoteId}\\0${namespace ?? \"\"}`).slice(0, 16);\n return path.join(path.resolve(memoryDir), SYNC_INTERNAL_DIR, \"state\", `${key}.json`);\n}\n\nexport async function readOfflineSyncState(\n statePath: string,\n): Promise<OfflineSyncState | null> {\n let raw: string;\n try {\n raw = await readFile(path.resolve(statePath), \"utf-8\");\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return null;\n throw error;\n }\n const parsed = JSON.parse(raw) as unknown;\n return normalizeOfflineSyncState(parsed);\n}\n\nexport async function writeOfflineSyncState(\n statePath: string,\n state: OfflineSyncState,\n): Promise<void> {\n const normalized = normalizeOfflineSyncState(state);\n const target = path.resolve(statePath);\n await mkdir(path.dirname(target), { recursive: true });\n const tmp = path.join(\n path.dirname(target),\n `.remnic-sync-state.${process.pid}.${randomUUID()}.tmp`,\n );\n await writeFile(tmp, JSON.stringify(normalized, null, 2) + \"\\n\", \"utf-8\");\n try {\n await rename(tmp, target);\n } catch (error) {\n await unlink(tmp).catch(() => {});\n throw error;\n }\n}\n\nexport function offlineSyncStateFromSnapshot(options: {\n remoteId: string;\n namespace?: string;\n snapshot: OfflineSyncSnapshot;\n baseFiles?: readonly OfflineSyncFileState[];\n}): OfflineSyncState {\n const snapshot = normalizeOfflineSyncSnapshot(options.snapshot);\n return normalizeOfflineSyncState({\n version: OFFLINE_SYNC_STATE_VERSION,\n remoteId: options.remoteId,\n namespace: options.namespace,\n includeTranscripts: snapshot.includeTranscripts,\n lastSyncedAt: new Date().toISOString(),\n baseFiles: options.baseFiles ?? snapshot.files.map(toFileState),\n });\n}\n\nexport function normalizeOfflineSyncState(input: unknown): OfflineSyncState {\n if (!input || typeof input !== \"object\" || Array.isArray(input)) {\n throw new Error(\"offline sync state must be an object\");\n }\n const obj = input as Record<string, unknown>;\n if (obj.version !== OFFLINE_SYNC_STATE_VERSION) {\n throw new Error(`offline sync state version must be ${OFFLINE_SYNC_STATE_VERSION}`);\n }\n const namespace =\n typeof obj.namespace === \"string\" && obj.namespace.trim().length > 0\n ? obj.namespace.trim()\n : undefined;\n const baseFiles = normalizeFileStates(obj.baseFiles as readonly unknown[] | undefined)\n .sort(compareByPath);\n assertUniquePaths(baseFiles, \"offline sync state\");\n return {\n version: OFFLINE_SYNC_STATE_VERSION,\n remoteId: normalizeSourceId(obj.remoteId, \"remoteId\"),\n ...(namespace ? { namespace } : {}),\n includeTranscripts: assertBoolean(obj.includeTranscripts, \"includeTranscripts\"),\n lastSyncedAt: normalizeIsoString(obj.lastSyncedAt, \"lastSyncedAt\"),\n baseFiles,\n };\n}\n\nexport function fileStatesFromSnapshot(snapshot: OfflineSyncSnapshot): OfflineSyncFileState[] {\n return normalizeOfflineSyncSnapshot(snapshot).files.map(toFileState).sort(compareByPath);\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,YAAY,kBAAkB;AACvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,UAAU;AAaV,IAAM,+BAA+B;AACrC,IAAM,gCAAgC;AACtC,IAAM,6BAA6B;AA+G1C,IAAM,oBAAoB;AAC1B,IAAM,sBAAsB,oBAAI,IAAI;AAAA,EAClC;AACF,CAAC;AAED,IAAM,qBAAqB,oBAAI,IAAI;AAAA,EACjC;AAAA,EACA;AACF,CAAC;AAED,IAAM,yBAAyB;AAAA,EAC7B;AAAA,EACA;AACF;AAEA,SAAS,SAAS,OAAuB;AACvC,SAAO,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AACxD;AAEA,SAAS,aAAa,QAAmD;AACvE,SAAO,YAAY,MAAM;AAC3B;AAEA,SAAS,cAA0C,MAAS,OAAkB;AAC5E,SAAO,KAAK,KAAK,cAAc,MAAM,IAAI;AAC3C;AAEA,SAAS,aAAa,OAAgB,OAAuB;AAC3D,MAAI,OAAO,UAAU,YAAY,CAAC,kBAAkB,KAAK,KAAK,GAAG;AAC/D,UAAM,IAAI,MAAM,GAAG,KAAK,2CAA2C;AAAA,EACrE;AACA,SAAO,MAAM,YAAY;AAC3B;AAEA,SAAS,yBAAyB,O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OAAO,IAAI,cAAc,YAAY,IAAI,UAAU,KAAK,EAAE,SAAS,IAC/D,IAAI,UAAU,KAAK,IACnB;AACN,QAAM,YAAY,oBAAoB,IAAI,SAA2C,EAClF,KAAK,aAAa;AACrB,oBAAkB,WAAW,oBAAoB;AACjD,SAAO;AAAA,IACL,SAAS;AAAA,IACT,UAAU,kBAAkB,IAAI,UAAU,UAAU;AAAA,IACpD,GAAI,YAAY,EAAE,UAAU,IAAI,CAAC;AAAA,IACjC,oBAAoB,cAAc,IAAI,oBAAoB,oBAAoB;AAAA,IAC9E,cAAc,mBAAmB,IAAI,cAAc,cAAc;AAAA,IACjE;AAAA,EACF;AACF;AAEO,SAAS,uBAAuB,UAAuD;AAC5F,SAAO,6BAA6B,QAAQ,EAAE,MAAM,IAAI,WAAW,EAAE,KAAK,aAAa;AACzF;","names":[]}
|
|
@@ -253,6 +253,11 @@ var offlineSyncApplyRequestSchema = z.object({
|
|
|
253
253
|
message: "changeset is required",
|
|
254
254
|
path: ["changeset"]
|
|
255
255
|
});
|
|
256
|
+
var offlineSyncFilesRequestSchema = z.object({
|
|
257
|
+
namespace: namespaceSchema,
|
|
258
|
+
includeTranscripts: z.boolean().optional(),
|
|
259
|
+
paths: z.array(z.string().trim().min(1, "path must be non-empty").max(4096)).max(5e3, "paths must contain 5000 or fewer entries")
|
|
260
|
+
});
|
|
256
261
|
var nullableOptional = (schema) => schema.optional().nullable().transform((value) => value ?? void 0);
|
|
257
262
|
var actionConfidenceRuleSchema = z.object({
|
|
258
263
|
kind: z.enum(ACTION_CONFIDENCE_RULE_KINDS),
|
|
@@ -300,6 +305,7 @@ var schemas = {
|
|
|
300
305
|
capsuleExport: capsuleExportRequestSchema,
|
|
301
306
|
capsuleImport: capsuleImportRequestSchema,
|
|
302
307
|
capsuleList: capsuleListRequestSchema,
|
|
308
|
+
offlineSyncFiles: offlineSyncFilesRequestSchema,
|
|
303
309
|
offlineSyncApply: offlineSyncApplyRequestSchema,
|
|
304
310
|
actionConfidence: actionConfidenceRequestSchema
|
|
305
311
|
};
|
|
@@ -344,7 +350,8 @@ export {
|
|
|
344
350
|
capsuleImportRequestSchema,
|
|
345
351
|
capsuleListRequestSchema,
|
|
346
352
|
offlineSyncApplyRequestSchema,
|
|
353
|
+
offlineSyncFilesRequestSchema,
|
|
347
354
|
actionConfidenceRequestSchema,
|
|
348
355
|
validateRequest
|
|
349
356
|
};
|
|
350
|
-
//# sourceMappingURL=chunk-
|
|
357
|
+
//# sourceMappingURL=chunk-66H2DZYB.js.map
|