@kici-dev/orchestrator 0.1.26 → 0.2.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.
- package/dist/__test-helpers__/mock-db.d.ts +2 -0
- package/dist/agent/dispatcher.d.ts +52 -2
- package/dist/agent/host-roster-reaper.d.ts +1 -2
- package/dist/agent/host-roster.d.ts +34 -0
- package/dist/agent/ownership-refusal.d.ts +12 -0
- package/dist/agent/ownership-tracker.d.ts +64 -16
- package/dist/agent/token-store.d.ts +13 -0
- package/dist/agent-packaging/availability.d.ts +27 -0
- package/dist/agent-packaging/build-package.d.ts +16 -0
- package/dist/agent-packaging/download.d.ts +30 -0
- package/dist/agent-packaging/index.d.ts +9 -0
- package/dist/agent-packaging/install-closure.d.ts +30 -0
- package/dist/agent-packaging/node-binary.d.ts +26 -0
- package/dist/agent-packaging/refresh.d.ts +50 -0
- package/dist/agent-packaging/store.d.ts +15 -0
- package/dist/agent-packaging/upload.d.ts +24 -0
- package/dist/app-on-error.d.ts +29 -0
- package/dist/app.d.ts +69 -8
- package/dist/approvals/apply-decision.d.ts +1 -1
- package/dist/approvals/step-approval-bridge.d.ts +1 -1
- package/dist/artifacts/artifact-store.d.ts +233 -0
- package/dist/artifacts/failure-messages.d.ts +46 -0
- package/dist/audit/access-log.d.ts +18 -1
- package/dist/cache/dep-cache.d.ts +15 -0
- package/dist/cache/pending-inits.d.ts +4 -4
- package/dist/cache/user-cache.d.ts +37 -0
- package/dist/cancel/cancel-run.d.ts +10 -3
- package/dist/cancel/dashboard-cancel-handler.d.ts +19 -0
- package/dist/cli/api-client.d.ts +51 -5
- package/dist/cli/commands/agent-package.d.ts +34 -0
- package/dist/cli/commands/check-run.d.ts +26 -0
- package/dist/cli/commands/cluster-settings.d.ts +55 -0
- package/dist/cli/commands/context.d.ts +25 -0
- package/dist/cli/commands/dashboard-encryption-key.d.ts +3 -0
- package/dist/cli/commands/db-backup.d.ts +71 -0
- package/dist/cli/commands/debug-bundle.d.ts +1 -1
- package/dist/cli/commands/orchestrator-service/drain.d.ts +31 -0
- package/dist/cli/commands/orchestrator-service/index.d.ts +7 -4
- package/dist/cli/commands/orchestrator-service/install-env.d.ts +58 -0
- package/dist/cli/commands/secret.d.ts +45 -1
- package/dist/cli/commands/shared/admin-cli-access-log.d.ts +46 -0
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +65 -2
- package/dist/cli/commands/signing-key.d.ts +3 -0
- package/dist/cli/commands/source.d.ts +12 -0
- package/dist/cli/commands/token.d.ts +9 -0
- package/dist/cli/commands/trust-policy.d.ts +48 -0
- package/dist/cli/commands/variable.d.ts +6 -6
- package/dist/cli/join.d.ts +1 -1
- package/dist/cli/service/index.d.ts +2 -2
- package/dist/cli/service/instance/manifest.d.ts +17 -0
- package/dist/cli/service/instance/resolve.d.ts +11 -0
- package/dist/cli/service/windows.d.ts +6 -0
- package/dist/cli/wizard/orchestrator-wizard.d.ts +39 -11
- package/dist/cli.js +10263 -3667
- package/dist/cluster/cluster-settings-reader.d.ts +78 -0
- package/dist/cluster/coordinator.d.ts +81 -9
- package/dist/cluster/join-client.d.ts +1 -1
- package/dist/cluster/leader-gated-scheduler.d.ts +50 -0
- package/dist/cluster/orphan-recovery.d.ts +14 -0
- package/dist/cluster/peer-client.d.ts +12 -2
- package/dist/cluster/peer-handler.d.ts +15 -4
- package/dist/cluster/peer-registry.d.ts +12 -0
- package/dist/cluster/verified-issuer-poller.d.ts +11 -0
- package/dist/cluster/verified-issuer.d.ts +63 -0
- package/dist/cold-store/tables/access-log.d.ts +1 -1
- package/dist/cold-store/tables/event-log.d.ts +1 -1
- package/dist/cold-store/tables/execution-jobs.d.ts +1 -1
- package/dist/cold-store/tables/execution-runs.d.ts +1 -1
- package/dist/cold-store/tables/execution-steps.d.ts +1 -1
- package/dist/cold-store/tables/secret-audit-log.d.ts +1 -1
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/resolver.d.ts +2 -1
- package/dist/config/schema.d.ts +8 -6
- package/dist/config/types.d.ts +3 -2
- package/dist/config.d.ts +372 -46
- package/dist/contexts/binding-store.d.ts +36 -0
- package/dist/contexts/context-store.d.ts +100 -0
- package/dist/contexts/glob-specificity.d.ts +30 -0
- package/dist/{environments → contexts}/held-runs.d.ts +64 -32
- package/dist/{environments → contexts}/index.d.ts +1 -1
- package/dist/contexts/protection/aggregate.d.ts +43 -0
- package/dist/contexts/protection/branch-gate.d.ts +5 -0
- package/dist/contexts/protection/concurrency-gate.d.ts +4 -0
- package/dist/{environments → contexts}/protection/pipeline.d.ts +3 -3
- package/dist/contexts/protection/reviewer-gate.d.ts +4 -0
- package/dist/{environments → contexts}/protection/satisfiability.d.ts +22 -22
- package/dist/contexts/protection/trust-gate.d.ts +4 -0
- package/dist/contexts/protection/wait-timer-gate.d.ts +4 -0
- package/dist/contexts/variable-store.d.ts +39 -0
- package/dist/cron/cron-scheduler.d.ts +24 -4
- package/dist/cron/cron-store.d.ts +21 -7
- package/dist/dashboard/attestation-filters.d.ts +94 -74
- package/dist/dashboard/handler.d.ts +63 -3
- package/dist/db/migration-test-harness.d.ts +41 -0
- package/dist/db/migrations/067_environments_to_contexts.d.ts +36 -0
- package/dist/db/migrations/068_request_idempotency.d.ts +17 -0
- package/dist/db/migrations/069_reroute_tunables.d.ts +21 -0
- package/dist/db/migrations/070_execution_runs_failure_class.d.ts +4 -0
- package/dist/db/migrations/071_batch_accumulation.d.ts +26 -0
- package/dist/db/migrations/072_dispatch_queue_run_id_index.d.ts +15 -0
- package/dist/db/migrations/073_org_settings_ingest_concurrency.d.ts +13 -0
- package/dist/db/migrations/074_normalize_zero_concurrency_limit.d.ts +13 -0
- package/dist/db/migrations/075_ingest_overflow_buffer.d.ts +16 -0
- package/dist/db/migrations/076_artifacts.d.ts +19 -0
- package/dist/db/migrations/077_backup_runs.d.ts +13 -0
- package/dist/db/migrations/078_org_settings_backup_staleness.d.ts +12 -0
- package/dist/db/migrations/079_org_settings_scaler_spawn_timeout.d.ts +14 -0
- package/dist/db/migrations/080_cluster_settings.d.ts +17 -0
- package/dist/db/migrations/081_org_settings_queue_timeout.d.ts +19 -0
- package/dist/db/migrations/082_host_s3_reachable.d.ts +16 -0
- package/dist/db/migrations/083_org_settings_artifact_caps.d.ts +18 -0
- package/dist/db/migrations/084_orchestrator_signing_keys.d.ts +20 -0
- package/dist/db/migrations/085_cluster_settings_reroute_flap_grace_ms.d.ts +12 -0
- package/dist/db/migrations/086_cluster_settings_max_fanout_hosts.d.ts +12 -0
- package/dist/db/migrations/087_cluster_settings_event_router_rate_limit.d.ts +12 -0
- package/dist/db/migrations/088_cluster_settings_cache_max_tarball_bytes.d.ts +12 -0
- package/dist/db/migrations/089_cluster_settings_cache_ttl_days.d.ts +12 -0
- package/dist/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.d.ts +12 -0
- package/dist/db/migrations/091_cluster_settings_agent_token_ttl_ms.d.ts +12 -0
- package/dist/db/migrations/092_cluster_settings_version.d.ts +16 -0
- package/dist/db/migrations/093_org_settings_sandbox_allowlist.d.ts +4 -0
- package/dist/db/migrations/094_dashboard_encryption_keys.d.ts +21 -0
- package/dist/db/migrations/095_dashboard_write_policy_tristate.d.ts +20 -0
- package/dist/db/migrations/096_multi_schedule_cron_last_fired.d.ts +4 -0
- package/dist/db/migrations/097_execution_runs_pr_number.d.ts +4 -0
- package/dist/db/migrations/098_execution_runs_customer_id.d.ts +4 -0
- package/dist/db/migrations/099_cluster_settings_dashboard_verified_issuer.d.ts +21 -0
- package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +31 -0
- package/dist/db/migrations/101_contexts_hold_expiry_drop_default.d.ts +31 -0
- package/dist/db/migrations/102_dispatch_queue_agent_id.d.ts +20 -0
- package/dist/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.d.ts +20 -0
- package/dist/db/migrations/104_check_run_terminal_sent.d.ts +22 -0
- package/dist/db/migrations/105_org_trust_policy.d.ts +19 -0
- package/dist/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.d.ts +18 -0
- package/dist/db/migrations/107_check_run_tracking_updated_at_index.d.ts +23 -0
- package/dist/db/repos/dashboard-encryption-keys-repo.d.ts +48 -0
- package/dist/db/repos/signing-keys-repo.d.ts +34 -0
- package/dist/db/types.d.ts +499 -66
- package/dist/deployment/deployment-identity.d.ts +87 -2
- package/dist/diagnostics/checks/backup.d.ts +18 -0
- package/dist/diagnostics/checks/index.d.ts +2 -1
- package/dist/diagnostics/fleet-collector.d.ts +1 -1
- package/dist/drain/drain-controller.d.ts +52 -0
- package/dist/events/batch-accumulator.d.ts +63 -0
- package/dist/events/circuit-breaker.d.ts +9 -3
- package/dist/events/event-emitter.d.ts +31 -0
- package/dist/events/event-retry-scanner.d.ts +12 -2
- package/dist/events/event-router.d.ts +29 -0
- package/dist/firecracker/host-network.d.ts +2 -0
- package/dist/firecracker/net-interfaces.d.ts +14 -0
- package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +19 -9
- package/dist/index.d.ts +2 -0
- package/dist/index.js +625 -22
- package/dist/lockfile-cache.d.ts +4 -0
- package/dist/lockfile-validate.d.ts +16 -9
- package/dist/metrics/prometheus.d.ts +114 -15
- package/dist/oidc/aws-kms-signer.d.ts +37 -0
- package/dist/oidc/command-signer.d.ts +23 -0
- package/dist/oidc/db-signer.d.ts +48 -0
- package/dist/oidc/id-token-claims.d.ts +76 -0
- package/dist/oidc/jwt.d.ts +18 -0
- package/dist/oidc/local-dev-signer.d.ts +31 -0
- package/dist/oidc/local-mint.d.ts +77 -0
- package/dist/oidc/oidc-mint-registration.d.ts +65 -0
- package/dist/oidc/orchestrator-mint.d.ts +97 -0
- package/dist/oidc/orchestrator-signer-factory.d.ts +33 -0
- package/dist/oidc/reconcile-signing-key.d.ts +21 -0
- package/dist/oidc/signer.d.ts +25 -0
- package/dist/oidc/signing-key-status.d.ts +23 -0
- package/dist/orchestrator-core.d.ts +42 -2
- package/dist/pipeline/decorating-secret-resolver.d.ts +5 -4
- package/dist/pipeline/dispatch-matched-workflow.d.ts +44 -3
- package/dist/pipeline/inline-eval.d.ts +2 -2
- package/dist/pipeline/install-secrets-resolver.d.ts +25 -14
- package/dist/pipeline/{job-environments.d.ts → job-contexts.d.ts} +23 -23
- package/dist/pipeline/manual-schedule.d.ts +28 -14
- package/dist/pipeline/pending-workflow-context.d.ts +1 -1
- package/dist/pipeline/process-webhook.d.ts +57 -2
- package/dist/pipeline/processor.d.ts +49 -13
- package/dist/pipeline/request-idempotency.d.ts +28 -0
- package/dist/pipeline/rerun.d.ts +20 -13
- package/dist/pipeline/resolve-sandbox-grant.d.ts +28 -0
- package/dist/pipeline/resume-workflow.d.ts +1 -1
- package/dist/pipeline/route-or-dispatch-jobs.d.ts +71 -0
- package/dist/pipeline/sandbox-allowlist-reader.d.ts +33 -0
- package/dist/pipeline/test-pipeline.d.ts +2 -2
- package/dist/policy/dashboard-write-policy.d.ts +9 -4
- package/dist/provenance/backfill-run.d.ts +1 -0
- package/dist/provenance/trust-root.d.ts +20 -0
- package/dist/provider-registry.d.ts +8 -0
- package/dist/providers/generic/normalizer.d.ts +1 -1
- package/dist/providers/github/auth.d.ts +1 -1
- package/dist/providers/github/changed-files.d.ts +14 -6
- package/dist/providers/github/check-status-poster.d.ts +19 -3
- package/dist/providers/github/contributor-resolver.d.ts +1 -1
- package/dist/providers/github/lock-file.d.ts +1 -1
- package/dist/providers/github/normalizer.d.ts +1 -1
- package/dist/providers/github/repo-url.d.ts +1 -1
- package/dist/providers/local/index.d.ts +1 -0
- package/dist/providers/local/local-source-config.d.ts +1 -0
- package/dist/providers/local/lock-file-fetcher.d.ts +1 -1
- package/dist/providers/local/normalizer.d.ts +1 -1
- package/dist/providers/local/repo-url-builder.d.ts +1 -1
- package/dist/providers/universal-git/changed-files.d.ts +8 -7
- package/dist/providers/universal-git/clone-token.d.ts +1 -1
- package/dist/providers/universal-git/config.d.ts +4 -4
- package/dist/providers/universal-git/index.d.ts +5 -1
- package/dist/providers/universal-git/lock-file.d.ts +6 -1
- package/dist/providers/universal-git/normalizer.d.ts +1 -1
- package/dist/providers/universal-git/repo-url.d.ts +1 -1
- package/dist/queue/cleanup.d.ts +69 -8
- package/dist/queue/job-queue.d.ts +94 -14
- package/dist/queue/scheduled-job.d.ts +2 -2
- package/dist/registration/registration-index.d.ts +1 -1
- package/dist/reporting/agent-failure-category.d.ts +4 -1
- package/dist/reporting/check-run-reporter.d.ts +34 -14
- package/dist/reporting/check-run-tracking-store.d.ts +70 -8
- package/dist/reporting/execution-tracker.d.ts +173 -17
- package/dist/reporting/fs-log-storage.d.ts +31 -2
- package/dist/reporting/job-check-run-completion.d.ts +50 -0
- package/dist/reporting/log-chunk-sink.d.ts +47 -0
- package/dist/reporting/log-retention.d.ts +16 -0
- package/dist/reporting/log-storage.d.ts +64 -4
- package/dist/reporting/log-writer.d.ts +22 -7
- package/dist/reporting/peer-log-normalize.d.ts +14 -0
- package/dist/reporting/run-aggregator.d.ts +36 -36
- package/dist/reporting/s3-log-storage.d.ts +102 -8
- package/dist/routes/admin-auth.d.ts +90 -0
- package/dist/routes/admin-cluster-settings.d.ts +31 -0
- package/dist/routes/admin-contexts.d.ts +47 -0
- package/dist/routes/admin-events.d.ts +3 -0
- package/dist/routes/admin-orchestrator-drain.d.ts +35 -0
- package/dist/routes/admin-registrations.d.ts +2 -2
- package/dist/routes/admin-runs.d.ts +9 -0
- package/dist/routes/admin-sources.d.ts +7 -0
- package/dist/routes/admin-trust-policy.d.ts +49 -0
- package/dist/routes/admin.d.ts +15 -1
- package/dist/routes/github-webhook.d.ts +9 -3
- package/dist/routes/provenance-oidc.d.ts +38 -0
- package/dist/routes/verify-attestation.d.ts +21 -0
- package/dist/scaler/bare-metal-backend.d.ts +9 -2
- package/dist/scaler/config.d.ts +25 -4
- package/dist/scaler/container-backend.d.ts +9 -1
- package/dist/scaler/firecracker-backend.d.ts +29 -2
- package/dist/scaler/index.d.ts +1 -1
- package/dist/scaler/manager.d.ts +166 -8
- package/dist/scaler/pending-scale-sweeper.d.ts +35 -0
- package/dist/scaler/types.d.ts +75 -6
- package/dist/secrets/backend-registry.d.ts +32 -1
- package/dist/secrets/context-secret-resolver.d.ts +30 -0
- package/dist/secrets/dashboard-encryption-key.d.ts +48 -0
- package/dist/secrets/ephemeral-keys.d.ts +16 -0
- package/dist/secrets/index.d.ts +1 -1
- package/dist/secrets/pg-secret-store.d.ts +13 -3
- package/dist/secrets/rbac.d.ts +5 -1
- package/dist/secrets/routing-key-scope.d.ts +6 -0
- package/dist/secrets/scope-routing.d.ts +126 -0
- package/dist/secrets/secret-resolver.d.ts +19 -32
- package/dist/secrets/token-manager.d.ts +5 -1
- package/dist/security/comment-handler.d.ts +1 -1
- package/dist/security/contributor-cache.d.ts +9 -1
- package/dist/security/trust-policy-gate.d.ts +117 -0
- package/dist/security/trust-policy-store.d.ts +78 -0
- package/dist/server.js +44012 -32721
- package/dist/sources/source-manager.d.ts +24 -0
- package/dist/stale-detector/stale-run-detector.d.ts +8 -1
- package/dist/standalone.js +44106 -33690
- package/dist/storage/blob-routes.d.ts +16 -0
- package/dist/storage/filesystem.d.ts +17 -0
- package/dist/storage/key-discriminator.d.ts +20 -0
- package/dist/storage/s3.d.ts +2 -0
- package/dist/storage/types.d.ts +16 -0
- package/dist/webhook/dedup.d.ts +9 -1
- package/dist/webhook/event-log.d.ts +13 -2
- package/dist/webhook/generic-sources-listener.d.ts +4 -0
- package/dist/webhook/ingest-admission.d.ts +140 -0
- package/dist/webhook/ingest-overflow-buffer.d.ts +27 -0
- package/dist/webhook/ingest-overflow-replayer.d.ts +49 -0
- package/dist/webhook/ingest-overflow-types.d.ts +73 -0
- package/dist/webhook/loop-lag-source.d.ts +40 -0
- package/dist/webhook/observed-relay-guard.d.ts +40 -0
- package/dist/webhook/org-ingest-cap-reader.d.ts +24 -0
- package/dist/webhook/register-source-bundle.d.ts +3 -0
- package/dist/webhook/relay-reinject.d.ts +43 -0
- package/dist/worker/in-memory-job-queue.d.ts +8 -3
- package/dist/worker-core.d.ts +10 -0
- package/dist/ws/agent-api-registry.d.ts +20 -0
- package/dist/ws/agent-handler.d.ts +63 -7
- package/dist/ws/bringup-api.d.ts +99 -0
- package/dist/ws/{dashboard-env-handler.d.ts → dashboard-context-handler.d.ts} +43 -25
- package/dist/ws/dashboard-run-state-handler.d.ts +31 -0
- package/dist/ws/failure-messages.d.ts +29 -0
- package/dist/ws/oidc-token-relay.d.ts +15 -0
- package/dist/ws/ownership-gate.d.ts +22 -0
- package/dist/ws/platform-client.d.ts +96 -1
- package/dist/ws/replay-chunker.d.ts +37 -0
- package/installer-image-digests.json +3 -3
- package/package.json +22 -21
- package/sbom.spdx.json +1245 -1793
- package/dist/cli/commands/environment.d.ts +0 -25
- package/dist/environments/binding-store.d.ts +0 -36
- package/dist/environments/environment-store.d.ts +0 -87
- package/dist/environments/protection/aggregate.d.ts +0 -43
- package/dist/environments/protection/branch-gate.d.ts +0 -5
- package/dist/environments/protection/concurrency-gate.d.ts +0 -7
- package/dist/environments/protection/reviewer-gate.d.ts +0 -7
- package/dist/environments/protection/trust-gate.d.ts +0 -7
- package/dist/environments/protection/wait-timer-gate.d.ts +0 -7
- package/dist/environments/variable-store.d.ts +0 -39
- package/dist/routes/admin-environments.d.ts +0 -47
|
@@ -20,9 +20,13 @@ export declare class InMemoryJobQueue {
|
|
|
20
20
|
enqueue(input: QueuedJobInput): Promise<string>;
|
|
21
21
|
/**
|
|
22
22
|
* Returns a generated UUID for direct-dispatch tracking, or honors the
|
|
23
|
-
* caller's pre-allocated jobId when set (cluster reroute path).
|
|
23
|
+
* caller's pre-allocated jobId when set (cluster reroute path). The in-memory
|
|
24
|
+
* queue has no unique-key constraint, so an insert is always treated as new.
|
|
24
25
|
*/
|
|
25
|
-
insertDispatched(input: QueuedJobInput): Promise<
|
|
26
|
+
insertDispatched(input: QueuedJobInput, _agentId: string): Promise<{
|
|
27
|
+
id: string;
|
|
28
|
+
inserted: boolean;
|
|
29
|
+
}>;
|
|
26
30
|
/**
|
|
27
31
|
* Dequeue the first pending job matching the given labels.
|
|
28
32
|
*
|
|
@@ -111,12 +115,13 @@ export declare class InMemoryJobQueue {
|
|
|
111
115
|
/** Always returns false. */
|
|
112
116
|
markFailedIfRecovering(_jobId: string, _reason: string): Promise<boolean>;
|
|
113
117
|
/** Always returns false. */
|
|
114
|
-
markDispatchedIfRecovering(_jobId: string): Promise<boolean>;
|
|
118
|
+
markDispatchedIfRecovering(_jobId: string, _agentId: string): Promise<boolean>;
|
|
115
119
|
/** Always returns empty array. */
|
|
116
120
|
getJobsByStatus(_status: DispatchQueueStatus): Promise<Array<{
|
|
117
121
|
id: string;
|
|
118
122
|
runId: string;
|
|
119
123
|
status: DispatchQueueStatus;
|
|
124
|
+
agentId: string | null;
|
|
120
125
|
}>>;
|
|
121
126
|
/** No-op — nothing to expire. */
|
|
122
127
|
markExpired(): Promise<number>;
|
package/dist/worker-core.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ import { StepLogBuffer } from './reporting/step-log-buffer.js';
|
|
|
40
40
|
import { ObserverRegistry } from './ws/observer-registry.js';
|
|
41
41
|
import { ScalerManager } from './scaler/index.js';
|
|
42
42
|
import type { ScalerConfig } from './scaler/index.js';
|
|
43
|
+
import type { WorkerClusterSettings } from '@kici-dev/engine';
|
|
43
44
|
/**
|
|
44
45
|
* Subsystems available in worker mode.
|
|
45
46
|
* Subset of OrchestratorSubsystems with in-memory replacements.
|
|
@@ -61,6 +62,15 @@ interface WorkerSubsystems {
|
|
|
61
62
|
scalerManager: ScalerManager | null;
|
|
62
63
|
scalerConfig: ScalerConfig | null;
|
|
63
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Resolve the ephemeral agent-token TTL a worker-spawned agent should use:
|
|
67
|
+
* the fleet-wide `agent_token_ttl_ms` pulled from the leader when a snapshot has
|
|
68
|
+
* landed, otherwise the boot-time config default. This is the single seam the
|
|
69
|
+
* worker's three scaler backends read at spawn.
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveWorkerAgentTokenTtlMs(pushed: {
|
|
72
|
+
settings: WorkerClusterSettings;
|
|
73
|
+
} | null, fallback: number): number;
|
|
64
74
|
/**
|
|
65
75
|
* Bootstrap the orchestrator in worker mode.
|
|
66
76
|
*
|
|
@@ -15,6 +15,26 @@
|
|
|
15
15
|
export type ApiRole = 'read' | 'write';
|
|
16
16
|
/** Handler function for an API method. */
|
|
17
17
|
export type ApiHandler = (agentId: string, params: Record<string, unknown>) => Promise<unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* The caller named a method the registry does not know.
|
|
20
|
+
*
|
|
21
|
+
* A deliberate, bounded rejection: its message names only the method the caller
|
|
22
|
+
* itself sent, so the agent WS handler may forward it verbatim to the workflow
|
|
23
|
+
* author instead of replacing it with a safe fixed string.
|
|
24
|
+
*/
|
|
25
|
+
export declare class UnknownApiMethodError extends Error {
|
|
26
|
+
constructor(method: string);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The caller is not authorized for the role the requested method requires.
|
|
30
|
+
*
|
|
31
|
+
* A deliberate, bounded rejection: its message names only the caller's own
|
|
32
|
+
* method and roles, so the agent WS handler may forward it verbatim to the
|
|
33
|
+
* workflow author instead of replacing it with a safe fixed string.
|
|
34
|
+
*/
|
|
35
|
+
export declare class ApiRoleDeniedError extends Error {
|
|
36
|
+
constructor(method: string, requiredRole: ApiRole, allowedRoles: ApiRole[]);
|
|
37
|
+
}
|
|
18
38
|
/**
|
|
19
39
|
* Registry for agent private API methods.
|
|
20
40
|
*
|
|
@@ -16,22 +16,24 @@
|
|
|
16
16
|
* When agentAuthMode === 'none', the auth phase is skipped (legacy behavior).
|
|
17
17
|
*/
|
|
18
18
|
import type { WSEvents } from 'hono/ws';
|
|
19
|
+
import { LogStream } from '@kici-dev/engine';
|
|
19
20
|
import type { RateLimiterConfig, AttestationVerifyStatus } from '@kici-dev/engine';
|
|
20
21
|
import type { ProvenanceTrustRoot } from '../provenance/trust-root.js';
|
|
21
22
|
import type { AgentRegistry } from '../agent/registry.js';
|
|
22
23
|
import type { Dispatcher } from '../agent/dispatcher.js';
|
|
23
|
-
import type
|
|
24
|
+
import { type AgentTokenStore } from '../agent/token-store.js';
|
|
24
25
|
import type { OwnershipTracker } from '../agent/ownership-tracker.js';
|
|
25
26
|
import type { SourceCache } from '../cache/source-cache.js';
|
|
26
27
|
import type { DepCache } from '../cache/dep-cache.js';
|
|
27
28
|
import type { UserCache } from '../cache/user-cache.js';
|
|
29
|
+
import { type ArtifactStore } from '../artifacts/artifact-store.js';
|
|
28
30
|
import type { DispatchCacheRefTracker } from '../cache/dispatch-cache-ref-tracker.js';
|
|
29
31
|
import type { PendingBuildTracker } from '../cache/pending-builds.js';
|
|
30
32
|
import type { PendingInitTracker } from '../cache/pending-inits.js';
|
|
31
33
|
import type { PendingDynamicTracker } from '../cache/pending-dynamics.js';
|
|
32
34
|
import type { CacheStorage } from '../storage/types.js';
|
|
33
35
|
import type { AgentMetricsAggregator } from '../metrics/agent-metrics-aggregator.js';
|
|
34
|
-
import type
|
|
36
|
+
import { type AgentApiRegistry } from './agent-api-registry.js';
|
|
35
37
|
import type { FleetAgentCollector } from './fleet-agent-collector.js';
|
|
36
38
|
/**
|
|
37
39
|
* Run the three token-bound authorization gates against a wire-supplied
|
|
@@ -39,8 +41,9 @@ import type { FleetAgentCollector } from './fleet-agent-collector.js';
|
|
|
39
41
|
* (Phase 2 / `pendingRegistration`) and on every subsequent re-register
|
|
40
42
|
* arriving on the same registered WS — every code path that mutates the
|
|
41
43
|
* registry's `agentId → entry` mapping for an authenticated WS MUST run
|
|
42
|
-
* them, otherwise the
|
|
43
|
-
* register and a re-register can silently
|
|
44
|
+
* them, otherwise the token-scope and identity-binding invariants only
|
|
45
|
+
* hold for the very first register and a re-register can silently
|
|
46
|
+
* overwrite the authority.
|
|
44
47
|
*
|
|
45
48
|
* Gates:
|
|
46
49
|
* 1. Token-scope subset — wire labels MUST be a subset of
|
|
@@ -59,7 +62,7 @@ import type { FleetAgentCollector } from './fleet-agent-collector.js';
|
|
|
59
62
|
* case the caller MUST stop processing.
|
|
60
63
|
*/
|
|
61
64
|
/**
|
|
62
|
-
* WebSocket close reasons are capped at 123 UTF-8 bytes (RFC 6455
|
|
65
|
+
* WebSocket close reasons are capped at 123 UTF-8 bytes (RFC 6455, section 5.5.1).
|
|
63
66
|
* A reason longer than that makes `ws.close()` throw a RangeError, which —
|
|
64
67
|
* thrown from an async message handler — surfaces as an unhandled rejection
|
|
65
68
|
* and skips the close entirely. Truncate on a byte boundary and drop any
|
|
@@ -88,6 +91,8 @@ export interface AgentWsHandlerDeps {
|
|
|
88
91
|
stepIndex: number;
|
|
89
92
|
lines: string[];
|
|
90
93
|
timestamp: number;
|
|
94
|
+
/** Absent when the agent does not report a stream; read as `stdout`. */
|
|
95
|
+
stream?: LogStream;
|
|
91
96
|
}) => void;
|
|
92
97
|
/** Optional callback when agent sends step status updates. */
|
|
93
98
|
onStepStatus?: (agentId: string, msg: {
|
|
@@ -141,7 +146,17 @@ export interface AgentWsHandlerDeps {
|
|
|
141
146
|
}) => void;
|
|
142
147
|
/** Optional callback when agent acknowledges config (for MMDS clearing in Firecracker). */
|
|
143
148
|
onConfigAck?: (agentId: string) => void;
|
|
144
|
-
/**
|
|
149
|
+
/**
|
|
150
|
+
* Optional callback when agent emits a custom event via ctx.emit().
|
|
151
|
+
*
|
|
152
|
+
* A returned `error` is relayed to the agent verbatim, and the agent runs
|
|
153
|
+
* untrusted workflow code that persists it into the author's step logs — so
|
|
154
|
+
* an implementation may only return author-facing wording (an unknown job
|
|
155
|
+
* context). Raw exception text belongs in the implementation's own
|
|
156
|
+
* `logger.*`, with {@link AgentWsInternalFailure.eventEmitFailed} returned in
|
|
157
|
+
* its place; a thrown exception is already replaced with the same string
|
|
158
|
+
* here.
|
|
159
|
+
*/
|
|
145
160
|
onEventEmit?: (agentId: string, msg: {
|
|
146
161
|
jobId: string;
|
|
147
162
|
requestId: string;
|
|
@@ -185,6 +200,12 @@ export interface AgentWsHandlerDeps {
|
|
|
185
200
|
* which org/repo/scope that job resolves to.
|
|
186
201
|
*/
|
|
187
202
|
dispatchCacheRefs?: DispatchCacheRefTracker;
|
|
203
|
+
/**
|
|
204
|
+
* User-facing artifact store for serving `artifacts.*` upload/download
|
|
205
|
+
* requests from the sandbox. The org (`customer_id`) + runId are resolved
|
|
206
|
+
* server-side from the job's dispatch ref, NEVER from the wire body.
|
|
207
|
+
*/
|
|
208
|
+
artifactStore?: ArtifactStore;
|
|
188
209
|
/** Cache storage for setting metadata after upload completion. */
|
|
189
210
|
cacheStorage?: CacheStorage;
|
|
190
211
|
/**
|
|
@@ -253,7 +274,15 @@ export interface AgentWsHandlerDeps {
|
|
|
253
274
|
}>) => Promise<void>;
|
|
254
275
|
/** Agent metrics aggregator for receiving pushed metrics. */
|
|
255
276
|
agentMetricsAggregator?: AgentMetricsAggregator;
|
|
256
|
-
/**
|
|
277
|
+
/**
|
|
278
|
+
* Optional callback when agent reports a job belongs to a concurrency group.
|
|
279
|
+
*
|
|
280
|
+
* A returned `reason` is relayed to the agent verbatim as the
|
|
281
|
+
* `job.concurrency.ack` reason, and the agent runs untrusted workflow code
|
|
282
|
+
* that persists it into the author's step logs — so an implementation may
|
|
283
|
+
* only return author-facing wording (the group the job queued behind). Raw
|
|
284
|
+
* exception text belongs in the implementation's own `logger.*`.
|
|
285
|
+
*/
|
|
257
286
|
onConcurrencyReport?: (agentId: string, msg: {
|
|
258
287
|
runId: string;
|
|
259
288
|
jobId: string;
|
|
@@ -271,6 +300,13 @@ export interface AgentWsHandlerDeps {
|
|
|
271
300
|
* resolution back to the originating agent as a `step.approval-resolved`
|
|
272
301
|
* message. The `agentId` lets the server drop the pending resolver when the
|
|
273
302
|
* agent disconnects.
|
|
303
|
+
*
|
|
304
|
+
* The resolved `reason` is relayed to the agent verbatim, and the agent runs
|
|
305
|
+
* untrusted workflow code that persists it into the author's step logs — so
|
|
306
|
+
* an implementation may only resolve with author-facing wording (an
|
|
307
|
+
* approver's decline note, an invalid per-gate timeout). Raw exception text
|
|
308
|
+
* belongs in the implementation's own `logger.*`; a rejected promise is
|
|
309
|
+
* already replaced with {@link AgentWsInternalFailure.approvalFailed} here.
|
|
274
310
|
*/
|
|
275
311
|
onStepApproval?: (agentId: string, msg: {
|
|
276
312
|
runId: string;
|
|
@@ -309,5 +345,25 @@ export interface AgentWsHandlerDeps {
|
|
|
309
345
|
*/
|
|
310
346
|
fleetAgentCollector?: FleetAgentCollector;
|
|
311
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* FAST PATH: Manual type guard for log.chunk messages.
|
|
350
|
+
*
|
|
351
|
+
* Skips Zod safeParse() on authenticated connections for this high-frequency message type.
|
|
352
|
+
*
|
|
353
|
+
* SYNC INVARIANT: This manual validator MUST match the Zod schema
|
|
354
|
+
* `agentLogChunkSchema` in packages/engine/src/protocol/messages/orchestrator-agent.ts.
|
|
355
|
+
* If you change the schema, update this validator in the same commit.
|
|
356
|
+
* See CLAUDE.md rule: "Zod fast-path sync invariant".
|
|
357
|
+
*/
|
|
358
|
+
export declare function isValidLogChunk(raw: unknown): raw is {
|
|
359
|
+
type: 'log.chunk';
|
|
360
|
+
messageId: string;
|
|
361
|
+
runId: string;
|
|
362
|
+
jobId: string;
|
|
363
|
+
stepIndex: number;
|
|
364
|
+
lines: string[];
|
|
365
|
+
timestamp: number;
|
|
366
|
+
stream?: LogStream;
|
|
367
|
+
};
|
|
312
368
|
export declare function createAgentWsHandler(deps: AgentWsHandlerDeps): WSEvents;
|
|
313
369
|
//# sourceMappingURL=agent-handler.d.ts.map
|
package/dist/ws/bringup-api.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AgentDeliveryMode, AgentPlatform } from '@kici-dev/shared';
|
|
2
|
+
import { type AgentPackageDownloadStorage } from '../agent-packaging/download.js';
|
|
1
3
|
import { type HostRosterStore } from '../agent/host-roster.js';
|
|
2
4
|
import type { AgentRegistry } from '../agent/registry.js';
|
|
3
5
|
import type { AgentTokenStore } from '../agent/token-store.js';
|
|
@@ -21,6 +23,15 @@ export interface BringupApiDeps {
|
|
|
21
23
|
resolveOrgId: () => string;
|
|
22
24
|
/** Resolve the orchestrator WS URL the init-runner should dial. */
|
|
23
25
|
resolveOrchestratorUrl: () => string;
|
|
26
|
+
/** Resolve the orchestrator's own version — the payload version to stage on bring-up. */
|
|
27
|
+
resolveVersion: () => string;
|
|
28
|
+
/**
|
|
29
|
+
* The cache-bucket agent-package store, present only when S3 cache storage is
|
|
30
|
+
* configured. Backs the `s3-direct` delivery mode: the handler mints a
|
|
31
|
+
* box-routable presigned download URL for a probed platform. Absent ⇒ every
|
|
32
|
+
* bring-up falls back to `ssh-push` and the presign RPC is refused.
|
|
33
|
+
*/
|
|
34
|
+
agentPackages?: AgentPackageDownloadStorage;
|
|
24
35
|
}
|
|
25
36
|
/**
|
|
26
37
|
* Reach the calling agent connects to + the resolved private key. Returned to
|
|
@@ -44,6 +55,15 @@ export interface EnsureInitRunnerResult {
|
|
|
44
55
|
orchestratorUrl?: string;
|
|
45
56
|
/** The init-runner label set the bootstrap token is bound to. */
|
|
46
57
|
labels?: string[];
|
|
58
|
+
/** The orchestrator's own version — the self-contained payload version to stage. */
|
|
59
|
+
version?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Per-host delivery mode the agent uses to stage the payload: `s3-direct` when
|
|
62
|
+
* the host is declared object-storage-reachable AND a cache store is
|
|
63
|
+
* configured, else `ssh-push`. The agent probes the platform then requests the
|
|
64
|
+
* presigned URL via `kici.presignAgentPackage` for the `s3-direct` case.
|
|
65
|
+
*/
|
|
66
|
+
deliveryMode?: AgentDeliveryMode;
|
|
47
67
|
}
|
|
48
68
|
/** Result the agent receives for a `preBootSend` call. */
|
|
49
69
|
export interface PreBootSendResult {
|
|
@@ -66,6 +86,85 @@ export declare class CapabilityDeniedError extends Error {
|
|
|
66
86
|
* agent needs to drop + start the init-runner over SSH.
|
|
67
87
|
*/
|
|
68
88
|
export declare function createEnsureInitRunnerHandler(deps: BringupApiDeps): (callingAgentId: string, params: Record<string, unknown>) => Promise<EnsureInitRunnerResult>;
|
|
89
|
+
/** Result the agent receives for a `presignAgentPackage` call. */
|
|
90
|
+
export interface PresignAgentPackageResult {
|
|
91
|
+
url: string;
|
|
92
|
+
/** The expected sha256 (hex), or null when the producer wrote no sidecar. */
|
|
93
|
+
sha256: string | null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Build the `kici.presignAgentPackage` handler — the follow-up RPC the ops agent
|
|
97
|
+
* calls AFTER it probes the target platform (so the presign is keyed by the real
|
|
98
|
+
* platform). Same capability gate + access-log as the bring-up. Mints a
|
|
99
|
+
* box-routable presigned GET URL for the version-keyed payload from the
|
|
100
|
+
* orchestrator's own cache bucket; no standing S3 credential leaves the
|
|
101
|
+
* orchestrator. A missing payload object throws loudly (never a silent stale
|
|
102
|
+
* stage). Used by BOTH delivery paths: for `s3-direct` the URL goes to the box;
|
|
103
|
+
* for `ssh-push` the ops agent fetches it and streams the bytes onward.
|
|
104
|
+
*/
|
|
105
|
+
export declare function createPresignAgentPackageHandler(deps: BringupApiDeps): (callingAgentId: string, params: Record<string, unknown>) => Promise<PresignAgentPackageResult>;
|
|
106
|
+
/** How the ops agent drains + restarts a re-staged host + where its install lives. */
|
|
107
|
+
export interface AgentRestartSpec {
|
|
108
|
+
stop: string;
|
|
109
|
+
start: string;
|
|
110
|
+
installDir?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Map a roster row's os/arch tokens to an {@link AgentPlatform}, or null when the
|
|
114
|
+
* host's platform is unknown / unsupported (so availability falls back to the
|
|
115
|
+
* whole bootstrap set). Accepts both `uname` (`x86_64`/`aarch64`) and Node
|
|
116
|
+
* (`x64`/`arm64`) arch spellings.
|
|
117
|
+
*/
|
|
118
|
+
export declare function archToAgentPlatform(platform: string | null, arch: string | null): AgentPlatform | null;
|
|
119
|
+
/**
|
|
120
|
+
* Derive the drain/restart spec from a host's declared properties. Explicit
|
|
121
|
+
* stop/start commands win; otherwise a declared systemd service name maps to
|
|
122
|
+
* `systemctl --user stop|start <svc>`. Returns null when neither is declared —
|
|
123
|
+
* the orchestrator then cannot re-stage the host (it does not know how to
|
|
124
|
+
* restart it) and the caller refuses loudly.
|
|
125
|
+
*/
|
|
126
|
+
export declare function resolveRestartSpec(properties: Record<string, unknown>): AgentRestartSpec | null;
|
|
127
|
+
/** Result the check-step receives for a `kici.agentVersionStatus` read. */
|
|
128
|
+
export interface AgentVersionStatusResult {
|
|
129
|
+
/** The orchestrator's own version — the convergence target. */
|
|
130
|
+
targetVersion: string;
|
|
131
|
+
/** The version last staged onto the host, or null when never staged. */
|
|
132
|
+
stagedVersion: string | null;
|
|
133
|
+
/** True only when the target's payload objects exist for the host's platform. */
|
|
134
|
+
available: boolean;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Build the `kici.agentVersionStatus` read handler — the availability-gate probe
|
|
138
|
+
* the convergence check-step calls. Returns the target version, the host's
|
|
139
|
+
* recorded staged version, and whether the target's payloads are available for
|
|
140
|
+
* the host's platform (the whole bootstrap set when the platform is unknown). No
|
|
141
|
+
* SSH, no token — a pure read, but same capability gate + audit as the bring-up.
|
|
142
|
+
*/
|
|
143
|
+
export declare function createAgentVersionStatusHandler(deps: BringupApiDeps): (callingAgentId: string, params: Record<string, unknown>) => Promise<AgentVersionStatusResult>;
|
|
144
|
+
/** Material the ops agent receives for a `kici.restageAgent` call. */
|
|
145
|
+
export interface RestageAgentResult {
|
|
146
|
+
/** How to SSH to the target host. */
|
|
147
|
+
reach: BringupReach;
|
|
148
|
+
/** The resolved bring-up private key (custodied by the ops agent). */
|
|
149
|
+
privateKey: string;
|
|
150
|
+
/** The target version to converge onto (the orchestrator's own). */
|
|
151
|
+
version: string;
|
|
152
|
+
/** Per-host delivery mode (`s3-direct` when reachable + a store is configured). */
|
|
153
|
+
deliveryMode: AgentDeliveryMode;
|
|
154
|
+
/** How the ops agent drains + restarts the host after the install swap. */
|
|
155
|
+
restart: AgentRestartSpec;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Build the `kici.restageAgent` handler — the availability-gated, external-actor
|
|
159
|
+
* re-stage authorization. Gates on the caller's `ssh-transport` capability,
|
|
160
|
+
* REFUSES loudly when the target version's payloads are unavailable for the
|
|
161
|
+
* host's platform (belt-and-suspenders over the check-step gate — never a
|
|
162
|
+
* skew), resolves the host reach + SSH key + restart spec, records the staged
|
|
163
|
+
* version, audits, and returns the material the ops agent needs to swap + restart
|
|
164
|
+
* the target's agent over SSH. Mints NO token: the re-staged permanent agent
|
|
165
|
+
* reconnects on its own persistent credential (no self-update-handoff).
|
|
166
|
+
*/
|
|
167
|
+
export declare function createRestageAgentHandler(deps: BringupApiDeps): (callingAgentId: string, params: Record<string, unknown>) => Promise<RestageAgentResult>;
|
|
69
168
|
/**
|
|
70
169
|
* Build the `kici.preBootSend` handler. Gates on the caller's capability,
|
|
71
170
|
* resolves the pre-boot input secret (e.g. a LUKS passphrase), audits, and
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dashboard
|
|
2
|
+
* Dashboard context handler for the orchestrator.
|
|
3
3
|
*
|
|
4
|
-
* Responds to dashboard.
|
|
5
|
-
* from Platform by calling the appropriate stores (
|
|
4
|
+
* Responds to dashboard.contexts.* and dashboard.held-runs.* WS messages
|
|
5
|
+
* from Platform by calling the appropriate stores (ContextStore, VariableStore,
|
|
6
6
|
* BindingStore, PgSecretStore) and sending typed responses.
|
|
7
7
|
*
|
|
8
8
|
* Each handler:
|
|
@@ -11,30 +11,29 @@
|
|
|
11
11
|
* 3. Returns a response message with requestId and data (or error)
|
|
12
12
|
*/
|
|
13
13
|
import { type Kysely } from 'kysely';
|
|
14
|
-
import type { HeldRunStore, ReleaseSignal } from '../
|
|
14
|
+
import type { HeldRunStore, ReleaseSignal } from '../contexts/held-runs.js';
|
|
15
15
|
import type { TeamMembershipLookup } from '../approvals/approval-resolver.js';
|
|
16
16
|
import type { DashboardPlatformToOrchMessage } from '@kici-dev/engine';
|
|
17
|
-
import type {
|
|
18
|
-
import type { VariableStore } from '../
|
|
19
|
-
import type { BindingStore } from '../
|
|
17
|
+
import type { ContextStore } from '../contexts/context-store.js';
|
|
18
|
+
import type { VariableStore } from '../contexts/variable-store.js';
|
|
19
|
+
import type { BindingStore } from '../contexts/binding-store.js';
|
|
20
20
|
import type { Database } from '../db/types.js';
|
|
21
21
|
import type { AccessLogWriter } from '../audit/access-log.js';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export interface DashboardEnvHandlerDeps {
|
|
22
|
+
import { type ScopedSecretStore } from '../secrets/scope-routing.js';
|
|
23
|
+
import type { ResolvedDashboardEncryptionKey } from '../secrets/dashboard-encryption-key.js';
|
|
24
|
+
/**
|
|
25
|
+
* Secret store interface (subset of PgSecretStore methods used here).
|
|
26
|
+
*
|
|
27
|
+
* Alias of the shared `ScopedSecretStore` so the WS plane and the HTTP admin
|
|
28
|
+
* plane route scopes against one contract.
|
|
29
|
+
*/
|
|
30
|
+
type SecretStoreForDashboard = ScopedSecretStore;
|
|
31
|
+
export interface DashboardContextHandlerDeps {
|
|
33
32
|
/** Organization ID for all operations. */
|
|
34
33
|
orgId: string;
|
|
35
34
|
/** Send a response message back to Platform over the WS connection. */
|
|
36
35
|
send: (msg: unknown) => void;
|
|
37
|
-
|
|
36
|
+
contextStore: ContextStore;
|
|
38
37
|
variableStore: VariableStore;
|
|
39
38
|
bindingStore: BindingStore;
|
|
40
39
|
secretStore: SecretStoreForDashboard;
|
|
@@ -54,6 +53,15 @@ export interface DashboardEnvHandlerDeps {
|
|
|
54
53
|
* handlers fall back to the direct status flip.
|
|
55
54
|
*/
|
|
56
55
|
approvals?: ApprovalHandlerDeps;
|
|
56
|
+
/**
|
|
57
|
+
* Dashboard-encryption key resolver. Present when KICI_SECRET_KEY is
|
|
58
|
+
* configured. Under the `encrypted` posture the secret/variable set handlers
|
|
59
|
+
* decrypt the browser-sealed envelope with the resolved private key. Absent ⇒
|
|
60
|
+
* `encrypted` writes fail closed (`encryption_unavailable`).
|
|
61
|
+
*/
|
|
62
|
+
dashboardEncryption?: {
|
|
63
|
+
resolve: () => Promise<ResolvedDashboardEncryptionKey | null>;
|
|
64
|
+
};
|
|
57
65
|
}
|
|
58
66
|
/** Dependencies enabling the resolver-backed approve/reject + resume path. */
|
|
59
67
|
export interface ApprovalHandlerDeps {
|
|
@@ -72,15 +80,15 @@ export interface ApprovalHandlerDeps {
|
|
|
72
80
|
rejectWorkflow?: (runId: string) => Promise<void>;
|
|
73
81
|
}
|
|
74
82
|
/**
|
|
75
|
-
* Handler for all dashboard
|
|
83
|
+
* Handler for all dashboard context and held run WS messages.
|
|
76
84
|
*
|
|
77
85
|
* Dispatches incoming messages by type and calls the appropriate store.
|
|
78
86
|
*/
|
|
79
|
-
export declare class
|
|
87
|
+
export declare class DashboardContextHandler {
|
|
80
88
|
private readonly deps;
|
|
81
89
|
private routingKey;
|
|
82
90
|
private readonly accessLog;
|
|
83
|
-
constructor(deps:
|
|
91
|
+
constructor(deps: DashboardContextHandlerDeps);
|
|
84
92
|
/** Update the orgId used for all operations (called when resolved from DB). */
|
|
85
93
|
setOrgId(orgId: string): void;
|
|
86
94
|
/** Update the routing key bound to access_log rows. */
|
|
@@ -92,6 +100,16 @@ export declare class DashboardEnvHandler {
|
|
|
92
100
|
* sends a structured `operation_disabled` envelope back to Platform.
|
|
93
101
|
*/
|
|
94
102
|
private enforcePolicy;
|
|
103
|
+
/**
|
|
104
|
+
* Resolve the plaintext value for a secret/variable set under the write
|
|
105
|
+
* policy. When the client sends a `sealed` envelope, decrypt it with the
|
|
106
|
+
* orchestrator's X25519 key (honored regardless of posture — the client chose
|
|
107
|
+
* to seal, so never expose that plaintext through the Platform). Otherwise,
|
|
108
|
+
* under the `encrypted` posture a plaintext `value` is refused (fail-closed);
|
|
109
|
+
* under `permissive` the plaintext `value` is used. Returns the plaintext or a
|
|
110
|
+
* structured error code the caller records + sends back.
|
|
111
|
+
*/
|
|
112
|
+
private resolveWriteValue;
|
|
95
113
|
/**
|
|
96
114
|
* Write an access_log row for a handler invocation. Uses the handler's
|
|
97
115
|
* bound orgId + routingKey, the msg.actor principal, and the handler-
|
|
@@ -105,8 +123,8 @@ export declare class DashboardEnvHandler {
|
|
|
105
123
|
handleMessage(msg: DashboardPlatformToOrchMessage): Promise<boolean>;
|
|
106
124
|
private handleEnvList;
|
|
107
125
|
/**
|
|
108
|
-
* Map each
|
|
109
|
-
* its scope bindings. Joins `
|
|
126
|
+
* Map each context id to the distinct secret key names reachable through
|
|
127
|
+
* its scope bindings. Joins `context_bindings` → `scoped_secrets` on the
|
|
110
128
|
* scope pattern, excluding the `__empty__` sentinel. Returns key names only —
|
|
111
129
|
* never values. Scoped to the caller-resolved org (the request's target org,
|
|
112
130
|
* or the connection-level org on the legacy path).
|
|
@@ -159,4 +177,4 @@ export declare class DashboardEnvHandler {
|
|
|
159
177
|
private sendError;
|
|
160
178
|
}
|
|
161
179
|
export {};
|
|
162
|
-
//# sourceMappingURL=dashboard-
|
|
180
|
+
//# sourceMappingURL=dashboard-context-handler.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator-side handler for the `dashboard.run.state` system reconciliation
|
|
3
|
+
* read.
|
|
4
|
+
*
|
|
5
|
+
* The Platform's `RunMirrorReconciler` issues this request for a run that is
|
|
6
|
+
* stuck non-terminal in the Platform mirror to recover a terminal frame that was
|
|
7
|
+
* dropped on a live Platform↔orchestrator connection. It projects the current
|
|
8
|
+
* `execution_runs` + `execution_jobs` state for one run into the same
|
|
9
|
+
* `StateReplayRun` shape the reconnect `state.replay` push carries, so the
|
|
10
|
+
* Platform can drive it through the shared `upsertRunMirror` helper.
|
|
11
|
+
*
|
|
12
|
+
* Unlike the user-plane `dashboard.run.detail` read, this handler does NOT write
|
|
13
|
+
* an `access_log` row: it is a system reconciliation read (a `system` actor),
|
|
14
|
+
* not a user data access. The handler is pure (deps passed as arguments) so the
|
|
15
|
+
* WS wiring in `server.ts` stays a thin adapter and the logic is unit-testable
|
|
16
|
+
* without a live Platform connection.
|
|
17
|
+
*/
|
|
18
|
+
import type { Kysely } from 'kysely';
|
|
19
|
+
import type { Database } from '../db/types.js';
|
|
20
|
+
import { type DashboardRunStateRequest, type DashboardRunStateResponse } from '@kici-dev/engine';
|
|
21
|
+
export interface RunStateHandlerDeps {
|
|
22
|
+
db: Kysely<Database>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build the `StateReplayRun` projection for one run, or `null` when the
|
|
26
|
+
* orchestrator has no such run. Mirrors the DB-backed branch of
|
|
27
|
+
* `ExecutionTracker.getReplayDataWithDb` (jobs = id/name/status;
|
|
28
|
+
* `jobCount = jobs.length`; `triggerEvent`/`commitMessage` omitted — no columns).
|
|
29
|
+
*/
|
|
30
|
+
export declare function handleRunState(deps: RunStateHandlerDeps, req: DashboardRunStateRequest): Promise<DashboardRunStateResponse>;
|
|
31
|
+
//# sourceMappingURL=dashboard-run-state-handler.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe, fixed messages the orchestrator sends to the agent (and through it to
|
|
3
|
+
* the workflow author) when an agent-WS request fails for an internal reason.
|
|
4
|
+
*
|
|
5
|
+
* These are presentation strings, not a wire vocabulary: the protocol carries
|
|
6
|
+
* them in the free-text `reason` field of `step.approval-resolved` and in the
|
|
7
|
+
* free-text `error` field of `event.emit.response` / `agent.api.response`, so an
|
|
8
|
+
* orchestrator is free to reword them without any agent-side change. They live
|
|
9
|
+
* in one module — rather than inline at each send site — so the handler, its
|
|
10
|
+
* tests and the `onEventEmit` callback in `app.ts` cannot drift apart.
|
|
11
|
+
*
|
|
12
|
+
* Raw exception text is never one of these. Exceptions stay in the
|
|
13
|
+
* orchestrator's own logs; the author sees only "this is an orchestrator
|
|
14
|
+
* problem", never a database endpoint, a constraint name or a stack frame.
|
|
15
|
+
*
|
|
16
|
+
* Author-actionable failures do not come through here at all — they ride the
|
|
17
|
+
* callback's return value with its own safe wording (an unknown job context, an
|
|
18
|
+
* approval bridge's timeout reason), which stays specific enough to debug a bad
|
|
19
|
+
* workflow without operator log access.
|
|
20
|
+
*/
|
|
21
|
+
export declare const AgentWsInternalFailure: Readonly<{
|
|
22
|
+
/** The step-approval bridge rejected instead of resolving the hold. */
|
|
23
|
+
readonly approvalFailed: 'the orchestrator hit an internal error while resolving this approval';
|
|
24
|
+
/** The event router threw while emitting the agent's event. */
|
|
25
|
+
readonly eventEmitFailed: 'the orchestrator hit an internal error while emitting this event';
|
|
26
|
+
/** An agent private-API handler threw for a reason other than its two deliberate rejections. */
|
|
27
|
+
readonly agentApiFailed: 'the orchestrator hit an internal error while handling this API request';
|
|
28
|
+
}>;
|
|
29
|
+
//# sourceMappingURL=failure-messages.d.ts.map
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Provenance ID-token relay (orchestrator side).
|
|
3
3
|
*
|
|
4
|
+
* @deprecated The Platform-rooted identity mint is hard-deprecated in favor of
|
|
5
|
+
* orchestrator-owned signing (`oidc/orchestrator-mint.ts`). This relay is
|
|
6
|
+
* registered ONLY when the orchestrator has NO provenance signer configured
|
|
7
|
+
* (`selectOidcMintRegistration` prefers the orchestrator-owned mint whenever
|
|
8
|
+
* `KICI_ORCHESTRATOR_PROVENANCE_ISSUER` is set). It is kept wire-compatible for
|
|
9
|
+
* the mixed-version rollout window; the `oidc.mint.*` RPC shim is removed at
|
|
10
|
+
* v1.0. Existing Platform-signed bundles keep verifying forever (the Platform
|
|
11
|
+
* JWKS stays published). See docs/user/deprecations.md.
|
|
12
|
+
*
|
|
4
13
|
* Backs the `oidc.token.request` agent.api method: an agent asks for a
|
|
5
14
|
* short-lived OIDC ID token for a job it is running; the orchestrator verifies
|
|
6
15
|
* the agent owns that job, resolves its runId from its own dispatch state, and
|
|
@@ -58,6 +67,12 @@ export interface OidcTokenHandlerDeps {
|
|
|
58
67
|
* OIDC audience (config.testMintDeferAudience). Ignored unless `testMode`.
|
|
59
68
|
*/
|
|
60
69
|
testMintDeferAudience?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Test-only: force the *initial* agent mint to defer for this OIDC audience
|
|
72
|
+
* (config.testMintRejectAudience) so a pending row is created, which the
|
|
73
|
+
* retrier then terminally rejects. Ignored unless `testMode`.
|
|
74
|
+
*/
|
|
75
|
+
testMintRejectAudience?: string;
|
|
61
76
|
}
|
|
62
77
|
/**
|
|
63
78
|
* Build the agent.api handler for `OIDC_TOKEN_REQUEST_METHOD`. Validates the
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { OwnershipTracker } from '../agent/ownership-tracker.js';
|
|
2
|
+
/** Whether a job-scoped agent frame may be handled. */
|
|
3
|
+
export type OwnershipDecision = 'accept' | 'reject';
|
|
4
|
+
/**
|
|
5
|
+
* Resolve whether `agentId` may act on `jobId`, in the two steps every
|
|
6
|
+
* job-scoped agent frame shares.
|
|
7
|
+
*
|
|
8
|
+
* 1. No tracker configured — ownership enforcement is off; accept.
|
|
9
|
+
* 2. The synchronous in-memory check hits — accept without touching the
|
|
10
|
+
* database. This is the hot path: the owning coordinator answers from its
|
|
11
|
+
* own `agentJobs` map.
|
|
12
|
+
* 3. Otherwise resolve asynchronously. `checkOwnership` returning false is
|
|
13
|
+
* "not decided yet", not "refused", whenever a database fallback is
|
|
14
|
+
* configured — so the caller must never treat step 2 as the verdict.
|
|
15
|
+
*
|
|
16
|
+
* A `reject` is final: the caller replies with the shared refusal wording (or,
|
|
17
|
+
* where the message has no reply, drops the frame). What it must never do is
|
|
18
|
+
* drop a frame that this function has not yet ruled on — an agent awaiting an
|
|
19
|
+
* acknowledgment would hang until its own deadline expired.
|
|
20
|
+
*/
|
|
21
|
+
export declare function gateOwnership(tracker: OwnershipTracker | undefined, agentId: string, jobId: string, messageType: string): Promise<OwnershipDecision>;
|
|
22
|
+
//# sourceMappingURL=ownership-gate.d.ts.map
|