@perkyzz/emvb 0.8.0 → 1.0.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 +3 -3
- package/package.json +4 -4
- package/src/admin/agents-api.ts +45 -0
- package/src/admin/editor/A11yCopilot.tsx +1 -1
- package/src/admin/editor/Editor.tsx +325 -239
- package/src/admin/editor/FieldPreview.tsx +164 -0
- package/src/admin/editor/Timeline.tsx +2 -1
- package/src/admin/editor/TopBar.tsx +36 -3
- package/src/admin/editor/canvas/CanvasFrame.tsx +2 -2
- package/src/admin/editor/canvas/DeviceBar.tsx +17 -9
- package/src/admin/editor/canvas/canvas-scale.ts +2 -2
- package/src/admin/editor/canvas/use-canvas-session.ts +2 -2
- package/src/admin/editor/co-design.ts +190 -0
- package/src/admin/editor/dnd/new-element.ts +26 -4
- package/src/admin/editor/editor-chrome.tsx +3 -3
- package/src/admin/editor/editor-commands.ts +8 -3
- package/src/admin/editor/editor-css.ts +3 -0
- package/src/admin/editor/element-chrome.ts +3 -1
- package/src/admin/editor/extension-manifests.ts +20 -0
- package/src/admin/editor/extensions/ExtensionPanels.tsx +26 -0
- package/src/admin/editor/extensions-context.tsx +27 -0
- package/src/admin/editor/feature-css.ts +17 -0
- package/src/admin/editor/host.ts +6 -0
- package/src/admin/editor/palette-items.ts +2 -2
- package/src/admin/editor/panels/AddPanel.tsx +31 -1
- package/src/admin/editor/panels/AgentRequestBox.tsx +116 -0
- package/src/admin/editor/panels/ClassesSection.tsx +9 -6
- package/src/admin/editor/panels/CoDesignPanel.tsx +170 -0
- package/src/admin/editor/panels/ColorControl.tsx +2 -2
- package/src/admin/editor/panels/ElementPanel.tsx +53 -15
- package/src/admin/editor/panels/LanguagesSection.tsx +152 -0
- package/src/admin/editor/panels/LayersPanel.tsx +10 -6
- package/src/admin/editor/panels/LeftPanel.tsx +33 -5
- package/src/admin/editor/panels/PageSettings.tsx +4 -0
- package/src/admin/editor/panels/SettingsPanel.tsx +21 -2
- package/src/admin/editor/panels/SiteStylesDrawer.tsx +7 -7
- package/src/admin/editor/panels/settings/BackgroundControls.tsx +76 -20
- package/src/admin/editor/panels/settings/BackgroundFill.tsx +8 -6
- package/src/admin/editor/panels/settings/BoxControl.tsx +5 -5
- package/src/admin/editor/panels/settings/EffectsControls.tsx +104 -9
- package/src/admin/editor/panels/settings/FieldControl.tsx +9 -3
- package/src/admin/editor/panels/settings/IconControls.tsx +14 -11
- package/src/admin/editor/panels/settings/LengthRow.tsx +27 -16
- package/src/admin/editor/panels/settings/LoopControl.tsx +269 -0
- package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +1 -1
- package/src/admin/editor/panels/settings/MediaPicker.tsx +5 -5
- package/src/admin/editor/panels/settings/MotionControl.tsx +12 -11
- package/src/admin/editor/panels/settings/QueryStyleRows.tsx +7 -4
- package/src/admin/editor/panels/settings/StyleRow.tsx +113 -13
- package/src/admin/editor/panels/settings/TextMarksControl.tsx +247 -0
- package/src/admin/editor/panels/settings/VariableBinding.tsx +2 -2
- package/src/admin/editor/panels/settings/background-mode.ts +14 -11
- package/src/admin/editor/panels/settings/box-link-name.ts +1 -1
- package/src/admin/editor/panels/settings/box-sides.ts +22 -14
- package/src/admin/editor/panels/settings/heading-warning.ts +5 -1
- package/src/admin/editor/panels/settings/length-units.ts +55 -2
- package/src/admin/editor/panels/settings/query-style.ts +3 -3
- package/src/admin/editor/panels/settings/style-sections.ts +51 -10
- package/src/admin/editor/panels/style-target.ts +9 -7
- package/src/admin/editor/presence.ts +60 -0
- package/src/admin/editor/store.ts +6 -2
- package/src/admin/editor/useCoDesign.ts +177 -0
- package/src/admin/editor/useEditorCommands.ts +4 -4
- package/src/admin/editor/useExtensions.ts +45 -0
- package/src/admin/editor/useNodeActions.ts +15 -6
- package/src/admin/editor/useProposals.ts +81 -0
- package/src/admin/index.tsx +5 -1
- package/src/admin/languages-api.ts +61 -0
- package/src/admin/media-api.ts +27 -0
- package/src/admin/pages/AgentSetup.tsx +148 -0
- package/src/admin/pages/AgentsPage.tsx +11 -28
- package/src/admin/pages/CollectionsPage.tsx +215 -0
- package/src/admin/pages/CreateDialog.tsx +15 -0
- package/src/admin/pages/ImportButton.tsx +18 -0
- package/src/admin/pages/ImportElementorDialog.tsx +669 -0
- package/src/admin/pages/ImportPageLinks.tsx +86 -0
- package/src/admin/pages/PageList.tsx +15 -1
- package/src/admin/pages/ThemePartList.tsx +15 -1
- package/src/admin/pages/section-head.tsx +27 -0
- package/src/admin/proposals-api.ts +91 -0
- package/src/admin/setup/host-collections.ts +100 -0
- package/src/admin/ui.ts +39 -2
- package/src/admin/widgets/CanvasField.tsx +202 -0
- package/src/admin/widgets/convert-body.ts +54 -0
- package/src/admin/widgets/field-fetcher.ts +79 -0
- package/src/astro/content-port.ts +14 -1
- package/src/astro/index.ts +2 -0
- package/src/astro/page-count.ts +77 -0
- package/src/astro/resolve-theme.ts +58 -3
- package/src/astro/resolve.ts +128 -5
- package/src/astro/responsive-images.ts +99 -0
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +44 -14
- package/src/core/arrange.ts +5 -1
- package/src/core/bounded-array.ts +31 -0
- package/src/core/canvas-collections.ts +20 -0
- package/src/core/clipboard.ts +9 -0
- package/src/core/contract.ts +285 -0
- package/src/core/css/generate.ts +89 -20
- package/src/core/css/trace.ts +18 -9
- package/src/core/css-keywords.ts +51 -1
- package/src/core/design/cascade.ts +12 -9
- package/src/core/design/classes.ts +4 -5
- package/src/core/design/devices.ts +13 -13
- package/src/core/design/states.ts +5 -3
- package/src/core/design/transfer.ts +5 -0
- package/src/core/design/variables.ts +17 -4
- package/src/core/elements/dynamic-elements.ts +19 -4
- package/src/core/elements/index.ts +73 -9
- package/src/core/extensions/define.ts +13 -0
- package/src/core/extensions/index.ts +41 -0
- package/src/core/extensions/namespace.ts +82 -0
- package/src/core/extensions/normalize.ts +141 -0
- package/src/core/extensions/placeholder.ts +41 -0
- package/src/core/extensions/registry.ts +94 -0
- package/src/core/extensions/render-ext.ts +118 -0
- package/src/core/extensions/safe-nodes.ts +93 -0
- package/src/core/extensions/schema.ts +112 -0
- package/src/core/extensions/types.ts +159 -0
- package/src/core/forms/binding.ts +1 -1
- package/src/core/history/diff.ts +1 -1
- package/src/core/import/elementor/atomic.ts +1595 -0
- package/src/core/import/elementor/classes.ts +127 -0
- package/src/core/import/elementor/context.ts +429 -0
- package/src/core/import/elementor/counter-steps.ts +72 -0
- package/src/core/import/elementor/css.ts +445 -0
- package/src/core/import/elementor/html.ts +500 -0
- package/src/core/import/elementor/index.ts +949 -0
- package/src/core/import/elementor/inline-marks.ts +81 -0
- package/src/core/import/elementor/snapshots.ts +48 -0
- package/src/core/import/elementor/style.ts +409 -0
- package/src/core/import/elementor/values.ts +241 -0
- package/src/core/import/elementor/widgets.ts +1897 -0
- package/src/core/index.ts +84 -0
- package/src/core/json-schema.ts +107 -0
- package/src/core/limits.ts +19 -0
- package/src/core/migrate/index.ts +6 -1
- package/src/core/migrate/v18.ts +222 -0
- package/src/core/perf/meter.ts +5 -5
- package/src/core/portable-text.ts +127 -0
- package/src/core/proposals-safety.ts +102 -0
- package/src/core/proposals.ts +357 -0
- package/src/core/recipes/index.ts +2 -2
- package/src/core/render/extras.ts +3 -3
- package/src/core/render/index.ts +140 -20
- package/src/core/render/loop.ts +1 -1
- package/src/core/render/pagination.ts +20 -1
- package/src/core/render/section.ts +4 -4
- package/src/core/render/vnode.ts +1 -1
- package/src/core/sanitize/css.ts +125 -10
- package/src/core/sanitize/motion.ts +116 -0
- package/src/core/saved-sections.ts +6 -0
- package/src/core/schema/descriptors.ts +3 -1
- package/src/core/schema/design.ts +2 -1
- package/src/core/schema/layout.ts +87 -14
- package/src/core/schema/style.ts +251 -114
- package/src/core/text-marks.ts +227 -0
- package/src/core/theme/dynamic.ts +9 -4
- package/src/core/theme/float.ts +1 -0
- package/src/core/theme/pagination.ts +9 -0
- package/src/core/theme/popup-rules.ts +17 -1
- package/src/core/translatable.ts +34 -0
- package/src/core/validate.ts +13 -1
- package/src/index.ts +35 -1
- package/src/mcp/errors.ts +3 -1
- package/src/mcp/ports.ts +67 -0
- package/src/mcp/prompts.ts +1 -11
- package/src/mcp/proposals.ts +281 -0
- package/src/mcp/read.ts +10 -9
- package/src/mcp/tools.ts +71 -3
- package/src/mcp/write.ts +66 -11
- package/src/server/agent-settings.ts +21 -2
- package/src/server/hooks.ts +81 -0
- package/src/server/mcp-routes.ts +15 -0
- package/src/server/plugin.ts +53 -5
- package/src/server/presence.ts +78 -0
- package/src/server/proposals.ts +261 -0
- package/src/server/requests.ts +196 -0
- package/src/server/tools-served.ts +45 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { PluginRouteError, type PluginRoute, type RouteContext } from "emdash";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { MAX_OPEN_REQUESTS_PER_PAGE, MAX_REQUEST_PROMPT } from "../core/limits.ts";
|
|
4
|
+
import { ProposalTarget } from "../core/proposals.ts";
|
|
5
|
+
import { isRecord } from "../core/record.ts";
|
|
6
|
+
import type { AgentRequest, RequestsPort } from "../mcp/ports.ts";
|
|
7
|
+
import { queued } from "../mcp/queue.ts";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* W-931 prompt relay (D-063: bring-your-own agent). A person writes a request in the editor's
|
|
11
|
+
* Agent tab; their own agent reads it with get_requests and answers with propose_changes. Nothing
|
|
12
|
+
* here calls a model or holds a key. Requests are the person's words for their agent: they are
|
|
13
|
+
* shown back as plain text and never reach a page.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const COLLECTION = "emvb_requests";
|
|
17
|
+
const ID = /^[0-9a-f]{16}$/;
|
|
18
|
+
/** Requests older than this are no longer offered to agents. */
|
|
19
|
+
const REQUEST_TTL_MS = 24 * 3_600_000;
|
|
20
|
+
const SEEN_KEY = "relay:seen";
|
|
21
|
+
|
|
22
|
+
type Target = z.infer<typeof ProposalTarget>;
|
|
23
|
+
type Stored = {
|
|
24
|
+
target: Target;
|
|
25
|
+
prompt: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
userId: string | null;
|
|
28
|
+
status: "open" | "answered";
|
|
29
|
+
proposalId?: string;
|
|
30
|
+
answeredAt?: string;
|
|
31
|
+
};
|
|
32
|
+
type Store = {
|
|
33
|
+
get(id: string): Promise<unknown>;
|
|
34
|
+
put(id: string, data: Stored): Promise<void>;
|
|
35
|
+
delete(id: string): Promise<boolean>;
|
|
36
|
+
query(options: { orderBy: Record<string, "asc" | "desc">; limit: number }): Promise<{
|
|
37
|
+
items: { id: string; data: unknown }[];
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
type Kv = {
|
|
41
|
+
get<T>(key: string): Promise<T | null>;
|
|
42
|
+
set(key: string, value: unknown): Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
function read(raw: unknown): Stored | null {
|
|
46
|
+
if (!isRecord(raw) || !isRecord(raw.target)) return null;
|
|
47
|
+
const target = ProposalTarget.safeParse(raw.target);
|
|
48
|
+
if (
|
|
49
|
+
!target.success ||
|
|
50
|
+
typeof raw.prompt !== "string" ||
|
|
51
|
+
typeof raw.createdAt !== "string" ||
|
|
52
|
+
(raw.status !== "open" && raw.status !== "answered")
|
|
53
|
+
)
|
|
54
|
+
return null;
|
|
55
|
+
return raw as Stored;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const toRequest = (id: string, s: Stored): AgentRequest => ({
|
|
59
|
+
id,
|
|
60
|
+
target: s.target,
|
|
61
|
+
prompt: s.prompt,
|
|
62
|
+
createdAt: s.createdAt,
|
|
63
|
+
status: s.status,
|
|
64
|
+
...(s.proposalId ? { proposalId: s.proposalId } : {}),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
/** Two requests in the same millisecond kept no order; times only move forward in one process. */
|
|
68
|
+
let lastCreatedMs = 0;
|
|
69
|
+
const nextCreatedAt = (nowMs: number) => {
|
|
70
|
+
// A tie (or a slightly earlier clock) moves one millisecond on; a clock far behind is kept.
|
|
71
|
+
lastCreatedMs =
|
|
72
|
+
nowMs > lastCreatedMs || lastCreatedMs - nowMs >= 1000 ? nowMs : lastCreatedMs + 1;
|
|
73
|
+
return new Date(lastCreatedMs).toISOString();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const sameTarget = (a: Target, b: Target) => a.collection === b.collection && a.id === b.id;
|
|
77
|
+
|
|
78
|
+
/** Same per-isolate write queue pattern as proposals; `now` is injectable for tests. */
|
|
79
|
+
export function requestsPort(store: Store, kv: Kv, now: () => number = Date.now): RequestsPort {
|
|
80
|
+
const all = async () => {
|
|
81
|
+
const rows = await store.query({ orderBy: { createdAt: "desc" }, limit: 200 });
|
|
82
|
+
const out: { id: string; stored: Stored }[] = [];
|
|
83
|
+
for (const row of rows.items) {
|
|
84
|
+
const stored = read(row.data);
|
|
85
|
+
if (stored) out.push({ id: row.id, stored });
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
};
|
|
89
|
+
const live = (s: Stored) => now() - Date.parse(s.createdAt) < REQUEST_TTL_MS;
|
|
90
|
+
return {
|
|
91
|
+
async list(target) {
|
|
92
|
+
return (await all())
|
|
93
|
+
.filter((r) => sameTarget(r.stored.target, target))
|
|
94
|
+
.map((r) => toRequest(r.id, r.stored));
|
|
95
|
+
},
|
|
96
|
+
async open(target) {
|
|
97
|
+
return (await all())
|
|
98
|
+
.filter((r) => r.stored.status === "open" && live(r.stored))
|
|
99
|
+
.filter((r) => !target || sameTarget(r.stored.target, target))
|
|
100
|
+
.map((r) => toRequest(r.id, r.stored))
|
|
101
|
+
.toSorted((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
102
|
+
},
|
|
103
|
+
create: (target, prompt, userId) =>
|
|
104
|
+
queued("requests", async () => {
|
|
105
|
+
const text = prompt.trim();
|
|
106
|
+
if (!text) return { ok: false as const, reason: "Write what you'd like the agent to do." };
|
|
107
|
+
if (text.length > MAX_REQUEST_PROMPT)
|
|
108
|
+
return {
|
|
109
|
+
ok: false as const,
|
|
110
|
+
reason: `Keep a request under ${MAX_REQUEST_PROMPT} characters.`,
|
|
111
|
+
};
|
|
112
|
+
const open = (await all()).filter(
|
|
113
|
+
(r) =>
|
|
114
|
+
r.stored.status === "open" && live(r.stored) && sameTarget(r.stored.target, target),
|
|
115
|
+
);
|
|
116
|
+
if (open.length >= MAX_OPEN_REQUESTS_PER_PAGE)
|
|
117
|
+
return {
|
|
118
|
+
ok: false as const,
|
|
119
|
+
reason: `This page already has ${MAX_OPEN_REQUESTS_PER_PAGE} requests waiting. Cancel one or wait for an answer.`,
|
|
120
|
+
};
|
|
121
|
+
const id = crypto.randomUUID().replaceAll("-", "").slice(0, 16);
|
|
122
|
+
const stored: Stored = {
|
|
123
|
+
target,
|
|
124
|
+
prompt: text,
|
|
125
|
+
createdAt: nextCreatedAt(now()),
|
|
126
|
+
userId,
|
|
127
|
+
status: "open",
|
|
128
|
+
};
|
|
129
|
+
await store.put(id, stored);
|
|
130
|
+
return { ok: true as const, request: toRequest(id, stored) };
|
|
131
|
+
}),
|
|
132
|
+
cancel: (id) => queued("requests", async () => ID.test(id) && (await store.delete(id))),
|
|
133
|
+
answer: (id, target, proposalId) =>
|
|
134
|
+
queued("requests", async () => {
|
|
135
|
+
if (!ID.test(id)) return false;
|
|
136
|
+
const stored = read(await store.get(id));
|
|
137
|
+
if (!stored || stored.status !== "open" || !sameTarget(stored.target, target)) return false;
|
|
138
|
+
await store.put(id, {
|
|
139
|
+
...stored,
|
|
140
|
+
status: "answered",
|
|
141
|
+
proposalId,
|
|
142
|
+
answeredAt: new Date(now()).toISOString(),
|
|
143
|
+
});
|
|
144
|
+
return true;
|
|
145
|
+
}),
|
|
146
|
+
async seen() {
|
|
147
|
+
await kv.set(SEEN_KEY, new Date(now()).toISOString());
|
|
148
|
+
},
|
|
149
|
+
async lastSeen() {
|
|
150
|
+
const at = await kv.get<unknown>(SEEN_KEY);
|
|
151
|
+
return typeof at === "string" && Number.isFinite(Date.parse(at)) ? at : null;
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export const requestsPortOf = (ctx: RouteContext<unknown>): RequestsPort =>
|
|
157
|
+
requestsPort(ctx.storage[COLLECTION] as unknown as Store, ctx.kv as unknown as Kv);
|
|
158
|
+
|
|
159
|
+
/** The editor's list: this page's requests and when an agent last checked for requests. */
|
|
160
|
+
export const requestsRoute: PluginRoute<z.infer<typeof ProposalTarget>> = {
|
|
161
|
+
permission: "content:edit_any",
|
|
162
|
+
input: ProposalTarget,
|
|
163
|
+
handler: async (ctx) => {
|
|
164
|
+
const port = requestsPortOf(ctx);
|
|
165
|
+
return { items: await port.list(ctx.input), agentSeenAt: await port.lastSeen() };
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const CreateInput = z.strictObject({
|
|
170
|
+
target: ProposalTarget,
|
|
171
|
+
prompt: z.string().max(MAX_REQUEST_PROMPT * 2),
|
|
172
|
+
});
|
|
173
|
+
export const requestCreateRoute: PluginRoute<z.infer<typeof CreateInput>> = {
|
|
174
|
+
permission: "content:edit_any",
|
|
175
|
+
input: CreateInput,
|
|
176
|
+
handler: async (ctx) => {
|
|
177
|
+
const made = await requestsPortOf(ctx).create(
|
|
178
|
+
ctx.input.target,
|
|
179
|
+
ctx.input.prompt,
|
|
180
|
+
ctx.user?.id ?? null,
|
|
181
|
+
);
|
|
182
|
+
if (!made.ok) throw new PluginRouteError("INVALID_REQUEST", made.reason, 422);
|
|
183
|
+
return { request: made.request };
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const IdInput = z.strictObject({ id: z.string().regex(ID) });
|
|
188
|
+
export const requestCancelRoute: PluginRoute<z.infer<typeof IdInput>> = {
|
|
189
|
+
permission: "content:edit_any",
|
|
190
|
+
input: IdInput,
|
|
191
|
+
handler: async (ctx) => {
|
|
192
|
+
if (!(await requestsPortOf(ctx).cancel(ctx.input.id)))
|
|
193
|
+
throw new PluginRouteError("NOT_FOUND", "No such request.", 404);
|
|
194
|
+
return { id: ctx.input.id };
|
|
195
|
+
},
|
|
196
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ToolDef } from "../mcp/tools.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* W-932: EmDash approves a plugin's MCP tools as a snapshot of the tool list and hides them again
|
|
5
|
+
* when the list changes (an EmVB update), without saying so to the plugin. EmVB notes which tool
|
|
6
|
+
* list EmDash last actually served, so the AI agents page can tell "working on this version" from
|
|
7
|
+
* "approved, but maybe for an older list".
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const KEY = "mcp:served";
|
|
11
|
+
type Kv = {
|
|
12
|
+
get<T>(key: string): Promise<T | null>;
|
|
13
|
+
set(key: string, value: unknown): Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** FNV-1a over what EmDash's consent covers: names, descriptions and the destructive flag. */
|
|
17
|
+
export function toolListFingerprint(tools: readonly ToolDef[]): string {
|
|
18
|
+
let hash = 0x811c9dc5;
|
|
19
|
+
const text = tools
|
|
20
|
+
.map((t) => `${t.name}\u0000${t.description}\u0000${t.destructive}`)
|
|
21
|
+
.join("\u0001");
|
|
22
|
+
for (let i = 0; i < text.length; i++) {
|
|
23
|
+
hash ^= text.charCodeAt(i);
|
|
24
|
+
hash = Math.imul(hash, 0x01000193) >>> 0;
|
|
25
|
+
}
|
|
26
|
+
return `${tools.length}-${hash.toString(16)}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Called when EmDash's own MCP endpoint ran an EmVB tool; writes only when the list changed. */
|
|
30
|
+
export async function noteServed(kv: Kv, fingerprint: string): Promise<void> {
|
|
31
|
+
if ((await kv.get<string>(KEY)) !== fingerprint) await kv.set(KEY, fingerprint);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function servedCurrent(kv: Kv, fingerprint: string): Promise<boolean> {
|
|
35
|
+
return (await kv.get<string>(KEY)) === fingerprint;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** EmDash's MCP endpoint, as opposed to calling the plugin route `mcp/<tool>` directly. */
|
|
39
|
+
export const viaEmDashMcp = (request: Request): boolean => {
|
|
40
|
+
try {
|
|
41
|
+
return new URL(request.url).pathname === "/_emdash/api/mcp";
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
};
|