@mhome/app-facade-protocol 1.186.0 → 1.188.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.
@@ -8,6 +8,7 @@ Full and Essential use the same business read scope; UI requests Full.
8
8
  | --- | --- | --- |
9
9
  | `/app/presentation/automation/names/get` | `{ids}`: one or more selected, trimmed/deduplicated IDs | `{automations: {id: label}}`. Missing IDs omitted. Selected definition metadata only; no source downloads, parsing, state, history or graph reads. |
10
10
  | `/app/presentation/automation/list` | `{type: "RECURRING" \| "TASK_FLOW"}` | `{automations}`: current-type regular user programs, with labels, runnable/last-execution/expiry metadata, enabled/running/blocked, last-run `timestamp`, status timestamps and tags. No temporary-program, Group, Widget, snapshot, graph or authored-source expansion. |
11
+ | `/app/presentation/automation/group-candidates/list` | `{}` | `{candidates:[{entityId,name}]}`: runnable regular Recurring programs eligible for Automation Groups. Uses the same eligibility predicate as membership validation; excludes temporary, generated and Group IDs. Reads stored metadata only, without source, runtime state or history. UI displays the returned candidates without rebuilding eligibility. |
11
12
  | `/app/presentation/automation/overview/get` | `{automationId}`: nonblank, trimmed | `{id,name,type,enabled,runnable,lastExecution,blocked,saveIncomplete?,widgets}`. Selected metadata, status, cloud quota display state and owned Widget configuration/current values. No source, graph traversal, running history or snapshots. Missing definition is not-found. |
12
13
  | `/app/presentation/automation/placements/get` | `{automationId}`: nonblank, trimmed | `{canvases:[{id,name,containsAutomation}]}`. Matches both owned Widget-to-Card relations and dedicated Automation Cards by `meta.automationId`, against Canvas leaf IDs including composition members. Backends read current-Space Card records to resolve these business references; responses contain only Canvas labels and membership flags. Retains existing default-canvas initialization when the Space has none. |
13
14
 
@@ -40,17 +41,17 @@ The frontend loads only the active list type, caches visited types within the
40
41
  active Space, applies realtime events to loaded rows, and invalidates inactive
41
42
  caches on incomplete updates or reconnect. Unloaded tab counts are unknown,
42
43
  not zero. Overview and placements are separate on-demand reads. Snapshot panels
43
- continue using `/app/automation/snapshot/list` only when opened.
44
+ continue using `/app/automation/snapshot/list` only when opened. This endpoint returns the newest 100 saved version summaries in both Full and Essential, never executable source or restore configuration. Rollback loads the selected source internally; backup/sync retain independent complete readers.
44
45
 
45
46
  Automation detail includes `runnable` from its already-loaded definition; Group
46
- entries omit it. Automation status includes `corrupted` from the existing status
47
+ entries omit it. Automation status exposes the current revision's `lastExecution`, when known,
47
48
  and temporary `expireAt` from creation/last-run timestamps. Ordinary configuration
48
49
  editor initialization supplies the metadata it already loaded, so subsequent
49
50
  runtime hydration only needs status.
50
51
 
51
52
  ## Selected summaries and configuration editing
52
53
 
53
- `/app/presentation/automation/summaries/get` accepts the same bounded selected
54
+ `/app/presentation/automation/summaries/get` accepts the same selected
54
55
  `{ids}` as names. It returns `{items:[{requestedId,found,resource}]}` in normalized input
55
56
  order. A found resource contains ListItem fields plus `automationId`, `temp`,
56
57
  nullable `lastRunAt` and `expireAt`. Missing items omit resource. It supports
@@ -63,7 +64,7 @@ also uses metadata rather than downloading authored source.
63
64
  | `/app/presentation/automation/overview/init` | `{automationId?,inspireId?,inspireVersion?,snapshotId?,args?}` | Existing editor session, required installs, AutomationOverview and already-loaded metadata. Snapshot takes precedence over existing program, then Inspire. Uses the authenticated Client and existing staged-Inspire developer session. |
64
65
  | `/app/presentation/automation/overview/config/provide` | `{sessionId,var,input}` | Existing option query and editor revision. |
65
66
  | `/app/presentation/automation/overview/config/update` | `{sessionId,var,inputs?,widgetize?}` | Existing config evaluation, diagnostics and revision. |
66
- | `/app/presentation/automation/overview/save` | `{sessionId,automationId?,inspireId?,inspireVersion?,snapshotId?,preferredName?,debug?,addCard?,canvasIds?}` | `{automationId,runnable,enabled}`. Existing single-save guard, Client ownership, prepare/save/complete revision checks and internal normalized-source persistence. Legacy snapshotId/addCard/canvasIds are accepted but do not perform placement; frontend creates placements separately. |
67
+ | `/app/presentation/automation/overview/save` | `{sessionId,automationId?,inspireId?,inspireVersion?,snapshotId?,preferredName?,debug?,addCard?,canvasIds?}` | `{automationId,runnable,enabled?,restoreIssue?}`. Updating an existing definition preserves its previous enabled intent; restoration runs after releasing the edit lock, is fenced by the saved revision, and cannot override a newer stop. A committed save with failed/unconfirmed restoration or an unavailable post-save enabled observation returns `partial`; unknown enabled is omitted. New saves retain existing creation semantics and saving never triggers a Task Flow. Existing single-save guard, Client ownership, prepare/save/complete revision checks and internal normalized-source persistence. Legacy snapshotId/addCard/canvasIds are accepted but do not perform placement; frontend creates placements separately. |
67
68
  | `/app/presentation/automation/overview/cancel` | `{sessionId}` | Canonical acknowledgement without data. Existing Client ownership check and session cleanup. |
68
69
  | `/app/presentation/automation/copy` | `{automationId,name?}` | `{automationId,runnable,enabled}`. Copies the existing script/template metadata using the internal save operation. |
69
70
  | `/app/presentation/automation/enroll` | `{automationId,name?}` | `{automationId,runnable,enabled}`. Existing enrollment behavior. |
@@ -124,3 +125,5 @@ internal context/condition evaluation and wait setup/cleanup may remain generic.
124
125
  unclassified fatal runtime fault must not reuse a prior handled action's reason.
125
126
  Old generated Plans can remain generic until normal regeneration; no automatic
126
127
  migration is required. The summary is independent of diagnostic-log retention.
128
+
129
+ Selected definition detail parses saved YAML only when its declared metadata is required. Failed optional parsing preserves the known definition and source/hash, attaches an ID-scoped problem, and omits unknown inputVars/descriptionTemplate. Corrupt stored JSON is not an empty source or capability list; strict dependent operations fail rather than rewriting fabricated values. No derived-metadata cache or extra database fields are required.
@@ -27,7 +27,8 @@ Generated Twin and Group programs remain internal resources.
27
27
 
28
28
  Inputs are closed objects. The schema is `schema/automation.v1.schema.json`.
29
29
 
30
- For `/app/automation/save` and `/app/automation/snapshot/rollback`, the definition
30
+ For `/app/automation/save`, `/app/presentation/automation/overview/save` and
31
+ `/app/automation/snapshot/rollback`, the definition
31
32
  is committed before the optional attempt to restore the enabled state. If that
32
33
  attempt is rejected or unconfirmed, the Facade returns `partial` with the
33
34
  Automation ID and `restoreIssue` (`failed` or `unconfirmed`). Rollback also
@@ -71,11 +71,28 @@ second durable outbox, reasoning replay or write replay.
71
71
 
72
72
  ## Generic content and validation
73
73
 
74
- `SuggestionDraft<C>` contains title, summary, reasons, evidence, optional expiry,
75
- and flattened content selected by `type`. `Suggestion<C>` adds backend-owned
76
- identity, Space, run, version, lifecycle, millisecond timestamps and resolution.
77
- The generator cannot assign those backend fields. A suggested expiry is checked
78
- against admission/publication time before persistence.
74
+ `SuggestionDraft<C>` contains title, summary, reasons, evidence, optional `audience`
75
+ (defaulting to `{"kind":"space"}`), optional expiry, and flattened content selected
76
+ by `type`. `Suggestion<C>` adds backend-owned identity, Space, run, version, lifecycle,
77
+ millisecond timestamps and resolution. The generator cannot assign those backend fields.
78
+ A suggested expiry is checked against admission/publication time before persistence.
79
+
80
+ ### Audience and visibility
81
+
82
+ Every Suggestion belongs to its Space and carries a `SuggestionAudience`:
83
+
84
+ - `{"kind":"space"}` (default and mainstream): visible to all authorized Space members
85
+ and enrolled shared Space principals (`ClientPrincipal::Space`, e.g. wall panels).
86
+ - `{"kind":"users","userIds":["..."]}` (rare): visible strictly to the listed Space
87
+ members (`userIds` must be nonblank and unique). Hidden from all other members and
88
+ from shared Space principals; non-audience calls to detail, handle, or feedback
89
+ return `NOT_FOUND` without disclosing existence.
90
+
91
+ Whenever `audience` is omitted in a draft or older record, it defaults to `{"kind":"space"}`.
92
+ Backends validate that every `userId` in a `users` audience is a real current member of the
93
+ Space before persisting a generated draft, and enforce that any recorded resolution actor is
94
+ authorized by the Suggestion's `audience`. `GenerateInput` does not accept an `audience` field;
95
+ explicit requests do not override audience modeling.
79
96
 
80
97
  Type names use `UPPER_CASE`. A registered type declares its strict content model,
81
98
  validator and supported business actions. The content must serialize to an
@@ -430,9 +430,6 @@
430
430
  "snapshotId": "v1",
431
431
  "createdAt": 90,
432
432
  "description": "Prior behavior",
433
- "script": {
434
- "script": "private"
435
- },
436
433
  "automationType": "TASK_FLOW"
437
434
  }
438
435
  ]
@@ -768,6 +768,72 @@
768
768
  "resourceIds": {}
769
769
  }
770
770
  }
771
+ },
772
+ {
773
+ "name": "space audience",
774
+ "type": "SuggestionAudience",
775
+ "value": {
776
+ "kind": "space"
777
+ }
778
+ },
779
+ {
780
+ "name": "users audience",
781
+ "type": "SuggestionAudience",
782
+ "value": {
783
+ "kind": "users",
784
+ "userIds": [
785
+ "fixture-alice",
786
+ "fixture-bob"
787
+ ]
788
+ }
789
+ },
790
+ {
791
+ "name": "targeted user automation draft",
792
+ "type": "AutomationDraft",
793
+ "value": {
794
+ "type": "AUTOMATION",
795
+ "operation": "CREATE",
796
+ "title": "Desk reminder",
797
+ "summary": "Remind Alice when the desk lamp stays on late",
798
+ "reasons": [
799
+ "Alice repeatedly turned off her study desk lamp after midnight"
800
+ ],
801
+ "evidence": [
802
+ {
803
+ "sourceType": "BEHAVIOR",
804
+ "sourceId": "fixture-operation-2",
805
+ "occurredAt": 1200,
806
+ "excerpt": "Alice turned off Desk Lamp at 00:15"
807
+ }
808
+ ],
809
+ "audience": {
810
+ "kind": "users",
811
+ "userIds": [
812
+ "fixture-alice"
813
+ ]
814
+ },
815
+ "request": "Turn off Alice's desk lamp after midnight"
816
+ }
817
+ },
818
+ {
819
+ "name": "targeted user suggestion summary",
820
+ "type": "SuggestionSummary",
821
+ "value": {
822
+ "id": "fixture-suggestion-2",
823
+ "type": "AUTOMATION",
824
+ "version": 1,
825
+ "title": "Desk reminder",
826
+ "summary": "Remind Alice when the desk lamp stays on late",
827
+ "audience": {
828
+ "kind": "users",
829
+ "userIds": [
830
+ "fixture-alice"
831
+ ]
832
+ },
833
+ "status": "PENDING",
834
+ "createdAt": 2000,
835
+ "updatedAt": 2000
836
+ }
771
837
  }
772
838
  ],
773
839
  "invalid": [
@@ -1545,6 +1611,105 @@
1545
1611
  "feedback": "already done"
1546
1612
  }
1547
1613
  }
1614
+ },
1615
+ {
1616
+ "name": "users audience rejects empty userIds",
1617
+ "type": "SuggestionAudience",
1618
+ "value": {
1619
+ "kind": "users",
1620
+ "userIds": []
1621
+ }
1622
+ },
1623
+ {
1624
+ "name": "users audience rejects blank userId",
1625
+ "type": "SuggestionAudience",
1626
+ "value": {
1627
+ "kind": "users",
1628
+ "userIds": [
1629
+ " "
1630
+ ]
1631
+ }
1632
+ },
1633
+ {
1634
+ "name": "users audience rejects duplicate userIds",
1635
+ "type": "SuggestionAudience",
1636
+ "value": {
1637
+ "kind": "users",
1638
+ "userIds": [
1639
+ "fixture-alice",
1640
+ "fixture-alice"
1641
+ ]
1642
+ }
1643
+ },
1644
+ {
1645
+ "name": "space audience rejects userIds",
1646
+ "type": "SuggestionAudience",
1647
+ "value": {
1648
+ "kind": "space",
1649
+ "userIds": [
1650
+ "fixture-alice"
1651
+ ]
1652
+ }
1653
+ },
1654
+ {
1655
+ "name": "audience rejects unknown kind",
1656
+ "type": "SuggestionAudience",
1657
+ "value": {
1658
+ "kind": "everyone"
1659
+ }
1660
+ },
1661
+ {
1662
+ "name": "draft rejects null audience",
1663
+ "type": "AutomationDraft",
1664
+ "value": {
1665
+ "type": "AUTOMATION",
1666
+ "operation": "CREATE",
1667
+ "title": "Evening lighting",
1668
+ "summary": "Suggest a lower evening brightness",
1669
+ "reasons": [
1670
+ "Observed manual adjustments"
1671
+ ],
1672
+ "evidence": [
1673
+ {
1674
+ "sourceType": "BEHAVIOR",
1675
+ "sourceId": "fixture-operation-1",
1676
+ "occurredAt": 1000,
1677
+ "excerpt": "Brightness 30"
1678
+ }
1679
+ ],
1680
+ "audience": null,
1681
+ "request": "Use lower evening brightness"
1682
+ }
1683
+ },
1684
+ {
1685
+ "name": "summary rejects empty users audience",
1686
+ "type": "SuggestionSummary",
1687
+ "value": {
1688
+ "id": "fixture-suggestion-2",
1689
+ "type": "AUTOMATION",
1690
+ "version": 1,
1691
+ "title": "Desk reminder",
1692
+ "summary": "Remind Alice when the desk lamp stays on late",
1693
+ "audience": {
1694
+ "kind": "users",
1695
+ "userIds": []
1696
+ },
1697
+ "status": "PENDING",
1698
+ "createdAt": 2000,
1699
+ "updatedAt": 2000
1700
+ }
1701
+ },
1702
+ {
1703
+ "name": "generate input rejects audience field",
1704
+ "type": "GenerateInput",
1705
+ "value": {
1706
+ "audience": {
1707
+ "kind": "users",
1708
+ "userIds": [
1709
+ "fixture-alice"
1710
+ ]
1711
+ }
1712
+ }
1548
1713
  }
1549
1714
  ]
1550
1715
  }
@@ -80,6 +80,9 @@
80
80
  "excerpt": "The user selected brightness 30 after brightness 80"
81
81
  }
82
82
  ],
83
+ "audience": {
84
+ "kind": "space"
85
+ },
83
86
  "id": "pending",
84
87
  "spaceId": "space",
85
88
  "runId": "run",
@@ -109,6 +112,12 @@
109
112
  "excerpt": "The user selected brightness 30 after brightness 80"
110
113
  }
111
114
  ],
115
+ "audience": {
116
+ "kind": "users",
117
+ "userIds": [
118
+ "fixture-user"
119
+ ]
120
+ },
112
121
  "id": "resolved",
113
122
  "spaceId": "space",
114
123
  "runId": "run",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.app-facade.v1",
3
- "contractVersion": "1.186.0",
3
+ "contractVersion": "1.188.0",
4
4
  "callSchema": "schema/facade-call.v1.schema.json",
5
5
  "routing": "manifest/routing.v1.json",
6
6
  "routingSchema": "schema/routing.v1.schema.json",
@@ -354,6 +354,7 @@
354
354
  "uiRequestTargets": [
355
355
  "/app/presentation/automation/names/get",
356
356
  "/app/presentation/automation/list",
357
+ "/app/presentation/automation/group-candidates/list",
357
358
  "/app/presentation/automation/overview/get",
358
359
  "/app/presentation/automation/placements/get",
359
360
  "/app/presentation/automation/summaries/get",
@@ -1,5 +1,5 @@
1
1
  {
2
- "contractVersion": "1.186.0",
2
+ "contractVersion": "1.188.0",
3
3
  "operations": {
4
4
  "/app/agent/context/get": "spaceRead",
5
5
  "/app/agent/conversation/get": "spaceRead",
@@ -242,6 +242,7 @@
242
242
  "/app/presentation/automation/generated/enable": "spaceWrite",
243
243
  "/app/presentation/automation/generated/run": "spaceWrite",
244
244
  "/app/presentation/automation/list": "spaceRead",
245
+ "/app/presentation/automation/group-candidates/list": "spaceRead",
245
246
  "/app/presentation/automation/names/get": "spaceRead",
246
247
  "/app/presentation/automation/overview/cancel": "spaceWrite",
247
248
  "/app/presentation/automation/overview/config/provide": "spaceWrite",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.host-provision.targets.v1",
3
- "contractVersion": "1.186.0",
3
+ "contractVersion": "1.188.0",
4
4
  "contract": "contract/host-provisioning-v1.md",
5
5
  "localTargets": [
6
6
  "/local/host/provision/start",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.hub.targets.v1",
3
- "contractVersion": "1.186.0",
3
+ "contractVersion": "1.188.0",
4
4
  "appTargets": [
5
5
  "/app/hub/get",
6
6
  "/app/hub/remove"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.pod.targets.v1",
3
- "contractVersion": "1.186.0",
3
+ "contractVersion": "1.188.0",
4
4
  "contract": "contract/pod-commissioning-v1.md",
5
5
  "localTargets": [
6
6
  "/local/pod/discovery/start",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.app-facade.routing.v1",
3
- "contractVersion": "1.186.0",
3
+ "contractVersion": "1.188.0",
4
4
  "targetPrefix": "/app/",
5
5
  "default": {
6
6
  "execution": "spaceMode"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.messaging.targets.v1",
3
- "contractVersion": "1.186.0",
3
+ "contractVersion": "1.188.0",
4
4
  "requestTargets": [
5
5
  "/app/messaging/provider/list",
6
6
  "/app/messaging/provider-account/list",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhome/app-facade-protocol",
3
- "version": "1.186.0",
3
+ "version": "1.188.0",
4
4
  "description": "Build-time protocol artifacts for mhome.app-facade",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/protocol.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "protocol": "mhome.app-facade",
3
- "contractVersion": "1.186.0",
3
+ "contractVersion": "1.188.0",
4
4
  "manifest": "manifest/app-facade.v1.json",
5
5
  "schemas": {
6
6
  "dashboardCardAuthoring": "schema/dashboard-card-authoring.v1.schema.json",
@@ -3,6 +3,44 @@
3
3
  "$id": "https://mhome.ai/schema/suggestion.v1.schema.json",
4
4
  "$comment": "Generic envelopes validate common fields only. Writers must also validate a registered type; AUTOMATION is the first production type. Timestamps and version are safe JSON integers. Cross-field time and authorization checks remain required.",
5
5
  "$defs": {
6
+ "SuggestionAudience": {
7
+ "oneOf": [
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "kind": {
12
+ "const": "space"
13
+ }
14
+ },
15
+ "required": [
16
+ "kind"
17
+ ],
18
+ "additionalProperties": false
19
+ },
20
+ {
21
+ "type": "object",
22
+ "properties": {
23
+ "kind": {
24
+ "const": "users"
25
+ },
26
+ "userIds": {
27
+ "type": "array",
28
+ "items": {
29
+ "type": "string",
30
+ "pattern": "[^\\u0009-\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]"
31
+ },
32
+ "minItems": 1,
33
+ "uniqueItems": true
34
+ }
35
+ },
36
+ "required": [
37
+ "kind",
38
+ "userIds"
39
+ ],
40
+ "additionalProperties": false
41
+ }
42
+ ]
43
+ },
6
44
  "Evidence": {
7
45
  "type": "object",
8
46
  "properties": {
@@ -213,6 +251,12 @@
213
251
  },
214
252
  "minItems": 1
215
253
  },
254
+ "audience": {
255
+ "$ref": "#/$defs/SuggestionAudience",
256
+ "default": {
257
+ "kind": "space"
258
+ }
259
+ },
216
260
  "expiresAt": {
217
261
  "anyOf": [
218
262
  {
@@ -265,6 +309,12 @@
265
309
  },
266
310
  "minItems": 1
267
311
  },
312
+ "audience": {
313
+ "$ref": "#/$defs/SuggestionAudience",
314
+ "default": {
315
+ "kind": "space"
316
+ }
317
+ },
268
318
  "expiresAt": {
269
319
  "anyOf": [
270
320
  {
@@ -434,6 +484,12 @@
434
484
  },
435
485
  "minItems": 1
436
486
  },
487
+ "audience": {
488
+ "$ref": "#/$defs/SuggestionAudience",
489
+ "default": {
490
+ "kind": "space"
491
+ }
492
+ },
437
493
  "expiresAt": {
438
494
  "anyOf": [
439
495
  {
@@ -550,6 +606,12 @@
550
606
  },
551
607
  "minItems": 1
552
608
  },
609
+ "audience": {
610
+ "$ref": "#/$defs/SuggestionAudience",
611
+ "default": {
612
+ "kind": "space"
613
+ }
614
+ },
553
615
  "expiresAt": {
554
616
  "anyOf": [
555
617
  {
@@ -909,6 +971,12 @@
909
971
  "type": "string",
910
972
  "pattern": "[^\\u0009-\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]"
911
973
  },
974
+ "audience": {
975
+ "$ref": "#/$defs/SuggestionAudience",
976
+ "default": {
977
+ "kind": "space"
978
+ }
979
+ },
912
980
  "status": {
913
981
  "enum": [
914
982
  "PENDING",