@kici-dev/orchestrator 0.1.20 → 0.1.22

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 (71) hide show
  1. package/dist/agent/dispatcher.d.ts +44 -0
  2. package/dist/agent/host-roster-reaper.d.ts +2 -1
  3. package/dist/agent/host-roster.d.ts +54 -1
  4. package/dist/agent/registry.d.ts +22 -0
  5. package/dist/app.d.ts +5 -0
  6. package/dist/approvals/step-approval-bridge.d.ts +5 -0
  7. package/dist/cli/commands/source-manifest.d.ts +42 -0
  8. package/dist/cli/loopback-callback.d.ts +24 -0
  9. package/dist/cli/open-browser.d.ts +12 -0
  10. package/dist/cli/service/compose.d.ts +13 -0
  11. package/dist/cli/service/deploy-env.d.ts +31 -0
  12. package/dist/cli.js +1204 -256
  13. package/dist/cluster/coordinator.d.ts +5 -3
  14. package/dist/cluster/index.d.ts +2 -0
  15. package/dist/cluster/join-token.d.ts +27 -5
  16. package/dist/cluster/peer-auth-coordinator.d.ts +36 -0
  17. package/dist/cluster/peer-client.d.ts +34 -14
  18. package/dist/cluster/peer-credentials.d.ts +14 -2
  19. package/dist/cluster/peer-handler.d.ts +2 -2
  20. package/dist/cluster/rerouted-job-guard.d.ts +39 -0
  21. package/dist/config.d.ts +6 -0
  22. package/dist/dashboard/needs-edges.d.ts +4 -3
  23. package/dist/db/migrations/043_rerouted_to_peer.d.ts +4 -0
  24. package/dist/db/migrations/044_check_mode.d.ts +4 -0
  25. package/dist/db/migrations/045_host_properties.d.ts +16 -0
  26. package/dist/db/migrations/046_join_token_consumed_by_instance.d.ts +17 -0
  27. package/dist/db/migrations/047_needs_run_on.d.ts +4 -0
  28. package/dist/db/migrations/048_host_reboot_pending.d.ts +19 -0
  29. package/dist/db/migrations/049_held_runs_payload.d.ts +14 -0
  30. package/dist/db/migrations/050_sources_slug.d.ts +17 -0
  31. package/dist/db/types.d.ts +60 -5
  32. package/dist/deployment/deployment-identity.d.ts +9 -0
  33. package/dist/entry-helpers.d.ts +7 -0
  34. package/dist/environments/held-runs.d.ts +7 -1
  35. package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +77 -0
  36. package/dist/index.d.ts +5 -1
  37. package/dist/index.js +1187 -33
  38. package/dist/lockfile-validate.d.ts +24 -0
  39. package/dist/orchestrator-core.d.ts +13 -1
  40. package/dist/pipeline/decorating-secret-resolver.d.ts +32 -0
  41. package/dist/pipeline/dispatch-matched-workflow.d.ts +127 -3
  42. package/dist/pipeline/install-secrets-resolver.d.ts +2 -2
  43. package/dist/pipeline/needs-scheduler.d.ts +22 -13
  44. package/dist/pipeline/processor.d.ts +2 -2
  45. package/dist/pipeline/test-pipeline.d.ts +37 -58
  46. package/dist/providers/github/manifest-form.d.ts +15 -0
  47. package/dist/providers/github/manifest.d.ts +103 -0
  48. package/dist/reporting/execution-tracker.d.ts +10 -1
  49. package/dist/routes/admin-sources.d.ts +18 -0
  50. package/dist/routes/admin.d.ts +8 -0
  51. package/dist/secrets/pg-secret-store.d.ts +9 -0
  52. package/dist/secrets/secret-resolver.d.ts +16 -1
  53. package/dist/server.js +4373 -2322
  54. package/dist/sources/source-store.d.ts +4 -0
  55. package/dist/sources/source-validator.d.ts +2 -0
  56. package/dist/stale-detector/reboot-deadline-sweep.d.ts +29 -0
  57. package/dist/stale-detector/stale-run-detector.d.ts +8 -0
  58. package/dist/standalone.js +3582 -1932
  59. package/dist/worker/in-memory-job-queue.d.ts +17 -0
  60. package/dist/worker/peer-outbox.d.ts +36 -0
  61. package/dist/worker/worker-outbox-relay.d.ts +13 -0
  62. package/dist/ws/agent-handler.d.ts +11 -6
  63. package/dist/ws/dashboard-fleet-handler.d.ts +33 -0
  64. package/dist/ws/dashboard-fleet-write-handler.d.ts +60 -0
  65. package/dist/ws/fleet-runs-on-all.d.ts +16 -0
  66. package/dist/ws/inventory-api.d.ts +17 -0
  67. package/dist/ws/platform-client.d.ts +13 -1
  68. package/dist/ws/test-relay-handlers.d.ts +4 -2
  69. package/installer-image-digests.json +3 -3
  70. package/package.json +4 -4
  71. package/sbom.spdx.json +77 -128
@@ -4,7 +4,7 @@
4
4
  * Manages the lifecycle: pending -> approved/rejected/expired.
5
5
  */
6
6
  import { type Kysely } from 'kysely';
7
- import { type ApprovalRequirement, type ApproverClause, ApprovalDecision, HoldScope, TriggerSource } from '@kici-dev/engine';
7
+ import { type ApprovalRequirement, type ApproverClause, type StepApprovalPayload, ApprovalDecision, HoldScope, TriggerSource } from '@kici-dev/engine';
8
8
  import type { Database, HeldRun, HeldRunApproval } from '../db/types.js';
9
9
  /** Status values for held runs (held_runs table). */
10
10
  export declare enum HeldRunStatus {
@@ -51,6 +51,12 @@ export interface CreateHoldData {
51
51
  * the automated release sweeps can find their rows.
52
52
  */
53
53
  holdType?: string;
54
+ /**
55
+ * Drift payload `{ summaryMarkdown, drift }` captured for a `when: 'drift'`
56
+ * step gate; persisted to `held_runs.payload` and surfaced in the dashboard
57
+ * approval queue + the CLI. Omit for non-drift holds.
58
+ */
59
+ payload?: StepApprovalPayload;
54
60
  }
55
61
  /** A single decision to record against a hold. */
56
62
  export interface RecordDecisionData {
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Daily refresh of every GitHub source's display name + slug from GitHub.
3
+ *
4
+ * GitHub is the source of truth for a GitHub-App source's display name and
5
+ * slug. They are captured at creation, but an operator can rename the App in
6
+ * the GitHub UI afterwards — this periodic task re-fetches `GET /app` for each
7
+ * GitHub source and, when the name or slug drifted, writes the new values to
8
+ * the `sources` row. The `sources_change` DB trigger then fans the change out
9
+ * (SourceManager reload → `platformClient.updateSources()` → re-register), so
10
+ * the Platform `webhook_sources` row and the dashboard Sources tab pick up the
11
+ * new name/slug without any extra plumbing here.
12
+ *
13
+ * Lifecycle mirrors `StaleRunDetector`: `start()` runs an immediate refresh
14
+ * (so a rename made while the orchestrator was down propagates on next boot)
15
+ * then a `setInterval`; `stop()` clears it. Per-source errors are logged and
16
+ * never abort the loop.
17
+ */
18
+ /** The slice of {@link SourceStore} this module needs. */
19
+ export interface RefreshableSourceStore {
20
+ listSources(): Promise<Array<{
21
+ routing_key: string;
22
+ provider: string;
23
+ name: string;
24
+ slug: string | null;
25
+ }>>;
26
+ getSourceWithSecrets(routingKey: string): Promise<{
27
+ provider: string;
28
+ config: string;
29
+ privateKey: string;
30
+ } | null>;
31
+ updateSource(routingKey: string, updates: {
32
+ name?: string;
33
+ slug?: string | null;
34
+ }): Promise<unknown>;
35
+ }
36
+ /** Fetch a GitHub App's authoritative identity. Matches `fetchGithubAppIdentity`. */
37
+ export type FetchGithubAppIdentity = (creds: {
38
+ appId: string;
39
+ privateKey: string;
40
+ }) => Promise<{
41
+ name: string;
42
+ slug: string;
43
+ }>;
44
+ /** Outcome of a single source refresh. */
45
+ export interface RefreshResult {
46
+ routingKey: string;
47
+ changed: boolean;
48
+ oldName: string;
49
+ newName: string;
50
+ oldSlug: string | null;
51
+ newSlug: string;
52
+ }
53
+ /**
54
+ * Re-fetch one GitHub source's identity from GitHub and persist it when the
55
+ * name or slug drifted. Shared by the daily task and `kici-admin source
56
+ * refresh`. Throws for a missing or non-GitHub routing key.
57
+ */
58
+ export declare function refreshGithubSourceIdentity(sourceStore: RefreshableSourceStore, routingKey: string, fetchIdentity: FetchGithubAppIdentity): Promise<RefreshResult>;
59
+ export interface GithubAppNameRefresherDeps {
60
+ sourceStore: RefreshableSourceStore;
61
+ fetchIdentity: FetchGithubAppIdentity;
62
+ /** Refresh cadence in ms. Default cluster value: 24h (`config.githubAppNameRefreshIntervalMs`). */
63
+ scanIntervalMs: number;
64
+ }
65
+ export declare class GithubAppNameRefresher {
66
+ private readonly sourceStore;
67
+ private readonly fetchIdentity;
68
+ private readonly scanIntervalMs;
69
+ private interval;
70
+ constructor(deps: GithubAppNameRefresherDeps);
71
+ /** Immediate refresh then periodic scans. */
72
+ start(): Promise<void>;
73
+ stop(): void;
74
+ /** Refresh every GitHub source once. Per-source failures are isolated. */
75
+ refresh(): Promise<void>;
76
+ }
77
+ //# sourceMappingURL=github-app-name-refresher.d.ts.map
package/dist/index.d.ts CHANGED
@@ -4,5 +4,9 @@ export { createCacheStorage } from './storage/index.js';
4
4
  export { SourceCache } from './cache/source-cache.js';
5
5
  export { DepCache } from './cache/dep-cache.js';
6
6
  export { UserCache, DEFAULT_USER_CACHE_QUOTA_BYTES, DEFAULT_USER_CACHE_TTL_MS, type UserCacheRef, type UserCacheRestoreResult, type UserCacheBeginSaveResult, } from './cache/user-cache.js';
7
- export { PeerCredentialStore, createPeerCredentialStoreFromUrl, type PeerCredential, } from './cluster/peer-credentials.js';
7
+ export { PeerCredentialStore, createPeerCredentialStoreFromUrl, type PeerCredential, type CredentialFileData, } from './cluster/peer-credentials.js';
8
+ export { PeerAuthCoordinator, type AuthDecision, type RejectionAction, } from './cluster/peer-auth-coordinator.js';
9
+ export { JoinTokenManager, createJoinTokenManagerFromUrl } from './cluster/join-token.js';
10
+ export { AdminApiClient } from './cli/api-client.js';
11
+ export { runGithubManifestSetup, type ManifestSetupOptions, type ManifestSetupDeps, } from './cli/commands/source-manifest.js';
8
12
  //# sourceMappingURL=index.d.ts.map