@datalayer/agent-runtimes 1.3.28 → 1.3.30

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 (99) hide show
  1. package/lib/AgentNode.js +14 -33
  2. package/lib/chat/ChatFloating.d.ts +12 -2
  3. package/lib/chat/ChatFloating.js +196 -25
  4. package/lib/chat/assistant/AssistantStage.d.ts +70 -0
  5. package/lib/chat/assistant/AssistantStage.js +192 -0
  6. package/lib/chat/assistant/SpeechBalloon.d.ts +26 -0
  7. package/lib/chat/assistant/SpeechBalloon.js +46 -0
  8. package/lib/chat/assistant/SpriteCharacter.d.ts +26 -0
  9. package/lib/chat/assistant/SpriteCharacter.js +73 -0
  10. package/lib/chat/assistant/characters.d.ts +30 -0
  11. package/lib/chat/assistant/characters.js +41 -0
  12. package/lib/chat/assistant/formats/acs.d.ts +88 -0
  13. package/lib/chat/assistant/formats/acs.js +493 -0
  14. package/lib/chat/assistant/formats/agentCompression.d.ts +5 -0
  15. package/lib/chat/assistant/formats/agentCompression.js +92 -0
  16. package/lib/chat/assistant/formats/blobs.d.ts +6 -0
  17. package/lib/chat/assistant/formats/blobs.js +52 -0
  18. package/lib/chat/assistant/formats/clippy.d.ts +21 -0
  19. package/lib/chat/assistant/formats/clippy.js +167 -0
  20. package/lib/chat/assistant/formats/index.d.ts +13 -0
  21. package/lib/chat/assistant/formats/index.js +15 -0
  22. package/lib/chat/assistant/formats/objectLiteral.d.ts +23 -0
  23. package/lib/chat/assistant/formats/objectLiteral.js +233 -0
  24. package/lib/chat/assistant/formats/stateAnimations.d.ts +16 -0
  25. package/lib/chat/assistant/formats/stateAnimations.js +115 -0
  26. package/lib/chat/assistant/formats/types.d.ts +56 -0
  27. package/lib/chat/assistant/formats/types.js +11 -0
  28. package/lib/chat/assistant/state.d.ts +62 -0
  29. package/lib/chat/assistant/state.js +116 -0
  30. package/lib/chat/base/ChatBase.js +41 -32
  31. package/lib/chat/base/modelChoice.d.ts +13 -0
  32. package/lib/chat/base/modelChoice.js +13 -0
  33. package/lib/chat/header/ChatViewModeToggle.js +6 -3
  34. package/lib/{loop/plugins/chat → chat/presence}/Presence.js +1 -1
  35. package/lib/{loop/plugins/chat → chat/presence}/presenceStatus.d.ts +7 -1
  36. package/lib/{loop/plugins/chat → chat/presence}/presenceStatus.js +18 -0
  37. package/lib/chat/viewModes.d.ts +6 -0
  38. package/lib/chat/viewModes.js +10 -1
  39. package/lib/examples/ChatAssistantExample.d.ts +8 -0
  40. package/lib/examples/ChatAssistantExample.js +59 -0
  41. package/lib/examples/example-selector.js +1 -0
  42. package/lib/examples/main.js +3 -0
  43. package/lib/loop/apps/AppRenderer.d.ts +34 -2
  44. package/lib/loop/apps/AppRenderer.js +96 -29
  45. package/lib/loop/apps/agent.d.ts +15 -0
  46. package/lib/loop/apps/agent.js +42 -0
  47. package/lib/loop/apps/appspec.d.ts +5 -1
  48. package/lib/loop/apps/appspec.js +21 -1
  49. package/lib/loop/apps/checks.js +3 -1
  50. package/lib/loop/apps/index.d.ts +1 -0
  51. package/lib/loop/apps/index.js +1 -0
  52. package/lib/loop/core/index.d.ts +23 -0
  53. package/lib/loop/core/index.js +1 -0
  54. package/lib/loop/embed/AppEmbed.d.ts +42 -0
  55. package/lib/loop/embed/AppEmbed.js +205 -0
  56. package/lib/loop/embed/datalayer-app.d.ts +1 -0
  57. package/lib/loop/embed/datalayer-app.js +16 -0
  58. package/lib/loop/embed/element.d.ts +57 -0
  59. package/lib/loop/embed/element.js +405 -0
  60. package/lib/loop/embed/embedConfig.d.ts +120 -0
  61. package/lib/loop/embed/embedConfig.js +148 -0
  62. package/lib/loop/embed/embedTheme.d.ts +24 -0
  63. package/lib/loop/embed/embedTheme.js +83 -0
  64. package/lib/loop/index.d.ts +6 -2
  65. package/lib/loop/index.js +8 -2
  66. package/lib/loop/plugins/a2ui-surface/InlineSurface.d.ts +21 -3
  67. package/lib/loop/plugins/a2ui-surface/InlineSurface.js +34 -6
  68. package/lib/loop/plugins/agent-capacity/index.d.ts +4 -0
  69. package/lib/loop/plugins/agent-capacity/index.js +3 -1
  70. package/lib/loop/plugins/agents/switchable.d.ts +7 -0
  71. package/lib/loop/plugins/agents/switchable.js +91 -88
  72. package/lib/loop/plugins/app-page/AppPage.d.ts +16 -0
  73. package/lib/loop/plugins/app-page/AppPage.js +53 -0
  74. package/lib/loop/plugins/app-page/appPage.d.ts +180 -0
  75. package/lib/loop/plugins/app-page/appPage.js +443 -0
  76. package/lib/loop/plugins/app-page/index.d.ts +8 -0
  77. package/lib/loop/plugins/app-page/index.js +34 -0
  78. package/lib/loop/plugins/assistant-characters/index.d.ts +30 -0
  79. package/lib/loop/plugins/assistant-characters/index.js +41 -0
  80. package/lib/loop/plugins/chat/ChatView.js +50 -39
  81. package/lib/loop/plugins/chat/index.d.ts +1 -1
  82. package/lib/loop/plugins/page-layout/SplitLayout.d.ts +31 -0
  83. package/lib/loop/plugins/page-layout/SplitLayout.js +129 -0
  84. package/lib/loop/plugins/page-layout/index.d.ts +13 -0
  85. package/lib/loop/plugins/page-layout/index.js +15 -2
  86. package/lib/loop/presets.d.ts +12 -0
  87. package/lib/loop/presets.js +5 -3
  88. package/lib/specs/actions.js +14 -0
  89. package/lib/specs/agents/agents.js +4 -0
  90. package/lib/specs/apps.d.ts +13 -1
  91. package/lib/specs/apps.js +2715 -373
  92. package/lib/specs/appspecSchema.js +21 -3
  93. package/lib/types/agentspecs.d.ts +21 -1
  94. package/lib/types/chat.d.ts +1 -1
  95. package/lib/types/config.d.ts +12 -0
  96. package/package.json +2 -1
  97. package/scripts/codegen/generate_agents.py +50 -2
  98. package/scripts/codegen/generate_apps.py +36 -6
  99. /package/lib/{loop/plugins/chat → chat/presence}/Presence.d.ts +0 -0
@@ -0,0 +1,443 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /** The id of the editor surface an application's page is drawn in. */
6
+ export const APP_PAGE_SURFACE = 'app-page';
7
+ /** The id of the A2UI surface itself, inside it. */
8
+ export const APP_PAGE_SURFACE_ID = 'app';
9
+ const APP = {
10
+ path: '/app',
11
+ meaning: "The application's name.",
12
+ words: 'Its name',
13
+ };
14
+ const STATUS = {
15
+ path: '/status',
16
+ meaning: 'Where its answer stands, in a word: Ready, Thinking, Answering, Answered or Stopped.',
17
+ words: 'Where its answer stands',
18
+ };
19
+ const DRAFT = {
20
+ path: '/draft',
21
+ meaning: 'A message written on the page, which a Send button sends.',
22
+ words: 'A message to send',
23
+ };
24
+ const SEND = {
25
+ name: 'send',
26
+ meaning: 'Send a message to the application: the context’s message, or what is written at /draft.',
27
+ words: 'Send the message',
28
+ context: ['message'],
29
+ asks: { message: 'The message it sends' },
30
+ };
31
+ const STOP = {
32
+ name: 'stop',
33
+ meaning: 'Stop the answer being written.',
34
+ words: 'Stop the answer',
35
+ context: [],
36
+ asks: {},
37
+ };
38
+ /**
39
+ * What each kind publishes to its page and takes from it, by path — the
40
+ * least that is real today, read from the conversation it runs as.
41
+ */
42
+ export const APP_KIND_PATHS = {
43
+ chat: {
44
+ publishes: [
45
+ APP,
46
+ {
47
+ path: '/question',
48
+ meaning: 'The question last asked.',
49
+ words: 'The question last asked',
50
+ },
51
+ {
52
+ path: '/answer',
53
+ meaning: 'Its answer to it, as it is written.',
54
+ words: 'Its answer',
55
+ },
56
+ STATUS,
57
+ ],
58
+ accepts: [DRAFT],
59
+ actions: [
60
+ SEND,
61
+ STOP,
62
+ {
63
+ name: 'new',
64
+ meaning: 'Start the conversation over.',
65
+ words: 'Start over',
66
+ context: [],
67
+ asks: {},
68
+ },
69
+ ],
70
+ inputs: true,
71
+ },
72
+ widget: {
73
+ publishes: [
74
+ APP,
75
+ {
76
+ path: '/output',
77
+ meaning: 'What it gave for the inputs last run, as it is written.',
78
+ words: 'What it gave',
79
+ },
80
+ STATUS,
81
+ ],
82
+ accepts: [],
83
+ actions: [
84
+ {
85
+ name: 'run',
86
+ meaning: 'Run it on its inputs: every value written under /inputs is sent, with the context’s message when there is one.',
87
+ words: 'Run it on its inputs',
88
+ context: ['message'],
89
+ asks: { message: 'What it says before the inputs' },
90
+ },
91
+ STOP,
92
+ ],
93
+ inputs: true,
94
+ },
95
+ worker: {
96
+ publishes: [
97
+ APP,
98
+ {
99
+ path: '/goal',
100
+ meaning: 'What it works toward.',
101
+ words: 'What it works toward',
102
+ },
103
+ {
104
+ path: '/activity',
105
+ meaning: 'What it is doing right now, in a short line, or nothing.',
106
+ words: 'What it is doing now',
107
+ },
108
+ {
109
+ path: '/report',
110
+ meaning: 'What it last said, as it is written.',
111
+ words: 'What it last said',
112
+ },
113
+ STATUS,
114
+ ],
115
+ accepts: [DRAFT],
116
+ actions: [SEND, STOP],
117
+ inputs: false,
118
+ },
119
+ };
120
+ /** Whether a kind runs as its conversation and has its paths here. */
121
+ export const isAppPageKind = (kind) => Object.prototype.hasOwnProperty.call(APP_KIND_PATHS, kind);
122
+ /** The path a setting, an input of the page, is kept at. */
123
+ export const inputPath = (id) => `/inputs/${id}`;
124
+ /**
125
+ * What an application publishes and takes, with its own settings: the kind's
126
+ * list, and for a kind that has inputs each setting at `/inputs/<id>`, both
127
+ * shown and written. Empty lists for a decision, or a kind not known.
128
+ */
129
+ export function appKindPaths(app) {
130
+ if (!isAppPageKind(app.kind)) {
131
+ return { publishes: [], accepts: [], actions: [], inputs: false };
132
+ }
133
+ const kind = APP_KIND_PATHS[app.kind];
134
+ if (!kind.inputs) {
135
+ return kind;
136
+ }
137
+ const inputs = app.interface.settings.map(setting => ({
138
+ path: inputPath(setting.id),
139
+ meaning: `The setting “${setting.label || setting.id}”.`,
140
+ words: setting.label || setting.id,
141
+ }));
142
+ return {
143
+ ...kind,
144
+ publishes: [...kind.publishes, ...inputs],
145
+ accepts: [...kind.accepts, ...inputs],
146
+ };
147
+ }
148
+ /** The components its surface has, or none. */
149
+ const surfaceComponents = (app) => app.interface.surface?.components ?? [];
150
+ /**
151
+ * Whether the workspace draws the application's page: a chat, a widget or a
152
+ * worker whose layout has one (`page`, `split`). A `chat` layout is the
153
+ * conversation alone: a surface composed for it is not drawn, which
154
+ * `surfaceUnshown` says in a sentence.
155
+ */
156
+ export function hasAppPage(app) {
157
+ if (!app.agent || !isAppPageKind(app.kind)) {
158
+ return false;
159
+ }
160
+ return app.interface.layout !== 'chat';
161
+ }
162
+ /**
163
+ * Why a composed surface is not drawn, or `null` when it is (or there is
164
+ * none): the application's layout is `chat`, the conversation alone.
165
+ */
166
+ export function surfaceUnshown(app) {
167
+ if (!app.agent ||
168
+ !isAppPageKind(app.kind) ||
169
+ app.interface.layout !== 'chat' ||
170
+ surfaceComponents(app).length === 0) {
171
+ return null;
172
+ }
173
+ return 'Its page is composed but its layout is chat, the conversation alone: choose page or split to show it.';
174
+ }
175
+ const STATUS_WORDS = {
176
+ idle: 'Ready',
177
+ thinking: 'Thinking',
178
+ streaming: 'Answering',
179
+ done: 'Answered',
180
+ error: 'Stopped',
181
+ };
182
+ /** A setting's first value, as its input holds it. */
183
+ export function initialInput(setting) {
184
+ switch (setting.type) {
185
+ case 'toggle':
186
+ return Boolean(setting.default ?? false);
187
+ case 'select':
188
+ // A ChoicePicker holds a list of the values chosen.
189
+ return setting.default === undefined ? [] : [String(setting.default)];
190
+ case 'slider':
191
+ return Number(setting.default ?? setting.min ?? 0);
192
+ case 'number':
193
+ return setting.max === undefined
194
+ ? String(setting.default ?? '')
195
+ : Number(setting.default ?? setting.min ?? 0);
196
+ default:
197
+ return String(setting.default ?? '');
198
+ }
199
+ }
200
+ /** What the conversation publishes to the page, by path, now. */
201
+ export function appPageData(app, turn) {
202
+ const data = {
203
+ '/app': app.name,
204
+ '/status': STATUS_WORDS[turn.status] ?? '',
205
+ };
206
+ switch (app.kind) {
207
+ case 'chat':
208
+ data['/question'] = turn.user ?? '';
209
+ data['/answer'] = turn.assistant ?? '';
210
+ break;
211
+ case 'widget':
212
+ data['/output'] = turn.assistant ?? '';
213
+ break;
214
+ case 'worker':
215
+ data['/goal'] = app.goal;
216
+ data['/activity'] = turn.activity ?? '';
217
+ data['/report'] = turn.assistant ?? '';
218
+ break;
219
+ default:
220
+ break;
221
+ }
222
+ return data;
223
+ }
224
+ /** The page's data model when it is drawn: what is published, the inputs, the draft. */
225
+ export function appPageInitialData(app) {
226
+ const tree = {};
227
+ for (const [path, value] of Object.entries(appPageData(app, { id: 0, status: 'idle' }))) {
228
+ tree[path.slice(1)] = value;
229
+ }
230
+ const paths = appKindPaths(app);
231
+ if (paths.inputs) {
232
+ tree.inputs = Object.fromEntries(app.interface.settings.map(setting => [
233
+ setting.id,
234
+ initialInput(setting),
235
+ ]));
236
+ }
237
+ if (paths.accepts.some(entry => entry.path === DRAFT.path)) {
238
+ tree.draft = '';
239
+ }
240
+ return tree;
241
+ }
242
+ /** One input in words: `Plan: Team`; nothing for an empty one. */
243
+ function inputWords(label, value) {
244
+ const shown = Array.isArray(value)
245
+ ? value.map(String).join(', ')
246
+ : typeof value === 'boolean'
247
+ ? value
248
+ ? 'yes'
249
+ : 'no'
250
+ : value === undefined || value === null
251
+ ? ''
252
+ : String(value);
253
+ return shown.trim() ? `${label}: ${shown}` : '';
254
+ }
255
+ /**
256
+ * The inputs written on the page, in words, one per line: each setting by
257
+ * its label, then any other value a block wrote under `/inputs` by its id.
258
+ */
259
+ export function inputsInWords(app, inputs) {
260
+ const values = inputs && typeof inputs === 'object'
261
+ ? inputs
262
+ : {};
263
+ const lines = [];
264
+ const seen = new Set();
265
+ for (const setting of app.interface.settings) {
266
+ seen.add(setting.id);
267
+ lines.push(inputWords(setting.label || setting.id, values[setting.id]));
268
+ }
269
+ for (const [id, value] of Object.entries(values)) {
270
+ if (!seen.has(id)) {
271
+ lines.push(inputWords(id, value));
272
+ }
273
+ }
274
+ return lines.filter(Boolean).join('\n');
275
+ }
276
+ /**
277
+ * What a button pressed on the page does.
278
+ *
279
+ * `read` gives what is in the surface's data model at a path; `lastInputs`
280
+ * is the inputs in words as last sent, so that a chat's message carries its
281
+ * settings only when they changed.
282
+ */
283
+ export function appPageAction(app, event, read, lastInputs = '') {
284
+ const paths = appKindPaths(app);
285
+ if (!paths.actions.some(action => action.name === event.name)) {
286
+ const offered = paths.actions.map(action => action.name).join(', ');
287
+ return {
288
+ refused: offered
289
+ ? `“${event.name}” is not something ${app.name} does: it does ${offered}.`
290
+ : `${app.name} handles no button.`,
291
+ };
292
+ }
293
+ const given = event.context?.message;
294
+ const message = typeof given === 'string' ? given.trim() : '';
295
+ const inputs = paths.inputs ? inputsInWords(app, read('/inputs')) : '';
296
+ switch (event.name) {
297
+ case 'stop':
298
+ return { stop: true };
299
+ case 'new':
300
+ return { newChat: true };
301
+ case 'run': {
302
+ const text = [message, inputs].filter(Boolean).join('\n');
303
+ return text
304
+ ? { send: text, inputs, clear: [] }
305
+ : { refused: `${app.name} has no inputs to run on: set one first.` };
306
+ }
307
+ default: {
308
+ const draft = read(DRAFT.path);
309
+ const written = message || (typeof draft === 'string' ? draft.trim() : '');
310
+ if (!written) {
311
+ return { refused: 'Nothing to send: write a message first.' };
312
+ }
313
+ const changed = inputs && inputs !== lastInputs;
314
+ return {
315
+ send: changed ? `${written}\n\n${inputs}` : written,
316
+ inputs,
317
+ clear: message ? [] : [DRAFT.path],
318
+ };
319
+ }
320
+ }
321
+ }
322
+ const text = (id, path, variant) => ({
323
+ id,
324
+ component: 'Text',
325
+ text: { path },
326
+ ...(variant ? { variant } : {}),
327
+ });
328
+ const button = (id, label, name, primary = false) => [
329
+ {
330
+ id,
331
+ component: 'Button',
332
+ child: `${id}-label`,
333
+ ...(primary ? { variant: 'primary' } : {}),
334
+ action: { event: { name } },
335
+ },
336
+ { id: `${id}-label`, component: 'Text', text: label },
337
+ ];
338
+ /** A setting as the input of the catalog that holds its value. */
339
+ function settingInput(setting) {
340
+ const base = {
341
+ id: `input-${setting.id}`,
342
+ label: setting.label || setting.id,
343
+ value: { path: inputPath(setting.id) },
344
+ };
345
+ switch (setting.type) {
346
+ case 'toggle':
347
+ return { ...base, component: 'CheckBox' };
348
+ case 'select':
349
+ return {
350
+ ...base,
351
+ component: 'ChoicePicker',
352
+ options: setting.options.map(option => ({
353
+ label: option,
354
+ value: option,
355
+ })),
356
+ };
357
+ case 'slider':
358
+ return {
359
+ ...base,
360
+ component: 'Slider',
361
+ min: setting.min ?? 0,
362
+ max: setting.max ?? 100,
363
+ };
364
+ case 'number':
365
+ return setting.max === undefined
366
+ ? { ...base, component: 'TextField', variant: 'number' }
367
+ : {
368
+ ...base,
369
+ component: 'Slider',
370
+ min: setting.min ?? 0,
371
+ max: setting.max,
372
+ };
373
+ default:
374
+ return { ...base, component: 'TextField' };
375
+ }
376
+ }
377
+ /**
378
+ * The page drawn when the application has a page layout and no surface
379
+ * composed: what its kind publishes, its settings as inputs, and the
380
+ * buttons its kind handles that the conversation does not already give.
381
+ */
382
+ export function defaultAppSurface(app) {
383
+ const inputs = appKindPaths(app).inputs
384
+ ? app.interface.settings.map(settingInput)
385
+ : [];
386
+ const body = [];
387
+ switch (app.kind) {
388
+ case 'chat':
389
+ body.push(text('question', '/question', 'h3'), text('answer', '/answer'), text('status', '/status', 'caption'), ...inputs);
390
+ break;
391
+ case 'widget':
392
+ body.push(...inputs, { id: 'actions', component: 'Row', children: ['run', 'stop'] }, ...button('run', 'Run', 'run', true), ...button('stop', 'Stop', 'stop'), text('status', '/status', 'caption'), text('output', '/output'));
393
+ break;
394
+ case 'worker':
395
+ body.push(text('goal', '/goal', 'h3'), text('status', '/status', 'caption'), text('activity', '/activity', 'caption'), text('report', '/report'));
396
+ break;
397
+ default:
398
+ break;
399
+ }
400
+ // The root's children: what is not inside a Row or a Button.
401
+ const inner = new Set(body.flatMap(component => [
402
+ ...(Array.isArray(component.children) ? component.children : []),
403
+ component.child,
404
+ ].filter((id) => typeof id === 'string')));
405
+ return [
406
+ {
407
+ id: 'root',
408
+ component: 'Column',
409
+ children: body
410
+ .map(component => component.id)
411
+ .filter(id => !inner.has(id)),
412
+ },
413
+ ...body,
414
+ ];
415
+ }
416
+ /**
417
+ * The A2UI messages that draw the application's page: its surface composed,
418
+ * or the default page of its kind, fed its first data.
419
+ */
420
+ export function appPageMessages(app, catalogId) {
421
+ const composed = surfaceComponents(app);
422
+ return [
423
+ {
424
+ version: 'v0.9',
425
+ createSurface: { surfaceId: APP_PAGE_SURFACE_ID, catalogId },
426
+ },
427
+ {
428
+ version: 'v0.9',
429
+ updateComponents: {
430
+ surfaceId: APP_PAGE_SURFACE_ID,
431
+ components: composed.length > 0 ? composed : defaultAppSurface(app),
432
+ },
433
+ },
434
+ {
435
+ version: 'v0.9',
436
+ updateDataModel: {
437
+ surfaceId: APP_PAGE_SURFACE_ID,
438
+ path: '/',
439
+ value: appPageInitialData(app),
440
+ },
441
+ },
442
+ ];
443
+ }
@@ -0,0 +1,8 @@
1
+ import { type ReactorPlugin } from '@datalayer/reactor';
2
+ import type { AppSpec } from '../../../types/agentspecs';
3
+ export declare const APP_PAGE_PLUGIN_NAME = "@datalayer/loop-plugin-app-page";
4
+ /** The plugin that draws an application's page beside its conversation. */
5
+ export declare function defineAppPagePlugin(app: AppSpec): ReactorPlugin<Record<string, never>, unknown, unknown>;
6
+ export { AppPage, type AppPageProps } from './AppPage';
7
+ export * from './appPage';
8
+ export default defineAppPagePlugin;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { BrowserIcon } from '@primer/octicons-react';
3
+ import { contribution, definePlugin, } from '@datalayer/reactor';
4
+ import { LoopEditorView } from '../../core';
5
+ import { AppPage } from './AppPage';
6
+ import { APP_PAGE_SURFACE } from './appPage';
7
+ export const APP_PAGE_PLUGIN_NAME = '@datalayer/loop-plugin-app-page';
8
+ /** The plugin that draws an application's page beside its conversation. */
9
+ export function defineAppPagePlugin(app) {
10
+ // One component per plugin: the editor keeps it, and the application with it.
11
+ function Page({ workspace }) {
12
+ return _jsx(AppPage, { app: app, workspace: workspace });
13
+ }
14
+ const plugin = definePlugin({
15
+ name: `${APP_PAGE_PLUGIN_NAME}-${app.id}`,
16
+ displayName: `${app.name}: its page`,
17
+ description: `The page of ${app.name}, drawn beside its conversation.`,
18
+ octicon: 'browser',
19
+ emoji: app.emoji || undefined,
20
+ contributes: [
21
+ contribution(LoopEditorView, {
22
+ surfaceId: APP_PAGE_SURFACE,
23
+ title: app.name,
24
+ icon: BrowserIcon,
25
+ order: -10,
26
+ load: async () => ({ default: Page }),
27
+ }, { id: APP_PAGE_SURFACE, order: -10 }),
28
+ ],
29
+ });
30
+ return plugin;
31
+ }
32
+ export { AppPage } from './AppPage';
33
+ export * from './appPage';
34
+ export default defineAppPagePlugin;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Datalayer's own characters for the floating assistant, contributed
3
+ * (LOOP T-24, T-25): the paper clip, the wizard, the cat and the L👀P eyes.
4
+ * Disabled, they leave the catalogue; another plugin may contribute others.
5
+ *
6
+ * @module loop/plugins/assistant-characters
7
+ */
8
+ import { type ReactorPlugin } from '@datalayer/reactor';
9
+ import { type AssistantCharacter } from '../../../chat/assistant/characters';
10
+ import type { AssistantCharacterData } from '../../../chat/assistant/formats/types';
11
+ import { LoopAssistantCharacter, type AssistantCharacterContribution } from '../../core';
12
+ /** What is read of a reactor here: its contributions to the point. */
13
+ type ContributionsReader = {
14
+ getContributions: (point: typeof LoopAssistantCharacter) => ReadonlyArray<{
15
+ value: AssistantCharacterContribution;
16
+ }>;
17
+ };
18
+ export declare const ASSISTANT_CHARACTERS_PLUGIN_NAME = "@datalayer/loop-plugin-assistant-characters";
19
+ export declare const AssistantCharactersPlugin: ReactorPlugin<Record<string, never>, unknown, unknown>;
20
+ /** The characters the enabled plugins contribute, in contribution order. */
21
+ export declare function assistantCharactersOf(reactor: ContributionsReader): {
22
+ id: string;
23
+ character: AssistantCharacter | AssistantCharacterData;
24
+ }[];
25
+ /**
26
+ * The character an application names, from what is contributed; an id no
27
+ * enabled plugin contributes is an error that says which ids there are.
28
+ */
29
+ export declare function assistantCharacterNamed(reactor: ContributionsReader, id: string): AssistantCharacter | AssistantCharacterData;
30
+ export default AssistantCharactersPlugin;
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Datalayer's own characters for the floating assistant, contributed
7
+ * (LOOP T-24, T-25): the paper clip, the wizard, the cat and the L👀P eyes.
8
+ * Disabled, they leave the catalogue; another plugin may contribute others.
9
+ *
10
+ * @module loop/plugins/assistant-characters
11
+ */
12
+ import { contribution, definePlugin, } from '@datalayer/reactor';
13
+ import { ASSISTANT_CHARACTERS, } from '../../../chat/assistant/characters';
14
+ import { LoopAssistantCharacter, } from '../../core';
15
+ export const ASSISTANT_CHARACTERS_PLUGIN_NAME = '@datalayer/loop-plugin-assistant-characters';
16
+ export const AssistantCharactersPlugin = definePlugin({
17
+ name: ASSISTANT_CHARACTERS_PLUGIN_NAME,
18
+ displayName: 'Assistant characters',
19
+ description: "Datalayer's own characters for the floating assistant: a paper clip, a wizard, a cat and the L👀P eyes.",
20
+ octicon: 'paperclip',
21
+ contributes: ASSISTANT_CHARACTERS.map(character => contribution(LoopAssistantCharacter, { id: character.id, character }, { id: character.id })),
22
+ });
23
+ /** The characters the enabled plugins contribute, in contribution order. */
24
+ export function assistantCharactersOf(reactor) {
25
+ return reactor
26
+ .getContributions(LoopAssistantCharacter)
27
+ .map(entry => entry.value);
28
+ }
29
+ /**
30
+ * The character an application names, from what is contributed; an id no
31
+ * enabled plugin contributes is an error that says which ids there are.
32
+ */
33
+ export function assistantCharacterNamed(reactor, id) {
34
+ const all = assistantCharactersOf(reactor);
35
+ const found = all.find(entry => entry.id === id);
36
+ if (!found) {
37
+ throw new Error(`No enabled plugin contributes the assistant character "${id}"; the characters are ${all.map(entry => entry.id).join(', ') || 'none'}.`);
38
+ }
39
+ return found.character;
40
+ }
41
+ export default AssistantCharactersPlugin;