@minca/core 0.1.10 → 0.1.11
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 +1 -1
- package/dist/identity/abilities.js +1 -1
- package/dist/identity/contact-key.d.ts +15 -15
- package/dist/identity/contact-key.d.ts.map +1 -1
- package/dist/identity/contact-key.js +21 -28
- package/dist/identity/contact-key.js.map +1 -1
- package/dist/inbox/inbox.d.ts +140 -0
- package/dist/inbox/inbox.d.ts.map +1 -0
- package/dist/inbox/inbox.js +212 -0
- package/dist/inbox/inbox.js.map +1 -0
- package/dist/inbox/index.d.ts +9 -0
- package/dist/inbox/index.d.ts.map +1 -0
- package/dist/inbox/index.js +7 -0
- package/dist/inbox/index.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/network/mailbox.d.ts +4 -4
- package/dist/network/mailbox.d.ts.map +1 -1
- package/dist/network/mailbox.js +5 -5
- package/dist/network/mailbox.js.map +1 -1
- package/dist/node/actions.d.ts.map +1 -1
- package/dist/node/actions.js +28 -18
- package/dist/node/actions.js.map +1 -1
- package/dist/node/api.d.ts +11 -10
- package/dist/node/api.d.ts.map +1 -1
- package/dist/node/api.js +11 -10
- package/dist/node/api.js.map +1 -1
- package/dist/node/carrier.d.ts +11 -5
- package/dist/node/carrier.d.ts.map +1 -1
- package/dist/node/carrier.js +42 -1
- package/dist/node/carrier.js.map +1 -1
- package/dist/node/copy.d.ts +1 -1
- package/dist/node/copy.d.ts.map +1 -1
- package/dist/node/copy.js +10 -4
- package/dist/node/copy.js.map +1 -1
- package/dist/node/host.d.ts +2 -0
- package/dist/node/host.d.ts.map +1 -1
- package/dist/node/host.js +2 -0
- package/dist/node/host.js.map +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/node.d.ts.map +1 -1
- package/dist/node/node.js +496 -295
- package/dist/node/node.js.map +1 -1
- package/dist/node/remote.d.ts.map +1 -1
- package/dist/node/remote.js +0 -2
- package/dist/node/remote.js.map +1 -1
- package/dist/node/space-runtime.d.ts +2 -1
- package/dist/node/space-runtime.d.ts.map +1 -1
- package/dist/node/space-runtime.js +2 -2
- package/dist/node/space-runtime.js.map +1 -1
- package/dist/node/types.d.ts +72 -43
- package/dist/node/types.d.ts.map +1 -1
- package/dist/react/use-invite-link.d.ts +1 -1
- package/dist/react/use-invite-link.d.ts.map +1 -1
- package/dist/react/use-invite-link.js +18 -11
- package/dist/react/use-invite-link.js.map +1 -1
- package/dist/records/loose.d.ts +52 -0
- package/dist/records/loose.d.ts.map +1 -0
- package/dist/records/loose.js +86 -0
- package/dist/records/loose.js.map +1 -0
- package/dist/schema/version.d.ts +2 -0
- package/dist/schema/version.d.ts.map +1 -1
- package/dist/schema/version.js +2 -1
- package/dist/schema/version.js.map +1 -1
- package/dist/schemas/choosing.d.ts +19 -0
- package/dist/schemas/choosing.d.ts.map +1 -0
- package/dist/schemas/choosing.js +69 -0
- package/dist/schemas/choosing.js.map +1 -0
- package/dist/schemas/contacts.d.ts +34 -87
- package/dist/schemas/contacts.d.ts.map +1 -1
- package/dist/schemas/contacts.js +32 -76
- package/dist/schemas/contacts.js.map +1 -1
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/library/annotations.d.ts +17 -285
- package/dist/schemas/library/annotations.d.ts.map +1 -1
- package/dist/schemas/library/annotations.js +9 -65
- package/dist/schemas/library/annotations.js.map +1 -1
- package/dist/schemas/library/community.d.ts +9 -17
- package/dist/schemas/library/community.d.ts.map +1 -1
- package/dist/schemas/library/community.js +5 -5
- package/dist/schemas/library/community.js.map +1 -1
- package/dist/schemas/library/life.d.ts +3 -3
- package/dist/schemas/library/life.d.ts.map +1 -1
- package/dist/schemas/library/life.js +2 -2
- package/dist/schemas/library/life.js.map +1 -1
- package/dist/schemas/library/media.d.ts +148 -541
- package/dist/schemas/library/media.d.ts.map +1 -1
- package/dist/schemas/library/media.js +28 -64
- package/dist/schemas/library/media.js.map +1 -1
- package/dist/schemas/library/money.d.ts +8 -8
- package/dist/schemas/library/money.d.ts.map +1 -1
- package/dist/schemas/library/money.js +4 -4
- package/dist/schemas/library/money.js.map +1 -1
- package/dist/schemas/library/planning.d.ts +23 -87
- package/dist/schemas/library/planning.d.ts.map +1 -1
- package/dist/schemas/library/planning.js +10 -26
- package/dist/schemas/library/planning.js.map +1 -1
- package/dist/schemas/library/publishing.d.ts +14 -14
- package/dist/schemas/library/publishing.d.ts.map +1 -1
- package/dist/schemas/library/publishing.js +7 -7
- package/dist/schemas/library/publishing.js.map +1 -1
- package/dist/schemas/library/social.d.ts +2 -2
- package/dist/schemas/library/social.d.ts.map +1 -1
- package/dist/schemas/library/social.js +1 -1
- package/dist/schemas/library/social.js.map +1 -1
- package/dist/schemas/standard.d.ts +1 -1
- package/dist/schemas/standard.d.ts.map +1 -1
- package/dist/schemas/standard.js +3 -3
- package/dist/schemas/standard.js.map +1 -1
- package/dist/session/auth.js +1 -1
- package/dist/session/auth.js.map +1 -1
- package/dist/space/account-registry.d.ts +22 -0
- package/dist/space/account-registry.d.ts.map +1 -1
- package/dist/space/account-registry.js +18 -0
- package/dist/space/account-registry.js.map +1 -1
- package/dist/space/invitation.d.ts +61 -0
- package/dist/space/invitation.d.ts.map +1 -0
- package/dist/space/invitation.js +84 -0
- package/dist/space/invitation.js.map +1 -0
- package/dist/space/invite-link.d.ts +64 -0
- package/dist/space/invite-link.d.ts.map +1 -0
- package/dist/space/invite-link.js +212 -0
- package/dist/space/invite-link.js.map +1 -0
- package/dist/space/space-manager.d.ts +21 -6
- package/dist/space/space-manager.d.ts.map +1 -1
- package/dist/space/space-manager.js +40 -23
- package/dist/space/space-manager.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/actions.md +37 -37
- package/docs/automations.md +2 -2
- package/docs/blueprints-and-guides.md +44 -3
- package/docs/building-an-app.md +2 -2
- package/docs/contacts.md +48 -69
- package/docs/inbox.md +145 -0
- package/docs/node.md +36 -23
- package/docs/query-format.md +1 -1
- package/docs/spaces.md +33 -5
- package/docs/standard-library.md +111 -86
- package/package.json +5 -5
- package/dist/doors/doors.d.ts +0 -140
- package/dist/doors/doors.d.ts.map +0 -1
- package/dist/doors/doors.js +0 -226
- package/dist/doors/doors.js.map +0 -1
- package/dist/doors/index.d.ts +0 -9
- package/dist/doors/index.d.ts.map +0 -1
- package/dist/doors/index.js +0 -7
- package/dist/doors/index.js.map +0 -1
- package/docs/doors.md +0 -151
package/docs/actions.md
CHANGED
|
@@ -29,42 +29,42 @@ It refuses: a non-object input; a missing required field; **any field not in
|
|
|
29
29
|
|
|
30
30
|
The actions (R = readOnly, S = sensitive, D = destructive, P = peerContent):
|
|
31
31
|
|
|
32
|
-
| Name | Flags | Input (required in **bold**) | Does
|
|
33
|
-
| ----------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
34
|
-
| `node_info` | R | — | `{ did, sessionDid }`
|
|
35
|
-
| `spaces_list` | R | — | `spaces.list()`
|
|
36
|
-
| `spaces_create` | | **`name`**, **`visibility`** (`private`\|`public`), `roles` (`solo`\|`team`\|`community`\|`coop`; default `solo`) | Creates a space with that template.
|
|
37
|
-
| `spaces_invite` | S | **`space`**, `role`, `viewOnly` (bool) | `{ invite }`. `viewOnly: true` wins over `role`.
|
|
38
|
-
| `spaces_preview_invite` | R | **`invite`** | `spaces.preview()`
|
|
39
|
-
| `spaces_join` | D | **`invite`** | `spaces.join()`
|
|
40
|
-
| `spaces_leave` | D | **`space`** | `{ left: <id> }`
|
|
41
|
-
| `spaces_access` | R | **`space`** | `spaces.access()`
|
|
42
|
-
| `spaces_assign` | D | **`space`**, **`did`**, **`role`**, `remove` (bool) | `spaces.assign()`, or with `remove: true` `unassign()`. Then returns `spaces.access()`.
|
|
43
|
-
| `spaces_remove_member` | D | **`space`**, **`did`** | `spaces.removeMember()`. Then returns `spaces.access()`.
|
|
44
|
-
| `spaces_step_down` | D | **`space`**, `keep` | `spaces.stepDown()`. Then returns `spaces.access()`.
|
|
45
|
-
| `spaces_succeed` | D | **`space`**, **`successor`** | `spaces.succeed()`. Then returns `spaces.access()`.
|
|
46
|
-
| `spaces_close_invite` | D | **`space`**, **`key`** | Then returns `spaces.access()`.
|
|
47
|
-
| `spaces_status` | R | **`space`** | `spaces.status()`
|
|
48
|
-
| `spaces_profiles` | R P | **`space`** | `spaces.profiles()`
|
|
49
|
-
| `collections_list` | R P | **`space`**, `names` | Without `names`: each collection in a line, `{ name, title?, description?, records, links, guides? }` with `links` its link roles' names and `guides` the `std.guide` records about it, `{ key, title }`. With them: those collections in full, as `collections.list()` gives them; refuses a name the space doesn't have.
|
|
50
|
-
| `collections_standard` | R | `names` | Without `names`: the
|
|
51
|
-
| `collections_define` | D | **`space`**, **`name`**, **`schema`**, `title`, `description`, `version`, `history` (`latest`\|`all`), `links`, `rules`, `topics` | The definition, plus `summary`: what its rules say, in words.
|
|
52
|
-
| `collections_propose` | | **`space`**, **`title`**, **`collections`** (definitions, or standard names like `"std.event"`), `description`, `updates` (key of the blueprint it replaces) | Writes a `std.blueprint`, a standard name stored as the library's definition; returns `{ key, proposed, applied: false, next, collections, warnings? }`, warning when it would change a collection another applied blueprint uses. Refuses an `updates` that names no blueprint in the space, and a `std.*` collection that is not the library's ([standard library](standard-library.md)). |
|
|
53
|
-
| `collections_proposals` | R P | **`space`** | Blueprints: `key`, `title`, `description`, `proposedBy`, `recordsOnly?`, `updates?`, `applied`, `superseded`, `problem`, `collections[]` (each `name`, `status`, `summary`, `changes`, and `usedBy`: the applied blueprints a change would touch).
|
|
54
|
-
| `collections_apply` | D | **`space`**, **`key`** | `applyBlueprint()`: `{ applied, collections }`. Needs a grant of `/collection/define` in the space, and a note that grants it.
|
|
55
|
-
| `collections_delete` | D | **`space`**, **`name`** | `collections.delete()`
|
|
56
|
-
| `records_list` | R P | **`space`**, `collection`, `limit`, `newestFirst` | `records.list()`
|
|
57
|
-
| `records_query` | R P | **`space`**, **`collection`**, `where`, `include`, `sort`, `limit`, `cursor` | `records.query()` ([02](https://github.com/leifriksheim/minca/blob/main/spec/02-records.md))
|
|
58
|
-
| `records_get` | R P | **`space`**, **`key`** | `records.get()`
|
|
59
|
-
| `records_history` | R P | **`space`**, **`key`** | `records.history()`
|
|
60
|
-
| `records_put` | | **`space`**, **`collection`**, **`body`**, `key`, `links` | `records.put()`
|
|
61
|
-
| `records_linked` | R P | **`space`**, **`key`**, `rel`, `collection` | `records.linked()`
|
|
62
|
-
| `records_can` | R | **`space`**, **`action`** (`create`\|`edit`\|`delete`), **`target`** | `records.can()` → boolean
|
|
63
|
-
| `records_update` | D | **`space`**, **`key`**, **`body`**, `links` | `records.update()`
|
|
64
|
-
| `records_delete` | D | **`space`**, **`key`** | `{ deleted: <key> }`
|
|
65
|
-
| `activity_set` | | **`space`**, **`about`** (a record's key), **`label`** (≤ 120), `state` (`working`\|`waiting`\|`done`\|`failed`; default `working`) | Your `std.activity` about that record, made or changed ([standard library](standard-library.md)); refuses in a space that keeps no `std.activity`.
|
|
66
|
-
| `direct_list` | R P | **`space`**, `with` (a member's DID), `limit` (default 30) | The direct messages by or to you, opened, oldest first, the newest `limit`; with `with`, only those between you and them ([direct messages](direct-messages.md)).
|
|
67
|
-
| `direct_send` | | **`space`**, **`to`** (DIDs), **`text`** | `direct.send()`: seals it for them and you.
|
|
32
|
+
| Name | Flags | Input (required in **bold**) | Does |
|
|
33
|
+
| ----------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `node_info` | R | — | `{ did, sessionDid }` |
|
|
35
|
+
| `spaces_list` | R | — | `spaces.list()` |
|
|
36
|
+
| `spaces_create` | | **`name`**, **`visibility`** (`private`\|`public`), `roles` (`solo`\|`team`\|`community`\|`coop`; default `solo`) | Creates a space with that template. |
|
|
37
|
+
| `spaces_invite` | S | **`space`**, `role`, `viewOnly` (bool) | `{ invite }`. `viewOnly: true` wins over `role`. |
|
|
38
|
+
| `spaces_preview_invite` | R | **`invite`** | `spaces.preview()` |
|
|
39
|
+
| `spaces_join` | D | **`invite`** | `spaces.join()` |
|
|
40
|
+
| `spaces_leave` | D | **`space`** | `{ left: <id> }` |
|
|
41
|
+
| `spaces_access` | R | **`space`** | `spaces.access()` |
|
|
42
|
+
| `spaces_assign` | D | **`space`**, **`did`**, **`role`**, `remove` (bool) | `spaces.assign()`, or with `remove: true` `unassign()`. Then returns `spaces.access()`. |
|
|
43
|
+
| `spaces_remove_member` | D | **`space`**, **`did`** | `spaces.removeMember()`. Then returns `spaces.access()`. |
|
|
44
|
+
| `spaces_step_down` | D | **`space`**, `keep` | `spaces.stepDown()`. Then returns `spaces.access()`. |
|
|
45
|
+
| `spaces_succeed` | D | **`space`**, **`successor`** | `spaces.succeed()`. Then returns `spaces.access()`. |
|
|
46
|
+
| `spaces_close_invite` | D | **`space`**, **`key`** | Then returns `spaces.access()`. |
|
|
47
|
+
| `spaces_status` | R | **`space`** | `spaces.status()` |
|
|
48
|
+
| `spaces_profiles` | R P | **`space`** | `spaces.profiles()` |
|
|
49
|
+
| `collections_list` | R P | **`space`**, `names` | Without `names`: each collection in a line, `{ name, title?, description?, records, links, guides? }` with `links` its link roles' names and `guides` the `std.guide` records about it, `{ key, title }`. With them: those collections in full, as `collections.list()` gives them; refuses a name the space doesn't have. |
|
|
50
|
+
| `collections_standard` | R | `names` | Without `names`: `{ choose, areas }`, `choose` a line per kind of thing saying which collection holds it, and `areas` the library by area, each `{ name, title, description }`. With them: each definition in full, plus `summary`. Refuses a name not in the library ([what a `std.*` name means](standard-library.md#what-a-std-name-means); [spec 02 §6.4](https://github.com/leifriksheim/minca/blob/main/spec/02-records.md)). |
|
|
51
|
+
| `collections_define` | D | **`space`**, **`name`**, **`schema`**, `title`, `description`, `version`, `history` (`latest`\|`all`), `links`, `rules`, `topics` | The definition, plus `summary`: what its rules say, in words. |
|
|
52
|
+
| `collections_propose` | | **`space`**, **`title`**, **`collections`** (definitions, or standard names like `"std.event"`), `description`, `updates` (key of the blueprint it replaces) | Writes a `std.blueprint`, a standard name stored as the library's definition; returns `{ key, proposed, applied: false, next, collections, warnings? }`, warning when it would change a collection another applied blueprint uses, when a collection of its own looks like a standard one (it keeps a file, like `std.file`; it is something at a time, like `std.event`), and when a link of its own says where a record sits, which the library calls `in` (`lookalikes`). Warnings don't refuse: the person applying it decides. Refuses an `updates` that names no blueprint in the space, and a `std.*` collection that is not the library's ([standard library](standard-library.md)). |
|
|
53
|
+
| `collections_proposals` | R P | **`space`** | Blueprints: `key`, `title`, `description`, `proposedBy`, `recordsOnly?`, `updates?`, `applied`, `superseded`, `problem`, `collections[]` (each `name`, `status`, `summary`, `changes`, and `usedBy`: the applied blueprints a change would touch). |
|
|
54
|
+
| `collections_apply` | D | **`space`**, **`key`** | `applyBlueprint()`: `{ applied, collections }`. Needs a grant of `/collection/define` in the space, and a note that grants it. |
|
|
55
|
+
| `collections_delete` | D | **`space`**, **`name`** | `collections.delete()` |
|
|
56
|
+
| `records_list` | R P | **`space`**, `collection`, `limit`, `newestFirst` | `records.list()` |
|
|
57
|
+
| `records_query` | R P | **`space`**, **`collection`**, `where`, `include`, `sort`, `limit`, `cursor` | `records.query()` ([02](https://github.com/leifriksheim/minca/blob/main/spec/02-records.md)) |
|
|
58
|
+
| `records_get` | R P | **`space`**, **`key`** | `records.get()` |
|
|
59
|
+
| `records_history` | R P | **`space`**, **`key`** | `records.history()` |
|
|
60
|
+
| `records_put` | | **`space`**, **`collection`**, **`body`**, `key`, `links` | `records.put()` |
|
|
61
|
+
| `records_linked` | R P | **`space`**, **`key`**, `rel`, `collection` | `records.linked()` |
|
|
62
|
+
| `records_can` | R | **`space`**, **`action`** (`create`\|`edit`\|`delete`), **`target`** | `records.can()` → boolean |
|
|
63
|
+
| `records_update` | D | **`space`**, **`key`**, **`body`**, `links` | `records.update()` |
|
|
64
|
+
| `records_delete` | D | **`space`**, **`key`** | `{ deleted: <key> }` |
|
|
65
|
+
| `activity_set` | | **`space`**, **`about`** (a record's key), **`label`** (≤ 120), `state` (`working`\|`waiting`\|`done`\|`failed`; default `working`) | Your `std.activity` about that record, made or changed ([standard library](standard-library.md)); refuses in a space that keeps no `std.activity`. |
|
|
66
|
+
| `direct_list` | R P | **`space`**, `with` (a member's DID), `limit` (default 30) | The direct messages by or to you, opened, oldest first, the newest `limit`; with `with`, only those between you and them ([direct messages](direct-messages.md)). |
|
|
67
|
+
| `direct_send` | | **`space`**, **`to`** (DIDs), **`text`** | `direct.send()`: seals it for them and you. |
|
|
68
68
|
|
|
69
69
|
The blueprint the three proposal actions read and write (`collections_propose`,
|
|
70
70
|
`collections_proposals`, `collections_apply`), and the guides `collections_list`
|
|
@@ -99,7 +99,7 @@ every action for the account itself; for a bot, all but `PERSON_ONLY`
|
|
|
99
99
|
`collections_delete` and `collections_apply`, registered on `document.modelContext` at page load.
|
|
100
100
|
_Implementation detail of the example._
|
|
101
101
|
|
|
102
|
-
_Source: `packages/core/src/node/actions.ts` (`callAction`, `offeredActions`), `packages/cli/src/mcp.ts`, `packages/cli/src/agent-chat.ts`, `apps/example/src/webmcp.ts`. Tests: `packages/core/tests/node.test.ts` ("actions"), `packages/cli/tests/cli.test.ts` ("MCP")._
|
|
102
|
+
_Source: `packages/core/src/node/actions.ts` (`callAction`, `offeredActions`), `packages/core/src/schemas/choosing.ts` (`CHOOSING`, `lookalikes`), `packages/cli/src/mcp.ts`, `packages/cli/src/agent-chat.ts`, `apps/example/src/webmcp.ts`. Tests: `packages/core/tests/node.test.ts` ("actions"), `packages/core/tests/records-only.test.ts` ("a twin of a standard collection, or a link of its own for where a record sits, is warned of"), `packages/cli/tests/cli.test.ts` ("MCP")._
|
|
103
103
|
|
|
104
104
|
## The agent on a computer
|
|
105
105
|
|
package/docs/automations.md
CHANGED
|
@@ -24,7 +24,7 @@ who made it:
|
|
|
24
24
|
"when": {
|
|
25
25
|
"query": {
|
|
26
26
|
"collection": "std.channel",
|
|
27
|
-
"include": { "messages": { "rel": "
|
|
27
|
+
"include": { "messages": { "rel": "in", "from": "std.message", "count": true } }
|
|
28
28
|
},
|
|
29
29
|
"holds": { "include:messages": { "$gte": 100 } }
|
|
30
30
|
},
|
|
@@ -32,7 +32,7 @@ who made it:
|
|
|
32
32
|
"kind": "add",
|
|
33
33
|
"collection": "std.message",
|
|
34
34
|
"text": "#{title} just passed {messages} messages",
|
|
35
|
-
"links": [{ "rel": "
|
|
35
|
+
"links": [{ "rel": "in", "to": "$it" }]
|
|
36
36
|
},
|
|
37
37
|
"since": "2026-09-29T12:00:00Z"
|
|
38
38
|
}
|
|
@@ -167,12 +167,53 @@ A screen reaches the page around it only through `window.minca`, and only for
|
|
|
167
167
|
its app's collections and the people in its space: it lists and writes
|
|
168
168
|
records as the person looking, asks what they may do (`can`), gets someone's
|
|
169
169
|
picture (`picture`), and asks the page to show a record or a person
|
|
170
|
-
(`open`)
|
|
170
|
+
(`open`), or the record one of its own links to (`open` with `link`: the
|
|
171
|
+
message a file was shared on). Following a link is the one way past its collections. The bridge answers the same whether or not the record is there, and never opens the space's own records (`sys.*`, `launcher.app`); but the page visibly opens a record that is there, for the person, who can see it anyway, so a screen that already knows a key could notice, from outside, that it exists. What a sealed frame can't do, the page does for it when it asks,
|
|
171
172
|
after checking the request: it searches for places and asks where the person
|
|
172
173
|
is (`places`), opens http and https pages (`link`), saves text files
|
|
173
174
|
(`save`), keeps a few kilobytes per app on the device (`remember`, `recall`),
|
|
174
175
|
and reads a picture that one of the app's own records refers to (`file`),
|
|
175
|
-
taking its type from the record rather than from
|
|
176
|
+
or the whole file (`blob`), taking its type from the record rather than from
|
|
177
|
+
the screen.
|
|
178
|
+
|
|
179
|
+
**Opening a record where it belongs.** A `launcher.app` may name, among its
|
|
180
|
+
`collections`, the ones it `shows`: the ones whose records it is the place
|
|
181
|
+
to open (`shows: ["std.message"]` for a chat). Whatever asks the example app
|
|
182
|
+
to open a record, a screen's `open` or a link beside a record, goes to the
|
|
183
|
+
app that shows that record's collection, the one open first, and that app's
|
|
184
|
+
screen is handed the record's key (`minca.shown`, `minca.onShow`, the kit's
|
|
185
|
+
`useShown`) to scroll to or open, but only of a collection it shows, which
|
|
186
|
+
it could list anyway. That app does learn which of those records the person
|
|
187
|
+
opens from elsewhere, which is why only someone who may define collections
|
|
188
|
+
adds an app. With no app that shows it, the record
|
|
189
|
+
opens beside whatever is open. So the Files app opens a file's message in
|
|
190
|
+
the chat, and a chat's file in Files, without either knowing the other. An
|
|
191
|
+
app that names a collection in `shows` must do something with what it is
|
|
192
|
+
handed. The kit's `<Record>` draws any standard record as one line the same
|
|
193
|
+
way in every app, and opens it this way when clicked.
|
|
194
|
+
|
|
195
|
+
A screen also sends live messages, kept nowhere, to the other devices that
|
|
196
|
+
have the same app open in the space (`live.send`, `live.on`): for cursors,
|
|
197
|
+
typing, who is here, or a game. Each goes as a live message of the space
|
|
198
|
+
([node](node.md#live-messages-and-status)) whose payload names the app by its
|
|
199
|
+
`launcher.app` key, and a screen hears only those naming its own app:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"type": "screen.live",
|
|
204
|
+
"app": "aj5pakqf52uftpgarut33aqxq4.ctzz2xssv7y3alqlcepfmkdks4",
|
|
205
|
+
"data": { "x": 120, "y": 48 }
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
A screen is handed `{ from, device, data, viaAgent }`, `from` being the
|
|
210
|
+
sender's account as the node proved it; a message from a peer with no account
|
|
211
|
+
is not passed on. One screen may send a burst of 30, then 15 a second, below
|
|
212
|
+
what a peer takes from another across everything, so a busy screen leaves
|
|
213
|
+
room for calls and the rest. An edited copy of an app is another
|
|
214
|
+
`launcher.app` record, so its screens don't hear the original's.
|
|
215
|
+
|
|
216
|
+
In front of every screen the example app also writes `@minca/ui`
|
|
176
217
|
(`packages/ui`): Preact with htm, hooks that keep records current, people's
|
|
177
218
|
faces, and Minca's look, so a screen is mostly what it is about. It isn't
|
|
178
219
|
part of the screen, so it doesn't count toward the 48 KB a screen may be.
|
|
@@ -182,7 +223,7 @@ defines its collections and writes a copy of it, naming where it came from
|
|
|
182
223
|
(`template: "kanban"`), and from then on the space changes its copy like any
|
|
183
224
|
other app.
|
|
184
225
|
|
|
185
|
-
_Source: `apps/example/src/components/apps/launcher.ts` (`addTemplate`), `apps/example/src/components/apps/screens.ts`, `apps/example/src/components/apps/ScreenFrame.tsx`, `apps/example/src/components/apps/templates/`, `apps/example/public/screen.html`, `packages/ui/src/frame/`, `packages/ui/src/guide.ts`. Tests: `apps/example/tests/launcher.test.ts` ("adding a ready-made app copies it into the space once, with its collections and first records"), `apps/example/tests/screens.test.ts` ("a screen checks, shows faces and opens things only within its app and its space", "what the page does for a screen, it does only as asked properly")._
|
|
226
|
+
_Source: `apps/example/src/components/apps/launcher.ts` (`addTemplate`), `apps/example/src/components/apps/screens.ts`, `apps/example/src/components/apps/ScreenFrame.tsx`, `apps/example/src/components/apps/templates/`, `apps/example/public/screen.html`, `packages/ui/src/frame/`, `packages/ui/src/guide.ts`. Tests: `apps/example/tests/launcher.test.ts` ("adding a ready-made app copies it into the space once, with its collections and first records"), `apps/example/tests/screens.test.ts` ("a screen checks, shows faces and opens things only within its app and its space", "what the page does for a screen, it does only as asked properly", "a screen hears the same app's screens on other devices, as who sent it, and no other app's")._
|
|
186
227
|
|
|
187
228
|
## Describing a collection
|
|
188
229
|
|
package/docs/building-an-app.md
CHANGED
|
@@ -114,7 +114,7 @@ Leave out `network` to stay offline. Call `node.close()` when done.
|
|
|
114
114
|
```typescript
|
|
115
115
|
const space = await node.spaces.create({ name: 'Groceries', visibility: 'private', ...rolePresets.team });
|
|
116
116
|
|
|
117
|
-
const invite = await node.spaces.invite(space.id); //
|
|
117
|
+
const invite = await node.spaces.invite(space.id, { short: true }); // ~85 characters; treat it as a secret
|
|
118
118
|
const view = await node.spaces.invite(space.id, { write: false }); // read-only
|
|
119
119
|
await node.spaces.join(invite); // on the friend's side
|
|
120
120
|
await node.spaces.closeInvite(space.id, invite); // nobody else joins with it
|
|
@@ -179,7 +179,7 @@ page was opened with:
|
|
|
179
179
|
```tsx
|
|
180
180
|
import { inviteLink, useInviteLink, useMyName, useNode } from '@minca/core/react';
|
|
181
181
|
|
|
182
|
-
const link = inviteLink(await node.spaces.invite(space.id)); // https://app.example/#invite=…
|
|
182
|
+
const link = inviteLink(await node.spaces.invite(space.id, { short: true })); // https://app.example/#invite=…
|
|
183
183
|
|
|
184
184
|
function Invited({ onJoin }: { onJoin: (invite: string) => Promise<unknown> }) {
|
|
185
185
|
const { invite, preview, dismiss } = useInviteLink();
|
package/docs/contacts.md
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
A contact is someone you share a **private space for two** with. The account
|
|
4
4
|
keeps its list of them in its contacts space, and asks someone to become a
|
|
5
|
-
contact by
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Asking someone you share **no** space with goes through
|
|
15
|
-
([
|
|
5
|
+
contact by leaving a knock for them: in a space both belong to, or in their
|
|
6
|
+
inbox.
|
|
7
|
+
|
|
8
|
+
The list and the request are conventions built on the protocol, not part of
|
|
9
|
+
it. Peers that have never heard of `std.contact` or `std.contact-request`
|
|
10
|
+
sync, store and judge them like any other record. The knock they carry is
|
|
11
|
+
protocol: how it is signed and sealed, and what the person it is for checks,
|
|
12
|
+
is [spec 07 §6](https://github.com/leifriksheim/minca/blob/main/spec/07-inbox.md),
|
|
13
|
+
the same however it is handed over.
|
|
14
|
+
Asking someone you share **no** space with goes through their inbox
|
|
15
|
+
([inbox.md](inbox.md)).
|
|
16
16
|
|
|
17
17
|
## The list: `std.contact`
|
|
18
18
|
|
|
@@ -22,15 +22,15 @@ The list lives in the account's contacts space (derived with the label
|
|
|
22
22
|
```
|
|
23
23
|
std.contact (rules: onePer ["did"])
|
|
24
24
|
{ did: string ≤256, name: string ≤200, space?: string ≤256, note?: string ≤2000,
|
|
25
|
-
blocked?: boolean
|
|
25
|
+
blocked?: boolean }
|
|
26
26
|
record key = records.onePerKey(contactsSpace, "std.contact", { did })
|
|
27
27
|
= "one:" + hex(HMAC(oneKey, "std.contact\ndid=" + canonical(did))[0..20))
|
|
28
28
|
// a shared key, spec 02 §7.3: onePer without @author
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
`name` is what you call them; they never see it. `space` is the id of the
|
|
32
|
-
space for two. `blocked` hides that person's
|
|
33
|
-
|
|
32
|
+
space for two. `blocked` hides that person's knocks, in every space and in the
|
|
33
|
+
inbox.
|
|
34
34
|
|
|
35
35
|
A reader must ignore a record whose key is not the one its `did` derives. It
|
|
36
36
|
also ignores one whose root is not the account, as it does for every record in
|
|
@@ -38,52 +38,28 @@ the account's derived spaces (spec 03 §13.1).
|
|
|
38
38
|
|
|
39
39
|
## The contact key
|
|
40
40
|
|
|
41
|
-
A
|
|
42
|
-
`contactKey` on their profile in the space (spec 03
|
|
43
|
-
in spec 01 §10.1. A node holds the private half
|
|
44
|
-
(`config.contactKey`); an agent never is.
|
|
41
|
+
A knock left in a shared space is sealed to the askee's contact key: the
|
|
42
|
+
public half, published as `contactKey` on their profile in the space (spec 03
|
|
43
|
+
§11). How it is derived is in spec 01 §10.1. A node holds the private half
|
|
44
|
+
only when it was given it (`config.contactKey`); an agent never is.
|
|
45
45
|
|
|
46
|
-
##
|
|
46
|
+
## Asking in a shared space
|
|
47
47
|
|
|
48
48
|
```
|
|
49
|
-
std.contact-request (no rules; who may
|
|
50
|
-
{ to: <askee
|
|
49
|
+
std.contact-request (no rules; who may write one is the space's grants)
|
|
50
|
+
{ to: <the askee's contact key, as on their profile here, ≤64>, sealed: string ≤16000 }
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
`ask` leaves one in the space: `sealed` is a knock sealed to `to` (spec 07
|
|
54
|
+
§6), whose invite is to a new space for two. It defines the collection first
|
|
55
|
+
if the space lacks it, which needs `/collection/define`. In a private space
|
|
56
|
+
the body is sealed with the space key too, so other members see that someone
|
|
57
|
+
asked, not whom.
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
bound = { space: <spaceId>, from: <askerAccountDid>, to: <askeeAccountDid> }
|
|
62
|
-
sealed = HPKE(askee.contactKey, "minca/contact-request/v1", bound, JSON value)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
`HPKE` is sealing to a key, spec 01 §9.2. A sealed `{"invite":"x"}` is
|
|
66
|
-
1 + 65 + 14 + 16 = 96 bytes.
|
|
67
|
-
|
|
68
|
-
Example: in space `bspace`, `did:key:zA` asking `did:key:zB` seals with bound
|
|
69
|
-
`{"from":"did:key:zA","space":"bspace","to":"did:key:zB"}`.
|
|
70
|
-
|
|
71
|
-
### Opening
|
|
72
|
-
|
|
73
|
-
The receiver must open a request only when the record verifies and stands, its
|
|
74
|
-
current version was signed by the account itself or under a note that grants
|
|
75
|
-
`/account/write` for the whole account (a note about the account, no policy
|
|
76
|
-
on `.space`), as a knock needs (spec 01 §8;
|
|
77
|
-
not one for some spaces, nor an agent's), is in `std.contact-request`, `to` is the
|
|
78
|
-
receiver's account, and `from` (the record's root) equals the root of the
|
|
79
|
-
record's first version and is not the receiver. It must use the bound built
|
|
80
|
-
from the space the record is in and that `from`. It must then reject the value
|
|
81
|
-
unless `invite` parses as an invite (spec 03 §7.4) to a **private** space whose
|
|
82
|
-
constitution names `from` as its one founder, assigning no roles of its own
|
|
83
|
-
(spec 03 §1), and which carries a `key`.
|
|
84
|
-
|
|
85
|
-
Binding the seal to the space and to who asked whom means a request copied
|
|
86
|
-
into another space, or re-posted by someone else, does not open.
|
|
59
|
+
The receiver opens a request only when `to` is its own contact key, the
|
|
60
|
+
knock checks out (spec 07 §6), and the knock's account is the record's root
|
|
61
|
+
and not its own. A knock copied into another record by someone else is not
|
|
62
|
+
theirs to leave, and opens as nothing.
|
|
87
63
|
|
|
88
64
|
## `node.contacts`
|
|
89
65
|
|
|
@@ -92,13 +68,16 @@ into another space, or re-posted by someone else, does not open.
|
|
|
92
68
|
- `put({ did, name, space?, note? })`: adds someone, or changes what the list
|
|
93
69
|
says about them.
|
|
94
70
|
- `ask(space, did, { note? })` needs whole-account access and the askee's
|
|
95
|
-
`contactKey` on their profile in that space. It
|
|
96
|
-
`
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
71
|
+
`contactKey` on their profile in that space. It creates a private `team`
|
|
72
|
+
space named `"<my name> & <their name>"`, opens an `editor` invite to it,
|
|
73
|
+
waits up to 3 seconds for a carrier that is online to hold it (`spaces.carried`), writes a
|
|
74
|
+
`std.contact` for them with that space, then leaves the knock as
|
|
75
|
+
`std.contact-request`. It returns the space for two, the record's key, and `carried`:
|
|
76
|
+
false when no carrier held the space in time, so the askee can join only
|
|
77
|
+
while one of the asker's devices is online.
|
|
78
|
+
- `requests(space)` lists the knocks left there that open for this account,
|
|
79
|
+
skipping blocked senders and knocks whose space for two the account already
|
|
80
|
+
holds.
|
|
102
81
|
- `accept(space, requestKey)` joins the invite (spec 03 §7.6) and writes a
|
|
103
82
|
`std.contact` for the asker with the space for two. There is no reply
|
|
104
83
|
record: joining is the answer.
|
|
@@ -111,25 +90,25 @@ into another space, or re-posted by someone else, does not open.
|
|
|
111
90
|
(members, profiles, connected peers).
|
|
112
91
|
|
|
113
92
|
`ask` and `accept` need a session note that grants `/account/write` for the
|
|
114
|
-
whole account, as a knock does. An app granted
|
|
115
|
-
|
|
93
|
+
whole account, as a knock does. An app granted `contacts` sees the list and
|
|
94
|
+
requests, but may not ask or accept
|
|
116
95
|
([spec 06 §2.5](https://github.com/leifriksheim/minca/blob/main/spec/06-nodes-and-sessions.md)).
|
|
117
96
|
|
|
118
|
-
_Source: `packages/core/src/schemas/contacts.ts
|
|
97
|
+
_Source: `packages/core/src/schemas/contacts.ts` (`contact`), `packages/core/src/identity/contact-key.ts` (`deriveContactKeyBytes`), `packages/core/src/inbox/inbox.ts` (`sealKnock`, `openKnock`), `packages/core/src/node/node.ts` (contacts section: `openMail`, `makePair`, `contacts`), `packages/core/src/schemas/contacts.ts` (`contactRequest`), `packages/core/src/node/types.ts` (`NodeContacts`), `packages/core/src/space/account-registry.ts` (`deriveContactsSpace`). Tests: `packages/core/tests/contacts.test.ts`, `packages/core/tests/attacks.test.ts` ("a knock re-posted by someone else…")._
|
|
119
98
|
|
|
120
99
|
## Planned: requests that can be taken back
|
|
121
100
|
|
|
122
101
|
A list that never names a space the account left, and requests that can be
|
|
123
|
-
taken back. Today the `std.contact` does not record where `ask`
|
|
124
|
-
|
|
102
|
+
taken back. Today the `std.contact` does not record where `ask` left the
|
|
103
|
+
knock, so `remove` and `block` leave it standing: the askee can still accept
|
|
125
104
|
it, into a space nobody holds. And `spaces.leave` on a space for two leaves the
|
|
126
105
|
`std.contact` naming it.
|
|
127
106
|
|
|
128
107
|
- `std.contact` gains `asked?: { space: string ≤256, key: string ≤256 }`, the
|
|
129
108
|
space and record key of the request. `ask` writes it.
|
|
130
|
-
- `remove(did)` and `block(did)` delete the
|
|
131
|
-
|
|
132
|
-
|
|
109
|
+
- `remove(did)` and `block(did)` delete the request at `asked` when the
|
|
110
|
+
space is still held and the record still stands, before leaving the space
|
|
111
|
+
for two.
|
|
133
112
|
- `spaces.leave(id)` on a space a `std.contact` names does what `remove` does
|
|
134
113
|
for that contact.
|
|
135
114
|
- `ContactView` gains `waiting: boolean`, true while the other account has no
|