@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-scope.js","sourceRoot":"","sources":["../../../agent/channels/notion-scope.ts"],"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iBAAiB,CAAC,CAAC;IACzG,IAAI,GAAG,CAAC,OAAO;QAAE,OAAO,GAAG,CAAC,YAAY,IAAI,WAAW,CAAC;IACxD,kGAAkG;IAClG,iGAAiG;IACjG,4FAA4F;IAC5F,MAAM,sBAAsB,CAC1B,GAAG,EACH,WAAW,EACX,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,kBAAkB,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,yBAAyB,EACrF,GAAG,CAAC,OAAO,EACX,IAAI,EACJ,GAAG,CAAC,YAAY,IAAI,IAAI,CACzB,CAAC;IACF,MAAM,IAAI,iBAAiB,CAAC,wBAAwB,CAAC,WAAW,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { cancelAnchoredTurn, type AttachSessionForCancel, type CancelOutcome } from "@open-everywhere/core/agent/adapter-api.js";
|
|
2
|
+
import { type NotionComment } from "./notion-api.js";
|
|
3
|
+
import type { NotionOwnBotIds } from "./notion-bot-user.js";
|
|
4
|
+
/**
|
|
5
|
+
* Is this FETCHED comment a genuine, human-authored stop directive? NEVER THROWS.
|
|
6
|
+
*
|
|
7
|
+
* FAIL CLOSED throughout — see this file's header for the five actor-guard arms. An unresolved
|
|
8
|
+
* PRIMARY id refuses EVERYTHING, not just the self-check: without our own identity there is no
|
|
9
|
+
* distinguishing "a human said stop" from "we said stop", and the safe answer is to not treat it as
|
|
10
|
+
* a stop at all (it still reaches the ordinary ambient path, which drops it for its own reasons).
|
|
11
|
+
*/
|
|
12
|
+
export declare function notionCommentIsStopDirective(comment: NotionComment, own: NotionOwnBotIds): boolean;
|
|
13
|
+
/** The facts a stop delivery carries, ALREADY RESOLVED by the webhook core's own steps (the
|
|
14
|
+
* authenticated page, the roster-aware workspace, the delivery's selected integration) — this file
|
|
15
|
+
* never re-derives any of them from the payload. */
|
|
16
|
+
export interface NotionStopComment {
|
|
17
|
+
readonly workspaceId?: string;
|
|
18
|
+
readonly pageId: string;
|
|
19
|
+
readonly discussionId?: string;
|
|
20
|
+
readonly credentialId?: string;
|
|
21
|
+
/** WHO asked (comment.created_by.id) — recorded on the audit row, never used to decide (the
|
|
22
|
+
* actor guard already ran in {@link notionCommentIsStopDirective}). */
|
|
23
|
+
readonly requesterId?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Injected seams, so parse + guard + cancel is unit-tested without a live Notion integration. */
|
|
26
|
+
export interface NotionStopDeps {
|
|
27
|
+
readonly attachSession: AttachSessionForCancel;
|
|
28
|
+
/** Injectable for the test; defaults to the shared `cancelAnchoredTurn`. There is no second
|
|
29
|
+
* cancel implementation behind this — the seam exists to observe the call, never to replace it. */
|
|
30
|
+
readonly cancel?: typeof cancelAnchoredTurn;
|
|
31
|
+
}
|
|
32
|
+
/** Why the arm did what it did — for the caller's log, never for a person to read. */
|
|
33
|
+
export type NotionStopOutcome = {
|
|
34
|
+
readonly stopped: false;
|
|
35
|
+
readonly reason: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly stopped: true;
|
|
38
|
+
readonly outcome: CancelOutcome;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Cancel the turn running on the page this stop directive was posted into.
|
|
42
|
+
*
|
|
43
|
+
* THE CONVERSATION KEY ONLY. A comment or discussion id is not the turn's anchor message — the
|
|
44
|
+
* anchor is the human's triggering message, which the registry keys on the PAGE (see this file's
|
|
45
|
+
* header) — so offering an `anchorKey` here would be a lookup that always misses.
|
|
46
|
+
*/
|
|
47
|
+
export declare function routeNotionStopComment(stop: NotionStopComment, deps: NotionStopDeps): Promise<NotionStopOutcome>;
|
|
48
|
+
//# sourceMappingURL=notion-stop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-stop.d.ts","sourceRoot":"","sources":["../../../agent/channels/notion-stop.ts"],"names":[],"mappings":"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the nearest honest equivalent to the ✋ reaction.
|
|
2
|
+
//
|
|
3
|
+
// ════════════════════════════════════════════════════════════════════════════════════════════════
|
|
4
|
+
// 🔴 NOTION SENDS NO REACTION WEBHOOK. THIS IS THE VENDOR EVIDENCE, AND IT IS WHY THIS FILE READS A
|
|
5
|
+
// COMMENT INSTEAD OF AN EMOJI.
|
|
6
|
+
// ════════════════════════════════════════════════════════════════════════════════════════════════
|
|
7
|
+
//
|
|
8
|
+
// Notion's complete webhook event catalogue (developers.notion.com/reference/webhooks-events-
|
|
9
|
+
// delivery, read 2026-08-23) is `page.*`, `database.*`/`data_source.*` and exactly THREE comment
|
|
10
|
+
// events: `comment.created`, `comment.updated`, `comment.deleted`. There is no reaction resource on
|
|
11
|
+
// any of them — the same gap GitHub's webhook catalogue has, and the same answer applies: the
|
|
12
|
+
// trigger is a bare `stop` comment, read at the ingress before anything is dispatched.
|
|
13
|
+
// `channels/turn-cancel.ts`'s `isStopDirective` owns the grammar (one word, optional `/oe ` prefix,
|
|
14
|
+
// optional trailing punctuation) and its header carries the reasoning for why the match is narrow.
|
|
15
|
+
//
|
|
16
|
+
// UNLIKE GITHUB, THE WEBHOOK CARRIES NO TEXT. A Notion `comment.created` delivery is a SIGNAL ONLY
|
|
17
|
+
// (the comment id, not its body — notion-webhook.ts's header), so the two-step fetch
|
|
18
|
+
// (`retrieveComment`) that the webhook core already runs for the ambient path is what supplies the
|
|
19
|
+
// text this arm reads. There is no separate "parse the raw delivery" function here the way GitHub's
|
|
20
|
+
// `parseGitHubStopComment` has one: `notionCommentIsStopDirective` takes the ALREADY-FETCHED comment.
|
|
21
|
+
//
|
|
22
|
+
// THE ACTOR GUARD FAILS CLOSED, THE SAME WAY THE AMBIENT LOOP GUARD DOES (notion-supervisor.ts
|
|
23
|
+
// `classifyNotionComment`). The agent's own reply rides the same webhook (`createCommentReply` fires
|
|
24
|
+
// a fresh `comment.created`), so behind `cancel()` a fail-OPEN identity check is a self-cancel:
|
|
25
|
+
// 1. UNRESOLVED PRIMARY bot user id ⇒ refuse. Without our own id we cannot rule out that this IS
|
|
26
|
+
// our own comment, so treating it as a stop would be a coin flip on self-cancellation.
|
|
27
|
+
// 2. SELF-authored (`created_by.id` in {@link NotionOwnBotIds.all}) ⇒ refuse. The set is EVERY
|
|
28
|
+
// configured integration's bot user id (OPE-1921), so a sibling integration's own comment
|
|
29
|
+
// cannot cancel this one's turn.
|
|
30
|
+
// 3. UNIDENTIFIABLE author (no `created_by.id`) ⇒ refuse (OPE-1906). Arm 2 is the only one that
|
|
31
|
+
// recognises our own words, and with no id it cannot run — what is left is arm 4, on a field
|
|
32
|
+
// Notion OMITS. So an author nobody can name could cancel the page's running turn.
|
|
33
|
+
// 4. BOT/integration-authored (`created_by.type` present and not `"person"`) ⇒ refuse — the
|
|
34
|
+
// bot-to-bot loop guard. 🔴 A BACKSTOP, never the self-check: `created_by.type` is usually
|
|
35
|
+
// ABSENT on a comment, so a FOREIGN bot reads here as a person. Arm 2's set is what answers
|
|
36
|
+
// "is it ours"; arm 5 is what answers "we cannot tell".
|
|
37
|
+
// 5. INCOMPLETE OWN-ID SET on an author Notion states nothing about ⇒ refuse (OPE-1921). One
|
|
38
|
+
// configured integration's id did not resolve, so arm 2 could not have recognised that
|
|
39
|
+
// integration's own `stop`. `classifyNotionComment` step 5 fails closed on the same fact.
|
|
40
|
+
// Any of these five leaves the comment UNCLASSIFIED as a stop, not rejected outright: the webhook
|
|
41
|
+
// core falls through to its ordinary ambient/classify path, where the very same checks drop it again
|
|
42
|
+
// for the ordinary reason.
|
|
43
|
+
// 🔴 A GENUINE HUMAN `stop` PASSES ALL FIVE ONLY WHILE THIS DEPLOYMENT CAN NAME ITS OWN IDS, and the
|
|
44
|
+
// two identity arms are the exceptions. Arm 1 (primary unresolved) and arm 5 (a sibling unresolved,
|
|
45
|
+
// on an author Notion states nothing about) refuse a REAL person's `stop` too: the comment then takes
|
|
46
|
+
// the ordinary classify path, which drops it for its own fail-closed reason, so no `cancelAnchoredTurn`
|
|
47
|
+
// runs and the person gets no reply. That is the accepted cost of never self-cancelling on a coin
|
|
48
|
+
// flip — an identity we cannot establish is not treated as a human — and it is why the drop is
|
|
49
|
+
// recorded under the classifier's reason rather than as a cancel.
|
|
50
|
+
//
|
|
51
|
+
// THE CONVERSATION KEY IS THE PAGE, NOT THE DISCUSSION. The Notion doc-session is PAGE-scoped
|
|
52
|
+
// (notion-supervisor.ts: "a page-scoped standing session aware of all the doc's discussions"), so a
|
|
53
|
+
// stop trigger anywhere on the page names the newest running turn on that page — the `/oe stop`
|
|
54
|
+
// grain the Teams arm's header documents. `notionConversationKey` (notion-identity.ts) is the ONE
|
|
55
|
+
// derivation both {@link bindNotion}'s `anchorChannelId` and this file's `routeNotionStopComment`
|
|
56
|
+
// use, so the registry write and the registry read can never drift into two spellings.
|
|
57
|
+
//
|
|
58
|
+
// IT SUPPRESSES THE REST OF THE PIPELINE FOR ITS OWN DELIVERY. notion-webhook.ts's `deliver()` runs
|
|
59
|
+
// this check BEFORE the ambient gate and BEFORE classify/dispatch — waking the supervisor on the very
|
|
60
|
+
// comment that asked it to stand down would be exactly the failure GitHub's `github.ts` avoids by
|
|
61
|
+
// suppressing its own ambient leg for a stop delivery.
|
|
62
|
+
import { cancelAnchoredTurn, resolvePartition, turnChannelKey, } from "@open-everywhere/core/agent/adapter-api.js";
|
|
63
|
+
import { isStopDirective } from "@open-everywhere/core/agent/adapter-api.js";
|
|
64
|
+
import { buildNotionAuth, notionConversationKey } from "./notion-identity.js";
|
|
65
|
+
import { richTextToPlainText } from "./notion-api.js";
|
|
66
|
+
/**
|
|
67
|
+
* Is this FETCHED comment a genuine, human-authored stop directive? NEVER THROWS.
|
|
68
|
+
*
|
|
69
|
+
* FAIL CLOSED throughout — see this file's header for the five actor-guard arms. An unresolved
|
|
70
|
+
* PRIMARY id refuses EVERYTHING, not just the self-check: without our own identity there is no
|
|
71
|
+
* distinguishing "a human said stop" from "we said stop", and the safe answer is to not treat it as
|
|
72
|
+
* a stop at all (it still reaches the ordinary ambient path, which drops it for its own reasons).
|
|
73
|
+
*/
|
|
74
|
+
export function notionCommentIsStopDirective(comment, own) {
|
|
75
|
+
if (!isStopDirective(richTextToPlainText(comment.rich_text)))
|
|
76
|
+
return false;
|
|
77
|
+
if (!own.primary)
|
|
78
|
+
return false; // can't rule out self — fail closed
|
|
79
|
+
const author = comment.created_by;
|
|
80
|
+
// OUR OWN WORDS, from ANY configured integration (OPE-1921) — never only the one that verified
|
|
81
|
+
// this delivery. A sibling integration's `stop` used to reach `cancelAnchoredTurn`.
|
|
82
|
+
if (author?.id !== undefined && own.all.has(author.id))
|
|
83
|
+
return false;
|
|
84
|
+
// 🔴 AN AUTHOR WE CANNOT IDENTIFY IS NOT A HUMAN (OPE-1906). The self-check above is the only arm
|
|
85
|
+
// that recognises our own words, and with no `created_by.id` it cannot run — the line below would
|
|
86
|
+
// then rest on `created_by.type`, which Notion OMITS on a comment. Without this, an unidentifiable
|
|
87
|
+
// author could CANCEL the page's running turn while the same author saying anything else is
|
|
88
|
+
// dropped by `classifyNotionComment` step 3. Same posture, one step apart.
|
|
89
|
+
if (!author?.id)
|
|
90
|
+
return false; // unidentified author — fail closed
|
|
91
|
+
if (author.type && author.type !== "person")
|
|
92
|
+
return false; // bot/integration-authored
|
|
93
|
+
// 🔴 A SIBLING WE COULD NOT RESOLVE IS A SELF-CHECK THAT DID NOT RUN (OPE-1921). With one
|
|
94
|
+
// integration's bot id missing, this author is either a person or that integration, and Notion's
|
|
95
|
+
// partial `created_by` cannot say which — so a self-cancel is back on the table. Refuse.
|
|
96
|
+
if (!own.complete && author.type !== "person")
|
|
97
|
+
return false;
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Cancel the turn running on the page this stop directive was posted into.
|
|
102
|
+
*
|
|
103
|
+
* THE CONVERSATION KEY ONLY. A comment or discussion id is not the turn's anchor message — the
|
|
104
|
+
* anchor is the human's triggering message, which the registry keys on the PAGE (see this file's
|
|
105
|
+
* header) — so offering an `anchorKey` here would be a lookup that always misses.
|
|
106
|
+
*/
|
|
107
|
+
export async function routeNotionStopComment(stop, deps) {
|
|
108
|
+
const conversationKey = notionConversationKey(stop.workspaceId, stop.pageId);
|
|
109
|
+
const channelKey = conversationKey ? turnChannelKey("notion", conversationKey) : undefined;
|
|
110
|
+
if (!channelKey)
|
|
111
|
+
return { stopped: false, reason: "stop: no conversation key" };
|
|
112
|
+
const partition = resolvePartition({
|
|
113
|
+
channel: { kind: "notion" },
|
|
114
|
+
session: {
|
|
115
|
+
auth: {
|
|
116
|
+
current: buildNotionAuth({
|
|
117
|
+
workspaceId: stop.workspaceId,
|
|
118
|
+
pageId: stop.pageId,
|
|
119
|
+
...(stop.discussionId ? { discussionId: stop.discussionId } : {}),
|
|
120
|
+
...(stop.credentialId ? { credentialId: stop.credentialId } : {}),
|
|
121
|
+
...(stop.requesterId ? { principalId: stop.requesterId } : {}),
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
const result = await (deps.cancel ?? cancelAnchoredTurn)({
|
|
127
|
+
org: partition.org,
|
|
128
|
+
platform: "notion",
|
|
129
|
+
workspace: partition.workspace,
|
|
130
|
+
...(stop.requesterId ? { requestedBy: stop.requesterId } : {}),
|
|
131
|
+
// `reaction` names the AFFORDANCE class, not the vendor mechanism: a member pressed the stop
|
|
132
|
+
// control this surface offers. `command` is the slash-command door and `tool` is the agent's
|
|
133
|
+
// own verb — neither is what happened here. The audit row's job is "which door do people reach
|
|
134
|
+
// for", and a Notion stop comment is the same door as a Slack ✋.
|
|
135
|
+
via: "reaction",
|
|
136
|
+
query: { channelKey },
|
|
137
|
+
attachSession: deps.attachSession,
|
|
138
|
+
});
|
|
139
|
+
return { stopped: true, outcome: result.outcome };
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=notion-stop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-stop.js","sour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