agentic-notify 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-6QCYA3X7.js → chunk-ARL7FN6Y.js} +0 -99
- package/dist/chunk-PHY45IVQ.js +101 -0
- package/dist/cli.js +2 -1
- package/dist/{dispatch-LBnkLOQg.d.ts → dispatch-xe2IAqWe.d.ts} +3 -3
- package/dist/{gdpr-CUq5MUwo.d.ts → gdpr-BAg1U1w6.d.ts} +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -2
- package/dist/mcp-bin.js +23 -14
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +82 -6
- package/dist/sdk.d.ts +8 -8
- package/dist/{testing-B5slvYDV.d.ts → testing-46doJP5Y.d.ts} +2 -2
- package/dist/testing.d.ts +3 -3
- package/dist/{types-DONKNIOo.d.ts → types-BdX7UTFu.d.ts} +1 -1
- package/dist/worker.d.ts +4 -4
- package/dist/worker.js +4 -2
- package/package.json +1 -1
- package/dist/chunk-POSHKDNY.js +0 -86
- package/dist/{types-C842YAMe.d.ts → types-anA8DMQH.d.ts} +30 -30
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Notifications for humans and agents: in-app inbox, email and webhook delivery, with a CLI, API, MCP server and SDK.
|
|
7
7
|
|
|
8
|
-
**Status: 0.2.
|
|
8
|
+
**Status: 0.2.1.** Breaking for 0.1.0 code and databases, see the CHANGELOG upgrade steps. Works today: the notification model, preferences and mute, digest, a store port from agentic-identity with its memory and D1 adapters, signed webhook and email delivery through a dispatcher, an HTTP API in a Worker, an SDK, a CLI, MCP tools, per-recipient export and erase, and a retention sweep. Not done: a real email provider adapter, webhook endpoint management, and a web UI.
|
|
9
9
|
|
|
10
10
|
## Live demo
|
|
11
11
|
|
|
@@ -1,101 +1,3 @@
|
|
|
1
|
-
// package.json
|
|
2
|
-
var package_default = {
|
|
3
|
-
name: "agentic-notify",
|
|
4
|
-
version: "0.2.0",
|
|
5
|
-
description: "Notifications for humans and agents: in-app inbox, webhook and email delivery, with SDK, CLI, MCP server and Worker API.",
|
|
6
|
-
keywords: [
|
|
7
|
-
"notifications",
|
|
8
|
-
"inbox",
|
|
9
|
-
"webhook",
|
|
10
|
-
"agents",
|
|
11
|
-
"mcp",
|
|
12
|
-
"cli",
|
|
13
|
-
"cloudflare-workers",
|
|
14
|
-
"typescript"
|
|
15
|
-
],
|
|
16
|
-
license: "MIT",
|
|
17
|
-
author: "Pooria Arab",
|
|
18
|
-
repository: {
|
|
19
|
-
type: "git",
|
|
20
|
-
url: "git+https://github.com/pooriaarab/agentic-notify.git"
|
|
21
|
-
},
|
|
22
|
-
type: "module",
|
|
23
|
-
private: false,
|
|
24
|
-
engines: {
|
|
25
|
-
node: ">=20"
|
|
26
|
-
},
|
|
27
|
-
files: [
|
|
28
|
-
"dist"
|
|
29
|
-
],
|
|
30
|
-
publishConfig: {
|
|
31
|
-
access: "public"
|
|
32
|
-
},
|
|
33
|
-
mcpName: "io.github.pooriaarab/agentic-notify",
|
|
34
|
-
main: "./dist/index.js",
|
|
35
|
-
types: "./dist/index.d.ts",
|
|
36
|
-
exports: {
|
|
37
|
-
".": {
|
|
38
|
-
types: "./dist/index.d.ts",
|
|
39
|
-
import: "./dist/index.js"
|
|
40
|
-
},
|
|
41
|
-
"./testing": {
|
|
42
|
-
types: "./dist/testing.d.ts",
|
|
43
|
-
import: "./dist/testing.js"
|
|
44
|
-
},
|
|
45
|
-
"./sdk": {
|
|
46
|
-
types: "./dist/sdk.d.ts",
|
|
47
|
-
import: "./dist/sdk.js"
|
|
48
|
-
},
|
|
49
|
-
"./worker": {
|
|
50
|
-
types: "./dist/worker.d.ts",
|
|
51
|
-
import: "./dist/worker.js"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
bin: {
|
|
55
|
-
"agentic-notify": "./dist/cli.js",
|
|
56
|
-
"agentic-notify-mcp": "./dist/mcp-bin.js"
|
|
57
|
-
},
|
|
58
|
-
scripts: {
|
|
59
|
-
build: "tsup",
|
|
60
|
-
typecheck: "tsc --noEmit",
|
|
61
|
-
test: "vitest run",
|
|
62
|
-
clean: "rm -rf dist",
|
|
63
|
-
prepack: "npm run build",
|
|
64
|
-
"ci:local": "npm run build && npm run typecheck && npm run check:worker && npm test",
|
|
65
|
-
"deploy:demo": "wrangler deploy --config wrangler.demo.jsonc",
|
|
66
|
-
"check:worker": "esbuild src/worker.ts --bundle --platform=neutral --format=esm --log-level=warning --outfile=node_modules/.cache/worker-check.js"
|
|
67
|
-
},
|
|
68
|
-
dependencies: {
|
|
69
|
-
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
70
|
-
"agentic-identity": "^0.4.0",
|
|
71
|
-
hono: "^4.13.14",
|
|
72
|
-
zod: "^3.25.0"
|
|
73
|
-
},
|
|
74
|
-
devDependencies: {
|
|
75
|
-
"@types/node": "^22.0.0",
|
|
76
|
-
esbuild: "^0.28.2",
|
|
77
|
-
miniflare: "^4.20260730.0",
|
|
78
|
-
tsup: "^8.0.0",
|
|
79
|
-
typescript: "^5.6.0",
|
|
80
|
-
vitest: "^3.0.0",
|
|
81
|
-
wrangler: "^4.155.0"
|
|
82
|
-
},
|
|
83
|
-
peerDependencies: {
|
|
84
|
-
vitest: ">=3"
|
|
85
|
-
},
|
|
86
|
-
peerDependenciesMeta: {
|
|
87
|
-
vitest: {
|
|
88
|
-
optional: true
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// src/version.ts
|
|
94
|
-
if (typeof package_default.version !== "string" || package_default.version.length === 0) {
|
|
95
|
-
throw new Error("package.json carries no version string");
|
|
96
|
-
}
|
|
97
|
-
var VERSION = package_default.version;
|
|
98
|
-
|
|
99
1
|
// src/core/types.ts
|
|
100
2
|
import { z } from "zod";
|
|
101
3
|
var CHANNELS = ["inbox", "webhook", "email"];
|
|
@@ -386,7 +288,6 @@ function createNotifier(options) {
|
|
|
386
288
|
}
|
|
387
289
|
|
|
388
290
|
export {
|
|
389
|
-
VERSION,
|
|
390
291
|
CHANNELS,
|
|
391
292
|
recipientSchema,
|
|
392
293
|
typeNameSchema,
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var package_default = {
|
|
3
|
+
name: "agentic-notify",
|
|
4
|
+
version: "0.2.1",
|
|
5
|
+
description: "Notifications for humans and agents: in-app inbox, webhook and email delivery, with SDK, CLI, MCP server and Worker API.",
|
|
6
|
+
keywords: [
|
|
7
|
+
"notifications",
|
|
8
|
+
"inbox",
|
|
9
|
+
"webhook",
|
|
10
|
+
"agents",
|
|
11
|
+
"mcp",
|
|
12
|
+
"cli",
|
|
13
|
+
"cloudflare-workers",
|
|
14
|
+
"typescript"
|
|
15
|
+
],
|
|
16
|
+
license: "MIT",
|
|
17
|
+
author: "Pooria Arab",
|
|
18
|
+
repository: {
|
|
19
|
+
type: "git",
|
|
20
|
+
url: "git+https://github.com/pooriaarab/agentic-notify.git"
|
|
21
|
+
},
|
|
22
|
+
type: "module",
|
|
23
|
+
private: false,
|
|
24
|
+
engines: {
|
|
25
|
+
node: ">=20"
|
|
26
|
+
},
|
|
27
|
+
files: [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
publishConfig: {
|
|
31
|
+
access: "public"
|
|
32
|
+
},
|
|
33
|
+
mcpName: "io.github.pooriaarab/agentic-notify",
|
|
34
|
+
main: "./dist/index.js",
|
|
35
|
+
types: "./dist/index.d.ts",
|
|
36
|
+
exports: {
|
|
37
|
+
".": {
|
|
38
|
+
types: "./dist/index.d.ts",
|
|
39
|
+
import: "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./testing": {
|
|
42
|
+
types: "./dist/testing.d.ts",
|
|
43
|
+
import: "./dist/testing.js"
|
|
44
|
+
},
|
|
45
|
+
"./sdk": {
|
|
46
|
+
types: "./dist/sdk.d.ts",
|
|
47
|
+
import: "./dist/sdk.js"
|
|
48
|
+
},
|
|
49
|
+
"./worker": {
|
|
50
|
+
types: "./dist/worker.d.ts",
|
|
51
|
+
import: "./dist/worker.js"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
bin: {
|
|
55
|
+
"agentic-notify": "./dist/cli.js",
|
|
56
|
+
"agentic-notify-mcp": "./dist/mcp-bin.js"
|
|
57
|
+
},
|
|
58
|
+
scripts: {
|
|
59
|
+
build: "tsup",
|
|
60
|
+
typecheck: "tsc --noEmit",
|
|
61
|
+
test: "vitest run",
|
|
62
|
+
clean: "rm -rf dist",
|
|
63
|
+
prepack: "npm run build",
|
|
64
|
+
"ci:local": "npm run build && npm run typecheck && npm run check:worker && npm test",
|
|
65
|
+
"deploy:demo": "wrangler deploy --config wrangler.demo.jsonc",
|
|
66
|
+
"check:worker": "esbuild src/worker.ts --bundle --platform=neutral --format=esm --log-level=warning --outfile=node_modules/.cache/worker-check.js"
|
|
67
|
+
},
|
|
68
|
+
dependencies: {
|
|
69
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
70
|
+
"agentic-identity": "^0.4.0",
|
|
71
|
+
hono: "^4.13.14",
|
|
72
|
+
zod: "^3.25.0"
|
|
73
|
+
},
|
|
74
|
+
devDependencies: {
|
|
75
|
+
"@types/node": "^22.0.0",
|
|
76
|
+
esbuild: "^0.28.2",
|
|
77
|
+
miniflare: "^4.20260730.0",
|
|
78
|
+
tsup: "^8.0.0",
|
|
79
|
+
typescript: "^5.6.0",
|
|
80
|
+
vitest: "^3.0.0",
|
|
81
|
+
wrangler: "^4.155.0"
|
|
82
|
+
},
|
|
83
|
+
peerDependencies: {
|
|
84
|
+
vitest: ">=3"
|
|
85
|
+
},
|
|
86
|
+
peerDependenciesMeta: {
|
|
87
|
+
vitest: {
|
|
88
|
+
optional: true
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// src/version.ts
|
|
94
|
+
if (typeof package_default.version !== "string" || package_default.version.length === 0) {
|
|
95
|
+
throw new Error("package.json carries no version string");
|
|
96
|
+
}
|
|
97
|
+
var VERSION = package_default.version;
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
VERSION
|
|
101
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
createClient
|
|
8
8
|
} from "./chunk-FJPEUDTG.js";
|
|
9
9
|
import "./chunk-KJKM56FT.js";
|
|
10
|
+
import "./chunk-ARL7FN6Y.js";
|
|
10
11
|
import {
|
|
11
12
|
VERSION
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PHY45IVQ.js";
|
|
13
14
|
|
|
14
15
|
// src/cli.ts
|
|
15
16
|
import { realpathSync } from "fs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as RecipientExport } from './gdpr-
|
|
1
|
+
import { R as RecipientExport } from './gdpr-BAg1U1w6.js';
|
|
2
2
|
import { Store } from 'agentic-identity';
|
|
3
|
-
import { S as SendInput, N as Notification, C as Channel, R as Recipient, D as Digest, P as Preferences } from './types-
|
|
4
|
-
import { D as DeliveryChannel, L as Logger } from './types-
|
|
3
|
+
import { S as SendInput, N as Notification, C as Channel, R as Recipient, D as Digest, P as Preferences } from './types-anA8DMQH.js';
|
|
4
|
+
import { D as DeliveryChannel, L as Logger } from './types-BdX7UTFu.js';
|
|
5
5
|
|
|
6
6
|
interface NotifierOptions {
|
|
7
7
|
store: Store;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { D as DispatchResult, a as DispatcherOptions, L as ListOptions, b as ListResult, N as NotFoundError, c as Notifier, d as NotifierOptions, S as SendResult, e as createDispatcher, f as createNotifier } from './dispatch-
|
|
1
|
+
export { D as DispatchResult, a as DispatcherOptions, L as ListOptions, b as ListResult, N as NotFoundError, c as Notifier, d as NotifierOptions, S as SendResult, e as createDispatcher, f as createNotifier } from './dispatch-xe2IAqWe.js';
|
|
2
2
|
export { Doc, Page, Query, Scalar, Store, StoreOps, createMemoryStore } from 'agentic-identity';
|
|
3
|
-
import { R as Recipient } from './types-
|
|
4
|
-
export { A as Actor, b as CHANNELS, C as Channel, c as DEFAULT_CHANNELS, D as Digest, d as DigestGroup, N as Notification, P as Preferences, a as ResourceRef, S as SendInput, e as defaultPreferences, r as recipientKey } from './types-
|
|
5
|
-
import { D as DeliveryChannel } from './types-
|
|
6
|
-
export { a as DeliveryError, L as Logger } from './types-
|
|
7
|
-
export { E as EmailChannelOptions, a as EmailMessage, b as EmailPort, c as createEmailChannel } from './testing-
|
|
3
|
+
import { R as Recipient } from './types-anA8DMQH.js';
|
|
4
|
+
export { A as Actor, b as CHANNELS, C as Channel, c as DEFAULT_CHANNELS, D as Digest, d as DigestGroup, N as Notification, P as Preferences, a as ResourceRef, S as SendInput, e as defaultPreferences, r as recipientKey } from './types-anA8DMQH.js';
|
|
5
|
+
import { D as DeliveryChannel } from './types-BdX7UTFu.js';
|
|
6
|
+
export { a as DeliveryError, L as Logger } from './types-BdX7UTFu.js';
|
|
7
|
+
export { E as EmailChannelOptions, a as EmailMessage, b as EmailPort, c as createEmailChannel } from './testing-46doJP5Y.js';
|
|
8
8
|
export { D1Like, D1_SCHEMA, createD1Store } from 'agentic-identity/cloudflare';
|
|
9
|
-
export { R as RecipientExport } from './gdpr-
|
|
9
|
+
export { R as RecipientExport } from './gdpr-BAg1U1w6.js';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'agentic-identity/testing';
|
|
12
12
|
|
package/dist/index.js
CHANGED
|
@@ -17,11 +17,13 @@ import {
|
|
|
17
17
|
CHANNELS,
|
|
18
18
|
DEFAULT_CHANNELS,
|
|
19
19
|
NotFoundError,
|
|
20
|
-
VERSION,
|
|
21
20
|
createNotifier,
|
|
22
21
|
defaultPreferences,
|
|
23
22
|
recipientKey
|
|
24
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ARL7FN6Y.js";
|
|
24
|
+
import {
|
|
25
|
+
VERSION
|
|
26
|
+
} from "./chunk-PHY45IVQ.js";
|
|
25
27
|
export {
|
|
26
28
|
CHANNELS,
|
|
27
29
|
D1_SCHEMA,
|
package/dist/mcp-bin.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-3N77SYRA.js";
|
|
6
|
-
import {
|
|
7
|
-
createClient
|
|
8
|
-
} from "./chunk-FJPEUDTG.js";
|
|
9
|
-
import "./chunk-KJKM56FT.js";
|
|
10
|
-
import "./chunk-6QCYA3X7.js";
|
|
3
|
+
VERSION
|
|
4
|
+
} from "./chunk-PHY45IVQ.js";
|
|
11
5
|
|
|
12
6
|
// src/mcp-bin.ts
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
var HELP = `agentic-notify-mcp ${VERSION}
|
|
8
|
+
Usage: agentic-notify-mcp [--help | --version]
|
|
9
|
+
|
|
10
|
+
Runs the MCP server on stdio. An MCP client starts it.
|
|
11
|
+
`;
|
|
12
|
+
var flag = process.argv[2];
|
|
13
|
+
if (flag === "--version" || flag === "-V") {
|
|
14
|
+
process.stdout.write(`${VERSION}
|
|
15
|
+
`);
|
|
16
|
+
} else if (flag === "--help" || flag === "-h") {
|
|
17
|
+
process.stdout.write(HELP);
|
|
18
|
+
} else {
|
|
19
|
+
Promise.all([import("./mcp.js"), import("./sdk.js")]).then(([{ startMcp }, { createClient }]) => {
|
|
20
|
+
const { NOTIFY_URL, NOTIFY_TOKEN } = process.env;
|
|
21
|
+
const client = NOTIFY_URL && NOTIFY_TOKEN ? createClient({ baseUrl: NOTIFY_URL, token: NOTIFY_TOKEN }) : void 0;
|
|
22
|
+
return startMcp(client);
|
|
23
|
+
}).catch((error) => {
|
|
24
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
25
|
+
process.exit(1);
|
|
26
|
+
});
|
|
27
|
+
}
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { Client } from './sdk.js';
|
|
3
|
-
import './types-
|
|
3
|
+
import './types-anA8DMQH.js';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import './gdpr-
|
|
5
|
+
import './gdpr-BAg1U1w6.js';
|
|
6
6
|
|
|
7
7
|
/** Without a client, only `ping` works and the other tools report that setup is missing. */
|
|
8
8
|
declare function createMcpServer(client?: Client): McpServer;
|
package/dist/mcp.js
CHANGED
|
@@ -1,11 +1,87 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
PACKAGE_NAME
|
|
3
|
+
} from "./chunk-3N77SYRA.js";
|
|
4
|
+
import {
|
|
5
|
+
ApiError
|
|
6
|
+
} from "./chunk-FJPEUDTG.js";
|
|
7
7
|
import "./chunk-KJKM56FT.js";
|
|
8
|
-
import
|
|
8
|
+
import {
|
|
9
|
+
preferencesSchema,
|
|
10
|
+
recipientSchema,
|
|
11
|
+
resourceRefSchema,
|
|
12
|
+
typeNameSchema
|
|
13
|
+
} from "./chunk-ARL7FN6Y.js";
|
|
14
|
+
import {
|
|
15
|
+
VERSION
|
|
16
|
+
} from "./chunk-PHY45IVQ.js";
|
|
17
|
+
|
|
18
|
+
// src/mcp.ts
|
|
19
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
20
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
21
|
+
import { z } from "zod";
|
|
22
|
+
async function wrap(fn) {
|
|
23
|
+
try {
|
|
24
|
+
return { content: [{ type: "text", text: JSON.stringify(await fn()) }] };
|
|
25
|
+
} catch (error) {
|
|
26
|
+
if (error instanceof ApiError) {
|
|
27
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: error.code, status: error.status }) }], isError: true };
|
|
28
|
+
}
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function createMcpServer(client) {
|
|
33
|
+
const server = new McpServer({ name: PACKAGE_NAME, version: VERSION });
|
|
34
|
+
const need = (fn) => () => wrap(async () => {
|
|
35
|
+
if (!client) throw new ApiError(0, "not_configured");
|
|
36
|
+
return fn(client);
|
|
37
|
+
});
|
|
38
|
+
const read = { readOnlyHint: true };
|
|
39
|
+
const write = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
40
|
+
server.registerTool(
|
|
41
|
+
"ping",
|
|
42
|
+
{ description: "Check that the server runs. Returns the package version.", inputSchema: {}, annotations: read },
|
|
43
|
+
async () => ({ content: [{ type: "text", text: JSON.stringify({ ok: true, version: VERSION }) }] })
|
|
44
|
+
);
|
|
45
|
+
server.registerTool("list_notifications", {
|
|
46
|
+
description: "List your notifications, newest first.",
|
|
47
|
+
inputSchema: { unreadOnly: z.boolean().optional(), limit: z.number().int().min(1).max(200).optional(), cursor: z.string().optional() },
|
|
48
|
+
annotations: read
|
|
49
|
+
}, (a) => need((c) => c.list(a))());
|
|
50
|
+
server.registerTool(
|
|
51
|
+
"read_notification",
|
|
52
|
+
{ description: "Get one notification by id.", inputSchema: { id: z.string() }, annotations: read },
|
|
53
|
+
({ id }) => need((c) => c.get(id))()
|
|
54
|
+
);
|
|
55
|
+
server.registerTool(
|
|
56
|
+
"mark_read",
|
|
57
|
+
{ description: "Mark one notification as read.", inputSchema: { id: z.string() }, annotations: write },
|
|
58
|
+
({ id }) => need((c) => c.markRead(id))()
|
|
59
|
+
);
|
|
60
|
+
server.registerTool(
|
|
61
|
+
"mark_all_read",
|
|
62
|
+
{ description: "Mark all your notifications as read.", inputSchema: {}, annotations: write },
|
|
63
|
+
need((c) => c.markAllRead())
|
|
64
|
+
);
|
|
65
|
+
server.registerTool(
|
|
66
|
+
"get_preferences",
|
|
67
|
+
{ description: "Read your notification preferences.", inputSchema: {}, annotations: read },
|
|
68
|
+
need((c) => c.getPreferences())
|
|
69
|
+
);
|
|
70
|
+
server.registerTool("set_preferences", {
|
|
71
|
+
description: "Replace your notification preferences: channels per type, mute, muted types.",
|
|
72
|
+
inputSchema: preferencesSchema.shape,
|
|
73
|
+
annotations: write
|
|
74
|
+
}, (a) => need((c) => c.setPreferences(a))());
|
|
75
|
+
server.registerTool("send_notification", {
|
|
76
|
+
description: "Send a notification. You must hold the send right. You are the actor.",
|
|
77
|
+
inputSchema: { recipient: recipientSchema, type: typeNameSchema, resource: resourceRefSchema, body: z.string().max(2e3) },
|
|
78
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
|
|
79
|
+
}, (a) => need((c) => c.send(a))());
|
|
80
|
+
return server;
|
|
81
|
+
}
|
|
82
|
+
async function startMcp(client) {
|
|
83
|
+
await createMcpServer(client).connect(new StdioServerTransport());
|
|
84
|
+
}
|
|
9
85
|
export {
|
|
10
86
|
createMcpServer,
|
|
11
87
|
startMcp
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as Notification, D as Digest, P as Preferences, R as Recipient, a as ResourceRef } from './types-
|
|
2
|
-
import { R as RecipientExport } from './gdpr-
|
|
1
|
+
import { N as Notification, D as Digest, P as Preferences, R as Recipient, a as ResourceRef } from './types-anA8DMQH.js';
|
|
2
|
+
import { R as RecipientExport } from './gdpr-BAg1U1w6.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
declare class ApiError extends Error {
|
|
@@ -46,17 +46,17 @@ declare function createClient(options: ClientOptions): {
|
|
|
46
46
|
type: string;
|
|
47
47
|
id: string;
|
|
48
48
|
recipient: {
|
|
49
|
-
id: string;
|
|
50
49
|
kind: "human" | "agent";
|
|
50
|
+
id: string;
|
|
51
51
|
};
|
|
52
52
|
resource: {
|
|
53
|
-
id: string;
|
|
54
53
|
kind: string;
|
|
54
|
+
id: string;
|
|
55
55
|
url?: string | undefined;
|
|
56
56
|
};
|
|
57
57
|
actor: {
|
|
58
|
-
id: string;
|
|
59
58
|
kind: "human" | "agent";
|
|
59
|
+
id: string;
|
|
60
60
|
};
|
|
61
61
|
body: string;
|
|
62
62
|
createdAt: number;
|
|
@@ -66,17 +66,17 @@ declare function createClient(options: ClientOptions): {
|
|
|
66
66
|
type: string;
|
|
67
67
|
id: string;
|
|
68
68
|
recipient: {
|
|
69
|
-
id: string;
|
|
70
69
|
kind: "human" | "agent";
|
|
70
|
+
id: string;
|
|
71
71
|
};
|
|
72
72
|
resource: {
|
|
73
|
-
id: string;
|
|
74
73
|
kind: string;
|
|
74
|
+
id: string;
|
|
75
75
|
url?: string | undefined;
|
|
76
76
|
};
|
|
77
77
|
actor: {
|
|
78
|
-
id: string;
|
|
79
78
|
kind: "human" | "agent";
|
|
79
|
+
id: string;
|
|
80
80
|
};
|
|
81
81
|
body: string;
|
|
82
82
|
createdAt: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'agentic-identity/testing';
|
|
2
|
-
import { R as Recipient } from './types-
|
|
3
|
-
import { D as DeliveryChannel } from './types-
|
|
2
|
+
import { R as Recipient } from './types-anA8DMQH.js';
|
|
3
|
+
import { D as DeliveryChannel } from './types-BdX7UTFu.js';
|
|
4
4
|
|
|
5
5
|
interface EmailMessage {
|
|
6
6
|
to: string;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { runStoreContract } from 'agentic-identity/testing';
|
|
2
|
-
export { T as TestEmailAdapter } from './testing-
|
|
3
|
-
import './types-
|
|
2
|
+
export { T as TestEmailAdapter } from './testing-46doJP5Y.js';
|
|
3
|
+
import './types-anA8DMQH.js';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import './types-
|
|
5
|
+
import './types-BdX7UTFu.js';
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { c as Notifier, e as createDispatcher } from './dispatch-
|
|
3
|
-
import { R as Recipient } from './types-
|
|
2
|
+
import { c as Notifier, e as createDispatcher } from './dispatch-xe2IAqWe.js';
|
|
3
|
+
import { R as Recipient } from './types-anA8DMQH.js';
|
|
4
4
|
import { D1Like } from 'agentic-identity/cloudflare';
|
|
5
|
-
import './gdpr-
|
|
5
|
+
import './gdpr-BAg1U1w6.js';
|
|
6
6
|
import 'agentic-identity';
|
|
7
|
-
import './types-
|
|
7
|
+
import './types-BdX7UTFu.js';
|
|
8
8
|
|
|
9
9
|
/** Who is calling. `kind` has no default: a missing kind is an error. */
|
|
10
10
|
declare const principalSchema: z.ZodObject<{
|
package/dist/worker.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOTES,
|
|
3
3
|
NotFoundError,
|
|
4
|
-
VERSION,
|
|
5
4
|
createNotifier,
|
|
6
5
|
preferencesSchema,
|
|
7
6
|
recipientSchema,
|
|
8
7
|
resourceRefSchema,
|
|
9
8
|
typeNameSchema
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ARL7FN6Y.js";
|
|
10
|
+
import {
|
|
11
|
+
VERSION
|
|
12
|
+
} from "./chunk-PHY45IVQ.js";
|
|
11
13
|
|
|
12
14
|
// src/api.ts
|
|
13
15
|
import { Hono } from "hono";
|
package/package.json
CHANGED
package/dist/chunk-POSHKDNY.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PACKAGE_NAME
|
|
3
|
-
} from "./chunk-3N77SYRA.js";
|
|
4
|
-
import {
|
|
5
|
-
ApiError
|
|
6
|
-
} from "./chunk-FJPEUDTG.js";
|
|
7
|
-
import {
|
|
8
|
-
VERSION,
|
|
9
|
-
preferencesSchema,
|
|
10
|
-
recipientSchema,
|
|
11
|
-
resourceRefSchema,
|
|
12
|
-
typeNameSchema
|
|
13
|
-
} from "./chunk-6QCYA3X7.js";
|
|
14
|
-
|
|
15
|
-
// src/mcp.ts
|
|
16
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18
|
-
import { z } from "zod";
|
|
19
|
-
async function wrap(fn) {
|
|
20
|
-
try {
|
|
21
|
-
return { content: [{ type: "text", text: JSON.stringify(await fn()) }] };
|
|
22
|
-
} catch (error) {
|
|
23
|
-
if (error instanceof ApiError) {
|
|
24
|
-
return { content: [{ type: "text", text: JSON.stringify({ error: error.code, status: error.status }) }], isError: true };
|
|
25
|
-
}
|
|
26
|
-
throw error;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function createMcpServer(client) {
|
|
30
|
-
const server = new McpServer({ name: PACKAGE_NAME, version: VERSION });
|
|
31
|
-
const need = (fn) => () => wrap(async () => {
|
|
32
|
-
if (!client) throw new ApiError(0, "not_configured");
|
|
33
|
-
return fn(client);
|
|
34
|
-
});
|
|
35
|
-
const read = { readOnlyHint: true };
|
|
36
|
-
const write = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
37
|
-
server.registerTool(
|
|
38
|
-
"ping",
|
|
39
|
-
{ description: "Check that the server runs. Returns the package version.", inputSchema: {}, annotations: read },
|
|
40
|
-
async () => ({ content: [{ type: "text", text: JSON.stringify({ ok: true, version: VERSION }) }] })
|
|
41
|
-
);
|
|
42
|
-
server.registerTool("list_notifications", {
|
|
43
|
-
description: "List your notifications, newest first.",
|
|
44
|
-
inputSchema: { unreadOnly: z.boolean().optional(), limit: z.number().int().min(1).max(200).optional(), cursor: z.string().optional() },
|
|
45
|
-
annotations: read
|
|
46
|
-
}, (a) => need((c) => c.list(a))());
|
|
47
|
-
server.registerTool(
|
|
48
|
-
"read_notification",
|
|
49
|
-
{ description: "Get one notification by id.", inputSchema: { id: z.string() }, annotations: read },
|
|
50
|
-
({ id }) => need((c) => c.get(id))()
|
|
51
|
-
);
|
|
52
|
-
server.registerTool(
|
|
53
|
-
"mark_read",
|
|
54
|
-
{ description: "Mark one notification as read.", inputSchema: { id: z.string() }, annotations: write },
|
|
55
|
-
({ id }) => need((c) => c.markRead(id))()
|
|
56
|
-
);
|
|
57
|
-
server.registerTool(
|
|
58
|
-
"mark_all_read",
|
|
59
|
-
{ description: "Mark all your notifications as read.", inputSchema: {}, annotations: write },
|
|
60
|
-
need((c) => c.markAllRead())
|
|
61
|
-
);
|
|
62
|
-
server.registerTool(
|
|
63
|
-
"get_preferences",
|
|
64
|
-
{ description: "Read your notification preferences.", inputSchema: {}, annotations: read },
|
|
65
|
-
need((c) => c.getPreferences())
|
|
66
|
-
);
|
|
67
|
-
server.registerTool("set_preferences", {
|
|
68
|
-
description: "Replace your notification preferences: channels per type, mute, muted types.",
|
|
69
|
-
inputSchema: preferencesSchema.shape,
|
|
70
|
-
annotations: write
|
|
71
|
-
}, (a) => need((c) => c.setPreferences(a))());
|
|
72
|
-
server.registerTool("send_notification", {
|
|
73
|
-
description: "Send a notification. You must hold the send right. You are the actor.",
|
|
74
|
-
inputSchema: { recipient: recipientSchema, type: typeNameSchema, resource: resourceRefSchema, body: z.string().max(2e3) },
|
|
75
|
-
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
|
|
76
|
-
}, (a) => need((c) => c.send(a))());
|
|
77
|
-
return server;
|
|
78
|
-
}
|
|
79
|
-
async function startMcp(client) {
|
|
80
|
-
await createMcpServer(client).connect(new StdioServerTransport());
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
createMcpServer,
|
|
85
|
-
startMcp
|
|
86
|
-
};
|
|
@@ -6,11 +6,11 @@ declare const recipientSchema: z.ZodObject<{
|
|
|
6
6
|
kind: z.ZodEnum<["human", "agent"]>;
|
|
7
7
|
id: z.ZodString;
|
|
8
8
|
}, "strict", z.ZodTypeAny, {
|
|
9
|
-
id: string;
|
|
10
9
|
kind: "human" | "agent";
|
|
11
|
-
}, {
|
|
12
10
|
id: string;
|
|
11
|
+
}, {
|
|
13
12
|
kind: "human" | "agent";
|
|
13
|
+
id: string;
|
|
14
14
|
}>;
|
|
15
15
|
type Recipient = z.infer<typeof recipientSchema>;
|
|
16
16
|
declare const resourceRefSchema: z.ZodObject<{
|
|
@@ -18,12 +18,12 @@ declare const resourceRefSchema: z.ZodObject<{
|
|
|
18
18
|
id: z.ZodString;
|
|
19
19
|
url: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
20
20
|
}, "strict", z.ZodTypeAny, {
|
|
21
|
-
id: string;
|
|
22
21
|
kind: string;
|
|
22
|
+
id: string;
|
|
23
23
|
url?: string | undefined;
|
|
24
24
|
}, {
|
|
25
|
-
id: string;
|
|
26
25
|
kind: string;
|
|
26
|
+
id: string;
|
|
27
27
|
url?: string | undefined;
|
|
28
28
|
}>;
|
|
29
29
|
type ResourceRef = z.infer<typeof resourceRefSchema>;
|
|
@@ -31,11 +31,11 @@ declare const actorSchema: z.ZodObject<{
|
|
|
31
31
|
kind: z.ZodEnum<["human", "agent"]>;
|
|
32
32
|
id: z.ZodString;
|
|
33
33
|
}, "strict", z.ZodTypeAny, {
|
|
34
|
-
id: string;
|
|
35
34
|
kind: "human" | "agent";
|
|
36
|
-
}, {
|
|
37
35
|
id: string;
|
|
36
|
+
}, {
|
|
38
37
|
kind: "human" | "agent";
|
|
38
|
+
id: string;
|
|
39
39
|
}>;
|
|
40
40
|
type Actor = z.infer<typeof actorSchema>;
|
|
41
41
|
declare const notificationSchema: z.ZodObject<{
|
|
@@ -44,11 +44,11 @@ declare const notificationSchema: z.ZodObject<{
|
|
|
44
44
|
kind: z.ZodEnum<["human", "agent"]>;
|
|
45
45
|
id: z.ZodString;
|
|
46
46
|
}, "strict", z.ZodTypeAny, {
|
|
47
|
-
id: string;
|
|
48
47
|
kind: "human" | "agent";
|
|
49
|
-
}, {
|
|
50
48
|
id: string;
|
|
49
|
+
}, {
|
|
51
50
|
kind: "human" | "agent";
|
|
51
|
+
id: string;
|
|
52
52
|
}>;
|
|
53
53
|
type: z.ZodString;
|
|
54
54
|
resource: z.ZodObject<{
|
|
@@ -56,23 +56,23 @@ declare const notificationSchema: z.ZodObject<{
|
|
|
56
56
|
id: z.ZodString;
|
|
57
57
|
url: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
58
58
|
}, "strict", z.ZodTypeAny, {
|
|
59
|
-
id: string;
|
|
60
59
|
kind: string;
|
|
60
|
+
id: string;
|
|
61
61
|
url?: string | undefined;
|
|
62
62
|
}, {
|
|
63
|
-
id: string;
|
|
64
63
|
kind: string;
|
|
64
|
+
id: string;
|
|
65
65
|
url?: string | undefined;
|
|
66
66
|
}>;
|
|
67
67
|
actor: z.ZodObject<{
|
|
68
68
|
kind: z.ZodEnum<["human", "agent"]>;
|
|
69
69
|
id: z.ZodString;
|
|
70
70
|
}, "strict", z.ZodTypeAny, {
|
|
71
|
-
id: string;
|
|
72
71
|
kind: "human" | "agent";
|
|
73
|
-
}, {
|
|
74
72
|
id: string;
|
|
73
|
+
}, {
|
|
75
74
|
kind: "human" | "agent";
|
|
75
|
+
id: string;
|
|
76
76
|
}>;
|
|
77
77
|
body: z.ZodString;
|
|
78
78
|
createdAt: z.ZodNumber;
|
|
@@ -81,17 +81,17 @@ declare const notificationSchema: z.ZodObject<{
|
|
|
81
81
|
type: string;
|
|
82
82
|
id: string;
|
|
83
83
|
recipient: {
|
|
84
|
-
id: string;
|
|
85
84
|
kind: "human" | "agent";
|
|
85
|
+
id: string;
|
|
86
86
|
};
|
|
87
87
|
resource: {
|
|
88
|
-
id: string;
|
|
89
88
|
kind: string;
|
|
89
|
+
id: string;
|
|
90
90
|
url?: string | undefined;
|
|
91
91
|
};
|
|
92
92
|
actor: {
|
|
93
|
-
id: string;
|
|
94
93
|
kind: "human" | "agent";
|
|
94
|
+
id: string;
|
|
95
95
|
};
|
|
96
96
|
body: string;
|
|
97
97
|
createdAt: number;
|
|
@@ -100,17 +100,17 @@ declare const notificationSchema: z.ZodObject<{
|
|
|
100
100
|
type: string;
|
|
101
101
|
id: string;
|
|
102
102
|
recipient: {
|
|
103
|
-
id: string;
|
|
104
103
|
kind: "human" | "agent";
|
|
104
|
+
id: string;
|
|
105
105
|
};
|
|
106
106
|
resource: {
|
|
107
|
-
id: string;
|
|
108
107
|
kind: string;
|
|
108
|
+
id: string;
|
|
109
109
|
url?: string | undefined;
|
|
110
110
|
};
|
|
111
111
|
actor: {
|
|
112
|
-
id: string;
|
|
113
112
|
kind: "human" | "agent";
|
|
113
|
+
id: string;
|
|
114
114
|
};
|
|
115
115
|
body: string;
|
|
116
116
|
createdAt: number;
|
|
@@ -122,11 +122,11 @@ declare const sendInputSchema: z.ZodObject<{
|
|
|
122
122
|
kind: z.ZodEnum<["human", "agent"]>;
|
|
123
123
|
id: z.ZodString;
|
|
124
124
|
}, "strict", z.ZodTypeAny, {
|
|
125
|
-
id: string;
|
|
126
125
|
kind: "human" | "agent";
|
|
127
|
-
}, {
|
|
128
126
|
id: string;
|
|
127
|
+
}, {
|
|
129
128
|
kind: "human" | "agent";
|
|
129
|
+
id: string;
|
|
130
130
|
}>;
|
|
131
131
|
type: z.ZodString;
|
|
132
132
|
resource: z.ZodObject<{
|
|
@@ -134,55 +134,55 @@ declare const sendInputSchema: z.ZodObject<{
|
|
|
134
134
|
id: z.ZodString;
|
|
135
135
|
url: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
136
136
|
}, "strict", z.ZodTypeAny, {
|
|
137
|
-
id: string;
|
|
138
137
|
kind: string;
|
|
138
|
+
id: string;
|
|
139
139
|
url?: string | undefined;
|
|
140
140
|
}, {
|
|
141
|
-
id: string;
|
|
142
141
|
kind: string;
|
|
142
|
+
id: string;
|
|
143
143
|
url?: string | undefined;
|
|
144
144
|
}>;
|
|
145
145
|
actor: z.ZodObject<{
|
|
146
146
|
kind: z.ZodEnum<["human", "agent"]>;
|
|
147
147
|
id: z.ZodString;
|
|
148
148
|
}, "strict", z.ZodTypeAny, {
|
|
149
|
-
id: string;
|
|
150
149
|
kind: "human" | "agent";
|
|
151
|
-
}, {
|
|
152
150
|
id: string;
|
|
151
|
+
}, {
|
|
153
152
|
kind: "human" | "agent";
|
|
153
|
+
id: string;
|
|
154
154
|
}>;
|
|
155
155
|
body: z.ZodString;
|
|
156
156
|
}, "strict", z.ZodTypeAny, {
|
|
157
157
|
type: string;
|
|
158
158
|
recipient: {
|
|
159
|
-
id: string;
|
|
160
159
|
kind: "human" | "agent";
|
|
160
|
+
id: string;
|
|
161
161
|
};
|
|
162
162
|
resource: {
|
|
163
|
-
id: string;
|
|
164
163
|
kind: string;
|
|
164
|
+
id: string;
|
|
165
165
|
url?: string | undefined;
|
|
166
166
|
};
|
|
167
167
|
actor: {
|
|
168
|
-
id: string;
|
|
169
168
|
kind: "human" | "agent";
|
|
169
|
+
id: string;
|
|
170
170
|
};
|
|
171
171
|
body: string;
|
|
172
172
|
}, {
|
|
173
173
|
type: string;
|
|
174
174
|
recipient: {
|
|
175
|
-
id: string;
|
|
176
175
|
kind: "human" | "agent";
|
|
176
|
+
id: string;
|
|
177
177
|
};
|
|
178
178
|
resource: {
|
|
179
|
-
id: string;
|
|
180
179
|
kind: string;
|
|
180
|
+
id: string;
|
|
181
181
|
url?: string | undefined;
|
|
182
182
|
};
|
|
183
183
|
actor: {
|
|
184
|
-
id: string;
|
|
185
184
|
kind: "human" | "agent";
|
|
185
|
+
id: string;
|
|
186
186
|
};
|
|
187
187
|
body: string;
|
|
188
188
|
}>;
|