@burdenoff/fe-libs 2026.1004.4 → 2026.1004.6

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 (105) hide show
  1. package/dist/chrome/ContextSwitcher.d.ts.map +1 -1
  2. package/dist/chrome/ContextSwitcher.js +73 -50
  3. package/dist/chrome/GlobalSearch.d.ts.map +1 -1
  4. package/dist/chrome/GlobalSearch.js +76 -72
  5. package/dist/chrome/LanguageSwitcher.d.ts.map +1 -1
  6. package/dist/chrome/LanguageSwitcher.js +61 -40
  7. package/dist/chrome/NotificationCenter.d.ts.map +1 -1
  8. package/dist/chrome/NotificationCenter.js +71 -68
  9. package/dist/chrome/ProfileSwitcher.d.ts.map +1 -1
  10. package/dist/chrome/ProfileSwitcher.js +87 -81
  11. package/dist/chrome/SideNavigation.d.ts.map +1 -1
  12. package/dist/chrome/SideNavigation.js +120 -76
  13. package/dist/shared/assistant/appControls/copy.d.ts +12 -0
  14. package/dist/shared/assistant/appControls/copy.d.ts.map +1 -0
  15. package/dist/shared/assistant/appControls/copy.js +98 -0
  16. package/dist/shared/assistant/appControls/grammar.d.ts +102 -0
  17. package/dist/shared/assistant/appControls/grammar.d.ts.map +1 -0
  18. package/dist/shared/assistant/appControls/grammar.js +236 -0
  19. package/dist/shared/assistant/appControls/languages.d.ts +6 -0
  20. package/dist/shared/assistant/appControls/languages.d.ts.map +1 -0
  21. package/dist/shared/assistant/appControls/languages.js +52 -0
  22. package/dist/shared/assistant/appControls/names.d.ts +22 -0
  23. package/dist/shared/assistant/appControls/names.d.ts.map +1 -0
  24. package/dist/shared/assistant/appControls/names.js +29 -0
  25. package/dist/shared/assistant/appControls/pageAdapters.d.ts +59 -0
  26. package/dist/shared/assistant/appControls/pageAdapters.d.ts.map +1 -0
  27. package/dist/shared/assistant/appControls/pageAdapters.js +87 -0
  28. package/dist/shared/assistant/appControls/plan.d.ts +148 -0
  29. package/dist/shared/assistant/appControls/plan.d.ts.map +1 -0
  30. package/dist/shared/assistant/appControls/plan.js +511 -0
  31. package/dist/shared/assistant/appControls/registry.d.ts +9 -0
  32. package/dist/shared/assistant/appControls/registry.d.ts.map +1 -0
  33. package/dist/shared/assistant/appControls/registry.js +38 -0
  34. package/dist/shared/assistant/appControls/snapshot.d.ts +42 -0
  35. package/dist/shared/assistant/appControls/snapshot.d.ts.map +1 -0
  36. package/dist/shared/assistant/appControls/snapshot.js +40 -0
  37. package/dist/shared/assistant/appControls/text.d.ts +7 -0
  38. package/dist/shared/assistant/appControls/text.d.ts.map +1 -0
  39. package/dist/shared/assistant/appControls/text.js +6 -0
  40. package/dist/shared/assistant/appControls/types.d.ts +183 -0
  41. package/dist/shared/assistant/appControls/types.d.ts.map +1 -0
  42. package/dist/shared/assistant/appControls/types.js +25 -0
  43. package/dist/shared/assistant/appControls/useAssistantControl.d.ts +24 -0
  44. package/dist/shared/assistant/appControls/useAssistantControl.d.ts.map +1 -0
  45. package/dist/shared/assistant/appControls/useAssistantControl.js +13 -0
  46. package/dist/shared/assistant/conversation.d.ts +12 -1
  47. package/dist/shared/assistant/conversation.d.ts.map +1 -1
  48. package/dist/shared/assistant/history/historyMapping.d.ts.map +1 -1
  49. package/dist/shared/assistant/history/historyMapping.js +130 -114
  50. package/dist/shared/assistant/i18nManifest.d.ts +74 -0
  51. package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
  52. package/dist/shared/assistant/i18nManifest.js +86 -12
  53. package/dist/shared/assistant/index.d.ts +16 -0
  54. package/dist/shared/assistant/index.d.ts.map +1 -1
  55. package/dist/shared/assistant/localUiCommandCopy.d.ts +7 -0
  56. package/dist/shared/assistant/localUiCommandCopy.d.ts.map +1 -1
  57. package/dist/shared/assistant/localUiCommandCopy.js +1 -1
  58. package/dist/shared/assistant/localUiCommands.d.ts +16 -0
  59. package/dist/shared/assistant/localUiCommands.d.ts.map +1 -1
  60. package/dist/shared/assistant/localUiCommands.js +92 -84
  61. package/dist/shared/assistant/store.d.ts +10 -0
  62. package/dist/shared/assistant/store.d.ts.map +1 -1
  63. package/dist/shared/assistant/store.js +52 -44
  64. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts.map +1 -1
  65. package/dist/shared/assistant/ui/AIAssistantPanel.js +57 -49
  66. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  67. package/dist/shared/assistant/ui/AssistantChatArea.js +1085 -1016
  68. package/dist/shared/assistant/ui/AssistantControlConfirmDialog.d.ts +38 -0
  69. package/dist/shared/assistant/ui/AssistantControlConfirmDialog.d.ts.map +1 -0
  70. package/dist/shared/assistant/ui/AssistantControlConfirmDialog.js +65 -0
  71. package/dist/shared/assistant/ui/AssistantMoreMenu.d.ts.map +1 -1
  72. package/dist/shared/assistant/ui/AssistantMoreMenu.js +58 -56
  73. package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
  74. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +106 -105
  75. package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.d.ts +20 -0
  76. package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.d.ts.map +1 -0
  77. package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.js +39 -0
  78. package/dist/shared/assistant/ui/controlConfirmDialog.d.ts +30 -0
  79. package/dist/shared/assistant/ui/controlConfirmDialog.d.ts.map +1 -0
  80. package/dist/shared/assistant/ui/controlConfirmDialog.js +46 -0
  81. package/dist/shared/assistant/ui/useVoiceSession.d.ts +35 -2
  82. package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
  83. package/dist/shared/assistant/ui/useVoiceSession.js +232 -171
  84. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +15 -1
  85. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
  86. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +173 -150
  87. package/dist/shared/assistant/voice/handsFree.d.ts +160 -0
  88. package/dist/shared/assistant/voice/handsFree.d.ts.map +1 -0
  89. package/dist/shared/assistant/voice/handsFree.js +104 -0
  90. package/dist/shared/assistant/voice/supersededTurns.d.ts +29 -0
  91. package/dist/shared/assistant/voice/supersededTurns.d.ts.map +1 -0
  92. package/dist/shared/assistant/voice/supersededTurns.js +17 -0
  93. package/dist/shared/assistant/voice/useVoiceInput.d.ts +7 -0
  94. package/dist/shared/assistant/voice/useVoiceInput.d.ts.map +1 -1
  95. package/dist/shared/assistant/voice/useVoiceInput.js +13 -10
  96. package/dist/shared/assistant/voice/voiceSession.d.ts +64 -20
  97. package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
  98. package/dist/shared/assistant/voice/voiceSession.js +120 -67
  99. package/dist/shared/components/KeyboardHelpDialogWrapper.d.ts.map +1 -1
  100. package/dist/shared/components/KeyboardHelpDialogWrapper.js +11 -9
  101. package/dist/shared/providers/shell/GlobalUiProvider.d.ts +2 -0
  102. package/dist/shared/providers/shell/GlobalUiProvider.d.ts.map +1 -1
  103. package/dist/shared/providers/shell/GlobalUiProvider.js +4 -1
  104. package/dist/shared-assistant.js +219 -203
  105. package/package.json +1 -1
@@ -0,0 +1,511 @@
1
+ import { getAssistantControl as e } from "./registry.js";
2
+ import { uiLanguageEnglishName as t } from "./languages.js";
3
+ import { resolveByLabel as n } from "./names.js";
4
+ //#region src/shared/assistant/appControls/plan.ts
5
+ var r = new Set([
6
+ "assistant.history",
7
+ "assistant.preview",
8
+ "assistant.conversation.new"
9
+ ]), i = (e, t) => ({
10
+ reply: e,
11
+ outcome: t
12
+ });
13
+ function a(e) {
14
+ try {
15
+ return e();
16
+ } catch {
17
+ return { status: "failed" };
18
+ }
19
+ }
20
+ var o = (e, t) => e.status === "failed" ? i({ code: "failed" }, "failed") : i(t(e.status === "already"), e.status);
21
+ function s(e, t, n) {
22
+ if (n.voiceLive && r.has(e)) return "voice-session";
23
+ try {
24
+ return t.blockedBy?.() ?? null;
25
+ } catch {
26
+ return "permission";
27
+ }
28
+ }
29
+ var c = (e, t) => ({
30
+ kind: "reply",
31
+ control: e,
32
+ run: i({
33
+ code: "blocked",
34
+ reason: t
35
+ }, "blocked")
36
+ });
37
+ function l(t, n) {
38
+ let { control: r, what: i } = t, l = e(r);
39
+ if (!l) return null;
40
+ let u = s(r, l, n);
41
+ return u ? c(r, u) : {
42
+ kind: "run",
43
+ control: r,
44
+ run: () => o(a(() => l.run()), () => ({
45
+ code: "opened",
46
+ what: i
47
+ }))
48
+ };
49
+ }
50
+ var u = (e) => e.map((e) => e.label);
51
+ function d(t, r) {
52
+ let l = e("page");
53
+ if (!l) return null;
54
+ let d = s("page", l, r);
55
+ if (d) return c("page", d);
56
+ let m = l.page, h = (e) => ({
57
+ kind: "reply",
58
+ control: "page",
59
+ run: e
60
+ }), g = (e) => ({
61
+ kind: "run",
62
+ control: "page",
63
+ run: e
64
+ });
65
+ switch (t.control) {
66
+ case "page.tab": {
67
+ let e = l.tabs;
68
+ if (!e) return null;
69
+ let r = e.items(), s = n(t.name, r);
70
+ if (s.kind === "none") return h(i({
71
+ code: "not-found",
72
+ what: "tab",
73
+ page: m,
74
+ name: t.name,
75
+ options: u(r)
76
+ }, "not-found"));
77
+ if (s.kind === "many") return h(i({
78
+ code: "ambiguous",
79
+ what: "tab",
80
+ name: t.name,
81
+ options: u(s.items)
82
+ }, "ambiguous"));
83
+ let c = s.item;
84
+ return e.current?.() === c.id ? h(i({
85
+ code: "tab",
86
+ name: c.label,
87
+ already: !0
88
+ }, "already")) : g(() => o(a(() => e.select(c.id)), (e) => ({
89
+ code: "tab",
90
+ name: c.label,
91
+ already: e
92
+ })));
93
+ }
94
+ case "page.filter": return p(l, t.filter, t.option, h, g);
95
+ case "page.filter.clear": {
96
+ let e = l.filters;
97
+ if (!e) return null;
98
+ let r = e.items();
99
+ if (t.filter === null) return g(() => o(a(() => {
100
+ if (e.clearAll) return e.clearAll();
101
+ for (let t of r) e.set(t.id, null);
102
+ return { status: "done" };
103
+ }), () => ({
104
+ code: "filter-cleared",
105
+ filter: null
106
+ })));
107
+ let s = n(t.filter, r);
108
+ if (s.kind === "none") return h(i({
109
+ code: "not-found",
110
+ what: "filter",
111
+ page: m,
112
+ name: t.filter,
113
+ options: u(r)
114
+ }, "not-found"));
115
+ if (s.kind === "many") return h(i({
116
+ code: "ambiguous",
117
+ what: "filter",
118
+ name: t.filter,
119
+ options: u(s.items)
120
+ }, "ambiguous"));
121
+ let c = s.item;
122
+ return g(() => o(a(() => e.set(c.id, null)), () => ({
123
+ code: "filter-cleared",
124
+ filter: c.label
125
+ })));
126
+ }
127
+ case "page.sort": {
128
+ let e = l.sort;
129
+ if (!e) return null;
130
+ let n = e.fields(), r = f(m, t.field, n, e.current?.() ?? null);
131
+ if ("reply" in r) return h(r.reply);
132
+ let { id: s, label: c } = r, u = t.direction ?? "asc", d = e.current?.() ?? null;
133
+ return d && d.field === s && d.direction === u ? h(i({
134
+ code: "sorted",
135
+ page: m,
136
+ field: c,
137
+ direction: u,
138
+ already: !0
139
+ }, "already")) : g(() => o(a(() => e.set(s, u)), () => ({
140
+ code: "sorted",
141
+ page: m,
142
+ field: c,
143
+ direction: u,
144
+ already: !1
145
+ })));
146
+ }
147
+ case "page.search": {
148
+ let e = l.search;
149
+ return e ? g(() => o(a(() => e.set(t.query)), () => ({
150
+ code: "searched",
151
+ page: m,
152
+ query: t.query
153
+ }))) : null;
154
+ }
155
+ case "page.search.clear": {
156
+ let e = l.search;
157
+ return e ? g(() => o(a(() => e.clear ? e.clear() : e.set("")), () => ({ code: "search-cleared" }))) : null;
158
+ }
159
+ case "page.open": {
160
+ let e = l.openers;
161
+ if (!e) return null;
162
+ let r = e.items(), s = n(t.name, r);
163
+ if (s.kind === "none") return h(i({
164
+ code: "not-found",
165
+ what: "form",
166
+ page: m,
167
+ name: t.name,
168
+ options: u(r)
169
+ }, "not-found"));
170
+ if (s.kind === "many") return h(i({
171
+ code: "ambiguous",
172
+ what: "form",
173
+ name: t.name,
174
+ options: u(s.items)
175
+ }, "ambiguous"));
176
+ let c = s.item;
177
+ return g(() => o(a(() => e.open(c.id)), () => ({
178
+ code: "form-opened",
179
+ name: c.label
180
+ })));
181
+ }
182
+ default: return null;
183
+ }
184
+ }
185
+ function f(e, t, r, a) {
186
+ if (t === null) return (a ? r.find((e) => e.id === a.field) : void 0) ?? { reply: i({ code: "sort-needs-field" }, "not-found") };
187
+ let o = n(t, r);
188
+ return o.kind === "one" ? o.item : { reply: o.kind === "none" ? i({
189
+ code: "not-found",
190
+ what: "sort",
191
+ page: e,
192
+ name: t,
193
+ options: u(r)
194
+ }, "not-found") : i({
195
+ code: "ambiguous",
196
+ what: "column",
197
+ name: t,
198
+ options: u(o.items)
199
+ }, "ambiguous") };
200
+ }
201
+ function p(e, t, r, s, c) {
202
+ let l = e.filters;
203
+ if (!l) return null;
204
+ let d = e.page, f = l.items(), p = [];
205
+ if (t !== null) {
206
+ let e = n(t, f);
207
+ if (e.kind === "none") return s(i({
208
+ code: "not-found",
209
+ what: "filter",
210
+ page: d,
211
+ name: t,
212
+ options: u(f)
213
+ }, "not-found"));
214
+ if (e.kind === "many") return s(i({
215
+ code: "ambiguous",
216
+ what: "filter",
217
+ name: t,
218
+ options: u(e.items)
219
+ }, "ambiguous"));
220
+ let a = e.item, o = a.options(), c = n(r, o, { sayingMayContainLabel: !0 });
221
+ if (c.kind === "none") return s(i({
222
+ code: "not-found",
223
+ what: "filter-option",
224
+ page: d,
225
+ name: r,
226
+ options: u(o),
227
+ filter: a.label
228
+ }, "not-found"));
229
+ if (c.kind === "many") return s(i({
230
+ code: "ambiguous",
231
+ what: "filter",
232
+ name: r,
233
+ options: u(c.items)
234
+ }, "ambiguous"));
235
+ p.push({
236
+ filter: a,
237
+ option: c.item
238
+ });
239
+ } else {
240
+ for (let e of f) {
241
+ let t = n(r, e.options(), { sayingMayContainLabel: !0 });
242
+ if (t.kind === "one") p.push({
243
+ filter: e,
244
+ option: t.item
245
+ });
246
+ else if (t.kind === "many") for (let n of t.items) p.push({
247
+ filter: e,
248
+ option: n
249
+ });
250
+ }
251
+ if (p.length === 0) {
252
+ let e = n(r, f);
253
+ return e.kind === "one" ? s(i({
254
+ code: "filter-choose",
255
+ filter: e.item.label,
256
+ options: u(e.item.options())
257
+ }, "not-found")) : s(i({
258
+ code: "not-found",
259
+ what: "filter",
260
+ page: d,
261
+ name: r,
262
+ options: u(f)
263
+ }, "not-found"));
264
+ }
265
+ if (p.length > 1) return s(i({
266
+ code: "ambiguous",
267
+ what: "filter",
268
+ name: r,
269
+ options: p.map((e) => `${e.filter.label}: ${e.option.label}`)
270
+ }, "ambiguous"));
271
+ }
272
+ let [m] = p;
273
+ if (!m) return null;
274
+ let { filter: h, option: g } = m;
275
+ return h.current?.() === g.value ? s(i({
276
+ code: "filter-set",
277
+ filter: h.label,
278
+ option: g.label,
279
+ already: !0
280
+ }, "already")) : c(() => o(a(() => l.set(h.id, g.value)), (e) => ({
281
+ code: "filter-set",
282
+ filter: h.label,
283
+ option: g.label,
284
+ already: e
285
+ })));
286
+ }
287
+ function m(r, f) {
288
+ switch (r.control) {
289
+ case "header.notifications": return l({
290
+ control: "header.notifications",
291
+ what: "notifications"
292
+ }, f);
293
+ case "header.help": return l({
294
+ control: "header.help",
295
+ what: "help"
296
+ }, f);
297
+ case "header.context": return l({
298
+ control: "header.context",
299
+ what: "context"
300
+ }, f);
301
+ case "assistant.history": return l({
302
+ control: "assistant.history",
303
+ what: "history"
304
+ }, f);
305
+ case "assistant.transcript": return l({
306
+ control: "assistant.transcript",
307
+ what: "transcript"
308
+ }, f);
309
+ case "assistant.preview": return l({
310
+ control: "assistant.preview",
311
+ what: "preview"
312
+ }, f);
313
+ case "assistant.conversation.new": {
314
+ let t = e("assistant.conversation.new");
315
+ if (!t) return null;
316
+ let n = s("assistant.conversation.new", t, f);
317
+ return n ? c("assistant.conversation.new", n) : {
318
+ kind: "run",
319
+ control: "assistant.conversation.new",
320
+ silent: !0,
321
+ run: () => o(a(() => t.run()), () => ({
322
+ code: "opened",
323
+ what: "conversation"
324
+ }))
325
+ };
326
+ }
327
+ case "header.search": {
328
+ let t = e("header.search");
329
+ if (!t) return null;
330
+ let n = s("header.search", t, f);
331
+ return n ? c("header.search", n) : {
332
+ kind: "run",
333
+ control: "header.search",
334
+ run: () => o(a(() => t.run({ query: r.query })), () => ({
335
+ code: "search-opened",
336
+ query: r.query
337
+ }))
338
+ };
339
+ }
340
+ case "sidebar": {
341
+ let t = e("sidebar");
342
+ if (!t) return null;
343
+ let n = s("sidebar", t, f);
344
+ return n ? c("sidebar", n) : t.collapsed() === r.collapsed ? {
345
+ kind: "reply",
346
+ control: "sidebar",
347
+ run: i({
348
+ code: "sidebar",
349
+ collapsed: r.collapsed,
350
+ already: !0
351
+ }, "already")
352
+ } : {
353
+ kind: "run",
354
+ control: "sidebar",
355
+ run: () => o(a(() => t.setCollapsed(r.collapsed)), (e) => ({
356
+ code: "sidebar",
357
+ collapsed: r.collapsed,
358
+ already: e
359
+ }))
360
+ };
361
+ }
362
+ case "sidebar.entry": {
363
+ let t = e("sidebar");
364
+ if (!t) return null;
365
+ let l = s("sidebar", t, f);
366
+ if (l) return c("sidebar", l);
367
+ let d = t.entries(), p = n(r.name, d);
368
+ if (p.kind === "none") return null;
369
+ if (p.kind === "many") return {
370
+ kind: "reply",
371
+ control: "sidebar",
372
+ run: i({
373
+ code: "ambiguous",
374
+ what: "menu",
375
+ name: r.name,
376
+ options: u(p.items)
377
+ }, "ambiguous")
378
+ };
379
+ let m = p.item;
380
+ return m.expanded === r.expanded ? {
381
+ kind: "reply",
382
+ control: "sidebar",
383
+ run: i({
384
+ code: "sidebar-entry",
385
+ name: m.label,
386
+ expanded: r.expanded,
387
+ already: !0
388
+ }, "already")
389
+ } : {
390
+ kind: "run",
391
+ control: "sidebar",
392
+ run: () => o(a(() => t.setExpanded(m.id, r.expanded)), (e) => ({
393
+ code: "sidebar-entry",
394
+ name: m.label,
395
+ expanded: r.expanded,
396
+ already: e
397
+ }))
398
+ };
399
+ }
400
+ case "language": {
401
+ let n = e("language");
402
+ if (!n) return null;
403
+ let l = s("language", n, f);
404
+ if (l) return c("language", l);
405
+ let u = n.languages().find((e) => e.code.toLowerCase() === r.code);
406
+ return u ? n.current().toLowerCase() === u.code.toLowerCase() ? {
407
+ kind: "reply",
408
+ control: "language",
409
+ run: i({
410
+ code: "language",
411
+ label: u.label,
412
+ already: !0
413
+ }, "already")
414
+ } : {
415
+ kind: "run",
416
+ control: "language",
417
+ run: () => o(a(() => n.set(u.code)), (e) => ({
418
+ code: "language",
419
+ label: u.label,
420
+ already: e
421
+ }))
422
+ } : {
423
+ kind: "reply",
424
+ control: "language",
425
+ run: i({
426
+ code: "language-not-offered",
427
+ label: t(r.code)
428
+ }, "not-found")
429
+ };
430
+ }
431
+ case "header.workspace": {
432
+ let t = e("header.workspace");
433
+ if (!t) return null;
434
+ let l = s("header.workspace", t, f);
435
+ if (l) return c("header.workspace", l);
436
+ let d = t.targets(), p = d.filter((e) => e.current !== !0);
437
+ if (p.length === 0) return {
438
+ kind: "reply",
439
+ control: "header.workspace",
440
+ run: i({ code: "workspace-none" }, "not-found")
441
+ };
442
+ let m = n(r.target, d);
443
+ if (m.kind === "none") return {
444
+ kind: "reply",
445
+ control: "header.workspace",
446
+ run: i({
447
+ code: "not-found",
448
+ what: "workspace",
449
+ page: "",
450
+ name: r.target,
451
+ options: u(p)
452
+ }, "not-found")
453
+ };
454
+ if (m.kind === "many") return {
455
+ kind: "reply",
456
+ control: "header.workspace",
457
+ run: i({
458
+ code: "ambiguous",
459
+ what: "workspace",
460
+ name: r.target,
461
+ options: u(m.items)
462
+ }, "ambiguous")
463
+ };
464
+ let h = m.item;
465
+ return h.current === !0 ? {
466
+ kind: "reply",
467
+ control: "header.workspace",
468
+ run: i({
469
+ code: "workspace-already",
470
+ name: h.label
471
+ }, "already")
472
+ } : {
473
+ kind: "confirm",
474
+ control: "header.workspace",
475
+ prompt: {
476
+ kind: "workspace",
477
+ name: h.label
478
+ },
479
+ ask: i({
480
+ code: "workspace-confirm",
481
+ name: h.label
482
+ }, "confirm"),
483
+ confirmed: () => {
484
+ let t = e("header.workspace"), n = t?.targets().find((e) => e.id === h.id);
485
+ return !t || !n || n.current === !0 || s("header.workspace", t, f) ? i({ code: "failed" }, "failed") : o(a(() => t.switchTo(h.id)), () => ({
486
+ code: "workspace-switched",
487
+ name: h.label
488
+ }));
489
+ }
490
+ };
491
+ }
492
+ case "account.logout": {
493
+ let t = e("account.logout");
494
+ if (!t) return null;
495
+ let n = s("account.logout", t, f);
496
+ return n ? c("account.logout", n) : {
497
+ kind: "confirm",
498
+ control: "account.logout",
499
+ prompt: { kind: "logout" },
500
+ ask: i({ code: "logout-confirm" }, "confirm"),
501
+ confirmed: () => {
502
+ let t = e("account.logout");
503
+ return !t || s("account.logout", t, f) ? i({ code: "failed" }, "failed") : o(a(() => t.run()), () => ({ code: "logout-done" }));
504
+ }
505
+ };
506
+ }
507
+ default: return d(r, f);
508
+ }
509
+ }
510
+ //#endregion
511
+ export { m as planAppControl };
@@ -0,0 +1,9 @@
1
+ import { ControlKey, ControlMap } from './types';
2
+ /** Register `impl` for `key`. Returns the cleanup that removes exactly this entry. */
3
+ export declare function registerAssistantControl<K extends ControlKey>(key: K, impl: ControlMap[K]): () => void;
4
+ /** The handler in force for `key` (the newest registration), or null. */
5
+ export declare function getAssistantControl<K extends ControlKey>(key: K): ControlMap[K] | null;
6
+ export declare function hasAssistantControl(key: ControlKey): boolean;
7
+ /** Test seam: forget every registration. */
8
+ export declare function clearAssistantControls(): void;
9
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/appControls/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA8CtD,sFAAsF;AACtF,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,UAAU,EAC3D,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAClB,MAAM,IAAI,CAQZ;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAGtF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAE5D;AAED,4CAA4C;AAC5C,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
@@ -0,0 +1,38 @@
1
+ //#region src/shared/assistant/appControls/registry.ts
2
+ var e = {
3
+ "header.notifications": [],
4
+ "header.search": [],
5
+ "header.help": [],
6
+ "header.context": [],
7
+ "header.workspace": [],
8
+ "account.logout": [],
9
+ sidebar: [],
10
+ language: [],
11
+ "assistant.history": [],
12
+ "assistant.transcript": [],
13
+ "assistant.preview": [],
14
+ "assistant.conversation.new": [],
15
+ page: []
16
+ };
17
+ function t(t, n) {
18
+ let r = Symbol(t), i = e[t];
19
+ return i.push({
20
+ token: r,
21
+ impl: n
22
+ }), () => {
23
+ let e = i.findIndex((e) => e.token === r);
24
+ e >= 0 && i.splice(e, 1);
25
+ };
26
+ }
27
+ function n(t) {
28
+ let n = e[t];
29
+ return n.length > 0 ? n[n.length - 1]?.impl ?? null : null;
30
+ }
31
+ function r(t) {
32
+ return e[t].length > 0;
33
+ }
34
+ function i() {
35
+ for (let t of Object.keys(e)) e[t].length = 0;
36
+ }
37
+ //#endregion
38
+ export { i as clearAssistantControls, n as getAssistantControl, r as hasAssistantControl, t as registerAssistantControl };
@@ -0,0 +1,42 @@
1
+ import { ControlKey, ControlTarget, SidebarEntry, UiLanguage } from './types';
2
+ /** A page's controls as the grammar needs to see them (labels only, no handlers). */
3
+ export interface PageSnapshot {
4
+ name: string;
5
+ tabs: readonly {
6
+ id: string;
7
+ label: string;
8
+ }[];
9
+ filters: readonly {
10
+ id: string;
11
+ label: string;
12
+ options: readonly {
13
+ value: string;
14
+ label: string;
15
+ }[];
16
+ }[];
17
+ sorts: readonly {
18
+ id: string;
19
+ label: string;
20
+ }[];
21
+ searchable: boolean;
22
+ openers: readonly {
23
+ id: string;
24
+ label: string;
25
+ }[];
26
+ }
27
+ /**
28
+ * What the grammar may know about the controls in force right now: which are
29
+ * registered, and the WORDS the product gave them (tab labels, filter options,
30
+ * languages). Read fresh for every sentence — never cached, because a page
31
+ * mounts and unmounts between two sentences.
32
+ */
33
+ export interface ControlSnapshot {
34
+ registered: Readonly<Record<ControlKey, boolean>>;
35
+ languages: readonly UiLanguage[];
36
+ sidebarEntries: readonly SidebarEntry[];
37
+ workspaces: readonly ControlTarget[];
38
+ page: PageSnapshot | null;
39
+ }
40
+ export declare const EMPTY_CONTROL_SNAPSHOT: ControlSnapshot;
41
+ export declare function readControlSnapshot(): ControlSnapshot;
42
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/appControls/snapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACX,MAAM,SAAS,CAAC;AAGjB,qFAAqF;AACrF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/C,OAAO,EAAE,SAAS;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,SAAS;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KACtD,EAAE,CAAC;IACJ,KAAK,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACnD;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,SAAS,EAAE,SAAS,UAAU,EAAE,CAAC;IACjC,cAAc,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IACrC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,EAAE,eASpC,CAAC;AAWF,wBAAgB,mBAAmB,IAAI,eAAe,CAkCrD"}
@@ -0,0 +1,40 @@
1
+ import { getAssistantControl as e, hasAssistantControl as t } from "./registry.js";
2
+ import { CONTROL_KEYS as n } from "./types.js";
3
+ //#region src/shared/assistant/appControls/snapshot.ts
4
+ var r = {
5
+ registered: Object.fromEntries(n.map((e) => [e, !1])),
6
+ languages: [],
7
+ sidebarEntries: [],
8
+ workspaces: [],
9
+ page: null
10
+ };
11
+ function i(e, t) {
12
+ try {
13
+ return e();
14
+ } catch {
15
+ return t;
16
+ }
17
+ }
18
+ function a() {
19
+ let r = Object.fromEntries(n.map((e) => [e, t(e)])), a = e("language"), o = e("sidebar"), s = e("header.workspace"), c = e("page");
20
+ return {
21
+ registered: r,
22
+ languages: a ? i(() => a.languages(), []) : [],
23
+ sidebarEntries: o ? i(() => o.entries(), []) : [],
24
+ workspaces: s ? i(() => s.targets(), []) : [],
25
+ page: c ? {
26
+ name: c.page,
27
+ tabs: c.tabs ? i(() => c.tabs?.items() ?? [], []) : [],
28
+ filters: c.filters ? i(() => c.filters?.items().map((e) => ({
29
+ id: e.id,
30
+ label: e.label,
31
+ options: e.options()
32
+ })) ?? [], []) : [],
33
+ sorts: c.sort ? i(() => c.sort?.fields() ?? [], []) : [],
34
+ searchable: c.search !== void 0,
35
+ openers: c.openers ? i(() => c.openers?.items() ?? [], []) : []
36
+ } : null
37
+ };
38
+ }
39
+ //#endregion
40
+ export { r as EMPTY_CONTROL_SNAPSHOT, a as readControlSnapshot };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Lower-case, punctuation-free, single-spaced ("let's" → "let s"). The ONE
3
+ * canonical form the command grammars compare in (`localUiCommands.ts` and
4
+ * `appControls/grammar.ts`), so a label and a sentence are judged alike.
5
+ */
6
+ export declare function canonical(text: string): string;
7
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/appControls/text.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ9C"}
@@ -0,0 +1,6 @@
1
+ //#region src/shared/assistant/appControls/text.ts
2
+ function e(e) {
3
+ return e.normalize("NFKC").toLowerCase().replace(/&/g, " and ").replace(/[^\p{L}\p{N}\s]/gu, " ").replace(/\s+/g, " ").trim();
4
+ }
5
+ //#endregion
6
+ export { e as canonical };