@almadar/std 16.21.2 → 16.21.4

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 (57) hide show
  1. package/behaviors/registry/agent/atoms/std-agent-activity-log.orb +5 -0
  2. package/behaviors/registry/agent/atoms/std-agent-classifier.orb +5 -0
  3. package/behaviors/registry/agent/atoms/std-agent-completion.orb +8 -0
  4. package/behaviors/registry/agent/atoms/std-agent-context-window.orb +9 -0
  5. package/behaviors/registry/agent/atoms/std-agent-memory.orb +5 -0
  6. package/behaviors/registry/agent/atoms/std-agent-provider.orb +8 -0
  7. package/behaviors/registry/agent/atoms/std-agent-search.orb +5 -0
  8. package/behaviors/registry/agent/atoms/std-agent-tool-call.orb +5 -0
  9. package/behaviors/registry/core/atoms/std-app-search.orb +560 -0
  10. package/behaviors/registry/core/atoms/std-autocomplete.orb +382 -0
  11. package/behaviors/registry/core/atoms/std-event-log.orb +15 -0
  12. package/behaviors/registry/core/atoms/std-filter.orb +8 -0
  13. package/behaviors/registry/core/atoms/std-push.orb +7 -0
  14. package/behaviors/registry/core/atoms/std-recurrence.orb +17 -0
  15. package/behaviors/registry/core/atoms/std-search.orb +7 -0
  16. package/behaviors/registry/core/atoms/std-wizard.orb +20 -0
  17. package/behaviors/registry/infra/atoms/std-notify-on-event.orb +82 -57
  18. package/behaviors/registry/infra/atoms/std-status-lifecycle.orb +306 -0
  19. package/dist/behaviors/behaviors-registry.json +447 -11
  20. package/dist/behaviors/registry/agent/atoms/std-agent-activity-log.orb +5 -0
  21. package/dist/behaviors/registry/agent/atoms/std-agent-classifier.orb +5 -0
  22. package/dist/behaviors/registry/agent/atoms/std-agent-completion.orb +8 -0
  23. package/dist/behaviors/registry/agent/atoms/std-agent-context-window.orb +9 -0
  24. package/dist/behaviors/registry/agent/atoms/std-agent-memory.orb +5 -0
  25. package/dist/behaviors/registry/agent/atoms/std-agent-provider.orb +8 -0
  26. package/dist/behaviors/registry/agent/atoms/std-agent-search.orb +5 -0
  27. package/dist/behaviors/registry/agent/atoms/std-agent-tool-call.orb +5 -0
  28. package/dist/behaviors/registry/core/atoms/std-app-search.orb +560 -0
  29. package/dist/behaviors/registry/core/atoms/std-autocomplete.orb +382 -0
  30. package/dist/behaviors/registry/core/atoms/std-event-log.orb +15 -0
  31. package/dist/behaviors/registry/core/atoms/std-filter.orb +8 -0
  32. package/dist/behaviors/registry/core/atoms/std-push.orb +7 -0
  33. package/dist/behaviors/registry/core/atoms/std-recurrence.orb +17 -0
  34. package/dist/behaviors/registry/core/atoms/std-search.orb +7 -0
  35. package/dist/behaviors/registry/core/atoms/std-wizard.orb +20 -0
  36. package/dist/behaviors/registry/infra/atoms/std-notify-on-event.orb +82 -57
  37. package/dist/behaviors/registry/infra/atoms/std-status-lifecycle.orb +306 -0
  38. package/dist/behaviors-registry.json +447 -11
  39. package/dist/registry/agent/atoms/std-agent-activity-log.orb +5 -0
  40. package/dist/registry/agent/atoms/std-agent-classifier.orb +5 -0
  41. package/dist/registry/agent/atoms/std-agent-completion.orb +8 -0
  42. package/dist/registry/agent/atoms/std-agent-context-window.orb +9 -0
  43. package/dist/registry/agent/atoms/std-agent-memory.orb +5 -0
  44. package/dist/registry/agent/atoms/std-agent-provider.orb +8 -0
  45. package/dist/registry/agent/atoms/std-agent-search.orb +5 -0
  46. package/dist/registry/agent/atoms/std-agent-tool-call.orb +5 -0
  47. package/dist/registry/core/atoms/std-app-search.orb +560 -0
  48. package/dist/registry/core/atoms/std-autocomplete.orb +382 -0
  49. package/dist/registry/core/atoms/std-event-log.orb +15 -0
  50. package/dist/registry/core/atoms/std-filter.orb +8 -0
  51. package/dist/registry/core/atoms/std-push.orb +7 -0
  52. package/dist/registry/core/atoms/std-recurrence.orb +17 -0
  53. package/dist/registry/core/atoms/std-search.orb +7 -0
  54. package/dist/registry/core/atoms/std-wizard.orb +20 -0
  55. package/dist/registry/infra/atoms/std-notify-on-event.orb +82 -57
  56. package/dist/registry/infra/atoms/std-status-lifecycle.orb +306 -0
  57. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "std-notify-on-event",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "std-notify-on-event — cross-orbital wiring atom. Subscribes to events from another orbital (e.g. CheckoutOrbital emits OrderPlaced, OrderRecordOrbital reacts via this atom) and dispatches a notification. Use when one orbital needs to react to or be notified about events that happen in another orbital — the wiring goes through this atom's `EventOccurred` listener which the molecule renames via traitOverrides.events to the upstream event name. Resolves recipient from `recipients` (first entry; multi-recipient fan-out is a future extension) or falls back to `@user.id`. Skips dispatch when the recipient is in `suppressionList`. Emits in-app `notify` when `notifyChannel` is `\"in-app\"`, or persists a `NotificationRecord` row for out-of-band delivery when channel is `\"email\"` or `\"sms\"`.",
5
5
  "orbitals": [
6
6
  {
@@ -103,6 +103,10 @@
103
103
  {
104
104
  "name": "data",
105
105
  "type": "object"
106
+ },
107
+ {
108
+ "name": "status",
109
+ "type": "string"
106
110
  }
107
111
  ]
108
112
  },
@@ -134,6 +138,19 @@
134
138
  "from": "idle",
135
139
  "to": "idle",
136
140
  "event": "EventOccurred",
141
+ "guard": [
142
+ "or",
143
+ [
144
+ "=",
145
+ "@config.triggerStatus",
146
+ ""
147
+ ],
148
+ [
149
+ "=",
150
+ "@payload.status",
151
+ "@config.triggerStatus"
152
+ ]
153
+ ],
137
154
  "effects": [
138
155
  [
139
156
  "set",
@@ -222,12 +239,12 @@
222
239
  "create",
223
240
  "NotificationRecord",
224
241
  {
225
- "dispatched": false,
226
242
  "channel": "@config.notifyChannel",
227
- "recordedAt": 0.0,
228
243
  "recipient": "@entity.recipient",
229
- "message": "@config.template",
230
- "severity": "@config.severity"
244
+ "severity": "@config.severity",
245
+ "recordedAt": 0.0,
246
+ "dispatched": false,
247
+ "message": "@config.template"
231
248
  }
232
249
  ]
233
250
  ]
@@ -236,10 +253,10 @@
236
253
  "emit",
237
254
  "NotificationDispatched",
238
255
  {
256
+ "recipient": "@entity.recipient",
239
257
  "channel": "@config.notifyChannel",
240
258
  "severity": "@config.severity",
241
- "message": "@config.template",
242
- "recipient": "@entity.recipient"
259
+ "message": "@config.template"
243
260
  }
244
261
  ]
245
262
  ]
@@ -247,36 +264,65 @@
247
264
  ]
248
265
  },
249
266
  "config": {
250
- "suppressionList": {
267
+ "triggerStatus": {
268
+ "type": "string",
269
+ "default": "",
270
+ "label": "Trigger status",
271
+ "description": "When set, dispatch only when the upstream event's `status` field equals this value (e.g. fire only when a record becomes 'approved'). Empty = fire on every subscribed event.",
272
+ "synonyms": "on status, when status, status filter, only when, fire on, react on status",
273
+ "tier": "policy"
274
+ },
275
+ "quietHours": {
276
+ "type": "QuietHoursSpec",
277
+ "default": {
278
+ "start": "",
279
+ "end": ""
280
+ },
281
+ "label": "Quiet hours",
282
+ "description": "Local-time window during which dispatch is suppressed. Both start and end required to activate. WIRING DEFERRED: needs @now-aware time comparison primitive (gap — docs/Almadar_Std_Factories.md).",
283
+ "tier": "policy",
284
+ "properties": {
285
+ "start": {
286
+ "name": "start",
287
+ "type": "string",
288
+ "required": false
289
+ },
290
+ "end": {
291
+ "name": "end",
292
+ "type": "string",
293
+ "required": false
294
+ }
295
+ }
296
+ },
297
+ "frequencyCapPerWeek": {
298
+ "type": "number",
299
+ "default": 0.0,
300
+ "label": "Frequency cap (per week)",
301
+ "description": "Max sends per (channel, recipient) per rolling 7-day window. 0 = uncapped. WIRING DEFERRED: needs stateful history query (gap — docs/Almadar_Std_Factories.md).",
302
+ "tier": "policy"
303
+ },
304
+ "recipients": {
251
305
  "type": "[string]",
252
306
  "default": [],
253
- "label": "Suppression list",
254
- "description": "Recipient ids/addresses to skip (e.g. unsubscribed users). Suppression check runs before dispatch.",
255
- "synonyms": "block list, unsubscribed, opt-out list",
307
+ "label": "Recipients",
308
+ "description": "Recipient ids/addresses. v1.1 uses the first entry; multi-recipient fan-out lands in v1.2 (gap). When empty, falls back to the authenticated user.",
309
+ "synonyms": "targets, addressees, notify to",
256
310
  "tier": "policy",
257
311
  "items": {
258
312
  "type": "string"
259
313
  }
260
314
  },
261
- "listensFor": {
315
+ "suppressionList": {
262
316
  "type": "[string]",
263
317
  "default": [],
264
- "label": "Trigger events",
265
- "description": "Event names that should fire a notification. Set this to the upstream event name (e.g. OrderPlaced, CheckoutCompleted) so this atom listens for events from the orbital that emits them. The orbital owning this trait reacts whenever the named event fires anywhere in the schema.",
266
- "synonyms": "subscribe to event, listen for event, react to event, watch for, wire upstream event, observe event from another orbital, cross-orbital subscription, on-event trigger",
267
- "tier": "internal",
318
+ "label": "Suppression list",
319
+ "description": "Recipient ids/addresses to skip (e.g. unsubscribed users). Suppression check runs before dispatch.",
320
+ "synonyms": "block list, unsubscribed, opt-out list",
321
+ "tier": "policy",
268
322
  "items": {
269
323
  "type": "string"
270
324
  }
271
325
  },
272
- "template": {
273
- "type": "string",
274
- "default": "",
275
- "label": "Message template",
276
- "description": "Text shown to the recipient; supports payload interpolation",
277
- "synonyms": "notification text, message body, alert text",
278
- "tier": "presentation"
279
- },
280
326
  "notifyChannel": {
281
327
  "type": "string",
282
328
  "default": "in-app",
@@ -285,46 +331,25 @@
285
331
  "synonyms": "delivery method, notification channel, send via, dispatch through",
286
332
  "tier": "policy"
287
333
  },
288
- "frequencyCapPerWeek": {
289
- "type": "number",
290
- "default": 0.0,
291
- "label": "Frequency cap (per week)",
292
- "description": "Max sends per (channel, recipient) per rolling 7-day window. 0 = uncapped. WIRING DEFERRED: needs stateful history query (gap — docs/Almadar_Std_Factories.md).",
293
- "tier": "policy"
334
+ "template": {
335
+ "type": "string",
336
+ "default": "",
337
+ "label": "Message template",
338
+ "description": "Text shown to the recipient; supports payload interpolation",
339
+ "synonyms": "notification text, message body, alert text",
340
+ "tier": "presentation"
294
341
  },
295
- "recipients": {
342
+ "listensFor": {
296
343
  "type": "[string]",
297
344
  "default": [],
298
- "label": "Recipients",
299
- "description": "Recipient ids/addresses. v1.1 uses the first entry; multi-recipient fan-out lands in v1.2 (gap). When empty, falls back to the authenticated user.",
300
- "synonyms": "targets, addressees, notify to",
301
- "tier": "policy",
345
+ "label": "Trigger events",
346
+ "description": "Event names that should fire a notification. Set this to the upstream event name (e.g. OrderPlaced, CheckoutCompleted) so this atom listens for events from the orbital that emits them. The orbital owning this trait reacts whenever the named event fires anywhere in the schema.",
347
+ "synonyms": "subscribe to event, listen for event, react to event, watch for, wire upstream event, observe event from another orbital, cross-orbital subscription, on-event trigger",
348
+ "tier": "internal",
302
349
  "items": {
303
350
  "type": "string"
304
351
  }
305
352
  },
306
- "quietHours": {
307
- "type": "QuietHoursSpec",
308
- "default": {
309
- "start": "",
310
- "end": ""
311
- },
312
- "label": "Quiet hours",
313
- "description": "Local-time window during which dispatch is suppressed. Both start and end required to activate. WIRING DEFERRED: needs @now-aware time comparison primitive (gap — docs/Almadar_Std_Factories.md).",
314
- "tier": "policy",
315
- "properties": {
316
- "start": {
317
- "name": "start",
318
- "type": "string",
319
- "required": false
320
- },
321
- "end": {
322
- "name": "end",
323
- "type": "string",
324
- "required": false
325
- }
326
- }
327
- },
328
353
  "severity": {
329
354
  "type": "string",
330
355
  "default": "info",
@@ -0,0 +1,306 @@
1
+ {
2
+ "name": "std-status-lifecycle",
3
+ "version": "0.1.0",
4
+ "description": "Infra substrate: data-driven entity status lifecycle. The statuses and the allowed transitions are config data over a fixed single-state topology, so a host organism can expand or collapse its lifecycle without forking. Compose onto an entity, rename the ChangeStatusRequested listen to the host's status-change action, and supply `states` + `transitions`. A requested move is validated against the `transitions` table (illegal moves are rejected), then the new value is written to `statusField` on the target entity and StatusChanged is emitted. Surfaces nothing — the host renders the badge and buttons.",
5
+ "orbitals": [
6
+ {
7
+ "name": "StatusLifecycleOrbital",
8
+ "entity": {
9
+ "name": "StatusRecord",
10
+ "collection": "status_records",
11
+ "persistence": "persistent",
12
+ "fields": [
13
+ {
14
+ "name": "id",
15
+ "type": "string",
16
+ "required": true
17
+ },
18
+ {
19
+ "name": "status",
20
+ "type": "string",
21
+ "default": "",
22
+ "description": "Current lifecycle status of the record.",
23
+ "synonyms": "state, stage, phase"
24
+ }
25
+ ]
26
+ },
27
+ "traits": [
28
+ {
29
+ "name": "StatusMachine",
30
+ "entityRebindable": true,
31
+ "entityContract": {
32
+ "requires": [],
33
+ "provides": []
34
+ },
35
+ "category": "lifecycle",
36
+ "linkedEntity": "StatusRecord",
37
+ "emits": [
38
+ {
39
+ "event": "StatusChanged",
40
+ "scope": "external",
41
+ "payloadSchema": [
42
+ {
43
+ "name": "entityId",
44
+ "type": "string"
45
+ },
46
+ {
47
+ "name": "status",
48
+ "type": "string"
49
+ }
50
+ ]
51
+ },
52
+ {
53
+ "event": "StatusChangeFailed",
54
+ "payloadSchema": [
55
+ {
56
+ "name": "error",
57
+ "type": "string"
58
+ },
59
+ {
60
+ "name": "code",
61
+ "type": "string"
62
+ }
63
+ ]
64
+ }
65
+ ],
66
+ "stateMachine": {
67
+ "states": [
68
+ {
69
+ "name": "idle",
70
+ "isInitial": true
71
+ }
72
+ ],
73
+ "events": [
74
+ {
75
+ "key": "ChangeStatusRequested",
76
+ "name": "Change status requested",
77
+ "payloadSchema": [
78
+ {
79
+ "name": "id",
80
+ "type": "string"
81
+ },
82
+ {
83
+ "name": "from",
84
+ "type": "string"
85
+ },
86
+ {
87
+ "name": "to",
88
+ "type": "string"
89
+ }
90
+ ]
91
+ },
92
+ {
93
+ "key": "StatusChangeFailed",
94
+ "name": "Status change failed",
95
+ "payloadSchema": [
96
+ {
97
+ "name": "error",
98
+ "type": "string"
99
+ },
100
+ {
101
+ "name": "code",
102
+ "type": "string"
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ "key": "StatusChanged",
108
+ "name": "Status changed",
109
+ "payloadSchema": [
110
+ {
111
+ "name": "entityId",
112
+ "type": "string"
113
+ },
114
+ {
115
+ "name": "status",
116
+ "type": "string"
117
+ }
118
+ ]
119
+ }
120
+ ],
121
+ "transitions": [
122
+ {
123
+ "from": "idle",
124
+ "to": "idle",
125
+ "event": "ChangeStatusRequested",
126
+ "guard": [
127
+ "and",
128
+ "@config.enabled",
129
+ [
130
+ "array/some",
131
+ "@config.transitions",
132
+ [
133
+ "fn",
134
+ "t",
135
+ [
136
+ "and",
137
+ [
138
+ "=",
139
+ [
140
+ "object/get",
141
+ "@t",
142
+ "from"
143
+ ],
144
+ "@payload.from"
145
+ ],
146
+ [
147
+ "=",
148
+ [
149
+ "object/get",
150
+ "@t",
151
+ "to"
152
+ ],
153
+ "@payload.to"
154
+ ]
155
+ ]
156
+ ]
157
+ ]
158
+ ],
159
+ "effects": [
160
+ [
161
+ "persist",
162
+ "update",
163
+ "@config.targetEntity",
164
+ [
165
+ "object/set",
166
+ {
167
+ "id": "@payload.id"
168
+ },
169
+ "@config.statusField",
170
+ "@payload.to"
171
+ ],
172
+ {
173
+ "emit": {
174
+ "failure": "StatusChangeFailed",
175
+ "success": "StatusChanged"
176
+ }
177
+ }
178
+ ],
179
+ [
180
+ "emit",
181
+ "StatusChanged",
182
+ {
183
+ "status": "@payload.to",
184
+ "entityId": "@payload.id"
185
+ }
186
+ ]
187
+ ]
188
+ },
189
+ {
190
+ "from": "idle",
191
+ "to": "idle",
192
+ "event": "StatusChangeFailed"
193
+ }
194
+ ]
195
+ },
196
+ "config": {
197
+ "enabled": {
198
+ "type": "boolean",
199
+ "default": false,
200
+ "label": "Enforce status lifecycle",
201
+ "description": "Validate and apply status transitions against the configured table. Off by default.",
202
+ "synonyms": "lifecycle, statuses, states, stages, workflow, status transitions, enforce, enable, apply",
203
+ "tier": "infra"
204
+ },
205
+ "statusField": {
206
+ "type": "string",
207
+ "default": "status",
208
+ "label": "Status field",
209
+ "description": "Which entity field this lifecycle drives. Defaults to 'status'; set it to bind any field (e.g. 'state', 'stage', 'phase').",
210
+ "synonyms": "state field, stage field, status column, lifecycle field",
211
+ "tier": "domain"
212
+ },
213
+ "transitions": {
214
+ "type": "[TransitionSpec]",
215
+ "default": [
216
+ {
217
+ "to": "active",
218
+ "from": "draft",
219
+ "event": "ACTIVATE",
220
+ "label": "Activate"
221
+ },
222
+ {
223
+ "from": "active",
224
+ "label": "Archive",
225
+ "event": "ARCHIVE",
226
+ "to": "archived"
227
+ }
228
+ ],
229
+ "label": "Allowed transitions",
230
+ "description": "The legal moves: each row is { from, to, event, label }. A requested move is applied only if it matches a row.",
231
+ "synonyms": "edges, allowed moves, status flow, workflow transitions",
232
+ "tier": "domain",
233
+ "items": {
234
+ "type": "object",
235
+ "properties": {
236
+ "event": {
237
+ "name": "event",
238
+ "type": "string",
239
+ "required": false
240
+ },
241
+ "label": {
242
+ "name": "label",
243
+ "type": "string",
244
+ "required": false
245
+ },
246
+ "to": {
247
+ "name": "to",
248
+ "type": "string",
249
+ "required": true
250
+ },
251
+ "from": {
252
+ "name": "from",
253
+ "type": "string",
254
+ "required": true
255
+ }
256
+ }
257
+ }
258
+ },
259
+ "states": {
260
+ "type": "[string]",
261
+ "default": [
262
+ "draft",
263
+ "active",
264
+ "archived"
265
+ ],
266
+ "label": "Statuses",
267
+ "description": "The closed set of statuses a record can hold.",
268
+ "synonyms": "states, stages, phases, statuses, lifecycle, workflow steps",
269
+ "tier": "domain",
270
+ "items": {
271
+ "type": "string"
272
+ }
273
+ },
274
+ "targetEntity": {
275
+ "type": "string",
276
+ "default": "StatusRecord",
277
+ "label": "Target entity",
278
+ "description": "Entity name whose status field this lifecycle drives (e.g. 'Contract'). Defaults to the atom's own record so the standalone validates; rebind per composition.",
279
+ "tier": "internal"
280
+ },
281
+ "initialStatus": {
282
+ "type": "string",
283
+ "default": "draft",
284
+ "label": "Initial status",
285
+ "description": "The status a new record starts in.",
286
+ "synonyms": "starting state, default status, first stage",
287
+ "tier": "domain"
288
+ }
289
+ },
290
+ "scope": "instance"
291
+ }
292
+ ],
293
+ "pages": [
294
+ {
295
+ "name": "StatusLifecyclePage",
296
+ "path": "/status-lifecycle",
297
+ "traits": [
298
+ {
299
+ "ref": "StatusMachine"
300
+ }
301
+ ]
302
+ }
303
+ ]
304
+ }
305
+ ]
306
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/std",
3
- "version": "16.21.2",
3
+ "version": "16.21.4",
4
4
  "description": "Standard library operators for Almadar (math, string, array, etc.)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",