@fungi.computer/puffball 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +443 -2
- package/dist/app-api.d.ts +7 -0
- package/dist/app-api.js +61 -0
- package/dist/app-backend-binding-vocabulary.d.ts +299 -0
- package/dist/app-backend-binding-vocabulary.js +257 -0
- package/dist/app-backend-bindings.d.ts +21 -0
- package/dist/app-backend-bindings.js +47 -0
- package/dist/app-declaration.d.ts +46 -0
- package/dist/app-declaration.js +115 -0
- package/dist/app-event-facts.d.ts +40 -0
- package/dist/app-event-facts.js +28 -0
- package/dist/app-method-context.d.ts +109 -0
- package/dist/app-method-context.js +9 -0
- package/dist/app-method-runtime.d.ts +86 -0
- package/dist/app-method-runtime.js +122 -0
- package/dist/app-origin-paths.d.ts +6 -0
- package/dist/app-origin-paths.js +6 -0
- package/dist/app-vocabulary.d.ts +189 -0
- package/dist/app-vocabulary.js +103 -0
- package/dist/app.d.ts +379 -0
- package/dist/app.js +71 -0
- package/dist/artifact-dispositions.d.ts +115 -0
- package/dist/artifact-dispositions.js +234 -0
- package/dist/assets.d.ts +54 -0
- package/dist/assets.js +89 -0
- package/dist/backend.d.ts +41 -0
- package/dist/backend.js +29 -0
- package/dist/background-replay.d.ts +115 -0
- package/dist/background-replay.js +175 -0
- package/dist/buyer-references.d.ts +69 -0
- package/dist/buyer-references.js +154 -0
- package/dist/cloudflare-assets.d.ts +48 -0
- package/dist/cloudflare-assets.js +105 -0
- package/dist/cloudflare.d.ts +254 -0
- package/dist/cloudflare.js +1619 -0
- package/dist/effect.d.ts +73 -0
- package/dist/effect.js +325 -0
- package/dist/git-representation.d.ts +13 -0
- package/dist/git-representation.js +16 -0
- package/dist/inbox.d.ts +132 -0
- package/dist/inbox.js +81 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +85 -0
- package/dist/internal/app-description.d.ts +14 -0
- package/dist/internal/app-description.js +98 -0
- package/dist/internal/app-release-artifact-reader.d.ts +26 -0
- package/dist/internal/app-release-artifact-reader.js +1 -0
- package/dist/internal/app-release-contract.d.ts +540 -0
- package/dist/internal/app-release-contract.js +169 -0
- package/dist/internal/app-release-schema.d.ts +1676 -0
- package/dist/internal/app-release-schema.js +386 -0
- package/dist/internal/app-release-store.d.ts +47 -0
- package/dist/internal/app-release-store.js +1 -0
- package/dist/internal/background-sync.d.ts +7 -0
- package/dist/internal/background-sync.js +10 -0
- package/dist/internal/deterministic-memory-app-release-store.d.ts +14 -0
- package/dist/internal/deterministic-memory-app-release-store.js +319 -0
- package/dist/internal/failure.d.ts +2 -0
- package/dist/internal/failure.js +9 -0
- package/dist/internal/immutable-release-material.d.ts +3 -0
- package/dist/internal/immutable-release-material.js +13 -0
- package/dist/internal/promise-app-release-store-adapter.d.ts +9 -0
- package/dist/internal/promise-app-release-store-adapter.js +65 -0
- package/dist/internal/promise-artifact-reader-adapter.d.ts +9 -0
- package/dist/internal/promise-artifact-reader-adapter.js +18 -0
- package/dist/internal/public-route-sql.d.ts +10 -0
- package/dist/internal/public-route-sql.js +239 -0
- package/dist/internal/public-website-authority.d.ts +338 -0
- package/dist/internal/public-website-authority.js +50 -0
- package/dist/internal/public-website-delivery.d.ts +59 -0
- package/dist/internal/public-website-delivery.js +232 -0
- package/dist/internal/public-website-fetch.d.ts +8 -0
- package/dist/internal/public-website-fetch.js +54 -0
- package/dist/internal/release-transition-material.d.ts +3 -0
- package/dist/internal/release-transition-material.js +11 -0
- package/dist/internal/verified-artifact-snapshot.d.ts +41 -0
- package/dist/internal/verified-artifact-snapshot.js +91 -0
- package/dist/public-route-moderation.d.ts +83 -0
- package/dist/public-route-moderation.js +236 -0
- package/dist/public-route-policy.d.ts +51 -0
- package/dist/public-route-policy.js +88 -0
- package/dist/public-routes.d.ts +34 -0
- package/dist/public-routes.js +136 -0
- package/dist/publisher.d.ts +61 -0
- package/dist/publisher.js +16 -0
- package/dist/safety-takedown.d.ts +56 -0
- package/dist/safety-takedown.js +146 -0
- package/dist/seller-closure-notice.d.ts +14 -0
- package/dist/seller-closure-notice.js +14 -0
- package/dist/seller-closure.d.ts +15 -0
- package/dist/seller-closure.js +31 -0
- package/dist/testing.d.ts +8 -0
- package/dist/testing.js +47 -0
- package/docs/api/README.md +26 -0
- package/docs/api/app-backend-binding-vocabulary.md +276 -0
- package/docs/api/app-backend-bindings.md +141 -0
- package/docs/api/app-event-facts.md +110 -0
- package/docs/api/app-method-context.md +166 -0
- package/docs/api/app-method-runtime.md +330 -0
- package/docs/api/backend.md +108 -0
- package/docs/api/background-replay.md +516 -0
- package/docs/api/cloudflare.md +1044 -0
- package/docs/api/effect.md +2429 -0
- package/docs/api/git-representation.md +56 -0
- package/docs/api/inbox.md +289 -0
- package/docs/api/index.md +2868 -0
- package/docs/api/publisher.md +147 -0
- package/docs/api/testing.md +31 -0
- package/package.json +158 -3
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import type { AppCapabilityId } from "./app-vocabulary.js";
|
|
2
|
+
/** Shared broker class, permission and effect metadata for a binding operation. */
|
|
3
|
+
export type BindingOperationDefinition = Readonly<{
|
|
4
|
+
cap: string;
|
|
5
|
+
requires: readonly AppCapabilityId[];
|
|
6
|
+
effect: "read" | "write";
|
|
7
|
+
}>;
|
|
8
|
+
/** The runtime-neutral registry shared by declarations, admission and Exec. */
|
|
9
|
+
export declare const appBackendBindingKinds: {
|
|
10
|
+
readonly BACKGROUND: {
|
|
11
|
+
readonly name: "BACKGROUND";
|
|
12
|
+
readonly operations: {
|
|
13
|
+
readonly admit: {
|
|
14
|
+
readonly cap: "app.background.admit";
|
|
15
|
+
readonly requires: readonly [];
|
|
16
|
+
readonly effect: "read";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
readonly GIT: {
|
|
21
|
+
readonly name: "GIT";
|
|
22
|
+
readonly operations: {
|
|
23
|
+
readonly create: {
|
|
24
|
+
readonly cap: "app.git.create";
|
|
25
|
+
readonly requires: readonly ["git.repository"];
|
|
26
|
+
readonly effect: "write";
|
|
27
|
+
};
|
|
28
|
+
readonly fork: {
|
|
29
|
+
readonly cap: "app.git.fork";
|
|
30
|
+
readonly requires: readonly ["git.repository"];
|
|
31
|
+
readonly effect: "write";
|
|
32
|
+
};
|
|
33
|
+
readonly read: {
|
|
34
|
+
readonly cap: "app.git.read";
|
|
35
|
+
readonly requires: readonly ["git.repository"];
|
|
36
|
+
readonly effect: "read";
|
|
37
|
+
};
|
|
38
|
+
readonly write: {
|
|
39
|
+
readonly cap: "app.git.write";
|
|
40
|
+
readonly requires: readonly ["git.repository"];
|
|
41
|
+
readonly effect: "write";
|
|
42
|
+
};
|
|
43
|
+
readonly exchange: {
|
|
44
|
+
readonly cap: "app.git.exchange";
|
|
45
|
+
readonly requires: readonly ["git.repository"];
|
|
46
|
+
readonly effect: "write";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly EVENTS: {
|
|
51
|
+
readonly name: "EVENTS";
|
|
52
|
+
readonly operations: {
|
|
53
|
+
readonly emit: {
|
|
54
|
+
readonly cap: "app.events.emit";
|
|
55
|
+
readonly requires: readonly ["app.events.emit"];
|
|
56
|
+
readonly effect: "write";
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
readonly APPS: {
|
|
61
|
+
readonly name: "APPS";
|
|
62
|
+
readonly operations: {
|
|
63
|
+
readonly build: {
|
|
64
|
+
readonly cap: "app.build";
|
|
65
|
+
readonly requires: readonly ["git.repository", "computer.execute"];
|
|
66
|
+
readonly effect: "write";
|
|
67
|
+
};
|
|
68
|
+
/** Read one build job's current status; the host re-checks the caller is the owner. */
|
|
69
|
+
readonly buildStatus: {
|
|
70
|
+
readonly cap: "app.build";
|
|
71
|
+
readonly requires: readonly [];
|
|
72
|
+
readonly effect: "read";
|
|
73
|
+
};
|
|
74
|
+
/** Install a Release at an installation id, or switch a live one onto
|
|
75
|
+
* it; the host re-checks the caller is the owner. */
|
|
76
|
+
readonly select: {
|
|
77
|
+
readonly cap: "app.select";
|
|
78
|
+
readonly requires: readonly [];
|
|
79
|
+
readonly effect: "write";
|
|
80
|
+
};
|
|
81
|
+
readonly catalog: {
|
|
82
|
+
readonly cap: "app.catalog.read";
|
|
83
|
+
readonly requires: readonly ["team.workbenchHost"];
|
|
84
|
+
readonly effect: "read";
|
|
85
|
+
};
|
|
86
|
+
/** Fork a platform App's published source into its own Team-owned App. */
|
|
87
|
+
readonly fork: {
|
|
88
|
+
readonly cap: "app.fork";
|
|
89
|
+
readonly requires: readonly [];
|
|
90
|
+
readonly effect: "write";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
readonly WORKFLOWS: {
|
|
95
|
+
readonly name: "WORKFLOWS";
|
|
96
|
+
readonly operations: {
|
|
97
|
+
/** The member's callable App methods, for an editor's palette. */
|
|
98
|
+
readonly catalog: {
|
|
99
|
+
readonly cap: "app.workflow.read";
|
|
100
|
+
readonly requires: readonly ["workflow.run"];
|
|
101
|
+
readonly effect: "read";
|
|
102
|
+
};
|
|
103
|
+
/** Compile and start a definition as the member on the pinned Computer. */
|
|
104
|
+
readonly runGraph: {
|
|
105
|
+
readonly cap: "app.workflow.run";
|
|
106
|
+
readonly requires: readonly ["workflow.run"];
|
|
107
|
+
readonly effect: "write";
|
|
108
|
+
};
|
|
109
|
+
readonly armSchedule: {
|
|
110
|
+
readonly cap: "app.workflow.run";
|
|
111
|
+
readonly requires: readonly ["workflow.run", "workflow.arm"];
|
|
112
|
+
readonly effect: "write";
|
|
113
|
+
};
|
|
114
|
+
readonly disarmSchedule: {
|
|
115
|
+
readonly cap: "app.workflow.run";
|
|
116
|
+
readonly requires: readonly ["workflow.run", "workflow.arm"];
|
|
117
|
+
readonly effect: "write";
|
|
118
|
+
};
|
|
119
|
+
readonly schedules: {
|
|
120
|
+
readonly cap: "app.workflow.read";
|
|
121
|
+
readonly requires: readonly ["workflow.run"];
|
|
122
|
+
readonly effect: "read";
|
|
123
|
+
};
|
|
124
|
+
readonly armEventTrigger: {
|
|
125
|
+
readonly cap: "app.workflow.run";
|
|
126
|
+
readonly requires: readonly ["workflow.run", "workflow.arm"];
|
|
127
|
+
readonly effect: "write";
|
|
128
|
+
};
|
|
129
|
+
readonly disarmEventTrigger: {
|
|
130
|
+
readonly cap: "app.workflow.run";
|
|
131
|
+
readonly requires: readonly ["workflow.run", "workflow.arm"];
|
|
132
|
+
readonly effect: "write";
|
|
133
|
+
};
|
|
134
|
+
readonly eventTriggers: {
|
|
135
|
+
readonly cap: "app.workflow.read";
|
|
136
|
+
readonly requires: readonly ["workflow.run"];
|
|
137
|
+
readonly effect: "read";
|
|
138
|
+
};
|
|
139
|
+
/** A person's answer to one of a run's reviews; Agents never answer. */
|
|
140
|
+
readonly cancel: {
|
|
141
|
+
readonly cap: "app.workflow.run";
|
|
142
|
+
readonly requires: readonly ["workflow.run"];
|
|
143
|
+
readonly effect: "write";
|
|
144
|
+
};
|
|
145
|
+
readonly answerReview: {
|
|
146
|
+
readonly cap: "app.workflow.run";
|
|
147
|
+
readonly requires: readonly ["workflow.run"];
|
|
148
|
+
readonly effect: "write";
|
|
149
|
+
};
|
|
150
|
+
/** One of the member's runs: node events, reviews and engine status. */
|
|
151
|
+
readonly graphStatus: {
|
|
152
|
+
readonly cap: "app.workflow.read";
|
|
153
|
+
readonly requires: readonly ["workflow.run"];
|
|
154
|
+
readonly effect: "read";
|
|
155
|
+
};
|
|
156
|
+
/** Up to 50 runs of this library, newest first; source and initiator included. */
|
|
157
|
+
readonly runs: {
|
|
158
|
+
readonly cap: "app.workflow.read";
|
|
159
|
+
readonly requires: readonly ["workflow.run"];
|
|
160
|
+
readonly effect: "read";
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
readonly APP_STORAGE: {
|
|
165
|
+
readonly name: "APP_STORAGE";
|
|
166
|
+
readonly operations: {
|
|
167
|
+
readonly read: {
|
|
168
|
+
readonly cap: "app.storage.read";
|
|
169
|
+
readonly requires: readonly ["app.storage"];
|
|
170
|
+
readonly effect: "read";
|
|
171
|
+
};
|
|
172
|
+
readonly write: {
|
|
173
|
+
readonly cap: "app.storage.write";
|
|
174
|
+
readonly requires: readonly ["app.storage"];
|
|
175
|
+
readonly effect: "write";
|
|
176
|
+
};
|
|
177
|
+
readonly reset: {
|
|
178
|
+
readonly cap: "app.storage.write";
|
|
179
|
+
readonly requires: readonly ["app.storage"];
|
|
180
|
+
readonly effect: "write";
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
readonly MEDIA: {
|
|
185
|
+
readonly name: "MEDIA";
|
|
186
|
+
readonly operations: {
|
|
187
|
+
readonly models: {
|
|
188
|
+
readonly cap: "app.media.read";
|
|
189
|
+
readonly requires: readonly ["media.generation"];
|
|
190
|
+
readonly effect: "read";
|
|
191
|
+
};
|
|
192
|
+
readonly generate: {
|
|
193
|
+
readonly cap: "app.media.generate";
|
|
194
|
+
readonly requires: readonly ["media.generation", "computer.writeFile"];
|
|
195
|
+
readonly effect: "write";
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
readonly COMPUTER: {
|
|
200
|
+
readonly name: "COMPUTER";
|
|
201
|
+
readonly operations: {
|
|
202
|
+
readonly list: {
|
|
203
|
+
readonly cap: "app.computer.read";
|
|
204
|
+
readonly requires: readonly ["computer.list"];
|
|
205
|
+
readonly effect: "read";
|
|
206
|
+
};
|
|
207
|
+
readonly read: {
|
|
208
|
+
readonly cap: "app.computer.read";
|
|
209
|
+
readonly requires: readonly ["computer.readFile"];
|
|
210
|
+
readonly effect: "read";
|
|
211
|
+
};
|
|
212
|
+
readonly ports: {
|
|
213
|
+
readonly cap: "app.computer.read";
|
|
214
|
+
readonly requires: readonly ["computer.execute"];
|
|
215
|
+
readonly effect: "read";
|
|
216
|
+
};
|
|
217
|
+
readonly processes: {
|
|
218
|
+
readonly cap: "app.computer.read";
|
|
219
|
+
readonly requires: readonly ["computer.execute"];
|
|
220
|
+
readonly effect: "read";
|
|
221
|
+
};
|
|
222
|
+
readonly write: {
|
|
223
|
+
readonly cap: "app.computer.write";
|
|
224
|
+
readonly requires: readonly ["computer.writeFile"];
|
|
225
|
+
readonly effect: "write";
|
|
226
|
+
};
|
|
227
|
+
readonly workflowGitPass: {
|
|
228
|
+
readonly cap: "app.computer.exec";
|
|
229
|
+
readonly requires: readonly ["computer.execute"];
|
|
230
|
+
readonly effect: "write";
|
|
231
|
+
};
|
|
232
|
+
readonly preview: {
|
|
233
|
+
readonly cap: "app.computer.exec";
|
|
234
|
+
readonly requires: readonly ["computer.execute"];
|
|
235
|
+
readonly effect: "write";
|
|
236
|
+
};
|
|
237
|
+
readonly processKill: {
|
|
238
|
+
readonly cap: "app.computer.exec";
|
|
239
|
+
readonly requires: readonly ["computer.execute"];
|
|
240
|
+
readonly effect: "write";
|
|
241
|
+
};
|
|
242
|
+
readonly processStart: {
|
|
243
|
+
readonly cap: "app.computer.exec";
|
|
244
|
+
readonly requires: readonly ["computer.execute"];
|
|
245
|
+
readonly effect: "write";
|
|
246
|
+
};
|
|
247
|
+
readonly exec: {
|
|
248
|
+
readonly cap: "app.computer.exec";
|
|
249
|
+
readonly requires: readonly ["computer.execute"];
|
|
250
|
+
readonly effect: "write";
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
readonly INBOX: {
|
|
255
|
+
readonly name: "INBOX";
|
|
256
|
+
readonly operations: {
|
|
257
|
+
readonly page: {
|
|
258
|
+
readonly cap: "inbox.read";
|
|
259
|
+
readonly requires: readonly ["agent.read"];
|
|
260
|
+
readonly effect: "read";
|
|
261
|
+
};
|
|
262
|
+
readonly visit: {
|
|
263
|
+
readonly cap: "inbox.visit";
|
|
264
|
+
readonly requires: readonly ["agent.read"];
|
|
265
|
+
readonly effect: "write";
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
readonly AGENTS: {
|
|
270
|
+
readonly name: "AGENTS";
|
|
271
|
+
readonly operations: {
|
|
272
|
+
readonly list: {
|
|
273
|
+
readonly cap: "agent.list";
|
|
274
|
+
readonly requires: readonly ["agent.list"];
|
|
275
|
+
readonly effect: "read";
|
|
276
|
+
};
|
|
277
|
+
readonly send: {
|
|
278
|
+
readonly cap: "agent.send";
|
|
279
|
+
readonly requires: readonly ["agent.send"];
|
|
280
|
+
readonly effect: "write";
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
/** A registered backend binding kind. */
|
|
286
|
+
export type AppBackendBindingName = keyof typeof appBackendBindingKinds;
|
|
287
|
+
/** One author-selected binding; its operation names are checked by the registry decoder. */
|
|
288
|
+
export type AppBackendBinding = Readonly<{
|
|
289
|
+
name: AppBackendBindingName;
|
|
290
|
+
operations: readonly string[];
|
|
291
|
+
}>;
|
|
292
|
+
/** RPC method names exposed by the registered kinds. */
|
|
293
|
+
export type AppBackendBindingMethod = {
|
|
294
|
+
[Kind in AppBackendBindingName]: keyof (typeof appBackendBindingKinds)[Kind]["operations"];
|
|
295
|
+
}[AppBackendBindingName];
|
|
296
|
+
/** The required permissions, effect and broker class of a registered operation. */
|
|
297
|
+
export type AppBackendBindingOperation = {
|
|
298
|
+
[Kind in AppBackendBindingName]: (typeof appBackendBindingKinds)[Kind]["operations"][keyof (typeof appBackendBindingKinds)[Kind]["operations"]];
|
|
299
|
+
}[AppBackendBindingName];
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/** The runtime-neutral registry shared by declarations, admission and Exec. */
|
|
2
|
+
export const appBackendBindingKinds = {
|
|
3
|
+
BACKGROUND: {
|
|
4
|
+
name: "BACKGROUND",
|
|
5
|
+
operations: {
|
|
6
|
+
admit: { cap: "app.background.admit", requires: [], effect: "read" },
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
GIT: {
|
|
10
|
+
name: "GIT",
|
|
11
|
+
operations: {
|
|
12
|
+
create: {
|
|
13
|
+
cap: "app.git.create",
|
|
14
|
+
requires: ["git.repository"],
|
|
15
|
+
effect: "write",
|
|
16
|
+
},
|
|
17
|
+
fork: {
|
|
18
|
+
cap: "app.git.fork",
|
|
19
|
+
requires: ["git.repository"],
|
|
20
|
+
effect: "write",
|
|
21
|
+
},
|
|
22
|
+
read: {
|
|
23
|
+
cap: "app.git.read",
|
|
24
|
+
requires: ["git.repository"],
|
|
25
|
+
effect: "read",
|
|
26
|
+
},
|
|
27
|
+
write: {
|
|
28
|
+
cap: "app.git.write",
|
|
29
|
+
requires: ["git.repository"],
|
|
30
|
+
effect: "write",
|
|
31
|
+
},
|
|
32
|
+
exchange: {
|
|
33
|
+
cap: "app.git.exchange",
|
|
34
|
+
requires: ["git.repository"],
|
|
35
|
+
effect: "write",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
EVENTS: {
|
|
40
|
+
name: "EVENTS",
|
|
41
|
+
operations: {
|
|
42
|
+
emit: {
|
|
43
|
+
cap: "app.events.emit",
|
|
44
|
+
requires: ["app.events.emit"],
|
|
45
|
+
effect: "write",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
APPS: {
|
|
50
|
+
name: "APPS",
|
|
51
|
+
operations: {
|
|
52
|
+
build: {
|
|
53
|
+
cap: "app.build",
|
|
54
|
+
requires: ["git.repository", "computer.execute"],
|
|
55
|
+
effect: "write",
|
|
56
|
+
},
|
|
57
|
+
/** Read one build job's current status; the host re-checks the caller is the owner. */
|
|
58
|
+
buildStatus: {
|
|
59
|
+
cap: "app.build",
|
|
60
|
+
requires: [],
|
|
61
|
+
effect: "read",
|
|
62
|
+
},
|
|
63
|
+
/** Install a Release at an installation id, or switch a live one onto
|
|
64
|
+
* it; the host re-checks the caller is the owner. */
|
|
65
|
+
select: {
|
|
66
|
+
cap: "app.select",
|
|
67
|
+
requires: [],
|
|
68
|
+
effect: "write",
|
|
69
|
+
},
|
|
70
|
+
catalog: {
|
|
71
|
+
cap: "app.catalog.read",
|
|
72
|
+
requires: ["team.workbenchHost"],
|
|
73
|
+
effect: "read",
|
|
74
|
+
},
|
|
75
|
+
/** Fork a platform App's published source into its own Team-owned App. */
|
|
76
|
+
fork: {
|
|
77
|
+
cap: "app.fork",
|
|
78
|
+
requires: [],
|
|
79
|
+
effect: "write",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
WORKFLOWS: {
|
|
84
|
+
name: "WORKFLOWS",
|
|
85
|
+
operations: {
|
|
86
|
+
/** The member's callable App methods, for an editor's palette. */
|
|
87
|
+
catalog: {
|
|
88
|
+
cap: "app.workflow.read",
|
|
89
|
+
requires: ["workflow.run"],
|
|
90
|
+
effect: "read",
|
|
91
|
+
},
|
|
92
|
+
/** Compile and start a definition as the member on the pinned Computer. */
|
|
93
|
+
runGraph: {
|
|
94
|
+
cap: "app.workflow.run",
|
|
95
|
+
requires: ["workflow.run"],
|
|
96
|
+
effect: "write",
|
|
97
|
+
},
|
|
98
|
+
armSchedule: {
|
|
99
|
+
cap: "app.workflow.run",
|
|
100
|
+
requires: ["workflow.run", "workflow.arm"],
|
|
101
|
+
effect: "write",
|
|
102
|
+
},
|
|
103
|
+
disarmSchedule: {
|
|
104
|
+
cap: "app.workflow.run",
|
|
105
|
+
requires: ["workflow.run", "workflow.arm"],
|
|
106
|
+
effect: "write",
|
|
107
|
+
},
|
|
108
|
+
schedules: {
|
|
109
|
+
cap: "app.workflow.read",
|
|
110
|
+
requires: ["workflow.run"],
|
|
111
|
+
effect: "read",
|
|
112
|
+
},
|
|
113
|
+
armEventTrigger: {
|
|
114
|
+
cap: "app.workflow.run",
|
|
115
|
+
requires: ["workflow.run", "workflow.arm"],
|
|
116
|
+
effect: "write",
|
|
117
|
+
},
|
|
118
|
+
disarmEventTrigger: {
|
|
119
|
+
cap: "app.workflow.run",
|
|
120
|
+
requires: ["workflow.run", "workflow.arm"],
|
|
121
|
+
effect: "write",
|
|
122
|
+
},
|
|
123
|
+
eventTriggers: {
|
|
124
|
+
cap: "app.workflow.read",
|
|
125
|
+
requires: ["workflow.run"],
|
|
126
|
+
effect: "read",
|
|
127
|
+
},
|
|
128
|
+
/** A person's answer to one of a run's reviews; Agents never answer. */
|
|
129
|
+
cancel: {
|
|
130
|
+
cap: "app.workflow.run",
|
|
131
|
+
requires: ["workflow.run"],
|
|
132
|
+
effect: "write",
|
|
133
|
+
},
|
|
134
|
+
answerReview: {
|
|
135
|
+
cap: "app.workflow.run",
|
|
136
|
+
requires: ["workflow.run"],
|
|
137
|
+
effect: "write",
|
|
138
|
+
},
|
|
139
|
+
/** One of the member's runs: node events, reviews and engine status. */
|
|
140
|
+
graphStatus: {
|
|
141
|
+
cap: "app.workflow.read",
|
|
142
|
+
requires: ["workflow.run"],
|
|
143
|
+
effect: "read",
|
|
144
|
+
},
|
|
145
|
+
/** Up to 50 runs of this library, newest first; source and initiator included. */
|
|
146
|
+
runs: {
|
|
147
|
+
cap: "app.workflow.read",
|
|
148
|
+
requires: ["workflow.run"],
|
|
149
|
+
effect: "read",
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
APP_STORAGE: {
|
|
154
|
+
name: "APP_STORAGE",
|
|
155
|
+
operations: {
|
|
156
|
+
read: {
|
|
157
|
+
cap: "app.storage.read",
|
|
158
|
+
requires: ["app.storage"],
|
|
159
|
+
effect: "read",
|
|
160
|
+
},
|
|
161
|
+
write: {
|
|
162
|
+
cap: "app.storage.write",
|
|
163
|
+
requires: ["app.storage"],
|
|
164
|
+
effect: "write",
|
|
165
|
+
},
|
|
166
|
+
reset: {
|
|
167
|
+
cap: "app.storage.write",
|
|
168
|
+
requires: ["app.storage"],
|
|
169
|
+
effect: "write",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
MEDIA: {
|
|
174
|
+
name: "MEDIA",
|
|
175
|
+
operations: {
|
|
176
|
+
models: {
|
|
177
|
+
cap: "app.media.read",
|
|
178
|
+
requires: ["media.generation"],
|
|
179
|
+
effect: "read",
|
|
180
|
+
},
|
|
181
|
+
generate: {
|
|
182
|
+
cap: "app.media.generate",
|
|
183
|
+
requires: ["media.generation", "computer.writeFile"],
|
|
184
|
+
effect: "write",
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
COMPUTER: {
|
|
189
|
+
name: "COMPUTER",
|
|
190
|
+
operations: {
|
|
191
|
+
list: {
|
|
192
|
+
cap: "app.computer.read",
|
|
193
|
+
requires: ["computer.list"],
|
|
194
|
+
effect: "read",
|
|
195
|
+
},
|
|
196
|
+
read: {
|
|
197
|
+
cap: "app.computer.read",
|
|
198
|
+
requires: ["computer.readFile"],
|
|
199
|
+
effect: "read",
|
|
200
|
+
},
|
|
201
|
+
ports: {
|
|
202
|
+
cap: "app.computer.read",
|
|
203
|
+
requires: ["computer.execute"],
|
|
204
|
+
effect: "read",
|
|
205
|
+
},
|
|
206
|
+
processes: {
|
|
207
|
+
cap: "app.computer.read",
|
|
208
|
+
requires: ["computer.execute"],
|
|
209
|
+
effect: "read",
|
|
210
|
+
},
|
|
211
|
+
write: {
|
|
212
|
+
cap: "app.computer.write",
|
|
213
|
+
requires: ["computer.writeFile"],
|
|
214
|
+
effect: "write",
|
|
215
|
+
},
|
|
216
|
+
workflowGitPass: {
|
|
217
|
+
cap: "app.computer.exec",
|
|
218
|
+
requires: ["computer.execute"],
|
|
219
|
+
effect: "write",
|
|
220
|
+
},
|
|
221
|
+
preview: {
|
|
222
|
+
cap: "app.computer.exec",
|
|
223
|
+
requires: ["computer.execute"],
|
|
224
|
+
effect: "write",
|
|
225
|
+
},
|
|
226
|
+
processKill: {
|
|
227
|
+
cap: "app.computer.exec",
|
|
228
|
+
requires: ["computer.execute"],
|
|
229
|
+
effect: "write",
|
|
230
|
+
},
|
|
231
|
+
processStart: {
|
|
232
|
+
cap: "app.computer.exec",
|
|
233
|
+
requires: ["computer.execute"],
|
|
234
|
+
effect: "write",
|
|
235
|
+
},
|
|
236
|
+
exec: {
|
|
237
|
+
cap: "app.computer.exec",
|
|
238
|
+
requires: ["computer.execute"],
|
|
239
|
+
effect: "write",
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
INBOX: {
|
|
244
|
+
name: "INBOX",
|
|
245
|
+
operations: {
|
|
246
|
+
page: { cap: "inbox.read", requires: ["agent.read"], effect: "read" },
|
|
247
|
+
visit: { cap: "inbox.visit", requires: ["agent.read"], effect: "write" },
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
AGENTS: {
|
|
251
|
+
name: "AGENTS",
|
|
252
|
+
operations: {
|
|
253
|
+
list: { cap: "agent.list", requires: ["agent.list"], effect: "read" },
|
|
254
|
+
send: { cap: "agent.send", requires: ["agent.send"], effect: "write" },
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type AppBackendBindingName, type AppBackendBindingOperation } from "./app-backend-binding-vocabulary.js";
|
|
2
|
+
export { appBackendBindingKinds, type AppBackendBindingName, type AppBackendBindingMethod, type AppBackendBindingOperation, } from "./app-backend-binding-vocabulary.js";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
/** Author declarations select named operations from registered binding kinds. */
|
|
5
|
+
export declare const appBackendBindingsSchema: Schema.$Array<Schema.Union<Schema.Struct<{
|
|
6
|
+
readonly name: Schema.Literal<"BACKGROUND" | "GIT" | "EVENTS" | "APPS" | "WORKFLOWS" | "APP_STORAGE" | "MEDIA" | "COMPUTER" | "INBOX" | "AGENTS">;
|
|
7
|
+
readonly operations: Schema.$Array<Schema.Literals<string[]>>;
|
|
8
|
+
}>[]>>;
|
|
9
|
+
/** Signed shard bindings pair each operation with its exact broker class. */
|
|
10
|
+
export declare const appBackendShardBindingsSchema: Schema.$Array<Schema.Union<Schema.Struct<{
|
|
11
|
+
readonly name: Schema.Literal<"BACKGROUND" | "GIT" | "EVENTS" | "APPS" | "WORKFLOWS" | "APP_STORAGE" | "MEDIA" | "COMPUTER" | "INBOX" | "AGENTS">;
|
|
12
|
+
readonly operations: Schema.$Array<Schema.Union<Schema.Struct<{
|
|
13
|
+
readonly name: Schema.Literal<string>;
|
|
14
|
+
readonly cap: Schema.Literal<"agent.list" | "agent.send" | "app.events.emit" | "app.background.admit" | "app.git.create" | "app.git.fork" | "app.git.read" | "app.git.write" | "app.git.exchange" | "app.build" | "app.select" | "app.catalog.read" | "app.fork" | "app.workflow.read" | "app.workflow.run" | "app.storage.read" | "app.storage.write" | "app.media.read" | "app.media.generate" | "app.computer.read" | "app.computer.write" | "app.computer.exec" | "inbox.read" | "inbox.visit">;
|
|
15
|
+
}>[]>>;
|
|
16
|
+
}>[]>>;
|
|
17
|
+
/** Look up an operation within its declared kind; unknown names have no authority. */
|
|
18
|
+
export declare function appBackendBindingOperation(name: AppBackendBindingName, operation: string): AppBackendBindingOperation | undefined;
|
|
19
|
+
/** Keep only operations required by the verified method and allowed by its write ceiling.
|
|
20
|
+
* Without a method, installation-scoped calls still respect the captured ceiling. */
|
|
21
|
+
export declare function scopeOperationToMethod(operation: AppBackendBindingOperation, method: Pick<import("./app-vocabulary.js").AppApi["methods"][string], "requires" | "effect"> | undefined, ceiling: "read" | "write"): boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { appBackendBindingKinds, } from "./app-backend-binding-vocabulary.js";
|
|
2
|
+
export { appBackendBindingKinds, } from "./app-backend-binding-vocabulary.js";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import { appApiMethodNameSchema } from "./app-api.js";
|
|
5
|
+
const unique = (values) => new Set(values).size === values.length;
|
|
6
|
+
function bindingKind(name, operations) {
|
|
7
|
+
const names = Object.keys(operations);
|
|
8
|
+
for (const operation of names)
|
|
9
|
+
Schema.decodeUnknownSync(appApiMethodNameSchema)(operation);
|
|
10
|
+
const declaration = Schema.Struct({
|
|
11
|
+
name: Schema.Literal(name),
|
|
12
|
+
operations: Schema.Array(Schema.Literals(names)).pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(names.length)), Schema.check(Schema.makeFilter(unique))),
|
|
13
|
+
});
|
|
14
|
+
const shard = Schema.Struct({
|
|
15
|
+
name: Schema.Literal(name),
|
|
16
|
+
operations: Schema.Array(Schema.Union(Object.entries(operations).map(([name, operation]) => Schema.Struct({
|
|
17
|
+
name: Schema.Literal(name),
|
|
18
|
+
cap: Schema.Literal(operation.cap),
|
|
19
|
+
})))).pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(names.length)), Schema.check(Schema.makeFilter((ops) => unique(ops.map((op) => op.name)), {
|
|
20
|
+
message: "App backend operation repeated",
|
|
21
|
+
}))),
|
|
22
|
+
});
|
|
23
|
+
return { declaration, shard };
|
|
24
|
+
}
|
|
25
|
+
const kinds = Object.values(appBackendBindingKinds).map((kind) => bindingKind(kind.name, kind.operations));
|
|
26
|
+
const count = kinds.length;
|
|
27
|
+
/** Author declarations select named operations from registered binding kinds. */
|
|
28
|
+
export const appBackendBindingsSchema = Schema.Array(Schema.Union(kinds.map((kind) => kind.declaration))).pipe(Schema.check(Schema.isMaxLength(count)), Schema.check(Schema.makeFilter((bindings) => unique(bindings.map((binding) => binding.name)))));
|
|
29
|
+
/** Signed shard bindings pair each operation with its exact broker class. */
|
|
30
|
+
export const appBackendShardBindingsSchema = Schema.Array(Schema.Union(kinds.map((kind) => kind.shard))).pipe(Schema.check(Schema.isMaxLength(count)), Schema.check(Schema.makeFilter((bindings) => unique(bindings.map((binding) => binding.name)))));
|
|
31
|
+
const operationCatalog = new Map(Object.entries(appBackendBindingKinds).map(([name, operations]) => [
|
|
32
|
+
name,
|
|
33
|
+
new Map(Object.entries(operations.operations)),
|
|
34
|
+
]));
|
|
35
|
+
/** Look up an operation within its declared kind; unknown names have no authority. */
|
|
36
|
+
export function appBackendBindingOperation(name, operation) {
|
|
37
|
+
return operationCatalog.get(name)?.get(operation);
|
|
38
|
+
}
|
|
39
|
+
/** Keep only operations required by the verified method and allowed by its write ceiling.
|
|
40
|
+
* Without a method, installation-scoped calls still respect the captured ceiling. */
|
|
41
|
+
export function scopeOperationToMethod(operation, method, ceiling) {
|
|
42
|
+
return ((method === undefined ||
|
|
43
|
+
operation.requires.every((capability) => method.requires.includes(capability))) &&
|
|
44
|
+
(operation.effect === "read" ||
|
|
45
|
+
((method === undefined || method.effect === "write") &&
|
|
46
|
+
ceiling === "write")));
|
|
47
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { type AppDeclaration, type AppDeclaredCommand } from "./app-vocabulary.js";
|
|
3
|
+
export declare const appRoleSchema: Schema.Literals<readonly ["dashboard", "inbox", "files", "media", "sessions", "terminal"]>;
|
|
4
|
+
export declare const appCapabilityIdSchema: Schema.Literals<readonly ["agent.list", "agent.manage", "agent.rename", "agent.toolPolicy", "agent.read", "agent.send", "computer.list", "computer.readFile", "computer.writeFile", "computer.execute", "llm.generation", "media.generation", "games:servers", "git.repository", "apps.open", "apps.call", "app.storage", "app.events.emit", "team.workbenchHost", "marketplace.browse", "marketplace.purchase", "workflow.run", "workflow.publish", "workflow.arm", "world", "channels.read", "channels.personal.manage"]>;
|
|
5
|
+
export declare const appHandlerSchema: Schema.Literals<readonly ["file.open"]>;
|
|
6
|
+
/**
|
|
7
|
+
* One declared command: a Whistle definition's identity and projections.
|
|
8
|
+
* Runtime-only facts (availability, typed actions, slash argument grammar)
|
|
9
|
+
* are not part of the digest-covered declaration and are dropped on decode.
|
|
10
|
+
*/
|
|
11
|
+
export declare const appDeclaredCommandSchema: Schema.Codec<AppDeclaredCommand>;
|
|
12
|
+
/** Maintained grammar for one bounded key in an App's private storage. */
|
|
13
|
+
export declare const appStorageKeyNameSchema: Schema.String;
|
|
14
|
+
export declare const appStorageKeySchema: Schema.declareConstructor<{
|
|
15
|
+
readonly key: string;
|
|
16
|
+
readonly scopes: readonly ("team" | "member")[];
|
|
17
|
+
readonly maxBytes: number;
|
|
18
|
+
}, {
|
|
19
|
+
readonly key: string;
|
|
20
|
+
readonly scopes: readonly ("team" | "member")[];
|
|
21
|
+
readonly maxBytes: number;
|
|
22
|
+
}, readonly [Schema.Struct<{
|
|
23
|
+
readonly key: Schema.String;
|
|
24
|
+
readonly scopes: Schema.$Array<Schema.Literals<readonly ["team", "member"]>>;
|
|
25
|
+
readonly maxBytes: Schema.Int;
|
|
26
|
+
}>], {
|
|
27
|
+
readonly key: string;
|
|
28
|
+
readonly scopes: readonly ("team" | "member")[];
|
|
29
|
+
readonly maxBytes: number;
|
|
30
|
+
}>;
|
|
31
|
+
/** The bounded, digest-covered allowlist shown when approving member App calls. */
|
|
32
|
+
export declare const appCallsSchema: Schema.$Array<Schema.declareConstructor<{
|
|
33
|
+
readonly appId: string;
|
|
34
|
+
readonly methods: readonly string[];
|
|
35
|
+
}, {
|
|
36
|
+
readonly appId: string;
|
|
37
|
+
readonly methods: readonly string[];
|
|
38
|
+
}, readonly [Schema.Struct<{
|
|
39
|
+
readonly appId: Schema.String;
|
|
40
|
+
readonly methods: Schema.$Array<Schema.String>;
|
|
41
|
+
}>], {
|
|
42
|
+
readonly appId: string;
|
|
43
|
+
readonly methods: readonly string[];
|
|
44
|
+
}>>;
|
|
45
|
+
/** Boundary codec for the digest-covered {@link AppDeclaration}. */
|
|
46
|
+
export declare const appDeclarationSchema: Schema.Codec<AppDeclaration>;
|