@sublang/spex 4.1.0 → 5.0.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 (98) hide show
  1. package/README.md +438 -54
  2. package/dist/cli.js +81 -31
  3. package/dist/commands/add.d.ts +12 -0
  4. package/dist/commands/add.js +138 -0
  5. package/dist/commands/auth-target.d.ts +11 -0
  6. package/dist/commands/auth-target.js +50 -0
  7. package/dist/commands/environment.d.ts +123 -0
  8. package/dist/commands/environment.js +411 -0
  9. package/dist/commands/export.d.ts +21 -0
  10. package/dist/commands/export.js +663 -0
  11. package/dist/commands/home.d.ts +56 -0
  12. package/dist/commands/home.js +215 -0
  13. package/dist/commands/install.d.ts +2 -0
  14. package/dist/commands/install.js +48 -0
  15. package/dist/commands/list.d.ts +2 -0
  16. package/dist/commands/list.js +87 -0
  17. package/dist/commands/login.d.ts +2 -0
  18. package/dist/commands/login.js +211 -0
  19. package/dist/commands/logout.d.ts +2 -0
  20. package/dist/commands/logout.js +74 -0
  21. package/dist/commands/publish.d.ts +2 -0
  22. package/dist/commands/publish.js +120 -0
  23. package/dist/commands/remove.d.ts +2 -0
  24. package/dist/commands/remove.js +34 -0
  25. package/dist/commands/run.d.ts +50 -0
  26. package/dist/commands/run.js +309 -0
  27. package/dist/commands/search.d.ts +2 -0
  28. package/dist/commands/search.js +34 -0
  29. package/dist/commands/settle.d.ts +124 -0
  30. package/dist/commands/settle.js +475 -0
  31. package/dist/commands/update.d.ts +2 -0
  32. package/dist/commands/update.js +37 -0
  33. package/dist/commands/whoami.d.ts +2 -0
  34. package/dist/commands/whoami.js +75 -0
  35. package/dist/lib/environment/agent-folders.d.ts +14 -0
  36. package/dist/lib/environment/agent-folders.js +11 -0
  37. package/dist/lib/environment/archive.d.ts +26 -0
  38. package/dist/lib/environment/archive.js +91 -0
  39. package/dist/lib/environment/builtins.d.ts +112 -0
  40. package/dist/lib/environment/builtins.js +539 -0
  41. package/dist/lib/environment/citations.d.ts +75 -0
  42. package/dist/lib/environment/citations.js +267 -0
  43. package/dist/lib/environment/exports.d.ts +190 -0
  44. package/dist/lib/environment/exports.js +1029 -0
  45. package/dist/lib/environment/format.d.ts +133 -0
  46. package/dist/lib/environment/format.js +651 -0
  47. package/dist/lib/environment/git-source.d.ts +41 -0
  48. package/dist/lib/environment/git-source.js +159 -0
  49. package/dist/lib/environment/index.d.ts +20 -0
  50. package/dist/lib/environment/index.js +27 -0
  51. package/dist/lib/environment/install.d.ts +140 -0
  52. package/dist/lib/environment/install.js +694 -0
  53. package/dist/lib/environment/layout.d.ts +15 -0
  54. package/dist/lib/environment/layout.js +50 -0
  55. package/dist/lib/environment/lock.d.ts +87 -0
  56. package/dist/lib/environment/lock.js +305 -0
  57. package/dist/lib/environment/marker.d.ts +15 -0
  58. package/dist/lib/environment/marker.js +31 -0
  59. package/dist/lib/environment/own-paths.d.ts +59 -0
  60. package/dist/lib/environment/own-paths.js +174 -0
  61. package/dist/lib/environment/placed-record.d.ts +32 -0
  62. package/dist/lib/environment/placed-record.js +72 -0
  63. package/dist/lib/environment/registries.d.ts +25 -0
  64. package/dist/lib/environment/registries.js +75 -0
  65. package/dist/lib/environment/registry.d.ts +173 -0
  66. package/dist/lib/environment/registry.js +390 -0
  67. package/dist/lib/environment/requests.d.ts +108 -0
  68. package/dist/lib/environment/requests.js +403 -0
  69. package/dist/lib/environment/resolve.d.ts +70 -0
  70. package/dist/lib/environment/resolve.js +451 -0
  71. package/dist/lib/environment/semver.d.ts +30 -0
  72. package/dist/lib/environment/semver.js +130 -0
  73. package/dist/lib/environment/store.d.ts +23 -0
  74. package/dist/lib/environment/store.js +123 -0
  75. package/dist/lib/environment/tar.d.ts +27 -0
  76. package/dist/lib/environment/tar.js +219 -0
  77. package/dist/lib/files.d.ts +66 -0
  78. package/dist/lib/files.js +233 -0
  79. package/dist/lib/git-host.d.ts +579 -0
  80. package/dist/lib/git-host.js +1363 -0
  81. package/dist/lib/home-file.d.ts +124 -0
  82. package/dist/lib/home-file.js +288 -0
  83. package/dist/lib/instance.d.ts +63 -0
  84. package/dist/lib/instance.js +130 -0
  85. package/dist/lib/words.d.ts +32 -0
  86. package/dist/lib/words.js +27 -0
  87. package/dist/lint.js +8 -0
  88. package/dist/testing/index.d.ts +1 -0
  89. package/dist/testing/index.js +7 -0
  90. package/dist/testing/standin-registry.d.ts +94 -0
  91. package/dist/testing/standin-registry.js +449 -0
  92. package/package.json +37 -3
  93. package/dist/attached-cli.d.ts +0 -13
  94. package/dist/attached-cli.js +0 -247
  95. package/dist/attached-client.d.ts +0 -36
  96. package/dist/attached-client.js +0 -189
  97. package/dist/generated-protocol.d.ts +0 -2
  98. package/dist/generated-protocol.js +0 -6
@@ -0,0 +1,579 @@
1
+ export { DEFAULT_HOST_URL, hostUrlFor } from "./instance.js";
2
+ /** The public OAuth client id Spex signs in as. */
3
+ export declare const CLIENT_ID = "spex";
4
+ /** An access secret this close to expiring is refreshed first (git-host-4). */
5
+ export declare const REFRESH_MARGIN_MS = 60000;
6
+ /** A browser sign-in without a callback ends `expired` after this long
7
+ * (git-host-2). */
8
+ export declare const BROWSER_SIGN_IN_TIMEOUT_MS: number;
9
+ /** The longest a rate limit holds the calls to the host (git-host-21). */
10
+ export declare const RATE_LIMIT_HOLD_MAX_MS = 120000;
11
+ /** The longest a server's id or a person's id may be in a device
12
+ * request (git-host-27; the instance's own bound). */
13
+ export declare const SEAT_ID_MAX = 64;
14
+ /**
15
+ * The seconds a host's `Retry-After` asks to wait (git-host-11): its
16
+ * number where it is all digits, the seconds from `now` until its HTTP
17
+ * date — none below zero — and null where it is absent or anything else.
18
+ */
19
+ export declare function retryAfterSeconds(value: string | null | undefined, now?: number): number | null;
20
+ /** The person as the host reports them; `canCreateGroup` is whether the
21
+ * host lets them create a group at the top (git-host-5, DR-114), false
22
+ * where it says nothing. */
23
+ export interface HostAccount {
24
+ id: string;
25
+ login: string;
26
+ displayName: string | null;
27
+ canCreateGroup: boolean;
28
+ }
29
+ /** What the host lets the person do in a group (git-host-5, DR-114,
30
+ * DR-120): create a group inside it, add and remove its members, rename
31
+ * it and delete it; false where the host says nothing, as for a
32
+ * repository's group or your own. */
33
+ export interface HostGroupCan {
34
+ createSubgroup: boolean;
35
+ manageMembers: boolean;
36
+ rename: boolean;
37
+ delete: boolean;
38
+ restore?: boolean;
39
+ }
40
+ /** A group as the host answers it (git-host-5): `fullPath` its path in
41
+ * the instance, taken as given (DR-120); `kind` `user` for an account's
42
+ * own group, the person's or another's. No page of the host is held. */
43
+ export interface HostGroup {
44
+ id: string | null;
45
+ fullPath: string;
46
+ name: string;
47
+ kind: "user" | "group";
48
+ can: HostGroupCan;
49
+ pendingDeletion?: boolean;
50
+ deletionRoot?: string;
51
+ }
52
+ export type HostGroupDeletion = {
53
+ status: "scheduled";
54
+ group: HostGroup;
55
+ } | {
56
+ status: "deleted";
57
+ };
58
+ export interface HostGroupContent {
59
+ kind: "project" | "group" | "records" | "server";
60
+ name: string;
61
+ }
62
+ /** One of the host's own roles (git-host-16): the id a client sends
63
+ * back, the host's name for it, and whether it may push. */
64
+ export interface HostRole {
65
+ id: string;
66
+ name: string;
67
+ mayPush: boolean;
68
+ }
69
+ /** The host's description (git-host-5): its name, its Git origin, and
70
+ * the roles it grants in its own order, empty where it lists none. */
71
+ export interface HostDescription {
72
+ displayName: string;
73
+ gitOrigin: string;
74
+ roles: HostRole[];
75
+ }
76
+ /** A group or a spex repository at the host, by the host's id, whose
77
+ * members are read, added or removed (git-host-8, git-host-16,
78
+ * git-host-17). */
79
+ export interface MembersTarget {
80
+ kind: "group" | "repository";
81
+ id: string;
82
+ }
83
+ export interface HostRepository {
84
+ id: string;
85
+ name: string;
86
+ path: string;
87
+ group: HostGroup;
88
+ /** The Git URL the core hands to Git alone (git-host-5, DR-120). */
89
+ remoteUrl: string;
90
+ visibility: string;
91
+ archived: boolean;
92
+ empty: boolean;
93
+ lfs: boolean;
94
+ spexBranch: boolean;
95
+ project: Record<string, unknown> | null;
96
+ /** Whether the host lets the person add and remove its members
97
+ * (git-host-5, DR-114) and move it to another group (DR-120); false
98
+ * where it says nothing. */
99
+ can: {
100
+ manageMembers: boolean;
101
+ transfer: boolean;
102
+ };
103
+ }
104
+ export interface HostRepositoryDetail extends HostRepository {
105
+ readOnly: null | {
106
+ reason: "archived" | "access";
107
+ message: string;
108
+ };
109
+ branch: {
110
+ present: boolean;
111
+ canPush: boolean | null;
112
+ protected: boolean | null;
113
+ blocked: boolean;
114
+ };
115
+ }
116
+ /** A member as the host lists them (git-host-8): `direct` where the
117
+ * membership is the group's or repository's own, else `via` the path in
118
+ * the instance of the group it comes through. */
119
+ export interface HostMember {
120
+ id: string;
121
+ login: string;
122
+ displayName: string | null;
123
+ role: string;
124
+ direct: boolean;
125
+ via: string | null;
126
+ }
127
+ /** A team server the person may open a seat on, as the instance lists it
128
+ * (git-host-29, DR-133): its id, name and address — the https origin it
129
+ * listens at — and its group by the instance's id, path, name and kind,
130
+ * with no abilities. */
131
+ export interface HostServer {
132
+ id: string;
133
+ name: string;
134
+ group: {
135
+ id: string | null;
136
+ fullPath: string;
137
+ name: string;
138
+ kind: "user" | "group";
139
+ };
140
+ address: string;
141
+ }
142
+ /** A ticket the instance minted for a seat on one of its servers
143
+ * (git-host-29): single use and short-lived — `expiresIn` its seconds —
144
+ * presented to the server at its address. A secret: never held after the
145
+ * caller presents it, never in a log or a message. */
146
+ export interface HostTicket {
147
+ ticket: string;
148
+ expiresIn: number;
149
+ server: {
150
+ id: string;
151
+ name: string;
152
+ address: string;
153
+ };
154
+ }
155
+ export type HostErrorKind = "pending" | "name_taken" | "host_refused" | "not_found" | "rate_limited" | "reauth" | "unreachable" | "bad_request";
156
+ /** Why a sign-in ended without an account (git-host-2, git-host-3):
157
+ * `account` a person other than a listed instance's account, `person` a
158
+ * person other than the one a seat's device request named (git-host-27). */
159
+ export type SignInCause = "denied" | "expired" | "stopped" | "refused" | "state" | "unreachable" | "account" | "person";
160
+ /**
161
+ * A host answer other than success (git-host-11). `words` is the host's
162
+ * own message, kept whole; `retryAfter` the host's `Retry-After` for
163
+ * `rate_limited`, raw, read as seconds by `retryAfterSeconds`; `code`
164
+ * the envelope's `error.code` where one came; and,
165
+ * for a sign-in that ended without an account, `cause` names why.
166
+ */
167
+ export declare class HostError extends Error {
168
+ readonly kind: HostErrorKind;
169
+ readonly words: string | null;
170
+ readonly retryAfter: string | null;
171
+ readonly code: string | null;
172
+ readonly status: number | null;
173
+ readonly cause?: SignInCause;
174
+ constructor(kind: HostErrorKind, options?: {
175
+ words?: string | null;
176
+ retryAfter?: string | null;
177
+ code?: string | null;
178
+ status?: number | null;
179
+ cause?: SignInCause;
180
+ });
181
+ }
182
+ /** A call's own Stop ended its wait for the host's rate limit before it
183
+ * was sent (git-host-21). Local; not the host's. */
184
+ export declare class HostWaitStopped extends Error {
185
+ readonly code = "stopped";
186
+ constructor();
187
+ }
188
+ /**
189
+ * How a call meets the host's rate limit (git-host-21): one carrying
190
+ * `signal` — a sync step's, whose Stop aborts it and so ends the wait
191
+ * unsent — or `wait` — the host read's — waits the hold out; any other
192
+ * call made while the hold stands is refused at once as `rate_limited`
193
+ * with the seconds that remain.
194
+ */
195
+ export interface HostCallOptions {
196
+ signal?: AbortSignal;
197
+ wait?: boolean;
198
+ /** Full-view essentials alone opt into deadline-bounded 429 GET recovery. */
199
+ retryRead?: boolean;
200
+ }
201
+ /** The pair a step used was no longer the stored one when its answer
202
+ * came (git-host-4, git-host-10, storage-19): nothing was stored or
203
+ * removed, and the step may be made again. Local; not the host's. */
204
+ export declare class CredentialChanged extends Error {
205
+ readonly code = "changed";
206
+ constructor();
207
+ }
208
+ /** A sign-in started while another runs (git-host-2: a second start is
209
+ * `busy`). */
210
+ export declare class SignInBusyError extends Error {
211
+ readonly code = "busy";
212
+ constructor();
213
+ }
214
+ export type AuthScope = "registry" | "space";
215
+ export interface StoredCredential {
216
+ access: string;
217
+ accessExpiresAt: number;
218
+ refresh: string;
219
+ }
220
+ export interface CredentialStore {
221
+ read(): Promise<StoredCredential | null>;
222
+ /**
223
+ * A versioned write of this host's pair (storage-19, DR-111): `next`,
224
+ * or none, in place of `expected`, the pair the writer read, or none.
225
+ * The file is read, compared and replaced in one synchronous step;
226
+ * false, and nothing written, where it holds another pair.
227
+ */
228
+ replace(expected: StoredCredential | null, next: StoredCredential | null): boolean;
229
+ /**
230
+ * For a sign-out whose read failed (git-host-10, storage-19): remove
231
+ * this host's malformed entry in one synchronous step, other hosts'
232
+ * kept; true where it is gone or none stands, false, and nothing
233
+ * written, where a well-formed pair stands by then. A file of another
234
+ * format is refused.
235
+ */
236
+ removeMalformed?(): boolean;
237
+ }
238
+ /** The path of the credentials file under a home. */
239
+ export declare function credentialsPath(homeDir: string): string;
240
+ /**
241
+ * The app token of one instance in `local/credentials.yaml`, exactly
242
+ * `{format: 1, hosts: {<origin>: {access, accessExpiresAt, refresh}}}`
243
+ * Space entries keyed by canonical origin; registry entries keyed by
244
+ * `registry:<origin>` (DR-168), with no implicit scope upgrade,
245
+ * written atomically with owner-only permissions under a `local/` made
246
+ * owner-only (storage-19). A file of another format is refused, never
247
+ * guessed at or overwritten, and no refusal or warning repeats the file's
248
+ * content, a secret among it: the format is named only where it is a
249
+ * number. Other instances' entries are kept; removing
250
+ * the last one removes the file. Every access is synchronous, so a
251
+ * replacement's read, comparison and rename leave no await between them.
252
+ */
253
+ export declare function fileCredentialStore(homeDir: string, hostUrl: string, scope?: AuthScope): CredentialStore;
254
+ export interface GitHostClientOptions {
255
+ url: string;
256
+ scope?: AuthScope;
257
+ /** The public client id; `spex`. */
258
+ clientId?: string;
259
+ /** This device and app, e.g. "Spex on <hostname>", shown on the host's
260
+ * approval page and device list; cut to 80 characters. */
261
+ label: string;
262
+ credentials: CredentialStore;
263
+ fetch?: typeof fetch;
264
+ now?: () => number;
265
+ /** Called once the client has signed the device out on the host's
266
+ * refusal (git-host-4); never on an explicit `signOut()`. */
267
+ onSignedOut?: (cause: HostErrorKind) => void;
268
+ /** Bound on each host request; a request past it is unreachable. */
269
+ requestTimeoutMs?: number;
270
+ /** Called when an answer of 429 sets the instant the calls are held
271
+ * until (git-host-21), with that instant in Unix milliseconds. */
272
+ onHold?: (until: number) => void;
273
+ /** Test seam (git-host-21): the hold and per-request recovery bounds;
274
+ * 120 s by default. */
275
+ holdMaxMs?: number;
276
+ /** On a seat (git-host-27): the server's id and the admitted person's
277
+ * permanent account id at the instance, which the device request
278
+ * carries as `server_id` and `person_id`; a sign-in whose person bears
279
+ * another id ends `failed`, storing nothing. */
280
+ server?: {
281
+ id: string;
282
+ personId: string;
283
+ };
284
+ }
285
+ /** Whether a sign-in may store its token for the person it read
286
+ * (git-host-2): null admits them; a refusal ends the sign-in `failed`
287
+ * with it, storing nothing. Called in the turn that would store it. */
288
+ export type AdmitAccount = (account: HostAccount) => HostError | null;
289
+ /** The refusal of a sign-in at a listed instance as another person than
290
+ * its entry's account (git-host-2): `words` carries the entry's login. */
291
+ export declare function anotherAccountError(login: string): HostError;
292
+ /** The refusal of a seat's sign-in as a person other than the one its
293
+ * device request named (git-host-27): `words` carries the login the
294
+ * instance signed in. */
295
+ export declare function anotherPersonError(login: string): HostError;
296
+ /** A running browser sign-in (git-host-2). */
297
+ export interface BrowserSignIn {
298
+ /** The host's `/login/app` URL for the system browser. */
299
+ url: string;
300
+ /** The loopback address the host redirects back to. */
301
+ redirectUri: string;
302
+ /** Resolves with the account once the token is stored; rejects with a
303
+ * `HostError` whose `cause` names why the sign-in ended. */
304
+ done: Promise<HostAccount>;
305
+ cancel(): void;
306
+ }
307
+ /** A running device sign-in (git-host-3). */
308
+ export interface DeviceSignIn {
309
+ userCode: string;
310
+ verificationUri: string;
311
+ /** Unix milliseconds. */
312
+ expiresAt: number;
313
+ /** The seconds between polls the host named (git-host-3). */
314
+ interval: number;
315
+ done: Promise<HostAccount>;
316
+ cancel(): void;
317
+ }
318
+ /** Pages the loopback answers the browser with; English by default. */
319
+ export interface CallbackPages {
320
+ complete: string;
321
+ failed: string;
322
+ }
323
+ /**
324
+ * The client of one Git host. Every call to a host route presents the
325
+ * stored access secret and keeps the app token current (git-host-4);
326
+ * `describe()` alone needs no token.
327
+ */
328
+ export declare class GitHostClient {
329
+ readonly url: string;
330
+ readonly scope: AuthScope;
331
+ private readonly clientId;
332
+ private readonly label;
333
+ private readonly credentials;
334
+ private readonly fetchImpl;
335
+ private readonly now;
336
+ private readonly onSignedOut?;
337
+ private readonly requestTimeoutMs;
338
+ private readonly onHold?;
339
+ private readonly holdMaxMs;
340
+ private readonly server?;
341
+ private refreshing;
342
+ private signIn;
343
+ /** The instant the host's last rate limit asked every call to wait
344
+ * until (git-host-21); 0 where none holds. */
345
+ private holdUntil;
346
+ constructor(options: GitHostClientOptions);
347
+ /** Whether the host's rate limit holds the calls now (git-host-21). */
348
+ holding(): boolean;
349
+ /** `GET /api/v1/host`: the host's display name, the Git origin its
350
+ * credentials are valid for, and the roles it grants (git-host-5). */
351
+ describe(options?: HostCallOptions): Promise<HostDescription>;
352
+ /** Whether this device holds an app token for the host. */
353
+ signedIn(): Promise<boolean>;
354
+ /** Whether a sign-in is running. */
355
+ signingIn(): boolean;
356
+ /**
357
+ * The browser flow with PKCE (git-host-2): a loopback listener on
358
+ * `127.0.0.1` at an OS-assigned port for one callback, an S256
359
+ * challenge, and the host's `/login/app` URL to open.
360
+ */
361
+ startBrowserSignIn(options?: {
362
+ timeoutMs?: number;
363
+ pages?: CallbackPages;
364
+ admit?: AdmitAccount;
365
+ }): Promise<BrowserSignIn>;
366
+ private answerCallback;
367
+ /**
368
+ * The device flow (git-host-3): the host's user code and verification
369
+ * URL, completed with the code where the host gives it, then polling the token endpoint at its interval, five seconds
370
+ * slower on each `slow_down`, until the token, a denial or the expiry.
371
+ * On a seat, `ticket` is the one the member's client presented for it,
372
+ * on which the host may grant the code without its page (git-host-27).
373
+ */
374
+ startDeviceSignIn(options?: {
375
+ admit?: AdmitAccount;
376
+ ticket?: string;
377
+ }): Promise<DeviceSignIn>;
378
+ /**
379
+ * Sign this device out (git-host-10): revoke it at the host with its
380
+ * app token, tried once, and remove that pair either way, calling
381
+ * `onRemoved` in the same turn as the removal. Where another pair was
382
+ * stored in its place meanwhile, that pair stays, `onRemoved` is not
383
+ * called, and `CredentialChanged` is thrown. A malformed entry, which
384
+ * cannot be read, is removed unless a well-formed pair stands by then.
385
+ */
386
+ signOut(onRemoved?: () => void): Promise<void>;
387
+ /** Whether no pair is stored for this host now, read synchronously so
388
+ * a caller acts on it in the same turn. */
389
+ holdsNone(): boolean;
390
+ /** The selected purpose's account; registry identity needs no host API. */
391
+ me(options?: HostCallOptions): Promise<HostAccount>;
392
+ /** `GET /api/v1/host/groups`: the person's own group and every group
393
+ * they belong to. */
394
+ groups(options?: HostCallOptions): Promise<HostGroup[]>;
395
+ /** `GET /api/v1/host/repositories`, every page. */
396
+ repositories(options?: HostCallOptions): Promise<HostRepository[]>;
397
+ /** `GET /api/v1/host/repositories/:id`, with its read-only state and
398
+ * the `spex` branch's. */
399
+ repository(id: string, options?: HostCallOptions): Promise<HostRepositoryDetail>;
400
+ /** `GET /api/v1/host/repositories/:id/members` or
401
+ * `GET /api/v1/host/groups/:id/members` (git-host-8): every member with
402
+ * the host's role name and source. */
403
+ members(target: MembersTarget, options?: HostCallOptions): Promise<{
404
+ members: HostMember[];
405
+ }>;
406
+ /**
407
+ * `POST /api/v1/host/groups` (git-host-15): a private group named
408
+ * `name` at the path `path`, inside the group `parentId` or at the top
409
+ * where it is null. A taken name throws `name_taken`, the host's
410
+ * refusal `host_refused` with its words.
411
+ */
412
+ createGroup(input: {
413
+ name: string;
414
+ path: string;
415
+ parentId: string | null;
416
+ }): Promise<HostGroup>;
417
+ /**
418
+ * `PATCH /api/v1/host/groups/:id` (git-host-18): give a group of the
419
+ * instance the name, the path segment, or both, given. A path taken
420
+ * there throws `name_taken`, the host's refusal `host_refused` with
421
+ * its words.
422
+ */
423
+ renameGroup(id: string, input: {
424
+ name?: string;
425
+ path?: string;
426
+ }): Promise<HostGroup>;
427
+ /** Request normal deletion through the confirmation-aware route
428
+ * (git-host-19). Older deployments are refused, never retried through
429
+ * the legacy route, whose behavior may permanently delete a group. */
430
+ deleteGroup(id: string, confirmPath?: string): Promise<HostGroupDeletion>;
431
+ /** Read the Space's current contents, including contents omitted from
432
+ * the records listing. Members are not contents. */
433
+ inspectGroupDeletion(id: string): Promise<{
434
+ group: HostGroup;
435
+ contents: HostGroupContent[];
436
+ }>;
437
+ /** Restore the group's normal scheduled deletion, where the Space
438
+ * permits it; no retention period is inferred by the client. */
439
+ restoreGroup(id: string): Promise<HostGroup>;
440
+ /**
441
+ * `POST /api/v1/host/repositories/:id/transfer` (git-host-20): move a
442
+ * spex repository into the group `groupId`, or the person's own group
443
+ * where it is null. A name taken there throws `name_taken`, the host's
444
+ * refusal `host_refused` with its words.
445
+ */
446
+ transferRepository(id: string, groupId: string | null): Promise<HostRepository>;
447
+ /**
448
+ * `POST …/members` (git-host-16): add the account the host lists under
449
+ * exactly `login` to the group or repository at the role whose id is
450
+ * `role`. No such account throws `not_found` with the host's words
451
+ * naming the login; a refusal `host_refused` with its words.
452
+ */
453
+ addMember(target: MembersTarget, input: {
454
+ login: string;
455
+ role: string;
456
+ }): Promise<HostMember>;
457
+ /**
458
+ * `DELETE …/members/:login` (git-host-17): remove the account under
459
+ * `login` from the group's or repository's own members. No account, or
460
+ * no membership of its own there, throws `not_found` with the host's
461
+ * words; a refusal `host_refused` with its words.
462
+ */
463
+ removeMember(target: MembersTarget, login: string): Promise<void>;
464
+ /**
465
+ * `POST /api/v1/host/repositories` (git-host-6): `name` is the whole
466
+ * repository name, `<name>-spex`; `groupId` null means the person's own
467
+ * group. A taken name throws `name_taken`.
468
+ */
469
+ create(input: {
470
+ groupId: string | null;
471
+ name: string;
472
+ description: string;
473
+ }): Promise<{
474
+ status: "created";
475
+ repository: HostRepository;
476
+ } | {
477
+ status: "pending";
478
+ message: string;
479
+ }>;
480
+ /** `POST /api/v1/host/repositories/:id/spex-branch` (git-host-7). */
481
+ prepareBranch(id: string, options?: HostCallOptions): Promise<{
482
+ status: "ready";
483
+ } | {
484
+ status: "pending";
485
+ message: string;
486
+ }>;
487
+ /**
488
+ * `GET /api/v1/host/servers` (git-host-29): the servers the person may
489
+ * open a seat on, as the instance answers them, in its order. The
490
+ * client keeps nothing of the answer.
491
+ */
492
+ servers(options?: HostCallOptions): Promise<HostServer[]>;
493
+ /**
494
+ * `POST /api/v1/host/servers/:id/tickets` (git-host-29): a ticket for a
495
+ * seat on the server `id`, as the instance answers it; the client keeps
496
+ * nothing of it. A server the instance does not list for the person
497
+ * throws `not_found`, a membership below the role it needs
498
+ * `host_refused`, each with the instance's words.
499
+ */
500
+ ticket(id: string, options?: HostCallOptions): Promise<HostTicket>;
501
+ /** `POST /api/v1/host/credential` (git-host-9): the Git credential for
502
+ * the host's Git origin, with its expiry in Unix milliseconds. */
503
+ credential(origin: string, options?: HostCallOptions): Promise<{
504
+ username: string;
505
+ secret: string;
506
+ expiresAt: number;
507
+ }>;
508
+ /**
509
+ * The access secret a call to the host presents now, for a client of
510
+ * the same host outside this one — the registry (environments-12):
511
+ * kept current as every call's is (git-host-4), refreshed first where
512
+ * it is within a minute of expiring; null where this device holds no
513
+ * app token, or the host refused the refresh and so signed it out.
514
+ * An unreachable host or a rate limit is thrown as the host answered.
515
+ */
516
+ accessSecret(): Promise<string | null>;
517
+ /**
518
+ * A client of the same host outside this one — the registry
519
+ * (environments-12) — was refused `access` with a code that signs the
520
+ * device out: as a refusal of this client's own call does (git-host-4),
521
+ * the pair that presented it is removed and the device signed out of
522
+ * this host alone in one step, `onSignedOut` called; true then. Where
523
+ * it is no longer the stored pair's — a sign-in, a refresh or a
524
+ * sign-out meanwhile — nothing is removed or said, and false comes
525
+ * back: the call stands refused as changed meanwhile.
526
+ */
527
+ signOutRefused(access: string): Promise<boolean>;
528
+ private claimSignIn;
529
+ /** Claim the one sign-in, and read the pair it begins over: its token
530
+ * is stored only in that pair's place (git-host-2). */
531
+ private beginSignIn;
532
+ private releaseSignIn;
533
+ /** The issued app token and the person read with it, nothing stored
534
+ * yet; a person the host does not return throws (git-host-2). */
535
+ private issued;
536
+ /** Store an issued token in place of the pair its sign-in began over;
537
+ * the caller ends the sign-in in the same turn. On a seat, a person
538
+ * bearing another permanent id than the one the request named ends it
539
+ * naming the account signed in (git-host-27); a person `admit` refuses
540
+ * ends it with that refusal; and another pair stored meanwhile ends it
541
+ * `stopped`, that pair kept: each stores nothing (git-host-2). */
542
+ private publish;
543
+ /** A host route with the bearer kept current (git-host-4). Only a
544
+ * success, `202` included, comes back; everything else throws.
545
+ * `signal` ends the call's wait for the host's rate limit (git-host-21). */
546
+ private call;
547
+ /** The pair a call presents, refreshed first near its expiry; the
548
+ * refresh waits out the host's rate limit where the call does
549
+ * (git-host-21). */
550
+ private current;
551
+ /** One refresh at a time: a caller arriving while one runs joins it,
552
+ * and one arriving after it finds the rotated pair already stored.
553
+ * Where another pair replaced the refreshed one meanwhile, the answer
554
+ * stores and removes nothing, and `CredentialChanged` is thrown. */
555
+ private refresh;
556
+ private runRefresh;
557
+ /** The host refused `used` (git-host-4): remove it and say the device
558
+ * is signed out in the same turn, giving back `refusal` to throw;
559
+ * where another pair is stored in its place, nothing is removed or
560
+ * said, and `CredentialChanged` comes back instead. */
561
+ private signOutLocally;
562
+ /** Wait out the host's rate limit (git-host-21): until the instant it
563
+ * holds, again where a later answer moves it on meanwhile; `signal`
564
+ * ends the wait. The timer keeps no process alive. */
565
+ private waitOut;
566
+ /** An answer of 429 holds the calls until the instant it asks for —
567
+ * its time plus its seconds, `holdMaxMs` at most — keeping a later
568
+ * instant already held; none where its seconds are unknown
569
+ * (git-host-21). */
570
+ private hold;
571
+ /** A call that does not wait, made while the hold stands, is refused
572
+ * at once as the host asking to wait the seconds that remain
573
+ * (git-host-21). */
574
+ private refuseWhileHeld;
575
+ /** One request to the host. A call carrying a signal, or asked to
576
+ * wait, waits out the host's rate limit first; any other is refused
577
+ * while it holds (git-host-21). */
578
+ private send;
579
+ }