@joe-broadhead/opencode-mem 0.9.14 → 0.11.3
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/CHANGELOG.md +1856 -0
- package/README.md +15 -7
- package/SECURITY.md +3 -1
- package/docs/agent-instructions.md +1 -1
- package/docs/agent-protocol.md +7 -7
- package/docs/permissions.md +16 -0
- package/package.json +8921 -1070
- package/shared/page-paths.js +44 -0
- package/skills/mem.pages/SKILL.md +3 -1
- package/skills/mem.usage/SKILL.md +15 -15
- package/src/action-grant-keys.js +159 -0
- package/src/action-grant.js +439 -0
- package/src/actions.js +1690 -0
- package/src/backend/records.js +25 -2
- package/src/backend/v3.js +76 -22
- package/src/call-shapes.js +17 -16
- package/src/collector-lock.js +533 -62
- package/src/collector-service.js +153 -26
- package/src/collector.js +623 -30
- package/src/config.js +88 -7
- package/src/connect.js +106 -8
- package/src/credentials.js +123 -25
- package/src/events.js +174 -3
- package/src/forget-turn.js +141 -0
- package/src/host-refusal.js +78 -0
- package/src/index.js +209 -22
- package/src/jobs/host.js +557 -0
- package/src/ops/codes.js +110 -0
- package/src/ops/copy-lineage.js +42 -0
- package/src/ops/index.js +28 -0
- package/src/ops/space-ops.js +1936 -0
- package/src/outlinks.js +103 -0
- package/src/p2-reservation.js +151 -0
- package/src/permissions.js +30 -0
- package/src/plugins/descriptor.js +62 -0
- package/src/plugins/discovery.js +318 -0
- package/src/plugins/grants.js +178 -0
- package/src/plugins/locate.js +319 -0
- package/src/plugins/manifest.js +1162 -0
- package/src/plugins/source-contract/index.js +34 -0
- package/src/plugins/source-contract/policy.js +102 -0
- package/src/plugins/source-contract/vendor/PROVENANCE.json +17 -0
- package/src/plugins/source-contract/vendor/RELEASE-SHA256SUMS +3 -0
- package/src/plugins/source-contract/vendor/RELEASE.json +17 -0
- package/src/plugins/source-contract/vendor/SHA256SUMS +41 -0
- package/src/plugins/source-contract/vendor/THIRD-PARTY-NOTICES.md +35 -0
- package/src/plugins/source-contract/vendor/broker-client.js +93 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-3M5PAKSS.js +84 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-4ERCA4TK.js +185 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-6HDIB2SA.js +183 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-ELPJD3ND.js +10 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-HLVAKAYG.js +10 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-I2RXJJJM.js +81 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-KWEWSZ4V.js +505 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-KYWBTAF4.js +182 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-Q3RQA5J2.js +249 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-RRUAIQ4I.js +156 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-RYNKNCPP.js +165 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-W5SHR7DQ.js +9477 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-ZUKF7P6U.js +653 -0
- package/src/plugins/source-contract/vendor/cursor.js +26 -0
- package/src/plugins/source-contract/vendor/descriptor.js +34 -0
- package/src/plugins/source-contract/vendor/events.js +257 -0
- package/src/plugins/source-contract/vendor/index.js +10 -0
- package/src/plugins/source-contract/vendor/params.js +22 -0
- package/src/plugins/source-contract/vendor/permission.js +28 -0
- package/src/plugins/source-contract/vendor/pick.js +22 -0
- package/src/plugins/source-contract/vendor/read.js +29 -0
- package/src/plugins/source-contract/vendor/registry.js +23 -0
- package/src/plugins/source-contract/vendor/schema.js +17 -0
- package/src/plugins/source-contract/vendor/schemas/output.agenda.json +96 -0
- package/src/plugins/source-contract/vendor/schemas/output.countdown.json +28 -0
- package/src/plugins/source-contract/vendor/schemas/output.image.json +28 -0
- package/src/plugins/source-contract/vendor/schemas/output.inbox.json +84 -0
- package/src/plugins/source-contract/vendor/schemas/output.links.json +46 -0
- package/src/plugins/source-contract/vendor/schemas/output.list.json +57 -0
- package/src/plugins/source-contract/vendor/schemas/output.metric.json +61 -0
- package/src/plugins/source-contract/vendor/schemas/output.note.json +14 -0
- package/src/plugins/source-contract/vendor/schemas/output.progress.json +50 -0
- package/src/plugins/source-contract/vendor/schemas/output.record.json +38 -0
- package/src/plugins/source-contract/vendor/schemas/output.table.json +61 -0
- package/src/plugins/source-contract/vendor/schemas/output.thread.json +62 -0
- package/src/plugins/source-contract/vendor/schemas/sources.json +819 -0
- package/src/plugins/source-contract/vendor/schemas.js +19 -0
- package/src/plugins/source-contract/vendor/tools-rpc.js +42 -0
- package/src/plugins/verify.js +56 -0
- package/src/protocol.js +11 -6
- package/src/recall.js +92 -5
- package/src/records.js +61 -2
- package/src/requests.js +216 -0
- package/src/runtime.js +89 -7
- package/src/setup-time.js +68 -0
- package/src/skills.js +230 -8
- package/src/source-ids.js +25 -0
- package/src/sources/declaration.js +365 -0
- package/src/sources/reads.js +772 -0
- package/src/sources/rpc.js +151 -0
- package/src/sources.js +389 -92
- package/src/spaces.js +283 -11
- package/src/spool.js +61 -4
- package/src/stated.js +10 -5
- package/src/storable.js +139 -0
- package/src/tools/commitments.js +74 -23
- package/src/tools/held-write.js +46 -19
- package/src/tools/index.js +28 -0
- package/src/tools/ingest.js +38 -2
- package/src/tools/memory.js +56 -25
- package/src/tools/page.js +212 -95
- package/src/tools/recall.js +218 -4
- package/src/tools/share.js +42 -3
- package/src/tools/shared.js +84 -6
- package/src/tools/space-lifecycle.js +278 -0
- package/src/tools/spaces.js +381 -30
- package/src/tools/status.js +9 -2
- package/src/tools/wiki.js +231 -116
- package/src/util.js +110 -6
- package/src/vendor/source-contract/README.md +24 -0
- package/src/vendor/source-contract/THIRD-PARTY-NOTICES.md +35 -0
- package/src/vendor/source-contract/VENDOR.json +81 -0
- package/src/vendor/source-contract/chunks/chunk-3M5PAKSS.js +84 -0
- package/src/vendor/source-contract/chunks/chunk-6HDIB2SA.js +183 -0
- package/src/vendor/source-contract/chunks/chunk-HLVAKAYG.js +10 -0
- package/src/vendor/source-contract/chunks/chunk-I2RXJJJM.js +81 -0
- package/src/vendor/source-contract/chunks/chunk-KWEWSZ4V.js +505 -0
- package/src/vendor/source-contract/chunks/chunk-W5SHR7DQ.js +9477 -0
- package/src/vendor/source-contract/chunks/chunk-ZUKF7P6U.js +653 -0
- package/src/vendor/source-contract/cursor.js +26 -0
- package/src/vendor/source-contract/events.js +257 -0
- package/src/vendor/source-contract/registry.js +23 -0
- package/src/vendor/source-contract/tools-rpc.js +42 -0
- package/src/views/access-reads.js +256 -0
- package/src/views/communities.js +77 -0
- package/src/views/contracts.js +1082 -23
- package/src/views/inbox-bytes.js +103 -0
- package/src/views/profile.js +31 -0
- package/src/views/receipt.js +26 -1
- package/src/views/records-reads.js +520 -41
- package/src/views/rpc.js +153 -25
- package/src/views/shape.js +8 -5
- package/src/views/write-state.js +89 -0
- package/src/wiki-ingest.js +215 -0
- package/src/wiki-state.js +228 -0
- package/views/pages.html +2 -2
package/src/views/contracts.js
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
* list under `mem_spaces`, recent memories under `mem_recall`, the wiki under
|
|
13
13
|
* `mem_wiki`, commitments under `mem_commitments`, and (0.9) journals, pages,
|
|
14
14
|
* history and the graph under `mem_page`, proposals awaiting review under
|
|
15
|
-
* `mem_spaces` (its `review` action).
|
|
15
|
+
* `mem_spaces` (its `review` action). `memory.setup` reads nothing of anyone's:
|
|
16
|
+
* it answers the numbers setup recorded at this start, under `mem_status`,
|
|
17
|
+
* which is the tool that says what Memory is doing on this host. None of them writes: a write starts as a
|
|
16
18
|
* message the person sends (`open-agent`), and the agent's tool runs under the
|
|
17
19
|
* person's rules. That includes a review decision: Jelly lets a view call only
|
|
18
20
|
* read-only methods (its `viewIssues`, and its host route), and a view call
|
|
@@ -36,6 +38,8 @@
|
|
|
36
38
|
* host refuses a page's input that carries it.
|
|
37
39
|
*/
|
|
38
40
|
|
|
41
|
+
import { WIKI_ERROR_CHARS, WIKI_STATES } from "../wiki-state.js"
|
|
42
|
+
|
|
39
43
|
/** A memory, space, wiki or page id as the views pass it back: visible ASCII, bounded. */
|
|
40
44
|
export const ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._:/-]{0,199}$"
|
|
41
45
|
/**
|
|
@@ -65,6 +69,12 @@ export const JOURNAL_SOURCES_MAX = 200
|
|
|
65
69
|
export const REVIEW_MAX = 20
|
|
66
70
|
/** Evidence quotes shown per proposal. */
|
|
67
71
|
export const EVIDENCE_MAX = 3
|
|
72
|
+
/**
|
|
73
|
+
* The provenance rows one proposal's read carries (#76): its evidence, then the
|
|
74
|
+
* record's own source. A proposal comes from a handful of turns and events, so
|
|
75
|
+
* ten holds the ones a review page lists and the rest are cut, not invented.
|
|
76
|
+
*/
|
|
77
|
+
export const PROPOSAL_SOURCES_MAX = 10
|
|
68
78
|
/** Pages one Pages answer lists, and the folders it names. */
|
|
69
79
|
export const PAGES_MAX = 150
|
|
70
80
|
export const FOLDERS_MAX = 50
|
|
@@ -85,6 +95,28 @@ export const CURSOR_CHARS = 600
|
|
|
85
95
|
export const BACKLINKS_MAX = 20
|
|
86
96
|
/** Backlink reads in flight at once, when a listing counts them. */
|
|
87
97
|
export const BACKLINKS_CONCURRENCY = 4
|
|
98
|
+
/**
|
|
99
|
+
* The bytes of a meeting's transcript one `page.save` carries (Jelly's #61),
|
|
100
|
+
* counted as UTF-8 bytes, never characters. The page keeps it in its field
|
|
101
|
+
* `fields.transcript`, where the meeting engine reads it
|
|
102
|
+
* (`records/src/jobs/meetings.js`), and the records service holds a page's
|
|
103
|
+
* whole `fields` to 32 KiB (`LIMITS.fieldsBytes`): the meeting's own fields and
|
|
104
|
+
* its file links ride there too, so the transcript takes half of it. The
|
|
105
|
+
* declared `maxLength` is this figure in **characters** — a JSON Schema cannot
|
|
106
|
+
* say bytes, and a string is never shorter than its byte count — and the
|
|
107
|
+
* operation refuses a transcript over this many bytes with the limit in words,
|
|
108
|
+
* before the store sees it. Nothing is ever stored in part: a transcript that
|
|
109
|
+
* does not fit waits for the Files address and a read in parts (later work).
|
|
110
|
+
*/
|
|
111
|
+
export const PAGE_TRANSCRIPT_BYTES = 16 * 1024
|
|
112
|
+
/**
|
|
113
|
+
* Characters of any page's notes one `page.save` carries, the cap every page had
|
|
114
|
+
* before meetings were saved: 58 KiB, the body a host signs for a grant (ADR
|
|
115
|
+
* §4.4). The figure is a ceiling a JSON Schema can state, and what a press may
|
|
116
|
+
* really carry is measured on the whole input before it is saved — a page's
|
|
117
|
+
* notes are not made smaller for the sake of a meeting's transcript.
|
|
118
|
+
*/
|
|
119
|
+
export const PAGE_BODY_CHARS = 58 * 1024
|
|
88
120
|
/** A page's fields, outlinks and backlinks one answer carries. */
|
|
89
121
|
export const FIELDS_MAX = 24
|
|
90
122
|
export const LINKS_MAX = 50
|
|
@@ -108,14 +140,47 @@ export const TERM_TYPES = Object.freeze(["person", "project", "team", "glossary"
|
|
|
108
140
|
/** Glossary pages one space's terms are read from, and their bodies read in one call. */
|
|
109
141
|
export const TERM_GLOSSARIES_MAX = 10
|
|
110
142
|
|
|
143
|
+
/**
|
|
144
|
+
* The names a host's dictation knows (0.10.2; Jelly's asks 3 and 6), the most
|
|
145
|
+
* one answer lists, and the aliases one name carries: `names.known` is a
|
|
146
|
+
* dictation vocabulary, so it is capped at 50 and carries no space, no path and
|
|
147
|
+
* no count, only what a caller would say.
|
|
148
|
+
*/
|
|
149
|
+
export const NAMES_MAX = 50
|
|
150
|
+
export const NAME_ALIASES_MAX = 4
|
|
151
|
+
/** The rows one `names.known` list read asks for (the service's own cap), and how many reads one space may take. */
|
|
152
|
+
export const NAMES_PAGE = 200
|
|
153
|
+
export const NAMES_SCAN_PAGES = 5
|
|
154
|
+
/**
|
|
155
|
+
* The page types a name comes from. The read asks the service for exactly these,
|
|
156
|
+
* so a space with thousands of newer journals or topics still offers its people.
|
|
157
|
+
*/
|
|
158
|
+
export const NAMES_PAGE_TYPES = Object.freeze(["person", "project", "team", "glossary"])
|
|
159
|
+
/** The kinds of name one answer may carry; a glossary entry is `term`. */
|
|
160
|
+
export const NAME_KINDS = Object.freeze(["person", "project", "team", "term"])
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Whether a write to a space waits for a grant (Jelly's ask 4, its #49 answer 8),
|
|
164
|
+
* so a host can say "this waits for you in the Inbox". **False for now:** Memory
|
|
165
|
+
* holds no write for a grant yet, so every space answers `grantOnly: false`, from
|
|
166
|
+
* this one constant. The day a space's held-write policy exists, the read takes
|
|
167
|
+
* the value from that policy and this becomes the fallback for a server that
|
|
168
|
+
* names none.
|
|
169
|
+
*/
|
|
170
|
+
export const SPACE_GRANT_ONLY = false
|
|
171
|
+
|
|
111
172
|
/** The graph's caps: nodes (the records service's own cap) and edges. */
|
|
112
173
|
export const GRAPH_NODES_MAX = 200
|
|
113
174
|
export const GRAPH_EDGES_MAX = 600
|
|
114
175
|
/**
|
|
115
|
-
* A page's owner, as a view names one:
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
176
|
+
* A page's owner, as a view names one: control's user id for the person the
|
|
177
|
+
* record's own `owner` names — matched through the space's member roster, which
|
|
178
|
+
* carries each member's upstream (memory) user id beside its own, because a
|
|
179
|
+
* record's owner is the upstream id the records service keeps — and the person's
|
|
180
|
+
* name from that roster (control's `listMembers`, read once per call). `name` is
|
|
181
|
+
* the key Jelly's `readPage` reads (`owner.name`, at most 120 characters) and is
|
|
182
|
+
* the issue's `label`; `id` is control's, the person's id everywhere else, never
|
|
183
|
+
* the upstream one (docs/jelly.md).
|
|
119
184
|
*
|
|
120
185
|
* **A person Memory can name, or no owner at all.** An id is not a name: control's
|
|
121
186
|
* member list needs the viewer role (`control/src/service/spaces.js`), so a reader
|
|
@@ -160,6 +225,20 @@ export const HELD_MEMORIES_MAX = 50
|
|
|
160
225
|
|
|
161
226
|
/** The most items one Inbox read carries: Jelly's own cap (`INBOX_CAP`). */
|
|
162
227
|
export const INBOX_MAX = 64
|
|
228
|
+
/**
|
|
229
|
+
* The most bytes one Inbox read's answer may carry, held below Jelly's own cap
|
|
230
|
+
* on a plugin RPC answer: `VIEW_DATA_MAX_BYTES`, 65,536 bytes
|
|
231
|
+
* (`protocol/contracts/src/plugin-views.ts` on its master), which its host
|
|
232
|
+
* refuses, leaving the person's last Inbox in place, silently
|
|
233
|
+
* (`backend/host/src/plugin-views/rpc.ts:247`). The margin is 4 KiB, the one the
|
|
234
|
+
* meeting press keeps (`PRESS_BYTES`, `src/ops/space-ops.js`).
|
|
235
|
+
*
|
|
236
|
+
* **A guard for the meeting carry, not a fix for today's read.** Without
|
|
237
|
+
* `inboxItemMeeting`, an answer peaks at 28–33 KB and never reaches this. With
|
|
238
|
+
* it, a full Inbox of proposals whose moments are quoted in CJK comes to about
|
|
239
|
+
* 75–80 KB, and `src/views/inbox-bytes.js` trims that to this.
|
|
240
|
+
*/
|
|
241
|
+
export const INBOX_READ_BYTES_MAX = 61_440
|
|
163
242
|
/**
|
|
164
243
|
* Whether an Inbox item carries the session a proposal was made in.
|
|
165
244
|
*
|
|
@@ -176,6 +255,39 @@ export const INBOX_MAX = 64
|
|
|
176
255
|
* Jelly's own master and fails while a declared field is one it refuses.
|
|
177
256
|
*/
|
|
178
257
|
export const INBOX_ITEM_SESSION = false
|
|
258
|
+
/**
|
|
259
|
+
* Whether an Inbox item carries the `revision` and the `decisions` a decide
|
|
260
|
+
* button needs (Jelly's answer 2 and 6, app#2430). **False, and Jelly's to
|
|
261
|
+
* change:** its Inbox item is a strict schema that knows neither, so a field it
|
|
262
|
+
* does not know makes it refuse the whole Inbox. `npm run check:jelly:master`
|
|
263
|
+
* is the proof they are held back: with this false, no sample item carries them,
|
|
264
|
+
* and Jelly's own reader refuses one that did. The day Jelly widens the item,
|
|
265
|
+
* this becomes true and `inbox.list` sends them.
|
|
266
|
+
*/
|
|
267
|
+
export const INBOX_ITEM_ACTIONS = false
|
|
268
|
+
/**
|
|
269
|
+
* Whether an Inbox item carries the meeting a proposal was drawn from — `meeting
|
|
270
|
+
* {id, path}`, and each `evidence` entry's `at` and `file`, exactly as
|
|
271
|
+
* `review.list` carries them (#62) — so the Inbox can say which meeting a Keep
|
|
272
|
+
* row came from and when it was said.
|
|
273
|
+
*
|
|
274
|
+
* **False, and Jelly's to change.** Jelly reads an Inbox item with a strict
|
|
275
|
+
* schema (`PluginInboxReadItemSchema`, `protocol/contracts/src/plugin-inbox.ts`
|
|
276
|
+
* on its master) that knows `key, category, kind?, label, name?, line?,
|
|
277
|
+
* explanation?, action?, revision?, decisions?, at, count?` and nothing else,
|
|
278
|
+
* and its host **leaves out** an item it cannot read rather than showing it
|
|
279
|
+
* (`backend/host/src/plugin-inbox/gather.ts`): carrying these today would make
|
|
280
|
+
* the proposal disappear from the Inbox, not gain a meeting. The fields are
|
|
281
|
+
* derived from the proposal's own `fields.meeting_id`, `fields.meeting` and
|
|
282
|
+
* `fields.evidence` — nothing is stored for this, and the read comes from the
|
|
283
|
+
* same space as `review.list` — and they go on the wire the day Jelly's item
|
|
284
|
+
* takes them, when this becomes true and `inboxOutput` beside it turns on with
|
|
285
|
+
* it.
|
|
286
|
+
*
|
|
287
|
+
* `scripts/check-jelly-master.sh` is the check: it runs the declaration against
|
|
288
|
+
* Jelly's own master and fails while sample items carry a field it refuses.
|
|
289
|
+
*/
|
|
290
|
+
export const INBOX_ITEM_MEETING = false
|
|
179
291
|
/**
|
|
180
292
|
* Overdue commitments one Inbox read lists, the most overdue first. With the
|
|
181
293
|
* proposals (`REVIEW_MAX`) the read stays within `INBOX_MAX`.
|
|
@@ -236,14 +348,58 @@ const viewInput = (properties = {}, required = []) => ({
|
|
|
236
348
|
const empty = viewInput()
|
|
237
349
|
const id = { type: "string", maxLength: 200 }
|
|
238
350
|
const line = (max) => ({ type: "string", maxLength: max })
|
|
351
|
+
/** A count: a non-negative whole number, never the rows behind it. */
|
|
352
|
+
const count = (minimum) => ({ type: "integer", minimum })
|
|
239
353
|
const space = {
|
|
240
354
|
type: "object",
|
|
241
355
|
additionalProperties: false,
|
|
242
|
-
required: ["id", "name", "kind"],
|
|
356
|
+
required: ["id", "name", "kind", "grantOnly"],
|
|
243
357
|
properties: {
|
|
244
358
|
id,
|
|
245
359
|
name: line(200),
|
|
246
360
|
kind: { type: "string", enum: ["personal", "shared", "unknown"] },
|
|
361
|
+
/**
|
|
362
|
+
* Whether a write here waits for a grant: `SPACE_GRANT_ONLY` for now (false,
|
|
363
|
+
* since Memory holds no write for a grant), so Jelly's "this waits for you
|
|
364
|
+
* in the Inbox" has a field to read the day a policy lands.
|
|
365
|
+
*/
|
|
366
|
+
grantOnly: { type: "boolean" },
|
|
367
|
+
/** How many people the space is shared with, when control answers it: a count, never the rows (jelly #55). */
|
|
368
|
+
members: count(0),
|
|
369
|
+
/** How many wikis the space holds, when control answers it (jelly #55). */
|
|
370
|
+
wikis: count(0),
|
|
371
|
+
},
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* `memory.setup`'s answer (jelly #80, D226): the phases of this engine start's
|
|
376
|
+
* setup and their total, on a monotonic clock, and when the start began. Only
|
|
377
|
+
* the numbers recorded once, as setup ended (`src/setup-time.js`): a host reads
|
|
378
|
+
* it for its engine-start telemetry, before anything else is asked.
|
|
379
|
+
*
|
|
380
|
+
* `ms` is the phases' sum, and each `ms` is a duration in milliseconds. `at` is
|
|
381
|
+
* ISO 8601 with milliseconds, the same length as a record's own instants.
|
|
382
|
+
*/
|
|
383
|
+
const setupOutput = {
|
|
384
|
+
type: "object",
|
|
385
|
+
additionalProperties: false,
|
|
386
|
+
required: ["ms", "phases", "at"],
|
|
387
|
+
properties: {
|
|
388
|
+
ms: { type: "number", minimum: 0 },
|
|
389
|
+
phases: {
|
|
390
|
+
type: "array",
|
|
391
|
+
maxItems: 32,
|
|
392
|
+
items: {
|
|
393
|
+
type: "object",
|
|
394
|
+
additionalProperties: false,
|
|
395
|
+
required: ["name", "ms"],
|
|
396
|
+
properties: {
|
|
397
|
+
name: line(40),
|
|
398
|
+
ms: { type: "number", minimum: 0 },
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
at: line(40),
|
|
247
403
|
},
|
|
248
404
|
}
|
|
249
405
|
|
|
@@ -260,6 +416,8 @@ const overviewOutput = {
|
|
|
260
416
|
* "refused" (the credential was turned down), or "unreachable" (anything else: try again).
|
|
261
417
|
*/
|
|
262
418
|
state: { type: "string", enum: ["unconfigured", "refused", "unreachable"] },
|
|
419
|
+
/** Not connected only: that state's one fixed sentence, at most 60 characters, ending in the next step (jelly #73). */
|
|
420
|
+
tile: line(60),
|
|
263
421
|
/** Where the bearer comes from: Jelly, a pasted key, the token option, or nothing. */
|
|
264
422
|
credential: { type: "string", enum: ["jelly", "key", "option", "opencode", "none"] },
|
|
265
423
|
/** Jelly's refusal code while the plugin falls back to a pasted key. */
|
|
@@ -313,7 +471,7 @@ const spacesOutput = {
|
|
|
313
471
|
items: {
|
|
314
472
|
type: "object",
|
|
315
473
|
additionalProperties: false,
|
|
316
|
-
required: ["id", "name", "kind", "role"],
|
|
474
|
+
required: ["id", "name", "kind", "grantOnly", "role"],
|
|
317
475
|
properties: { ...space.properties, role: line(40) },
|
|
318
476
|
},
|
|
319
477
|
},
|
|
@@ -415,8 +573,16 @@ const wikiListOutput = {
|
|
|
415
573
|
items: {
|
|
416
574
|
type: "object",
|
|
417
575
|
additionalProperties: false,
|
|
418
|
-
required: ["id", "name", "pages"],
|
|
419
|
-
properties: {
|
|
576
|
+
required: ["id", "name", "pages", "status"],
|
|
577
|
+
properties: {
|
|
578
|
+
id,
|
|
579
|
+
name: line(200),
|
|
580
|
+
pages: { type: "integer", minimum: 0 },
|
|
581
|
+
/** The state a host shows on the wiki (jelly #89 A1). */
|
|
582
|
+
status: { type: "string", enum: [...WIKI_STATES] },
|
|
583
|
+
/** Why a failed wiki failed, at most 400 characters. */
|
|
584
|
+
error: line(WIKI_ERROR_CHARS),
|
|
585
|
+
},
|
|
420
586
|
},
|
|
421
587
|
},
|
|
422
588
|
},
|
|
@@ -437,6 +603,8 @@ const wikiPagesOutput = {
|
|
|
437
603
|
properties: { ref: id, title: line(200) },
|
|
438
604
|
},
|
|
439
605
|
},
|
|
606
|
+
/** The pages are the last ready set, kept while an ingest runs (jelly #89 A2). */
|
|
607
|
+
stale: { type: "boolean" },
|
|
440
608
|
},
|
|
441
609
|
}
|
|
442
610
|
|
|
@@ -474,6 +642,8 @@ const commitmentsOutput = {
|
|
|
474
642
|
state: { type: "string", enum: ["open", "done", "cancelled"] },
|
|
475
643
|
/** The due day as "Fri 6 Nov" (with a time for a date-time), or "" when undated. */
|
|
476
644
|
when: line(40),
|
|
645
|
+
/** The due day as an ISO 8601 local date; absent when the commitment waits on a trigger. */
|
|
646
|
+
due: line(40),
|
|
477
647
|
overdue: { type: "boolean" },
|
|
478
648
|
dueToday: { type: "boolean" },
|
|
479
649
|
trigger: line(200),
|
|
@@ -497,12 +667,157 @@ const object = (properties, required = Object.keys(properties)) => ({
|
|
|
497
667
|
required,
|
|
498
668
|
properties,
|
|
499
669
|
})
|
|
670
|
+
|
|
671
|
+
/* ------------------------------------------------------- meetings and handovers (0.11.3) */
|
|
672
|
+
|
|
673
|
+
const MEETINGS_MAX = 100
|
|
674
|
+
const MEETING_TRANSCRIPT_CHARS = 12_000
|
|
675
|
+
|
|
676
|
+
/** One meeting page's row, as `meetings.list` answers it. */
|
|
677
|
+
const meetingRow = object(
|
|
678
|
+
{
|
|
679
|
+
id,
|
|
680
|
+
path: line(300),
|
|
681
|
+
title: line(200),
|
|
682
|
+
/** The meeting's start, ISO 8601. */
|
|
683
|
+
at: line(40),
|
|
684
|
+
/** Its end, when the page names one: a live meeting has none. */
|
|
685
|
+
endsAt: line(40),
|
|
686
|
+
/** The names the page records for the meeting, as strings. */
|
|
687
|
+
people: list(line(200), 50),
|
|
688
|
+
},
|
|
689
|
+
["id", "path", "title", "at"],
|
|
690
|
+
)
|
|
691
|
+
|
|
692
|
+
const meetingsListOutput = object(
|
|
693
|
+
{
|
|
694
|
+
space,
|
|
695
|
+
items: list(meetingRow, MEETINGS_MAX),
|
|
696
|
+
more: flag,
|
|
697
|
+
cursor: line(CURSOR_CHARS),
|
|
698
|
+
},
|
|
699
|
+
["space", "items", "more"],
|
|
700
|
+
)
|
|
701
|
+
|
|
702
|
+
const meetingReadOutput = object(
|
|
703
|
+
{
|
|
704
|
+
space,
|
|
705
|
+
...meetingRow.properties,
|
|
706
|
+
/** The page's own notes. */
|
|
707
|
+
body: line(200_000),
|
|
708
|
+
/** The stored transcript, cut at the declared ceiling. */
|
|
709
|
+
transcript: line(MEETING_TRANSCRIPT_CHARS),
|
|
710
|
+
transcriptMore: flag,
|
|
711
|
+
},
|
|
712
|
+
["id", "path", "title", "at", "body"],
|
|
713
|
+
)
|
|
714
|
+
|
|
715
|
+
/** A hand-over request addressed to the person. */
|
|
716
|
+
const shareRequestRow = object(
|
|
717
|
+
{
|
|
718
|
+
id,
|
|
719
|
+
state: { type: "string", enum: ["pending", "accepted", "declined"] },
|
|
720
|
+
target: object({ type: { type: "string", enum: ["space", "page"] }, id, label: line(300), space: line(200) }, ["type", "id", "label"]),
|
|
721
|
+
from: object({ user_id: line(200), name: line(200) }, ["user_id"]),
|
|
722
|
+
to: object({ user_id: line(200), name: line(200) }, ["user_id"]),
|
|
723
|
+
at: line(40),
|
|
724
|
+
note: line(300),
|
|
725
|
+
},
|
|
726
|
+
["id", "state", "target", "from", "to", "at"],
|
|
727
|
+
)
|
|
728
|
+
|
|
729
|
+
const shareRequestsOutput = object({ requests: list(shareRequestRow, 100) })
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* The project pages one answer may name (jelly's ask 11). A cap, like the
|
|
733
|
+
* person read's, and past it `more` says so: a space is read in one page of
|
|
734
|
+
* `records.list`'s own ceiling, and the space is named when it holds more.
|
|
735
|
+
*/
|
|
736
|
+
export const PROJECTS_MAX = 200
|
|
737
|
+
|
|
738
|
+
const projectsInput = viewInput({
|
|
739
|
+
/** A space from `spaces.list`; omitted, every space the person can read. */
|
|
740
|
+
space: id,
|
|
741
|
+
})
|
|
742
|
+
|
|
743
|
+
const projectsOutput = object({
|
|
744
|
+
/**
|
|
745
|
+
* The project pages the caller can read, by name and then by path: each one
|
|
746
|
+
* the page's own id, its title and path, and the space it lives in. A project
|
|
747
|
+
* another member keeps to themselves is never listed.
|
|
748
|
+
*/
|
|
749
|
+
items: list(
|
|
750
|
+
object(
|
|
751
|
+
{
|
|
752
|
+
/** The record's own id, as `records.list` gives it. */
|
|
753
|
+
id,
|
|
754
|
+
/** The page's title: the name a host spells and shows ("Harbour"). */
|
|
755
|
+
name: line(200),
|
|
756
|
+
/** The page's path in its space ("projects/harbour"). */
|
|
757
|
+
path: id,
|
|
758
|
+
/** The space the page lives in. */
|
|
759
|
+
space: rowSpace,
|
|
760
|
+
},
|
|
761
|
+
["id", "name", "path", "space"],
|
|
762
|
+
),
|
|
763
|
+
PROJECTS_MAX,
|
|
764
|
+
),
|
|
765
|
+
/** Whether more project pages are held than this answer lists. */
|
|
766
|
+
more: flag,
|
|
767
|
+
/** A space that could not be read, or was not read, and why: named, never dropped. */
|
|
768
|
+
incomplete: list(
|
|
769
|
+
object({ id, name: line(200), reason: line(200) }, ["id", "name", "reason"]),
|
|
770
|
+
LIST_MAX,
|
|
771
|
+
),
|
|
772
|
+
})
|
|
773
|
+
|
|
500
774
|
/** A space the person chose from `spaces.list`; omitted, their personal space. */
|
|
501
775
|
const spaceInput = { space: id }
|
|
502
776
|
/** A page's owning person in its space: the record's own owner, named by the space's roster; absent when no one can be named. */
|
|
503
777
|
const pageOwner = object({ id: line(OWNER_ID_CHARS), name: line(OWNER_NAME_CHARS) }, ["id", "name"])
|
|
504
778
|
const period = { type: "string", enum: ["day", "week", "month"] }
|
|
505
779
|
|
|
780
|
+
/**
|
|
781
|
+
* The size limits a `page.save` really keeps, said where a host reads them. A
|
|
782
|
+
* JSON Schema counts characters, never bytes, and cannot add a body's bytes to
|
|
783
|
+
* a transcript's, so these numbers are ceilings the host may rely on: the act
|
|
784
|
+
* measures what it is given — a transcript in UTF-8 bytes, a meeting and a
|
|
785
|
+
* page's fields in the JSON the store writes, and the whole press against the
|
|
786
|
+
* grant's cap — and refuses what is too large in words before anything is
|
|
787
|
+
* signed or written, never cutting it.
|
|
788
|
+
*/
|
|
789
|
+
export const pageBody = {
|
|
790
|
+
type: "string",
|
|
791
|
+
maxLength: PAGE_BODY_CHARS,
|
|
792
|
+
description:
|
|
793
|
+
"The page's notes: 59392 characters, and a whole press (body, transcript and files) is held to 61440 bytes of JSON.",
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* A meeting's transcript, as `page.save` takes it: the declared ceiling is the
|
|
797
|
+
* byte cap counted in characters (a JSON Schema counts characters, never
|
|
798
|
+
* bytes), and the operation holds it to `PAGE_TRANSCRIPT_BYTES` UTF-8 bytes. A
|
|
799
|
+
* transcript longer than that is not saved: a Files address on the page
|
|
800
|
+
* (`fields.transcript_file`), read in parts with the person's own rights, is
|
|
801
|
+
* later work.
|
|
802
|
+
*/
|
|
803
|
+
export const pageTranscript = {
|
|
804
|
+
type: "string",
|
|
805
|
+
maxLength: PAGE_TRANSCRIPT_BYTES,
|
|
806
|
+
description:
|
|
807
|
+
"The meeting's transcript, held to 16384 UTF-8 bytes. A longer one is refused, never cut: a Files address on the page and a read in parts is later work.",
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* The same property without its `description`: a view method's schema is read
|
|
811
|
+
* by the pinned engine's RPC, which knows the keywords the views use and none
|
|
812
|
+
* beyond them, so the host-facing note stays on the action's own declaration.
|
|
813
|
+
*/
|
|
814
|
+
const withoutNote = ({ description: _note, ...schema }) => schema
|
|
815
|
+
/** The meeting a save names: its id and its times, kept small. */
|
|
816
|
+
export const pageMeeting = {
|
|
817
|
+
type: "object",
|
|
818
|
+
description: "The meeting's id and its times, at most 1024 bytes of JSON.",
|
|
819
|
+
}
|
|
820
|
+
|
|
506
821
|
const journalListInput = viewInput({ ...spaceInput, period })
|
|
507
822
|
|
|
508
823
|
const journalListOutput = object({
|
|
@@ -574,6 +889,14 @@ const reviewListOutput = object({
|
|
|
574
889
|
title: line(200),
|
|
575
890
|
/** The record or page it changes, when it changes one. */
|
|
576
891
|
target: line(200),
|
|
892
|
+
/**
|
|
893
|
+
* The wiki a new page would land in, where the proposal names one
|
|
894
|
+
* (#63, #76): a space holds several wikis, and a folder path does not
|
|
895
|
+
* say which. Absent when the proposal names none.
|
|
896
|
+
*/
|
|
897
|
+
wiki: line(128),
|
|
898
|
+
/** The folder a new page would land in, from the path the proposal names (#63). */
|
|
899
|
+
parent: line(300),
|
|
577
900
|
reason: line(300),
|
|
578
901
|
stated_by: { type: "string", enum: ["person", "agent", "inferred", "external", "unknown"] },
|
|
579
902
|
/** Where it came from, as "event evt_…" or "routine daily@v1", where the record says. */
|
|
@@ -591,14 +914,42 @@ const reviewListOutput = object({
|
|
|
591
914
|
space: rowSpace,
|
|
592
915
|
/** Whether the words came from someone other than the person: the page labels it. */
|
|
593
916
|
external: flag,
|
|
917
|
+
/**
|
|
918
|
+
* The meeting page a proposal was drawn from (#62), so a host ties the
|
|
919
|
+
* item to the meeting it came from: the record's id and its path. Absent
|
|
920
|
+
* for a proposal that came from something other than a meeting.
|
|
921
|
+
*/
|
|
922
|
+
meeting: object({ id, path: line(300) }, ["id"]),
|
|
594
923
|
evidence: list(
|
|
595
|
-
object(
|
|
924
|
+
object(
|
|
925
|
+
{
|
|
926
|
+
kind: { type: "string", enum: ["event", "turn", "record"] },
|
|
927
|
+
ref: id,
|
|
928
|
+
quote: line(300),
|
|
929
|
+
/** The transcript moment the line was said, when it is a meeting proposal (#62). */
|
|
930
|
+
at: line(20),
|
|
931
|
+
/** The transcript file the moment came from, when the page named one. */
|
|
932
|
+
file: line(200),
|
|
933
|
+
},
|
|
934
|
+
["kind", "ref", "quote"],
|
|
935
|
+
),
|
|
596
936
|
EVIDENCE_MAX,
|
|
597
937
|
),
|
|
938
|
+
/**
|
|
939
|
+
* Where the proposal's words came from, for the review page's Sources
|
|
940
|
+
* section (#76): the evidence it cites, then the record's own
|
|
941
|
+
* provenance, each row once. A proposal with neither has none.
|
|
942
|
+
*/
|
|
943
|
+
sources: list(
|
|
944
|
+
object({ kind: { type: "string", enum: ["event", "turn", "record", "session", "routine", "url"] }, ref: line(300), quote: line(300) }, ["kind", "ref"]),
|
|
945
|
+
PROPOSAL_SOURCES_MAX,
|
|
946
|
+
),
|
|
598
947
|
/** The text accepting it would apply; the Edit box starts from it. */
|
|
599
948
|
proposed: line(600),
|
|
600
949
|
expires: line(40),
|
|
601
950
|
created: line(40),
|
|
951
|
+
/** When it was created, ISO 8601 with milliseconds. */
|
|
952
|
+
at: line(40),
|
|
602
953
|
/** #55: what accepting it would make, when the payload is a record (a share names none). */
|
|
603
954
|
payload: object(
|
|
604
955
|
{
|
|
@@ -608,13 +959,38 @@ const reviewListOutput = object({
|
|
|
608
959
|
["kind"],
|
|
609
960
|
),
|
|
610
961
|
},
|
|
611
|
-
["id", "status", "action", "title", "target", "reason", "stated_by", "external", "evidence", "proposed", "expires", "created", "held"],
|
|
962
|
+
["id", "status", "action", "title", "target", "reason", "stated_by", "external", "evidence", "sources", "proposed", "expires", "created", "held"],
|
|
612
963
|
),
|
|
613
964
|
REVIEW_MAX,
|
|
614
965
|
),
|
|
615
966
|
more: flag,
|
|
616
967
|
})
|
|
617
968
|
|
|
969
|
+
/**
|
|
970
|
+
* The `meeting` and `evidence` an Inbox item carries when `INBOX_ITEM_MEETING`
|
|
971
|
+
* is true: one source for the shape `inboxOutput` declares the day that flag
|
|
972
|
+
* turns on, so a test can hold a read that carries them to the shape Jelly will
|
|
973
|
+
* read then.
|
|
974
|
+
*/
|
|
975
|
+
export const INBOX_MEETING_FIELDS = Object.freeze({
|
|
976
|
+
/** The meeting page a proposal was drawn from (#62), as `review.list` carries it. */
|
|
977
|
+
meeting: object({ id, path: line(300) }, ["id"]),
|
|
978
|
+
/** The moments the proposal cites, as `review.list` carries them. */
|
|
979
|
+
evidence: list(
|
|
980
|
+
object(
|
|
981
|
+
{
|
|
982
|
+
kind: { type: "string", enum: ["event", "turn", "record"] },
|
|
983
|
+
ref: id,
|
|
984
|
+
quote: line(300),
|
|
985
|
+
at: line(20),
|
|
986
|
+
file: line(200),
|
|
987
|
+
},
|
|
988
|
+
["kind", "ref", "quote"],
|
|
989
|
+
),
|
|
990
|
+
EVIDENCE_MAX,
|
|
991
|
+
),
|
|
992
|
+
})
|
|
993
|
+
|
|
618
994
|
const inboxOutput = object({
|
|
619
995
|
/**
|
|
620
996
|
* What waits for the person, as the host replaces its whole copy with each
|
|
@@ -636,6 +1012,15 @@ const inboxOutput = object({
|
|
|
636
1012
|
...(INBOX_ITEM_SESSION
|
|
637
1013
|
? { session: line(200) }
|
|
638
1014
|
: {}),
|
|
1015
|
+
...(INBOX_ITEM_MEETING ? INBOX_MEETING_FIELDS : {}),
|
|
1016
|
+
...(INBOX_ITEM_ACTIONS
|
|
1017
|
+
? {
|
|
1018
|
+
/** The proposal's version, as `inbox.decide`'s `revision` takes it. */
|
|
1019
|
+
revision: { type: "integer", minimum: 1 },
|
|
1020
|
+
/** The decisions the item offers: accept, private, decline. */
|
|
1021
|
+
decisions: { type: "array", maxItems: 3, items: { type: "string" } },
|
|
1022
|
+
}
|
|
1023
|
+
: {}),
|
|
639
1024
|
},
|
|
640
1025
|
["key", "category", "label", "name", "line", "at"],
|
|
641
1026
|
), INBOX_MAX),
|
|
@@ -653,6 +1038,8 @@ const pagesListOutput = object({
|
|
|
653
1038
|
title: line(200),
|
|
654
1039
|
type: line(40),
|
|
655
1040
|
updated: line(40),
|
|
1041
|
+
/** The last change as an ISO 8601 instant; `updated` stays the display day. */
|
|
1042
|
+
changedAt: line(40),
|
|
656
1043
|
/** The page's owning person, where the page names one. */
|
|
657
1044
|
owner: pageOwner,
|
|
658
1045
|
/** How many pages link to this one, at most `BACKLINKS_MAX`; absent when the count could not be read. */
|
|
@@ -706,10 +1093,22 @@ const pagesReadOutput = object({
|
|
|
706
1093
|
fields: list(object({ name: line(40), value: line(300) }), FIELDS_MAX),
|
|
707
1094
|
body: line(RECORD_BODY_CHARS),
|
|
708
1095
|
clipped: flag,
|
|
709
|
-
/**
|
|
710
|
-
|
|
1096
|
+
/**
|
|
1097
|
+
* Each `[[link]]` of the body: its target, the record it names when there is
|
|
1098
|
+
* one, and `exists` only where existence is known — false for a page this
|
|
1099
|
+
* reader can prove is not there, true for the record it read. It is absent
|
|
1100
|
+
* when the answer would be a guess (a reader with only a page grant, a failed
|
|
1101
|
+
* lookup), and the page then marks nothing; the rule is `src/outlinks.js`.
|
|
1102
|
+
*/
|
|
1103
|
+
outlinks: list(object({ target: line(200), title: line(200), exists: flag }, ["target", "title"]), LINKS_MAX),
|
|
711
1104
|
backlinks: list(object({ id, path: line(200), title: line(200), type: line(40) }), LINKS_MAX),
|
|
712
1105
|
backlinksMore: flag,
|
|
1106
|
+
/**
|
|
1107
|
+
* Present when these are only the backlinks this reader can see (it holds no
|
|
1108
|
+
* space-level read, so the store filter hides the rest): the page says
|
|
1109
|
+
* "Nothing you can see links here." rather than "Nothing links here yet."
|
|
1110
|
+
*/
|
|
1111
|
+
backlinksPartial: flag,
|
|
713
1112
|
}, ["space", "id", "path", "kind", "type", "title", "status", "stated_by", "updated", "version", "fields", "body", "clipped", "outlinks", "backlinks", "backlinksMore"])
|
|
714
1113
|
|
|
715
1114
|
const lineageItem = object({ id, title: line(200), status: line(20) })
|
|
@@ -758,6 +1157,156 @@ const termsOutput = object({
|
|
|
758
1157
|
),
|
|
759
1158
|
})
|
|
760
1159
|
|
|
1160
|
+
const namesOutput = object({
|
|
1161
|
+
/**
|
|
1162
|
+
* The people, projects, teams and glossary terms Memory can name, the most
|
|
1163
|
+
* referenced first and then by name: at most `NAMES_MAX`, each one only
|
|
1164
|
+
* `{name, kind, aliases?}`, with no space id and no path (a dictation
|
|
1165
|
+
* vocabulary, not a page list). A name that appears in two spaces is one
|
|
1166
|
+
* entry, its aliases together.
|
|
1167
|
+
*/
|
|
1168
|
+
names: list(
|
|
1169
|
+
object(
|
|
1170
|
+
{
|
|
1171
|
+
name: line(TERM_TEXT_CHARS),
|
|
1172
|
+
/** person, project, team, or a glossary entry (`term`). */
|
|
1173
|
+
kind: { type: "string", enum: [...NAME_KINDS] },
|
|
1174
|
+
/** Other ways the page says this name (`fields.aliases`), at most `NAME_ALIASES_MAX`, sorted; absent when it names none. */
|
|
1175
|
+
aliases: list(line(TERM_TEXT_CHARS), NAME_ALIASES_MAX),
|
|
1176
|
+
},
|
|
1177
|
+
["name", "kind"],
|
|
1178
|
+
),
|
|
1179
|
+
NAMES_MAX,
|
|
1180
|
+
),
|
|
1181
|
+
/**
|
|
1182
|
+
* Whether the answer was cut: a space with more pages than one scan reads
|
|
1183
|
+
* (`NAMES_SCAN_PAGES`), more names than `NAMES_MAX`, or more glossary pages
|
|
1184
|
+
* than have their bodies read. A host that needs every name of such a space
|
|
1185
|
+
* asks for that space alone, or reads its pages.
|
|
1186
|
+
*/
|
|
1187
|
+
more: flag,
|
|
1188
|
+
/** A space that could not be read, or was not read, and why: named, never dropped. */
|
|
1189
|
+
incomplete: list(
|
|
1190
|
+
object({ id, name: line(200), reason: line(200) }, ["id", "name", "reason"]),
|
|
1191
|
+
LIST_MAX,
|
|
1192
|
+
),
|
|
1193
|
+
}, ["names", "more", "incomplete"])
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* The people, and the grants, one access answer asks control for (Jelly's ask
|
|
1197
|
+
* 10): 50 a page, then `fitAccessPage` keeps what fits `ANSWER_BYTES`, and the
|
|
1198
|
+
* cursor continues after the last row shown. Control answers a space's whole
|
|
1199
|
+
* roster or a target's whole grant list, so the page and the cursor are what
|
|
1200
|
+
* keep an answer bounded without losing a row.
|
|
1201
|
+
*/
|
|
1202
|
+
export const ACCESS_PAGE = 50
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* A cursor of one of these reads: this read's own opaque token, bound to the
|
|
1206
|
+
* space and target it was given for (`encodeCursor`/`decodeCursor` in
|
|
1207
|
+
* `src/views/access-reads.js`), never the records service's.
|
|
1208
|
+
*/
|
|
1209
|
+
const accessCursor = { type: "string", maxLength: CURSOR_CHARS }
|
|
1210
|
+
|
|
1211
|
+
const membersInput = viewInput({
|
|
1212
|
+
/** A space from `spaces.list`; omitted, the person's personal space. */
|
|
1213
|
+
space: id,
|
|
1214
|
+
/** The `cursor` a previous page answered, to read on from the row after its last; omitted, the top. */
|
|
1215
|
+
cursor: accessCursor,
|
|
1216
|
+
})
|
|
1217
|
+
|
|
1218
|
+
const membersOutput = object({
|
|
1219
|
+
/** The space whose roster this is. */
|
|
1220
|
+
space: rowSpace,
|
|
1221
|
+
/**
|
|
1222
|
+
* The space's people, as control's own roster gives them and its own rules
|
|
1223
|
+
* let the caller see: a member (viewer or above) or a space-wide grant, never
|
|
1224
|
+
* a page grant alone. At most `ACCESS_PAGE` a page, and always inside
|
|
1225
|
+
* `ANSWER_BYTES`.
|
|
1226
|
+
*/
|
|
1227
|
+
members: list(
|
|
1228
|
+
object(
|
|
1229
|
+
{
|
|
1230
|
+
/** The person's control user id. */
|
|
1231
|
+
person: id,
|
|
1232
|
+
/** Their name, their email, or their id: one line, the person as control names them. */
|
|
1233
|
+
label: line(200),
|
|
1234
|
+
/** Their space role, in control's own words: owner, admin, editor or viewer. */
|
|
1235
|
+
role: line(40),
|
|
1236
|
+
/** When they joined, where control says. */
|
|
1237
|
+
added: line(40),
|
|
1238
|
+
},
|
|
1239
|
+
["person", "label", "role"],
|
|
1240
|
+
),
|
|
1241
|
+
ACCESS_PAGE,
|
|
1242
|
+
),
|
|
1243
|
+
/** Whether anything is left after this page: a row cut for room, or a row past it. */
|
|
1244
|
+
more: flag,
|
|
1245
|
+
/** Where to read on from, whenever `more`: the row after the last one shown. */
|
|
1246
|
+
cursor: accessCursor,
|
|
1247
|
+
}, ["space", "members", "more"])
|
|
1248
|
+
|
|
1249
|
+
const grantsInput = viewInput({
|
|
1250
|
+
/** A space from `spaces.list`; omitted, the person's personal space. */
|
|
1251
|
+
space: id,
|
|
1252
|
+
/**
|
|
1253
|
+
* A page, folder or wiki of the space: the id of its registered share (the
|
|
1254
|
+
* `resource` a `mem_share` grant names), not a path. Its grants are its
|
|
1255
|
+
* owner's and a space admin's to list. Omitted, the answer is the grants that
|
|
1256
|
+
* name the caller, because a key cannot list every grant in a space.
|
|
1257
|
+
*/
|
|
1258
|
+
target: id,
|
|
1259
|
+
/** The `cursor` a previous page answered, to read on from the row after its last; omitted, the top. */
|
|
1260
|
+
cursor: accessCursor,
|
|
1261
|
+
})
|
|
1262
|
+
|
|
1263
|
+
const grantsOutput = object({
|
|
1264
|
+
/** The space the grants are in. */
|
|
1265
|
+
space: rowSpace,
|
|
1266
|
+
/** Whose grants these are: the named target's (`target`), or the caller's own (`mine`). */
|
|
1267
|
+
scope: { type: "string", enum: ["target", "mine"] },
|
|
1268
|
+
/** The target the call named, or null for the caller's own grants. */
|
|
1269
|
+
target: { type: ["string", "null"], maxLength: 200 },
|
|
1270
|
+
/**
|
|
1271
|
+
* Who has access, and how much: one row a principal, the strongest access
|
|
1272
|
+
* first as control lists them. At most `ACCESS_PAGE` a page, and always
|
|
1273
|
+
* inside `ANSWER_BYTES`.
|
|
1274
|
+
*/
|
|
1275
|
+
grants: list(
|
|
1276
|
+
object(
|
|
1277
|
+
{
|
|
1278
|
+
/**
|
|
1279
|
+
* Who it names: exactly one of `person`, `group`, `role` (an
|
|
1280
|
+
* organisation role) or `agent`, as control's principal types.
|
|
1281
|
+
*/
|
|
1282
|
+
subject: {
|
|
1283
|
+
type: "object",
|
|
1284
|
+
additionalProperties: false,
|
|
1285
|
+
properties: { person: id, group: id, role: id, agent: id },
|
|
1286
|
+
},
|
|
1287
|
+
/** Their access in control's words: viewer, editor or admin. */
|
|
1288
|
+
access: line(40),
|
|
1289
|
+
/** What it is on: the space itself, a collection, or one registered resource. */
|
|
1290
|
+
target: object({ type: line(20), id }),
|
|
1291
|
+
/** A person's name (or email) where control gives one, else their id. */
|
|
1292
|
+
label: line(200),
|
|
1293
|
+
/** When the access started. */
|
|
1294
|
+
since: line(40),
|
|
1295
|
+
/** When it ends, where it does: control hides an expired grant. */
|
|
1296
|
+
expires: line(40),
|
|
1297
|
+
},
|
|
1298
|
+
["subject", "access", "target", "label"],
|
|
1299
|
+
),
|
|
1300
|
+
ACCESS_PAGE,
|
|
1301
|
+
),
|
|
1302
|
+
/** Whether anything is left after this page: a row cut for room, or a row past it. */
|
|
1303
|
+
more: flag,
|
|
1304
|
+
/** Where to read on from, whenever `more`: the row after the last one shown. */
|
|
1305
|
+
cursor: accessCursor,
|
|
1306
|
+
/** Said when the list is the caller's own grants: a key reads no space's whole grant list. */
|
|
1307
|
+
note: line(300),
|
|
1308
|
+
}, ["space", "scope", "target", "grants", "more"])
|
|
1309
|
+
|
|
761
1310
|
const graphInput = viewInput({
|
|
762
1311
|
...pageRef,
|
|
763
1312
|
/** A folder (a wiki): every page in it and the links between them, in one read. One of `path`, `id` or `folder`. */
|
|
@@ -782,7 +1331,16 @@ const graphOutput = object({
|
|
|
782
1331
|
kind: line(20),
|
|
783
1332
|
type: line(40),
|
|
784
1333
|
dangling: flag,
|
|
785
|
-
|
|
1334
|
+
/**
|
|
1335
|
+
* The group this node's links put it in, among the nodes of this answer
|
|
1336
|
+
* (Jelly's ask 2, for colouring the graph): a computed grouping of the
|
|
1337
|
+
* visible pages, never stored, the same for the same graph
|
|
1338
|
+
* (`src/views/communities.js`; docs/jelly.md, "Communities in a graph").
|
|
1339
|
+
* A node the caller cannot see is not in the answer, so no community
|
|
1340
|
+
* reveals one. Every node of every answer carries it.
|
|
1341
|
+
*/
|
|
1342
|
+
community: integer,
|
|
1343
|
+
}, ["id", "path", "title", "kind", "type", "dangling", "community"]),
|
|
786
1344
|
GRAPH_NODES_MAX,
|
|
787
1345
|
),
|
|
788
1346
|
/** Edges by node index. */
|
|
@@ -822,11 +1380,270 @@ const profileReadOutput = object({
|
|
|
822
1380
|
notes: list(line(200), PROFILE_NOTES_MAX),
|
|
823
1381
|
})
|
|
824
1382
|
|
|
1383
|
+
/**
|
|
1384
|
+
* The previews of Memory's actions (#58 section A): what a Jelly `always`
|
|
1385
|
+
* confirmation shows before the person presses, and A12's About-you preview.
|
|
1386
|
+
* Each is a read: it changes nothing, and it is called with the action's own
|
|
1387
|
+
* input, as the person whose device asked.
|
|
1388
|
+
*
|
|
1389
|
+
* `profile.erase.preview` is also one of the reads Jelly's About-you page asks
|
|
1390
|
+
* for by name (`LIVE_OPTIONAL_READS`, opencode-mem#49), so its shape is the one
|
|
1391
|
+
* that page reads.
|
|
1392
|
+
*/
|
|
1393
|
+
const pagePath = { type: "string", maxLength: 300 }
|
|
1394
|
+
/** A memory a confirm or correct would change. */
|
|
1395
|
+
const memoryPreviewOutput = {
|
|
1396
|
+
type: "object",
|
|
1397
|
+
additionalProperties: false,
|
|
1398
|
+
required: ["found", "id", "version", "body", "status"],
|
|
1399
|
+
properties: {
|
|
1400
|
+
found: { type: "boolean" },
|
|
1401
|
+
id,
|
|
1402
|
+
version: { type: "integer", minimum: 0 },
|
|
1403
|
+
body: line(4000),
|
|
1404
|
+
status: { type: "string", maxLength: 40 },
|
|
1405
|
+
},
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
/** A commitment a delete or a move would change: its own words, never only its id. */
|
|
1409
|
+
const commitmentPreviewOutput = {
|
|
1410
|
+
type: "object",
|
|
1411
|
+
additionalProperties: false,
|
|
1412
|
+
required: ["found", "id", "what", "state", "version"],
|
|
1413
|
+
properties: {
|
|
1414
|
+
found: { type: "boolean" },
|
|
1415
|
+
id,
|
|
1416
|
+
what: { type: "string", maxLength: 300 },
|
|
1417
|
+
state: { type: "string", maxLength: 40 },
|
|
1418
|
+
version: { type: "integer", minimum: 0 },
|
|
1419
|
+
to: { type: "string", maxLength: 200 },
|
|
1420
|
+
},
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
/** A page a save or a delete touches, and a copy's source and target. */
|
|
1424
|
+
const pageFactsOutput = {
|
|
1425
|
+
type: "object",
|
|
1426
|
+
additionalProperties: false,
|
|
1427
|
+
required: ["space", "path", "exists", "version", "approvalRequired"],
|
|
1428
|
+
properties: { space: { type: "string", maxLength: 200 }, path: pagePath, exists: { type: "boolean" }, version: { type: "integer", minimum: 0 }, type: { type: "string", maxLength: 40 }, title: { type: "string", maxLength: 300 }, approvalRequired: { type: "boolean" } },
|
|
1429
|
+
}
|
|
1430
|
+
const accessPreviewOutput = {
|
|
1431
|
+
type: "object",
|
|
1432
|
+
properties: { ok: { type: "boolean" }, gainAccess: { type: "array", maxItems: 100, items: { type: "object" } }, loseAccess: { type: "array", maxItems: 100, items: { type: "object" } }, affected: { type: "integer", minimum: 0 }, target: { type: "object" }, from: { type: "object" }, to: { type: "object" }, path: pagePath, pages: { type: "integer", minimum: 0 }, wiki: id, space: { type: "string", maxLength: 200 }, ownerNow: { type: "object" }, state: { type: "string", maxLength: 40 } },
|
|
1433
|
+
}
|
|
1434
|
+
/** A move's answer: one page's access delta, or the pages a folder or a list moves. */
|
|
1435
|
+
const movePreviewOutput = {
|
|
1436
|
+
type: "object",
|
|
1437
|
+
properties: {
|
|
1438
|
+
ok: { type: "boolean" },
|
|
1439
|
+
action: { type: "string", maxLength: 40 },
|
|
1440
|
+
gainAccess: { type: "array", maxItems: 100, items: { type: "object" } },
|
|
1441
|
+
loseAccess: { type: "array", maxItems: 100, items: { type: "object" } },
|
|
1442
|
+
affected: { type: "integer", minimum: 0 },
|
|
1443
|
+
count: { type: "integer", minimum: 0 },
|
|
1444
|
+
// At most 50: a page's old and new path can each be 300 characters, and
|
|
1445
|
+
// Jelly caps a preview at 64 KiB (see MAX_FOLDER_PAGES in src/ops).
|
|
1446
|
+
pages: { type: "array", maxItems: 50, items: { type: "object" } },
|
|
1447
|
+
from: { type: "object" },
|
|
1448
|
+
to: { type: "object" },
|
|
1449
|
+
approvalRequired: { type: "boolean" },
|
|
1450
|
+
},
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
/** A delete's answer: every page the press removes. */
|
|
1454
|
+
const deletePreviewOutput = {
|
|
1455
|
+
type: "object",
|
|
1456
|
+
additionalProperties: false,
|
|
1457
|
+
required: ["space", "count", "pages", "approvalRequired"],
|
|
1458
|
+
properties: {
|
|
1459
|
+
space: { type: "string", maxLength: 200 },
|
|
1460
|
+
count: { type: "integer", minimum: 0 },
|
|
1461
|
+
pages: {
|
|
1462
|
+
type: "array",
|
|
1463
|
+
maxItems: 50,
|
|
1464
|
+
items: { type: "object", additionalProperties: false, required: ["path", "exists", "version"], properties: { path: pagePath, exists: { type: "boolean" }, version: { type: "integer", minimum: 0 }, type: { type: "string", maxLength: 40 }, title: { type: "string", maxLength: 300 } } },
|
|
1465
|
+
},
|
|
1466
|
+
path: pagePath,
|
|
1467
|
+
exists: { type: "boolean" },
|
|
1468
|
+
version: { type: "integer", minimum: 0 },
|
|
1469
|
+
approvalRequired: { type: "boolean" },
|
|
1470
|
+
},
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
/** A copy's answer: a page's source and target, or the memories it would take. */
|
|
1474
|
+
const copyPreviewOutput = {
|
|
1475
|
+
type: "object",
|
|
1476
|
+
additionalProperties: false,
|
|
1477
|
+
required: ["op", "from", "to"],
|
|
1478
|
+
properties: {
|
|
1479
|
+
ok: { type: "boolean" },
|
|
1480
|
+
op: { type: "string", enum: ["page", "memories"] },
|
|
1481
|
+
from: { type: "object" },
|
|
1482
|
+
to: { type: "object" },
|
|
1483
|
+
count: { type: "integer", minimum: 0 },
|
|
1484
|
+
ids: { type: "array", maxItems: 100, items: id },
|
|
1485
|
+
memories: { type: "array", maxItems: 50, items: { type: "object" } },
|
|
1486
|
+
missing: { type: "array", maxItems: 100, items: id },
|
|
1487
|
+
note: { type: "string", maxLength: 300 },
|
|
1488
|
+
},
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
/** What one organiser op would change: the op's own name, and the memories. */
|
|
1492
|
+
const organisePreviewOutput = {
|
|
1493
|
+
type: "object",
|
|
1494
|
+
additionalProperties: false,
|
|
1495
|
+
required: ["op", "label", "from"],
|
|
1496
|
+
properties: {
|
|
1497
|
+
ok: { type: "boolean" },
|
|
1498
|
+
op: { type: "string", enum: ["retire", "restore", "confirm"] },
|
|
1499
|
+
label: { type: "string", maxLength: 60 },
|
|
1500
|
+
count: { type: "integer", minimum: 0 },
|
|
1501
|
+
memories: {
|
|
1502
|
+
type: "array",
|
|
1503
|
+
maxItems: 50,
|
|
1504
|
+
items: { type: "object", additionalProperties: false, required: ["id", "title"], properties: { id, title: { type: "string", maxLength: 160 }, status: { type: "string", maxLength: 40 } } },
|
|
1505
|
+
},
|
|
1506
|
+
missing: { type: "array", maxItems: 100, items: id },
|
|
1507
|
+
from: { type: "object" },
|
|
1508
|
+
to: { type: "object" },
|
|
1509
|
+
},
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
/** What one space op would change: the op's own name, and the space. */
|
|
1513
|
+
const spaceManagePreviewOutput = {
|
|
1514
|
+
type: "object",
|
|
1515
|
+
additionalProperties: false,
|
|
1516
|
+
required: ["op", "label", "space"],
|
|
1517
|
+
properties: {
|
|
1518
|
+
ok: { type: "boolean" },
|
|
1519
|
+
op: { type: "string", enum: ["rename", "archive", "unarchive", "leave"] },
|
|
1520
|
+
label: { type: "string", maxLength: 60 },
|
|
1521
|
+
space: { type: "object", additionalProperties: false, required: ["id"], properties: { id, name: { type: "string", maxLength: 200 } } },
|
|
1522
|
+
to: { type: "string", maxLength: 120 },
|
|
1523
|
+
summary: { type: "string", maxLength: 300 },
|
|
1524
|
+
reversible: { type: "boolean" },
|
|
1525
|
+
expectedDigest: { type: "string", maxLength: 200 },
|
|
1526
|
+
},
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
const pageWritePreviewOutput = {
|
|
1530
|
+
type: "object",
|
|
1531
|
+
additionalProperties: false,
|
|
1532
|
+
required: ["space", "path", "exists", "version", "approvalRequired", "added", "removed"],
|
|
1533
|
+
properties: {
|
|
1534
|
+
space: { type: "string", maxLength: 200 },
|
|
1535
|
+
path: pagePath,
|
|
1536
|
+
/** Whether the page exists now: false is a create, at `expectVersion` 0. */
|
|
1537
|
+
exists: { type: "boolean" },
|
|
1538
|
+
/** Its version now, 0 when it does not exist. */
|
|
1539
|
+
version: { type: "integer", minimum: 0 },
|
|
1540
|
+
/** The version the action carries, where the page gave one; absent when it carries none. */
|
|
1541
|
+
expectVersion: { type: "integer", minimum: 0 },
|
|
1542
|
+
/** True for a team space: the person approves the change in Memory's own page, never here. */
|
|
1543
|
+
approvalRequired: { type: "boolean" },
|
|
1544
|
+
/** Lines the write would add, and remove, against the version it names. */
|
|
1545
|
+
added: { type: "integer", minimum: 0 },
|
|
1546
|
+
removed: { type: "integer", minimum: 0 },
|
|
1547
|
+
},
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
const joinRequestPreviewOutput = {
|
|
1551
|
+
type: "object",
|
|
1552
|
+
properties: {
|
|
1553
|
+
ok: { type: "boolean" },
|
|
1554
|
+
/** The request the person is deciding. */
|
|
1555
|
+
requestId: id,
|
|
1556
|
+
/** The space it is for. */
|
|
1557
|
+
space: { type: "object", properties: { id: { type: "string", maxLength: 200 }, name: { type: "string", maxLength: 400 } } },
|
|
1558
|
+
/** The person who asked; null when the request no longer names one. */
|
|
1559
|
+
user: { type: ["object", "null"], properties: { user_id: { type: "string", maxLength: 200 }, name: { type: "string", maxLength: 400 } } },
|
|
1560
|
+
/** The words they wrote with the request, if any. */
|
|
1561
|
+
note: { type: ["string", "null"], maxLength: 2000 },
|
|
1562
|
+
/** The read access the asker gains when it is approved. */
|
|
1563
|
+
gainAccess: { type: "array", maxItems: 100, items: { type: "object" } },
|
|
1564
|
+
loseAccess: { type: "array", maxItems: 100, items: { type: "object" } },
|
|
1565
|
+
affected: { type: "integer", minimum: 0 },
|
|
1566
|
+
},
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
const visibilityPreviewOutput = {
|
|
1570
|
+
type: "object",
|
|
1571
|
+
properties: {
|
|
1572
|
+
ok: { type: "boolean" },
|
|
1573
|
+
space: { type: "object", properties: { id: { type: "string", maxLength: 200 }, name: { type: "string", maxLength: 400 } } },
|
|
1574
|
+
/** Who may join now, and who could after the change. */
|
|
1575
|
+
from: { type: "string", enum: ["invite", "open"] },
|
|
1576
|
+
to: { type: "string", enum: ["invite", "open"] },
|
|
1577
|
+
/** How many people are in it now. */
|
|
1578
|
+
members: { type: "integer", minimum: 0 },
|
|
1579
|
+
/** The join requests that would become direct joins. */
|
|
1580
|
+
pendingRequests: { type: "integer", minimum: 0 },
|
|
1581
|
+
/** Who could then find or join it, in the person's words. */
|
|
1582
|
+
discoverable: line(400),
|
|
1583
|
+
unaffected: { type: "array", maxItems: 100, items: { type: "object" } },
|
|
1584
|
+
},
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
const proposalPreviewOutput = {
|
|
1588
|
+
type: "object",
|
|
1589
|
+
additionalProperties: false,
|
|
1590
|
+
required: ["found", "id", "version", "state", "kind", "space", "text"],
|
|
1591
|
+
properties: {
|
|
1592
|
+
/** False when the proposal is gone, or is not this person's to decide. */
|
|
1593
|
+
found: { type: "boolean" },
|
|
1594
|
+
id,
|
|
1595
|
+
version: { type: "integer", minimum: 0 },
|
|
1596
|
+
/** proposed, accepting, accepted, rejected, applied, applied_private or declined. */
|
|
1597
|
+
state: { type: "string", maxLength: 40 },
|
|
1598
|
+
/** The proposal's type: create, share, team_write and so on. */
|
|
1599
|
+
kind: { type: "string", maxLength: 40 },
|
|
1600
|
+
/** The shared space a held write would reach, where it names one. */
|
|
1601
|
+
space: { type: "string", maxLength: 200 },
|
|
1602
|
+
/** The record's title, on one line: what a confirm panel says ("Keep "<title>"?"), never its id (jelly #75). */
|
|
1603
|
+
title: line(120),
|
|
1604
|
+
/** The words a keep, an edit or a private keep would save. */
|
|
1605
|
+
text: line(4000),
|
|
1606
|
+
},
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
const erasePreviewOutput = {
|
|
1610
|
+
type: "object",
|
|
1611
|
+
additionalProperties: false,
|
|
1612
|
+
required: ["lines", "count", "snapshot"],
|
|
1613
|
+
properties: {
|
|
1614
|
+
lines: {
|
|
1615
|
+
type: "array",
|
|
1616
|
+
maxItems: 20,
|
|
1617
|
+
items: {
|
|
1618
|
+
type: "object",
|
|
1619
|
+
additionalProperties: false,
|
|
1620
|
+
required: ["id", "text", "space"],
|
|
1621
|
+
properties: { id, text: line(300), space: { type: "string", maxLength: 200 } },
|
|
1622
|
+
},
|
|
1623
|
+
},
|
|
1624
|
+
/** Every line the erase would remove, including the ones not shown. */
|
|
1625
|
+
count: { type: "integer", minimum: 0 },
|
|
1626
|
+
/** The digest the erase action carries; a profile that changed no longer has it. */
|
|
1627
|
+
snapshot: { type: "string", maxLength: 43 },
|
|
1628
|
+
/** True when the phrase is too short to erase by (under four characters). */
|
|
1629
|
+
tooShort: { type: "boolean" },
|
|
1630
|
+
/** What the erase does not do: the turns it came from stay, so it can come back. */
|
|
1631
|
+
note: { type: "string", maxLength: 300 },
|
|
1632
|
+
},
|
|
1633
|
+
}
|
|
1634
|
+
|
|
825
1635
|
/**
|
|
826
1636
|
* The methods, in the order `package.json` declares them.
|
|
827
1637
|
* @type {ReadonlyArray<{ name: string, label: string, permission: string, input: object, output: object }>}
|
|
828
1638
|
*/
|
|
829
1639
|
export const VIEW_METHODS = Object.freeze([
|
|
1640
|
+
{
|
|
1641
|
+
name: "memory.setup",
|
|
1642
|
+
label: "read how long Memory's own setup took at this engine start",
|
|
1643
|
+
permission: "mem_status",
|
|
1644
|
+
input: empty,
|
|
1645
|
+
output: setupOutput,
|
|
1646
|
+
},
|
|
830
1647
|
{
|
|
831
1648
|
name: "memory.overview",
|
|
832
1649
|
label: "say whether memory is connected and how much it holds",
|
|
@@ -864,6 +1681,34 @@ export const VIEW_METHODS = Object.freeze([
|
|
|
864
1681
|
input: commitmentsInput,
|
|
865
1682
|
output: commitmentsOutput,
|
|
866
1683
|
},
|
|
1684
|
+
{
|
|
1685
|
+
name: "meetings.list",
|
|
1686
|
+
label: "list your meeting pages",
|
|
1687
|
+
permission: "mem_page",
|
|
1688
|
+
input: viewInput({ ...spaceInput, cursor: line(CURSOR_CHARS) }),
|
|
1689
|
+
output: meetingsListOutput,
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
name: "meetings.read",
|
|
1693
|
+
label: "read a meeting page and its transcript",
|
|
1694
|
+
permission: "mem_page",
|
|
1695
|
+
input: viewInput({ ...spaceInput, id }, ["id"]),
|
|
1696
|
+
output: meetingReadOutput,
|
|
1697
|
+
},
|
|
1698
|
+
{
|
|
1699
|
+
name: "share.requests",
|
|
1700
|
+
label: "list the hand-over requests addressed to you",
|
|
1701
|
+
permission: "mem_share",
|
|
1702
|
+
input: viewInput(),
|
|
1703
|
+
output: shareRequestsOutput,
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
name: "projects.list",
|
|
1707
|
+
label: "list your project pages",
|
|
1708
|
+
permission: "mem_page",
|
|
1709
|
+
input: projectsInput,
|
|
1710
|
+
output: projectsOutput,
|
|
1711
|
+
},
|
|
867
1712
|
{
|
|
868
1713
|
name: "journal.list",
|
|
869
1714
|
label: "list your journal pages",
|
|
@@ -927,6 +1772,189 @@ export const VIEW_METHODS = Object.freeze([
|
|
|
927
1772
|
input: empty,
|
|
928
1773
|
output: profileReadOutput,
|
|
929
1774
|
},
|
|
1775
|
+
{
|
|
1776
|
+
name: "profile.erase.preview",
|
|
1777
|
+
label: "show the lines an erase from your profile would remove",
|
|
1778
|
+
permission: "mem_recall",
|
|
1779
|
+
input: viewInput({ phrase: line(200), snapshot: line(43) }, ["phrase"]),
|
|
1780
|
+
output: erasePreviewOutput,
|
|
1781
|
+
},
|
|
1782
|
+
{
|
|
1783
|
+
name: "page.write.preview",
|
|
1784
|
+
label: "show what a page write would change",
|
|
1785
|
+
permission: "mem_page",
|
|
1786
|
+
// The body stays under the 64 KiB a grant can carry (ADR §4.4), as the
|
|
1787
|
+
// action's own does.
|
|
1788
|
+
input: viewInput({ space: line(128), path: pagePath, body: line(58 * 1024), expectVersion: { type: "integer", minimum: 0 } }, ["space", "path"]),
|
|
1789
|
+
output: pageWritePreviewOutput,
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
name: "page.save.preview",
|
|
1793
|
+
label: "show what saving a page would write",
|
|
1794
|
+
permission: "mem_page",
|
|
1795
|
+
input: viewInput({ space: line(128), path: line(300), folder: line(200), title: line(300), body: withoutNote(pageBody), meeting: withoutNote(pageMeeting), transcript: withoutNote(pageTranscript), files: { type: "array", maxItems: 50, items: line(300) } }, ["body"]),
|
|
1796
|
+
output: pageFactsOutput,
|
|
1797
|
+
},
|
|
1798
|
+
{
|
|
1799
|
+
name: "page.move.preview",
|
|
1800
|
+
label: "show who gains and loses a moved page",
|
|
1801
|
+
permission: "mem_page",
|
|
1802
|
+
// One page, a folder or up to fifty pages: the preview takes the action's
|
|
1803
|
+
// own input, and answers every page a folder or a list would move.
|
|
1804
|
+
input: viewInput({
|
|
1805
|
+
space: line(128),
|
|
1806
|
+
path: line(300),
|
|
1807
|
+
prefix: line(300),
|
|
1808
|
+
paths: { type: "array", maxItems: 50, items: line(300) },
|
|
1809
|
+
to: { type: "object", additionalProperties: false, properties: { space: line(128), path: line(300), folder: line(200) } },
|
|
1810
|
+
}, ["space"]),
|
|
1811
|
+
output: movePreviewOutput,
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
name: "page.delete.preview",
|
|
1815
|
+
label: "show the page a delete would remove",
|
|
1816
|
+
permission: "mem_page",
|
|
1817
|
+
// Every page the press removes, never only the first.
|
|
1818
|
+
input: viewInput({ space: line(128), path: line(300), paths: { type: "array", maxItems: 50, items: line(300) } }, ["space"]),
|
|
1819
|
+
output: deletePreviewOutput,
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
name: "wiki.delete.preview",
|
|
1823
|
+
label: "show what deleting a wiki would remove",
|
|
1824
|
+
permission: "mem_wiki",
|
|
1825
|
+
input: viewInput({ space: line(128), wiki: id }, ["space", "wiki"]),
|
|
1826
|
+
output: accessPreviewOutput,
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
name: "share.copy.preview",
|
|
1830
|
+
label: "show what a copy would take, and where it would land",
|
|
1831
|
+
permission: "mem_page",
|
|
1832
|
+
// `op` picks the console's two copies: a page, or the person's own memories.
|
|
1833
|
+
// `to.wiki` sends a page's copy into a hub wiki, as one flat source file.
|
|
1834
|
+
input: viewInput({ op: { type: "string", enum: ["page", "memories"] }, from: { type: "object", additionalProperties: false, properties: { space: line(128), path: line(300) } }, to: { type: "object", additionalProperties: false, properties: { space: line(128), folder: line(200), path: line(300), wiki: line(128) } }, ids: { type: "array", maxItems: 100, items: id }, version: { type: "integer", minimum: 1 }, note: line(300) }, ["op"]),
|
|
1835
|
+
output: copyPreviewOutput,
|
|
1836
|
+
},
|
|
1837
|
+
{
|
|
1838
|
+
name: "commitment.delete.preview",
|
|
1839
|
+
label: "show the commitment a delete would remove",
|
|
1840
|
+
permission: "mem_commitments",
|
|
1841
|
+
input: viewInput({ id, space: line(128), what: line(300), revision: { type: "integer", minimum: 1 } }, ["id"]),
|
|
1842
|
+
output: commitmentPreviewOutput,
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
name: "commitment.move.preview",
|
|
1846
|
+
label: "show the commitment a move would take, and where it goes",
|
|
1847
|
+
permission: "mem_commitments",
|
|
1848
|
+
input: viewInput({ id, space: line(128), what: line(300), revision: { type: "integer", minimum: 1 }, to: { type: "object", additionalProperties: false, required: ["space"], properties: { space: line(128) } } }, ["space", "id", "to"]),
|
|
1849
|
+
output: commitmentPreviewOutput,
|
|
1850
|
+
},
|
|
1851
|
+
{
|
|
1852
|
+
name: "memory.organise.preview",
|
|
1853
|
+
label: "show which memories would move, retire, restore or be confirmed",
|
|
1854
|
+
permission: "mem_recall",
|
|
1855
|
+
// The preview names the op: moving memories and confirming them are not the
|
|
1856
|
+
// same press.
|
|
1857
|
+
input: viewInput({ space: line(128), op: { type: "string", enum: ["retire", "restore", "confirm"] }, ids: { type: "array", maxItems: 100, items: id } }, ["space", "op"]),
|
|
1858
|
+
output: organisePreviewOutput,
|
|
1859
|
+
},
|
|
1860
|
+
{
|
|
1861
|
+
name: "share.grant.preview",
|
|
1862
|
+
label: "show what sharing would give someone",
|
|
1863
|
+
permission: "mem_share",
|
|
1864
|
+
input: viewInput({ space: line(128), target: { type: "object" }, person: line(200), access: { type: "string", enum: ["read", "write"] } }, ["target", "person", "access"]),
|
|
1865
|
+
output: accessPreviewOutput,
|
|
1866
|
+
},
|
|
1867
|
+
{
|
|
1868
|
+
name: "share.revoke.preview",
|
|
1869
|
+
label: "show what taking access back would change",
|
|
1870
|
+
permission: "mem_share",
|
|
1871
|
+
input: viewInput({ space: line(128), target: { type: "object" }, person: line(200) }, ["target", "person"]),
|
|
1872
|
+
output: accessPreviewOutput,
|
|
1873
|
+
},
|
|
1874
|
+
{
|
|
1875
|
+
name: "share.transfer.preview",
|
|
1876
|
+
needsControlP2: true,
|
|
1877
|
+
label: "show who would own a space after a handover",
|
|
1878
|
+
permission: "mem_share",
|
|
1879
|
+
input: viewInput({ space: line(128), target: { type: "object" }, to: line(200) }, ["space", "to"]),
|
|
1880
|
+
output: accessPreviewOutput,
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
name: "space.manage.preview",
|
|
1884
|
+
needsControlP2: true,
|
|
1885
|
+
label: "show what renaming, archiving or leaving a space would change",
|
|
1886
|
+
permission: "mem_spaces",
|
|
1887
|
+
input: viewInput({ space: line(128), op: { type: "string", enum: ["rename", "archive", "unarchive", "leave"] }, name: line(120), expectedDigest: line(200) }, ["space", "op"]),
|
|
1888
|
+
output: spaceManagePreviewOutput,
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
name: "space.joinRequest.preview",
|
|
1892
|
+
label: "show who a join request would let in",
|
|
1893
|
+
permission: "mem_spaces",
|
|
1894
|
+
input: viewInput({ requestId: id, decision: { type: "string", enum: ["approve", "decline"] }, note: line(300) }, ["requestId"]),
|
|
1895
|
+
output: joinRequestPreviewOutput,
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
name: "space.visibility.preview",
|
|
1899
|
+
needsControlP2: true,
|
|
1900
|
+
label: "show who could find or join a space after a change",
|
|
1901
|
+
permission: "mem_spaces",
|
|
1902
|
+
input: viewInput({ space: line(128), visibility: { type: "string", enum: ["invite", "open"] } }, ["space", "visibility"]),
|
|
1903
|
+
output: visibilityPreviewOutput,
|
|
1904
|
+
},
|
|
1905
|
+
{
|
|
1906
|
+
name: "proposal.decide.preview",
|
|
1907
|
+
label: "show the edit a proposal decision would apply",
|
|
1908
|
+
permission: "mem_spaces",
|
|
1909
|
+
input: viewInput({ space: line(128), id, op: { type: "string", enum: ["accept", "askChanges", "reject"] }, edits: line(56 * 1024), note: line(2000) }, ["id", "op"]),
|
|
1910
|
+
output: proposalPreviewOutput,
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
name: "memory.revise.preview",
|
|
1914
|
+
label: "show the memory a confirm or correct would change",
|
|
1915
|
+
permission: "mem_recall",
|
|
1916
|
+
// An `add` has no record yet: the read answers `found: false`, which is what
|
|
1917
|
+
// the person's own confirmation needs to know.
|
|
1918
|
+
input: viewInput({ space: line(128), id, revision: { type: "integer", minimum: 1 }, action: { type: "string", enum: ["confirm", "correct", "add"] }, content: line(56 * 1024) }, ["space"]),
|
|
1919
|
+
output: memoryPreviewOutput,
|
|
1920
|
+
},
|
|
1921
|
+
{
|
|
1922
|
+
name: "inbox.decide.preview",
|
|
1923
|
+
label: "show the Inbox item a decision would settle",
|
|
1924
|
+
permission: "mem_spaces",
|
|
1925
|
+
input: viewInput({ itemId: line(200), decision: { type: "string", enum: ["accept", "private", "decline"] }, revision: { type: "integer", minimum: 1 } }, ["itemId", "decision", "revision"]),
|
|
1926
|
+
output: proposalPreviewOutput,
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
name: "review.decide.preview",
|
|
1930
|
+
label: "show the record a review decision would save",
|
|
1931
|
+
permission: "mem_spaces",
|
|
1932
|
+
input: viewInput({ id, op: { type: "string", enum: ["accept", "edit", "reject", "private", "decline"] }, revision: { type: "integer", minimum: 1 }, text: line(4000) }, ["id", "op"]),
|
|
1933
|
+
output: proposalPreviewOutput,
|
|
1934
|
+
},
|
|
1935
|
+
{
|
|
1936
|
+
name: "write.decide.preview",
|
|
1937
|
+
label: "show the held write an edit or a private keep acts on",
|
|
1938
|
+
permission: "mem_spaces",
|
|
1939
|
+
input: viewInput({ id, op: { type: "string", enum: ["edit", "private"] }, revision: { type: "integer", minimum: 1 }, text: line(4000) }, ["id", "op"]),
|
|
1940
|
+
output: proposalPreviewOutput,
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
name: "held.decide.preview",
|
|
1944
|
+
needsRoom: true,
|
|
1945
|
+
label: "show the held write an accept, edit or drop acts on",
|
|
1946
|
+
permission: "mem_spaces",
|
|
1947
|
+
input: viewInput({ id, op: { type: "string", enum: ["accept", "edit", "drop"] }, edits: line(4000), revision: { type: "integer", minimum: 1 } }, ["id", "op"]),
|
|
1948
|
+
output: proposalPreviewOutput,
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
name: "suggestion.dismiss.preview",
|
|
1952
|
+
needsRoom: true,
|
|
1953
|
+
label: "show the suggestion a dismissal would hide",
|
|
1954
|
+
permission: "mem_spaces",
|
|
1955
|
+
input: viewInput({ id, forever: { type: "boolean" }, revision: { type: "integer", minimum: 1 } }, ["id"]),
|
|
1956
|
+
output: proposalPreviewOutput,
|
|
1957
|
+
},
|
|
930
1958
|
{
|
|
931
1959
|
name: "terms.list",
|
|
932
1960
|
label: "list the people and names Memory knows",
|
|
@@ -934,21 +1962,52 @@ export const VIEW_METHODS = Object.freeze([
|
|
|
934
1962
|
input: termsInput,
|
|
935
1963
|
output: termsOutput,
|
|
936
1964
|
},
|
|
1965
|
+
{
|
|
1966
|
+
name: "names.known",
|
|
1967
|
+
label: "list the names Memory knows, for dictation",
|
|
1968
|
+
permission: "mem_page",
|
|
1969
|
+
input: empty,
|
|
1970
|
+
output: namesOutput,
|
|
1971
|
+
},
|
|
1972
|
+
// Who is in a space, and who one of its pages is shared with: the space page
|
|
1973
|
+
// and the share sheet read them here instead of asking the agent (ask 10).
|
|
1974
|
+
// Both answer as `mem_spaces` does (`members`, `access`), and control decides
|
|
1975
|
+
// every visibility rule: a member's roster, a page owner's or an admin's grants.
|
|
1976
|
+
{
|
|
1977
|
+
name: "members.list",
|
|
1978
|
+
label: "list a space's members",
|
|
1979
|
+
permission: "mem_spaces",
|
|
1980
|
+
input: membersInput,
|
|
1981
|
+
output: membersOutput,
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
name: "grants.list",
|
|
1985
|
+
label: "list who a page, folder or wiki is shared with",
|
|
1986
|
+
permission: "mem_spaces",
|
|
1987
|
+
input: grantsInput,
|
|
1988
|
+
output: grantsOutput,
|
|
1989
|
+
},
|
|
937
1990
|
])
|
|
938
1991
|
|
|
939
|
-
//
|
|
940
|
-
//
|
|
941
|
-
//
|
|
942
|
-
//
|
|
943
|
-
//
|
|
944
|
-
//
|
|
945
|
-
// to
|
|
946
|
-
//
|
|
1992
|
+
// The acts are declared in `jelly.actions` (#58 section A), not here: they are
|
|
1993
|
+
// what a person's own page changes as the person, under a host-signed grant
|
|
1994
|
+
// (docs/design/adr-verified-caller-grants.md). Snoozing an overdue commitment is
|
|
1995
|
+
// `commitment.snooze {id, due}` with a new due date, confirm never (Jelly's
|
|
1996
|
+
// answer on #48): the item clears by itself once the due day is in the future.
|
|
1997
|
+
// `src/actions.js` is their one source, and `test/actions.test.js` holds
|
|
1998
|
+
// `package.json` to it. No action is an RPC method: `act.<name>` is registered
|
|
1999
|
+
// with the engine alone, and Jelly's own fence refuses it to everything but the
|
|
2000
|
+
// host's call for a person.
|
|
947
2001
|
|
|
948
2002
|
/** The refusal a page can show in the plugin's own words (`call.error`). */
|
|
949
2003
|
export const VIEW_ERROR = "memory.refused"
|
|
950
2004
|
|
|
951
|
-
/**
|
|
2005
|
+
/**
|
|
2006
|
+
* `jelly.rpc` as package.json declares it: every read the views call, and the
|
|
2007
|
+
* previews of every action declared. With Jelly's protocol major 7 (48
|
|
2008
|
+
* actions) all actions are declared, so every preview is named here too; the
|
|
2009
|
+
* `needsControlP2`/`needsRoom` markers stay on the methods as history.
|
|
2010
|
+
*/
|
|
952
2011
|
export function declaredMethods() {
|
|
953
2012
|
return VIEW_METHODS.map(({ name, label, permission, input, output }) => ({
|
|
954
2013
|
name,
|