@clawscarf/cli 0.1.0-alpha.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.
Files changed (197) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/THIRD_PARTY_NOTICES.md +102 -0
  4. package/deploy/execution/browser/LICENSE.playwright +202 -0
  5. package/deploy/execution/browser/seccomp.json +640 -0
  6. package/deploy/execution/browser-node/configuration.js +85 -0
  7. package/deploy/execution/browser-node/operator.js +167 -0
  8. package/deploy/execution/network/node-ingress.cfg +35 -0
  9. package/deploy/models/catalog.json +275 -0
  10. package/deploy/openshell/policy.yaml +24 -0
  11. package/generated/http/LICENSE.md +21 -0
  12. package/generated/http/client/client.gen.d.ts +2 -0
  13. package/generated/http/client/client.gen.js +216 -0
  14. package/generated/http/client/index.d.ts +10 -0
  15. package/generated/http/client/index.js +6 -0
  16. package/generated/http/client/types.gen.d.ts +120 -0
  17. package/generated/http/client/types.gen.js +2 -0
  18. package/generated/http/client/utils.gen.d.ts +37 -0
  19. package/generated/http/client/utils.gen.js +228 -0
  20. package/generated/http/core/auth.gen.d.ts +25 -0
  21. package/generated/http/core/auth.gen.js +14 -0
  22. package/generated/http/core/bodySerializer.gen.d.ts +25 -0
  23. package/generated/http/core/bodySerializer.gen.js +57 -0
  24. package/generated/http/core/params.gen.d.ts +43 -0
  25. package/generated/http/core/params.gen.js +109 -0
  26. package/generated/http/core/pathSerializer.gen.d.ts +33 -0
  27. package/generated/http/core/pathSerializer.gen.js +106 -0
  28. package/generated/http/core/queryKeySerializer.gen.d.ts +18 -0
  29. package/generated/http/core/queryKeySerializer.gen.js +92 -0
  30. package/generated/http/core/serverSentEvents.gen.d.ts +71 -0
  31. package/generated/http/core/serverSentEvents.gen.js +132 -0
  32. package/generated/http/core/types.gen.d.ts +83 -0
  33. package/generated/http/core/types.gen.js +2 -0
  34. package/generated/http/core/utils.gen.d.ts +19 -0
  35. package/generated/http/core/utils.gen.js +87 -0
  36. package/package.json +37 -0
  37. package/packs/README.md +130 -0
  38. package/packs/research-team/pack.json +20 -0
  39. package/packs/research-team/researcher/CLAW.md +19 -0
  40. package/packs/research-team/researcher/package.json +8 -0
  41. package/packs/research-team/researcher/profiles/openclaw.yml +6 -0
  42. package/packs/research-team/reviewer/CLAW.md +19 -0
  43. package/packs/research-team/reviewer/package.json +8 -0
  44. package/packs/research-team/reviewer/profiles/openclaw.yml +6 -0
  45. package/pnpm-lock.yaml +7158 -0
  46. package/recipes/README.md +37 -0
  47. package/recipes/team-server/recipe.json +28 -0
  48. package/release/README.md +137 -0
  49. package/release/components.json +29 -0
  50. package/release/operator.md +63 -0
  51. package/runtime/configuration.js +135 -0
  52. package/runtime/connections-configuration.js +70 -0
  53. package/runtime/model-contract.js +92 -0
  54. package/runtime/releases/0.1.0-alpha.1.json +37 -0
  55. package/scripts/clawscarf.js +92 -0
  56. package/scripts/cloud/login.js +134 -0
  57. package/scripts/cloud/registration.js +232 -0
  58. package/scripts/cloud/url.js +9 -0
  59. package/scripts/connections.js +193 -0
  60. package/scripts/controller.js +143 -0
  61. package/scripts/deployment/browser-node-compose.js +81 -0
  62. package/scripts/deployment/browser-node-helper.js +9 -0
  63. package/scripts/deployment/browser-node-pairing.js +165 -0
  64. package/scripts/deployment/browser-node.js +154 -0
  65. package/scripts/deployment/browser.js +143 -0
  66. package/scripts/deployment/certificates.js +76 -0
  67. package/scripts/deployment/compose.js +191 -0
  68. package/scripts/deployment/configuration.js +275 -0
  69. package/scripts/deployment/connection-policy.js +80 -0
  70. package/scripts/deployment/connection-settings.js +60 -0
  71. package/scripts/deployment/connections-runtime.js +31 -0
  72. package/scripts/deployment/connections.js +213 -0
  73. package/scripts/deployment/controller-compose.js +59 -0
  74. package/scripts/deployment/database.js +199 -0
  75. package/scripts/deployment/entrypoint.js +7 -0
  76. package/scripts/deployment/images.js +17 -0
  77. package/scripts/deployment/initial-services.js +53 -0
  78. package/scripts/deployment/launch.js +177 -0
  79. package/scripts/deployment/logs.js +15 -0
  80. package/scripts/deployment/model-gateway-compose.js +74 -0
  81. package/scripts/deployment/model-gateway.js +125 -0
  82. package/scripts/deployment/models.js +82 -0
  83. package/scripts/deployment/networks.js +354 -0
  84. package/scripts/deployment/policy.js +56 -0
  85. package/scripts/deployment/preflight.js +124 -0
  86. package/scripts/deployment/prepare.js +205 -0
  87. package/scripts/deployment/process.js +70 -0
  88. package/scripts/deployment/relay.js +58 -0
  89. package/scripts/deployment/runtime-binding.js +100 -0
  90. package/scripts/deployment/runtime.js +232 -0
  91. package/scripts/deployment/state.js +154 -0
  92. package/scripts/deployment/team.js +76 -0
  93. package/scripts/deployment/upgrade-rpc.py +148 -0
  94. package/scripts/deployment/upgrade-state.js +47 -0
  95. package/scripts/deployment/upgrade.js +298 -0
  96. package/scripts/deployment/volumes.js +24 -0
  97. package/scripts/errors.js +9 -0
  98. package/scripts/installation/administrator.js +23 -0
  99. package/scripts/installation/command.js +176 -0
  100. package/scripts/installation/configuration.js +104 -0
  101. package/scripts/installation/configure.js +122 -0
  102. package/scripts/installation/delete.js +111 -0
  103. package/scripts/installation/doctor.js +8 -0
  104. package/scripts/installation/errors.js +8 -0
  105. package/scripts/installation/files.js +51 -0
  106. package/scripts/installation/installer/cloud.js +22 -0
  107. package/scripts/installation/installer/collect.js +245 -0
  108. package/scripts/installation/installer/inputs.js +59 -0
  109. package/scripts/installation/installer/menu.js +49 -0
  110. package/scripts/installation/installer/prompts.js +139 -0
  111. package/scripts/installation/installer/run.js +251 -0
  112. package/scripts/installation/installer/secrets.js +16 -0
  113. package/scripts/installation/installer/sections/access.js +69 -0
  114. package/scripts/installation/installer/sections/certificates.js +18 -0
  115. package/scripts/installation/installer/sections/connections.js +4 -0
  116. package/scripts/installation/installer/sections/external-models.js +35 -0
  117. package/scripts/installation/installer/sections/models.js +119 -0
  118. package/scripts/installation/installer/sections/packs.js +82 -0
  119. package/scripts/installation/installer/sections/resources.js +10 -0
  120. package/scripts/installation/installer/settings.js +192 -0
  121. package/scripts/installation/installer/summary.js +44 -0
  122. package/scripts/installation/lifecycle.js +127 -0
  123. package/scripts/installation/location.js +3 -0
  124. package/scripts/installation/models.js +42 -0
  125. package/scripts/installation/options.js +360 -0
  126. package/scripts/installation/packs.js +150 -0
  127. package/scripts/installation/plan.js +121 -0
  128. package/scripts/installation/prerequisites.js +170 -0
  129. package/scripts/installation/recipes/catalog.js +55 -0
  130. package/scripts/installation/recipes/definition.js +32 -0
  131. package/scripts/installation/reconfigure.js +255 -0
  132. package/scripts/installation/requirements.js +23 -0
  133. package/scripts/installation/resolve.js +217 -0
  134. package/scripts/installation/runtime.js +87 -0
  135. package/scripts/installation/save.js +95 -0
  136. package/scripts/installation/setup.js +91 -0
  137. package/scripts/models/catalog.js +9 -0
  138. package/scripts/models/configuration.js +184 -0
  139. package/scripts/models/credentials.js +132 -0
  140. package/scripts/models/runtime.js +87 -0
  141. package/scripts/output.js +34 -0
  142. package/scripts/packs/connections.js +95 -0
  143. package/scripts/packs/lifecycle.js +125 -0
  144. package/scripts/packs/model.js +66 -0
  145. package/scripts/packs/native.js +69 -0
  146. package/scripts/packs/openshell.js +148 -0
  147. package/scripts/packs/policy.js +189 -0
  148. package/scripts/packs/requirements.in +1 -0
  149. package/scripts/packs/requirements.js +11 -0
  150. package/scripts/packs/requirements.txt +116 -0
  151. package/scripts/packs/source.js +90 -0
  152. package/scripts/packs/transport.py +68 -0
  153. package/scripts/people.js +52 -0
  154. package/scripts/release/create.js +62 -0
  155. package/scripts/release/definition.js +51 -0
  156. package/scripts/session.js +27 -0
  157. package/services/access/generated/client.gen.d.ts +12 -0
  158. package/services/access/generated/client.gen.js +3 -0
  159. package/services/access/generated/fastify.gen.d.ts +49 -0
  160. package/services/access/generated/fastify.gen.js +2 -0
  161. package/services/access/generated/index.d.ts +2 -0
  162. package/services/access/generated/index.js +2 -0
  163. package/services/access/generated/sdk.gen.d.ts +28 -0
  164. package/services/access/generated/sdk.gen.js +107 -0
  165. package/services/access/generated/types.gen.d.ts +349 -0
  166. package/services/access/generated/types.gen.js +2 -0
  167. package/services/access/migrations/001_access.sql +39 -0
  168. package/services/access/migrations/002_administrator_setup.sql +16 -0
  169. package/services/access/migrations/003_local_login_completion.sql +5 -0
  170. package/services/access/migrations/004_invitations.sql +21 -0
  171. package/services/access/repo/postgres.js +341 -0
  172. package/services/access/repo/session-logout.js +28 -0
  173. package/services/access/types/credential.js +2 -0
  174. package/services/access/types/errors.js +7 -0
  175. package/services/access/types/ingress.js +1 -0
  176. package/services/access/types/model.js +1 -0
  177. package/services/access/types/native-errors.js +7 -0
  178. package/services/access/types/native.js +1 -0
  179. package/services/cloud/generated/client.gen.d.ts +12 -0
  180. package/services/cloud/generated/client.gen.js +3 -0
  181. package/services/cloud/generated/index.d.ts +2 -0
  182. package/services/cloud/generated/index.js +2 -0
  183. package/services/cloud/generated/sdk.gen.d.ts +145 -0
  184. package/services/cloud/generated/sdk.gen.js +488 -0
  185. package/services/cloud/generated/types.gen.d.ts +2034 -0
  186. package/services/cloud/generated/types.gen.js +2 -0
  187. package/services/connections/cloud/generated/client.gen.d.ts +12 -0
  188. package/services/connections/cloud/generated/client.gen.js +3 -0
  189. package/services/connections/cloud/generated/fastify.gen.d.ts +68 -0
  190. package/services/connections/cloud/generated/fastify.gen.js +2 -0
  191. package/services/connections/cloud/generated/index.d.ts +2 -0
  192. package/services/connections/cloud/generated/index.js +2 -0
  193. package/services/connections/cloud/generated/sdk.gen.d.ts +95 -0
  194. package/services/connections/cloud/generated/sdk.gen.js +210 -0
  195. package/services/connections/cloud/generated/types.gen.d.ts +1044 -0
  196. package/services/connections/cloud/generated/types.gen.js +2 -0
  197. package/services/connections/migrations/001_connections.sql +220 -0
@@ -0,0 +1,349 @@
1
+ export type ClientOptions = {
2
+ baseUrl: `${string}://services` | (string & {});
3
+ };
4
+ /**
5
+ * Client input failures return 400 (including malformed JSON), 413 for oversized bodies, or 415 for unsupported media types. Native request_rejected returns 409 for a confirmed rejection; outcome_unknown returns 503 when a mutation result cannot be established. Request IDs correlate service failures with sanitized diagnostics.
6
+ */
7
+ export type Problem = {
8
+ type: string;
9
+ title: string;
10
+ status: number;
11
+ code: string;
12
+ detail: string;
13
+ requestId: string;
14
+ };
15
+ export type User = {
16
+ id: string;
17
+ identity: string;
18
+ name: string;
19
+ email: string;
20
+ };
21
+ export type NavigationLink = {
22
+ label: string;
23
+ href: string;
24
+ };
25
+ export type Role = {
26
+ id: string;
27
+ administrator: boolean;
28
+ };
29
+ export type Person = {
30
+ id: string;
31
+ identity: string;
32
+ name: string;
33
+ email: string;
34
+ role: string | null;
35
+ };
36
+ export type Invitation = {
37
+ id: string;
38
+ email: string;
39
+ expiresAt: string;
40
+ status: 'pending' | 'accepted' | 'revoked' | 'expired';
41
+ };
42
+ export type HealthData = {
43
+ body?: never;
44
+ path?: never;
45
+ query?: never;
46
+ url: '/_clawscarf/health';
47
+ };
48
+ export type HealthErrors = {
49
+ /**
50
+ * Failure
51
+ */
52
+ default: Problem;
53
+ };
54
+ export type HealthError = HealthErrors[keyof HealthErrors];
55
+ export type HealthResponses = {
56
+ /**
57
+ * Success
58
+ */
59
+ 200: {
60
+ status: 'ok';
61
+ };
62
+ };
63
+ export type HealthResponse = HealthResponses[keyof HealthResponses];
64
+ export type StartLoginData = {
65
+ body?: never;
66
+ path?: never;
67
+ query?: {
68
+ returnTo?: string;
69
+ /**
70
+ * Private, one-use first-administrator setup token.
71
+ */
72
+ setup?: string;
73
+ /**
74
+ * Private, one-use member invitation token.
75
+ */
76
+ invitation?: string;
77
+ };
78
+ url: '/_clawscarf/login';
79
+ };
80
+ export type StartLoginErrors = {
81
+ /**
82
+ * Failure. Browser requests accepting text/html receive a sign-in error page; API clients receive Problem Details.
83
+ */
84
+ default: Problem;
85
+ };
86
+ export type StartLoginError = StartLoginErrors[keyof StartLoginErrors];
87
+ export type StartLoginResponses = {
88
+ /**
89
+ * Failure. Browser requests accepting text/html receive a sign-in error page; API clients receive Problem Details.
90
+ */
91
+ default: Problem;
92
+ };
93
+ export type StartLoginResponse = StartLoginResponses[keyof StartLoginResponses];
94
+ export type CompleteLoginData = {
95
+ body?: never;
96
+ path?: never;
97
+ query: {
98
+ state: string;
99
+ code?: string;
100
+ error?: string;
101
+ error_description?: string;
102
+ iss?: string;
103
+ };
104
+ url: '/_clawscarf/callback';
105
+ };
106
+ export type CompleteLoginErrors = {
107
+ /**
108
+ * Failure. Browser requests accepting text/html receive a sign-in error page; API clients receive Problem Details.
109
+ */
110
+ default: Problem;
111
+ };
112
+ export type CompleteLoginError = CompleteLoginErrors[keyof CompleteLoginErrors];
113
+ export type CompleteLoginResponses = {
114
+ /**
115
+ * Failure. Browser requests accepting text/html receive a sign-in error page; API clients receive Problem Details.
116
+ */
117
+ default: Problem;
118
+ };
119
+ export type CompleteLoginResponse = CompleteLoginResponses[keyof CompleteLoginResponses];
120
+ export type SessionData = {
121
+ body?: never;
122
+ path?: never;
123
+ query?: never;
124
+ url: '/_clawscarf/session';
125
+ };
126
+ export type SessionErrors = {
127
+ /**
128
+ * Failure
129
+ */
130
+ default: Problem;
131
+ };
132
+ export type SessionError = SessionErrors[keyof SessionErrors];
133
+ export type SessionResponses = {
134
+ /**
135
+ * Success
136
+ */
137
+ 200: {
138
+ user: User;
139
+ csrfToken: string;
140
+ enrollmentEnabled: boolean;
141
+ links: Array<NavigationLink>;
142
+ };
143
+ };
144
+ export type SessionResponse = SessionResponses[keyof SessionResponses];
145
+ export type LogoutData = {
146
+ body?: never;
147
+ path?: never;
148
+ query?: never;
149
+ url: '/_clawscarf/logout';
150
+ };
151
+ export type LogoutErrors = {
152
+ /**
153
+ * Failure
154
+ */
155
+ default: Problem;
156
+ };
157
+ export type LogoutError = LogoutErrors[keyof LogoutErrors];
158
+ export type LogoutResponses = {
159
+ /**
160
+ * Success
161
+ */
162
+ 200: {
163
+ redirect: string;
164
+ };
165
+ };
166
+ export type LogoutResponse = LogoutResponses[keyof LogoutResponses];
167
+ export type ListPeopleData = {
168
+ body?: never;
169
+ path?: never;
170
+ query?: never;
171
+ url: '/_clawscarf/people';
172
+ };
173
+ export type ListPeopleErrors = {
174
+ /**
175
+ * Failure
176
+ */
177
+ default: Problem;
178
+ };
179
+ export type ListPeopleError = ListPeopleErrors[keyof ListPeopleErrors];
180
+ export type ListPeopleResponses = {
181
+ /**
182
+ * Success
183
+ */
184
+ 200: {
185
+ people: Array<Person>;
186
+ /**
187
+ * Current native enrollment configuration, observed without mutation after administrator authorization.
188
+ */
189
+ enrollment: 'ready' | 'preparation_required' | 'configuration_required';
190
+ roles: Array<Role>;
191
+ };
192
+ };
193
+ export type ListPeopleResponse = ListPeopleResponses[keyof ListPeopleResponses];
194
+ export type EnrollPersonData = {
195
+ body: {
196
+ subject: string;
197
+ email: string;
198
+ name: string;
199
+ };
200
+ path?: never;
201
+ query?: never;
202
+ url: '/_clawscarf/people';
203
+ };
204
+ export type EnrollPersonErrors = {
205
+ /**
206
+ * Failure
207
+ */
208
+ default: Problem;
209
+ };
210
+ export type EnrollPersonError = EnrollPersonErrors[keyof EnrollPersonErrors];
211
+ export type EnrollPersonResponses = {
212
+ /**
213
+ * Success
214
+ */
215
+ 200: User;
216
+ };
217
+ export type EnrollPersonResponse = EnrollPersonResponses[keyof EnrollPersonResponses];
218
+ export type RemovePersonData = {
219
+ body?: never;
220
+ path: {
221
+ userId: string;
222
+ };
223
+ query?: never;
224
+ url: '/_clawscarf/people/{userId}';
225
+ };
226
+ export type RemovePersonErrors = {
227
+ /**
228
+ * Failure
229
+ */
230
+ default: Problem;
231
+ };
232
+ export type RemovePersonError = RemovePersonErrors[keyof RemovePersonErrors];
233
+ export type RemovePersonResponses = {
234
+ /**
235
+ * Success
236
+ */
237
+ 200: unknown;
238
+ };
239
+ export type PrepareTeamData = {
240
+ body?: never;
241
+ path?: never;
242
+ query?: never;
243
+ url: '/_clawscarf/team';
244
+ };
245
+ export type PrepareTeamErrors = {
246
+ /**
247
+ * Failure
248
+ */
249
+ default: Problem;
250
+ };
251
+ export type PrepareTeamError = PrepareTeamErrors[keyof PrepareTeamErrors];
252
+ export type PrepareTeamResponses = {
253
+ /**
254
+ * Success
255
+ */
256
+ 200: unknown;
257
+ };
258
+ export type SetPersonRoleData = {
259
+ body: {
260
+ role: string;
261
+ expectedRole: string | null;
262
+ };
263
+ path: {
264
+ userId: string;
265
+ };
266
+ query?: never;
267
+ url: '/_clawscarf/people/{userId}/role';
268
+ };
269
+ export type SetPersonRoleErrors = {
270
+ /**
271
+ * Failure
272
+ */
273
+ default: Problem;
274
+ };
275
+ export type SetPersonRoleError = SetPersonRoleErrors[keyof SetPersonRoleErrors];
276
+ export type SetPersonRoleResponses = {
277
+ /**
278
+ * Success
279
+ */
280
+ 200: unknown;
281
+ };
282
+ export type ListInvitationsData = {
283
+ body?: never;
284
+ path?: never;
285
+ query?: never;
286
+ url: '/_clawscarf/invitations';
287
+ };
288
+ export type ListInvitationsErrors = {
289
+ /**
290
+ * Failure
291
+ */
292
+ default: Problem;
293
+ };
294
+ export type ListInvitationsError = ListInvitationsErrors[keyof ListInvitationsErrors];
295
+ export type ListInvitationsResponses = {
296
+ /**
297
+ * Success
298
+ */
299
+ 200: {
300
+ invitations: Array<Invitation>;
301
+ };
302
+ };
303
+ export type ListInvitationsResponse = ListInvitationsResponses[keyof ListInvitationsResponses];
304
+ export type CreateInvitationData = {
305
+ body: {
306
+ email: string;
307
+ };
308
+ path?: never;
309
+ query?: never;
310
+ url: '/_clawscarf/invitations';
311
+ };
312
+ export type CreateInvitationErrors = {
313
+ /**
314
+ * Failure
315
+ */
316
+ default: Problem;
317
+ };
318
+ export type CreateInvitationError = CreateInvitationErrors[keyof CreateInvitationErrors];
319
+ export type CreateInvitationResponses = {
320
+ /**
321
+ * Success
322
+ */
323
+ 200: {
324
+ invitation: Invitation;
325
+ url: string;
326
+ };
327
+ };
328
+ export type CreateInvitationResponse = CreateInvitationResponses[keyof CreateInvitationResponses];
329
+ export type RevokeInvitationData = {
330
+ body?: never;
331
+ path: {
332
+ invitationId: string;
333
+ };
334
+ query?: never;
335
+ url: '/_clawscarf/invitations/{invitationId}';
336
+ };
337
+ export type RevokeInvitationErrors = {
338
+ /**
339
+ * Failure
340
+ */
341
+ default: Problem;
342
+ };
343
+ export type RevokeInvitationError = RevokeInvitationErrors[keyof RevokeInvitationErrors];
344
+ export type RevokeInvitationResponses = {
345
+ /**
346
+ * Success
347
+ */
348
+ 200: unknown;
349
+ };
@@ -0,0 +1,2 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ export {};
@@ -0,0 +1,39 @@
1
+ -- Up Migration
2
+ CREATE SCHEMA clawscarf_access;
3
+ CREATE TABLE clawscarf_access.users (
4
+ id uuid PRIMARY KEY,
5
+ issuer text NOT NULL,
6
+ subject text NOT NULL,
7
+ email text NOT NULL,
8
+ name text NOT NULL,
9
+ admitted boolean NOT NULL DEFAULT false,
10
+ revision bigint NOT NULL DEFAULT 1 CHECK (revision > 0),
11
+ UNIQUE(issuer,subject)
12
+ );
13
+ CREATE TABLE clawscarf_access.server (
14
+ singleton boolean PRIMARY KEY DEFAULT true CHECK(singleton),
15
+ id uuid NOT NULL UNIQUE,
16
+ administrator_id uuid NOT NULL REFERENCES clawscarf_access.users(id)
17
+ );
18
+ CREATE TABLE clawscarf_access.login_transactions (
19
+ cookie_hash text PRIMARY KEY,
20
+ state_hash text NOT NULL,
21
+ payload text NOT NULL,
22
+ expires_at timestamptz NOT NULL DEFAULT now()+interval '10 minutes'
23
+ );
24
+ CREATE TABLE clawscarf_access.browser_sessions (
25
+ hash text PRIMARY KEY,
26
+ purpose text NOT NULL DEFAULT 'browser' CHECK(purpose IN ('browser','management','enrollment')),
27
+ parent_hash text REFERENCES clawscarf_access.browser_sessions(hash) ON DELETE CASCADE,
28
+ user_id uuid NOT NULL REFERENCES clawscarf_access.users(id),
29
+ admission_revision bigint NOT NULL,
30
+ csrf text NOT NULL,
31
+ logout_redirect text,
32
+ expires_at timestamptz NOT NULL DEFAULT now()+interval '12 hours'
33
+ );
34
+ CREATE TABLE clawscarf_access.local_tokens (
35
+ hash text PRIMARY KEY,
36
+ expires_at timestamptz NOT NULL DEFAULT now()+interval '5 minutes'
37
+ );
38
+ -- Down Migration
39
+ DROP SCHEMA clawscarf_access CASCADE;
@@ -0,0 +1,16 @@
1
+ -- Up Migration
2
+ ALTER TABLE clawscarf_access.server
3
+ ADD COLUMN setup_complete boolean NOT NULL DEFAULT true,
4
+ ADD COLUMN setup_token_hash text,
5
+ ADD COLUMN setup_expires_at timestamptz,
6
+ ADD COLUMN setup_subject text;
7
+ ALTER TABLE clawscarf_access.browser_sessions DROP CONSTRAINT browser_sessions_purpose_check;
8
+ ALTER TABLE clawscarf_access.browser_sessions ADD CONSTRAINT browser_sessions_purpose_check
9
+ CHECK (purpose IN ('browser','management','enrollment','setup'));
10
+ -- Down Migration
11
+ DELETE FROM clawscarf_access.browser_sessions WHERE purpose='setup';
12
+ ALTER TABLE clawscarf_access.browser_sessions DROP CONSTRAINT browser_sessions_purpose_check;
13
+ ALTER TABLE clawscarf_access.browser_sessions ADD CONSTRAINT browser_sessions_purpose_check
14
+ CHECK (purpose IN ('browser','management','enrollment'));
15
+ ALTER TABLE clawscarf_access.server DROP COLUMN setup_complete,
16
+ DROP COLUMN setup_token_hash, DROP COLUMN setup_expires_at, DROP COLUMN setup_subject;
@@ -0,0 +1,5 @@
1
+ -- Up Migration
2
+ ALTER TABLE clawscarf_access.local_tokens ADD COLUMN consumed_at timestamptz;
3
+ -- Down Migration
4
+ DELETE FROM clawscarf_access.local_tokens WHERE consumed_at IS NOT NULL;
5
+ ALTER TABLE clawscarf_access.local_tokens DROP COLUMN consumed_at;
@@ -0,0 +1,21 @@
1
+ -- Up Migration
2
+ CREATE TABLE clawscarf_access.invitations (
3
+ id uuid PRIMARY KEY,
4
+ token_hash text NOT NULL UNIQUE,
5
+ email text NOT NULL,
6
+ sponsor_id uuid NOT NULL REFERENCES clawscarf_access.users(id),
7
+ sponsor_revision bigint NOT NULL,
8
+ subject text,
9
+ expires_at timestamptz NOT NULL DEFAULT now()+interval '7 days',
10
+ accepted_at timestamptz,
11
+ revoked_at timestamptz
12
+ );
13
+ ALTER TABLE clawscarf_access.browser_sessions DROP CONSTRAINT browser_sessions_purpose_check;
14
+ ALTER TABLE clawscarf_access.browser_sessions ADD CONSTRAINT browser_sessions_purpose_check
15
+ CHECK(purpose IN ('browser','management','enrollment','setup','invitation'));
16
+ -- Down Migration
17
+ DELETE FROM clawscarf_access.browser_sessions WHERE purpose='invitation';
18
+ ALTER TABLE clawscarf_access.browser_sessions DROP CONSTRAINT browser_sessions_purpose_check;
19
+ ALTER TABLE clawscarf_access.browser_sessions ADD CONSTRAINT browser_sessions_purpose_check
20
+ CHECK(purpose IN ('browser','management','enrollment','setup'));
21
+ DROP TABLE clawscarf_access.invitations;