@kici-dev/orchestrator 0.9.1 → 0.11.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 (101) hide show
  1. package/dist/__test-helpers__/test-db.d.ts +14 -1
  2. package/dist/agent/dispatcher.d.ts +137 -41
  3. package/dist/agent/registry.d.ts +79 -2
  4. package/dist/app.d.ts +2 -0
  5. package/dist/cancel/cancel-held-run.d.ts +68 -0
  6. package/dist/cancel/cancel-route-answer.d.ts +21 -0
  7. package/dist/cancel/cancel-run.d.ts +32 -0
  8. package/dist/cli/api-client.d.ts +23 -1
  9. package/dist/cli/commands/attestations.d.ts +10 -0
  10. package/dist/cli/commands/cold-store-impl.d.ts +3 -3
  11. package/dist/cli/commands/cold-store.d.ts +6 -3
  12. package/dist/cli/commands/context.d.ts +6 -2
  13. package/dist/cli/commands/dashboard-encryption-key.d.ts +18 -0
  14. package/dist/cli/commands/event-dlq.d.ts +2 -2
  15. package/dist/cli/commands/registration.d.ts +8 -4
  16. package/dist/cli/commands/runs.d.ts +7 -0
  17. package/dist/cli/commands/secret.d.ts +1 -0
  18. package/dist/cli/commands/shared/confirm.d.ts +19 -0
  19. package/dist/cli/commands/shared/unbound-context-warning.d.ts +43 -0
  20. package/dist/cli/commands/signing-key.d.ts +22 -1
  21. package/dist/cli.js +1522 -871
  22. package/dist/cluster/cluster-settings-reader.d.ts +1 -1
  23. package/dist/cluster/coordinator.d.ts +2 -0
  24. package/dist/cluster/live-coordinator-peer.d.ts +13 -0
  25. package/dist/config.d.ts +9 -0
  26. package/dist/contexts/context-store.d.ts +3 -2
  27. package/dist/contexts/protection/satisfiability.d.ts +6 -3
  28. package/dist/contexts/variable-store.d.ts +2 -0
  29. package/dist/db/migrations/145_execution_runs_workflow_provenance.d.ts +4 -0
  30. package/dist/db/migrations/146_pending_job_contexts_context_resolution.d.ts +4 -0
  31. package/dist/db/migrations/147_sealed_job_secrets.d.ts +19 -0
  32. package/dist/db/migrations/148_cluster_settings_sealed_secrets_retry_backoff_ms.d.ts +21 -0
  33. package/dist/db/migrations/149_workflow_registrations_dep_cache_key.d.ts +4 -0
  34. package/dist/db/migrations/150_execution_runs_status_epoch.d.ts +18 -0
  35. package/dist/db/migrations/151_workflow_registrations_dep_cache_key_sha.d.ts +4 -0
  36. package/dist/db/repos/signing-keys-repo.d.ts +48 -3
  37. package/dist/db/types.d.ts +81 -1
  38. package/dist/git/clone-token-auth.d.ts +7 -0
  39. package/dist/git/dispatch-git-auth.d.ts +63 -0
  40. package/dist/index.js +26 -0
  41. package/dist/lockfile-validate.d.ts +4 -2
  42. package/dist/metrics/prometheus.d.ts +1 -1
  43. package/dist/oidc/id-token-claims.d.ts +10 -0
  44. package/dist/oidc/oidc-mint-registration.d.ts +2 -0
  45. package/dist/oidc/orchestrator-mint.d.ts +25 -4
  46. package/dist/oidc/reconcile-signing-key.d.ts +31 -6
  47. package/dist/oidc/resolve-signer.d.ts +12 -6
  48. package/dist/pipeline/decorating-secret-resolver.d.ts +5 -3
  49. package/dist/pipeline/dispatch-matched-workflow.d.ts +105 -13
  50. package/dist/pipeline/dispatch-matched-workflow.test-helpers.d.ts +121 -0
  51. package/dist/pipeline/global-dispatch-identity.d.ts +76 -0
  52. package/dist/pipeline/global-dispatch.d.ts +91 -0
  53. package/dist/pipeline/global-eval-round.d.ts +56 -4
  54. package/dist/pipeline/global-round-hold.d.ts +41 -0
  55. package/dist/pipeline/held-context-data.d.ts +143 -0
  56. package/dist/pipeline/held-round-registrations.d.ts +40 -0
  57. package/dist/pipeline/install-gate.d.ts +93 -0
  58. package/dist/pipeline/install-secrets-resolver.d.ts +28 -13
  59. package/dist/pipeline/job-contexts.d.ts +21 -6
  60. package/dist/pipeline/pending-workflow-context.d.ts +15 -3
  61. package/dist/pipeline/process-webhook.d.ts +38 -1
  62. package/dist/pipeline/processor.d.ts +20 -0
  63. package/dist/pipeline/rerun-global.d.ts +28 -0
  64. package/dist/pipeline/rerun-inputs.d.ts +88 -0
  65. package/dist/pipeline/rerun.d.ts +25 -2
  66. package/dist/pipeline/resume-workflow.d.ts +36 -2
  67. package/dist/pipeline/unbound-job-context.d.ts +34 -0
  68. package/dist/pipeline/workflow-lock-at-sha.d.ts +67 -0
  69. package/dist/provenance/backfill-run.d.ts +5 -0
  70. package/dist/providers/github/check-status-poster.d.ts +4 -16
  71. package/dist/queue/job-queue.d.ts +127 -10
  72. package/dist/queue/terminalize-unroutable.d.ts +37 -4
  73. package/dist/registration/registration-index.d.ts +13 -1
  74. package/dist/registration/registration-store.d.ts +10 -1
  75. package/dist/reporting/execution-tracker.d.ts +149 -8
  76. package/dist/reporting/log-chunk-sink.d.ts +1 -1
  77. package/dist/reporting/log-writer.d.ts +14 -0
  78. package/dist/reporting/step-log-path.d.ts +8 -0
  79. package/dist/reporting/step-log-reader.d.ts +21 -3
  80. package/dist/routes/admin-contexts.d.ts +6 -0
  81. package/dist/routes/admin-registrations.d.ts +2 -2
  82. package/dist/routes/admin-signing-keys.d.ts +33 -0
  83. package/dist/scaler/agent-fit.d.ts +159 -0
  84. package/dist/scaler/container-routing.d.ts +16 -16
  85. package/dist/scaler/manager.d.ts +23 -17
  86. package/dist/secrets/audit-logger.d.ts +1 -1
  87. package/dist/secrets/context-secret-resolver.d.ts +1 -1
  88. package/dist/secrets/index.d.ts +1 -1
  89. package/dist/secrets/job-secret-gate.d.ts +25 -3
  90. package/dist/secrets/job-secret-seal.d.ts +36 -0
  91. package/dist/secrets/master-key-rotation.d.ts +7 -3
  92. package/dist/secrets/secret-resolver.d.ts +42 -23
  93. package/dist/server.js +27611 -23219
  94. package/dist/standalone.js +58327 -53119
  95. package/dist/worker/in-memory-job-queue.d.ts +12 -3
  96. package/dist/worker/reroute-dispatch.d.ts +35 -0
  97. package/dist/ws/agent-handler.d.ts +23 -10
  98. package/dist/ws/git-credential-relay.d.ts +16 -3
  99. package/installer-image-digests.json +3 -3
  100. package/package.json +4 -4
  101. package/sbom.spdx.json +53 -53
@@ -1,3 +1,13 @@
1
+ /**
2
+ * `kici-admin attestations` — orchestrator-DB-direct provenance maintenance.
3
+ *
4
+ * attestations reverify [--all] Recompute stored verdicts (verify-at-ingest
5
+ * backfill). Default scope: pending /
6
+ * unverifiable rows; `--all` re-evaluates
7
+ * every row. Direct DB + object storage.
8
+ *
9
+ * Classified `kici-admin` (orchestrator DB plane) per .claude/rules/platform-admin.md.
10
+ */
1
11
  import type { Command } from 'commander';
2
12
  import type { AdminApiClient } from '../api-client.js';
3
13
  export declare function registerAttestationsCommands(program: Command, getClient: () => AdminApiClient): void;
@@ -45,7 +45,7 @@ export declare function replayChunk(opts: {
45
45
  instanceId?: string;
46
46
  }): Promise<void>;
47
47
  /**
48
- * Phase F — promote a chunk's rows BACK into the orchestrator PG.
48
+ * Promote a chunk's rows back into the orchestrator PG.
49
49
  * Mirrors the Platform-side `replayIntoPg`. Adapter must implement
50
50
  * `replayInsert` — currently only `execution_runs`.
51
51
  */
@@ -65,7 +65,7 @@ export declare function reconcile(opts: {
65
65
  instanceId?: string;
66
66
  }): Promise<void>;
67
67
  /**
68
- * Phase 2 — list chunks past their cold-retention horizon. Read-only;
68
+ * List chunks past their cold-retention horizon. Read-only;
69
69
  * no S3 or PG mutation. Emits one JSON line per row so the output is
70
70
  * easy to pipe through `jq` / `column -t` / etc.
71
71
  */
@@ -77,7 +77,7 @@ export declare function listPurgeable(opts: {
77
77
  instanceId?: string;
78
78
  }): Promise<void>;
79
79
  /**
80
- * Phase 2 — delete S3 objects + clean up PG bookkeeping for chunks
80
+ * Delete S3 objects + clean up PG bookkeeping for chunks
81
81
  * past their cold-retention horizon. Defaults to dry-run; pass
82
82
  * `--apply` to actually delete.
83
83
  */
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Cold-store commands for kici-admin (orchestrator side).
3
3
  *
4
- * Phase C: every subcommand has a real implementation that builds an
5
- * `OrchestratorColdStore` against the orchestrator Postgres + S3 and
6
- * delegates to the helpers in `cold-store-impl.ts`. Mirrors
4
+ * Every subcommand builds an `OrchestratorColdStore` against the
5
+ * orchestrator Postgres + S3 and delegates to the helpers in
6
+ * `cold-store-impl.ts`. Mirrors
7
7
  * `kici-platform-admin cold-store …` on the Platform side.
8
8
  *
9
9
  * cold-store archive-now <table> Run one cycle for a single adapter
@@ -11,7 +11,10 @@
11
11
  * cold-store list-chunks <table> List chunks for a table
12
12
  * cold-store verify-chunk <chunkId> Recompute contentHash for a chunk
13
13
  * cold-store replay-chunk <chunkId> Re-run UPDATE+DELETE for a stuck chunk
14
+ * cold-store replay-into-pg <chunkId> Promote a chunk's rows back into PG
14
15
  * cold-store reconcile <table> Rebuild orphaned manifests from data
16
+ * cold-store list-purgeable List chunks past cold retention
17
+ * cold-store purge-now Purge expired chunks (dry-run default)
15
18
  * cold-store peek-chunk <chunkId> Stream the first N rows of a chunk
16
19
  *
17
20
  * The CLI talks **directly** to the orchestrator Postgres (and the same
@@ -3,13 +3,15 @@
3
3
  *
4
4
  * context create — upsert a context
5
5
  * context bind — bind a scope pattern to a context
6
- * context set-policy — update policy fields (branch, reviewers, timers, trust)
6
+ * context set-policy — update policy fields (branch, repo patterns, reviewers, timers, trust)
7
7
  * context list — list contexts for an org
8
8
  * context show — show a single context with variables + bindings
9
9
  * context delete — delete a context (cascades bindings, variables, overrides; held-run history survives; pending held runs block with a clear error, resolved holds do not)
10
10
  * context create-template — create/update a context template + its seed variables
11
+ * context source-override list|set|delete — per-source variable overrides (HTTP only)
11
12
  *
12
- * Each command supports two modes (stage-4 pattern from `maintenance.ts`):
13
+ * Each command except `source-override` supports two modes, the same split
14
+ * `maintenance.ts` uses:
13
15
  *
14
16
  * HTTP mode (default): requires `--url` + `--token`, routes through the
15
17
  * orchestrator admin HTTP API at /api/v1/admin/contexts.
@@ -21,5 +23,7 @@
21
23
  */
22
24
  import type { Command } from 'commander';
23
25
  import type { AdminApiClient } from '../api-client.js';
26
+ /** `--enabled`: absent stays undefined (keep the stored flag); only `false` disables. */
27
+ export declare function parseEnabledOption(raw: string | undefined): boolean | undefined;
24
28
  export declare function registerContextCommands(program: Command, getClient: () => AdminApiClient): void;
25
29
  //# sourceMappingURL=context.d.ts.map
@@ -1,3 +1,21 @@
1
+ /**
2
+ * `kici-admin dashboard-encryption-key` — the orchestrator's X25519
3
+ * dashboard-encryption key: the trust root a browser seals a secret / variable
4
+ * value to under the `encrypted` dashboard-write posture, so the hosted control
5
+ * plane relays only opaque ciphertext.
6
+ *
7
+ * dashboard-encryption-key show Print the active kid, its public JWK, where
8
+ * the JWKS is published, and the Verified-tier
9
+ * URL (when that tier is opted into).
10
+ * dashboard-encryption-key list List every key on record (kid / status / created_at).
11
+ * dashboard-encryption-key rotate Mint a new active key; the prior active key
12
+ * is retired from the published JWKS, but its
13
+ * private half stays on record so envelopes
14
+ * already sealed to it still decrypt.
15
+ *
16
+ * The PRIVATE half is master-key wrapped (`KICI_SECRET_KEY`) in the orchestrator
17
+ * DB and is never exportable — recovery from a lost key is a routine rotation.
18
+ */
1
19
  import type { Command } from 'commander';
2
20
  export declare function registerDashboardEncryptionKeyCommands(program: Command): void;
3
21
  //# sourceMappingURL=dashboard-encryption-key.d.ts.map
@@ -6,8 +6,8 @@
6
6
  * event-dlq retry <id> — clear DLQ flag, schedule for retry, pg_notify
7
7
  * event-dlq discard <id> — permanently delete a DLQ event
8
8
  *
9
- * Operator dogfooding path for at-least-once event delivery (Phase 5 of the
10
- * event durability work). Customers should generally never see anything in
9
+ * Operator dogfooding path for at-least-once event delivery. Customers
10
+ * should generally never see anything in
11
11
  * the DLQ — when something lands here it usually means a workflow handler is
12
12
  * consistently failing and should be fixed at its root cause. This CLI is the
13
13
  * triage surface: inspect last_error, retry once a fix is deployed, or discard
@@ -1,16 +1,20 @@
1
1
  /**
2
- * Workflow registration read CLI commands for kici-admin (5a #4).
2
+ * Workflow registration CLI commands for kici-admin.
3
3
  *
4
4
  * registration list [--org <id>] [--routing-key <k>] [--repo <ident>] [--limit <n>]
5
5
  * registration show <id>
6
+ * registration disable <id> | enable <id>
7
+ * registration delete <id> [--yes]
6
8
  *
7
9
  * A distinct namespace from `workflow list` — `workflow` is workflow-code,
8
10
  * `registration` is the registered-workflow-instance row in
9
- * workflow_registrations. Both coexist; the existing `workflow list` is
10
- * untouched by this plan.
11
+ * workflow_registrations. Both coexist.
11
12
  *
12
- * Dual-mode: HTTP (via AdminApiClient on the existing
13
+ * `list` and `show` are dual-mode: HTTP (via AdminApiClient on the
13
14
  * /api/v1/admin/registrations admin API) or `--database-url` (direct DB).
15
+ * `disable`, `enable` and `delete` are HTTP only: they are the operator path
16
+ * for the dashboard's registration writes, and the admin route bumps the
17
+ * registry version so every peer reloads.
14
18
  */
15
19
  import type { Command } from 'commander';
16
20
  import type { AdminApiClient } from '../api-client.js';
@@ -28,6 +28,13 @@
28
28
  */
29
29
  import type { Command } from 'commander';
30
30
  import type { AdminApiClient } from '../api-client.js';
31
+ import { type AgentStepLogs } from '@kici-dev/engine';
32
+ /**
33
+ * The note `runs logs` prints when a step has no lines: whether no log was ever
34
+ * recorded, or a log is stored and holds nothing. `null` when the step has
35
+ * lines, or when the orchestrator does not report which case applies.
36
+ */
37
+ export declare function emptyStepLogNote(stepIndex: number, logs: Pick<AgentStepLogs, 'totalLines' | 'recorded'>): string | null;
31
38
  /**
32
39
  * Register the `runs` command group with kici-admin.
33
40
  */
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * Provides scoped secret operations:
5
5
  * secret scopes, list, set, delete, fix-prefixed-scopes
6
+ * secret scope create|rename|delete
6
7
  *
7
8
  * Secret values are write-only -- there is no "get value" command.
8
9
  */
@@ -0,0 +1,19 @@
1
+ /** Message of the error raised when stdin ends before the operator answers. */
2
+ export declare const NO_CONFIRMATION_ANSWER: string;
3
+ /** The streams the prompt writes to and reads from. */
4
+ export interface ConfirmIo {
5
+ input: NodeJS.ReadableStream;
6
+ output: NodeJS.WritableStream;
7
+ }
8
+ /**
9
+ * Write `prompt` and read one line of answer.
10
+ *
11
+ * Resolves true when the line is `y` or `yes` (any case, surrounding spaces
12
+ * ignored) and false for any other line. Rejects with
13
+ * {@link NO_CONFIRMATION_ANSWER} when stdin ends before a line arrives, as it
14
+ * does for a script, a cron job or a `< /dev/null` redirect. Resolving false
15
+ * there would let a verb run without `--yes` exit 0 having done nothing, and
16
+ * the script that ran it would read that as success.
17
+ */
18
+ export declare function confirmPrompt(prompt: string, io?: ConfirmIo): Promise<boolean>;
19
+ //# sourceMappingURL=confirm.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The warning `kici-admin context create` and `kici-admin secret set` print
3
+ * when a context's secrets cannot reach any job.
4
+ *
5
+ * A job that lists a context in its `contexts:` receives the context's
6
+ * secrets only through the context's scope bindings: the secret resolver reads
7
+ * the bindings of the context row the job's declared name matched — a fixed
8
+ * context by its exact name, a glob context by its pattern — and returns
9
+ * nothing when there are none. So such a context with no binding delivers no
10
+ * secret to those jobs, whatever its scopes hold, and nothing fails loudly — a
11
+ * workflow's `ctx.secrets.get()` throws at run time instead. A
12
+ * `<context>:<key>` git-credential or registry reference to a fixed context
13
+ * still reads the scope named after it, through a deprecated fallback; a glob
14
+ * context has no such fallback. The warning names the context, that fallback
15
+ * where it applies, and the `context bind` command that fixes it.
16
+ *
17
+ * Advisory only: the lookup runs after the command's own write succeeded, and
18
+ * a failed lookup prints nothing, so the command's exit code never changes.
19
+ */
20
+ import { ContextType } from '@kici-dev/engine';
21
+ /** The one admin API call the lookup needs, so any client shape satisfies it. */
22
+ export interface ContextLookupClient {
23
+ get<T>(path: string): Promise<T>;
24
+ }
25
+ export interface WarnIfContextUnboundArgs {
26
+ orgId: string;
27
+ /** The context name; for `secret set` this is the scope the secret was written to. */
28
+ name: string;
29
+ /** Direct-DB mode when set; otherwise the admin API through `client`. */
30
+ dbUrl: string | null;
31
+ client?: ContextLookupClient;
32
+ /** Where the warning goes; stderr by default. */
33
+ warn?: (line: string) => void;
34
+ }
35
+ /** The warning line for a context of `type` with no binding. */
36
+ export declare function unboundContextWarning(orgId: string, name: string, type: ContextType): string;
37
+ /**
38
+ * Print the unbound-context warning when `name` is a context a job can resolve
39
+ * through (a fixed or glob context, `ContextType`) that has no binding. A
40
+ * template row is a seed for other contexts, not a job context, and stays silent.
41
+ */
42
+ export declare function warnIfContextUnbound(args: WarnIfContextUnboundArgs): Promise<void>;
43
+ //# sourceMappingURL=unbound-context-warning.d.ts.map
@@ -1,3 +1,24 @@
1
1
  import type { Command } from 'commander';
2
- export declare function registerSigningKeyCommands(program: Command): void;
2
+ import { OrchestratorSigningKeyRepo } from '../../db/repos/signing-keys-repo.js';
3
+ import type { AdminApiClient } from '../api-client.js';
4
+ /** Outcome of {@link generateInitialSigningKey}. */
5
+ export type InitialSigningKeyOutcome = {
6
+ created: true;
7
+ kid: string;
8
+ } | {
9
+ created: false;
10
+ activeKid: string;
11
+ };
12
+ /**
13
+ * Generate the initial db-custody key and activate it only while no key is
14
+ * active. Orchestrator nodes create the key on their own, so a node may win the
15
+ * race after the command's check; the node's key then stays active, because the
16
+ * nodes already sign with it, and its kid is returned.
17
+ */
18
+ export declare function generateInitialSigningKey(repo: OrchestratorSigningKeyRepo, secretKey: string): Promise<InitialSigningKeyOutcome>;
19
+ /**
20
+ * Register `kici-admin signing-key`. `tryGetClient` returns null when no admin
21
+ * token is configured, so `list` can name both of its data sources.
22
+ */
23
+ export declare function registerSigningKeyCommands(program: Command, tryGetClient: () => AdminApiClient | null): void;
3
24
  //# sourceMappingURL=signing-key.d.ts.map