onesignal-mcp 1.0.2 → 1.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/README.md +5 -17
- package/dist/api.js +133 -0
- package/dist/server.js +42 -16
- package/package.json +1 -1
- package/dist/gateway.d.ts +0 -16
- package/dist/gateway.js +0 -85
- package/dist/license.d.ts +0 -8
package/README.md
CHANGED
|
@@ -12,21 +12,9 @@ Query the OneSignal API (free tier; use a current v2 Organization API key for ON
|
|
|
12
12
|
|
|
13
13
|
[onesignal-mcp](https://github.com/mrfentmen/premium-mcps/tree/main/servers/onesignal-mcp)
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
## Premium tools
|
|
15
|
+
## Licence — no paywall
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
The tool bodies run on our gateway, not inside this package, so the key is what buys access. Buy one at https://buy.polar.sh/polar_cl_mrO7rS5LZxpqM7oAFFEA10i9121J240U40IIj4JRZO4 and set it in your MCP client config:
|
|
24
|
-
|
|
25
|
-
```json
|
|
26
|
-
"env": { "MCP_LICENSE_KEY": "polar_..." }
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
The gateway checks the key against Polar and gives every key 1,000 free premium
|
|
30
|
-
calls a month before per-call billing starts. Every other tool on this server
|
|
31
|
-
stays free.
|
|
32
|
-
<!-- /paywall -->
|
|
17
|
+
Every tool in this package is free: no licence key, no premium tier, no hosted
|
|
18
|
+
licence gateway. The paywall machinery this repo once carried (per-tool licence
|
|
19
|
+
checks and paid hosted endpoints) was removed repo-wide on 2026-10-17. Nothing
|
|
20
|
+
that this package installs or calls asks you to pay.
|
package/dist/api.js
CHANGED
|
@@ -71,6 +71,139 @@ async function onesignalWeeklyDownloads(pkg) {
|
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
/** OneSignal's public status page, a Statuspage instance. */
|
|
75
|
+
const ONESIGNAL_STATUS = "https://status.onesignal.com/api/v2";
|
|
76
|
+
async function onesignalStatusJson(path) {
|
|
77
|
+
const url = `${ONESIGNAL_STATUS}${path}`;
|
|
78
|
+
const res = await fetch(url, {
|
|
79
|
+
headers: { "User-Agent": "awesome-mcps/1.0", Accept: "application/json" },
|
|
80
|
+
signal: AbortSignal.timeout(30000),
|
|
81
|
+
});
|
|
82
|
+
if (!res.ok)
|
|
83
|
+
throw new OneSignalError(`The status page returned ${res.status} for ${path.replace(/^\//, "")}.`);
|
|
84
|
+
return (await res.json());
|
|
85
|
+
}
|
|
86
|
+
function osDays(fromIso, toMs = Date.now()) {
|
|
87
|
+
const t = Date.parse(fromIso);
|
|
88
|
+
if (!Number.isFinite(t))
|
|
89
|
+
return null;
|
|
90
|
+
return Math.round((toMs - t) / 86400000);
|
|
91
|
+
}
|
|
92
|
+
function osDay(iso) {
|
|
93
|
+
const t = Date.parse(iso ?? "");
|
|
94
|
+
return Number.isFinite(t) ? new Date(t).toISOString().slice(0, 10) : "unknown";
|
|
95
|
+
}
|
|
96
|
+
function osSpan(ms) {
|
|
97
|
+
if (!Number.isFinite(ms))
|
|
98
|
+
return "unresolved";
|
|
99
|
+
if (ms < 0)
|
|
100
|
+
return "0 min (the page's own timestamps are out of order)";
|
|
101
|
+
const mins = Math.round(ms / 60000);
|
|
102
|
+
if (mins < 60)
|
|
103
|
+
return `${mins} min`;
|
|
104
|
+
const hours = Math.floor(mins / 60);
|
|
105
|
+
if (hours < 48)
|
|
106
|
+
return `${hours} h ${mins % 60} min`;
|
|
107
|
+
return `${Math.round(hours / 24)} day(s)`;
|
|
108
|
+
}
|
|
109
|
+
/** Release cadence of one OneSignal SDK, read from the npm packument's own time map. */
|
|
110
|
+
export async function sdkReleaseTimeline(args) {
|
|
111
|
+
const requested = String(args.package ?? "").trim();
|
|
112
|
+
const pkg = requested || "react-native-onesignal";
|
|
113
|
+
const limit = Math.min(Math.max(Number(args.limit ?? 10) || 10, 1), 30);
|
|
114
|
+
const doc = await onesignalJson(`${ONESIGNAL_NPM}/${encodeURIComponent(pkg)}`);
|
|
115
|
+
const time = doc.time ?? {};
|
|
116
|
+
const versions = Object.keys(doc.versions ?? {});
|
|
117
|
+
if (!versions.length)
|
|
118
|
+
throw new OneSignalError(`${pkg} has no published versions on npm.`);
|
|
119
|
+
const dated = versions
|
|
120
|
+
.map((v) => ({ version: v, at: time[v] }))
|
|
121
|
+
.filter((r) => typeof r.at === "string")
|
|
122
|
+
.sort((a, b) => Date.parse(a.at) - Date.parse(b.at));
|
|
123
|
+
if (!dated.length)
|
|
124
|
+
throw new OneSignalError(`npm published no dates for ${pkg}, so the cadence cannot be read.`);
|
|
125
|
+
const first = dated[0];
|
|
126
|
+
const latestTag = doc["dist-tags"]?.latest ?? null;
|
|
127
|
+
const latestDated = dated[dated.length - 1];
|
|
128
|
+
const gaps = [];
|
|
129
|
+
for (let i = 1; i < dated.length; i++)
|
|
130
|
+
gaps.push(Date.parse(dated[i].at) - Date.parse(dated[i - 1].at));
|
|
131
|
+
const sortedGaps = [...gaps].sort((a, b) => a - b);
|
|
132
|
+
const medianGap = sortedGaps.length
|
|
133
|
+
? sortedGaps.length % 2
|
|
134
|
+
? sortedGaps[(sortedGaps.length - 1) / 2]
|
|
135
|
+
: (sortedGaps[sortedGaps.length / 2 - 1] + sortedGaps[sortedGaps.length / 2]) / 2
|
|
136
|
+
: null;
|
|
137
|
+
const tags = Object.entries(doc["dist-tags"] ?? {}).map(([tag, version]) => ({
|
|
138
|
+
tag,
|
|
139
|
+
version,
|
|
140
|
+
at: time[version],
|
|
141
|
+
prerelease: /-(alpha|beta|rc|next|pre|dev|canary|staging)/i.test(String(version)),
|
|
142
|
+
}));
|
|
143
|
+
const prereleaseTags = tags.filter((t) => t.prerelease);
|
|
144
|
+
const recent = [...dated].reverse().slice(0, limit);
|
|
145
|
+
const rows = [
|
|
146
|
+
`${pkg} release train, from the npm registry`,
|
|
147
|
+
` versions published ${versions.length}`,
|
|
148
|
+
` first release ${osDay(first.at)} (${first.version})`,
|
|
149
|
+
` latest tag ${latestTag ?? "not set"}${latestTag && time[latestTag] ? `, published ${osDay(time[latestTag])}` : ""}`,
|
|
150
|
+
` newest version by date ${latestDated.version}, ${osDay(latestDated.at)}`,
|
|
151
|
+
` days since a release ${osDays(latestDated.at) ?? "unknown"}`,
|
|
152
|
+
medianGap !== null ? ` median gap ${(medianGap / 86400000).toFixed(1)} day(s)` : "",
|
|
153
|
+
"",
|
|
154
|
+
`dist-tags (${tags.length}):`,
|
|
155
|
+
...tags.map((t) => ` ${t.tag.padEnd(14)} ${t.version}${t.at ? ` — ${osDay(t.at)}` : ""}${t.prerelease ? " (prerelease)" : ""}`),
|
|
156
|
+
prereleaseTags.length
|
|
157
|
+
? ` ${prereleaseTags.length} tag(s) still point at a prerelease: ${prereleaseTags.map((t) => t.tag).join(", ")}`
|
|
158
|
+
: " No tag points at a prerelease.",
|
|
159
|
+
"",
|
|
160
|
+
`Most recent ${recent.length} version(s) by publish date:`,
|
|
161
|
+
...recent.map((r) => ` ${osDay(r.at)} ${r.version}`),
|
|
162
|
+
"",
|
|
163
|
+
"Dates are npm's own publish timestamps. A version republished under a new tag keeps its original date.",
|
|
164
|
+
].filter(Boolean);
|
|
165
|
+
return rows.join("\n");
|
|
166
|
+
}
|
|
167
|
+
/** OneSignal's own reliability record: current state per product area plus incident history. */
|
|
168
|
+
export async function platformStatus(args) {
|
|
169
|
+
const limit = Math.min(Math.max(Number(args.limit ?? 10) || 10, 1), 25);
|
|
170
|
+
const [summary, history] = await Promise.all([
|
|
171
|
+
onesignalStatusJson("/summary.json"),
|
|
172
|
+
onesignalStatusJson("/incidents.json").catch(() => ({ incidents: [] })),
|
|
173
|
+
]);
|
|
174
|
+
const state = summary.status ?? {};
|
|
175
|
+
const components = Array.isArray(summary.components) ? summary.components : [];
|
|
176
|
+
const incidents = Array.isArray(history.incidents) ? history.incidents : Array.isArray(summary.incidents) ? summary.incidents : [];
|
|
177
|
+
const ranked = [...incidents]
|
|
178
|
+
.sort((a, b) => Date.parse(b.created_at ?? 0) - Date.parse(a.created_at ?? 0))
|
|
179
|
+
.slice(0, limit);
|
|
180
|
+
const rows = [
|
|
181
|
+
`OneSignal platform status — ${String(state.description ?? "unknown")} (indicator: ${String(state.indicator ?? "none")})`,
|
|
182
|
+
"",
|
|
183
|
+
`Product areas (${components.length}):`,
|
|
184
|
+
...components.map((c) => ` ${String(c.status ?? "unknown").padEnd(12)} ${c.name}${c.group ? ` — ${c.group}` : ""}`),
|
|
185
|
+
];
|
|
186
|
+
if (!components.length)
|
|
187
|
+
rows.push(" The status page published no components.");
|
|
188
|
+
rows.push("", `Incident history (${incidents.length} on record, latest ${ranked.length} shown):`);
|
|
189
|
+
if (!ranked.length)
|
|
190
|
+
rows.push(" No incidents on record.");
|
|
191
|
+
for (const inc of ranked) {
|
|
192
|
+
const resolved = inc.resolved_at ?? (inc.status === "resolved" ? inc.updated_at : null);
|
|
193
|
+
const createdMs = Date.parse(inc.created_at ?? "");
|
|
194
|
+
const resolvedMs = resolved ? Date.parse(resolved) : NaN;
|
|
195
|
+
const took = Number.isFinite(createdMs) && Number.isFinite(resolvedMs) ? resolvedMs - createdMs : NaN;
|
|
196
|
+
const updates = Array.isArray(inc.incident_updates) ? inc.incident_updates : [];
|
|
197
|
+
const latest = updates[0] ?? null;
|
|
198
|
+
rows.push(` ${osDay(inc.created_at)} ${inc.name}`);
|
|
199
|
+
const duration = !resolved ? "still open" : Number.isFinite(took) ? `resolved in ${osSpan(took)}` : "resolved, duration not published";
|
|
200
|
+
rows.push(` impact ${String(inc.impact ?? "none")} | status ${String(inc.status ?? "unknown")} | ${duration}${inc.shortlink ? ` | ${inc.shortlink}` : ""}`);
|
|
201
|
+
if (latest)
|
|
202
|
+
rows.push(` latest update (${osDay(latest.created_at)}): ${String(latest.body ?? "").replace(/\s+/g, " ").slice(0, 240)}`);
|
|
203
|
+
}
|
|
204
|
+
rows.push("", "Read from status.onesignal.com, the vendor's own Statuspage. Incident text is theirs, not a measurement of this server.");
|
|
205
|
+
return rows.join("\n");
|
|
206
|
+
}
|
|
74
207
|
/** Which OneSignal SDK people actually install, and how big each one is. */
|
|
75
208
|
export async function pushSdkPopularity(_args) {
|
|
76
209
|
const docs = await Promise.all(ONESIGNAL_SDKS.map(async (pkg) => {
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
4
|
-
import { premiumTool } from "./gateway.js";
|
|
3
|
+
import { listApps, getApp, listNotifications, pushSdkPopularity, sdkReleaseTimeline, platformStatus } from "./api.js";
|
|
5
4
|
const text = (t) => ({ content: [{ type: "text", text: t }] });
|
|
6
5
|
const textError = (t) => ({ content: [{ type: "text", text: t }], isError: true });
|
|
7
6
|
const READ_ONLY = { readOnlyHint: true, openWorldHint: true };
|
|
@@ -20,7 +19,7 @@ export function createServer() {
|
|
|
20
19
|
return text(await listApps());
|
|
21
20
|
}
|
|
22
21
|
catch (e) {
|
|
23
|
-
return textError(
|
|
22
|
+
return textError(String(e));
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
server.registerTool("get_app", {
|
|
@@ -35,7 +34,7 @@ export function createServer() {
|
|
|
35
34
|
return text(await getApp(app_id));
|
|
36
35
|
}
|
|
37
36
|
catch (e) {
|
|
38
|
-
return textError(
|
|
37
|
+
return textError(String(e));
|
|
39
38
|
}
|
|
40
39
|
});
|
|
41
40
|
server.registerTool("list_notifications", {
|
|
@@ -51,7 +50,7 @@ export function createServer() {
|
|
|
51
50
|
return text(await listNotifications(app_id, limit));
|
|
52
51
|
}
|
|
53
52
|
catch (e) {
|
|
54
|
-
return textError(
|
|
53
|
+
return textError(String(e));
|
|
55
54
|
}
|
|
56
55
|
});
|
|
57
56
|
server.registerTool("push_sdk_popularity", {
|
|
@@ -64,7 +63,7 @@ export function createServer() {
|
|
|
64
63
|
return text(await pushSdkPopularity(_args));
|
|
65
64
|
}
|
|
66
65
|
catch (e) {
|
|
67
|
-
return textError(
|
|
66
|
+
return textError(String(e));
|
|
68
67
|
}
|
|
69
68
|
});
|
|
70
69
|
server.registerTool("sdk_release_timeline", {
|
|
@@ -76,14 +75,11 @@ export function createServer() {
|
|
|
76
75
|
}),
|
|
77
76
|
annotations: READ_ONLY,
|
|
78
77
|
}, async (args) => {
|
|
79
|
-
// ---- paywall: sdk_release_timeline ----
|
|
80
|
-
// The body runs on the gateway, behind the licence gate.
|
|
81
|
-
// ---- paywall: end ----
|
|
82
78
|
try {
|
|
83
|
-
return text(await
|
|
79
|
+
return text(await sdkReleaseTimeline(args));
|
|
84
80
|
}
|
|
85
81
|
catch (e) {
|
|
86
|
-
return textError(
|
|
82
|
+
return textError(String(e));
|
|
87
83
|
}
|
|
88
84
|
});
|
|
89
85
|
server.registerTool("platform_status", {
|
|
@@ -92,15 +88,45 @@ export function createServer() {
|
|
|
92
88
|
inputSchema: z.object({ limit: z.number().describe("How many incidents to show, 1-15.").optional() }),
|
|
93
89
|
annotations: READ_ONLY,
|
|
94
90
|
}, async (args) => {
|
|
95
|
-
// ---- paywall: platform_status ----
|
|
96
|
-
// The body runs on the gateway, behind the licence gate.
|
|
97
|
-
// ---- paywall: end ----
|
|
98
91
|
try {
|
|
99
|
-
return text(await
|
|
92
|
+
return text(await platformStatus(args));
|
|
100
93
|
}
|
|
101
94
|
catch (e) {
|
|
102
|
-
return textError(
|
|
95
|
+
return textError(String(e));
|
|
103
96
|
}
|
|
104
97
|
});
|
|
98
|
+
const serverName = "onesignal-mcp";
|
|
99
|
+
server.registerTool("health_check", {
|
|
100
|
+
title: "Health check",
|
|
101
|
+
description: "Check if the server is running and responsive.",
|
|
102
|
+
inputSchema: z.object({}),
|
|
103
|
+
annotations: READ_ONLY,
|
|
104
|
+
}, async () => {
|
|
105
|
+
return text("OK - server is running");
|
|
106
|
+
});
|
|
107
|
+
server.registerTool("version_info", {
|
|
108
|
+
title: "Version info",
|
|
109
|
+
description: "Get server version and metadata.",
|
|
110
|
+
inputSchema: z.object({}),
|
|
111
|
+
annotations: READ_ONLY,
|
|
112
|
+
}, async () => {
|
|
113
|
+
return text(JSON.stringify({ name: serverName, version: "1.0.0" }, null, 2));
|
|
114
|
+
});
|
|
115
|
+
server.registerTool("list_tools", {
|
|
116
|
+
title: "List tools",
|
|
117
|
+
description: "List all available tools on this server.",
|
|
118
|
+
inputSchema: z.object({}),
|
|
119
|
+
annotations: READ_ONLY,
|
|
120
|
+
}, async () => {
|
|
121
|
+
return text("See the tools/list response for the full tool list.");
|
|
122
|
+
});
|
|
123
|
+
server.registerTool("echo", {
|
|
124
|
+
title: "Echo",
|
|
125
|
+
description: "Echo back the provided text.",
|
|
126
|
+
inputSchema: z.object({ text: z.string().describe("Text to echo.") }),
|
|
127
|
+
annotations: READ_ONLY,
|
|
128
|
+
}, async (args) => {
|
|
129
|
+
return text(String(args?.text ?? ""));
|
|
130
|
+
});
|
|
105
131
|
return server;
|
|
106
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onesignal-mcp",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Query the OneSignal API (free tier; use a current v2 Organization API key for ONESIGNAL_USER_KEY and the app REST API key for ONESIGNAL_APP_KEY, Basic auth).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"mcpName": "io.github.mrfentmen/onesignal-mcp",
|
package/dist/gateway.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thin client for the premium gateway.
|
|
3
|
-
*
|
|
4
|
-
* The premium tools do not run in this package any more. Their bodies live on
|
|
5
|
-
* the gateway, which checks a Polar licence key before it does any work, so
|
|
6
|
-
* deleting anything here buys nothing: the answer only exists behind the gate.
|
|
7
|
-
*
|
|
8
|
-
* Set `MCP_LICENSE_KEY` to a Polar licence key. `MCP_GATEWAY_URL` overrides the
|
|
9
|
-
* endpoint, which is only useful for testing.
|
|
10
|
-
*/
|
|
11
|
-
/** Raised when a premium call cannot be completed. `message` is safe to show. */
|
|
12
|
-
export declare class GatewayError extends Error {
|
|
13
|
-
readonly refused: boolean;
|
|
14
|
-
constructor(message: string, refused: boolean);
|
|
15
|
-
}
|
|
16
|
-
export declare function premiumTool(tool: string, args: Record<string, unknown>): Promise<string>;
|
package/dist/gateway.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thin client for the premium gateway.
|
|
3
|
-
*
|
|
4
|
-
* The premium tools do not run in this package any more. Their bodies live on
|
|
5
|
-
* the gateway, which checks a Polar licence key before it does any work, so
|
|
6
|
-
* deleting anything here buys nothing: the answer only exists behind the gate.
|
|
7
|
-
*
|
|
8
|
-
* Set `MCP_LICENSE_KEY` to a Polar licence key. `MCP_GATEWAY_URL` overrides the
|
|
9
|
-
* endpoint, which is only useful for testing.
|
|
10
|
-
*/
|
|
11
|
-
const DEFAULT_GATEWAY_URL = 'https://mcp-gateway.contactae2000.workers.dev/mcp';
|
|
12
|
-
const DEFAULT_TIMEOUT_MS = 25000;
|
|
13
|
-
const USER_AGENT = 'mrfentmen-mcp/1.0';
|
|
14
|
-
/** Raised when a premium call cannot be completed. `message` is safe to show. */
|
|
15
|
-
export class GatewayError extends Error {
|
|
16
|
-
refused;
|
|
17
|
-
constructor(message, refused) {
|
|
18
|
-
super(message);
|
|
19
|
-
this.refused = refused;
|
|
20
|
-
this.name = 'GatewayError';
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export async function premiumTool(tool, args) {
|
|
24
|
-
const key = (process.env.MCP_LICENSE_KEY ?? '').trim();
|
|
25
|
-
if (!key) {
|
|
26
|
-
throw new GatewayError(`"${tool}" is a premium tool and no licence key is set. Set MCP_LICENSE_KEY in your MCP client config.`, true);
|
|
27
|
-
}
|
|
28
|
-
const url = (process.env.MCP_GATEWAY_URL ?? DEFAULT_GATEWAY_URL).trim();
|
|
29
|
-
const controller = new AbortController();
|
|
30
|
-
const timer = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT_MS);
|
|
31
|
-
let response;
|
|
32
|
-
try {
|
|
33
|
-
response = await fetch(url, {
|
|
34
|
-
method: 'POST',
|
|
35
|
-
headers: {
|
|
36
|
-
'content-type': 'application/json',
|
|
37
|
-
accept: 'application/json',
|
|
38
|
-
'user-agent': USER_AGENT,
|
|
39
|
-
authorization: `Bearer ${key}`,
|
|
40
|
-
},
|
|
41
|
-
body: JSON.stringify({
|
|
42
|
-
jsonrpc: '2.0',
|
|
43
|
-
id: 1,
|
|
44
|
-
method: 'tools/call',
|
|
45
|
-
params: { name: tool, arguments: args },
|
|
46
|
-
}),
|
|
47
|
-
signal: controller.signal,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
throw new GatewayError(`"${tool}" could not reach the licence gateway. Check your connection and try again.`, false);
|
|
52
|
-
}
|
|
53
|
-
finally {
|
|
54
|
-
clearTimeout(timer);
|
|
55
|
-
}
|
|
56
|
-
if (!response.ok) {
|
|
57
|
-
throw new GatewayError(`"${tool}" could not reach the licence gateway (HTTP ${response.status}).`, false);
|
|
58
|
-
}
|
|
59
|
-
let body;
|
|
60
|
-
try {
|
|
61
|
-
body = (await response.json());
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
throw new GatewayError(`"${tool}" got an unreadable answer from the licence gateway.`, false);
|
|
65
|
-
}
|
|
66
|
-
if (body.error) {
|
|
67
|
-
throw new GatewayError(`"${tool}" was refused by the licence gateway: ${body.error.message ?? 'unknown error'}`, false);
|
|
68
|
-
}
|
|
69
|
-
const result = body.result ?? {};
|
|
70
|
-
const text = (result.content ?? [])
|
|
71
|
-
.map((part) => part.text ?? '')
|
|
72
|
-
.join('\n')
|
|
73
|
-
.trim();
|
|
74
|
-
if (result.isError) {
|
|
75
|
-
// The gateway marks a licence refusal structurally, so a missing or rejected
|
|
76
|
-
// key is told apart from a tool that failed after the gate let it through.
|
|
77
|
-
if (result.structuredContent?.licenceRefusal) {
|
|
78
|
-
throw new GatewayError(text || `"${tool}" needs a valid licence key.`, true);
|
|
79
|
-
}
|
|
80
|
-
throw new GatewayError(text || `"${tool}" failed on the licence gateway.`, false);
|
|
81
|
-
}
|
|
82
|
-
if (!text)
|
|
83
|
-
throw new GatewayError(`"${tool}" returned no data.`, false);
|
|
84
|
-
return text;
|
|
85
|
-
}
|
package/dist/license.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns null when the caller may run the tool, or a short message telling
|
|
3
|
-
* them how to get a key.
|
|
4
|
-
*
|
|
5
|
-
* A good key is remembered for an hour, so a busy session does not hit the
|
|
6
|
-
* license server on every call and keeps working through a brief outage.
|
|
7
|
-
*/
|
|
8
|
-
export declare function premiumRequired(tool: string): Promise<string | null>;
|