@framers/agentos-ext-account-sources 0.6.0 → 0.7.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,6 +1,6 @@
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, the contracts, pure rules, PostgreSQL store and coordinator of a durable, resumable synchronization, and weighted request quotas that every worker shares.
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, the contracts, pure rules, PostgreSQL store and coordinator of a durable, resumable synchronization, weighted request quotas that every worker shares, and the fenced purge and revocation recovery of a connection's grant.
4
4
 
5
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
 
@@ -15,7 +15,7 @@ An `AccountSourceConnector` exposes its `kind` and four operations:
15
15
 
16
16
  A selection holds account item ids. A read carries text or bytes with a media type, the item and its attribution. A gone item names its id and the reason: `removed`, `no_access` or `not_owned`.
17
17
 
18
- Connectors obtain their grants through AgentOS's auth module and store them through its sealed token store. This library holds no grants and performs no sealing.
18
+ Connectors obtain their grants through AgentOS's auth module and store them through its sealed token store. The connector interface holds no grant. The revocation lifecycle seals a stopped grant's refresh token into its revoke-only queue with the same module's sealing (see [Revocation and purge](#revocation-and-purge)).
19
19
 
20
20
  ## Attribution
21
21
 
@@ -172,7 +172,7 @@ Pause is the `paused` flag on a connected or syncing connection, not a state: it
172
172
 
173
173
  ### Cycles and the cursor
174
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, and their history then replays from the checkpoint's `fromCursor`: an anchor read before the scan for `bootstrap` and `recovery`, the committed cursor for `reconcile` (see [The coordinator](#the-coordinator)). `advanceSourceSyncPage(checkpoint, page, policy)` answers the next checkpoint and the ids to queue, without duplicates:
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, and their history then replays from the checkpoint's `fromCursor`: an anchor read before the scan for `bootstrap` and `recovery`, the committed cursor for `reconcile`, or its anchor when the provider answers that the history from that cursor has expired (see [The coordinator](#the-coordinator)). `advanceSourceSyncPage(checkpoint, page, policy)` answers the next checkpoint and the ids to queue, without duplicates:
176
176
 
177
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
178
  - A history page records its cursor as the target. The last page, with no next page token, moves the cycle to `apply`.
@@ -224,7 +224,7 @@ A sync holds a lease. `claim(scope, trigger)` answers a handle only when the own
224
224
 
225
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
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.
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 keep the committed cursor, and make a reconcile the next cycle: a fresh bounded scan, then history replayed from that cursor, so a change made since it reaches the store even for an item the scan does not list. 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
228
 
229
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
230
 
@@ -293,7 +293,7 @@ for (const sql of sourceSyncCoordinatorSchema()) await db.exec(sql);
293
293
 
294
294
  const sync = new AccountSourceSync<PreparedPassages>({
295
295
  store, // the SqlAccountSourceSyncStore above
296
- lifecycle, // the host's purge recovery and grant-loss handoff
296
+ lifecycle, // purge recovery and the grant-loss handoff: a SourceRevocations (below)
297
297
  // Builds the connector bound to this lease; it sends no request while building.
298
298
  provider: async (currentHandle) => connectorFor(scope, currentHandle).sync,
299
299
  // Embeds outside any transaction; the store commits the result with its document.
@@ -312,15 +312,15 @@ do after = (await sync.maintain(after, 100)).next; while (after !== null);
312
312
 
313
313
  The provider factory receives `currentHandle`, which answers the handle the run holds when it is called; the handle changes after each applied result. The factory builds a provider bound to the lease and sends no request. `prepare` turns a document into the host's prepared value, such as its passages and vectors, outside any transaction, and the store commits that value with the document. `lifecycle.recover(scope)` completes the host's committed purges; `lifecycle.loseGrant(handle, reason)` receives the run's exact handle, compares it atomically before it fences the grant, so a stale run cannot revoke a newer grant, and answers whether it acted. `runBudgetMs` (90,000 unless given, at most 90,000) bounds one run and `operationTimeoutMs` (30,000 unless given, at most 60,000) one provider call or preparation; another value throws `invalid_source_coordinator_policy`. `clock` and `random` (the retry jitter, from 0 to 1) default to `Date.now` and `Math.random`.
314
314
 
315
- `run(scope, trigger, signal?)` calls `lifecycle.recover` and the store's `recoverControl` for the scope, then claims the lease; a run that claims nothing answers `idle`. With no open cycle it opens one: `bootstrap` when no cursor is committed, `reconcile` once `reconcileMs` has passed since the last cycle that was not incremental, otherwise `incremental`. A bootstrap, a reconcile and a recovery call the provider's `begin` for an anchor before their scan. A bootstrap and a recovery replay history from that anchor. A reconcile replays it from the committed cursor: history ids only increase, so that replay also covers the changes made between the cursor and the anchor, and a change to an item the bounded scan does not list still reaches the store. An incremental cycle replays history from the committed cursor without a scan.
315
+ `run(scope, trigger, signal?)` calls `lifecycle.recover` and the store's `recoverControl` for the scope, then claims the lease; a run that claims nothing answers `idle`. With no open cycle it opens one: `bootstrap` when no cursor is committed, `reconcile` once `reconcileMs` has passed since the last cycle that was not incremental or after a change to the exclusions, otherwise `incremental`. A bootstrap, a reconcile and a recovery call the provider's `begin` for an anchor before their scan. A bootstrap and a recovery replay history from that anchor. A reconcile replays it from the committed cursor: history ids only increase, so that replay also covers the changes made between the cursor and the anchor, and a change to an item the bounded scan does not list still reaches the store. Before its scan, a reconcile asks the provider for the first history page from the committed cursor; when that answers `history_expired`, nothing before the anchor can be replayed, so the reconcile replays from its anchor instead, with one scan and one read pass. An incremental cycle replays history from the committed cursor without a scan.
316
316
 
317
317
  The run drains the queued reads before it asks for the next page. Each item is read, unless it is excluded, which records it as skipped; a document is prepared, `applyResult` commits it, and the run goes on with the handle the application answers. When no read is due, a read waiting for its retry time ends the run as `deferred` until then; otherwise the run records the next page, and once the last history page is recorded and every item is terminal, `finish` commits the cursor and the run answers `completed`. A run yields, keeping its checkpoint and reads for the next claim, after `maxChangedPerLease` reads, after `maxHistoryPagesPerLease` history pages, when `runBudgetMs` has passed or when `signal` aborts; a signal aborted before the run starts answers `yielded` at once. It never waits out a retry.
318
318
 
319
319
  Before each provider call and each preparation the run renews its lease, and the call gets a signal that aborts after `operationTimeoutMs`, at the end of the run budget or a second before the lease expires, whichever comes first. A provider call cut off by that signal counts as a `network` failure and a preparation as `storage_unavailable`; one cut off by the caller's signal yields. The store refuses a result that arrives after the lease, the generation or the owner's fence has moved on, as after a disconnect, and the run then answers `stale`. A failed request is never an empty page, and a bounded scan never proves that an item it did not list is gone.
320
320
 
321
- Attempts are counted before each call, so a process that dies during a call has used that attempt. The anchor read and each page are counted in the connection's `operation` column, under a SHA-256 digest that names the operation, so a new generation, cycle, revision or phase starts a new count; the column holds no page token, cursor or provider id. Each read is counted in its work row. A `network`, `rate_limited`, `provider_unavailable` or `storage_unavailable` failure records a wait of `sourceRetryAt`: one second doubled for each earlier attempt, with up to as much again as jitter and at most 60 seconds, or the provider's own retry time when that is later. The fifth attempt's wait is at least `pollMs`, and the attempt after it starts a new count of five; five attempts that recorded nothing also wait `pollMs`. The connection's next sync is then that wait, which neither a restart nor a manual request shortens.
321
+ Attempts are counted before each call, so a process that dies during a call has used that attempt. The anchor read and each page are counted in the connection's `operation` column, under a SHA-256 digest that names the operation, so a new generation, cycle, revision or phase starts a new count; the column holds no page token, cursor or provider id. A reconcile's look at the committed cursor's history shares the count of its anchor read, and a recovery's anchor read continues the count of the history page that answered `history_expired`, so the one column never alternates between two operations, and while a call keeps failing the count reaches five attempts and the `pollMs` wait. Each read is counted in its work row. A `network`, `rate_limited`, `provider_unavailable` or `storage_unavailable` failure records a wait of `sourceRetryAt`: one second doubled for each earlier attempt, with up to as much again as jitter and at most 60 seconds, or the provider's own retry time when that is later. The fifth attempt's wait is at least `pollMs`, and the attempt after it starts a new count of five; five attempts that recorded nothing also wait `pollMs`. The connection's next sync is then that wait, which neither a restart nor a manual request shortens.
322
322
 
323
- A `grant_rejected` or `insufficient_scope` failure goes to `lifecycle.loseGrant` with the run's handle, and the run answers `reconnect`, or `stale` when `loseGrant` answers false. A `domain_policy` or `invalid_response` failure releases the lease with that failure, which clears the next scheduled sync until a manual request or another control sets one, and the run answers `failed`. An unknown exception from the provider becomes `invalid_response`, and one from preparation or storage `storage_unavailable`; no exception text reaches a result or an event. Expired history (`history_expired`) opens a `recovery` cycle with a fresh anchor and a new bounded scan; a second expiry in the same run defers the sync as `provider_unavailable` for `pollMs`. Retained items the scan does not list stay until they expire.
323
+ A `grant_rejected` or `insufficient_scope` failure goes to `lifecycle.loseGrant` with the run's handle, and the run answers `reconnect`, or `stale` when `loseGrant` answers false. A `domain_policy` or `invalid_response` failure releases the lease with that failure, which clears the next scheduled sync until a manual request or another control sets one, and the run answers `failed`. An unknown exception from the provider becomes `invalid_response`, and one from preparation or storage `storage_unavailable`; no exception text reaches a result or an event. Expired history (`history_expired`) on a history page opens a `recovery` cycle with a fresh anchor and a new bounded scan; a second expiry in the same run defers the sync as `provider_unavailable` for `pollMs`. Retained items the scan does not list stay until they expire.
324
324
 
325
325
  | Result | When |
326
326
  |---|---|
@@ -337,7 +337,73 @@ A `grant_rejected` or `insufficient_scope` failure goes to `lifecycle.loseGrant`
337
337
 
338
338
  With an `events` sink the coordinator reports `started` at the claim, `progress` with the count of retained sources after each read, `yielded` and `retry` with the reads made, `succeeded` with the count of retained sources, `reconnect`, and `purged` with the sources a maintenance batch expired. Each event carries `kind`, `state` and `n`, and `yielded`, `retry`, `succeeded` and `reconnect` also the run's duration as `ms`. A sink that throws is ignored.
339
339
 
340
- The coordinator uses three store methods besides those above. `reserveOperation(handle, key)` counts an attempt at the anchor read or a page before it is sent, and answers `{ kind: 'attempt', attempt }`, or `{ kind: 'deferred', reason, retryAt }` while a recorded wait has not passed or after five attempts that recorded nothing. `deferOperation(handle, key, attempt, reason, retryAt)` records the wait after a retriable failure when that attempt is still the one reserved. `pendingRetry(handle)` answers the earliest wait among the cycle's reads.
340
+ The coordinator uses three store methods besides those above. `reserveOperation(handle, key)` counts an attempt at the anchor read, a reconcile's look at the committed cursor or a page before it is sent, and answers `{ kind: 'attempt', attempt }`, or `{ kind: 'deferred', reason, retryAt }` while a recorded wait has not passed or after five attempts that recorded nothing. `deferOperation(handle, key, attempt, reason, retryAt)` records the wait after a retriable failure when that attempt is still the one reserved. `pendingRetry(handle)` answers the earliest wait among the cycle's reads.
341
+
342
+ ### Revocation and purge
343
+
344
+ ```ts
345
+ import { SourceRevocations, sourceRevocationSchema } from '@framers/agentos-ext-account-sources';
346
+
347
+ // The host's migration, with the store's and the coordinator's schemas.
348
+ for (const sql of sourceRevocationSchema()) await db.exec(sql);
349
+
350
+ const revocations = new SourceRevocations<PreparedPassages>(db, {
351
+ store, // the SqlAccountSourceSyncStore above
352
+ keys, // SealingKeys: the current key seals, previous keys still open
353
+ values: (tx, scope) => grantRows(tx, scope), // the host's sealed-value rows, on the transaction given
354
+ revoker: (signal) => revocationFlow(signal), // a provider flow without a store; its fetch honors the signal
355
+ });
356
+ // It is the coordinator's lifecycle binding: new AccountSourceSync({ store, lifecycle: revocations, ... }).
357
+
358
+ // A disconnect from an authenticated request, at the generation that request saw.
359
+ const notice = await revocations.disconnect(scope, generation);
360
+ // null when the generation moved on; otherwise { localPending, revocation }
361
+
362
+ // An account-independent job, at least once a minute.
363
+ await revocations.revokeBatch();
364
+ ```
365
+
366
+ `SourceRevocations` stops a connection and completes what the stop leaves: the purge of its sources and of every result derived from them, and the revocation of its grant at the provider. `sourceRevocationSchema(prefix)` answers eight statements for the host's migration, under a prefix of a lower-case letter and at most 27 lower-case letters, digits or underscores (`agentos_source_revoke` unless given): the owner's block marker, each connection's stop intent, the revoke-only queue and its due index, the grant lease, and the authorization exchanges with two indexes. No table references an account table, so removing an account cannot erase an outstanding revocation, and the rows hold opaque ids, times, fixed states, attempt counts and sealed refresh tokens only. The service needs a PostgreSQL adapter with transactions and runs no DDL.
367
+
368
+ The host wires it in four places. The store's `active` binding answers true only when the account is live and `permits(tx, owner)` holds, so an owner whose stop is still purging, or who was deleted, has no sources. Authorization start and grant installation check `canConnect(tx, owner)` under the owner fence. The grant is saved with `new SealedTokenStore(values(tx, scope), keys, { namespace: sourceGrantNamespace(scope) })` under `SOURCE_GRANT_KEY`, the row every lifecycle step reads. A grant operation such as a refresh runs through `withGrant`.
369
+
370
+ `disconnect(scope, generation)`, `loseGrant(handle, reason)` and `deleteOwner(owner)` each commit in one short transaction the owner's fence, the connection's stop (`disconnected`, or `needs_reconnecting` for a lost grant), a purge barrier, a content-free stop intent, the grant's refresh token moved into the revoke-only queue, sealed under the current key and bound to its queue row, and the deletion of the active grant and its lease. `disconnect` takes the generation the authenticated request saw and answers null for another one; `loseGrant` takes the coordinator's exact current handle and answers false for a stale one; `deleteOwner` stops every connection of the owner, also when there is none, and keeps the owner blocked for good. Call it before the host removes any source, credential or account row. A grant that cannot be opened is deleted all the same, and its queue row records it as unreadable. The purge then runs in a transaction of its own; when it fails, the committed stop keeps the owner blocked, and `recover(scope)` completes it. The coordinator's `maintain` calls `recover` for every connection, paused ones included. None of these methods calls the provider.
371
+
372
+ `revokeBatch(limit?, signal?)` is the account-independent worker. It claims due queue rows, one worker per row, opens each token and revokes it with the revoker's `revoke` outside any transaction, within 15 seconds. A success confirms the row and erases its ciphertext. A failure is retried after 1, 2, 4, 8 and then 15 minutes, whatever status the provider answered. Each token's deadline is 23 hours and 59 minutes after it was queued, and neither a retry, a restart nor a repeated disconnect or deletion moves it: at the deadline the ciphertext is erased and the row records that the permission must be removed at the provider. A token that does not open, because its ciphertext was moved to another row or its key is gone, is erased the same way and never sent. A worker whose claim expired cannot settle a row another worker claimed since. The batch answers `{ attempted, confirmed, deferred, expired, unreadable }`. The database erases nothing on its own when a deadline passes: reads and dispatch stop at the deadline, and erasure needs the worker to run, so schedule it at least once a minute.
373
+
374
+ `status(scope)` answers `{ localPending, revocation }`, with `revocation` one of `not_needed`, `pending`, `confirmed` and `permission_removal_required`; the local purge completes whatever the revocation's outcome. A provider can revoke a whole grant rather than one connection's, so `canConnect` stays false while a revocation of the owner's is pending, or expired or unreadable and not yet acknowledged. `acknowledgeRemoval(scope)` records the account owner's statement that the permission was removed at the provider, after which a new grant may begin; it is an attestation, never a confirmation. `compact()` removes, a day after their deadline, terminal rows that nothing refers to.
375
+
376
+ `withGrant(handle, work, signal?)` runs one grant operation under a durable 30-second grant lease, without holding a transaction over the network; another worker gets `rate_limited` until the lease expires, and the lease is never renewed. `work` receives a `SealedTokenStore` and a signal that aborts after 15 seconds. Every load and save through that store, and the final return, recheck the sync handle and the lease, so after a disconnect or once the lease has expired a held token can be neither saved nor returned (`grant_rejected`).
377
+
378
+ ```ts
379
+ // The callback's transaction consumes the authenticated start and records the exchange, or rolls back.
380
+ const exchange = await db.transaction(async (tx) => {
381
+ const start = await consumeStart(tx, callback);
382
+ const begun = start && await revocations.beginExchange(tx, scope, start.generation, start.exchangeId);
383
+ if (!begun) throw new Error('start_refused');
384
+ return begun;
385
+ });
386
+ // Only after that commit does the code exchange reach the provider.
387
+ // When it returns no grant: endExchange(exchange, 'not_dispatched' | 'revoked' | 'unconfirmed').
388
+ const grant = await exchangeCode(callback);
389
+ const outcome = await revocations.settleExchange(exchange, grant, async (tx, granted) => {
390
+ await new SealedTokenStore(grantRows(tx, scope), keys, { namespace: sourceGrantNamespace(scope) })
391
+ .save(SOURCE_GRANT_KEY, granted);
392
+ await new SqlAccountSourceSyncStore(tx, { bindings }).control(scope, { type: 'grant_ready', use });
393
+ return finishStart(tx, exchange.id);
394
+ });
395
+ // outcome.kind: 'installed', 'cleanup_pending' or 'permission_removal_required'
396
+ ```
397
+
398
+ An authorization code exchange returns a grant before anything is installed, and a cancellation, a disconnect, the account's deletion or a failed installation must not leave that grant at the provider unrecorded. `beginExchange(tx, scope, generation, exchangeId)` runs in the host transaction that consumes the authenticated start. It answers the exchange only when the connection is `connecting` at that generation and `canConnect` holds, so one exchange is in flight per owner; otherwise it answers null, and the host rolls the consumption back. The exchange's row holds opaque ids and times, never a code, a state, a PKCE verifier, an address or a credential. The exchange ends 60 seconds after it begins, and while it is open `canConnect` is false.
399
+
400
+ `settleExchange(exchange, grant, install)` first seals the grant's refresh token into the revoke-only queue, held there until the exchange ends, so a crash cannot lose it. When `mayInstallExchange(tx, exchange)` holds (this exact exchange is open and before its end, the connection is still `connecting` at its generation with no grant installed, and nothing else keeps the owner from a new grant), `install` runs in the owner's transaction: it saves the grant, records `grant_ready` and finishes the start, and the same commit removes the held token. When the exchange may not install, or `install` answers anything but true, throws or finishes after the end, the whole installation rolls back and the held token is due for revocation at once; after a crash it is due when the exchange ends, and `revokeBatch` revokes it under its own deadline. A grant that arrives for an exchange already recorded as unconfirmed is neither installed nor revoked: a newer grant at the provider could share its permission, so the notice stands.
401
+
402
+ `endExchange(exchange, outcome)` records an exchange that returned no grant: `not_dispatched` when the request never left the process, `revoked` when the provider flow revoked a grant it refused and the provider confirmed it, and `unconfirmed` otherwise, as after a timeout, an aborted connection or an unreadable answer. An open exchange whose end passes with nothing recorded, because its worker stopped, becomes unconfirmed at the next `revokeBatch`, counted in `expired`. A recorded outcome is never weakened. An unconfirmed exchange, or a returned grant whose revocation expired or could not be opened, makes `status` answer `permission_removal_required` and keeps `canConnect` false until `acknowledgeRemoval`. Exchange rows survive the account's deletion, and `compact` removes them a day after their end once nothing about them is pending.
403
+
404
+ With an `events` sink the service reports `fenced` after a stop's transaction, `purged` after its purge, and `confirmed`, `deferred`, `expired` and `unreadable` from `revokeBatch`, each as `{ kind: 'source_revocation', state, n }`, with no scope, token or provider text. A sink that throws is ignored.
405
+
406
+ The service uses five store methods besides those above. `stageStop(scope, event, stage, expected)` and `stageOwnerStop(owner, stage)` commit a stop and run the service's writes in its transaction; `completeStop(scope, generation, complete)` runs the purge's completion once the barrier is gone; `withCurrentHandle(handle, work)` runs grant storage work with the handle checked; and `lockState(tx, scope)` reads the connection's state in a host transaction after taking the owner fence's lock and then the connection's.
341
407
 
342
408
  ## License
343
409
 
package/dist/index.d.ts CHANGED
@@ -19,4 +19,6 @@ export { SourceQuota, sourceQuotaSchema, sourceRetryAt, type SourceQuotaMethod,
19
19
  /** The resumable synchronization coordinator, its lifecycle binding and the migration of its control state. */
20
20
  export { AccountSourceSync, type AccountSourceSyncOptions, type SourceSyncLifecycle, type SourceSyncRunResult, type SourceSyncMaintenanceResult, } from './sync/AccountSourceSync.js';
21
21
  export { sourceSyncCoordinatorSchema, type SourceSyncOperationAttempt, type SourceSyncOperationState, } from './sync/coordinatorState.js';
22
+ /** Fenced purge, the grant lease, the bounded revoke-only queue and the cleanup of grants that exchanges return. */
23
+ export { SourceRevocations, sourceRevocationSchema, sourceGrantNamespace, SOURCE_GRANT_KEY, type SourceRevocationOptions, type SourceRevocationReason, type SourceRevocationNotice, type SourceRevocationBatch, type SourceRevocationEvent, type SourceGrantExchange, type SourceGrantExchangeOutcome, type SourceUninstalledGrantLifecycle, } from './sync/SourceRevocations.js';
22
24
  //# 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;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;AAC7C,2GAA2G;AAC3G,OAAO,EACL,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAC7C,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EACvE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,KAAK,qBAAqB,GACpG,MAAM,uBAAuB,CAAC;AAC/B,+GAA+G;AAC/G,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EACvD,KAAK,mBAAmB,EAAE,KAAK,2BAA2B,GAC3D,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,2BAA2B,EAC3B,KAAK,0BAA0B,EAAE,KAAK,wBAAwB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E,gBAAgB,EACjF,KAAK,uBAAuB,EAAE,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EACtF,KAAK,qBAAqB,EAAE,KAAK,qBAAqB,EACtD,KAAK,mBAAmB,EAAE,KAAK,0BAA0B,EAAE,KAAK,+BAA+B,GAChG,MAAM,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -19,4 +19,6 @@ export { SourceQuota, sourceQuotaSchema, sourceRetryAt, } from './sync/SourceQuo
19
19
  /** The resumable synchronization coordinator, its lifecycle binding and the migration of its control state. */
20
20
  export { AccountSourceSync, } from './sync/AccountSourceSync.js';
21
21
  export { sourceSyncCoordinatorSchema, } from './sync/coordinatorState.js';
22
+ /** Fenced purge, the grant lease, the bounded revoke-only queue and the cleanup of grants that exchanges return. */
23
+ export { SourceRevocations, sourceRevocationSchema, sourceGrantNamespace, SOURCE_GRANT_KEY, } from './sync/SourceRevocations.js';
22
24
  //# 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;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;AAC7C,2GAA2G;AAC3G,OAAO,EACL,WAAW,EAAE,iBAAiB,EAAE,aAAa,GAG9C,MAAM,uBAAuB,CAAC;AAC/B,+GAA+G;AAC/G,OAAO,EACL,iBAAiB,GAGlB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,2BAA2B,GAE5B,MAAM,4BAA4B,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;AAC7C,2GAA2G;AAC3G,OAAO,EACL,WAAW,EAAE,iBAAiB,EAAE,aAAa,GAG9C,MAAM,uBAAuB,CAAC;AAC/B,+GAA+G;AAC/G,OAAO,EACL,iBAAiB,GAGlB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,2BAA2B,GAE5B,MAAM,4BAA4B,CAAC;AACpC,oHAAoH;AACpH,OAAO,EACL,iBAAiB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,gBAAgB,GAIlF,MAAM,6BAA6B,CAAC"}
@@ -109,9 +109,10 @@ export declare class AccountSourceSync<Prepared = unknown> {
109
109
  /**
110
110
  * Runs one connection's sync under a claimed lease. It recovers the host's purges and the store's controls, claims
111
111
  * the lease, opens a cycle when none is open (`bootstrap` without a cursor, `reconcile` once `reconcileMs` has
112
- * passed since the last non-incremental cycle, otherwise `incremental`), drains the queued reads before asking for
113
- * the next page, and commits the cursor once every item is terminal. It yields with the checkpoint kept after the
114
- * policy's changed-item or history-page budget, the run budget or an aborted signal, and never waits out a retry.
112
+ * passed since the last non-incremental cycle or when none is recorded, as after a change to the exclusions,
113
+ * otherwise `incremental`), drains the queued reads before asking for the next page, and commits the cursor once
114
+ * every item is terminal. It yields with the checkpoint kept after the policy's changed-item or history-page
115
+ * budget, the run budget or an aborted signal, and never waits out a retry.
115
116
  *
116
117
  * @param scope - The connection.
117
118
  * @param trigger - A scheduled poll or a person's request.
@@ -1 +1 @@
1
- {"version":3,"file":"AccountSourceSync.d.ts","sourceRoot":"","sources":["../../src/sync/AccountSourceSync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,yBAAyB,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAChF,kBAAkB,EACF,qBAAqB,EAAmB,mBAAmB,EAC5E,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,yBAAyB,EAAE,gBAAgB,EAC5C,MAAM,gCAAgC,CAAC;AAIxC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,6FAA6F;IAC7F,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxG;AACD;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB,CAAC,QAAQ;IAChD,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,EAAE,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IACpD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE,MAAM,gBAAgB,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACjG,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,kBAAkB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClG,wDAAwD;IACxD,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,+EAA+E;IAC/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AQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC/F;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAAA;CAAE,CAAC;AACvF;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;CACvC;AAYD;;;;;;;;GAQG;AACH,qBAAa,iBAAiB,CAAC,QAAQ,GAAG,OAAO;IAUnC,OAAO,CAAC,QAAQ,CAAC,OAAO;IATpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsC;IAC5D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C;;;;OAIG;gBAC0B,OAAO,EAAE,wBAAwB,CAAC,QAAQ,CAAC;IAOxE,OAAO,CAAC,GAAG;IAKX,OAAO,CAAC,IAAI;YAKE,MAAM;IAIpB,OAAO,CAAC,EAAE;IAMV;;;;;;;;;;;;OAYG;IACG,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAmNjH;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,KAAK,GAAE,eAAe,GAAG,IAAW,EAAE,KAAK,SAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAcxG"}
@@ -86,9 +86,10 @@ export class AccountSourceSync {
86
86
  /**
87
87
  * Runs one connection's sync under a claimed lease. It recovers the host's purges and the store's controls, claims
88
88
  * the lease, opens a cycle when none is open (`bootstrap` without a cursor, `reconcile` once `reconcileMs` has
89
- * passed since the last non-incremental cycle, otherwise `incremental`), drains the queued reads before asking for
90
- * the next page, and commits the cursor once every item is terminal. It yields with the checkpoint kept after the
91
- * policy's changed-item or history-page budget, the run budget or an aborted signal, and never waits out a retry.
89
+ * passed since the last non-incremental cycle or when none is recorded, as after a change to the exclusions,
90
+ * otherwise `incremental`), drains the queued reads before asking for the next page, and commits the cursor once
91
+ * every item is terminal. It yields with the checkpoint kept after the policy's changed-item or history-page
92
+ * budget, the run budget or an aborted signal, and never waits out a retry.
92
93
  *
93
94
  * @param scope - The connection.
94
95
  * @param trigger - A scheduled poll or a person's request.
@@ -208,15 +209,34 @@ export class AccountSourceSync {
208
209
  throw error;
209
210
  throw new SourceSyncFault('storage_unavailable');
210
211
  }
211
- const open = async (mode, replace = false) => {
212
+ // An anchor read shares one attempt count with the provider call that leads to it: a recovery's with the history
213
+ // page that answered `history_expired`, a reconcile's with its look at the committed cursor's history. The one
214
+ // operation slot then never alternates between two keys, and while a call keeps failing the count reaches five
215
+ // attempts and the `pollMs` wait.
216
+ const open = async (mode, replace = false, sharedKey) => {
212
217
  const cutoff = this.now();
213
218
  const cycleId = randomUUID();
214
- const anchor = mode === 'incremental' ? snapshot.state.cursor : await operation(digest(['begin', handle.lease.generation, mode, snapshot.state.cursor,
215
- snapshot.state.lastSyncAt, checkpoint?.cycleId ?? null, checkpoint?.revision ?? null]), (child) => source.begin(context(cycleId, cutoff, child)));
219
+ const committed = snapshot.state.cursor;
220
+ const key = sharedKey ?? digest(['begin', handle.lease.generation, mode, committed,
221
+ snapshot.state.lastSyncAt, checkpoint?.cycleId ?? null, checkpoint?.revision ?? null]);
222
+ const anchor = mode === 'incremental' ? committed : await operation(key, (child) => source.begin(context(cycleId, cutoff, child)));
216
223
  // A reconcile reads its anchor before the scan but replays history from the committed cursor: history ids
217
224
  // only increase, so that replay also covers the changes between the cursor and the anchor, which the bounded
218
- // scan may not list.
219
- const fromCursor = mode === 'reconcile' ? snapshot.state.cursor ?? anchor : anchor;
225
+ // scan may not list. It asks for that history first: when the provider answers that it has expired, nothing
226
+ // before the anchor can be replayed, so the cycle replays from the anchor, with one scan and one read pass,
227
+ // instead of finding the expiry after them and repeating both in a recovery.
228
+ let fromCursor = anchor;
229
+ if (mode === 'reconcile' && committed !== null) {
230
+ const cursor = committed;
231
+ try {
232
+ await operation(key, (child) => source.historyPage(context(cycleId, cutoff, child), cursor, null));
233
+ fromCursor = cursor;
234
+ }
235
+ catch (error) {
236
+ if (!(error instanceof SourceSyncFault) || error.code !== 'history_expired')
237
+ throw error;
238
+ }
239
+ }
220
240
  const next = await this.stored(() => this.store.openCycle(needHandle(), { mode, fromCursor, cutoff, cycleId }, replace));
221
241
  if (!next)
222
242
  throw new SyncStale();
@@ -290,10 +310,11 @@ export class AccountSourceSync {
290
310
  if (checkpoint.phase === 'history' && historyPages >= snapshot.policy.maxHistoryPagesPerLease)
291
311
  throw new SyncYield();
292
312
  const cp = checkpoint;
313
+ const pageKey = digest(['page', cp.generation, cp.cycleId, cp.revision, cp.phase]);
293
314
  try {
294
315
  if (cp.phase === 'history')
295
316
  historyPages++;
296
- const page = await operation(digest(['page', cp.generation, cp.cycleId, cp.revision, cp.phase]), (child) => cp.phase === 'scan'
317
+ const page = await operation(pageKey, (child) => cp.phase === 'scan'
297
318
  ? source.scanPage(context(cp.cycleId, cp.cutoff, child), cp.nextPageToken)
298
319
  : source.historyPage(context(cp.cycleId, cp.cutoff, child), cp.fromCursor, cp.nextPageToken));
299
320
  checkpoint = await this.stored(() => this.store.page(needHandle(), cp, page));
@@ -304,8 +325,9 @@ export class AccountSourceSync {
304
325
  if (error instanceof SourceSyncFault && error.code === 'history_expired' && cp.phase === 'history') {
305
326
  if (recovered)
306
327
  throw new SyncDeferred('provider_unavailable', this.now() + snapshot.policy.pollMs);
328
+ // The recovery's anchor read continues this page's attempt count (see `open`).
307
329
  recovered = true;
308
- checkpoint = await open('recovery', true);
330
+ checkpoint = await open('recovery', true, pageKey);
309
331
  continue;
310
332
  }
311
333
  throw error;
@@ -1 +1 @@
1
- {"version":3,"file":"AccountSourceSync.js","sourceRoot":"","sources":["../../src/sync/AccountSourceSync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AASrD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmEjD,MAAM,SAAU,SAAQ,KAAK;IAAG,gBAAgB,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAAE;AAC/E,MAAM,SAAU,SAAQ,KAAK;IAAG,gBAAgB,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAAE;AAC/E,MAAM,YAAa,SAAQ,KAAK;IACT;IAAwC;IAA7D,YAAqB,MAA6B,EAAW,OAAe;QAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAAzF,WAAM,GAAN,MAAM,CAAuB;QAAW,YAAO,GAAP,OAAO,CAAQ;IAAmC,CAAC;CACjH;AACD,MAAM,YAAY,GAAqC,CAAC,SAAS,EAAE,cAAc,EAAE,sBAAsB,EAAE,qBAAqB,CAAC,CAAC;AAClI,MAAM,SAAS,GAAG,CAAC,KAAsB,EAAuE,EAAE,CAChH,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAA6B,CAAC,CAAC;AAC7D,MAAM,MAAM,GAAG,CAAC,KAA0C,EAAU,EAAE,CACpE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEnE;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IAUC;IATZ,KAAK,CAAsC;IAC3C,KAAK,CAAe;IACpB,SAAS,CAAS;IAClB,gBAAgB,CAAS;IAC1C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