@mhome/app-facade-protocol 1.140.0 → 1.142.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.
@@ -18,10 +18,18 @@ Business execution follows Space mode, independently of LLM placement:
18
18
  cloud forwarding. Core obtains cloud-owned directory metadata and user grants
19
19
  through the private `/bridge/management/control` endpoint; this endpoint neither
20
20
  dispatches Host commands nor impersonates a Client.
21
- - Cloud Space: cloud executes business through the initiating personal desktop
22
- Client. No other online App is selected. MCP, web and mobile have no such
21
+ - Cloud Space: cloud executes business through the initiating personal Native
22
+ Client (desktop, Android or iOS). No other online App is selected. MCP and web have no such
23
23
  transport and management calls fail if no suitable route exists. List still
24
24
  returns registrations with unavailable observations.
25
+ - No Space: `/app/host/metrics` and `/app/host/permissions/get` execute through
26
+ the authenticated initiating Native Client, using the same Facade DTO and
27
+ caller-selected Full/Essential protocol. Only an Admin Host is accepted; a
28
+ Space Host still requires its Space. The Cloud verifies the current socket
29
+ identity directly because no Space presence index exists yet. It never chooses
30
+ another online Client. These two exceptions are declared by
31
+ `routing.v1.json.unspacedCloudTargets`; with a Space, normal Space-mode routing
32
+ applies. MCP has no Native Client execution route.
25
33
 
26
34
  Host mode, ACL and Space ownership remain authoritative. The private bridge is
27
35
  bound to its authenticated tenant/Space and rechecks personal User read access;
@@ -32,6 +40,20 @@ Public signing endpoints remain Client-only and are not Agent/MCP tools.
32
40
 
33
41
  The private `/app/host/execute` Client request is a fixed management transport,
34
42
  not a capability or public Facade. It accepts no service switch or admin removal.
43
+ Its authenticated Cloud socket, personal User, tenant and explicit `spaceId` must
44
+ match the receiving Client's current membership. UI focus does not select or
45
+ authorize this execution. `inventory` accepts `{}` for a list or `{hostId}` for a
46
+ single target; the Client selects that target before probing devices. `runtime`
47
+ and `permissions` address one explicit Host ID. Private requests never enter the
48
+ WebView event stream. Each exchange remains bound to the initiating login and
49
+ connection attempt; an expired attempt cannot dispatch further work or reply on
50
+ its replacement. A result uses exactly `{value: ...}` or
51
+ `{error: {code, message}}`, keeping business refusal codes intact.
52
+ For an account read, the private request body's `spaceId` is explicitly `null`
53
+ and its envelope has no Space selection. The only admitted forms are `inventory {hostId}`,
54
+ `runtime {hostId,action:"metrics"}` and `permissions {hostId}`. Each receiver
55
+ verifies its current personal user/tenant and the Host's signed Admin mode;
56
+ missing `spaceId`, arbitrary unscoped writes and local Host aliases are rejected.
35
57
  A missing route fails; a mutation is never replayed through another transport.
36
58
  If a cloud entrypoint cannot reach a local Space's Core, list alone may return
37
59
  cloud registrations with unavailable observations and `sourceErrors.hub`.
@@ -3,9 +3,10 @@
3
3
  BLE-capable embedded Linux Hosts get Wi-Fi or recover an unfinished first claim
4
4
  over BLE from a native Client (desktop/CLI Clientd, Android, iOS). Desktop, Docker
5
5
  and Android Hosts use LAN discovery rather than advertising BLE setup.
6
- Provisioning connects the Host to the LAN
7
- and hands the provisioner a one-time claim token; ownership is then established
8
- by the existing Host claim over the LAN, which requires that token (section 4).
6
+ Provisioning connects the Host to the LAN. The Native Client retains the BLE
7
+ claim token privately and, after explicit user confirmation, establishes ownership
8
+ through the existing LAN claim protocol. CLI/UI drive this session protocol;
9
+ they never receive the token or compose the claim and Hub setup themselves.
9
10
 
10
11
  The BLE layer is the one pods use (`pod-commissioning-v1.md` sections 2 and 3):
11
12
  same service UUID, manufacturer data with device kind `2`, protocomm security 2
@@ -79,6 +80,7 @@ Fallback characteristic UUIDs: the standard endpoints as for pods, `host-info`
79
80
  "firmwareVersion": "0.9.0",
80
81
  "fingerprint": "<hex SHA-256 of the bootstrap public key>",
81
82
  "wifiConfigured": false,
83
+ "authorizationMode": "spaceSelf",
82
84
  "onboardingRequired": true,
83
85
  "networkOnline": false
84
86
  }
@@ -86,10 +88,26 @@ Fallback characteristic UUIDs: the standard endpoints as for pods, `host-info`
86
88
 
87
89
  `productId` is optional. `onboardingRequired` reports whether this Host still
88
90
  awaits its first claim and is required. `networkOnline` reports current LAN
89
- readiness. A securely paired Host with `networkOnline: true`
91
+ readiness. `authorizationMode` is the persisted installation role, independent
92
+ of upgrades. A securely paired Admin Host with `networkOnline: true`
90
93
  and `onboardingRequired: true` can finish without resubmitting Wi-Fi. `finish`
91
94
  issues a fresh first-claim token after checking authoritative Host ownership.
92
95
  Already claimed Hosts never issue a new first-claim token.
96
+ - `{"op":"identity"}` → `{"hostId":"…","publicKey":["<P-256 x>","<P-256 y>"]}`.
97
+ The separate encrypted record fits the BLE attribute budget. Native retains
98
+ this key and pins the subsequent LAN TLS connection to it before sending any
99
+ claim token, exchange secret or cloud grant.
100
+ - `{"op":"networkTarget"}` reports `user`, `space` (with claimed Space/Tenant),
101
+ `ownHub`, `firstHub` or `unclaimed`, derived from Host authority and the installed Core's
102
+ durable identity. It does not trust Pod profile caches or caller assertions.
103
+ - `{"op":"prepareWifi","mode":"user|space|bootstrap|bootstrapRecovery|ownHub","hub":[…]?}`
104
+ prepares the network policy in the same secure session before `set_config`.
105
+ Space uses the compact exact Hub identity tuple defined in the Pod contract.
106
+ Only an explicit first-Hub enrollment may request bootstrap; an existing Hub
107
+ is exempt from finding a different Hub only when its own Core identity matches
108
+ its Host claim. Ordinary Space re-provisioning obtains current Hub identity
109
+ online. The Host validates its own role/claim and rejects changed targets while
110
+ joining. A new central cannot reuse the preceding central's target or password.
93
111
  - `{"op":"finish"}` → `{"ok":true,"claimToken":"…"}`. After a successful
94
112
  first-provisioning join, or secure recovery with an already working network,
95
113
  the response carries a claim token: 32 random bytes as 43 unpadded base64url
@@ -123,7 +141,8 @@ most 4 at a time).
123
141
 
124
142
  `prov-config` status reports `connected` with the IPv4 address after the Host
125
143
  has saved the new profile. The Linux backend first activates a temporary
126
- profile. On failure or local cancellation it removes that profile and attempts
144
+ profile, then proves the exact target Hub through that trial interface within
145
+ 30 seconds of obtaining an IP for ordinary Space devices. On failure or local cancellation it removes that profile and attempts
127
146
  to reactivate the previous one. `connection_failed` may distinguish
128
147
  `auth_error` or `network_not_found`. After a failed join the commissioner sends
129
148
  `prov-ctrl` reset before the next `set_config`.
@@ -138,9 +157,10 @@ Candidates come from the shared discovery (`/local/pod/discovery/*`) with
138
157
  | --- | --- | --- |
139
158
  | `/local/host/provision/start` | `{"candidateId"}` | session snapshot |
140
159
  | `/local/host/provision/code` | `{"sessionId","code"}` | session snapshot |
141
- | `/local/host/provision/wifi` | `{"sessionId","ssid","password"?}` | session snapshot |
160
+ | `/local/host/provision/wifi` | `{"sessionId","ssid","password"?,"enrollment"?}` | session snapshot |
142
161
  | `/local/host/provision/wifi/scan` | `{"sessionId"}` | session snapshot |
143
162
  | `/local/host/provision/status` | `{}` | `{"session": snapshot or null}` |
163
+ | `/local/host/provision/authorize` | `{"sessionId"}` | session snapshot |
144
164
  | `/local/host/provision/cancel` | `{"sessionId"}` | session snapshot |
145
165
 
146
166
  Event `/local/host/provision/changed` carries a session snapshot. One session
@@ -158,37 +178,40 @@ returns the same session; a different session ID is rejected. Cancellation durin
158
178
  token form a bounded critical section. Leaving the UI does not cancel a session.
159
179
  There is no renewal endpoint.
160
180
 
161
- Session states, in order: `connecting`, `awaiting_code`, `securing`,
162
- `reading_info`, `awaiting_wifi`, `joining_wifi`, `completed`; terminal `failed`,
163
- `timed_out`, `cancelled`; transitional `cancelling`. `completed` carries `host`, the reported `addresses`
164
- (IPv4 only, possibly empty) and `claimToken` from the `finish` response; the
165
- commissioner sends `finish` (up to 3 times while the secure session lasts)
166
- before reporting it. A missing or refused `finish` is a failed session. The
167
- first-claim handoff includes `claimToken`. A completed Wi-Fi update on an
168
- already claimed Host omits it. An account change can redact the token from a
169
- terminal event, so confirm a tokenless completion through the native status
170
- target before displaying the Wi-Fi update as successful. No other state
171
- carries `claimToken`.
172
-
173
- The first claim (TOFU) after BLE provisioning must include the returned token.
174
- Native `host.claim` passes it to `POST /v1/auth/claim`, alongside the environment,
175
- cloud proof and direct Client exchange secret (`core-api::host::access::ClaimRequest`).
176
- There is no Core-proxied first-claim route. The Host rejects a missing or incorrect
177
- provisioning token with 403 `HOST_CLAIM_TOKEN_REQUIRED`. The token remains valid
178
- until claim succeeds, another setup issues a replacement token, or factory reset.
179
- BLE `completed` confirms the network/handoff step, not Host ownership. The App's
180
- Host onboarding operation waits for explicit ownership confirmation, then claims
181
- over the LAN. It completes only after the existing claim API confirms cloud
182
- registration. It does not install Core or Plugins. Hosts that were not provisioned
183
- over BLE use the ordinary direct LAN claim flow. See the Foundation Host
184
- management authorization contract.
185
-
186
- Error codes are the pod session codes without the credential ones:
187
- `bluetooth_unavailable`, `device_busy`, `disconnected`, `code_rejected` (retry
188
- allowed), `code_locked`, `wifi_auth_failed`, `wifi_not_found`, `wifi_failed`,
189
- `session_timeout`. Retry rules are the pod ones: a rejected code returns to
190
- `awaiting_code`, a failed join to `awaiting_wifi`, each with its error; `failed`
191
- and `timed_out` always carry `error`. `code_locked` is terminal.
181
+ Session states: `connecting` → `awaiting_code` → `securing` → `reading_info`
182
+ → `awaiting_wifi` → `joining_wifi`. A Host that already has an authoritative
183
+ claim completes here; this only changes its network. An unclaimed Host continues
184
+ through `awaiting_authorization` → `authorizing` → `completed`. User confirmation
185
+ calls `/local/host/provision/authorize`. Failure returns to
186
+ `awaiting_authorization` with `issue_failed`; retry is explicit, never an automatic
187
+ repeat of a write whose response may have been lost. The same paired Host key
188
+ and account remain required. Cancellation during `authorizing` is rejected as
189
+ busy, as it is during `joining_wifi`.
190
+
191
+ Space Hosts require an owner Space and explicit `firstHub` enrollment before
192
+ Wi-Fi is sent. Ordinary Space Hosts must verify the existing exact Hub. Explicit
193
+ first-Hub enrollment reuses the durable Hub setup engine after Host claim; the
194
+ result is accepted only for the same BLE-paired Host key and original Client LAN.
195
+ Admin Hosts require no Space. A combined Pod/Host uses the Pod session instead.
196
+
197
+ The Host first-claim token remains private to Native. It is sent with the existing
198
+ LAN `POST /v1/auth/claim` proof and exchange secret. The Host rejects a missing or
199
+ incorrect token with `HOST_CLAIM_TOKEN_REQUIRED`. Its validity ends at successful
200
+ claim, replacement by another secure setup, or factory reset. Repeating the same
201
+ owner's already committed claim reconciles through the ordinary claim contract.
202
+ There is no Core-proxied first-claim route. Hosts already online without BLE use
203
+ the ordinary direct LAN claim operation.
204
+
205
+ Only `completed` carries `result`: `{hostId,wifiConfigured:true,commissioned:true,
206
+ hubId?}`. `hubId` is present when this operation explicitly established the first
207
+ Hub. `host` and optional reported IPv4 `addresses` remain in the snapshot. No
208
+ public snapshot, event, CLI or UI result contains `claimToken`. Terminal errors
209
+ are `failed` and `timed_out`, both with `error`; cancellation uses `cancelling`
210
+ then `cancelled`. Wrong codes and failed Wi-Fi joins return to their input states.
211
+ The supported errors include `bluetooth_unavailable`, `device_busy`,
212
+ `disconnected`, `code_rejected`, `code_locked`, `wifi_auth_failed`,
213
+ `wifi_not_found`, `wifi_failed`, `lan_unavailable`, `device_mismatch`,
214
+ `issue_failed` and `session_timeout`.
192
215
 
193
216
  The schema is `schema/host-provision.v1.schema.json`.
194
217
 
@@ -211,3 +234,37 @@ The schema is `schema/host-provision.v1.schema.json`.
211
234
  services, forgets saved Wi-Fi on BLE provisioning appliances, erases owners,
212
235
  the Host security store and bootstrap key, and returns to first provisioning.
213
236
  Machine identity and installed software are retained.
237
+
238
+ ## Interrupted first-Hub installation
239
+
240
+ The explicit first-Hub BLE flow records a durable installation intent before
241
+ trying Wi-Fi. Native obtains the securely paired Host identity and calls
242
+ `POST /api/v1/host/first-hub/begin` with `{spaceId, hostId, env, hostPublicKey}`
243
+ under the signed-in Owner. Cloud checks Space ownership and current Hub state,
244
+ returning `{intentId, space: {tenantId, spaceId}}`. The encrypted `prepareWifi`
245
+ bootstrap record carries this object as `firstHub`. It is not a Host claim or
246
+ permission to replace a Hub. Host persists it bound to its own installation key.
247
+
248
+ If Host was claimed to that Space but Core setup was interrupted, the next secure
249
+ `networkTarget` returns `{mode:"firstHub", intentId, spaceId, tenantId}`.
250
+ Native retains this exact Space and gets a fresh online Owner permit with
251
+ `POST /api/v1/host/first-hub/recovery/prepare {spaceId,intentId}`. It sends
252
+ `{op:"prepareWifi",mode:"bootstrapRecovery",firstHub:{intentId,space},authorizationId}`.
253
+ This is a compact private BLE record, not part of the public session snapshot.
254
+
255
+ After trial Wi-Fi obtains an IP, Host signs its current claimed status using the
256
+ permit as `probeId` and calls `/api/v1/host/first-hub/recovery/verify` over its
257
+ configured trusted HTTPS endpoint, bound to the trial Wi-Fi interface. Cloud
258
+ checks the Host signature and key, original Space, current Owner, five-minute
259
+ permit and absence of another Host's Hub/operation. The cloud permit determines
260
+ freshness; a rebooted Host clock does not extend it. Verification shares the
261
+ 30-second post-IP trial deadline. Failure discards the trial and restores the
262
+ previous network; the Host's original claim is retained.
263
+
264
+ A successful recovery enters `awaiting_authorization`, then the existing Hub
265
+ setup engine continues for the same paired Host. It does not submit another Host
266
+ claim. Hub completion closes the cloud intent generation before publication;
267
+ removing that Hub later does not revive the old intent. A local Core identity
268
+ already durably installed uses `ownHub` network change instead. Neither path
269
+ changes the installation role. Reset removes this pending intent with identity
270
+ and ownership, while preserving the installation role.
@@ -134,6 +134,20 @@ confirming connectivity with `prov-config` status. Inside a Wi-Fi change window
134
134
  the response also carries `"mode":"reprovision"` and `wifiConfigured` is false
135
135
  (section 4).
136
136
 
137
+ BLE `pod-info` is the network-phase DTO, not the LAN identity/receipt DTO above.
138
+ It carries `protocol`, `env`, `deviceId`, `model`, `firmwareVersion`,
139
+ `publicKey: [x, y]`, `wifiConfigured`, `state`, `dependentHost`, and optional
140
+ `mode`/`error: {code}`. It never includes `deviceBinding`, `podId`, `clientMode`
141
+ or a credential. `publicKey` is the same ES256 P-256 key as LAN: derive
142
+ `fingerprint = hex(SHA256(0x04 || x || y))` and `keyId = "p256:" + fingerprint`.
143
+ Coordinates are unpadded base64url. The complete JSON must fit 480 bytes,
144
+ leaving room for the authenticated record in one 512-byte ATT value.
145
+ `dependentHost` identifies a combined product eligible for explicit first-Hub
146
+ network setup; it is not an ownership grant. After the LAN handoff, the Client
147
+ requires the exact same key, device ID, environment and dependent-Host role,
148
+ then verifies the complete product binding and Host proof before authorization.
149
+ No fallback accepts the former full LAN DTO on BLE.
150
+
137
151
  `pod-credential` requests:
138
152
 
139
153
  - `{"op":"deliver","clientMode":"user","podId","loginGrant","spaceId","cloudApi","cloudWs"}` →
@@ -339,7 +353,7 @@ not request Bluetooth permission. BLE discovery uses the current Client's radio.
339
353
  Snapshots may contain both transports when several callers hold leases. A running
340
354
  Pod setup may continue LAN browsing to complete a handoff.
341
355
 
342
- Initial BLE Wi-Fi setup requires `enrollment: {spaceId, clientMode}`. An
356
+ Initial BLE Wi-Fi setup requires `enrollment: {spaceId, clientMode, firstHub?}`. An
343
357
  already-bound Pod changing Wi-Fi uses the stored authorization and omits it.
344
358
  An already-networked Pod selects its authorization in the LAN session.
345
359
 
@@ -357,8 +371,13 @@ trial and rejects a credential from a different Hub.
357
371
  embedded dependent Host. The selected Space must have no existing Hub or
358
372
  pending Hub transition. For BLE, include the flag in `enrollment` before sending
359
373
  Wi-Fi and repeat the same intent during authorization. An already-networked
360
- product supplies its intent during authorization. A standalone Pod rejects
361
- first Hub setup.
374
+ product supplies its intent during authorization. A retry may resume an existing
375
+ setup or published Hub only when its Host ID matches the securely paired
376
+ product. Removal, revocation, or another Host's operation blocks that retry.
377
+ The existing Hub setup engine owns continuation; the Client adopts the newly
378
+ published Hub only after checking its Host key, account, explicit Space and
379
+ unchanged local network. UI focus changes do not change this destination.
380
+ A standalone Pod rejects first Hub setup.
362
381
 
363
382
  Discovery is shared by every MeowLink device kind: each candidate carries
364
383
  `kind` (`pod` or `host`). `/local/pod/commission/start` accepts only `pod`
@@ -394,6 +413,29 @@ interface. On failure it discards the attempted network. A pod that reports
394
413
  example `wifi_hub_unverified` or `storage_failed`) in `detail`. UIs show such a session as changing the
395
414
  pod's Wi-Fi rather than adding a pod.
396
415
 
416
+ For a combined Linux product (`dependentHost: true`), the Native Client is the
417
+ single Security 2 pairing authority on both BLE and LAN. The Host peripheral
418
+ forwards encrypted records over the OS-private Pod socket; the Host owns the
419
+ Wi-Fi trial, verification and rollback. This is not a BLE discovery relay.
420
+ A secured `pod-info` `{"op":"networkTarget"}` read before a Wi-Fi trial returns
421
+ `{"mode":"space","spaceId":"...","tenantId":"..."}` for an ordinary Space
422
+ product, `{"mode":"unclaimed"}` before Host binding, or `{"mode":"ownHub"}` when its installed Core durable identity matches its
423
+ local Host claim. The ordinary product requires the signed-in owner to obtain the
424
+ current Hub identity online and send the `space` preparation record above.
425
+ An own-Hub product accepts `{"op":"prepareWifi","mode":"ownHub"}` only after
426
+ checking the installed Core identity against its local Host claim. It
427
+ changes network without trying to prove LAN membership against itself. Both
428
+ paths retain authorization and issue no new Pod credential.
429
+ The `commissioned` response in this Wi-Fi-only mode confirms the saved network;
430
+ it does not restore a revoked credential. A Linux product that already needs
431
+ reauthorization keeps that state and its existing binding after a network change.
432
+
433
+ The Linux trial binds discovery and the pinned connection to the new Wi-Fi
434
+ interface. It saves the NetworkManager profile only after Hub proof succeeds;
435
+ a failure or cancellation discards the trial and restores the previous profile.
436
+ Its total session polling budget also covers bounded network activation and
437
+ rollback; the Hub proof budget remains 30 seconds after obtaining an IP.
438
+
397
439
  Session states, in order: `connecting`, `awaiting_code`, `securing`,
398
440
  `reading_info`, `awaiting_wifi`, `joining_wifi`, `discovering_lan`,
399
441
  `connecting_lan`, `awaiting_authorization`,
@@ -526,3 +568,21 @@ An older registration for the same device cannot complete a different attempt.
526
568
  active local credential, returning `clientMode: "space"`; this read requires Space
527
569
  MANAGE. A cloud Space has no such local enrollment and returns `registered:false`.
528
570
  Both checks are read-only completion hooks. They do not issue or renew credentials.
571
+
572
+ ### Interrupted combined first Hub
573
+
574
+ A combined product uses the same durable first-Hub network intent and cloud
575
+ recovery permit as [Host provisioning](host-provisioning-v1.md#interrupted-first-hub-installation).
576
+ The secured `pod-info {op:"hostIdentity"}` returns the local Host's
577
+ `{hostId,publicKey:[x,y]}` through OS-private IPC while a network window is open.
578
+ The commissioner retains this identity across BLE-to-LAN handoff and checks it
579
+ against the product's signed binding before any claim or credential delivery.
580
+ The BLE record contains only the public identity and compact intent/permit;
581
+ full Host claim messages and Pod credentials remain on the LAN Security 2 channel.
582
+
583
+ If the Host is already bound and its first-Hub setup is pending, `networkTarget`
584
+ returns `firstHub` with the original intent and Space. Native obtains an online
585
+ Owner permit and submits `bootstrapRecovery`. If no Pod profile has been saved,
586
+ Wi-Fi success continues the defined LAN binding/Hub setup/Pod credential protocol.
587
+ An existing Pod profile keeps the Wi-Fi-only reprovision flow. Neither case
588
+ changes Space or clears the current Host authorization to bypass a failed check.
@@ -20,6 +20,8 @@ Every row contains `registrationId`, `clientMode` (`user` or `space`), `register
20
20
  `spaceId` and `appClientId`. Personal rows contain the saved `name`, `deviceId`,
21
21
  `model`, `platform`, `firmwareVersion`, `issuedAt`, and `activatedAt`.
22
22
  No tokens, enrollment grants, credential IDs or private keys are returned.
23
+ `observedAtMs`, `issuedAt`, and `activatedAt` are Unix milliseconds in Full.
24
+ Essential renders them in the authorized display time zone.
23
25
 
24
26
  Connection is an observation in the indicated Space, not global power state.
25
27
  Personal registration IDs are keyed by User and device public-key fingerprint;
@@ -1,4 +1,4 @@
1
- # Native Wave admission
1
+ # Wave authorization management
2
2
 
3
3
  These Hub-routed App Facades require current-Space Manage access and an active
4
4
  local Hub. They do not make Wave devices Hosts, Nodes or Plugins. No device URL,
@@ -13,11 +13,9 @@ Space/Hub selector, grant, certificate or private key is an input/output.
13
13
  Results are untrusted location hints, scoped to this caller, Space and Hub
14
14
  generation and transport, expiring after two minutes. They never grant operation
15
15
  authority.
16
- - `/app/wave/pair`: `{candidateId,pin?}` -> AdmissionResult below. This is a direct
17
- authenticated App interaction; Agent/MCP/cloud delegation cannot submit PINs.
18
- PIN6 is required when the selected device requires it. Omitting it is allowed
19
- only for an explicitly opened initial local-claim window. No fallback occurs.
20
- Retry reconciles an existing candidate; an uncertain result never rotates a key.
16
+ - `/app/wave/pair` is retired. Core rejects it with guidance to select the
17
+ Integration and use `/app/integration/connect`. Its constant/input DTO remain
18
+ readable for older clients; this route cannot enroll a device.
21
19
  - `/app/wave/list`: `{}` -> `{bindings:[{deviceId,grantState}]}`. States are
22
20
  `candidate` or `committed`; this is authorization bookkeeping, not Device/Twin
23
21
  inventory, online state or evidence that a candidate committed on the device.
@@ -33,6 +31,33 @@ fails. A later refresh uses the existing grant, without consuming another slot.
33
31
  Missing/uninstalled or incompatible contracts never install code automatically.
34
32
  Normal Device/capability APIs own subsequent observations, control and subscriptions.
35
33
 
34
+ Standard onboarding uses `/app/integration/connect` for a concrete local Integration
35
+ whose compiled model declares `connectAdapter: wave`. It uses the same interactive
36
+ start/input/resolve/next/confirm/read/retry lifecycle as other custom connections.
37
+ The built-in typed form supports PIN6 and explicitly opened initial no-PIN windows.
38
+ Core checks the selected resource before pairing, verifies it against authenticated
39
+ inventory after grant confirmation, writes the normal IntegrationInstall, and
40
+ publishes compatible entities. It creates no ordinary Connection record.
41
+
42
+ The lifecycle response includes `wave: {deviceId,grantState,inventoryState,installed,
43
+ entityIds,warnings,reason?}`. Completed projection is `status: done`; interrupted
44
+ setup is `status: failed, recoverable: true, canCancel: false`, preserving committed
45
+ facts. Retry first reconciles the durable candidate/identity through authenticated
46
+ operation. A committed grant continues installation without pairing. If the grant
47
+ is still unconfirmed, retry returns `needs_input` with a standard typed Flow view
48
+ for the same device. The user opens its pairing window again and re-enters its
49
+ current PIN when required; confirmation reuses the exact saved key/grant/attempt.
50
+ No retry replaces an existing device identity or replays a business command.
51
+
52
+ The decision to request new pairing input survives Core restart. Status can return
53
+ the reconstructed input view. Clients replace their displayed flow with this
54
+ authoritative retry/status view, including its step and revision; they must not
55
+ reuse commands or PINs from the previous page. Reconstructed pages use new step
56
+ identities, while ordinary next/refresh/confirm retain their revision fences.
57
+ Closing this input cancels only the interaction, preserving candidate credentials.
58
+ Additional unavailable capabilities warn without erasing compatible entities.
59
+ Preview selection does not install a business Integration. Integration uninstall
60
+ and physical grant removal are separate operations.
61
+
36
62
  Credentials remain Core-local, outside ordinary Connection/privateData/Twin/sync.
37
- Explicit Hub migration is outside this increment. Removal/invitation UI, BLE and
38
- physical target acceptance remain separate increments. Commands are never replayed.
63
+ Explicit Hub migration is outside this increment. Physical target acceptance and publication remain separate from source implementation. Commands are never replayed.
@@ -20,8 +20,16 @@
20
20
  "productId": "camera",
21
21
  "firmwareVersion": "0.9.0",
22
22
  "fingerprint": "5e6f7a8b0c1d2e3f405162738495a6b7c8d9eaf0123456789abcdef012345678",
23
- "wifiConfigured": false
23
+ "wifiConfigured": false,
24
+ "authorizationMode": "admin",
25
+ "onboardingRequired": true
24
26
  },
25
- "addresses": ["192.168.1.42"],
26
- "claimToken": "q3hX0v2c1mJb9yQe7tL4nK8sP5wR6uA0zD1fG2hI3jM"
27
+ "addresses": [
28
+ "192.168.1.42"
29
+ ],
30
+ "result": {
31
+ "hostId": "host-0f3c9a",
32
+ "wifiConfigured": true,
33
+ "commissioned": true
34
+ }
27
35
  }
@@ -1300,6 +1300,7 @@
1300
1300
  {
1301
1301
  "name": "pod-directory-unknown",
1302
1302
  "target": "/app/pod/list",
1303
+ "timezone": "Asia/Shanghai",
1303
1304
  "data": {
1304
1305
  "spaceId": "space-demo",
1305
1306
  "observedAtMs": 1800000000000,
@@ -1329,7 +1330,7 @@
1329
1330
  "status": "success",
1330
1331
  "essential": {
1331
1332
  "spaceId": "space-demo",
1332
- "observedAtMs": 1800000000000,
1333
+ "observedAtMs": "2027-01-15 16:00:00 +08:00 (Asia/Shanghai)",
1333
1334
  "pods": [
1334
1335
  {
1335
1336
  "registrationId": "pod-demo",
@@ -1340,8 +1341,8 @@
1340
1341
  "model": "Pod",
1341
1342
  "platform": "esp32",
1342
1343
  "firmwareVersion": "1.0.0",
1343
- "issuedAt": 1800000000000,
1344
- "activatedAt": 1800000001000,
1344
+ "issuedAt": "2027-01-15 16:00:00 +08:00 (Asia/Shanghai)",
1345
+ "activatedAt": "2027-01-15 16:00:01 +08:00 (Asia/Shanghai)",
1345
1346
  "connection": {
1346
1347
  "state": "unknown",
1347
1348
  "source": "unavailable",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.app-facade.v1",
3
- "contractVersion": "1.140.0",
3
+ "contractVersion": "1.142.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",
@@ -1,5 +1,5 @@
1
1
  {
2
- "contractVersion": "1.140.0",
2
+ "contractVersion": "1.142.0",
3
3
  "operations": {
4
4
  "/app/agent/context/get": "spaceRead",
5
5
  "/app/agent/credit/usage": "spaceRead",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.host-provision.targets.v1",
3
- "contractVersion": "1.140.0",
3
+ "contractVersion": "1.142.0",
4
4
  "contract": "contract/host-provisioning-v1.md",
5
5
  "localTargets": [
6
6
  "/local/host/provision/start",
@@ -8,6 +8,7 @@
8
8
  "/local/host/provision/wifi",
9
9
  "/local/host/provision/wifi/scan",
10
10
  "/local/host/provision/status",
11
+ "/local/host/provision/authorize",
11
12
  "/local/host/provision/cancel"
12
13
  ],
13
14
  "eventTargets": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.hub.targets.v1",
3
- "contractVersion": "1.140.0",
3
+ "contractVersion": "1.142.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.140.0",
3
+ "contractVersion": "1.142.0",
4
4
  "contract": "contract/pod-commissioning-v1.md",
5
5
  "localTargets": [
6
6
  "/local/pod/discovery/start",
@@ -373,6 +373,13 @@
373
373
  "expiresAt"
374
374
  ]
375
375
  },
376
+ "/app/pod/list": {
377
+ "ms": [
378
+ "observedAtMs",
379
+ "pods.*.issuedAt",
380
+ "pods.*.activatedAt"
381
+ ]
382
+ },
376
383
  "/app/host/directory/list": {
377
384
  "ms": [
378
385
  "observedAtMs"
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "manifest": "mhome.app-facade.routing.v1",
3
- "contractVersion": "1.140.0",
3
+ "contractVersion": "1.142.0",
4
4
  "targetPrefix": "/app/",
5
5
  "default": {
6
6
  "execution": "spaceMode"
7
7
  },
8
8
  "matching": "exactBeforePrefix",
9
9
  "placementJsonPointer": "/input/placement",
10
+ "unspacedCloudTargets": [
11
+ "/app/host/metrics",
12
+ "/app/host/permissions/get"
13
+ ],
10
14
  "rules": {
11
15
  "cloudPrefixes": [
12
16
  "/app/space/",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.messaging.targets.v1",
3
- "contractVersion": "1.140.0",
3
+ "contractVersion": "1.142.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.140.0",
3
+ "version": "1.142.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.140.0",
3
+ "contractVersion": "1.142.0",
4
4
  "manifest": "manifest/app-facade.v1.json",
5
5
  "schemas": {
6
6
  "storage": "schema/storage.v1.schema.json",
@@ -4,10 +4,22 @@
4
4
  "title": "Native-client Host provisioning session snapshot",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
- "required": ["sessionId", "revision", "state", "candidate", "expiresAtMs"],
7
+ "required": [
8
+ "sessionId",
9
+ "revision",
10
+ "state",
11
+ "candidate",
12
+ "expiresAtMs"
13
+ ],
8
14
  "properties": {
9
- "sessionId": { "type": "string", "minLength": 1 },
10
- "revision": { "type": "integer", "minimum": 0 },
15
+ "sessionId": {
16
+ "type": "string",
17
+ "minLength": 1
18
+ },
19
+ "revision": {
20
+ "type": "integer",
21
+ "minimum": 0
22
+ },
11
23
  "state": {
12
24
  "enum": [
13
25
  "connecting",
@@ -16,6 +28,8 @@
16
28
  "reading_info",
17
29
  "awaiting_wifi",
18
30
  "joining_wifi",
31
+ "awaiting_authorization",
32
+ "authorizing",
19
33
  "cancelling",
20
34
  "cancelled",
21
35
  "completed",
@@ -23,19 +37,58 @@
23
37
  "timed_out"
24
38
  ]
25
39
  },
26
- "candidate": { "$ref": "pod-discovery.v1.schema.json#/$defs/candidate" },
27
- "expiresAtMs": { "type": "integer", "minimum": 0 },
40
+ "candidate": {
41
+ "$ref": "pod-discovery.v1.schema.json#/$defs/candidate"
42
+ },
43
+ "expiresAtMs": {
44
+ "type": "integer",
45
+ "minimum": 0
46
+ },
28
47
  "host": {
29
48
  "type": "object",
30
49
  "additionalProperties": false,
31
- "required": ["hostId", "name", "firmwareVersion", "fingerprint", "wifiConfigured"],
50
+ "required": [
51
+ "hostId",
52
+ "name",
53
+ "firmwareVersion",
54
+ "fingerprint",
55
+ "wifiConfigured",
56
+ "authorizationMode",
57
+ "onboardingRequired"
58
+ ],
32
59
  "properties": {
33
- "hostId": { "type": "string", "minLength": 1 },
34
- "name": { "type": "string", "minLength": 1 },
35
- "productId": { "type": "string" },
36
- "firmwareVersion": { "type": "string", "minLength": 1 },
37
- "fingerprint": { "type": "string", "minLength": 1 },
38
- "wifiConfigured": { "type": "boolean" }
60
+ "hostId": {
61
+ "type": "string",
62
+ "minLength": 1
63
+ },
64
+ "name": {
65
+ "type": "string",
66
+ "minLength": 1
67
+ },
68
+ "productId": {
69
+ "type": "string"
70
+ },
71
+ "firmwareVersion": {
72
+ "type": "string",
73
+ "minLength": 1
74
+ },
75
+ "fingerprint": {
76
+ "type": "string",
77
+ "minLength": 1
78
+ },
79
+ "wifiConfigured": {
80
+ "type": "boolean"
81
+ },
82
+ "authorizationMode": {
83
+ "enum": [
84
+ "admin",
85
+ "spaceSelf",
86
+ "spaceDep"
87
+ ]
88
+ },
89
+ "onboardingRequired": {
90
+ "type": "boolean"
91
+ }
39
92
  }
40
93
  },
41
94
  "networks": {
@@ -43,28 +96,46 @@
43
96
  "items": {
44
97
  "type": "object",
45
98
  "additionalProperties": false,
46
- "required": ["ssid", "rssi", "secured"],
99
+ "required": [
100
+ "ssid",
101
+ "rssi",
102
+ "secured"
103
+ ],
47
104
  "properties": {
48
- "ssid": { "type": "string", "minLength": 1 },
49
- "rssi": { "type": "integer" },
50
- "secured": { "type": "boolean" }
105
+ "ssid": {
106
+ "type": "string",
107
+ "minLength": 1
108
+ },
109
+ "rssi": {
110
+ "type": "integer"
111
+ },
112
+ "secured": {
113
+ "type": "boolean"
114
+ }
51
115
  }
52
116
  }
53
117
  },
118
+ "authorization": {
119
+ "$ref": "pod-commission.v1.schema.json#/properties/authorization"
120
+ },
121
+ "enrollment": {
122
+ "$ref": "pod-commission.v1.schema.json#/properties/enrollment"
123
+ },
54
124
  "addresses": {
55
125
  "description": "IPv4 LAN addresses reported by the Host; may be empty",
56
126
  "type": "array",
57
- "items": { "type": "string", "format": "ipv4" }
58
- },
59
- "claimToken": {
60
- "description": "One-time token for the first claim of this Host",
61
- "type": "string",
62
- "pattern": "^[A-Za-z0-9_-]{43}$"
127
+ "items": {
128
+ "type": "string",
129
+ "format": "ipv4"
130
+ }
63
131
  },
64
132
  "error": {
65
133
  "type": "object",
66
134
  "additionalProperties": false,
67
- "required": ["code", "message"],
135
+ "required": [
136
+ "code",
137
+ "message"
138
+ ],
68
139
  "properties": {
69
140
  "code": {
70
141
  "enum": [
@@ -76,48 +147,198 @@
76
147
  "wifi_auth_failed",
77
148
  "wifi_not_found",
78
149
  "wifi_failed",
79
- "session_timeout"
150
+ "lan_unavailable",
151
+ "device_mismatch",
152
+ "session_timeout",
153
+ "issue_failed"
80
154
  ]
81
155
  },
82
- "message": { "type": "string" },
83
- "detail": { "type": "string" }
156
+ "message": {
157
+ "type": "string"
158
+ },
159
+ "detail": {
160
+ "type": "string"
161
+ }
162
+ }
163
+ },
164
+ "result": {
165
+ "type": "object",
166
+ "additionalProperties": false,
167
+ "required": [
168
+ "hostId",
169
+ "wifiConfigured",
170
+ "commissioned"
171
+ ],
172
+ "properties": {
173
+ "hostId": {
174
+ "type": "string",
175
+ "minLength": 1
176
+ },
177
+ "wifiConfigured": {
178
+ "const": true
179
+ },
180
+ "commissioned": {
181
+ "const": true
182
+ },
183
+ "hubId": {
184
+ "type": "string",
185
+ "minLength": 1
186
+ }
84
187
  }
85
188
  }
86
189
  },
87
190
  "allOf": [
88
191
  {
89
- "if": { "properties": { "state": { "enum": ["failed", "timed_out"] } } },
90
- "then": { "properties": { "error": {} }, "required": ["error"] }
192
+ "if": {
193
+ "properties": {
194
+ "state": {
195
+ "enum": [
196
+ "failed",
197
+ "timed_out"
198
+ ]
199
+ }
200
+ }
201
+ },
202
+ "then": {
203
+ "properties": {
204
+ "error": {}
205
+ },
206
+ "required": [
207
+ "error"
208
+ ]
209
+ }
91
210
  },
92
211
  {
93
212
  "if": {
94
213
  "properties": {
95
- "state": { "not": { "enum": ["failed", "timed_out", "awaiting_code", "awaiting_wifi"] } }
214
+ "state": {
215
+ "not": {
216
+ "enum": [
217
+ "failed",
218
+ "timed_out",
219
+ "awaiting_code",
220
+ "awaiting_wifi",
221
+ "awaiting_authorization"
222
+ ]
223
+ }
224
+ }
96
225
  }
97
226
  },
98
- "then": { "not": { "properties": { "error": {} }, "required": ["error"] } }
227
+ "then": {
228
+ "not": {
229
+ "properties": {
230
+ "error": {}
231
+ },
232
+ "required": [
233
+ "error"
234
+ ]
235
+ }
236
+ }
99
237
  },
100
238
  {
101
- "if": { "properties": { "state": { "const": "awaiting_code" } }, "required": ["error"] },
102
- "then": { "properties": { "error": { "type": "object", "properties": { "code": { "const": "code_rejected" } } } } }
239
+ "if": {
240
+ "properties": {
241
+ "state": {
242
+ "const": "awaiting_code"
243
+ }
244
+ },
245
+ "required": [
246
+ "error"
247
+ ]
248
+ },
249
+ "then": {
250
+ "properties": {
251
+ "error": {
252
+ "type": "object",
253
+ "properties": {
254
+ "code": {
255
+ "const": "code_rejected"
256
+ }
257
+ }
258
+ }
259
+ }
260
+ }
103
261
  },
104
262
  {
105
- "if": { "properties": { "state": { "const": "awaiting_wifi" } }, "required": ["error"] },
263
+ "if": {
264
+ "properties": {
265
+ "state": {
266
+ "const": "awaiting_wifi"
267
+ }
268
+ },
269
+ "required": [
270
+ "error"
271
+ ]
272
+ },
106
273
  "then": {
107
274
  "properties": {
108
275
  "error": {
109
276
  "type": "object",
110
277
  "properties": {
111
- "code": { "enum": ["wifi_auth_failed", "wifi_not_found", "wifi_failed"] }
278
+ "code": {
279
+ "enum": [
280
+ "wifi_auth_failed",
281
+ "wifi_not_found",
282
+ "wifi_failed"
283
+ ]
284
+ }
112
285
  }
113
286
  }
114
287
  }
115
288
  }
116
289
  },
117
290
  {
118
- "if": { "properties": { "state": { "const": "completed" } } },
119
- "then": { "properties": { "host": {} }, "required": ["host"] },
120
- "else": { "not": { "properties": { "claimToken": {} }, "required": ["claimToken"] } }
291
+ "if": {
292
+ "properties": {
293
+ "state": {
294
+ "const": "completed"
295
+ }
296
+ }
297
+ },
298
+ "then": {
299
+ "properties": {
300
+ "host": {},
301
+ "result": {}
302
+ },
303
+ "required": [
304
+ "host",
305
+ "result"
306
+ ]
307
+ },
308
+ "else": {
309
+ "not": {
310
+ "properties": {
311
+ "result": {}
312
+ },
313
+ "required": [
314
+ "result"
315
+ ]
316
+ }
317
+ }
318
+ },
319
+ {
320
+ "if": {
321
+ "properties": {
322
+ "state": {
323
+ "const": "awaiting_authorization"
324
+ }
325
+ },
326
+ "required": [
327
+ "error"
328
+ ]
329
+ },
330
+ "then": {
331
+ "properties": {
332
+ "error": {
333
+ "type": "object",
334
+ "properties": {
335
+ "code": {
336
+ "const": "issue_failed"
337
+ }
338
+ }
339
+ }
340
+ }
341
+ }
121
342
  }
122
343
  ]
123
344
  }
@@ -107,7 +107,8 @@
107
107
  "required": ["spaceId", "clientMode"],
108
108
  "properties": {
109
109
  "spaceId": { "type": "string", "minLength": 1 },
110
- "clientMode": { "enum": ["user", "space"] }
110
+ "clientMode": { "enum": ["user", "space"] },
111
+ "firstHub": { "type": "boolean" }
111
112
  }
112
113
  },
113
114
  "authorization": {
@@ -11,6 +11,7 @@
11
11
  "default",
12
12
  "matching",
13
13
  "placementJsonPointer",
14
+ "unspacedCloudTargets",
14
15
  "rules"
15
16
  ],
16
17
  "properties": {
@@ -42,6 +43,9 @@
42
43
  "placementJsonPointer": {
43
44
  "const": "/input/placement"
44
45
  },
46
+ "unspacedCloudTargets": {
47
+ "$ref": "#/$defs/targetList"
48
+ },
45
49
  "rules": {
46
50
  "type": "object",
47
51
  "additionalProperties": false,