@open-everywhere/provider-notion 0.1.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/LICENSE +201 -0
- package/NOTICE +21 -0
- package/README.md +48 -0
- package/agent/channels/notion-acting-identity.ts +88 -0
- package/agent/channels/notion-ancestry-trust.ts +458 -0
- package/agent/channels/notion-api.ts +1290 -0
- package/agent/channels/notion-bot-user.ts +250 -0
- package/agent/channels/notion-catch-up.ts +339 -0
- package/agent/channels/notion-credentials.ts +417 -0
- package/agent/channels/notion-engagement.ts +372 -0
- package/agent/channels/notion-event-normalizer.ts +587 -0
- package/agent/channels/notion-identity.ts +271 -0
- package/agent/channels/notion-ingress-drain.ts +289 -0
- package/agent/channels/notion-ingress.ts +182 -0
- package/agent/channels/notion-message-ops.ts +140 -0
- package/agent/channels/notion-origin-codec.ts +38 -0
- package/agent/channels/notion-post-arm.ts +189 -0
- package/agent/channels/notion-question-return.ts +223 -0
- package/agent/channels/notion-read.ts +283 -0
- package/agent/channels/notion-scope.ts +560 -0
- package/agent/channels/notion-stop.ts +169 -0
- package/agent/channels/notion-supervisor.ts +856 -0
- package/agent/channels/notion-webhook-timing.ts +131 -0
- package/agent/channels/notion-webhook-verifier.ts +55 -0
- package/agent/channels/notion-webhook.ts +963 -0
- package/agent/channels/notion-work-search.ts +74 -0
- package/agent/channels/notion-work.ts +144 -0
- package/agent/channels/notion.ts +1242 -0
- package/agent/contributions.ts +39 -0
- package/agent/docs-generated.ts +15 -0
- package/agent/memory/blocks.ts +295 -0
- package/agent/memory/memory.ts +622 -0
- package/agent/provider-events.ts +198 -0
- package/agent/register.ts +144 -0
- package/agent/schedules/notion-ingress.ts +20 -0
- package/agent/surface-parity.ts +105 -0
- package/agent/tools/notion_search.ts +110 -0
- package/agent/tools/read_notion_comments.ts +250 -0
- package/agent/tools/read_notion_page.ts +351 -0
- package/dist/agent/channels/notion-acting-identity.d.ts +23 -0
- package/dist/agent/channels/notion-acting-identity.d.ts.map +1 -0
- package/dist/agent/channels/notion-acting-identity.js +85 -0
- package/dist/agent/channels/notion-acting-identity.js.map +1 -0
- package/dist/agent/channels/notion-ancestry-trust.d.ts +208 -0
- package/dist/agent/channels/notion-ancestry-trust.d.ts.map +1 -0
- package/dist/agent/channels/notion-ancestry-trust.js +331 -0
- package/dist/agent/channels/notion-ancestry-trust.js.map +1 -0
- package/dist/agent/channels/notion-api.d.ts +655 -0
- package/dist/agent/channels/notion-api.d.ts.map +1 -0
- package/dist/agent/channels/notion-api.js +938 -0
- package/dist/agent/channels/notion-api.js.map +1 -0
- package/dist/agent/channels/notion-bot-user.d.ts +107 -0
- package/dist/agent/channels/notion-bot-user.d.ts.map +1 -0
- package/dist/agent/channels/notion-bot-user.js +192 -0
- package/dist/agent/channels/notion-bot-user.js.map +1 -0
- package/dist/agent/channels/notion-catch-up.d.ts +64 -0
- package/dist/agent/channels/notion-catch-up.d.ts.map +1 -0
- package/dist/agent/channels/notion-catch-up.js +289 -0
- package/dist/agent/channels/notion-catch-up.js.map +1 -0
- package/dist/agent/channels/notion-credentials.d.ts +210 -0
- package/dist/agent/channels/notion-credentials.d.ts.map +1 -0
- package/dist/agent/channels/notion-credentials.js +360 -0
- package/dist/agent/channels/notion-credentials.js.map +1 -0
- package/dist/agent/channels/notion-engagement.d.ts +219 -0
- package/dist/agent/channels/notion-engagement.d.ts.map +1 -0
- package/dist/agent/channels/notion-engagement.js +283 -0
- package/dist/agent/channels/notion-engagement.js.map +1 -0
- package/dist/agent/channels/notion-event-normalizer.d.ts +194 -0
- package/dist/agent/channels/notion-event-normalizer.d.ts.map +1 -0
- package/dist/agent/channels/notion-event-normalizer.js +542 -0
- package/dist/agent/channels/notion-event-normalizer.js.map +1 -0
- package/dist/agent/channels/notion-identity.d.ts +119 -0
- package/dist/agent/channels/notion-identity.d.ts.map +1 -0
- package/dist/agent/channels/notion-identity.js +205 -0
- package/dist/agent/channels/notion-identity.js.map +1 -0
- package/dist/agent/channels/notion-ingress-drain.d.ts +66 -0
- package/dist/agent/channels/notion-ingress-drain.d.ts.map +1 -0
- package/dist/agent/channels/notion-ingress-drain.js +185 -0
- package/dist/agent/channels/notion-ingress-drain.js.map +1 -0
- package/dist/agent/channels/notion-ingress.d.ts +64 -0
- package/dist/agent/channels/notion-ingress.d.ts.map +1 -0
- package/dist/agent/channels/notion-ingress.js +130 -0
- package/dist/agent/channels/notion-ingress.js.map +1 -0
- package/dist/agent/channels/notion-message-ops.d.ts +3 -0
- package/dist/agent/channels/notion-message-ops.d.ts.map +1 -0
- package/dist/agent/channels/notion-message-ops.js +126 -0
- package/dist/agent/channels/notion-message-ops.js.map +1 -0
- package/dist/agent/channels/notion-origin-codec.d.ts +7 -0
- package/dist/agent/channels/notion-origin-codec.d.ts.map +1 -0
- package/dist/agent/channels/notion-origin-codec.js +32 -0
- package/dist/agent/channels/notion-origin-codec.js.map +1 -0
- package/dist/agent/channels/notion-post-arm.d.ts +3 -0
- package/dist/agent/channels/notion-post-arm.d.ts.map +1 -0
- package/dist/agent/channels/notion-post-arm.js +185 -0
- package/dist/agent/channels/notion-post-arm.js.map +1 -0
- package/dist/agent/channels/notion-question-return.d.ts +77 -0
- package/dist/agent/channels/notion-question-return.d.ts.map +1 -0
- package/dist/agent/channels/notion-question-return.js +183 -0
- package/dist/agent/channels/notion-question-return.js.map +1 -0
- package/dist/agent/channels/notion-read.d.ts +62 -0
- package/dist/agent/channels/notion-read.d.ts.map +1 -0
- package/dist/agent/channels/notion-read.js +257 -0
- package/dist/agent/channels/notion-read.js.map +1 -0
- package/dist/agent/channels/notion-scope.d.ts +188 -0
- package/dist/agent/channels/notion-scope.d.ts.map +1 -0
- package/dist/agent/channels/notion-scope.js +433 -0
- package/dist/agent/channels/notion-scope.js.map +1 -0
- package/dist/agent/channels/notion-stop.d.ts +48 -0
- package/dist/agent/channels/notion-stop.d.ts.map +1 -0
- package/dist/agent/channels/notion-stop.js +141 -0
- package/dist/agent/channels/notion-stop.js.map +1 -0
- package/dist/agent/channels/notion-supervisor.d.ts +462 -0
- package/dist/agent/channels/notion-supervisor.d.ts.map +1 -0
- package/dist/agent/channels/notion-supervisor.js +482 -0
- package/dist/agent/channels/notion-supervisor.js.map +1 -0
- package/dist/agent/channels/notion-webhook-timing.d.ts +35 -0
- package/dist/agent/channels/notion-webhook-timing.d.ts.map +1 -0
- package/dist/agent/channels/notion-webhook-timing.js +99 -0
- package/dist/agent/channels/notion-webhook-timing.js.map +1 -0
- package/dist/agent/channels/notion-webhook-verifier.d.ts +5 -0
- package/dist/agent/channels/notion-webhook-verifier.d.ts.map +1 -0
- package/dist/agent/channels/notion-webhook-verifier.js +53 -0
- package/dist/agent/channels/notion-webhook-verifier.js.map +1 -0
- package/dist/agent/channels/notion-webhook.d.ts +242 -0
- package/dist/agent/channels/notion-webhook.d.ts.map +1 -0
- package/dist/agent/channels/notion-webhook.js +675 -0
- package/dist/agent/channels/notion-webhook.js.map +1 -0
- package/dist/agent/channels/notion-work-search.d.ts +9 -0
- package/dist/agent/channels/notion-work-search.d.ts.map +1 -0
- package/dist/agent/channels/notion-work-search.js +69 -0
- package/dist/agent/channels/notion-work-search.js.map +1 -0
- package/dist/agent/channels/notion-work.d.ts +68 -0
- package/dist/agent/channels/notion-work.d.ts.map +1 -0
- package/dist/agent/channels/notion-work.js +126 -0
- package/dist/agent/channels/notion-work.js.map +1 -0
- package/dist/agent/channels/notion.d.ts +95 -0
- package/dist/agent/channels/notion.d.ts.map +1 -0
- package/dist/agent/channels/notion.js +1081 -0
- package/dist/agent/channels/notion.js.map +1 -0
- package/dist/agent/contributions.d.ts +32 -0
- package/dist/agent/contributions.d.ts.map +1 -0
- package/dist/agent/contributions.js +37 -0
- package/dist/agent/contributions.js.map +1 -0
- package/dist/agent/docs-generated.d.ts +3 -0
- package/dist/agent/docs-generated.d.ts.map +1 -0
- package/dist/agent/docs-generated.js +13 -0
- package/dist/agent/docs-generated.js.map +1 -0
- package/dist/agent/memory/blocks.d.ts +58 -0
- package/dist/agent/memory/blocks.d.ts.map +1 -0
- package/dist/agent/memory/blocks.js +264 -0
- package/dist/agent/memory/blocks.js.map +1 -0
- package/dist/agent/memory/memory.d.ts +157 -0
- package/dist/agent/memory/memory.d.ts.map +1 -0
- package/dist/agent/memory/memory.js +471 -0
- package/dist/agent/memory/memory.js.map +1 -0
- package/dist/agent/provider-events.d.ts +3 -0
- package/dist/agent/provider-events.d.ts.map +1 -0
- package/dist/agent/provider-events.js +196 -0
- package/dist/agent/provider-events.js.map +1 -0
- package/dist/agent/register.d.ts +5 -0
- package/dist/agent/register.d.ts.map +1 -0
- package/dist/agent/register.js +128 -0
- package/dist/agent/register.js.map +1 -0
- package/dist/agent/schedules/notion-ingress.d.ts +6 -0
- package/dist/agent/schedules/notion-ingress.d.ts.map +1 -0
- package/dist/agent/schedules/notion-ingress.js +16 -0
- package/dist/agent/schedules/notion-ingress.js.map +1 -0
- package/dist/agent/surface-parity.d.ts +3 -0
- package/dist/agent/surface-parity.d.ts.map +1 -0
- package/dist/agent/surface-parity.js +99 -0
- package/dist/agent/surface-parity.js.map +1 -0
- package/dist/agent/tools/notion_search.d.ts +56 -0
- package/dist/agent/tools/notion_search.d.ts.map +1 -0
- package/dist/agent/tools/notion_search.js +100 -0
- package/dist/agent/tools/notion_search.js.map +1 -0
- package/dist/agent/tools/read_notion_comments.d.ts +57 -0
- package/dist/agent/tools/read_notion_comments.d.ts.map +1 -0
- package/dist/agent/tools/read_notion_comments.js +236 -0
- package/dist/agent/tools/read_notion_comments.js.map +1 -0
- package/dist/agent/tools/read_notion_page.d.ts +53 -0
- package/dist/agent/tools/read_notion_page.d.ts.map +1 -0
- package/dist/agent/tools/read_notion_page.js +327 -0
- package/dist/agent/tools/read_notion_page.js.map +1 -0
- package/package.json +231 -0
- package/tsconfig.build.json +22 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-api.js","sourceRoot":"","sources":["../../../agent/channels/notion-api.ts"],"names":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ED,KAAK,UAAU,QAAQ,CAAC,GAAa;IACnC,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type ResolvedNotionCredential } from "./notion-api.js";
|
|
2
|
+
/**
|
|
3
|
+
* EVERY bot user id this deployment posts under, and whether the set is COMPLETE (OPE-1921).
|
|
4
|
+
*
|
|
5
|
+
* 🔴 ONE ID IS NOT THE DEPLOYMENT'S IDENTITY WHEN IT RUNS TWO INTEGRATIONS. Each Notion integration
|
|
6
|
+
* has its own bot user id. The loop guard used to compare a comment against the id of the ONE
|
|
7
|
+
* integration whose secret verified that delivery, so a reply posted by integration A and delivered
|
|
8
|
+
* on integration B's subscription carried a real id that matched nothing. It read as a person, woke a
|
|
9
|
+
* turn, and A's subscription then saw B's answer — a loop the OPE-1906 once-guard cannot bound,
|
|
10
|
+
* because every reply is a new comment id.
|
|
11
|
+
*
|
|
12
|
+
* `all` is what a self-check compares against; `primary` is the VERIFYING integration's own id, kept
|
|
13
|
+
* separate because the addressed path is still that integration's (a structured @mention names one
|
|
14
|
+
* bot user, not a deployment).
|
|
15
|
+
*
|
|
16
|
+
* 🔴 `complete` IS THE FAIL-CLOSED INPUT, AND IT IS FALSE WHENEVER ONE CONFIGURED INTEGRATION'S ID
|
|
17
|
+
* DID NOT RESOLVE. Notion serves a comment's `created_by` as a PARTIAL user with no `type`
|
|
18
|
+
* (OPE-1857), so an unresolved sibling leaves a real authored comment that NOTHING can attribute:
|
|
19
|
+
* it is either a person or our own second integration, and the payload cannot say which. The guard
|
|
20
|
+
* therefore drops it — see {@link NotionOwnBotIds.complete} for what that costs.
|
|
21
|
+
*/
|
|
22
|
+
export interface NotionOwnBotIds {
|
|
23
|
+
/** The bot user id of the integration this delivery VERIFIED under, or undefined when it did not
|
|
24
|
+
* resolve. An absent primary is the pre-existing fail-closed arm and still drops on its own. */
|
|
25
|
+
readonly primary: string | undefined;
|
|
26
|
+
/** Every bot user id this deployment could resolve, `primary` included. A comment whose author id
|
|
27
|
+
* is in here is OUR OWN WORDS, whichever integration posted it. */
|
|
28
|
+
readonly all: ReadonlySet<string>;
|
|
29
|
+
/**
|
|
30
|
+
* True when EVERY configured integration's bot user id resolved. False ⇒ the self-check cannot
|
|
31
|
+
* answer "is this ours" for an author it does not recognise, and the loop guard fails CLOSED.
|
|
32
|
+
*
|
|
33
|
+
* 🔴 THE COST, STATED PLAINLY: an integration that CAN reach Notion but whose `GET /v1/users/me`
|
|
34
|
+
* fails makes the whole deployment deaf to every Notion comment Notion does not mark
|
|
35
|
+
* `person`-authored — on every page, including pages the healthy integration serves. That is NOT
|
|
36
|
+
* only ambient chatter: `classifyNotionComment` step 5 sits ABOVE the addressed arms, so an
|
|
37
|
+
* addressed name-drop and an `oe link <code>` identity claim drop with it. And
|
|
38
|
+
* `resolveNotionBotUser` caches a failure for the PROCESS
|
|
39
|
+
* LIFETIME, so a single rate-limit episode during the first resolve silences that instance until
|
|
40
|
+
* it restarts. That is the direction this repository takes everywhere else on this guard (an
|
|
41
|
+
* identity we cannot establish never wakes the agent), and the alternative is worse: a fail-open
|
|
42
|
+
* sibling is an unbounded reply loop between two integrations of one deployment, on a launch
|
|
43
|
+
* surface, with no once-guard able to stop it.
|
|
44
|
+
* The cost is bounded to integrations that could actually have posted — an integration with no
|
|
45
|
+
* usable key never sets this false. See `collectNotionOwnBotIds`'s `canPost`.
|
|
46
|
+
*/
|
|
47
|
+
readonly complete: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Resolve the deployment's own bot user ids: the already-resolved `primary`, plus one per entry of
|
|
51
|
+
* `siblingCredentialIds` — every CONFIGURED INTEGRATION EXCEPT the one this delivery verified under.
|
|
52
|
+
* The resolver is the SAME per-credential one and cache the loop guard already reads, so no second
|
|
53
|
+
* spelling of one identity can exist.
|
|
54
|
+
*
|
|
55
|
+
* 🔴 THE ADDED INGRESS COST, EXACTLY: N-1 extra `GET /v1/users/me` calls for N configured
|
|
56
|
+
* integrations, on the FIRST delivery of a process, and ZERO after it —
|
|
57
|
+
* {@link resolveNotionBotUser} memoises on the credential id. The verifying integration is excluded
|
|
58
|
+
* here precisely so the number is N-1 and not N: its id is already in hand, and re-resolving it
|
|
59
|
+
* would charge a live resolver for an answer the caller just took. A SINGLE-INTEGRATION deployment —
|
|
60
|
+
* every deployment before OPE-1921 — therefore pays NOTHING at all, and `notion-test.ts`'s
|
|
61
|
+
* ack-attribution fixture measures that: its `botTriggerPage` bucket is unchanged.
|
|
62
|
+
*
|
|
63
|
+
* A resolver that THROWS counts as unresolved rather than failing the delivery: this runs on the
|
|
64
|
+
* awaited ingress path, and a thrown identity lookup must not turn into a 500 Notion will retry.
|
|
65
|
+
*
|
|
66
|
+
* 🔴 AN INTEGRATION THAT CANNOT POST IS NOT A LOOP RISK, AND MARKING THE SET INCOMPLETE FOR ONE IS
|
|
67
|
+
* PURE AVAILABILITY LOSS. `resolve` answers `undefined` for two different failures: a working key
|
|
68
|
+
* whose `GET /v1/users/me` failed — that integration CAN post, so we must fail closed — and an
|
|
69
|
+
* integration THIS DEPLOYMENT holds no usable API key for, so it cannot post FROM HERE. `canPost`
|
|
70
|
+
* separates them, and it is consulted ONLY when `resolve` came back empty, so the ordinary path
|
|
71
|
+
* pays nothing for it. Without the split, a domain whose credential is declared but whose secret is
|
|
72
|
+
* unset or revoked would silence Notion on EVERY page of the deployment, including pages
|
|
73
|
+
* the healthy org-default integration serves — a blast radius nothing buys. Absent ⇒ every
|
|
74
|
+
* unresolved sibling is treated as able to post, which is the conservative reading.
|
|
75
|
+
*
|
|
76
|
+
* 🔴 THE CLAIM IS "NOT A LOOP RISK FROM HERE", NEVER "CANNOT HAVE AUTHORED ANY COMMENT", and the
|
|
77
|
+
* difference is real. `canPost` establishes only that THIS deployment cannot resolve a key for that
|
|
78
|
+
* credential right now. A token an operator deleted here, or one another environment still holds,
|
|
79
|
+
* can keep authoring comments on the shared page — and this deployment then reads those replies as a
|
|
80
|
+
* person's, because that id is absent from `all` while `complete` stays true. The residual is
|
|
81
|
+
* accepted: a loop needs two of OUR OWN integrations answering each other, and an integration we
|
|
82
|
+
* cannot post under is not one of the two.
|
|
83
|
+
*/
|
|
84
|
+
export declare function collectNotionOwnBotIds(primary: string | undefined, siblingCredentialIds: readonly string[], resolve: (credentialId: string) => Promise<string | undefined>, canPost?: (credentialId: string) => Promise<boolean>): Promise<NotionOwnBotIds>;
|
|
85
|
+
/**
|
|
86
|
+
* The bot user (id and display name) for ONE integration, memoised on `credentialId`.
|
|
87
|
+
* `credential` is a THUNK so an operator override short-circuits the credential resolution entirely.
|
|
88
|
+
*
|
|
89
|
+
* 🔴 `NOTION_BOT_USER_ID` PINS THE ORG DEFAULT ONLY, AND SCOPING IT IS LOAD-BEARING (OPE-1921). It
|
|
90
|
+
* is ONE id, and two Notion integrations NEVER share a bot user — so an override applied to every
|
|
91
|
+
* credential would answer every integration with the org default's id. That is worse than no
|
|
92
|
+
* override: the cross-integration loop guard would hold a one-element set AND report it COMPLETE,
|
|
93
|
+
* so a sibling's reply would match nothing, the fail-closed arm would not fire, and the loop the
|
|
94
|
+
* set exists to close would reopen silently on a deployment that looks configured. Scoped here, a
|
|
95
|
+
* sibling still resolves live and an unresolvable one correctly marks the set incomplete.
|
|
96
|
+
* `NOTION_BOT_NAME` is NOT scoped: it is a display name the judge reads, never an identity anything
|
|
97
|
+
* is compared against, and a deployment that renames its agent means the new name everywhere.
|
|
98
|
+
*/
|
|
99
|
+
export declare function resolveNotionBotUser(credentialId: string, credential: () => Promise<ResolvedNotionCredential | undefined>): () => Promise<{
|
|
100
|
+
id?: string;
|
|
101
|
+
name?: string;
|
|
102
|
+
}>;
|
|
103
|
+
/** Reset the cached bot users AND the cached reachability verdicts (tests only). Both are keyed by
|
|
104
|
+
* credential id and both live for the process lifetime, so a test that resets one and not the other
|
|
105
|
+
* would carry a stale answer into the next case. */
|
|
106
|
+
export declare function _resetNotionBotUserCache(): void;
|
|
107
|
+
//# sourceMappingURL=notion-bot-user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-bot-user.d.ts","sourceRoot":"","sources":["../../../agent/channels/notion-bot-user.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAyC,KAAK,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAKvG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,eAAe;IAC9B;qGACiG;IACjG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;wEACoE;IACpE,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,oBAAoB,EAAE,SAAS,MAAM,EAAE,EACvC,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,EAC9D,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GACnD,OAAO,CAAC,eAAe,CAAC,CAgC1B;AAwCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,GAC9D,MAAM,OAAO,CAAC;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA4B/C;AAED;;qDAEqD;AACrD,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
// notion-bot-user — THE deployment's own Notion identity, per integration: the bot user id every
|
|
2
|
+
// road that has to tell "our own words" from someone else's compares against.
|
|
3
|
+
//
|
|
4
|
+
// 🔴 IT LIVES IN ITS OWN MODULE BECAUSE TWO ROADS NEED IT (OPE-1857). The ingress road has always
|
|
5
|
+
// held it — `classifyNotionComment` drops a self-authored comment, and `notionCommentIsStopDirective`
|
|
6
|
+
// refuses one — and it sat as a module-private helper inside `notion.ts`. The SEAT CATCH-UP needs the
|
|
7
|
+
// same answer: it reads the page's own discussion since the seat last woke, and the seat's previous
|
|
8
|
+
// reply is IN that window. Without this the catch-up cannot recognise our own comment, and Notion's
|
|
9
|
+
// comment payload gives it nothing else to go on — `created_by` is a partial user (an id and an
|
|
10
|
+
// object, no `type`), so our own reply is indistinguishable from a person's by shape alone. A second
|
|
11
|
+
// copy of this resolver would be a second spelling of one identity, which is the class OPE-1857 is.
|
|
12
|
+
//
|
|
13
|
+
// 🔴 CACHED PER CREDENTIAL (OPE-467), not per deployment. EVERY Notion integration has its OWN bot
|
|
14
|
+
// user id, so a deployment running a second integration for a bound domain has two of them. One
|
|
15
|
+
// shared cache would compare a reply against the WRONG identity and break the loop guard in both
|
|
16
|
+
// directions: the agent could either loop on its own replies (its id never matches) or drop real
|
|
17
|
+
// human comments. The key is the credential id, which is exactly one integration.
|
|
18
|
+
//
|
|
19
|
+
// FAIL-SOFT, AND THE TWO ROADS READ AN UNRESOLVED ID DIFFERENTLY. A failed resolve answers `{}` and
|
|
20
|
+
// is CACHED as such for the process lifetime.
|
|
21
|
+
// • THE INGRESS ROAD FAILS CLOSED: `classifyNotionComment` drops on "unresolved bot user id", so
|
|
22
|
+
// nothing dispatches rather than risk looping on our own replies.
|
|
23
|
+
// • THE CATCH-UP ROAD DOES NOT. With no id, our own comment reads as a PERSON and enters the
|
|
24
|
+
// seat's context at the `unauth` floor. That is deliberate and `notion-catch-up.ts` states and
|
|
25
|
+
// defends it where it reads this resolver: blinding a context read on a transient
|
|
26
|
+
// `GET /v1/users/me` failure would re-create the OPE-1857 symptom — a seat that keeps nothing.
|
|
27
|
+
// The ingress road's fail-closed arm covers the PRIMARY id only: a deployment that cannot
|
|
28
|
+
// resolve THAT dispatches no Notion wake and therefore takes no catch-up. An unresolved SIBLING
|
|
29
|
+
// still wakes on a person-marked comment (classifyNotionComment step 5), so its own replies can
|
|
30
|
+
// reach a seat's context as a person's — `notion-catch-up.ts` states that residual.
|
|
31
|
+
import { retrieveBotUser, NOTION_INGRESS_RETRY } from "./notion-api.js";
|
|
32
|
+
// The ORG-DEFAULT credential id, imported rather than spelled: the override scope below is a
|
|
33
|
+
// security decision, and a second spelling of that id would silently widen it.
|
|
34
|
+
import { NOTION_CHANNEL_CREDENTIAL } from "./notion-credentials.js";
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the deployment's own bot user ids: the already-resolved `primary`, plus one per entry of
|
|
37
|
+
* `siblingCredentialIds` — every CONFIGURED INTEGRATION EXCEPT the one this delivery verified under.
|
|
38
|
+
* The resolver is the SAME per-credential one and cache the loop guard already reads, so no second
|
|
39
|
+
* spelling of one identity can exist.
|
|
40
|
+
*
|
|
41
|
+
* 🔴 THE ADDED INGRESS COST, EXACTLY: N-1 extra `GET /v1/users/me` calls for N configured
|
|
42
|
+
* integrations, on the FIRST delivery of a process, and ZERO after it —
|
|
43
|
+
* {@link resolveNotionBotUser} memoises on the credential id. The verifying integration is excluded
|
|
44
|
+
* here precisely so the number is N-1 and not N: its id is already in hand, and re-resolving it
|
|
45
|
+
* would charge a live resolver for an answer the caller just took. A SINGLE-INTEGRATION deployment —
|
|
46
|
+
* every deployment before OPE-1921 — therefore pays NOTHING at all, and `notion-test.ts`'s
|
|
47
|
+
* ack-attribution fixture measures that: its `botTriggerPage` bucket is unchanged.
|
|
48
|
+
*
|
|
49
|
+
* A resolver that THROWS counts as unresolved rather than failing the delivery: this runs on the
|
|
50
|
+
* awaited ingress path, and a thrown identity lookup must not turn into a 500 Notion will retry.
|
|
51
|
+
*
|
|
52
|
+
* 🔴 AN INTEGRATION THAT CANNOT POST IS NOT A LOOP RISK, AND MARKING THE SET INCOMPLETE FOR ONE IS
|
|
53
|
+
* PURE AVAILABILITY LOSS. `resolve` answers `undefined` for two different failures: a working key
|
|
54
|
+
* whose `GET /v1/users/me` failed — that integration CAN post, so we must fail closed — and an
|
|
55
|
+
* integration THIS DEPLOYMENT holds no usable API key for, so it cannot post FROM HERE. `canPost`
|
|
56
|
+
* separates them, and it is consulted ONLY when `resolve` came back empty, so the ordinary path
|
|
57
|
+
* pays nothing for it. Without the split, a domain whose credential is declared but whose secret is
|
|
58
|
+
* unset or revoked would silence Notion on EVERY page of the deployment, including pages
|
|
59
|
+
* the healthy org-default integration serves — a blast radius nothing buys. Absent ⇒ every
|
|
60
|
+
* unresolved sibling is treated as able to post, which is the conservative reading.
|
|
61
|
+
*
|
|
62
|
+
* 🔴 THE CLAIM IS "NOT A LOOP RISK FROM HERE", NEVER "CANNOT HAVE AUTHORED ANY COMMENT", and the
|
|
63
|
+
* difference is real. `canPost` establishes only that THIS deployment cannot resolve a key for that
|
|
64
|
+
* credential right now. A token an operator deleted here, or one another environment still holds,
|
|
65
|
+
* can keep authoring comments on the shared page — and this deployment then reads those replies as a
|
|
66
|
+
* person's, because that id is absent from `all` while `complete` stays true. The residual is
|
|
67
|
+
* accepted: a loop needs two of OUR OWN integrations answering each other, and an integration we
|
|
68
|
+
* cannot post under is not one of the two.
|
|
69
|
+
*/
|
|
70
|
+
export async function collectNotionOwnBotIds(primary, siblingCredentialIds, resolve, canPost) {
|
|
71
|
+
const all = new Set();
|
|
72
|
+
if (primary)
|
|
73
|
+
all.add(primary);
|
|
74
|
+
// An unresolved PRIMARY is already an incomplete set. Step 1 of the classifier drops on it before
|
|
75
|
+
// step 5 is reached, so this line changes no verdict — it keeps the flag's meaning honest for any
|
|
76
|
+
// later reader of the structure.
|
|
77
|
+
let complete = primary !== undefined;
|
|
78
|
+
for (const credentialId of new Set(siblingCredentialIds)) {
|
|
79
|
+
let id;
|
|
80
|
+
try {
|
|
81
|
+
id = await resolve(credentialId);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
id = undefined;
|
|
85
|
+
}
|
|
86
|
+
if (id) {
|
|
87
|
+
all.add(id);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
// Unresolved. Only an integration that can REACH Notion could have authored the comment in
|
|
91
|
+
// hand, so only that one makes the set incomplete.
|
|
92
|
+
// 🔴 AN UNKNOWN ANSWER COUNTS AS ABLE TO POST. `resolveNotionCredential` signals the real
|
|
93
|
+
// no-usable-key cases by RETURNING `undefined` — an unregistered credential, one with no
|
|
94
|
+
// `secretRef`, and a broker `CredentialError` all take that path — so it re-throws only an
|
|
95
|
+
// UNEXPECTED fault (a store timeout, a decrypt error). A throw therefore says the state is
|
|
96
|
+
// unknown, never "this integration has no key", and the unknown side of this question has to
|
|
97
|
+
// fall the way the absent-`canPost` default falls: treat the sibling as able to post and let
|
|
98
|
+
// the set go incomplete. `reachableOnce` holds that direction.
|
|
99
|
+
let reachable = true;
|
|
100
|
+
if (canPost)
|
|
101
|
+
reachable = await reachableOnce(credentialId, canPost);
|
|
102
|
+
if (reachable)
|
|
103
|
+
complete = false;
|
|
104
|
+
}
|
|
105
|
+
return { primary, all, complete };
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Can this credential reach Notion at all — memoised for the PROCESS LIFETIME, the same lifetime
|
|
109
|
+
* {@link botUserCache} gives a resolved bot user.
|
|
110
|
+
*
|
|
111
|
+
* 🔴 WITHOUT THE MEMO THIS QUESTION IS ASKED ON EVERY DELIVERY, FOR EVER. The answer is consulted
|
|
112
|
+
* only for a sibling whose bot user id did not resolve — and `botUserCache` holds THAT failure for
|
|
113
|
+
* the process lifetime, so the arm runs on every subsequent delivery of the process. The webhook
|
|
114
|
+
* core's own credential memo is per-DELIVERY (`notion.ts` builds a fresh `Map` per delivery), so
|
|
115
|
+
* each of those deliveries paid a fresh operational-store read on the AWAITED ingress path. Worse,
|
|
116
|
+
* on the default `db` broker a ref with no stored row writes one `CREDENTIAL_UNRESOLVED` audit row
|
|
117
|
+
* per attempt by design, so a declared-but-unstored sibling credential — a configuration
|
|
118
|
+
* `docs/deploy/surfaces/notion.md` calls supported — wrote one row per ingress delivery indefinitely
|
|
119
|
+
* and drowned the repeated-refusal RATE that row exists to show. `notion-catch-up.ts` refuses that
|
|
120
|
+
* same cost on the catch-up road; this is the ingress road's answer to it.
|
|
121
|
+
*
|
|
122
|
+
* The cached value is the VERDICT, not the credential, so no key is held here. Both answers last
|
|
123
|
+
* until restart, which matches `botUserCache`: a sibling whose id will not resolve stays unresolved
|
|
124
|
+
* until then anyway, so a fresher reachability answer could not change any verdict.
|
|
125
|
+
*/
|
|
126
|
+
const reachableCache = new Map();
|
|
127
|
+
function reachableOnce(credentialId, canPost) {
|
|
128
|
+
const hit = reachableCache.get(credentialId);
|
|
129
|
+
if (hit)
|
|
130
|
+
return hit;
|
|
131
|
+
// `.catch(() => true)` is the fail-CLOSED direction, and it is the whole point: an unknown answer
|
|
132
|
+
// leaves the sibling counted as able to post, which marks the set incomplete. See the call site.
|
|
133
|
+
const verdict = canPost(credentialId).catch(() => true);
|
|
134
|
+
reachableCache.set(credentialId, verdict);
|
|
135
|
+
return verdict;
|
|
136
|
+
}
|
|
137
|
+
const botUserCache = new Map();
|
|
138
|
+
/** Where this module's own diagnostics go — the same prefix every Notion channel module logs under. */
|
|
139
|
+
function log(msg) {
|
|
140
|
+
console.log(`[open-everywhere:notion] ${msg}`);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The bot user (id and display name) for ONE integration, memoised on `credentialId`.
|
|
144
|
+
* `credential` is a THUNK so an operator override short-circuits the credential resolution entirely.
|
|
145
|
+
*
|
|
146
|
+
* 🔴 `NOTION_BOT_USER_ID` PINS THE ORG DEFAULT ONLY, AND SCOPING IT IS LOAD-BEARING (OPE-1921). It
|
|
147
|
+
* is ONE id, and two Notion integrations NEVER share a bot user — so an override applied to every
|
|
148
|
+
* credential would answer every integration with the org default's id. That is worse than no
|
|
149
|
+
* override: the cross-integration loop guard would hold a one-element set AND report it COMPLETE,
|
|
150
|
+
* so a sibling's reply would match nothing, the fail-closed arm would not fire, and the loop the
|
|
151
|
+
* set exists to close would reopen silently on a deployment that looks configured. Scoped here, a
|
|
152
|
+
* sibling still resolves live and an unresolvable one correctly marks the set incomplete.
|
|
153
|
+
* `NOTION_BOT_NAME` is NOT scoped: it is a display name the judge reads, never an identity anything
|
|
154
|
+
* is compared against, and a deployment that renames its agent means the new name everywhere.
|
|
155
|
+
*/
|
|
156
|
+
export function resolveNotionBotUser(credentialId, credential) {
|
|
157
|
+
return () => {
|
|
158
|
+
const cached = botUserCache.get(credentialId);
|
|
159
|
+
if (cached)
|
|
160
|
+
return cached;
|
|
161
|
+
const overrideId = credentialId === NOTION_CHANNEL_CREDENTIAL ? process.env.NOTION_BOT_USER_ID : undefined;
|
|
162
|
+
const overrideName = process.env.NOTION_BOT_NAME;
|
|
163
|
+
const named = (u) => ({ id: u.id, name: overrideName && overrideName.length > 0 ? overrideName : u.name });
|
|
164
|
+
const resolved = overrideId && overrideId.length > 0
|
|
165
|
+
? Promise.resolve(named({ id: overrideId }))
|
|
166
|
+
: credential()
|
|
167
|
+
// 🔴 THE INGRESS POLICY, BECAUSE THIS RESOLVE IS ON THE AWAITED INGRESS PATH (OPE-1254).
|
|
168
|
+
// `handleNotionDelivery` awaits `deps.resolveBotUserId` BEFORE `retrieveComment`, and
|
|
169
|
+
// this is the only thing behind it. On the shared defaults it could spend 60 s of backoff
|
|
170
|
+
// on its own, ahead of every call the webhook core's own `ingressCallOpts` bounds — so
|
|
171
|
+
// the delivery's worst case was ~90 s against a 300 s ceiling, not the ~60 s the seam
|
|
172
|
+
// claims. Worse, a failure here is CACHED for the process lifetime as `{}` below, and an
|
|
173
|
+
// unresolved bot id makes the classifier fail closed: one rate-limit episode during the
|
|
174
|
+
// first resolve silences every later delivery on that instance. Bounding the wait shrinks
|
|
175
|
+
// that window.
|
|
176
|
+
.then((cred) => (cred ? retrieveBotUser({ ...cred, retry: NOTION_INGRESS_RETRY }).then(named) : {}))
|
|
177
|
+
.catch((err) => {
|
|
178
|
+
log(`could not resolve bot user for credential "${credentialId}" (GET /v1/users/me failed): ${String(err)}`);
|
|
179
|
+
return {};
|
|
180
|
+
});
|
|
181
|
+
botUserCache.set(credentialId, resolved);
|
|
182
|
+
return resolved;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/** Reset the cached bot users AND the cached reachability verdicts (tests only). Both are keyed by
|
|
186
|
+
* credential id and both live for the process lifetime, so a test that resets one and not the other
|
|
187
|
+
* would carry a stale answer into the next case. */
|
|
188
|
+
export function _resetNotionBotUserCache() {
|
|
189
|
+
botUserCache.clear();
|
|
190
|
+
reachableCache.clear();
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=notion-bot-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-bot-user.js","sourceRoot":"","sources":["../../../agent/channels/notion-bot-user.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,8EAA8E;AAC9E,EAAE;AACF,kGAAkG;AAClG,sGAAsG;AACtG,sGAAsG;AACtG,oGAAoG;AACpG,oGAAoG;AACpG,gGAAgG;AAChG,qGAAqG;AACrG,oGAAoG;AACpG,EAAE;AACF,mGAAmG;AACnG,gGAAgG;AAChG,iGAAiG;AACjG,iGAAiG;AACjG,kFAAkF;AAClF,EAAE;AACF,oGAAoG;AACpG,8CAA8C;AAC9C,mGAAmG;AACnG,sEAAsE;AACtE,+FAA+F;AAC/F,mGAAmG;AACnG,sFAAsF;AACtF,mGAAmG;AACnG,8FAA8F;AAC9F,oGAAoG;AACpG,oGAAoG;AACpG,wFAAwF;AAExF,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CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC3I,MAAM,QAAQ,GACZ,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;YACjC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;YAC5C,CAAC,CAAC,UAAU,EAAE;gBACV,yFAAyF;gBACzF,sFAAsF;gBACtF,0FAA0F;gBAC1F,uFAAuF;gBACvF,sFAAsF;gBACtF,yFAAyF;gBACzF,wFAAwF;gBACxF,0FAA0F;gBAC1F,eAAe;iBACd,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;iBACnG,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,GAAG,CAAC,8CAA8C,YAAY,gCAAgC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC7G,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;QACX,YAAY,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACzC,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC;AAED;;qDAEqD;AACrD,MAAM,UAAU,wBAAwB;IACtC,YAAY,CAAC,KAAK,EAAE,CAAC;IACrB,cAAc,CAAC,KAAK,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { readNotionComments, resolveNotionCredential, type ResolvedNotionCredential } from "./notion-api.js";
|
|
2
|
+
import { type Domain, type NormalizedMessage, type SeatCatchUpFetch } from "@open-everywhere/core/agent/adapter-api.js";
|
|
3
|
+
/** Injected seam so the fetch drives offline in tests; defaults to the live brokered credential. */
|
|
4
|
+
export interface NotionCatchUpDeps {
|
|
5
|
+
readonly readComments: typeof readNotionComments;
|
|
6
|
+
readonly resolveCredential: typeof resolveNotionCredential;
|
|
7
|
+
/** The domain roster the per-surface credential is resolved against. Injected so the fetch drives
|
|
8
|
+
* with no config registered; the live default is the loaded roster. */
|
|
9
|
+
readonly domains?: readonly Domain[];
|
|
10
|
+
/** ONE own Notion bot id, pinning the whole self set — a TEST override, so a fetch drives with a
|
|
11
|
+
* fixed identity and resolves nothing. Present ⇒ {@link selfActorIdFor} is never called and no
|
|
12
|
+
* sibling integration is resolved. The live read builds the set through `collectCatchUpSelfIds`. */
|
|
13
|
+
readonly selfActorId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the deployment's own bot user id for ONE integration. The live default is the SAME
|
|
16
|
+
* per-credential resolver and cache the ingress road reads (`notion-bot-user.ts`), so the catch-up
|
|
17
|
+
* and the loop guard can never hold two answers for one integration. `collectCatchUpSelfIds` calls
|
|
18
|
+
* it once per CONFIGURED integration, so the seat recognises its own words whichever one posted
|
|
19
|
+
* them (OPE-1921).
|
|
20
|
+
*
|
|
21
|
+
* 🔴 IT IS LOAD-BEARING SINCE OPE-1857, NOT A LABEL. Notion's comment payload carries a partial
|
|
22
|
+
* `created_by` — an id and an object, no `type` — so this read cannot tell our own reply from a
|
|
23
|
+
* person's by SHAPE. Before OPE-1857 an absent `type` made every author a `bot`, which refused our
|
|
24
|
+
* own comment as a side effect of refusing everyone. Now that an unsignalled author is a person,
|
|
25
|
+
* the id comparison is the ONLY thing keeping the seat's own previous reply — which lands in the
|
|
26
|
+
* very discussion this read sweeps — out of its next wake as another person's words.
|
|
27
|
+
* 🔴 THE READING CREDENTIAL AND THE POSTING ONE CAN DIFFER, AND THAT NO LONGER LOSES THE REPLY.
|
|
28
|
+
* This read's credential comes from the page's DOMAIN BINDING, while the reply sitting in the
|
|
29
|
+
* discussion was posted under the DELIVERY's carried credential, which wins where the two differ
|
|
30
|
+
* (OPE-499, `notion-credentials.ts`). On a page served by two integrations they disagree, and the
|
|
31
|
+
* seat's own reply used to read as a person's. `collectCatchUpSelfIds` resolves BOTH, so the
|
|
32
|
+
* comparison no longer depends on which credential posted — and the delivery's credential id,
|
|
33
|
+
* which this seam once needed on `SeatCatchUpRequest` to close this, is not required after all.
|
|
34
|
+
* 🔴 AN UNRESOLVED ID DOES NOT BLIND THIS READ, and it does not have to: the INGRESS road fails
|
|
35
|
+
* CLOSED on the same id from the same cache (`classifyNotionComment` drops on "unresolved bot user
|
|
36
|
+
* id"), so a deployment that cannot resolve it dispatches no Notion wake at all and takes no
|
|
37
|
+
* catch-up. Blinding the read here as well would re-create the OPE-1857 symptom — a seat that
|
|
38
|
+
* keeps nothing — out of a transient `GET /v1/users/me` failure.
|
|
39
|
+
*/
|
|
40
|
+
readonly selfActorIdFor?: (credentialId: string, credential: () => Promise<ResolvedNotionCredential | undefined>) => Promise<string | undefined>;
|
|
41
|
+
}
|
|
42
|
+
/** The fetch, with its seams exposed so the contract test drives it with no network. */
|
|
43
|
+
export declare function fetchNotionCatchUpWindow(req: {
|
|
44
|
+
container: string;
|
|
45
|
+
threadRoot?: string;
|
|
46
|
+
threadAnchor?: string;
|
|
47
|
+
sinceMs: number;
|
|
48
|
+
channelKey?: string;
|
|
49
|
+
}, deps?: NotionCatchUpDeps): Promise<readonly NormalizedMessage[]>;
|
|
50
|
+
/**
|
|
51
|
+
* 🔴 NOTION FLOORS `created_time` TO THE MINUTE, and this is the number the shared catch-up road
|
|
52
|
+
* widens both of its bounds by (OPE-1847, `core/agent/channels/seat-catch-up.ts`
|
|
53
|
+
* {@link SeatCatchUpDeclaration.timestampPrecisionMs}).
|
|
54
|
+
* It is the VENDOR'S UNIT, not a margin: every comment posted inside one wall-clock minute comes back
|
|
55
|
+
* carrying that minute's opening instant. Declare it too small and a comment in the trigger's own
|
|
56
|
+
* minute is bounded out of the window it belongs to — the ship #211 red, where the seat read two
|
|
57
|
+
* comments and kept none. Declare it too large and the seat is handed comments from before its window.
|
|
58
|
+
* Measured on the live workspace (OPE-1711) and the repository's own e2e driver floors to the same
|
|
59
|
+
* unit (`core/scripts/e2e/notion-driver.ts` `notionMinuteFloor`).
|
|
60
|
+
*/
|
|
61
|
+
export declare const NOTION_TIMESTAMP_PRECISION_MS = 60000;
|
|
62
|
+
/** Notion's registered {@link SeatCatchUpFetch} — the one thing this surface contributes to the shared path. */
|
|
63
|
+
export declare const notionSeatCatchUpFetch: SeatCatchUpFetch;
|
|
64
|
+
//# sourceMappingURL=notion-catch-up.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-catch-up.d.ts","sourceRoot":"","sources":["../../../agent/channels/notion-catch-up.ts"],"names":[],"mappings":"AA+DA,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAA6B,KAAK,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAGxI,OAAO,EAA4B,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AA0FlJ,oGAAoG;AACpG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,YAAY,EAAE,OAAO,kBAAkB,CAAC;IACjD,QAAQ,CAAC,iBAAiB,EAAE,OAAO,uBAAuB,CAAC;IAC3D;4EACwE;IACxE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;yGAEqG;IACrG,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAClJ;AAkED,wFAAwF;AACxF,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE;IAAE,SAAS,EAAE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