@kici-dev/orchestrator 0.1.3 → 0.1.6

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 (73) hide show
  1. package/dist/agent/dispatcher.d.ts +26 -0
  2. package/dist/agent/ownership-tracker.d.ts +45 -3
  3. package/dist/app.d.ts +9 -3
  4. package/dist/audit/access-log.d.ts +7 -0
  5. package/dist/cli/api-client.d.ts +14 -0
  6. package/dist/cli/commands/cluster-name.d.ts +18 -0
  7. package/dist/cli/commands/db.d.ts +9 -6
  8. package/dist/cli/commands/org-settings.d.ts +2 -1
  9. package/dist/cli/commands/shared/secret-input.d.ts +46 -0
  10. package/dist/cli/commands/variable.d.ts +18 -0
  11. package/dist/cli/service/index.d.ts +1 -0
  12. package/dist/cli/service/launchd.d.ts +19 -0
  13. package/dist/cli/service/privilege.d.ts +21 -0
  14. package/dist/cli/wizard/orchestrator-wizard.d.ts +4 -2
  15. package/dist/cli.js +1074 -225
  16. package/dist/cluster/coordinator.d.ts +3 -3
  17. package/dist/cluster/join-token.d.ts +21 -13
  18. package/dist/cluster/peer-client.d.ts +9 -0
  19. package/dist/config/cluster-id.d.ts +23 -0
  20. package/dist/config/cluster-name.d.ts +39 -0
  21. package/dist/config.d.ts +8 -0
  22. package/dist/dashboard/handler.d.ts +54 -2
  23. package/dist/db/migrations/019_generic_sources_change_notify.d.ts +25 -0
  24. package/dist/db/migrations/020_org_settings_dashboard_write_policy.d.ts +17 -0
  25. package/dist/db/migrations/021_check_run_tracking.d.ts +26 -0
  26. package/dist/db/migrations/022_scaler_manager_state.d.ts +29 -0
  27. package/dist/db/migrations/023_dispatch_queue_recovery_deadline.d.ts +26 -0
  28. package/dist/db/types.d.ts +137 -0
  29. package/dist/events/event-store.d.ts +9 -2
  30. package/dist/events/trust-store.d.ts +7 -0
  31. package/dist/events/types.d.ts +33 -0
  32. package/dist/metrics/scheduled-jobs.d.ts +26 -5
  33. package/dist/orchestrator-core.d.ts +16 -2
  34. package/dist/pipeline/processor.d.ts +2 -2
  35. package/dist/pipeline/rerun.d.ts +2 -2
  36. package/dist/pipeline/test-pipeline.d.ts +2 -2
  37. package/dist/policy/dashboard-write-policy.d.ts +115 -0
  38. package/dist/queue/job-queue.d.ts +54 -1
  39. package/dist/reporting/{commit-status.d.ts → check-run-reporter.d.ts} +94 -16
  40. package/dist/reporting/check-run-tracking-store.d.ts +133 -0
  41. package/dist/routes/admin-access-log.d.ts +1 -0
  42. package/dist/routes/admin-backends.d.ts +9 -1
  43. package/dist/routes/admin-cluster-name.d.ts +50 -0
  44. package/dist/routes/admin-db.d.ts +9 -1
  45. package/dist/routes/admin-environments.d.ts +10 -6
  46. package/dist/routes/admin-event-dlq.d.ts +1 -0
  47. package/dist/routes/admin-event-log.d.ts +1 -0
  48. package/dist/routes/admin-events.d.ts +19 -0
  49. package/dist/routes/admin-maintenance.d.ts +9 -1
  50. package/dist/routes/admin-org-settings.d.ts +10 -1
  51. package/dist/routes/admin-queue-execution.d.ts +1 -0
  52. package/dist/routes/admin-registrations.d.ts +1 -0
  53. package/dist/routes/admin-runs.d.ts +1 -0
  54. package/dist/routes/admin-scheduled-jobs.d.ts +1 -0
  55. package/dist/routes/admin-sources.d.ts +24 -1
  56. package/dist/routes/admin.d.ts +22 -0
  57. package/dist/scaler/manager.d.ts +38 -0
  58. package/dist/scaler/scaler-state-store.d.ts +102 -0
  59. package/dist/secrets/routing-key-scope.d.ts +43 -0
  60. package/dist/server.js +10098 -6961
  61. package/dist/sources/build-platform-sources.d.ts +26 -0
  62. package/dist/sources/source-manager.d.ts +14 -0
  63. package/dist/stale-detector/stale-run-detector.d.ts +17 -5
  64. package/dist/standalone.js +7525 -5172
  65. package/dist/webhook/generic-sources-listener.d.ts +89 -0
  66. package/dist/webhook/register-source-bundle.d.ts +57 -0
  67. package/dist/ws/dashboard-backends-handler.d.ts +14 -0
  68. package/dist/ws/dashboard-env-handler.d.ts +7 -0
  69. package/dist/ws/dashboard-global-workflows-handler.d.ts +6 -0
  70. package/dist/ws/dashboard-registrations-handler.d.ts +7 -0
  71. package/dist/ws/platform-client.d.ts +57 -2
  72. package/package.json +3 -3
  73. package/sbom.spdx.json +40 -35
@@ -0,0 +1,26 @@
1
+ import type { AppConfig } from '../config.js';
2
+ import type { SourceManager } from './source-manager.js';
3
+ import type { ProviderSource } from '../entry-helpers.js';
4
+ /** One active generic-webhook routing-key row (subset consumed here). */
5
+ export interface GenericRoutingKeyRow {
6
+ routing_key: string;
7
+ provider_type: string;
8
+ name: string;
9
+ has_git_config: boolean;
10
+ }
11
+ /**
12
+ * Build the full provider-source list the orchestrator advertises to the
13
+ * Platform: GitHub-app sources from the {@link SourceManager} plus every
14
+ * *servable* generic-webhook source.
15
+ *
16
+ * Used both at boot and by the live republish closure (platform mode). It MUST
17
+ * return the complete set every time — a live source change re-sends the whole
18
+ * list via `platformClient.updateSources()`, which diffs against the previously
19
+ * sent set; a partial list would make the Platform deregister the sources that
20
+ * happened to be omitted.
21
+ *
22
+ * The generic-row loader is injected (rather than taking a `db`) so the merge
23
+ * logic is unit-testable without a live database.
24
+ */
25
+ export declare function buildPlatformProviderSources(sourceManager: Pick<SourceManager, 'getSources'>, loadGenericRows: () => Promise<GenericRoutingKeyRow[]>, config: AppConfig): Promise<ProviderSource[]>;
26
+ //# sourceMappingURL=build-platform-sources.d.ts.map
@@ -42,7 +42,21 @@ export declare class SourceManager {
42
42
  private currentSources;
43
43
  private debounceTimer;
44
44
  private readonly debounceMs;
45
+ /**
46
+ * Change callback. Stored in a mutable field (not read off `opts`) so a
47
+ * mode-specific hook can rewire it after construction — the platform-mode
48
+ * boot wires it to push the full source list to the Platform via
49
+ * `platformClient.updateSources()`. Defaults to the (possibly no-op) value
50
+ * passed at construction.
51
+ */
52
+ private onSourcesChanged;
45
53
  constructor(opts: SourceManagerOptions);
54
+ /**
55
+ * Replace the change callback after construction. The SourceManager is built
56
+ * early (before the Platform client exists); the platform-mode boot calls
57
+ * this once the client is ready so live source changes propagate upstream.
58
+ */
59
+ setOnSourcesChanged(cb: SourceManagerOptions['onSourcesChanged']): void;
46
60
  /** Get current ProviderRegistry (rebuilt on each reload). */
47
61
  getRegistry(): ProviderRegistry;
48
62
  /** Get current sources for Platform registration. */
@@ -18,7 +18,7 @@
18
18
  import { type Kysely } from 'kysely';
19
19
  import type { Database } from '../db/types.js';
20
20
  import type { ExecutionTracker } from '../reporting/execution-tracker.js';
21
- import type { CommitStatusReporter } from '../reporting/commit-status.js';
21
+ import type { CheckRunReporter } from '../reporting/check-run-reporter.js';
22
22
  import type { ScalerManager } from '../scaler/manager.js';
23
23
  import type { Dispatcher } from '../agent/dispatcher.js';
24
24
  import type { AgentRegistry } from '../agent/registry.js';
@@ -26,7 +26,7 @@ import type { HeldRunStore } from '../environments/held-runs.js';
26
26
  export interface StaleRunDetectorDeps {
27
27
  db: Kysely<Database>;
28
28
  executionTracker: ExecutionTracker;
29
- commitStatusReporter?: CommitStatusReporter;
29
+ checkRunReporter?: CheckRunReporter;
30
30
  scalerManager?: ScalerManager;
31
31
  dispatcher: Dispatcher;
32
32
  registry: AgentRegistry;
@@ -40,7 +40,7 @@ export interface StaleRunDetectorDeps {
40
40
  export declare class StaleRunDetector {
41
41
  private readonly db;
42
42
  private readonly executionTracker;
43
- private readonly commitStatusReporter?;
43
+ private readonly checkRunReporter?;
44
44
  private readonly scalerManager?;
45
45
  private readonly dispatcher;
46
46
  private readonly registry;
@@ -96,8 +96,20 @@ export declare class StaleRunDetector {
96
96
  private scanStaleRunningJobsNullHeartbeat;
97
97
  /**
98
98
  * Sub-scan C: Find dispatched entries that were never acknowledged.
99
- * Only checks 'dispatched' status (job sent to agent but agent never started it).
100
- * 'queued' jobs are legitimately waiting for agents and handled by queue timeout instead.
99
+ *
100
+ * Only catches dispatches that the agent never started i.e., the
101
+ * dispatch_queue row is still 'dispatched' AND there is no
102
+ * execution_jobs row in 'running' state. When the agent has reported
103
+ * the job as running (so execution_jobs.status='running'), heartbeat
104
+ * supervision falls to sub-scans A and B, which look at
105
+ * `execution_jobs.last_heartbeat_at`. Without this filter, a long
106
+ * job whose first step legitimately exceeds the dispatch threshold
107
+ * (e.g. an inline `npm install` for a workflow that imports
108
+ * `@kici-dev/sdk`) would be marked stale here before sub-scan A's
109
+ * heartbeat path has a chance to keep it alive.
110
+ *
111
+ * 'queued' jobs are legitimately waiting for agents and handled by
112
+ * the queue timeout in {@link JobQueue.markExpired} instead.
101
113
  */
102
114
  private scanStaleDispatchedJobs;
103
115
  /**