@framers/agentos-ext-account-sources 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @framers/agentos-ext-account-sources
2
2
 
3
- A person's own accounts as sources. This library defines `AccountSourceConnector` and the `SourceRef` every passage carries, with helpers for line ranges, links, bounded body reads, requests under the shared public-sources limiter and the cache lifetime of a read.
3
+ A person's own accounts as sources. This library defines `AccountSourceConnector` and the `SourceRef` every passage carries, with helpers for line ranges, links, bounded body reads, requests under the shared public-sources limiter and the cache lifetime of a read, and the contracts, pure rules and PostgreSQL store of a durable, resumable synchronization.
4
4
 
5
- Install `@framers/agentos-ext-account-sources` with its peer `@framers/agentos` 0.10.40 or later. Node.js 20.19 or later is required. The runtime dependency is `@framers/agentos-ext-public-sources`.
5
+ Install `@framers/agentos-ext-account-sources` with its peer `@framers/agentos` 0.13.134 or later. Node.js 20.19 or later is required. The runtime dependencies are `@framers/agentos-ext-public-sources` and `@framers/sql-storage-adapter`.
6
6
 
7
7
  ## Connector
8
8
 
@@ -115,10 +115,119 @@ A skip carries one of these reasons:
115
115
  | `invalid_bounds` | A clock value that is not a nonnegative safe integer, a `receivedAt` before `readStartedAt`, a `maximumCacheMs` that is not a positive safe integer, or a lifetime past the safe-integer range |
116
116
  | `expired` | The lifetime ends at or before `receivedAt` |
117
117
 
118
- Directive names match in any case and values may be quoted. Other directives, such as `private` and `immutable`, neither grant nor extend a lifetime. The obsolete HTTP date forms are refused rather than parsed.
118
+ Directive names match in any case and values may be quoted; a quoted value may hold commas, as in `private="set-cookie, authorization"`. Other directives, such as `private` and `immutable`, neither grant nor extend a lifetime. The obsolete HTTP date forms are refused rather than parsed.
119
119
 
120
120
  A skip stores nothing: record its reason and keep no content. Store `expiresAt` with the content and check it on every read. Neither a later sync checkpoint nor a second call with the old response extends it; a new read takes a new decision.
121
121
 
122
+ ## Durable synchronization
123
+
124
+ ```ts
125
+ import {
126
+ advanceSourceSyncPage, committableSourceCursor, openSourceSyncCycle,
127
+ type SourceSyncPolicy, type SourceSyncWorkSummary,
128
+ } from '@framers/agentos-ext-account-sources';
129
+
130
+ const policy: SourceSyncPolicy = {
131
+ windowMs: 7 * 86_400_000, maxRetainedDocuments: 100, maxHeldCharacters: 2_000_000,
132
+ maxIndexedCharacters: 4_000_000, scanPageSize: 50, maxScanPages: 4, maxCandidates: 200,
133
+ maxChangedPerLease: 50, maxHistoryPagesPerLease: 10, leaseMs: 120_000,
134
+ pollMs: 900_000, manualMinIntervalMs: 60_000, reconcileMs: 86_400_000,
135
+ };
136
+
137
+ const opened = openSourceSyncCycle({
138
+ cycleId: 'cycle-1', generation: 3, mode: 'incremental', cutoff: Date.now(), fromCursor: 'cursor-41',
139
+ });
140
+ const { checkpoint, enqueueIds } = advanceSourceSyncPage(opened, {
141
+ kind: 'history', ids: ['item-a', 'item-b'], nextPageToken: null, cursor: 'cursor-42',
142
+ }, policy);
143
+ // Store `checkpoint` and queue `enqueueIds` as pending work in one transaction, then read each item.
144
+
145
+ const summary: SourceSyncWorkSummary = {
146
+ cycleId: checkpoint.cycleId, generation: checkpoint.generation, checkpointRevision: checkpoint.revision,
147
+ total: 2, pending: 0, retry: 0, applied: 1, gone: 1, skipped: 0,
148
+ };
149
+ committableSourceCursor(checkpoint, summary); // 'cursor-42'
150
+ ```
151
+
152
+ A connector that can page through an account adds the optional `sync` capability, an `AccountSourceSyncProvider`, and becomes a `ResumableAccountSourceConnector`. The four original methods keep their signatures, and an empty selection is not redefined as the whole account. The provider's calls take a `SourceSyncRequest` (scope, generation, cycle id, cutoff, policy and an optional signal) and commit nothing: `begin` answers the anchor a cycle starts from, `scanPage` a page of candidate ids, `historyPage` the ids changed since an anchor with the cursor the page reached, and `readSource` one item as a `document`, `gone`, `skipped` or `retry` result. Cursors and page tokens are opaque strings; no rule does arithmetic on them or orders them.
153
+
154
+ A `SourceSyncDocument` holds a `SourceRead` with text, its message spans as UTF-16 offsets into that text, JSON metadata, an activity time, a content hash and the `cache` decision `decideSourceCache` answered for the read. A `SourceSyncWork` row holds ids, revisions, attempts and a disposition, never content. A `SourceSyncEvent` carries a fixed state, a count and an optional duration, never a scope or a provider payload.
155
+
156
+ ### Connection state
157
+
158
+ `createSourceSyncState(scope, now)` starts a connection in `not_connected` at generation 0. `transitionSourceSync(state, event, now)` answers the next frozen state. It throws `invalid_source_transition` for an event the state does not allow and `source_sync_counter_exhausted` when a counter would pass the safe-integer range.
159
+
160
+ | State | Meaning |
161
+ |---|---|
162
+ | `not_connected` | No grant yet |
163
+ | `connecting` | Authorization in progress |
164
+ | `syncing` | A sync is running |
165
+ | `connected` | Grant held, no sync running |
166
+ | `needs_reconnecting` | The grant was refused or lacks a scope; the cursor and use switches are cleared |
167
+ | `disconnected` | The connection ended; the cursor and use switches are cleared |
168
+
169
+ Pause is the `paused` flag on a connected or syncing connection, not a state: it stops syncs and keeps the cursor. Connecting, grant loss, disconnecting, pause, resume, a policy change and a use change each raise `generation`, so a store can refuse work started under an earlier one. A policy change also clears the cursor, so the next cycle applies the new bounds from a fresh pass. Connecting, pause, resume, a policy change, grant loss and disconnecting set `revalidationRequired`; a successful sync clears it. Disconnecting a disconnected connection, pausing a paused one and resuming an unpaused one answer the same state.
170
+
171
+ `sourceSyncDue(state, policy, now, trigger)` is false unless the connection is connected or syncing, unpaused and at or after any `retryAt`. A `'scheduled'` trigger is then due once `nextSyncAt` is reached; a `'manual'` one when no request was made yet or `manualMinIntervalMs` has passed since the last. A deferred sync keeps the cursor and sets `retryAt`. A `domain_policy` or `invalid_response` failure clears `nextSyncAt`, so no scheduled sync is due until a manual request or another control change sets it.
172
+
173
+ ### Cycles and the cursor
174
+
175
+ `openSourceSyncCycle(input)` opens a checkpoint at revision 0 and throws `invalid_source_sync_checkpoint` for an empty or oversized id or anchor, a generation or cutoff that is not a nonnegative safe integer, or an unknown mode. An `incremental` cycle starts with history from the committed cursor; `bootstrap`, `reconcile` and `recovery` start with a scan, from an anchor read before it. `advanceSourceSyncPage(checkpoint, page, policy)` answers the next checkpoint and the ids to queue, without duplicates:
176
+
177
+ - A scan that reaches `maxScanPages` pages or `maxCandidates` ids with more left keeps the first ids in the order given, marks the checkpoint `bounded` and stops. A finished scan moves the cycle to history from the same anchor.
178
+ - A history page records its cursor as the target. The last page, with no next page token, moves the cycle to `apply`.
179
+ - A page of the wrong kind for the phase, a scan page past the bounds or larger than `scanPageSize`, an empty or oversized id, cursor or page token, or a page whose next token is the token it was read with throws `invalid_source_sync_page`.
180
+
181
+ `committableSourceCursor(checkpoint, summary)` answers the target cursor only in `apply` with no page token left, when the summary names the checkpoint's cycle, generation and revision, holds no pending or retry work, and its applied, gone and skipped counts add up to its total. Otherwise it answers null. `isTerminalSourceWork` is true for applied, gone and skipped work.
182
+
183
+ The rules are pure and take no lock: the store that commits a cursor reads the summary from all of the cycle's work under its lease and checkpoint lock, in the transaction that commits it. A page carries no gone list: only a read of the item, an exclusion, expiry or the end of the connection removes content.
184
+
185
+ `new SourceSyncFault(code, retryAt?)` carries a fixed failure code as its message (`source_sync_<code>`), never a provider's text, exposes `code` and `retryAt`, and throws `invalid_source_sync_fault` for an unknown code or a `retryAt` that is not a nonnegative safe integer. `assertSourceSyncPolicy(policy)` throws `invalid_source_sync_policy` unless every policy value is a positive safe integer.
186
+
187
+ ### The SQL store
188
+
189
+ ```ts
190
+ import { createPostgresAdapter } from '@framers/sql-storage-adapter';
191
+ import { sourceDerivationSchema } from '@framers/agentos/cognition/library';
192
+ import { SqlAccountSourceSyncStore, sourceSyncSchema } from '@framers/agentos-ext-account-sources';
193
+
194
+ const db = createPostgresAdapter({ connectionString: process.env.DATABASE_URL! });
195
+ await db.open();
196
+ // The host's migration runs the DDL; the store never does.
197
+ for (const sql of [...sourceDerivationSchema(), ...sourceSyncSchema()]) await db.exec(sql);
198
+
199
+ const store = new SqlAccountSourceSyncStore<PreparedPassages>(db, { bindings });
200
+ const scope = { tenantId: 'tenant-1', ownerId: 'owner-1', connectionId: 'connection-1' };
201
+ await store.create(scope, policy);
202
+ await store.control(scope, { type: 'connect_started' });
203
+ await store.control(scope, { type: 'grant_ready', use: { searchAskEnabled: true, liveEnabled: false } });
204
+ const handle = await store.claim(scope, 'scheduled'); // null unless the connection is due and free
205
+ ```
206
+
207
+ `SqlAccountSourceSyncStore` keeps each connection's state, policy, open checkpoint, lease and barrier, the cycle's work rows, the provenance of retained sources and the connection's exclusions in the tables `sourceSyncSchema(prefix)` creates: six statements, with a prefix of a lower-case letter and at most 31 lower-case letters, digits or underscores (`agentos_source_sync` unless given). It needs a PostgreSQL adapter with transactions and runs no DDL. Its `fence` is the core `SqlSourceDerivationStore` on the same adapter, over the tables of `sourceDerivationSchema(derivationPrefix)`: every change to an owner's sources runs under that owner's fence, the one that also commits and delivers results derived from them.
208
+
209
+ The host supplies seven bindings. The store calls each inside its own transaction, on the transaction adapter it passes:
210
+
211
+ | Binding | What it does |
212
+ |---|---|
213
+ | `active(tx, owner)` | Answers false for an account that is deleted or being deleted, whose admission is off or whose purge is pending; the store then claims, commits and reactivates nothing for it and answers no source state |
214
+ | `allowance(tx, scope)` | Answers the connection's document and held-character ceilings after unrelated sources, and the remaining indexing balance |
215
+ | `write(tx, scope, dependency, document, prepared)` | Writes the document's text and the host's prepared passages and vectors |
216
+ | `chargeIndexed(tx, scope, characters)` | Charges committed characters to the indexing allowance |
217
+ | `purge(tx, owner, affected)` | Deletes the host's text, passages and vectors in the affected scope |
218
+ | `purgeResults(tx, owner, ids)` | Deletes the host's rows for these derived results |
219
+ | `rebind(tx, scope, generation)` | Moves the connection's host rows to a new generation without changing their content, version or expiry |
220
+
221
+ Provider reads, embedding and model calls run between store calls, never inside a binding.
222
+
223
+ A sync holds a lease. `claim(scope, trigger)` answers a handle only when the owner is active, the `active` binding agrees, no barrier or live lease is set and `sourceSyncDue` holds; `renew(handle)` extends the lease by `leaseMs`; `release(handle, event?)` gives it up, records a deferral or a fixed failure when one is given, and keeps the checkpoint and work for the next claim. `openCycle` opens a checkpoint or answers the one already open, `page` records a page and queues its ids in one transaction (the same page sent again right after answers the same checkpoint; any other stale revision answers null), and `takeWork` marks the next due item attempted before the read. Every call made with a handle checks the owner fence, the lease token and expiry, the generation and the `active` binding in the same transaction, and answers null once any of them has moved on.
224
+
225
+ `applyResult(handle, work, result, prepared)` keeps a `retry` result unresolved. Any other result first removes the source's previous copy and every derived result that depends on it, through the fence. A `document` result then replaces it in the same transaction (host write, indexing charge and provenance) when the source is not excluded and fits: the store ranks this connection's retained sources and the new one by activity time, newest first with ties broken by source id, keeps those inside `maxRetainedDocuments`, `maxHeldCharacters` and the allowance, and removes this connection's other sources, never another connection's. A document that does not fit is recorded as skipped with `document_limit`, `held_limit` or `indexing_limit`, and an excluded one with `excluded`. A failing binding rolls the whole application back. The answer carries a new handle, because each removal advances the owner's fence; later calls use it. `finish` commits the cycle's target cursor once every work item is terminal, counting from the stored work, and `progress` records the counts so far.
226
+
227
+ Controls run with the owner blocked. `control(scope, event, policy?)` applies `connect_started`, `grant_ready`, `pause`, `resume`, `use_changed`, `policy_changed` (with the new policy), `grant_lost` or `disconnect`: it records a content-free barrier and drops the open cycle in one transaction, then completes the barrier and reactivates the owner. Connecting, grant loss and disconnecting remove the connection's sources, their derived results and its exclusions. Pause, resume, a use change and a policy change move retained content to the new generation with its version kept and its expiry never extended, so no result derived before the change can be delivered again; a policy change also removes the sources the new limits leave out and shortens the expiry of the rest to the new window. `exclude(scope, sourceId)` removes one source and keeps a content-free exclusion; `resetExclusions(scope)` clears them. Both raise the generation and clear the cursor. A control other than disconnecting throws `stale_source_sync` while the `active` binding refuses the owner. A barrier left by a failure blocks claims and reactivation until `recoverControl(scope)` completes it, and a lifecycle worker calls it even for a paused connection. `expire(scope, limit)` removes retained sources whose expiry has passed, also while the connection is paused, then the owner's expired derived results; reads refuse an expired source either way.
228
+
229
+ `readCurrent(tx, derivation)` answers the current state of a derivation's sources for the fence's commit and delivery checks, and a connection with a barrier or pending revalidation reads as disconnected. `snapshot(scope)` answers metadata for authenticated controls and `documents(scope)` the retained provenance; neither authorizes delivery. Work rows and barriers hold ids and fixed values only. The documents table holds provenance, message timing and counts, never text; treat it, like the host's own tables, as restricted data for retention and backups.
230
+
122
231
  ## License
123
232
 
124
233
  Apache-2.0. This pack carries a copy of the repository's license.
@@ -1 +1 @@
1
- {"version":3,"file":"cachePolicy.d.ts","sourceRoot":"","sources":["../src/cachePolicy.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,wFAAwF;AACxF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;CACtC;AAED,iFAAiF;AACjF,MAAM,MAAM,qBAAqB,GAC7B,eAAe,GAAG,UAAU,GAAG,uBAAuB,GACtD,sBAAsB,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAE1D,uFAAuF;AACvF,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,IAAI,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SAAS,CAAC;AAE1D,uFAAuF;AACvF,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACnF;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,CAAC;AAgEtE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,mBAAmB,CAiD9E"}
@@ -15,13 +15,47 @@ function date(value) {
15
15
  const parsed = Date.parse(value);
16
16
  return integer(parsed) && new Date(parsed).toUTCString() === value ? parsed : null;
17
17
  }
18
- /** Cache-Control directives by lower-case name; a malformed or repeated directive answers null. */
18
+ /**
19
+ * Splits a list field value on commas outside quoted strings (RFC 9110, sections 5.6.1.2 and
20
+ * 5.6.4). A quoted string left open answers null.
21
+ */
22
+ function listMembers(value) {
23
+ const members = [];
24
+ let quoted = false;
25
+ let from = 0;
26
+ for (let index = 0; index < value.length; index += 1) {
27
+ const character = value[index];
28
+ if (quoted && character === '\\') {
29
+ // A quoted-pair: the escaped character neither closes the string nor splits the list.
30
+ index += 1;
31
+ }
32
+ else if (character === '"') {
33
+ quoted = !quoted;
34
+ }
35
+ else if (character === ',' && !quoted) {
36
+ members.push(value.slice(from, index));
37
+ from = index + 1;
38
+ }
39
+ }
40
+ if (quoted)
41
+ return null;
42
+ members.push(value.slice(from));
43
+ return members;
44
+ }
45
+ /**
46
+ * Cache-Control directives by lower-case name. A quoted value may hold commas; a backslash in it
47
+ * escapes the next character and stays in the value. A malformed or repeated directive, or a
48
+ * quoted value left open, answers null.
49
+ */
19
50
  function directives(value) {
20
51
  const found = new Map();
21
52
  if (value === null || value.trim() === '')
22
53
  return found;
23
- for (const part of value.split(',')) {
24
- const match = /^([a-z][a-z0-9-]*)(?:\s*=\s*(?:"([^"]*)"|([^\s",]+)))?$/i.exec(part.trim());
54
+ const members = listMembers(value);
55
+ if (members === null)
56
+ return null;
57
+ for (const part of members) {
58
+ const match = /^([a-z][a-z0-9-]*)(?:\s*=\s*(?:"((?:[^"\\]|\\[\s\S])*)"|([^\s",]+)))?$/i.exec(part.trim());
25
59
  const name = match?.[1]?.toLowerCase();
26
60
  if (!match || !name || found.has(name))
27
61
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"cachePolicy.js","sourceRoot":"","sources":["../src/cachePolicy.ts"],"names":[],"mappings":"AAkCA,MAAM,OAAO,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtF,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;AACzE,MAAM,IAAI,GAAG,CAAC,MAA6B,EAAuB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAEhG,iGAAiG;AACjG,SAAS,YAAY,CAAC,KAAa;IACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACxC,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC;AAED,gHAAgH;AAChH,SAAS,IAAI,CAAC,KAAoB;IAChC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,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sB,CAAC,CAAC;QAC/E,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,GAAG,QAAQ,GAAG,YAAY,CAAC;QAC9D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC3E,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,eAAe,GAAG,CAAC,YAAY,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QACzE,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,GAAG,QAAQ,GAAG,YAAY,CAAC;QAC9D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC3E,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IAC/D,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACpE,IAAI,SAAS,IAAI,KAAK,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,UAAU,EAAE,CAAC;AACzE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -8,4 +8,10 @@ export * from './readCapped.js';
8
8
  export * from './limiter.js';
9
9
  /** Explicit retention permission and conservative source-cache expiry. */
10
10
  export * from './cachePolicy.js';
11
+ /** Durable synchronization contracts and pure state/checkpoint rules. */
12
+ export * from './sync/types.js';
13
+ export * from './sync/state.js';
14
+ /** The migration-owned schema and the SQL store that persists synchronization under the owner fence. */
15
+ export { sourceSyncSchema } from './sync/schema.js';
16
+ export { SqlAccountSourceSyncStore, type SourceSyncStoredDocument, type SourceSyncAllowance, type SourceSyncStorageBindings, type SourceSyncStoreOptions, type SourceSyncHandle, type SourceSyncSnapshot, type SourceSyncControl, type SourceSyncApplication, type SourceSyncBarrier, } from './sync/SqlAccountSourceSyncStore.js';
11
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,cAAc,YAAY,CAAC;AAC3B,yDAAyD;AACzD,cAAc,gBAAgB,CAAC;AAC/B,8DAA8D;AAC9D,cAAc,iBAAiB,CAAC;AAChC,oEAAoE;AACpE,cAAc,cAAc,CAAC;AAC7B,0EAA0E;AAC1E,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,cAAc,YAAY,CAAC;AAC3B,yDAAyD;AACzD,cAAc,gBAAgB,CAAC;AAC/B,8DAA8D;AAC9D,cAAc,iBAAiB,CAAC;AAChC,oEAAoE;AACpE,cAAc,cAAc,CAAC;AAC7B,0EAA0E;AAC1E,cAAc,kBAAkB,CAAC;AACjC,yEAAyE;AACzE,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,wGAAwG;AACxG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,yBAAyB,EACzB,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EAAE,KAAK,yBAAyB,EACvF,KAAK,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAC3E,KAAK,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,GAC3E,MAAM,qCAAqC,CAAC"}
package/dist/index.js CHANGED
@@ -8,4 +8,10 @@ export * from './readCapped.js';
8
8
  export * from './limiter.js';
9
9
  /** Explicit retention permission and conservative source-cache expiry. */
10
10
  export * from './cachePolicy.js';
11
+ /** Durable synchronization contracts and pure state/checkpoint rules. */
12
+ export * from './sync/types.js';
13
+ export * from './sync/state.js';
14
+ /** The migration-owned schema and the SQL store that persists synchronization under the owner fence. */
15
+ export { sourceSyncSchema } from './sync/schema.js';
16
+ export { SqlAccountSourceSyncStore, } from './sync/SqlAccountSourceSyncStore.js';
11
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,cAAc,YAAY,CAAC;AAC3B,yDAAyD;AACzD,cAAc,gBAAgB,CAAC;AAC/B,8DAA8D;AAC9D,cAAc,iBAAiB,CAAC;AAChC,oEAAoE;AACpE,cAAc,cAAc,CAAC;AAC7B,0EAA0E;AAC1E,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,cAAc,YAAY,CAAC;AAC3B,yDAAyD;AACzD,cAAc,gBAAgB,CAAC;AAC/B,8DAA8D;AAC9D,cAAc,iBAAiB,CAAC;AAChC,oEAAoE;AACpE,cAAc,cAAc,CAAC;AAC7B,0EAA0E;AAC1E,cAAc,kBAAkB,CAAC;AACjC,yEAAyE;AACzE,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,wGAAwG;AACxG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,yBAAyB,GAI1B,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,285 @@
1
+ /**
2
+ * @fileoverview The durable source synchronization store on PostgreSQL through `@framers/sql-storage-adapter`:
3
+ * connection state, leases, checkpoints, work rows and the provenance of retained documents, with every change to
4
+ * an owner's content made under that owner's fence from the core derivation store.
5
+ * @module account-sources/sync/SqlAccountSourceSyncStore
6
+ */
7
+ import type { StorageAdapter } from '@framers/sql-storage-adapter';
8
+ import { SqlSourceDerivationStore, type SourceDependency, type SourceDependencyState, type SourceDerivation, type SourceOwnerScope, type SourceInvalidation, type SourceFenceTicket } from '@framers/agentos/cognition/library';
9
+ import type { SourceSyncScope, SourceSyncState, SourceSyncPolicy, SourceSyncLease, SourceSyncTrigger, SourceSyncCheckpoint, SourceSyncCycleInput, SourceSyncPage, SourceSyncWork, SourceSyncDocument, SourceSyncMessageSpan, SourceSyncReadResult, SourceSyncWorkDisposition, SourceSyncTransition } from './types.js';
10
+ /**
11
+ * The provenance kept for one retained source: its dependency, message spans, activity time, character count and
12
+ * content hash, never its text.
13
+ */
14
+ export interface SourceSyncStoredDocument {
15
+ readonly dependency: SourceDependency;
16
+ readonly messages: readonly SourceSyncMessageSpan[];
17
+ readonly activityAt: number;
18
+ readonly characters: number;
19
+ readonly contentHash: string;
20
+ }
21
+ /** The host's limits for one connection, read under the owner fence in the transaction that uses them. */
22
+ export interface SourceSyncAllowance {
23
+ readonly maximumConnectionDocuments: number;
24
+ readonly maximumConnectionHeldCharacters: number;
25
+ readonly additionalIndexedCharacters: number;
26
+ }
27
+ /**
28
+ * The host's table bindings. The store calls each one inside the owner fence, on the transaction adapter it is given
29
+ * and only there; a binding never calls a provider, embeds, generates, delivers over the network or refreshes a grant.
30
+ *
31
+ * @typeParam Prepared - The host's in-memory value for one document, such as its computed passages and vectors.
32
+ */
33
+ export interface SourceSyncStorageBindings<Prepared> {
34
+ /**
35
+ * False for an account that is deleted or being deleted, disabled admission or a pending host purge: the store then
36
+ * claims, commits and reactivates nothing for the owner and answers no source state.
37
+ */
38
+ active(tx: StorageAdapter, scope: SourceOwnerScope): Promise<boolean>;
39
+ /** Absolute ceilings for this connection after subtracting unrelated sources; indexing is the remaining period balance. All writers take the owner fence first. */
40
+ allowance(tx: StorageAdapter, scope: SourceSyncScope): Promise<SourceSyncAllowance>;
41
+ /** Writes the document's content and the prepared value under this dependency, on the given transaction. */
42
+ write(tx: StorageAdapter, scope: SourceSyncScope, dependency: SourceDependency, document: SourceSyncDocument, prepared: Prepared): Promise<void>;
43
+ /** Charges committed sanitized characters to the owner's indexing allowance. */
44
+ chargeIndexed(tx: StorageAdapter, scope: SourceSyncScope, characters: number): Promise<void>;
45
+ /** Removes the host's source content in the affected scope: text, passages and vectors. */
46
+ purge(tx: StorageAdapter, scope: SourceOwnerScope, affected: SourceInvalidation): Promise<void>;
47
+ /** Removes every host row stored for these derived result ids, whole. */
48
+ purgeResults(tx: StorageAdapter, scope: SourceOwnerScope, ids: readonly string[]): Promise<void>;
49
+ /** Moves this connection's host rows to a new generation without changing their content, version or expiry. */
50
+ rebind(tx: StorageAdapter, scope: SourceSyncScope, generation: number): Promise<void>;
51
+ }
52
+ /** The store's table prefixes, clock and host bindings. */
53
+ export interface SourceSyncStoreOptions<Prepared> {
54
+ /** Prefix of the synchronization tables, the one given to `sourceSyncSchema`; `agentos_source_sync` unless given. */
55
+ readonly tablePrefix?: string;
56
+ /** Prefix of the core derivation store's tables, the one given to `sourceDerivationSchema`; core's default unless given. */
57
+ readonly derivationPrefix?: string;
58
+ /** Current time as integer UTC epoch milliseconds; `Date.now` unless given. */
59
+ readonly clock?: () => number;
60
+ /** The host's table bindings. */
61
+ readonly bindings: SourceSyncStorageBindings<Prepared>;
62
+ }
63
+ /**
64
+ * A claimed lease with the owner fence ticket it was claimed under. A source change advances the owner's fence, so
65
+ * `applyResult` answers a handle with the new ticket: later calls use that handle.
66
+ */
67
+ export interface SourceSyncHandle {
68
+ readonly ticket: SourceFenceTicket;
69
+ readonly lease: SourceSyncLease;
70
+ }
71
+ /**
72
+ * The transitions a host control applies: connecting, a ready or lost grant, pause, resume, a use or policy change,
73
+ * and disconnecting.
74
+ */
75
+ export type SourceSyncControl = Extract<SourceSyncTransition, {
76
+ type: 'connect_started' | 'grant_ready' | 'pause' | 'resume' | 'use_changed' | 'policy_changed' | 'grant_lost' | 'disconnect';
77
+ }>;
78
+ /**
79
+ * A control's durable, content-free record of the work it still owes: purging the connection, pruning it to its
80
+ * limits, excluding one source, or completing a rebind or a reset. No claim succeeds and the owner is not reactivated
81
+ * while one is set; `recoverControl` completes it.
82
+ */
83
+ export interface SourceSyncBarrier {
84
+ readonly token: string;
85
+ readonly action: 'rebind' | 'purge' | 'prune' | 'exclude' | 'reset';
86
+ readonly sourceId: string | null;
87
+ }
88
+ /**
89
+ * A connection's metadata for authenticated host controls: state, policy, open checkpoint, barrier and last
90
+ * reconciliation time.
91
+ */
92
+ export interface SourceSyncSnapshot {
93
+ readonly state: SourceSyncState;
94
+ readonly policy: SourceSyncPolicy;
95
+ readonly checkpoint: SourceSyncCheckpoint | null;
96
+ readonly barrier: SourceSyncBarrier | null;
97
+ readonly lastReconcileAt: number | null;
98
+ }
99
+ /** What applying one read result answers: the handle to use next and the work's disposition. */
100
+ export interface SourceSyncApplication {
101
+ readonly handle: SourceSyncHandle;
102
+ readonly disposition: SourceSyncWorkDisposition;
103
+ }
104
+ /**
105
+ * Durable synchronization state for account sources on PostgreSQL. Every change to an owner's content runs under
106
+ * that owner's fence (`fence`), and a change made with a handle checks its lease, generation and host liveness in
107
+ * the same transaction. Applying a source purges its old copy and every derived result that depends on it before the
108
+ * replacement is written. Provider reads, embedding and model calls stay outside the store. The constructor runs no
109
+ * DDL: the host's migration runs `sourceSyncSchema` and core's `sourceDerivationSchema` first.
110
+ *
111
+ * @typeParam Prepared - The host's in-memory value for one document, passed through to its `write` binding.
112
+ */
113
+ export declare class SqlAccountSourceSyncStore<Prepared = unknown> {
114
+ private readonly db;
115
+ private readonly options;
116
+ private readonly t;
117
+ private readonly clock;
118
+ /**
119
+ * The owner fence. The same instance commits and delivers derived results and fences account deletion. Host code
120
+ * never activates an owner through it with a callback that answers true unconditionally.
121
+ */
122
+ readonly fence: SqlSourceDerivationStore;
123
+ /**
124
+ * @param db - A PostgreSQL adapter with transactions.
125
+ * @param options - Table prefixes, clock and the host's bindings.
126
+ * @throws {Error} `source_sync_requires_postgres` for another kind of adapter or one without transactions, and
127
+ * `invalid_source_sync_prefix` or core's `invalid_derivation_table_prefix` for a malformed prefix.
128
+ */
129
+ constructor(db: StorageAdapter, options: SourceSyncStoreOptions<Prepared>);
130
+ private now;
131
+ private fenceOn;
132
+ private row;
133
+ private save;
134
+ private clearCycle;
135
+ private activate;
136
+ /**
137
+ * Creates the connection in `not_connected` and activates its owner when the host's `active` binding allows it and
138
+ * no barrier of the owner is pending; otherwise nothing changes. An existing connection is kept as it is.
139
+ *
140
+ * @throws {Error} `invalid_source_sync_policy` for an invalid policy and `invalid_source_sync_state` for an
141
+ * invalid scope.
142
+ */
143
+ create(scope: SourceSyncScope, policy: SourceSyncPolicy): Promise<void>;
144
+ /** Metadata for authenticated host controls only; no content-delivery authorization. */
145
+ snapshot(scope: SourceSyncScope): Promise<SourceSyncSnapshot | null>;
146
+ /** Operator scheduler only. The claim performs fresh host and owner checks. */
147
+ scopes(after?: SourceSyncScope | null, limit?: number): Promise<readonly SourceSyncScope[]>;
148
+ /**
149
+ * Connections whose next sync time has come, with no barrier and no live lease, earliest first.
150
+ *
151
+ * @param limit - At most this many, an integer from 1 to 1,000.
152
+ * @throws {Error} `invalid_sync_batch` for another limit.
153
+ */
154
+ due(limit?: number): Promise<readonly SourceSyncScope[]>;
155
+ /**
156
+ * Claims the connection's lease for one sync. The owner must be active, the host's `active` binding must allow it,
157
+ * no barrier or live lease may be set and the connection must be due for `trigger`; a manual claim records the
158
+ * request.
159
+ *
160
+ * @returns The handle, or null.
161
+ */
162
+ claim(scope: SourceSyncScope, trigger: SourceSyncTrigger): Promise<SourceSyncHandle | null>;
163
+ private checked;
164
+ private withHandle;
165
+ /**
166
+ * Extends a live lease by the policy's `leaseMs`.
167
+ *
168
+ * @returns The renewed handle, or null when the lease, its generation or the owner fence has moved on.
169
+ */
170
+ renew(h: SourceSyncHandle): Promise<SourceSyncHandle | null>;
171
+ /**
172
+ * Opens a cycle's durable checkpoint and drops the previous cycle's work, or answers the checkpoint already open.
173
+ * An incremental cycle starts from the committed cursor. With `replaceExpiredHistory`, a `recovery` cycle replaces
174
+ * the open one. The cutoff defaults to the connection's last change.
175
+ *
176
+ * @returns The checkpoint, or null for a stale handle or an incremental cycle from another cursor.
177
+ * @throws {SourceSyncFault} `invalid_response` for a cutoff in the future or a replacement that is not `recovery`.
178
+ */
179
+ openCycle(h: SourceSyncHandle, input: Pick<SourceSyncCycleInput, 'mode' | 'fromCursor'> & {
180
+ readonly cutoff?: number;
181
+ readonly cycleId?: string;
182
+ }, replaceExpiredHistory?: boolean): Promise<SourceSyncCheckpoint | null>;
183
+ /**
184
+ * Records one page: the next checkpoint and its queued work, in one transaction. The same page sent again right
185
+ * after it was recorded answers the same checkpoint; any other stale revision answers null.
186
+ *
187
+ * @throws {SourceSyncFault} `invalid_response` for an id longer than 512 characters, and the page rules'
188
+ * `invalid_source_sync_page` for a page the checkpoint does not admit.
189
+ */
190
+ page(h: SourceSyncHandle, expected: SourceSyncCheckpoint, page: SourceSyncPage): Promise<SourceSyncCheckpoint | null>;
191
+ private putWork;
192
+ /** Null id takes the first due item. Increment before external work; a crash leaves it pending. */
193
+ takeWork(h: SourceSyncHandle, id?: string | null): Promise<SourceSyncWork | null>;
194
+ private currentWork;
195
+ private normalized;
196
+ private documentRows;
197
+ /** Internal provenance enumeration. Never expose this as a browser retrieval response. */
198
+ documents(scope: SourceSyncScope): Promise<readonly SourceSyncStoredDocument[]>;
199
+ /** Whether the connection holds an exclusion for this source id. */
200
+ isExcluded(scope: SourceSyncScope, id: string): Promise<boolean>;
201
+ private choose;
202
+ /**
203
+ * Applies one read result for a work item taken in this cycle, under a live lease and the owner fence. A retry
204
+ * keeps the work unresolved. Any other result first purges the source's old copy and every result derived from it;
205
+ * a document then replaces it in the same transaction (host write, indexing charge and provenance) when it is not
206
+ * excluded and fits the retained and indexing limits, evicting this connection's older sources the limits no
207
+ * longer admit. A document that is excluded or does not fit is recorded as a skip with its reason.
208
+ *
209
+ * @param prepared - The host's prepared value for a document result; null for any other result.
210
+ * @returns The disposition and the handle later calls use, whose ticket reflects the purge; null for a stale
211
+ * handle or work item.
212
+ * @throws {SourceSyncFault} `invalid_response` for a result that does not match its work item or is malformed.
213
+ * @throws {Error} `invalid_source_allowance` when the host's allowance is not made of nonnegative safe integers.
214
+ */
215
+ applyResult(h: SourceSyncHandle, work: SourceSyncWork, result: SourceSyncReadResult, prepared: Prepared | null): Promise<SourceSyncApplication | null>;
216
+ private summary;
217
+ /**
218
+ * Records the cycle's progress, counted from its stored work and the retained documents.
219
+ *
220
+ * @returns The state, or null for a stale handle.
221
+ */
222
+ progress(h: SourceSyncHandle): Promise<SourceSyncState | null>;
223
+ /**
224
+ * Commits the cycle's target cursor once every work item is terminal, counting from the stored work and never from
225
+ * a caller's numbers, then clears the cycle, releases the lease and schedules the next poll.
226
+ *
227
+ * @returns The connected state, or null while work is unresolved or for a stale handle.
228
+ */
229
+ finish(h: SourceSyncHandle, expected: SourceSyncCheckpoint): Promise<SourceSyncState | null>;
230
+ /**
231
+ * Releases the lease, recording a deferral or a fixed failure when one is given; the cycle's checkpoint and work
232
+ * stay for the next claim.
233
+ *
234
+ * @returns Whether the lease was released.
235
+ */
236
+ release(h: SourceSyncHandle, event?: Extract<SourceSyncTransition, {
237
+ type: 'sync_deferred' | 'sync_failed';
238
+ }> | null): Promise<boolean>;
239
+ /**
240
+ * The current state of each of the derivation's retained sources, read in the given transaction for the fence's
241
+ * commit and delivery checks; not an authorization answer of its own. An owner the host's `active` binding refuses
242
+ * has no sources, and a connection with a barrier or pending revalidation reads as disconnected.
243
+ */
244
+ readCurrent(tx: StorageAdapter, derivation: SourceDerivation): Promise<readonly SourceDependencyState[]>;
245
+ /** Removes the host's content and this store's provenance in the affected scope; the fence calls it inside an invalidation. */
246
+ purgeSources(tx: StorageAdapter, scope: SourceOwnerScope, affected: SourceInvalidation): Promise<void>;
247
+ /**
248
+ * Applies a host control: completes any earlier barrier, then blocks the owner, moves the connection, records a
249
+ * barrier and drops the open cycle in one transaction, and completes the barrier before reactivating the owner.
250
+ * Connecting, grant loss and disconnecting purge the connection and its exclusions; a policy change, which takes
251
+ * the new policy, prunes retained sources to it and shortens their expiry to its window; the other controls rebind
252
+ * content to the new generation without changing its version or expiry.
253
+ *
254
+ * @returns The snapshot after the barrier is complete.
255
+ * @throws {Error} `source_policy_control_required` unless a policy comes exactly with `policy_changed`, and
256
+ * `stale_source_sync` when the host's `active` binding refuses anything but disconnecting or a barrier is still set.
257
+ */
258
+ control(scope: SourceSyncScope, event: SourceSyncControl, policy?: SourceSyncPolicy): Promise<SourceSyncSnapshot | null>;
259
+ private rebind;
260
+ /** Called by the lifecycle worker even when a connection is paused or the owner is blocked. */
261
+ recoverControl(scope: SourceSyncScope): Promise<void>;
262
+ /**
263
+ * Removes one source and every result derived from it, and keeps a content-free exclusion so later syncs skip it.
264
+ * The connection moves to a new generation, its cursor is cleared and its open cycle is dropped.
265
+ *
266
+ * @throws {SourceSyncFault} `invalid_response` for an empty id or one longer than 512 characters.
267
+ */
268
+ exclude(scope: SourceSyncScope, sourceId: string): Promise<void>;
269
+ /**
270
+ * Clears the connection's exclusions. The connection moves to a new generation, its cursor is cleared and its open
271
+ * cycle is dropped.
272
+ */
273
+ resetExclusions(scope: SourceSyncScope): Promise<void>;
274
+ /**
275
+ * Removes retained sources whose expiry has passed, with every result derived from them, also while the connection
276
+ * is paused, then expires the owner's derived results. Sources are removed only while the owner's fence is active;
277
+ * reads refuse an expired source regardless.
278
+ *
279
+ * @param limit - At most this many sources, an integer from 1 to 1,000.
280
+ * @returns How many sources were removed.
281
+ * @throws {Error} `invalid_sync_batch` for another limit.
282
+ */
283
+ expire(scope: SourceSyncScope, limit?: number): Promise<number>;
284
+ }
285
+ //# sourceMappingURL=SqlAccountSourceSyncStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlAccountSourceSyncStore.d.ts","sourceRoot":"","sources":["../../src/sync/SqlAccountSourceSyncStore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,wBAAwB,EACxB,KAAK,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,KAAK,gBAAgB,EACxE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EACvE,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EACtF,oBAAoB,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAC1E,kBAAkB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,yBAAyB,EAC1F,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAOpB;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACpD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AACD,0GAA0G;AAC1G,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;IAC5C,QAAQ,CAAC,+BAA+B,EAAE,MAAM,CAAC;IACjD,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAC;CAC9C;AACD;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB,CAAC,QAAQ;IACjD;;;OAGG;IACH,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,KAA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