@forumone/throughline-audit 0.3.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +100 -0
- package/README.md +4 -2
- package/dist/options.d.ts +1 -1
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +12 -34
- package/dist/plugin.js.map +1 -1
- package/dist/tools/descriptors.d.ts +26 -0
- package/dist/tools/descriptors.d.ts.map +1 -0
- package/dist/tools/descriptors.js +35 -0
- package/dist/tools/descriptors.js.map +1 -0
- package/dist/tools/get-change-history.d.ts.map +1 -1
- package/dist/tools/get-change-history.js +2 -2
- package/dist/tools/get-change-history.js.map +1 -1
- package/dist/tools/get-recent-failures.d.ts.map +1 -1
- package/dist/tools/get-recent-failures.js +2 -2
- package/dist/tools/get-recent-failures.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/query-audit.d.ts.map +1 -1
- package/dist/tools/query-audit.js +2 -2
- package/dist/tools/query-audit.js.map +1 -1
- package/dist/tools/what-changed-in-range.d.ts.map +1 -1
- package/dist/tools/what-changed-in-range.js +2 -2
- package/dist/tools/what-changed-in-range.js.map +1 -1
- package/dist/tools/who-changed-what.d.ts.map +1 -1
- package/dist/tools/who-changed-what.js +2 -2
- package/dist/tools/who-changed-what.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,105 @@
|
|
|
1
1
|
# @forumone/throughline-audit
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a9262da: Per-tool gating works, because tool names no longer wait for `onInit`
|
|
8
|
+
|
|
9
|
+
`@payloadcms/plugin-mcp` generates one per-key checkbox per tool while the host's
|
|
10
|
+
config is being built, and then gates every call on the checkbox matching the
|
|
11
|
+
tool's name. Every Throughline tool was built at `onInit` — each closes over
|
|
12
|
+
`payload`, the publishing service or the manifest loader — so the array it maps
|
|
13
|
+
over was empty, no checkboxes were generated, and its `?? false` denied all 27
|
|
14
|
+
tools to every key. A valid key got a 200 and an empty `tools/list`, with nothing
|
|
15
|
+
wrong on either side.
|
|
16
|
+
|
|
17
|
+
The plugin needs only `name` and `description` then, and neither needs a Payload.
|
|
18
|
+
So a server now **declares** its tools as the config is built and **binds** their
|
|
19
|
+
handlers at `onInit`:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
options.mcpTools?.declare(PUBLISHING_TOOL_DESCRIPTORS, { serverName: 'publishing' })
|
|
23
|
+
// …later, at onInit:
|
|
24
|
+
options.mcpTools?.add(tools, { serverName: 'publishing' })
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Each package gained a `tools/descriptors.ts` holding every tool's name and
|
|
28
|
+
description; the factories spread from it, so the checkbox and the MCP client
|
|
29
|
+
cannot describe a tool differently. A `descriptors.test.ts` in each package
|
|
30
|
+
asserts the two sets match, without needing a database.
|
|
31
|
+
|
|
32
|
+
`createMcpToolCollector` gains `declare()` and an `unbound` list. Both mismatches
|
|
33
|
+
are refused rather than absorbed: a tool built but never declared throws at
|
|
34
|
+
`onInit` (it would otherwise be denied to every key, silently), and a tool
|
|
35
|
+
declared but never bound stays advertised with a handler that explains itself.
|
|
36
|
+
|
|
37
|
+
**Order in the host's plugin array is now load-bearing.** Every tool-bearing
|
|
38
|
+
server must come before `mcpPlugin`, or it declares into an array that has
|
|
39
|
+
already been read. It was only a convention before; it is a requirement now, and
|
|
40
|
+
the failure mode — a server's tools missing from every key — is the one this
|
|
41
|
+
change exists to remove.
|
|
42
|
+
|
|
43
|
+
`requiredScope` stays declared and read by nothing. Enforcement is the checkbox;
|
|
44
|
+
these record which tools are consequential, and are the mapping a scope-aware
|
|
45
|
+
default would be built from.
|
|
46
|
+
|
|
47
|
+
The playground registers `mcpPlugin` for the first time, so the suite's only
|
|
48
|
+
end-to-end host now exercises the tools rather than just their composition.
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [a9262da]
|
|
53
|
+
- @forumone/throughline-core@0.8.0
|
|
54
|
+
|
|
55
|
+
## 0.4.0
|
|
56
|
+
|
|
57
|
+
### Minor Changes
|
|
58
|
+
|
|
59
|
+
- 3140ea0: One MCP transport, not seven
|
|
60
|
+
|
|
61
|
+
Every plugin served its own `POST /<prefix>/mcp` on a 146-line JSON-RPC subset of
|
|
62
|
+
the protocol that spoke `tools/list` and `tools/call` and nothing else. Payload
|
|
63
|
+
ships an MCP server built on the official SDK — streamable HTTP, sessions, per-key
|
|
64
|
+
capability checkboxes — and the tools were never the transport. They now reach a
|
|
65
|
+
client through the host's `@payloadcms/plugin-mcp`, on one `/api/mcp`, via the
|
|
66
|
+
collector `createMcpToolCollector` already provided.
|
|
67
|
+
|
|
68
|
+
**Breaking.** Removed from `@forumone/throughline-core`: `createMcpHandler`,
|
|
69
|
+
`McpHandlerOptions`, `createApiKeysCollection`, `ApiKeysCollectionOptions`,
|
|
70
|
+
`DEFAULT_API_KEYS_SLUG`, `createBearerTokenAuthenticator`,
|
|
71
|
+
`BearerTokenAuthenticatorOptions`, `generateApiKey`. Removed from
|
|
72
|
+
`@forumone/throughline-plugin-contract`: `McpAuthenticator`, `McpAuthResult`.
|
|
73
|
+
`sha256Hex` stays exported, from `./utils` rather than `./auth`.
|
|
74
|
+
|
|
75
|
+
`routePrefix` is gone from `auditQueryPlugin`, `componentsPlugin` and
|
|
76
|
+
`integrationsPlugin` — omitted from their options types, so passing one is a
|
|
77
|
+
compile error rather than config that reads as if it does something. `/mcp` was
|
|
78
|
+
the only endpoint any of the three served. `publishingPlugin`, `approvalsPlugin`
|
|
79
|
+
and `formsPlugin` keep theirs; they still serve admin controls, the approval
|
|
80
|
+
action link and the public form post.
|
|
81
|
+
|
|
82
|
+
**A host that passes no `mcpTools` collector now has no MCP surface.** There is no
|
|
83
|
+
per-server endpoint left as a fallback. This is a config change of one line per
|
|
84
|
+
plugin, and `createMcpToolCollector`'s own docs carry the shape.
|
|
85
|
+
|
|
86
|
+
**What this costs, stated plainly.** `requiredScope` is now read by nothing —
|
|
87
|
+
`plugin-mcp` gates on checkboxes generated at config time, which this suite cannot
|
|
88
|
+
fill because every tool is built at `onInit`. So a key that authenticates reaches
|
|
89
|
+
every collected tool, exactly as an all-or-nothing per-server key did. The
|
|
90
|
+
declarations are kept because they are the mapping those checkboxes need; #78
|
|
91
|
+
tracks restoring enforcement, and the type's own doc comment says so.
|
|
92
|
+
|
|
93
|
+
Also drops the key collection from the playground, which leaves that app with no
|
|
94
|
+
MCP surface at all until `mcpPlugin` can be wired there — #79, blocked on moving
|
|
95
|
+
it off `payload@^3.83.0`.
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- Updated dependencies [3140ea0]
|
|
100
|
+
- @forumone/throughline-plugin-contract@0.4.0
|
|
101
|
+
- @forumone/throughline-core@0.7.0
|
|
102
|
+
|
|
3
103
|
## 0.3.1
|
|
4
104
|
|
|
5
105
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -4,7 +4,9 @@ Read-only MCP query tools over the Throughline audit log. Pairs with the writer
|
|
|
4
4
|
|
|
5
5
|
## What this package provides
|
|
6
6
|
|
|
7
|
-
Five MCP tools
|
|
7
|
+
Five MCP tools, handed to the host's collector at `onInit` and served by
|
|
8
|
+
`@payloadcms/plugin-mcp` on one `/api/mcp`. Pass `mcpTools` or they reach nobody.
|
|
9
|
+
All are read-only and emit no audit events of their own.
|
|
8
10
|
|
|
9
11
|
| Tool | Use it for | Default access |
|
|
10
12
|
|---|---|---|
|
|
@@ -74,7 +76,7 @@ auditQueryPlugin({
|
|
|
74
76
|
|
|
75
77
|
| Option | Type | Default | Notes |
|
|
76
78
|
|---|---|---|---|
|
|
77
|
-
| `
|
|
79
|
+
| `mcpTools` | `McpToolCollector` | — | The host's collector. Without it these five tools are unreachable |
|
|
78
80
|
| `collectionSlug` | `string` | `audit-events` | Must match the slug used by core's `auditPlugin` |
|
|
79
81
|
| `readAccess` | `(req) => boolean` | admin / editor | Custom predicate for read-side access |
|
|
80
82
|
| `enabled` | `boolean` | `true` | Set to `false` to no-op the plugin |
|
package/dist/options.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { McpToolCollector } from '@forumone/throughline-core';
|
|
2
2
|
import type { PayloadRequest } from 'payload';
|
|
3
3
|
import type { BaseCorePluginOptions } from '@forumone/throughline-plugin-contract';
|
|
4
|
-
export interface AuditQueryPluginOptions extends BaseCorePluginOptions {
|
|
4
|
+
export interface AuditQueryPluginOptions extends Omit<BaseCorePluginOptions, 'routePrefix'> {
|
|
5
5
|
/**
|
|
6
6
|
* Override the audit collection slug. Must match the slug `auditPlugin`
|
|
7
7
|
* (in `@forumone/throughline-core`) writes to. Default: `'audit-events'`.
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAQlF,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,aAAa,CAAC;IACzF;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAA;IAE7C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAC5B;AAED,eAAO,MAAM,6BAA6B,iBAAiB,CAAA;AAE3D;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,uBAAuB,GAAG,uBAAuB,CAEzF"}
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAqCA,MAAM,CAAC,MAAM,6BAA6B,GAAG,cAAc,CAAA;AAE3D;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgC;IAC9D,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
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,EAAqB,MAAM,uCAAuC,CAAA;AAG1F,OAAO,EACL,KAAK,uBAAuB,EAG7B,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,uCAAuC,CAAA;AAG1F,OAAO,EACL,KAAK,uBAAuB,EAG7B,MAAM,cAAc,CAAA;AAYrB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,uBAAuB,CAkD9D,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { getPluginRegistry } from '@forumone/throughline-plugin-contract';
|
|
2
|
-
import {
|
|
2
|
+
import { createNamedLogger, defaultLogger } from '@forumone/throughline-core';
|
|
3
3
|
import { DEFAULT_AUDIT_COLLECTION_SLUG, validateOptions, } from './options.js';
|
|
4
|
-
import { createGetChangeHistoryTool, createGetRecentFailuresTool, createQueryAuditTool, createWhatChangedInRangeTool, createWhoChangedWhatTool, } from './tools/index.js';
|
|
4
|
+
import { AUDIT_TOOL_DESCRIPTORS, createGetChangeHistoryTool, createGetRecentFailuresTool, createQueryAuditTool, createWhatChangedInRangeTool, createWhoChangedWhatTool, } from './tools/index.js';
|
|
5
5
|
const PLUGIN_ID = '@forumone/throughline-audit';
|
|
6
6
|
const PLUGIN_VERSION = '0.1.0';
|
|
7
|
-
const MCP_HANDLER_SYMBOL = Symbol.for('@forumone/throughline/audit-mcp-handler');
|
|
8
7
|
/**
|
|
9
8
|
* Read-only MCP server over the audit log. Pairs with `auditPlugin` from
|
|
10
9
|
* `@forumone/throughline-core` (which writes records). The query plugin
|
|
@@ -16,25 +15,17 @@ export const auditQueryPlugin = (rawOptions) => (incomingConfig) => {
|
|
|
16
15
|
if (rawOptions.enabled === false)
|
|
17
16
|
return incomingConfig;
|
|
18
17
|
const options = validateOptions(rawOptions);
|
|
19
|
-
const routePrefix = options.routePrefix ?? '/audit';
|
|
20
18
|
const collectionSlug = options.collectionSlug ?? DEFAULT_AUDIT_COLLECTION_SLUG;
|
|
21
19
|
const logger = createNamedLogger('audit-query', options.logger ?? defaultLogger);
|
|
20
|
+
/*
|
|
21
|
+
Declared here, bound at `onInit` — `mcpPlugin` generates its per-key
|
|
22
|
+
checkboxes from these names and descriptions while the config is built, and
|
|
23
|
+
denies any tool it has no checkbox for. This plugin must therefore come
|
|
24
|
+
before `mcpPlugin` in the host's array.
|
|
25
|
+
*/
|
|
26
|
+
options.mcpTools?.declare(AUDIT_TOOL_DESCRIPTORS, { serverName: 'audit' });
|
|
22
27
|
return {
|
|
23
28
|
...incomingConfig,
|
|
24
|
-
endpoints: [
|
|
25
|
-
...(incomingConfig.endpoints ?? []),
|
|
26
|
-
{
|
|
27
|
-
path: `${routePrefix}/mcp`,
|
|
28
|
-
method: 'post',
|
|
29
|
-
handler: async (req) => {
|
|
30
|
-
const handler = req.payload[MCP_HANDLER_SYMBOL];
|
|
31
|
-
if (!handler) {
|
|
32
|
-
return new Response(JSON.stringify({ error: 'Audit query MCP not initialized' }), { status: 503, headers: { 'content-type': 'application/json' } });
|
|
33
|
-
}
|
|
34
|
-
return handler(req);
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
29
|
onInit: async (payload) => {
|
|
39
30
|
if (incomingConfig.onInit)
|
|
40
31
|
await incomingConfig.onInit(payload);
|
|
@@ -48,22 +39,10 @@ export const auditQueryPlugin = (rawOptions) => (incomingConfig) => {
|
|
|
48
39
|
createWhatChangedInRangeTool(deps),
|
|
49
40
|
createGetRecentFailuresTool(deps),
|
|
50
41
|
];
|
|
51
|
-
// Payload's own MCP plugin,
|
|
52
|
-
//
|
|
53
|
-
//
|
|
42
|
+
// Payload's own MCP plugin, and the only transport these tools have.
|
|
43
|
+
// `onInit` is both the earliest they can exist and still early enough
|
|
44
|
+
// that `mcpPlugin` reads the array populated.
|
|
54
45
|
options.mcpTools?.add(tools, { serverName: 'audit', logger });
|
|
55
|
-
const handler = createMcpHandler({
|
|
56
|
-
payload,
|
|
57
|
-
serverName: 'audit',
|
|
58
|
-
tools,
|
|
59
|
-
logger,
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(payload, MCP_HANDLER_SYMBOL, {
|
|
62
|
-
value: handler,
|
|
63
|
-
enumerable: false,
|
|
64
|
-
writable: false,
|
|
65
|
-
configurable: false,
|
|
66
|
-
});
|
|
67
46
|
registry.register({
|
|
68
47
|
id: PLUGIN_ID,
|
|
69
48
|
version: PLUGIN_VERSION,
|
|
@@ -71,7 +50,6 @@ export const auditQueryPlugin = (rawOptions) => (incomingConfig) => {
|
|
|
71
50
|
});
|
|
72
51
|
logger.info('Audit query server ready', {
|
|
73
52
|
collectionSlug,
|
|
74
|
-
routePrefix,
|
|
75
53
|
toolCount: tools.length,
|
|
76
54
|
});
|
|
77
55
|
},
|
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,EAAE,
|
|
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,MAAM,4BAA4B,CAAA;AAC7E,OAAO,EAEL,6BAA6B,EAC7B,eAAe,GAChB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,kBAAkB,CAAA;AAEzB,MAAM,SAAS,GAAG,6BAA6B,CAAA;AAC/C,MAAM,cAAc,GAAG,OAAO,CAAA;AAC9B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,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,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,6BAA6B,CAAA;IAC9E,MAAM,MAAM,GAAG,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC,CAAA;IAEhF;;;;;MAKE;IACF,OAAO,CA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ly name: "query_audit";
|
|
5
|
+
readonly description: "General-purpose audit log query. Filter by collection, document, actor, action, server, date range, or failure-only. Returns chronologically ordered results, most recent first. Use when you need a custom view of system activity that doesn't fit the more specific tools.";
|
|
6
|
+
};
|
|
7
|
+
readonly getChangeHistory: {
|
|
8
|
+
readonly name: "get_change_history";
|
|
9
|
+
readonly description: "Returns the complete chronological history of actions on a single document, including diffs. Use to answer \"what has happened to this page?\" or \"who changed X?\". Most-recent first.";
|
|
10
|
+
};
|
|
11
|
+
readonly whoChangedWhat: {
|
|
12
|
+
readonly name: "who_changed_what";
|
|
13
|
+
readonly description: "A user's recent activity. Use when someone asks 'what has Sarah been working on?' or 'show me my changes today'. If actorId is omitted, defaults to the authenticated caller — so users can ask about themselves without knowing their ID. Other users' activity requires admin/editor.";
|
|
14
|
+
};
|
|
15
|
+
readonly whatChangedInRange: {
|
|
16
|
+
readonly name: "what_changed_in_range";
|
|
17
|
+
readonly description: "Summarized activity over a time range, grouped by action type, actor, and target collection. Use for \"what happened last week?\" or weekly review questions. Returns counts and top contributors rather than individual events. Caps the scan at 1000 events by default — for wider sweeps, raise scanLimit or use query_audit with paging.";
|
|
18
|
+
};
|
|
19
|
+
readonly getRecentFailures: {
|
|
20
|
+
readonly name: "get_recent_failures";
|
|
21
|
+
readonly description: "Recent failed operations across all MCP servers. Use for \"what broke recently?\" or when diagnosing issues. Returns actions with success=false and their error messages, most recent first.";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/** Every tool this server contributes, for the collector. */
|
|
25
|
+
export declare const AUDIT_TOOL_DESCRIPTORS: readonly McpToolDescriptor[];
|
|
26
|
+
//# sourceMappingURL=descriptors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../src/tools/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAYnE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;CA0B8B,CAAA;AAEtD,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,EAAE,SAAS,iBAAiB,EAA+B,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This server's tools, by name and description, knowable without a Payload.
|
|
3
|
+
|
|
4
|
+
`@payloadcms/plugin-mcp` reads exactly these two fields while the host's config
|
|
5
|
+
is being built, to generate one per-key checkbox per tool, and denies any tool it
|
|
6
|
+
has no checkbox for. The handlers close over `payload`, so they cannot exist that
|
|
7
|
+
early — the names never needed to wait for them.
|
|
8
|
+
|
|
9
|
+
The factories below spread these, so the two cannot drift.
|
|
10
|
+
*/
|
|
11
|
+
export const AUDIT_TOOLS = {
|
|
12
|
+
queryAudit: {
|
|
13
|
+
name: 'query_audit',
|
|
14
|
+
description: "General-purpose audit log query. Filter by collection, document, actor, action, server, date range, or failure-only. Returns chronologically ordered results, most recent first. Use when you need a custom view of system activity that doesn't fit the more specific tools.",
|
|
15
|
+
},
|
|
16
|
+
getChangeHistory: {
|
|
17
|
+
name: 'get_change_history',
|
|
18
|
+
description: 'Returns the complete chronological history of actions on a single document, including diffs. Use to answer "what has happened to this page?" or "who changed X?". Most-recent first.',
|
|
19
|
+
},
|
|
20
|
+
whoChangedWhat: {
|
|
21
|
+
name: 'who_changed_what',
|
|
22
|
+
description: "A user's recent activity. Use when someone asks 'what has Sarah been working on?' or 'show me my changes today'. If actorId is omitted, defaults to the authenticated caller — so users can ask about themselves without knowing their ID. Other users' activity requires admin/editor.",
|
|
23
|
+
},
|
|
24
|
+
whatChangedInRange: {
|
|
25
|
+
name: 'what_changed_in_range',
|
|
26
|
+
description: 'Summarized activity over a time range, grouped by action type, actor, and target collection. Use for "what happened last week?" or weekly review questions. Returns counts and top contributors rather than individual events. Caps the scan at 1000 events by default — for wider sweeps, raise scanLimit or use query_audit with paging.',
|
|
27
|
+
},
|
|
28
|
+
getRecentFailures: {
|
|
29
|
+
name: 'get_recent_failures',
|
|
30
|
+
description: 'Recent failed operations across all MCP servers. Use for "what broke recently?" or when diagnosing issues. Returns actions with success=false and their error messages, most recent first.',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/** Every tool this server contributes, for the collector. */
|
|
34
|
+
export const AUDIT_TOOL_DESCRIPTORS = Object.values(AUDIT_TOOLS);
|
|
35
|
+
//# sourceMappingURL=descriptors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../src/tools/descriptors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;EASE;AACF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,UAAU,EAAE;QACV,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,+QAA+Q;KAClR;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,sLAAsL;KACzL;IACD,cAAc,EAAE;QACd,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACT,yRAAyR;KAC5R;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,4UAA4U;KAC/U;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,4LAA4L;KAC/L;CACmD,CAAA;AAEtD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,sBAAsB,GAAiC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-change-history.d.ts","sourceRoot":"","sources":["../../src/tools/get-change-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"get-change-history.d.ts","sourceRoot":"","sources":["../../src/tools/get-change-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAK9E,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,QAAA,MAAM,WAAW;;;;;;;;;;;;EAUf,CAAA;AAEF,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,oBAAoB,GACzB,iBAAiB,CAAC,OAAO,WAAW,CAAC,CA6BvC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { formatAuditEvent } from '../formatting/index.js';
|
|
3
3
|
import { deniedEnvelope, isAuditReader } from './access.js';
|
|
4
|
+
import { AUDIT_TOOLS } from './descriptors.js';
|
|
4
5
|
const inputSchema = z.object({
|
|
5
6
|
targetCollection: z.string().describe('Collection slug (e.g. "pages").'),
|
|
6
7
|
targetId: z.string().describe('Document ID within the collection.'),
|
|
@@ -14,8 +15,7 @@ const inputSchema = z.object({
|
|
|
14
15
|
});
|
|
15
16
|
export function createGetChangeHistoryTool(deps) {
|
|
16
17
|
return {
|
|
17
|
-
|
|
18
|
-
description: 'Returns the complete chronological history of actions on a single document, including diffs. Use to answer "what has happened to this page?" or "who changed X?". Most-recent first.',
|
|
18
|
+
...AUDIT_TOOLS.getChangeHistory,
|
|
19
19
|
inputSchema,
|
|
20
20
|
handler: async (input, ctx) => {
|
|
21
21
|
if (!isAuditReader(ctx)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-change-history.js","sourceRoot":"","sources":["../../src/tools/get-change-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,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,CAAC,gBAAgB,EAAE,EAAE;wBACxD,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE;qBACzC;iBACF;gBACD,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE;aACzB,CAAC,CAAA;YAEF,OAAO;gBACL,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;gBACxC,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,UAAU,EAAE,MAAM,CAAC,SAAS;gBAC5B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAA8B,CAAC,CAAC;aACpF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-recent-failures.d.ts","sourceRoot":"","sources":["../../src/tools/get-recent-failures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAS,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"get-recent-failures.d.ts","sourceRoot":"","sources":["../../src/tools/get-recent-failures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAS,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAK9E,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,QAAA,MAAM,WAAW;;;;;;;;;;;;EAmBf,CAAA;AAEF,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,qBAAqB,GAC1B,iBAAiB,CAAC,OAAO,WAAW,CAAC,CAgCvC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { formatAuditEvent } from '../formatting/index.js';
|
|
3
3
|
import { deniedEnvelope, isAuditReader } from './access.js';
|
|
4
|
+
import { AUDIT_TOOLS } from './descriptors.js';
|
|
4
5
|
const inputSchema = z.object({
|
|
5
6
|
hours: z
|
|
6
7
|
.number()
|
|
@@ -23,8 +24,7 @@ const inputSchema = z.object({
|
|
|
23
24
|
});
|
|
24
25
|
export function createGetRecentFailuresTool(deps) {
|
|
25
26
|
return {
|
|
26
|
-
|
|
27
|
-
description: 'Recent failed operations across all MCP servers. Use for "what broke recently?" or when diagnosing issues. Returns actions with success=false and their error messages, most recent first.',
|
|
27
|
+
...AUDIT_TOOLS.getRecentFailures,
|
|
28
28
|
inputSchema,
|
|
29
29
|
handler: async (input, ctx) => {
|
|
30
30
|
if (!isAuditReader(ctx)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-recent-failures.js","sourceRoot":"","sources":["../../src/tools/get-recent-failures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"get-recent-failures.js","sourceRoot":"","sources":["../../src/tools/get-recent-failures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAO9C,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC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M,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;gBACrC,UAAU,EAAE,IAAI,CAAC,cAAc;gBAC/B,KAAK,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE;gBAC1B,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE;aACzB,CAAC,CAAA;YAEF,OAAO;gBACL,YAAY,EAAE,KAAK;gBACnB,KAAK;gBACL,YAAY,EAAE,MAAM,CAAC,SAAS;gBAC9B,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAA8B,CAAC,CAAC;aACrF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAChE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAA;AACzE,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AACtE,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAChE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAA;AACzE,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AACtE,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/tools/index.js
CHANGED
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAEpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAEhE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAA;AAEzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAEpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAEhE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAA;AAEzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-audit.d.ts","sourceRoot":"","sources":["../../src/tools/query-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAS,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"query-audit.d.ts","sourceRoot":"","sources":["../../src/tools/query-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAS,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAK9E,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCf,CAAA;AAEF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,iBAAiB,CAAC,OAAO,WAAW,CAAC,CAmChG"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { formatAuditEvent } from '../formatting/index.js';
|
|
3
3
|
import { deniedEnvelope, isAuditReader } from './access.js';
|
|
4
|
+
import { AUDIT_TOOLS } from './descriptors.js';
|
|
4
5
|
const inputSchema = z.object({
|
|
5
6
|
targetCollection: z
|
|
6
7
|
.string()
|
|
@@ -37,8 +38,7 @@ const inputSchema = z.object({
|
|
|
37
38
|
});
|
|
38
39
|
export function createQueryAuditTool(deps) {
|
|
39
40
|
return {
|
|
40
|
-
|
|
41
|
-
description: "General-purpose audit log query. Filter by collection, document, actor, action, server, date range, or failure-only. Returns chronologically ordered results, most recent first. Use when you need a custom view of system activity that doesn't fit the more specific tools.",
|
|
41
|
+
...AUDIT_TOOLS.queryAudit,
|
|
42
42
|
inputSchema,
|
|
43
43
|
handler: async (input, ctx) => {
|
|
44
44
|
if (!isAuditReader(ctx)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-audit.js","sourceRoot":"","sources":["../../src/tools/query-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"query-audit.js","sourceRoot":"","sources":["../../src/tools/query-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAO9C,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,gBAAgB,EAAE,CAAC;SAChB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,iDAAiD,CAAC;IAC9D,QAAQ,E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gBAC/B,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAChE,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE;aACzB,CAAC,CAAA;YAEF,OAAO;gBACL,KAAK,EAAE,MAAM,CAAC,SAAS;gBACvB,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;gBAC5B,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAA8B,CAAC,CAAC;aACnF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"what-changed-in-range.d.ts","sourceRoot":"","sources":["../../src/tools/what-changed-in-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"what-changed-in-range.d.ts","sourceRoot":"","sources":["../../src/tools/what-changed-in-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAI9E,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,QAAA,MAAM,WAAW;;;;;;;;;;;;EAUf,CAAA;AAEF,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,sBAAsB,GAC3B,iBAAiB,CAAC,OAAO,WAAW,CAAC,CAoFvC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { deniedEnvelope, isAuditReader } from './access.js';
|
|
3
|
+
import { AUDIT_TOOLS } from './descriptors.js';
|
|
3
4
|
const inputSchema = z.object({
|
|
4
5
|
from: z.string().datetime().describe('ISO-8601 start of range (inclusive).'),
|
|
5
6
|
to: z.string().datetime().describe('ISO-8601 end of range (inclusive).'),
|
|
@@ -13,8 +14,7 @@ const inputSchema = z.object({
|
|
|
13
14
|
});
|
|
14
15
|
export function createWhatChangedInRangeTool(deps) {
|
|
15
16
|
return {
|
|
16
|
-
|
|
17
|
-
description: 'Summarized activity over a time range, grouped by action type, actor, and target collection. Use for "what happened last week?" or weekly review questions. Returns counts and top contributors rather than individual events. Caps the scan at 1000 events by default — for wider sweeps, raise scanLimit or use query_audit with paging.',
|
|
17
|
+
...AUDIT_TOOLS.whatChangedInRange,
|
|
18
18
|
inputSchema,
|
|
19
19
|
handler: async (input, ctx) => {
|
|
20
20
|
if (!isAuditReader(ctx)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"what-changed-in-range.js","sourceRoot":"","sources":["../../src/tools/what-changed-in-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"what-changed-in-range.js","sourceRoot":"","sources":["../../src/tools/what-changed-in-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAO9C,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,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AO,CAAC,OAAO,EAAE,CAAC;qBACrC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;qBACrD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;qBACjC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;gBACf,YAAY,EAAE,MAAM,CAAC,WAAW,CAC9B,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/D;gBACD,QAAQ,EAAE,MAAM,CAAC,WAAW,CAC1B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3D;aACF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"who-changed-what.d.ts","sourceRoot":"","sources":["../../src/tools/who-changed-what.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAS,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"who-changed-what.d.ts","sourceRoot":"","sources":["../../src/tools/who-changed-what.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAS,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAK9E,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBf,CAAA;AAEF,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,kBAAkB,GACvB,iBAAiB,CAAC,OAAO,WAAW,CAAC,CA8CvC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { formatAuditEvent } from '../formatting/index.js';
|
|
3
3
|
import { deniedEnvelope, isAuditReader } from './access.js';
|
|
4
|
+
import { AUDIT_TOOLS } from './descriptors.js';
|
|
4
5
|
const inputSchema = z.object({
|
|
5
6
|
actorId: z
|
|
6
7
|
.string()
|
|
@@ -22,8 +23,7 @@ const inputSchema = z.object({
|
|
|
22
23
|
});
|
|
23
24
|
export function createWhoChangedWhatTool(deps) {
|
|
24
25
|
return {
|
|
25
|
-
|
|
26
|
-
description: "A user's recent activity. Use when someone asks 'what has Sarah been working on?' or 'show me my changes today'. If actorId is omitted, defaults to the authenticated caller — so users can ask about themselves without knowing their ID. Other users' activity requires admin/editor.",
|
|
26
|
+
...AUDIT_TOOLS.whoChangedWhat,
|
|
27
27
|
inputSchema,
|
|
28
28
|
handler: async (input, ctx) => {
|
|
29
29
|
const callerId = ctx.user?.id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"who-changed-what.js","sourceRoot":"","sources":["../../src/tools/who-changed-what.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,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,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,OAAO,CAAC;oBAC7B,CAAC,CAAC,OAAO,CAAA;YAEf,OAAO;gBACL,OAAO;gBACP,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,MAAM,CAAC,SAAS;gBAC7B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAA8B,CAAC,CAAC;aACpF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forumone/throughline-audit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Read-only MCP query tools over the Throughline audit log. Pairs with core's auditPlugin (which writes records).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"zod": "^3.23.0",
|
|
43
|
-
"@forumone/throughline-core": "0.
|
|
44
|
-
"@forumone/throughline-plugin-contract": "0.
|
|
43
|
+
"@forumone/throughline-core": "0.8.0",
|
|
44
|
+
"@forumone/throughline-plugin-contract": "0.4.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "^20.17.0",
|