@dudko.dev/agent-web-ui 0.0.3 → 0.0.5
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 +78 -6
- package/dist/{chunk-UNIXGP4N.js → chunk-627OXMFG.js} +2 -0
- package/dist/{chunk-G7LQTOA2.js → chunk-NHU6WQM5.js} +61 -6
- package/dist/controller.cjs +621 -20
- package/dist/controller.d.cts +110 -3
- package/dist/controller.d.ts +110 -3
- package/dist/controller.js +575 -17
- package/dist/index.cjs +81 -14
- package/dist/index.d.cts +28 -10
- package/dist/index.d.ts +28 -10
- package/dist/index.js +27 -8
- package/dist/{labels-DH1ESUtm.d.ts → labels-CCPL7t17.d.ts} +8 -1
- package/dist/{labels-CmiTBLWD.d.cts → labels-ipy-ydkp.d.cts} +8 -1
- package/dist/locales/be.cjs +2 -0
- package/dist/locales/be.js +1 -1
- package/dist/locales/bg.cjs +2 -0
- package/dist/locales/bg.js +1 -1
- package/dist/locales/ca.cjs +2 -0
- package/dist/locales/ca.js +1 -1
- package/dist/locales/cs.cjs +2 -0
- package/dist/locales/cs.js +1 -1
- package/dist/locales/da.cjs +2 -0
- package/dist/locales/da.js +1 -1
- package/dist/locales/de.cjs +2 -0
- package/dist/locales/de.js +1 -1
- package/dist/locales/el.cjs +2 -0
- package/dist/locales/el.js +1 -1
- package/dist/locales/en.cjs +2 -0
- package/dist/locales/en.js +1 -1
- package/dist/locales/es-419.cjs +2 -0
- package/dist/locales/es-419.js +1 -1
- package/dist/locales/es.cjs +2 -0
- package/dist/locales/es.js +1 -1
- package/dist/locales/fi.cjs +2 -0
- package/dist/locales/fi.js +1 -1
- package/dist/locales/fr-CA.cjs +2 -0
- package/dist/locales/fr-CA.js +1 -1
- package/dist/locales/fr.cjs +2 -0
- package/dist/locales/fr.js +1 -1
- package/dist/locales/gn.cjs +2 -0
- package/dist/locales/gn.js +1 -1
- package/dist/locales/hr.cjs +2 -0
- package/dist/locales/hr.js +1 -1
- package/dist/locales/ht.cjs +2 -0
- package/dist/locales/ht.js +1 -1
- package/dist/locales/hu.cjs +2 -0
- package/dist/locales/hu.js +1 -1
- package/dist/locales/index.cjs +2 -0
- package/dist/locales/index.js +1 -1
- package/dist/locales/it.cjs +2 -0
- package/dist/locales/it.js +1 -1
- package/dist/locales/nb.cjs +2 -0
- package/dist/locales/nb.js +1 -1
- package/dist/locales/nl.cjs +2 -0
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.cjs +2 -0
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt-BR.cjs +2 -0
- package/dist/locales/pt-BR.js +1 -1
- package/dist/locales/pt.cjs +2 -0
- package/dist/locales/pt.js +1 -1
- package/dist/locales/qu.cjs +2 -0
- package/dist/locales/qu.js +1 -1
- package/dist/locales/ro.cjs +2 -0
- package/dist/locales/ro.js +1 -1
- package/dist/locales/ru.cjs +2 -0
- package/dist/locales/ru.js +1 -1
- package/dist/locales/sk.cjs +2 -0
- package/dist/locales/sk.js +1 -1
- package/dist/locales/sq.cjs +2 -0
- package/dist/locales/sq.js +1 -1
- package/dist/locales/sr-Latn.cjs +2 -0
- package/dist/locales/sr-Latn.js +1 -1
- package/dist/locales/sr.cjs +2 -0
- package/dist/locales/sr.js +1 -1
- package/dist/locales/sv.cjs +2 -0
- package/dist/locales/sv.js +1 -1
- package/dist/locales/tr.cjs +2 -0
- package/dist/locales/tr.js +1 -1
- package/dist/locales/uk.cjs +2 -0
- package/dist/locales/uk.js +1 -1
- package/dist/markdown.cjs +36 -0
- package/dist/markdown.d.cts +27 -1
- package/dist/markdown.d.ts +27 -1
- package/dist/markdown.js +33 -0
- package/dist/mcp-app.cjs +1 -4
- package/dist/mcp-app.js +1 -2
- package/package.json +1 -1
package/dist/markdown.cjs
CHANGED
|
@@ -23,9 +23,12 @@ __export(markdown_exports, {
|
|
|
23
23
|
MARKDOWN_CACHE_MAX: () => MARKDOWN_CACHE_MAX,
|
|
24
24
|
MARKDOWN_LONG_CELL: () => MARKDOWN_LONG_CELL,
|
|
25
25
|
emptyMarkdownStream: () => emptyMarkdownStream,
|
|
26
|
+
linkHostAllowed: () => linkHostAllowed,
|
|
27
|
+
linkPolicyOf: () => linkPolicyOf,
|
|
26
28
|
markdownCellIsLong: () => markdownCellIsLong,
|
|
27
29
|
markdownPlainText: () => markdownPlainText,
|
|
28
30
|
markdownSettled: () => markdownSettled,
|
|
31
|
+
parseLinkHosts: () => parseLinkHosts,
|
|
29
32
|
parseMarkdown: () => parseMarkdown,
|
|
30
33
|
parseMarkdownCached: () => parseMarkdownCached,
|
|
31
34
|
parseMarkdownInline: () => parseMarkdownInline,
|
|
@@ -602,14 +605,47 @@ var lengthOf = (runs) => runs.reduce(
|
|
|
602
605
|
0
|
|
603
606
|
);
|
|
604
607
|
var markdownCellIsLong = (runs) => lengthOf(runs) > MARKDOWN_LONG_CELL;
|
|
608
|
+
|
|
609
|
+
// src/markdown/links.ts
|
|
610
|
+
var linkHostAllowed = (href, hosts) => {
|
|
611
|
+
let u;
|
|
612
|
+
try {
|
|
613
|
+
u = new URL(href.trim());
|
|
614
|
+
} catch {
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
if (u.protocol !== "https:" && u.protocol !== "http:") return false;
|
|
618
|
+
if (u.username !== "" || u.password !== "" || u.port !== "") return false;
|
|
619
|
+
const host = u.hostname.toLowerCase();
|
|
620
|
+
for (const entry of hosts) {
|
|
621
|
+
const e = entry.trim();
|
|
622
|
+
const slash = e.indexOf("/");
|
|
623
|
+
const eHost = (slash < 0 ? e : e.slice(0, slash)).toLowerCase();
|
|
624
|
+
const ePath = slash < 0 ? "" : e.slice(slash).replace(/\/+$/, "");
|
|
625
|
+
if (!eHost || eHost !== host) continue;
|
|
626
|
+
if (!ePath) return true;
|
|
627
|
+
if (u.pathname === ePath || u.pathname.startsWith(`${ePath}/`)) return true;
|
|
628
|
+
}
|
|
629
|
+
return false;
|
|
630
|
+
};
|
|
631
|
+
var linkPolicyOf = (hosts) => (href) => linkHostAllowed(href, hosts);
|
|
632
|
+
var parseLinkHosts = (value) => {
|
|
633
|
+
if (value === null || value === void 0) return void 0;
|
|
634
|
+
const entries = value.split(/[\s,]+/).map((s) => s.trim()).filter(Boolean);
|
|
635
|
+
const ok = entries.every((e) => /^[A-Za-z0-9.-]+(\/[A-Za-z0-9._~@%+-]+)*\/?$/.test(e));
|
|
636
|
+
return ok ? entries : [];
|
|
637
|
+
};
|
|
605
638
|
// Annotate the CommonJS export names for ESM import in node:
|
|
606
639
|
0 && (module.exports = {
|
|
607
640
|
MARKDOWN_CACHE_MAX,
|
|
608
641
|
MARKDOWN_LONG_CELL,
|
|
609
642
|
emptyMarkdownStream,
|
|
643
|
+
linkHostAllowed,
|
|
644
|
+
linkPolicyOf,
|
|
610
645
|
markdownCellIsLong,
|
|
611
646
|
markdownPlainText,
|
|
612
647
|
markdownSettled,
|
|
648
|
+
parseLinkHosts,
|
|
613
649
|
parseMarkdown,
|
|
614
650
|
parseMarkdownCached,
|
|
615
651
|
parseMarkdownInline,
|
package/dist/markdown.d.cts
CHANGED
|
@@ -149,5 +149,31 @@ declare const MARKDOWN_LONG_CELL = 48;
|
|
|
149
149
|
/** Whether a table cell wraps (see {@link MARKDOWN_LONG_CELL}). */
|
|
150
150
|
declare const markdownCellIsLong: (runs: MarkdownInline[]) => boolean;
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Which links an answer may keep (a renderer's `linkAllowed`): a host's list of hosts, each
|
|
154
|
+
* `host` or `host/path` - `dudko.dev`, `github.com/dudko-dev`, `npmjs.com/package/@dudko.dev`. A
|
|
155
|
+
* link the list does not name is drawn as its words (and its address, as text): a public chat
|
|
156
|
+
* that should only send people to its own sites (examples/support-cloudflare). Without a list,
|
|
157
|
+
* nothing changes: every link `safeHref` takes stays a link.
|
|
158
|
+
*
|
|
159
|
+
* The rules (each a guard, `tests/markdown.test.ts`): `http(s)` only (no `mailto:`, no other
|
|
160
|
+
* scheme); the host EXACTLY one of the list's, case-insensitive - no subdomain (`evil.dudko.dev`),
|
|
161
|
+
* no look-alike (`dudko.dev.evil.com`); no user or password in the address (`dudko.dev@evil.com`
|
|
162
|
+
* is evil.com's, `user@dudko.dev` refused anyway); the default port only; a path in the entry is a
|
|
163
|
+
* prefix by whole segments (`github.com/dudko-dev` takes `/dudko-dev` and `/dudko-dev/agents`,
|
|
164
|
+
* never `/dudko-devil`), compared after the URL parser's normalisation (`/x/../dudko-dev` is
|
|
165
|
+
* `/dudko-dev`, `%2e%2e` too) and before any percent-decoding.
|
|
166
|
+
*/
|
|
167
|
+
declare const linkHostAllowed: (href: string, hosts: readonly string[]) => boolean;
|
|
168
|
+
/** `linkHostAllowed` bound to a list, for a renderer's `linkAllowed`. */
|
|
169
|
+
declare const linkPolicyOf: (hosts: readonly string[]) => ((href: string) => boolean);
|
|
170
|
+
/**
|
|
171
|
+
* A list of hosts as an attribute writes it (`<dd-agent-chat link-hosts="dudko.dev
|
|
172
|
+
* github.com/dudko-dev">`): separated by commas or blanks, empty entries dropped; an entry with a
|
|
173
|
+
* scheme, a query, a fragment, a user or a port makes the whole list empty (the attribute is
|
|
174
|
+
* wrong: no link is kept - never "every link"). No attribute: `undefined` (no allowlist).
|
|
175
|
+
*/
|
|
176
|
+
declare const parseLinkHosts: (value: string | null | undefined) => string[] | undefined;
|
|
177
|
+
|
|
178
|
+
export { MARKDOWN_CACHE_MAX, MARKDOWN_LONG_CELL, emptyMarkdownStream, linkHostAllowed, linkPolicyOf, markdownCellIsLong, markdownPlainText, markdownSettled, parseLinkHosts, parseMarkdown, parseMarkdownCached, parseMarkdownInline, parseMarkdownStreaming, safeHref, workspaceLinkPath };
|
|
153
179
|
export type { MarkdownAlign, MarkdownBlock, MarkdownInline, MarkdownListBlock, MarkdownListItem, MarkdownStream };
|
package/dist/markdown.d.ts
CHANGED
|
@@ -149,5 +149,31 @@ declare const MARKDOWN_LONG_CELL = 48;
|
|
|
149
149
|
/** Whether a table cell wraps (see {@link MARKDOWN_LONG_CELL}). */
|
|
150
150
|
declare const markdownCellIsLong: (runs: MarkdownInline[]) => boolean;
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Which links an answer may keep (a renderer's `linkAllowed`): a host's list of hosts, each
|
|
154
|
+
* `host` or `host/path` - `dudko.dev`, `github.com/dudko-dev`, `npmjs.com/package/@dudko.dev`. A
|
|
155
|
+
* link the list does not name is drawn as its words (and its address, as text): a public chat
|
|
156
|
+
* that should only send people to its own sites (examples/support-cloudflare). Without a list,
|
|
157
|
+
* nothing changes: every link `safeHref` takes stays a link.
|
|
158
|
+
*
|
|
159
|
+
* The rules (each a guard, `tests/markdown.test.ts`): `http(s)` only (no `mailto:`, no other
|
|
160
|
+
* scheme); the host EXACTLY one of the list's, case-insensitive - no subdomain (`evil.dudko.dev`),
|
|
161
|
+
* no look-alike (`dudko.dev.evil.com`); no user or password in the address (`dudko.dev@evil.com`
|
|
162
|
+
* is evil.com's, `user@dudko.dev` refused anyway); the default port only; a path in the entry is a
|
|
163
|
+
* prefix by whole segments (`github.com/dudko-dev` takes `/dudko-dev` and `/dudko-dev/agents`,
|
|
164
|
+
* never `/dudko-devil`), compared after the URL parser's normalisation (`/x/../dudko-dev` is
|
|
165
|
+
* `/dudko-dev`, `%2e%2e` too) and before any percent-decoding.
|
|
166
|
+
*/
|
|
167
|
+
declare const linkHostAllowed: (href: string, hosts: readonly string[]) => boolean;
|
|
168
|
+
/** `linkHostAllowed` bound to a list, for a renderer's `linkAllowed`. */
|
|
169
|
+
declare const linkPolicyOf: (hosts: readonly string[]) => ((href: string) => boolean);
|
|
170
|
+
/**
|
|
171
|
+
* A list of hosts as an attribute writes it (`<dd-agent-chat link-hosts="dudko.dev
|
|
172
|
+
* github.com/dudko-dev">`): separated by commas or blanks, empty entries dropped; an entry with a
|
|
173
|
+
* scheme, a query, a fragment, a user or a port makes the whole list empty (the attribute is
|
|
174
|
+
* wrong: no link is kept - never "every link"). No attribute: `undefined` (no allowlist).
|
|
175
|
+
*/
|
|
176
|
+
declare const parseLinkHosts: (value: string | null | undefined) => string[] | undefined;
|
|
177
|
+
|
|
178
|
+
export { MARKDOWN_CACHE_MAX, MARKDOWN_LONG_CELL, emptyMarkdownStream, linkHostAllowed, linkPolicyOf, markdownCellIsLong, markdownPlainText, markdownSettled, parseLinkHosts, parseMarkdown, parseMarkdownCached, parseMarkdownInline, parseMarkdownStreaming, safeHref, workspaceLinkPath };
|
|
153
179
|
export type { MarkdownAlign, MarkdownBlock, MarkdownInline, MarkdownListBlock, MarkdownListItem, MarkdownStream };
|
package/dist/markdown.js
CHANGED
|
@@ -556,13 +556,46 @@ var lengthOf = (runs) => runs.reduce(
|
|
|
556
556
|
0
|
|
557
557
|
);
|
|
558
558
|
var markdownCellIsLong = (runs) => lengthOf(runs) > MARKDOWN_LONG_CELL;
|
|
559
|
+
|
|
560
|
+
// src/markdown/links.ts
|
|
561
|
+
var linkHostAllowed = (href, hosts) => {
|
|
562
|
+
let u;
|
|
563
|
+
try {
|
|
564
|
+
u = new URL(href.trim());
|
|
565
|
+
} catch {
|
|
566
|
+
return false;
|
|
567
|
+
}
|
|
568
|
+
if (u.protocol !== "https:" && u.protocol !== "http:") return false;
|
|
569
|
+
if (u.username !== "" || u.password !== "" || u.port !== "") return false;
|
|
570
|
+
const host = u.hostname.toLowerCase();
|
|
571
|
+
for (const entry of hosts) {
|
|
572
|
+
const e = entry.trim();
|
|
573
|
+
const slash = e.indexOf("/");
|
|
574
|
+
const eHost = (slash < 0 ? e : e.slice(0, slash)).toLowerCase();
|
|
575
|
+
const ePath = slash < 0 ? "" : e.slice(slash).replace(/\/+$/, "");
|
|
576
|
+
if (!eHost || eHost !== host) continue;
|
|
577
|
+
if (!ePath) return true;
|
|
578
|
+
if (u.pathname === ePath || u.pathname.startsWith(`${ePath}/`)) return true;
|
|
579
|
+
}
|
|
580
|
+
return false;
|
|
581
|
+
};
|
|
582
|
+
var linkPolicyOf = (hosts) => (href) => linkHostAllowed(href, hosts);
|
|
583
|
+
var parseLinkHosts = (value) => {
|
|
584
|
+
if (value === null || value === void 0) return void 0;
|
|
585
|
+
const entries = value.split(/[\s,]+/).map((s) => s.trim()).filter(Boolean);
|
|
586
|
+
const ok = entries.every((e) => /^[A-Za-z0-9.-]+(\/[A-Za-z0-9._~@%+-]+)*\/?$/.test(e));
|
|
587
|
+
return ok ? entries : [];
|
|
588
|
+
};
|
|
559
589
|
export {
|
|
560
590
|
MARKDOWN_CACHE_MAX,
|
|
561
591
|
MARKDOWN_LONG_CELL,
|
|
562
592
|
emptyMarkdownStream,
|
|
593
|
+
linkHostAllowed,
|
|
594
|
+
linkPolicyOf,
|
|
563
595
|
markdownCellIsLong,
|
|
564
596
|
markdownPlainText,
|
|
565
597
|
markdownSettled,
|
|
598
|
+
parseLinkHosts,
|
|
566
599
|
parseMarkdown,
|
|
567
600
|
parseMarkdownCached,
|
|
568
601
|
parseMarkdownInline,
|
package/dist/mcp-app.cjs
CHANGED
|
@@ -85,9 +85,6 @@ __export(mcp_app_entry_exports, {
|
|
|
85
85
|
});
|
|
86
86
|
module.exports = __toCommonJS(mcp_app_entry_exports);
|
|
87
87
|
|
|
88
|
-
// src/mcp-app.ts
|
|
89
|
-
var import_agent_web = require("@dudko.dev/agent-web");
|
|
90
|
-
|
|
91
88
|
// src/html-preview.ts
|
|
92
89
|
var escapeAttribute = (value) => value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
93
90
|
var cspMetaTag = (policy) => `<meta http-equiv="Content-Security-Policy" content="${escapeAttribute(policy)}">`;
|
|
@@ -213,7 +210,7 @@ var clampAppHeight = (height, max = APP_MAX_HEIGHT) => Math.min(
|
|
|
213
210
|
var origins = (list) => {
|
|
214
211
|
const out = [];
|
|
215
212
|
for (const entry of list ?? []) {
|
|
216
|
-
const origin = (
|
|
213
|
+
const origin = mcpAppPolicyOrigin(entry);
|
|
217
214
|
if (origin && !out.includes(origin)) out.push(origin);
|
|
218
215
|
}
|
|
219
216
|
return out;
|
package/dist/mcp-app.js
CHANGED
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
} from "./chunk-WEYQMUKY.js";
|
|
19
19
|
|
|
20
20
|
// src/mcp-app.ts
|
|
21
|
-
import { mcpAppOrigin } from "@dudko.dev/agent-web";
|
|
22
21
|
var MCP_APP_PROTOCOL_VERSION = "2026-01-26";
|
|
23
22
|
var APP_DEFAULT_HEIGHT = 360;
|
|
24
23
|
var APP_MIN_HEIGHT = 120;
|
|
@@ -50,7 +49,7 @@ var clampAppHeight = (height, max = APP_MAX_HEIGHT) => Math.min(
|
|
|
50
49
|
var origins = (list) => {
|
|
51
50
|
const out = [];
|
|
52
51
|
for (const entry of list ?? []) {
|
|
53
|
-
const origin =
|
|
52
|
+
const origin = mcpAppPolicyOrigin(entry);
|
|
54
53
|
if (origin && !out.includes(origin)) out.push(origin);
|
|
55
54
|
}
|
|
56
55
|
return out;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudko.dev/agent-web-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The framework-free UI logic of @dudko.dev/agent-web, the in-browser LLM agent: the headless reducer that turns the agent's events into UI state, every UI string, the composer's and transcript's pure helpers, voice, saved chats, the sandboxed-frame and MCP Apps security cores, the MCP Apps sandbox page for a server, and the pipeline editor's logic - plus the stylesheets. No React: build a front end for any framework on it.",
|
|
6
6
|
"type": "module",
|