@kici-dev/orchestrator 0.7.0 → 0.9.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 (75) hide show
  1. package/dist/__test-helpers__/test-db.d.ts +21 -0
  2. package/dist/app.d.ts +6 -5
  3. package/dist/artifacts/artifact-store.d.ts +6 -10
  4. package/dist/cache/legacy-prefixes.d.ts +19 -0
  5. package/dist/cache/pending-precursor-db-watcher.d.ts +79 -0
  6. package/dist/cache/pending-tracker.d.ts +10 -0
  7. package/dist/cache/precursor-result.d.ts +68 -0
  8. package/dist/cache/source-cache.d.ts +2 -1
  9. package/dist/cache/user-cache.d.ts +37 -58
  10. package/dist/cli/api-client.d.ts +3 -6
  11. package/dist/cli/commands/cache.d.ts +51 -0
  12. package/dist/cli/commands/cluster-settings.d.ts +0 -11
  13. package/dist/cli/commands/trust-policy.d.ts +12 -42
  14. package/dist/cli/service/privilege.d.ts +27 -6
  15. package/dist/cli.js +1171 -860
  16. package/dist/cluster/cluster-settings-reader.d.ts +1 -3
  17. package/dist/cluster/coordinator.d.ts +2 -3
  18. package/dist/cluster/join-client.d.ts +1 -39
  19. package/dist/config.d.ts +0 -6
  20. package/dist/contexts/context-store.d.ts +3 -3
  21. package/dist/contexts/held-runs.d.ts +6 -6
  22. package/dist/contexts/protection/aggregate.d.ts +5 -5
  23. package/dist/dashboard/handler.d.ts +1 -1
  24. package/dist/db/migrations/142_sweep_deprecated_columns.d.ts +4 -0
  25. package/dist/db/migrations/143_execution_jobs_precursor_result.d.ts +26 -0
  26. package/dist/db/migrations/144_execution_runs_registration_window.d.ts +32 -0
  27. package/dist/db/types.d.ts +27 -13
  28. package/dist/index.js +115 -156
  29. package/dist/metrics/prometheus.d.ts +2 -2
  30. package/dist/oidc/id-token-claims.d.ts +9 -10
  31. package/dist/oidc/local-mint.d.ts +9 -12
  32. package/dist/oidc/oidc-mint-registration.d.ts +15 -28
  33. package/dist/oidc/orchestrator-mint.d.ts +10 -10
  34. package/dist/oidc/resolve-signer.d.ts +40 -0
  35. package/dist/orchestrator-core.d.ts +11 -0
  36. package/dist/pipeline/dispatch-matched-workflow.d.ts +1 -2
  37. package/dist/pipeline/job-contexts.d.ts +2 -2
  38. package/dist/provenance/attestation-retrier.d.ts +11 -1
  39. package/dist/provenance/retrier-mint.d.ts +35 -0
  40. package/dist/providers/github/normalizer.d.ts +1 -28
  41. package/dist/providers/local/lock-file-fetcher.d.ts +8 -0
  42. package/dist/providers/local/normalizer.d.ts +1 -15
  43. package/dist/queue/job-queue.d.ts +2 -6
  44. package/dist/queue/terminalize-unroutable.d.ts +1 -1
  45. package/dist/reporting/execution-tracker.d.ts +107 -0
  46. package/dist/scaler/claim-store.d.ts +0 -2
  47. package/dist/scaler/event-backend.d.ts +7 -6
  48. package/dist/scaler/label-matcher.d.ts +0 -1
  49. package/dist/scaler/manager.d.ts +20 -26
  50. package/dist/scaler/scaler-state-store.d.ts +9 -2
  51. package/dist/scaler/types.d.ts +10 -0
  52. package/dist/scaler/warm-pool.d.ts +6 -4
  53. package/dist/security/global-workflow-policy.d.ts +3 -28
  54. package/dist/security/identity-link.d.ts +1 -1
  55. package/dist/security/lock-source.d.ts +1 -1
  56. package/dist/security/trust-directory-store.d.ts +1 -1
  57. package/dist/security/trust-policy-gate.d.ts +0 -14
  58. package/dist/security/trust-policy-store.d.ts +2 -3
  59. package/dist/security/trust-resolver.d.ts +1 -2
  60. package/dist/server.js +2810 -2524
  61. package/dist/stale-detector/all-terminal-runs.d.ts +31 -0
  62. package/dist/stale-detector/stale-run-detector.d.ts +20 -0
  63. package/dist/standalone.js +2956 -2610
  64. package/dist/webhook/ingest-overflow-replayer.d.ts +1 -1
  65. package/dist/webhook/relay-reinject.d.ts +1 -1
  66. package/dist/worker/in-memory-job-queue.d.ts +9 -0
  67. package/dist/ws/dashboard-global-workflows-handler.d.ts +3 -4
  68. package/dist/ws/fleet-agent-collector.d.ts +7 -0
  69. package/dist/ws/platform-client.d.ts +0 -15
  70. package/dist/ws/test-relay-handlers.d.ts +2 -0
  71. package/installer-image-digests.json +3 -3
  72. package/package.json +18 -17
  73. package/sbom.spdx.json +1178 -1352
  74. package/dist/ws/oidc-token-relay.d.ts +0 -79
  75. package/dist/ws/orch-rpc.d.ts +0 -9
@@ -1,9 +1,7 @@
1
1
  import type { Kysely } from 'kysely';
2
2
  import type { Database } from '../db/types.js';
3
3
  /** Numeric columns on cluster_settings readable via {@link ClusterSettingsReader}. */
4
- export type ClusterNumberColumn = 'max_github_payload_bytes' | 'event_log_max_payload_bytes' | 'lock_file_max_bytes' | 'webhook_dedup_ttl_ms'
5
- /** @deprecated Readable, but no call site reads it. Removed at v1.0.0. */
6
- | 'contributor_cache_ttl_ms' | 'event_router_event_ttl_seconds' | 'event_router_max_dispatch_attempts' | 'queue_max_depth' | 'reroute_flap_grace_ms' | 'max_fanout_hosts' | 'event_router_rate_limit_per_workflow_per_minute' | 'cache_max_tarball_bytes' | 'cache_ttl_days' | 'lockfile_cache_max' | 'lockfile_cache_max_bytes' | 'lockfile_cache_ttl_ms' | 'content_cache_max' | 'content_cache_max_bytes' | 'content_cache_ttl_ms' | 'global_eval_round_timeout_ms' | 'global_eval_candidate_timeout_ms' | 'global_eval_cache_max' | 'global_eval_wait_timeout_ms' | 'check_run_tracking_ttl_days' | 'run_retention_days' | 'audit_retention_days' | 'provenance_retention_days' | 'held_run_retention_days' | 'concurrency_wait_timeout_ms' | 'agent_token_ttl_ms' | 'ownership_db_check_timeout_ms' | 'unroutable_grace_ms' | 'ingest_overflow_claim_timeout_ms' | 'scaler_reap_interval_ms' | 'scaler_reap_stranded_timeout_ms' | 'scaler_reap_reattempt_interval_ms' | 'scaler_claim_retention_ms' | 'scaler_provision_backoff_base_ms' | 'scaler_provision_backoff_max_ms' | 'scaler_provision_max_consecutive_failures';
4
+ export type ClusterNumberColumn = 'max_github_payload_bytes' | 'event_log_max_payload_bytes' | 'lock_file_max_bytes' | 'webhook_dedup_ttl_ms' | 'event_router_event_ttl_seconds' | 'event_router_max_dispatch_attempts' | 'queue_max_depth' | 'reroute_flap_grace_ms' | 'max_fanout_hosts' | 'event_router_rate_limit_per_workflow_per_minute' | 'cache_max_tarball_bytes' | 'cache_ttl_days' | 'lockfile_cache_max' | 'lockfile_cache_max_bytes' | 'lockfile_cache_ttl_ms' | 'content_cache_max' | 'content_cache_max_bytes' | 'content_cache_ttl_ms' | 'global_eval_round_timeout_ms' | 'global_eval_candidate_timeout_ms' | 'global_eval_cache_max' | 'global_eval_wait_timeout_ms' | 'check_run_tracking_ttl_days' | 'run_retention_days' | 'audit_retention_days' | 'provenance_retention_days' | 'held_run_retention_days' | 'concurrency_wait_timeout_ms' | 'agent_token_ttl_ms' | 'ownership_db_check_timeout_ms' | 'unroutable_grace_ms' | 'ingest_overflow_claim_timeout_ms' | 'scaler_reap_interval_ms' | 'scaler_reap_stranded_timeout_ms' | 'scaler_reap_reattempt_interval_ms' | 'scaler_claim_retention_ms' | 'scaler_provision_backoff_base_ms' | 'scaler_provision_backoff_max_ms' | 'scaler_provision_max_consecutive_failures';
7
5
  /** Text columns on cluster_settings readable via {@link ClusterSettingsReader}. */
8
6
  export type ClusterStringColumn = 'dashboard_verified_issuer';
9
7
  /** Boolean columns on cluster_settings readable via {@link ClusterSettingsReader}. */
@@ -46,7 +46,6 @@ export interface JobToRoute {
46
46
  ref: string;
47
47
  sha: string;
48
48
  sourceTarUrl?: string;
49
- sourceTarHash?: string;
50
49
  sourceTarDigest?: string;
51
50
  depsUrl?: string;
52
51
  depsHash?: string;
@@ -305,8 +304,8 @@ export declare class RunCoordinator {
305
304
  * tracking entry once the shared row is terminal, otherwise re-arm the window
306
305
  * as a reap poll.
307
306
  *
308
- * The entry cannot simply be dropped here: cancel propagation still needs it
309
- * while the job runs. It also cannot simply be kept, because a peer
307
+ * The entry cannot be dropped here: cancel propagation still needs it
308
+ * while the job runs. It also cannot be kept, because a peer
310
309
  * COORDINATOR relays no terminal `job.progress` — the shared row IS its
311
310
  * report — so nothing else would ever release it and `reroutedJobs` would
312
311
  * grow for the lifetime of the process. A read fault re-arms (never releases),
@@ -22,45 +22,15 @@ interface JoinClientOptions {
22
22
  peerUrl?: string;
23
23
  /** API key for Platform authentication (required for --platform mode) */
24
24
  apiKey?: string;
25
- /**
26
- * Path to write the resulting local config YAML.
27
- *
28
- * @deprecated The orchestrator boots from its environment, so nothing reads
29
- * this file. Leave it unset and use {@link JoinClientOptions.envFilePath}.
30
- */
31
- configPath?: string;
32
25
  /** Path to write the env file `orchestrator install --env-file` consumes. */
33
26
  envFilePath?: string;
34
27
  }
35
28
  /** Default path the join writes its env file to. */
36
29
  export declare const DEFAULT_JOIN_ENV_FILE = "./kici-orchestrator.env";
37
- /**
38
- * Local config structure written by the deprecated `--config` path.
39
- *
40
- * @deprecated `loadLocalConfig()` strips `storage` and `secrets`, and the boot
41
- * path never reads the file at all.
42
- */
43
- interface JoinLocalConfig {
44
- database: {
45
- url: string;
46
- };
47
- storage?: ConfigBundle['storage'];
48
- secrets?: {
49
- key: string;
50
- };
51
- }
52
30
  /**
53
31
  * Decrypt a base64-encoded encrypted config bundle using a derived encryption key.
54
32
  */
55
33
  export declare function decryptAndParseBundle(encryptedB64: string, encryptionKey: Buffer): ConfigBundle;
56
- /**
57
- * Build a JoinLocalConfig from a decrypted ConfigBundle.
58
- * Maps bundle fields to the structure expected by loadLocalConfig().
59
- *
60
- * @deprecated Feeds the deprecated `--config` artifact. Use
61
- * {@link buildEnvFile}.
62
- */
63
- export declare function buildLocalConfig(bundle: ConfigBundle): JoinLocalConfig;
64
34
  /**
65
35
  * Startup environment variable each `ConfigBundle.storage` field is delivered
66
36
  * through.
@@ -93,13 +63,6 @@ export declare function buildEnvFile(bundle: ConfigBundle): string;
93
63
  * Write the env file the orchestrator boots from.
94
64
  */
95
65
  export declare function writeEnvFile(path: string, bundle: ConfigBundle): Promise<void>;
96
- /**
97
- * Write a local config object to a YAML file.
98
- *
99
- * @deprecated The orchestrator boot path is environment-only, so nothing reads
100
- * this file. Use {@link writeEnvFile}.
101
- */
102
- export declare function writeConfigFile(path: string, config: Record<string, unknown>): Promise<void>;
103
66
  export declare class JoinClient {
104
67
  private readonly options;
105
68
  constructor(options: JoinClientOptions);
@@ -108,8 +71,7 @@ export declare class JoinClient {
108
71
  * 1. Send join.request with token to Platform relay or direct peer
109
72
  * 2. Receive join.response with encrypted config bundle
110
73
  * 3. Decrypt bundle using token-derived key
111
- * 4. Write the env file the orchestrator boots from (and, when `--config`
112
- * names one, the deprecated local YAML)
74
+ * 4. Write the env file the orchestrator boots from
113
75
  */
114
76
  join(): Promise<void>;
115
77
  /**
package/dist/config.d.ts CHANGED
@@ -43,7 +43,6 @@ declare const configSchema: z.ZodObject<{
43
43
  provenanceIssuer: z.ZodOptional<z.ZodString>;
44
44
  provenanceSigningIssuer: z.ZodOptional<z.ZodString>;
45
45
  provenanceSignerKind: z.ZodOptional<z.ZodString>;
46
- oidcLegacyPrSub: z.ZodPipe<z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.ZodTransform<boolean, string | boolean>>;
47
46
  provenanceKmsKeyArn: z.ZodOptional<z.ZodString>;
48
47
  provenanceKmsRegion: z.ZodOptional<z.ZodString>;
49
48
  provenanceKmsAccessKeyId: z.ZodOptional<z.ZodString>;
@@ -195,7 +194,6 @@ declare const configSchema: z.ZodObject<{
195
194
  maxGithubPayloadBytes: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
196
195
  lockFileMaxBytes: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
197
196
  webhookDedupTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
198
- contributorCacheTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
199
197
  clusterSettingsCacheTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
200
198
  logLevel: z.ZodDefault<z.ZodEnum<{
201
199
  debug: "debug";
@@ -254,7 +252,6 @@ export declare const packagingConfigSchema: z.ZodObject<{
254
252
  provenanceIssuer: z.ZodOptional<z.ZodString>;
255
253
  provenanceSigningIssuer: z.ZodOptional<z.ZodString>;
256
254
  provenanceSignerKind: z.ZodOptional<z.ZodString>;
257
- oidcLegacyPrSub: z.ZodPipe<z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.ZodTransform<boolean, string | boolean>>;
258
255
  provenanceKmsKeyArn: z.ZodOptional<z.ZodString>;
259
256
  provenanceKmsRegion: z.ZodOptional<z.ZodString>;
260
257
  provenanceKmsAccessKeyId: z.ZodOptional<z.ZodString>;
@@ -406,7 +403,6 @@ export declare const packagingConfigSchema: z.ZodObject<{
406
403
  maxGithubPayloadBytes: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
407
404
  lockFileMaxBytes: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
408
405
  webhookDedupTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
409
- contributorCacheTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
410
406
  clusterSettingsCacheTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
411
407
  logLevel: z.ZodDefault<z.ZodEnum<{
412
408
  debug: "debug";
@@ -498,7 +494,6 @@ export declare const envDef: import("@kici-dev/shared/env").DefineEnvResult<{
498
494
  provenanceIssuer?: string | undefined;
499
495
  provenanceSigningIssuer?: string | undefined;
500
496
  provenanceSignerKind?: string | undefined;
501
- oidcLegacyPrSub: boolean;
502
497
  provenanceKmsKeyArn?: string | undefined;
503
498
  provenanceKmsRegion?: string | undefined;
504
499
  provenanceKmsAccessKeyId?: string | undefined;
@@ -629,7 +624,6 @@ export declare const envDef: import("@kici-dev/shared/env").DefineEnvResult<{
629
624
  maxGithubPayloadBytes: number;
630
625
  lockFileMaxBytes: number;
631
626
  webhookDedupTtlMs: number;
632
- contributorCacheTtlMs: number;
633
627
  clusterSettingsCacheTtlMs: number;
634
628
  logLevel: "debug" | "error" | "info" | "warn";
635
629
  nodeEnv: "development" | "production" | "test";
@@ -1,5 +1,5 @@
1
1
  import { type Kysely } from 'kysely';
2
- import type { ConcurrencyStrategy, Context as EngineContext } from '@kici-dev/engine';
2
+ import type { ConcurrencyStrategy, Context as EngineContext, MinimumTrust } from '@kici-dev/engine';
3
3
  import type { Database, Context } from '../db/types.js';
4
4
  /** Thrown by `delete` when pending held runs reference the context. */
5
5
  export declare class ContextDeleteBlockedError extends Error {
@@ -26,7 +26,7 @@ export interface ContextCreateInput {
26
26
  requiredReviewers?: string[] | null;
27
27
  waitTimerSeconds?: number | null;
28
28
  holdExpirySeconds?: number;
29
- minimumTrust?: 'known' | 'trusted' | null;
29
+ minimumTrust?: MinimumTrust;
30
30
  allowLocalExecution?: boolean;
31
31
  enabled?: boolean;
32
32
  createdBy?: string | null;
@@ -55,7 +55,7 @@ export interface ContextUpdateInput {
55
55
  requiredReviewers?: string[] | null;
56
56
  waitTimerSeconds?: number | null;
57
57
  holdExpirySeconds?: number | null;
58
- minimumTrust?: 'known' | 'trusted' | null;
58
+ minimumTrust?: MinimumTrust;
59
59
  allowLocalExecution?: boolean;
60
60
  enabled?: boolean;
61
61
  }
@@ -32,12 +32,12 @@ export declare enum HeldRunStatus {
32
32
  *
33
33
  * - `fork_pr` — the org trust policy's fork switch held the run.
34
34
  * - `context_trust` — a context's minimum-trust gate held the run.
35
- * - `workflow_modification` — deprecated; no longer raised. Modifications to
36
- * `.kici/` are surfaced on their own informational check and no longer feed
37
- * a policy arm. Removed at v1.0.0.
38
- * - `unknown_contributor` — deprecated; no longer raised. The policy turns on
39
- * whether the pull request came from a fork, not on who opened it. Removed
40
- * at v1.0.0.
35
+ * - `workflow_modification` — no longer raised. Modifications to `.kici/`
36
+ * are surfaced on their own informational check and no longer feed a policy
37
+ * arm. Kept so stored `held_runs` rows with this reason still render.
38
+ * - `unknown_contributor` — no longer raised. The policy turns on whether the
39
+ * pull request came from a fork, not on who opened it. Kept so stored
40
+ * `held_runs` rows with this reason still render.
41
41
  */
42
42
  export declare const SecurityHoldReason: z.ZodEnum<{
43
43
  context_trust: "context_trust";
@@ -8,7 +8,7 @@ export interface ContextGateRejection {
8
8
  }
9
9
  /** Effective protection parameters after most-restrictive aggregation. */
10
10
  export interface EffectiveProtection {
11
- minimumTrust?: 'known' | 'trusted';
11
+ minimumTrust?: 'trusted';
12
12
  requiredReviewers: string[];
13
13
  waitTimerSeconds: number | null;
14
14
  holdExpirySeconds: number;
@@ -26,10 +26,10 @@ export declare function evaluateMultiContextGates(envs: ReadonlyArray<{
26
26
  }>, ctx: JobDispatchContext): ContextGateRejection[];
27
27
  /**
28
28
  * Aggregate hold/wait/queue parameters across all bound contexts, most
29
- * restrictive wins: trust = strictest declared floor (see `TRUST_RANK` a
30
- * wording choice, not a verdict), reviewers = sorted dedup union, wait timer =
31
- * max, hold expiry = min, concurrency limit = min (tightest). The concurrency
32
- * strategy follows the primary (first) context.
29
+ * restrictive wins: trust = the declared floor when any context declares one,
30
+ * reviewers = sorted dedup union, wait timer = max, hold expiry = min,
31
+ * concurrency limit = min (tightest). The concurrency strategy follows the
32
+ * primary (first) context.
33
33
  */
34
34
  export declare function aggregateProtectionParams(envs: ReadonlyArray<Context>): EffectiveProtection;
35
35
  /**
@@ -466,7 +466,7 @@ export declare class DashboardHandler {
466
466
  * volume without adding attribution detail.
467
467
  *
468
468
  * Pacing: a `setImmediate` yield between sends keeps the WS connection
469
- * from saturating. For a 5 MB cap (the wishlist's worst case) this means
469
+ * from saturating. For the 5 MB cap this means
470
470
  * ~80 yields per stream — negligible.
471
471
  */
472
472
  handleEventLogPayloadStream(msg: DashboardEventLogPayloadStreamRequest): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { type Kysely } from 'kysely';
2
+ export declare function up(db: Kysely<unknown>): Promise<void>;
3
+ export declare function down(): Promise<void>;
4
+ //# sourceMappingURL=142_sweep_deprecated_columns.d.ts.map
@@ -0,0 +1,26 @@
1
+ import { type Kysely } from 'kysely';
2
+ /**
3
+ * Add `execution_jobs.precursor_result JSONB NULL` — the payload a precursor
4
+ * job (source-pack build, init, dynamic eval) reports on its terminal
5
+ * `job.status`, persisted so a coordinator other than the one whose agent ran
6
+ * the job can read it back.
7
+ *
8
+ * The dispatch queue is cluster-wide: a job one coordinator dispatched may be
9
+ * claimed by an agent connected to a sibling coordinator. The sibling receives
10
+ * the agent's terminal frame; the coordinator awaiting the job never does. The
11
+ * shared row is the channel between them, and until this column existed the
12
+ * row carried the status but not the result — a build's `buildComplete`
13
+ * marker, an init's resolved fields, a dynamic eval's generated jobs — so the
14
+ * awaiting coordinator waited out its build timeout on a build that had
15
+ * succeeded.
16
+ *
17
+ * Nullable, with no default: NULL means "this job reported no precursor
18
+ * payload", which is true of every ordinary job and of every row written
19
+ * before this column existed.
20
+ *
21
+ * Idempotent: the add is guarded on existence and the drop uses IF EXISTS, so a
22
+ * re-run is a no-op.
23
+ */
24
+ export declare function up(db: Kysely<unknown>): Promise<void>;
25
+ export declare function down(db: Kysely<unknown>): Promise<void>;
26
+ //# sourceMappingURL=143_execution_jobs_precursor_result.d.ts.map
@@ -0,0 +1,32 @@
1
+ import { type Kysely } from 'kysely';
2
+ /**
3
+ * Add `execution_runs.registration_window_instance_id TEXT NULL` — the
4
+ * coordinator whose dispatch pipeline still has jobs to register for this run.
5
+ *
6
+ * A run is registered before all of its jobs exist: with its source-pack build
7
+ * job alone, or with no jobs at all ahead of its dispatch loop, and the real
8
+ * jobs land only once the build finishes or every dispatch has returned. The
9
+ * coordinator running that pipeline holds an in-memory token that keeps its
10
+ * own completion check from finalizing the run on the jobs registered so far.
11
+ *
12
+ * The dispatch queue is cluster-wide, so a job may be claimed by an agent
13
+ * connected to a sibling coordinator, and that sibling rehydrates the run from
14
+ * the database when the agent reports on it. The sibling has no token, so
15
+ * once the jobs it knows about are terminal it finalizes the run — on a build
16
+ * job alone, that is a green run in which nothing ran. This column is the
17
+ * token's durable form: the owner writes its instance id when it takes its
18
+ * first token and clears it when it drops its last, and every finalization
19
+ * path defers while the column names a live sibling.
20
+ *
21
+ * Nullable, with no default: NULL means "no coordinator has a registration
22
+ * window open", which is true of every run whose owner released its window
23
+ * and of every row written before this column existed. A dead holder's id
24
+ * reads as no window at all — liveness comes from `cluster_instances`, the
25
+ * same way the dispatch plane reads `dispatch_queue.owner_instance_id`.
26
+ *
27
+ * Idempotent: the add is guarded on existence and the drop uses IF EXISTS, so a
28
+ * re-run is a no-op.
29
+ */
30
+ export declare function up(db: Kysely<unknown>): Promise<void>;
31
+ export declare function down(db: Kysely<unknown>): Promise<void>;
32
+ //# sourceMappingURL=144_execution_runs_registration_window.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import type { ColumnType, Generated, Insertable, Selectable, Updateable } from 'kysely';
2
2
  import type { ApprovalRequirement, ApproverClause, InitFailure, StepApprovalPayload } from '@kici-dev/engine';
3
+ import type { PrecursorResult } from '../cache/precursor-result.js';
3
4
  /**
4
5
  * Job kind stored in `execution_jobs.job_kind`. `Standard` runs steps on an
5
6
  * agent; `Gate` is an invoke gate that summons source-repo runs; `Proxy`
@@ -252,8 +253,6 @@ export interface DispatchQueueTable {
252
253
  provider_context: Generated<string>;
253
254
  /** Pre-packed `.kici/` source tarball URL (from cache). Nullable. */
254
255
  source_tar_url: string | null;
255
- /** SHA-256 hash of the source tarball bytes for integrity verification. Nullable. */
256
- source_tar_hash: string | null;
257
256
  source_tar_digest: string | null;
258
257
  /** Pre-built dependency tarball URL (from dep cache). Nullable. */
259
258
  deps_url: string | null;
@@ -712,6 +711,18 @@ export interface ExecutionRunTable {
712
711
  * breaker bounds recursion. Defaults to 0.
713
712
  */
714
713
  chain_depth: Generated<number>;
714
+ /**
715
+ * The coordinator whose dispatch pipeline still has jobs to register for
716
+ * this run — the durable form of the in-memory pending-jobs token
717
+ * (`ExecutionTracker.holdRunForPendingJobs`). The owner writes its instance
718
+ * id when it takes its first token and clears it when it drops its last;
719
+ * every finalization path defers while the column names a LIVE sibling
720
+ * (liveness from `cluster_instances`, the same read the dispatch queue's
721
+ * `owner_instance_id` predicates use). A dead holder's id reads as no
722
+ * window. NULL for every run with no window open and every row written
723
+ * before the column existed.
724
+ */
725
+ registration_window_instance_id: string | null;
715
726
  }
716
727
  /**
717
728
  * Execution job table
@@ -859,6 +870,16 @@ export interface ExecutionJobTable {
859
870
  * proxies have not all terminalized in time. NULL = no gate timeout.
860
871
  */
861
872
  timeout_ms: number | null;
873
+ /**
874
+ * The precursor payload a build / init / dynamic-eval job reported on its
875
+ * terminal `job.status` (shape: `PrecursorResult`), persisted so a
876
+ * coordinator other than the one whose agent ran the job can settle its
877
+ * pending tracker from the shared row. JSONB: the driver returns a parsed
878
+ * object on SELECT, while writers pass a `JSON.stringify` string. NULL for
879
+ * every ordinary job and for a precursor job that has not reached a
880
+ * terminal state.
881
+ */
882
+ precursor_result: ColumnType<PrecursorResult | null, string | null | undefined, string | null>;
862
883
  }
863
884
  /**
864
885
  * Execution step table
@@ -1809,8 +1830,6 @@ export interface OrgSettingsTable {
1809
1830
  customer_id: string;
1810
1831
  /** Repos allowed to author global workflows (null = any repo can author) */
1811
1832
  global_workflow_allowed_repos: ColumnType<OrgSettingsRepoPatternEntry[] | null, OrgSettingsRepoPatternEntry[] | null | undefined | string, OrgSettingsRepoPatternEntry[] | null | string>;
1812
- /** Repos with elevated trust for global workflow execution (null = none) */
1813
- global_workflow_elevated_repos: ColumnType<OrgSettingsRepoPatternEntry[] | null, OrgSettingsRepoPatternEntry[] | null | undefined | string, OrgSettingsRepoPatternEntry[] | null | string>;
1814
1833
  /**
1815
1834
  * Repos explicitly denied as event sources for global workflows.
1816
1835
  * Deny takes precedence over the allow-list (null = no deny patterns).
@@ -1962,19 +1981,15 @@ export type OrgSettingsUpdate = Updateable<OrgSettingsTable>;
1962
1981
  * tunes org_settings, the Platform owns this. `source` records which of the two
1963
1982
  * wrote the row.
1964
1983
  *
1965
- * The three policy columns are plain `string`, not the Zod enums that name the
1966
- * known vocabulary — same reasoning as `held_runs.hold_type`: a value written by
1967
- * a newer Platform must still be readable rather than failing the row.
1984
+ * The policy column is plain `string`, not the Zod enum that names the known
1985
+ * vocabulary — same reasoning as `held_runs.hold_type`: a value written by a
1986
+ * newer Platform must still be readable rather than failing the row.
1968
1987
  */
1969
1988
  export interface OrgTrustPolicyTable {
1970
1989
  /** Customer/org identifier (primary key) */
1971
1990
  customer_id: string;
1972
- /** How to treat a pull request opened from a fork: hold | reject | allow */
1991
+ /** How to treat a pull request opened from a fork: ignore | hold | allow */
1973
1992
  fork_policy: string;
1974
- /** How to treat a PR from a contributor with no resolved identity: hold | reject */
1975
- unknown_contributor_policy: string;
1976
- /** How to treat a PR that modifies workflow files: hold | reject | allow */
1977
- workflow_change_policy: string;
1978
1993
  /**
1979
1994
  * The coarse, hours-granularity view of the security-hold window.
1980
1995
  *
@@ -2082,7 +2097,6 @@ export interface ClusterSettingsTable {
2082
2097
  event_log_max_payload_bytes: ColumnType<string | null, number | null | undefined, number | null>;
2083
2098
  lock_file_max_bytes: ColumnType<string | null, number | null | undefined, number | null>;
2084
2099
  webhook_dedup_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
2085
- contributor_cache_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
2086
2100
  event_router_event_ttl_seconds: ColumnType<number | null, number | null | undefined, number | null>;
2087
2101
  event_router_max_dispatch_attempts: ColumnType<number | null, number | null | undefined, number | null>;
2088
2102
  queue_max_depth: ColumnType<number | null, number | null | undefined, number | null>;