@framers/agentos-ext-gmail-source 0.5.0 → 0.5.2
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 +6 -4
- package/dist/GmailOAuthFlow.d.ts +21 -6
- package/dist/GmailOAuthFlow.d.ts.map +1 -1
- package/dist/GmailOAuthFlow.js +66 -19
- package/dist/GmailOAuthFlow.js.map +1 -1
- package/dist/characters.d.ts +39 -0
- package/dist/characters.d.ts.map +1 -0
- package/dist/characters.js +83 -0
- package/dist/characters.js.map +1 -0
- package/dist/gmail.d.ts.map +1 -1
- package/dist/gmail.js +4 -5
- package/dist/gmail.js.map +1 -1
- package/dist/htmlNamedReferences.d.ts +13 -0
- package/dist/htmlNamedReferences.d.ts.map +1 -0
- package/dist/htmlNamedReferences.js +389 -0
- package/dist/htmlNamedReferences.js.map +1 -0
- package/dist/mailSanitize.d.ts +17 -11
- package/dist/mailSanitize.d.ts.map +1 -1
- package/dist/mailSanitize.js +30 -36
- package/dist/mailSanitize.js.map +1 -1
- package/dist/mapThread.d.ts +3 -0
- package/dist/mapThread.d.ts.map +1 -1
- package/dist/mapThread.js +3 -0
- package/dist/mapThread.js.map +1 -1
- package/dist/mime.d.ts +3 -1
- package/dist/mime.d.ts.map +1 -1
- package/dist/mime.js +16 -5
- package/dist/mime.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -30,9 +30,9 @@ Construct `GmailOAuthFlow(client, store, options)` on the server. `client` conta
|
|
|
30
30
|
|
|
31
31
|
`begin({ redirectUri })` returns the authorization URL, state and PKCE verifier. Keep state and verifier under a short-lived, single-use record tied to the signed-in account. `complete(input)` checks state, exchanges the code and verifies the granted scope and refresh material. It returns credentials in memory and does not persist them. The host must atomically consume the start and recheck account liveness and generation before installing the sealed grant. Do not log callback URLs, credentials or errors from arbitrary provider middleware.
|
|
32
32
|
|
|
33
|
-
Construct a flow for each scheduled token operation, with that operation's sealed store and abort signal, call `accessToken`, and discard the flow at the end of the operation. A store scoped to one operation must never be retained for another worker. The host's durable lifecycle owns disconnect, purge, refresh exclusion across workers and revocation. `forget` on an independently held flow is not a cross-worker lifecycle operation.
|
|
33
|
+
Construct a flow for each scheduled token operation, with that operation's sealed store and abort signal, call `accessToken`, and discard the flow at the end of the operation. A store scoped to one operation must never be retained for another worker. The host's durable lifecycle owns disconnect, purge, refresh exclusion across workers and revocation. `forget` on an independently held flow is not a cross-worker lifecycle operation. `accessToken` checks the read-only scope, before Google is asked, on the grant its own call read in the key's turn, the one a refresh renews, so neither another writer between two reads nor calls for other keys can change its outcome; a token held in memory is used only while the store holds the grant it came with, refresh token and scope alike.
|
|
34
34
|
|
|
35
|
-
OAuth responses are capped at 65,536 bytes and must finish within 15 seconds. Parent cancellation stops dispatch and body consumption. Fixed `GmailOAuthFault` reasons contain no provider message or credential. When an exchange succeeds and `complete` does not return the grant, because the grant fails the checks or because the parent cancelled before `complete` returned, the flow asks Google to revoke the grant before it throws. That revocation has the same byte cap and a 15-second deadline of its own, and the parent's cancellation does not stop it. The fault's `cleanup` field then reads `confirmed` or `unconfirmed`. An unconfirmed outcome needs a provider-permission removal instruction. It does not authorize retaining the grant.
|
|
35
|
+
OAuth responses are capped at 65,536 bytes and must finish within 15 seconds. An answer past the cap is refused at once: the rest of Google's stream is cancelled without waiting for the cancellation to settle, and the Gmail API's answers are read the same way. Parent cancellation stops dispatch and body consumption. `revoke(token)` resolves when Google revokes the token, and when Google answers that the token is already expired or revoked: Google answers such a token with 400 and `invalid_token`, where RFC 7009 section 2.2 answers 200, and either way the token no longer works. So the revoke-only queue confirms the revocation of a grant the person already removed at Google rather than retrying it to its deadline and then asking for a permission removal. Revoke a grant's refresh token to end the grant: Google answers an expired access token the same way while its refresh token stays valid. Every other answer that is not a success throws `OAuthGrantRefused` with reason `revoke`. Fixed `GmailOAuthFault` reasons contain no provider message or credential. When an exchange succeeds and `complete` does not return the grant, because the grant fails the checks or because the parent cancelled before `complete` returned, the flow asks Google to revoke the grant before it throws. That revocation has the same byte cap and a 15-second deadline of its own, and the parent's cancellation does not stop it. The fault's `cleanup` field then reads `confirmed` or `unconfirmed`; Google's answer that the grant is already expired or revoked reads `confirmed`. An unconfirmed outcome needs a provider-permission removal instruction. It does not authorize retaining the grant.
|
|
36
36
|
|
|
37
37
|
The host supplies informed consent, cache permission, retention policy, account isolation and a truthful availability state. Authorization alone does not establish permission to store or send mailbox content to a model. Do not infer those permissions from this package's successful tests.
|
|
38
38
|
|
|
@@ -54,7 +54,7 @@ const filename = sanitizeMailMetadata(decodedFilename, { ...policy, maxOutputCha
|
|
|
54
54
|
|
|
55
55
|
`sanitizeMailText(input, policy)` removes address tokens and credential-shaped content without a network call. `sanitizeMailMetadata` applies the same rules and folds whitespace for filenames, label names and display fields. `sanitizeMailHeaders` retains only Subject, Date, From, To and Cc; its Subject output is capped at 200 characters. MIME header decoding and structural validation must happen before these functions receive strings. Bcc is never returned.
|
|
56
56
|
|
|
57
|
-
`policy` supplies `maxInputCharacters`, `maxLineCharacters` and `maxOutputCharacters` as positive UTF-16 code-unit counts. The input ceiling is 2,097,152 and the line ceiling is 65,536. The output cap cannot exceed the input cap. Oversized input throws `GmailTextFault` with a fixed reason; an overlong line is suppressed. Processing never scans only a truncated prefix for credentials.
|
|
57
|
+
`policy` supplies `maxInputCharacters`, `maxLineCharacters` and `maxOutputCharacters` as positive UTF-16 code-unit counts. The input ceiling is 2,097,152 and the line ceiling is 65,536. The output cap cannot exceed the input cap. Oversized input throws `GmailTextFault` with a fixed reason; an overlong line is suppressed. Processing never scans only a truncated prefix for credentials. Percent and character-reference decoding repeats at most four times, every named reference of the HTML standard and numeric references among them; a line that still holds an encoded byte or a known reference after those passes is removed. Padding, a run of spaces and invisible characters that holds anything other than ASCII spaces and tabs, such as the no-break spaces, zero-width non-joiners, combining grapheme joiners and braille blanks mail templates repeat after a preheader, becomes one space, or nothing when it holds no space at all, so zero-width characters between letters join them. Padding that holds an invisible character and ends a line leaves no space there; a run of no-break spaces alone keeps one, so a signature separator written with one still reads `-- `. Runs of ASCII spaces and tabs stay as written. Output truncation avoids splitting a surrogate pair and is marked in the result.
|
|
58
58
|
|
|
59
59
|
`messageText(input, policy)` sanitizes first, trims recognized reply history and short signatures, then applies the output cap. Explicit forwarded content and ambiguous prose are retained. Its `trimmedQuote`, `trimmedSignature` and `truncated` flags describe omissions. Quote spans must refer to its returned string, without inserted summaries or an ellipsis presented as source text. A host should disclose that attachments are listed and their contents are not read when its mapper implements that boundary.
|
|
60
60
|
|
|
@@ -87,12 +87,14 @@ Construct `GmailThreadMapper(bounds)` with explicit response, decoded-byte, MIME
|
|
|
87
87
|
Supply a fixed selection cutoff, message window, original read start and completion times, actual response cache headers, independently established cache permission and a host-generated relative detail path. The path must resolve authentication and current source generation in the host. It is never a Gmail deep link or a request-derived external URL. A successful OAuth grant does not establish cache or model-processing permission.
|
|
88
88
|
Pass `labelCache` as the separate labels response’s cache decision. Missing, refused or expired label permission keeps ids without names. Permitted names shorten the entire document’s expiry when their allowed lifetime ends first.
|
|
89
89
|
|
|
90
|
-
Each message is filtered by its internal timestamp and excluded labels. Retained messages are selected newest first with stable id ties, within the explicit cap, and rendered chronologically. Plain text wins within a MIME alternative. Other multipart containers retain their non-attachment text children in MIME order. HTML uses the public AgentOS `HtmlLoader` with an in-memory Buffer. No browser or remote resource is loaded. The resulting text, structured headers, filenames, media types and label names all pass the text sanitizer.
|
|
90
|
+
Each message is filtered by its internal timestamp and excluded labels. Retained messages are selected newest first with stable id ties, within the explicit cap, and rendered chronologically. Plain text wins within a MIME alternative. Other multipart containers retain their non-attachment text children in MIME order. HTML uses the public AgentOS `HtmlLoader` with an in-memory Buffer; every character reference the loader leaves is then decoded, padding collapses and whitespace collapses again, with at most one blank line between paragraphs. No browser or remote resource is loaded. The resulting text, structured headers, filenames, media types and label names all pass the text sanitizer.
|
|
91
91
|
|
|
92
92
|
Attachments are listed; their contents are not read. An external body or attachment contributes only sanitized filename, media type and size. Inline attachment bytes and attachment ids are discarded. Bcc, raw payloads, snippets and unknown fields are not returned. The mapper never calls any Gmail endpoint. Unsupported charset, invalid bytes and omitted content have fixed counted reasons. Invalid protocol shape is a failure rather than an empty successful source.
|
|
93
93
|
|
|
94
94
|
A returned document has matching item/ref versions, a normalized-content hash, message ids and body spans, earliest allowed expiry and explicit omission/truncation metadata. Spans count UTF-16 code units in the returned text and exclude the header prefix. Quote trimming preserves normalized source text; no generated summary or ellipsis is inserted into a quote. Header-only messages can have an empty body span. Render structured metadata as escaped text and treat all mail as untrusted data.
|
|
95
95
|
|
|
96
|
+
The version is the thread's history id and `contentHash`, the SHA-256 of the normalized text, metadata and message spans, so the hash is the field that carries a change to how text is normalized. A release that normalizes text differently changes the hash of exactly the threads whose normalized text, metadata or spans it changes. At the next read of such a thread, when history names it or a reconcile scan lists it, the account-source store finds a new version and writes the copy again. A thread whose history id, normalized text, metadata and message spans (each message's window end among them, so a changed `windowMs` changes the version too) are unchanged keeps its version, and the store, given a host's `refresh` binding, keeps that copy in place without embedding it again. No separate normalizer version is kept.
|
|
97
|
+
|
|
96
98
|
A history-only change does not extend cache life or change the normalized hash. Storage still requires the account-source transactional fence, fresh expiry checks and host allowances. Derived results retain the whole source's personal-use, expiry and deletion restrictions. Never persist the transient MIME types or bypass the account-source store with a mapper result.
|
|
97
99
|
|
|
98
100
|
## Read-only API
|
package/dist/GmailOAuthFlow.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* @fileoverview Google's read-only Gmail grant on the AgentOS redirect OAuth flow: the read-only scope alone, asked for
|
|
3
3
|
* offline and incrementally with consent, for registered callbacks only; granted scopes and refresh material checked
|
|
4
4
|
* before a grant is accepted; every token and revocation call capped at 65,536 bytes, bounded by one 15-second
|
|
5
|
-
* deadline and stopped by the caller's cancellation, except the revocation of a grant the flow will not hand back.
|
|
5
|
+
* deadline and stopped by the caller's cancellation, except the revocation of a grant the flow will not hand back. A
|
|
6
|
+
* token Google answers as already expired or revoked counts as revoked.
|
|
6
7
|
* @module agentos-ext-gmail-source/GmailOAuthFlow
|
|
7
8
|
*/
|
|
8
9
|
import { RedirectOAuthFlow, type IOAuthTokenStore, type OAuthTokenSet, type RedirectOAuthConfig, type RedirectBegin, type RedirectCompleteInput } from '@framers/agentos/auth';
|
|
@@ -22,6 +23,8 @@ export declare class GmailOAuthFlow extends RedirectOAuthFlow {
|
|
|
22
23
|
private readonly signal?;
|
|
23
24
|
/** The fetch and stand-in endpoints of a withheld grant's revocation, without the caller's signal. */
|
|
24
25
|
private readonly withheld;
|
|
26
|
+
/** Each `accessToken` call's own record of what its read of the store found. */
|
|
27
|
+
private readonly reads;
|
|
25
28
|
/**
|
|
26
29
|
* @param client The dedicated client and its registered callback addresses (one to sixteen).
|
|
27
30
|
* @param store Where the grant is kept, a namespaced `SealedTokenStore` on a server; null for a flow that only
|
|
@@ -60,19 +63,31 @@ export declare class GmailOAuthFlow extends RedirectOAuthFlow {
|
|
|
60
63
|
*/
|
|
61
64
|
private revokeWithheld;
|
|
62
65
|
/**
|
|
63
|
-
* Refreshes
|
|
64
|
-
*
|
|
66
|
+
* Refreshes the grant the core flow has just read in the key's turn for this `accessToken` call, once that read is
|
|
67
|
+
* found to hold the read-only scope alone (any other grant, or a refresh outside such a call, throws `scope` before
|
|
68
|
+
* Google is asked), then checks the answer: a scope it returns must be the read-only scope alone, and a refresh token
|
|
69
|
+
* it returns must be usable. An omitted scope keeps the kept grant's checked scope.
|
|
65
70
|
*/
|
|
66
71
|
protected refreshTokens(refreshToken: string): Promise<OAuthTokenSet>;
|
|
67
72
|
/** Keeps an accepted grant under `key` after the exchange's checks; the store receives its refresh token and scope. */
|
|
68
73
|
keep(key: string, tokens: OAuthTokenSet): Promise<void>;
|
|
69
74
|
/**
|
|
70
75
|
* An access token for the grant kept under `key`, refreshed when needed, only while the kept scope is the read-only
|
|
71
|
-
* scope alone.
|
|
72
|
-
*
|
|
76
|
+
* scope alone. Each call checks the scope of the grant its own read answered in the key's turn, the one a refresh
|
|
77
|
+
* renews, so neither another writer between two reads nor calls for other keys can change its outcome. A token held
|
|
78
|
+
* in memory is used only while the store holds the grant it came with, refresh token and scope alike, and a held grant
|
|
79
|
+
* always holds the read-only scope alone. Throws `OAuthGrantRefused` with reason `missing` when nothing is kept or the
|
|
80
|
+
* grant changes during the refresh, and with reason `refresh` when Google refuses it; `GmailOAuthFault` `scope` when
|
|
81
|
+
* the kept grant holds another scope.
|
|
73
82
|
*/
|
|
74
83
|
accessToken(key: string): Promise<string>;
|
|
75
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Revokes a token at Google. It resolves when Google revokes the token, and when Google answers that the token is
|
|
86
|
+
* already expired or revoked (400 with `invalid_token`), as RFC 7009 section 2.2 answers 200 for an invalid token:
|
|
87
|
+
* either way the token no longer works. Revoke a grant's refresh token to end the grant; Google answers an expired
|
|
88
|
+
* access token the same way while its refresh token stays valid. Any other answer that is not a success throws
|
|
89
|
+
* `OAuthGrantRefused` with reason `revoke`, the status and Google's error when it is an allowlisted OAuth error code.
|
|
90
|
+
*/
|
|
76
91
|
revoke(token: string): Promise<void>;
|
|
77
92
|
}
|
|
78
93
|
//# sourceMappingURL=GmailOAuthFlow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GmailOAuthFlow.d.ts","sourceRoot":"","sources":["../src/GmailOAuthFlow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"GmailOAuthFlow.d.ts","sourceRoot":"","sources":["../src/GmailOAuthFlow.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,iBAAiB,EAAqB,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAC/E,KAAK,mBAAmB,EAAE,KAAK,aAAa,EAAE,KAAK,qBAAqB,EACzE,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACkC,KAAK,gBAAgB,EAClC,KAAK,iBAAiB,EACjD,MAAM,YAAY,CAAC;AA6LpB;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AAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAUpD"}
|
package/dist/GmailOAuthFlow.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* @fileoverview Google's read-only Gmail grant on the AgentOS redirect OAuth flow: the read-only scope alone, asked for
|
|
3
3
|
* offline and incrementally with consent, for registered callbacks only; granted scopes and refresh material checked
|
|
4
4
|
* before a grant is accepted; every token and revocation call capped at 65,536 bytes, bounded by one 15-second
|
|
5
|
-
* deadline and stopped by the caller's cancellation, except the revocation of a grant the flow will not hand back.
|
|
5
|
+
* deadline and stopped by the caller's cancellation, except the revocation of a grant the flow will not hand back. A
|
|
6
|
+
* token Google answers as already expired or revoked counts as revoked.
|
|
6
7
|
* @module agentos-ext-gmail-source/GmailOAuthFlow
|
|
7
8
|
*/
|
|
9
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
8
10
|
import { RedirectOAuthFlow, OAuthGrantRefused, } from '@framers/agentos/auth';
|
|
9
11
|
import { readCapped, ReadCapExceeded } from '@framers/agentos-ext-account-sources';
|
|
10
12
|
import { GMAIL_READONLY_SCOPE, GmailOAuthFault, } from './types.js';
|
|
@@ -92,7 +94,8 @@ function abortable(work, signal, stopped, discard) {
|
|
|
92
94
|
function cancel(response) { void response.body?.cancel().catch(() => { }); }
|
|
93
95
|
/**
|
|
94
96
|
* Reads a body through the released byte cap. The bridge stream turns the signal's abort into a fixed fault, even
|
|
95
|
-
* while no bytes arrive, and passes a cancellation
|
|
97
|
+
* while no bytes arrive, and passes a cancellation on to the provider's stream without waiting for it to settle, so the
|
|
98
|
+
* cap's refusal and the deadline never wait on a stream whose cancellation does not end.
|
|
96
99
|
*/
|
|
97
100
|
async function boundedBody(response, signal, stopped) {
|
|
98
101
|
if (signal.aborted) {
|
|
@@ -136,10 +139,8 @@ async function boundedBody(response, signal, stopped) {
|
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
catch { /* No provider text escapes. */ } },
|
|
142
|
+
// Asked for, not awaited: `readCapped` awaits this cancellation before it throws past the cap.
|
|
143
|
+
cancel() { closed = true; void reader.cancel().catch(() => { }); },
|
|
143
144
|
});
|
|
144
145
|
try {
|
|
145
146
|
return await readCapped(new Response(bridge, { headers: response.headers }), maxBytes);
|
|
@@ -226,6 +227,33 @@ function normalize(tokens, refreshRequired, scopeRequired) {
|
|
|
226
227
|
return { accessToken: tokens.accessToken, refreshToken: tokens.refreshToken, expiresAt: tokens.expiresAt,
|
|
227
228
|
metadata: scope === undefined ? undefined : { scope: GMAIL_READONLY_SCOPE } };
|
|
228
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* The caller's store as the core flow reads it. A read made for an `accessToken` call notes on that call's own record
|
|
232
|
+
* whether the grant it answered holds the read-only scope alone. The core reads the grant and refreshes it in the key's
|
|
233
|
+
* turn, within the call, so the refresh checks the very grant it renews, whatever other calls read meanwhile. The
|
|
234
|
+
* record ends with its call; a read made for `forget` notes nothing.
|
|
235
|
+
*/
|
|
236
|
+
function notingStore(store, reads) {
|
|
237
|
+
return {
|
|
238
|
+
async load(key) {
|
|
239
|
+
const kept = await store.load(key);
|
|
240
|
+
const read = reads.getStore();
|
|
241
|
+
if (read !== undefined)
|
|
242
|
+
read.scopeOnly = kept !== null && scopeOnly(kept.metadata?.scope);
|
|
243
|
+
return kept;
|
|
244
|
+
},
|
|
245
|
+
save: (key, tokens) => store.save(key, tokens),
|
|
246
|
+
clear: (key) => store.clear(key),
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/** The `error` code an answer's JSON object names, and undefined for any other body. */
|
|
250
|
+
async function answeredError(response) {
|
|
251
|
+
const parsed = await response.json().catch(() => undefined);
|
|
252
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
|
|
253
|
+
return undefined;
|
|
254
|
+
const { error } = parsed;
|
|
255
|
+
return typeof error === 'string' ? error : undefined;
|
|
256
|
+
}
|
|
229
257
|
/**
|
|
230
258
|
* Google's read-only Gmail grant on the core redirect flow. `begin` asks for the read-only scope alone, offline, with
|
|
231
259
|
* incremental authorization and consent, for a registered callback; `complete` accepts only that scope with refresh
|
|
@@ -241,6 +269,8 @@ export class GmailOAuthFlow extends RedirectOAuthFlow {
|
|
|
241
269
|
signal;
|
|
242
270
|
/** The fetch and stand-in endpoints of a withheld grant's revocation, without the caller's signal. */
|
|
243
271
|
withheld;
|
|
272
|
+
/** Each `accessToken` call's own record of what its read of the store found. */
|
|
273
|
+
reads;
|
|
244
274
|
/**
|
|
245
275
|
* @param client The dedicated client and its registered callback addresses (one to sixteen).
|
|
246
276
|
* @param store Where the grant is kept, a namespaced `SealedTokenStore` on a server; null for a flow that only
|
|
@@ -250,7 +280,9 @@ export class GmailOAuthFlow extends RedirectOAuthFlow {
|
|
|
250
280
|
*/
|
|
251
281
|
constructor(client, store, options = {}) {
|
|
252
282
|
const chosen = selectedEndpoints(options);
|
|
253
|
-
|
|
283
|
+
const reads = new AsyncLocalStorage();
|
|
284
|
+
super(store === null ? null : notingStore(store, reads), oauthFetch(options, chosen));
|
|
285
|
+
this.reads = reads;
|
|
254
286
|
if (!tokenString(client.clientId) || !tokenString(client.clientSecret)
|
|
255
287
|
|| !Array.isArray(client.redirectUris) || client.redirectUris.length === 0 || client.redirectUris.length > 16) {
|
|
256
288
|
throw new GmailOAuthFault('configuration');
|
|
@@ -337,11 +369,15 @@ export class GmailOAuthFlow extends RedirectOAuthFlow {
|
|
|
337
369
|
}
|
|
338
370
|
}
|
|
339
371
|
/**
|
|
340
|
-
* Refreshes
|
|
341
|
-
*
|
|
372
|
+
* Refreshes the grant the core flow has just read in the key's turn for this `accessToken` call, once that read is
|
|
373
|
+
* found to hold the read-only scope alone (any other grant, or a refresh outside such a call, throws `scope` before
|
|
374
|
+
* Google is asked), then checks the answer: a scope it returns must be the read-only scope alone, and a refresh token
|
|
375
|
+
* it returns must be usable. An omitted scope keeps the kept grant's checked scope.
|
|
342
376
|
*/
|
|
343
377
|
async refreshTokens(refreshToken) {
|
|
344
378
|
this.active();
|
|
379
|
+
if (this.reads.getStore()?.scopeOnly !== true)
|
|
380
|
+
throw new GmailOAuthFault('scope');
|
|
345
381
|
const tokens = normalize(await super.refreshTokens(refreshToken), false, false);
|
|
346
382
|
this.active();
|
|
347
383
|
return tokens;
|
|
@@ -354,28 +390,39 @@ export class GmailOAuthFlow extends RedirectOAuthFlow {
|
|
|
354
390
|
}
|
|
355
391
|
/**
|
|
356
392
|
* An access token for the grant kept under `key`, refreshed when needed, only while the kept scope is the read-only
|
|
357
|
-
* scope alone.
|
|
358
|
-
*
|
|
393
|
+
* scope alone. Each call checks the scope of the grant its own read answered in the key's turn, the one a refresh
|
|
394
|
+
* renews, so neither another writer between two reads nor calls for other keys can change its outcome. A token held
|
|
395
|
+
* in memory is used only while the store holds the grant it came with, refresh token and scope alike, and a held grant
|
|
396
|
+
* always holds the read-only scope alone. Throws `OAuthGrantRefused` with reason `missing` when nothing is kept or the
|
|
397
|
+
* grant changes during the refresh, and with reason `refresh` when Google refuses it; `GmailOAuthFault` `scope` when
|
|
398
|
+
* the kept grant holds another scope.
|
|
359
399
|
*/
|
|
360
400
|
async accessToken(key) {
|
|
361
401
|
this.active();
|
|
362
402
|
if (this.store === null)
|
|
363
403
|
throw new GmailOAuthFault('configuration');
|
|
364
|
-
const
|
|
365
|
-
if (saved === null)
|
|
366
|
-
throw new OAuthGrantRefused('missing');
|
|
367
|
-
if (!scopeOnly(saved.metadata?.scope))
|
|
368
|
-
throw new GmailOAuthFault('scope');
|
|
369
|
-
const token = await super.accessToken(key);
|
|
404
|
+
const token = await this.reads.run({}, () => super.accessToken(key));
|
|
370
405
|
this.active();
|
|
371
406
|
return token;
|
|
372
407
|
}
|
|
373
|
-
/**
|
|
408
|
+
/**
|
|
409
|
+
* Revokes a token at Google. It resolves when Google revokes the token, and when Google answers that the token is
|
|
410
|
+
* already expired or revoked (400 with `invalid_token`), as RFC 7009 section 2.2 answers 200 for an invalid token:
|
|
411
|
+
* either way the token no longer works. Revoke a grant's refresh token to end the grant; Google answers an expired
|
|
412
|
+
* access token the same way while its refresh token stays valid. Any other answer that is not a success throws
|
|
413
|
+
* `OAuthGrantRefused` with reason `revoke`, the status and Google's error when it is an allowlisted OAuth error code.
|
|
414
|
+
*/
|
|
374
415
|
async revoke(token) {
|
|
375
416
|
this.active();
|
|
376
417
|
if (!tokenString(token))
|
|
377
418
|
throw new GmailOAuthFault('configuration');
|
|
378
|
-
await
|
|
419
|
+
const response = await this.fetchImpl(this.endpoints.revoke, { method: 'POST',
|
|
420
|
+
headers: { 'content-type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams({ token }).toString() });
|
|
421
|
+
if (!response.ok) {
|
|
422
|
+
const error = await answeredError(response);
|
|
423
|
+
if (response.status !== 400 || error !== 'invalid_token')
|
|
424
|
+
throw new OAuthGrantRefused('revoke', response.status, error);
|
|
425
|
+
}
|
|
379
426
|
this.active();
|
|
380
427
|
}
|
|
381
428
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GmailOAuthFlow.js","sourceRoot":"","sources":["../src/GmailOAuthFlow.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,iBAAiB,EAAE,iBAAiB,GAErC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EACL,oBAAoB,EAAE,eAAe,GAEtC,MAAM,YAAY,CAAC;AAEpB,yEAAyE;AACzE,MAAM,SAAS,GAAwB,MAAM,CAAC,MAAM,CAAC;IACnD,aAAa,EAAE,8CAA8C;IAC7D,KAAK,EAAE,qCAAqC;IAC5C,MAAM,EAAE,sCAAsC;CAC/C,CAAC,CAAC;AACH,+CAA+C;AAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC;AACxB,+DAA+D;AAC/D,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1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AAO,KAAK,CAAC;IACpG,CAAC;IACD;;;;;;OAMG;IACM,KAAK,CAAC,MAAM,CAAC,KAAa;QACjC,IAAI,CAAC,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YAAE,MAAM,IAAI,eAAe,CAAC,eAAe,CAAC,CAAC;QACnF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM;YAC3E,OAAO,EAAE,EAAE,cAAc,EAAE,mCAAmC,EAAE,EAAE,IAAI,EAAE,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACvH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,KAAK,KAAK,eAAe;gBAAE,MAAM,IAAI,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC1H,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview One pass of character-reference decoding and the collapse of padding runs, shared by the HTML reader
|
|
3
|
+
* and the text sanitizer. A named reference is read from the HTML standard's table, and a numeric one when it names a
|
|
4
|
+
* Unicode scalar value. Padding is what mail templates repeat after a preheader so that a client's preview shows
|
|
5
|
+
* nothing more of the body: no-break spaces, zero-width non-joiners, combining grapheme joiners and braille blanks.
|
|
6
|
+
* Nothing here logs or fetches.
|
|
7
|
+
* @module agentos-ext-gmail-source/characters
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Decodes each character reference in `text` once, in one left-to-right pass: a named reference the HTML standard's
|
|
11
|
+
* table holds, and a decimal or hexadecimal one that names a Unicode scalar value. Any other reference stays as
|
|
12
|
+
* written, `&constructor;` and a number past U+10FFFF or naming a surrogate among them. Decoding never lengthens the
|
|
13
|
+
* text.
|
|
14
|
+
*
|
|
15
|
+
* @param text Any text: an HTML body after its tags are removed, a plain body or a header value.
|
|
16
|
+
* @returns The text with its known references replaced by the characters they stand for.
|
|
17
|
+
*/
|
|
18
|
+
export declare function decodeCharacterReferences(text: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether `text` still holds a named reference the table decodes, as text nested deeper than the decoding passes
|
|
21
|
+
* does. One scan, each name looked up once.
|
|
22
|
+
*
|
|
23
|
+
* @param text One line of decoded text.
|
|
24
|
+
*/
|
|
25
|
+
export declare function holdsNamedReference(text: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Collapses each run of spaces and invisible characters that holds anything other than ASCII spaces and tabs: to one
|
|
28
|
+
* space when the run holds a character with the width of a space (a no-break or other Unicode space, a tab or a
|
|
29
|
+
* braille blank), and to nothing when it holds only invisible characters, so zero-width characters between letters
|
|
30
|
+
* join them. A run that holds an invisible character and ends a line or the text also becomes nothing, so a
|
|
31
|
+
* preheader's padding leaves no space at the end of its line; a run of no-break spaces alone keeps its one space
|
|
32
|
+
* there, so a signature separator written with one still reads `-- `. A run of ASCII spaces and tabs alone stays as
|
|
33
|
+
* written, so a plain body keeps its indentation and alignment.
|
|
34
|
+
*
|
|
35
|
+
* @param text Text whose character references are already decoded.
|
|
36
|
+
* @returns The text with each padding run collapsed.
|
|
37
|
+
*/
|
|
38
|
+
export declare function collapsePadding(text: string): string;
|
|
39
|
+
//# sourceMappingURL=characters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"characters.d.ts","sourceRoot":"","sources":["../src/characters.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAwBH;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ9D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKzD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOpD"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview One pass of character-reference decoding and the collapse of padding runs, shared by the HTML reader
|
|
3
|
+
* and the text sanitizer. A named reference is read from the HTML standard's table, and a numeric one when it names a
|
|
4
|
+
* Unicode scalar value. Padding is what mail templates repeat after a preheader so that a client's preview shows
|
|
5
|
+
* nothing more of the body: no-break spaces, zero-width non-joiners, combining grapheme joiners and braille blanks.
|
|
6
|
+
* Nothing here logs or fetches.
|
|
7
|
+
* @module agentos-ext-gmail-source/characters
|
|
8
|
+
*/
|
|
9
|
+
import { HTML_NAMED_REFERENCES } from './htmlNamedReferences.js';
|
|
10
|
+
// The standard's names, with `‐` read as the ASCII hyphen-minus, as this sanitizer has read it since its first
|
|
11
|
+
// release, so a credential prefix spelled with it is still recognized. A Map, so no name reads an object's prototype.
|
|
12
|
+
const names = new Map([...Object.entries(HTML_NAMED_REFERENCES), ['hyphen', '-']]);
|
|
13
|
+
// A hexadecimal, decimal or named reference that ends with a semicolon.
|
|
14
|
+
const reference = /&(#x[0-9a-f]+|#[0-9]+|[a-z][a-z0-9]+);/gi;
|
|
15
|
+
// A named reference that ends with a semicolon.
|
|
16
|
+
const namedReference = /&([a-z][a-z0-9]+);/gi;
|
|
17
|
+
// A run of horizontal spaces and invisible characters: tabs, every space separator (the no-break spaces among them),
|
|
18
|
+
// the braille blank, every format character (the zero-width space, the joiners, the word joiner, the byte order mark,
|
|
19
|
+
// the soft hyphen and the direction marks among them) and the combining grapheme joiner.
|
|
20
|
+
const paddingRun = /[\t\p{Zs}\u2800\p{Cf}\u034f]+/gu;
|
|
21
|
+
// A character of such a run that takes up the width of a space.
|
|
22
|
+
const spacing = /[\t\p{Zs}\u2800]/u;
|
|
23
|
+
// A character of such a run with no width of its own.
|
|
24
|
+
const invisible = /[\p{Cf}\u034f]/u;
|
|
25
|
+
// A line break, which ends a line.
|
|
26
|
+
const lineBreak = /[\n\r\u2028\u2029]/;
|
|
27
|
+
// A run of ASCII spaces and tabs alone.
|
|
28
|
+
const asciiSpacing = /^[ \t]+$/;
|
|
29
|
+
/**
|
|
30
|
+
* Decodes each character reference in `text` once, in one left-to-right pass: a named reference the HTML standard's
|
|
31
|
+
* table holds, and a decimal or hexadecimal one that names a Unicode scalar value. Any other reference stays as
|
|
32
|
+
* written, `&constructor;` and a number past U+10FFFF or naming a surrogate among them. Decoding never lengthens the
|
|
33
|
+
* text.
|
|
34
|
+
*
|
|
35
|
+
* @param text Any text: an HTML body after its tags are removed, a plain body or a header value.
|
|
36
|
+
* @returns The text with its known references replaced by the characters they stand for.
|
|
37
|
+
*/
|
|
38
|
+
export function decodeCharacterReferences(text) {
|
|
39
|
+
return text.replace(reference, (whole, entity) => {
|
|
40
|
+
if (!entity.startsWith('#'))
|
|
41
|
+
return names.get(entity) ?? whole;
|
|
42
|
+
const hex = entity[1]?.toLowerCase() === 'x';
|
|
43
|
+
const point = Number.parseInt(entity.slice(hex ? 2 : 1), hex ? 16 : 10);
|
|
44
|
+
return Number.isSafeInteger(point) && point >= 0 && point <= 0x10ffff && !(point >= 0xd800 && point <= 0xdfff)
|
|
45
|
+
? String.fromCodePoint(point) : whole;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether `text` still holds a named reference the table decodes, as text nested deeper than the decoding passes
|
|
50
|
+
* does. One scan, each name looked up once.
|
|
51
|
+
*
|
|
52
|
+
* @param text One line of decoded text.
|
|
53
|
+
*/
|
|
54
|
+
export function holdsNamedReference(text) {
|
|
55
|
+
for (const match of text.matchAll(namedReference)) {
|
|
56
|
+
if (names.has(match[1] ?? ''))
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Collapses each run of spaces and invisible characters that holds anything other than ASCII spaces and tabs: to one
|
|
63
|
+
* space when the run holds a character with the width of a space (a no-break or other Unicode space, a tab or a
|
|
64
|
+
* braille blank), and to nothing when it holds only invisible characters, so zero-width characters between letters
|
|
65
|
+
* join them. A run that holds an invisible character and ends a line or the text also becomes nothing, so a
|
|
66
|
+
* preheader's padding leaves no space at the end of its line; a run of no-break spaces alone keeps its one space
|
|
67
|
+
* there, so a signature separator written with one still reads `-- `. A run of ASCII spaces and tabs alone stays as
|
|
68
|
+
* written, so a plain body keeps its indentation and alignment.
|
|
69
|
+
*
|
|
70
|
+
* @param text Text whose character references are already decoded.
|
|
71
|
+
* @returns The text with each padding run collapsed.
|
|
72
|
+
*/
|
|
73
|
+
export function collapsePadding(text) {
|
|
74
|
+
return text.replace(paddingRun, (run, offset) => {
|
|
75
|
+
if (asciiSpacing.test(run))
|
|
76
|
+
return run;
|
|
77
|
+
if (!spacing.test(run))
|
|
78
|
+
return '';
|
|
79
|
+
const end = offset + run.length;
|
|
80
|
+
return invisible.test(run) && (end === text.length || lineBreak.test(text.charAt(end))) ? '' : ' ';
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=characters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"characters.js","sourceRoot":"","sources":["../src/characters.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,sHAAsH;AACtH,sHAAsH;AACtH,MAAM,KAAK,GAAG,IAAI,GAAG,CAAiB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AACnG,wEAAwE;AACxE,MAAM,SAAS,GAAG,0CAA0C,CAAC;AAC7D,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M,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAsBlG;;;;;;;;;;;;OAYG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAC3D,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgB9E;;;;;;;;;;;OAWG;IACG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAC1E,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA8BvD;;;;;;;;OAQG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAmB7F"}
|
package/dist/gmail.js
CHANGED
|
@@ -106,7 +106,8 @@ function abortable(work, signal, stopped, discard) {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
// Reads a body through the released byte cap. The bridge turns an abort into a fixed fault even while no bytes
|
|
109
|
-
// arrive, and passes cancellation
|
|
109
|
+
// arrive, and passes cancellation on to the provider's stream without waiting for it to settle, so the cap's refusal
|
|
110
|
+
// and the deadline never wait on a stream whose cancellation does not end.
|
|
110
111
|
async function bodyBytes(response, maximum, signal, stopped) {
|
|
111
112
|
if (signal.aborted) {
|
|
112
113
|
cancel(response);
|
|
@@ -149,10 +150,8 @@ async function bodyBytes(response, maximum, signal, stopped) {
|
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
catch { /* Fixed fault only. */ } },
|
|
153
|
+
// Asked for, not awaited: `readCapped` awaits this cancellation before it throws past the cap.
|
|
154
|
+
cancel() { closed = true; void reader.cancel().catch(() => { }); },
|
|
156
155
|
});
|
|
157
156
|
try {
|
|
158
157
|
return await readCapped(new Response(bridge, { headers: response.headers }), maximum);
|