@dudko.dev/agent-web-ui 0.0.3 → 0.0.4
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 +55 -2
- package/dist/{chunk-UNIXGP4N.js → chunk-627OXMFG.js} +2 -0
- package/dist/controller.cjs +560 -5
- package/dist/controller.d.cts +110 -3
- package/dist/controller.d.ts +110 -3
- package/dist/controller.js +555 -4
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/{labels-DH1ESUtm.d.ts → labels-BJMtk5Fw.d.ts} +2 -0
- package/dist/{labels-CmiTBLWD.d.cts → labels-B_y8F1GW.d.cts} +2 -0
- 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/package.json +3 -3
package/dist/locales/uk.cjs
CHANGED
|
@@ -82,6 +82,8 @@ var labelsFromCatalog = (tag, catalog2) => {
|
|
|
82
82
|
planned: t("planned"),
|
|
83
83
|
replanned: (_mode, reason) => t("replanned", { reason }),
|
|
84
84
|
placeholder: t("placeholder"),
|
|
85
|
+
// The catalogs' placeholder names no attachment: the same words for a text-only box.
|
|
86
|
+
placeholderTextOnly: t("placeholder"),
|
|
85
87
|
placeholderBusy: t("placeholderBusy"),
|
|
86
88
|
message: t("message"),
|
|
87
89
|
commands: t("commands"),
|
package/dist/locales/uk.js
CHANGED
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/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.4",
|
|
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",
|
|
@@ -182,8 +182,8 @@
|
|
|
182
182
|
"prettier": "^3.10.1",
|
|
183
183
|
"tsup": "^9.0.0",
|
|
184
184
|
"typescript": "^6.0.3",
|
|
185
|
-
"@dudko.dev/
|
|
186
|
-
"@dudko.dev/
|
|
185
|
+
"@dudko.dev/test-servers": "0.0.0",
|
|
186
|
+
"@dudko.dev/agent-web": "0.0.54"
|
|
187
187
|
},
|
|
188
188
|
"scripts": {
|
|
189
189
|
"build": "tsup",
|