@kici-dev/orchestrator 0.14.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/__test-helpers__/peer-mutual-auth.d.ts +42 -0
  2. package/dist/__test-helpers__/scratch-db.d.ts +16 -0
  3. package/dist/agent/host-roster.d.ts +100 -37
  4. package/dist/agent/registry.d.ts +1 -8
  5. package/dist/app-on-error.d.ts +1 -1
  6. package/dist/app.d.ts +4 -2
  7. package/dist/artifacts/artifact-store.d.ts +0 -2
  8. package/dist/audit/access-log.d.ts +1 -1
  9. package/dist/cache/source-cache.d.ts +1 -1
  10. package/dist/cache/user-cache.d.ts +0 -28
  11. package/dist/cli/api-client.d.ts +27 -1
  12. package/dist/cli/commands/access-log.d.ts +1 -1
  13. package/dist/cli/commands/cold-store-impl.d.ts +7 -84
  14. package/dist/cli/commands/db.d.ts +1 -0
  15. package/dist/cli/commands/host.d.ts +3 -0
  16. package/dist/cli/commands/orchestrator-service/status.d.ts +2 -0
  17. package/dist/cli/commands/org.d.ts +12 -0
  18. package/dist/cli/commands/scaler.d.ts +14 -0
  19. package/dist/cli/commands/secret.d.ts +1 -45
  20. package/dist/cli/commands/service-health.d.ts +21 -13
  21. package/dist/cli/commands/shared/cli-action.d.ts +17 -0
  22. package/dist/cli/commands/shared/db.d.ts +5 -5
  23. package/dist/cli/commands/shared/org-id.d.ts +5 -0
  24. package/dist/cli/commands/shared/service-verbs.d.ts +19 -0
  25. package/dist/cli/commands/shared/table.d.ts +3 -0
  26. package/dist/cli/commands/shared/unbound-context-warning.d.ts +2 -22
  27. package/dist/cli/commands/source-manifest.d.ts +3 -3
  28. package/dist/cli/commands/source.d.ts +23 -0
  29. package/dist/cli/commands/trust-policy.d.ts +7 -31
  30. package/dist/cli/join.d.ts +2 -2
  31. package/dist/cli/kici-admin.d.ts +6 -1
  32. package/dist/cli/local-github-ingress-url.d.ts +6 -0
  33. package/dist/cli/root-option-routing.d.ts +46 -0
  34. package/dist/cli/webhook-url-notes.d.ts +15 -0
  35. package/dist/cli.js +10667 -8461
  36. package/dist/cluster/coordinator-credential.d.ts +21 -0
  37. package/dist/cluster/coordinator.d.ts +2 -2
  38. package/dist/cluster/index.d.ts +4 -4
  39. package/dist/cluster/join-client.d.ts +23 -21
  40. package/dist/cluster/join-handler.d.ts +24 -16
  41. package/dist/cluster/join-protocol-v2.d.ts +84 -0
  42. package/dist/cluster/join-token.d.ts +78 -56
  43. package/dist/cluster/peer-auth-coordinator.d.ts +16 -2
  44. package/dist/cluster/peer-client.d.ts +99 -5
  45. package/dist/cluster/peer-crypto.d.ts +60 -3
  46. package/dist/cluster/peer-discovery.d.ts +67 -0
  47. package/dist/cluster/peer-forget.d.ts +4 -9
  48. package/dist/cluster/peer-handler.d.ts +28 -6
  49. package/dist/cluster/peer-registry.d.ts +15 -1
  50. package/dist/cluster/peer-request-waiters.d.ts +26 -0
  51. package/dist/cluster/scaler-orphans-peer.d.ts +4 -9
  52. package/dist/cluster/scaler-reload-fanout.d.ts +29 -0
  53. package/dist/cluster/scaler-reload-peer.d.ts +16 -0
  54. package/dist/cluster/worker-cluster-settings.d.ts +1 -0
  55. package/dist/cold-store/load-access-log-range.d.ts +3 -3
  56. package/dist/cold-store/tables/access-log.d.ts +4 -12
  57. package/dist/cold-store/tables/event-log.d.ts +8 -19
  58. package/dist/cold-store/tables/execution-jobs.d.ts +7 -24
  59. package/dist/cold-store/tables/execution-runs.d.ts +6 -20
  60. package/dist/cold-store/tables/execution-steps.d.ts +8 -26
  61. package/dist/cold-store/tables/secret-audit-log.d.ts +4 -11
  62. package/dist/config/env-overlay.d.ts +3 -8
  63. package/dist/config/reload.d.ts +9 -2
  64. package/dist/config/schema.d.ts +16 -2
  65. package/dist/config/types.d.ts +6 -2
  66. package/dist/config.d.ts +22 -17
  67. package/dist/contexts/held-runs.d.ts +3 -6
  68. package/dist/dashboard/cursor.d.ts +12 -0
  69. package/dist/dashboard/handler.d.ts +5 -12
  70. package/dist/db/deferred-index-build.d.ts +42 -0
  71. package/dist/db/deferred-indexes.d.ts +3 -37
  72. package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +3 -5
  73. package/dist/db/migrations/157_host_roster_identity_source.d.ts +21 -0
  74. package/dist/db/migrations/158_normalize_legacy_values.d.ts +4 -0
  75. package/dist/db/repos/org-ids-repo.d.ts +87 -0
  76. package/dist/db/schema-snapshot.generated.d.ts +3 -0
  77. package/dist/db/types.d.ts +21 -24
  78. package/dist/fault-injection-types.d.ts +0 -6
  79. package/dist/git/dispatch-git-auth.d.ts +6 -12
  80. package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +25 -13
  81. package/dist/helpers/json.d.ts +3 -0
  82. package/dist/index.d.ts +1 -1
  83. package/dist/index.js +357 -216
  84. package/dist/metrics/prometheus.d.ts +0 -5
  85. package/dist/oidc/id-token-claims.d.ts +1 -1
  86. package/dist/oidc/resolve-signer.d.ts +2 -4
  87. package/dist/orchestrator-core.d.ts +10 -3
  88. package/dist/pipeline/global-eval-round.d.ts +2 -26
  89. package/dist/pipeline/install-secrets-resolver.d.ts +0 -3
  90. package/dist/pipeline/manual-schedule.d.ts +1 -7
  91. package/dist/provenance/dispatch-context.d.ts +5 -7
  92. package/dist/provenance/pending-attestations-repo.d.ts +1 -1
  93. package/dist/provenance/trust-root.d.ts +4 -5
  94. package/dist/provenance/verify-deferred-capture.d.ts +3 -3
  95. package/dist/provider-registry.d.ts +13 -40
  96. package/dist/providers/github/manifest.d.ts +58 -7
  97. package/dist/providers/universal-git/ssh-auth.d.ts +0 -5
  98. package/dist/reporting/check-run-reporter.d.ts +8 -21
  99. package/dist/reporting/check-run-summary.d.ts +2 -2
  100. package/dist/reporting/execution-tracker.d.ts +1 -1
  101. package/dist/reporting/log-chunk-sink.d.ts +1 -1
  102. package/dist/reporting/run-summary-fields.d.ts +25 -0
  103. package/dist/reporting/s3-log-storage.d.ts +2 -2
  104. package/dist/routes/admin-access-log.d.ts +2 -9
  105. package/dist/routes/admin-backends.d.ts +2 -9
  106. package/dist/routes/admin-cluster-name.d.ts +2 -8
  107. package/dist/routes/admin-cluster-settings.d.ts +2 -8
  108. package/dist/routes/admin-config.d.ts +0 -3
  109. package/dist/routes/admin-contexts.d.ts +3 -11
  110. package/dist/routes/admin-db.d.ts +2 -9
  111. package/dist/routes/admin-env.d.ts +33 -0
  112. package/dist/routes/admin-event-dlq.d.ts +2 -9
  113. package/dist/routes/admin-event-inspect.d.ts +2 -9
  114. package/dist/routes/admin-event-log.d.ts +2 -9
  115. package/dist/routes/admin-events.d.ts +3 -13
  116. package/dist/routes/admin-held-runs.d.ts +2 -8
  117. package/dist/routes/admin-list-limit.d.ts +3 -0
  118. package/dist/routes/admin-maintenance.d.ts +2 -9
  119. package/dist/routes/admin-orchestrator-drain.d.ts +2 -9
  120. package/dist/routes/admin-org-settings.d.ts +2 -8
  121. package/dist/routes/admin-orgs.d.ts +27 -0
  122. package/dist/routes/admin-peer-forget.d.ts +2 -9
  123. package/dist/routes/admin-queue-execution.d.ts +3 -10
  124. package/dist/routes/admin-registrations.d.ts +3 -14
  125. package/dist/routes/admin-runs.d.ts +3 -14
  126. package/dist/routes/admin-scaler-orphans.d.ts +2 -9
  127. package/dist/routes/admin-scaler-reload.d.ts +41 -0
  128. package/dist/routes/admin-scheduled-jobs.d.ts +2 -9
  129. package/dist/routes/admin-signing-keys.d.ts +2 -9
  130. package/dist/routes/admin-sources.d.ts +28 -32
  131. package/dist/routes/admin-trust-policy.d.ts +2 -8
  132. package/dist/routes/admin.d.ts +29 -30
  133. package/dist/routes/cluster-join.d.ts +13 -0
  134. package/dist/routes/github-webhook.d.ts +13 -11
  135. package/dist/scaler/bare-metal-backend.d.ts +42 -1
  136. package/dist/scaler/config.d.ts +12 -84
  137. package/dist/scaler/file-reload.d.ts +48 -0
  138. package/dist/scaler/manager.d.ts +47 -33
  139. package/dist/scaler/scaler-state-store.d.ts +5 -0
  140. package/dist/scaler/types.d.ts +8 -9
  141. package/dist/secrets/job-secret-gate.d.ts +2 -5
  142. package/dist/secrets/secret-resolver.d.ts +2 -4
  143. package/dist/security/trust-policy-gate.d.ts +0 -4
  144. package/dist/server.d.ts +6 -17
  145. package/dist/server.js +10933 -10836
  146. package/dist/sources/source-manager.d.ts +0 -24
  147. package/dist/sources/webhook-url-resolvers.d.ts +60 -0
  148. package/dist/standalone.js +10457 -10060
  149. package/dist/worker/reroute-dispatch.d.ts +1 -0
  150. package/dist/worker/reroute-spawn-control.d.ts +1 -3
  151. package/dist/worker-core.d.ts +9 -2
  152. package/dist/ws/agent-handler.d.ts +3 -3
  153. package/dist/ws/dashboard-access.d.ts +57 -0
  154. package/dist/ws/dashboard-backends-handler.d.ts +1 -6
  155. package/dist/ws/dashboard-context-handler.d.ts +10 -15
  156. package/dist/ws/dashboard-fleet-handler.d.ts +4 -3
  157. package/dist/ws/dashboard-fleet-write-handler.d.ts +6 -5
  158. package/dist/ws/dashboard-global-workflows-handler.d.ts +1 -6
  159. package/dist/ws/dashboard-registrations-handler.d.ts +1 -7
  160. package/dist/ws/platform-client.d.ts +94 -327
  161. package/installer-image-digests.json +3 -3
  162. package/package.json +4 -4
  163. package/sbom.spdx.json +53 -53
  164. package/dist/cache/legacy-prefixes.d.ts +0 -19
  165. package/dist/cli/commands/agent-service/logs.d.ts +0 -14
  166. package/dist/cli/commands/agent-service/restart.d.ts +0 -12
  167. package/dist/cli/commands/agent-service/start.d.ts +0 -12
  168. package/dist/cli/commands/agent-service/stop.d.ts +0 -12
  169. package/dist/cli/commands/agent-service/uninstall.d.ts +0 -13
  170. package/dist/cli/commands/cache.d.ts +0 -51
  171. package/dist/cli/commands/orchestrator-service/logs.d.ts +0 -14
  172. package/dist/cli/commands/orchestrator-service/restart.d.ts +0 -12
  173. package/dist/cli/commands/orchestrator-service/start.d.ts +0 -12
  174. package/dist/cli/commands/orchestrator-service/stop.d.ts +0 -12
  175. package/dist/cli/commands/orchestrator-service/uninstall.d.ts +0 -13
  176. package/dist/git/inherited-secret.d.ts +0 -29
@@ -2,56 +2,12 @@
2
2
  * Secret management commands for kici-admin.
3
3
  *
4
4
  * Provides scoped secret operations:
5
- * secret scopes, list, set, delete, fix-prefixed-scopes
5
+ * secret scopes, list, set, delete
6
6
  * secret scope create|rename|delete
7
7
  *
8
8
  * Secret values are write-only -- there is no "get value" command.
9
9
  */
10
10
  import type { Command } from 'commander';
11
11
  import type { AdminApiClient } from '../api-client.js';
12
- /** One planned rename from a stored qualified scope to its bare path. */
13
- export interface PrefixedScopeRename {
14
- from: string;
15
- to: string;
16
- backendName: string;
17
- }
18
- /** One stored scope that cannot be repaired automatically. */
19
- export interface PrefixedScopeSkip {
20
- scope: string;
21
- reason: string;
22
- }
23
- /** Outcome of planning the repair of legacy qualifier-bearing scopes. */
24
- export interface PrefixedScopeFixPlan {
25
- renames: PrefixedScopeRename[];
26
- skips: PrefixedScopeSkip[];
27
- }
28
- /**
29
- * Plan the repair of scopes stored with a `<backend>:` qualifier still attached.
30
- *
31
- * Before backend-qualified routing landed on the HTTP admin plane, a scope
32
- * written as `pg:production` was stored verbatim, so the stored name carries a
33
- * qualifier the resolver now strips before it reaches the store. Such a row is
34
- * unreachable: every read addresses the bare `production`.
35
- *
36
- * Only a `pg:` qualifier is repaired. The scopes handed in come out of the PG
37
- * store, so a row named `vault:foo` is a PG row wearing another backend's
38
- * name: renaming it to `foo` would turn it into a genuine PG secret, moving it
39
- * across a backend boundary and past a `pgCustomerSecrets: false` setting that
40
- * exists to keep customer secrets out of PG. That is the same cross-backend
41
- * move the rename route refuses, so it is reported as a skip instead.
42
- *
43
- * An unregistered head is left alone entirely -- it is an ordinary (if
44
- * unusual) scope path, not a stale qualifier.
45
- *
46
- * A repair whose bare target already exists is SKIPPED, never merged: merging
47
- * two scopes would silently overwrite whichever key the two share, and there
48
- * is no way to tell which value the operator meant to keep.
49
- *
50
- * Pure -- no I/O, so the decision table is unit-testable without a database.
51
- *
52
- * @param scopes - Scope names as currently stored in the PG backend.
53
- * @param backendNames - Names of the registered secret backends.
54
- */
55
- export declare function planPrefixedScopeFixes(scopes: string[], backendNames: string[]): PrefixedScopeFixPlan;
56
12
  export declare function registerSecretCommands(program: Command, getClient: () => AdminApiClient): void;
57
13
  //# sourceMappingURL=secret.d.ts.map
@@ -30,6 +30,26 @@ export interface LocalEndpoint {
30
30
  export declare function readLocalEndpoint(envContent: string, defaultPort: number): LocalEndpoint;
31
31
  /** The URL of `pathname` on `endpoint`, with an IPv6 host bracketed. */
32
32
  export declare function localUrl(endpoint: LocalEndpoint, pathname: string): string;
33
+ /** What a local JSON request got: a body, a refusing status, or no answer at all. */
34
+ export type LocalJsonResult<T> = {
35
+ kind: 'ok';
36
+ status: number;
37
+ body: T;
38
+ } | {
39
+ kind: 'http-error';
40
+ status: number;
41
+ } | {
42
+ kind: 'no-answer';
43
+ };
44
+ /**
45
+ * GET a JSON body from a service on this host. `acceptStatuses` names the
46
+ * non-2xx codes whose body is still an answer; `headers` carries credentials.
47
+ */
48
+ export declare function requestLocalJson<T>(endpoint: LocalEndpoint, pathname: string, opts?: {
49
+ acceptStatuses?: readonly number[];
50
+ timeoutMs?: number;
51
+ headers?: Record<string, string>;
52
+ }): Promise<LocalJsonResult<T>>;
33
53
  /**
34
54
  * GET a JSON body from a service on this host. `acceptStatuses` names the
35
55
  * non-2xx codes whose body is still an answer: `/ready` returns its checks
@@ -39,22 +59,10 @@ export declare function fetchLocalJson<T>(endpoint: LocalEndpoint, pathname: str
39
59
  acceptStatuses?: readonly number[];
40
60
  timeoutMs?: number;
41
61
  }): Promise<T | null>;
42
- /**
43
- * A `/health` body with its deprecated `buildCommit` replaced by its version.
44
- * A service older than this CLI reports a commit ID from KiCI's private
45
- * repository there, which a reader cannot resolve; `--json` keeps the key, a
46
- * string as before, and carries the release version in it. A body that reports
47
- * no `buildCommit` comes back unchanged.
48
- */
49
- export declare function hideBuildCommit<T extends {
50
- version?: string;
51
- buildCommit?: string;
52
- }>(health: T): T;
53
62
  /**
54
63
  * Rows for the build fingerprint and process uptime of a `/health` body. A
55
64
  * field the body lacks is skipped, so a service older than this CLI renders
56
- * the fields it does report. The version line never shows `buildCommit`
57
- * (see {@link hideBuildCommit}).
65
+ * the fields it does report.
58
66
  */
59
67
  export declare function buildInfoRows(health: Partial<LivenessBase & BuildFingerprint & {
60
68
  buildDate: string;
@@ -0,0 +1,17 @@
1
+ /** Commander option flag and help text shared by every command that can bypass HTTP. */
2
+ export declare const DIRECT_DB_URL_FLAG = "--database-url <url>";
3
+ export declare const DIRECT_DB_URL_HELP = "Use direct DB access instead of HTTP (offline mode)";
4
+ /** `--database-url`, else `KICI_DATABASE_URL`, else null (null = use the HTTP admin API). */
5
+ export declare function resolveDirectDbUrl(explicit?: string): string | null;
6
+ /** Like {@link resolveDirectDbUrl} but required: throws when neither source is set. */
7
+ export declare function resolveDatabaseUrl(explicit?: string): string;
8
+ /** Parse an optional integer flag; throws naming the flag on a non-integer. */
9
+ export declare function parseIntOption(raw: string | undefined, label: string): number | undefined;
10
+ /**
11
+ * Wrap a Commander action so any thrown error prints `Error: <message>` to
12
+ * stderr and exits 1.
13
+ */
14
+ export declare function cliAction<A extends unknown[]>(fn: (...args: A) => Promise<void> | void): (...args: A) => Promise<void>;
15
+ /** Print `value` as one JSON line when `json` is set, otherwise hand it to `render`. */
16
+ export declare function printJsonOr<T>(json: boolean | undefined, value: T, render: (v: T) => void): void;
17
+ //# sourceMappingURL=cli-action.d.ts.map
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * Shared database helper for CLI commands that need direct DB access.
3
3
  *
4
- * Provides a withDb() wrapper that creates a database connection from
5
- * KICI_DATABASE_URL, runs a callback, and ensures cleanup.
4
+ * Provides a withDb() wrapper that creates a database connection from the
5
+ * URL it is given (or KICI_DATABASE_URL when none is passed), runs a callback,
6
+ * and ensures cleanup.
6
7
  */
7
8
  import pg from 'pg';
8
9
  import { Kysely } from 'kysely';
9
10
  /**
10
11
  * Execute a callback with a database connection, then clean up.
11
12
  *
12
- * Reads the database URL from KICI_DATABASE_URL.
13
- * Creates a connection pool, runs the callback, and destroys the pool.
13
+ * Connects to `databaseUrl`, or to KICI_DATABASE_URL when none is passed.
14
14
  */
15
- export declare function withDb<T>(fn: (db: Kysely<any>, pool: pg.Pool) => Promise<T>): Promise<T>;
15
+ export declare function withDb<T>(fn: (db: Kysely<any>, pool: pg.Pool) => Promise<T>, databaseUrl?: string | undefined): Promise<T>;
16
16
  //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1,5 @@
1
+ /** Where an operator finds an org id: appended to every org-id input's help. */
2
+ export declare const ORG_LIST_HINT = "kici-admin org list prints the org ids";
3
+ /** Help text of an org-id argument or `--org` option. */
4
+ export declare const ORG_ID_HELP = "Org id (kici-admin org list prints the org ids)";
5
+ //# sourceMappingURL=org-id.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The service lifecycle verbs shared by `kici-admin agent` and `kici-admin orchestrator`:
3
+ * `uninstall`, `start`, `stop`, `restart` and `logs`.
4
+ *
5
+ * Target resolution goes through resolveInstanceTarget — the priority chain every
6
+ * lifecycle command uses (--instance-dir > --name > CWD manifest > refusal with
7
+ * candidate list). `--name` has no default.
8
+ */
9
+ import type { Command } from 'commander';
10
+ export type ServiceComponent = 'agent' | 'orchestrator';
11
+ /**
12
+ * Register `uninstall`, `start`, `stop` and `restart` on a component's command group.
13
+ * Commander lists subcommands in registration order, so the caller places this
14
+ * between `install` and `status`.
15
+ */
16
+ export declare function registerServiceLifecycleVerbs(parent: Command, component: ServiceComponent): void;
17
+ /** Register `logs` on a component's command group (listed after `status`). */
18
+ export declare function registerServiceLogsVerb(parent: Command, component: ServiceComponent): void;
19
+ //# sourceMappingURL=service-verbs.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Render a left-aligned, two-space-gapped text table with a dashed separator row. */
2
+ export declare function renderTable(headers: string[], rows: string[][]): string;
3
+ //# sourceMappingURL=table.d.ts.map
@@ -1,23 +1,3 @@
1
- /**
2
- * The warning `kici-admin context create` and `kici-admin secret set` print
3
- * when a context's secrets cannot reach any job.
4
- *
5
- * A job that lists a context in its `contexts:` receives the context's
6
- * secrets only through the context's scope bindings: the secret resolver reads
7
- * the bindings of the context row the job's declared name matched — a fixed
8
- * context by its exact name, a glob context by its pattern — and returns
9
- * nothing when there are none. So such a context with no binding delivers no
10
- * secret to those jobs, whatever its scopes hold, and nothing fails loudly — a
11
- * workflow's `ctx.secrets.get()` throws at run time instead. A
12
- * `<context>:<key>` git-credential or registry reference to a fixed context
13
- * still reads the scope named after it, through a deprecated fallback; a glob
14
- * context has no such fallback. The warning names the context, that fallback
15
- * where it applies, and the `context bind` command that fixes it.
16
- *
17
- * Advisory only: the lookup runs after the command's own write succeeded, and
18
- * a failed lookup prints nothing, so the command's exit code never changes.
19
- */
20
- import { ContextType } from '@kici-dev/engine';
21
1
  /** The one admin API call the lookup needs, so any client shape satisfies it. */
22
2
  export interface ContextLookupClient {
23
3
  get<T>(path: string): Promise<T>;
@@ -32,8 +12,8 @@ export interface WarnIfContextUnboundArgs {
32
12
  /** Where the warning goes; stderr by default. */
33
13
  warn?: (line: string) => void;
34
14
  }
35
- /** The warning line for a context of `type` with no binding. */
36
- export declare function unboundContextWarning(orgId: string, name: string, type: ContextType): string;
15
+ /** The warning line for a context with no binding. */
16
+ export declare function unboundContextWarning(orgId: string, name: string): string;
37
17
  /**
38
18
  * Print the unbound-context warning when `name` is a context a job can resolve
39
19
  * through (a fixed or glob context, `ContextType`) that has no binding. A
@@ -19,9 +19,9 @@ export interface ManifestSetupOptions {
19
19
  githubOrg?: string;
20
20
  /**
21
21
  * Self-hosted webhook URL override. When set, it is baked verbatim into the
22
- * App manifest's `hook_attributes.url` and the platform-mode webhook-URL
23
- * resolution is skipped — so the flow works even where the auto-resolved KiCI
24
- * platform URL is unavailable. KiCI adds no ingress at this URL; the operator
22
+ * App manifest's `hook_attributes.url` instead of the URL the orchestrator
23
+ * resolves for its mode — so the flow works even where that URL is
24
+ * unavailable. KiCI adds no ingress at this URL; the operator
25
25
  * owns delivery. Advanced/self-hosted only.
26
26
  */
27
27
  webhookUrl?: string;
@@ -21,6 +21,28 @@
21
21
  */
22
22
  import type { Command } from 'commander';
23
23
  import type { AdminApiClient } from '../api-client.js';
24
+ /** Structural row a listed generic/local source exposes for text rendering.
25
+ * Both the HTTP `GenericSourceResponse` and the DB `GenericWebhookSource`
26
+ * satisfy it, so `renderSourceListText` renders either transport's output. */
27
+ interface ListableGenericRow {
28
+ id: string;
29
+ name: string;
30
+ routing_key: string;
31
+ enabled: boolean;
32
+ deleted_at?: unknown;
33
+ }
34
+ /** Render the human-readable `source list` output shared by the HTTP and the
35
+ * direct-DB branches. `hasOrg` mirrors whether `--org` was passed (generic
36
+ * sources are only listed for a specific org). `opts.directDb` marks a direct
37
+ * DB read, which has no ingress URLs to print. */
38
+ export declare function renderSourceListText(githubSources: Array<{
39
+ routingKey: string;
40
+ name: string;
41
+ provider: string;
42
+ ingressUrl?: string | null;
43
+ }>, genericSources: ListableGenericRow[], hasOrg: boolean, opts: {
44
+ directDb: boolean;
45
+ }): void;
24
46
  /** Error shown when both the private key and the webhook secret ask for stdin. */
25
47
  export declare const BOTH_STDIN_ERROR = "cannot read both the private key and the webhook secret from stdin \u2014 use @file or --from-env for one of them";
26
48
  /**
@@ -34,4 +56,5 @@ export declare function resolveWebhookSecret(opts: {
34
56
  privateKeyFromStdin: boolean;
35
57
  }, readStdin?: () => Promise<string>): Promise<string | undefined>;
36
58
  export declare function registerSourceCommands(program: Command, getClient: () => AdminApiClient): void;
59
+ export {};
37
60
  //# sourceMappingURL=source.d.ts.map
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * The two directory writers live in this namespace rather than one of their
19
19
  * own because they are the same org-trust concept as the policy, gated by the
20
- * same mode rule against the same `--customer-id`, and reached through the same
20
+ * same mode rule against the same `--org`, and reached through the same
21
21
  * admin route file. Splitting them out would put half of "who may approve" in a
22
22
  * second top-level command with its own copy of that story. They are siblings
23
23
  * of the `directory` reader rather than subcommands under it, because turning
@@ -40,11 +40,7 @@ import type { AdminApiClient } from '../api-client.js';
40
40
  export interface TrustPolicyView {
41
41
  customerId: string;
42
42
  forkPolicy?: string;
43
- approvalExpiryHours?: number;
44
- /**
45
- * The authoritative hold window. Absent from any orchestrator that predates
46
- * it, in which case `approvalExpiryHours` is the only window on offer.
47
- */
43
+ /** The hold window, in seconds. */
48
44
  approvalExpirySeconds?: number;
49
45
  source: string | null;
50
46
  updatedAt: string | null;
@@ -62,21 +58,13 @@ export declare function formatPolicy(policy: TrustPolicyView, format: string): s
62
58
  * touched to a policy they never set, so the reader of `trust-policy show`
63
59
  * is told outright — with where to look for each individual drop.
64
60
  *
65
- * Returns the lines rather than printing them so the check is unit-testable,
66
- * matching `policyExpiryWarnings` below.
61
+ * Returns the lines rather than printing them so the check is unit-testable.
67
62
  */
68
63
  export declare function forkDropWarnings(policy: TrustPolicyView): string[];
69
64
  /**
70
- * Render the enforced hold window.
71
- *
72
- * A whole number of hours still prints as `72 h`, exactly as it always did, so
73
- * no existing policy's output moves. Anything finer prints in seconds, because
74
- * the hours spelling cannot express it and rounding would report a window the
75
- * orchestrator is not applying.
76
- *
77
- * A policy carrying neither field is an orchestrator old enough to have
78
- * resolved no policy at all (see {@link TrustPolicyView}); one carrying only
79
- * hours is an orchestrator that predates the seconds window.
65
+ * Render the enforced hold window in the duration spelling `--approval-expiry`
66
+ * takes (`72h`, `1h30m`). A policy carrying no window is an orchestrator old
67
+ * enough to have resolved no policy at all (see {@link TrustPolicyView}).
80
68
  */
81
69
  export declare function formatExpiry(policy: TrustPolicyView): string;
82
70
  /**
@@ -86,17 +74,6 @@ export declare function formatExpiry(policy: TrustPolicyView): string;
86
74
  * clear local message naming the accepted values instead of a 400 from the API.
87
75
  */
88
76
  export declare function buildPolicyPatch(opts: Record<string, string | undefined>): Record<string, string | number>;
89
- /**
90
- * Warn when a patch names both spellings of the hold window.
91
- *
92
- * The route resolves this deterministically — the more specific seconds value
93
- * wins — but an operator who passed both asked for two different things, so the
94
- * one that is not applied is named rather than dropped in silence.
95
- *
96
- * Returns the lines rather than printing them so the check is unit-testable,
97
- * matching `forkDropWarnings` above.
98
- */
99
- export declare function policyExpiryWarnings(patch: Record<string, string | number>): string[];
100
77
  /** One identity link as the directory route reports it. */
101
78
  interface DirectoryIdentityLink {
102
79
  userId: string;
@@ -154,8 +131,7 @@ export declare function formatDirectoryAge(updatedAt: string, now: number): stri
154
131
  * The connected wording is a `Note:` and the disconnected one a `Warning:`,
155
132
  * because the two ask for different things: one states a property of the design
156
133
  * the reader should know, the other names a condition they should act on. The
157
- * `Warning:` producers above — `forkDropWarnings` and `policyExpiryWarnings` —
158
- * are both of the second kind.
134
+ * `Warning:` producer above, `forkDropWarnings`, is of the second kind.
159
135
  *
160
136
  * Returns the lines rather than printing them so the check is unit-testable,
161
137
  * matching `forkDropWarnings` above.
@@ -2,8 +2,8 @@
2
2
  * `kici-admin join` command.
3
3
  *
4
4
  * Bootstraps a new orchestrator by connecting to an existing cluster via
5
- * Platform relay or direct peer, receiving an encrypted config bundle, and
6
- * writing an env file the orchestrator boots from.
5
+ * Platform relay or direct peer, receiving the configuration bundle sealed to
6
+ * this host, and writing an env file the orchestrator boots from.
7
7
  *
8
8
  * Usage:
9
9
  * kici-admin join --token kici_join_v1.xxx.yyy --platform wss://api.kici.dev/ws --api-key KEY
@@ -6,8 +6,13 @@
6
6
  * through the orchestrator's admin HTTP API.
7
7
  *
8
8
  * Global options:
9
- * --url / -u Orchestrator URL (env: KICI_ADMIN_URL, default: http://localhost:8080)
9
+ * --url / -u Orchestrator URL (env: KICI_ADMIN_URL, default: http://localhost:4000)
10
10
  * --token / -t Admin API token (env: KICI_ADMIN_TOKEN, required)
11
+ * -V / --cli-version / --version Print the CLI version (--version only before a command)
12
+ *
13
+ * A command that declares its own option under one of these flags (for
14
+ * example `orchestrator upgrade --url`) owns that flag after its name; see
15
+ * `root-option-routing.ts`.
11
16
  */
12
17
  import { Command } from 'commander';
13
18
  /**
@@ -5,4 +5,10 @@
5
5
  * KICI_WEBHOOK_PUBLIC_URL" note instead of a fabricated URL).
6
6
  */
7
7
  export declare function buildLocalGithubIngressUrl(webhookPublicUrl: string | undefined, orgId: string, sourceId: string): string | null;
8
+ /**
9
+ * Build the orchestrator's OWN org-scoped GitHub App ingress URL
10
+ * (`<base>/webhook/<orgId>/github`), served by the org-scoped direct route.
11
+ * Null when no public base is configured.
12
+ */
13
+ export declare function buildLocalGithubAppIngressUrl(webhookPublicUrl: string | undefined, orgId: string): string | null;
8
14
  //# sourceMappingURL=local-github-ingress-url.d.ts.map
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Decide which command each root-option token in a kici-admin argv belongs to.
3
+ *
4
+ * Commander matches a program option anywhere in argv: the root's own
5
+ * `parseOptions` consumes `-u, --url`, `-t, --token` and `-V, --cli-version`
6
+ * even after a command name. That lets an operator put a global option after
7
+ * the command (`kici-admin runs list -u <url>`), but on its own it would also
8
+ * take an option away from any command that declares one with the same flag,
9
+ * such as `orchestrator upgrade --url <archive-url>` or
10
+ * `join --token <join-token>`.
11
+ *
12
+ * {@link routeRootArgs} prepares the argv for the root's `parseOptions`:
13
+ *
14
+ * - A flag that the command being run declares, and that also names a root
15
+ * option, belongs to that command when it comes after the command's name. It
16
+ * is hidden from the root behind an opaque stand-in token, which the root
17
+ * classifies as an unknown option and so hands on to the subcommand; the
18
+ * stand-ins are mapped back to the original tokens before the subcommand
19
+ * parses them.
20
+ * - `--version` before the first command name is the root's version flag. The
21
+ * root cannot register `--version` itself (`orchestrator upgrade` and
22
+ * `agent upgrade` own `--version <version>`), so it is rewritten to the
23
+ * registered `--cli-version`. After a command name it is left alone.
24
+ *
25
+ * - The value of a command option, when it is shaped like an option (`-uP4ss`,
26
+ * `--url`), is hidden from the root the same way, so the root does not read
27
+ * it as one of its own flags.
28
+ *
29
+ * Every other token reaches the root unchanged, so a root option after a
30
+ * command that does not declare that flag still sets the global option.
31
+ */
32
+ import type { Command } from 'commander';
33
+ /** The flag the root registers its version option under. */
34
+ export declare const ROOT_VERSION_FLAG = "--cli-version";
35
+ /** The root's argv, routed, and the map from each stand-in back to its token. */
36
+ export interface RoutedRootArgs {
37
+ readonly args: string[];
38
+ /** Map a token from the root's parse result back to the original token. */
39
+ readonly restore: (token: string) => string;
40
+ }
41
+ /**
42
+ * Route a kici-admin argv (the user arguments, without `node` and the script)
43
+ * for the root command's `parseOptions`. See the module comment.
44
+ */
45
+ export declare function routeRootArgs(root: Command, args: readonly string[]): RoutedRootArgs;
46
+ //# sourceMappingURL=root-option-routing.d.ts.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The text the CLI prints when the orchestrator returns no webhook URL. Shared
3
+ * by `kici-admin source add` and the manifest setup flow, so each
4
+ * `WebhookUrlNote` reads the same in both.
5
+ */
6
+ import { WebhookUrlNote } from '../sources/webhook-url-resolvers.js';
7
+ /**
8
+ * Short reason shown in `(unavailable — <reason>)` when no webhook URL could be
9
+ * resolved. Takes a plain string too, because an orchestrator of another
10
+ * version can send a note this CLI does not know.
11
+ */
12
+ export declare function webhookNoteReason(note: WebhookUrlNote | string | undefined): string;
13
+ /** Actionable next-step hint paired with {@link webhookNoteReason}. */
14
+ export declare function webhookNoteHint(note: WebhookUrlNote | string | undefined): string;
15
+ //# sourceMappingURL=webhook-url-notes.d.ts.map