@almadar/std 16.216.0 → 16.217.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.
@@ -0,0 +1,1417 @@
1
+ {
2
+ "description": "std-global-search — cross-module federated search. Use when a user voices that one search box should query several modules at once (global search, search everything, unified search, cross-module search, federated search, search across records, omnisearch, one search box, aggregated results, grouped results). One SEARCH event fans out to every module key listed in the `modules` config (comma-separated, deterministic — no registry magic): the trait walks the parsed key list with an internal FAN_OUT_STEP sentinel and emits one scoped MODULE_SEARCH_REQUESTED { moduleKey, queryText, typeFilter, scopeJson } -> external per key, so modules respond in parallel rather than in sequence. Modules answer with SEARCH_RESULTS { moduleKey, resultsJson }; each answer appends a SearchResultGroup to the entity, so the merged view stays grouped by module. Client/person/date/type filters ride `scopeJson` — the atom never interprets them. Every query persists as a SearchQuery row (recent/saved searches) when `saveHistory` is on. The input is the mapped `search-input` type rendered inline with event renamed to SEARCH (the std-geosearch idiom); its native {searchTerm}/{value} payloads are bridged via str/default, so programmatic SEARCH { queryText, typeFilter, scopeJson } emitters and the UI box drive the same arm.",
3
+ "ledger": {
4
+ "entries": {
5
+ "ent_01M2HF5GMNGVKWFSM4E6WE1SAY": {
6
+ "bakedName": "SearchQuery",
7
+ "curName": "SearchQuery",
8
+ "id": "ent_01M2HF5GMNGVKWFSM4E6WE1SAY",
9
+ "kind": "entity",
10
+ "owner": "workspace",
11
+ "renames": []
12
+ },
13
+ "evt_01M2HF5GMN6JSD7G1NETHYTHQR": {
14
+ "bakedName": "INIT",
15
+ "curName": "INIT",
16
+ "id": "evt_01M2HF5GMN6JSD7G1NETHYTHQR",
17
+ "kind": "event",
18
+ "owner": "workspace",
19
+ "parent": "trt_01M2HF5GMNYZN83ARCEMGT2H32",
20
+ "renames": []
21
+ },
22
+ "evt_01M2HF5GMNAKMT2RRYB0ZGZS6Z": {
23
+ "bakedName": "QUERY_SAVE_FAILED",
24
+ "curName": "QUERY_SAVE_FAILED",
25
+ "id": "evt_01M2HF5GMNAKMT2RRYB0ZGZS6Z",
26
+ "kind": "event",
27
+ "owner": "workspace",
28
+ "parent": "trt_01M2HF5GMNYZN83ARCEMGT2H32",
29
+ "renames": []
30
+ },
31
+ "evt_01M2HF5GMNCGC1A1JPXVA31JJ1": {
32
+ "bakedName": "FAN_OUT_STEP",
33
+ "curName": "FAN_OUT_STEP",
34
+ "id": "evt_01M2HF5GMNCGC1A1JPXVA31JJ1",
35
+ "kind": "event",
36
+ "owner": "workspace",
37
+ "parent": "trt_01M2HF5GMNYZN83ARCEMGT2H32",
38
+ "renames": []
39
+ },
40
+ "evt_01M2HF5GMNEB63359FQVKBKN3V": {
41
+ "bakedName": "SEARCH_RESULTS",
42
+ "curName": "SEARCH_RESULTS",
43
+ "id": "evt_01M2HF5GMNEB63359FQVKBKN3V",
44
+ "kind": "event",
45
+ "owner": "workspace",
46
+ "parent": "trt_01M2HF5GMNYZN83ARCEMGT2H32",
47
+ "renames": []
48
+ },
49
+ "evt_01M2HF5GMNGMY75CAME4DJCNH7": {
50
+ "bakedName": "MODULE_SEARCH_REQUESTED",
51
+ "curName": "MODULE_SEARCH_REQUESTED",
52
+ "id": "evt_01M2HF5GMNGMY75CAME4DJCNH7",
53
+ "kind": "event",
54
+ "owner": "workspace",
55
+ "parent": "trt_01M2HF5GMNYZN83ARCEMGT2H32",
56
+ "renames": []
57
+ },
58
+ "evt_01M2HF5GMNP8V3F758G3B5HH7M": {
59
+ "bakedName": "GLOBAL_SEARCH_COMPLETED",
60
+ "curName": "GLOBAL_SEARCH_COMPLETED",
61
+ "id": "evt_01M2HF5GMNP8V3F758G3B5HH7M",
62
+ "kind": "event",
63
+ "owner": "workspace",
64
+ "parent": "trt_01M2HF5GMNYZN83ARCEMGT2H32",
65
+ "renames": []
66
+ },
67
+ "evt_01M2HF5GMNSJYN4RP8WVXTB1ES": {
68
+ "bakedName": "SEARCH",
69
+ "curName": "SEARCH",
70
+ "id": "evt_01M2HF5GMNSJYN4RP8WVXTB1ES",
71
+ "kind": "event",
72
+ "owner": "workspace",
73
+ "parent": "trt_01M2HF5GMNYZN83ARCEMGT2H32",
74
+ "renames": []
75
+ },
76
+ "evt_01M2HF5GMNZ50T4QQD0RMJC0S8": {
77
+ "bakedName": "QUERY_SAVED",
78
+ "curName": "QUERY_SAVED",
79
+ "id": "evt_01M2HF5GMNZ50T4QQD0RMJC0S8",
80
+ "kind": "event",
81
+ "owner": "workspace",
82
+ "parent": "trt_01M2HF5GMNYZN83ARCEMGT2H32",
83
+ "renames": []
84
+ },
85
+ "orb_01M2HF5GMNVYV2SQAEAZFVDG76": {
86
+ "bakedName": "GlobalSearchOrbital",
87
+ "curName": "GlobalSearchOrbital",
88
+ "id": "orb_01M2HF5GMNVYV2SQAEAZFVDG76",
89
+ "kind": "orbital",
90
+ "owner": "workspace",
91
+ "renames": []
92
+ },
93
+ "pag_01M2HF5GMN5HJY316K81KVBCNE": {
94
+ "bakedName": "GlobalSearchPage",
95
+ "curName": "GlobalSearchPage",
96
+ "id": "pag_01M2HF5GMN5HJY316K81KVBCNE",
97
+ "kind": "page",
98
+ "owner": "workspace",
99
+ "renames": []
100
+ },
101
+ "trt_01M2HF5GMN2FE93FP2KKCTC5FB": {
102
+ "bakedName": "InlineTypographyRender3",
103
+ "curName": "InlineTypographyRender3",
104
+ "id": "trt_01M2HF5GMN2FE93FP2KKCTC5FB",
105
+ "kind": "trait",
106
+ "owner": "workspace",
107
+ "renames": []
108
+ },
109
+ "trt_01M2HF5GMNH5WR6RWC7C05RFQT": {
110
+ "bakedName": "InlineTypographyRender4",
111
+ "curName": "InlineTypographyRender4",
112
+ "id": "trt_01M2HF5GMNH5WR6RWC7C05RFQT",
113
+ "kind": "trait",
114
+ "owner": "workspace",
115
+ "renames": []
116
+ },
117
+ "trt_01M2HF5GMNQ98TN6V15AA4B52H": {
118
+ "bakedName": "InlineSpinnerRender2",
119
+ "curName": "InlineSpinnerRender2",
120
+ "id": "trt_01M2HF5GMNQ98TN6V15AA4B52H",
121
+ "kind": "trait",
122
+ "owner": "workspace",
123
+ "renames": []
124
+ },
125
+ "trt_01M2HF5GMNYZN83ARCEMGT2H32": {
126
+ "bakedName": "GlobalSearch",
127
+ "curName": "GlobalSearch",
128
+ "id": "trt_01M2HF5GMNYZN83ARCEMGT2H32",
129
+ "kind": "trait",
130
+ "owner": "workspace",
131
+ "renames": []
132
+ },
133
+ "trt_01M2HF5GMNZQ67R15B1XS75064": {
134
+ "bakedName": "InlineTypographyRender1",
135
+ "curName": "InlineTypographyRender1",
136
+ "id": "trt_01M2HF5GMNZQ67R15B1XS75064",
137
+ "kind": "trait",
138
+ "owner": "workspace",
139
+ "renames": []
140
+ }
141
+ },
142
+ "schemaVersion": 1
143
+ },
144
+ "name": "std-global-search",
145
+ "orbitals": [
146
+ {
147
+ "entity": {
148
+ "collection": "search_queries",
149
+ "fields": [
150
+ {
151
+ "name": "id",
152
+ "required": true,
153
+ "type": "string"
154
+ },
155
+ {
156
+ "default": "",
157
+ "description": "Owner of this query — the user who ran it.",
158
+ "name": "personId",
159
+ "synonyms": "user, owner, searcher, account",
160
+ "type": "string"
161
+ },
162
+ {
163
+ "default": "",
164
+ "description": "The search text the user typed.",
165
+ "name": "queryText",
166
+ "synonyms": "query, search term, keywords, search string",
167
+ "type": "string"
168
+ },
169
+ {
170
+ "default": "",
171
+ "description": "Record-type filter applied to the query; blank = all types.",
172
+ "name": "typeFilter",
173
+ "synonyms": "type, kind, category filter, record type",
174
+ "type": "string"
175
+ },
176
+ {
177
+ "default": "",
178
+ "description": "Serialized scope filters (client/person/date/type) passed through to modules uninterpreted.",
179
+ "name": "scopeJson",
180
+ "synonyms": "filters, scope, search filters, filter json",
181
+ "type": "string"
182
+ },
183
+ {
184
+ "default": 0.0,
185
+ "description": "When the query was run.",
186
+ "name": "createdAt",
187
+ "synonyms": "timestamp, searched at, date",
188
+ "type": "number"
189
+ },
190
+ {
191
+ "default": [],
192
+ "description": "Scratch: configured module keys still awaiting a fan-out request.",
193
+ "items": {
194
+ "type": "string"
195
+ },
196
+ "name": "pendingModules",
197
+ "synonyms": "remaining modules, queue",
198
+ "type": "array"
199
+ },
200
+ {
201
+ "default": 0.0,
202
+ "description": "How many module requests have been emitted for the current query.",
203
+ "name": "requestedCount",
204
+ "synonyms": "fanned out, requests sent",
205
+ "type": "number"
206
+ },
207
+ {
208
+ "default": 0.0,
209
+ "description": "How many modules have answered the current query.",
210
+ "name": "respondedCount",
211
+ "synonyms": "answers received, responses",
212
+ "type": "number"
213
+ },
214
+ {
215
+ "default": false,
216
+ "description": "Scratch: true once every configured module has been sent its request.",
217
+ "name": "fanOutDone",
218
+ "synonyms": "fan-out complete, all requested",
219
+ "type": "boolean"
220
+ },
221
+ {
222
+ "default": false,
223
+ "description": "True while a query is in flight.",
224
+ "name": "searching",
225
+ "synonyms": "loading, in progress, busy",
226
+ "type": "boolean"
227
+ },
228
+ {
229
+ "default": [],
230
+ "description": "Merged answers, one entry per responding module, grouped by moduleKey.",
231
+ "items": {
232
+ "properties": {
233
+ "moduleKey": {
234
+ "name": "moduleKey",
235
+ "required": false,
236
+ "type": "string"
237
+ },
238
+ "receivedAt": {
239
+ "name": "receivedAt",
240
+ "required": false,
241
+ "type": "number"
242
+ },
243
+ "resultsJson": {
244
+ "name": "resultsJson",
245
+ "required": false,
246
+ "type": "string"
247
+ }
248
+ },
249
+ "type": "object"
250
+ },
251
+ "name": "results",
252
+ "synonyms": "grouped results, hits, matches, answers",
253
+ "type": "array"
254
+ },
255
+ {
256
+ "default": "",
257
+ "description": "Display rendering of the grouped results: one \"moduleKey: resultsJson\" line per answering module.",
258
+ "name": "resultsSummary",
259
+ "synonyms": "results text, summary, grouped display",
260
+ "type": "string"
261
+ },
262
+ {
263
+ "default": "",
264
+ "description": "Id of the persisted SearchQuery row for the current query; blank until saved.",
265
+ "name": "savedQueryId",
266
+ "synonyms": "query id, saved search id",
267
+ "type": "string"
268
+ },
269
+ {
270
+ "default": "",
271
+ "description": "Scratch: last failure shown to the user; blank = none.",
272
+ "name": "lastError",
273
+ "synonyms": "error, failure reason",
274
+ "type": "string"
275
+ }
276
+ ],
277
+ "id": "ent_01M2HF5GMNGVKWFSM4E6WE1SAY",
278
+ "name": "SearchQuery",
279
+ "persistence": "persistent"
280
+ },
281
+ "id": "orb_01M2HF5GMNVYV2SQAEAZFVDG76",
282
+ "name": "GlobalSearchOrbital",
283
+ "pages": [
284
+ {
285
+ "id": "pag_01M2HF5GMN5HJY316K81KVBCNE",
286
+ "name": "GlobalSearchPage",
287
+ "path": "/global-search",
288
+ "traits": [
289
+ {
290
+ "ref": "GlobalSearch",
291
+ "refId": "trt_01M2HF5GMNYZN83ARCEMGT2H32"
292
+ },
293
+ {
294
+ "ref": "InlineTypographyRender1",
295
+ "refId": "trt_01M2HF5GMNZQ67R15B1XS75064"
296
+ },
297
+ {
298
+ "ref": "InlineSpinnerRender2",
299
+ "refId": "trt_01M2HF5GMNQ98TN6V15AA4B52H"
300
+ },
301
+ {
302
+ "ref": "InlineTypographyRender3",
303
+ "refId": "trt_01M2HF5GMN2FE93FP2KKCTC5FB"
304
+ },
305
+ {
306
+ "ref": "InlineTypographyRender4",
307
+ "refId": "trt_01M2HF5GMNH5WR6RWC7C05RFQT"
308
+ }
309
+ ]
310
+ }
311
+ ],
312
+ "traits": [
313
+ {
314
+ "capabilities": [
315
+ "discovery",
316
+ "search"
317
+ ],
318
+ "category": "lifecycle",
319
+ "config": {
320
+ "modules": {
321
+ "default": "",
322
+ "description": "Comma-separated module keys to fan each query out to (e.g. \"contacts,projects,invoices\"). Each key gets one scoped MODULE_SEARCH_REQUESTED; the module owning a key subscribes to it and answers with SEARCH_RESULTS. Empty = no fan-out (the query is still persisted to history).",
323
+ "label": "Modules to search",
324
+ "synonyms": "search modules, search scope, sources, providers, search providers, indexes, search targets, modules",
325
+ "tier": "internal",
326
+ "type": "string"
327
+ },
328
+ "placeholder": {
329
+ "default": "Search across modules…",
330
+ "description": "Hint text in the search input.",
331
+ "label": "Search placeholder",
332
+ "synonyms": "placeholder, hint text, input hint",
333
+ "tier": "presentation",
334
+ "type": "string"
335
+ },
336
+ "saveHistory": {
337
+ "default": true,
338
+ "description": "Persist each query as a SearchQuery row so recent and saved searches survive reloads.",
339
+ "label": "Keep recent searches",
340
+ "synonyms": "search history, recent searches, saved searches, remember searches, keep history",
341
+ "tier": "policy",
342
+ "type": "boolean"
343
+ }
344
+ },
345
+ "effectRow": [
346
+ {
347
+ "kind": "emit",
348
+ "resource": "FAN_OUT_STEP"
349
+ },
350
+ {
351
+ "kind": "emit",
352
+ "resource": "GLOBAL_SEARCH_COMPLETED"
353
+ },
354
+ {
355
+ "kind": "emit",
356
+ "resource": "MODULE_SEARCH_REQUESTED"
357
+ },
358
+ {
359
+ "kind": "fetch",
360
+ "resource": "SearchQuery"
361
+ },
362
+ {
363
+ "kind": "persist",
364
+ "resource": "SearchQuery"
365
+ },
366
+ {
367
+ "kind": "render-ui",
368
+ "resource": "main"
369
+ },
370
+ {
371
+ "kind": "render-ui",
372
+ "resource": "toast"
373
+ },
374
+ {
375
+ "kind": "set",
376
+ "resource": "@entity.createdAt"
377
+ },
378
+ {
379
+ "kind": "set",
380
+ "resource": "@entity.fanOutDone"
381
+ },
382
+ {
383
+ "kind": "set",
384
+ "resource": "@entity.lastError"
385
+ },
386
+ {
387
+ "kind": "set",
388
+ "resource": "@entity.pendingModules"
389
+ },
390
+ {
391
+ "kind": "set",
392
+ "resource": "@entity.personId"
393
+ },
394
+ {
395
+ "kind": "set",
396
+ "resource": "@entity.queryText"
397
+ },
398
+ {
399
+ "kind": "set",
400
+ "resource": "@entity.requestedCount"
401
+ },
402
+ {
403
+ "kind": "set",
404
+ "resource": "@entity.respondedCount"
405
+ },
406
+ {
407
+ "kind": "set",
408
+ "resource": "@entity.results"
409
+ },
410
+ {
411
+ "kind": "set",
412
+ "resource": "@entity.resultsSummary"
413
+ },
414
+ {
415
+ "kind": "set",
416
+ "resource": "@entity.savedQueryId"
417
+ },
418
+ {
419
+ "kind": "set",
420
+ "resource": "@entity.scopeJson"
421
+ },
422
+ {
423
+ "kind": "set",
424
+ "resource": "@entity.searching"
425
+ },
426
+ {
427
+ "kind": "set",
428
+ "resource": "@entity.typeFilter"
429
+ }
430
+ ],
431
+ "emits": [
432
+ {
433
+ "description": "The query as submitted — re-broadcast so downstream listeners (recent-searches trays, analytics) can react without intercepting the input",
434
+ "event": "SEARCH",
435
+ "eventId": "evt_01M2HF5GMNSJYN4RP8WVXTB1ES",
436
+ "payloadSchema": [
437
+ {
438
+ "name": "queryText",
439
+ "type": "string"
440
+ },
441
+ {
442
+ "name": "typeFilter",
443
+ "type": "string"
444
+ },
445
+ {
446
+ "name": "scopeJson",
447
+ "type": "string"
448
+ },
449
+ {
450
+ "name": "value",
451
+ "type": "string"
452
+ },
453
+ {
454
+ "name": "searchTerm",
455
+ "type": "string"
456
+ }
457
+ ],
458
+ "scope": "external",
459
+ "tier": "essential"
460
+ },
461
+ {
462
+ "description": "One per configured module key — the module owning that key runs its own search and answers with SEARCH_RESULTS",
463
+ "event": "MODULE_SEARCH_REQUESTED",
464
+ "eventId": "evt_01M2HF5GMNGMY75CAME4DJCNH7",
465
+ "payloadSchema": [
466
+ {
467
+ "name": "moduleKey",
468
+ "type": "string"
469
+ },
470
+ {
471
+ "name": "queryText",
472
+ "type": "string"
473
+ },
474
+ {
475
+ "name": "typeFilter",
476
+ "type": "string"
477
+ },
478
+ {
479
+ "name": "scopeJson",
480
+ "type": "string"
481
+ }
482
+ ],
483
+ "scope": "external",
484
+ "tier": "essential"
485
+ },
486
+ {
487
+ "description": "Every requested module has answered; the grouped view is final",
488
+ "event": "GLOBAL_SEARCH_COMPLETED",
489
+ "eventId": "evt_01M2HF5GMNP8V3F758G3B5HH7M",
490
+ "payloadSchema": [
491
+ {
492
+ "name": "queryText",
493
+ "type": "string"
494
+ },
495
+ {
496
+ "name": "moduleCount",
497
+ "type": "number"
498
+ },
499
+ {
500
+ "name": "respondedCount",
501
+ "type": "number"
502
+ }
503
+ ],
504
+ "scope": "external",
505
+ "tier": "secondary"
506
+ },
507
+ {
508
+ "description": "The query persisted to search history",
509
+ "event": "QUERY_SAVED",
510
+ "eventId": "evt_01M2HF5GMNZ50T4QQD0RMJC0S8",
511
+ "payloadSchema": [
512
+ {
513
+ "name": "id",
514
+ "required": true,
515
+ "type": "string"
516
+ }
517
+ ],
518
+ "scope": "external",
519
+ "tier": "secondary"
520
+ },
521
+ {
522
+ "description": "Persisting the query failed — the search itself is unaffected",
523
+ "event": "QUERY_SAVE_FAILED",
524
+ "eventId": "evt_01M2HF5GMNAKMT2RRYB0ZGZS6Z",
525
+ "payloadSchema": [
526
+ {
527
+ "name": "error",
528
+ "required": true,
529
+ "type": "string"
530
+ }
531
+ ],
532
+ "scope": "external",
533
+ "tier": "secondary"
534
+ },
535
+ {
536
+ "description": "Internal sentinel draining the module queue, one MODULE_SEARCH_REQUESTED per pass; `remaining` is the queue length after the last seed/drop",
537
+ "event": "FAN_OUT_STEP",
538
+ "eventId": "evt_01M2HF5GMNCGC1A1JPXVA31JJ1",
539
+ "payloadSchema": [
540
+ {
541
+ "name": "remaining",
542
+ "type": "number"
543
+ }
544
+ ],
545
+ "tier": "internal"
546
+ }
547
+ ],
548
+ "entityContract": {
549
+ "provides": [
550
+ "fanOutDone",
551
+ "lastError",
552
+ "pendingModules",
553
+ "personId",
554
+ "queryText",
555
+ "requestedCount",
556
+ "respondedCount",
557
+ "results",
558
+ "resultsSummary",
559
+ "savedQueryId",
560
+ "scopeJson",
561
+ "searching",
562
+ "typeFilter"
563
+ ],
564
+ "requires": []
565
+ },
566
+ "entityRebindable": true,
567
+ "entityRefIds": {
568
+ "SearchQuery": "ent_01M2HF5GMNGVKWFSM4E6WE1SAY"
569
+ },
570
+ "id": "trt_01M2HF5GMNYZN83ARCEMGT2H32",
571
+ "linkedEntity": "SearchQuery",
572
+ "linkedEntityId": "ent_01M2HF5GMNGVKWFSM4E6WE1SAY",
573
+ "name": "GlobalSearch",
574
+ "scope": "instance",
575
+ "stateMachine": {
576
+ "events": [
577
+ {
578
+ "id": "evt_01M2HF5GMN6JSD7G1NETHYTHQR",
579
+ "key": "INIT",
580
+ "name": "Initialize"
581
+ },
582
+ {
583
+ "description": "The query as submitted — re-broadcast so downstream listeners (recent-searches trays, analytics) can react without intercepting the input",
584
+ "id": "evt_01M2HF5GMNSJYN4RP8WVXTB1ES",
585
+ "key": "SEARCH",
586
+ "name": "Search",
587
+ "payloadSchema": [
588
+ {
589
+ "name": "queryText",
590
+ "type": "string"
591
+ },
592
+ {
593
+ "name": "typeFilter",
594
+ "type": "string"
595
+ },
596
+ {
597
+ "name": "scopeJson",
598
+ "type": "string"
599
+ },
600
+ {
601
+ "name": "value",
602
+ "type": "string"
603
+ },
604
+ {
605
+ "name": "searchTerm",
606
+ "type": "string"
607
+ }
608
+ ],
609
+ "tier": "essential"
610
+ },
611
+ {
612
+ "description": "Internal sentinel draining the module queue, one MODULE_SEARCH_REQUESTED per pass; `remaining` is the queue length after the last seed/drop",
613
+ "id": "evt_01M2HF5GMNCGC1A1JPXVA31JJ1",
614
+ "key": "FAN_OUT_STEP",
615
+ "name": "Fan Out Step",
616
+ "payloadSchema": [
617
+ {
618
+ "name": "remaining",
619
+ "type": "number"
620
+ }
621
+ ],
622
+ "tier": "internal"
623
+ },
624
+ {
625
+ "id": "evt_01M2HF5GMNEB63359FQVKBKN3V",
626
+ "key": "SEARCH_RESULTS",
627
+ "name": "Search Results",
628
+ "payloadSchema": [
629
+ {
630
+ "name": "moduleKey",
631
+ "type": "string"
632
+ },
633
+ {
634
+ "name": "resultsJson",
635
+ "type": "string"
636
+ }
637
+ ]
638
+ },
639
+ {
640
+ "description": "The query persisted to search history",
641
+ "id": "evt_01M2HF5GMNZ50T4QQD0RMJC0S8",
642
+ "key": "QUERY_SAVED",
643
+ "name": "Query Saved",
644
+ "payloadSchema": [
645
+ {
646
+ "name": "id",
647
+ "required": true,
648
+ "type": "string"
649
+ }
650
+ ],
651
+ "tier": "secondary"
652
+ },
653
+ {
654
+ "description": "Persisting the query failed — the search itself is unaffected",
655
+ "id": "evt_01M2HF5GMNAKMT2RRYB0ZGZS6Z",
656
+ "key": "QUERY_SAVE_FAILED",
657
+ "name": "Query Save Failed",
658
+ "payloadSchema": [
659
+ {
660
+ "name": "error",
661
+ "required": true,
662
+ "type": "string"
663
+ }
664
+ ],
665
+ "tier": "secondary"
666
+ },
667
+ {
668
+ "description": "One per configured module key — the module owning that key runs its own search and answers with SEARCH_RESULTS",
669
+ "id": "evt_01M2HF5GMNGMY75CAME4DJCNH7",
670
+ "key": "MODULE_SEARCH_REQUESTED",
671
+ "name": "Module Search Requested",
672
+ "payloadSchema": [
673
+ {
674
+ "name": "moduleKey",
675
+ "type": "string"
676
+ },
677
+ {
678
+ "name": "queryText",
679
+ "type": "string"
680
+ },
681
+ {
682
+ "name": "typeFilter",
683
+ "type": "string"
684
+ },
685
+ {
686
+ "name": "scopeJson",
687
+ "type": "string"
688
+ }
689
+ ],
690
+ "tier": "essential"
691
+ },
692
+ {
693
+ "description": "Every requested module has answered; the grouped view is final",
694
+ "id": "evt_01M2HF5GMNP8V3F758G3B5HH7M",
695
+ "key": "GLOBAL_SEARCH_COMPLETED",
696
+ "name": "Global Search Completed",
697
+ "payloadSchema": [
698
+ {
699
+ "name": "queryText",
700
+ "type": "string"
701
+ },
702
+ {
703
+ "name": "moduleCount",
704
+ "type": "number"
705
+ },
706
+ {
707
+ "name": "respondedCount",
708
+ "type": "number"
709
+ }
710
+ ],
711
+ "tier": "secondary"
712
+ }
713
+ ],
714
+ "states": [
715
+ {
716
+ "isInitial": true,
717
+ "name": "idle"
718
+ },
719
+ {
720
+ "name": "searching"
721
+ }
722
+ ],
723
+ "transitions": [
724
+ {
725
+ "effects": [
726
+ [
727
+ "fetch",
728
+ "SearchQuery"
729
+ ],
730
+ [
731
+ "render-ui",
732
+ "main",
733
+ {
734
+ "children": [
735
+ {
736
+ "event": "SEARCH",
737
+ "placeholder": "@config.placeholder",
738
+ "type": "search-input"
739
+ },
740
+ "@trait.InlineTypographyRender1"
741
+ ],
742
+ "direction": "vertical",
743
+ "gap": "md",
744
+ "type": "stack"
745
+ }
746
+ ]
747
+ ],
748
+ "event": "INIT",
749
+ "eventId": "evt_01M2HF5GMN6JSD7G1NETHYTHQR",
750
+ "from": "idle",
751
+ "to": "idle"
752
+ },
753
+ {
754
+ "effects": [
755
+ [
756
+ "set",
757
+ "@entity.queryText",
758
+ [
759
+ "str/default",
760
+ "@payload.queryText",
761
+ [
762
+ "str/default",
763
+ "@payload.value",
764
+ "@payload.searchTerm"
765
+ ]
766
+ ]
767
+ ],
768
+ [
769
+ "set",
770
+ "@entity.typeFilter",
771
+ [
772
+ "str/default",
773
+ "@payload.typeFilter",
774
+ ""
775
+ ]
776
+ ],
777
+ [
778
+ "set",
779
+ "@entity.scopeJson",
780
+ [
781
+ "str/default",
782
+ "@payload.scopeJson",
783
+ ""
784
+ ]
785
+ ],
786
+ [
787
+ "set",
788
+ "@entity.personId",
789
+ "@user.id"
790
+ ],
791
+ [
792
+ "set",
793
+ "@entity.createdAt",
794
+ "@now"
795
+ ],
796
+ [
797
+ "set",
798
+ "@entity.pendingModules",
799
+ [
800
+ "array/filter",
801
+ [
802
+ "array/map",
803
+ [
804
+ "str/split",
805
+ "@config.modules",
806
+ ","
807
+ ],
808
+ [
809
+ "fn",
810
+ "m",
811
+ [
812
+ "str/trim",
813
+ "@m"
814
+ ]
815
+ ]
816
+ ],
817
+ [
818
+ "fn",
819
+ "m",
820
+ [
821
+ "!=",
822
+ "@m",
823
+ ""
824
+ ]
825
+ ]
826
+ ]
827
+ ],
828
+ [
829
+ "set",
830
+ "@entity.requestedCount",
831
+ 0.0
832
+ ],
833
+ [
834
+ "set",
835
+ "@entity.respondedCount",
836
+ 0.0
837
+ ],
838
+ [
839
+ "set",
840
+ "@entity.fanOutDone",
841
+ false
842
+ ],
843
+ [
844
+ "set",
845
+ "@entity.searching",
846
+ true
847
+ ],
848
+ [
849
+ "set",
850
+ "@entity.results",
851
+ []
852
+ ],
853
+ [
854
+ "set",
855
+ "@entity.resultsSummary",
856
+ ""
857
+ ],
858
+ [
859
+ "set",
860
+ "@entity.lastError",
861
+ ""
862
+ ],
863
+ [
864
+ "when",
865
+ "@config.saveHistory",
866
+ [
867
+ "persist",
868
+ "create",
869
+ "SearchQuery",
870
+ {
871
+ "createdAt": "@entity.createdAt",
872
+ "personId": "@entity.personId",
873
+ "queryText": "@entity.queryText",
874
+ "scopeJson": "@entity.scopeJson",
875
+ "typeFilter": "@entity.typeFilter"
876
+ },
877
+ {
878
+ "emit": {
879
+ "failure": "QUERY_SAVE_FAILED",
880
+ "success": "QUERY_SAVED"
881
+ }
882
+ }
883
+ ]
884
+ ],
885
+ [
886
+ "when",
887
+ [
888
+ ">",
889
+ [
890
+ "array/len",
891
+ "@entity.pendingModules"
892
+ ],
893
+ 0.0
894
+ ],
895
+ [
896
+ "emit",
897
+ "FAN_OUT_STEP",
898
+ {
899
+ "remaining": [
900
+ "array/len",
901
+ "@entity.pendingModules"
902
+ ]
903
+ }
904
+ ]
905
+ ],
906
+ [
907
+ "render-ui",
908
+ "main",
909
+ {
910
+ "children": [
911
+ {
912
+ "event": "SEARCH",
913
+ "placeholder": "@config.placeholder",
914
+ "type": "search-input"
915
+ },
916
+ {
917
+ "align": "center",
918
+ "children": [
919
+ "@trait.InlineSpinnerRender2",
920
+ "@trait.InlineTypographyRender3"
921
+ ],
922
+ "direction": "horizontal",
923
+ "gap": "sm",
924
+ "type": "stack"
925
+ }
926
+ ],
927
+ "direction": "vertical",
928
+ "gap": "md",
929
+ "type": "stack"
930
+ }
931
+ ]
932
+ ],
933
+ "event": "SEARCH",
934
+ "eventId": "evt_01M2HF5GMNSJYN4RP8WVXTB1ES",
935
+ "from": "idle",
936
+ "to": "searching"
937
+ },
938
+ {
939
+ "effects": [
940
+ [
941
+ "set",
942
+ "@entity.queryText",
943
+ [
944
+ "str/default",
945
+ "@payload.queryText",
946
+ [
947
+ "str/default",
948
+ "@payload.value",
949
+ "@payload.searchTerm"
950
+ ]
951
+ ]
952
+ ],
953
+ [
954
+ "set",
955
+ "@entity.typeFilter",
956
+ [
957
+ "str/default",
958
+ "@payload.typeFilter",
959
+ ""
960
+ ]
961
+ ],
962
+ [
963
+ "set",
964
+ "@entity.scopeJson",
965
+ [
966
+ "str/default",
967
+ "@payload.scopeJson",
968
+ ""
969
+ ]
970
+ ],
971
+ [
972
+ "set",
973
+ "@entity.personId",
974
+ "@user.id"
975
+ ],
976
+ [
977
+ "set",
978
+ "@entity.createdAt",
979
+ "@now"
980
+ ],
981
+ [
982
+ "set",
983
+ "@entity.pendingModules",
984
+ [
985
+ "array/filter",
986
+ [
987
+ "array/map",
988
+ [
989
+ "str/split",
990
+ "@config.modules",
991
+ ","
992
+ ],
993
+ [
994
+ "fn",
995
+ "m",
996
+ [
997
+ "str/trim",
998
+ "@m"
999
+ ]
1000
+ ]
1001
+ ],
1002
+ [
1003
+ "fn",
1004
+ "m",
1005
+ [
1006
+ "!=",
1007
+ "@m",
1008
+ ""
1009
+ ]
1010
+ ]
1011
+ ]
1012
+ ],
1013
+ [
1014
+ "set",
1015
+ "@entity.requestedCount",
1016
+ 0.0
1017
+ ],
1018
+ [
1019
+ "set",
1020
+ "@entity.respondedCount",
1021
+ 0.0
1022
+ ],
1023
+ [
1024
+ "set",
1025
+ "@entity.fanOutDone",
1026
+ false
1027
+ ],
1028
+ [
1029
+ "set",
1030
+ "@entity.searching",
1031
+ true
1032
+ ],
1033
+ [
1034
+ "set",
1035
+ "@entity.results",
1036
+ []
1037
+ ],
1038
+ [
1039
+ "set",
1040
+ "@entity.resultsSummary",
1041
+ ""
1042
+ ],
1043
+ [
1044
+ "set",
1045
+ "@entity.lastError",
1046
+ ""
1047
+ ],
1048
+ [
1049
+ "when",
1050
+ "@config.saveHistory",
1051
+ [
1052
+ "persist",
1053
+ "create",
1054
+ "SearchQuery",
1055
+ {
1056
+ "createdAt": "@entity.createdAt",
1057
+ "personId": "@entity.personId",
1058
+ "queryText": "@entity.queryText",
1059
+ "scopeJson": "@entity.scopeJson",
1060
+ "typeFilter": "@entity.typeFilter"
1061
+ },
1062
+ {
1063
+ "emit": {
1064
+ "failure": "QUERY_SAVE_FAILED",
1065
+ "success": "QUERY_SAVED"
1066
+ }
1067
+ }
1068
+ ]
1069
+ ],
1070
+ [
1071
+ "when",
1072
+ [
1073
+ ">",
1074
+ [
1075
+ "array/len",
1076
+ "@entity.pendingModules"
1077
+ ],
1078
+ 0.0
1079
+ ],
1080
+ [
1081
+ "emit",
1082
+ "FAN_OUT_STEP",
1083
+ {
1084
+ "remaining": [
1085
+ "array/len",
1086
+ "@entity.pendingModules"
1087
+ ]
1088
+ }
1089
+ ]
1090
+ ]
1091
+ ],
1092
+ "event": "SEARCH",
1093
+ "eventId": "evt_01M2HF5GMNSJYN4RP8WVXTB1ES",
1094
+ "from": "searching",
1095
+ "to": "searching"
1096
+ },
1097
+ {
1098
+ "effects": [
1099
+ [
1100
+ "emit",
1101
+ "MODULE_SEARCH_REQUESTED",
1102
+ {
1103
+ "moduleKey": [
1104
+ "array/first",
1105
+ "@entity.pendingModules"
1106
+ ],
1107
+ "queryText": "@entity.queryText",
1108
+ "scopeJson": "@entity.scopeJson",
1109
+ "typeFilter": "@entity.typeFilter"
1110
+ }
1111
+ ],
1112
+ [
1113
+ "set",
1114
+ "@entity.requestedCount",
1115
+ [
1116
+ "+",
1117
+ "@entity.requestedCount",
1118
+ 1.0
1119
+ ]
1120
+ ],
1121
+ [
1122
+ "set",
1123
+ "@entity.pendingModules",
1124
+ [
1125
+ "array/drop",
1126
+ "@entity.pendingModules",
1127
+ 1.0
1128
+ ]
1129
+ ],
1130
+ [
1131
+ "when",
1132
+ [
1133
+ "=",
1134
+ [
1135
+ "array/len",
1136
+ "@entity.pendingModules"
1137
+ ],
1138
+ 0.0
1139
+ ],
1140
+ [
1141
+ "set",
1142
+ "@entity.fanOutDone",
1143
+ true
1144
+ ]
1145
+ ],
1146
+ [
1147
+ "when",
1148
+ [
1149
+ ">",
1150
+ [
1151
+ "array/len",
1152
+ "@entity.pendingModules"
1153
+ ],
1154
+ 0.0
1155
+ ],
1156
+ [
1157
+ "emit",
1158
+ "FAN_OUT_STEP",
1159
+ {
1160
+ "remaining": [
1161
+ "array/len",
1162
+ "@entity.pendingModules"
1163
+ ]
1164
+ }
1165
+ ]
1166
+ ]
1167
+ ],
1168
+ "event": "FAN_OUT_STEP",
1169
+ "eventId": "evt_01M2HF5GMNCGC1A1JPXVA31JJ1",
1170
+ "from": "searching",
1171
+ "guard": [
1172
+ ">",
1173
+ "@payload.remaining",
1174
+ 0.0
1175
+ ],
1176
+ "to": "searching"
1177
+ },
1178
+ {
1179
+ "effects": [
1180
+ [
1181
+ "set",
1182
+ "@entity.respondedCount",
1183
+ [
1184
+ "+",
1185
+ "@entity.respondedCount",
1186
+ 1.0
1187
+ ]
1188
+ ],
1189
+ [
1190
+ "set",
1191
+ "@entity.results",
1192
+ [
1193
+ "array/append",
1194
+ "@entity.results",
1195
+ {
1196
+ "moduleKey": "@payload.moduleKey",
1197
+ "receivedAt": "@now",
1198
+ "resultsJson": "@payload.resultsJson"
1199
+ }
1200
+ ]
1201
+ ],
1202
+ [
1203
+ "set",
1204
+ "@entity.resultsSummary",
1205
+ [
1206
+ "str/concat",
1207
+ "@entity.resultsSummary",
1208
+ [
1209
+ "str/concat",
1210
+ "@payload.moduleKey",
1211
+ [
1212
+ "str/concat",
1213
+ ": ",
1214
+ [
1215
+ "str/concat",
1216
+ "@payload.resultsJson",
1217
+ "\n"
1218
+ ]
1219
+ ]
1220
+ ]
1221
+ ]
1222
+ ],
1223
+ [
1224
+ "render-ui",
1225
+ "main",
1226
+ {
1227
+ "children": [
1228
+ {
1229
+ "event": "SEARCH",
1230
+ "placeholder": "@config.placeholder",
1231
+ "type": "search-input"
1232
+ },
1233
+ "@trait.InlineTypographyRender4"
1234
+ ],
1235
+ "direction": "vertical",
1236
+ "gap": "md",
1237
+ "type": "stack"
1238
+ }
1239
+ ],
1240
+ [
1241
+ "when",
1242
+ [
1243
+ "and",
1244
+ "@entity.fanOutDone",
1245
+ [
1246
+ ">=",
1247
+ "@entity.respondedCount",
1248
+ "@entity.requestedCount"
1249
+ ]
1250
+ ],
1251
+ [
1252
+ "do",
1253
+ [
1254
+ "set",
1255
+ "@entity.searching",
1256
+ false
1257
+ ],
1258
+ [
1259
+ "emit",
1260
+ "GLOBAL_SEARCH_COMPLETED",
1261
+ {
1262
+ "moduleCount": "@entity.requestedCount",
1263
+ "queryText": "@entity.queryText",
1264
+ "respondedCount": "@entity.respondedCount"
1265
+ }
1266
+ ]
1267
+ ]
1268
+ ]
1269
+ ],
1270
+ "event": "SEARCH_RESULTS",
1271
+ "eventId": "evt_01M2HF5GMNEB63359FQVKBKN3V",
1272
+ "from": "searching",
1273
+ "to": "searching"
1274
+ },
1275
+ {
1276
+ "effects": [
1277
+ [
1278
+ "set",
1279
+ "@entity.savedQueryId",
1280
+ "@payload.id"
1281
+ ]
1282
+ ],
1283
+ "event": "QUERY_SAVED",
1284
+ "eventId": "evt_01M2HF5GMNZ50T4QQD0RMJC0S8",
1285
+ "from": "searching",
1286
+ "to": "searching"
1287
+ },
1288
+ {
1289
+ "effects": [
1290
+ [
1291
+ "set",
1292
+ "@entity.lastError",
1293
+ "@payload.error"
1294
+ ],
1295
+ [
1296
+ "render-ui",
1297
+ "toast",
1298
+ {
1299
+ "dismissible": true,
1300
+ "message": "Could not save the search to history",
1301
+ "type": "alert",
1302
+ "variant": "warning"
1303
+ }
1304
+ ]
1305
+ ],
1306
+ "event": "QUERY_SAVE_FAILED",
1307
+ "eventId": "evt_01M2HF5GMNAKMT2RRYB0ZGZS6Z",
1308
+ "from": "searching",
1309
+ "to": "searching"
1310
+ }
1311
+ ]
1312
+ },
1313
+ "traitEmbedIds": {
1314
+ "InlineSpinnerRender2": "trt_01M2HF5GMNQ98TN6V15AA4B52H",
1315
+ "InlineTypographyRender1": "trt_01M2HF5GMNZQ67R15B1XS75064",
1316
+ "InlineTypographyRender3": "trt_01M2HF5GMN2FE93FP2KKCTC5FB",
1317
+ "InlineTypographyRender4": "trt_01M2HF5GMNH5WR6RWC7C05RFQT"
1318
+ }
1319
+ },
1320
+ {
1321
+ "config": {
1322
+ "color": {
1323
+ "default": "muted",
1324
+ "type": "unknown"
1325
+ },
1326
+ "content": {
1327
+ "default": "Search across every connected module — results group by module.",
1328
+ "type": "unknown"
1329
+ },
1330
+ "variant": {
1331
+ "default": "caption",
1332
+ "type": "unknown"
1333
+ }
1334
+ },
1335
+ "id": "trt_01M2HF5GMNZQ67R15B1XS75064",
1336
+ "linkedEntity": "SearchQuery",
1337
+ "linkedEntityId": "ent_01M2HF5GMNGVKWFSM4E6WE1SAY",
1338
+ "name": "InlineTypographyRender1",
1339
+ "ref": "Typography.traits.TypographyRender"
1340
+ },
1341
+ {
1342
+ "id": "trt_01M2HF5GMNQ98TN6V15AA4B52H",
1343
+ "linkedEntity": "SearchQuery",
1344
+ "linkedEntityId": "ent_01M2HF5GMNGVKWFSM4E6WE1SAY",
1345
+ "name": "InlineSpinnerRender2",
1346
+ "ref": "Spinner.traits.SpinnerRender"
1347
+ },
1348
+ {
1349
+ "config": {
1350
+ "color": {
1351
+ "default": "muted",
1352
+ "type": "unknown"
1353
+ },
1354
+ "content": {
1355
+ "default": "Searching…",
1356
+ "type": "unknown"
1357
+ },
1358
+ "variant": {
1359
+ "default": "caption",
1360
+ "type": "unknown"
1361
+ }
1362
+ },
1363
+ "id": "trt_01M2HF5GMN2FE93FP2KKCTC5FB",
1364
+ "linkedEntity": "SearchQuery",
1365
+ "linkedEntityId": "ent_01M2HF5GMNGVKWFSM4E6WE1SAY",
1366
+ "name": "InlineTypographyRender3",
1367
+ "ref": "Typography.traits.TypographyRender"
1368
+ },
1369
+ {
1370
+ "config": {
1371
+ "content": {
1372
+ "default": "@entity.resultsSummary",
1373
+ "type": "unknown"
1374
+ },
1375
+ "variant": {
1376
+ "default": "body",
1377
+ "type": "unknown"
1378
+ }
1379
+ },
1380
+ "id": "trt_01M2HF5GMNH5WR6RWC7C05RFQT",
1381
+ "linkedEntity": "SearchQuery",
1382
+ "linkedEntityId": "ent_01M2HF5GMNGVKWFSM4E6WE1SAY",
1383
+ "name": "InlineTypographyRender4",
1384
+ "ref": "Typography.traits.TypographyRender"
1385
+ }
1386
+ ],
1387
+ "types": {
1388
+ "SearchResultGroup": [
1389
+ {
1390
+ "name": "moduleKey",
1391
+ "type": "string"
1392
+ },
1393
+ {
1394
+ "name": "resultsJson",
1395
+ "type": "string"
1396
+ },
1397
+ {
1398
+ "name": "receivedAt",
1399
+ "type": "number"
1400
+ }
1401
+ ]
1402
+ },
1403
+ "uses": [
1404
+ {
1405
+ "as": "Typography",
1406
+ "from": "std/behaviors/ui-typography"
1407
+ },
1408
+ {
1409
+ "as": "Spinner",
1410
+ "from": "std/behaviors/ui-spinner"
1411
+ }
1412
+ ]
1413
+ }
1414
+ ],
1415
+ "schemaVersion": 1,
1416
+ "version": "1.0.0"
1417
+ }