@mhome/app-facade-protocol 1.142.0 → 1.146.1

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 CHANGED
@@ -28,6 +28,9 @@ Device-only rendering, online rows and chart series use the
28
28
  See [Agent LLM settings](contract/agent-llm-v1.md) for active-mode reads,
29
29
  independent saved configuration and Provider Operation boundaries.
30
30
 
31
+ See [Group operation state](contract/groups-v1.md) for incomplete application,
32
+ manual reapplication, deletion and name-update outcomes.
33
+
31
34
  ## Business DTO ownership
32
35
 
33
36
  A Facade owns the public business DTO for an operation. Native Agent tools, MCP,
@@ -0,0 +1,46 @@
1
+ # Group operation state
2
+
3
+ A Group owns its definition, derived Twin, generated execution plans and related
4
+ cards. Deleting a Group preserves member resources. Member type is immutable.
5
+
6
+ `applyState` is persisted before changing derived resources. Validation and
7
+ preparation failures preserve the preceding definition. After a definition is
8
+ accepted, interrupted or failed application remains `applying` or `failed` until
9
+ another application succeeds. Controls require `ready` and a matching runtime
10
+ projection revision. `applying` alone does not establish that a worker is active.
11
+
12
+ A saved incomplete creation has a stable Group ID and complete member definition.
13
+ A user may reapply those IDs through `/app/group/members/update` with the current
14
+ revision, or delete the Group. Reusing the original `creationId` and payload also
15
+ preserves identity; it never overwrites later edits of a completed Group.
16
+
17
+ Deletion persists `deleting`, rejects rename/member updates and removes the Group
18
+ record last. Repeating deletion at the retained revision continues cleanup;
19
+ an absent Group succeeds. These operations do not require a background recovery
20
+ worker or a per-step task log. Normal reconciliation after member-source changes
21
+ continues independently.
22
+
23
+ Rename preserves runtime and does not require available members. Its saved name
24
+ and internal `presentationPending` marker are committed together before updating
25
+ Twin/card titles. The marker clears after all title writes succeed. An interrupted
26
+ rename therefore remains visible while ready controls remain usable. Saving the
27
+ current name again repairs titles; a successful full application also settles it.
28
+
29
+ List summaries, details and mutation results expose optional `applicationProblem`.
30
+ An incomplete persisted state yields a problem even when no exception was recorded.
31
+ A ready Group may carry a title problem. Mutation results with a problem are
32
+ `partial`, retaining Group identity, current revision and diagnostics in both
33
+ Full and Essential presentation. Read success means the definition was read;
34
+ inspect its state and problem separately. Member-resolution read failures retain
35
+ the existing `GROUP_MEMBERS_UNAVAILABLE` partial-read contract.
36
+
37
+ Notifications are best effort. A notification failure does not undo successful
38
+ writes. Rename invalidation follows the persisted final outcome. Clients may
39
+ refresh reads and expose user-initiated write retries. Existing member-source
40
+ reconciliation can reapply affected incomplete Groups under its existing rules;
41
+ this contract adds no separate recovery worker.
42
+
43
+ The cloud Group record gains one optional boolean attribute. Primary keys and
44
+ indexes do not change. Core SQLite includes `presentation_pending` in its complete
45
+ baseline; an existing database requires an explicit rebuild under the workspace
46
+ baseline policy. No startup conversion or automatic deletion is performed.
@@ -202,7 +202,13 @@ owner's already committed claim reconciles through the ordinary claim contract.
202
202
  There is no Core-proxied first-claim route. Hosts already online without BLE use
203
203
  the ordinary direct LAN claim operation.
204
204
 
205
- Only `completed` carries `result`: `{hostId,wifiConfigured:true,commissioned:true,
205
+ The required `result.outcome` is `onboarded` after adding the Host or completing
206
+ first-Hub setup, and `wifiUpdated` after changing an already claimed Host's Wi-Fi.
207
+ It survives status/event reconciliation; callers must not infer the operation
208
+ from the current `host.onboardingRequired` value. `wifiUpdated` never carries a
209
+ `hubId`.
210
+
211
+ Only `completed` carries `result`: `{hostId,outcome,wifiConfigured:true,commissioned:true,
206
212
  hubId?}`. `hubId` is present when this operation explicitly established the first
207
213
  Hub. `host` and optional reported IPv4 `addresses` remain in the snapshot. No
208
214
  public snapshot, event, CLI or UI result contains `claimToken`. Terminal errors
@@ -268,3 +274,26 @@ removing that Hub later does not revive the old intent. A local Core identity
268
274
  already durably installed uses `ownHub` network change instead. Neither path
269
275
  changes the installation role. Reset removes this pending intent with identity
270
276
  and ownership, while preserving the installation role.
277
+
278
+ ## Completion and continuation
279
+
280
+ A confirmed Host claim is a completed checkpoint. A failure in first-Hub setup
281
+ must not repeat Host claiming. Native session snapshots update
282
+ `host.onboardingRequired` to false after confirmed claim success and discard the
283
+ claim handoff token. An unknown claim outcome remains unconfirmed until the
284
+ Host/cloud authority protocol resolves it; display text never decides ownership.
285
+
286
+ Cloud Hub `status: ready` confirms migration publication, not local runtime
287
+ readiness. Native `/local/hub/get` adds `hub.local.ready`, which is true only when
288
+ the exact authenticated LAN Hub reports its business request gate open through
289
+ `/app/hub/status` (`data.ready`). A connected socket alone is insufficient.
290
+ Shared Hub setup reports `WAITING_FOR_LOCAL` after cloud commit and completes
291
+ only with both `hub.local.connected` and `hub.local.ready`. Cloud publication and
292
+ local readiness retain separate meanings. A retry after cloud commit continues
293
+ the same Hub rather than reimporting or reclaiming it.
294
+
295
+ Direct LAN Space Host claims must use the same selected-Hub physical-LAN admission
296
+ as BLE commissioning. The native adapter validates the selected Space's published
297
+ Hub, pins its identity and verifies it on the same physical LAN as the Host.
298
+ A cloud Owner grant or the Host's own on-link address alone does not establish
299
+ this condition. First-Hub bootstrap has no existing target Hub to verify.
@@ -41,7 +41,7 @@ Task failure, notification priority and schedule trigger times are not inferred
41
41
  as user-decision facts.
42
42
 
43
43
  Standard device facts currently cover `state.water` (`wet` / `dry`) and
44
- `state.smoke` (`detected` / `clear`). Other readings, including unknown/testing,
44
+ `state.smokeDetector.alarmState` (`detected` / `clear`). Other readings, including unknown/testing,
45
45
  do not create an incident and do not resolve an existing incident. The small
46
46
  retained device projection preserves the episode across restarts and Space
47
47
  execution-mode migration. Its CAS revision is owned by Attention, independent of rebuildable Twin cache
@@ -28,8 +28,10 @@ identity and has no cloud access/refresh token. Changing mode requires reset.
28
28
 
29
29
  ## 2. BLE advertising
30
30
 
31
- Pods advertise only while unprovisioned, while re-commissioning after logout or
32
- credential invalidation, or inside a re-provision window. A commissioned pod does not advertise.
31
+ Pods advertise only while unprovisioned, while a User Pod is re-commissioning
32
+ after logout or credential invalidation, or inside a re-provision window. A
33
+ commissioned pod does not advertise. Space Pods have no personal login/logout
34
+ operation: only factory reset may clear their Space binding.
33
35
 
34
36
  - Service UUID (128-bit, shared by every MeowLink commissionable device):
35
37
  `a17a7ad5-9b2f-4010-9cf0-aa15ac54c40e`.
@@ -237,12 +239,18 @@ Runtime states after commit:
237
239
  with `wifi_hub_unverified` when the Hub proof fails or `storage_failed` if saving fails. It then
238
240
  restarts on `finish`, 30 seconds later, or at the end of the window. A failed
239
241
  join or an expired window restarts with the previous network.
240
- - `needs_recommission`: logout, or refresh rejected because the credential was
242
+ - `needs_recommission` (User mode only): logout, or refresh rejected because the credential was
241
243
  revoked or the user no longer exists. Credential and local JWTs are erased,
242
244
  Wi-Fi is kept, advertising resumes with the Wi-Fi-configured flag.
243
245
  - `factory_resetting`: purely offline, erase all persisted data including the
244
246
  identity key and cached Hub tokens, reboot to `unprovisioned`. No cloud
245
- request is needed. Logout also clears local credentials without cloud revocation.
247
+ request is needed. User logout also clears local credentials without cloud revocation.
248
+
249
+ User logout keeps network and device preferences, but clears the User session,
250
+ selected Space, account navigation data and per-Hub credentials. A subsequent
251
+ User login obtains a fresh device session. Space mode refuses logout in both UI
252
+ and the native execution/persistence boundary. Network loss or rejected
253
+ authorization never clears its fixed Space binding or permits a different Space.
246
254
 
247
255
  Linux uses its OS time service and ESP uses background SNTP. User login proofs
248
256
  require usable UTC and cloud TLS retains normal CA and date validation. Space
@@ -398,7 +406,16 @@ page does not end setup; returning to it reads `status`. Waiting for user input
398
406
  also counts toward the deadline. Discovery leases still control scanning.
399
407
 
400
408
  Sign-in and Spaces are checked at `start` (`not_signed_in`,
401
- `space_not_offered`) and again when the authorization prompt is built.
409
+ `space_not_offered`) and again when the authorization prompt is built. Every
410
+ Pod/Host setup session belongs to the assisting login generation, including
411
+ Wi-Fi-only sessions. Account replacement ends the old attempt and releases its
412
+ link; status does not expose it to the replacement login, and queued terminal
413
+ notifications contain no old account's authorization or completion data.
414
+
415
+ Personal Pod admission requires the assisting Client and Pod to share the Client's
416
+ physical LAN. The initial UI Space may have an unavailable or remote Hub and
417
+ never imposes that Hub's LAN on the personal login. Space Pod admission continues
418
+ to require the selected Space's exact Hub and same-LAN proof.
402
419
 
403
420
  A pod inside a Wi-Fi change window (`pod-info` `"mode":"reprovision"`) gets a
404
421
  Wi-Fi-only session. From `reading_info` on, its snapshots carry
@@ -17,11 +17,26 @@ Space/Hub selector, grant, certificate or private key is an input/output.
17
17
  Integration and use `/app/integration/connect`. Its constant/input DTO remain
18
18
  readable for older clients; this route cannot enroll a device.
19
19
  - `/app/wave/list`: `{}` -> `{bindings:[{deviceId,grantState}]}`. States are
20
- `candidate` or `committed`; this is authorization bookkeeping, not Device/Twin
21
- inventory, online state or evidence that a candidate committed on the device.
20
+ `candidate`, `committed` or `removing`; this is authorization bookkeeping, not
21
+ Device/Twin inventory, online state or evidence that a candidate committed on the device.
22
22
  - `/app/wave/refresh`: `{deviceId}` -> AdmissionResult. Reconcile the same saved
23
23
  credential, validate full Entity self-description against installed contracts,
24
24
  then use ordinary Twin source synchronization. It cannot open a pairing window.
25
+ - `/app/wave/remove`: `{deviceId,forgetAfterDeviceReset?:boolean}` ->
26
+ `{deviceId,grantState}`. An authenticated App caller with current-Space Manage
27
+ access requests physical grant removal. The optional flag defaults to false.
28
+ `removed` confirms the device revoked the grant and Core cleared the local
29
+ binding. `removing` is a partial outcome retaining an unconfirmed removal.
30
+ Retry can complete while the device still accepts the saved grant. If the
31
+ device already revoked it and its reply was lost, the old credential cannot
32
+ authenticate another attempt, even when the device is reachable. The user
33
+ clears Wave authorization locally on the device, then explicitly confirms
34
+ `forgetAfterDeviceReset:true` to clear this Space's saved binding. A device-wide
35
+ Wave reset also removes its other Space grants. `unbound` means no saved binding
36
+ remains.
37
+ `forgotten` clears its saved local binding without a device revocation reply.
38
+ Clearing a local binding also clears its published inventory. Ordinary
39
+ Integration uninstall remains a separate operation.
25
40
 
26
41
  AdmissionResult is `{deviceId,grantState,inventoryState,entityIds,reason?}`.
27
42
  `inventoryState:ready` means existing inventory synchronization completed;
@@ -229,7 +229,7 @@
229
229
  },
230
230
  {
231
231
  "name": "testing alone does not create smoke incident",
232
- "capabilityId": "basic.device.state.smoke",
232
+ "capabilityId": "basic.device.state.smokeDetector",
233
233
  "observations": [
234
234
  {
235
235
  "sequence": 1,
@@ -243,7 +243,7 @@
243
243
  "sourceUpdatedAt": 1000,
244
244
  "persisted": {
245
245
  "entityId": "sensor",
246
- "capabilityId": "basic.device.state.smoke",
246
+ "capabilityId": "basic.device.state.smokeDetector",
247
247
  "latest": {
248
248
  "sequence": 1,
249
249
  "timestamp": 1000,
@@ -255,7 +255,7 @@
255
255
  },
256
256
  {
257
257
  "name": "smoke testing preserves detected incident",
258
- "capabilityId": "basic.device.state.smoke",
258
+ "capabilityId": "basic.device.state.smokeDetector",
259
259
  "observations": [
260
260
  {
261
261
  "sequence": 1,
@@ -274,7 +274,7 @@
274
274
  "sourceUpdatedAt": 2000,
275
275
  "persisted": {
276
276
  "entityId": "sensor",
277
- "capabilityId": "basic.device.state.smoke",
277
+ "capabilityId": "basic.device.state.smokeDetector",
278
278
  "latest": {
279
279
  "sequence": 2,
280
280
  "timestamp": 2000,
@@ -290,7 +290,7 @@
290
290
  },
291
291
  {
292
292
  "name": "clear ends smoke incident",
293
- "capabilityId": "basic.device.state.smoke",
293
+ "capabilityId": "basic.device.state.smokeDetector",
294
294
  "observations": [
295
295
  {
296
296
  "sequence": 1,
@@ -314,7 +314,7 @@
314
314
  "sourceUpdatedAt": 1000,
315
315
  "persisted": {
316
316
  "entityId": "sensor",
317
- "capabilityId": "basic.device.state.smoke",
317
+ "capabilityId": "basic.device.state.smokeDetector",
318
318
  "latest": {
319
319
  "sequence": 3,
320
320
  "timestamp": 3000,
@@ -192,6 +192,23 @@
192
192
  "lamp-b"
193
193
  ]
194
194
  }
195
+ },
196
+ {
197
+ "definition": "GroupSummary",
198
+ "value": {
199
+ "groupId": "g:11111111-1111-4111-8111-111111111111",
200
+ "name": "Lights",
201
+ "entityType": "basic.device.Device",
202
+ "memberCount": 2,
203
+ "revision": 3,
204
+ "applyState": "ready",
205
+ "createdAt": 1900000000000,
206
+ "updatedAt": 1900000001000,
207
+ "applicationProblem": {
208
+ "code": "GROUP_PRESENTATION_INCOMPLETE",
209
+ "message": "Group name update is incomplete; save the name again"
210
+ }
211
+ }
195
212
  }
196
213
  ],
197
214
  "invalid": [
@@ -22,7 +22,7 @@
22
22
  "fingerprint": "5e6f7a8b0c1d2e3f405162738495a6b7c8d9eaf0123456789abcdef012345678",
23
23
  "wifiConfigured": false,
24
24
  "authorizationMode": "admin",
25
- "onboardingRequired": true
25
+ "onboardingRequired": false
26
26
  },
27
27
  "addresses": [
28
28
  "192.168.1.42"
@@ -30,6 +30,7 @@
30
30
  "result": {
31
31
  "hostId": "host-0f3c9a",
32
32
  "wifiConfigured": true,
33
- "commissioned": true
33
+ "commissioned": true,
34
+ "outcome": "onboarded"
34
35
  }
35
36
  }
@@ -16,7 +16,8 @@
16
16
  "connected": true,
17
17
  "connectionStatus": "connected",
18
18
  "hostName": "Living Room Mac",
19
- "version": "1.0.0"
19
+ "version": "1.0.0",
20
+ "ready": true
20
21
  }
21
22
  }
22
23
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.app-facade.v1",
3
- "contractVersion": "1.142.0",
3
+ "contractVersion": "1.146.1",
4
4
  "callSchema": "schema/facade-call.v1.schema.json",
5
5
  "routing": "manifest/routing.v1.json",
6
6
  "routingSchema": "schema/routing.v1.schema.json",
@@ -489,7 +489,8 @@
489
489
  "/app/wave/discover",
490
490
  "/app/wave/pair",
491
491
  "/app/wave/list",
492
- "/app/wave/refresh"
492
+ "/app/wave/refresh",
493
+ "/app/wave/remove"
493
494
  ]
494
495
  },
495
496
  "dashboardWidgetCardCreate": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "contractVersion": "1.142.0",
2
+ "contractVersion": "1.146.1",
3
3
  "operations": {
4
4
  "/app/agent/context/get": "spaceRead",
5
5
  "/app/agent/credit/usage": "spaceRead",
@@ -376,7 +376,8 @@
376
376
  "/app/wave/discover": "spaceManage",
377
377
  "/app/wave/pair": "spaceManage",
378
378
  "/app/wave/list": "spaceManage",
379
- "/app/wave/refresh": "spaceManage"
379
+ "/app/wave/refresh": "spaceManage",
380
+ "/app/wave/remove": "spaceManage"
380
381
  },
381
382
  "nodePrefix": "/app/plugin/",
382
383
  "serviceOperations": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.host-provision.targets.v1",
3
- "contractVersion": "1.142.0",
3
+ "contractVersion": "1.146.1",
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.142.0",
3
+ "contractVersion": "1.146.1",
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.142.0",
3
+ "contractVersion": "1.146.1",
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.142.0",
3
+ "contractVersion": "1.146.1",
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.142.0",
3
+ "contractVersion": "1.146.1",
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.142.0",
3
+ "version": "1.146.1",
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.142.0",
3
+ "contractVersion": "1.146.1",
4
4
  "manifest": "manifest/app-facade.v1.json",
5
5
  "schemas": {
6
6
  "storage": "schema/storage.v1.schema.json",
@@ -171,6 +171,25 @@
171
171
  "updatedAt": {
172
172
  "type": "integer",
173
173
  "minimum": 1
174
+ },
175
+ "applicationProblem": {
176
+ "type": "object",
177
+ "additionalProperties": false,
178
+ "properties": {
179
+ "code": {
180
+ "type": "string",
181
+ "minLength": 1
182
+ },
183
+ "message": {
184
+ "type": "string",
185
+ "minLength": 1
186
+ },
187
+ "details": {}
188
+ },
189
+ "required": [
190
+ "code",
191
+ "message"
192
+ ]
174
193
  }
175
194
  },
176
195
  "required": [
@@ -166,6 +166,7 @@
166
166
  "additionalProperties": false,
167
167
  "required": [
168
168
  "hostId",
169
+ "outcome",
169
170
  "wifiConfigured",
170
171
  "commissioned"
171
172
  ],
@@ -183,8 +184,35 @@
183
184
  "hubId": {
184
185
  "type": "string",
185
186
  "minLength": 1
187
+ },
188
+ "outcome": {
189
+ "enum": [
190
+ "onboarded",
191
+ "wifiUpdated"
192
+ ]
186
193
  }
187
- }
194
+ },
195
+ "allOf": [
196
+ {
197
+ "if": {
198
+ "properties": {
199
+ "outcome": {
200
+ "const": "wifiUpdated"
201
+ }
202
+ }
203
+ },
204
+ "then": {
205
+ "not": {
206
+ "properties": {
207
+ "hubId": {}
208
+ },
209
+ "required": [
210
+ "hubId"
211
+ ]
212
+ }
213
+ }
214
+ }
215
+ ]
188
216
  }
189
217
  },
190
218
  "allOf": [
@@ -54,6 +54,7 @@
54
54
  "properties": {
55
55
  "discovered": { "type": "boolean" },
56
56
  "connected": { "type": "boolean" },
57
+ "ready": { "type": "boolean", "default": false },
57
58
  "connectionStatus": { "type": "string" },
58
59
  "hostName": { "type": "string" },
59
60
  "version": { "type": "string" }