@kici-dev/orchestrator 0.15.0 → 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 (146) hide show
  1. package/dist/__test-helpers__/scratch-db.d.ts +16 -0
  2. package/dist/agent/registry.d.ts +1 -8
  3. package/dist/app-on-error.d.ts +1 -1
  4. package/dist/artifacts/artifact-store.d.ts +0 -2
  5. package/dist/audit/access-log.d.ts +1 -1
  6. package/dist/cache/source-cache.d.ts +1 -1
  7. package/dist/cache/user-cache.d.ts +0 -28
  8. package/dist/cli/api-client.d.ts +27 -1
  9. package/dist/cli/commands/access-log.d.ts +1 -1
  10. package/dist/cli/commands/cold-store-impl.d.ts +7 -84
  11. package/dist/cli/commands/db.d.ts +1 -0
  12. package/dist/cli/commands/orchestrator-service/status.d.ts +2 -0
  13. package/dist/cli/commands/org.d.ts +12 -0
  14. package/dist/cli/commands/scaler.d.ts +14 -0
  15. package/dist/cli/commands/secret.d.ts +1 -45
  16. package/dist/cli/commands/service-health.d.ts +21 -13
  17. package/dist/cli/commands/shared/cli-action.d.ts +17 -0
  18. package/dist/cli/commands/shared/db.d.ts +5 -5
  19. package/dist/cli/commands/shared/org-id.d.ts +5 -0
  20. package/dist/cli/commands/shared/service-verbs.d.ts +19 -0
  21. package/dist/cli/commands/shared/table.d.ts +3 -0
  22. package/dist/cli/commands/shared/unbound-context-warning.d.ts +2 -22
  23. package/dist/cli/commands/trust-policy.d.ts +7 -31
  24. package/dist/cli/kici-admin.d.ts +1 -1
  25. package/dist/cli.js +9863 -8201
  26. package/dist/cluster/coordinator.d.ts +2 -2
  27. package/dist/cluster/peer-client.d.ts +27 -1
  28. package/dist/cluster/peer-forget.d.ts +4 -9
  29. package/dist/cluster/peer-handler.d.ts +11 -1
  30. package/dist/cluster/peer-request-waiters.d.ts +26 -0
  31. package/dist/cluster/scaler-orphans-peer.d.ts +4 -9
  32. package/dist/cluster/scaler-reload-fanout.d.ts +29 -0
  33. package/dist/cluster/scaler-reload-peer.d.ts +16 -0
  34. package/dist/cluster/worker-cluster-settings.d.ts +1 -0
  35. package/dist/cold-store/load-access-log-range.d.ts +3 -3
  36. package/dist/cold-store/tables/access-log.d.ts +4 -12
  37. package/dist/cold-store/tables/event-log.d.ts +8 -19
  38. package/dist/cold-store/tables/execution-jobs.d.ts +7 -24
  39. package/dist/cold-store/tables/execution-runs.d.ts +6 -20
  40. package/dist/cold-store/tables/execution-steps.d.ts +8 -26
  41. package/dist/cold-store/tables/secret-audit-log.d.ts +4 -11
  42. package/dist/config/env-overlay.d.ts +3 -8
  43. package/dist/config/reload.d.ts +9 -2
  44. package/dist/config/schema.d.ts +2 -2
  45. package/dist/config/types.d.ts +2 -2
  46. package/dist/config.d.ts +13 -17
  47. package/dist/contexts/held-runs.d.ts +3 -6
  48. package/dist/dashboard/cursor.d.ts +12 -0
  49. package/dist/dashboard/handler.d.ts +5 -12
  50. package/dist/db/deferred-index-build.d.ts +42 -0
  51. package/dist/db/deferred-indexes.d.ts +3 -37
  52. package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +3 -5
  53. package/dist/db/migrations/158_normalize_legacy_values.d.ts +4 -0
  54. package/dist/db/repos/org-ids-repo.d.ts +87 -0
  55. package/dist/db/schema-snapshot.generated.d.ts +3 -0
  56. package/dist/db/types.d.ts +5 -22
  57. package/dist/fault-injection-types.d.ts +0 -6
  58. package/dist/git/dispatch-git-auth.d.ts +6 -12
  59. package/dist/helpers/json.d.ts +3 -0
  60. package/dist/index.js +133 -136
  61. package/dist/metrics/prometheus.d.ts +0 -5
  62. package/dist/oidc/id-token-claims.d.ts +1 -1
  63. package/dist/oidc/resolve-signer.d.ts +2 -4
  64. package/dist/orchestrator-core.d.ts +10 -3
  65. package/dist/pipeline/global-eval-round.d.ts +2 -26
  66. package/dist/pipeline/install-secrets-resolver.d.ts +0 -3
  67. package/dist/pipeline/manual-schedule.d.ts +1 -7
  68. package/dist/provenance/dispatch-context.d.ts +5 -7
  69. package/dist/provenance/pending-attestations-repo.d.ts +1 -1
  70. package/dist/provenance/trust-root.d.ts +4 -5
  71. package/dist/provenance/verify-deferred-capture.d.ts +3 -3
  72. package/dist/provider-registry.d.ts +13 -40
  73. package/dist/providers/universal-git/ssh-auth.d.ts +0 -5
  74. package/dist/reporting/check-run-reporter.d.ts +8 -21
  75. package/dist/reporting/check-run-summary.d.ts +2 -2
  76. package/dist/reporting/execution-tracker.d.ts +1 -1
  77. package/dist/reporting/log-chunk-sink.d.ts +1 -1
  78. package/dist/reporting/run-summary-fields.d.ts +25 -0
  79. package/dist/reporting/s3-log-storage.d.ts +2 -2
  80. package/dist/routes/admin-access-log.d.ts +2 -9
  81. package/dist/routes/admin-backends.d.ts +2 -9
  82. package/dist/routes/admin-cluster-name.d.ts +2 -8
  83. package/dist/routes/admin-cluster-settings.d.ts +2 -8
  84. package/dist/routes/admin-config.d.ts +0 -3
  85. package/dist/routes/admin-contexts.d.ts +3 -11
  86. package/dist/routes/admin-db.d.ts +2 -9
  87. package/dist/routes/admin-env.d.ts +33 -0
  88. package/dist/routes/admin-event-dlq.d.ts +2 -9
  89. package/dist/routes/admin-event-inspect.d.ts +2 -9
  90. package/dist/routes/admin-event-log.d.ts +2 -9
  91. package/dist/routes/admin-events.d.ts +3 -13
  92. package/dist/routes/admin-held-runs.d.ts +2 -8
  93. package/dist/routes/admin-list-limit.d.ts +3 -0
  94. package/dist/routes/admin-maintenance.d.ts +2 -9
  95. package/dist/routes/admin-orchestrator-drain.d.ts +2 -9
  96. package/dist/routes/admin-org-settings.d.ts +2 -8
  97. package/dist/routes/admin-orgs.d.ts +27 -0
  98. package/dist/routes/admin-peer-forget.d.ts +2 -9
  99. package/dist/routes/admin-queue-execution.d.ts +3 -10
  100. package/dist/routes/admin-registrations.d.ts +3 -14
  101. package/dist/routes/admin-runs.d.ts +3 -14
  102. package/dist/routes/admin-scaler-orphans.d.ts +2 -9
  103. package/dist/routes/admin-scaler-reload.d.ts +41 -0
  104. package/dist/routes/admin-scheduled-jobs.d.ts +2 -9
  105. package/dist/routes/admin-signing-keys.d.ts +2 -9
  106. package/dist/routes/admin-sources.d.ts +2 -9
  107. package/dist/routes/admin-trust-policy.d.ts +2 -8
  108. package/dist/routes/admin.d.ts +15 -13
  109. package/dist/scaler/config.d.ts +12 -84
  110. package/dist/scaler/file-reload.d.ts +48 -0
  111. package/dist/scaler/manager.d.ts +47 -33
  112. package/dist/scaler/scaler-state-store.d.ts +5 -0
  113. package/dist/scaler/types.d.ts +1 -4
  114. package/dist/secrets/job-secret-gate.d.ts +2 -5
  115. package/dist/secrets/secret-resolver.d.ts +2 -4
  116. package/dist/security/trust-policy-gate.d.ts +0 -4
  117. package/dist/server.d.ts +6 -17
  118. package/dist/server.js +6693 -8005
  119. package/dist/standalone.js +5826 -6555
  120. package/dist/worker/reroute-dispatch.d.ts +1 -0
  121. package/dist/worker/reroute-spawn-control.d.ts +1 -3
  122. package/dist/worker-core.d.ts +9 -2
  123. package/dist/ws/agent-handler.d.ts +3 -3
  124. package/dist/ws/dashboard-access.d.ts +57 -0
  125. package/dist/ws/dashboard-backends-handler.d.ts +1 -6
  126. package/dist/ws/dashboard-context-handler.d.ts +10 -15
  127. package/dist/ws/dashboard-fleet-write-handler.d.ts +1 -6
  128. package/dist/ws/dashboard-global-workflows-handler.d.ts +1 -6
  129. package/dist/ws/dashboard-registrations-handler.d.ts +1 -7
  130. package/dist/ws/platform-client.d.ts +85 -330
  131. package/installer-image-digests.json +3 -3
  132. package/package.json +4 -4
  133. package/sbom.spdx.json +53 -53
  134. package/dist/cache/legacy-prefixes.d.ts +0 -19
  135. package/dist/cli/commands/agent-service/logs.d.ts +0 -14
  136. package/dist/cli/commands/agent-service/restart.d.ts +0 -12
  137. package/dist/cli/commands/agent-service/start.d.ts +0 -12
  138. package/dist/cli/commands/agent-service/stop.d.ts +0 -12
  139. package/dist/cli/commands/agent-service/uninstall.d.ts +0 -13
  140. package/dist/cli/commands/cache.d.ts +0 -51
  141. package/dist/cli/commands/orchestrator-service/logs.d.ts +0 -14
  142. package/dist/cli/commands/orchestrator-service/restart.d.ts +0 -12
  143. package/dist/cli/commands/orchestrator-service/start.d.ts +0 -12
  144. package/dist/cli/commands/orchestrator-service/stop.d.ts +0 -12
  145. package/dist/cli/commands/orchestrator-service/uninstall.d.ts +0 -13
  146. package/dist/git/inherited-secret.d.ts +0 -29
@@ -6,15 +6,14 @@ import type { JSONWebKeySet } from 'jose';
6
6
  */
7
7
  export declare function deriveJwksUri(issuer: string): string;
8
8
  /**
9
- * The orchestrator's view of the provenance trust root. The issuer arrives over
10
- * the `auth.success` connect message for the live process, or from config/env
11
- * (`KICI_PROVENANCE_ISSUER`) for the CLI backfill which has no live handshake.
12
- * The JWKS is fetched lazily and cached with a single refetch-on-`kid`-miss.
9
+ * The orchestrator's view of the provenance trust root. The issuer is fixed at
10
+ * construction: the orchestrator's own signing issuer, the local dev plane's
11
+ * `kici-local`, or the configured `KICI_PROVENANCE_ISSUER`. The JWKS is fetched
12
+ * lazily and cached with a single refetch-on-`kid`-miss.
13
13
  */
14
14
  export interface ProvenanceTrustRoot {
15
15
  getIssuer(): string | null;
16
16
  getJwks(kid?: string): Promise<JSONWebKeySet | null>;
17
- setIssuer(issuer: string | null): void;
18
17
  }
19
18
  /**
20
19
  * A trust root backed by the orchestrator's OWN signing keys
@@ -27,9 +27,9 @@ export type DeferredCaptureVerdict = {
27
27
  * A rejection is a DROP: the job stays green and has no attestation.
28
28
  * That is a degradation, whereas storing an unchecked statement re-introduces
29
29
  * the forgery primitive — every gate that lets one through is the hole again.
30
- * An agent too old to receive `provenanceContext` freezes the legacy statement
31
- * shape and is dropped for the same reason, with the mismatched field named so
32
- * the operator can see the upgrade is what fixes it.
30
+ * A dispatch that carried no `provenanceContext` makes the agent freeze its
31
+ * local statement, which is dropped for the same reason, with the mismatched
32
+ * field named.
33
33
  */
34
34
  export declare function checkDeferredCapture(deps: {
35
35
  db: Kysely<Database>;
@@ -75,9 +75,9 @@ export interface ProviderBundle {
75
75
  * registry.registerByRoutingKey('github:67890', bundleForApp2);
76
76
  * const bundle = registry.getByRoutingKey('github:12345');
77
77
  *
78
- * Usage (backward-compatible single-app):
79
- * registry.register('github', bundle);
80
- * const bundle = registry.get('github');
78
+ * A provider-wide default bundle, registered with `register(type)`, stands in
79
+ * for every routing key of that type that has no bundle of its own:
80
+ * registry.register('generic', genericBundle);
81
81
  */
82
82
  export declare class ProviderRegistry {
83
83
  private readonly bundles;
@@ -89,26 +89,16 @@ export declare class ProviderRegistry {
89
89
  */
90
90
  registerByRoutingKey(routingKey: string, bundle: ProviderBundle): void;
91
91
  /**
92
- * Register a provider implementation bundle by provider type.
93
- *
94
- * Backward-compatible: stores the bundle under a synthetic routing key
95
- * "{type}:default". Only works for single-app scenarios.
96
- *
97
- * For multi-app support, use registerByRoutingKey() instead.
92
+ * Register the provider-wide default bundle for `type`, stored under the
93
+ * synthetic routing key "{type}:default". It answers every routing key of
94
+ * that type that has no bundle of its own.
98
95
  */
99
96
  register(type: ProviderType, bundle: ProviderBundle): void;
100
- /**
101
- * Get the provider bundle for a given type.
102
- *
103
- * Backward-compatible: returns the first bundle matching the provider type
104
- * prefix. For multi-app, use getByRoutingKey() instead.
105
- */
106
- get(type: ProviderType): ProviderBundle | undefined;
107
97
  /**
108
98
  * Whether a bundle is registered at EXACTLY this routing key.
109
99
  *
110
- * `getByRoutingKey` cannot answer this: it falls back to a provider-type
111
- * lookup, so it returns a bundle for a key it has never seen. A caller that
100
+ * `getByRoutingKey` cannot answer this: it falls back to the type's default
101
+ * bundle, so it returns a bundle for a key it has never seen. A caller that
112
102
  * needs to know whether the source's OWN bundle is present — rather than
113
103
  * whether some bundle can be produced — has to ask here.
114
104
  */
@@ -117,17 +107,11 @@ export declare class ProviderRegistry {
117
107
  * Get the provider bundle by routing key.
118
108
  * Routing keys have the format "{provider}:{id}" (e.g., "github:12345").
119
109
  *
120
- * Falls back to get(providerType) if the exact key is not found, for
121
- * backward compatibility with single-app registration.
122
- *
123
- * The fallback is deliberately narrower for a `generic:` key. Such a key is
124
- * fully qualified (`generic:{orgId}:{sourceId}`), so the type-prefix scan in
125
- * `get()` cannot be a "the single configured app" shortcut the way it is for
126
- * `github:` — it returns whichever `generic:`-prefixed bundle happens to sit
127
- * first in insertion order, which may belong to a different source, or to a
128
- * different ORGANIZATION. Only the shared default bundle (`generic:default`,
129
- * the one that genuinely stands in for every plain generic source) is an
130
- * acceptable stand-in, so that is the only fallback offered here.
110
+ * A key with no bundle of its own falls back only to its type's default
111
+ * bundle (`{type}:default`, e.g. `generic:default`, which stands in for every
112
+ * plain generic source). It never falls back to another key's bundle: that
113
+ * bundle belongs to a different App or source, possibly in a different
114
+ * organization.
131
115
  */
132
116
  getByRoutingKey(routingKey: string): ProviderBundle | undefined;
133
117
  /**
@@ -139,21 +123,10 @@ export declare class ProviderRegistry {
139
123
  * Iterate over all registered bundles.
140
124
  */
141
125
  getAll(): IterableIterator<[string, ProviderBundle]>;
142
- /**
143
- * Check if a provider type has at least one registered bundle.
144
- */
145
- has(type: ProviderType): boolean;
146
126
  /**
147
127
  * Get all registered routing keys.
148
128
  */
149
129
  getRoutingKeys(): string[];
150
- /**
151
- * Get routing keys matching a specific provider type.
152
- *
153
- * @param type - Provider type (e.g., "github")
154
- * @returns Array of routing keys matching the type prefix
155
- */
156
- getRoutingKeysForProvider(type: ProviderType): string[];
157
130
  /**
158
131
  * Remove a routing key and its bundle.
159
132
  * Used during config reload when apps are removed.
@@ -86,9 +86,4 @@ export declare function prepareSshAuthSync(opts: PrepareSshAuthOptions): SshAuth
86
86
  * orchestrator's runtime user may have a populated ssh-agent.
87
87
  */
88
88
  export declare function composeGitSshCommand(privateKeyPath: string, policy: SshHostKeyPolicy, knownHostsPath: string): string;
89
- /**
90
- * Shell-quote a path for embedding in `GIT_SSH_COMMAND`. Single-quotes the
91
- * string and escapes embedded single quotes — matches POSIX shell parsing.
92
- */
93
- export declare function quoteShell(path: string): string;
94
89
  //# sourceMappingURL=ssh-auth.d.ts.map
@@ -25,7 +25,6 @@
25
25
  * This CheckRunReporter handles execution lifecycle checks (queued, in_progress, completed per job/workflow).
26
26
  * Future cleanup may unify both under CheckStatusPoster, but they serve different purposes today.
27
27
  */
28
- import { type GitHubAppConfig } from '../providers/github/auth.js';
29
28
  import type { ProviderRegistry } from '../provider-registry.js';
30
29
  import type { StepLogBuffer } from './step-log-buffer.js';
31
30
  import { type SourceLocationData } from './check-run-summary.js';
@@ -36,17 +35,11 @@ import { CheckRunConclusion, type TerminalJobStatus } from '@kici-dev/engine';
36
35
  */
37
36
  interface CheckRunReporterDeps {
38
37
  /**
39
- * Provider registry for per-routing-key credential lookup.
40
- * When provided, the reporter resolves GitHub App credentials by routing key
41
- * from the registry's CloneTokenProvider config. Takes precedence over githubConfig.
38
+ * Provider registry for per-routing-key credential lookup: the reporter
39
+ * resolves GitHub App credentials by routing key from the registry's
40
+ * CloneTokenProvider config.
42
41
  */
43
42
  providerRegistry?: ProviderRegistry;
44
- /**
45
- * GitHub App config for creating Octokit instances.
46
- * Fallback for backward compatibility when providerRegistry is not provided
47
- * or when no routing key is available.
48
- */
49
- githubConfig?: GitHubAppConfig;
50
43
  /** Step log buffer for enriched failure summaries. */
51
44
  stepLogBuffer?: StepLogBuffer;
52
45
  /**
@@ -73,8 +66,7 @@ interface CheckRunReporterDeps {
73
66
  * Resolver for the orchestrator's owning org public alias. Typically
74
67
  * wired to `PlatformClient.getOrgPublicAlias()`. Returns the
75
68
  * `oal_<12-char>` alias supplied by Platform on `auth.success`, or
76
- * `undefined` before auth completes / when running against a
77
- * Platform that predates the alias plumbing.
69
+ * `undefined` before auth completes.
78
70
  */
79
71
  getOrgPublicAlias?: () => string | undefined;
80
72
  }
@@ -254,7 +246,7 @@ interface UpdateStepProgressOptions {
254
246
  jobName: string;
255
247
  stepIndex: number;
256
248
  stepName: string;
257
- state: 'running' | 'success' | 'failed' | 'skipped' | 'cancelled' | 'error';
249
+ state: 'running' | 'success' | 'failed' | 'skipped' | 'cancelled';
258
250
  durationMs?: number;
259
251
  installationId?: number;
260
252
  /** Routing key for per-app credential lookup (e.g., "github:12345"). */
@@ -526,14 +518,9 @@ export declare class CheckRunReporter {
526
518
  */
527
519
  private persistBuildCreationPending;
528
520
  /**
529
- * Resolve GitHub App credentials for a given routing key.
530
- *
531
- * Resolution order:
532
- * 1. If providerRegistry is provided AND routingKey is given, look up the bundle
533
- * by routing key and extract config from the CloneTokenProvider's getAppConfig().
534
- * 2. Fall back to the direct githubConfig dep (backward compatible).
535
- *
536
- * Returns undefined if no config is available.
521
+ * Resolve GitHub App credentials for a given routing key from the bundle's
522
+ * CloneTokenProvider `getAppConfig()`. Returns undefined when no routing key,
523
+ * registry, bundle or GitHub provider is available.
537
524
  */
538
525
  private resolveGithubConfig;
539
526
  /**
@@ -17,7 +17,7 @@ import type { StepLogBuffer } from './step-log-buffer.js';
17
17
  /** Step result data as sent by the agent in job.status data.stepResults. */
18
18
  export interface StepResultData {
19
19
  name: string;
20
- status: 'success' | 'failed' | 'error' | 'skipped' | 'cancelled';
20
+ status: 'success' | 'failed' | 'skipped' | 'cancelled';
21
21
  durationMs?: number;
22
22
  error?: string;
23
23
  exitCode?: number;
@@ -43,7 +43,7 @@ export interface CheckAnnotation {
43
43
  /** Step progress entry for live updates. */
44
44
  export interface StepProgressEntry {
45
45
  name: string;
46
- status: 'pending' | 'running' | 'success' | 'failed' | 'error' | 'skipped' | 'cancelled';
46
+ status: 'pending' | 'running' | 'success' | 'failed' | 'skipped' | 'cancelled';
47
47
  durationMs?: number;
48
48
  }
49
49
  interface BuildCheckRunSummaryOptions {
@@ -1299,7 +1299,7 @@ export declare class ExecutionTracker {
1299
1299
  startedAt: number;
1300
1300
  completedAt?: number;
1301
1301
  durationMs?: number;
1302
- statusEpoch?: number;
1302
+ statusEpoch: number;
1303
1303
  jobs: Array<{
1304
1304
  jobId: string;
1305
1305
  jobName: string;
@@ -24,7 +24,7 @@ export interface NormalizedLogChunk {
24
24
  stepIndex: number;
25
25
  lines: string[];
26
26
  timestamp: number;
27
- stream?: LogStream;
27
+ stream: LogStream;
28
28
  }
29
29
  /** Which ingress produced the chunk. Stamped onto the two log counters. */
30
30
  export type LogChunkSource = 'local' | 'peer';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The run fields every `onExecutionStatusChange` context built from an
3
+ * in-memory run carries, in one place so a new column cannot be forwarded from
4
+ * some status transitions and silently dropped from others.
5
+ */
6
+ import type { ExecutionContext } from './execution-tracker.js';
7
+ type RunSummaryKey = 'workflowName' | 'provider' | 'repoIdentifier' | 'workflowRepoIdentifier' | 'sha' | 'installationId' | 'requestId' | 'routingKey' | 'ref' | 'triggerEvent' | 'commitMessage' | 'parentRunId' | 'originalRunId' | 'triggeredBy' | 'triggeredByAgentLabel' | 'triggerActorUsername' | 'triggerActorUserId';
8
+ /** The slice of a tracked run {@link runSummaryFields} reads. */
9
+ export type RunSummarySource = Pick<ExecutionContext, RunSummaryKey> & {
10
+ statusEpoch?: number | null;
11
+ };
12
+ /** The `statusEpoch` context field for a run, omitted at 0 (its default). */
13
+ export declare function statusEpochField(epoch: number | null | undefined): {
14
+ statusEpoch?: number;
15
+ };
16
+ /**
17
+ * The shared part of a run's status-change context.
18
+ *
19
+ * `workflowRepoIdentifier` is copied only when set, because its presence is
20
+ * what marks a cross-repository global run downstream. `localWorkingTree` is
21
+ * left to the caller: only some transitions forward it.
22
+ */
23
+ export declare function runSummaryFields(run: RunSummarySource): Pick<ExecutionContext, RunSummaryKey | 'statusEpoch'>;
24
+ export {};
25
+ //# sourceMappingURL=run-summary-fields.d.ts.map
@@ -22,7 +22,7 @@
22
22
  * finalize(path) at run completion.
23
23
  *
24
24
  * - finalize() seals the remaining tail buffer for a step key.
25
- * - read() lists sealed segments (plus any legacy/single object written by
25
+ * - read() lists sealed segments (plus any single object written by
26
26
  * append()) and streams them via the byte-offset cursor.
27
27
  * - exists()/list() are segment-aware: `exists` is true when a single object or
28
28
  * any segment is present; `list` collapses segment keys to their logical step
@@ -113,7 +113,7 @@ export declare class S3LogStorage implements LogStorage {
113
113
  /**
114
114
  * Single-object size (or null) + sealed segments in ascending seq order for a
115
115
  * key. The single object is the content written by append() (single-shot
116
- * writers) or any legacy step log written before the append-only change.
116
+ * writers).
117
117
  */
118
118
  private layout;
119
119
  /** Fetch an inclusive byte range from one object. */
@@ -18,19 +18,12 @@
18
18
  import { Hono } from 'hono';
19
19
  import type { AccessLogWriter } from '../audit/access-log.js';
20
20
  import type { TokenManager } from '../secrets/token-manager.js';
21
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
21
+ import type { RbacEnforcer } from '../secrets/rbac.js';
22
+ import { type AdminEnv } from './admin-env.js';
22
23
  export interface AdminAccessLogRoutesDeps {
23
24
  accessLog: AccessLogWriter;
24
25
  tokenManager: TokenManager;
25
26
  rbac: RbacEnforcer;
26
27
  }
27
- type AdminEnv = {
28
- Variables: {
29
- role: Role;
30
- userId: string;
31
- routingKey: string | null;
32
- };
33
- };
34
28
  export declare function createAdminAccessLogRoutes(deps: AdminAccessLogRoutesDeps): Hono<AdminEnv>;
35
- export {};
36
29
  //# sourceMappingURL=admin-access-log.d.ts.map
@@ -12,14 +12,7 @@ import { Hono } from 'hono';
12
12
  import type { BackendSyncManager } from '@kici-dev/engine';
13
13
  import type { BackendRegistry } from '../secrets/backend-registry.js';
14
14
  import type { BackendHealthChecker } from '../secrets/backend-health.js';
15
- import type { Role } from '../secrets/rbac.js';
16
- type AdminBackendsEnv = {
17
- Variables: {
18
- role: Role;
19
- userId: string;
20
- routingKey: string | null;
21
- };
22
- };
15
+ import { type AdminEnv } from './admin-env.js';
23
16
  interface BackendRouteDeps {
24
17
  registry: BackendRegistry;
25
18
  healthChecker: BackendHealthChecker;
@@ -31,6 +24,6 @@ interface BackendRouteDeps {
31
24
  * @param deps - Backend route dependencies (registry, health checker, sync manager)
32
25
  * @returns Hono app with backend routes
33
26
  */
34
- export declare function createBackendRoutes(deps: BackendRouteDeps): Hono<AdminBackendsEnv>;
27
+ export declare function createBackendRoutes(deps: BackendRouteDeps): Hono<AdminEnv>;
35
28
  export {};
36
29
  //# sourceMappingURL=admin-backends.d.ts.map
@@ -25,8 +25,9 @@ import { Hono } from 'hono';
25
25
  import type { Kysely } from 'kysely';
26
26
  import { CLUSTER_NAME_REGEX } from '@kici-dev/engine/protocol/cluster-name';
27
27
  import type { Database } from '../db/types.js';
28
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
28
+ import type { RbacEnforcer } from '../secrets/rbac.js';
29
29
  import type { AccessLogWriter } from '../audit/access-log.js';
30
+ import { type AdminEnv } from './admin-env.js';
30
31
  interface ClusterNameRouteDeps {
31
32
  db: Kysely<Database>;
32
33
  rbac: RbacEnforcer;
@@ -38,13 +39,6 @@ interface ClusterNameRouteDeps {
38
39
  */
39
40
  accessLog?: AccessLogWriter;
40
41
  }
41
- type AdminEnv = {
42
- Variables: {
43
- role: Role;
44
- userId: string;
45
- routingKey: string | null;
46
- };
47
- };
48
42
  export declare function createClusterNameRoutes(deps: ClusterNameRouteDeps): Hono<AdminEnv>;
49
43
  export { CLUSTER_NAME_REGEX };
50
44
  //# sourceMappingURL=admin-cluster-name.d.ts.map
@@ -16,8 +16,9 @@
16
16
  import { Hono } from 'hono';
17
17
  import { type Kysely } from 'kysely';
18
18
  import type { Database } from '../db/types.js';
19
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
19
+ import type { RbacEnforcer } from '../secrets/rbac.js';
20
20
  import type { PeerRegistry } from '../cluster/peer-registry.js';
21
+ import { type AdminEnv } from './admin-env.js';
21
22
  /** The live view behind `GET /cluster-settings/propagation`. */
22
23
  export interface ClusterSettingsPropagationSource {
23
24
  instanceId: string;
@@ -31,13 +32,6 @@ interface ClusterSettingsRouteDeps {
31
32
  /** Mounts `GET /cluster-settings/propagation` when set. */
32
33
  propagation?: ClusterSettingsPropagationSource;
33
34
  }
34
- type AdminEnv = {
35
- Variables: {
36
- role: Role;
37
- userId: string;
38
- routingKey: string | null;
39
- };
40
- };
41
35
  export declare function createClusterSettingsRoutes(deps: ClusterSettingsRouteDeps): Hono<AdminEnv>;
42
36
  export {};
43
37
  //# sourceMappingURL=admin-cluster-settings.d.ts.map
@@ -28,9 +28,6 @@ import type { LocalConfig } from '../config/types.js';
28
28
  export interface PeerReloadForwardResult {
29
29
  result: ReloadResult | null;
30
30
  }
31
- /**
32
- * Dependencies for config admin routes.
33
- */
34
31
  export interface ConfigRouteDeps {
35
32
  sharedStore: SharedConfigStore;
36
33
  configReloader: ConfigReloader;
@@ -29,25 +29,17 @@
29
29
  */
30
30
  import { Hono } from 'hono';
31
31
  import { type Kysely } from 'kysely';
32
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
32
+ import type { RbacEnforcer } from '../secrets/rbac.js';
33
+ import { type AdminEnv } from './admin-env.js';
33
34
  export interface AdminContextRoutesDeps {
34
35
  db: Kysely<any>;
35
36
  rbac: RbacEnforcer;
36
37
  }
37
- /** Hono env type for admin-contexts routes with context variables. */
38
- type AdminEnvEnv = {
39
- Variables: {
40
- role: Role;
41
- userId: string;
42
- routingKey: string | null;
43
- };
44
- };
45
38
  /**
46
39
  * Create admin API routes for context management.
47
40
  *
48
41
  * @param deps - db (Kysely) + rbac enforcer
49
42
  * @returns Hono app mounted at /api/v1/admin
50
43
  */
51
- export declare function createAdminContextRoutes(deps: AdminContextRoutesDeps): Hono<AdminEnvEnv>;
52
- export {};
44
+ export declare function createAdminContextRoutes(deps: AdminContextRoutesDeps): Hono<AdminEnv>;
53
45
  //# sourceMappingURL=admin-contexts.d.ts.map
@@ -11,7 +11,7 @@
11
11
  import { Hono } from 'hono';
12
12
  import type { Kysely } from 'kysely';
13
13
  import type pg from 'pg';
14
- import type { Role } from '../secrets/rbac.js';
14
+ import { type AdminEnv } from './admin-env.js';
15
15
  interface DbRouteDeps {
16
16
  db: Kysely<any>;
17
17
  pool: pg.Pool;
@@ -21,13 +21,6 @@ interface DbRouteDeps {
21
21
  */
22
22
  databaseUrl?: string;
23
23
  }
24
- type AdminDbEnv = {
25
- Variables: {
26
- role: Role;
27
- userId: string;
28
- routingKey: string | null;
29
- };
30
- };
31
- export declare function createDbRoutes(deps: DbRouteDeps): Hono<AdminDbEnv>;
24
+ export declare function createDbRoutes(deps: DbRouteDeps): Hono<AdminEnv>;
32
25
  export {};
33
26
  //# sourceMappingURL=admin-db.d.ts.map
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The Hono env, app factory and routing-key guard every admin route file shares.
3
+ */
4
+ import { Hono, type Env, type MiddlewareHandler } from 'hono';
5
+ import type { Role } from '../secrets/rbac.js';
6
+ /** Context variables the admin auth middleware sets for every admin route. */
7
+ export type AdminEnv = {
8
+ Variables: {
9
+ role: Role;
10
+ userId: string;
11
+ routingKey: string | null;
12
+ };
13
+ };
14
+ type ErrorLogger = {
15
+ error: (msg: string, meta?: Record<string, unknown>) => void;
16
+ };
17
+ /**
18
+ * Build an admin sub-app whose thrown errors map through `handleAdminError`.
19
+ *
20
+ * Hono runs a routed sub-app's own error handler, so the parent app's generic
21
+ * 500 never answers an admin route. An `HTTPException` (Hono's deliberate
22
+ * control-flow response) passes through unchanged, as it does on the parent.
23
+ *
24
+ * @param logger - Receives the unmapped-error log line.
25
+ * @param opts.logBeforeHandling - When set, every error is first logged under this message.
26
+ */
27
+ export declare function createAdminApp<E extends Env = AdminEnv>(logger: ErrorLogger, opts?: {
28
+ logBeforeHandling?: string;
29
+ }): Hono<E>;
30
+ /** Refuse a routing-key-scoped token with 403 before the handler runs. */
31
+ export declare const requireUnscoped: MiddlewareHandler<AdminEnv>;
32
+ export {};
33
+ //# sourceMappingURL=admin-env.d.ts.map
@@ -19,8 +19,9 @@
19
19
  import { Hono } from 'hono';
20
20
  import type { EventStore } from '../events/event-store.js';
21
21
  import type { TokenManager } from '../secrets/token-manager.js';
22
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
22
+ import type { RbacEnforcer } from '../secrets/rbac.js';
23
23
  import type { AccessLogWriter } from '../audit/access-log.js';
24
+ import { type AdminEnv } from './admin-env.js';
24
25
  export interface AdminEventDlqRoutesDeps {
25
26
  eventStore: EventStore;
26
27
  tokenManager: TokenManager;
@@ -28,13 +29,5 @@ export interface AdminEventDlqRoutesDeps {
28
29
  /** Required so retry/discard mutations land in the access log. */
29
30
  accessLog?: AccessLogWriter;
30
31
  }
31
- type AdminEnv = {
32
- Variables: {
33
- role: Role;
34
- userId: string;
35
- routingKey: string | null;
36
- };
37
- };
38
32
  export declare function createAdminEventDlqRoutes(deps: AdminEventDlqRoutesDeps): Hono<AdminEnv>;
39
- export {};
40
33
  //# sourceMappingURL=admin-event-dlq.d.ts.map
@@ -17,20 +17,13 @@ import type { Kysely } from 'kysely';
17
17
  import type { Database } from '../db/types.js';
18
18
  import type { EventStore } from '../events/event-store.js';
19
19
  import type { TokenManager } from '../secrets/token-manager.js';
20
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
20
+ import type { RbacEnforcer } from '../secrets/rbac.js';
21
+ import { type AdminEnv } from './admin-env.js';
21
22
  export interface AdminEventInspectRoutesDeps {
22
23
  db: Kysely<Database>;
23
24
  eventStore: EventStore;
24
25
  tokenManager: TokenManager;
25
26
  rbac: RbacEnforcer;
26
27
  }
27
- type AdminEnv = {
28
- Variables: {
29
- role: Role;
30
- userId: string;
31
- routingKey: string | null;
32
- };
33
- };
34
28
  export declare function createAdminEventInspectRoutes(deps: AdminEventInspectRoutesDeps): Hono<AdminEnv>;
35
- export {};
36
29
  //# sourceMappingURL=admin-event-inspect.d.ts.map
@@ -21,8 +21,9 @@ import { type ColdStore } from '@kici-dev/shared';
21
21
  import type { Kysely } from 'kysely';
22
22
  import type { Database } from '../db/types.js';
23
23
  import type { TokenManager } from '../secrets/token-manager.js';
24
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
24
+ import type { RbacEnforcer } from '../secrets/rbac.js';
25
25
  import type { LogStorage } from '../reporting/log-storage.js';
26
+ import { type AdminEnv } from './admin-env.js';
26
27
  export interface AdminEventLogRoutesDeps {
27
28
  db: Kysely<Database>;
28
29
  logStorage: LogStorage;
@@ -31,13 +32,5 @@ export interface AdminEventLogRoutesDeps {
31
32
  /** Optional cold-store for archived event_log rows. */
32
33
  coldStore?: ColdStore;
33
34
  }
34
- type AdminEnv = {
35
- Variables: {
36
- role: Role;
37
- userId: string;
38
- routingKey: string | null;
39
- };
40
- };
41
35
  export declare function createAdminEventLogRoutes(deps: AdminEventLogRoutesDeps): Hono<AdminEnv>;
42
- export {};
43
36
  //# sourceMappingURL=admin-event-log.d.ts.map
@@ -12,14 +12,12 @@ import type pg from 'pg';
12
12
  import type { GenericSourceManager } from '../webhook/generic-sources.js';
13
13
  import type { TrustStore } from '../events/trust-store.js';
14
14
  import type { TokenManager } from '../secrets/token-manager.js';
15
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
15
+ import type { RbacEnforcer } from '../secrets/rbac.js';
16
16
  import type { AppConfig } from '../config.js';
17
17
  import type { ProviderRegistry } from '../provider-registry.js';
18
18
  import type { SecretResolver } from '../secrets/secret-resolver.js';
19
19
  import type { ClusterSettingsReader } from '../cluster/cluster-settings-reader.js';
20
- /**
21
- * Dependencies for admin event routes.
22
- */
20
+ import { type AdminEnv } from './admin-env.js';
23
21
  interface AdminEventRouteDeps {
24
22
  sourceManager: GenericSourceManager;
25
23
  trustStore: TrustStore;
@@ -61,20 +59,12 @@ interface AdminEventRouteDeps {
61
59
  */
62
60
  pool?: pg.Pool;
63
61
  }
64
- /** Hono env type for admin event routes with context variables. */
65
- type AdminEventEnv = {
66
- Variables: {
67
- role: Role;
68
- userId: string;
69
- routingKey: string | null;
70
- };
71
- };
72
62
  /**
73
63
  * Create admin API routes for generic webhook sources and trust management.
74
64
  *
75
65
  * @param deps - Admin event route dependencies
76
66
  * @returns Hono app with admin event routes mounted at /api/v1/admin/*
77
67
  */
78
- export declare function createAdminEventRoutes(deps: AdminEventRouteDeps): Hono<AdminEventEnv>;
68
+ export declare function createAdminEventRoutes(deps: AdminEventRouteDeps): Hono<AdminEnv>;
79
69
  export {};
80
70
  //# sourceMappingURL=admin-events.d.ts.map
@@ -45,9 +45,10 @@ import { HeldRunStore, type ReleaseSignal } from '../contexts/held-runs.js';
45
45
  import type { TrustDirectoryStore } from '../security/trust-directory-store.js';
46
46
  import { adminActorSub, triggererSubjectFor } from '../approvals/triggerer-subject.js';
47
47
  import { type ResolveCheckStatusPoster } from '../pipeline/security-hold-check.js';
48
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
48
+ import type { RbacEnforcer } from '../secrets/rbac.js';
49
49
  import type { AccessLogWriter } from '../audit/access-log.js';
50
50
  import type { Database, HeldRun } from '../db/types.js';
51
+ import { type AdminEnv } from './admin-env.js';
51
52
  /**
52
53
  * Wording for the Platform-managed refusal, surfaced verbatim by the CLI.
53
54
  *
@@ -126,13 +127,6 @@ export interface HeldRunRouteDeps {
126
127
  accessLog: AccessLogWriter;
127
128
  release: HeldRunReleaseWiring;
128
129
  }
129
- type AdminEnv = {
130
- Variables: {
131
- role: Role;
132
- userId: string;
133
- routingKey: string | null;
134
- };
135
- };
136
130
  /**
137
131
  * The approval subject for a decision taken through an admin token.
138
132
  *
@@ -0,0 +1,3 @@
1
+ /** Page size from a `?limit=` query: a missing, non-numeric or non-positive value is 50; the cap is 200. */
2
+ export declare function clampLimit(raw: string | undefined): number;
3
+ //# sourceMappingURL=admin-list-limit.d.ts.map
@@ -14,17 +14,10 @@
14
14
  */
15
15
  import { Hono } from 'hono';
16
16
  import type { Kysely } from 'kysely';
17
- import type { Role } from '../secrets/rbac.js';
17
+ import { type AdminEnv } from './admin-env.js';
18
18
  interface MaintenanceRouteDeps {
19
19
  db: Kysely<any>;
20
20
  }
21
- type AdminMaintenanceEnv = {
22
- Variables: {
23
- role: Role;
24
- userId: string;
25
- routingKey: string | null;
26
- };
27
- };
28
- export declare function createMaintenanceRoutes(deps: MaintenanceRouteDeps): Hono<AdminMaintenanceEnv>;
21
+ export declare function createMaintenanceRoutes(deps: MaintenanceRouteDeps): Hono<AdminEnv>;
29
22
  export {};
30
23
  //# sourceMappingURL=admin-maintenance.d.ts.map