@nicia-ai/typegraph 0.67.1 → 0.68.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/backend/postgres/pglite-store.cjs +1 -1
  3. package/dist/backend/postgres/pglite-store.js +1 -1
  4. package/dist/backend/sqlite/local-store.cjs +1 -1
  5. package/dist/backend/sqlite/local-store.js +1 -1
  6. package/dist/{chunk-T3VU3YRQ.cjs → chunk-6GUBF5TF.cjs} +24 -18
  7. package/dist/chunk-6GUBF5TF.cjs.map +1 -0
  8. package/dist/{chunk-55DGFZYC.js → chunk-EJYBHBIB.js} +3 -3
  9. package/dist/{chunk-55DGFZYC.js.map → chunk-EJYBHBIB.js.map} +1 -1
  10. package/dist/{chunk-WY3IFEKV.cjs → chunk-IFTYHOEE.cjs} +13 -5
  11. package/dist/chunk-IFTYHOEE.cjs.map +1 -0
  12. package/dist/{chunk-RTPMG6LQ.js → chunk-JVKHJQ6Q.js} +13 -5
  13. package/dist/chunk-JVKHJQ6Q.js.map +1 -0
  14. package/dist/{chunk-FS2GVO2T.cjs → chunk-OBEYH22Q.cjs} +159 -159
  15. package/dist/{chunk-FS2GVO2T.cjs.map → chunk-OBEYH22Q.cjs.map} +1 -1
  16. package/dist/{chunk-7YJHUY4T.js → chunk-VUYODTHL.js} +10 -5
  17. package/dist/chunk-VUYODTHL.js.map +1 -0
  18. package/dist/graph-merge/index.cjs +540 -22
  19. package/dist/graph-merge/index.cjs.map +1 -1
  20. package/dist/graph-merge/index.d.cts +317 -9
  21. package/dist/graph-merge/index.d.ts +317 -9
  22. package/dist/graph-merge/index.js +512 -8
  23. package/dist/graph-merge/index.js.map +1 -1
  24. package/dist/index.cjs +43 -43
  25. package/dist/index.js +2 -2
  26. package/dist/interchange/index.cjs +25 -25
  27. package/dist/interchange/index.js +2 -2
  28. package/dist/{local-store-impl-GI6S4J6B.cjs → local-store-impl-INNRHDK3.cjs} +5 -5
  29. package/dist/{local-store-impl-GI6S4J6B.cjs.map → local-store-impl-INNRHDK3.cjs.map} +1 -1
  30. package/dist/{local-store-impl-CCMWTLGY.js → local-store-impl-VGC3OKCA.js} +4 -4
  31. package/dist/{local-store-impl-CCMWTLGY.js.map → local-store-impl-VGC3OKCA.js.map} +1 -1
  32. package/dist/{pglite-store-impl-HAPAJUIO.cjs → pglite-store-impl-KDS4NRMC.cjs} +5 -5
  33. package/dist/{pglite-store-impl-HAPAJUIO.cjs.map → pglite-store-impl-KDS4NRMC.cjs.map} +1 -1
  34. package/dist/{pglite-store-impl-HDLFOZWS.js → pglite-store-impl-LJDF2EUF.js} +4 -4
  35. package/dist/{pglite-store-impl-HDLFOZWS.js.map → pglite-store-impl-LJDF2EUF.js.map} +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunk-7YJHUY4T.js.map +0 -1
  38. package/dist/chunk-RTPMG6LQ.js.map +0 -1
  39. package/dist/chunk-T3VU3YRQ.cjs.map +0 -1
  40. package/dist/chunk-WY3IFEKV.cjs.map +0 -1
@@ -922,6 +922,12 @@ declare const MERGE_ERROR_CODES: {
922
922
  readonly evidence: "GRAPH_MERGE_EVIDENCE";
923
923
  readonly candidateWriteSet: "GRAPH_MERGE_CANDIDATE_WRITE_SET";
924
924
  readonly review: "GRAPH_MERGE_REVIEW";
925
+ readonly operation: "GRAPH_MERGE_OPERATION";
926
+ readonly operationRequest: "GRAPH_MERGE_OPERATION_REQUEST";
927
+ readonly operationConflict: "GRAPH_MERGE_OPERATION_CONFLICT";
928
+ readonly operationUnsupported: "GRAPH_MERGE_OPERATION_UNSUPPORTED";
929
+ readonly operationEvidence: "GRAPH_MERGE_OPERATION_EVIDENCE";
930
+ readonly operationUndelivered: "GRAPH_MERGE_OPERATION_UNDELIVERED";
925
931
  };
926
932
  /**
927
933
  * Options shared by every merge error. Mirrors the relevant subset of
@@ -1074,6 +1080,58 @@ declare class MatchEvidenceError extends MergeError {
1074
1080
  readonly code: "GRAPH_MERGE_EVIDENCE";
1075
1081
  constructor(message: string, options?: MergeErrorOptions);
1076
1082
  }
1083
+ /**
1084
+ * Generic operational failure raised while orchestrating a durable-branch
1085
+ * operation, such as a strategy transport or host failure.
1086
+ */
1087
+ declare class DurableOperationError extends MergeError {
1088
+ readonly code: string;
1089
+ constructor(message: string, options?: MergeErrorOptions);
1090
+ }
1091
+ /** Raised when a durable-operation request or descriptor is invalid. */
1092
+ declare class DurableOperationRequestError extends DurableOperationError {
1093
+ protected static readonly errorCategory = "user";
1094
+ readonly code: "GRAPH_MERGE_OPERATION_REQUEST";
1095
+ constructor(message: string, options?: MergeErrorOptions);
1096
+ }
1097
+ /**
1098
+ * Raised when an idempotency key is reused with a different operation digest.
1099
+ * The previously committed operation is returned untouched; the new request is
1100
+ * refused before any graph mutation or evidence write.
1101
+ */
1102
+ declare class DurableOperationConflictError extends DurableOperationError {
1103
+ protected static readonly errorCategory = "constraint";
1104
+ readonly code: "GRAPH_MERGE_OPERATION_CONFLICT";
1105
+ constructor(message: string, options?: MergeErrorOptions);
1106
+ }
1107
+ /**
1108
+ * Raised when a host cannot provide the atomic mutation-plus-evidence
1109
+ * guarantee. It carries the dimensions the host cannot honor. The portable
1110
+ * fallback is refusal; TypeGraph never emulates atomicity with callbacks or
1111
+ * best effort.
1112
+ */
1113
+ declare class DurableOperationUnsupportedError extends DurableOperationError {
1114
+ protected static readonly errorCategory = "user";
1115
+ readonly code: "GRAPH_MERGE_OPERATION_UNSUPPORTED";
1116
+ constructor(message: string, options?: MergeErrorOptions);
1117
+ }
1118
+ /** Raised when a host returns malformed or request-inconsistent evidence. */
1119
+ declare class DurableOperationEvidenceError extends DurableOperationError {
1120
+ readonly code: "GRAPH_MERGE_OPERATION_EVIDENCE";
1121
+ constructor(message: string, options?: MergeErrorOptions);
1122
+ }
1123
+ /**
1124
+ * Raised when archive/destroy is fenced by undelivered operation evidence.
1125
+ *
1126
+ * Extends {@link BranchError} so the established `destroyDurableBranch` result
1127
+ * type already transports it: a strategy that refuses destruction while
1128
+ * undelivered evidence remains preserves that refusal to the caller instead of
1129
+ * having it flattened into a generic branch failure.
1130
+ */
1131
+ declare class DurableEvidenceUndeliveredError extends BranchError {
1132
+ readonly code: "GRAPH_MERGE_OPERATION_UNDELIVERED";
1133
+ constructor(message: string, options?: MergeErrorOptions);
1134
+ }
1077
1135
 
1078
1136
  /**
1079
1137
  * Pluggable working-copy strategy: how `branch()` produces an isolated,
@@ -1112,6 +1170,14 @@ declare class MatchEvidenceError extends MergeError {
1112
1170
  * identical reads on the base for any instant between the row's real
1113
1171
  * creation and the clone.
1114
1172
  *
1173
+ * Undeclared properties are the same class of stored live state.
1174
+ * `validateStore()` treats them as healthy semi-structured data. The clone
1175
+ * therefore imports with `onUnknownProperty: "allow"` — interchange's
1176
+ * fidelity-preserving strategy — so those keys survive the round trip.
1177
+ * `"error"` would refuse to branch a graph analysis already reports as clean.
1178
+ * `"strip"` would drop the keys on the fork, and the merge diff against the
1179
+ * original base would invent deletions the caller never made.
1180
+ *
1115
1181
  * Logical-namespace (copy-on-write within one backend, no full data copy) is a
1116
1182
  * future strategy slot — see the `WorkingCopyStrategy` interface — deferred past
1117
1183
  * P0.
@@ -1177,14 +1243,17 @@ type MakeBackend = () => Promise<GraphBackend>;
1177
1243
  * base's live state.
1178
1244
  * 2. Create a fresh store over the caller-provided backend with the SAME graph
1179
1245
  * definition via `createStoreWithSchema`.
1180
- * 3. `importGraphStream(freshStore, data, { onConflict: "error", ... })` — ids are
1181
- * preserved so the diff engine can key on them. `onConflict: "error"`
1182
- * requires the backend to be EMPTY: a pre-existing row is a contract
1183
- * violation that must surface loudly, never be silently skipped (a skipped
1184
- * row would leave the clone diverging from the base, so the fork's diff would
1185
- * report phantom modifications/deletions). `importGraphStream` RETURNS
1186
- * `{ success, errors }` rather than throwing on a per-row rejection, so its
1187
- * result is checked and any failure fails the branch.
1246
+ * 3. `importGraphStream(freshStore, data, { onConflict: "error",
1247
+ * onUnknownProperty: "allow", ... })` — ids are preserved so the diff
1248
+ * engine can key on them. `onConflict: "error"` requires the backend to be
1249
+ * EMPTY: a pre-existing row is a contract violation that must surface
1250
+ * loudly, never be silently skipped (a skipped row would leave the clone
1251
+ * diverging from the base, so the fork's diff would report phantom
1252
+ * modifications/deletions). `onUnknownProperty: "allow"` carries undeclared
1253
+ * properties through (see the fidelity note above). A streamed chunk that
1254
+ * reports per-row errors throws (default `onStreamChunkError: "abort"`); a
1255
+ * materialized import returns `{ success, errors }`. Either failure fails
1256
+ * the branch.
1188
1257
  *
1189
1258
  * The backend `makeBackend()` returns is opened here, so any failure AFTER it is
1190
1259
  * created closes it before rethrowing — only the success path hands the backend
@@ -1780,6 +1849,230 @@ declare function planCandidateWriteSetReview<G extends GraphDef>(args: PlanCandi
1780
1849
  */
1781
1850
  declare function revalidateCandidateWriteSetReview<G extends GraphDef>(args: RevalidateCandidateWriteSetReviewArgs<G>): Promise<Result<MergeReviewRevalidation, MergeError>>;
1782
1851
 
1852
+ /**
1853
+ * Durable-branch operations: a generic, backend-neutral facility for a durable
1854
+ * host to combine an opaque graph mutation with immutable operation evidence in
1855
+ * ONE host transaction.
1856
+ *
1857
+ * The facility is deliberately the same shape as the optional host-native merge
1858
+ * command ({@link import("./durable-merge").applyDurableMergePlan}): TypeGraph
1859
+ * owns descriptor validation, sealed-origin attestation, request
1860
+ * canonicalization, and evidence validation; the host owns the database
1861
+ * mechanics. A strategy that cannot combine the mutation and its evidence in a
1862
+ * single atomic unit returns `unsupported` BEFORE touching the host, and
1863
+ * TypeGraph refuses rather than emulating atomicity with callbacks or best
1864
+ * effort.
1865
+ *
1866
+ * WHAT IS OPAQUE. Both `metadata` and `mutation` are JSON-safe host values.
1867
+ * TypeGraph never interprets their application fields; it canonicalizes them to
1868
+ * derive {@link DurableBranchOperation.operationDigest} and otherwise carries
1869
+ * them through untouched. `metadata` is retained as evidence; `mutation` is the
1870
+ * host's own description of the graph change it must apply (for example a
1871
+ * serialized statement or a host-defined command) atomically with the evidence
1872
+ * row.
1873
+ *
1874
+ * IDEMPOTENCY. The digest is derived from the complete request content
1875
+ * (`mutation` plus `metadata`) with the repository's canonical JSON serializer.
1876
+ * The strategy is handed the digest and MUST treat `(idempotencyKey)` as the
1877
+ * unique key: identical key AND digest returns the previously committed
1878
+ * evidence without re-applying; identical key with a different digest fails
1879
+ * with {@link DurableOperationConflictError} and mutates nothing.
1880
+ *
1881
+ * DELIVERY AND DESTRUCTION. Evidence is delivered explicitly via
1882
+ * {@link markDurableOperationDelivered}. Archive/destroy is fenced on
1883
+ * undelivered evidence: a strategy MUST refuse destruction while undelivered
1884
+ * evidence remains, and the refusal is preserved through
1885
+ * {@link import("./durable-branch").destroyDurableBranch} as a
1886
+ * {@link DurableEvidenceUndeliveredError}. Concurrent `operate` and `destroy`
1887
+ * are serialized by the host's own transaction: either the operation commits
1888
+ * first (destroy observes undelivered evidence and refuses) or destroy commits
1889
+ * first (the operation fails against the removed allocation). No partial state
1890
+ * is ever observable.
1891
+ *
1892
+ * CURSORS. {@link scanDurableOperations} returns evidence in a stable total
1893
+ * order the strategy defines (commit order, ties broken deterministically).
1894
+ * `cursor` is an opaque continuation token; pass it back as `after` to resume.
1895
+ * A missing `cursor` means the scan reached the end.
1896
+ */
1897
+
1898
+ /** Default page size for {@link scanDurableOperations}. */
1899
+ declare const DURABLE_OPERATION_SCAN_DEFAULT_LIMIT = 100;
1900
+ /** Largest page a single {@link scanDurableOperations} call may request. */
1901
+ declare const DURABLE_OPERATION_SCAN_MAX_LIMIT = 1000;
1902
+ /**
1903
+ * The dimensions whose absence a strategy reports through the `unsupported`
1904
+ * outcome. Each names a guarantee TypeGraph will not fake.
1905
+ */
1906
+ type DurableOperationUnsupportedDimension = "atomicMutation" | "evidenceStore" | "host";
1907
+ /**
1908
+ * The caller's operation request. `idempotencyKey` identifies the operation;
1909
+ * `mutation` is the host's opaque, JSON-safe description of the graph change;
1910
+ * `metadata` is opaque, JSON-safe host evidence TypeGraph never interprets.
1911
+ */
1912
+ type DurableBranchOperationRequest = Readonly<{
1913
+ idempotencyKey: string;
1914
+ metadata: JsonValue;
1915
+ mutation: JsonValue;
1916
+ }>;
1917
+ /**
1918
+ * The canonical operation handed to the strategy: the request plus the
1919
+ * TypeGraph-derived digest the strategy must use for idempotency.
1920
+ */
1921
+ type DurableBranchOperation = Readonly<{
1922
+ idempotencyKey: string;
1923
+ operationDigest: string;
1924
+ metadata: JsonValue;
1925
+ mutation: JsonValue;
1926
+ }>;
1927
+ /**
1928
+ * A branch's content coordinates at one point. `base` is the
1929
+ * merge-visible base-version fingerprint (as produced by
1930
+ * `computeBaseVersion`); `revision` is the engine revision when the working
1931
+ * copy resolves lineage.
1932
+ */
1933
+ type DurableBranchCoordinates = Readonly<{
1934
+ base: BaseVersion;
1935
+ revision?: EngineRevision | undefined;
1936
+ }>;
1937
+ /**
1938
+ * Immutable evidence of one committed operation. `delivered` is the only
1939
+ * mutating dimension, and it moves in one direction (`false` → `true`) under
1940
+ * {@link DurableOperationCapability.markDelivered}. A newly `applied`
1941
+ * operation must return `false`; an exact `replayed` operation returns its
1942
+ * current committed delivery state.
1943
+ */
1944
+ type DurableBranchOperationEvidence = Readonly<{
1945
+ idempotencyKey: string;
1946
+ operationDigest: string;
1947
+ metadata: JsonValue;
1948
+ mutation: JsonValue;
1949
+ before: DurableBranchCoordinates;
1950
+ after: DurableBranchCoordinates;
1951
+ delivered: boolean;
1952
+ }>;
1953
+ /** One stable-order page of evidence returned by {@link scanDurableOperations}. */
1954
+ type DurableOperationScan = Readonly<{
1955
+ operations: readonly DurableBranchOperationEvidence[];
1956
+ /** Opaque continuation token; absent when the scan reached the end. */
1957
+ cursor?: string | undefined;
1958
+ }>;
1959
+ /** Outcome of an atomic operation attempt. */
1960
+ type DurableOperationOutcome = Readonly<{
1961
+ outcome: "applied" | "replayed";
1962
+ evidence: DurableBranchOperationEvidence;
1963
+ }> | Readonly<{
1964
+ outcome: "unsupported";
1965
+ dimensions: readonly [
1966
+ DurableOperationUnsupportedDimension,
1967
+ ...DurableOperationUnsupportedDimension[]
1968
+ ];
1969
+ }>;
1970
+ /**
1971
+ * The optional host capability behind `DurableWorkingCopyStrategy.operations`.
1972
+ *
1973
+ * Every member receives the opaque locator AND the caller's expected origin, so
1974
+ * the host attests the sealed origin exactly as it does for reopen, destroy,
1975
+ * and native merge. TypeGraph validates the descriptor before any member is
1976
+ * called.
1977
+ */
1978
+ type DurableOperationCapability<TStoreDescriptor extends DurableStoreDescriptor = DurableStoreDescriptor> = Readonly<{
1979
+ /**
1980
+ * Atomically applies `request.mutation` and records evidence, or returns
1981
+ * `unsupported` having executed no host SQL or mutation.
1982
+ *
1983
+ * The host MUST:
1984
+ * 1. attest `expectedOrigin` against the allocation `descriptor` names;
1985
+ * 2. return the previously committed evidence unchanged when
1986
+ * `(idempotencyKey, operationDigest)` matches a committed operation,
1987
+ * applying nothing;
1988
+ * 3. refuse with {@link DurableOperationConflictError} when the key exists
1989
+ * with a different digest, applying nothing; and
1990
+ * 4. otherwise apply the mutation and undelivered evidence in ONE
1991
+ * transaction, returning `outcome: "applied"` with `delivered: false`.
1992
+ */
1993
+ operate: (args: Readonly<{
1994
+ descriptor: TStoreDescriptor;
1995
+ expectedOrigin: DurableBranchOrigin;
1996
+ request: DurableBranchOperation;
1997
+ }>) => Promise<DurableOperationOutcome>;
1998
+ /** Reads one operation's evidence, or `undefined` when never committed. */
1999
+ get: (args: Readonly<{
2000
+ descriptor: TStoreDescriptor;
2001
+ expectedOrigin: DurableBranchOrigin;
2002
+ idempotencyKey: string;
2003
+ }>) => Promise<DurableBranchOperationEvidence | undefined>;
2004
+ /**
2005
+ * Reads evidence in the strategy's stable total order. `after` resumes from
2006
+ * a previous page's `cursor`; `limit` bounds the page.
2007
+ */
2008
+ scan: (args: Readonly<{
2009
+ descriptor: TStoreDescriptor;
2010
+ expectedOrigin: DurableBranchOrigin;
2011
+ after?: string | undefined;
2012
+ limit: number;
2013
+ }>) => Promise<DurableOperationScan>;
2014
+ /**
2015
+ * Marks one operation delivered. MUST be idempotent: marking an
2016
+ * already-delivered operation returns the same evidence and writes nothing.
2017
+ * Returns `undefined` when the operation does not exist.
2018
+ */
2019
+ markDelivered: (args: Readonly<{
2020
+ descriptor: TStoreDescriptor;
2021
+ expectedOrigin: DurableBranchOrigin;
2022
+ idempotencyKey: string;
2023
+ }>) => Promise<DurableBranchOperationEvidence | undefined>;
2024
+ /** Whether any committed evidence is still undelivered. */
2025
+ hasUndelivered: (args: Readonly<{
2026
+ descriptor: TStoreDescriptor;
2027
+ expectedOrigin: DurableBranchOrigin;
2028
+ }>) => Promise<boolean>;
2029
+ }>;
2030
+ /**
2031
+ * Derives the operation digest from its canonical content. The digest covers
2032
+ * the complete request except the idempotency key, so reusing a key with a
2033
+ * different mutation OR different metadata conflicts.
2034
+ */
2035
+ declare function computeDurableOperationDigest(request: DurableBranchOperationRequest): Promise<string>;
2036
+ /**
2037
+ * Atomically applies an opaque graph mutation and commits its evidence through
2038
+ * the strategy's optional `operations.operate` capability.
2039
+ *
2040
+ * Descriptor format/type/version validation and the sealed-origin attestation
2041
+ * are exactly those of reopen, destroy, and native merge: TypeGraph validates
2042
+ * the envelope and hands the caller's expected origin to the host, which
2043
+ * attests it inside its own transaction. A strategy without the capability
2044
+ * yields the `unsupported` outcome with no host call.
2045
+ */
2046
+ declare function operateDurableBranch<G extends GraphDef, TStoreDescriptor extends DurableStoreDescriptor = DurableStoreDescriptor>(descriptor: DurableBranchDescriptor<TStoreDescriptor>, strategy: DurableWorkingCopyStrategy<G, TStoreDescriptor>, request: DurableBranchOperationRequest): Promise<Result<DurableOperationOutcome, DurableOperationError>>;
2047
+ /**
2048
+ * Reads one operation's evidence. Returns `undefined` when the operation was
2049
+ * never committed. A strategy without evidence access is an explicit typed
2050
+ * refusal.
2051
+ */
2052
+ declare function getDurableOperation<G extends GraphDef, TStoreDescriptor extends DurableStoreDescriptor = DurableStoreDescriptor>(descriptor: DurableBranchDescriptor<TStoreDescriptor>, strategy: DurableWorkingCopyStrategy<G, TStoreDescriptor>, idempotencyKey: string): Promise<Result<DurableBranchOperationEvidence | undefined, DurableOperationError>>;
2053
+ /**
2054
+ * Reads evidence in a stable order. `after` resumes from a previous page's
2055
+ * `cursor`; `limit` defaults to {@link DURABLE_OPERATION_SCAN_DEFAULT_LIMIT}
2056
+ * and may not exceed {@link DURABLE_OPERATION_SCAN_MAX_LIMIT}. The returned
2057
+ * `cursor` is absent at the end of the scan.
2058
+ */
2059
+ declare function scanDurableOperations<G extends GraphDef, TStoreDescriptor extends DurableStoreDescriptor = DurableStoreDescriptor>(descriptor: DurableBranchDescriptor<TStoreDescriptor>, strategy: DurableWorkingCopyStrategy<G, TStoreDescriptor>, options?: Readonly<{
2060
+ after?: string | undefined;
2061
+ limit?: number | undefined;
2062
+ }>): Promise<Result<DurableOperationScan, DurableOperationError>>;
2063
+ /**
2064
+ * Marks one operation delivered, idempotently. Marking an already-delivered
2065
+ * operation returns the same evidence without writing. Returns `undefined` when
2066
+ * the operation does not exist.
2067
+ */
2068
+ declare function markDurableOperationDelivered<G extends GraphDef, TStoreDescriptor extends DurableStoreDescriptor = DurableStoreDescriptor>(descriptor: DurableBranchDescriptor<TStoreDescriptor>, strategy: DurableWorkingCopyStrategy<G, TStoreDescriptor>, idempotencyKey: string): Promise<Result<DurableBranchOperationEvidence | undefined, DurableOperationError>>;
2069
+ /**
2070
+ * Reports whether any committed evidence is still undelivered. Archive/destroy
2071
+ * must fence on this; the strategy enforces the fence atomically, this is the
2072
+ * queryable half.
2073
+ */
2074
+ declare function durableBranchHasUndeliveredEvidence<G extends GraphDef, TStoreDescriptor extends DurableStoreDescriptor = DurableStoreDescriptor>(descriptor: DurableBranchDescriptor<TStoreDescriptor>, strategy: DurableWorkingCopyStrategy<G, TStoreDescriptor>): Promise<Result<boolean, DurableOperationError>>;
2075
+
1783
2076
  /**
1784
2077
  * Durable working-copy branches: a JSON-serializable descriptor for a
1785
2078
  * PERSISTENT working copy plus reopen / destroy operations over it.
@@ -2056,6 +2349,21 @@ type DurableWorkingCopyStrategy<G extends GraphDef, TStoreDescriptor extends Dur
2056
2349
  expectedOrigin: DurableBranchOrigin;
2057
2350
  plan: MergePlanArtifactV1;
2058
2351
  }>) => Promise<NativeDurableMergeResult>) | undefined;
2352
+ /**
2353
+ * Optional atomic operation + evidence capability.
2354
+ *
2355
+ * When present, {@link import("./durable-operation").operateDurableBranch}
2356
+ * commits the host's opaque graph mutation and its immutable evidence in one
2357
+ * host transaction, keyed by idempotency. `destroy` MUST additionally refuse
2358
+ * to remove the allocation while undelivered evidence remains, throwing
2359
+ * {@link DurableEvidenceUndeliveredError}; closing a branch handle still only
2360
+ * releases the connection.
2361
+ *
2362
+ * A strategy that cannot provide the atomic guarantee MUST omit this
2363
+ * capability (or return `unsupported` from `operate`) rather than emulating
2364
+ * atomicity with callbacks or best effort. See `durable-operation.ts`.
2365
+ */
2366
+ operations?: DurableOperationCapability<TStoreDescriptor> | undefined;
2059
2367
  }>;
2060
2368
  /**
2061
2369
  * A normal {@link GraphBranch} paired with the serializable descriptor that
@@ -2623,4 +2931,4 @@ type KeylessConfig = Readonly<{
2623
2931
  sortFields: readonly string[];
2624
2932
  }>;
2625
2933
 
2626
- export { type ApplyDurableMergePlanArgs, type BaseAmbiguity, type BaseNodeLookup, type BaseVersion, BaseVersionMismatchError, BranchError, type BranchId, type BranchOptions, type BranchProvenance, CANDIDATE_WRITE_SET_FORMAT_VERSION, type CandidateDiagnostic, type CandidateDiagnostics, type CandidateDiagnosticsOptions, type CandidateSource, CandidateSourceError, type CandidateWriteSet, CandidateWriteSetError, CandidateWriteSetSchema, type CandidateWriteSetTarget, CandidateWriteSetTargetSchema, type ComparisonCeilingPolicy, type ConflictingValue, type DeleteModifyConflict, type DeleteModifyPolicy, type DroppedItem, type DurableBranch, type DurableBranchDescriptor, type DurableBranchOrigin, type DurableStoreDescriptor, type DurableWorkingCopyAccess, type DurableWorkingCopyStrategy, type Embedder, type EntityRef, type EntityResolution, type ForkHandle, type ForkedWorkingCopyOptions, type GraphBranch, IdentityAssertionWriteFacade, IdentityMergeConflictError, type IngestionBranch, IngestionImportTarget, type IngestionNodeCollections, InvalidMergeOptionsError, InvalidMergePlanError, type KeylessConfig, MERGE_ERROR_CODES, MERGE_OPTION_DEFAULTS, MERGE_PLAN_DIGEST_ALGORITHM, MERGE_PLAN_FORMAT_VERSION, MERGE_REVIEW_FORMAT_VERSION, type MakeBackend, type MatchEvidence, MatchEvidenceError, type MatchSource, type MatchStrategy, type MergeBranch, MergeConflictError, MergeConstraintConflictError, type MergeConstraintConflictErrorDetails, MergeError, type MergeIncrementalArgs, type MergeOptions, type MergePlanAnchors, type MergePlanApplied, type MergePlanApplyOptions, type MergePlanArtifact, type MergePlanArtifactV1, type MergePlanArtifactV1Input, type MergePlanBranchAnchor, type MergePlanCandidateDiagnostic, type MergePlanCanonicalMapping, MergePlanCapabilityError, type MergePlanDiagnostics, type MergePlanDigest, MergePlanDigestMismatchError, type MergePlanEdgeDelete, type MergePlanEdgeUpsert, type MergePlanEntityRef, type MergePlanEntityResolution, type MergePlanGuards, type MergePlanIdentityAssertion, type MergePlanMatchEvidence, type MergePlanMatchSource, type MergePlanNodeDelete, type MergePlanNodeUpsert, MergePlanOriginMismatchError, type MergePlanProposedSummary, type MergePlanProvenanceOptions, type MergePlanReadContext, type MergePlanRetype, type MergePlanReview, type MergePlanRevisionFence, type MergePlanSchemaFence, MergePlanSchemaMismatchError, type MergePlanSimilarityStrategy, type MergePlanTargetFence, MergePlanTargetMismatchError, type MergePlanTypeReconciliation, type MergePlanWrites, MergePlanningStaleError, type MergeReport, type MergeReviewArtifact, type MergeReviewBaseline, type MergeReviewDifference, MergeReviewError, type MergeReviewPolicy, type MergeReviewRevalidation, type MergeReviewRow, type MergedCounts, type NativeDurableMergeResult, type NativeDurableMergeUnsupportedDimension, type NormalizedMergeOptions, type PlanCandidateWriteSetArgs, type PlanCandidateWriteSetForEvolutionArgs, type PlanCandidateWriteSetReviewArgs, type PropertyConflict, type PropertyConflictPolicy, type ProvenanceGraph, type ProvenanceIndex, type ProvenanceNode, type ProvenanceQuery, type ProvenanceRecord, type ReconcileTypesMode, type ResolveConfig, type ResolveMap, type ResolvedCluster, Result, type RevalidateCandidateWriteSetReviewArgs, type SimilarityStrategy, SimilarityUnavailableError, type SourceScope, StaleMergePlanError, type TypeReconciliation, UnsupportedMergePlanVersionError, VALIDITY_END_TARGET_PRECEDENCE, type ValidityEndResolution, type WorkingCopyStrategy, applyDurableMergePlan, applyMergePlan, applyMergePlanInTransaction, asBaseVersion, asBranchId, branch, branchDurable, branchForEvolution, captureCandidateWriteSetTarget, captureCandidateWriteSetTargetForEvolution, cloneWorkingCopyStrategy, computeBaseVersion, destroyDurableBranch, forkedWorkingCopyStrategy, ingestionBranch, merge, mergeIncremental, normalizeMergeOptions, openProvenanceStore, persistProvenanceRecords, planCandidateWriteSet, planCandidateWriteSetForEvolution, planCandidateWriteSetReview, planMerge, planMergeForEvolution, planMergeIncremental, provenanceGraphId, readProvenance, reopenDurableBranch, revalidateCandidateWriteSetReview };
2934
+ export { type ApplyDurableMergePlanArgs, type BaseAmbiguity, type BaseNodeLookup, type BaseVersion, BaseVersionMismatchError, BranchError, type BranchId, type BranchOptions, type BranchProvenance, CANDIDATE_WRITE_SET_FORMAT_VERSION, type CandidateDiagnostic, type CandidateDiagnostics, type CandidateDiagnosticsOptions, type CandidateSource, CandidateSourceError, type CandidateWriteSet, CandidateWriteSetError, CandidateWriteSetSchema, type CandidateWriteSetTarget, CandidateWriteSetTargetSchema, type ComparisonCeilingPolicy, type ConflictingValue, DURABLE_OPERATION_SCAN_DEFAULT_LIMIT, DURABLE_OPERATION_SCAN_MAX_LIMIT, type DeleteModifyConflict, type DeleteModifyPolicy, type DroppedItem, type DurableBranch, type DurableBranchCoordinates, type DurableBranchDescriptor, type DurableBranchOperation, type DurableBranchOperationEvidence, type DurableBranchOperationRequest, type DurableBranchOrigin, DurableEvidenceUndeliveredError, type DurableOperationCapability, DurableOperationConflictError, DurableOperationError, DurableOperationEvidenceError, type DurableOperationOutcome, DurableOperationRequestError, type DurableOperationScan, type DurableOperationUnsupportedDimension, DurableOperationUnsupportedError, type DurableStoreDescriptor, type DurableWorkingCopyAccess, type DurableWorkingCopyStrategy, type Embedder, type EntityRef, type EntityResolution, type ForkHandle, type ForkedWorkingCopyOptions, type GraphBranch, IdentityAssertionWriteFacade, IdentityMergeConflictError, type IngestionBranch, IngestionImportTarget, type IngestionNodeCollections, InvalidMergeOptionsError, InvalidMergePlanError, type KeylessConfig, MERGE_ERROR_CODES, MERGE_OPTION_DEFAULTS, MERGE_PLAN_DIGEST_ALGORITHM, MERGE_PLAN_FORMAT_VERSION, MERGE_REVIEW_FORMAT_VERSION, type MakeBackend, type MatchEvidence, MatchEvidenceError, type MatchSource, type MatchStrategy, type MergeBranch, MergeConflictError, MergeConstraintConflictError, type MergeConstraintConflictErrorDetails, MergeError, type MergeIncrementalArgs, type MergeOptions, type MergePlanAnchors, type MergePlanApplied, type MergePlanApplyOptions, type MergePlanArtifact, type MergePlanArtifactV1, type MergePlanArtifactV1Input, type MergePlanBranchAnchor, type MergePlanCandidateDiagnostic, type MergePlanCanonicalMapping, MergePlanCapabilityError, type MergePlanDiagnostics, type MergePlanDigest, MergePlanDigestMismatchError, type MergePlanEdgeDelete, type MergePlanEdgeUpsert, type MergePlanEntityRef, type MergePlanEntityResolution, type MergePlanGuards, type MergePlanIdentityAssertion, type MergePlanMatchEvidence, type MergePlanMatchSource, type MergePlanNodeDelete, type MergePlanNodeUpsert, MergePlanOriginMismatchError, type MergePlanProposedSummary, type MergePlanProvenanceOptions, type MergePlanReadContext, type MergePlanRetype, type MergePlanReview, type MergePlanRevisionFence, type MergePlanSchemaFence, MergePlanSchemaMismatchError, type MergePlanSimilarityStrategy, type MergePlanTargetFence, MergePlanTargetMismatchError, type MergePlanTypeReconciliation, type MergePlanWrites, MergePlanningStaleError, type MergeReport, type MergeReviewArtifact, type MergeReviewBaseline, type MergeReviewDifference, MergeReviewError, type MergeReviewPolicy, type MergeReviewRevalidation, type MergeReviewRow, type MergedCounts, type NativeDurableMergeResult, type NativeDurableMergeUnsupportedDimension, type NormalizedMergeOptions, type PlanCandidateWriteSetArgs, type PlanCandidateWriteSetForEvolutionArgs, type PlanCandidateWriteSetReviewArgs, type PropertyConflict, type PropertyConflictPolicy, type ProvenanceGraph, type ProvenanceIndex, type ProvenanceNode, type ProvenanceQuery, type ProvenanceRecord, type ReconcileTypesMode, type ResolveConfig, type ResolveMap, type ResolvedCluster, Result, type RevalidateCandidateWriteSetReviewArgs, type SimilarityStrategy, SimilarityUnavailableError, type SourceScope, StaleMergePlanError, type TypeReconciliation, UnsupportedMergePlanVersionError, VALIDITY_END_TARGET_PRECEDENCE, type ValidityEndResolution, type WorkingCopyStrategy, applyDurableMergePlan, applyMergePlan, applyMergePlanInTransaction, asBaseVersion, asBranchId, branch, branchDurable, branchForEvolution, captureCandidateWriteSetTarget, captureCandidateWriteSetTargetForEvolution, cloneWorkingCopyStrategy, computeBaseVersion, computeDurableOperationDigest, destroyDurableBranch, durableBranchHasUndeliveredEvidence, forkedWorkingCopyStrategy, getDurableOperation, ingestionBranch, markDurableOperationDelivered, merge, mergeIncremental, normalizeMergeOptions, openProvenanceStore, operateDurableBranch, persistProvenanceRecords, planCandidateWriteSet, planCandidateWriteSetForEvolution, planCandidateWriteSetReview, planMerge, planMergeForEvolution, planMergeIncremental, provenanceGraphId, readProvenance, reopenDurableBranch, revalidateCandidateWriteSetReview, scanDurableOperations };