@fabrika/cli 0.9.0-dev.53 → 0.9.0-dev.55

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/cli",
3
- "version": "0.9.0-dev.53",
3
+ "version": "0.9.0-dev.55",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,21 +32,21 @@
32
32
  "dependencies": {
33
33
  "jose": "^5.9.0",
34
34
  "zod": "^3.25.76",
35
- "@fabrika/app": "0.9.0-dev.53",
36
- "@fabrika/auth-core": "0.9.0-dev.53",
37
- "@fabrika/control-contract": "0.9.0-dev.53",
38
- "@fabrika/iam-contract": "0.9.0-dev.53",
39
- "@fabrika/operations-contract": "0.9.0-dev.53",
40
- "@fabrika/provider-contract": "0.9.0-dev.53",
41
- "@fabrika/db": "0.9.0-dev.53",
42
- "@fabrika/platform": "0.9.0-dev.53",
43
- "@fabrika/platform-node": "0.9.0-dev.53",
44
- "@fabrika/check": "0.9.0-dev.53"
35
+ "@fabrika/app": "0.9.0-dev.55",
36
+ "@fabrika/auth-core": "0.9.0-dev.55",
37
+ "@fabrika/control-contract": "0.9.0-dev.55",
38
+ "@fabrika/iam-contract": "0.9.0-dev.55",
39
+ "@fabrika/operations-contract": "0.9.0-dev.55",
40
+ "@fabrika/provider-contract": "0.9.0-dev.55",
41
+ "@fabrika/db": "0.9.0-dev.55",
42
+ "@fabrika/platform": "0.9.0-dev.55",
43
+ "@fabrika/platform-node": "0.9.0-dev.55",
44
+ "@fabrika/check": "0.9.0-dev.55"
45
45
  },
46
46
  "peerDependencies": {
47
- "@fabrika/builder": "0.9.0-dev.53",
48
- "@fabrika/provider-cloudflare": "0.9.0-dev.53",
49
- "@fabrika/provider-zerops": "0.9.0-dev.53"
47
+ "@fabrika/builder": "0.9.0-dev.55",
48
+ "@fabrika/provider-cloudflare": "0.9.0-dev.55",
49
+ "@fabrika/provider-zerops": "0.9.0-dev.55"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@fabrika/builder": {
@@ -15,6 +15,7 @@ import {
15
15
  type ControlCliPreset,
16
16
  controlCliPresetPaths,
17
17
  } from '@fabrika/control-contract'
18
+ import { IAM_ADMIN_OAUTH_SCOPE, IAM_ADMIN_RPC_PATH } from '@fabrika/iam-contract'
18
19
  import { createHash, randomUUID } from 'node:crypto'
19
20
  import { link, mkdir, open, readFile, stat, unlink, writeFile } from 'node:fs/promises'
20
21
  import { homedir } from 'node:os'
@@ -250,6 +251,11 @@ async function discover(origin: string, deps: ControlOAuthDependencies): Promise
250
251
  if (issuer === undefined || credentialOriginOf(issuer) !== issuer) {
251
252
  throw new Error(`${origin} names an authorization server that is not an https origin`)
252
253
  }
254
+ return authorizationServer(issuer, deps)
255
+ }
256
+
257
+ /** The endpoints `issuer`'s RFC 8414 metadata names, each on the issuer's own origin; read without following a redirect. */
258
+ async function authorizationServer(issuer: string, deps: ControlOAuthDependencies): Promise<AuthorizationServer> {
253
259
  const server = serverMetadataSchema.safeParse(await getJson(`${issuer}/.well-known/oauth-authorization-server`, deps))
254
260
  if (
255
261
  !server.success || server.data.issuer !== issuer || !sameOrigin(server.data.token_endpoint, issuer)
@@ -313,10 +319,44 @@ export const parseControlCliPreset = (raw: string): ControlCliPreset | null => C
313
319
  export async function authorizeDevice(request: DeviceGrantRequest, deps: ControlOAuthDependencies): Promise<void> {
314
320
  const server = await discover(request.origin, deps)
315
321
  const resources = controlCliPresetPaths(request.preset).map((path) => `${request.origin}${path}`)
316
- const form = new URLSearchParams({
317
- client_id: OAUTH_CLI_CLIENT_ID,
318
- scope: request.app === undefined ? request.preset : `${request.preset}:${request.app}`,
319
- })
322
+ const scope = request.app === undefined ? request.preset : `${request.preset}:${request.app}`
323
+ await runDeviceGrant(server, scope, resources, request.origin, 'The person who approves picks how long the grant lasts.', deps)
324
+ deps.note(`Approved. The refresh token is stored through ${CREDENTIAL_HELPER_VARIABLE}; Control calls without FABRIKA_CONTROL_KEY use it.`)
325
+ }
326
+
327
+ /**
328
+ * The `admin` device grant (ADR-0049 rule 2): IAM's administration API as the approving person, `iam.admin` alone, for
329
+ * one hour at most. IAM is found from Control's origin; the refresh token is stored under IAM's origin, so it sits beside
330
+ * a console grant instead of replacing it.
331
+ */
332
+ export async function authorizeAdminDevice(origin: string, deps: ControlOAuthDependencies): Promise<void> {
333
+ const server = await discover(origin, deps)
334
+ await runDeviceGrant(
335
+ server,
336
+ IAM_ADMIN_OAUTH_SCOPE,
337
+ [`${server.issuer}${IAM_ADMIN_RPC_PATH}`],
338
+ server.issuer,
339
+ 'The grant lasts one hour at most.',
340
+ deps,
341
+ )
342
+ deps.note(
343
+ `Approved for one hour at most. The refresh token is stored through ${CREDENTIAL_HELPER_VARIABLE} under ${server.issuer}; `
344
+ + '`control external-apps` uses it without FABRIKA_IAM_PROVISIONING_KEY.',
345
+ )
346
+ }
347
+
348
+ /** Start a device grant, tell the person where to approve it, poll until they do, and store its refresh token under `storeOrigin`. */
349
+ async function runDeviceGrant(
350
+ server: AuthorizationServer,
351
+ scope: string,
352
+ resources: readonly string[],
353
+ storeOrigin: string,
354
+ lifetime: string,
355
+ deps: ControlOAuthDependencies,
356
+ ): Promise<void> {
357
+ const [first] = resources
358
+ if (first === undefined) throw new Error('a device grant names at least one resource')
359
+ const form = new URLSearchParams({ client_id: OAUTH_CLI_CLIENT_ID, scope })
320
360
  for (const resource of resources) form.append('resource', resource)
321
361
  const response = await postForm(server.deviceEndpoint, form, deps, `${server.issuer} could not be reached to start the device grant`)
322
362
  if (response.status === 429) {
@@ -336,15 +376,14 @@ export async function authorizeDevice(request: DeviceGrantRequest, deps: Control
336
376
  ? started.data.verification_uri_complete
337
377
  : started.data.verification_uri
338
378
  deps.note(`Open ${page} and confirm the code ${started.data.user_code}.`)
339
- deps.note(`The person who approves picks how long the grant lasts. The code expires in ${Math.ceil(started.data.expires_in / 60)} minutes.`)
340
- const refreshToken = await pollDevice(server, started.data, resources[0] ?? `${request.origin}${CONTROL_RPC_PATH}`, deps)
341
- const release = await deps.lock(request.origin)
379
+ deps.note(`${lifetime} The code expires in ${Math.ceil(started.data.expires_in / 60)} minutes.`)
380
+ const refreshToken = await pollDevice(server, started.data, first, deps)
381
+ const release = await deps.lock(storeOrigin)
342
382
  try {
343
- await deps.helper.store(request.origin, refreshToken)
383
+ await deps.helper.store(storeOrigin, refreshToken)
344
384
  } finally {
345
385
  await release()
346
386
  }
347
- deps.note(`Approved. The refresh token is stored through ${CREDENTIAL_HELPER_VARIABLE}; Control calls without FABRIKA_CONTROL_KEY use it.`)
348
387
  }
349
388
 
350
389
  async function pollDevice(
@@ -411,11 +450,25 @@ export type ControlBearer = (resource: string) => Promise<string>
411
450
  * process's memory only. Concurrent calls for one resource share one refresh.
412
451
  */
413
452
  export function controlOAuthBearer(origin: string, deps: ControlOAuthDependencies): ControlBearer {
453
+ return grantBearer(origin, () => discover(origin, deps), deps)
454
+ }
455
+
456
+ /**
457
+ * Access tokens for IAM's administration API at `issuer`, refreshed through the `admin` grant the helper holds under
458
+ * IAM's origin. IAM's own metadata names the endpoints, so this needs no Control origin.
459
+ */
460
+ export function iamAdminOAuthBearer(issuer: string, deps: ControlOAuthDependencies): () => Promise<string> {
461
+ const bearer = grantBearer(issuer, () => authorizationServer(issuer, deps), deps)
462
+ return () => bearer(`${issuer}${IAM_ADMIN_RPC_PATH}`)
463
+ }
464
+
465
+ /** Access tokens refreshed through the grant the helper holds under `origin`, kept in this process's memory only. */
466
+ function grantBearer(origin: string, locate: () => Promise<AuthorizationServer>, deps: ControlOAuthDependencies): ControlBearer {
414
467
  let server: Promise<AuthorizationServer> | undefined
415
468
  const held = new Map<string, { readonly token: string; readonly refreshAt: number }>()
416
469
  const pending = new Map<string, Promise<string>>()
417
470
  const refresh = async (resource: string): Promise<string> => {
418
- server ??= discover(origin, deps)
471
+ server ??= locate()
419
472
  const { issuer, tokenEndpoint } = await server
420
473
  const release = await deps.lock(origin)
421
474
  try {
package/src/control.ts CHANGED
@@ -48,6 +48,7 @@ import type {
48
48
  } from '@fabrika/control-contract'
49
49
  import {
50
50
  type ExternalAppDto,
51
+ IAM_ADMIN_OAUTH_SCOPE,
51
52
  type IamAdminRpcContract,
52
53
  isHttpsDocumentUrl,
53
54
  isOAuthIdentityAppId,
@@ -65,12 +66,14 @@ import {
65
66
  import { compactDecrypt, exportJWK, generateKeyPair } from 'jose'
66
67
  import { z } from 'zod'
67
68
  import {
69
+ authorizeAdminDevice,
68
70
  authorizeDevice,
69
71
  controlOAuthBearer,
70
72
  type ControlOAuthDependencies,
71
73
  controlResourceFor,
72
74
  CREDENTIAL_HELPER_VARIABLE,
73
75
  defaultControlOAuthDependencies,
76
+ iamAdminOAuthBearer,
74
77
  parseControlCliPreset,
75
78
  } from './control-oauth.js'
76
79
  import { credentialOrigin, type OriginSource } from './credential-origin.js'
@@ -95,7 +98,7 @@ const issueKeyResultSchema = z.union([
95
98
  const USAGE = `fabrika control — operate the Delivery control plane
96
99
 
97
100
  Usage:
98
- fabrika control auth device --preset=<read|deploy|operate|create> [--app=<id>]
101
+ fabrika control auth device --preset=<read|deploy|operate|create|admin> [--app=<id>]
99
102
  fabrika control key issue --label=<name> --permissions=<a,b,c> --expires-in=<seconds> [--iam-url=<origin>]
100
103
  fabrika control apps list
101
104
  fabrika control apps get --app=<id>
@@ -278,9 +281,11 @@ day or a week). The grant holds the preset's actions at one application, never m
278
281
  deploy read, and deploy.trigger
279
282
  operate deploy, secret.manage, app.manage and operations.triage
280
283
  create app.manage wherever the person holds it, with no --app: it also changes and deletes apps
284
+ admin iam.admin on IAM's administration API, with no --app, for one hour at most: the whole installation's
285
+ identity and access; \`external-apps\` uses it (below), and every call it makes is recorded with the grant
281
286
 
282
287
  The refresh token goes to the helper and nowhere else: the helper runs as \`sh -c '<helper> get|store'\`,
283
- reads \`origin=<console origin>\` (and, for \`store\`, \`refresh_token=<token>\`) on stdin, and \`get\` prints
288
+ reads \`origin=<origin>\` (the console's, or IAM's for \`admin\`; for \`store\` also \`refresh_token=<token>\`) on stdin, and \`get\` prints
284
289
  \`refresh_token=<token>\`, or nothing. Every call then trades it for a short-lived access token, and IAM
285
290
  rotates it each time; a lock under $XDG_CACHE_HOME/fabrika (~/.cache/fabrika when unset) serializes that
286
291
  between processes on this machine. If a refresh's answer is lost, the stored token is spent and the next
@@ -303,7 +308,9 @@ resolves inside the provider's project and nowhere else, so from here it only ev
303
308
 
304
309
  \`external-apps\` and \`oauth-clients\` manage the OAuth clients IAM serves (ADR-0089). They call IAM's admin API
305
310
  with two of the variables \`key issue\` reads, and nothing else: FABRIKA_IAM_RPC_URL (or --iam-url), IAM's PUBLIC origin,
306
- and FABRIKA_IAM_PROVISIONING_KEY, the bearer. An external application is an application outside this installation that
311
+ and FABRIKA_IAM_PROVISIONING_KEY, the bearer. Without the key, \`external-apps\` uses the \`auth device --preset=admin\`
312
+ grant FABRIKA_CONTROL_CREDENTIAL_HELPER holds, and so does \`oauth-clients list\`; IAM takes only the key for
313
+ \`oauth-clients put\` and \`delete\`. An external application is an application outside this installation that
307
314
  signs people in through IAM; \`put\` replaces it whole from a file (record, roles and clients) and is idempotent:
308
315
 
309
316
  {
@@ -662,16 +669,22 @@ const APP_ID = /^[a-z0-9][a-z0-9-]*$/
662
669
  const runAuthDevice = async (flags: Flags, env: Readonly<Record<string, string | undefined>>): Promise<void> => {
663
670
  const origin = credentialOrigin(flags.values.get('url') ?? env['FABRIKA_CONTROL_URL'], CONTROL_ORIGIN)
664
671
  const raw = required(flags, 'preset')
665
- const preset = parseControlCliPreset(raw)
666
- if (preset === null) throw new Error(`--preset must be one of ${CONTROL_CLI_PRESETS.join(', ')}`)
667
672
  const app = optional(flags, 'app')
673
+ const admin = raw === IAM_ADMIN_OAUTH_SCOPE
674
+ const preset = admin ? null : parseControlCliPreset(raw)
675
+ if (!admin && preset === null) throw new Error(`--preset must be one of ${[...CONTROL_CLI_PRESETS, IAM_ADMIN_OAUTH_SCOPE].join(', ')}`)
676
+ if (admin && app !== undefined) throw new Error('--preset=admin administers the whole installation, and takes no --app')
668
677
  if (preset === 'create' && app !== undefined) throw new Error('--preset=create holds its action wherever you may, and takes no --app')
669
- if (preset !== 'create' && (app === undefined || !APP_ID.test(app))) throw new Error(`--preset=${preset} needs --app=<application id>`)
678
+ if (preset !== null && preset !== 'create' && (app === undefined || !APP_ID.test(app))) {
679
+ throw new Error(`--preset=${preset} needs --app=<application id>`)
680
+ }
670
681
  const helper = env[CREDENTIAL_HELPER_VARIABLE]?.trim()
671
682
  if (helper === undefined || helper === '') {
672
683
  throw new Error(`${CREDENTIAL_HELPER_VARIABLE} is required: the refresh token is stored through it and never printed`)
673
684
  }
674
- await authorizeDevice({ origin, preset, ...(app === undefined ? {} : { app }) }, defaultControlOAuthDependencies(helper, env, fetch))
685
+ const deps = defaultControlOAuthDependencies(helper, env, fetch)
686
+ if (preset === null) return authorizeAdminDevice(origin, deps)
687
+ await authorizeDevice({ origin, preset, ...(app === undefined ? {} : { app }) }, deps)
675
688
  }
676
689
 
677
690
  const decodeIssueKeyResult = (value: unknown): IssueKeyResult => {
@@ -1253,9 +1266,10 @@ const runNamespaces = async (verb: string | undefined, flags: Flags, env: Readon
1253
1266
 
1254
1267
  // ── IAM's client registry (ADR-0089) ─────────────────────────────────────────
1255
1268
  // `external-apps` and `oauth-clients` call IAM's `/admin/rpc` with the provisioning key as the bearer, the credential
1256
- // Control's own IAM provisioning client sends. A person's device grant does not reach IAM's admin API.
1269
+ // Control's own IAM provisioning client sends, or without it with a person's `admin` device grant (ADR-0049 rule 2).
1257
1270
 
1258
1271
  const PROVISIONING_KEY_LABEL = '[FABRIKA_IAM_PROVISIONING_KEY]'
1272
+ const ADMIN_GRANT_TOKEN_LABEL = "[the admin grant's access token]"
1259
1273
 
1260
1274
  /** `text` with the provisioning key cut out: every diagnostic of the registry verbs passes through it. */
1261
1275
  const withoutProvisioningKey = (text: string, env: Readonly<Record<string, string | undefined>>): string => {
@@ -1265,18 +1279,49 @@ const withoutProvisioningKey = (text: string, env: Readonly<Record<string, strin
1265
1279
 
1266
1280
  export type IamAdminClient = InferRpcClient<IamAdminRpcContract>
1267
1281
 
1268
- /** IAM's admin RPC at its public origin, with the provisioning key from the environment only and no redirect followed. */
1282
+ /** Neither IAM credential is set; both are read from the environment only. */
1283
+ const MISSING_IAM_CREDENTIAL = `FABRIKA_IAM_PROVISIONING_KEY is required (environment only — it has no flag), or ${CREDENTIAL_HELPER_VARIABLE} `
1284
+ + 'after `fabrika control auth device --preset=admin`.'
1285
+
1286
+ /**
1287
+ * The bearer of IAM's admin RPC: FABRIKA_IAM_PROVISIONING_KEY when it is set, else an access token of the person's `admin`
1288
+ * device grant, refreshed through the credential helper.
1289
+ */
1290
+ const iamAdminBearer = (
1291
+ origin: string,
1292
+ env: Readonly<Record<string, string | undefined>>,
1293
+ send: RpcFetch,
1294
+ oauth: ControlOAuthDependencies | undefined,
1295
+ ): () => Promise<string> => {
1296
+ const key = env['FABRIKA_IAM_PROVISIONING_KEY']?.trim()
1297
+ if (key !== undefined && key !== '') return () => Promise.resolve(key)
1298
+ const helper = env[CREDENTIAL_HELPER_VARIABLE]?.trim()
1299
+ if (helper === undefined || helper === '') throw new Error(MISSING_IAM_CREDENTIAL)
1300
+ return iamAdminOAuthBearer(origin, oauth ?? defaultControlOAuthDependencies(helper, env, send))
1301
+ }
1302
+
1303
+ /** IAM's admin RPC at its public origin, with a credential from the environment only and no redirect followed. */
1269
1304
  export const iamAdminClient = (
1270
1305
  url: string | undefined,
1271
1306
  env: Readonly<Record<string, string | undefined>>,
1272
1307
  send: RpcFetch = fetch,
1308
+ oauth?: ControlOAuthDependencies,
1273
1309
  ): IamAdminClient => {
1274
1310
  const origin = credentialOrigin(url ?? env['FABRIKA_IAM_RPC_URL'], IAM_ORIGIN)
1275
- const key = secret('FABRIKA_IAM_PROVISIONING_KEY', env)
1311
+ const bearer = iamAdminBearer(origin, env, send, oauth)
1312
+ const provisioned = (env['FABRIKA_IAM_PROVISIONING_KEY']?.trim() ?? '') !== ''
1276
1313
  return createRpcClient<IamAdminRpcContract>({
1277
1314
  baseUrl: `${origin}/admin/rpc`,
1278
1315
  bounceOnAuth: false,
1279
1316
  fetch: async (input, init) => {
1317
+ let key: string
1318
+ try {
1319
+ key = await bearer()
1320
+ } catch (error) {
1321
+ // The RPC client reads a rejected fetch as "Network request failed"; this answer keeps the reason.
1322
+ const message = error instanceof Error ? error.message : 'the IAM credential could not be obtained'
1323
+ return Response.json({ error: { type: 'credential', message } }, { status: 401 })
1324
+ }
1280
1325
  const headers = new Headers(init?.headers)
1281
1326
  headers.set('authorization', `Bearer ${key}`)
1282
1327
  let response: Response
@@ -1287,7 +1332,7 @@ export const iamAdminClient = (
1287
1332
  // The RPC client reads a rejected fetch as "Network request failed"; this answer keeps the reason.
1288
1333
  return Response.json({ error: { type: 'transport', message: unreachableIam(origin, cause) } }, { status: 502 })
1289
1334
  }
1290
- return await withoutEchoedKey(response, key, { service: 'IAM', label: PROVISIONING_KEY_LABEL })
1335
+ return await withoutEchoedKey(response, key, { service: 'IAM', label: provisioned ? PROVISIONING_KEY_LABEL : ADMIN_GRANT_TOKEN_LABEL })
1291
1336
  },
1292
1337
  })
1293
1338
  }
@@ -45,6 +45,12 @@ export declare const parseControlCliPreset: (raw: string) => ControlCliPreset |
45
45
  * store the refresh token through the helper. The access token of the first resource is dropped; a call refreshes its own.
46
46
  */
47
47
  export declare function authorizeDevice(request: DeviceGrantRequest, deps: ControlOAuthDependencies): Promise<void>;
48
+ /**
49
+ * The `admin` device grant (ADR-0049 rule 2): IAM's administration API as the approving person, `iam.admin` alone, for
50
+ * one hour at most. IAM is found from Control's origin; the refresh token is stored under IAM's origin, so it sits beside
51
+ * a console grant instead of replacing it.
52
+ */
53
+ export declare function authorizeAdminDevice(origin: string, deps: ControlOAuthDependencies): Promise<void>;
48
54
  /** A current access token for one of the console's resources. */
49
55
  export type ControlBearer = (resource: string) => Promise<string>;
50
56
  /**
@@ -52,5 +58,10 @@ export type ControlBearer = (resource: string) => Promise<string>;
52
58
  * process's memory only. Concurrent calls for one resource share one refresh.
53
59
  */
54
60
  export declare function controlOAuthBearer(origin: string, deps: ControlOAuthDependencies): ControlBearer;
61
+ /**
62
+ * Access tokens for IAM's administration API at `issuer`, refreshed through the `admin` grant the helper holds under
63
+ * IAM's origin. IAM's own metadata names the endpoints, so this needs no Control origin.
64
+ */
65
+ export declare function iamAdminOAuthBearer(issuer: string, deps: ControlOAuthDependencies): () => Promise<string>;
55
66
  /** The console resource a request needs: the Operations RPC, or Control's own. A bearer never leaves Control's origin. */
56
67
  export declare function controlResourceFor(origin: string, input: RequestInfo | URL): string;
@@ -3,7 +3,7 @@ import { type ApprovalRequestDto } from '@fabrika/control-contract';
3
3
  import type { AppEnvDto, ControlRpcContract, DeploymentNamespaceDto, JsonValue, PlanDeploymentNamespaceResponse, RunDto } from '@fabrika/control-contract';
4
4
  import { type ExternalAppDto, type IamAdminRpcContract, type PutExternalAppRequest, type PutOAuthClientRequest } from '@fabrika/iam-contract';
5
5
  import { type ControlOAuthDependencies } from './control-oauth.js';
6
- declare const USAGE = "fabrika control \u2014 operate the Delivery control plane\n\nUsage:\n fabrika control auth device --preset=<read|deploy|operate|create> [--app=<id>]\n fabrika control key issue --label=<name> --permissions=<a,b,c> --expires-in=<seconds> [--iam-url=<origin>]\n fabrika control apps list\n fabrika control apps get --app=<id>\n fabrika control apps environments list --app=<id>\n fabrika control apps environments put --provider=<name> --app=<id> --env=<name> --manifest=<path>\n [--domain=<host>] [--public-origin=<url>] [--trigger-ref=<ref>] [--namespace=<id>]\n [--cross-origin=<origin> ...] [--kind=standard|dev] [--wait]\n fabrika control apps environments suspend --app=<id> --env=<name> [--wait]\n fabrika control apps environments resume --app=<id> --env=<name> [--wait]\n fabrika control apps variables list --app=<id>\n fabrika control apps variables put --app=<id> --name=<name> --value=<text> [--env=<name>] [--not-secret] [--request] [--wait]\n fabrika control apps variables delete --app=<id> --name=<name> [--env=<name>] [--request] [--wait]\n fabrika control apps secrets list --app=<id>\n fabrika control apps secrets put --app=<id> --name=<name> [--env=<name>] [--request] [--wait] (the value on stdin)\n fabrika control apps secrets delete --app=<id> --name=<name> [--env=<name>] [--request] [--wait]\n fabrika control register --provider=<name> --app=<id> --repo=<url> --env=<name> --manifest=<path>\n [--domain=<host>] [--public-origin=<url>] [--trigger-ref=<ref>]\n [--namespace=<id>] [--installation-id=<n|none>] [--cross-origin=<origin> ...]\n fabrika control namespaces list\n fabrika control namespaces get --namespace=<id>\n fabrika control namespaces plan --namespace=<id> --env=<name> --preset=<cheap|mid|full> [placement]\n fabrika control namespaces create --namespace=<id> --env=<name> --preset=<cheap|mid|full> [placement]\n fabrika control namespaces reconcile --namespace=<id>\n fabrika control namespaces update --namespace=<id> --proxy-source=current\n fabrika control namespaces remove --namespace=<id>\n fabrika control namespaces release-claims --namespace=<id> --app=<id> --env=<name>\n fabrika control deploy --app=<id> --env=<name> [--ref=<ref>] [--wait]\n fabrika control runs list [--app=<id>] [--env=<name>] [--limit=<n>]\n fabrika control runs get --run=<id>\n fabrika control runs log --run=<id>\n fabrika control requests get <id> [--wait]\n fabrika control access request-grant --app=<id> --env=<name> --principal=<id> --role=<role>\n [--scope=<dimension>:<value>] --expires-in=<seconds> [--wait]\n fabrika control access request-key --app=<id> --action=<action> [--action=<action>\u2026] --label=<text>\n --expires-in=<seconds> --wait\n fabrika control external-apps list | get <app> | put --file=<app.json> | delete <app> [--iam-url=<origin>]\n fabrika control oauth-clients list | put --file=<client.json> | delete <client id> [--iam-url=<origin>]\n\n`register` CREATES an app and refuses a second one with the same id. Re-registering a changed\nmanifest \u2014 a new import document, or a new `zerops.yaml` of an app without a contract \u2014 is\n`apps environments put`, which replaces one environment's envelopes and leaves the app row alone. A\ncontract app's deploy registers the `zerops.yaml` of its commit itself.\n\nA manifest that publishes the app through the namespace proxy is routed by HOST, so `--domain` is\nREQUIRED for it \u2014 on `register` and on `apps environments put` alike \u2014 and a registration without one is\nrefused before anything is created. `namespaces get` lists the hosts a `zerops-subdomain` namespace\nserves and which of them are still free; a custom-domain namespace serves the domain you bound to its\nproxy. A manifest with no proxy target needs no domain.\n\n`apps environments suspend` takes an environment offline in an incident, such as a compromised or leaked application.\nBehind a Zerops namespace proxy every request to it answers 503 once the republished proxy is live, which takes the\nminutes of a proxy build; `namespaces get` follows it. A namespace pinned to an older proxy source is refused with the\nre-pin to run first. On Cloudflare the environment's object goes into maintenance `closed`. `resume` restores the\nrouting it had, or on Cloudflare the maintenance mode it was in. Neither stops the application's service, nor\nrevokes a key. Repeating either is a retry.\n\nA variable's value is stored and printed in clear, so `apps variables put` refuses one that looks like a\ncredential (by its name, such as `*_TOKEN` or `*_PASSWORD`, or by its value) and names `apps secrets put` instead.\n`--not-secret` stores it anyway, for a value you have checked is not one. A secret's value is write-only: `apps secrets put`\nreads it from STDIN, never from a flag, so it reaches neither shell history nor a process listing, and\none trailing newline is dropped. No command prints it back; `apps secrets list` shows names, scope and\nstorage only. Generate one in the pipe:\n\n openssl rand -base64 32 | fabrika control apps secrets put --app=<id> --name=<name>\n\n`--public-origin` is where IAM may return a signed-in person: without one, sign-in to the environment is\nrefused. When `register` is given none and the namespace lists `--domain` among its hosts, it sets\n`https://<domain>` and says so on stderr. A custom domain needs the flag.\n\n`--cross-origin` names an origin whose pages may call the environment's cross-origin endpoints (ADR-0022), and\nrepeats: the flags given are the environment's whole list. Each is an exact origin with a literal host\n(`https://app.example.com`; `http://` only for a local one), never the environment's own domain, at most 16.\n`apps environments put` without the flag keeps the stored list, and a lone empty `--cross-origin=` clears it.\nOn Zerops the change reaches the namespace proxy at once; on Cloudflare the next deploy of the environment\napplies it.\n\n`--installation-id` has three states: omitted resolves the installation from the repository owner's\nconnected GitHub App, `none` registers an anonymous PUBLIC repository source, and a number names one\ninstallation outright. With `none`, control reads the repository once without a token and refuses one\nGitHub hides: a private repository needs the GitHub App connected in the console first.\n\n`--trigger-ref` is the git ref whose push deploys the environment; without it the environment deploys only\non `deploy`. A bare name is a branch: `--trigger-ref=deploy/prod` is stored as `refs/heads/deploy/prod`.\nA full ref is kept as given: `refs/heads/<branch>`, `refs/tags/<tag>`, or a `*` glob such as\n`refs/tags/v*`, which deploys every matching tag. A tag always needs the `refs/tags/` form. Each\nenvironment of an app needs its own trigger ref. Branches named `fabrika/\u2026` are reserved for MCP\nworkspaces and are never a trigger ref.\n\n`deploy` of a protected environment with `FABRIKA_CONTROL_KEY` or a device grant is a request a person approves:\n`--ref` names a 40-character commit SHA, by default one merged into the environment's trigger ref (or the default\nbranch), and stderr prints the console link the person opens. `--wait` follows the run until it succeeds or\nfails, approval being one step on the way, and prints its final row; a refusal or an expiry says so on stderr.\n\n`requests get` reads one approval request: a change an agent or a key asked a person to approve, by the id its\ncreation answered. stderr prints the console link while it waits, and why it did not run once it failed, went stale or\nexpired. `--wait` reads it again until it is refused, expired, executed, failed or stale, and prints its final row;\nonce a person decided it, it stops with an error after 15 minutes without an outcome.\n\n`--request` on `apps secrets put|delete` and `apps variables put|delete` does not make the change: it asks a person\nto approve it. Every other verb refuses it. Control stores the request, inert, and stderr prints the console link the person opens; for a secret it\nalso prints the value's fingerprint (the first 8 hex characters of its SHA-256, computed here), which the page shows\nbeside the value's length, so the person can tell it is the value you sent; when Control's answer names another\nfingerprint, the command fails and says to refuse the request. Control seals the value and stores only that. stdout\nprints the request's id, state and link; `--wait` follows it as `requests get --wait` does. Without `--env` the request\nis for every environment of the app, and every protected one judges it. A secret the provider keeps (a Zerops\nenvironment) is requested for one `--env`.\n\n`access request-grant` asks a person to give a principal (this agent's own, or another) one role of an application\nenvironment. It needs `access.request` at the app, the role must be one the environment's approved contract declares,\na membership role takes `--scope` with a value of its dimension, and `--expires-in` is at most 30 days. An IAM\nadministrator of the application approves it at the console link stderr prints; the grant is then theirs, and where\nthe application's grants wait for approval, IAM holds it for a second administrator. An environment that does not gate\nan agent's grants (not protected, or `agent-grants` off) refuses it: there is nothing to approve there. stdout prints\nthe request's id, state and link; `--wait` follows it as `requests get --wait` does.\n\nWithout `--request`, a write by `FABRIKA_CONTROL_KEY` or a device grant on a protected environment meets that\nenvironment's approval policy (ADR-0083): `apps secrets` and `apps variables` are `secrets` and `variables` writes,\n`apps environments put` is a `registry` write, and `apps environments suspend|resume` are `data` writes.\nA category set to `off` applies the write; `refuse` refuses it; `person` does not make the change but stores it as a\nrequest, exactly as `--request` does: stdout prints its id, state and link, stderr the fingerprint of a secret, and the\ncommand exits 75. Hand the person the link; nothing changes until they approve it. `--wait` follows the request\ninstead, and succeeds only when it executed.\n\n`access request-key` asks a person for a key holding exact Control actions at one application (each `--action`, no\nwildcard), for someone other than this agent, expiring in at most 30 days. It needs `access.request` at the app, and\nthe protected environments' `credentialCeiling` decides whether the key may hold actions this agent does not. It\nmakes a key pair in memory, sends only the public key, and prints on stderr the console link and the public key's\nthumbprint, which the page shows: an IAM installation administrator checks it there and approves with a passkey. IAM\nencrypts the key to that public key, and Control hands it out once. `--wait` is required: the private key never leaves\nthis process, so the key cannot be fetched later; the command waits for the decision, fetches the key, decrypts it, and\nprints it once on stdout. A request that issues no key (refused, expired, failed) fails with why.\n\nNamespace placement options, each defaulting to what the preset would choose:\n\n --project=<name> the provider project the namespace owns; on Zerops the default is\n fabrika-<env>-<namespace id>, beside the installation's fabrika-<env>\n --core-package=<LIGHT|SERIOUS> defaults to LIGHT on every environment, `prod` included (ADR-0038).\n SERIOUS is a deliberate choice: a project cannot be downgraded again\n --public-access=<custom-domain|zerops-subdomain>\n --exclusive-app=<id> required by, and only by, the `full` preset\n --postgres-type=<type> the `cheap` preset's shared PostgreSQL; on Zerops postgresql:single@18\n (default) or postgresql:ha@18, which keeps its data through a node loss.\n Fixed once created\n --postgres-profile=<profile> its profile, given together with --postgres-type: oltp-hobby for single,\n oltp-staging (about $11) or oltp-production (about $72) for HA\n\n`namespaces plan` is a preview and changes nothing. It prints one `<path>\\t<value>` row per field of\nthe plan, keyed by its path in `--json`; a multi-line value such as the proxy's descriptor file is shown\nby size only. `namespaces create` commits that exact plan \u2014 the\nsame two steps the console's form takes \u2014 and returns as soon as the placement is recorded: provisioning\nruns behind the control queue and takes minutes, so the state comes back `pending`. Follow it with\n`namespaces get` or `namespaces list`; nothing needs to stay connected. `namespaces remove` frees the id\nof a placement no application is registered in. It deletes nothing at the provider and prints, on stderr,\nthe provider resources it stopped tracking. `namespaces update --proxy-source=current` re-pins a placement's\nproxy to the source this control plane deploys new placements from \u2014 a placement keeps the one it was created\nwith until you do \u2014 and queues the reconcile that rebuilds the proxy from it; a `failed` placement accepts it.\n\n`namespaces release-claims` frees the resource names one app environment holds in a placement, which an\nenvironment or app delete otherwise refuses over. Delete those resources at the provider first: the release\nreads each one back and refuses, naming it, while any still exists. It prints one released key per line.\n\nEvery command accepts --json, which prints the procedure's result verbatim.\n\nThe control origin is not a credential and takes either form:\n\n --url=<origin> FABRIKA_CONTROL_URL\n\nCredentials are read from the ENVIRONMENT ONLY and have no flag, so they cannot reach a CI log or a\nprocess listing. One of:\n\n FABRIKA_CONTROL_KEY a machine `px_` credential for the control app; it wins when both are set\n FABRIKA_CONTROL_CREDENTIAL_HELPER a command with `get` and `store` that holds the refresh token of a\n `control auth device` grant (below)\n\n`auth device` asks IAM for a grant a person approves in the browser (RFC 8628). It prints the page and the\ncode on stderr and waits; the person signs in, checks the code, and picks how long the grant lasts (an hour, a\nday or a week). The grant holds the preset's actions at one application, never more than that person may:\n\n read deploy.read, data.read, operations.read\n deploy read, and deploy.trigger\n operate deploy, secret.manage, app.manage and operations.triage\n create app.manage wherever the person holds it, with no --app: it also changes and deletes apps\n\nThe refresh token goes to the helper and nowhere else: the helper runs as `sh -c '<helper> get|store'`,\nreads `origin=<console origin>` (and, for `store`, `refresh_token=<token>`) on stdin, and `get` prints\n`refresh_token=<token>`, or nothing. Every call then trades it for a short-lived access token, and IAM\nrotates it each time; a lock under $XDG_CACHE_HOME/fabrika (~/.cache/fabrika when unset) serializes that\nbetween processes on this machine. If a refresh's answer is lost, the stored token is spent and the next\ncall says to run `auth device` again.\n\n`key issue` mints that credential and therefore authenticates differently \u2014 it presents the\ninstallation's IAM RPC key as transport authentication and its provisioning key as the ISSUING\ncredential. Every key expires: `--expires-in` is required and at most 2592000 (30 days). Both\ncredentials are read from the environment only:\n\n FABRIKA_IAM_RPC_URL required IAM's PUBLIC origin, or --iam-url\n FABRIKA_IAM_RPC_KEY required the installation's IAM RPC key\n FABRIKA_IAM_PROVISIONING_KEY required the installation's seeded `px_` provisioning key\n FABRIKA_CONTROL_APP_ID optional the control app's IAM id (default `vozka`)\n\nThe PUBLIC origin is the `https://` address the installation answers on \u2014 the one `platform admin`\nand `platform init` print in their closing block, and the value `FABRIKA_IAM_ISSUER` holds on the\ncontrol service. It is NOT the private hostname the services use between themselves: `http://iam:3000`\nresolves inside the provider's project and nowhere else, so from here it only ever fails to connect.\n\n`external-apps` and `oauth-clients` manage the OAuth clients IAM serves (ADR-0089). They call IAM's admin API\nwith two of the variables `key issue` reads, and nothing else: FABRIKA_IAM_RPC_URL (or --iam-url), IAM's PUBLIC origin,\nand FABRIKA_IAM_PROVISIONING_KEY, the bearer. An external application is an application outside this installation that\nsigns people in through IAM; `put` replaces it whole from a file (record, roles and clients) and is idempotent:\n\n {\n \"app\": \"ops-tool\",\n \"name\": \"Ops tool\",\n \"resource\": \"https://ops.example.com\",\n \"roles\": [{ \"key\": \"viewer\", \"name\": \"Viewer\" }],\n \"clients\": [{ \"clientId\": \"https://ops.example.com/oauth/client.json\",\n \"redirectUris\": [\"https://ops.example.com/oauth/callback\"], \"metadataUrl\": null }]\n }\n\n`roles` null or left out: every active user of the installation signs in. `get` prints the same file, ready to edit\nand put back. Removing a client, changing the resource or deleting the application revokes the sign-ins through it.\n`oauth-clients put` writes an MCP authoring client, whose tokens reach the console's /mcp:\n\n { \"clientId\": \"https://claude.ai/oauth/mcp-oauth-client-metadata\", \"label\": \"claude\",\n \"redirectUris\": [\"https://claude.ai/api/mcp/auth_callback\"] }\n\n`label` is claude, chatgpt or external. A client of an external application is written only through\n`external-apps put`, and `oauth-clients` refuses it. `put` checks the file before anything is sent.\nThe console registers external applications too, under Access \u2192 External applications.\n\nConnecting a GitHub source is NOT here and will not be: App creation is a browser flow whose\nauthorization requires a human principal (ADR-0029). Use Settings \u2192 Source in the console.\n";
6
+ declare const USAGE = "fabrika control \u2014 operate the Delivery control plane\n\nUsage:\n fabrika control auth device --preset=<read|deploy|operate|create|admin> [--app=<id>]\n fabrika control key issue --label=<name> --permissions=<a,b,c> --expires-in=<seconds> [--iam-url=<origin>]\n fabrika control apps list\n fabrika control apps get --app=<id>\n fabrika control apps environments list --app=<id>\n fabrika control apps environments put --provider=<name> --app=<id> --env=<name> --manifest=<path>\n [--domain=<host>] [--public-origin=<url>] [--trigger-ref=<ref>] [--namespace=<id>]\n [--cross-origin=<origin> ...] [--kind=standard|dev] [--wait]\n fabrika control apps environments suspend --app=<id> --env=<name> [--wait]\n fabrika control apps environments resume --app=<id> --env=<name> [--wait]\n fabrika control apps variables list --app=<id>\n fabrika control apps variables put --app=<id> --name=<name> --value=<text> [--env=<name>] [--not-secret] [--request] [--wait]\n fabrika control apps variables delete --app=<id> --name=<name> [--env=<name>] [--request] [--wait]\n fabrika control apps secrets list --app=<id>\n fabrika control apps secrets put --app=<id> --name=<name> [--env=<name>] [--request] [--wait] (the value on stdin)\n fabrika control apps secrets delete --app=<id> --name=<name> [--env=<name>] [--request] [--wait]\n fabrika control register --provider=<name> --app=<id> --repo=<url> --env=<name> --manifest=<path>\n [--domain=<host>] [--public-origin=<url>] [--trigger-ref=<ref>]\n [--namespace=<id>] [--installation-id=<n|none>] [--cross-origin=<origin> ...]\n fabrika control namespaces list\n fabrika control namespaces get --namespace=<id>\n fabrika control namespaces plan --namespace=<id> --env=<name> --preset=<cheap|mid|full> [placement]\n fabrika control namespaces create --namespace=<id> --env=<name> --preset=<cheap|mid|full> [placement]\n fabrika control namespaces reconcile --namespace=<id>\n fabrika control namespaces update --namespace=<id> --proxy-source=current\n fabrika control namespaces remove --namespace=<id>\n fabrika control namespaces release-claims --namespace=<id> --app=<id> --env=<name>\n fabrika control deploy --app=<id> --env=<name> [--ref=<ref>] [--wait]\n fabrika control runs list [--app=<id>] [--env=<name>] [--limit=<n>]\n fabrika control runs get --run=<id>\n fabrika control runs log --run=<id>\n fabrika control requests get <id> [--wait]\n fabrika control access request-grant --app=<id> --env=<name> --principal=<id> --role=<role>\n [--scope=<dimension>:<value>] --expires-in=<seconds> [--wait]\n fabrika control access request-key --app=<id> --action=<action> [--action=<action>\u2026] --label=<text>\n --expires-in=<seconds> --wait\n fabrika control external-apps list | get <app> | put --file=<app.json> | delete <app> [--iam-url=<origin>]\n fabrika control oauth-clients list | put --file=<client.json> | delete <client id> [--iam-url=<origin>]\n\n`register` CREATES an app and refuses a second one with the same id. Re-registering a changed\nmanifest \u2014 a new import document, or a new `zerops.yaml` of an app without a contract \u2014 is\n`apps environments put`, which replaces one environment's envelopes and leaves the app row alone. A\ncontract app's deploy registers the `zerops.yaml` of its commit itself.\n\nA manifest that publishes the app through the namespace proxy is routed by HOST, so `--domain` is\nREQUIRED for it \u2014 on `register` and on `apps environments put` alike \u2014 and a registration without one is\nrefused before anything is created. `namespaces get` lists the hosts a `zerops-subdomain` namespace\nserves and which of them are still free; a custom-domain namespace serves the domain you bound to its\nproxy. A manifest with no proxy target needs no domain.\n\n`apps environments suspend` takes an environment offline in an incident, such as a compromised or leaked application.\nBehind a Zerops namespace proxy every request to it answers 503 once the republished proxy is live, which takes the\nminutes of a proxy build; `namespaces get` follows it. A namespace pinned to an older proxy source is refused with the\nre-pin to run first. On Cloudflare the environment's object goes into maintenance `closed`. `resume` restores the\nrouting it had, or on Cloudflare the maintenance mode it was in. Neither stops the application's service, nor\nrevokes a key. Repeating either is a retry.\n\nA variable's value is stored and printed in clear, so `apps variables put` refuses one that looks like a\ncredential (by its name, such as `*_TOKEN` or `*_PASSWORD`, or by its value) and names `apps secrets put` instead.\n`--not-secret` stores it anyway, for a value you have checked is not one. A secret's value is write-only: `apps secrets put`\nreads it from STDIN, never from a flag, so it reaches neither shell history nor a process listing, and\none trailing newline is dropped. No command prints it back; `apps secrets list` shows names, scope and\nstorage only. Generate one in the pipe:\n\n openssl rand -base64 32 | fabrika control apps secrets put --app=<id> --name=<name>\n\n`--public-origin` is where IAM may return a signed-in person: without one, sign-in to the environment is\nrefused. When `register` is given none and the namespace lists `--domain` among its hosts, it sets\n`https://<domain>` and says so on stderr. A custom domain needs the flag.\n\n`--cross-origin` names an origin whose pages may call the environment's cross-origin endpoints (ADR-0022), and\nrepeats: the flags given are the environment's whole list. Each is an exact origin with a literal host\n(`https://app.example.com`; `http://` only for a local one), never the environment's own domain, at most 16.\n`apps environments put` without the flag keeps the stored list, and a lone empty `--cross-origin=` clears it.\nOn Zerops the change reaches the namespace proxy at once; on Cloudflare the next deploy of the environment\napplies it.\n\n`--installation-id` has three states: omitted resolves the installation from the repository owner's\nconnected GitHub App, `none` registers an anonymous PUBLIC repository source, and a number names one\ninstallation outright. With `none`, control reads the repository once without a token and refuses one\nGitHub hides: a private repository needs the GitHub App connected in the console first.\n\n`--trigger-ref` is the git ref whose push deploys the environment; without it the environment deploys only\non `deploy`. A bare name is a branch: `--trigger-ref=deploy/prod` is stored as `refs/heads/deploy/prod`.\nA full ref is kept as given: `refs/heads/<branch>`, `refs/tags/<tag>`, or a `*` glob such as\n`refs/tags/v*`, which deploys every matching tag. A tag always needs the `refs/tags/` form. Each\nenvironment of an app needs its own trigger ref. Branches named `fabrika/\u2026` are reserved for MCP\nworkspaces and are never a trigger ref.\n\n`deploy` of a protected environment with `FABRIKA_CONTROL_KEY` or a device grant is a request a person approves:\n`--ref` names a 40-character commit SHA, by default one merged into the environment's trigger ref (or the default\nbranch), and stderr prints the console link the person opens. `--wait` follows the run until it succeeds or\nfails, approval being one step on the way, and prints its final row; a refusal or an expiry says so on stderr.\n\n`requests get` reads one approval request: a change an agent or a key asked a person to approve, by the id its\ncreation answered. stderr prints the console link while it waits, and why it did not run once it failed, went stale or\nexpired. `--wait` reads it again until it is refused, expired, executed, failed or stale, and prints its final row;\nonce a person decided it, it stops with an error after 15 minutes without an outcome.\n\n`--request` on `apps secrets put|delete` and `apps variables put|delete` does not make the change: it asks a person\nto approve it. Every other verb refuses it. Control stores the request, inert, and stderr prints the console link the person opens; for a secret it\nalso prints the value's fingerprint (the first 8 hex characters of its SHA-256, computed here), which the page shows\nbeside the value's length, so the person can tell it is the value you sent; when Control's answer names another\nfingerprint, the command fails and says to refuse the request. Control seals the value and stores only that. stdout\nprints the request's id, state and link; `--wait` follows it as `requests get --wait` does. Without `--env` the request\nis for every environment of the app, and every protected one judges it. A secret the provider keeps (a Zerops\nenvironment) is requested for one `--env`.\n\n`access request-grant` asks a person to give a principal (this agent's own, or another) one role of an application\nenvironment. It needs `access.request` at the app, the role must be one the environment's approved contract declares,\na membership role takes `--scope` with a value of its dimension, and `--expires-in` is at most 30 days. An IAM\nadministrator of the application approves it at the console link stderr prints; the grant is then theirs, and where\nthe application's grants wait for approval, IAM holds it for a second administrator. An environment that does not gate\nan agent's grants (not protected, or `agent-grants` off) refuses it: there is nothing to approve there. stdout prints\nthe request's id, state and link; `--wait` follows it as `requests get --wait` does.\n\nWithout `--request`, a write by `FABRIKA_CONTROL_KEY` or a device grant on a protected environment meets that\nenvironment's approval policy (ADR-0083): `apps secrets` and `apps variables` are `secrets` and `variables` writes,\n`apps environments put` is a `registry` write, and `apps environments suspend|resume` are `data` writes.\nA category set to `off` applies the write; `refuse` refuses it; `person` does not make the change but stores it as a\nrequest, exactly as `--request` does: stdout prints its id, state and link, stderr the fingerprint of a secret, and the\ncommand exits 75. Hand the person the link; nothing changes until they approve it. `--wait` follows the request\ninstead, and succeeds only when it executed.\n\n`access request-key` asks a person for a key holding exact Control actions at one application (each `--action`, no\nwildcard), for someone other than this agent, expiring in at most 30 days. It needs `access.request` at the app, and\nthe protected environments' `credentialCeiling` decides whether the key may hold actions this agent does not. It\nmakes a key pair in memory, sends only the public key, and prints on stderr the console link and the public key's\nthumbprint, which the page shows: an IAM installation administrator checks it there and approves with a passkey. IAM\nencrypts the key to that public key, and Control hands it out once. `--wait` is required: the private key never leaves\nthis process, so the key cannot be fetched later; the command waits for the decision, fetches the key, decrypts it, and\nprints it once on stdout. A request that issues no key (refused, expired, failed) fails with why.\n\nNamespace placement options, each defaulting to what the preset would choose:\n\n --project=<name> the provider project the namespace owns; on Zerops the default is\n fabrika-<env>-<namespace id>, beside the installation's fabrika-<env>\n --core-package=<LIGHT|SERIOUS> defaults to LIGHT on every environment, `prod` included (ADR-0038).\n SERIOUS is a deliberate choice: a project cannot be downgraded again\n --public-access=<custom-domain|zerops-subdomain>\n --exclusive-app=<id> required by, and only by, the `full` preset\n --postgres-type=<type> the `cheap` preset's shared PostgreSQL; on Zerops postgresql:single@18\n (default) or postgresql:ha@18, which keeps its data through a node loss.\n Fixed once created\n --postgres-profile=<profile> its profile, given together with --postgres-type: oltp-hobby for single,\n oltp-staging (about $11) or oltp-production (about $72) for HA\n\n`namespaces plan` is a preview and changes nothing. It prints one `<path>\\t<value>` row per field of\nthe plan, keyed by its path in `--json`; a multi-line value such as the proxy's descriptor file is shown\nby size only. `namespaces create` commits that exact plan \u2014 the\nsame two steps the console's form takes \u2014 and returns as soon as the placement is recorded: provisioning\nruns behind the control queue and takes minutes, so the state comes back `pending`. Follow it with\n`namespaces get` or `namespaces list`; nothing needs to stay connected. `namespaces remove` frees the id\nof a placement no application is registered in. It deletes nothing at the provider and prints, on stderr,\nthe provider resources it stopped tracking. `namespaces update --proxy-source=current` re-pins a placement's\nproxy to the source this control plane deploys new placements from \u2014 a placement keeps the one it was created\nwith until you do \u2014 and queues the reconcile that rebuilds the proxy from it; a `failed` placement accepts it.\n\n`namespaces release-claims` frees the resource names one app environment holds in a placement, which an\nenvironment or app delete otherwise refuses over. Delete those resources at the provider first: the release\nreads each one back and refuses, naming it, while any still exists. It prints one released key per line.\n\nEvery command accepts --json, which prints the procedure's result verbatim.\n\nThe control origin is not a credential and takes either form:\n\n --url=<origin> FABRIKA_CONTROL_URL\n\nCredentials are read from the ENVIRONMENT ONLY and have no flag, so they cannot reach a CI log or a\nprocess listing. One of:\n\n FABRIKA_CONTROL_KEY a machine `px_` credential for the control app; it wins when both are set\n FABRIKA_CONTROL_CREDENTIAL_HELPER a command with `get` and `store` that holds the refresh token of a\n `control auth device` grant (below)\n\n`auth device` asks IAM for a grant a person approves in the browser (RFC 8628). It prints the page and the\ncode on stderr and waits; the person signs in, checks the code, and picks how long the grant lasts (an hour, a\nday or a week). The grant holds the preset's actions at one application, never more than that person may:\n\n read deploy.read, data.read, operations.read\n deploy read, and deploy.trigger\n operate deploy, secret.manage, app.manage and operations.triage\n create app.manage wherever the person holds it, with no --app: it also changes and deletes apps\n admin iam.admin on IAM's administration API, with no --app, for one hour at most: the whole installation's\n identity and access; `external-apps` uses it (below), and every call it makes is recorded with the grant\n\nThe refresh token goes to the helper and nowhere else: the helper runs as `sh -c '<helper> get|store'`,\nreads `origin=<origin>` (the console's, or IAM's for `admin`; for `store` also `refresh_token=<token>`) on stdin, and `get` prints\n`refresh_token=<token>`, or nothing. Every call then trades it for a short-lived access token, and IAM\nrotates it each time; a lock under $XDG_CACHE_HOME/fabrika (~/.cache/fabrika when unset) serializes that\nbetween processes on this machine. If a refresh's answer is lost, the stored token is spent and the next\ncall says to run `auth device` again.\n\n`key issue` mints that credential and therefore authenticates differently \u2014 it presents the\ninstallation's IAM RPC key as transport authentication and its provisioning key as the ISSUING\ncredential. Every key expires: `--expires-in` is required and at most 2592000 (30 days). Both\ncredentials are read from the environment only:\n\n FABRIKA_IAM_RPC_URL required IAM's PUBLIC origin, or --iam-url\n FABRIKA_IAM_RPC_KEY required the installation's IAM RPC key\n FABRIKA_IAM_PROVISIONING_KEY required the installation's seeded `px_` provisioning key\n FABRIKA_CONTROL_APP_ID optional the control app's IAM id (default `vozka`)\n\nThe PUBLIC origin is the `https://` address the installation answers on \u2014 the one `platform admin`\nand `platform init` print in their closing block, and the value `FABRIKA_IAM_ISSUER` holds on the\ncontrol service. It is NOT the private hostname the services use between themselves: `http://iam:3000`\nresolves inside the provider's project and nowhere else, so from here it only ever fails to connect.\n\n`external-apps` and `oauth-clients` manage the OAuth clients IAM serves (ADR-0089). They call IAM's admin API\nwith two of the variables `key issue` reads, and nothing else: FABRIKA_IAM_RPC_URL (or --iam-url), IAM's PUBLIC origin,\nand FABRIKA_IAM_PROVISIONING_KEY, the bearer. Without the key, `external-apps` uses the `auth device --preset=admin`\ngrant FABRIKA_CONTROL_CREDENTIAL_HELPER holds, and so does `oauth-clients list`; IAM takes only the key for\n`oauth-clients put` and `delete`. An external application is an application outside this installation that\nsigns people in through IAM; `put` replaces it whole from a file (record, roles and clients) and is idempotent:\n\n {\n \"app\": \"ops-tool\",\n \"name\": \"Ops tool\",\n \"resource\": \"https://ops.example.com\",\n \"roles\": [{ \"key\": \"viewer\", \"name\": \"Viewer\" }],\n \"clients\": [{ \"clientId\": \"https://ops.example.com/oauth/client.json\",\n \"redirectUris\": [\"https://ops.example.com/oauth/callback\"], \"metadataUrl\": null }]\n }\n\n`roles` null or left out: every active user of the installation signs in. `get` prints the same file, ready to edit\nand put back. Removing a client, changing the resource or deleting the application revokes the sign-ins through it.\n`oauth-clients put` writes an MCP authoring client, whose tokens reach the console's /mcp:\n\n { \"clientId\": \"https://claude.ai/oauth/mcp-oauth-client-metadata\", \"label\": \"claude\",\n \"redirectUris\": [\"https://claude.ai/api/mcp/auth_callback\"] }\n\n`label` is claude, chatgpt or external. A client of an external application is written only through\n`external-apps put`, and `oauth-clients` refuses it. `put` checks the file before anything is sent.\nThe console registers external applications too, under Access \u2192 External applications.\n\nConnecting a GitHub source is NOT here and will not be: App creation is a browser flow whose\nauthorization requires a human principal (ADR-0029). Use Settings \u2192 Source in the console.\n";
7
7
  interface Flags {
8
8
  readonly values: ReadonlyMap<string, string>;
9
9
  /** Every value of every option, in order; `values` keeps the last. Only a repeatable option reads it. */
@@ -69,8 +69,8 @@ export interface SecretValueInput {
69
69
  export declare const namespaceLine: (namespace: Pick<DeploymentNamespaceDto, "id" | "env" | "state" | "exclusiveAppId">) => string;
70
70
  export declare const namespacePlanLines: (plan: PlanDeploymentNamespaceResponse) => string[];
71
71
  export type IamAdminClient = InferRpcClient<IamAdminRpcContract>;
72
- /** IAM's admin RPC at its public origin, with the provisioning key from the environment only and no redirect followed. */
73
- export declare const iamAdminClient: (url: string | undefined, env: Readonly<Record<string, string | undefined>>, send?: RpcFetch) => IamAdminClient;
72
+ /** IAM's admin RPC at its public origin, with a credential from the environment only and no redirect followed. */
73
+ export declare const iamAdminClient: (url: string | undefined, env: Readonly<Record<string, string | undefined>>, send?: RpcFetch, oauth?: ControlOAuthDependencies) => IamAdminClient;
74
74
  /** An `externalApps.put` request from a file, checked against the contract before it is sent; IAM checks it again. */
75
75
  export declare const parseExternalAppFile: (value: JsonValue, path: string) => PutExternalAppRequest;
76
76
  /** An `oauthClients.put` request (an MCP authoring client) from a file, checked against the contract before it is sent. */