@kici-dev/orchestrator 0.0.0 → 0.1.2

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 (342) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +1 -6
  3. package/dist/__test-helpers__/mock-db.d.ts +103 -0
  4. package/dist/__test-helpers__/mock-ws.d.ts +13 -0
  5. package/dist/agent/dispatcher.d.ts +231 -0
  6. package/dist/agent/ownership-tracker.d.ts +46 -0
  7. package/dist/agent/registry.d.ts +255 -0
  8. package/dist/agent/token-store.d.ts +96 -0
  9. package/dist/app.d.ts +234 -0
  10. package/dist/audit/access-log.d.ts +92 -0
  11. package/dist/audit/sampling-rate-limiter.d.ts +41 -0
  12. package/dist/cache/build-coordinator.d.ts +42 -0
  13. package/dist/cache/dep-cache.d.ts +51 -0
  14. package/dist/cache/index.d.ts +16 -0
  15. package/dist/cache/pending-builds.d.ts +14 -0
  16. package/dist/cache/pending-dynamics.d.ts +15 -0
  17. package/dist/cache/pending-inits.d.ts +19 -0
  18. package/dist/cache/pending-tracker.d.ts +65 -0
  19. package/dist/cache/source-cache.d.ts +30 -0
  20. package/dist/cli/api-client.d.ts +411 -0
  21. package/dist/cli/commands/access-log.d.ts +30 -0
  22. package/dist/cli/commands/agent-service/index.d.ts +15 -0
  23. package/dist/cli/commands/agent-service/install.d.ts +9 -0
  24. package/dist/cli/commands/agent-service/logs.d.ts +9 -0
  25. package/dist/cli/commands/agent-service/restart.d.ts +8 -0
  26. package/dist/cli/commands/agent-service/start.d.ts +8 -0
  27. package/dist/cli/commands/agent-service/status.d.ts +10 -0
  28. package/dist/cli/commands/agent-service/stop.d.ts +8 -0
  29. package/dist/cli/commands/agent-service/uninstall.d.ts +9 -0
  30. package/dist/cli/commands/agent-service/upgrade.d.ts +11 -0
  31. package/dist/cli/commands/agent.d.ts +10 -0
  32. package/dist/cli/commands/api-key.d.ts +12 -0
  33. package/dist/cli/commands/audit.d.ts +9 -0
  34. package/dist/cli/commands/backend.d.ts +17 -0
  35. package/dist/cli/commands/cold-store-impl.d.ts +101 -0
  36. package/dist/cli/commands/cold-store.d.ts +30 -0
  37. package/dist/cli/commands/config.d.ts +16 -0
  38. package/dist/cli/commands/db.d.ts +19 -0
  39. package/dist/cli/commands/debug-bundle.d.ts +16 -0
  40. package/dist/cli/commands/diagnose.d.ts +15 -0
  41. package/dist/cli/commands/environment.d.ts +24 -0
  42. package/dist/cli/commands/event-dlq.d.ts +19 -0
  43. package/dist/cli/commands/event-log.d.ts +27 -0
  44. package/dist/cli/commands/event.d.ts +4 -0
  45. package/dist/cli/commands/execution.d.ts +17 -0
  46. package/dist/cli/commands/inspect-bundle.d.ts +16 -0
  47. package/dist/cli/commands/maintenance.d.ts +4 -0
  48. package/dist/cli/commands/orchestrator-service/index.d.ts +12 -0
  49. package/dist/cli/commands/orchestrator-service/install.d.ts +10 -0
  50. package/dist/cli/commands/orchestrator-service/logs.d.ts +10 -0
  51. package/dist/cli/commands/orchestrator-service/restart.d.ts +8 -0
  52. package/dist/cli/commands/orchestrator-service/start.d.ts +8 -0
  53. package/dist/cli/commands/orchestrator-service/status.d.ts +10 -0
  54. package/dist/cli/commands/orchestrator-service/stop.d.ts +8 -0
  55. package/dist/cli/commands/orchestrator-service/uninstall.d.ts +9 -0
  56. package/dist/cli/commands/orchestrator-service/upgrade.d.ts +12 -0
  57. package/dist/cli/commands/org-settings.d.ts +17 -0
  58. package/dist/cli/commands/peer.d.ts +13 -0
  59. package/dist/cli/commands/queue.d.ts +16 -0
  60. package/dist/cli/commands/registration.d.ts +18 -0
  61. package/dist/cli/commands/rotate.d.ts +9 -0
  62. package/dist/cli/commands/runs.d.ts +34 -0
  63. package/dist/cli/commands/secret.d.ts +12 -0
  64. package/dist/cli/commands/shared/db.d.ts +16 -0
  65. package/dist/cli/commands/shared/versioned-upgrade.d.ts +38 -0
  66. package/dist/cli/commands/source.d.ts +24 -0
  67. package/dist/cli/commands/token.d.ts +10 -0
  68. package/dist/cli/commands/workflow.d.ts +31 -0
  69. package/dist/cli/join.d.ts +14 -0
  70. package/dist/cli/kici-admin.d.ts +13 -0
  71. package/dist/cli/lazy-deps/cache.d.ts +17 -0
  72. package/dist/cli/lazy-deps/downloader.d.ts +33 -0
  73. package/dist/cli/lazy-deps/registry.d.ts +43 -0
  74. package/dist/cli/service/compose.d.ts +25 -0
  75. package/dist/cli/service/index.d.ts +24 -0
  76. package/dist/cli/service/launchd.d.ts +34 -0
  77. package/dist/cli/service/platform-detect.d.ts +59 -0
  78. package/dist/cli/service/systemd.d.ts +41 -0
  79. package/dist/cli/service/types.d.ts +91 -0
  80. package/dist/cli/service/windows.d.ts +20 -0
  81. package/dist/cli/wizard/agent-wizard.d.ts +24 -0
  82. package/dist/cli/wizard/orchestrator-wizard.d.ts +38 -0
  83. package/dist/cli/wizard/prompts.d.ts +23 -0
  84. package/dist/cli.js +11435 -0
  85. package/dist/cluster/cluster-identity.d.ts +59 -0
  86. package/dist/cluster/coordinator.d.ts +204 -0
  87. package/dist/cluster/health-api.d.ts +30 -0
  88. package/dist/cluster/index.d.ts +24 -0
  89. package/dist/cluster/join-client.d.ts +75 -0
  90. package/dist/cluster/join-handler.d.ts +58 -0
  91. package/dist/cluster/join-token.d.ts +94 -0
  92. package/dist/cluster/orphan-recovery.d.ts +67 -0
  93. package/dist/cluster/peer-client.d.ts +190 -0
  94. package/dist/cluster/peer-credentials.d.ts +108 -0
  95. package/dist/cluster/peer-crypto.d.ts +57 -0
  96. package/dist/cluster/peer-handler.d.ts +97 -0
  97. package/dist/cluster/peer-registry.d.ts +186 -0
  98. package/dist/cluster/raft-state.d.ts +36 -0
  99. package/dist/cluster/raft.d.ts +140 -0
  100. package/dist/cold-store/load-access-log-range.d.ts +73 -0
  101. package/dist/cold-store/load-event-log-range.d.ts +62 -0
  102. package/dist/cold-store/load-secret-audit-log-range.d.ts +38 -0
  103. package/dist/cold-store/orchestrator-cold-store.d.ts +58 -0
  104. package/dist/cold-store/tables/access-log.d.ts +80 -0
  105. package/dist/cold-store/tables/event-log.d.ts +70 -0
  106. package/dist/cold-store/tables/execution-jobs.d.ts +63 -0
  107. package/dist/cold-store/tables/execution-runs.d.ts +81 -0
  108. package/dist/cold-store/tables/execution-steps.d.ts +65 -0
  109. package/dist/cold-store/tables/secret-audit-log.d.ts +77 -0
  110. package/dist/concurrency/dispatch-next-queued.d.ts +63 -0
  111. package/dist/concurrency/group-tracker.d.ts +51 -0
  112. package/dist/concurrency/index.d.ts +3 -0
  113. package/dist/concurrency/queue-manager.d.ts +68 -0
  114. package/dist/concurrency/waiters.d.ts +58 -0
  115. package/dist/config/encryption.d.ts +82 -0
  116. package/dist/config/env-overlay.d.ts +45 -0
  117. package/dist/config/index.d.ts +16 -0
  118. package/dist/config/loader.d.ts +26 -0
  119. package/dist/config/reload.d.ts +113 -0
  120. package/dist/config/resolver.d.ts +47 -0
  121. package/dist/config/schema.d.ts +210 -0
  122. package/dist/config/shared-store.d.ts +142 -0
  123. package/dist/config/types.d.ts +218 -0
  124. package/dist/config.d.ts +249 -0
  125. package/dist/cron/cron-scheduler.d.ts +78 -0
  126. package/dist/cron/cron-store.d.ts +38 -0
  127. package/dist/dashboard/handler.d.ts +243 -0
  128. package/dist/db/client.d.ts +13 -0
  129. package/dist/db/migration-provider.d.ts +9 -0
  130. package/dist/db/migrations/001_initial.d.ts +8 -0
  131. package/dist/db/migrations/002_config_versions_key_version.d.ts +16 -0
  132. package/dist/db/migrations/003_access_log.d.ts +26 -0
  133. package/dist/db/migrations/004_rename_bundle_to_source.d.ts +19 -0
  134. package/dist/db/migrations/005_cold_store_chunk_counter.d.ts +19 -0
  135. package/dist/db/migrations/006_runs_jobs_steps_archived_at.d.ts +38 -0
  136. package/dist/db/migrations/007_audit_logs_archived_at.d.ts +42 -0
  137. package/dist/db/migrations/008_event_log_archived_at.d.ts +40 -0
  138. package/dist/db/migrations/009_access_log_trigram.d.ts +15 -0
  139. package/dist/db/migrations/010_cold_store_chunks.d.ts +34 -0
  140. package/dist/db/migrations/011_drop_source_secrets_notify.d.ts +21 -0
  141. package/dist/db/migrations/012_peer_credentials_active_uniq.d.ts +28 -0
  142. package/dist/db/migrations/013_execution_log_bytes.d.ts +21 -0
  143. package/dist/db/migrations/014_kici_events_lease_retry.d.ts +36 -0
  144. package/dist/db/migrations/015_org_settings_customer_scoped.d.ts +30 -0
  145. package/dist/db/migrations/016_org_settings_allow_http_npm.d.ts +15 -0
  146. package/dist/db/migrations/017_org_id_widen.d.ts +4 -0
  147. package/dist/db/migrations/018_org_id_prefix_backfill.d.ts +4 -0
  148. package/dist/db/migrator.d.ts +32 -0
  149. package/dist/db/types.d.ts +1266 -0
  150. package/dist/diagnostics/bundle-reader.d.ts +48 -0
  151. package/dist/diagnostics/bundle-writer.d.ts +57 -0
  152. package/dist/diagnostics/checks/agents.d.ts +10 -0
  153. package/dist/diagnostics/checks/certs.d.ts +9 -0
  154. package/dist/diagnostics/checks/config.d.ts +10 -0
  155. package/dist/diagnostics/checks/db.d.ts +9 -0
  156. package/dist/diagnostics/checks/disk.d.ts +9 -0
  157. package/dist/diagnostics/checks/index.d.ts +17 -0
  158. package/dist/diagnostics/checks/ws.d.ts +9 -0
  159. package/dist/diagnostics/index.d.ts +13 -0
  160. package/dist/diagnostics/runner.d.ts +23 -0
  161. package/dist/diagnostics/types.d.ts +38 -0
  162. package/dist/entry-helpers.d.ts +93 -0
  163. package/dist/environments/binding-store.d.ts +27 -0
  164. package/dist/environments/environment-store.d.ts +74 -0
  165. package/dist/environments/held-runs.d.ts +64 -0
  166. package/dist/environments/index.d.ts +10 -0
  167. package/dist/environments/protection/branch-gate.d.ts +5 -0
  168. package/dist/environments/protection/concurrency-gate.d.ts +7 -0
  169. package/dist/environments/protection/pipeline.d.ts +18 -0
  170. package/dist/environments/protection/reviewer-gate.d.ts +7 -0
  171. package/dist/environments/protection/trust-gate.d.ts +7 -0
  172. package/dist/environments/protection/wait-timer-gate.d.ts +7 -0
  173. package/dist/environments/variable-store.d.ts +39 -0
  174. package/dist/events/circuit-breaker.d.ts +33 -0
  175. package/dist/events/event-emitter.d.ts +55 -0
  176. package/dist/events/event-retry-scanner.d.ts +52 -0
  177. package/dist/events/event-router.d.ts +183 -0
  178. package/dist/events/event-store.d.ts +157 -0
  179. package/dist/events/trust-store.d.ts +54 -0
  180. package/dist/events/types.d.ts +61 -0
  181. package/dist/helpers/ip-extraction.d.ts +29 -0
  182. package/dist/helpers/rate-limiter.d.ts +23 -0
  183. package/dist/index.d.ts +7 -0
  184. package/dist/index.js +772 -0
  185. package/dist/lockfile-cache.d.ts +39 -0
  186. package/dist/metrics/agent-metrics-aggregator.d.ts +116 -0
  187. package/dist/metrics/metrics-reporter.d.ts +40 -0
  188. package/dist/metrics/prometheus.d.ts +261 -0
  189. package/dist/metrics/scheduled-jobs.d.ts +20 -0
  190. package/dist/orchestrator-core.d.ts +193 -0
  191. package/dist/pipeline/dispatch-matched-workflow.d.ts +102 -0
  192. package/dist/pipeline/inline-eval.d.ts +28 -0
  193. package/dist/pipeline/install-secrets-resolver.d.ts +73 -0
  194. package/dist/pipeline/manual-schedule.d.ts +21 -0
  195. package/dist/pipeline/needs-scheduler.d.ts +85 -0
  196. package/dist/pipeline/process-webhook.d.ts +38 -0
  197. package/dist/pipeline/processor.d.ts +326 -0
  198. package/dist/pipeline/rerun.d.ts +79 -0
  199. package/dist/pipeline/test-pipeline.d.ts +110 -0
  200. package/dist/provider-registry.d.ts +122 -0
  201. package/dist/providers/generic/index.d.ts +23 -0
  202. package/dist/providers/generic/normalizer.d.ts +112 -0
  203. package/dist/providers/generic/verification.d.ts +47 -0
  204. package/dist/providers/github/auth.d.ts +60 -0
  205. package/dist/providers/github/changed-files.d.ts +51 -0
  206. package/dist/providers/github/check-status-poster.d.ts +35 -0
  207. package/dist/providers/github/contributor-resolver.d.ts +30 -0
  208. package/dist/providers/github/index.d.ts +20 -0
  209. package/dist/providers/github/lock-file.d.ts +32 -0
  210. package/dist/providers/github/normalizer.d.ts +103 -0
  211. package/dist/providers/github/repo-url.d.ts +35 -0
  212. package/dist/providers/internal/index.d.ts +32 -0
  213. package/dist/providers/internal/lock-file-fetcher.d.ts +34 -0
  214. package/dist/providers/internal/normalizer.d.ts +89 -0
  215. package/dist/providers/internal/repo-url-builder.d.ts +42 -0
  216. package/dist/providers/universal-git/changed-files.d.ts +42 -0
  217. package/dist/providers/universal-git/clone-token.d.ts +83 -0
  218. package/dist/providers/universal-git/config.d.ts +192 -0
  219. package/dist/providers/universal-git/index.d.ts +55 -0
  220. package/dist/providers/universal-git/lock-file.d.ts +71 -0
  221. package/dist/providers/universal-git/normalizer.d.ts +90 -0
  222. package/dist/providers/universal-git/repo-url.d.ts +50 -0
  223. package/dist/providers/universal-git/ssh-auth.d.ts +94 -0
  224. package/dist/queue/bootstrap.d.ts +50 -0
  225. package/dist/queue/cleanup.d.ts +41 -0
  226. package/dist/queue/depth-refresher.d.ts +65 -0
  227. package/dist/queue/job-queue.d.ts +343 -0
  228. package/dist/queue/scheduled-job.d.ts +91 -0
  229. package/dist/registration/extractor.d.ts +44 -0
  230. package/dist/registration/registration-index.d.ts +162 -0
  231. package/dist/registration/registration-store.d.ts +111 -0
  232. package/dist/reporting/check-run-summary.d.ts +102 -0
  233. package/dist/reporting/commit-status.d.ts +382 -0
  234. package/dist/reporting/execution-tracker.d.ts +538 -0
  235. package/dist/reporting/fs-log-storage.d.ts +41 -0
  236. package/dist/reporting/log-pull-handler.d.ts +35 -0
  237. package/dist/reporting/log-storage.d.ts +70 -0
  238. package/dist/reporting/log-writer.d.ts +45 -0
  239. package/dist/reporting/s3-log-storage.d.ts +42 -0
  240. package/dist/reporting/step-log-buffer.d.ts +57 -0
  241. package/dist/routes/admin-access-log.d.ts +34 -0
  242. package/dist/routes/admin-backends.d.ts +28 -0
  243. package/dist/routes/admin-config.d.ts +57 -0
  244. package/dist/routes/admin-db.d.ts +20 -0
  245. package/dist/routes/admin-environments.d.ts +42 -0
  246. package/dist/routes/admin-errors.d.ts +4 -0
  247. package/dist/routes/admin-event-dlq.d.ts +39 -0
  248. package/dist/routes/admin-event-log.d.ts +42 -0
  249. package/dist/routes/admin-events.d.ts +46 -0
  250. package/dist/routes/admin-maintenance.d.ts +22 -0
  251. package/dist/routes/admin-org-settings.d.ts +29 -0
  252. package/dist/routes/admin-queue-execution.d.ts +27 -0
  253. package/dist/routes/admin-registrations.d.ts +37 -0
  254. package/dist/routes/admin-runs.d.ts +57 -0
  255. package/dist/routes/admin-scheduled-jobs.d.ts +36 -0
  256. package/dist/routes/admin-sources.d.ts +18 -0
  257. package/dist/routes/admin.d.ts +103 -0
  258. package/dist/routes/capabilities.d.ts +24 -0
  259. package/dist/routes/diagnostics.d.ts +16 -0
  260. package/dist/routes/health.d.ts +20 -0
  261. package/dist/routes/test-trigger.d.ts +41 -0
  262. package/dist/routes/uploads.d.ts +38 -0
  263. package/dist/routes/webhooks.d.ts +36 -0
  264. package/dist/scaler/bare-metal-backend.d.ts +107 -0
  265. package/dist/scaler/config.d.ts +303 -0
  266. package/dist/scaler/container-backend.d.ts +125 -0
  267. package/dist/scaler/file-tail.d.ts +23 -0
  268. package/dist/scaler/firecracker-api.d.ts +100 -0
  269. package/dist/scaler/firecracker-backend.d.ts +263 -0
  270. package/dist/scaler/index.d.ts +24 -0
  271. package/dist/scaler/ip-allocator.d.ts +177 -0
  272. package/dist/scaler/label-matcher.d.ts +73 -0
  273. package/dist/scaler/log-forwarder.d.ts +54 -0
  274. package/dist/scaler/machine-ledger.d.ts +160 -0
  275. package/dist/scaler/manager.d.ts +338 -0
  276. package/dist/scaler/nftables.d.ts +85 -0
  277. package/dist/scaler/types.d.ts +388 -0
  278. package/dist/scaler/warm-pool.d.ts +81 -0
  279. package/dist/secrets/audit-logger.d.ts +65 -0
  280. package/dist/secrets/backend-health.d.ts +60 -0
  281. package/dist/secrets/backend-registry.d.ts +68 -0
  282. package/dist/secrets/backend-sync.d.ts +40 -0
  283. package/dist/secrets/cleanup.d.ts +40 -0
  284. package/dist/secrets/config.d.ts +51 -0
  285. package/dist/secrets/crypto.d.ts +49 -0
  286. package/dist/secrets/ephemeral-keys.d.ts +49 -0
  287. package/dist/secrets/index.d.ts +17 -0
  288. package/dist/secrets/pg-secret-store.d.ts +105 -0
  289. package/dist/secrets/rbac.d.ts +47 -0
  290. package/dist/secrets/secret-output-store.d.ts +46 -0
  291. package/dist/secrets/secret-resolver.d.ts +137 -0
  292. package/dist/secrets/source-credentials.d.ts +61 -0
  293. package/dist/secrets/token-manager.d.ts +63 -0
  294. package/dist/secrets/vault-secret-store.d.ts +85 -0
  295. package/dist/security/comment-handler.d.ts +67 -0
  296. package/dist/security/contributor-cache.d.ts +75 -0
  297. package/dist/security/global-workflow-policy.d.ts +72 -0
  298. package/dist/security/lock-source.d.ts +34 -0
  299. package/dist/security/trust-resolver.d.ts +108 -0
  300. package/dist/security/workflow-diff.d.ts +26 -0
  301. package/dist/server.d.ts +17 -0
  302. package/dist/server.js +48055 -0
  303. package/dist/sources/index.d.ts +10 -0
  304. package/dist/sources/source-manager.d.ts +63 -0
  305. package/dist/sources/source-store.d.ts +79 -0
  306. package/dist/sources/source-validator.d.ts +16 -0
  307. package/dist/stale-detector/stale-run-detector.d.ts +109 -0
  308. package/dist/standalone.d.ts +20 -0
  309. package/dist/standalone.js +41546 -0
  310. package/dist/storage/blob-routes.d.ts +20 -0
  311. package/dist/storage/filesystem.d.ts +60 -0
  312. package/dist/storage/index.d.ts +20 -0
  313. package/dist/storage/s3.d.ts +68 -0
  314. package/dist/storage/sign-url.d.ts +45 -0
  315. package/dist/storage/types.d.ts +98 -0
  316. package/dist/webhook/dedup.d.ts +44 -0
  317. package/dist/webhook/event-log.d.ts +83 -0
  318. package/dist/webhook/generic-sources.d.ts +169 -0
  319. package/dist/webhook/handler.d.ts +23 -0
  320. package/dist/webhook/relay-buffer.d.ts +96 -0
  321. package/dist/webhook/verify-inbound.d.ts +78 -0
  322. package/dist/worker/in-memory-execution-tracker.d.ts +94 -0
  323. package/dist/worker/in-memory-job-queue.d.ts +74 -0
  324. package/dist/worker/static-agent-token-store.d.ts +58 -0
  325. package/dist/worker/worker-status.d.ts +36 -0
  326. package/dist/worker-core.d.ts +74 -0
  327. package/dist/ws/agent-api-registry.d.ts +49 -0
  328. package/dist/ws/agent-handler.d.ts +176 -0
  329. package/dist/ws/agent-heartbeat.d.ts +45 -0
  330. package/dist/ws/dashboard-backends-handler.d.ts +51 -0
  331. package/dist/ws/dashboard-diagnostics-handler.d.ts +56 -0
  332. package/dist/ws/dashboard-env-handler.d.ts +107 -0
  333. package/dist/ws/dashboard-global-workflows-handler.d.ts +72 -0
  334. package/dist/ws/dashboard-registrations-handler.d.ts +84 -0
  335. package/dist/ws/event-buffer.d.ts +16 -0
  336. package/dist/ws/observer-handler.d.ts +42 -0
  337. package/dist/ws/observer-registry.d.ts +88 -0
  338. package/dist/ws/platform-client.d.ts +270 -0
  339. package/dist/ws/server-options.d.ts +15 -0
  340. package/package.json +87 -7
  341. package/sbom.spdx.json +14370 -0
  342. package/index.js +0 -3
@@ -0,0 +1,303 @@
1
+ /**
2
+ * YAML configuration loading and Zod validation for the scaler module.
3
+ *
4
+ * Handles:
5
+ * - Main YAML config file parsing
6
+ * - scalers.d/ directory merging (alphabetically sorted)
7
+ * - Zod schema validation with type-specific refinements
8
+ * - Memory string parsing (e.g., "2g" -> bytes)
9
+ */
10
+ import { z } from 'zod';
11
+ import type { ScalerConfig } from './types.js';
12
+ /**
13
+ * Zod schema for network policy configuration on a label set.
14
+ * Controls RFC1918 and internet access for spawned agents.
15
+ */
16
+ export declare const networkPolicySchema: z.ZodOptional<z.ZodObject<{
17
+ allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
18
+ denyAll: z.ZodDefault<z.ZodBoolean>;
19
+ }, z.core.$strip>>;
20
+ /**
21
+ * Zod schema for a label-set configuration entry.
22
+ */
23
+ export declare const labelSetConfigSchema: z.ZodObject<{
24
+ labels: z.ZodArray<z.ZodString>;
25
+ image: z.ZodOptional<z.ZodString>;
26
+ imagePullPolicy: z.ZodDefault<z.ZodEnum<{
27
+ Always: "Always";
28
+ IfNotPresent: "IfNotPresent";
29
+ Never: "Never";
30
+ }>>;
31
+ binaryPath: z.ZodOptional<z.ZodString>;
32
+ resources: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodObject<{
33
+ requests: z.ZodOptional<z.ZodObject<{
34
+ memory: z.ZodOptional<z.ZodString>;
35
+ cpus: z.ZodOptional<z.ZodNumber>;
36
+ }, z.core.$strict>>;
37
+ limits: z.ZodOptional<z.ZodObject<{
38
+ memory: z.ZodOptional<z.ZodString>;
39
+ cpus: z.ZodOptional<z.ZodNumber>;
40
+ }, z.core.$strict>>;
41
+ }, z.core.$strict>, z.ZodObject<{
42
+ memory: z.ZodOptional<z.ZodString>;
43
+ cpus: z.ZodOptional<z.ZodNumber>;
44
+ }, z.core.$strict>]>, z.ZodTransform<{
45
+ requests?: {
46
+ cpus?: number;
47
+ memory?: string;
48
+ };
49
+ limits?: {
50
+ cpus?: number;
51
+ memory?: string;
52
+ };
53
+ }, {
54
+ memory?: string | undefined;
55
+ cpus?: number | undefined;
56
+ } | {
57
+ requests?: {
58
+ memory?: string | undefined;
59
+ cpus?: number | undefined;
60
+ } | undefined;
61
+ limits?: {
62
+ memory?: string | undefined;
63
+ cpus?: number | undefined;
64
+ } | undefined;
65
+ }>>>;
66
+ volumes: z.ZodOptional<z.ZodArray<z.ZodString>>;
67
+ containerSocket: z.ZodDefault<z.ZodBoolean>;
68
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
69
+ backpressureMode: z.ZodOptional<z.ZodEnum<{
70
+ pause: "pause";
71
+ drop: "drop";
72
+ }>>;
73
+ networkPolicy: z.ZodOptional<z.ZodObject<{
74
+ allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
+ denyAll: z.ZodDefault<z.ZodBoolean>;
76
+ }, z.core.$strip>>;
77
+ rootfsPath: z.ZodOptional<z.ZodString>;
78
+ kernelPath: z.ZodOptional<z.ZodString>;
79
+ vcpuCount: z.ZodOptional<z.ZodNumber>;
80
+ memSizeMib: z.ZodOptional<z.ZodNumber>;
81
+ overlayDriveSizeMib: z.ZodOptional<z.ZodNumber>;
82
+ }, z.core.$strict>;
83
+ /**
84
+ * Zod schema for Firecracker network configuration.
85
+ * Global across all Firecracker scalers on the orchestrator.
86
+ */
87
+ export declare const firecrackerNetworkSchema: z.ZodObject<{
88
+ cidr: z.ZodDefault<z.ZodString>;
89
+ bridgeName: z.ZodDefault<z.ZodString>;
90
+ gateway: z.ZodDefault<z.ZodString>;
91
+ netmask: z.ZodDefault<z.ZodString>;
92
+ }, z.core.$strip>;
93
+ /**
94
+ * Zod schema for the complete scaler configuration file.
95
+ * Validates version, global limits, defaults, and scaler entries.
96
+ */
97
+ export declare const scalerFileSchema: z.ZodObject<{
98
+ version: z.ZodLiteral<1>;
99
+ globalMaxAgents: z.ZodDefault<z.ZodNumber>;
100
+ defaults: z.ZodOptional<z.ZodObject<{
101
+ resources: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodObject<{
102
+ requests: z.ZodOptional<z.ZodObject<{
103
+ memory: z.ZodOptional<z.ZodString>;
104
+ cpus: z.ZodOptional<z.ZodNumber>;
105
+ }, z.core.$strict>>;
106
+ limits: z.ZodOptional<z.ZodObject<{
107
+ memory: z.ZodOptional<z.ZodString>;
108
+ cpus: z.ZodOptional<z.ZodNumber>;
109
+ }, z.core.$strict>>;
110
+ }, z.core.$strict>, z.ZodObject<{
111
+ memory: z.ZodOptional<z.ZodString>;
112
+ cpus: z.ZodOptional<z.ZodNumber>;
113
+ }, z.core.$strict>]>, z.ZodTransform<{
114
+ requests?: {
115
+ cpus?: number;
116
+ memory?: string;
117
+ };
118
+ limits?: {
119
+ cpus?: number;
120
+ memory?: string;
121
+ };
122
+ }, {
123
+ memory?: string | undefined;
124
+ cpus?: number | undefined;
125
+ } | {
126
+ requests?: {
127
+ memory?: string | undefined;
128
+ cpus?: number | undefined;
129
+ } | undefined;
130
+ limits?: {
131
+ memory?: string | undefined;
132
+ cpus?: number | undefined;
133
+ } | undefined;
134
+ }>>>;
135
+ }, z.core.$strip>>;
136
+ globalResourceCap: z.ZodOptional<z.ZodPipe<z.ZodObject<{
137
+ maxCpu: z.ZodOptional<z.ZodNumber>;
138
+ maxMemory: z.ZodOptional<z.ZodString>;
139
+ }, z.core.$strict>, z.ZodTransform<{
140
+ maxCpu: number | undefined;
141
+ maxMemoryBytes: number | undefined;
142
+ }, {
143
+ maxCpu?: number | undefined;
144
+ maxMemory?: string | undefined;
145
+ }>>>;
146
+ machinePools: z.ZodOptional<z.ZodArray<z.ZodObject<{
147
+ name: z.ZodString;
148
+ cap: z.ZodPipe<z.ZodObject<{
149
+ maxCpu: z.ZodOptional<z.ZodNumber>;
150
+ maxMemory: z.ZodOptional<z.ZodString>;
151
+ }, z.core.$strict>, z.ZodTransform<{
152
+ maxCpu: number | undefined;
153
+ maxMemoryBytes: number | undefined;
154
+ }, {
155
+ maxCpu?: number | undefined;
156
+ maxMemory?: string | undefined;
157
+ }>>;
158
+ }, z.core.$strict>>>;
159
+ scalers: z.ZodArray<z.ZodObject<{
160
+ name: z.ZodString;
161
+ type: z.ZodEnum<{
162
+ container: "container";
163
+ "bare-metal": "bare-metal";
164
+ firecracker: "firecracker";
165
+ }>;
166
+ maxAgents: z.ZodNumber;
167
+ labelSets: z.ZodArray<z.ZodObject<{
168
+ labels: z.ZodArray<z.ZodString>;
169
+ image: z.ZodOptional<z.ZodString>;
170
+ imagePullPolicy: z.ZodDefault<z.ZodEnum<{
171
+ Always: "Always";
172
+ IfNotPresent: "IfNotPresent";
173
+ Never: "Never";
174
+ }>>;
175
+ binaryPath: z.ZodOptional<z.ZodString>;
176
+ resources: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodObject<{
177
+ requests: z.ZodOptional<z.ZodObject<{
178
+ memory: z.ZodOptional<z.ZodString>;
179
+ cpus: z.ZodOptional<z.ZodNumber>;
180
+ }, z.core.$strict>>;
181
+ limits: z.ZodOptional<z.ZodObject<{
182
+ memory: z.ZodOptional<z.ZodString>;
183
+ cpus: z.ZodOptional<z.ZodNumber>;
184
+ }, z.core.$strict>>;
185
+ }, z.core.$strict>, z.ZodObject<{
186
+ memory: z.ZodOptional<z.ZodString>;
187
+ cpus: z.ZodOptional<z.ZodNumber>;
188
+ }, z.core.$strict>]>, z.ZodTransform<{
189
+ requests?: {
190
+ cpus?: number;
191
+ memory?: string;
192
+ };
193
+ limits?: {
194
+ cpus?: number;
195
+ memory?: string;
196
+ };
197
+ }, {
198
+ memory?: string | undefined;
199
+ cpus?: number | undefined;
200
+ } | {
201
+ requests?: {
202
+ memory?: string | undefined;
203
+ cpus?: number | undefined;
204
+ } | undefined;
205
+ limits?: {
206
+ memory?: string | undefined;
207
+ cpus?: number | undefined;
208
+ } | undefined;
209
+ }>>>;
210
+ volumes: z.ZodOptional<z.ZodArray<z.ZodString>>;
211
+ containerSocket: z.ZodDefault<z.ZodBoolean>;
212
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
213
+ backpressureMode: z.ZodOptional<z.ZodEnum<{
214
+ pause: "pause";
215
+ drop: "drop";
216
+ }>>;
217
+ networkPolicy: z.ZodOptional<z.ZodObject<{
218
+ allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
219
+ denyAll: z.ZodDefault<z.ZodBoolean>;
220
+ }, z.core.$strip>>;
221
+ rootfsPath: z.ZodOptional<z.ZodString>;
222
+ kernelPath: z.ZodOptional<z.ZodString>;
223
+ vcpuCount: z.ZodOptional<z.ZodNumber>;
224
+ memSizeMib: z.ZodOptional<z.ZodNumber>;
225
+ overlayDriveSizeMib: z.ZodOptional<z.ZodNumber>;
226
+ }, z.core.$strict>>;
227
+ host: z.ZodOptional<z.ZodString>;
228
+ socketPath: z.ZodOptional<z.ZodString>;
229
+ runtime: z.ZodDefault<z.ZodEnum<{
230
+ docker: "docker";
231
+ podman: "podman";
232
+ auto: "auto";
233
+ }>>;
234
+ orchestratorUrl: z.ZodOptional<z.ZodString>;
235
+ extraHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
236
+ networkIsolation: z.ZodDefault<z.ZodBoolean>;
237
+ warmPool: z.ZodOptional<z.ZodObject<{
238
+ enabled: z.ZodDefault<z.ZodBoolean>;
239
+ size: z.ZodDefault<z.ZodNumber>;
240
+ idleTimeoutSeconds: z.ZodDefault<z.ZodNumber>;
241
+ }, z.core.$strip>>;
242
+ mandatoryLabels: z.ZodDefault<z.ZodArray<z.ZodString>>;
243
+ roles: z.ZodPipe<z.ZodOptional<z.ZodArray<z.ZodEnum<{
244
+ builder: "builder";
245
+ "init-runner": "init-runner";
246
+ all: "all";
247
+ }>>>, z.ZodTransform<string[] | undefined, ("builder" | "init-runner" | "all")[] | undefined>>;
248
+ resourceCap: z.ZodOptional<z.ZodPipe<z.ZodObject<{
249
+ maxCpu: z.ZodOptional<z.ZodNumber>;
250
+ maxMemory: z.ZodOptional<z.ZodString>;
251
+ }, z.core.$strict>, z.ZodTransform<{
252
+ maxCpu: number | undefined;
253
+ maxMemoryBytes: number | undefined;
254
+ }, {
255
+ maxCpu?: number | undefined;
256
+ maxMemory?: string | undefined;
257
+ }>>>;
258
+ machinePool: z.ZodOptional<z.ZodString>;
259
+ enforceCgroups: z.ZodDefault<z.ZodBoolean>;
260
+ firecrackerPath: z.ZodOptional<z.ZodString>;
261
+ jailerPath: z.ZodOptional<z.ZodString>;
262
+ kernelPath: z.ZodOptional<z.ZodString>;
263
+ chrootBaseDir: z.ZodDefault<z.ZodString>;
264
+ uid: z.ZodOptional<z.ZodNumber>;
265
+ gid: z.ZodOptional<z.ZodNumber>;
266
+ vcpuCount: z.ZodDefault<z.ZodNumber>;
267
+ memSizeMib: z.ZodDefault<z.ZodNumber>;
268
+ requireSudo: z.ZodDefault<z.ZodBoolean>;
269
+ }, z.core.$strict>>;
270
+ firecracker: z.ZodOptional<z.ZodObject<{
271
+ cidr: z.ZodDefault<z.ZodString>;
272
+ bridgeName: z.ZodDefault<z.ZodString>;
273
+ gateway: z.ZodDefault<z.ZodString>;
274
+ netmask: z.ZodDefault<z.ZodString>;
275
+ }, z.core.$strip>>;
276
+ }, z.core.$strip>;
277
+ /**
278
+ * Parse a memory string with unit suffix to bytes.
279
+ *
280
+ * Supported formats:
281
+ * - "512m" or "512M" -> 536870912 (512 * 1024^2)
282
+ * - "2g" or "2G" -> 2147483648 (2 * 1024^3)
283
+ * - "1024k" or "1024K" -> 1048576 (1024 * 1024)
284
+ *
285
+ * @throws Error if the format is invalid
286
+ */
287
+ export declare function parseMemoryString(memory: string): number;
288
+ /**
289
+ * Load and validate the scaler configuration from YAML files.
290
+ *
291
+ * 1. Reads the main config file
292
+ * 2. If scalersDirPath provided, reads all *.yaml and *.yml files
293
+ * from the directory (sorted alphabetically) and merges their
294
+ * scalers arrays into the main config
295
+ * 3. Validates the merged config through Zod schema
296
+ *
297
+ * @param configPath - Path to the main scaler YAML config file
298
+ * @param scalersDirPath - Optional path to scalers.d/ directory for additional scaler definitions
299
+ * @returns Validated ScalerConfig
300
+ * @throws ZodError if validation fails
301
+ */
302
+ export declare function loadScalerConfig(configPath: string, scalersDirPath?: string): Promise<ScalerConfig>;
303
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Container scaler backend implementation.
3
+ *
4
+ * Manages ephemeral agent containers using Docker or Podman via dockerode.
5
+ * Supports auto-detection of container runtime socket.
6
+ * Handles full container lifecycle: pull, create, start, stop, remove.
7
+ * Supports container socket sharing, resource limits, and orphan cleanup.
8
+ */
9
+ import { type ToolRequirement } from '@kici-dev/shared';
10
+ import type { AgentTokenStore } from '../agent/token-store.js';
11
+ import type { ScalerBackend, ManagedAgent, LabelSetConfig, LogCapture, ResourceRequest, EffectiveLimits, ScalerEventCallback, ValidationResult } from './types.js';
12
+ /**
13
+ * Result of runtime detection.
14
+ */
15
+ export interface DetectedRuntime {
16
+ socketPath: string;
17
+ runtime: 'docker' | 'podman';
18
+ }
19
+ /**
20
+ * Probe known socket paths to detect which container runtime is available.
21
+ * Returns the first accessible socket found, or null if none found.
22
+ */
23
+ export declare function detectRuntime(runtimeHint?: 'docker' | 'podman' | 'auto'): Promise<DetectedRuntime | null>;
24
+ export interface ContainerScalerBackendOptions {
25
+ /** Human-readable name for this scaler */
26
+ name: string;
27
+ /** Label sets this backend can provision */
28
+ labelSets: LabelSetConfig[];
29
+ /** Maximum concurrent agents */
30
+ maxAgents: number;
31
+ /** Container runtime host for remote connections (works for Docker and Podman remote) */
32
+ host?: string;
33
+ /** Explicit socket path (overrides auto-detection) */
34
+ socketPath?: string;
35
+ /** Runtime type hint: 'docker', 'podman', or 'auto' (default: 'auto') */
36
+ runtime?: 'docker' | 'podman' | 'auto';
37
+ /** Default resource limits applied when label set has none */
38
+ defaultResources?: ResourceRequest;
39
+ /** Extra host:IP mappings injected into spawned containers (e.g. ["verdaccio.local:host-gateway"]) */
40
+ extraHosts?: string[];
41
+ /** Disable nftables-based network isolation (default: true). Set to false when nft is unavailable (e.g. rootless containers without NET_ADMIN). */
42
+ networkIsolation?: boolean;
43
+ /** Token store for creating ephemeral agent auth tokens. Optional -- when undefined, no token is injected. */
44
+ tokenStore?: AgentTokenStore;
45
+ /** TTL for ephemeral agent tokens in ms. Default: 1 hour. */
46
+ tokenTtlMs?: number;
47
+ /** Agent roles for this scaler. undefined = all, [] = execution only. */
48
+ roles?: string[];
49
+ }
50
+ export declare class ContainerScalerBackend implements ScalerBackend {
51
+ readonly type: "container";
52
+ readonly maxAgents: number;
53
+ private _labelSets;
54
+ private readonly name;
55
+ private readonly docker;
56
+ private readonly defaultResources?;
57
+ /** The resolved socket path (for socket sharing bind mounts) */
58
+ private readonly resolvedSocketPath;
59
+ /** The detected or configured runtime type */
60
+ private readonly detectedRuntime;
61
+ /** Extra host:IP mappings for spawned containers */
62
+ private readonly extraHosts?;
63
+ /** Whether nftables-based network isolation is enabled */
64
+ private readonly networkIsolation;
65
+ /** Token store for creating ephemeral agent auth tokens */
66
+ private readonly tokenStore?;
67
+ /** TTL for ephemeral agent tokens in ms */
68
+ private readonly tokenTtlMs;
69
+ /** Agent roles for this scaler. undefined = all, [] = execution only. */
70
+ private readonly roles;
71
+ /** ID of the isolated bridge network (set after creation/discovery) */
72
+ private isolatedNetworkId;
73
+ /** Host bridge interface name for the isolated network (used by nftables) */
74
+ private isolatedBridgeIface;
75
+ /** Tracks all managed agent containers by ManagedAgent.id */
76
+ private readonly agents;
77
+ /** Maps container ID to ManagedAgent.id for reverse lookup */
78
+ private readonly containerToManaged;
79
+ /** LogCapture instances for each managed agent (keyed by ManagedAgent.id) */
80
+ private readonly logCaptures;
81
+ /** Maps managedId → container IP on the isolated network (for per-container nftables cleanup) */
82
+ private readonly containerIps;
83
+ private constructor();
84
+ /**
85
+ * Ensure the isolated bridge network exists and nftables rules are applied.
86
+ *
87
+ * Creates `kici-agent-net` if it doesn't exist, inspects the network to
88
+ * discover the host bridge interface name, then applies RFC1918 + metadata
89
+ * blocking rules via nftables with a gateway exception.
90
+ *
91
+ * Idempotent: safe to call across orchestrator restarts.
92
+ */
93
+ private ensureIsolatedNetwork;
94
+ /**
95
+ * Declare required tools for a container scaler entry.
96
+ * Container runtime socket and nftables are validated during create() — no
97
+ * additional tool declarations needed here.
98
+ */
99
+ static getRequiredTools(): ToolRequirement[];
100
+ /**
101
+ * Create a ContainerScalerBackend with auto-detected or configured socket.
102
+ * Throws if no container runtime is found and no host is configured.
103
+ */
104
+ static create(options: ContainerScalerBackendOptions): Promise<ContainerScalerBackend>;
105
+ /** Log source identifier: 'docker' or 'podman' based on detected runtime. */
106
+ get logsSource(): string;
107
+ get labelSets(): LabelSetConfig[];
108
+ getActiveCount(): number;
109
+ spawn(labelSet: string[], agentId: string, orchestratorUrl: string, onEvent?: ScalerEventCallback, effectiveLimits?: EffectiveLimits): Promise<ManagedAgent>;
110
+ getScalerContext(agentId: string): Record<string, unknown> | undefined;
111
+ destroy(managedId: string): Promise<void>;
112
+ /**
113
+ * Get the LogCapture for a managed agent (used by ScalerManager for log forwarding).
114
+ */
115
+ getLogCapture(managedId: string): LogCapture | undefined;
116
+ shutdownAll(): Promise<void>;
117
+ reload(labelSets: LabelSetConfig[]): ValidationResult;
118
+ /**
119
+ * Clean up orphaned kici-managed containers on startup.
120
+ * Finds containers with the `kici-managed=true` label and removes them.
121
+ * Returns the count of cleaned containers.
122
+ */
123
+ cleanupOrphans(): Promise<number>;
124
+ }
125
+ //# sourceMappingURL=container-backend.d.ts.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * File tailing utility for append-only log files.
3
+ *
4
+ * Provides an async generator that yields complete lines as they are appended
5
+ * to a file, using `fs.watch()` for change notifications and partial line
6
+ * buffering for split writes.
7
+ *
8
+ * Used by the Firecracker backend to tail serial console and VMM log files
9
+ * from the jailer chroot directory.
10
+ */
11
+ /**
12
+ * Tail an append-only file, yielding complete lines as they are written.
13
+ *
14
+ * Pre-creates the file if it does not exist to avoid watch errors.
15
+ * Tracks byte offset and partial (incomplete) trailing lines across reads.
16
+ * Stops when the provided AbortSignal is triggered.
17
+ *
18
+ * @param filePath - Path to the file to tail
19
+ * @param signal - AbortSignal to stop tailing
20
+ * @yields Complete lines (non-empty) as they are appended to the file
21
+ */
22
+ export declare function tailFile(filePath: string, signal: AbortSignal): AsyncGenerator<string>;
23
+ //# sourceMappingURL=file-tail.d.ts.map
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Firecracker REST API client over Unix domain sockets.
3
+ *
4
+ * Provides a thin wrapper around Node.js built-in `http` module for communicating
5
+ * with Firecracker's REST API. Uses the `socketPath` option for HTTP-over-Unix-socket.
6
+ *
7
+ * Only used for post-boot operations:
8
+ * - MMDS data injection (passing agent config to the guest VM)
9
+ * - Graceful shutdown via SendCtrlAltDel (x86_64 only)
10
+ * - Socket readiness polling after jailer invocation
11
+ *
12
+ * Pre-boot VM configuration uses `--config-file` JSON (atomic, simpler).
13
+ *
14
+ * @see https://github.com/firecracker-microvm/firecracker/blob/main/docs/getting-started.md
15
+ * @see https://github.com/firecracker-microvm/firecracker/blob/main/docs/mmds/mmds-user-guide.md
16
+ */
17
+ /**
18
+ * Error thrown when the Firecracker API returns a non-2xx status code
19
+ * or a network-level error occurs.
20
+ */
21
+ export declare class FirecrackerApiError extends Error {
22
+ /** HTTP status code from the Firecracker API (undefined for network errors) */
23
+ readonly statusCode: number | undefined;
24
+ /** The API path that was requested */
25
+ readonly path: string;
26
+ /** The response body from the Firecracker API */
27
+ readonly responseBody: string;
28
+ constructor(message: string, path: string, statusCode?: number, responseBody?: string);
29
+ }
30
+ /**
31
+ * Thin REST client for the Firecracker API over Unix domain sockets.
32
+ *
33
+ * No external dependencies -- uses Node.js built-in `http` module with
34
+ * the `socketPath` option for HTTP-over-Unix-socket communication.
35
+ */
36
+ export declare class FirecrackerApi {
37
+ private readonly socketPath;
38
+ constructor(socketPath: string);
39
+ /**
40
+ * Send an HTTP request to the Firecracker API.
41
+ *
42
+ * @param method - HTTP method (GET, PUT, PATCH)
43
+ * @param path - API path (e.g., '/mmds', '/actions', '/')
44
+ * @param body - Optional JSON body for PUT/PATCH requests
45
+ * @returns Response with statusCode and body
46
+ * @throws FirecrackerApiError on non-2xx status or network error
47
+ */
48
+ private request;
49
+ /**
50
+ * Inject MMDS (Micro VM Metadata Service) data into a running VM.
51
+ *
52
+ * Uses MMDS v2 data injection endpoint. The data should follow the structure:
53
+ * `{ latest: { 'meta-data': { ... } } }`
54
+ *
55
+ * The guest VM reads this data from http://169.254.169.254/latest/meta-data/
56
+ * using a token-based session (MMDS v2).
57
+ *
58
+ * @param data - Metadata object to inject
59
+ * @see https://github.com/firecracker-microvm/firecracker/blob/main/docs/mmds/mmds-user-guide.md
60
+ */
61
+ putMmds(data: Record<string, unknown>): Promise<void>;
62
+ /**
63
+ * Clear MMDS data after agent has received config via WS.
64
+ * Replaces the MMDS data with an empty meta-data object.
65
+ * Called after receiving config.ack from the agent.
66
+ */
67
+ clearMmds(): Promise<void>;
68
+ /**
69
+ * Send a SendCtrlAltDel action for graceful x86_64 shutdown.
70
+ *
71
+ * This simulates pressing Ctrl+Alt+Del on the virtual keyboard,
72
+ * which triggers a clean shutdown in most Linux distributions.
73
+ *
74
+ * Note: Only works on x86_64. On arm64, the i8042 keyboard controller
75
+ * is not available, so this action is not supported. Use process kill
76
+ * as fallback on arm64.
77
+ *
78
+ * @see https://github.com/firecracker-microvm/firecracker/blob/main/docs/getting-started.md
79
+ */
80
+ sendCtrlAltDel(): Promise<void>;
81
+ /**
82
+ * Get instance info from the Firecracker API root endpoint.
83
+ *
84
+ * Used to check if the API socket is reachable and the VM is running.
85
+ * Returns the parsed JSON response with instance information.
86
+ */
87
+ getInstanceInfo(): Promise<Record<string, unknown>>;
88
+ /**
89
+ * Poll the Firecracker API socket until it becomes reachable or timeout expires.
90
+ *
91
+ * Used after jailer invocation to wait for Firecracker to create the API socket
92
+ * and become ready to accept requests.
93
+ *
94
+ * @param timeoutMs - Maximum time to wait in milliseconds (default: 5000)
95
+ * @param intervalMs - Polling interval in milliseconds (default: 100)
96
+ * @returns true if socket became reachable, false on timeout
97
+ */
98
+ waitForSocket(timeoutMs?: number, intervalMs?: number): Promise<boolean>;
99
+ }
100
+ //# sourceMappingURL=firecracker-api.d.ts.map