@fabrika/control-contract 0.9.0-dev.3 → 0.9.0-dev.30

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.
@@ -43,6 +43,18 @@ export declare const CONTROL_ACTIONS: Readonly<{
43
43
  MAIL_CONTENT_READ: "mail.content.read";
44
44
  /** Release or drop a held message, requeue a final one, and change the gate's rules. Global. */
45
45
  MAIL_MANAGE: "mail.manage";
46
+ /**
47
+ * Read an application environment's data as a metadata projection: sizes, counts, state and the backup list
48
+ * (ADR-0069 §2). Scoped by app/environment.
49
+ */
50
+ DATA_READ: "data.read";
51
+ /**
52
+ * Read row contents, exports, backup downloads and content fields of every tenant of an environment. Checked as a
53
+ * global grant only, so a grant scoped to an app never carries it: content is for the installation's operators.
54
+ */
55
+ DATA_CONTENT_READ: "data.content.read";
56
+ /** Run maintenance transitions, backups and restores, and recover an interrupted operation. Scoped by app/environment. */
57
+ DATA_MANAGE: "data.manage";
46
58
  }>;
47
59
  /**
48
60
  * The scope dimensions Control authorizes within (flat + independent IAM semantics):
@@ -0,0 +1,111 @@
1
+ import { type AccessChangeDto, type ChangeAudienceDto, type ChangeSubjectDto, type ChangeSubjectKind, type SurfaceReach } from './index.js';
2
+ /**
3
+ * Whether a change waits for a person on a protected environment (ADR-0050 §3): it has a line that needs closer review,
4
+ * a step off the paved road, something anyone sets off, people becoming visible or a migration that may change stored
5
+ * data. Any other change publishes at once, its lines recorded.
6
+ */
7
+ export declare function waitsForApproval(changes: readonly Pick<AccessChangeDto, 'review'>[]): boolean;
8
+ /**
9
+ * The endpoints of one caller group: everyone a reach admits, or the holders of one link mount's share links. `people`
10
+ * marks the machine endpoints that signed-in people reach too, a group of their own, so its title names both.
11
+ */
12
+ export interface CallerGroup {
13
+ readonly kind: 'caller';
14
+ readonly key: string;
15
+ readonly reach: SurfaceReach;
16
+ readonly mount?: string;
17
+ readonly people?: true;
18
+ }
19
+ /** The lines about one kind of subject other than an endpoint: tables, roles, migrations, the application. */
20
+ export interface SubjectGroup {
21
+ readonly kind: 'subject';
22
+ readonly key: string;
23
+ readonly subject: ChangeSubjectKind;
24
+ }
25
+ /** One subject and its lines, most important first. */
26
+ export interface SubjectRow {
27
+ readonly kind: 'subject';
28
+ readonly subject: ChangeSubjectDto;
29
+ readonly audience?: ChangeAudienceDto;
30
+ readonly changes: readonly AccessChangeDto[];
31
+ }
32
+ /**
33
+ * Quiet subjects that changed alike: each has lines of exactly these rules and effects, and none of them widens or needs
34
+ * closer review (`rules` in order, as `rule` and `effect`).
35
+ */
36
+ export interface FoldedRow {
37
+ readonly kind: 'folded';
38
+ readonly rules: readonly {
39
+ readonly rule: string;
40
+ readonly effect: 'narrows' | 'neutral';
41
+ }[];
42
+ readonly subjects: readonly SubjectRow[];
43
+ }
44
+ export type ChangeRow = SubjectRow | FoldedRow;
45
+ export interface EffectTally {
46
+ readonly widens: number;
47
+ readonly narrows: number;
48
+ readonly neutral: number;
49
+ readonly closer: number;
50
+ }
51
+ /** A group's subjects by what their lines do: how many there are, how many widen access, how many need closer review. */
52
+ export interface SubjectTally {
53
+ readonly subjects: number;
54
+ readonly widening: number;
55
+ readonly closer: number;
56
+ }
57
+ export type ChangeGroup = (CallerGroup | SubjectGroup) & {
58
+ readonly rows: readonly ChangeRow[];
59
+ /** How many subjects the group holds, folded ones included. */
60
+ readonly subjects: number;
61
+ /** The group's lines by effect. */
62
+ readonly tally: EffectTally;
63
+ /** The group's subjects (its rows' endpoints, tables, …) by effect: what its heading counts. */
64
+ readonly standing: SubjectTally;
65
+ /** Whether the page collapses the group by default: only when it holds no widening line. */
66
+ readonly collapsed: boolean;
67
+ };
68
+ export interface ApprovalView {
69
+ /**
70
+ * The change in a sentence or two, which the page leads with: the endpoints it adds, changes and removes, and what to
71
+ * check first. `check` is every line that needs closer review, the most important first; without one, the widening
72
+ * line most worth a look: a new endpoint the most exposed callers reach, else the most exposed widening. Empty when
73
+ * nothing widens or needs closer review.
74
+ */
75
+ readonly summary: {
76
+ readonly added: number;
77
+ readonly changed: number;
78
+ readonly removed: number;
79
+ readonly check: readonly AccessChangeDto[];
80
+ };
81
+ /**
82
+ * Per caller group the endpoints that change, apart from the removed endpoints and mounts its paths reach (a removal
83
+ * that widens stands with whoever its paths reach now), and the migration files the change adds or edits.
84
+ */
85
+ readonly impact: {
86
+ readonly callers: readonly {
87
+ readonly key: string;
88
+ readonly reach: SurfaceReach;
89
+ readonly mount?: string;
90
+ readonly people?: true;
91
+ readonly endpoints: number;
92
+ readonly removedEndpoints: number;
93
+ readonly removedMounts: number;
94
+ }[];
95
+ readonly migrations: number;
96
+ };
97
+ readonly callers: readonly ChangeGroup[];
98
+ readonly data: readonly ChangeGroup[];
99
+ /** The lines of a run classified before lines carried facts, in their stored order. */
100
+ readonly unsorted: readonly AccessChangeDto[];
101
+ }
102
+ /** Quiet subjects that changed alike fold from this many on. */
103
+ export declare const FOLD_AT = 3;
104
+ /**
105
+ * A line's rank: a widening for closer review first, then a widening, a narrowing for closer review, a line that leaves
106
+ * access unchanged, a narrowing. Nothing else enters it, so it cannot disagree with the classification.
107
+ */
108
+ export declare function changeRank(change: Pick<AccessChangeDto, 'effect' | 'review'>): number;
109
+ export declare function approvalView(changes: readonly AccessChangeDto[]): ApprovalView;
110
+ /** Every line a row holds. */
111
+ export declare function rowChanges(row: ChangeRow): readonly AccessChangeDto[];
@@ -41,23 +41,23 @@ export declare const builderConnectionAppSchema: z.ZodEffects<z.ZodObject<{
41
41
  createdAt: z.ZodNumber;
42
42
  }, "strict", z.ZodTypeAny, {
43
43
  id: string;
44
+ createdAt: number;
44
45
  repoUrl: string;
45
46
  defaultBranch: string;
46
47
  workerDir: string | null;
47
48
  buildCmd: string | null;
48
49
  configPath: string | null;
49
50
  githubInstallationId: number | null;
50
- createdAt: number;
51
51
  githubConnectionId?: string | null | undefined;
52
52
  }, {
53
53
  id: string;
54
+ createdAt: number;
54
55
  repoUrl: string;
55
56
  defaultBranch: string;
56
57
  workerDir: string | null;
57
58
  buildCmd: string | null;
58
59
  configPath: string | null;
59
60
  githubInstallationId: number | null;
60
- createdAt: number;
61
61
  githubConnectionId?: string | null | undefined;
62
62
  }>, {
63
63
  githubInstallationId: number | null;
@@ -71,13 +71,13 @@ export declare const builderConnectionAppSchema: z.ZodEffects<z.ZodObject<{
71
71
  configPath: string | null;
72
72
  }, {
73
73
  id: string;
74
+ createdAt: number;
74
75
  repoUrl: string;
75
76
  defaultBranch: string;
76
77
  workerDir: string | null;
77
78
  buildCmd: string | null;
78
79
  configPath: string | null;
79
80
  githubInstallationId: number | null;
80
- createdAt: number;
81
81
  githubConnectionId?: string | null | undefined;
82
82
  }>;
83
83
  export declare const builderConnectionEnvironmentSchema: z.ZodObject<{
@@ -89,15 +89,15 @@ export declare const builderConnectionEnvironmentSchema: z.ZodObject<{
89
89
  }, "strict", z.ZodTypeAny, {
90
90
  env: string;
91
91
  domain: string | null;
92
+ namespaceId: string | null;
92
93
  publicOrigin: string | null;
93
94
  triggerRef: string | null;
94
- namespaceId: string | null;
95
95
  }, {
96
96
  env: string;
97
97
  domain: string | null;
98
+ namespaceId: string | null;
98
99
  publicOrigin: string | null;
99
100
  triggerRef: string | null;
100
- namespaceId: string | null;
101
101
  }>;
102
102
  export declare const builderConnectionReceiptSchema: z.ZodObject<{
103
103
  version: z.ZodLiteral<1>;
@@ -115,23 +115,23 @@ export declare const builderConnectionReceiptSchema: z.ZodObject<{
115
115
  createdAt: z.ZodNumber;
116
116
  }, "strict", z.ZodTypeAny, {
117
117
  id: string;
118
+ createdAt: number;
118
119
  repoUrl: string;
119
120
  defaultBranch: string;
120
121
  workerDir: string | null;
121
122
  buildCmd: string | null;
122
123
  configPath: string | null;
123
124
  githubInstallationId: number | null;
124
- createdAt: number;
125
125
  githubConnectionId?: string | null | undefined;
126
126
  }, {
127
127
  id: string;
128
+ createdAt: number;
128
129
  repoUrl: string;
129
130
  defaultBranch: string;
130
131
  workerDir: string | null;
131
132
  buildCmd: string | null;
132
133
  configPath: string | null;
133
134
  githubInstallationId: number | null;
134
- createdAt: number;
135
135
  githubConnectionId?: string | null | undefined;
136
136
  }>, {
137
137
  githubInstallationId: number | null;
@@ -145,13 +145,13 @@ export declare const builderConnectionReceiptSchema: z.ZodObject<{
145
145
  configPath: string | null;
146
146
  }, {
147
147
  id: string;
148
+ createdAt: number;
148
149
  repoUrl: string;
149
150
  defaultBranch: string;
150
151
  workerDir: string | null;
151
152
  buildCmd: string | null;
152
153
  configPath: string | null;
153
154
  githubInstallationId: number | null;
154
- createdAt: number;
155
155
  githubConnectionId?: string | null | undefined;
156
156
  }>;
157
157
  environment: z.ZodObject<{
@@ -163,15 +163,15 @@ export declare const builderConnectionReceiptSchema: z.ZodObject<{
163
163
  }, "strict", z.ZodTypeAny, {
164
164
  env: string;
165
165
  domain: string | null;
166
+ namespaceId: string | null;
166
167
  publicOrigin: string | null;
167
168
  triggerRef: string | null;
168
- namespaceId: string | null;
169
169
  }, {
170
170
  env: string;
171
171
  domain: string | null;
172
+ namespaceId: string | null;
172
173
  publicOrigin: string | null;
173
174
  triggerRef: string | null;
174
- namespaceId: string | null;
175
175
  }>;
176
176
  createdAt: z.ZodNumber;
177
177
  }, "strict", z.ZodTypeAny, {
@@ -189,35 +189,35 @@ export declare const builderConnectionReceiptSchema: z.ZodObject<{
189
189
  environment: {
190
190
  env: string;
191
191
  domain: string | null;
192
+ namespaceId: string | null;
192
193
  publicOrigin: string | null;
193
194
  triggerRef: string | null;
194
- namespaceId: string | null;
195
195
  };
196
196
  attemptId: string;
197
197
  version: 1;
198
- provider: string;
199
198
  createdAt: number;
199
+ provider: string;
200
200
  }, {
201
201
  app: {
202
202
  id: string;
203
+ createdAt: number;
203
204
  repoUrl: string;
204
205
  defaultBranch: string;
205
206
  workerDir: string | null;
206
207
  buildCmd: string | null;
207
208
  configPath: string | null;
208
209
  githubInstallationId: number | null;
209
- createdAt: number;
210
210
  githubConnectionId?: string | null | undefined;
211
211
  };
212
212
  environment: {
213
213
  env: string;
214
214
  domain: string | null;
215
+ namespaceId: string | null;
215
216
  publicOrigin: string | null;
216
217
  triggerRef: string | null;
217
- namespaceId: string | null;
218
218
  };
219
219
  attemptId: string;
220
220
  version: 1;
221
- provider: string;
222
221
  createdAt: number;
222
+ provider: string;
223
223
  }>;
@@ -46,6 +46,8 @@ export interface GitHubSourceRepositoryDto {
46
46
  readonly owner: string;
47
47
  readonly name: string;
48
48
  }
49
+ /** Who owns a connection's GitHub App: an organization, or a personal account. */
50
+ export type GitHubSourceOwnerType = 'Organization' | 'User';
49
51
  export interface GitHubSourceConnectionAppDto {
50
52
  readonly id: number;
51
53
  readonly slug: string;
@@ -53,7 +55,7 @@ export interface GitHubSourceConnectionAppDto {
53
55
  readonly public: boolean;
54
56
  readonly owner: {
55
57
  readonly login: string;
56
- readonly type: 'Organization';
58
+ readonly type: GitHubSourceOwnerType;
57
59
  };
58
60
  readonly permissions: {
59
61
  readonly contents: 'read';
@@ -82,6 +84,10 @@ export interface GitHubSourceConnectionSetupPendingDto extends GitHubSourceConne
82
84
  readonly phase: 'starting' | 'awaiting-manifest-callback' | 'persisting' | 'activating';
83
85
  /** Present only while the same-origin manifest handoff can be resumed. */
84
86
  readonly continuePath?: string;
87
+ /** Present while a handoff link for an organization owner is outstanding: when it, and the setup, expire. */
88
+ readonly handoff?: {
89
+ readonly expiresAt: number;
90
+ };
85
91
  }
86
92
  export interface GitHubSourceConnectionInstallationRequiredDto extends GitHubSourceConnectionBaseDto {
87
93
  readonly state: 'installation-required';
@@ -116,13 +122,19 @@ export interface GitHubSourceConnectionListResponse {
116
122
  export interface GitHubSourceConnectionRepairRequiredDto extends GitHubSourceConnectionBaseDto {
117
123
  readonly state: 'repair-required';
118
124
  readonly connectionId: string;
119
- readonly reason: 'interrupted-setup' | 'credential-activation' | 'installation-verification';
125
+ readonly reason: 'interrupted-setup' | 'credential-activation' | 'installation-verification' | 'rate-limited';
120
126
  readonly app?: GitHubSourceConnectionAppDto;
121
127
  }
122
128
  /** Browser-safe setup state. It never carries a private key, webhook secret, token, or source RPC key. */
123
129
  export type GitHubSourceConnectionStatusDto = GitHubSourceConnectionAnonymousDto | GitHubSourceConnectionUnavailableDto | GitHubSourceConnectionSetupPendingDto | GitHubSourceConnectionInstallationRequiredDto | GitHubSourceConnectionConnectedDto | GitHubSourceConnectionRepairRequiredDto;
124
130
  export interface StartGitHubSourceConnectionRequest {
131
+ /** The App owner's login: the organization's, or the personal account's when `ownerType` is `User`. */
125
132
  readonly organization: string;
133
+ /**
134
+ * Absent means `Organization`. GitHub creates a personal account's App on whichever account is signed in, so the
135
+ * person who continues the setup must be signed in to GitHub as that account.
136
+ */
137
+ readonly ownerType?: GitHubSourceOwnerType;
126
138
  readonly appName: string;
127
139
  readonly visibility: 'private' | 'public';
128
140
  readonly repositories: readonly GitHubSourceRepositoryDto[];
@@ -132,6 +144,26 @@ export interface StartGitHubSourceConnectionResponse {
132
144
  /** Same-origin path that starts the GitHub manifest handoff. */
133
145
  readonly continuePath: string;
134
146
  }
147
+ export interface GitHubSourceConnectionHandoffInput {
148
+ readonly connectionId: string;
149
+ /** How long the link stays usable: 600 to 86400 seconds, 3600 when omitted. It holds the one setup slot that long. */
150
+ readonly expiresInSeconds?: number;
151
+ }
152
+ /** The setup that was cancelled before GitHub created its App. */
153
+ export interface GitHubSourceConnectionCancelDto {
154
+ readonly connectionId: string;
155
+ }
156
+ /**
157
+ * A link for an owner of the organization who has no console session: opening it posts the manifest, and the owner
158
+ * creates and installs the App from their own browser. Shown once; a new one replaces it.
159
+ */
160
+ export interface GitHubSourceConnectionHandoffDto {
161
+ readonly connectionId: string;
162
+ /** Absolute URL on the console's origin; it carries the token, so treat it as a secret. */
163
+ readonly url: string;
164
+ /** Unix seconds after which the link, and the setup it belongs to, expire. */
165
+ readonly expiresAt: number;
166
+ }
135
167
  /** One redacted line of deploy output: the runner's NDJSON log line and the control API's view of it. */
136
168
  export declare const runLogLineSchema: z.ZodObject<{
137
169
  ts: z.ZodNumber;
@@ -140,11 +172,11 @@ export declare const runLogLineSchema: z.ZodObject<{
140
172
  }, "strip", z.ZodTypeAny, {
141
173
  text: string;
142
174
  ts: number;
143
- stream: "stdout" | "stderr" | "meta";
175
+ stream: "meta" | "stdout" | "stderr";
144
176
  }, {
145
177
  text: string;
146
178
  ts: number;
147
- stream: "stdout" | "stderr" | "meta";
179
+ stream: "meta" | "stdout" | "stderr";
148
180
  }>;
149
181
  export type RunLogLine = z.infer<typeof runLogLineSchema>;
150
182
  /** Backward-compatible short name for browser consumers. */
@@ -205,12 +237,79 @@ export interface AppEnvDto {
205
237
  deviationSubjects: DeviationSubjectDto[];
206
238
  /** The published snapshot's endpoints as the outside reaches them, most exposed first; empty until a run publishes one. */
207
239
  surface: SurfaceEndpointDto[];
240
+ /**
241
+ * The published snapshot's roles and what each action of theirs reaches; empty until a run publishes one. Absent from
242
+ * a Control released before it.
243
+ */
244
+ accessMap?: AccessMapDto;
208
245
  namespaceId: string | null;
209
246
  provider: string;
210
247
  target: ProviderEnvelopeDto;
211
248
  artifact: ProviderEnvelopeDto;
212
249
  createdAt: number;
213
250
  }
251
+ /**
252
+ * A contract's access read by role: each role and the actions it holds, and, once per action, the endpoints that require
253
+ * it and the tables it reaches. Actions are listed once, so a large contract does not repeat its endpoints per role.
254
+ */
255
+ export interface AccessMapDto {
256
+ roles: AccessMapRoleDto[];
257
+ /** Every action a role holds, by name, in name order. */
258
+ actions: AccessMapActionDto[];
259
+ /** The endpoints any member reaches, whatever role it holds, by path. */
260
+ memberEndpoints: AccessMapEndpointDto[];
261
+ }
262
+ export interface AccessMapRoleDto {
263
+ role: string;
264
+ /** The dimension a membership role is granted in; null for an application-wide role, granted globally. */
265
+ scope: string | null;
266
+ /** The roles whose holders assign it in a value of `scope`; empty for an application-wide role. */
267
+ assignableBy: string[];
268
+ /** The dimensions whose new values grant it to their creator, in name order. */
269
+ creatorOf: string[];
270
+ /** An external principal may hold it (ADR-0051). */
271
+ external: boolean;
272
+ /** The actions it grants, in name order. */
273
+ actions: string[];
274
+ /** The actions its holder holds at each node a row of the relation names them at, by relation, in name order. */
275
+ via: {
276
+ relation: string;
277
+ dimension: string;
278
+ actions: string[];
279
+ conferredBy: string[];
280
+ }[];
281
+ }
282
+ /** An endpoint a role's holder may call: `access` says where its action must be held (`on deal`, `app-wide`). */
283
+ export interface AccessMapEndpointDto {
284
+ id: string;
285
+ method: EndpointMethod;
286
+ path: string;
287
+ access: string;
288
+ /** The callers among role holders: `human` (a person), `machine` (a script's key). */
289
+ callers: string[];
290
+ }
291
+ export interface AccessMapActionDto {
292
+ action: string;
293
+ description: string;
294
+ /** The endpoints whose requirement names it and that a person or a script calls, by path. */
295
+ endpoints: AccessMapEndpointDto[];
296
+ /** What it does to people: `manage the members of each org`, `list the application's members`. */
297
+ members: string[];
298
+ /** The share links it issues: `issue share links of shared to a note, which grant notes.read`. */
299
+ links: string[];
300
+ /**
301
+ * The tables it reaches, by name: what it does there, where their rows lie (in org, app-wide), and `also` the other
302
+ * paths it reaches them through or that their rows open (a path column, a reveal, an access view, a condition).
303
+ */
304
+ tables: {
305
+ table: string;
306
+ lies: string;
307
+ operations: string[];
308
+ also: string[];
309
+ }[];
310
+ /** The stored files it reads, uploads or deletes: `read, upload the files of attachments (rows of notes)`. */
311
+ files: string[];
312
+ }
214
313
  /** One endpoint, job or migration of a published snapshot and its steps off the paved road. */
215
314
  export interface DeviationSubjectDto {
216
315
  /** `Endpoint \`id\``, `Job \`name\`` or `Migration \`file\``. */
@@ -235,6 +334,30 @@ export interface SurfaceEndpointDto {
235
334
  requirement: string | null;
236
335
  /** What else opens the endpoint: another origin, a file it answers, a body limit, a form's protection, a signature. */
237
336
  notes: string[];
337
+ /**
338
+ * The same notes, in the same order, each with what it is about. Beside `notes`, never instead of it: a builder
339
+ * daemon of an older release reads `notes` as text and drops a field it does not know. Absent from a Control
340
+ * released before it.
341
+ */
342
+ noteFacts?: SurfaceNoteDto[];
343
+ }
344
+ /**
345
+ * What a surface note is about: an opaque root it takes, another origin it is callable from, a file it answers or
346
+ * takes, an upload's body limit, a form's protection, a procedure's buckets and challenge (`guards`), how long it waits
347
+ * for a body of what size and how long it runs (`limits`), a webhook's signature. A line that already says one
348
+ * (`AccessChangeDto.states`) lets the approval page leave that note out of the line's row.
349
+ */
350
+ export declare const SURFACE_NOTE_TOPICS: readonly ["opaque-root", "cross-origin", "answers-file", "takes-files", "body-limit", "form", "guards", "limits", "signature"];
351
+ export type SurfaceNoteTopic = (typeof SURFACE_NOTE_TOPICS)[number];
352
+ /** One thing that opens an endpoint or stands in front of it, in the approval's words. */
353
+ export interface SurfaceNoteDto {
354
+ topic: SurfaceNoteTopic;
355
+ text: string;
356
+ /**
357
+ * The procedure's `limits` are the framework's defaults (its body limit and time limit, without file fields): the
358
+ * approval page says them once for every such row instead of on each.
359
+ */
360
+ default?: true;
238
361
  }
239
362
  export interface PutAppEnvRequest {
240
363
  domain?: string | null;
@@ -345,6 +468,14 @@ export interface DeploymentNamespaceListResponse {
345
468
  export interface RemoveDeploymentNamespaceResponse {
346
469
  readonly removed: DeploymentNamespaceDetailDto;
347
470
  }
471
+ /** The namespaces whose proxy rebuild `namespaces.republishAll` submitted. */
472
+ export interface RepublishAllNamespacesResponse {
473
+ readonly namespaceIds: readonly string[];
474
+ }
475
+ /** The resource keys released; each was confirmed gone at the provider in the same call. */
476
+ export interface ReleaseNamespaceClaimsResponse {
477
+ readonly released: readonly string[];
478
+ }
348
479
  export interface PlanDeploymentNamespaceRequest {
349
480
  id: string;
350
481
  env: string;
@@ -393,6 +524,11 @@ export interface PutAppVarRequest {
393
524
  name: string;
394
525
  value: string;
395
526
  env?: string | null;
527
+ /**
528
+ * The caller checked the value is not a credential. Without it Control refuses a variable whose name or value looks
529
+ * like one, because a variable is shown in clear to everyone who manages the application; a credential is a secret.
530
+ */
531
+ notSecret?: boolean;
396
532
  }
397
533
  export interface RegisterAppRequest extends AppOptionalFields {
398
534
  id: string;
@@ -430,23 +566,79 @@ export interface RunDto {
430
566
  createdAt: number;
431
567
  startedAt: number | null;
432
568
  finishedAt: number | null;
569
+ /** When someone asked to cancel the run; a run that finished with it set was cancelled, unless it succeeded first. */
570
+ cancelRequestedAt: number | null;
571
+ }
572
+ /** What a change line is about (ADR-0050 §3). */
573
+ export declare const CHANGE_SUBJECT_KINDS: readonly ["application", "endpoint", "mount", "dimension", "action", "role", "table", "file-collection", "file-kind", "job", "export", "import", "token", "csp", "migration"];
574
+ export type ChangeSubjectKind = (typeof CHANGE_SUBJECT_KINDS)[number];
575
+ export interface ChangeSubjectDto {
576
+ kind: ChangeSubjectKind;
577
+ /** The endpoint id, the table, the role, the migration file, the CSP directive; the application's id for `application`. */
578
+ name: string;
579
+ /** An endpoint's route: the candidate's row, or the baseline's for a removed endpoint. */
580
+ method?: EndpointMethod;
581
+ path?: string;
582
+ }
583
+ /** Who reaches an endpoint: the candidate's row, or the baseline's for a removed endpoint, in the surface's terms. */
584
+ export interface ChangeAudienceDto {
585
+ reach: SurfaceReach;
586
+ /** The link mount whose share links reach it, for a `link` reach. */
587
+ mount?: string;
588
+ /** What a caller must hold, as `SurfaceEndpointDto.requirement` words it; null for an anonymous kind. */
589
+ requirement: string | null;
590
+ /**
591
+ * Every caller kind the endpoint admits, sorted, as `SurfaceEndpointDto.callers`; empty for an anonymous kind. Absent
592
+ * on a line classified before lines carried it.
593
+ */
594
+ callers?: string[];
595
+ }
596
+ /**
597
+ * Why a line needs closer review: a step off the paved road, something anyone without signing in sets off, a mutation
598
+ * served on `GET`, people becoming visible, a file collection adopted or released, the application naming who signs
599
+ * in at an enrolled terminal, or a migration statement not known to keep every stored value.
600
+ */
601
+ export declare const REVIEW_REASONS: readonly ["off-road", "anyone-calls", "get-mutation", "people", "adoption", "terminal", "deletes-data"];
602
+ export type ReviewReason = (typeof REVIEW_REASONS)[number];
603
+ /** What a call sets off, when the line says so. */
604
+ export interface ChangeConsequenceDto {
605
+ kind: 'starts-job';
606
+ job: string;
433
607
  }
434
608
  /**
435
609
  * One plain-language line of an access change. `effect` is `widens` when it can grant access the baseline did not,
436
610
  * `narrows` when it can only take access away, and `neutral` when it admits no one new and takes nothing away.
437
- * `review: 'closer'` marks a step off the paved road (declared reach, database code) or a change the diff cannot classify.
611
+ * `review: 'closer'` marks a line the approver reads the code behind (a step off the paved road, a call anyone sets off,
612
+ * …), and `reason` says which. A line classified before lines carried facts has no `rule`, `subject` or `reason`.
438
613
  */
439
614
  export interface AccessChangeDto {
440
615
  effect: 'widens' | 'narrows' | 'neutral';
441
616
  line: string;
442
617
  review?: 'closer';
618
+ reason?: ReviewReason;
443
619
  /** The line opens an endpoint to the pages on the origins the environment lists; `ApprovalDto.crossOrigins` names them. */
444
620
  environmentOrigins?: true;
621
+ /** The comparison that produced the line, a stable code (`endpoint.body-limit`); it never holds an application's name. */
622
+ rule?: string;
623
+ subject?: ChangeSubjectDto;
624
+ /** Who reaches the endpoint, on an endpoint subject. */
625
+ audience?: ChangeAudienceDto;
626
+ consequence?: ChangeConsequenceDto;
627
+ /**
628
+ * The line's words in a row that already names its endpoint, route and audience (the approval page's caller groups):
629
+ * `New endpoint`, `Output \`header\` gains field \`reference\``. Absent where the line has no shorter form.
630
+ */
631
+ inRow?: string;
632
+ /** The surface notes of its endpoint the line already says, so its row does not say them again. */
633
+ states?: SurfaceNoteTopic[];
445
634
  }
446
635
  /** A run's access change against its environment's active snapshot (ADR-0050 §3). */
447
636
  export interface ApprovalDto {
448
637
  run: RunDto;
449
- /** `none`: no line. `no-widening`: lines that narrow or leave access unchanged; it publishes at once. */
638
+ /**
639
+ * `none`: no line. `no-widening`: lines that narrow or leave access unchanged. `widening`: a line widens. On a
640
+ * protected environment only a change with a closer-review line waits (`waitsForApproval`); any other publishes at once.
641
+ */
450
642
  outcome: 'none' | 'no-widening' | 'widening';
451
643
  changes: AccessChangeDto[];
452
644
  /** The digest of the run's snapshot and of the active one it was compared with: an approval is bound to both. */
@@ -462,12 +654,34 @@ export interface ApprovalDto {
462
654
  * empty when the environment lists none.
463
655
  */
464
656
  crossOrigins?: string[];
465
- /** The human who approved it, once one did. */
657
+ /**
658
+ * The candidate's endpoints the change names, as the environment page's surface words them: who reaches each, what it
659
+ * requires, and what else opens it or stands in front of it (another origin, a body limit, rate buckets, a challenge).
660
+ * A removed endpoint is not among them. Empty for a run that stored no snapshot, and on the approvals list.
661
+ */
662
+ endpoints: SurfaceEndpointDto[];
663
+ /**
664
+ * The candidate's roles and what each action of theirs reaches: the access the run would publish to people and
665
+ * scripts, by role (workloads and other applications are the change's). Absent on the approvals list, for a run that
666
+ * stored no snapshot, and from a Control released before it.
667
+ */
668
+ accessMap?: AccessMapDto;
669
+ /**
670
+ * The human who approved it, once one did. `holds` is false once the approval lapsed: an older run of the environment
671
+ * published another change first, the change still widens against it, and the run waits for a new approval (ADR-0050
672
+ * §2). A refusal or a cancellation of such a run drops the approval, so a decided run's approval always held.
673
+ */
466
674
  approval: {
467
675
  principalId: string;
468
676
  label: string;
469
677
  approvedAt: number;
678
+ holds: boolean;
470
679
  } | null;
680
+ /**
681
+ * The newer run of the environment whose success stopped this one before it started: an older run never deploys over
682
+ * a newer one (ADR-0050 §6). Only on one approval read, of a run that failed without starting.
683
+ */
684
+ supersededBy?: string;
471
685
  }
472
686
  /** Approve or refuse one parked run. The digests are the ones the approver read; a reclassified run refuses them. */
473
687
  export interface CompleteApprovalRequest {
@@ -497,4 +711,8 @@ export interface RunLogResponse {
497
711
  lines: RunLogLine[];
498
712
  status?: RunStatus;
499
713
  }
500
- export type { AdoptNamespaceInput, AppEnvironmentInput, AppIdInput, AppNamedValueInput, ControlRpcContract, CreateAppRequest, DescribeConnectorRequest, GitHubSourceConnectionInput, GitHubSourceConnectionRpcContract, NamespaceIdInput, OkResponse, PutAppEnvironmentInput, PutAppSecretInput, PutAppVarInput, RotateTokenKeyResponse, RunIdInput, RunListInput, SecretValueInput, SecretValueResponse, TailRunInput, UpdateNamespaceInput, } from './rpc.js';
714
+ export { OPS_ROW_COUNT_CAP, type OpsContentView, type OpsView } from '@fabrika/auth-core';
715
+ export * from './approval-view.js';
716
+ export type { AdoptNamespaceInput, AppEnvironmentInput, AppIdInput, AppNamedValueInput, ControlRpcContract, CreateAppRequest, DescribeConnectorRequest, GitHubSourceConnectionInput, GitHubSourceConnectionRpcContract, NamespaceIdInput, OkResponse, PutAppEnvironmentInput, PutAppSecretInput, PutAppVarInput, ReleaseNamespaceClaimsInput, RotateTokenKeyResponse, RunIdInput, RunListInput, SecretValueInput, SecretValueResponse, TailRunInput, UpdateNamespaceInput, } from './rpc.js';
717
+ export type { DataBackupDto, DataBackupScheduleDto, DataBackupState, DataOperationDto, DataOperationKind, DataOperationListInput, DataOperationResolution, DataOperationState, DataOperationStep, DataRehearsalOutcome, MaintenanceMode, RecoverDataOperationInput, SetDataBackupScheduleInput, StartDataOperationInput, } from './rpc.js';
718
+ export { DATA_OPERATION_MAX_PAGE_SIZE, dataOperationListInputSchema, recoverDataOperationInputSchema, startDataOperationInputSchema } from './rpc.js';
@@ -42,6 +42,8 @@ export interface MailMessageContentDto {
42
42
  readonly replyTo?: string;
43
43
  readonly fromName?: string;
44
44
  readonly unsubscribeUrl?: string;
45
+ /** A message of a send to many recipients, which the provider keeps apart from transactional mail. */
46
+ readonly broadcast?: true;
45
47
  readonly attachments: readonly MailAttachmentDto[];
46
48
  }
47
49
  /** `withheld`: the caller does not hold `mail.content.read`. `purged`: the relay no longer keeps it. */