@kici-dev/orchestrator 0.11.0 → 0.13.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 (158) 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 +48 -0
  4. package/dist/agent/registry.d.ts +38 -9
  5. package/dist/agent-packaging/node-runtime-members.d.ts +14 -0
  6. package/dist/app.d.ts +9 -3
  7. package/dist/approvals/apply-decision.d.ts +1 -1
  8. package/dist/audit/access-log.d.ts +2 -3
  9. package/dist/cache/cache-upload-settle.d.ts +75 -0
  10. package/dist/cache/pending-inits.d.ts +9 -0
  11. package/dist/cancel/cancel-run.d.ts +22 -4
  12. package/dist/cancel/peer-job-cancel.d.ts +50 -0
  13. package/dist/cancel/sweep-stuck-cancelling.d.ts +3 -1
  14. package/dist/cli/commands/access-log.d.ts +3 -3
  15. package/dist/cli/commands/agent-service/agent-env.d.ts +20 -0
  16. package/dist/cli/commands/agent-service/status.d.ts +3 -3
  17. package/dist/cli/commands/attestations.d.ts +1 -1
  18. package/dist/cli/commands/context.d.ts +2 -2
  19. package/dist/cli/commands/event-dlq.d.ts +5 -6
  20. package/dist/cli/commands/event-log.d.ts +2 -3
  21. package/dist/cli/commands/execution.d.ts +1 -3
  22. package/dist/cli/commands/local-hook.d.ts +3 -2
  23. package/dist/cli/commands/local-trigger.d.ts +7 -0
  24. package/dist/cli/commands/orchestrator-service/status.d.ts +10 -3
  25. package/dist/cli/commands/queue.d.ts +1 -2
  26. package/dist/cli/commands/runs.d.ts +2 -3
  27. package/dist/cli/commands/service-health.d.ts +68 -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 +2601 -1232
  44. package/dist/cluster/cluster-identity.d.ts +4 -4
  45. package/dist/cluster/coordinator-credential.d.ts +45 -0
  46. package/dist/cluster/coordinator.d.ts +18 -2
  47. package/dist/cluster/index.d.ts +1 -0
  48. package/dist/cluster/instance-heartbeat.d.ts +6 -1
  49. package/dist/cluster/join-token.d.ts +4 -2
  50. package/dist/cluster/leader-gated-scheduler.d.ts +7 -1
  51. package/dist/cluster/peer-auth-coordinator.d.ts +13 -0
  52. package/dist/cluster/peer-client.d.ts +4 -0
  53. package/dist/cluster/peer-credentials.d.ts +32 -1
  54. package/dist/cluster/raft-state.d.ts +6 -0
  55. package/dist/cluster/raft.d.ts +16 -2
  56. package/dist/cold-store/load-access-log-range.d.ts +3 -3
  57. package/dist/cold-store/load-event-log-range.d.ts +1 -1
  58. package/dist/cold-store/load-secret-audit-log-range.d.ts +2 -2
  59. package/dist/cold-store/orchestrator-cold-store.d.ts +9 -11
  60. package/dist/cold-store/tables/access-log.d.ts +2 -2
  61. package/dist/cold-store/tables/event-log.d.ts +4 -10
  62. package/dist/cold-store/tables/execution-jobs.d.ts +1 -1
  63. package/dist/cold-store/tables/execution-runs.d.ts +4 -4
  64. package/dist/cold-store/tables/execution-steps.d.ts +1 -1
  65. package/dist/cold-store/tables/secret-audit-log.d.ts +3 -3
  66. package/dist/config.d.ts +6 -1
  67. package/dist/contexts/held-runs.d.ts +2 -2
  68. package/dist/dashboard/attestation-filters.d.ts +1 -1
  69. package/dist/dashboard/handler.d.ts +8 -8
  70. package/dist/db/deferred-indexes.d.ts +2 -2
  71. package/dist/db/migrations/005_cold_store_chunk_counter.d.ts +2 -4
  72. package/dist/db/migrations/006_runs_jobs_steps_archived_at.d.ts +4 -4
  73. package/dist/db/migrations/007_audit_logs_archived_at.d.ts +6 -9
  74. package/dist/db/migrations/008_event_log_archived_at.d.ts +4 -6
  75. package/dist/db/migrations/010_cold_store_chunks.d.ts +2 -2
  76. package/dist/db/migrations/012_peer_credentials_active_uniq.d.ts +2 -4
  77. package/dist/db/migrations/016_org_settings_allow_http_npm.d.ts +2 -2
  78. package/dist/db/migrations/045_host_properties.d.ts +1 -1
  79. package/dist/db/migrations/046_join_token_consumed_by_instance.d.ts +1 -1
  80. package/dist/db/migrations/048_host_reboot_pending.d.ts +1 -1
  81. package/dist/db/migrations/049_held_runs_payload.d.ts +1 -1
  82. package/dist/db/migrations/050_sources_slug.d.ts +1 -1
  83. package/dist/db/migrations/051_binding_host_pattern.d.ts +1 -1
  84. package/dist/db/migrations/052_host_reach_metadata.d.ts +1 -1
  85. package/dist/db/migrations/053_agent_token_single_use.d.ts +1 -1
  86. package/dist/db/migrations/054_local_working_tree.d.ts +1 -1
  87. package/dist/db/migrations/055_agent_token_mandatory_labels.d.ts +1 -1
  88. package/dist/db/migrations/056_execution_jobs_environments.d.ts +1 -1
  89. package/dist/db/migrations/064_execution_jobs_skipped_environments.d.ts +1 -1
  90. package/dist/db/migrations/152_org_settings_cache_upload_settle_timeout.d.ts +15 -0
  91. package/dist/db/migrations/153_execution_runs_cancel_force.d.ts +16 -0
  92. package/dist/db/types.d.ts +27 -13
  93. package/dist/events/types.d.ts +1 -1
  94. package/dist/fault-injection-types.d.ts +2 -2
  95. package/dist/firecracker/host-network.d.ts +21 -3
  96. package/dist/firecracker/net-interfaces.d.ts +1 -1
  97. package/dist/helpers/run-detached.d.ts +12 -0
  98. package/dist/index.js +242 -67
  99. package/dist/oidc/db-signer.d.ts +1 -1
  100. package/dist/pipeline/changed-files.d.ts +51 -0
  101. package/dist/pipeline/cross-source-tally.d.ts +21 -0
  102. package/dist/pipeline/degraded-reason.d.ts +8 -0
  103. package/dist/pipeline/dispatch-matched-workflow.d.ts +10 -0
  104. package/dist/pipeline/global-eval-round.d.ts +5 -4
  105. package/dist/pipeline/processor.d.ts +11 -3
  106. package/dist/pipeline/rerun-inputs.d.ts +16 -7
  107. package/dist/provenance/retrier-mint.d.ts +1 -1
  108. package/dist/provenance/trust-root.d.ts +3 -3
  109. package/dist/providers/github/changed-files.d.ts +14 -4
  110. package/dist/providers/universal-git/changed-files.d.ts +6 -0
  111. package/dist/providers/universal-git/clone-token.d.ts +9 -13
  112. package/dist/providers/universal-git/config.d.ts +4 -0
  113. package/dist/providers/universal-git/index.d.ts +1 -2
  114. package/dist/providers/universal-git/normalizer.d.ts +2 -3
  115. package/dist/providers/universal-git/ssh-auth.d.ts +4 -4
  116. package/dist/queue/cleanup.d.ts +2 -2
  117. package/dist/queue/job-queue.d.ts +6 -6
  118. package/dist/queue/scheduled-job.d.ts +5 -7
  119. package/dist/registration/extractor.d.ts +1 -1
  120. package/dist/registration/registration-index.d.ts +1 -1
  121. package/dist/reporting/execution-tracker.d.ts +3 -3
  122. package/dist/routes/admin-access-log.d.ts +1 -1
  123. package/dist/routes/admin-auth.d.ts +2 -2
  124. package/dist/routes/admin-event-log.d.ts +2 -2
  125. package/dist/routes/admin-runs.d.ts +3 -3
  126. package/dist/routes/admin-scheduled-jobs.d.ts +2 -3
  127. package/dist/routes/health.d.ts +9 -0
  128. package/dist/scaler/container-backend.d.ts +3 -1
  129. package/dist/scaler/container-runtime.d.ts +9 -0
  130. package/dist/scaler/firecracker-backend.d.ts +15 -10
  131. package/dist/scaler/firecracker-extra-hosts.d.ts +20 -0
  132. package/dist/scaler/machine-ledger.d.ts +3 -4
  133. package/dist/scaler/manager.d.ts +26 -2
  134. package/dist/scaler/scaler-state-store.d.ts +1 -1
  135. package/dist/scaler/types.d.ts +4 -1
  136. package/dist/secrets/audit-logger.d.ts +2 -2
  137. package/dist/security/reduced-privilege-note.d.ts +2 -3
  138. package/dist/security/trust-policy-store.d.ts +3 -3
  139. package/dist/server.d.ts +2 -1
  140. package/dist/server.js +4955 -3206
  141. package/dist/stale-detector/stale-run-detector.d.ts +1 -1
  142. package/dist/stale-detector/workflow-deadline-detector.d.ts +7 -1
  143. package/dist/standalone.d.ts +1 -1
  144. package/dist/standalone.js +12944 -11243
  145. package/dist/storage/filesystem.d.ts +1 -1
  146. package/dist/storage/index.d.ts +1 -1
  147. package/dist/storage/s3.d.ts +36 -0
  148. package/dist/storage/sign-url.d.ts +2 -1
  149. package/dist/storage/types.d.ts +2 -2
  150. package/dist/ws/agent-handler.d.ts +58 -6
  151. package/dist/ws/agent-heartbeat.d.ts +4 -5
  152. package/dist/ws/dashboard-context-handler.d.ts +1 -1
  153. package/dist/ws/platform-client.d.ts +44 -32
  154. package/dist/ws/server-options.d.ts +1 -1
  155. package/dist/ws/test-relay-handlers.d.ts +1 -1
  156. package/installer-image-digests.json +3 -3
  157. package/package.json +5 -5
  158. package/sbom.spdx.json +53 -53
@@ -23,7 +23,7 @@ interface DashboardHandlerDeps {
23
23
  * so the dashboard verifies it client-side without a second fetch. Optional —
24
24
  * when absent (e.g. orchestrators without provenance configured) the handler
25
25
  * replies with an `error` and an empty list. Reuses the cache storage backend
26
- * (the same one P1.5 writes bundles to).
26
+ * (the same one attestation bundles are written to).
27
27
  */
28
28
  provenanceStorage?: CacheStorage | null;
29
29
  /**
@@ -58,14 +58,14 @@ interface DashboardHandlerDeps {
58
58
  * Long-lived cold-store handle for read fallback. When set, run /
59
59
  * job / step lookups fall through to S3 if the row has aged out of
60
60
  * PG. `null` means the orchestrator is running without cold-store
61
- * configured — handler then returns its pre-Phase-C behavior.
61
+ * configured — handler then serves PG rows only.
62
62
  */
63
63
  coldStore?: ColdStore | null;
64
64
  /**
65
65
  * Callback for handling re-run requests.
66
66
  * Returns { newRunId } on success or throws on failure.
67
67
  *
68
- * Phase F — `routingKey` is forwarded from the Platform (read from
68
+ * `routingKey` is forwarded from the Platform (read from
69
69
  * Platform's denormalized `execution_runs.routing_key`) so the
70
70
  * orchestrator can probe its cold-store under the right tenant
71
71
  * prefix when the run row is missing from PG. Optional for back-
@@ -114,7 +114,7 @@ interface DashboardHandlerDeps {
114
114
  /**
115
115
  * **Test-only fault injection**, supplied only by the build-time test double:
116
116
  * `handleRerunRequest` awaits this hook before invoking `onRerun`, so an HA
117
- * E2E can force a slow first coordinator and trigger a relay failover.
117
+ * test can force a slow first coordinator and trigger a relay failover.
118
118
  * Undefined (the shipped default) means no delay.
119
119
  */
120
120
  beforeRerun?: () => Promise<void>;
@@ -167,7 +167,7 @@ export declare class DashboardHandler {
167
167
  * Resolve the org owning a routing key by consulting both source tables
168
168
  * (GitHub-app `sources` first, then `generic_webhook_sources`). Used
169
169
  * directly for `handleRerunRequest` (which gets a `routingKey` hint from
170
- * Platform — Phase F denormalization) and indirectly via
170
+ * Platform's denormalized copy) and indirectly via
171
171
  * `resolveOrgForRun`.
172
172
  */
173
173
  private resolveOrgForRoutingKey;
@@ -206,7 +206,7 @@ export declare class DashboardHandler {
206
206
  handleRunDetail(msg: DashboardRunDetailRequest): Promise<void>;
207
207
  /**
208
208
  * Handle a dashboard.run.structured request — the user-plane equivalent of
209
- * the orchestrator-admin `/runs/:id/structured` endpoint. Reuses the Phase-1
209
+ * the orchestrator-admin `/runs/:id/structured` endpoint. Reuses the
210
210
  * aggregator + provenance mapper so the result is byte-identical to the admin
211
211
  * surface; emits an `access_log` `run.structured.read` row (carrying the
212
212
  * agent label when the actor came through an agent PAT).
@@ -396,7 +396,7 @@ export declare class DashboardHandler {
396
396
  * Handle a run.rerun.request.
397
397
  * Delegates to the onRerun callback which invokes handleRerun from the rerun module.
398
398
  *
399
- * Resolution: prefer `msg.routingKey` (Phase F denormalization hint from
399
+ * Resolution: prefer `msg.routingKey` (denormalization hint from
400
400
  * Platform — `execution_runs.routing_key` mirror). The hint is the ONLY
401
401
  * org context we have when the run row has been cold-archived out of PG,
402
402
  * so consult sources/generic_webhook_sources directly. If the hint is
@@ -512,7 +512,7 @@ export declare class DashboardHandler {
512
512
  */
513
513
  handleManualScheduleRequest(msg: ManualScheduleRequest): Promise<void>;
514
514
  /**
515
- * Phase C cold-store fallback: fetch the run + its jobs + its steps
515
+ * Cold-store fallback: fetch the run + its jobs + its steps
516
516
  * from S3 when the PG copy has been archived. Bounded scan: stops at
517
517
  * the warm cutoff (older entries don't exist in cold-store yet by
518
518
  * construction). Each row is filtered by `run_id` because chunks
@@ -15,8 +15,8 @@
15
15
  * server is already serving. `IF NOT EXISTS` makes every build idempotent, and
16
16
  * a failed build retries on the next boot.
17
17
  *
18
- * `hack/check-migration-safety.ts` enforces that new indexes on those tables
19
- * land here rather than in a migration.
18
+ * A repository check enforces that new indexes on those tables land here
19
+ * rather than in a migration.
20
20
  */
21
21
  import type pg from 'pg';
22
22
  import { type Logger } from '@kici-dev/shared';
@@ -7,12 +7,10 @@ import { type Kysely } from 'kysely';
7
7
  * `kici-admin cold-store list-chunks` CLI can report totals without
8
8
  * issuing S3 LIST calls (expensive + rate-limited).
9
9
  *
10
- * Phase A creates the table empty; the cold-store archiver
11
- * (Phase B+) updates it transactionally with every successful chunk
10
+ * The table starts empty; the cold-store archiver
11
+ * updates it transactionally with every successful chunk
12
12
  * write via `INSERT ... ON CONFLICT (db, table_name, tenant_id) DO
13
13
  * UPDATE SET chunk_count = chunk_count + EXCLUDED.chunk_count, ...`.
14
- *
15
- * sections 5 and 8.
16
14
  */
17
15
  export declare function up(db: Kysely<unknown>): Promise<void>;
18
16
  export declare function down(db: Kysely<unknown>): Promise<void>;
@@ -3,12 +3,12 @@ import { type Kysely } from 'kysely';
3
3
  * `execution_runs` / `execution_jobs` / `execution_steps` cold-store
4
4
  * schema additions.
5
5
  *
6
- * Phase C of the cold-storage archival system. See
6
+ * Part of the cold-storage archival system.
7
7
  *
8
8
  * Each table gets `archived_at TIMESTAMPTZ NULL` and
9
9
  * `archive_object_key TEXT NULL` (set inside the archive tx before the
10
- * DELETE; survivors carry NULL — same pattern as Phase B's migration
11
- * 004 for `run_events`).
10
+ * DELETE; survivors carry NULL — the same pattern `run_events` carries
11
+ * in the Platform's schema).
12
12
  *
13
13
  * Tenant column denormalization: the orchestrator side partitions by
14
14
  * `routing_key`, but only `execution_runs` carries the column today.
@@ -17,7 +17,7 @@ import { type Kysely } from 'kysely';
17
17
  * denormalize `routing_key` onto both tables and backfill from the
18
18
  * existing run rows. Backfill is one-shot inside this migration. New
19
19
  * inserts must populate the column going forward (enforced at the
20
- * application layer in the same phase).
20
+ * application layer).
21
21
  *
22
22
  * The denormalized column is left NULLable for safety: if an insert
23
23
  * site is missed in the rollout, the row still lands in PG; the
@@ -3,13 +3,12 @@ import { type Kysely } from 'kysely';
3
3
  * `secret_audit_log` and `access_log` cold-store schema additions, plus
4
4
  * the removal of `access_log`'s `expires_at`-based hard delete.
5
5
  *
6
- * Phase D of the cold-storage archival system. See
6
+ * Part of the cold-storage archival system.
7
7
  *
8
8
  * Both tables get the same `archived_at TIMESTAMPTZ NULL` /
9
- * `archive_object_key TEXT NULL` pair that Phase B added to `run_events`
10
- * (`packages/platform/src/db/migrations/004_run_events_archived_at.ts`)
11
- * and Phase C added to `execution_runs` / `execution_jobs` /
12
- * `execution_steps` (`006_runs_jobs_steps_archived_at.ts`). Set inside
9
+ * `archive_object_key TEXT NULL` pair that `run_events` carries
10
+ * (in the Platform's schema) and that `execution_runs` / `execution_jobs` /
11
+ * `execution_steps` got in `006_runs_jobs_steps_archived_at.ts`. Set inside
13
12
  * the archive transaction before the DELETE; survivors carry NULL.
14
13
  *
15
14
  * `secret_audit_log` gets a composite
@@ -23,7 +22,7 @@ import { type Kysely } from 'kysely';
23
22
  * (range scans use either direction).
24
23
  *
25
24
  * Drops `access_log.expires_at` column and `access_log_expires_idx`.
26
- * Until Phase D, `expires_at` powered a 90-day hard-delete sweep in
25
+ * Before this migration, `expires_at` powered a 90-day hard-delete sweep in
27
26
  * `packages/orchestrator/src/audit/access-log.ts:cleanup` (called from
28
27
  * `packages/orchestrator/src/queue/cleanup.ts:runCleanup` step 5). With
29
28
  * cold-store, `access_log` rows older than 30 days are archived rather
@@ -31,11 +30,9 @@ import { type Kysely } from 'kysely';
31
30
  * column would mean either (a) double-evicting rows or (b) silently
32
31
  * mismatching the new contract. Drop it.
33
32
  *
34
- * Per the project's "no backward compatibility (pre-release)" rule,
35
33
  * `down()` recreates `expires_at` with a default of `now() + 90 days`
36
34
  * — best effort; rows inserted between `up()` and a hypothetical
37
- * `down()` would not have meaningful retention bounds. Acceptable for
38
- * staging.
35
+ * `down()` would not have meaningful retention bounds.
39
36
  */
40
37
  export declare function up(db: Kysely<unknown>): Promise<void>;
41
38
  export declare function down(db: Kysely<unknown>): Promise<void>;
@@ -3,13 +3,11 @@ import { type Kysely } from 'kysely';
3
3
  * `event_log` cold-store schema additions plus removal of the
4
4
  * `expires_at`-based 30-day hard delete.
5
5
  *
6
- * Phase E of the cold-storage archival system. See
7
- * §10
8
- * Phase E.
6
+ * Part of the cold-storage archival system.
9
7
  *
10
8
  * Adds the same `archived_at TIMESTAMPTZ NULL` /
11
- * `archive_object_key TEXT NULL` pair Phase D added on this side
12
- * (`007_audit_logs_archived_at.ts`). Set inside the archive
9
+ * `archive_object_key TEXT NULL` pair
10
+ * `007_audit_logs_archived_at.ts` added on this side. Set inside the archive
13
11
  * transaction before the DELETE; survivors carry NULL.
14
12
  *
15
13
  * Adds `idx_event_log_routing_received` on `(routing_key, received_at)`
@@ -20,7 +18,7 @@ import { type Kysely } from 'kysely';
20
18
  * archiver scan.
21
19
  *
22
20
  * Drops `event_log.expires_at` and the matching
23
- * `event_log_expires_at_idx` index. Until Phase E, `expires_at`
21
+ * `event_log_expires_at_idx` index. Before this migration, `expires_at`
24
22
  * powered the 30-day hard-delete sweep in
25
23
  * `packages/orchestrator/src/webhook/event-log.ts:cleanup`, called
26
24
  * from `packages/orchestrator/src/queue/cleanup.ts:runCleanup` step 4
@@ -1,6 +1,6 @@
1
1
  import { type Kysely } from 'kysely';
2
2
  /**
3
- * Cold-store chunk index — Phase 2 (cold-store purge).
3
+ * Cold-store chunk index (cold-store purge).
4
4
  *
5
5
  * One row per archived chunk that the GC sweep can later purge from S3.
6
6
  * Inserted inside the same transaction as `markArchivedAndDelete` so a
@@ -25,7 +25,7 @@ import { type Kysely } from 'kysely';
25
25
  * uses this to issue `DeleteObject` directly without recomputing the
26
26
  * key from the prefix.
27
27
  *
28
- * Pre-Phase-2 chunks (v1 manifest) are NOT in this table — they live
28
+ * V1-manifest chunks are NOT in this table — they live
29
29
  * forever. Adapters that don't opt into per-bucket archival via
30
30
  * `coldTtlDays` don't insert here either.
31
31
  */
@@ -12,13 +12,11 @@ import { type Kysely } from 'kysely';
12
12
  * nothing and both `INSERT`s succeeded, leaving 2+ ACTIVE rows for the same
13
13
  * `instance_id`. The peer's local credential file then ended up holding a
14
14
  * hash that a later concurrent `save()` had revoked, causing an endless
15
- * "Peer HMAC proof invalid" loop. See
16
- * for the
17
- * full incident write-up (DB rows + log evidence from real staging deploys).
15
+ * "Peer HMAC proof invalid" loop.
18
16
  *
19
17
  * The `up()` first dedupes any pre-existing duplicates (revoke all but the
20
18
  * newest active row per `instance_id`) — required because earlier migrations
21
- * predate the constraint and existing staging DBs already have the dupes.
19
+ * predate the constraint and existing databases may already hold the dupes.
22
20
  *
23
21
  * `down()` only drops the index; it does NOT undo the dedupe (there's no
24
22
  * safe way to recreate revoked rows, and the dedupe is monotonic).
@@ -5,8 +5,8 @@ import { type Kysely } from 'kysely';
5
5
  * Operators flip this on a per-org basis to permit `http://` (non-HTTPS)
6
6
  * registry URLs in workflow `registries:` declarations. By default only
7
7
  * `https://` registries are accepted, with an automatic exemption for
8
- * loopback / `*.local` / private link-local hosts so dev fixtures
9
- * (Verdaccio at `http://verdaccio.local:4873`) keep working.
8
+ * loopback / `*.local` / private link-local hosts so a local registry
9
+ * (for example `http://registry.local:4873`) keeps working.
10
10
  *
11
11
  * Idempotent: a re-run on a DB that already has the column is a no-op.
12
12
  */
@@ -9,7 +9,7 @@ import { type Kysely } from 'kysely';
9
9
  * the separate queryable host-vars dimension.
10
10
  *
11
11
  * Idempotent (`ADD COLUMN IF NOT EXISTS`): re-running on a DB that already has
12
- * the column is a no-op. Staging data is preserved (additive column).
12
+ * the column is a no-op. Existing data is preserved (additive column).
13
13
  */
14
14
  export declare function up(db: Kysely<unknown>): Promise<void>;
15
15
  export declare function down(db: Kysely<unknown>): Promise<void>;
@@ -10,7 +10,7 @@ import { type Kysely } from 'kysely';
10
10
  * join token already in its env — no operator action, no cluster redeploy.
11
11
  *
12
12
  * Idempotent (`ADD COLUMN IF NOT EXISTS`): re-running on a DB that already has
13
- * the column is a no-op. Staging data is preserved (additive nullable column).
13
+ * the column is a no-op. Existing data is preserved (additive nullable column).
14
14
  */
15
15
  export declare function up(db: Kysely<unknown>): Promise<void>;
16
16
  export declare function down(db: Kysely<unknown>): Promise<void>;
@@ -11,7 +11,7 @@ import { type Kysely } from 'kysely';
11
11
  * (3) clears on the next reconnect (down-then-up), releasing the held job. NULL
12
12
  * = no reboot pending.
13
13
  *
14
- * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
14
+ * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so existing data is
15
15
  * preserved.
16
16
  */
17
17
  export declare function up(db: Kysely<unknown>): Promise<void>;
@@ -6,7 +6,7 @@ import { type Kysely } from 'kysely';
6
6
  * the dashboard approval queue and the CLI render the computed diff the
7
7
  * operator approves. NULL for every non-drift hold.
8
8
  *
9
- * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
9
+ * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so existing data is
10
10
  * preserved.
11
11
  */
12
12
  export declare function up(db: Kysely<unknown>): Promise<void>;
@@ -9,7 +9,7 @@ import { type Kysely } from 'kysely';
9
9
  * hasn't populated it yet (manual `--app-id` flow whose initial fetch failed,
10
10
  * or a row created before the rollout).
11
11
  *
12
- * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
12
+ * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so existing data is
13
13
  * preserved.
14
14
  */
15
15
  export declare function up(db: Kysely<unknown>): Promise<void>;
@@ -11,7 +11,7 @@ import { type Kysely } from 'kysely';
11
11
  * distinct per-host selectors.
12
12
  *
13
13
  * Idempotent: re-running on a DB that already has the column / index is a no-op.
14
- * Additive — staging data is preserved.
14
+ * Additive — existing data is preserved.
15
15
  */
16
16
  export declare function up(db: Kysely<unknown>): Promise<void>;
17
17
  export declare function down(db: Kysely<unknown>): Promise<void>;
@@ -12,7 +12,7 @@ import { type Kysely } from 'kysely';
12
12
  *
13
13
  * All nullable: a host with no reach metadata simply cannot be bootstrapped and
14
14
  * behaves exactly as before. Idempotent (`ADD COLUMN IF NOT EXISTS`); additive,
15
- * so staging data is preserved.
15
+ * so existing data is preserved.
16
16
  */
17
17
  export declare function up(db: Kysely<unknown>): Promise<void>;
18
18
  export declare function down(db: Kysely<unknown>): Promise<void>;
@@ -9,7 +9,7 @@ import { type Kysely } from 'kysely';
9
9
  * default for every existing static / ephemeral token, which stay reusable
10
10
  * until expiry).
11
11
  *
12
- * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
12
+ * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so existing data is
13
13
  * preserved.
14
14
  */
15
15
  export declare function up(db: Kysely<unknown>): Promise<void>;
@@ -7,7 +7,7 @@ import { type Kysely } from 'kysely';
7
7
  * lock file). The dashboard renders a "Local machine" badge for these runs
8
8
  * and avoids building an external repository link from the repo identifier.
9
9
  *
10
- * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive with a default, so staging
10
+ * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive with a default, so existing
11
11
  * data is preserved.
12
12
  */
13
13
  export declare function up(db: Kysely<unknown>): Promise<void>;
@@ -10,7 +10,7 @@ import { type Kysely } from 'kysely';
10
10
  * agent accepts any job its advertised labels match), so every existing token
11
11
  * stays unconfined until re-minted.
12
12
  *
13
- * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
13
+ * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so existing data is
14
14
  * preserved.
15
15
  */
16
16
  export declare function up(db: Kysely<unknown>): Promise<void>;
@@ -9,7 +9,7 @@ import { type Kysely } from 'kysely';
9
9
  * fully-resolved list when a deferred-init agent eval resolves dynamic
10
10
  * elements. NULL = the job binds no environment.
11
11
  *
12
- * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
12
+ * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so existing data is
13
13
  * preserved.
14
14
  */
15
15
  export declare function up(db: Kysely<unknown>): Promise<void>;
@@ -9,7 +9,7 @@ import { type Kysely } from 'kysely';
9
9
  * - `execution_jobs.env_warning text NULL` — the user-visible warning naming the
10
10
  * skipped environments, surfaced on the dashboard run view. NULL = no warning.
11
11
  *
12
- * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
12
+ * Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so existing data is
13
13
  * preserved.
14
14
  */
15
15
  export declare function up(db: Kysely<unknown>): Promise<void>;
@@ -0,0 +1,15 @@
1
+ import { type Kysely } from 'kysely';
2
+ /**
3
+ * Add `org_settings.cache_upload_settle_timeout_ms BIGINT` (nullable).
4
+ *
5
+ * Per-org bound on how long a build job's `job.status success` waits for the
6
+ * cache publish (object metadata plus pointer) its agent reported just before
7
+ * it. NULL falls back to the cluster default
8
+ * (`KICI_CACHE_UPLOAD_SETTLE_TIMEOUT_MS`, 10s); 0 turns the wait off. Operators
9
+ * tune it via `kici-admin org-settings cache-upload-settle`.
10
+ *
11
+ * Idempotent: a re-run on a DB that already has the column is a no-op.
12
+ */
13
+ export declare function up(db: Kysely<unknown>): Promise<void>;
14
+ export declare function down(db: Kysely<unknown>): Promise<void>;
15
+ //# sourceMappingURL=152_org_settings_cache_upload_settle_timeout.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { type Kysely } from 'kysely';
2
+ /**
3
+ * Add `execution_runs.cancel_force BOOLEAN` (nullable, no default).
4
+ *
5
+ * TRUE once a forced cancel reached the run. The leader's stuck-cancelling
6
+ * sweep reads it to re-send a cancel that did not complete with `force` set,
7
+ * so a forced cancel whose first forward to a sibling coordinator was lost is
8
+ * not re-sent as a graceful one. NULL (every existing row, and every run no
9
+ * forced cancel reached) re-sends gracefully. No backfill: nothing recorded
10
+ * whether an earlier cancel was forced.
11
+ *
12
+ * Idempotent: a re-run on a DB that already has the column is a no-op.
13
+ */
14
+ export declare function up(db: Kysely<unknown>): Promise<void>;
15
+ export declare function down(db: Kysely<unknown>): Promise<void>;
16
+ //# sourceMappingURL=153_execution_runs_cancel_force.d.ts.map
@@ -514,6 +514,13 @@ export interface ExecutionRunTable {
514
514
  * cancelled and for one that entered `cancelling` before the column existed.
515
515
  */
516
516
  cancelling_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
517
+ /**
518
+ * TRUE once a forced cancel reached the run (migration 153). The
519
+ * stuck-cancelling re-drive reads it so a cancel that did not complete is
520
+ * re-sent with `force`. Never reset to FALSE: a later graceful cancel does
521
+ * not undo a forced one. NULL re-drives gracefully.
522
+ */
523
+ cancel_force: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
517
524
  /**
518
525
  * The run's status generation (migration 150). Starts at 0 and rises by one
519
526
  * each time the run leaves a terminal status to continue. Forwarded on every
@@ -714,8 +721,8 @@ export interface ExecutionRunTable {
714
721
  check_mode: string | null;
715
722
  /**
716
723
  * Set inside the cold-store archive transaction before the row is
717
- * DELETEd. Survivors carry NULL. Exists so a future
718
- * "promote-chunk-back-into-PG" path (Phase F) can restore rows with
724
+ * DELETEd. Survivors carry NULL. Exists so the
725
+ * "promote-chunk-back-into-PG" path can restore rows with
719
726
  * their original archive pointer.
720
727
  */
721
728
  archived_at: Date | null;
@@ -1301,7 +1308,7 @@ export interface SecretAuditLogTable {
1301
1308
  metadata: string | null;
1302
1309
  /**
1303
1310
  * Set inside the archive transaction before the row is DELETEd.
1304
- * Survivors carry NULL. See cold-storage Phase D notes.
1311
+ * Survivors carry NULL.
1305
1312
  */
1306
1313
  archived_at: Date | null;
1307
1314
  /** S3 object key of the chunk that carried this row; see `archived_at`. */
@@ -1338,9 +1345,8 @@ export interface AccessLogTable {
1338
1345
  created_at: Generated<Date>;
1339
1346
  /**
1340
1347
  * Set inside the archive transaction before the row is DELETEd.
1341
- * Survivors carry NULL. See cold-storage Phase D notes.
1342
- * Phase D removed the previous `expires_at`-based TTL — rows older
1343
- * than 30 days are archived to S3 instead of hard-deleted.
1348
+ * Survivors carry NULL. The table has no `expires_at`-based TTL — rows
1349
+ * older than 30 days are archived to S3 instead of hard-deleted.
1344
1350
  */
1345
1351
  archived_at: Date | null;
1346
1352
  /** S3 object key of the chunk that carried this row; see `archived_at`. */
@@ -1995,6 +2001,14 @@ export interface OrgSettingsTable {
1995
2001
  * returns a string on select; accept a number on insert/update.
1996
2002
  */
1997
2003
  queue_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
2004
+ /**
2005
+ * Per-org bound (ms) on how long a build job's success waits for the cache
2006
+ * publish its agent reported just before it. 0 turns the wait off. Null =
2007
+ * cluster default (config.cacheUploadSettleTimeoutMs /
2008
+ * KICI_CACHE_UPLOAD_SETTLE_TIMEOUT_MS). Postgres BIGINT — pg returns a string
2009
+ * on select; accept a number on insert/update.
2010
+ */
2011
+ cache_upload_settle_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
1998
2012
  /**
1999
2013
  * Per-org expiry (seconds) for a held approval element before it is rejected
2000
2014
  * and its run/job/step fails. NOT NULL, default 86400 (one day). An SDK
@@ -2403,9 +2417,9 @@ export interface EventLogTable {
2403
2417
  error_message: string | null;
2404
2418
  /** When the delivery was received */
2405
2419
  received_at: Generated<Date>;
2406
- /** Phase E cold-store: set inside the archive transaction; NULL for hot rows. */
2420
+ /** Cold-store: set inside the archive transaction; NULL for hot rows. */
2407
2421
  archived_at: Date | null;
2408
- /** Phase E cold-store: chunk object key when row is archived. */
2422
+ /** Cold-store: chunk object key when row is archived. */
2409
2423
  archive_object_key: string | null;
2410
2424
  }
2411
2425
  export type EventLogRow = Selectable<EventLogTable>;
@@ -2415,8 +2429,8 @@ export type EventLogRowUpdate = Updateable<EventLogTable>;
2415
2429
  * Cold-store chunk counts table (cold_store_chunk_counts).
2416
2430
  * Tracks per-(db, table, tenant) archived-chunk metadata so the
2417
2431
  * `cold_store_chunks_total` gauge and the `kici-admin cold-store list-chunks`
2418
- * CLI can report totals without S3 LIST calls. Phase A creates the table
2419
- * empty; Phase B+ populates it transactionally on each chunk write.
2432
+ * CLI can report totals without S3 LIST calls. The cold-store archiver
2433
+ * populates it transactionally on each chunk write.
2420
2434
  */
2421
2435
  export interface ColdStoreChunkCountsTable {
2422
2436
  /** DbKind identifier ('orchestrator' on this side). */
@@ -2438,12 +2452,12 @@ export type ColdStoreChunkCountsRow = Selectable<ColdStoreChunkCountsTable>;
2438
2452
  export type NewColdStoreChunkCountsRow = Insertable<ColdStoreChunkCountsTable>;
2439
2453
  export type ColdStoreChunkCountsUpdate = Updateable<ColdStoreChunkCountsTable>;
2440
2454
  /**
2441
- * Cold-store chunk index (cold_store_chunks). Phase 2.
2455
+ * Cold-store chunk index (cold_store_chunks).
2442
2456
  *
2443
2457
  * One row per archived chunk that the GC sweep can later purge from S3.
2444
2458
  * Inserted inside `markArchivedAndDelete`'s transaction by adapters that
2445
- * opt into the per-bucket layout via `coldTtlDays(row)`. Pre-Phase-2
2446
- * (v1) chunks are NOT in this table — they're treated as
2459
+ * opt into the per-bucket layout via `coldTtlDays(row)`. V1
2460
+ * chunks are NOT in this table — they're treated as
2447
2461
  * `'forever'` and never purged.
2448
2462
  */
2449
2463
  export interface ColdStoreChunksTable {
@@ -31,7 +31,7 @@ export interface EventRouterConfig {
31
31
  /**
32
32
  * **Test-only.** Per-event-name fault injection: when `attempts <= N`,
33
33
  * the EventRouter throws a synthetic dispatch error to drive the retry /
34
- * DLQ path. Used by the fault-injection E2E to prove the lease + retry
34
+ * DLQ path. Used by fault-injection tests to prove the lease + retry
35
35
  * loop dispatches a real run when the inner dispatch eventually
36
36
  * succeeds, and lands the row in the DLQ when N exceeds
37
37
  * `maxDispatchAttempts`.
@@ -29,7 +29,7 @@ export interface OrchestratorFaultInjection {
29
29
  skipS3Sentinel?: boolean;
30
30
  /**
31
31
  * Predicate over an OIDC `audience`: when true, the *initial* provenance
32
- * mint fails transiently (defer), so an E2E can exercise the
32
+ * mint fails transiently (defer), so a test can exercise the
33
33
  * deferred-attestation retry + per-run serve path.
34
34
  */
35
35
  initialMintFault?: (audience: string) => boolean;
@@ -40,7 +40,7 @@ export interface OrchestratorFaultInjection {
40
40
  */
41
41
  remintReject?: (audience: string) => boolean;
42
42
  /**
43
- * Invoked by `handleRerunRequest` before `onRerun`, so an HA E2E can make
43
+ * Invoked by `handleRerunRequest` before `onRerun`, so an HA test can make
44
44
  * the first coordinator slow enough that the Platform relay fails over.
45
45
  */
46
46
  beforeRerun?: () => Promise<void>;
@@ -43,9 +43,9 @@ export declare function cidrToNetwork(cidr: string): string;
43
43
  * serializes them.
44
44
  *
45
45
  * The command list NEVER deletes the table. It is a self-heal — `ensureHostReady`
46
- * runs it whenever `verifyBridge` reports unhealthy, which happens on any of
47
- * four conditions none of which knows how many VMs are live — so dropping the
48
- * table would leave every running VM fail-open, with full RFC1918 and
46
+ * runs it whenever `verifyBridge` reports unhealthy, and none of the
47
+ * conditions it checks says how many VMs are live — so dropping the table
48
+ * would leave every running VM fail-open, with full RFC1918 and
49
49
  * cloud-metadata reach, until it was destroyed. Instead the baseline lives in
50
50
  * its own regular chain (`baseline`, see {@link BASELINE_CHAIN}) that is flushed
51
51
  * and refilled, and the hooked `forward` chain keeps its per-VM rules
@@ -80,6 +80,10 @@ export interface BridgeHealth {
80
80
  tablePresent: boolean;
81
81
  /** The regular baseline chain exists and `forward` ends in a jump to it. */
82
82
  baselineChainPresent: boolean;
83
+ /** The table's `postrouting` chain masquerades the bridge subnet — the guests' internet egress. */
84
+ natPresent: boolean;
85
+ /** The baseline chain holds the bridge subnet's rules, in the order the provisioner writes them. */
86
+ baselineRulesPresent: boolean;
83
87
  /** Every enslaved kici-* TAP carries bridge port isolation. */
84
88
  tapIsolationPresent: boolean;
85
89
  healthy: boolean;
@@ -125,6 +129,20 @@ export declare function verifyBridge(cfg: FirecrackerBridgeConfig, opts?: ExecOp
125
129
  * `denyAll` drop.
126
130
  */
127
131
  export declare function forwardEndsInBaselineJump(nftJson: string): boolean;
132
+ /**
133
+ * True when a `nft -j list chain … postrouting` listing masquerades traffic
134
+ * whose source is `subnet` (the network CIDR, e.g. `10.0.0.0/24`).
135
+ */
136
+ export declare function postroutingMasqueradesSubnet(nftJson: string, subnet: string): boolean;
137
+ /**
138
+ * True when a `nft -j list chain … baseline` listing holds this bridge's
139
+ * subnet-scoped accepts and drops exactly as {@link buildBridgeCommands} writes
140
+ * them, in the same order.
141
+ *
142
+ * Order is part of the check: the internet accept is terminal, so ahead of the
143
+ * RFC1918 and metadata drops it would let the guests reach every private range.
144
+ */
145
+ export declare function baselineHoldsBridgeRules(nftJson: string, cfg: FirecrackerBridgeConfig): boolean;
128
146
  /**
129
147
  * Names of the kici-* TAPs enslaved to the bridge that are NOT port-isolated,
130
148
  * read from `ip -d -j link show master <bridge>`.
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * A leaf module on purpose: it imports nothing, so an out-of-package consumer
6
6
  * can read the constant without pulling the orchestrator runtime graph in with
7
- * it. The NetworkManager drift watchdog (`hack/lib/nm-watchdog.ts`) derives its
7
+ * it. A NetworkManager drift watchdog derives its
8
8
  * expected-pattern set from here rather than re-typing the patterns — a second
9
9
  * copy desyncs silently the moment a pattern is added. `host-network.ts`
10
10
  * re-exports it and renders `NM_CONF_CONTENT` from it, so the drop-in and the
@@ -0,0 +1,12 @@
1
+ /** The part of a logger that `runDetached` writes a failure to. */
2
+ export interface DetachedFailureLogger {
3
+ error(message: string, meta?: Record<string, unknown>): unknown;
4
+ }
5
+ /**
6
+ * Run `work` without waiting for it. A throw, or a rejection of the promise it
7
+ * returns, is logged at error level as `<task> failed` with `context` and the
8
+ * error message, and goes no further. `context` is read when the failure is
9
+ * logged, so the work may fill it in while it runs.
10
+ */
11
+ export declare function runDetached(logger: DetachedFailureLogger, task: string, work: () => unknown, context?: Record<string, unknown>): void;
12
+ //# sourceMappingURL=run-detached.d.ts.map