@mhome/core-protocol 1.62.1 → 1.72.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.
- package/contract/extension-preview-v1.md +54 -0
- package/contract/extension-sources-v1.md +107 -0
- package/contract/{node-metadata-v1.md → node-metadata-v2.md} +50 -7
- package/contract/storage-v1.md +202 -0
- package/fixtures/extension-sources.conformance.json +520 -0
- package/fixtures/operation-timeouts.conformance.json +242 -25
- package/manifest/core.v1.json +22 -4
- package/manifest/operation-timeouts.v1.json +3 -3
- package/package.json +1 -1
- package/protocol.json +4 -2
- package/schema/node-metadata.v2.schema.json +129 -0
- package/schema/storage.v1.schema.json +548 -0
- package/schema/node-metadata.v1.schema.json +0 -65
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Integration Preview apply
|
|
2
|
+
|
|
3
|
+
This source contract implements standard Integration Preview on a Local Space Hub.
|
|
4
|
+
Native Plugin Preview and long-lived subscription refresh have separate owners.
|
|
5
|
+
|
|
6
|
+
App calls use the ordinary Facade envelope and Space authorization:
|
|
7
|
+
|
|
8
|
+
| Target | Input | Business output | Owner |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `/app/integration/preview/apply` | `ApplyPreviewRequest` | `spaceId`, exact `source`, `activated: true` | Selected Local Hub; Space write |
|
|
11
|
+
| `/app/integration/preview/status` | `{}` | `spaceId`, active Preview `sources`, `refreshPending` | Selected Local Hub; Space read |
|
|
12
|
+
| `/app/resource/transfer/prepare` | `sizeBytes`, `sha256` | `reference`, presigned PUT `url`, required `headers` | Cloud; Space write |
|
|
13
|
+
|
|
14
|
+
`ApplyPreviewRequest.material` contains a `PreviewManifest` as UTF-8 JSON.
|
|
15
|
+
`scripts` maps function names to the separately transferred UTF-8 ESM bodies.
|
|
16
|
+
Each resource is `{"kind":"inline","text":"..."}` or
|
|
17
|
+
`{"kind":"object","reference":{...}}`. No client-selected download URL, filesystem
|
|
18
|
+
path, tenant or Hub identifier is accepted. The CLI sends bytes to the explicitly
|
|
19
|
+
selected Space; the desktop and Hub may be on different machines.
|
|
20
|
+
|
|
21
|
+
The manifest has `formatVersion: 1`, `integrationId`, `schemas` (relative filename
|
|
22
|
+
to YAML), `i18n` (language to YAML), and `scripts` (function to ScriptArtifact).
|
|
23
|
+
The Hub derives its content identity from canonical serialization, using sorted
|
|
24
|
+
maps. A Preview has no release version. Its exact script inventory and every size,
|
|
25
|
+
digest and runtime SDK version are checked before activation. Limits: 16 MiB
|
|
26
|
+
manifest, 100 scripts, 4 MiB per script, 1 MiB serialized apply input. Script bodies
|
|
27
|
+
do not share the manifest's 16 MiB budget.
|
|
28
|
+
|
|
29
|
+
Optional `configuration` is a separate JSON object, limited to 64 KiB/1000 keys.
|
|
30
|
+
Omission preserves Hub values; explicit null removes a key. Values are checked
|
|
31
|
+
against the candidate's declarations, and removed declarations are projected out.
|
|
32
|
+
Configuration is absent from source hashes, publication objects, compiler callbacks
|
|
33
|
+
and status responses. It is stored by Space/Integration only on the Hub and committed
|
|
34
|
+
with the source/models. Published configuration sync cannot replace it. Runtime-only
|
|
35
|
+
cloud evaluation can read the exact active Preview configuration through the
|
|
36
|
+
authenticated `/dispatch/integration/preview/env/read` callback (`integrationId`,
|
|
37
|
+
`snapshot` -> `values`); a changed source rejects the read. Cloud JS remains deferred.
|
|
38
|
+
|
|
39
|
+
Temporary transfers reuse the private transport bucket, not a release bucket.
|
|
40
|
+
References contain a random 32-hex `id`, `expiresAt` in Unix milliseconds,
|
|
41
|
+
`sizeBytes` and a SHA-256 digest. They expire after five minutes. Hub resolution uses
|
|
42
|
+
`/bridge/resource/transfer/read` in its authenticated tenant/Space; the cloud derives
|
|
43
|
+
the object key and returns a GET grant. Receivers reject changed references,
|
|
44
|
+
redirects, oversized/truncated bodies, invalid UTF-8 and digest mismatches.
|
|
45
|
+
Objects are transient; no upload-session database or Preview operation journal is added.
|
|
46
|
+
|
|
47
|
+
The ordinary 60-second request deadline covers Hub downloads, Lion preparation,
|
|
48
|
+
activation and request-awaited projection. Child calls inherit remaining time;
|
|
49
|
+
resource HTTP has an additional 30-second cap. Build/capture is a prior local step.
|
|
50
|
+
Preparation failure leaves active source and configuration unchanged. Immutable
|
|
51
|
+
candidate resources may remain unreferenced. Activation commits locally before
|
|
52
|
+
projection; a subsequent failure reports `details.activated: true` and can be retried
|
|
53
|
+
with the same content. Timeout may prevent that response, so query status if needed.
|
|
54
|
+
There is no automatic rollback, exit operation, history selector or published fallback.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Space-owned Integration source reads
|
|
2
|
+
|
|
3
|
+
`extension_sources` defines the compiler's source-read callback, not publication,
|
|
4
|
+
installation authority, or an Integration business lifecycle. The caller supplies
|
|
5
|
+
tenant/Space through the existing authenticated Bridge envelope. Neither payload
|
|
6
|
+
accepts caller-controlled tenant/Space fields.
|
|
7
|
+
|
|
8
|
+
| Route | Request | Response |
|
|
9
|
+
| --- | --- | --- |
|
|
10
|
+
| `/dispatch/extension/sources/snapshot` | `{}` | `SpaceSources` |
|
|
11
|
+
| `/dispatch/extension/sources/read` | `SourceReadRequest` | `SourceReadResponse` |
|
|
12
|
+
| `/dispatch/extension/acquire` | `{integrations: string[]}` | `true` after preparation/activation |
|
|
13
|
+
| `/dispatch/extension/resources/plan` | `{capabilityId, role, source}` | `{invokePlan}` from the exact local cache |
|
|
14
|
+
| `/dispatch/extension/resources/guides` | `{keys: [{capabilityId, version?, snapshot?, type}]}` | `{guides: [{key, guide}]}` from the exact local cache |
|
|
15
|
+
|
|
16
|
+
Local Spaces own these records on their bound Hub. Cloud Spaces own published
|
|
17
|
+
selections in a separate Space-partitioned cloud table and cannot select a local
|
|
18
|
+
preview. Published package bodies remain in the release registry/object store.
|
|
19
|
+
The developer's desktop Host may differ from that Hub. Preview material is
|
|
20
|
+
transferred as content, not as a desktop-local pathname. Native Plugin installation
|
|
21
|
+
and its Space binding remain separate from this source-read protocol.
|
|
22
|
+
|
|
23
|
+
A source contains `integrationId`, `type` (`standard` or `composite`), and exactly
|
|
24
|
+
one content identity: a positive signed-32-bit `version` for a registry release,
|
|
25
|
+
or a lowercase SHA-256 `snapshot` for Preview. Preview has no numeric version and
|
|
26
|
+
cannot replace `base` or a composite package. Neither identity may substitute for
|
|
27
|
+
the other.
|
|
28
|
+
|
|
29
|
+
`SpaceSources` contains a safe-integer `revision` and up to 1,000 `integrations`,
|
|
30
|
+
with at most 256 KiB of encoded selection metadata on both storage platforms.
|
|
31
|
+
There is at most one published source and one Preview override per
|
|
32
|
+
`(integrationId, type)`. The shared resolver selects Preview first regardless of
|
|
33
|
+
list order. Updating a published source does not displace its override; exiting
|
|
34
|
+
Preview removes only that override and resolves the ordinary source again. Without
|
|
35
|
+
an ordinary source, the ID is unavailable. The complete selection is
|
|
36
|
+
replaced using its expected revision; a stale writer fails without partial edits.
|
|
37
|
+
Revision zero and an empty list represent a Space with no selections. Acquiring a
|
|
38
|
+
package and creating its business Connection remain separate operations.
|
|
39
|
+
|
|
40
|
+
The read request contains one exact `source`. The response echoes that exact
|
|
41
|
+
source, `schemas` (normalized relative YAML paths to UTF-8 text), and
|
|
42
|
+
`scriptDigests` (function name to lowercase SHA-256), and required `i18n`
|
|
43
|
+
(language tag to intro-translation YAML; an empty map is valid). English remains
|
|
44
|
+
in the schema. Language tags follow the existing intro-i18n grammar; path-like,
|
|
45
|
+
empty, or malformed tags and empty content are rejected. Relative paths may include
|
|
46
|
+
directories but reject empty/dot/parent segments, backslashes, colons and NULs.
|
|
47
|
+
Each inventory has at most 1,000 members; the encoded material is at most
|
|
48
|
+
16 MiB, below the existing general Bridge payload ceiling. Its normal bulk
|
|
49
|
+
transport handles large responses. No JavaScript body or credentials are sent
|
|
50
|
+
to the compiler by this callback.
|
|
51
|
+
|
|
52
|
+
Preparation stores immutable candidate material without changing availability.
|
|
53
|
+
Core stores compiler material as bounded, digest-checked files under its workdir's
|
|
54
|
+
`packages/extensions/preview/sources/`; database rows retain identities and hashes,
|
|
55
|
+
not duplicate Schema bodies. Files must be complete before recording references.
|
|
56
|
+
The compiler can read that exact candidate while preparation waits for validation.
|
|
57
|
+
Source and resource read handlers do not compile, call the cloud, or acquire Automation/lifecycle/cache
|
|
58
|
+
locks. They only read the selected Space's stored material. Missing or mismatched
|
|
59
|
+
material fails; there is no owner-catalog or latest-version fallback.
|
|
60
|
+
|
|
61
|
+
Removing a selection does not delete immutable material required by cleanup or
|
|
62
|
+
saved plans. Preview and published Integrations use the same disconnect/uninstall
|
|
63
|
+
business lifecycle; these read routes do not delete Connections or rewrite user
|
|
64
|
+
Automations. Resource retention and invocation admission belong to the resource
|
|
65
|
+
and lifecycle consumers, not this read protocol.
|
|
66
|
+
|
|
67
|
+
Preview compilation uses the exact candidate plus explicitly acquired dependency
|
|
68
|
+
materials. Its result must retain every source identity; numeric versions and
|
|
69
|
+
staging/prod channel names do not identify Preview bytes. Channels choose release
|
|
70
|
+
heads/configuration, and promotion does not change the immutable release identity.
|
|
71
|
+
The complete material set for one compilation is bounded to 16 MiB of encoded
|
|
72
|
+
material. Translation contents contribute to the material hash and byte bounds.
|
|
73
|
+
|
|
74
|
+
Provider configuration is not compiler material. Preview provider vars are supplied
|
|
75
|
+
explicitly to the owning Hub through a separate configuration operation, remain
|
|
76
|
+
Space-scoped, and are never part of this source callback or a publication artifact.
|
|
77
|
+
Omitted configuration on repeated Preview preserves existing values; explicit
|
|
78
|
+
updates/deletions are validated against the candidate schema. That configuration
|
|
79
|
+
consumer, compiled-result transport and runtime activation are subsequent work.
|
|
80
|
+
|
|
81
|
+
## Runtime preparation
|
|
82
|
+
|
|
83
|
+
`/bridge/schema/prepare` carries the Hub's current `SpaceSources`, requested package
|
|
84
|
+
IDs, and known model content hashes. Lion acquires latest published dependencies,
|
|
85
|
+
keeps Preview overrides, and prepares one exact graph without saving the selection.
|
|
86
|
+
The response includes the candidate selection, manifest, complete model identities,
|
|
87
|
+
changed models, published provider configuration and affected derived plans/guides.
|
|
88
|
+
A source or publication head changing during preparation fails the response.
|
|
89
|
+
Core stores immutable resources first, then commits selection and matching runtime
|
|
90
|
+
models/provider data under one local transaction. A stale selection revision rolls
|
|
91
|
+
back that transaction. Projection refresh remains the existing retryable operation.
|
|
92
|
+
|
|
93
|
+
Runtime `PlanSource` contains exactly one positive `version` or lowercase SHA-256
|
|
94
|
+
`snapshot`, plus `type` and `archived`. Plan cache keys use `v<version>` or
|
|
95
|
+
`p<snapshot>`; guide keys and frozen invocation references carry the same source.
|
|
96
|
+
Derived snapshots cover exact dependency material, environment and compiler/protocol
|
|
97
|
+
identity. Unaffected published packages retain their released keys. A missing Preview
|
|
98
|
+
plan/guide/script is an error, never a registry lookup or published fallback.
|
|
99
|
+
|
|
100
|
+
Acquisition is the mutating route above; it is distinct from source/resource read
|
|
101
|
+
callbacks and shares the caller's deadline. It finishes before installation or
|
|
102
|
+
connection reads its first runtime model. Catalog browsing does not acquire packages.
|
|
103
|
+
Catalog guide reads may supply `integrationIds` to `/bridge/schema/manifest`;
|
|
104
|
+
Lion returns the prospective package/dependency selection without activating it.
|
|
105
|
+
An empty list reads the current Space selection. Installed guide reads continue to
|
|
106
|
+
use committed local sources, including while offline. Public Preview commands and
|
|
107
|
+
configuration activation remain a later slice.
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
# Node
|
|
1
|
+
# Node source metadata
|
|
2
2
|
|
|
3
3
|
`POST /node/metadata` with `{}` is available over commissioning HTTPS and the
|
|
4
4
|
existing authenticated Node request transport. It returns `NodeMetadata` under
|
|
5
|
-
`schema/node-metadata.
|
|
5
|
+
`schema/node-metadata.v2.schema.json`. It does not start a business runtime.
|
|
6
6
|
|
|
7
7
|
Delivery describes ownership, independently of `kind` (`core` or `extension`):
|
|
8
8
|
|
|
9
|
-
- `host`:
|
|
10
|
-
|
|
9
|
+
- `host`: published services ask their local Host for the actual installed release
|
|
10
|
+
manifest. Preview services read their launch-specific Host proof, described below.
|
|
11
|
+
Published evidence comes from installation state, never the latest catalog.
|
|
11
12
|
The SDK checks node type, service ID and version against its running process.
|
|
12
13
|
- `firmware`: a dedicated implementation embeds its publisher-signed definition
|
|
13
14
|
and version in the binary. Updates replace it with the firmware/application.
|
|
@@ -20,8 +21,8 @@ reports its embedded AAR release version. Publishing a new AAR does not update a
|
|
|
20
21
|
installed App. This classification describes the update owner, not the hardware
|
|
21
22
|
category or whether the Plugin is `core` or `extension`.
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
signature. Host manifests use `meow.plugin.manifest[-bundle]`; embedded releases
|
|
24
|
+
A `source.kind=published` response carries `source.releaseManifest` with exact
|
|
25
|
+
signed manifest bytes and the detached Minisign signature. Host manifests use `meow.plugin.manifest[-bundle]`; embedded releases
|
|
25
26
|
use `meow.node.firmware-manifest[-bundle]`, with `platform`, `pluginId`,
|
|
26
27
|
`componentId`, `version`, `nodeMetadata.plugin` and `compatibility` at the payload
|
|
27
28
|
root. Host release components retain their normal package manifest structure.
|
|
@@ -42,7 +43,8 @@ requests still require the challenge-proven TLS key.
|
|
|
42
43
|
Core persists `NodeBindingMetadata` with each binding for offline management.
|
|
43
44
|
Every `/node/auth` request includes required `metadata` for the running release.
|
|
44
45
|
Core authenticates the token and binding first, then verifies the publisher
|
|
45
|
-
signature, stable identity, runtime
|
|
46
|
+
signature (or explicitly selected Host Preview proof), stable identity, runtime
|
|
47
|
+
version and private protocol compatibility.
|
|
46
48
|
Only then may it activate the token and return `ok: true`. Release validation
|
|
47
49
|
failure rejects the connection without revoking the binding or requesting
|
|
48
50
|
`CLEAR_LOCAL_IDENTITY`. No catalog/network lookup is part of authentication.
|
|
@@ -73,3 +75,44 @@ Manifest bytes are bounded to 1 MiB, signatures to 4 KiB. No publisher secret or
|
|
|
73
75
|
account credential is included. Existing databases require explicit rebuilding
|
|
74
76
|
when the baseline binding snapshot column is introduced; startup does not migrate
|
|
75
77
|
or erase data.
|
|
78
|
+
|
|
79
|
+
## Native Preview
|
|
80
|
+
|
|
81
|
+
`source.kind=preview` is Host delivery only. It carries exact `manifest` bytes and
|
|
82
|
+
`hostProof`, a compact JWS under the existing Host P-256 key and the dedicated
|
|
83
|
+
`meow-plugin-preview+jwt` purpose. The proof binds Host ID, runtime environment and
|
|
84
|
+
manifest SHA-256. It is provenance, not a Space token; there is no separate lease.
|
|
85
|
+
A publisher verification failure never tries this path.
|
|
86
|
+
|
|
87
|
+
The small manifest contains formatVersion=1, Plugin definition, platform,
|
|
88
|
+
serviceVersion, optional coreProtocol and filesSha256. The complete file inventory
|
|
89
|
+
stays on Host in `preview-files.json`; its hash is covered by the manifest/proof.
|
|
90
|
+
The manifest also carries an explicit `requires` map (possibly empty), keyed by
|
|
91
|
+
`host`/`client` with version requirements. The installing Host parses and checks
|
|
92
|
+
these against installed platform versions before stopping the current service.
|
|
93
|
+
It persists them with installed compatibility for subsequent platform update
|
|
94
|
+
planning. Preview does not silently upgrade Host or Client.
|
|
95
|
+
The inventory contains safe relative paths and each file's size and SHA-256.
|
|
96
|
+
The Host copies and verifies a complete candidate before selection. Proofs never
|
|
97
|
+
include private keys, account credentials or native payload bytes.
|
|
98
|
+
|
|
99
|
+
Initial enable uses the ordinary authenticated Space Manage request with an
|
|
100
|
+
explicit Preview expectation (hostId, hostPublicKey, manifestSha256) obtained from
|
|
101
|
+
that computer's OS-authenticated Host socket. Node-supplied metadata cannot select
|
|
102
|
+
the trusted key. The signed commissioning challenge must match that expectation.
|
|
103
|
+
Bindings record their verified Host public key for both published and Preview
|
|
104
|
+
sources. Reconnect verifies Preview with that saved key, the token's Host identity,
|
|
105
|
+
and current environment; this allows one Host's replacement to reach every
|
|
106
|
+
existing bound Space without issuing new credentials. A failed check leaves the
|
|
107
|
+
binding intact and disconnected.
|
|
108
|
+
|
|
109
|
+
The SDK reads Preview evidence from its actual canonical executable package,
|
|
110
|
+
never from the current mutable Host selection. Missing/corrupt Preview launch
|
|
111
|
+
evidence fails; a running older same-version process cannot claim a newer build.
|
|
112
|
+
Auth acknowledgements must match source kind as well as manifest hash/version.
|
|
113
|
+
Published firmware retains publisher verification and never accepts Preview.
|
|
114
|
+
|
|
115
|
+
This v2 envelope replaces v1; Host, Core, native SDK consumers and firmware must
|
|
116
|
+
consume the matching protocol together. No legacy reader or database conversion
|
|
117
|
+
is provided. Runtime business data and binding identities remain unchanged by a
|
|
118
|
+
normal Preview replacement.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Storage capability, version 1
|
|
2
|
+
|
|
3
|
+
`mhome-storage-api` owns logical Folder and object contracts, usage,
|
|
4
|
+
path validation and structured errors. It has no Catalog, filesystem or network
|
|
5
|
+
implementation. Core API re-exports it and adds binding and Host TLS messages;
|
|
6
|
+
App Facade API re-exports the same contracts for `/app/object-storage/`.
|
|
7
|
+
|
|
8
|
+
The wire generation is `storage.v1`; package versions independently identify
|
|
9
|
+
published build artifacts. During development, providers and consumers are
|
|
10
|
+
updated together. Earlier development contracts are not negotiated or served.
|
|
11
|
+
|
|
12
|
+
## Names and ownership
|
|
13
|
+
|
|
14
|
+
A Folder's immutable `id` is its exact case-sensitive UTF-8 path within one
|
|
15
|
+
(tenant, Space). Names are never normalized or silently trimmed. Use `home/<path>`,
|
|
16
|
+
`plugin/<unique-plugin-name>/<bound-instance>/<path>`, or `core/<module>/<path>`.
|
|
17
|
+
Segments contain 1–80 Unicode characters, with no edge whitespace, control
|
|
18
|
+
characters, backslash, empty segments, `.` or `..`. Paths contain at most 16
|
|
19
|
+
segments and 1024 UTF-8 bytes; no leading or trailing slash. These logical paths
|
|
20
|
+
are never joined to disk paths. Unicode spellings remain distinct exact IDs.
|
|
21
|
+
|
|
22
|
+
`folders/create` takes `folderId`, is idempotent, and creates missing parents
|
|
23
|
+
below the namespace root in one transaction. Namespace roots themselves are
|
|
24
|
+
virtual and cannot be created or deleted. `folders/get` and `folders/list` return
|
|
25
|
+
path IDs, system/deleting flags, timestamps, direct usage and subtree quota
|
|
26
|
+
snapshots. Paths have no display-name alias or rename endpoint. Storage does not
|
|
27
|
+
automatically evict data or infer consumer-folder mappings.
|
|
28
|
+
|
|
29
|
+
App/CLI/Agent users may create, delete and acquire data sessions only under
|
|
30
|
+
`home/`. Space-authorized diagnostics may list Plugin/system Folder usage.
|
|
31
|
+
Bound Plugins may create multiple Folders, read and acquire sessions, or delete
|
|
32
|
+
only inside `plugin/<name>/<instance>/`. Core derives the name from verified
|
|
33
|
+
binding metadata and the instance from authenticated context; `nodeType`, a
|
|
34
|
+
request path or a caller-supplied name is not ownership proof. Core internal
|
|
35
|
+
modules use `core/<module>/...`. The protected `artifact` Folder is created and
|
|
36
|
+
used only through Artifact APIs; it has no ordinary sessions or Storage settings.
|
|
37
|
+
|
|
38
|
+
## Folder quota settings
|
|
39
|
+
|
|
40
|
+
`folders/set-limit` takes exactly `{ "folderId": "<path>", "maxBytes": "<bytes>" }`.
|
|
41
|
+
Both fields are required. `maxBytes` is a canonical positive decimal string in
|
|
42
|
+
1..9223372036854775807, or explicit `null` to remove this Folder's own limit.
|
|
43
|
+
The result is the updated Folder. App Facade uses
|
|
44
|
+
`/app/object-storage/folders/set-limit`; authenticated Node requests use the same
|
|
45
|
+
target with Plugin context derived by Core. Space members can change any ordinary Folder
|
|
46
|
+
setting, including Plugin Folders, without acquiring content mutation permission.
|
|
47
|
+
Plugins can change only their own authenticated namespace. System `artifact` and
|
|
48
|
+
deleting Folders reject settings. There is no version check: last committed write wins.
|
|
49
|
+
|
|
50
|
+
Limits cover a Folder and all descendants across every physical repository.
|
|
51
|
+
Every limited ancestor applies even if a child has no own limit. `quota` contains
|
|
52
|
+
`maxBytes` (own setting), `usedBytes` (subtree committed bytes), `reservedBytes`
|
|
53
|
+
(subtree admitted/uncertain/cleanup writes), `remainingBytes` (minimum remaining
|
|
54
|
+
allowance across this Folder and limited ancestors, or null if none), and
|
|
55
|
+
`exceeded` (any applicable limit is below its charged usage). All byte fields use
|
|
56
|
+
decimal strings. Existing top-level `usedBytes`, `reservedBytes`, and `objectCount`
|
|
57
|
+
continue to describe only the Folder's direct objects.
|
|
58
|
+
|
|
59
|
+
Core checks and reserves the declared object length atomically against all
|
|
60
|
+
applicable limits before physical write preparation. Concurrent descendants cannot
|
|
61
|
+
spend the same allowance. Publication transfers reserved to used; confirmed
|
|
62
|
+
physical deletion/retirement releases the corresponding charge. Lost responses,
|
|
63
|
+
offline repositories, restarts and failed cleanup do not free unconfirmed bytes.
|
|
64
|
+
Immutable-object retries keep their original reservation and do not charge twice.
|
|
65
|
+
`QUOTA_EXCEEDED` is a typed refusal (HTTP 507), distinct from physical `VOLUME_FULL`.
|
|
66
|
+
|
|
67
|
+
Lowering below used plus reserved saves immediately. Existing objects and admitted
|
|
68
|
+
uploads remain; new admissions fail until enough charged bytes are removed or the
|
|
69
|
+
limit increases. Storage never deletes content in response to a setting change.
|
|
70
|
+
Null removes only this Folder's limit; ancestor limits, physical reserves and
|
|
71
|
+
staging requirements still apply. New Folders start with no own limit.
|
|
72
|
+
|
|
73
|
+
## Deletion and lifetime
|
|
74
|
+
|
|
75
|
+
`folders/delete` takes `folderId` and `recursive` (false by default). False
|
|
76
|
+
requires an empty Folder with no descendants or active/cleanup writes. True
|
|
77
|
+
explicitly removes all its contents and descendants. Physical cleanup must
|
|
78
|
+
succeed before the Folder tree is removed; failure can leave earlier physical
|
|
79
|
+
deletions applied. Remaining objects and staged bytes remain indexed and counted.
|
|
80
|
+
A persistent deletion fence blocks new writes and descendant creation until
|
|
81
|
+
cleanup is retried and finishes. The response is `{ "deleted": true }`; an
|
|
82
|
+
already absent path returns false. `deleting` exposes incomplete cleanup.
|
|
83
|
+
|
|
84
|
+
The catalog retains a private creation incarnation for object ownership and
|
|
85
|
+
sessions, separate from the public path. Reusing a deleted path creates a new
|
|
86
|
+
incarnation; old sessions cannot read, delete or write into it. A fresh management
|
|
87
|
+
delete always addresses the current path, so callers inspect state after an
|
|
88
|
+
uncertain response before retrying. Scope/Core removal stops ordinary access and
|
|
89
|
+
waits for all physical repositories, including offline repositories, to be cleaned.
|
|
90
|
+
|
|
91
|
+
## Placement and capacity
|
|
92
|
+
|
|
93
|
+
For SDK writes, Core prefers a healthy external repository on the authenticated
|
|
94
|
+
source Host, then another external repository, and finally its internal disk.
|
|
95
|
+
Within each external group, writable staging bytes descending and stable repository/
|
|
96
|
+
binding identities decide the order. An unknown source Host has no local preference.
|
|
97
|
+
Existing objects keep their recorded repository UUID; enabling a Plugin never moves
|
|
98
|
+
them. Discovery excludes unavailable or insufficient candidates. Once selected,
|
|
99
|
+
preparation or transfer failure fails this write: there is no Core byte relay,
|
|
100
|
+
cross-repository replay, persistent sender spool or automatic media retransmission.
|
|
101
|
+
Uncertain results remain pinned to that repository until publication or cleanup.
|
|
102
|
+
Core-internal Artifact consumers retain their existing engine write/recovery path.
|
|
103
|
+
|
|
104
|
+
All Folders share available capacity. Host physical reserves and staging space
|
|
105
|
+
still apply. A write validates full size and SHA-256; no staging space means
|
|
106
|
+
failure without deleting old data. Storage never infers business references.
|
|
107
|
+
Camera owns retention, pinned clips and shared segments, using the recording
|
|
108
|
+
Folder quota with no separate default byte budget. Temporary Artifact content
|
|
109
|
+
retains its transient store and idle TTL. Logically unlimited Artifact storage still needs real space.
|
|
110
|
+
|
|
111
|
+
Object keys are immutable: the same key, size and SHA-256 is an idempotent retry;
|
|
112
|
+
new content requires a new key. Management byte counts and timestamps are decimal
|
|
113
|
+
strings; object/physical receipts use JSON u64.
|
|
114
|
+
|
|
115
|
+
## Folder SDK and internal transport
|
|
116
|
+
|
|
117
|
+
Business callers use `ensureFolder` (explicit, idempotent creation), `openFolder`
|
|
118
|
+
(existing only), Folder listing/deletion and overview. A Folder handle provides
|
|
119
|
+
put/get/stat/list/delete. The existing Node SDK owns the Plugin client, and the
|
|
120
|
+
App SDK owns the `home/` client. Core internal consumers call the engine directly.
|
|
121
|
+
Camera retains recording retention and shared-segment references.
|
|
122
|
+
|
|
123
|
+
Object HEAD/stat verifies the selected physical repository, not just its Catalog
|
|
124
|
+
receipt. Confirmed physical absence returns 404 (`NOT_FOUND` for GET); a missing
|
|
125
|
+
repository, transport failure or timeout remains unavailable, never absence.
|
|
126
|
+
Length/hash declaration mismatches remain integrity errors. Existence probes do
|
|
127
|
+
not remove receipts or release quota charges: only confirmed deletion does that.
|
|
128
|
+
SDK HEAD maps 404 to no object, and reads preserve the typed `NOT_FOUND` failure.
|
|
129
|
+
|
|
130
|
+
`/app/object-storage/session/acquire` is an internal transport operation, with
|
|
131
|
+
`folderId` and optional `expectedIncarnation`. It accepts no `permissions` or
|
|
132
|
+
`ttlSeconds`. An authorized namespace owner receives all object operations for
|
|
133
|
+
that Folder; the fixed 15-minute expiry is not a business setting. Its Core API
|
|
134
|
+
response includes `folderIncarnation`, HTTPS endpoint, token, Host identity and
|
|
135
|
+
expiry. SDKs keep these private and renew shortly before expiry. The incarnation
|
|
136
|
+
is an opaque transport fence, not another public Folder ID.
|
|
137
|
+
|
|
138
|
+
Each handle binds to its originating Space and owner. Renewals send the original
|
|
139
|
+
creation identity and never call Folder creation. A deleted/recreated path cannot
|
|
140
|
+
replace an existing handle. App login/Space changes retire handles and active
|
|
141
|
+
transfers; Plugin context changes reject the old binding. Reopen explicitly after
|
|
142
|
+
an authorization refusal. HTTP 401 `SESSION_EXPIRED` is raised before object
|
|
143
|
+
mutation and permits one retry after refresh. HTTP 403 remains terminal. Other
|
|
144
|
+
failures, including uncertain writes, are returned without automatic replay.
|
|
145
|
+
Retried uploads retain their original key, length and SHA-256. Native file tickets
|
|
146
|
+
are owned per transfer: renewal leaves an admitted read alive, and completion,
|
|
147
|
+
cancellation or SDK disposal releases its ticket.
|
|
148
|
+
|
|
149
|
+
Object data uses SDK-owned direct transfers. POST to the session's
|
|
150
|
+
`objects/<key>` URL carries a Core API `StorageObjectControl`: `prepare`
|
|
151
|
+
(`sizeBytes`, `sha256`, `contentType`, `localImport`), `complete`, `status`, or
|
|
152
|
+
`abort` (each with `uploadId`), or `read`. Prepare reserves quota once and returns
|
|
153
|
+
an already-published receipt or the exact repository transfer. A transfer contains
|
|
154
|
+
its URL, token, Host TLS identity, expiry and an optional local capability.
|
|
155
|
+
The SDK sends bytes to that repository and completes through Core. Only Core's
|
|
156
|
+
published receipt is success. Complete verifies physical metadata rather than
|
|
157
|
+
trusting the client. Aborting a published upload leaves its object intact.
|
|
158
|
+
Unfinished/cancelled writes remain charged until confirmed cleanup; existing
|
|
159
|
+
recovery may publish verified bytes after a lost response. Terminal journals have
|
|
160
|
+
a 24-hour cleanup window; the immutable object receipt remains accessible by key.
|
|
161
|
+
|
|
162
|
+
Read obtains the selected repository's grant and streams directly, including HTTP
|
|
163
|
+
Range. Session HEAD/list/delete remain Core metadata/management operations. Session
|
|
164
|
+
PUT only accepts a prepared internal-disk upload; external data cannot be relayed
|
|
165
|
+
through the Core Folder gateway. Old SDK byte routes are not served in parallel.
|
|
166
|
+
|
|
167
|
+
The Node SDK writes byte buffers without a temporary file and reuses pinned HTTPS
|
|
168
|
+
connections without sharing request authorization. A local capability is projected
|
|
169
|
+
only for a verified same-Host Plugin. Its private Unix socket accepts one authorized
|
|
170
|
+
object stream, or a read-only source file descriptor for import. Source pathnames
|
|
171
|
+
and repository directory access are never transferred. Import clones on supported
|
|
172
|
+
filesystems or allocates/copies locally, verifies the result, and preserves the
|
|
173
|
+
source. Inaccessible local namespaces may use HTTPS to the same selected repository
|
|
174
|
+
before a local request starts. App WebViews use the native pinned file bridge;
|
|
175
|
+
exact-object upload tickets permit PUT only. No offline quota delegation is added.
|
|
176
|
+
|
|
177
|
+
These logical sessions do not replace physical backend grants. Physical read,
|
|
178
|
+
stat, delete and prepared-write grants remain separate, including Artifact read
|
|
179
|
+
and removal-only cleanup authority.
|
|
180
|
+
|
|
181
|
+
## Physical backend and reads
|
|
182
|
+
|
|
183
|
+
`storage.backend.v1` remains separate from the public `storage.v1` capability.
|
|
184
|
+
Storage is in development: both protocols evolve in place as v1, with no legacy
|
|
185
|
+
readers, version negotiation or compatibility branches.
|
|
186
|
+
Describe reports capacity; grant authorizes stat/read/delete; prepare-write reserves
|
|
187
|
+
space for an immutable Blob before issuing a write grant. A lost reply can have
|
|
188
|
+
reserved bytes. Receipts are resolved before changing repositories. Issued grants survive temporary Core control disconnection until normal expiry;
|
|
189
|
+
explicit binding removal still revokes unused grants. TLS is pinned,
|
|
190
|
+
with redirects and proxy inheritance disabled. Core's internal `mhome-storage-disk`
|
|
191
|
+
source crate (`publish = false`) owns disk durability, repository identity,
|
|
192
|
+
reservations and idempotent unlink. Core and the Storage Plugin reuse this code;
|
|
193
|
+
it has no independent public package release.
|
|
194
|
+
|
|
195
|
+
Errors carry `code`, `detail` and `outcome` (`notApplied`, `partial`, `unknown`),
|
|
196
|
+
with optional `deletedObjects` for confirmed per-attempt deletions. Unknown
|
|
197
|
+
transport results are not proof of failure. Range reads do not hash the whole
|
|
198
|
+
file first. Full Artifact streams can check integrity incrementally, withholding
|
|
199
|
+
the last bytes until verification succeeds.
|
|
200
|
+
|
|
201
|
+
This version supports new databases only. Edit complete baselines; never convert
|
|
202
|
+
old data at startup. Preserve old databases/files for a separately authorized import.
|