sgiant-ai-widget 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.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +155 -0
  3. package/dist/ai-invalidation.d.ts +29 -0
  4. package/dist/ai-invalidation.d.ts.map +1 -0
  5. package/dist/ai-invalidation.js +121 -0
  6. package/dist/ai-invalidation.js.map +1 -0
  7. package/dist/contrast.d.ts +87 -0
  8. package/dist/contrast.d.ts.map +1 -0
  9. package/dist/contrast.js +151 -0
  10. package/dist/contrast.js.map +1 -0
  11. package/dist/directive.d.ts +37 -0
  12. package/dist/directive.d.ts.map +1 -0
  13. package/dist/directive.js +87 -0
  14. package/dist/directive.js.map +1 -0
  15. package/dist/dom.d.ts +83 -0
  16. package/dist/dom.d.ts.map +1 -0
  17. package/dist/dom.js +146 -0
  18. package/dist/dom.js.map +1 -0
  19. package/dist/host-actions.d.ts +192 -0
  20. package/dist/host-actions.d.ts.map +1 -0
  21. package/dist/host-actions.js +443 -0
  22. package/dist/host-actions.js.map +1 -0
  23. package/dist/icons.d.ts +21 -0
  24. package/dist/icons.d.ts.map +1 -0
  25. package/dist/icons.js +84 -0
  26. package/dist/icons.js.map +1 -0
  27. package/dist/index.d.ts +600 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +4833 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/labels.d.ts +187 -0
  32. package/dist/labels.d.ts.map +1 -0
  33. package/dist/labels.js +232 -0
  34. package/dist/labels.js.map +1 -0
  35. package/dist/limits.d.ts +43 -0
  36. package/dist/limits.d.ts.map +1 -0
  37. package/dist/limits.js +48 -0
  38. package/dist/limits.js.map +1 -0
  39. package/dist/markdown.d.ts +23 -0
  40. package/dist/markdown.d.ts.map +1 -0
  41. package/dist/markdown.js +0 -0
  42. package/dist/markdown.js.map +1 -0
  43. package/dist/message-chrome.d.ts +45 -0
  44. package/dist/message-chrome.d.ts.map +1 -0
  45. package/dist/message-chrome.js +101 -0
  46. package/dist/message-chrome.js.map +1 -0
  47. package/dist/pane-follow.d.ts +67 -0
  48. package/dist/pane-follow.d.ts.map +1 -0
  49. package/dist/pane-follow.js +61 -0
  50. package/dist/pane-follow.js.map +1 -0
  51. package/dist/prefix.d.ts +9 -0
  52. package/dist/prefix.d.ts.map +1 -0
  53. package/dist/prefix.js +9 -0
  54. package/dist/prefix.js.map +1 -0
  55. package/dist/proposal-summary.d.ts +19 -0
  56. package/dist/proposal-summary.d.ts.map +1 -0
  57. package/dist/proposal-summary.js +73 -0
  58. package/dist/proposal-summary.js.map +1 -0
  59. package/dist/replay.d.ts +125 -0
  60. package/dist/replay.d.ts.map +1 -0
  61. package/dist/replay.js +172 -0
  62. package/dist/replay.js.map +1 -0
  63. package/dist/safe-url.d.ts +47 -0
  64. package/dist/safe-url.d.ts.map +1 -0
  65. package/dist/safe-url.js +80 -0
  66. package/dist/safe-url.js.map +1 -0
  67. package/dist/sgiant-ai-widget.global.js +778 -0
  68. package/dist/sgiant-ai-widget.global.js.map +7 -0
  69. package/dist/specs.d.ts +173 -0
  70. package/dist/specs.d.ts.map +1 -0
  71. package/dist/specs.js +231 -0
  72. package/dist/specs.js.map +1 -0
  73. package/dist/storage.d.ts +77 -0
  74. package/dist/storage.d.ts.map +1 -0
  75. package/dist/storage.js +124 -0
  76. package/dist/storage.js.map +1 -0
  77. package/dist/styles.d.ts +29 -0
  78. package/dist/styles.d.ts.map +1 -0
  79. package/dist/styles.js +876 -0
  80. package/dist/styles.js.map +1 -0
  81. package/dist/ui-control.d.ts +8 -0
  82. package/dist/ui-control.d.ts.map +1 -0
  83. package/dist/ui-control.js +8 -0
  84. package/dist/ui-control.js.map +1 -0
  85. package/dist/ui-render.d.ts +75 -0
  86. package/dist/ui-render.d.ts.map +1 -0
  87. package/dist/ui-render.js +617 -0
  88. package/dist/ui-render.js.map +1 -0
  89. package/dist/ui-spec.d.ts +143 -0
  90. package/dist/ui-spec.d.ts.map +1 -0
  91. package/dist/ui-spec.js +288 -0
  92. package/dist/ui-spec.js.map +1 -0
  93. package/package.json +61 -0
@@ -0,0 +1,87 @@
1
+ /**
2
+ * The `[[tag:{json}]]` directive extractor the chat widget runs over every
3
+ * assistant reply.
4
+ *
5
+ * Lives in its own module because it is pure and because getting it wrong is
6
+ * VISIBLE: whatever this function fails to consume is shown to the user as raw
7
+ * text in the middle of a sentence. That makes it worth pinning down with
8
+ * tests, which the widget itself (imperative DOM, no harness) cannot be.
9
+ */
10
+ /**
11
+ * Pull the FIRST `[[tag:{json}]]` out of `text`.
12
+ *
13
+ * Forgiving by design, because the delimiters are the part a model gets wrong
14
+ * most often and every slip is shown to the user as raw punctuation:
15
+ *
16
+ * - the JSON object is BRACE-MATCHED, string- and escape-aware, so a `}` or
17
+ * `]]` inside a quoted caption cannot end it early;
18
+ * - 0–2 trailing `]` are consumed, so `…}]]`, `…}]` and `…}` all parse;
19
+ * - a surplus `}` before the brackets is consumed too. A model that closes one
20
+ * brace too many is common, and it used to leave `}]]` sitting in the reply:
21
+ * the matcher stopped at the REAL closing brace (correctly), then looked for
22
+ * `]`, found `}`, and gave up — so the card rendered perfectly and the user
23
+ * still saw `}]]` printed above it.
24
+ *
25
+ * Only ADJACENT residue is swallowed. Once a character is neither `}` nor `]`,
26
+ * consumption stops, so nothing the assistant actually wrote is eaten.
27
+ */
28
+ export function parseJsonDirective(text, tag) {
29
+ const open = `[[${tag}:`;
30
+ const start = text.indexOf(open);
31
+ if (start < 0)
32
+ return null;
33
+ const braceStart = text.indexOf("{", start + open.length);
34
+ if (braceStart < 0)
35
+ return null;
36
+ // Walk the JSON object, tracking string state, to find its true closing brace.
37
+ let depth = 0;
38
+ let inStr = false;
39
+ let esc = false;
40
+ let end = -1;
41
+ for (let i = braceStart; i < text.length; i++) {
42
+ const ch = text[i];
43
+ if (inStr) {
44
+ if (esc)
45
+ esc = false;
46
+ else if (ch === "\\")
47
+ esc = true;
48
+ else if (ch === '"')
49
+ inStr = false;
50
+ }
51
+ else if (ch === '"')
52
+ inStr = true;
53
+ else if (ch === "{")
54
+ depth++;
55
+ else if (ch === "}") {
56
+ depth--;
57
+ if (depth === 0) {
58
+ end = i;
59
+ break;
60
+ }
61
+ }
62
+ }
63
+ if (end < 0)
64
+ return null;
65
+ try {
66
+ const spec = JSON.parse(text.slice(braceStart, end + 1));
67
+ let after = end + 1;
68
+ // Surplus closing braces the model added past the object's real end.
69
+ // Bounded so a genuine `}` in following prose is never swallowed wholesale.
70
+ let extraBraces = 0;
71
+ while (text[after] === "}" && extraBraces < 3) {
72
+ after++;
73
+ extraBraces++;
74
+ }
75
+ // Then the closing brackets — 0, 1 or 2.
76
+ if (text[after] === "]")
77
+ after++;
78
+ if (text[after] === "]")
79
+ after++;
80
+ const stripped = (text.slice(0, start) + text.slice(after)).trim();
81
+ return { spec, stripped, start, end: after };
82
+ }
83
+ catch {
84
+ return null;
85
+ }
86
+ }
87
+ //# sourceMappingURL=directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directive.js","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,GAAW;IAEX,MAAM,IAAI,GAAG,KAAK,GAAG,GAAG,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,UAAU,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAChC,+EAA+E;IAC/E,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,GAAG,GAAG,K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AG;YAAE,KAAK,EAAE,CAAC;QACjC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG;YAAE,KAAK,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACnE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
package/dist/dom.d.ts ADDED
@@ -0,0 +1,83 @@
1
+ /** One decoded SSE frame. Lives here because `parseLine` produces it and
2
+ * nothing upstream of the parser has an opinion about its shape. */
3
+ export interface StreamFrame {
4
+ type?: string;
5
+ text?: string;
6
+ d?: string;
7
+ threadId?: string;
8
+ message?: string;
9
+ /** render_chart widget frame (analytics lane): spec = model args, rows = data. */
10
+ spec?: {
11
+ title?: string;
12
+ chartType?: string;
13
+ };
14
+ rows?: unknown;
15
+ /** Optional prior-period rows for the same chart (comparison overlay). */
16
+ comparisonRows?: unknown;
17
+ /** question frame — the assistant asking the human to DECIDE (see WsQuestion). */
18
+ questionId?: string;
19
+ prompt?: string;
20
+ context?: string;
21
+ options?: Array<{
22
+ id: string;
23
+ label: string;
24
+ description?: string;
25
+ }>;
26
+ multi?: boolean;
27
+ critical?: boolean;
28
+ /** activity frame — a live agent process step (running → ok/error). */
29
+ callId?: string;
30
+ name?: string;
31
+ label?: string;
32
+ status?: string;
33
+ /** tool_proposal frame — a confirm-gated write tool's args. */
34
+ args?: unknown;
35
+ /** tool_proposal frame — the AiArtifact the runner persisted for a
36
+ * dashboard/template write, which is the ONLY handle its REST apply takes.
37
+ * The runner has always emitted this; nothing here read it, so
38
+ * `apply_dashboard` and `save_template` rendered a confirm card whose Apply
39
+ * could only reach `throw new Error("Unsupported action")`. */
40
+ artifactId?: string;
41
+ /** usage frame — per-turn token counts (drives the session meter). */
42
+ inputTokens?: number;
43
+ outputTokens?: number;
44
+ /** quota frame — the free visitor allowance snapshot. */
45
+ granted?: number;
46
+ used?: number;
47
+ remaining?: number;
48
+ exhausted?: boolean;
49
+ /** meta frame — staff-only "model" chip: which model/agent runs the turn. */
50
+ isStaff?: boolean;
51
+ modelLabel?: string;
52
+ /** done frame — the persisted id of the turn's final assistant message, and
53
+ * the model that wrote it. Absent when the turn persisted nothing. */
54
+ messageId?: string;
55
+ model?: string;
56
+ }
57
+ /** Parse one stream line — tolerates `data: ` SSE prefix and bare NDJSON. */
58
+ export declare function parseLine(line: string): StreamFrame | null;
59
+ /** Chip glyph per attachment kind — a clip showing the document icon would read
60
+ * as "we did not understand your file". */
61
+ export declare function attIcon(kind: string): string;
62
+ export declare function el(tag: string, cls: string): HTMLElement;
63
+ /** Coarse "when" bucket for grouping past conversations (Today / Yesterday / …). */
64
+ /** Relative-time group for a timestamp — returns a WIDGET_LABELS key so the
65
+ * caller resolves the localized separator text via L(). */
66
+ export declare function relBucket(iso: string): "bucketToday" | "bucketYesterday" | "bucketWeek" | "bucketMonth" | "bucketOlder";
67
+ /** Short relative label, e.g. "3h ago", "2w ago" — falls back to a date. */
68
+ export declare function relTime(iso: string): string;
69
+ /** Hide raw markdown control marks from a streamed chunk so the user reads clean
70
+ * text WHILE the bot types (the real markdown renders once at the end). Light +
71
+ * per-chunk — it only needs to look clean for the moment it streams. */
72
+ export declare function maskMarkdown(s: string): string;
73
+ /** Escape text for the few places we build innerHTML (nav button label). */
74
+ export declare function escapeHtml(s: string): string;
75
+ /** Wrap a bare HTML fragment in a minimal document so a preview always renders
76
+ * sanely; a full document is used as-is. */
77
+ export declare function wrapPreviewHtml(html: string): string;
78
+ export declare function addMsg(log: HTMLElement, role: "user" | "assistant", text: string, attachments?: {
79
+ kind: string;
80
+ filename: string;
81
+ contentType: string;
82
+ }[]): HTMLElement;
83
+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AAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EAAE,GACtE,WAAW,CAkBb"}
package/dist/dom.js ADDED
@@ -0,0 +1,146 @@
1
+ /**
2
+ * DOM construction and the small formatters around it.
3
+ *
4
+ * These nine helpers sat at the bottom of index.ts, below the 6,143-line
5
+ * `createAiChatWidget` closure and outside it — module-level all along, and
6
+ * used from inside it 240+ times (`el` alone has 215 call sites). Being outside
7
+ * the closure is what makes them the one seam in #320 that separates without a
8
+ * design decision: they capture nothing, so moving them is a move and not a
9
+ * refactor.
10
+ *
11
+ * Nothing here may reach back into the widget. If one of these ever needs
12
+ * widget state, it belongs in the closure or behind an explicit parameter — a
13
+ * helper that quietly grows a dependency on its caller is how the file got to
14
+ * 7,000 lines in the first place.
15
+ */
16
+ import { PREFIX } from "./prefix.js";
17
+ /** Parse one stream line — tolerates `data: ` SSE prefix and bare NDJSON. */
18
+ export function parseLine(line) {
19
+ if (!line)
20
+ return null;
21
+ let json = line;
22
+ if (json.startsWith("data:"))
23
+ json = json.slice(5).trim();
24
+ if (!json || json === "[DONE]")
25
+ return null;
26
+ try {
27
+ return JSON.parse(json);
28
+ }
29
+ catch {
30
+ return null;
31
+ }
32
+ }
33
+ /** Chip glyph per attachment kind — a clip showing the document icon would read
34
+ * as "we did not understand your file". */
35
+ export function attIcon(kind) {
36
+ if (kind === "image")
37
+ return "🖼";
38
+ if (kind === "video")
39
+ return "🎬";
40
+ if (kind === "audio")
41
+ return "🎵";
42
+ return "📄";
43
+ }
44
+ export function el(tag, cls) {
45
+ const node = document.createElement(tag);
46
+ node.className = cls;
47
+ // Every button gets the focus base HERE rather than at its 40 call sites
48
+ // (#308). Enumerating the call sites is the wrong shape — the list falls
49
+ // behind the code the first time someone adds a control, which is exactly how
50
+ // the widget ended up with forty buttons and no designed focus state. A
51
+ // button created after this change is covered without anyone remembering.
52
+ if (tag === "button")
53
+ node.classList.add(`${PREFIX}-btn`);
54
+ return node;
55
+ }
56
+ /** Coarse "when" bucket for grouping past conversations (Today / Yesterday / …). */
57
+ /** Relative-time group for a timestamp — returns a WIDGET_LABELS key so the
58
+ * caller resolves the localized separator text via L(). */
59
+ export function relBucket(iso) {
60
+ const d = new Date(iso);
61
+ if (isNaN(d.getTime()))
62
+ return "bucketOlder";
63
+ const now = new Date();
64
+ const startToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
65
+ const day = 86400000;
66
+ const t = d.getTime();
67
+ if (t >= startToday)
68
+ return "bucketToday";
69
+ if (t >= startToday - day)
70
+ return "bucketYesterday";
71
+ if (t >= startToday - 6 * day)
72
+ return "bucketWeek";
73
+ if (t >= startToday - 29 * day)
74
+ return "bucketMonth";
75
+ return "bucketOlder";
76
+ }
77
+ /** Short relative label, e.g. "3h ago", "2w ago" — falls back to a date. */
78
+ export function relTime(iso) {
79
+ const d = new Date(iso);
80
+ if (isNaN(d.getTime()))
81
+ return "";
82
+ const diff = Date.now() - d.getTime();
83
+ const min = 60000;
84
+ const hr = 3600000;
85
+ const day = 86400000;
86
+ const wk = 7 * day;
87
+ if (diff < hr)
88
+ return `${Math.max(1, Math.floor(diff / min))}m ago`;
89
+ if (diff < day)
90
+ return `${Math.floor(diff / hr)}h ago`;
91
+ if (diff < wk)
92
+ return `${Math.floor(diff / day)}d ago`;
93
+ if (diff < 30 * day)
94
+ return `${Math.floor(diff / wk)}w ago`;
95
+ return d.toLocaleDateString();
96
+ }
97
+ /** Hide raw markdown control marks from a streamed chunk so the user reads clean
98
+ * text WHILE the bot types (the real markdown renders once at the end). Light +
99
+ * per-chunk — it only needs to look clean for the moment it streams. */
100
+ export function maskMarkdown(s) {
101
+ return s
102
+ .replace(/`+/g, "") // code ticks
103
+ .replace(/[*~]/g, "") // bold / italic / strike markers
104
+ .replace(/^#{1,6}\s*/gm, "") // heading hashes
105
+ .replace(/^\s{0,3}>\s?/gm, "") // blockquote
106
+ .replace(/\|/g, " "); // table pipes
107
+ }
108
+ /** Escape text for the few places we build innerHTML (nav button label). */
109
+ export function escapeHtml(s) {
110
+ return s.replace(/[&<>"']/g, (c) => ({
111
+ "&": "&amp;",
112
+ "<": "&lt;",
113
+ ">": "&gt;",
114
+ '"': "&quot;",
115
+ "'": "&#39;",
116
+ })[c]);
117
+ }
118
+ /** Wrap a bare HTML fragment in a minimal document so a preview always renders
119
+ * sanely; a full document is used as-is. */
120
+ export function wrapPreviewHtml(html) {
121
+ const s = (html ?? "").trim();
122
+ if (/<!doctype|<html[\s>]/i.test(s))
123
+ return s;
124
+ return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><style>*{box-sizing:border-box}body{margin:0;padding:16px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;color:#0f172a}</style></head><body>${s}</body></html>`;
125
+ }
126
+ export function addMsg(log, role, text, attachments) {
127
+ // Attachment chips render as their own row above the text bubble so a
128
+ // file-only turn (no text) still shows what the user sent.
129
+ if (attachments && attachments.length) {
130
+ const chips = el("div", `${PREFIX}-atts ${PREFIX}-${role}`);
131
+ for (const a of attachments) {
132
+ const chip = el("span", `${PREFIX}-att`);
133
+ chip.title = `${a.filename} (${a.contentType})`;
134
+ chip.textContent = `${attIcon(a.kind)} ${a.filename}`;
135
+ chips.appendChild(chip);
136
+ }
137
+ log.appendChild(chips);
138
+ }
139
+ const msg = el("div", `${PREFIX}-msg ${PREFIX}-${role}`);
140
+ msg.textContent = text;
141
+ if (!text && attachments && attachments.length)
142
+ msg.style.display = "none";
143
+ log.appendChild(msg);
144
+ return msg;
145
+ }
146
+ //# sourceMappingURL=dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAoDlC,6EAA6E;AAC7E,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,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AC,gBAAgB,CAAC;AAC1T,CAAC;AAED,MAAM,UAAU,MAAM,CACpB,GAAgB,EAChB,IAA0B,EAC1B,IAAY,EACZ,WAAuE;IAEvE,sEAAsE;IACtE,2DAA2D;IAC3D,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,MAAM,SAAS,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC;QAC5D,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC;YACzC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,WAAW,GAAG,CAAC;YAChD,IAAI,CAAC,WAAW,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;YACtD,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,MAAM,QAAQ,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC;IACzD,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,CAAC,IAAI,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM;QAAE,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IAC3E,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACrB,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,192 @@
1
+ /**
2
+ * Shared host protocol for Copilot — the ONE definition of the page context the
3
+ * assistant receives and the in-app actions it may take, reused by every
4
+ * surface (org, admin, marketing, onboarding). Keeping this in one place means
5
+ * adding a surface is a few lines, and the action allow-list can't drift between
6
+ * apps.
7
+ *
8
+ * SECURITY: the AI only ever NAMES an action; the host owns the name→effect
9
+ * mapping below. The model never receives a raw URL or endpoint.
10
+ */
11
+ /** Which product surface the user is on. */
12
+ export type AppSurface = "org" | "admin" | "marketing" | "onboarding";
13
+ /**
14
+ * A structured descriptor of ONE page/route — the "page manifest". It lives next
15
+ * to the app's routes (one source of truth) and teaches Copilot what a page IS:
16
+ * its purpose, the sections on it, and the actions available there. Feeding
17
+ * these into the turn context turns Copilot from "knows the route name" into a
18
+ * page-structure-aware UI assistant.
19
+ */
20
+ export interface PageManifestEntry {
21
+ /** Language-/account-neutral path the model uses to navigate (e.g. "/network",
22
+ * or an org suffix like "/assets"). */
23
+ path: string;
24
+ /** Human title shown to the user / used by the model. */
25
+ title: string;
26
+ /** One-line "what this page is for". */
27
+ purpose: string;
28
+ /** Key sections/areas on the page (so Copilot can describe its structure). */
29
+ sections?: string[];
30
+ /** Allow-listed action name(s) that open/operate this page, when the host
31
+ * prefers a named action over a raw path (e.g. org's "open-dashboards"). */
32
+ action?: string;
33
+ /** A few page-aware shortcut questions surfaced as clickable chips in the
34
+ * assistant widget while the conversation is empty — the smart "where do I
35
+ * start on THIS page" prompts. Clicking one sends it to Copilot. */
36
+ suggestions?: string[];
37
+ }
38
+ /** A compact navigable target the model is offered (derived from the manifest). */
39
+ export interface NavTarget {
40
+ path: string;
41
+ title: string;
42
+ purpose: string;
43
+ /** Named action to use instead of a raw path, when set. */
44
+ action?: string;
45
+ }
46
+ /** Per-turn page context sent to the assistant (merged into the POST as
47
+ * `pageContext` by `getContext`). */
48
+ export interface PageContext {
49
+ app: AppSurface;
50
+ /** Current route/path. */
51
+ path: string;
52
+ /** Last path segment — a coarse "page" name the model can reason about. */
53
+ page: string;
54
+ /** Recent navigation breadcrumb (most-recent last, capped). */
55
+ recentPages: string[];
56
+ /** The current page's manifest descriptor (purpose + sections), when known. */
57
+ pageInfo?: PageManifestEntry;
58
+ /** The catalog of pages Copilot may open (from the manifest) — the single source
59
+ * of truth for navigation, so the prompt never hardcodes a path list. */
60
+ navTargets?: NavTarget[];
61
+ /** On-page controls the Copilot may point at (highlight/scroll-to/focus-field)
62
+ * — scanned from the live DOM via `scanAiTargets()`. Ids the host owns, never
63
+ * selectors. Fed into the turn so the model knows what's on THIS page. */
64
+ uiTargets?: Array<{
65
+ id: string;
66
+ label: string;
67
+ }>;
68
+ }
69
+ /**
70
+ * Find the manifest entry that best describes the current path — the entry
71
+ * whose `path` is the longest suffix of the (normalized) current path.
72
+ *
73
+ * A segment written as `:name` matches ANY one segment, so a detail page can
74
+ * be declared once ("/reports/:reportId") instead of being undescribable.
75
+ * Without this a concrete `/reports/<uuid>` matched nothing at all — not even
76
+ * the list page above it, since the uuid is a further segment and the
77
+ * comparison was a plain suffix test — so the assistant silently lost all
78
+ * knowledge of which page the user was standing on.
79
+ *
80
+ * Matching is done per SEGMENT rather than by string, because a suffix test
81
+ * cannot tell a parameter from a literal. The longest match still wins, which
82
+ * keeps a specific entry ahead of a general one.
83
+ */
84
+ export declare function matchManifest(path: string, manifest: PageManifestEntry[]): PageManifestEntry | undefined;
85
+ /**
86
+ * Is this AI-supplied path one of the pages the manifest actually DECLARES?
87
+ *
88
+ * The manifest is the whole security surface for navigation, and until now it
89
+ * was only ever advice: it went into the prompt as "Pages you can open (use
90
+ * ONLY these to navigate)" and nothing checked the answer. The only real gate
91
+ * was a shape test — starts with one `/`, not `//` or `/\` — which every
92
+ * cross-tenant path also passes. `/accounts/<someone-else>/settings` is a
93
+ * root-relative in-app route by that definition, and `orgPath` returns an
94
+ * already-`/accounts/`-prefixed path untouched, so a model that emitted one got
95
+ * it loaded into the deliberately un-sandboxed, same-origin advanced frame.
96
+ *
97
+ * Matched from the START, per segment, unlike `matchManifest` — which matches a
98
+ * SUFFIX because it is handed a full SPA route and has to find the entry that
99
+ * describes it. Here the input is the account-relative path the model wrote, so
100
+ * the manifest's namespace has to be its PREFIX or the check is no gate at all:
101
+ * a suffix test admits `/accounts/<someone-else>/dashboards` on the strength of
102
+ * the `/dashboards` entry. Extra trailing segments ARE allowed — that is how a
103
+ * detail page under a declared list ("/reports/<uuid>") stays reachable — and
104
+ * `:param` segments match any one segment, as in the manifest itself.
105
+ *
106
+ * DECODE FIRST, THEN VALIDATE. The first cut of this refused a literal `..`
107
+ * segment by comparing the raw spelling, which is a blocklist — and a blocklist
108
+ * of shapes is exactly what produced the hole above. `%2e%2e`, `%2E%2E`, `.%2e`
109
+ * and `%252e%252e` all survive a literal comparison and all mean `..` by the
110
+ * time the URL is parsed, so `/reports/%2e%2e/%2e%2e/%2e%2e/accounts/<them>/x`
111
+ * walked straight through it and into the frame. `navPathSegments` resolves the
112
+ * path to what the browser will actually see — percent-decoded to a fixed
113
+ * point, NFKC-folded, backslashes and protocol-relative forms refused — and
114
+ * only then is each segment matched against the manifest.
115
+ *
116
+ * A dot segment is refused rather than resolved: the host prefixes the account
117
+ * AFTER this runs, so resolving here would judge a different path than the one
118
+ * the browser resolves, and no real route contains one.
119
+ *
120
+ * NO MANIFEST MEANS NO NAVIGATION. A host that declares no pages has declared
121
+ * nothing the model may open, and falling back to "any root-relative path" here
122
+ * would restore exactly the hole this closes.
123
+ */
124
+ export declare function isKnownNavTarget(path: unknown, targets: readonly {
125
+ path?: string;
126
+ }[] | undefined | null): path is string;
127
+ /** Build a standard PageContext from a path (derives `page`, caps the trail).
128
+ * Pass the app's page `manifest` to also attach the current page's descriptor
129
+ * and the navigable-page catalog. */
130
+ export declare function makePageContext(app: AppSurface, path: string, recentPages?: string[], manifest?: PageManifestEntry[]): PageContext;
131
+ /**
132
+ * Account-relative path each named standard action opens. Single source of truth
133
+ * shared by `createHostActions` (which navigates the parent app there) and the
134
+ * widget's advanced view (which navigates the iframe there via `resolveActionPath`),
135
+ * so the two can't drift.
136
+ */
137
+ export declare const STANDARD_ACTION_PATHS: Record<string, string>;
138
+ /**
139
+ * Is this action PURE NAVIGATION — moving the user to a page and nothing else?
140
+ *
141
+ * The auto-navigate option promises exactly this and nothing more. It used to
142
+ * decide by asking whether the model had attached a `confirm` to its own action,
143
+ * which put the safety decision in the model's hands: an action it emitted
144
+ * without one ran instantly and unattended — and a confirm-less action can
145
+ * spend metered credit, so "auto-navigate" could buy things. Navigation is a
146
+ * closed set — enumerate it, and let everything else wait for the user to
147
+ * press the button.
148
+ */
149
+ export declare function isNavigationAction(name: string): boolean;
150
+ export type HostActionHandler = (data: Record<string, string>) => Promise<string | void> | string | void;
151
+ export interface HostActionsConfig {
152
+ /** Account scope for the `/accounts/:id/...` standard routes (org/admin). */
153
+ accountId?: string;
154
+ /** The host's router push (in-app SPA navigation). */
155
+ navigate: (path: string) => void;
156
+ /** Point a MOUNTED asset library at a folder/asset. Supplied by the host as
157
+ * `showAssetsAt` from @sgiant/assets — the router push alone cannot reach a
158
+ * library that is already on screen. */
159
+ showAssets?: (t: {
160
+ folderId?: string | null;
161
+ assetId?: string | null;
162
+ }) => void;
163
+ /** App-specific actions, merged over the standard set (can override). */
164
+ handlers?: Record<string, HostActionHandler>;
165
+ /**
166
+ * The page manifest this host declares — the SAME catalogue the model is
167
+ * offered as "Pages you can open". A model-authored `navigate` path is
168
+ * checked against it (see `isKnownNavTarget`) before the router is touched,
169
+ * so the list stops being advice and becomes the gate. A host that passes
170
+ * none can navigate nowhere.
171
+ */
172
+ pages?: readonly {
173
+ path?: string;
174
+ }[];
175
+ /**
176
+ * The host's translator, for the CHIP OUTCOMES below.
177
+ *
178
+ * Every visible string the widget itself renders goes through
179
+ * `WIDGET_LABELS`, which is what lets a host translate the chrome. These
180
+ * outcomes were plain English record literals returned straight into the chip
181
+ * text, so a Turkish session read "Opened dashboards" and "Already there" in
182
+ * the middle of a Turkish conversation. Optional so a host that passes none
183
+ * keeps today's English.
184
+ */
185
+ t?: (key: string, defaultValue: string) => string;
186
+ }
187
+ /**
188
+ * Build the `onWidgetAction(name, data)` handler from the standard allow-listed
189
+ * actions + any app-specific handlers. Pass to `createAiChatWidget`.
190
+ */
191
+ export declare function createHostActions(cfg: HostActionsConfig): (action: string, data: Record<string, string>) => Promise<string | void>;
192
+ //# sourceMappingURL=host-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-actions.d.ts","sourceRoot":"","sources":["../src/host-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,4CAA4C;AAC5C,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,WAAW,GAAG,YAAY,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC;4CACwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;iFAC6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;yEAEqE;IACrE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,mFAAmF;AACnF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;sCACsC;AACtC,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,UAAU,CAAC;IAChB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;8EAC0E;IAC1E,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB;;+EAE2E;IAC3E,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,E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