@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
@@ -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
@@ -14,22 +14,15 @@
14
14
  import { Hono } from 'hono';
15
15
  import { z } from 'zod';
16
16
  import type { DrainController } from '../drain/drain-controller.js';
17
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
17
+ import type { RbacEnforcer } from '../secrets/rbac.js';
18
+ import { type AdminEnv } from './admin-env.js';
18
19
  export declare const DrainActionSchema: z.ZodEnum<{
19
20
  drain: "drain";
20
21
  resume: "resume";
21
22
  }>;
22
23
  export type DrainAction = z.infer<typeof DrainActionSchema>;
23
- type AdminEnv = {
24
- Variables: {
25
- role: Role;
26
- userId: string;
27
- routingKey: string | null;
28
- };
29
- };
30
24
  export declare function createOrchestratorDrainRoutes(deps: {
31
25
  drainController: DrainController;
32
26
  rbac: RbacEnforcer;
33
27
  }): Hono<AdminEnv>;
34
- export {};
35
28
  //# sourceMappingURL=admin-orchestrator-drain.d.ts.map
@@ -14,8 +14,9 @@ import { type Kysely } from 'kysely';
14
14
  import { type OrchestratorMode } from '@kici-dev/engine';
15
15
  import { DashboardWriteOperation } from '@kici-dev/engine/protocol/dashboard-write-operations';
16
16
  import type { Database } from '../db/types.js';
17
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
17
+ import type { RbacEnforcer } from '../secrets/rbac.js';
18
18
  import type { AccessLogWriter } from '../audit/access-log.js';
19
+ import { type AdminEnv } from './admin-env.js';
19
20
  interface OrgSettingsRouteDeps {
20
21
  db: Kysely<Database>;
21
22
  rbac: RbacEnforcer;
@@ -40,13 +41,6 @@ interface OrgSettingsRouteDeps {
40
41
  */
41
42
  accessLog?: AccessLogWriter;
42
43
  }
43
- type AdminEnv = {
44
- Variables: {
45
- role: Role;
46
- userId: string;
47
- routingKey: string | null;
48
- };
49
- };
50
44
  export declare function createOrgSettingsRoutes(deps: OrgSettingsRouteDeps): Hono<AdminEnv>;
51
45
  export { DashboardWriteOperation };
52
46
  //# sourceMappingURL=admin-org-settings.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Admin API route listing the org ids this orchestrator holds data for.
3
+ *
4
+ * GET /api/v1/admin/org-ids → `OrgListResponse`: every org id the configuration
5
+ * and anchor tables name, each with the data that names it, plus the live
6
+ * Platform attachment (`attached` / `pending` / `none`).
7
+ *
8
+ * Backs `kici-admin org list` and the `Org:` line of `kici-admin orchestrator
9
+ * status`. The listing spans every org, so the route requires an unscoped token
10
+ * and `secret.read`, like the other read-only inspection routes.
11
+ */
12
+ import { Hono } from 'hono';
13
+ import { type HeldOrg } from '../db/repos/org-ids-repo.js';
14
+ import type { RbacEnforcer } from '../secrets/rbac.js';
15
+ import { type AdminEnv } from './admin-env.js';
16
+ export interface AdminOrgRoutesDeps {
17
+ /** The org ids the database holds (`listHeldOrgIds` bound to the orchestrator DB). */
18
+ listOrgs: () => Promise<HeldOrg[]>;
19
+ rbac: RbacEnforcer;
20
+ /**
21
+ * The org the Platform named on `auth.success`; `undefined` before the first
22
+ * authentication. Absent when no Platform client runs (independent mode).
23
+ */
24
+ getPlatformOrgId?: () => string | undefined;
25
+ }
26
+ export declare function createAdminOrgRoutes(deps: AdminOrgRoutesDeps): Hono<AdminEnv>;
27
+ //# sourceMappingURL=admin-orgs.d.ts.map
@@ -16,14 +16,8 @@
16
16
  import { Hono } from 'hono';
17
17
  import type { AccessLogWriter } from '../audit/access-log.js';
18
18
  import { type PeerForgetResult } from '../cluster/peer-forget.js';
19
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
20
- type AdminEnv = {
21
- Variables: {
22
- role: Role;
23
- userId: string;
24
- routingKey: string | null;
25
- };
26
- };
19
+ import type { RbacEnforcer } from '../secrets/rbac.js';
20
+ import { type AdminEnv } from './admin-env.js';
27
21
  /** What the route needs from the coordinator it runs on. */
28
22
  export interface PeerForgetRouteDeps {
29
23
  /**
@@ -39,5 +33,4 @@ export declare function createPeerForgetRoutes(deps: {
39
33
  rbac: RbacEnforcer;
40
34
  accessLog?: AccessLogWriter;
41
35
  }): Hono<AdminEnv>;
42
- export {};
43
36
  //# sourceMappingURL=admin-peer-forget.d.ts.map
@@ -11,18 +11,11 @@
11
11
  */
12
12
  import { Hono } from 'hono';
13
13
  import { type Kysely } from 'kysely';
14
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
14
+ import type { RbacEnforcer } from '../secrets/rbac.js';
15
+ import { type AdminEnv } from './admin-env.js';
15
16
  export interface AdminQueueExecutionRoutesDeps {
16
17
  db: Kysely<any>;
17
18
  rbac: RbacEnforcer;
18
19
  }
19
- type AdminQEEnv = {
20
- Variables: {
21
- role: Role;
22
- userId: string;
23
- routingKey: string | null;
24
- };
25
- };
26
- export declare function createAdminQueueExecutionRoutes(deps: AdminQueueExecutionRoutesDeps): Hono<AdminQEEnv>;
27
- export {};
20
+ export declare function createAdminQueueExecutionRoutes(deps: AdminQueueExecutionRoutesDeps): Hono<AdminEnv>;
28
21
  //# sourceMappingURL=admin-queue-execution.d.ts.map
@@ -9,11 +9,9 @@ import { Hono } from 'hono';
9
9
  import type { RegistrationStore } from '../registration/registration-store.js';
10
10
  import type { RegistrationIndex } from '../registration/registration-index.js';
11
11
  import type { TokenManager } from '../secrets/token-manager.js';
12
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
12
+ import type { RbacEnforcer } from '../secrets/rbac.js';
13
13
  import type { ContextStore } from '../contexts/context-store.js';
14
- /**
15
- * Dependencies for admin registration routes.
16
- */
14
+ import { type AdminEnv } from './admin-env.js';
17
15
  export interface AdminRegistrationRoutesDeps {
18
16
  registrationStore: RegistrationStore;
19
17
  registrationIndex: RegistrationIndex;
@@ -27,20 +25,11 @@ export interface AdminRegistrationRoutesDeps {
27
25
  */
28
26
  contextStore?: Pick<ContextStore, 'matchContext'>;
29
27
  }
30
- /** Hono env type for admin registration routes with context variables. */
31
- type AdminRegEnv = {
32
- Variables: {
33
- role: Role;
34
- userId: string;
35
- routingKey: string | null;
36
- };
37
- };
38
28
  /**
39
29
  * Create admin API routes for workflow registration management.
40
30
  *
41
31
  * @param deps - Admin registration route dependencies
42
32
  * @returns Hono app with registration routes mounted at /api/v1/admin/registrations
43
33
  */
44
- export declare function createAdminRegistrationRoutes(deps: AdminRegistrationRoutesDeps): Hono<AdminRegEnv>;
45
- export {};
34
+ export declare function createAdminRegistrationRoutes(deps: AdminRegistrationRoutesDeps): Hono<AdminEnv>;
46
35
  //# sourceMappingURL=admin-registrations.d.ts.map
@@ -22,10 +22,11 @@ import { Hono } from 'hono';
22
22
  import type { Kysely } from 'kysely';
23
23
  import type { Database } from '../db/types.js';
24
24
  import type { TokenManager } from '../secrets/token-manager.js';
25
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
25
+ import type { RbacEnforcer } from '../secrets/rbac.js';
26
26
  import type { AuditLogger } from '../secrets/audit-logger.js';
27
27
  import type { ResolvedMasterKeys } from '../secrets/config.js';
28
28
  import type { LogStorage } from '../reporting/log-storage.js';
29
+ import { type AdminEnv } from './admin-env.js';
29
30
  /**
30
31
  * Statuses accepted by the `?status=` filter.
31
32
  *
@@ -35,9 +36,6 @@ import type { LogStorage } from '../reporting/log-storage.js';
35
36
  * an empty result into a rejected request.
36
37
  */
37
38
  export declare const RUN_STATUSES: ReadonlySet<string>;
38
- /**
39
- * Dependencies for admin run routes.
40
- */
41
39
  export interface AdminRunRoutesDeps {
42
40
  db: Kysely<Database>;
43
41
  tokenManager: TokenManager;
@@ -58,20 +56,11 @@ export interface AdminRunRoutesDeps {
58
56
  */
59
57
  logStorage?: LogStorage;
60
58
  }
61
- /** Hono env type for admin run routes with context variables. */
62
- type AdminRunEnv = {
63
- Variables: {
64
- role: Role;
65
- userId: string;
66
- routingKey: string | null;
67
- };
68
- };
69
59
  /**
70
60
  * Create admin API routes for execution run inspection.
71
61
  *
72
62
  * @param deps - Admin run route dependencies
73
63
  * @returns Hono app with run routes mounted at /api/v1/admin/runs
74
64
  */
75
- export declare function createAdminRunRoutes(deps: AdminRunRoutesDeps): Hono<AdminRunEnv>;
76
- export {};
65
+ export declare function createAdminRunRoutes(deps: AdminRunRoutesDeps): Hono<AdminEnv>;
77
66
  //# sourceMappingURL=admin-runs.d.ts.map
@@ -19,16 +19,10 @@
19
19
  import { Hono } from 'hono';
20
20
  import { type PeerScalerOrphansResponse } from '@kici-dev/engine';
21
21
  import type { AccessLogWriter } from '../audit/access-log.js';
22
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
22
+ import type { RbacEnforcer } from '../secrets/rbac.js';
23
23
  import { type ScalerOrphansAnswer, type ScalerOrphansRequest } from '../scaler/orphan-requests.js';
24
24
  import { ScalerOrphansForwardFailure } from '../cluster/scaler-orphans-peer.js';
25
- type AdminEnv = {
26
- Variables: {
27
- role: Role;
28
- userId: string;
29
- routingKey: string | null;
30
- };
31
- };
25
+ import { type AdminEnv } from './admin-env.js';
32
26
  /** What the routes need from the coordinator they run on. */
33
27
  export interface ScalerOrphansRouteDeps {
34
28
  /** This coordinator's instance id. */
@@ -60,5 +54,4 @@ export declare function createScalerOrphansRoutes(deps: {
60
54
  rbac: RbacEnforcer;
61
55
  accessLog?: AccessLogWriter;
62
56
  }): Hono<AdminEnv>;
63
- export {};
64
57
  //# sourceMappingURL=admin-scaler-orphans.d.ts.map
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Reload the scaler config, behind `kici-admin scaler reload`.
3
+ *
4
+ * Mounted inside `createAdminRoutes` at `/api/v1/admin`, so the Bearer-token
5
+ * auth middleware has already resolved the caller's role. Needs an unscoped
6
+ * token and the `scaler.manage` permission (owner, admin).
7
+ *
8
+ * - `POST /api/v1/admin/scaler/reload { single?, timeoutMs? }` — re-read the
9
+ * scaler config on this orchestrator and, unless `single`, on every peer it
10
+ * is connected to. Each orchestrator applies its own file completely or not
11
+ * at all. Answers `{ scope, results }` with one result per instance, this
12
+ * one first: `200` when no instance refused its file or went unanswered,
13
+ * `422` otherwise.
14
+ *
15
+ * The route runs the scaler reload only: it does not reload the orchestrator
16
+ * config, so it never bumps the config version the peers follow, and a
17
+ * `single` reload stays on this orchestrator.
18
+ */
19
+ import { Hono } from 'hono';
20
+ import { type ScalerReloadInstanceResult } from '@kici-dev/engine';
21
+ import type { AccessLogWriter } from '../audit/access-log.js';
22
+ import type { RbacEnforcer } from '../secrets/rbac.js';
23
+ import { type AdminEnv } from './admin-env.js';
24
+ /** What the route needs from the orchestrator it runs on. */
25
+ export interface ScalerReloadRouteDeps {
26
+ /** This orchestrator's instance id, the audit row's target. */
27
+ instanceId: string;
28
+ /**
29
+ * Reload here and, unless `single`, on every connected peer, waiting
30
+ * `timeoutMs` for each peer. The first result is this orchestrator's.
31
+ */
32
+ reload: (single: boolean, timeoutMs: number) => Promise<ScalerReloadInstanceResult[]>;
33
+ }
34
+ /** How long the route waits for each peer by default. */
35
+ export declare const DEFAULT_SCALER_RELOAD_TIMEOUT_MS = 60000;
36
+ export declare function createScalerReloadRoutes(deps: {
37
+ scalerReload: ScalerReloadRouteDeps;
38
+ rbac: RbacEnforcer;
39
+ accessLog?: AccessLogWriter;
40
+ }): Hono<AdminEnv>;
41
+ //# sourceMappingURL=admin-scaler-reload.d.ts.map
@@ -18,19 +18,12 @@ import { Hono } from 'hono';
18
18
  import type { Kysely } from 'kysely';
19
19
  import type { Database } from '../db/types.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 AdminScheduledJobsRoutesDeps {
23
24
  db: Kysely<Database>;
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 createAdminScheduledJobsRoutes(deps: AdminScheduledJobsRoutesDeps): Hono<AdminEnv>;
35
- export {};
36
29
  //# sourceMappingURL=admin-scheduled-jobs.d.ts.map
@@ -16,18 +16,11 @@
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
+ import { type AdminEnv } from './admin-env.js';
20
21
  export interface AdminSigningKeyRoutesDeps {
21
22
  db: Kysely<Database>;
22
23
  rbac: RbacEnforcer;
23
24
  }
24
- type AdminEnv = {
25
- Variables: {
26
- role: Role;
27
- userId: string;
28
- routingKey: string | null;
29
- };
30
- };
31
25
  export declare function createAdminSigningKeyRoutes(deps: AdminSigningKeyRoutesDeps): Hono<AdminEnv>;
32
- export {};
33
26
  //# sourceMappingURL=admin-signing-keys.d.ts.map