@milesroxas/design-hub 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/README.md +13 -11
  2. package/core/controls.test.ts +176 -0
  3. package/core/controls.ts +195 -0
  4. package/core/files.test.ts +76 -0
  5. package/core/files.ts +131 -0
  6. package/core/prototype.test.ts +124 -7
  7. package/core/prototype.ts +133 -24
  8. package/core/review/model.ts +144 -2
  9. package/core/review/policy.test.ts +79 -22
  10. package/core/review/policy.ts +36 -8
  11. package/core/review/service.test.ts +1525 -322
  12. package/core/review/service.ts +810 -183
  13. package/core/review/store.test.ts +91 -0
  14. package/core/review/store.ts +143 -26
  15. package/dist/core/controls.d.ts +55 -0
  16. package/dist/core/controls.js +174 -0
  17. package/dist/core/files.d.ts +39 -0
  18. package/dist/core/files.js +107 -0
  19. package/dist/core/prototype.d.ts +61 -12
  20. package/dist/core/prototype.js +105 -26
  21. package/dist/core/review/model.d.ts +87 -2
  22. package/dist/core/review/model.js +97 -1
  23. package/dist/core/review/policy.d.ts +11 -4
  24. package/dist/core/review/policy.js +14 -2
  25. package/dist/core/review/service.d.ts +222 -43
  26. package/dist/core/review/service.js +727 -182
  27. package/dist/core/review/store.d.ts +84 -24
  28. package/dist/core/review/store.js +66 -26
  29. package/dist/scripts/bootstrap.d.ts +4 -34
  30. package/dist/scripts/bootstrap.js +9 -244
  31. package/dist/scripts/cli.js +6 -0
  32. package/dist/scripts/client.d.ts +45 -0
  33. package/dist/scripts/client.js +320 -0
  34. package/dist/scripts/commands.js +6 -0
  35. package/dist/scripts/comments.d.ts +8 -26
  36. package/dist/scripts/comments.js +27 -14
  37. package/dist/scripts/guard.d.ts +11 -0
  38. package/dist/scripts/guard.js +44 -0
  39. package/dist/scripts/lib/builds.d.ts +40 -0
  40. package/dist/scripts/lib/builds.js +198 -0
  41. package/dist/scripts/lib/cli.js +3 -1
  42. package/dist/scripts/lib/deploy.d.ts +6 -90
  43. package/dist/scripts/lib/deploy.js +24 -137
  44. package/dist/scripts/lib/dns.d.ts +49 -0
  45. package/dist/scripts/lib/dns.js +141 -0
  46. package/dist/scripts/lib/fake-host.d.ts +168 -0
  47. package/dist/scripts/lib/fake-host.js +244 -0
  48. package/dist/scripts/lib/host.d.ts +87 -0
  49. package/dist/scripts/lib/host.js +362 -0
  50. package/dist/scripts/lib/linked.d.ts +51 -0
  51. package/dist/scripts/lib/linked.js +124 -0
  52. package/dist/scripts/lib/names.d.ts +35 -0
  53. package/dist/scripts/lib/names.js +77 -0
  54. package/dist/scripts/lib/review.d.ts +23 -2
  55. package/dist/scripts/lib/review.js +32 -15
  56. package/dist/scripts/lib/rules.d.ts +1 -0
  57. package/dist/scripts/lib/rules.js +1 -0
  58. package/dist/scripts/lib/studio-deps.d.ts +35 -0
  59. package/dist/scripts/lib/studio-deps.js +79 -0
  60. package/dist/scripts/lib/studios.d.ts +70 -0
  61. package/dist/scripts/lib/studios.js +187 -0
  62. package/dist/scripts/lib/update.d.ts +33 -0
  63. package/dist/scripts/lib/update.js +40 -0
  64. package/dist/scripts/lib/vercel.d.ts +1 -23
  65. package/dist/scripts/lib/vercel.js +6 -81
  66. package/dist/scripts/people.d.ts +7 -11
  67. package/dist/scripts/people.js +51 -46
  68. package/dist/scripts/preflight.d.ts +8 -1
  69. package/dist/scripts/preflight.js +36 -19
  70. package/dist/scripts/project.d.ts +86 -0
  71. package/dist/scripts/project.js +141 -0
  72. package/dist/scripts/share.d.ts +105 -30
  73. package/dist/scripts/share.js +82 -154
  74. package/dist/scripts/skills.d.ts +18 -2
  75. package/dist/scripts/skills.js +22 -3
  76. package/dist/scripts/studio.d.ts +75 -0
  77. package/dist/scripts/studio.js +401 -0
  78. package/dist/scripts/upgrade.d.ts +10 -2
  79. package/dist/scripts/upgrade.js +44 -14
  80. package/dist/server/api.d.ts +22 -11
  81. package/dist/server/api.js +125 -44
  82. package/dist/server/blob.d.ts +10 -0
  83. package/dist/server/blob.js +53 -0
  84. package/dist/server/checks.js +2 -2
  85. package/dist/server/dev.js +4 -4
  86. package/dist/server/env.d.ts +2 -0
  87. package/dist/server/env.js +9 -0
  88. package/dist/server/fake-upstash.js +52 -3
  89. package/dist/server/hosts.d.ts +11 -0
  90. package/dist/server/hosts.js +31 -0
  91. package/dist/server/local.d.ts +7 -1
  92. package/dist/server/local.js +10 -1
  93. package/dist/server/mark.d.ts +41 -0
  94. package/dist/server/mark.js +111 -0
  95. package/dist/server/session.d.ts +17 -9
  96. package/dist/server/session.js +22 -45
  97. package/dist/server/upstash.js +20 -0
  98. package/dist/vercel/files.d.ts +11 -0
  99. package/dist/vercel/files.js +68 -0
  100. package/dist/vercel/index.d.ts +4 -3
  101. package/dist/vercel/index.js +12 -8
  102. package/dist/vercel/proxy.d.ts +69 -4
  103. package/dist/vercel/proxy.js +171 -107
  104. package/dist/vite/plugin.d.ts +24 -1
  105. package/dist/vite/plugin.js +46 -2
  106. package/kit/Artboard.tsx +21 -8
  107. package/kit/Space.tsx +4 -3
  108. package/kit/Variants.tsx +193 -65
  109. package/kit/ViewTools.tsx +77 -11
  110. package/kit/audience.ts +85 -0
  111. package/kit/dials.css +59 -0
  112. package/kit/dials.tsx +272 -35
  113. package/kit/harness.css +34 -0
  114. package/kit/prefs.ts +23 -1
  115. package/package.json +3 -2
  116. package/shell/ClientViewNote.tsx +31 -3
  117. package/shell/Guide.tsx +11 -5
  118. package/shell/Index.tsx +32 -10
  119. package/shell/Notice.tsx +1 -1
  120. package/shell/controls.ts +26 -0
  121. package/shell/hub.ts +5 -1
  122. package/shell/main.tsx +33 -6
  123. package/shell/review/Review.tsx +2 -2
  124. package/shell/review/ThreadCard.tsx +5 -5
  125. package/shell/review/client.ts +28 -11
  126. package/shell/review/view.test.ts +19 -0
  127. package/shell/review/view.ts +25 -0
  128. package/shell/shell.css +8 -0
  129. package/shell/studio/ClientHub.tsx +98 -0
  130. package/shell/studio/hub.css +48 -0
  131. package/shell/studio/index.html +14 -0
  132. package/shell/studio/main.tsx +17 -0
  133. package/skills/miles-brand/SKILL.md +11 -1
  134. package/skills/miles-deploy/SKILL.md +121 -64
  135. package/skills/miles-design-hub/SKILL.md +11 -9
  136. package/skills/miles-prototype/SKILL.md +34 -1
  137. package/skills/miles-review/SKILL.md +5 -7
  138. package/skills/miles-worktrees/SKILL.md +3 -3
  139. package/templates/conductor/settings.toml +1 -1
  140. package/templates/studio/.env.example +9 -0
  141. package/templates/studio/.vercelignore +5 -0
  142. package/templates/studio/README.md +84 -0
  143. package/templates/studio/_gitignore +7 -0
  144. package/templates/studio/api/files.ts +4 -0
  145. package/templates/studio/api/review.ts +4 -0
  146. package/templates/studio/build.mjs +4 -0
  147. package/templates/studio/package.json +16 -0
  148. package/templates/studio/proxy.ts +4 -0
  149. package/templates/studio/studio.json +9 -0
  150. package/templates/studio/vercel.json +27 -0
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Whether an op in `scope` is the actor's at all: Studio works in every
3
+ * client, a Client only in their own. A person whose kind and client
4
+ * disagree (Studio with a client, a Client with none) is in no scope, and
5
+ * so is every op on a scope that names no client: it fails closed here.
6
+ */
7
+ export function inScope(actor, scope) {
8
+ if (typeof scope.client !== 'string' || scope.client === '')
9
+ return false;
10
+ return actor.kind === 'studio' ? actor.client === null : actor.client === scope.client;
11
+ }
1
12
  /** Whether a comment reaches a Client. Only the exact value counts, so a record without one stays inside. */
2
13
  const clientFacing = (c) => c.audience === 'client';
3
14
  /**
@@ -5,8 +16,8 @@ const clientFacing = (c) => c.audience === 'client';
5
16
  * reply (edit or delete one); without `subject`, the root is the subject.
6
17
  * Without a root, the action is on no thread: listing, or a new thread.
7
18
  */
8
- export function can(actor, action, root, subject) {
9
- if (!actor || actor.revokedAt)
19
+ export function can(actor, scope, action, root, subject) {
20
+ if (!actor || actor.revokedAt || !inScope(actor, scope))
10
21
  return false;
11
22
  const studio = actor.kind === 'studio';
12
23
  if (!studio && [root, subject].some((c) => c && !clientFacing(c)))
@@ -24,6 +35,7 @@ export function can(actor, action, root, subject) {
24
35
  case 'triage':
25
36
  case 'people':
26
37
  case 'audience':
38
+ case 'setup':
27
39
  return studio;
28
40
  }
29
41
  }
@@ -1,4 +1,5 @@
1
- import { type Access, type Audience, type Comment, type Person, type PersonKind, type Triage } from './model.ts';
1
+ import { type ControlKind, type Marks } from '../controls.ts';
2
+ import { type Access, type Audience, type Client, type Comment, type Person, type PersonKind, type Project, type Scope, type Triage } from './model.ts';
2
3
  import { type KV } from './store.ts';
3
4
  export type ErrorCode = 'unauthorized' | 'forbidden' | 'not_found' | 'invalid';
4
5
  export declare class ReviewError extends Error {
@@ -19,80 +20,227 @@ export type Deps = {
19
20
  random: (bytes: number) => Uint8Array;
20
21
  triage: Triager | null;
21
22
  };
23
+ /**
24
+ * How long a slug or host stays out of reach after its client is archived:
25
+ * twice the time a studio site's instance keeps a host's answer. An instance
26
+ * that cached the archived client's record keeps accepting that client's
27
+ * fresh tokens until its answer runs out; if the slug came back sooner, it
28
+ * would show them the new client's projects.
29
+ */
30
+ export declare const REUSE_SECONDS: number;
31
+ /** A started build of a project: the order it was started in, and whether the project ever pointed at it. */
32
+ type BuildEntry = {
33
+ n: number;
34
+ live: boolean;
35
+ };
36
+ export type Build = BuildEntry & {
37
+ build: string;
38
+ };
39
+ /** What an archive answers: the archived record, and whether its host is the client's own to take off the site. */
40
+ export type Archived = {
41
+ client: Client;
42
+ ownHost: boolean;
43
+ };
44
+ export declare const NO_PROJECT = "No such project.";
45
+ /** A person and a new one-time link's token for them. */
46
+ type Issued = {
47
+ person: Person;
48
+ token: string;
49
+ };
22
50
  export declare function createReview(kv: KV, overrides?: Partial<Deps>): {
23
- person: (id: string) => Promise<Person | null>;
24
- /** The person a signed session names, if they still may sign in with it. */
25
- sessionPerson(id: string, epoch: number): Promise<Person | null>;
26
- listPeople(actor: Person | null): Promise<Person[]>;
27
- /** A new person and their first link. Without an access length, a Client gets the project default and Studio is open-ended. */
28
- addPerson(actor: Person | null, input: unknown): Promise<{
29
- person: Person;
30
- token: string;
51
+ person: (scope: Scope, id: string) => Promise<Person | null>;
52
+ /**
53
+ * The client a host serves, asked by the gate and the studio's functions
54
+ * with no actor: null for a host no client has, an archived client, or
55
+ * records that disagree, so an unknown host is never a scope.
56
+ */
57
+ clientOfHost(host: string): Promise<Client | null>;
58
+ /** One project of the scope's client, asked with no actor: null when the client has none by that name. */
59
+ projectOf: ({ client, project }: Scope) => Promise<Project | null>;
60
+ /** Every project of the scope's client that has a build to open, by name. */
61
+ listProjects(scope: Scope, actor: Person | null): Promise<Project[]>;
62
+ /**
63
+ * A new client and its host. Studio only. The slug and the host are each
64
+ * claimed (`claims` in store.ts), so of two adds at once only one gets
65
+ * either, and a slug or a host already taken is refused. The record goes
66
+ * in between the two claims, so a host's claim is only ever held while a
67
+ * record names the host: an add that stops part way leaves a record that
68
+ * `archiveClient` and `forgetClient` find, and so free. A slug or host
69
+ * archived less than REUSE_SECONDS ago is refused, with how long to wait.
70
+ * Once the slug is claimed, everything stored under the slug's prefix is
71
+ * removed before the record goes in, so the client starts clean whatever
72
+ * was written under the slug before, and whether or not a record named it.
73
+ */
74
+ addClient(actor: Person | null, input: unknown): Promise<Client>;
75
+ /**
76
+ * How many seconds until this slug and host may be added again: 0 when
77
+ * neither was archived in the last REUSE_SECONDS. `client add` asks
78
+ * before it changes any DNS or domain. Studio only.
79
+ */
80
+ clientWait(actor: Person | null, input: {
81
+ slug: string;
82
+ host: string;
83
+ }): Promise<number>;
84
+ /**
85
+ * A new host proof for the scope's client, in place of any before it:
86
+ * `ask` goes to the client's host and `answer` must come back, which only
87
+ * the gate with this store can give (PROOF_PATH). The store keeps the ask
88
+ * as its hash, so a leaked store answers nothing. Studio only.
89
+ */
90
+ startProof(scope: Scope, actor: Person | null): Promise<{
91
+ ask: string;
92
+ answer: string;
31
93
  }>;
32
- /** Another one-time link, for another device. Their sessions and other unused links stay. */
33
- newLink(actor: Person | null, id: string): Promise<{
34
- person: Person;
35
- token: string;
94
+ /**
95
+ * Ends the scope's client's host proof, once its host has answered it,
96
+ * and marks the client proven: it has finished being added (isAdded).
97
+ * The mark goes on first, so a run stopped between the two leaves a
98
+ * proven client with a stale proof, which answers nothing anyone holds.
99
+ * Studio only.
100
+ */
101
+ endProof(scope: Scope, actor: Person | null): Promise<Client>;
102
+ /** The answer to a host proof's ask in the scope's client, asked by the gate with no actor: null for any other ask. */
103
+ proofAnswer(scope: Scope, ask: string): Promise<string | null>;
104
+ /** The scope's client record. Studio only. */
105
+ clientRecord(scope: Scope, actor: Person | null): Promise<Client>;
106
+ /** Sets how long the scope's client's new people keep access by default; null leaves it to the studio's. Studio only. */
107
+ setClientAccess(scope: Scope, actor: Person | null, access: unknown): Promise<Client>;
108
+ /**
109
+ * Archives the scope's client, the first of two steps: its record is
110
+ * marked archived, so its host stops serving at once (clientOfHost), then
111
+ * its host entry, then everything under its prefix (people, links,
112
+ * projects, each project's records, and any key no record names). The record stays, naming the host, until
113
+ * forgetClient, so `client archive` stopped part way and run again still
114
+ * knows the host to take off the site. Answers the record, and whether
115
+ * the host is the client's own to take off: not when another client
116
+ * serves it or a live client's record names it. null when there is no
117
+ * record. Safe to run again. The client's files are the caller's to
118
+ * remove (the files port). Studio only.
119
+ */
120
+ archiveClient(scope: Scope, actor: Person | null): Promise<Archived | null>;
121
+ /**
122
+ * The second step, once the caller has removed the client's files, DNS
123
+ * record and domain: its keys once more (anything written meanwhile),
124
+ * then the time on its slug and host (`held`), then the host's claim
125
+ * unless another client holds it, then its record, then the slug's claim.
126
+ * With no record, it frees the slug alone: an add that stopped before its
127
+ * record held no host. Refused while the client is not archived. Studio only.
128
+ */
129
+ forgetClient(scope: Scope, actor: Person | null): Promise<void>;
130
+ /** A new project of the scope's client, with no build yet. Studio only. */
131
+ addProject(scope: Scope, actor: Person | null, input: unknown): Promise<Project>;
132
+ /**
133
+ * Starts a build of the scope's project, before any of its files go up:
134
+ * it takes the next number in the project's own order of builds, from
135
+ * the store, never a clock. Only a started build can go live, and setBuild
136
+ * refuses one while a build started after it is live. A build started for
137
+ * a project that was archived and made again was started for none of
138
+ * the new one's. Studio only.
139
+ */
140
+ startBuild(scope: Scope, actor: Person | null, build: unknown): Promise<void>;
141
+ /**
142
+ * Points the scope's project at a build. The caller has checked that
143
+ * every file of it is in the file store. Refused for a build never
144
+ * started for this project, or one started before the build the pointer
145
+ * names when this call reads it: a share overtaken by a newer one does
146
+ * not take the project back, which is what lets pruning remove the
147
+ * builds before the live one. The check reads and then writes, with no
148
+ * lock, so of two calls for one project within the same few store calls
149
+ * both can pass and the older build's write can land last; and a build
150
+ * pruned meanwhile, not yet marked live, is still pointed at, with no
151
+ * files. The next share's call puts either right. The build is marked
152
+ * live before the pointer moves. Studio only.
153
+ */
154
+ setBuild(scope: Scope, actor: Person | null, build: unknown): Promise<Project>;
155
+ /** The scope's project's live build and every build started for it, in the order they were started. Studio only. */
156
+ buildsOf(scope: Scope, actor: Person | null): Promise<{
157
+ live: string | null;
158
+ builds: Build[];
36
159
  }>;
160
+ /** Forgets builds of the scope's project, once their files are gone; never the live one. Studio only. */
161
+ forgetBuilds(scope: Scope, actor: Person | null, builds: string[]): Promise<void>;
162
+ /** The person a signed session names, if they still may sign in with it, here. */
163
+ sessionPerson(scope: Scope, id: string, epoch: number): Promise<Person | null>;
164
+ /** The scope's Clients and every Studio person. */
165
+ listPeople(scope: Scope, actor: Person | null): Promise<Person[]>;
166
+ /**
167
+ * A new person and their first link: a Client of the scope's client, or a
168
+ * Studio person. Without an access length, a Client gets the default and
169
+ * Studio is open-ended.
170
+ */
171
+ addPerson(scope: Scope, actor: Person | null, input: unknown): Promise<Issued>;
172
+ /** Another one-time link, for another device. Their sessions and other unused links stay. */
173
+ newLink(scope: Scope, actor: Person | null, id: string): Promise<Issued>;
37
174
  /** Ends every session they hold and every unused link, and gives one new link. */
38
- signOutEverywhere(actor: Person | null, id: string): Promise<{
39
- person: Person;
40
- token: string;
41
- }>;
42
- revoke(actor: Person | null, id: string): Promise<Person>;
175
+ signOutEverywhere(scope: Scope, actor: Person | null, id: string): Promise<Issued>;
176
+ revoke(scope: Scope, actor: Person | null, id: string): Promise<Person>;
43
177
  /** Sets one person's access length, counted from now. Their sessions follow at the gate's next check, within five minutes. */
44
- setAccess(actor: Person | null, id: string, access: unknown): Promise<Person>;
45
- /** How long a new Client keeps access unless Studio says otherwise. */
46
- defaultAccess(actor: Person | null): Promise<Access>;
47
- setDefaultAccess(actor: Person | null, access: unknown): Promise<Access>;
48
- /** Who a link signs in, without using it: mail and chat previews open links too. */
49
- peekLink(token: string): Promise<Person | null>;
178
+ setAccess(scope: Scope, actor: Person | null, id: string, access: unknown): Promise<Person>;
179
+ /** How long a new Client of the scope's client keeps access unless Studio says otherwise: the client's default, else the studio's. */
180
+ defaultAccess(scope: Scope, actor: Person | null): Promise<Access>;
181
+ /**
182
+ * Sets what defaultAccess reads for the scope: the client's own default
183
+ * on a studio site's client host, the studio's in the local store, whose
184
+ * client has no record. Never the studio's for a client whose record is
185
+ * gone. Studio only.
186
+ */
187
+ setDefaultAccess(scope: Scope, actor: Person | null, access: unknown): Promise<Access>;
188
+ /** A new Studio person, who works in every client. No link: each comes from newStudioLink, for one host. Studio only. */
189
+ addStudioPerson(actor: Person | null, input: unknown): Promise<Person>;
190
+ /** Another one-time link for a Studio person: it signs in one device, on whichever client host it is opened. Studio only. */
191
+ newStudioLink(actor: Person | null, id: string): Promise<Issued>;
192
+ /** The studio's default access length, what a client without its own gives. Studio only. */
193
+ studioAccess(actor: Person | null): Promise<Access>;
194
+ setStudioAccess(actor: Person | null, access: unknown): Promise<Access>;
195
+ /** Who a link signs in here, without using it: mail and chat previews open links too. */
196
+ peekLink(scope: Scope, token: string): Promise<Person | null>;
50
197
  /**
51
198
  * Uses a link up and returns who it signs in. The delete is the claim: of
52
199
  * two requests with one token, only the one whose delete removed the link
53
200
  * gets a person, so a link signs in one device at most. Who it signs in is
54
- * read and checked first, so the delete is the last store call.
201
+ * read and checked first, so the delete is the last store call. Only a
202
+ * link of the scope's client, or a Studio person's, is found at all.
55
203
  */
56
- useLink(token: string): Promise<Person | null>;
204
+ useLink(scope: Scope, token: string): Promise<Person | null>;
57
205
  /**
58
206
  * A prototype's comments as the actor's view sees them. `viewAs: 'client'`
59
207
  * is Studio's Client view; it never widens a Client's.
60
208
  */
61
- listComments(actor: Person | null, prototype: string, viewAs?: unknown): Promise<Comment[]>;
62
- /** Every comment on every prototype the actor may see, for the CLI (which acts as Studio). */
63
- allComments(actor: Person | null): Promise<Comment[]>;
209
+ listComments(scope: Scope, actor: Person | null, prototype: string, viewAs?: unknown): Promise<Comment[]>;
210
+ /** Every comment on every prototype of the scope's project the actor may see, for the CLI (which acts as Studio). */
211
+ allComments(scope: Scope, actor: Person | null): Promise<Comment[]>;
64
212
  /**
65
213
  * A new thread. A Client's is client-facing whatever the input says;
66
214
  * Studio's is internal unless `audience` is 'client'. Its number is the
67
215
  * next of its audience on the prototype, never one used before.
68
216
  */
69
- add(actor: Person | null, input: {
217
+ add(scope: Scope, actor: Person | null, input: {
70
218
  body?: unknown;
71
219
  anchor?: unknown;
72
220
  states?: unknown;
73
221
  audience?: unknown;
74
222
  }): Promise<Comment>;
75
- reply(actor: Person | null, input: {
223
+ reply(scope: Scope, actor: Person | null, input: {
76
224
  prototype: string;
77
225
  thread: string;
78
226
  body?: unknown;
79
227
  }): Promise<Comment>;
80
- edit(actor: Person | null, input: {
228
+ edit(scope: Scope, actor: Person | null, input: {
81
229
  prototype: string;
82
230
  id: string;
83
231
  body?: unknown;
84
232
  }): Promise<Comment>;
85
233
  /** Deletes a comment; deleting a thread's root deletes its replies with it. */
86
- remove(actor: Person | null, input: {
234
+ remove(scope: Scope, actor: Person | null, input: {
87
235
  prototype: string;
88
236
  id: string;
89
237
  }): Promise<string[]>;
90
- resolve(actor: Person | null, input: {
238
+ resolve(scope: Scope, actor: Person | null, input: {
91
239
  prototype: string;
92
240
  id: string;
93
241
  resolved: boolean;
94
242
  }): Promise<Comment>;
95
- retriage(actor: Person | null, input: {
243
+ retriage(scope: Scope, actor: Person | null, input: {
96
244
  prototype: string;
97
245
  id: string;
98
246
  triage?: unknown;
@@ -103,27 +251,58 @@ export declare function createReview(kv: KV, overrides?: Partial<Deps>): {
103
251
  * stored, so internal deletes the field and a prototype nobody marked is
104
252
  * internal. Studio only.
105
253
  */
106
- setAudience(actor: Person | null, prototype: unknown, audience: unknown): Promise<Audience>;
254
+ setAudience(scope: Scope, actor: Person | null, prototype: unknown, audience: unknown): Promise<Audience>;
107
255
  /**
108
- * Who a prototype is for, asked by the gate with no actor. Absent, or any
109
- * value but `client`, is internal; a name that cannot be a prototype is
110
- * internal without asking the store.
256
+ * What Studio marked on a prototype's dials and variants, with the view
257
+ * the actor gets. A Client reads the marks too: their page needs a dial
258
+ * Studio switched back to internal as much as one it shared, and the
259
+ * names are in the prototype's own code already. An internal prototype
260
+ * has none for a Client, as it has no comments.
111
261
  */
112
- audienceOf(prototype: string): Promise<Audience>;
262
+ controlsOf(scope: Scope, actor: Person | null, prototype: unknown): Promise<{
263
+ view: PersonKind;
264
+ } & Marks>;
265
+ /**
266
+ * Marks one dial or one variant client-facing or internal. A dial's mark
267
+ * is stored either way, because it overrules what the code says; a
268
+ * variant's internal is the field's absence. Studio only. The server
269
+ * keeps no list of a prototype's controls, so any well-formed id is taken.
270
+ */
271
+ setControl(scope: Scope, actor: Person | null, input: {
272
+ prototype: unknown;
273
+ kind: unknown;
274
+ id: unknown;
275
+ audience: unknown;
276
+ }): Promise<{
277
+ kind: ControlKind;
278
+ id: string;
279
+ audience: Audience;
280
+ }>;
281
+ /**
282
+ * Who a prototype of the scope's project is for, asked by the gate with no
283
+ * actor. Absent, or any value but `client`, is internal; a name that
284
+ * cannot be a prototype is internal without asking the store.
285
+ */
286
+ audienceOf(scope: Scope, prototype: string): Promise<Audience>;
113
287
  /**
114
288
  * What the index is built from: the view the actor gets (Client view for
115
289
  * Studio with `viewAs: 'client'`) and every client-facing slug. The
116
290
  * server keeps no list of internal ones: Studio's view reads the build's
117
291
  * own list, which the gate refuses to a Client.
118
292
  */
119
- visiblePrototypes(actor: Person | null, viewAs?: unknown): Promise<{
293
+ visiblePrototypes(scope: Scope, actor: Person | null, viewAs?: unknown): Promise<{
120
294
  view: PersonKind;
121
295
  clientFacing: string[];
122
296
  }>;
123
- /** Where a comment lives, for the CLI, which has an id and no prototype; null when the actor may not see it. */
124
- locate(actor: Person | null, id: string): Promise<{
297
+ /**
298
+ * Where a comment lives, for the CLI, which has an id and no prototype;
299
+ * null when the actor may not see it, and outside the actor's scope or in
300
+ * a client that is not live, as for an id that is not there.
301
+ */
302
+ locate(scope: Scope, actor: Person | null, id: string): Promise<{
125
303
  prototype: string;
126
304
  comment: Comment;
127
305
  } | null>;
128
306
  };
129
307
  export type Review = ReturnType<typeof createReview>;
308
+ export {};