@forumone/throughline-approvals 0.5.1 → 0.6.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/CHANGELOG.md +49 -0
- package/README.md +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +4 -28
- package/dist/plugin.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @forumone/throughline-approvals
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3140ea0: One MCP transport, not seven
|
|
8
|
+
|
|
9
|
+
Every plugin served its own `POST /<prefix>/mcp` on a 146-line JSON-RPC subset of
|
|
10
|
+
the protocol that spoke `tools/list` and `tools/call` and nothing else. Payload
|
|
11
|
+
ships an MCP server built on the official SDK — streamable HTTP, sessions, per-key
|
|
12
|
+
capability checkboxes — and the tools were never the transport. They now reach a
|
|
13
|
+
client through the host's `@payloadcms/plugin-mcp`, on one `/api/mcp`, via the
|
|
14
|
+
collector `createMcpToolCollector` already provided.
|
|
15
|
+
|
|
16
|
+
**Breaking.** Removed from `@forumone/throughline-core`: `createMcpHandler`,
|
|
17
|
+
`McpHandlerOptions`, `createApiKeysCollection`, `ApiKeysCollectionOptions`,
|
|
18
|
+
`DEFAULT_API_KEYS_SLUG`, `createBearerTokenAuthenticator`,
|
|
19
|
+
`BearerTokenAuthenticatorOptions`, `generateApiKey`. Removed from
|
|
20
|
+
`@forumone/throughline-plugin-contract`: `McpAuthenticator`, `McpAuthResult`.
|
|
21
|
+
`sha256Hex` stays exported, from `./utils` rather than `./auth`.
|
|
22
|
+
|
|
23
|
+
`routePrefix` is gone from `auditQueryPlugin`, `componentsPlugin` and
|
|
24
|
+
`integrationsPlugin` — omitted from their options types, so passing one is a
|
|
25
|
+
compile error rather than config that reads as if it does something. `/mcp` was
|
|
26
|
+
the only endpoint any of the three served. `publishingPlugin`, `approvalsPlugin`
|
|
27
|
+
and `formsPlugin` keep theirs; they still serve admin controls, the approval
|
|
28
|
+
action link and the public form post.
|
|
29
|
+
|
|
30
|
+
**A host that passes no `mcpTools` collector now has no MCP surface.** There is no
|
|
31
|
+
per-server endpoint left as a fallback. This is a config change of one line per
|
|
32
|
+
plugin, and `createMcpToolCollector`'s own docs carry the shape.
|
|
33
|
+
|
|
34
|
+
**What this costs, stated plainly.** `requiredScope` is now read by nothing —
|
|
35
|
+
`plugin-mcp` gates on checkboxes generated at config time, which this suite cannot
|
|
36
|
+
fill because every tool is built at `onInit`. So a key that authenticates reaches
|
|
37
|
+
every collected tool, exactly as an all-or-nothing per-server key did. The
|
|
38
|
+
declarations are kept because they are the mapping those checkboxes need; #78
|
|
39
|
+
tracks restoring enforcement, and the type's own doc comment says so.
|
|
40
|
+
|
|
41
|
+
Also drops the key collection from the playground, which leaves that app with no
|
|
42
|
+
MCP surface at all until `mcpPlugin` can be wired there — #79, blocked on moving
|
|
43
|
+
it off `payload@^3.83.0`.
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [3140ea0]
|
|
48
|
+
- @forumone/throughline-plugin-contract@0.4.0
|
|
49
|
+
- @forumone/throughline-publishing@0.8.0
|
|
50
|
+
- @forumone/throughline-core@0.7.0
|
|
51
|
+
|
|
3
52
|
## 0.5.1
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Conversational approval workflow server for Throughline. Provides the resolver t
|
|
|
8
8
|
- **Approval resolver** that the publishing server's `approvalStep` calls to check for active granted approvals (auto-attached on the Payload instance via Symbol — no manual wiring needed).
|
|
9
9
|
- **HMAC-signed action tokens** (`generateActionToken` / `verifyActionToken`) for inline-action emails. Single-use enforcement via the per-record `consumedTokens` array prevents replay.
|
|
10
10
|
- **HTTP action endpoint** at `/api/approvals/action` that handles email button clicks: verify token → confirmation page → record decision.
|
|
11
|
-
- **Five MCP tools
|
|
11
|
+
- **Five MCP tools**, handed to the host's collector at `onInit` and served by `@payloadcms/plugin-mcp` on one `/api/mcp`. Pass `mcpTools` or they reach nobody:
|
|
12
12
|
|
|
13
13
|
| Tool | Audit |
|
|
14
14
|
|---|---|
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AAGvE,OAAO,EAAE,KAAK,sBAAsB,EAAmB,MAAM,cAAc,CAAA;AAgB3E,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC,sBAAsB,CAkF5D,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getPluginRegistry } from '@forumone/throughline-plugin-contract';
|
|
2
|
-
import {
|
|
2
|
+
import { createNamedLogger, defaultLogger, getAuditWriter } from '@forumone/throughline-core';
|
|
3
3
|
import { validateOptions } from './options.js';
|
|
4
4
|
import { createApprovalsCollection } from './collection.js';
|
|
5
5
|
import { attachApprovalResolver, createApprovalResolver } from './resolver.js';
|
|
@@ -7,7 +7,6 @@ import { createActionEndpoint } from './endpoints/action.js';
|
|
|
7
7
|
import { createGetApprovalStatusTool, createListMyRequestsTool, createListPendingApprovalsTool, createRequestApprovalTool, createRespondToApprovalTool, } from './tools/index.js';
|
|
8
8
|
const PLUGIN_ID = '@forumone/throughline-approvals';
|
|
9
9
|
const PLUGIN_VERSION = '0.1.0';
|
|
10
|
-
const MCP_HANDLER_SYMBOL = Symbol.for('@forumone/throughline/approvals-mcp-handler');
|
|
11
10
|
const ACTION_HANDLER_SYMBOL = Symbol.for('@forumone/throughline/approvals-action-handler');
|
|
12
11
|
export const approvalsPlugin = (rawOptions) => (incomingConfig) => {
|
|
13
12
|
if (rawOptions.enabled === false)
|
|
@@ -25,17 +24,6 @@ export const approvalsPlugin = (rawOptions) => (incomingConfig) => {
|
|
|
25
24
|
collections: [...(incomingConfig.collections ?? []), collection],
|
|
26
25
|
endpoints: [
|
|
27
26
|
...(incomingConfig.endpoints ?? []),
|
|
28
|
-
{
|
|
29
|
-
path: `${routePrefix}/mcp`,
|
|
30
|
-
method: 'post',
|
|
31
|
-
handler: async (req) => {
|
|
32
|
-
const handler = req.payload[MCP_HANDLER_SYMBOL];
|
|
33
|
-
if (!handler) {
|
|
34
|
-
return new Response(JSON.stringify({ error: 'Approvals MCP not initialized' }), { status: 503, headers: { 'content-type': 'application/json' } });
|
|
35
|
-
}
|
|
36
|
-
return handler(req);
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
27
|
{
|
|
40
28
|
path: `${routePrefix}/action`,
|
|
41
29
|
method: 'get',
|
|
@@ -72,22 +60,10 @@ export const approvalsPlugin = (rawOptions) => (incomingConfig) => {
|
|
|
72
60
|
createListPendingApprovalsTool({ payload, options }),
|
|
73
61
|
createListMyRequestsTool({ payload, options }),
|
|
74
62
|
];
|
|
75
|
-
// Payload's own MCP plugin,
|
|
76
|
-
//
|
|
77
|
-
//
|
|
63
|
+
// Payload's own MCP plugin, and the only transport these tools have.
|
|
64
|
+
// `onInit` is both the earliest they can exist and still early enough
|
|
65
|
+
// that `mcpPlugin` reads the array populated.
|
|
78
66
|
options.mcpTools?.add(tools, { serverName: 'approvals', logger });
|
|
79
|
-
const handler = createMcpHandler({
|
|
80
|
-
payload,
|
|
81
|
-
serverName: 'approvals',
|
|
82
|
-
tools,
|
|
83
|
-
logger,
|
|
84
|
-
});
|
|
85
|
-
Object.defineProperty(payload, MCP_HANDLER_SYMBOL, {
|
|
86
|
-
value: handler,
|
|
87
|
-
enumerable: false,
|
|
88
|
-
writable: false,
|
|
89
|
-
configurable: false,
|
|
90
|
-
});
|
|
91
67
|
registry.register({
|
|
92
68
|
id: PLUGIN_ID,
|
|
93
69
|
version: PLUGIN_VERSION,
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EAA+B,eAAe,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,kBAAkB,CAAA;AAEzB,MAAM,SAAS,GAAG,iCAAiC,CAAA;AACnD,MAAM,cAAc,GAAG,OAAO,CAAA;AAC9B,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAA;AAE1F,MAAM,CAAC,MAAM,eAAe,GAC1B,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,cAAc,EAAE,EAAE;IACjC,IAAI,UAAU,CAAC,OAAO,KAAK,KAAK;QAAE,OAAO,cAAc,CAAA;IAEvD,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,CAAC,CAAA;IAC3C,MAA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E,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;YAEjE,QAAQ,CAAC,QAAQ,CAAC;gBAChB,EAAE,EAAE,SAAS;gBACb,OAAO,EAAE,cAAc;gBACvB,YAAY,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;aACjD,CAAC,CAAA;YAEF,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE;gBACpC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;gBACzC,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,CAAC;aAC5C,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAEH,4EAA4E;AAC5E,0EAA0E;AAC1E,yEAAyE;AACzE,uCAAuC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forumone/throughline-approvals",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Conversational approval workflow server for Throughline. Provides the approval resolver the publishing server consumes plus MCP tools for requesting and responding to approvals.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"zod": "^3.23.0",
|
|
45
|
-
"@forumone/throughline-core": "0.
|
|
46
|
-
"@forumone/throughline-plugin-contract": "0.
|
|
47
|
-
"@forumone/throughline-publishing": "0.
|
|
45
|
+
"@forumone/throughline-core": "0.7.0",
|
|
46
|
+
"@forumone/throughline-plugin-contract": "0.4.0",
|
|
47
|
+
"@forumone/throughline-publishing": "0.8.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/node": "^20.17.0",
|