adula 2.2.0 → 2.3.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.
- package/README.md +1 -1
- package/build/agent/capabilities.md +2 -3
- package/build/agent/skills/adula-frontend-design/SKILL.md +5 -3
- package/build/commands/adula_assistant_prune.d.ts +10 -0
- package/build/commands/adula_assistant_prune.js +12 -0
- package/build/commands/backup_open.d.ts +16 -0
- package/build/commands/backup_open.js +48 -0
- package/build/commands/backup_restore_test.js +3 -0
- package/build/commands/backup_seal.d.ts +12 -0
- package/build/commands/backup_seal.js +36 -0
- package/build/commands/backup_services.d.ts +3 -1
- package/build/commands/doctor.js +18 -1
- package/build/commands/install.js +6 -0
- package/build/commands/main.d.ts +2 -2
- package/build/commands/main.js +6 -0
- package/build/commands/resource_migration.js +12 -3
- package/build/commands/resource_snapshot.js +18 -4
- package/build/database/migrations/1770000000051_comment_notifications.d.ts +5 -0
- package/build/database/migrations/1770000000051_comment_notifications.js +10 -0
- package/build/database/migrations/1770000000054_cloud_backups.d.ts +5 -0
- package/build/database/migrations/1770000000054_cloud_backups.js +10 -0
- package/build/database/migrations/1770000000055_ai_assistant.d.ts +5 -0
- package/build/database/migrations/1770000000055_ai_assistant.js +10 -0
- package/build/database/migrations/1770000000056_appearance.d.ts +5 -0
- package/build/database/migrations/1770000000056_appearance.js +10 -0
- package/build/index.d.ts +36 -6
- package/build/index.js +18 -3
- package/build/src/admin/controller.js +18 -4
- package/build/src/admin/resource/editor.d.ts +1 -0
- package/build/src/admin/resource/editor.js +26 -4
- package/build/src/admin/resource/export.d.ts +21 -4
- package/build/src/admin/resource/export.js +117 -36
- package/build/src/admin/resource/lifecycle.d.ts +2 -0
- package/build/src/admin/resource/query.d.ts +14 -3
- package/build/src/admin/resource/query.js +98 -11
- package/build/src/admin/resource/read.d.ts +3 -0
- package/build/src/admin/resource/read.js +75 -14
- package/build/src/admin/resource/shared.d.ts +16 -0
- package/build/src/admin/resource/shared.js +47 -4
- package/build/src/admin/resource/write.js +37 -8
- package/build/src/admin/resource_service.d.ts +17 -3
- package/build/src/admin/resource_service.js +16 -2
- package/build/src/admin/resource_tools.d.ts +111 -0
- package/build/src/admin/resource_tools.js +139 -0
- package/build/src/ai/assistant.d.ts +100 -0
- package/build/src/ai/assistant.js +487 -0
- package/build/src/ai/client.d.ts +49 -0
- package/build/src/ai/client.js +85 -0
- package/build/src/ai/prompt.d.ts +23 -0
- package/build/src/ai/prompt.js +83 -0
- package/build/src/ai/settings.d.ts +56 -0
- package/build/src/ai/settings.js +214 -0
- package/build/src/ai/usage.d.ts +16 -0
- package/build/src/ai/usage.js +33 -0
- package/build/src/appearance/appearance.d.ts +134 -0
- package/build/src/appearance/appearance.js +461 -0
- package/build/src/appearance/colors.d.ts +43 -0
- package/build/src/appearance/colors.js +99 -0
- package/build/src/appearance/logo.d.ts +32 -0
- package/build/src/appearance/logo.js +112 -0
- package/build/src/auth/actor_store.d.ts +5 -1
- package/build/src/auth/actor_store.js +8 -4
- package/build/src/backups/archive.d.ts +52 -0
- package/build/src/backups/archive.js +362 -0
- package/build/src/backups/cloud_backups.d.ts +133 -0
- package/build/src/backups/cloud_backups.js +650 -0
- package/build/src/backups/doctor.d.ts +7 -0
- package/build/src/backups/doctor.js +55 -0
- package/build/src/backups/providers.d.ts +81 -0
- package/build/src/backups/providers.js +470 -0
- package/build/src/collaboration/assignments.d.ts +24 -2
- package/build/src/collaboration/assignments.js +88 -32
- package/build/src/collaboration/record_collaboration.d.ts +19 -1
- package/build/src/collaboration/record_collaboration.js +109 -37
- package/build/src/collaboration/shared.d.ts +10 -2
- package/build/src/collaboration/shared.js +14 -1
- package/build/src/commands/capabilities.js +1 -1
- package/build/src/commands/doctor.d.ts +10 -0
- package/build/src/commands/doctor.js +31 -1
- package/build/src/commands/snapshot.d.ts +14 -0
- package/build/src/commands/snapshot.js +23 -0
- package/build/src/core/administrators.js +19 -3
- package/build/src/core/avatar_image.d.ts +33 -0
- package/build/src/core/avatar_image.js +278 -0
- package/build/src/core/mail_settings.d.ts +83 -0
- package/build/src/core/mail_settings.js +274 -0
- package/build/src/core/mail_test.d.ts +16 -0
- package/build/src/core/mail_test.js +81 -6
- package/build/src/core/message_templates.d.ts +8 -0
- package/build/src/core/message_templates.js +12 -3
- package/build/src/core/roles.js +24 -7
- package/build/src/core/saved_views.js +55 -24
- package/build/src/core/settings.d.ts +2 -2
- package/build/src/core/settings.js +15 -4
- package/build/src/core/ui_preferences.d.ts +6 -0
- package/build/src/core/ui_preferences.js +12 -1
- package/build/src/core/user_avatars.d.ts +79 -0
- package/build/src/core/user_avatars.js +186 -0
- package/build/src/core/user_preferences.d.ts +36 -0
- package/build/src/core/user_preferences.js +125 -0
- package/build/src/core/users.d.ts +2 -0
- package/build/src/core/users.js +4 -2
- package/build/src/database/schema.d.ts +46 -0
- package/build/src/database/schema.js +182 -0
- package/build/src/database/schema_diff.d.ts +16 -2
- package/build/src/database/schema_diff.js +40 -7
- package/build/src/integrations/api_client.js +18 -3
- package/build/src/integrations/imports.d.ts +16 -4
- package/build/src/integrations/imports.js +36 -8
- package/build/src/integrations/openapi.js +15 -4
- package/build/src/integrations/outbound.d.ts +43 -0
- package/build/src/integrations/outbound.js +98 -17
- package/build/src/integrations/print.d.ts +2 -1
- package/build/src/integrations/print.js +7 -3
- package/build/src/integrations/print_templates.js +3 -1
- package/build/src/integrations/xlsx.d.ts +41 -0
- package/build/src/integrations/xlsx.js +519 -0
- package/build/src/languages/ar.js +22 -0
- package/build/src/languages/ar_ui.d.ts +143 -14
- package/build/src/languages/ar_ui.js +145 -14
- package/build/src/languages/en.js +22 -0
- package/build/src/languages/en_ui.js +144 -14
- package/build/src/lists/dashboards.d.ts +42 -0
- package/build/src/lists/dashboards.js +49 -0
- package/build/src/mcp/tools.js +9 -104
- package/build/src/resource/define_resource.js +7 -0
- package/build/src/resource/types.d.ts +9 -0
- package/build/src/workflows/delegations.d.ts +15 -1
- package/build/src/workflows/delegations.js +49 -10
- package/build/src/workflows/engine.d.ts +11 -0
- package/build/src/workflows/engine.js +29 -7
- package/package.json +5 -1
|
@@ -42,11 +42,16 @@ export const englishInterfaceMessages = {
|
|
|
42
42
|
'ui.actions.submit': 'Submit document',
|
|
43
43
|
'ui.actions.cancel': 'Cancel document',
|
|
44
44
|
'ui.actions.amend': 'Amend as copy',
|
|
45
|
-
'ui.actions.
|
|
45
|
+
'ui.actions.deleteRecord': 'Delete {record}',
|
|
46
|
+
'ui.actions.submitRecord': 'Submit {record}',
|
|
47
|
+
'ui.actions.cancelRecord': 'Cancel {record}',
|
|
48
|
+
'ui.actions.amendRecord': 'Amend {record} as a copy',
|
|
49
|
+
'ui.actions.deleteDescription': 'The record moves to Deleted records, where it can be restored.',
|
|
46
50
|
'ui.actions.submitDescription': 'Once submitted, the document and its lines can no longer be edited.',
|
|
47
51
|
'ui.actions.cancelDescription': 'The document will be marked as cancelled and will no longer count.',
|
|
48
52
|
'ui.actions.amendDescription': 'A new draft is copied from this cancelled document with its lines; the original stays unchanged.',
|
|
49
53
|
'ui.actions.deleted': 'Record deleted',
|
|
54
|
+
'ui.actions.undoFailed': 'The deletion could not be undone. Restore the record from Deleted records.',
|
|
50
55
|
'ui.actions.submitted': 'Document submitted',
|
|
51
56
|
'ui.actions.cancelled': 'Document cancelled',
|
|
52
57
|
'ui.actions.amended': 'Amended copy created',
|
|
@@ -90,6 +95,8 @@ export const englishInterfaceMessages = {
|
|
|
90
95
|
'ui.show.noActivity': 'No activity recorded yet.',
|
|
91
96
|
'ui.common.loadingSection': 'Loading {section}',
|
|
92
97
|
'ui.field.chooseValue': 'Choose a value',
|
|
98
|
+
'ui.field.datePlaceholder': 'Type the date or pick it',
|
|
99
|
+
'ui.field.hijriDatePlaceholder': 'Type the Hijri date or pick it',
|
|
93
100
|
'ui.common.yes': 'Yes',
|
|
94
101
|
'ui.common.no': 'No',
|
|
95
102
|
'ui.field.entryCalendar': 'Entry calendar: {field}',
|
|
@@ -107,6 +114,8 @@ export const englishInterfaceMessages = {
|
|
|
107
114
|
'ui.field.replace': 'Replace',
|
|
108
115
|
'ui.field.remove': 'Remove',
|
|
109
116
|
'ui.field.chooseFile': 'Choose file',
|
|
117
|
+
'ui.field.changeFile': 'Change file',
|
|
118
|
+
'ui.field.noFileChosen': 'No file chosen',
|
|
110
119
|
'ui.field.uploading': 'Uploading {progress}%',
|
|
111
120
|
'ui.field.upload': 'Upload {field}',
|
|
112
121
|
'ui.field.optionsFailed': 'Could not load the options',
|
|
@@ -144,10 +153,26 @@ export const englishInterfaceMessages = {
|
|
|
144
153
|
'ui.value.currency': 'SAR',
|
|
145
154
|
'ui.value.percent': '%',
|
|
146
155
|
'ui.table.listOf': '{resource} list',
|
|
147
|
-
'ui.table.
|
|
148
|
-
'ui.table.shown': '{count}
|
|
149
|
-
'ui.table.estimate': '
|
|
156
|
+
'ui.table.records': 'Records',
|
|
157
|
+
'ui.table.shown': 'Shown: {count}',
|
|
158
|
+
'ui.table.estimate': 'In your scope: about {records}',
|
|
159
|
+
'ui.table.exact': 'In your scope: {records}',
|
|
150
160
|
'ui.table.scope': 'Within your permission scope',
|
|
161
|
+
'ui.count.recordOne': '1 record',
|
|
162
|
+
'ui.count.recordTwo': '2 records',
|
|
163
|
+
'ui.count.recordFew': '{count} records',
|
|
164
|
+
'ui.count.recordMany': '{count} records',
|
|
165
|
+
'ui.count.recordOther': '{count} records',
|
|
166
|
+
'ui.count.documentOne': '1 document',
|
|
167
|
+
'ui.count.documentTwo': '2 documents',
|
|
168
|
+
'ui.count.documentFew': '{count} documents',
|
|
169
|
+
'ui.count.documentMany': '{count} documents',
|
|
170
|
+
'ui.count.documentOther': '{count} documents',
|
|
171
|
+
'ui.count.tokenOne': '1 token',
|
|
172
|
+
'ui.count.tokenTwo': '2 tokens',
|
|
173
|
+
'ui.count.tokenFew': '{count} tokens',
|
|
174
|
+
'ui.count.tokenMany': '{count} tokens',
|
|
175
|
+
'ui.count.tokenOther': '{count} tokens',
|
|
151
176
|
'ui.table.export': 'Export shown',
|
|
152
177
|
'ui.table.searchPlaceholder': 'Search records...',
|
|
153
178
|
'ui.table.filter': 'Filter',
|
|
@@ -230,6 +255,8 @@ export const englishInterfaceMessages = {
|
|
|
230
255
|
'ui.list.exportResults': 'Export results',
|
|
231
256
|
'ui.list.exporting': 'Exporting...',
|
|
232
257
|
'ui.list.exportFailed': 'Could not export the results. Try again.',
|
|
258
|
+
'ui.list.exportXlsx': 'Excel file (xlsx)',
|
|
259
|
+
'ui.list.exportCsv': 'CSV file',
|
|
233
260
|
'ui.list.activeFilters': 'Applied filters',
|
|
234
261
|
'ui.list.removeFilter': 'Remove the {field} filter',
|
|
235
262
|
'ui.list.rangeBoth': 'From {from} to {to}',
|
|
@@ -258,22 +285,21 @@ export const englishInterfaceMessages = {
|
|
|
258
285
|
'ui.bulk.title': 'Bulk actions',
|
|
259
286
|
'ui.bulk.selected': '{count} selected',
|
|
260
287
|
'ui.bulk.clear': 'Clear selection',
|
|
261
|
-
'ui.bulk.limit': '
|
|
288
|
+
'ui.bulk.limit': 'At most {records} at a time.',
|
|
262
289
|
'ui.bulk.perRow': 'Your permission is checked for each record separately.',
|
|
263
|
-
'ui.bulk.succeeded': 'Done
|
|
264
|
-
'ui.bulk.failed': '
|
|
265
|
-
'ui.bulk.defined': 'The action “{action}” will run
|
|
290
|
+
'ui.bulk.succeeded': 'Done: {records}',
|
|
291
|
+
'ui.bulk.failed': 'Could not run: {records}',
|
|
292
|
+
'ui.bulk.defined': 'The action “{action}” will run. Selected: {records}.',
|
|
266
293
|
'ui.bulk.delete': 'Delete',
|
|
267
294
|
'ui.bulk.restore': 'Restore',
|
|
268
295
|
'ui.bulk.submit': 'Submit',
|
|
269
296
|
'ui.bulk.cancel': 'Cancel document',
|
|
270
|
-
'ui.bulk.deleteDescription': '{
|
|
271
|
-
'ui.bulk.restoreDescription': '{
|
|
272
|
-
'ui.bulk.submitDescription': '{
|
|
273
|
-
'ui.bulk.cancelDescription': '
|
|
297
|
+
'ui.bulk.deleteDescription': '{records} will be removed from lists; they can be restored from Deleted records.',
|
|
298
|
+
'ui.bulk.restoreDescription': '{records} will be restored from Deleted records to the active records.',
|
|
299
|
+
'ui.bulk.submitDescription': '{documents} will be submitted and can no longer be edited.',
|
|
300
|
+
'ui.bulk.cancelDescription': 'Submission will be cancelled. Selected: {documents}. A cancelled document is not counted.',
|
|
274
301
|
'ui.trash.title': 'Deleted records',
|
|
275
302
|
'ui.trash.titleOf': 'Deleted records · {resource}',
|
|
276
|
-
'ui.trash.listOf': 'Deleted {resource}',
|
|
277
303
|
'ui.trash.subtitle': 'Deleted records within your scope; restore what you need to the active records.',
|
|
278
304
|
'ui.trash.active': 'Active records',
|
|
279
305
|
'ui.trash.empty': 'No deleted records',
|
|
@@ -293,7 +319,7 @@ export const englishInterfaceMessages = {
|
|
|
293
319
|
'ui.dashboard.noValue': 'No value',
|
|
294
320
|
'ui.dashboard.meter': '{label}: {value}',
|
|
295
321
|
'ui.dashboard.truncated': 'Only the highest categories are shown.',
|
|
296
|
-
'ui.dashboard.openRecords': 'Open the {label}
|
|
322
|
+
'ui.dashboard.openRecords': 'Open the list: {label}',
|
|
297
323
|
'ui.attachment.preview': 'Preview',
|
|
298
324
|
'ui.attachment.previewNamed': 'Preview {name}',
|
|
299
325
|
'ui.attachment.previewDescription': 'Attachment preview. You can download it with the button below.',
|
|
@@ -325,4 +351,108 @@ export const englishInterfaceMessages = {
|
|
|
325
351
|
'ui.print.open': 'Open for printing',
|
|
326
352
|
'ui.activity.printed': 'Printed with a template',
|
|
327
353
|
'ui.admin.printTemplates': 'Print templates',
|
|
354
|
+
'ui.relation.unavailable': 'Record not available',
|
|
355
|
+
'ui.show.orgUnitUnavailable': 'Unit not available',
|
|
356
|
+
'ui.copy.action': 'Copy',
|
|
357
|
+
'ui.copy.done': 'Copied',
|
|
358
|
+
'ui.copy.failed': 'Copying failed; select the text and copy it manually.',
|
|
359
|
+
// Workspace shell, account menu and navigation order (ADR 049).
|
|
360
|
+
'ui.shell.apps': 'Applications',
|
|
361
|
+
'ui.shell.adminSections': 'Administration sections',
|
|
362
|
+
'ui.shell.sidebar': 'Sidebar',
|
|
363
|
+
'ui.shell.showSidebar': 'Show the sidebar',
|
|
364
|
+
'ui.shell.collapseSidebar': 'Collapse the sidebar',
|
|
365
|
+
'ui.shell.expandSidebar': 'Expand the sidebar',
|
|
366
|
+
'ui.shell.hideSidebar': 'Hide the sidebar',
|
|
367
|
+
'ui.shell.sectionPages': 'Section pages: {section}',
|
|
368
|
+
'ui.shell.myTasksCount': 'My tasks, {count} open',
|
|
369
|
+
'ui.account.menu': 'Account menu',
|
|
370
|
+
'ui.account.profile': 'Profile',
|
|
371
|
+
'ui.account.tokens': 'API tokens',
|
|
372
|
+
'ui.account.delegation': 'Delegation while away',
|
|
373
|
+
'ui.account.logout': 'Sign out',
|
|
374
|
+
'ui.account.theme': 'Appearance',
|
|
375
|
+
'ui.account.themeLight': 'Light',
|
|
376
|
+
'ui.account.themeDark': 'Dark',
|
|
377
|
+
'ui.account.themeSystem': 'Match device',
|
|
378
|
+
'ui.account.layout': 'Navigation layout',
|
|
379
|
+
'ui.account.layoutDefault': 'System default',
|
|
380
|
+
'ui.account.layoutSidebar': 'Sidebar menu',
|
|
381
|
+
'ui.account.layoutTop': 'Top menu',
|
|
382
|
+
'ui.account.sidebarCollapse': 'When the menu collapses',
|
|
383
|
+
'ui.account.sidebarCollapseIcons': 'Icons',
|
|
384
|
+
'ui.account.sidebarCollapseHidden': 'Hide completely',
|
|
385
|
+
'ui.account.arrange': 'Arrange the menu…',
|
|
386
|
+
'ui.navOrder.title': 'Arrange the menu',
|
|
387
|
+
'ui.navOrder.description': 'Order the menu entries to suit your work. The same order applies to the side and top menus.',
|
|
388
|
+
'ui.navOrder.position': '{name} at position {position}',
|
|
389
|
+
'ui.navOrder.up': 'Move {name} up',
|
|
390
|
+
'ui.navOrder.down': 'Move {name} down',
|
|
391
|
+
'ui.navOrder.reset': 'Restore the default order',
|
|
392
|
+
'ui.navOrder.save': 'Save the order',
|
|
393
|
+
'ui.preferences.saveFailed': 'Could not save the preference.',
|
|
394
|
+
'ui.notifications.unread': 'Notifications, {count} unread',
|
|
395
|
+
'ui.admin.delegations': 'Approval delegations',
|
|
396
|
+
'ui.admin.general': 'General settings',
|
|
397
|
+
'ui.admin.lookups': 'Reference lists',
|
|
398
|
+
'ui.admin.sequences': 'Sequential numbering',
|
|
399
|
+
'ui.overview.description': 'Your work and indicators in one place, in the order you choose.',
|
|
400
|
+
'ui.overview.customize': 'Customize',
|
|
401
|
+
'ui.overview.customizeTitle': 'Customize the overview',
|
|
402
|
+
'ui.overview.customizeDescription': 'Choose the items to show and order them by dragging or with the keyboard.',
|
|
403
|
+
'ui.overview.widgets': 'Overview items',
|
|
404
|
+
'ui.overview.show': 'Show {widget}',
|
|
405
|
+
'ui.overview.reset': 'Restore default',
|
|
406
|
+
'ui.overview.resetTitle': 'Restore the default order?',
|
|
407
|
+
'ui.overview.resetDescription': 'The items return to their default order and visibility.',
|
|
408
|
+
'ui.overview.empty': 'No items are shown. Show one from “Customize”.',
|
|
409
|
+
'ui.overview.welcome': 'My account and settings',
|
|
410
|
+
'ui.overview.tasks': 'My open tasks',
|
|
411
|
+
'ui.overview.notifications': 'Unread notifications',
|
|
412
|
+
'ui.overview.modules': 'Work modules',
|
|
413
|
+
'ui.overview.unavailable': 'Unavailable',
|
|
414
|
+
'ui.overview.countFailed': 'Could not load the count',
|
|
415
|
+
'ui.sortable.handle': 'Move handle for {item}',
|
|
416
|
+
'ui.sortable.moveUp': 'Move {item} up',
|
|
417
|
+
'ui.sortable.moveDown': 'Move {item} down',
|
|
418
|
+
'ui.sortable.picked': 'Picked up {item}, position {position} of {total}. Use the arrow keys to move it, then Space to drop it.',
|
|
419
|
+
'ui.sortable.moved': 'Moved {item} to position {position} of {total}.',
|
|
420
|
+
'ui.sortable.dropped': 'Dropped {item} at position {position} of {total}.',
|
|
421
|
+
'ui.sortable.cancelled': 'Move cancelled; {item} is back at position {position}.',
|
|
422
|
+
'ui.sortable.hint': 'Press Space to pick up the item, the arrow keys to move it, Space to drop it, or Escape to cancel.',
|
|
423
|
+
'ui.assistant.title': 'AI assistant',
|
|
424
|
+
'ui.assistant.description': 'Answers your questions and reads records with your own permissions only.',
|
|
425
|
+
'ui.assistant.accept': 'I understand and agree',
|
|
426
|
+
'ui.assistant.acceptFailed': 'Could not save your agreement.',
|
|
427
|
+
'ui.assistant.empty': 'Ask about your records, for example: how many open orders are in my unit?',
|
|
428
|
+
'ui.assistant.pending': 'Proposal awaiting your review',
|
|
429
|
+
'ui.assistant.review': 'Review',
|
|
430
|
+
'ui.assistant.typing': 'The assistant is typing…',
|
|
431
|
+
'ui.assistant.question': 'Your question',
|
|
432
|
+
'ui.assistant.placeholder': 'Type your question…',
|
|
433
|
+
'ui.assistant.remaining': 'Remaining today: {count}',
|
|
434
|
+
'ui.assistant.send': 'Send',
|
|
435
|
+
'ui.assistant.failed': 'Could not get a reply. Try again.',
|
|
436
|
+
'ui.assistant.confirmed': 'The proposal was carried out.',
|
|
437
|
+
'ui.assistant.rejected': 'The proposal was rejected and not carried out.',
|
|
438
|
+
'ui.assistant.confirmFailed': 'Could not carry out the proposal.',
|
|
439
|
+
'ui.assistant.reviewTitle': "Review the assistant's proposal",
|
|
440
|
+
'ui.assistant.reviewDescription': 'The assistant proposed this change; nothing has run yet. Review it, then carry it out or reject it.',
|
|
441
|
+
'ui.assistant.resource': 'Resource',
|
|
442
|
+
'ui.assistant.record': 'Record',
|
|
443
|
+
'ui.assistant.field': 'Field',
|
|
444
|
+
'ui.assistant.current': 'Current value',
|
|
445
|
+
'ui.assistant.proposed': 'Proposed value',
|
|
446
|
+
'ui.assistant.reject': 'Reject',
|
|
447
|
+
'ui.assistant.execute': 'Carry out',
|
|
448
|
+
'ui.assistant.create': 'Create a record',
|
|
449
|
+
'ui.assistant.update': 'Update a record',
|
|
450
|
+
'ui.assistant.delete': 'Delete a record',
|
|
451
|
+
'ui.assistant.submit': 'Submit a record',
|
|
452
|
+
'ui.assistant.cancel': 'Cancel a record',
|
|
453
|
+
'ui.assistant.noticeTitle': 'What is sent to an external provider?',
|
|
454
|
+
'ui.assistant.noticeQuestion': 'The text of your question and the current conversation.',
|
|
455
|
+
'ui.assistant.noticeRecords': 'What the assistant reads from records on your behalf: only what your permissions let you see, without hidden or restricted fields.',
|
|
456
|
+
'ui.assistant.noticeResources': 'The names of the resources you may view.',
|
|
457
|
+
'ui.assistant.noticeNever': 'Passwords, settings, attachments and your name or e-mail are never sent. The provider (OpenRouter) processes this data under its own policy, and no change to records runs without your approval.',
|
|
328
458
|
};
|
|
@@ -19,6 +19,11 @@ export type DashboardWidgetDefinition = {
|
|
|
19
19
|
filters?: Record<string, unknown>;
|
|
20
20
|
/** Role-rule style conditions, as in ResourceService.aggregate. */
|
|
21
21
|
where?: Conditions;
|
|
22
|
+
/**
|
|
23
|
+
* Offers the widget on the personal overview page (ADR 050) as `dashboard.<name>.<key>`;
|
|
24
|
+
* each user shows, hides and orders it there, and it appears only when they may read it.
|
|
25
|
+
*/
|
|
26
|
+
overview?: boolean;
|
|
22
27
|
};
|
|
23
28
|
export type DashboardDefinition = {
|
|
24
29
|
/** /^[a-z][a-z0-9_]*$/, used in the URL /dashboards/:name. */
|
|
@@ -54,6 +59,36 @@ export type DashboardWidgetResult = {
|
|
|
54
59
|
rows?: DashboardGroupRow[];
|
|
55
60
|
truncated: boolean;
|
|
56
61
|
};
|
|
62
|
+
/** A widget the host draws itself on the overview (its data is already the viewer's own). */
|
|
63
|
+
export type OverviewBuiltin = {
|
|
64
|
+
id: string;
|
|
65
|
+
label: string;
|
|
66
|
+
};
|
|
67
|
+
/** A user's saved overview arrangement; ids they may not see are ignored on every read. */
|
|
68
|
+
export type OverviewLayout = {
|
|
69
|
+
order?: readonly string[];
|
|
70
|
+
hidden?: readonly string[];
|
|
71
|
+
};
|
|
72
|
+
export type OverviewWidget = {
|
|
73
|
+
id: string;
|
|
74
|
+
kind: 'builtin';
|
|
75
|
+
label: string;
|
|
76
|
+
hidden: boolean;
|
|
77
|
+
} | {
|
|
78
|
+
id: string;
|
|
79
|
+
kind: 'dashboard';
|
|
80
|
+
label: string;
|
|
81
|
+
hidden: boolean;
|
|
82
|
+
dashboard: string;
|
|
83
|
+
/** Computed for shown widgets only; null when hidden. */
|
|
84
|
+
data: DashboardWidgetResult | null;
|
|
85
|
+
};
|
|
86
|
+
export type OverviewState = {
|
|
87
|
+
/** Every widget the viewer may see, in their order; hidden ones carry no data. */
|
|
88
|
+
widgets: OverviewWidget[];
|
|
89
|
+
/** True when the saved arrangement differs from the default. */
|
|
90
|
+
customized: boolean;
|
|
91
|
+
};
|
|
57
92
|
export type DashboardResult = {
|
|
58
93
|
name: string;
|
|
59
94
|
label: string;
|
|
@@ -89,6 +124,13 @@ export declare class Dashboards {
|
|
|
89
124
|
private readable;
|
|
90
125
|
/** Dashboards with at least one widget the actor may read. */
|
|
91
126
|
list(actor: Actor): DashboardSummary[];
|
|
127
|
+
/**
|
|
128
|
+
* The personal overview (ADR 050): the host's built-in widgets and every `overview: true`
|
|
129
|
+
* dashboard widget the actor may read, arranged by the saved layout. Saved ids that are
|
|
130
|
+
* unknown or no longer readable are dropped, widgets added later join in default order, and
|
|
131
|
+
* only shown dashboard widgets are computed, so a stored id never reveals data.
|
|
132
|
+
*/
|
|
133
|
+
overview(actor: Actor, saved: OverviewLayout | null | undefined, builtins?: readonly OverviewBuiltin[]): Promise<OverviewState>;
|
|
92
134
|
render(name: string, actor: Actor): Promise<DashboardResult>;
|
|
93
135
|
private widget;
|
|
94
136
|
/** Display labels of one grouped field: lookups, titles, user names, «نعم/لا». */
|
|
@@ -39,6 +39,8 @@ export function defineDashboard(definition) {
|
|
|
39
39
|
throw new Error(`${where}: measure is 'count' or { sum: field }`);
|
|
40
40
|
if (widget.groupBy !== undefined && typeof widget.groupBy !== 'string')
|
|
41
41
|
throw new Error(`${where}: groupBy is one field name`);
|
|
42
|
+
if (widget.overview !== undefined && typeof widget.overview !== 'boolean')
|
|
43
|
+
throw new Error(`${where}: overview is true or false`);
|
|
42
44
|
for (const [option, value] of [
|
|
43
45
|
['filters', widget.filters],
|
|
44
46
|
['where', widget.where],
|
|
@@ -121,6 +123,53 @@ export class Dashboards {
|
|
|
121
123
|
.filter((dashboard) => dashboard.widgets.some((widget) => this.readable(widget, actor, ability)))
|
|
122
124
|
.map((dashboard) => ({ name: dashboard.name, label: labelText(dashboard.label) }));
|
|
123
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* The personal overview (ADR 050): the host's built-in widgets and every `overview: true`
|
|
128
|
+
* dashboard widget the actor may read, arranged by the saved layout. Saved ids that are
|
|
129
|
+
* unknown or no longer readable are dropped, widgets added later join in default order, and
|
|
130
|
+
* only shown dashboard widgets are computed, so a stored id never reveals data.
|
|
131
|
+
*/
|
|
132
|
+
async overview(actor, saved, builtins = []) {
|
|
133
|
+
const ability = buildAbility(actor.rules, this.registry.all());
|
|
134
|
+
const available = new Map();
|
|
135
|
+
for (const builtin of builtins)
|
|
136
|
+
available.set(builtin.id, { label: builtin.label, builtin: true });
|
|
137
|
+
for (const dashboard of this.dashboards.values())
|
|
138
|
+
for (const widget of dashboard.widgets)
|
|
139
|
+
if (widget.overview && this.readable(widget, actor, ability))
|
|
140
|
+
available.set(`dashboard.${dashboard.name}.${widget.key}`, {
|
|
141
|
+
label: labelText(widget.label),
|
|
142
|
+
dashboard: dashboard.name,
|
|
143
|
+
widget,
|
|
144
|
+
});
|
|
145
|
+
const ids = (value) => Array.isArray(value)
|
|
146
|
+
? value.filter((id) => typeof id === 'string' && available.has(id))
|
|
147
|
+
: [];
|
|
148
|
+
const order = [...new Set([...ids(saved?.order), ...available.keys()])];
|
|
149
|
+
const hidden = new Set(ids(saved?.hidden));
|
|
150
|
+
const defaults = [...available.keys()];
|
|
151
|
+
const widgets = [];
|
|
152
|
+
for (const id of order) {
|
|
153
|
+
const entry = available.get(id);
|
|
154
|
+
const isHidden = hidden.has(id);
|
|
155
|
+
if (entry.builtin) {
|
|
156
|
+
widgets.push({ id, kind: 'builtin', label: entry.label, hidden: isHidden });
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
widgets.push({
|
|
160
|
+
id,
|
|
161
|
+
kind: 'dashboard',
|
|
162
|
+
label: entry.label,
|
|
163
|
+
hidden: isHidden,
|
|
164
|
+
dashboard: entry.dashboard,
|
|
165
|
+
data: isHidden ? null : await this.widget(entry.widget, actor),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
widgets,
|
|
170
|
+
customized: hidden.size > 0 || order.some((id, index) => id !== defaults[index]),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
124
173
|
async render(name, actor) {
|
|
125
174
|
const dashboard = typeof name === 'string' ? this.dashboards.get(name) : undefined;
|
|
126
175
|
if (!dashboard)
|
package/build/src/mcp/tools.js
CHANGED
|
@@ -1,88 +1,26 @@
|
|
|
1
1
|
import { Tool } from '@jrmc/adonis-mcp';
|
|
2
2
|
import { AdulaError } from '../admin/errors.js';
|
|
3
|
-
|
|
4
|
-
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
5
|
-
throw new AdulaError(422, 'E_INPUT', 'Expected an object');
|
|
6
|
-
return value;
|
|
7
|
-
}
|
|
8
|
-
function recordId(value) {
|
|
9
|
-
if (!Number.isSafeInteger(value) || Number(value) < 1)
|
|
10
|
-
throw new AdulaError(422, 'E_ID', 'Expected a positive integer record ID');
|
|
11
|
-
return Number(value);
|
|
12
|
-
}
|
|
3
|
+
import { RESOURCE_READ_SCHEMA, RESOURCE_WRITE_SCHEMA, parseResourceToolArgs, resourceToolError, runResourceTool, } from '../admin/resource_tools.js';
|
|
13
4
|
/** Optional MCP adapter. Actor identity comes only from the host's authenticated context. */
|
|
14
5
|
export function createResourceTools(resolveRuntime) {
|
|
15
6
|
async function execute(context, write) {
|
|
16
7
|
try {
|
|
17
|
-
|
|
8
|
+
// Argument shape is refused before the runtime (and the actor) is resolved.
|
|
9
|
+
const args = context.args;
|
|
10
|
+
if (!args || typeof args !== 'object' || Array.isArray(args))
|
|
11
|
+
throw new AdulaError(422, 'E_INPUT', 'Expected an object');
|
|
18
12
|
const accepted = write
|
|
19
13
|
? ['resource', 'action', 'id', 'input', 'version']
|
|
20
14
|
: ['resource', 'action', 'id', 'options'];
|
|
21
15
|
if (Object.keys(args).some((key) => !accepted.includes(key)))
|
|
22
16
|
throw new AdulaError(422, 'E_INPUT', 'Unknown tool argument');
|
|
23
17
|
const runtime = await resolveRuntime(context);
|
|
24
|
-
|
|
25
|
-
!runtime.registry.all().some((r) => r.name === args.resource))
|
|
26
|
-
throw new AdulaError(404, 'E_NOT_FOUND', 'الكيان غير موجود');
|
|
27
|
-
const name = args.resource;
|
|
28
|
-
const { resources, actor } = runtime;
|
|
29
|
-
let result;
|
|
30
|
-
if (!write && args.action === 'list') {
|
|
31
|
-
const options = args.options === undefined ? {} : object(args.options);
|
|
32
|
-
if (Object.keys(options).some((key) => !['limit', 'cursor', 'search', 'sort', 'direction', 'filters', 'estimate'].includes(key)))
|
|
33
|
-
throw new AdulaError(422, 'E_INPUT', 'Unknown list option');
|
|
34
|
-
for (const key of ['cursor', 'search', 'sort'])
|
|
35
|
-
if (options[key] !== undefined && typeof options[key] !== 'string')
|
|
36
|
-
throw new AdulaError(422, 'E_INPUT', `Invalid ${key}`);
|
|
37
|
-
if ((options.limit !== undefined && !Number.isSafeInteger(options.limit)) ||
|
|
38
|
-
(options.direction !== undefined &&
|
|
39
|
-
!['asc', 'desc'].includes(String(options.direction))) ||
|
|
40
|
-
(options.estimate !== undefined && typeof options.estimate !== 'boolean'))
|
|
41
|
-
throw new AdulaError(422, 'E_INPUT', 'Invalid list options');
|
|
42
|
-
if (options.filters !== undefined)
|
|
43
|
-
object(options.filters);
|
|
44
|
-
result = await resources.list(name, actor, options);
|
|
45
|
-
}
|
|
46
|
-
else if (!write && args.action === 'show') {
|
|
47
|
-
result = await resources.show(name, recordId(args.id), actor);
|
|
48
|
-
}
|
|
49
|
-
else if (!write && args.action === 'editor') {
|
|
50
|
-
result = await resources.editor(name, actor, args.id === undefined ? undefined : recordId(args.id));
|
|
51
|
-
}
|
|
52
|
-
else if (write && (args.action === 'create' || args.action === 'update')) {
|
|
53
|
-
if (args.action === 'create' && args.id !== undefined)
|
|
54
|
-
throw new AdulaError(422, 'E_INPUT', 'Create cannot specify an ID');
|
|
55
|
-
result = {
|
|
56
|
-
data: await resources.save(name, actor, object(args.input), args.action === 'update' ? recordId(args.id) : undefined),
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
else if (write &&
|
|
60
|
-
(args.action === 'delete' || args.action === 'submit' || args.action === 'cancel')) {
|
|
61
|
-
result = {
|
|
62
|
-
data: await resources.transition(name, recordId(args.id), actor, args.action, args.version),
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
else
|
|
66
|
-
throw new AdulaError(422, 'E_ACTION', 'Unsupported resource action');
|
|
18
|
+
const result = await runResourceTool(runtime, parseResourceToolArgs(runtime, args, write));
|
|
67
19
|
return context.response.text(JSON.stringify(result));
|
|
68
20
|
}
|
|
69
21
|
catch (error) {
|
|
70
|
-
if (error instanceof AdulaError)
|
|
71
|
-
return context.response.error(JSON.stringify({ status: error.status, code: error.code, message: error.message }));
|
|
72
|
-
if (error?.code === 'E_VALIDATION_ERROR')
|
|
73
|
-
return context.response.error(JSON.stringify({
|
|
74
|
-
status: 422,
|
|
75
|
-
code: 'E_VALIDATION_ERROR',
|
|
76
|
-
messages: error.messages,
|
|
77
|
-
}));
|
|
78
|
-
if (['23505', '23503', '23502'].includes(error?.code ?? ''))
|
|
79
|
-
return context.response.error(JSON.stringify({
|
|
80
|
-
status: 422,
|
|
81
|
-
code: 'E_CONSTRAINT',
|
|
82
|
-
message: 'تحقق من القيم والسجلات المرتبطة',
|
|
83
|
-
}));
|
|
84
22
|
// Do not put database statements, credentials or stack traces on the wire.
|
|
85
|
-
return context.response.error(JSON.stringify(
|
|
23
|
+
return context.response.error(JSON.stringify(resourceToolError(error)));
|
|
86
24
|
}
|
|
87
25
|
}
|
|
88
26
|
class ResourceReadTool extends Tool {
|
|
@@ -96,29 +34,7 @@ export function createResourceTools(resolveRuntime) {
|
|
|
96
34
|
openWorldHint: false,
|
|
97
35
|
};
|
|
98
36
|
schema() {
|
|
99
|
-
return
|
|
100
|
-
type: 'object',
|
|
101
|
-
additionalProperties: false,
|
|
102
|
-
properties: {
|
|
103
|
-
resource: { type: 'string' },
|
|
104
|
-
action: { type: 'string', enum: ['list', 'show', 'editor'] },
|
|
105
|
-
id: { type: 'integer', minimum: 1 },
|
|
106
|
-
options: {
|
|
107
|
-
type: 'object',
|
|
108
|
-
properties: {
|
|
109
|
-
limit: { type: 'integer', minimum: 1, maximum: 100 },
|
|
110
|
-
cursor: { type: 'string' },
|
|
111
|
-
search: { type: 'string' },
|
|
112
|
-
sort: { type: 'string' },
|
|
113
|
-
direction: { type: 'string', enum: ['asc', 'desc'] },
|
|
114
|
-
filters: { type: 'object', properties: {}, additionalProperties: true },
|
|
115
|
-
estimate: { type: 'boolean' },
|
|
116
|
-
},
|
|
117
|
-
additionalProperties: false,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
required: ['resource', 'action'],
|
|
121
|
-
};
|
|
37
|
+
return structuredClone(RESOURCE_READ_SCHEMA);
|
|
122
38
|
}
|
|
123
39
|
async handle(context) {
|
|
124
40
|
return execute(context, false);
|
|
@@ -135,18 +51,7 @@ export function createResourceTools(resolveRuntime) {
|
|
|
135
51
|
openWorldHint: false,
|
|
136
52
|
};
|
|
137
53
|
schema() {
|
|
138
|
-
return
|
|
139
|
-
type: 'object',
|
|
140
|
-
additionalProperties: false,
|
|
141
|
-
properties: {
|
|
142
|
-
resource: { type: 'string' },
|
|
143
|
-
action: { type: 'string', enum: ['create', 'update', 'delete', 'submit', 'cancel'] },
|
|
144
|
-
id: { type: 'integer', minimum: 1 },
|
|
145
|
-
input: { type: 'object', properties: {}, additionalProperties: true },
|
|
146
|
-
version: { type: 'integer', minimum: 1 },
|
|
147
|
-
},
|
|
148
|
-
required: ['resource', 'action'],
|
|
149
|
-
};
|
|
54
|
+
return structuredClone(RESOURCE_WRITE_SCHEMA);
|
|
150
55
|
}
|
|
151
56
|
async handle(context) {
|
|
152
57
|
return execute(context, true);
|
|
@@ -247,6 +247,13 @@ export function defineResource(input) {
|
|
|
247
247
|
if (parent?.type !== 'belongsTo' || !parent.required)
|
|
248
248
|
throw new Error(`${input.name}: scope.from must name a required belongsTo field`);
|
|
249
249
|
}
|
|
250
|
+
if (input.defaultSort !== undefined) {
|
|
251
|
+
const { field, direction } = input.defaultSort;
|
|
252
|
+
if (field !== 'id' && !input.fields[field]?.sortable)
|
|
253
|
+
throw new Error(`${input.name}: defaultSort must name id or a sortable field`);
|
|
254
|
+
if (direction !== undefined && direction !== 'asc' && direction !== 'desc')
|
|
255
|
+
throw new Error(`${input.name}: defaultSort direction must be asc or desc`);
|
|
256
|
+
}
|
|
250
257
|
assertTitle(input);
|
|
251
258
|
assertPrintTemplates(input);
|
|
252
259
|
if (!input.submittable && input.actions.some((a) => ['submit', 'cancel', 'amend'].includes(a)))
|
|
@@ -317,6 +317,15 @@ export type Resource = {
|
|
|
317
317
|
fields: Record<string, Field>;
|
|
318
318
|
/** Field keys shown as list columns, in order. */
|
|
319
319
|
list: readonly string[];
|
|
320
|
+
/**
|
|
321
|
+
* The list's order when the user has chosen none: a sortable field (or `id`) and its
|
|
322
|
+
* direction (ascending unless given). Ties are broken by id in the same direction.
|
|
323
|
+
* @default newest first: created_at descending, then id descending
|
|
324
|
+
*/
|
|
325
|
+
defaultSort?: {
|
|
326
|
+
field: string;
|
|
327
|
+
direction?: 'asc' | 'desc';
|
|
328
|
+
};
|
|
320
329
|
/** Field keys of the create and edit form, in order. */
|
|
321
330
|
form: readonly string[];
|
|
322
331
|
/** Field keys of the record details view, in order. */
|
|
@@ -4,8 +4,12 @@ export type WorkflowDelegation = {
|
|
|
4
4
|
id: number;
|
|
5
5
|
delegatorId: number;
|
|
6
6
|
delegatorName: string | null;
|
|
7
|
+
/** The delegator's versioned picture URL, or null without one (ADR 050). */
|
|
8
|
+
delegatorAvatarUrl?: string | null;
|
|
7
9
|
delegateId: number;
|
|
8
10
|
delegateName: string | null;
|
|
11
|
+
/** The delegate's versioned picture URL, or null without one (ADR 050). */
|
|
12
|
+
delegateAvatarUrl?: string | null;
|
|
9
13
|
/** Inclusive dates (YYYY-MM-DD), days in the system time zone (UTC by default). */
|
|
10
14
|
startsOn: string;
|
|
11
15
|
endsOn: string;
|
|
@@ -61,10 +65,15 @@ export declare class WorkflowDelegations {
|
|
|
61
65
|
* Active users a delegate can be chosen from (id and display name only), at most 20.
|
|
62
66
|
* The search needs two characters and matches names, or an e-mail address exactly, so
|
|
63
67
|
* the picker cannot list the whole user directory or probe e-mail fragments.
|
|
68
|
+
* `exceptId` is the delegator: only users on the delegator's organization path (the same
|
|
69
|
+
* unit, an ancestor or a descendant) are offered, by name or e-mail, the rule create()
|
|
70
|
+
* applies to a user's own delegation. 0 (administrators managing anyone's delegation)
|
|
71
|
+
* offers every active user.
|
|
64
72
|
*/
|
|
65
73
|
candidates(search: unknown, exceptId: number): Promise<{
|
|
66
74
|
id: number;
|
|
67
75
|
name: string;
|
|
76
|
+
avatarUrl?: string | null;
|
|
68
77
|
}[]>;
|
|
69
78
|
/** Every delegation that has not ended, for administrators. */
|
|
70
79
|
current(): Promise<WorkflowDelegation[]>;
|
|
@@ -73,7 +82,12 @@ export declare class WorkflowDelegations {
|
|
|
73
82
|
id: number;
|
|
74
83
|
delegateId: number;
|
|
75
84
|
} | null>;
|
|
76
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Creates a delegation; the caller decides whether `createdBy` may act for the delegator.
|
|
87
|
+
* When `createdBy` is the delegator, the delegate must be on their organization path (see
|
|
88
|
+
* candidates()); a caller acting for someone else (administrators) may choose any active
|
|
89
|
+
* user.
|
|
90
|
+
*/
|
|
77
91
|
create(input: WorkflowDelegationInput, createdBy: number): Promise<WorkflowDelegation>;
|
|
78
92
|
/**
|
|
79
93
|
* Ends a delegation now. `ownerId` must be the delegator unless `any` (administrators);
|