@slopus/happy-agent-client 0.0.121 → 0.0.122

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.
@@ -0,0 +1,324 @@
1
+ /**
2
+ * The sidebar document: one `<nav>` of custom elements, every one of them an item the person can
3
+ * drag, parsed into a typed tree and written back in one canonical form. The daemon and every
4
+ * client use this one parser and serializer, so they read the same skeleton from the same text.
5
+ *
6
+ * The skeleton is strict well-formed markup — only the sidebar's elements, quoted attributes,
7
+ * explicit or self-closing ends, and no text — so an HTML parser and an XML parser read the same
8
+ * tree. A widget's content is the one exception: arbitrary HTML, kept verbatim and never
9
+ * interpreted.
10
+ */
11
+ import { Type } from "@sinclair/typebox";
12
+ import { Value } from "@sinclair/typebox/value";
13
+ import { spaceSidebarFoldRibbonSchema, spaceSidebarIdSchema, spaceSidebarLabelSchema, } from "./protocol/spaces.js";
14
+ /** The bounds every document stays within, as the daemon enforces them. */
15
+ export const SPACE_SIDEBAR_LIMITS = {
16
+ /** The whole document, in UTF-8 bytes. */
17
+ bytes: 128 * 1024,
18
+ /** Elements, `nav` included. */
19
+ elements: 1000,
20
+ /** Element nesting, `nav` included. */
21
+ depth: 16,
22
+ /** One widget's content, in UTF-8 bytes. */
23
+ widgetBytes: 16 * 1024,
24
+ };
25
+ /** The IDs of the nodes named by their tags; no other node may use them. */
26
+ export const SPACE_SIDEBAR_RESERVED_IDS = [
27
+ "nav",
28
+ "happy-search",
29
+ "happy-create",
30
+ ];
31
+ /** Why a document or an operation was refused, with where in the text it went wrong. */
32
+ export class SpaceSidebarError extends Error {
33
+ diagnostics;
34
+ constructor(message, offset = 0) {
35
+ super(message);
36
+ this.name = "SpaceSidebarError";
37
+ this.diagnostics = [{ message, offset }];
38
+ }
39
+ }
40
+ const switchSchema = Type.Optional(Type.Union([Type.Literal("true"), Type.Literal("false")]));
41
+ const empty = Type.Object({}, { additionalProperties: false });
42
+ const foldRibbonAttribute = Type.Optional(spaceSidebarFoldRibbonSchema);
43
+ const ATTRIBUTES = {
44
+ nav: Type.Object({ "fold-ribbon": foldRibbonAttribute }, { additionalProperties: false }),
45
+ "happy-search": empty,
46
+ "happy-create": empty,
47
+ "happy-section": Type.Object({ id: spaceSidebarIdSchema, label: spaceSidebarLabelSchema, collapsed: switchSchema }, { additionalProperties: false }),
48
+ "happy-separator": Type.Object({ id: spaceSidebarIdSchema }, { additionalProperties: false }),
49
+ "happy-space": Type.Object({ id: spaceSidebarIdSchema, expanded: switchSchema, "fold-ribbon": foldRibbonAttribute }, { additionalProperties: false }),
50
+ "happy-widget": Type.Object({ id: spaceSidebarIdSchema }, { additionalProperties: false }),
51
+ };
52
+ const CHILDREN = {
53
+ nav: [
54
+ "happy-search",
55
+ "happy-create",
56
+ "happy-section",
57
+ "happy-separator",
58
+ "happy-space",
59
+ "happy-widget",
60
+ ],
61
+ "happy-search": [],
62
+ "happy-create": [],
63
+ "happy-section": [],
64
+ "happy-separator": [],
65
+ "happy-space": ["happy-space"],
66
+ "happy-widget": [],
67
+ };
68
+ const WIDGET_CLOSE = "</happy-widget";
69
+ const LONE_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
70
+ /** Parses and validates a whole document; throws `SpaceSidebarError` with a diagnostic. */
71
+ export function parseSpaceSidebar(html) {
72
+ if (html.includes("\0") || LONE_SURROGATE.test(html))
73
+ throw new SpaceSidebarError("The sidebar must contain valid Unicode text without null characters.");
74
+ if (utf8Length(html) > SPACE_SIDEBAR_LIMITS.bytes)
75
+ throw new SpaceSidebarError("The sidebar exceeds 128 KiB.");
76
+ const stack = [];
77
+ let root;
78
+ let count = 0;
79
+ let at = 0;
80
+ const fail = (message, offset = at) => {
81
+ throw new SpaceSidebarError(message, offset);
82
+ };
83
+ // Sticky patterns match exactly at `at`, so the text is never copied while it is read.
84
+ const match = (pattern) => {
85
+ pattern.lastIndex = at;
86
+ return pattern.exec(html);
87
+ };
88
+ const CLOSE = /<\/([a-z][a-z0-9-]*)\s*>/y;
89
+ const OPEN = /<([a-z][a-z0-9-]*)\b/y;
90
+ const WHITESPACE = /\s+/y;
91
+ const ATTRIBUTE = /([a-z][a-z0-9-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/y;
92
+ const WIDGET_END = /<\/happy-widget\s*>/y;
93
+ while (at < html.length) {
94
+ if (html[at] !== "<") {
95
+ const end = html.indexOf("<", at);
96
+ const next = end < 0 ? html.length : end;
97
+ if (html.slice(at, next).trim())
98
+ fail("The sidebar holds elements, not text.");
99
+ at = next;
100
+ continue;
101
+ }
102
+ const start = at;
103
+ const close = match(CLOSE);
104
+ if (close !== null) {
105
+ const node = stack.pop();
106
+ if (node === undefined || node.tag !== close[1])
107
+ fail("Closing element does not match the open element.");
108
+ at += close[0].length;
109
+ continue;
110
+ }
111
+ const open = match(OPEN);
112
+ if (open === null)
113
+ fail("Expected an allowed element.");
114
+ const tag = open[1];
115
+ const schema = ATTRIBUTES[tag];
116
+ if (schema === undefined)
117
+ fail(`Element ${tag} is not allowed.`);
118
+ at += open[0].length;
119
+ const attrs = Object.create(null);
120
+ while (at < html.length) {
121
+ const whitespace = match(WHITESPACE);
122
+ if (whitespace !== null)
123
+ at += whitespace[0].length;
124
+ if (html[at] === ">" || html.startsWith("/>", at))
125
+ break;
126
+ if (whitespace === null)
127
+ fail("Attributes must be separated by whitespace.");
128
+ const attr = match(ATTRIBUTE);
129
+ if (attr === null)
130
+ fail("Attribute values must be quoted.");
131
+ const key = attr[1];
132
+ if (Object.hasOwn(attrs, key))
133
+ fail(`Duplicate attribute ${key}.`);
134
+ attrs[key] = decodeEntities(attr[2] ?? attr[3] ?? "");
135
+ at += attr[0].length;
136
+ }
137
+ if (!Value.Check(schema, { ...attrs }))
138
+ fail(`Invalid attributes on ${tag}.`, start);
139
+ const selfClosing = html.startsWith("/>", at);
140
+ if (selfClosing && tag === "nav")
141
+ fail("The nav cannot be self-closing.");
142
+ if (html[at] !== ">" && !selfClosing)
143
+ fail("The opening element is incomplete.");
144
+ at += selfClosing ? 2 : 1;
145
+ const parent = stack.at(-1);
146
+ if (tag === "nav" && (parent !== undefined || root !== undefined))
147
+ fail("The sidebar needs exactly one nav root.", start);
148
+ if (parent === undefined && tag !== "nav")
149
+ fail("The sidebar needs a nav root.", start);
150
+ if (parent !== undefined && !CHILDREN[parent.tag].includes(tag))
151
+ fail(parent.tag === "happy-space"
152
+ ? "A happy-space may contain only happy-space elements."
153
+ : `A ${parent.tag} cannot contain ${tag}.`, start);
154
+ if (++count > SPACE_SIDEBAR_LIMITS.elements || stack.length >= SPACE_SIDEBAR_LIMITS.depth)
155
+ fail("The sidebar exceeds 1,000 elements or depth 16.", start);
156
+ const node = { tag, attrs, start, children: [], content: "" };
157
+ if (parent === undefined)
158
+ root = node;
159
+ else
160
+ parent.children.push(node);
161
+ if (tag === "happy-widget" && !selfClosing) {
162
+ // A widget's content runs verbatim to its closing tag, which it may never contain.
163
+ const search = new RegExp(WIDGET_CLOSE, "gi");
164
+ search.lastIndex = at;
165
+ const end = search.exec(html)?.index ?? -1;
166
+ const contentStart = at;
167
+ at = end < 0 ? start : end;
168
+ const closing = end < 0 ? null : match(WIDGET_END);
169
+ if (closing === null)
170
+ fail(`A widget's content may not contain ${WIDGET_CLOSE} other than its own closing tag.`);
171
+ node.content = html.slice(contentStart, end);
172
+ widgetCheck(node.content, contentStart);
173
+ at = end + closing[0].length;
174
+ continue;
175
+ }
176
+ if (!selfClosing)
177
+ stack.push(node);
178
+ }
179
+ if (stack.length > 0 || root === undefined)
180
+ fail("The sidebar has unclosed elements or no nav root.");
181
+ return documentOf(root);
182
+ }
183
+ /** Checks a widget's content, as parsing and every operation do. */
184
+ export function widgetCheck(html, offset = 0) {
185
+ if (html.includes("\0") || LONE_SURROGATE.test(html))
186
+ throw new SpaceSidebarError("A widget must contain valid Unicode text without null characters.", offset);
187
+ if (utf8Length(html) > SPACE_SIDEBAR_LIMITS.widgetBytes)
188
+ throw new SpaceSidebarError("A widget's content exceeds 16 KiB.", offset);
189
+ if (new RegExp(WIDGET_CLOSE, "i").test(html))
190
+ throw new SpaceSidebarError(`A widget's content may not contain ${WIDGET_CLOSE}.`, offset);
191
+ }
192
+ function documentOf(root) {
193
+ const seen = new Set(SPACE_SIDEBAR_RESERVED_IDS);
194
+ const singles = { "happy-search": 0, "happy-create": 0 };
195
+ const identify = (node) => {
196
+ const id = node.attrs["id"];
197
+ if (seen.has(id))
198
+ throw new SpaceSidebarError(SPACE_SIDEBAR_RESERVED_IDS.includes(id)
199
+ ? `The ID ${id} is reserved.`
200
+ : `Duplicate ID ${id}.`, node.start);
201
+ seen.add(id);
202
+ return id;
203
+ };
204
+ const space = (node) => {
205
+ const foldRibbon = node.attrs["fold-ribbon"];
206
+ return {
207
+ type: "space",
208
+ id: identify(node),
209
+ expanded: node.attrs["expanded"] === "true",
210
+ ...(foldRibbon === "hover" || foldRibbon === "always" ? { foldRibbon } : {}),
211
+ children: node.children.map(space),
212
+ };
213
+ };
214
+ const items = root.children.map((node) => {
215
+ switch (node.tag) {
216
+ case "happy-search":
217
+ case "happy-create":
218
+ singles[node.tag]++;
219
+ return node.tag === "happy-search"
220
+ ? { type: "search", id: "happy-search" }
221
+ : { type: "create", id: "happy-create" };
222
+ case "happy-section":
223
+ return {
224
+ type: "section",
225
+ id: identify(node),
226
+ label: node.attrs["label"],
227
+ collapsed: node.attrs["collapsed"] === "true",
228
+ };
229
+ case "happy-separator":
230
+ return { type: "separator", id: identify(node) };
231
+ case "happy-widget":
232
+ return { type: "widget", id: identify(node), html: node.content };
233
+ default:
234
+ return space(node);
235
+ }
236
+ });
237
+ for (const tag of ["happy-search", "happy-create"])
238
+ if (singles[tag] !== 1)
239
+ throw new SpaceSidebarError(`The sidebar needs exactly one ${tag}.`);
240
+ const foldRibbon = root.attrs["fold-ribbon"];
241
+ return {
242
+ ...(foldRibbon === "hover" || foldRibbon === "always" ? { foldRibbon } : {}),
243
+ items,
244
+ };
245
+ }
246
+ function decodeEntities(value) {
247
+ return value.replace(/&(?:#(x[0-9a-f]+|[0-9]+)|(amp|lt|gt|quot|apos));/gi, (_match, numeric, named) => {
248
+ if (numeric !== undefined) {
249
+ const code = numeric[0]?.toLowerCase() === "x"
250
+ ? Number.parseInt(numeric.slice(1), 16)
251
+ : Number.parseInt(numeric, 10);
252
+ // A surrogate on its own would not survive the next read, so it decodes like any
253
+ // other unusable code point.
254
+ return code > 0 && code <= 0x10ffff && (code < 0xd800 || code > 0xdfff)
255
+ ? String.fromCodePoint(code)
256
+ : "\ufffd";
257
+ }
258
+ return { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" }[named.toLowerCase()];
259
+ });
260
+ }
261
+ function escapeAttribute(value) {
262
+ return value
263
+ .replaceAll("&", "&amp;")
264
+ .replaceAll('"', "&quot;")
265
+ .replaceAll("<", "&lt;")
266
+ .replaceAll(">", "&gt;");
267
+ }
268
+ /**
269
+ * The canonical text: one element a line, two spaces a level, attributes in grammar order, false
270
+ * switches and defaults left out, empty elements self-closed, widget content verbatim. With
271
+ * `widgets: false` widgets are left out, for clients that predate them.
272
+ */
273
+ export function formatSpaceSidebar(document, options = {}) {
274
+ const attribute = (name, value) => ` ${name}="${escapeAttribute(value)}"`;
275
+ const ribbon = (value) => value === undefined ? "" : attribute("fold-ribbon", value);
276
+ const space = (node, indent) => {
277
+ const open = `${indent}<happy-space${attribute("id", node.id)}${node.expanded ? attribute("expanded", "true") : ""}${ribbon(node.foldRibbon)}`;
278
+ if (node.children.length === 0)
279
+ return `${open}/>\n`;
280
+ return `${open}>\n${node.children
281
+ .map((child) => space(child, `${indent} `))
282
+ .join("")}${indent}</happy-space>\n`;
283
+ };
284
+ const item = (node) => {
285
+ switch (node.type) {
286
+ case "search":
287
+ return " <happy-search/>\n";
288
+ case "create":
289
+ return " <happy-create/>\n";
290
+ case "section":
291
+ return ` <happy-section${attribute("id", node.id)}${attribute("label", node.label)}${node.collapsed ? attribute("collapsed", "true") : ""}/>\n`;
292
+ case "separator":
293
+ return ` <happy-separator${attribute("id", node.id)}/>\n`;
294
+ case "widget":
295
+ if (options.widgets === false)
296
+ return "";
297
+ return node.html === ""
298
+ ? ` <happy-widget${attribute("id", node.id)}/>\n`
299
+ : ` <happy-widget${attribute("id", node.id)}>${node.html}</happy-widget>\n`;
300
+ case "space":
301
+ return space(node, " ");
302
+ }
303
+ };
304
+ return `<nav${ribbon(document.foldRibbon)}>\n${document.items.map(item).join("")}</nav>\n`;
305
+ }
306
+ /** UTF-8 length without allocating the encoding. */
307
+ export function utf8Length(text) {
308
+ let bytes = 0;
309
+ for (let index = 0; index < text.length; index++) {
310
+ const code = text.charCodeAt(index);
311
+ if (code < 0x80)
312
+ bytes += 1;
313
+ else if (code < 0x800)
314
+ bytes += 2;
315
+ else if (code >= 0xd800 && code <= 0xdbff && index + 1 < text.length) {
316
+ bytes += 4;
317
+ index++;
318
+ }
319
+ else
320
+ bytes += 3;
321
+ }
322
+ return bytes;
323
+ }
324
+ //# sourceMappingURL=spaceSidebarDocument.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaceSidebarDocument.js","sourceRoot":"","sources":["../sources/spaceSidebarDocument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAgB,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EACH,4BAA4B,EAC5B,oBAAoB,EACpB,uBAAuB,GAK1B,MAAM,sBAAsB,CAAC;AAE9B,2EAA2E;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAChC,0CAA0C;IAC1C,KAAK,EAAE,GAAG,GAAG,IAAI;IACjB,gCAAgC;IAChC,QAAQ,EAAE,IAAI;IACd,uCAAuC;IACvC,KAAK,EAAE,EAAE;IACT,4CAA4C;IAC5C,WAAW,EAAE,EAAE,GAAG,IAAI;CAChB,CAAC;AAEX,4EAA4E;AAC5E,MAAM,CAAC,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AS,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,mBAAmB,CAAC;YACrF,KAAK,OAAO;gBACR,OAAO,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjC,CAAC;IACL,CAAC,CAAC;IACF,OAAO,OAAO,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC;AAC/F,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,UAAU,CAAC,IAAY;IACnC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,IAAI,GAAG,IAAI;YAAE,KAAK,IAAI,CAAC,CAAC;aACvB,IAAI,IAAI,GAAG,KAAK;YAAE,KAAK,IAAI,CAAC,CAAC;aAC7B,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YACnE,KAAK,IAAI,CAAC,CAAC;YACX,KAAK,EAAE,CAAC;QACZ,CAAC;;YAAM,KAAK,IAAI,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slopus/happy-agent-client",
3
- "version": "0.0.121",
3
+ "version": "0.0.122",
4
4
  "description": "Typed client for the Happy agent HTTP API.",
5
5
  "license": "MIT",
6
6
  "repository": {