@framers/agentos-ext-gmail-source 0.3.0 → 0.5.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 +80 -2
- package/dist/GmailSourceConnector.d.ts +161 -0
- package/dist/GmailSourceConnector.d.ts.map +1 -0
- package/dist/GmailSourceConnector.js +465 -0
- package/dist/GmailSourceConnector.js.map +1 -0
- package/dist/gmail.d.ts +203 -0
- package/dist/gmail.d.ts.map +1 -0
- package/dist/gmail.js +592 -0
- package/dist/gmail.js.map +1 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/retry.d.ts +44 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +102 -0
- package/dist/retry.js.map +1 -0
- package/dist/sync.d.ts +66 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +145 -0
- package/dist/sync.js.map +1 -0
- package/manifest.json +2 -2
- package/package.json +4 -4
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,oBAAoB,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EACrF,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,GACxE,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAC3E,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EACpE,KAAK,qBAAqB,EAAE,KAAK,gBAAgB,GAClD,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EACL,QAAQ,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAClE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,GAClF,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,EACL,oBAAoB,EAAE,mBAAmB,EACzC,KAAK,mBAAmB,EAAE,KAAK,2BAA2B,GAC3D,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kBAAkB,EAAE,iBAAiB,EACrC,KAAK,qBAAqB,EAAE,KAAK,uBAAuB,GACzD,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
* @fileoverview A read-only Gmail source's grant: Google's read-only scope on the AgentOS redirect OAuth flow and
|
|
3
3
|
* sealed-token store, with capped, cancellable OAuth calls and fixed failures; its text helpers: bounded
|
|
4
4
|
* pre-storage sanitization of mail text, allow-listed headers and metadata, and conservative trimming of reply history
|
|
5
|
-
* and signatures;
|
|
6
|
-
* with message provenance, attachment listings and an explicit cache decision
|
|
5
|
+
* and signatures; its thread mapper: bounded MIME reading of one thread into a sanitized account-source document
|
|
6
|
+
* with message provenance, attachment listings and an explicit cache decision; its read-only API client: capped
|
|
7
|
+
* profile, label, list, history and thread calls through the host's grant and quota services, with fixed failures;
|
|
8
|
+
* and its connector: the bounded selected-id account-source interface and the resumable sync provider, with private
|
|
9
|
+
* mailbox verification, composed with the released durable coordinator and a one-time identity probe.
|
|
7
10
|
* @module agentos-ext-gmail-source
|
|
8
11
|
*/
|
|
9
12
|
export { GmailOAuthFlow } from './GmailOAuthFlow.js';
|
|
@@ -12,4 +15,8 @@ export { GmailTextFault, sanitizeMailText, sanitizeMailMetadata, sanitizeMailHea
|
|
|
12
15
|
export { messageText } from './messageText.js';
|
|
13
16
|
export { GmailThreadMapper } from './mapThread.js';
|
|
14
17
|
export { GmailMappingFault } from './mime.js';
|
|
18
|
+
export { GmailApi, GmailApiFault, } from './gmail.js';
|
|
19
|
+
export { classifyGmailHttp, gmailOAuthFault } from './retry.js';
|
|
20
|
+
export { GmailSourceConnector, GmailConnectorFault, } from './GmailSourceConnector.js';
|
|
21
|
+
export { runGmailSourceSync, verifyGmailSource, } from './sync.js';
|
|
15
22
|
//# 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
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,oBAAoB,EAAE,eAAe,GAEtC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,GAG5E,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAA8B,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAA2B,MAAM,WAAW,CAAC;AACvE,OAAO,EACL,QAAQ,EAAE,aAAa,GAExB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAA6B,MAAM,YAAY,CAAC;AAC3F,OAAO,EACL,oBAAoB,EAAE,mBAAmB,GAE1C,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kBAAkB,EAAE,iBAAiB,GAEtC,MAAM,WAAW,CAAC"}
|
package/dist/retry.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SourceSyncFault, type SourceQuotaMethod, type SourceSyncFailureCode } from '@framers/agentos-ext-account-sources';
|
|
2
|
+
/**
|
|
3
|
+
* What one Gmail API answer calls for: `ok` for a success; `refresh` for a 401, which earns one fresh access token and
|
|
4
|
+
* one repeat of the same call; `gone` for a canonical thread read's 404; `retry` for a rate limit or a server failure,
|
|
5
|
+
* with the scope its wait applies to and whether it is the provider's daily limit; `fault` for a fixed failure.
|
|
6
|
+
*/
|
|
7
|
+
export type GmailHttpDisposition = {
|
|
8
|
+
readonly kind: 'ok' | 'refresh' | 'gone';
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: 'retry';
|
|
11
|
+
readonly code: 'rate_limited' | 'provider_unavailable';
|
|
12
|
+
readonly scope: 'project' | 'mailbox';
|
|
13
|
+
readonly daily: boolean;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'fault';
|
|
16
|
+
readonly code: SourceSyncFailureCode;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Classifies one Gmail API answer by its status and, for a 403, the exact reason tokens of at most 32 error entries.
|
|
20
|
+
* A 429 or 5xx is retried whether or not its body parses. A 403 `domainPolicy` wins over any other reason, then
|
|
21
|
+
* `insufficientPermissions`, `dailyLimitExceeded` (the whole project, daily), `rateLimitExceeded` (the whole project)
|
|
22
|
+
* and `userRateLimitExceeded` (the mailbox). A 404 is `gone` for a thread read and `history_expired` for a history
|
|
23
|
+
* page. Any other answer, an unknown reason included, is the fixed `invalid_response`, never an inferred grant loss.
|
|
24
|
+
* Only exact reason tokens influence policy. Provider text never leaves this function.
|
|
25
|
+
*
|
|
26
|
+
* @param status The HTTP status.
|
|
27
|
+
* @param body The answer's parsed JSON, or null when it did not parse.
|
|
28
|
+
* @param method The kind of call that was answered.
|
|
29
|
+
*/
|
|
30
|
+
export declare function classifyGmailHttp(status: number, body: unknown, method: SourceQuotaMethod): GmailHttpDisposition;
|
|
31
|
+
/**
|
|
32
|
+
* Translates a failure of an OAuth grant operation into a fixed account-source fault. A missing grant or Google's
|
|
33
|
+
* `invalid_grant` is `grant_rejected` and `invalid_scope` or a scope check is `insufficient_scope`, the two that start
|
|
34
|
+
* the coordinator's fenced grant-loss lifecycle; a 429 is `rate_limited`; a 5xx, `server_error` or
|
|
35
|
+
* `temporarily_unavailable` is `provider_unavailable`; a transport failure or deadline is `network`. A refused client
|
|
36
|
+
* (`invalid_client`, `unauthorized_client`) needs an operator's configuration fix and, like every other failure, is
|
|
37
|
+
* `invalid_response`: never a revoked mailbox. A `SourceSyncFault` is returned unchanged.
|
|
38
|
+
*
|
|
39
|
+
* Call inside withGrant so that its fixed-fault boundary preserves this distinction.
|
|
40
|
+
*
|
|
41
|
+
* @param error What the grant operation threw.
|
|
42
|
+
*/
|
|
43
|
+
export declare function gmailOAuthFault(error: unknown): SourceSyncFault;
|
|
44
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,eAAe,EAAE,KAAK,iBAAiB,EAAE,KAAK,qBAAqB,EACpE,MAAM,sCAAsC,CAAC;AAG9C;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,GAAG,MAAM,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,sBAAsB,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAClJ;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAA;CAAE,CAAC;AAMrE;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,GAAG,oBAAoB,CA0BhH;AACD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAiB/D"}
|
package/dist/retry.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Fixed classification of Gmail API answers and OAuth refresh failures. Only an HTTP status and exact,
|
|
3
|
+
* allow-listed reason tokens decide a disposition; provider text, error bodies and causes never reach a result or an
|
|
4
|
+
* error. The durable account-source coordinator owns retry episodes, backoff and grant-loss handling.
|
|
5
|
+
* @module agentos-ext-gmail-source/retry
|
|
6
|
+
*/
|
|
7
|
+
import { OAuthGrantRefused } from '@framers/agentos/auth';
|
|
8
|
+
import { SourceSyncFault, } from '@framers/agentos-ext-account-sources';
|
|
9
|
+
import { GmailOAuthFault } from './types.js';
|
|
10
|
+
// A plain object, or null for anything else.
|
|
11
|
+
function record(value) {
|
|
12
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
13
|
+
? value : null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Classifies one Gmail API answer by its status and, for a 403, the exact reason tokens of at most 32 error entries.
|
|
17
|
+
* A 429 or 5xx is retried whether or not its body parses. A 403 `domainPolicy` wins over any other reason, then
|
|
18
|
+
* `insufficientPermissions`, `dailyLimitExceeded` (the whole project, daily), `rateLimitExceeded` (the whole project)
|
|
19
|
+
* and `userRateLimitExceeded` (the mailbox). A 404 is `gone` for a thread read and `history_expired` for a history
|
|
20
|
+
* page. Any other answer, an unknown reason included, is the fixed `invalid_response`, never an inferred grant loss.
|
|
21
|
+
* Only exact reason tokens influence policy. Provider text never leaves this function.
|
|
22
|
+
*
|
|
23
|
+
* @param status The HTTP status.
|
|
24
|
+
* @param body The answer's parsed JSON, or null when it did not parse.
|
|
25
|
+
* @param method The kind of call that was answered.
|
|
26
|
+
*/
|
|
27
|
+
export function classifyGmailHttp(status, body, method) {
|
|
28
|
+
if (status === 200)
|
|
29
|
+
return { kind: 'ok' };
|
|
30
|
+
if (status === 401)
|
|
31
|
+
return { kind: 'refresh' };
|
|
32
|
+
if (status === 404 && method === 'read')
|
|
33
|
+
return { kind: 'gone' };
|
|
34
|
+
if (status === 404 && method === 'changes')
|
|
35
|
+
return { kind: 'fault', code: 'history_expired' };
|
|
36
|
+
const retry = (code, scope, daily = false) => ({ kind: 'retry', code, scope, daily });
|
|
37
|
+
if (status === 429)
|
|
38
|
+
return retry('rate_limited', 'mailbox');
|
|
39
|
+
if (status >= 500 && status <= 599)
|
|
40
|
+
return retry('provider_unavailable', 'mailbox');
|
|
41
|
+
if (status === 403) {
|
|
42
|
+
const entries = record(record(body)?.error)?.errors;
|
|
43
|
+
const reasons = new Set();
|
|
44
|
+
if (Array.isArray(entries) && entries.length <= 32) {
|
|
45
|
+
for (const entry of entries) {
|
|
46
|
+
const reason = record(entry)?.reason;
|
|
47
|
+
if (typeof reason === 'string' && ['domainPolicy', 'insufficientPermissions', 'dailyLimitExceeded',
|
|
48
|
+
'rateLimitExceeded', 'userRateLimitExceeded'].includes(reason))
|
|
49
|
+
reasons.add(reason);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (reasons.has('domainPolicy'))
|
|
53
|
+
return { kind: 'fault', code: 'domain_policy' };
|
|
54
|
+
if (reasons.has('insufficientPermissions'))
|
|
55
|
+
return { kind: 'fault', code: 'insufficient_scope' };
|
|
56
|
+
if (reasons.has('dailyLimitExceeded'))
|
|
57
|
+
return retry('rate_limited', 'project', true);
|
|
58
|
+
if (reasons.has('rateLimitExceeded'))
|
|
59
|
+
return retry('rate_limited', 'project');
|
|
60
|
+
if (reasons.has('userRateLimitExceeded'))
|
|
61
|
+
return retry('rate_limited', 'mailbox');
|
|
62
|
+
}
|
|
63
|
+
return { kind: 'fault', code: 'invalid_response' };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Translates a failure of an OAuth grant operation into a fixed account-source fault. A missing grant or Google's
|
|
67
|
+
* `invalid_grant` is `grant_rejected` and `invalid_scope` or a scope check is `insufficient_scope`, the two that start
|
|
68
|
+
* the coordinator's fenced grant-loss lifecycle; a 429 is `rate_limited`; a 5xx, `server_error` or
|
|
69
|
+
* `temporarily_unavailable` is `provider_unavailable`; a transport failure or deadline is `network`. A refused client
|
|
70
|
+
* (`invalid_client`, `unauthorized_client`) needs an operator's configuration fix and, like every other failure, is
|
|
71
|
+
* `invalid_response`: never a revoked mailbox. A `SourceSyncFault` is returned unchanged.
|
|
72
|
+
*
|
|
73
|
+
* Call inside withGrant so that its fixed-fault boundary preserves this distinction.
|
|
74
|
+
*
|
|
75
|
+
* @param error What the grant operation threw.
|
|
76
|
+
*/
|
|
77
|
+
export function gmailOAuthFault(error) {
|
|
78
|
+
if (error instanceof SourceSyncFault)
|
|
79
|
+
return error;
|
|
80
|
+
if (error instanceof GmailOAuthFault) {
|
|
81
|
+
if (error.reason === 'scope')
|
|
82
|
+
return new SourceSyncFault('insufficient_scope');
|
|
83
|
+
if (error.reason === 'network' || error.reason === 'timeout')
|
|
84
|
+
return new SourceSyncFault('network');
|
|
85
|
+
if (error.reason === 'cancelled')
|
|
86
|
+
return new SourceSyncFault('cancelled');
|
|
87
|
+
return new SourceSyncFault('invalid_response');
|
|
88
|
+
}
|
|
89
|
+
if (error instanceof OAuthGrantRefused) {
|
|
90
|
+
if (error.reason === 'missing' || error.providerError === 'invalid_grant')
|
|
91
|
+
return new SourceSyncFault('grant_rejected');
|
|
92
|
+
if (error.providerError === 'invalid_scope')
|
|
93
|
+
return new SourceSyncFault('insufficient_scope');
|
|
94
|
+
if (error.status === 429)
|
|
95
|
+
return new SourceSyncFault('rate_limited');
|
|
96
|
+
if ((error.status !== undefined && error.status >= 500) || ['server_error', 'temporarily_unavailable'].includes(error.providerError ?? '')) {
|
|
97
|
+
return new SourceSyncFault('provider_unavailable');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return new SourceSyncFault('invalid_response');
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAW7C,6CAA6C;AAC7C,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzE,CAAC,CAAC,KAAgC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9C,CAAC;AACD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,IAAa,EAAE,MAAyB;IACxF,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC1C,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC/C,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACjE,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAA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E,OAAO,IAAI,eAAe,CAAC,oBAAoB,CAAC,CAAC;QAC9F,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,eAAe,CAAC,cAAc,CAAC,CAAC;QACrE,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,yBAAyB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,IAAI,EAAE,CAAC,EAAE,CAAC;YAC3I,OAAO,IAAI,eAAe,CAAC,sBAAsB,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,OAAO,IAAI,eAAe,CAAC,kBAAkB,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/sync.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The Gmail connector composed with the released account-source coordinator: one durable sync run with
|
|
3
|
+
* a fresh connector that is disposed whatever the run's outcome, and the one-time identity probe a host runs after it
|
|
4
|
+
* installs a grant. Neither adds scheduling, retries, quota reservations or checkpoint state of its own.
|
|
5
|
+
* @module agentos-ext-gmail-source/sync
|
|
6
|
+
*/
|
|
7
|
+
import { type AccountSourceSyncOptions, type SourceSyncRunResult, type SourceSyncScope, type SourceSyncTrigger, type SourceRevocations, type SourceSyncRetryReason } from '@framers/agentos-ext-account-sources';
|
|
8
|
+
import { type GmailSourceConnectorOptions } from './GmailSourceConnector.js';
|
|
9
|
+
/**
|
|
10
|
+
* What a Gmail sync run and the identity probe are built from.
|
|
11
|
+
*
|
|
12
|
+
* @typeParam Prepared - The host's prepared-document type of its sync store and revocation service.
|
|
13
|
+
*/
|
|
14
|
+
export interface GmailSourceRunOptions<Prepared> {
|
|
15
|
+
/** The connection. */
|
|
16
|
+
readonly scope: SourceSyncScope;
|
|
17
|
+
/** The released coordinator's options without the provider and the lifecycle, which the run supplies. */
|
|
18
|
+
readonly coordinator: Omit<AccountSourceSyncOptions<Prepared>, 'provider' | 'lifecycle'>;
|
|
19
|
+
/** The released revocation service: the coordinator's lifecycle and the connector's grant operation. */
|
|
20
|
+
readonly revocations: SourceRevocations<Prepared>;
|
|
21
|
+
/** The connector's options without the store, the current-handle getter, the revocation service and the clock. */
|
|
22
|
+
readonly connector: Omit<GmailSourceConnectorOptions<Prepared>, 'store' | 'currentHandle' | 'revocations' | 'clock'>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* How an identity probe ended: `verified` once the bound mailbox accepted the profile; `busy` when another lease is
|
|
26
|
+
* held, which is no approval; `stale` when the generation or the lease moved on; `reconnect` after a refused grant or
|
|
27
|
+
* a different mailbox was fenced; `unavailable` when the store could not be reached; `cancelled`; `deferred` with the
|
|
28
|
+
* recorded retry; `failed` with a fixed reason.
|
|
29
|
+
*/
|
|
30
|
+
export type GmailSourceVerification = {
|
|
31
|
+
readonly kind: 'verified' | 'busy' | 'stale' | 'reconnect' | 'unavailable' | 'cancelled';
|
|
32
|
+
} | {
|
|
33
|
+
readonly kind: 'deferred';
|
|
34
|
+
readonly reason: SourceSyncRetryReason;
|
|
35
|
+
readonly retryAt: number;
|
|
36
|
+
} | {
|
|
37
|
+
readonly kind: 'failed';
|
|
38
|
+
readonly reason: 'domain_policy' | 'invalid_response';
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Runs one durable sync of the connection with the released account-source coordinator and a fresh Gmail connector,
|
|
42
|
+
* which it disposes when the run ends, whatever the outcome. No extra scheduling, retries, quota reservation or
|
|
43
|
+
* checkpoint state.
|
|
44
|
+
*
|
|
45
|
+
* @param options The scope, the coordinator's options, the revocation service and the connector's options.
|
|
46
|
+
* @param trigger A scheduled poll or a person's request.
|
|
47
|
+
* @param signal Aborting it ends the run with `yielded`.
|
|
48
|
+
* @returns The coordinator's result.
|
|
49
|
+
*/
|
|
50
|
+
export declare function runGmailSourceSync<Prepared>(options: GmailSourceRunOptions<Prepared>, trigger: SourceSyncTrigger, signal?: AbortSignal): Promise<SourceSyncRunResult>;
|
|
51
|
+
/**
|
|
52
|
+
* One post-install identity probe on a real lease; no enumeration, source write or cursor commit.
|
|
53
|
+
*
|
|
54
|
+
* It recovers the host's purges and the store's controls, claims a scheduled lease, checks the expected generation,
|
|
55
|
+
* reads the profile through the grant service and lets the host's binding accept the mailbox, then releases the
|
|
56
|
+
* lease. A refused grant or a different mailbox is fenced through the lifecycle; a transient failure records a retry
|
|
57
|
+
* no sooner than one polling interval away. It opens no cycle and sets no cursor or last sync time.
|
|
58
|
+
*
|
|
59
|
+
* @param options The scope, the coordinator's options, the revocation service and the connector's options.
|
|
60
|
+
* @param expectedGeneration The generation the host installed the grant into.
|
|
61
|
+
* @param signal Cancels the probe.
|
|
62
|
+
* @returns How the probe ended.
|
|
63
|
+
* @throws {SourceSyncFault} `invalid_response` for a generation that is not a nonnegative safe integer.
|
|
64
|
+
*/
|
|
65
|
+
export declare function verifyGmailSource<Prepared>(options: GmailSourceRunOptions<Prepared>, expectedGeneration: number, signal?: AbortSignal): Promise<GmailSourceVerification>;
|
|
66
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAC7E,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAAE,KAAK,qBAAqB,EACnD,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAwB,KAAK,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAEnG;;;;GAIG;AACH,MAAM,WAAW,qBAAqB,CAAC,QAAQ;IAC7C,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,yGAAyG;IACzG,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,wBAAwB,CAAC,QAAQ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a fresh connector that is disposed whatever the run's outcome, and the one-time identity probe a host runs after it
|
|
4
|
+
* installs a grant. Neither adds scheduling, retries, quota reservations or checkpoint state of its own.
|
|
5
|
+
* @module agentos-ext-gmail-source/sync
|
|
6
|
+
*/
|
|
7
|
+
import { AccountSourceSync, SourceSyncFault, } from '@framers/agentos-ext-account-sources';
|
|
8
|
+
import { GmailSourceConnector } from './GmailSourceConnector.js';
|
|
9
|
+
// A connector on the coordinator's live handle getter, refusing a handle for any other connection.
|
|
10
|
+
function connectorFor(options, current) {
|
|
11
|
+
const currentHandle = () => {
|
|
12
|
+
const handle = current();
|
|
13
|
+
const actual = handle.lease.scope;
|
|
14
|
+
if (actual.tenantId !== options.scope.tenantId || actual.ownerId !== options.scope.ownerId
|
|
15
|
+
|| actual.connectionId !== options.scope.connectionId)
|
|
16
|
+
throw new SourceSyncFault('grant_rejected');
|
|
17
|
+
return handle;
|
|
18
|
+
};
|
|
19
|
+
return new GmailSourceConnector({ ...options.connector, store: options.coordinator.store,
|
|
20
|
+
revocations: options.revocations, currentHandle, clock: options.coordinator.clock });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Runs one durable sync of the connection with the released account-source coordinator and a fresh Gmail connector,
|
|
24
|
+
* which it disposes when the run ends, whatever the outcome. No extra scheduling, retries, quota reservation or
|
|
25
|
+
* checkpoint state.
|
|
26
|
+
*
|
|
27
|
+
* @param options The scope, the coordinator's options, the revocation service and the connector's options.
|
|
28
|
+
* @param trigger A scheduled poll or a person's request.
|
|
29
|
+
* @param signal Aborting it ends the run with `yielded`.
|
|
30
|
+
* @returns The coordinator's result.
|
|
31
|
+
*/
|
|
32
|
+
export async function runGmailSourceSync(options, trigger, signal) {
|
|
33
|
+
const connectors = [];
|
|
34
|
+
try {
|
|
35
|
+
const coordinator = new AccountSourceSync({ ...options.coordinator, lifecycle: options.revocations,
|
|
36
|
+
provider: async (currentHandle) => {
|
|
37
|
+
const connector = connectorFor(options, currentHandle);
|
|
38
|
+
connectors.push(connector);
|
|
39
|
+
return connector.sync;
|
|
40
|
+
} });
|
|
41
|
+
return await coordinator.run(options.scope, trigger, signal);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
for (const connector of connectors)
|
|
45
|
+
connector.dispose();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* One post-install identity probe on a real lease; no enumeration, source write or cursor commit.
|
|
50
|
+
*
|
|
51
|
+
* It recovers the host's purges and the store's controls, claims a scheduled lease, checks the expected generation,
|
|
52
|
+
* reads the profile through the grant service and lets the host's binding accept the mailbox, then releases the
|
|
53
|
+
* lease. A refused grant or a different mailbox is fenced through the lifecycle; a transient failure records a retry
|
|
54
|
+
* no sooner than one polling interval away. It opens no cycle and sets no cursor or last sync time.
|
|
55
|
+
*
|
|
56
|
+
* @param options The scope, the coordinator's options, the revocation service and the connector's options.
|
|
57
|
+
* @param expectedGeneration The generation the host installed the grant into.
|
|
58
|
+
* @param signal Cancels the probe.
|
|
59
|
+
* @returns How the probe ended.
|
|
60
|
+
* @throws {SourceSyncFault} `invalid_response` for a generation that is not a nonnegative safe integer.
|
|
61
|
+
*/
|
|
62
|
+
export async function verifyGmailSource(options, expectedGeneration, signal) {
|
|
63
|
+
if (!Number.isSafeInteger(expectedGeneration) || expectedGeneration < 0)
|
|
64
|
+
throw new SourceSyncFault('invalid_response');
|
|
65
|
+
if (signal?.aborted)
|
|
66
|
+
return { kind: 'cancelled' };
|
|
67
|
+
const store = options.coordinator.store;
|
|
68
|
+
const clock = options.coordinator.clock ?? Date.now;
|
|
69
|
+
let handle = null;
|
|
70
|
+
let connector = null;
|
|
71
|
+
let pollMs = 900_000;
|
|
72
|
+
let result = { kind: 'unavailable' };
|
|
73
|
+
const current = () => {
|
|
74
|
+
if (handle === null)
|
|
75
|
+
throw new SourceSyncFault('grant_rejected');
|
|
76
|
+
return handle;
|
|
77
|
+
};
|
|
78
|
+
try {
|
|
79
|
+
await options.revocations.recover(options.scope);
|
|
80
|
+
await store.recoverControl(options.scope);
|
|
81
|
+
handle = await store.claim(options.scope, 'scheduled');
|
|
82
|
+
if (handle === null)
|
|
83
|
+
result = { kind: 'busy' };
|
|
84
|
+
else if (handle.lease.generation !== expectedGeneration)
|
|
85
|
+
result = { kind: 'stale' };
|
|
86
|
+
else {
|
|
87
|
+
const snapshot = await store.snapshot(options.scope);
|
|
88
|
+
if (!snapshot || snapshot.state.generation !== expectedGeneration)
|
|
89
|
+
result = { kind: 'stale' };
|
|
90
|
+
else {
|
|
91
|
+
pollMs = snapshot.policy.pollMs;
|
|
92
|
+
connector = connectorFor(options, current);
|
|
93
|
+
const request = { scope: options.scope, generation: expectedGeneration,
|
|
94
|
+
cycleId: 'identity-check', cutoff: clock(), policy: snapshot.policy, signal };
|
|
95
|
+
await connector.sync.begin(request);
|
|
96
|
+
result = { kind: 'verified' };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
try {
|
|
102
|
+
const fault = error instanceof SourceSyncFault ? error : new SourceSyncFault('storage_unavailable');
|
|
103
|
+
if (signal?.aborted || fault.code === 'cancelled')
|
|
104
|
+
result = { kind: 'cancelled' };
|
|
105
|
+
else if (handle === null)
|
|
106
|
+
result = { kind: 'unavailable' };
|
|
107
|
+
else if (fault.code === 'grant_rejected' || fault.code === 'insufficient_scope') {
|
|
108
|
+
const stopped = await options.revocations.loseGrant(handle, fault.code);
|
|
109
|
+
result = { kind: stopped ? 'reconnect' : 'stale' };
|
|
110
|
+
handle = null;
|
|
111
|
+
}
|
|
112
|
+
else if (fault.code === 'domain_policy' || fault.code === 'invalid_response' || fault.code === 'history_expired') {
|
|
113
|
+
const reason = fault.code === 'domain_policy' ? 'domain_policy' : 'invalid_response';
|
|
114
|
+
const released = await store.release(handle, { type: 'sync_failed', reason });
|
|
115
|
+
result = released ? { kind: 'failed', reason } : { kind: 'stale' };
|
|
116
|
+
handle = null;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
const reason = fault.code;
|
|
120
|
+
const now = clock();
|
|
121
|
+
const retryAt = Math.max(now + pollMs, fault.retryAt ?? 0);
|
|
122
|
+
const released = await store.release(handle, { type: 'sync_deferred', reason, retryAt });
|
|
123
|
+
result = released ? { kind: 'deferred', reason, retryAt } : { kind: 'stale' };
|
|
124
|
+
handle = null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
result = { kind: 'unavailable' };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
connector?.dispose();
|
|
133
|
+
if (handle !== null) {
|
|
134
|
+
try {
|
|
135
|
+
if (!await store.release(handle))
|
|
136
|
+
result = { kind: 'stale' };
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
result = { kind: 'unavailable' };
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=sync.js.map
|
package/dist/sync.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,iBAAiB,EAAE,eAAe,GAInC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAoC,MAAM,2BAA2B,CAAC;AA4BnG,mGAAmG;AACnG,SAAS,YAAY,CAAW,OAAwC,EAAE,OAA+B;IACvG,MAAM,aAAa,GAAG,GAAqB,EAAE;QAC3C,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;QAAC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAC5D,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO,CAAC,KAAK,CAAC,OAAO;eACrF,MAAM,CA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MAAM,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QAAC,CAAC;IAC/C,CAAC;YAAS,CAAC;QACT,SAAS,EAAE,OAAO,EAAE,CAAC;QACrB,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC;gBAAC,IAAI,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;oBAAE,MAAM,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;YAAC,CAAC;YACrE,MAAM,CAAC;gBAAC,MAAM,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;YAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
|
|
3
3
|
"id": "com.framers.productivity.gmail-source",
|
|
4
4
|
"name": "Gmail Source",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.5.0",
|
|
6
6
|
"description": "Read-only OAuth and bounded personal Gmail source helpers",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Frame",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"keywords": ["gmail", "sources", "oauth"],
|
|
14
|
-
"agentosVersion": ">=0.13.
|
|
14
|
+
"agentosVersion": ">=0.13.146",
|
|
15
15
|
"categories": ["productivity"],
|
|
16
16
|
"repository": { "type": "git", "url": "https://github.com/framerslab/agentos-extensions" },
|
|
17
17
|
"extensions": [{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@framers/agentos-ext-gmail-source",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Read-only OAuth and bounded personal Gmail source helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"node": ">=20.19.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@framers/agentos": ">=0.13.
|
|
46
|
+
"@framers/agentos": ">=0.13.146",
|
|
47
47
|
"@framers/agentos-ext-account-sources": ">=0.7.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"@vitest/coverage-v8": "^3.2.7",
|
|
52
52
|
"typescript": "5.4.5",
|
|
53
53
|
"vitest": "^3.2.7",
|
|
54
|
-
"@framers/agentos": "^0.
|
|
55
|
-
"@framers/agentos
|
|
54
|
+
"@framers/agentos-ext-account-sources": "^0.7.2",
|
|
55
|
+
"@framers/agentos": "^0.13.134"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsc",
|