@kici-dev/orchestrator 0.10.0 → 0.12.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 (141) hide show
  1. package/dist/__test-helpers__/mock-db-query.d.ts +4 -5
  2. package/dist/agent/agent-version.d.ts +5 -5
  3. package/dist/agent/dispatcher.d.ts +26 -0
  4. package/dist/agent/registry.d.ts +7 -9
  5. package/dist/agent-packaging/node-runtime-members.d.ts +14 -0
  6. package/dist/app.d.ts +3 -3
  7. package/dist/approvals/apply-decision.d.ts +1 -1
  8. package/dist/audit/access-log.d.ts +2 -3
  9. package/dist/cli/api-client.d.ts +20 -1
  10. package/dist/cli/commands/access-log.d.ts +3 -3
  11. package/dist/cli/commands/agent-service/agent-env.d.ts +20 -0
  12. package/dist/cli/commands/agent-service/status.d.ts +3 -3
  13. package/dist/cli/commands/attestations.d.ts +10 -0
  14. package/dist/cli/commands/cold-store-impl.d.ts +3 -3
  15. package/dist/cli/commands/cold-store.d.ts +6 -3
  16. package/dist/cli/commands/context.d.ts +5 -3
  17. package/dist/cli/commands/dashboard-encryption-key.d.ts +18 -0
  18. package/dist/cli/commands/event-dlq.d.ts +5 -6
  19. package/dist/cli/commands/event-log.d.ts +2 -3
  20. package/dist/cli/commands/execution.d.ts +1 -3
  21. package/dist/cli/commands/orchestrator-service/status.d.ts +10 -3
  22. package/dist/cli/commands/queue.d.ts +1 -2
  23. package/dist/cli/commands/registration.d.ts +8 -4
  24. package/dist/cli/commands/runs.d.ts +2 -3
  25. package/dist/cli/commands/secret.d.ts +1 -0
  26. package/dist/cli/commands/service-health.d.ts +68 -0
  27. package/dist/cli/commands/shared/confirm.d.ts +19 -0
  28. package/dist/cli/commands/shared/env-file-mode.d.ts +3 -2
  29. package/dist/cli/commands/shared/upgrade-safety.d.ts +11 -5
  30. package/dist/cli/commands/shared/versioned-upgrade.d.ts +119 -7
  31. package/dist/cli/commands/workflow.d.ts +3 -4
  32. package/dist/cli/open-browser.d.ts +1 -1
  33. package/dist/cli/service/entrypoint.d.ts +18 -0
  34. package/dist/cli/service/image-digests.d.ts +10 -0
  35. package/dist/cli/service/index.d.ts +4 -2
  36. package/dist/cli/service/instance/manifest.d.ts +39 -0
  37. package/dist/cli/service/launchd.d.ts +45 -10
  38. package/dist/cli/service/shutdown-grace.d.ts +35 -0
  39. package/dist/cli/service/types.d.ts +9 -0
  40. package/dist/cli/service/windows-acl.d.ts +40 -0
  41. package/dist/cli/service/windows-env-file.d.ts +45 -0
  42. package/dist/cli/service/windows.d.ts +13 -0
  43. package/dist/cli.js +1869 -707
  44. package/dist/cluster/cluster-identity.d.ts +4 -4
  45. package/dist/cluster/join-token.d.ts +2 -2
  46. package/dist/cluster/leader-gated-scheduler.d.ts +7 -1
  47. package/dist/cluster/peer-credentials.d.ts +1 -1
  48. package/dist/cluster/raft-state.d.ts +6 -0
  49. package/dist/cluster/raft.d.ts +16 -2
  50. package/dist/cold-store/load-access-log-range.d.ts +3 -3
  51. package/dist/cold-store/load-event-log-range.d.ts +1 -1
  52. package/dist/cold-store/load-secret-audit-log-range.d.ts +2 -2
  53. package/dist/cold-store/orchestrator-cold-store.d.ts +9 -11
  54. package/dist/cold-store/tables/access-log.d.ts +2 -2
  55. package/dist/cold-store/tables/event-log.d.ts +4 -10
  56. package/dist/cold-store/tables/execution-jobs.d.ts +1 -1
  57. package/dist/cold-store/tables/execution-runs.d.ts +4 -4
  58. package/dist/cold-store/tables/execution-steps.d.ts +1 -1
  59. package/dist/cold-store/tables/secret-audit-log.d.ts +3 -3
  60. package/dist/config.d.ts +3 -1
  61. package/dist/contexts/held-runs.d.ts +2 -2
  62. package/dist/contexts/variable-store.d.ts +2 -0
  63. package/dist/dashboard/attestation-filters.d.ts +1 -1
  64. package/dist/dashboard/handler.d.ts +8 -8
  65. package/dist/db/deferred-indexes.d.ts +2 -2
  66. package/dist/db/migrations/005_cold_store_chunk_counter.d.ts +2 -4
  67. package/dist/db/migrations/006_runs_jobs_steps_archived_at.d.ts +4 -4
  68. package/dist/db/migrations/007_audit_logs_archived_at.d.ts +6 -9
  69. package/dist/db/migrations/008_event_log_archived_at.d.ts +4 -6
  70. package/dist/db/migrations/010_cold_store_chunks.d.ts +2 -2
  71. package/dist/db/migrations/012_peer_credentials_active_uniq.d.ts +2 -4
  72. package/dist/db/migrations/016_org_settings_allow_http_npm.d.ts +2 -2
  73. package/dist/db/migrations/045_host_properties.d.ts +1 -1
  74. package/dist/db/migrations/046_join_token_consumed_by_instance.d.ts +1 -1
  75. package/dist/db/migrations/048_host_reboot_pending.d.ts +1 -1
  76. package/dist/db/migrations/049_held_runs_payload.d.ts +1 -1
  77. package/dist/db/migrations/050_sources_slug.d.ts +1 -1
  78. package/dist/db/migrations/051_binding_host_pattern.d.ts +1 -1
  79. package/dist/db/migrations/052_host_reach_metadata.d.ts +1 -1
  80. package/dist/db/migrations/053_agent_token_single_use.d.ts +1 -1
  81. package/dist/db/migrations/054_local_working_tree.d.ts +1 -1
  82. package/dist/db/migrations/055_agent_token_mandatory_labels.d.ts +1 -1
  83. package/dist/db/migrations/056_execution_jobs_environments.d.ts +1 -1
  84. package/dist/db/migrations/064_execution_jobs_skipped_environments.d.ts +1 -1
  85. package/dist/db/types.d.ts +12 -13
  86. package/dist/events/types.d.ts +1 -1
  87. package/dist/fault-injection-types.d.ts +2 -2
  88. package/dist/firecracker/host-network.d.ts +21 -3
  89. package/dist/firecracker/net-interfaces.d.ts +1 -1
  90. package/dist/helpers/run-detached.d.ts +12 -0
  91. package/dist/index.js +76 -14
  92. package/dist/oidc/db-signer.d.ts +1 -1
  93. package/dist/pipeline/global-eval-round.d.ts +2 -2
  94. package/dist/pipeline/processor.d.ts +2 -2
  95. package/dist/provenance/retrier-mint.d.ts +1 -1
  96. package/dist/provenance/trust-root.d.ts +3 -3
  97. package/dist/providers/universal-git/clone-token.d.ts +9 -13
  98. package/dist/providers/universal-git/index.d.ts +1 -2
  99. package/dist/providers/universal-git/normalizer.d.ts +2 -3
  100. package/dist/providers/universal-git/ssh-auth.d.ts +4 -4
  101. package/dist/queue/cleanup.d.ts +2 -2
  102. package/dist/queue/job-queue.d.ts +6 -6
  103. package/dist/queue/scheduled-job.d.ts +5 -7
  104. package/dist/registration/extractor.d.ts +1 -1
  105. package/dist/registration/registration-index.d.ts +1 -1
  106. package/dist/reporting/execution-tracker.d.ts +3 -3
  107. package/dist/routes/admin-access-log.d.ts +1 -1
  108. package/dist/routes/admin-auth.d.ts +2 -2
  109. package/dist/routes/admin-contexts.d.ts +6 -0
  110. package/dist/routes/admin-event-log.d.ts +2 -2
  111. package/dist/routes/admin-registrations.d.ts +2 -2
  112. package/dist/routes/admin-runs.d.ts +3 -3
  113. package/dist/routes/admin-scheduled-jobs.d.ts +2 -3
  114. package/dist/routes/health.d.ts +9 -0
  115. package/dist/scaler/container-backend.d.ts +1 -1
  116. package/dist/scaler/firecracker-backend.d.ts +15 -10
  117. package/dist/scaler/firecracker-extra-hosts.d.ts +20 -0
  118. package/dist/scaler/machine-ledger.d.ts +3 -4
  119. package/dist/scaler/scaler-state-store.d.ts +1 -1
  120. package/dist/scaler/types.d.ts +4 -1
  121. package/dist/secrets/audit-logger.d.ts +3 -3
  122. package/dist/security/reduced-privilege-note.d.ts +2 -3
  123. package/dist/security/trust-policy-store.d.ts +3 -3
  124. package/dist/server.d.ts +2 -1
  125. package/dist/server.js +2885 -2211
  126. package/dist/stale-detector/stale-run-detector.d.ts +1 -1
  127. package/dist/standalone.d.ts +1 -1
  128. package/dist/standalone.js +2254 -1629
  129. package/dist/storage/filesystem.d.ts +1 -1
  130. package/dist/storage/index.d.ts +1 -1
  131. package/dist/storage/sign-url.d.ts +2 -1
  132. package/dist/storage/types.d.ts +2 -2
  133. package/dist/ws/agent-handler.d.ts +34 -3
  134. package/dist/ws/agent-heartbeat.d.ts +2 -3
  135. package/dist/ws/dashboard-context-handler.d.ts +1 -1
  136. package/dist/ws/platform-client.d.ts +44 -32
  137. package/dist/ws/server-options.d.ts +1 -1
  138. package/dist/ws/test-relay-handlers.d.ts +1 -1
  139. package/installer-image-digests.json +3 -3
  140. package/package.json +4 -4
  141. package/sbom.spdx.json +53 -53
@@ -612,12 +612,12 @@ export declare class JobQueue {
612
612
  * declared failed, so any dispatch_queue row still in `Pending`,
613
613
  * `Recovering`, or `Dispatched` is by definition orphaned and must
614
614
  * also be moved to `Failed` — leaving a `Dispatched` row in place
615
- * keeps the row in a non-terminal state forever, which the build-timeout
616
- * E2E (and any operator query for "is this run actually done") relies
617
- * on never happening. The complementary {@link markCompleted} status
618
- * guard ensures a late `job.complete` from the agent that was still
619
- * working when the run was declared failed cannot flip the row back
620
- * to `Completed`.
615
+ * keeps the row in a non-terminal state forever, which any caller
616
+ * polling for a terminal state (and any operator query for "is this
617
+ * run actually done") relies on never happening. The complementary
618
+ * {@link markCompleted} status guard ensures a late `job.complete` from
619
+ * the agent that was still working when the run was declared failed
620
+ * cannot flip the row back to `Completed`.
621
621
  *
622
622
  * @returns Number of affected rows.
623
623
  */
@@ -1,19 +1,17 @@
1
1
  /**
2
2
  * Orchestrator scheduled-job wrapper.
3
3
  *
4
- * Mirrors `packages/platform/src/queue/scheduled-job.ts` in observable
4
+ * Mirrors the Platform's scheduled-job wrapper in observable
5
5
  * surface (5 Prometheus metrics + structured logs + audit row on
6
6
  * failure) but uses `setInterval` instead of pg-boss — the orchestrator
7
7
  * has no pg-boss dependency and we're not adding one.
8
8
  *
9
- * All future orchestrator periodic jobs MUST use this wrapper — per
10
- * CLAUDE.md "no workarounds", the legacy setInterval call sites in
11
- * queue/cleanup.ts and secrets/cleanup.ts migrate in the same phase
12
- * they'd otherwise be updated.
9
+ * Every orchestrator periodic job MUST use this wrapper, as the cleanup
10
+ * jobs in queue/cleanup.ts and secrets/cleanup.ts do.
13
11
  *
14
12
  * `triggerNow()` on the returned handle forces one off-cadence tick
15
13
  * (used by the admin `/api/v1/admin/scheduled-jobs/:name/trigger`
16
- * endpoint and by E2E harnesses). It does NOT reset the interval
14
+ * endpoint and by tests). It does NOT reset the interval
17
15
  * timer — a real tick still fires at the scheduled cadence after.
18
16
  */
19
17
  import { z } from 'zod';
@@ -60,7 +58,7 @@ export interface OrchestratorScheduledJobHandle {
60
58
  stop(): void;
61
59
  /**
62
60
  * Force one off-cadence tick and await it (success or failure).
63
- * Returns the tick's outcome so E2E and admin routes can report it.
61
+ * Returns the tick's outcome so callers such as the admin route can report it.
64
62
  */
65
63
  triggerNow(): Promise<{
66
64
  ok: boolean;
@@ -5,7 +5,7 @@ import type { LockFile, LockTrigger, LockWorkflow } from '@kici-dev/engine';
5
5
  * Non-Git-provider triggers (kici_event, schedule, webhook, …) live in the
6
6
  * registration table because they have no per-repo lock file pipeline to
7
7
  * fall back to. Git-provider triggers (push, pr, tag, …) ALSO live in the
8
- * registration table so that the cross-source dispatch path (phase 28.5)
8
+ * registration table so that the cross-source dispatch path
9
9
  * can resolve them by (customer_id, repo_identifier) when a generic webhook
10
10
  * targets an externally-hosted repo. The per-event lock file pipeline still
11
11
  * handles same-source dispatch for git triggers; registration is an additive
@@ -73,7 +73,7 @@ export declare class RegistrationIndex {
73
73
  private byOrgAndEvent;
74
74
  /**
75
75
  * Quinary index: registrations keyed by `${customerId}|${repoIdentifier}`.
76
- * Drives the cross-source repo lookup (phase 28.5): when a generic webhook
76
+ * Drives the cross-source repo lookup: when a generic webhook
77
77
  * carries a repository identifier in its payload, the dispatcher looks up
78
78
  * registrations for that (org, repo) pair across ALL routing keys and uses
79
79
  * each registration's stored `providerContext` + `routingKey` to reach the
@@ -716,7 +716,7 @@ export declare class ExecutionTracker {
716
716
  */
717
717
  private runInvokeGateAggregationHook;
718
718
  /**
719
- * Phase 9: stuck-jobs invariant check ( Layer 3).
719
+ * Phase 9: stuck-jobs invariant check (Layer 3).
720
720
  * Before declaring a run complete, verify no stuck jobs exist. If any are
721
721
  * found, fail them via recursive onJobStatus calls and signal the caller to
722
722
  * stop (returns true) — the recursive calls will re-enter and re-check
@@ -786,8 +786,8 @@ export declare class ExecutionTracker {
786
786
  * Create a failed execution run when the build timed out before onExecutionStarted
787
787
  * had a chance to insert the row (buildJobTrackedEarly was false).
788
788
  *
789
- * Inserts a minimal execution_runs row with status='failed' directly so the E2E
790
- * test (and dashboard) can observe the failure instead of a missing run.
789
+ * Inserts a minimal execution_runs row with status='failed' directly so the
790
+ * dashboard (and any run query) can observe the failure instead of a missing run.
791
791
  *
792
792
  * The fifth pre-dispatch recording site, and the third that writes the row and
793
793
  * returns. Its row is terminal with no resume path, so no invoke gate ever
@@ -4,7 +4,7 @@
4
4
  * Operator-facing read access to read + orchestrator-admin mutation attempts
5
5
  * captured with ActorPrincipal attribution. Mirrors the dashboard's
6
6
  * dashboard.access-log.list WS handler but exposed over HTTP + Bearer auth
7
- * so operators can dogfood from the CLI without going through the dashboard.
7
+ * so operators can read it from the CLI without going through the dashboard.
8
8
  *
9
9
  * GET /api/v1/admin/access-log
10
10
  * Filters: orgId, actorType, actorId, action, source, outcome,
@@ -26,8 +26,8 @@ import type { Role } from '../secrets/rbac.js';
26
26
  * The three admin-auth response bodies.
27
27
  *
28
28
  * A single map rather than string literals repeated across every admin router:
29
- * the 401 wordings are observed by operators and by E2E assertions, so they are
30
- * pinned in exactly one place.
29
+ * the 401 wordings are observed by operators and asserted on by tests, so they
30
+ * are pinned in exactly one place.
31
31
  */
32
32
  export declare const AUTH_ERROR: {
33
33
  readonly missing: 'Missing authorization';
@@ -11,6 +11,12 @@
11
11
  * GET /api/v1/admin/contexts/:name/variables?orgId=<id> — list org-level variables
12
12
  * PUT /api/v1/admin/contexts/:name/variables/:key?orgId=<id> — upsert variable
13
13
  * DELETE /api/v1/admin/contexts/:name/variables/:key?orgId=<id> — delete variable
14
+ * GET /api/v1/admin/contexts/:name/source-overrides?orgId=<id>[&routingKey=<k>]
15
+ * — list per-source overrides
16
+ * PUT /api/v1/admin/contexts/:name/source-overrides/:routingKey/:key?orgId=<id>
17
+ * — upsert a source override
18
+ * DELETE /api/v1/admin/contexts/:name/source-overrides/:routingKey/:key?orgId=<id>
19
+ * — delete a source override
14
20
  *
15
21
  * Backs the `kici-admin context` dual-mode CLI. Offline (direct-DB) mode
16
22
  * bypasses this router entirely — the CLI calls `*Direct` helpers from
@@ -4,7 +4,7 @@
4
4
  * Operator-facing read access to the per-delivery records the orchestrator
5
5
  * persists for every inbound webhook. Mirrors the dashboard's WS handler
6
6
  * (`DashboardHandler.handleEventLogList/Detail`) but is exposed over HTTP +
7
- * Bearer auth so operators can dogfood from the CLI without going through
7
+ * Bearer auth so operators can read it from the CLI without going through
8
8
  * the dashboard.
9
9
  *
10
10
  * GET /api/v1/admin/event-log
@@ -28,7 +28,7 @@ export interface AdminEventLogRoutesDeps {
28
28
  logStorage: LogStorage;
29
29
  tokenManager: TokenManager;
30
30
  rbac: RbacEnforcer;
31
- /** Phase E: optional cold-store for archived event_log rows. */
31
+ /** Optional cold-store for archived event_log rows. */
32
32
  coldStore?: ColdStore;
33
33
  }
34
34
  type AdminEnv = {
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Admin API routes for workflow registration management.
3
3
  *
4
- * Provides endpoints for listing, inspecting, refreshing, and deleting
5
- * workflow registrations. All routes are protected by Bearer token
4
+ * Provides endpoints for listing, inspecting, refreshing, disabling and
5
+ * deleting workflow registrations. All routes are protected by Bearer token
6
6
  * authentication via the existing admin auth middleware pattern.
7
7
  */
8
8
  import { Hono } from 'hono';
@@ -14,9 +14,9 @@
14
14
  * GET /api/v1/admin/runs/:runId/ephemeral-key — scrub status
15
15
  * GET /api/v1/admin/runs/:runId/secret-outputs — masked by default; ?reveal=true
16
16
  *
17
- * This is the server-side counterpart to `kici-admin runs` — the dogfooded
18
- * replacement for hand-rolled curl commands and dashboard clicks when
19
- * verifying execution state.
17
+ * This is the server-side counterpart to `kici-admin runs`, which replaces
18
+ * hand-rolled curl commands and dashboard clicks when verifying execution
19
+ * state.
20
20
  */
21
21
  import { Hono } from 'hono';
22
22
  import type { Kysely } from 'kysely';
@@ -6,9 +6,8 @@
6
6
  * Requires: scheduled_job.trigger role permission (owner + admin roles)
7
7
  * Returns: { triggered: true, ok: boolean, durationMs: number, error?: string }
8
8
  *
9
- * Phase A's E2E smoke uses this endpoint to force a cold-store-archive
10
- * tick without waiting for the hourly cron. Future dashboard "Run now"
11
- * buttons use it too.
9
+ * Use it, for example, to force a cold-store-archive tick without waiting
10
+ * for the hourly cadence.
12
11
  *
13
12
  * The access_log row is written directly (not via the typed
14
13
  * AccessLogWriter) because `scheduled_job.trigger` is not in the
@@ -1,5 +1,14 @@
1
+ import { type BuildFingerprint } from '@kici-dev/shared';
1
2
  import type { Kysely } from 'kysely';
2
3
  import type { Database } from '../db/types.js';
4
+ /**
5
+ * The fields the orchestrator adds to its `/health` body. The route below
6
+ * returns this type, and `kici-admin orchestrator status` renders it.
7
+ */
8
+ export interface OrchestratorLivenessInfo extends BuildFingerprint {
9
+ /** ISO-8601 time the orchestrator bundle was built. */
10
+ buildDate: string;
11
+ }
3
12
  export interface HealthRoutesDeps {
4
13
  /** Optional DB instance for readiness checks */
5
14
  db?: Kysely<Database>;
@@ -41,7 +41,7 @@ export interface ContainerScalerBackendOptions {
41
41
  runtime?: 'docker' | 'podman' | 'auto';
42
42
  /** Default resource limits applied when label set has none */
43
43
  defaultResources?: ResourceRequest;
44
- /** Extra host:IP mappings injected into spawned containers (e.g. ["verdaccio.local:host-gateway"]) */
44
+ /** Extra host:IP mappings injected into spawned containers (e.g. ["registry.local:host-gateway"]) */
45
45
  extraHosts?: string[];
46
46
  /** Disable nftables-based network isolation (default: true). Set to false when nft is unavailable (e.g. rootless containers without NET_ADMIN). */
47
47
  networkIsolation?: boolean;
@@ -21,13 +21,6 @@ import type { IpAllocator, IpAllocationResult } from './ip-allocator.js';
21
21
  import type { AgentTokenStore } from '../agent/token-store.js';
22
22
  import { type FirecrackerBridgeConfig, type BridgeHealth, type ExecOptions } from '../firecracker/host-network.js';
23
23
  import type { ScalerBackend, ScalerDestroyContext, ScalerEntry, ManagedAgent, LabelSetConfig, ScalerEventCallback, ValidationResult, EffectiveLimits, SpawnContext } from './types.js';
24
- /**
25
- * Infrastructure interfaces that share the `kici-` prefix but must NEVER be
26
- * deleted by the orphan sweep. Bridges (kici-br0/kici-br1) carry all VM
27
- * traffic; kici-m01 is the staging metadata interface. Losing any of these
28
- * kills all running VMs.
29
- */
30
- export declare const PROTECTED_INTERFACES: readonly string[];
31
24
  /** Extended ManagedAgent that includes the allocated IP for cleanup */
32
25
  export interface FirecrackerManagedAgent extends ManagedAgent {
33
26
  /** Allocated IP address for TAP/IP release during destroy */
@@ -80,6 +73,11 @@ export interface FirecrackerScalerBackendOptions {
80
73
  cidr?: string;
81
74
  /** Gateway IP for guest networking */
82
75
  gateway: string;
76
+ /**
77
+ * Extra `host:address` mappings the rootfs `/init` appends to each guest's
78
+ * `/etc/hosts`; `host-gateway` resolves to {@link gateway}. None by default.
79
+ */
80
+ extraHosts?: string[];
83
81
  /** Netmask for guest networking */
84
82
  netmask: string;
85
83
  /** nft table name for host-network diagnostics. @default 'kici' */
@@ -145,6 +143,8 @@ export declare class FirecrackerScalerBackend implements ScalerBackend {
145
143
  private readonly bridgeName;
146
144
  private readonly cidr;
147
145
  private readonly gateway;
146
+ /** The MMDS `kici-extra-hosts` value, or undefined when the scaler maps no host. */
147
+ private readonly guestExtraHosts;
148
148
  /** Host services the orchestrator directed agents at, as `hostAccess` entries. */
149
149
  private readonly hostServices?;
150
150
  private readonly netmask;
@@ -180,6 +180,11 @@ export declare class FirecrackerScalerBackend implements ScalerBackend {
180
180
  * because `cleanupFailedSpawn` removes the tracking entry.
181
181
  */
182
182
  private abandonSpawn;
183
+ /**
184
+ * {@link abandonSpawn} from a path that cannot await it (an abort listener, a
185
+ * process exit handler). A failure is logged.
186
+ */
187
+ private abandonSpawnDetached;
183
188
  getScalerContext(agentId: string): Record<string, unknown> | undefined;
184
189
  /**
185
190
  * Bridge config for host-network diagnostics (read-only snapshot).
@@ -305,9 +310,9 @@ export declare class FirecrackerScalerBackend implements ScalerBackend {
305
310
  /**
306
311
  * Default interval for periodic orphan sweeps (15 minutes).
307
312
  *
308
- * Long-running orchestrators need in-process orphan sweeps because the
309
- * external kici-leak-sweep timer skips TAP cleanup while a staging
310
- * orchestrator is active (to avoid racing spawns). Without this, leaked
313
+ * Long-running orchestrators need in-process orphan sweeps because a
314
+ * host-level cleanup job skips TAP cleanup while an orchestrator is active
315
+ * (to avoid racing spawns). Without this, leaked
311
316
  * TAPs accumulate until the orchestrator restarts — which can be weeks.
312
317
  */
313
318
  private static readonly ORPHAN_SWEEP_INTERVAL_MS;
@@ -0,0 +1,20 @@
1
+ /** The address keyword for the bridge gateway, as the container runtimes spell it. */
2
+ export declare const HOST_GATEWAY = "host-gateway";
3
+ export interface ExtraHost {
4
+ host: string;
5
+ /** An IPv4 or IPv6 address, or {@link HOST_GATEWAY}. */
6
+ address: string;
7
+ }
8
+ /**
9
+ * Parse one `host:address` entry. The host ends at the first colon, so an
10
+ * IPv6 address keeps its own colons. Throws on a malformed entry.
11
+ */
12
+ export declare function parseExtraHost(entry: string): ExtraHost;
13
+ /**
14
+ * The MMDS value the rootfs `/init` reads: `host:address` pairs joined by
15
+ * commas, with `host-gateway` replaced by `gateway`. `undefined` when the
16
+ * scaler configures no mapping, so the guest gets none. Throws on a malformed
17
+ * entry, and on `host-gateway` when `gateway` is not an IP address.
18
+ */
19
+ export declare function renderGuestExtraHosts(entries: readonly string[] | undefined, gateway: string): string | undefined;
20
+ //# sourceMappingURL=firecracker-extra-hosts.d.ts.map
@@ -13,10 +13,9 @@
13
13
  * `mkdir` succeeds for exactly one caller when the directory does not exist,
14
14
  * so it works as a portable `flock` substitute without any native dependency.
15
15
  *
16
- * The plan considered `proper-lockfile` and `fs-ext` first; neither is a
17
- * transitive dep today (`pnpm why proper-lockfile` and `pnpm why fs-ext`
18
- * both empty), so we use the documented `mkdir` fallback. This avoids
19
- * adding a native binding for the sake of a single locking primitive.
16
+ * Neither `proper-lockfile` nor `fs-ext` is a dependency, so this uses the
17
+ * `mkdir` lock instead. This avoids adding a native binding for the sake of
18
+ * a single locking primitive.
20
19
  *
21
20
  * ## Crash safety
22
21
  *
@@ -346,7 +346,7 @@ export declare class ScalerStateStore {
346
346
  * the prune's verdict does not depend on it. It is written because the row
347
347
  * is the only surviving account of what became of a provision once the spawn
348
348
  * row is gone — which is what an operator investigating a torn-down
349
- * provision, and the E2E that pins this behaviour, read it for.
349
+ * provision reads it for.
350
350
  */
351
351
  recordProvisionCondemned(agentId: string, scalerName: string, reason: string): Promise<void>;
352
352
  /**
@@ -476,7 +476,10 @@ export interface ScalerEntry {
476
476
  runtime?: 'docker' | 'podman' | 'auto';
477
477
  /** Orchestrator URL for spawned agents to connect back to */
478
478
  orchestratorUrl?: string;
479
- /** Extra host:IP mappings injected into spawned containers (e.g. ["verdaccio.local:host-gateway"]) */
479
+ /**
480
+ * Extra host:IP mappings for spawned agents (e.g. ["registry.local:host-gateway"]): the
481
+ * container runtime's ExtraHosts, or each Firecracker guest's /etc/hosts.
482
+ */
480
483
  extraHosts?: string[];
481
484
  /** Disable nftables-based network isolation for container backend (default: true). Set to false when nft is unavailable. */
482
485
  networkIsolation?: boolean;
@@ -4,7 +4,7 @@
4
4
  * Records all secret access/denial events to the secret_audit_log table
5
5
  * for compliance and security monitoring.
6
6
  *
7
- * Phase D: query() supports cold-store read-through via the optional
7
+ * query() supports cold-store read-through via the optional
8
8
  * `coldStore` constructor argument and an `includeArchived` query
9
9
  * filter. Hot-only behavior is unchanged when neither is supplied.
10
10
  */
@@ -32,7 +32,7 @@ export declare class AuditLogger {
32
32
  * engine's `shouldRecordSecretResolve` helper) since they're written
33
33
  * once per JOB-step secret resolution and dwarf every other action's
34
34
  * volume. Denied resolves and every other action (`setSecret`,
35
- * `deleteSecret`, `rotateKey`, `secret-outputs.reveal`) bypass the
35
+ * `deleteSecret`, the scope writes, `rotateKey`, `secret-outputs.reveal`) bypass the
36
36
  * sampler — they are transactional with the mutation and must always
37
37
  * land.
38
38
  *
@@ -54,7 +54,7 @@ export declare class AuditLogger {
54
54
  limit?: number;
55
55
  offset?: number;
56
56
  /**
57
- * Phase D opt-in. When true, falls through to cold-store via
57
+ * Opt-in. When true, falls through to cold-store via
58
58
  * `loadSecretAuditLogRange` for any portion of the requested
59
59
  * window past the warm cutoff. Default false preserves the
60
60
  * original semantics.
@@ -56,9 +56,8 @@ export declare const REDUCED_PRIVILEGE_MARKER = "**Reduced privileges (untrusted
56
56
  * event, and an untrusted tier also reaches an internal-event child run that
57
57
  * inherited it.
58
58
  *
59
- * Kept in step with the dashboard's reduced-privilege banner
60
- * (`packages/dashboard/src/components/run-detail/degraded-run-banner.tsx`),
61
- * which describes the same run and may be read beside these checks.
59
+ * Kept in step with the dashboard's reduced-privilege banner, which
60
+ * describes the same run and may be read beside these checks.
62
61
  */
63
62
  export declare function buildReducedPrivilegeNote(tier: string | null | undefined, lockFileSource?: string | null): string | null;
64
63
  //# sourceMappingURL=reduced-privilege-note.d.ts.map
@@ -67,9 +67,9 @@ export declare class TrustPolicyStore {
67
67
  }
68
68
  /**
69
69
  * Build a TrustPolicyStore backed by its own connection pool to the given
70
- * orchestrator database URL. Mirrors `createHeldRunStoreFromUrl`; consumed by
71
- * E2E tests that assert the pushed policy is persisted in the real deployed
72
- * orchestrator DB rather than held in process memory.
70
+ * orchestrator database URL. Mirrors `createHeldRunStoreFromUrl`; exported for
71
+ * tests that assert the pushed policy is persisted in a real orchestrator DB
72
+ * rather than held in process memory.
73
73
  */
74
74
  export declare function createTrustPolicyStoreFromUrl(databaseUrl: string, opts?: {
75
75
  maxConnections?: number;
package/dist/server.d.ts CHANGED
@@ -7,12 +7,13 @@
7
7
  *
8
8
  * Both modes connect a PlatformClient to the Platform relay and run an agent WS server.
9
9
  *
10
- * Startup sequence follows packages/platform/src/server.ts pattern:
10
+ * Startup sequence (the same one the Platform follows):
11
11
  * config -> DB -> migrations -> provider registry -> dispatcher -> PlatformClient -> app -> HTTP -> heartbeat
12
12
  *
13
13
  * Graceful shutdown in reverse order:
14
14
  * Platform client -> agent WS -> heartbeat -> HTTP -> DB
15
15
  */
16
+ import '@kici-dev/shared/load-service-env-file';
16
17
  import type { OrchestratorFaultInjection } from './fault-injection-types.js';
17
18
  /**
18
19
  * Boot the Platform-connected orchestrator. Factored out of the module entry so