@kici-dev/orchestrator 0.0.0 → 0.1.1
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/LICENSE +661 -0
- package/README.md +1 -6
- package/dist/__test-helpers__/mock-db.d.ts +103 -0
- package/dist/__test-helpers__/mock-ws.d.ts +13 -0
- package/dist/agent/dispatcher.d.ts +231 -0
- package/dist/agent/ownership-tracker.d.ts +46 -0
- package/dist/agent/registry.d.ts +255 -0
- package/dist/agent/token-store.d.ts +96 -0
- package/dist/app.d.ts +234 -0
- package/dist/audit/access-log.d.ts +92 -0
- package/dist/audit/sampling-rate-limiter.d.ts +41 -0
- package/dist/cache/build-coordinator.d.ts +42 -0
- package/dist/cache/dep-cache.d.ts +51 -0
- package/dist/cache/index.d.ts +16 -0
- package/dist/cache/pending-builds.d.ts +14 -0
- package/dist/cache/pending-dynamics.d.ts +15 -0
- package/dist/cache/pending-inits.d.ts +19 -0
- package/dist/cache/pending-tracker.d.ts +65 -0
- package/dist/cache/source-cache.d.ts +30 -0
- package/dist/cli/api-client.d.ts +411 -0
- package/dist/cli/commands/access-log.d.ts +30 -0
- package/dist/cli/commands/agent-service/index.d.ts +15 -0
- package/dist/cli/commands/agent-service/install.d.ts +9 -0
- package/dist/cli/commands/agent-service/logs.d.ts +9 -0
- package/dist/cli/commands/agent-service/restart.d.ts +8 -0
- package/dist/cli/commands/agent-service/start.d.ts +8 -0
- package/dist/cli/commands/agent-service/status.d.ts +10 -0
- package/dist/cli/commands/agent-service/stop.d.ts +8 -0
- package/dist/cli/commands/agent-service/uninstall.d.ts +9 -0
- package/dist/cli/commands/agent-service/upgrade.d.ts +11 -0
- package/dist/cli/commands/agent.d.ts +10 -0
- package/dist/cli/commands/api-key.d.ts +12 -0
- package/dist/cli/commands/audit.d.ts +9 -0
- package/dist/cli/commands/backend.d.ts +17 -0
- package/dist/cli/commands/cold-store-impl.d.ts +101 -0
- package/dist/cli/commands/cold-store.d.ts +30 -0
- package/dist/cli/commands/config.d.ts +16 -0
- package/dist/cli/commands/db.d.ts +19 -0
- package/dist/cli/commands/debug-bundle.d.ts +16 -0
- package/dist/cli/commands/diagnose.d.ts +15 -0
- package/dist/cli/commands/environment.d.ts +24 -0
- package/dist/cli/commands/event-dlq.d.ts +19 -0
- package/dist/cli/commands/event-log.d.ts +27 -0
- package/dist/cli/commands/event.d.ts +4 -0
- package/dist/cli/commands/execution.d.ts +17 -0
- package/dist/cli/commands/inspect-bundle.d.ts +16 -0
- package/dist/cli/commands/maintenance.d.ts +4 -0
- package/dist/cli/commands/orchestrator-service/index.d.ts +12 -0
- package/dist/cli/commands/orchestrator-service/install.d.ts +10 -0
- package/dist/cli/commands/orchestrator-service/logs.d.ts +10 -0
- package/dist/cli/commands/orchestrator-service/restart.d.ts +8 -0
- package/dist/cli/commands/orchestrator-service/start.d.ts +8 -0
- package/dist/cli/commands/orchestrator-service/status.d.ts +10 -0
- package/dist/cli/commands/orchestrator-service/stop.d.ts +8 -0
- package/dist/cli/commands/orchestrator-service/uninstall.d.ts +9 -0
- package/dist/cli/commands/orchestrator-service/upgrade.d.ts +12 -0
- package/dist/cli/commands/org-settings.d.ts +17 -0
- package/dist/cli/commands/peer.d.ts +13 -0
- package/dist/cli/commands/queue.d.ts +16 -0
- package/dist/cli/commands/registration.d.ts +18 -0
- package/dist/cli/commands/rotate.d.ts +9 -0
- package/dist/cli/commands/runs.d.ts +34 -0
- package/dist/cli/commands/secret.d.ts +12 -0
- package/dist/cli/commands/shared/db.d.ts +16 -0
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +38 -0
- package/dist/cli/commands/source.d.ts +24 -0
- package/dist/cli/commands/token.d.ts +10 -0
- package/dist/cli/commands/workflow.d.ts +31 -0
- package/dist/cli/join.d.ts +14 -0
- package/dist/cli/kici-admin.d.ts +13 -0
- package/dist/cli/lazy-deps/cache.d.ts +17 -0
- package/dist/cli/lazy-deps/downloader.d.ts +33 -0
- package/dist/cli/lazy-deps/registry.d.ts +43 -0
- package/dist/cli/service/compose.d.ts +25 -0
- package/dist/cli/service/index.d.ts +24 -0
- package/dist/cli/service/launchd.d.ts +34 -0
- package/dist/cli/service/platform-detect.d.ts +59 -0
- package/dist/cli/service/systemd.d.ts +41 -0
- package/dist/cli/service/types.d.ts +91 -0
- package/dist/cli/service/windows.d.ts +20 -0
- package/dist/cli/wizard/agent-wizard.d.ts +24 -0
- package/dist/cli/wizard/orchestrator-wizard.d.ts +38 -0
- package/dist/cli/wizard/prompts.d.ts +23 -0
- package/dist/cli.js +11435 -0
- package/dist/cluster/cluster-identity.d.ts +59 -0
- package/dist/cluster/coordinator.d.ts +204 -0
- package/dist/cluster/health-api.d.ts +30 -0
- package/dist/cluster/index.d.ts +24 -0
- package/dist/cluster/join-client.d.ts +75 -0
- package/dist/cluster/join-handler.d.ts +58 -0
- package/dist/cluster/join-token.d.ts +94 -0
- package/dist/cluster/orphan-recovery.d.ts +67 -0
- package/dist/cluster/peer-client.d.ts +190 -0
- package/dist/cluster/peer-credentials.d.ts +108 -0
- package/dist/cluster/peer-crypto.d.ts +57 -0
- package/dist/cluster/peer-handler.d.ts +97 -0
- package/dist/cluster/peer-registry.d.ts +186 -0
- package/dist/cluster/raft-state.d.ts +36 -0
- package/dist/cluster/raft.d.ts +140 -0
- package/dist/cold-store/load-access-log-range.d.ts +73 -0
- package/dist/cold-store/load-event-log-range.d.ts +62 -0
- package/dist/cold-store/load-secret-audit-log-range.d.ts +38 -0
- package/dist/cold-store/orchestrator-cold-store.d.ts +58 -0
- package/dist/cold-store/tables/access-log.d.ts +80 -0
- package/dist/cold-store/tables/event-log.d.ts +70 -0
- package/dist/cold-store/tables/execution-jobs.d.ts +63 -0
- package/dist/cold-store/tables/execution-runs.d.ts +81 -0
- package/dist/cold-store/tables/execution-steps.d.ts +65 -0
- package/dist/cold-store/tables/secret-audit-log.d.ts +77 -0
- package/dist/concurrency/dispatch-next-queued.d.ts +63 -0
- package/dist/concurrency/group-tracker.d.ts +51 -0
- package/dist/concurrency/index.d.ts +3 -0
- package/dist/concurrency/queue-manager.d.ts +68 -0
- package/dist/concurrency/waiters.d.ts +58 -0
- package/dist/config/encryption.d.ts +82 -0
- package/dist/config/env-overlay.d.ts +45 -0
- package/dist/config/index.d.ts +16 -0
- package/dist/config/loader.d.ts +26 -0
- package/dist/config/reload.d.ts +113 -0
- package/dist/config/resolver.d.ts +47 -0
- package/dist/config/schema.d.ts +210 -0
- package/dist/config/shared-store.d.ts +142 -0
- package/dist/config/types.d.ts +218 -0
- package/dist/config.d.ts +249 -0
- package/dist/cron/cron-scheduler.d.ts +78 -0
- package/dist/cron/cron-store.d.ts +38 -0
- package/dist/dashboard/handler.d.ts +243 -0
- package/dist/db/client.d.ts +13 -0
- package/dist/db/migration-provider.d.ts +9 -0
- package/dist/db/migrations/001_initial.d.ts +8 -0
- package/dist/db/migrations/002_config_versions_key_version.d.ts +16 -0
- package/dist/db/migrations/003_access_log.d.ts +26 -0
- package/dist/db/migrations/004_rename_bundle_to_source.d.ts +19 -0
- package/dist/db/migrations/005_cold_store_chunk_counter.d.ts +19 -0
- package/dist/db/migrations/006_runs_jobs_steps_archived_at.d.ts +38 -0
- package/dist/db/migrations/007_audit_logs_archived_at.d.ts +42 -0
- package/dist/db/migrations/008_event_log_archived_at.d.ts +40 -0
- package/dist/db/migrations/009_access_log_trigram.d.ts +15 -0
- package/dist/db/migrations/010_cold_store_chunks.d.ts +34 -0
- package/dist/db/migrations/011_drop_source_secrets_notify.d.ts +21 -0
- package/dist/db/migrations/012_peer_credentials_active_uniq.d.ts +28 -0
- package/dist/db/migrations/013_execution_log_bytes.d.ts +21 -0
- package/dist/db/migrations/014_kici_events_lease_retry.d.ts +36 -0
- package/dist/db/migrations/015_org_settings_customer_scoped.d.ts +30 -0
- package/dist/db/migrations/016_org_settings_allow_http_npm.d.ts +15 -0
- package/dist/db/migrations/017_org_id_widen.d.ts +4 -0
- package/dist/db/migrations/018_org_id_prefix_backfill.d.ts +4 -0
- package/dist/db/migrator.d.ts +32 -0
- package/dist/db/types.d.ts +1266 -0
- package/dist/diagnostics/bundle-reader.d.ts +48 -0
- package/dist/diagnostics/bundle-writer.d.ts +57 -0
- package/dist/diagnostics/checks/agents.d.ts +10 -0
- package/dist/diagnostics/checks/certs.d.ts +9 -0
- package/dist/diagnostics/checks/config.d.ts +10 -0
- package/dist/diagnostics/checks/db.d.ts +9 -0
- package/dist/diagnostics/checks/disk.d.ts +9 -0
- package/dist/diagnostics/checks/index.d.ts +17 -0
- package/dist/diagnostics/checks/ws.d.ts +9 -0
- package/dist/diagnostics/index.d.ts +13 -0
- package/dist/diagnostics/runner.d.ts +23 -0
- package/dist/diagnostics/types.d.ts +38 -0
- package/dist/entry-helpers.d.ts +93 -0
- package/dist/environments/binding-store.d.ts +27 -0
- package/dist/environments/environment-store.d.ts +74 -0
- package/dist/environments/held-runs.d.ts +64 -0
- package/dist/environments/index.d.ts +10 -0
- package/dist/environments/protection/branch-gate.d.ts +5 -0
- package/dist/environments/protection/concurrency-gate.d.ts +7 -0
- package/dist/environments/protection/pipeline.d.ts +18 -0
- package/dist/environments/protection/reviewer-gate.d.ts +7 -0
- package/dist/environments/protection/trust-gate.d.ts +7 -0
- package/dist/environments/protection/wait-timer-gate.d.ts +7 -0
- package/dist/environments/variable-store.d.ts +39 -0
- package/dist/events/circuit-breaker.d.ts +33 -0
- package/dist/events/event-emitter.d.ts +55 -0
- package/dist/events/event-retry-scanner.d.ts +52 -0
- package/dist/events/event-router.d.ts +183 -0
- package/dist/events/event-store.d.ts +157 -0
- package/dist/events/trust-store.d.ts +54 -0
- package/dist/events/types.d.ts +61 -0
- package/dist/helpers/ip-extraction.d.ts +29 -0
- package/dist/helpers/rate-limiter.d.ts +23 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +772 -0
- package/dist/lockfile-cache.d.ts +39 -0
- package/dist/metrics/agent-metrics-aggregator.d.ts +116 -0
- package/dist/metrics/metrics-reporter.d.ts +40 -0
- package/dist/metrics/prometheus.d.ts +261 -0
- package/dist/metrics/scheduled-jobs.d.ts +20 -0
- package/dist/orchestrator-core.d.ts +193 -0
- package/dist/pipeline/dispatch-matched-workflow.d.ts +102 -0
- package/dist/pipeline/inline-eval.d.ts +28 -0
- package/dist/pipeline/install-secrets-resolver.d.ts +73 -0
- package/dist/pipeline/manual-schedule.d.ts +21 -0
- package/dist/pipeline/needs-scheduler.d.ts +85 -0
- package/dist/pipeline/process-webhook.d.ts +38 -0
- package/dist/pipeline/processor.d.ts +326 -0
- package/dist/pipeline/rerun.d.ts +79 -0
- package/dist/pipeline/test-pipeline.d.ts +110 -0
- package/dist/provider-registry.d.ts +122 -0
- package/dist/providers/generic/index.d.ts +23 -0
- package/dist/providers/generic/normalizer.d.ts +112 -0
- package/dist/providers/generic/verification.d.ts +47 -0
- package/dist/providers/github/auth.d.ts +60 -0
- package/dist/providers/github/changed-files.d.ts +51 -0
- package/dist/providers/github/check-status-poster.d.ts +35 -0
- package/dist/providers/github/contributor-resolver.d.ts +30 -0
- package/dist/providers/github/index.d.ts +20 -0
- package/dist/providers/github/lock-file.d.ts +32 -0
- package/dist/providers/github/normalizer.d.ts +103 -0
- package/dist/providers/github/repo-url.d.ts +35 -0
- package/dist/providers/internal/index.d.ts +32 -0
- package/dist/providers/internal/lock-file-fetcher.d.ts +34 -0
- package/dist/providers/internal/normalizer.d.ts +89 -0
- package/dist/providers/internal/repo-url-builder.d.ts +42 -0
- package/dist/providers/universal-git/changed-files.d.ts +42 -0
- package/dist/providers/universal-git/clone-token.d.ts +83 -0
- package/dist/providers/universal-git/config.d.ts +192 -0
- package/dist/providers/universal-git/index.d.ts +55 -0
- package/dist/providers/universal-git/lock-file.d.ts +71 -0
- package/dist/providers/universal-git/normalizer.d.ts +90 -0
- package/dist/providers/universal-git/repo-url.d.ts +50 -0
- package/dist/providers/universal-git/ssh-auth.d.ts +94 -0
- package/dist/queue/bootstrap.d.ts +50 -0
- package/dist/queue/cleanup.d.ts +41 -0
- package/dist/queue/depth-refresher.d.ts +65 -0
- package/dist/queue/job-queue.d.ts +343 -0
- package/dist/queue/scheduled-job.d.ts +91 -0
- package/dist/registration/extractor.d.ts +44 -0
- package/dist/registration/registration-index.d.ts +162 -0
- package/dist/registration/registration-store.d.ts +111 -0
- package/dist/reporting/check-run-summary.d.ts +102 -0
- package/dist/reporting/commit-status.d.ts +382 -0
- package/dist/reporting/execution-tracker.d.ts +538 -0
- package/dist/reporting/fs-log-storage.d.ts +41 -0
- package/dist/reporting/log-pull-handler.d.ts +35 -0
- package/dist/reporting/log-storage.d.ts +70 -0
- package/dist/reporting/log-writer.d.ts +45 -0
- package/dist/reporting/s3-log-storage.d.ts +42 -0
- package/dist/reporting/step-log-buffer.d.ts +57 -0
- package/dist/routes/admin-access-log.d.ts +34 -0
- package/dist/routes/admin-backends.d.ts +28 -0
- package/dist/routes/admin-config.d.ts +57 -0
- package/dist/routes/admin-db.d.ts +20 -0
- package/dist/routes/admin-environments.d.ts +42 -0
- package/dist/routes/admin-errors.d.ts +4 -0
- package/dist/routes/admin-event-dlq.d.ts +39 -0
- package/dist/routes/admin-event-log.d.ts +42 -0
- package/dist/routes/admin-events.d.ts +46 -0
- package/dist/routes/admin-maintenance.d.ts +22 -0
- package/dist/routes/admin-org-settings.d.ts +29 -0
- package/dist/routes/admin-queue-execution.d.ts +27 -0
- package/dist/routes/admin-registrations.d.ts +37 -0
- package/dist/routes/admin-runs.d.ts +57 -0
- package/dist/routes/admin-scheduled-jobs.d.ts +36 -0
- package/dist/routes/admin-sources.d.ts +18 -0
- package/dist/routes/admin.d.ts +103 -0
- package/dist/routes/capabilities.d.ts +24 -0
- package/dist/routes/diagnostics.d.ts +16 -0
- package/dist/routes/health.d.ts +20 -0
- package/dist/routes/test-trigger.d.ts +41 -0
- package/dist/routes/uploads.d.ts +38 -0
- package/dist/routes/webhooks.d.ts +36 -0
- package/dist/scaler/bare-metal-backend.d.ts +107 -0
- package/dist/scaler/config.d.ts +303 -0
- package/dist/scaler/container-backend.d.ts +125 -0
- package/dist/scaler/file-tail.d.ts +23 -0
- package/dist/scaler/firecracker-api.d.ts +100 -0
- package/dist/scaler/firecracker-backend.d.ts +263 -0
- package/dist/scaler/index.d.ts +24 -0
- package/dist/scaler/ip-allocator.d.ts +177 -0
- package/dist/scaler/label-matcher.d.ts +73 -0
- package/dist/scaler/log-forwarder.d.ts +54 -0
- package/dist/scaler/machine-ledger.d.ts +160 -0
- package/dist/scaler/manager.d.ts +338 -0
- package/dist/scaler/nftables.d.ts +85 -0
- package/dist/scaler/types.d.ts +388 -0
- package/dist/scaler/warm-pool.d.ts +81 -0
- package/dist/secrets/audit-logger.d.ts +65 -0
- package/dist/secrets/backend-health.d.ts +60 -0
- package/dist/secrets/backend-registry.d.ts +68 -0
- package/dist/secrets/backend-sync.d.ts +40 -0
- package/dist/secrets/cleanup.d.ts +40 -0
- package/dist/secrets/config.d.ts +51 -0
- package/dist/secrets/crypto.d.ts +49 -0
- package/dist/secrets/ephemeral-keys.d.ts +49 -0
- package/dist/secrets/index.d.ts +17 -0
- package/dist/secrets/pg-secret-store.d.ts +105 -0
- package/dist/secrets/rbac.d.ts +47 -0
- package/dist/secrets/secret-output-store.d.ts +46 -0
- package/dist/secrets/secret-resolver.d.ts +137 -0
- package/dist/secrets/source-credentials.d.ts +61 -0
- package/dist/secrets/token-manager.d.ts +63 -0
- package/dist/secrets/vault-secret-store.d.ts +85 -0
- package/dist/security/comment-handler.d.ts +67 -0
- package/dist/security/contributor-cache.d.ts +75 -0
- package/dist/security/global-workflow-policy.d.ts +72 -0
- package/dist/security/lock-source.d.ts +34 -0
- package/dist/security/trust-resolver.d.ts +108 -0
- package/dist/security/workflow-diff.d.ts +26 -0
- package/dist/server.d.ts +17 -0
- package/dist/server.js +48055 -0
- package/dist/sources/index.d.ts +10 -0
- package/dist/sources/source-manager.d.ts +63 -0
- package/dist/sources/source-store.d.ts +79 -0
- package/dist/sources/source-validator.d.ts +16 -0
- package/dist/stale-detector/stale-run-detector.d.ts +109 -0
- package/dist/standalone.d.ts +20 -0
- package/dist/standalone.js +41546 -0
- package/dist/storage/blob-routes.d.ts +20 -0
- package/dist/storage/filesystem.d.ts +60 -0
- package/dist/storage/index.d.ts +20 -0
- package/dist/storage/s3.d.ts +68 -0
- package/dist/storage/sign-url.d.ts +45 -0
- package/dist/storage/types.d.ts +98 -0
- package/dist/webhook/dedup.d.ts +44 -0
- package/dist/webhook/event-log.d.ts +83 -0
- package/dist/webhook/generic-sources.d.ts +169 -0
- package/dist/webhook/handler.d.ts +23 -0
- package/dist/webhook/relay-buffer.d.ts +96 -0
- package/dist/webhook/verify-inbound.d.ts +78 -0
- package/dist/worker/in-memory-execution-tracker.d.ts +94 -0
- package/dist/worker/in-memory-job-queue.d.ts +74 -0
- package/dist/worker/static-agent-token-store.d.ts +58 -0
- package/dist/worker/worker-status.d.ts +36 -0
- package/dist/worker-core.d.ts +74 -0
- package/dist/ws/agent-api-registry.d.ts +49 -0
- package/dist/ws/agent-handler.d.ts +176 -0
- package/dist/ws/agent-heartbeat.d.ts +45 -0
- package/dist/ws/dashboard-backends-handler.d.ts +51 -0
- package/dist/ws/dashboard-diagnostics-handler.d.ts +56 -0
- package/dist/ws/dashboard-env-handler.d.ts +107 -0
- package/dist/ws/dashboard-global-workflows-handler.d.ts +72 -0
- package/dist/ws/dashboard-registrations-handler.d.ts +84 -0
- package/dist/ws/event-buffer.d.ts +16 -0
- package/dist/ws/observer-handler.d.ts +42 -0
- package/dist/ws/observer-registry.d.ts +88 -0
- package/dist/ws/platform-client.d.ts +270 -0
- package/dist/ws/server-options.d.ts +15 -0
- package/package.json +87 -6
- package/sbom.spdx.json +14370 -0
- package/index.js +0 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log writer that transforms agent log lines into JSONL and persists to LogStorage.
|
|
3
|
+
*
|
|
4
|
+
* Each log line is formatted as a JSON object with timestamp, level, message,
|
|
5
|
+
* and metadata fields. Lines are written to the standard log path layout:
|
|
6
|
+
* executions/{runId}/job-{name}/step-{index}.log
|
|
7
|
+
*
|
|
8
|
+
* For filesystem storage, data is appended immediately (no buffering).
|
|
9
|
+
* For S3 storage, the LogStorage backend handles read-concat-put.
|
|
10
|
+
*/
|
|
11
|
+
import type { LogStorage } from './log-storage.js';
|
|
12
|
+
import type { ObserverRegistry } from '../ws/observer-registry.js';
|
|
13
|
+
interface LogWriterDeps {
|
|
14
|
+
logStorage: LogStorage;
|
|
15
|
+
/** Optional observer registry for broadcasting log chunks to CLI observers. */
|
|
16
|
+
observerRegistry?: ObserverRegistry;
|
|
17
|
+
/** Optional function to check if a run is a test run (for observer broadcasting). */
|
|
18
|
+
isTestRun?: (runId: string) => boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class LogWriter {
|
|
21
|
+
private readonly logStorage;
|
|
22
|
+
private readonly observerRegistry?;
|
|
23
|
+
private readonly isTestRun?;
|
|
24
|
+
constructor(deps: LogWriterDeps);
|
|
25
|
+
/**
|
|
26
|
+
* Append log lines from an agent to storage in JSONL format.
|
|
27
|
+
*
|
|
28
|
+
* Each line is formatted as:
|
|
29
|
+
* {"ts":"2026-01-01T00:00:00.000Z","level":"stdout","msg":"line content","meta":{}}
|
|
30
|
+
*
|
|
31
|
+
* Also fans log chunks to connected observers for real-time streaming
|
|
32
|
+
* (test runs only, when observerRegistry is configured).
|
|
33
|
+
*
|
|
34
|
+
* @param runId - Execution run ID
|
|
35
|
+
* @param jobName - Job name (not job ID)
|
|
36
|
+
* @param stepIndex - Step index within the job (0-based)
|
|
37
|
+
* @param lines - Raw log lines from the agent
|
|
38
|
+
* @param timestamp - Timestamp from the agent message (epoch ms)
|
|
39
|
+
* @param jobId - Job ID for observer broadcasting (optional)
|
|
40
|
+
* @param stepName - Step name for observer broadcasting (optional)
|
|
41
|
+
*/
|
|
42
|
+
appendChunk(runId: string, jobName: string, stepIndex: number, lines: string[], timestamp: number, jobId?: string, stepName?: string): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=log-writer.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S3-backed log storage.
|
|
3
|
+
*
|
|
4
|
+
* Stores execution logs in S3. No TTL -- logs persist indefinitely.
|
|
5
|
+
*
|
|
6
|
+
* Implementation notes:
|
|
7
|
+
* - append() reads existing content + concatenates + puts back (acceptable
|
|
8
|
+
* for the sequential step model where max ~10MB per step)
|
|
9
|
+
* - read() uses Range header for cursor-based pagination
|
|
10
|
+
* - exists() uses HeadObject
|
|
11
|
+
* - list() uses ListObjectsV2 with prefix
|
|
12
|
+
*
|
|
13
|
+
* Uses AWS SDK v3 modular imports -- only loaded when S3 storage is configured.
|
|
14
|
+
*/
|
|
15
|
+
import type { LogReadOptions, LogReadResult, LogStorage } from './log-storage.js';
|
|
16
|
+
interface S3LogStorageOptions {
|
|
17
|
+
bucket: string;
|
|
18
|
+
prefix: string;
|
|
19
|
+
region?: string;
|
|
20
|
+
/** Custom endpoint URL for S3-compatible services (e.g., SeaweedFS, LocalStack) */
|
|
21
|
+
endpoint?: string;
|
|
22
|
+
/** Use path-style access instead of virtual-hosted-style (required for most S3-compatible services) */
|
|
23
|
+
forcePathStyle?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare class S3LogStorage implements LogStorage {
|
|
26
|
+
private readonly client;
|
|
27
|
+
private readonly bucket;
|
|
28
|
+
private readonly prefix;
|
|
29
|
+
constructor(options: S3LogStorageOptions);
|
|
30
|
+
/** Build the full S3 object key from a log path. */
|
|
31
|
+
private objectKey;
|
|
32
|
+
/** Check if an error is a "not found" error (NoSuchKey, NotFound, 404). */
|
|
33
|
+
private isNotFoundError;
|
|
34
|
+
/** Read the full content of an S3 object as a string. Returns null if not found. */
|
|
35
|
+
private getContent;
|
|
36
|
+
append(path: string, data: string): Promise<void>;
|
|
37
|
+
read(path: string, options?: LogReadOptions): Promise<LogReadResult>;
|
|
38
|
+
exists(path: string): Promise<boolean>;
|
|
39
|
+
list(prefix: string): Promise<string[]>;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=s3-log-storage.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ring buffer for per-step log line retention.
|
|
3
|
+
*
|
|
4
|
+
* Stores the last N ANSI-stripped log lines per step for use in check run
|
|
5
|
+
* summaries. Log lines are keyed by `{runId}:{jobId}:{stepIndex}` so each
|
|
6
|
+
* step gets its own independent buffer. When the buffer exceeds maxLines,
|
|
7
|
+
* the oldest lines are evicted.
|
|
8
|
+
*
|
|
9
|
+
* The totalCount field tracks how many lines were added in total (not just
|
|
10
|
+
* retained), enabling the truncation indicator: "showing last 20 of N lines".
|
|
11
|
+
*/
|
|
12
|
+
/** Entry stored per step in the buffer. */
|
|
13
|
+
export interface StepLogEntry {
|
|
14
|
+
/** The retained (last N) log lines, ANSI-stripped. */
|
|
15
|
+
lines: string[];
|
|
16
|
+
/** Total number of lines added (including evicted ones). */
|
|
17
|
+
totalCount: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class StepLogBuffer {
|
|
20
|
+
private readonly maxLines;
|
|
21
|
+
private readonly entries;
|
|
22
|
+
constructor(opts?: {
|
|
23
|
+
maxLines?: number;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Build the composite key for a step.
|
|
27
|
+
*/
|
|
28
|
+
private buildKey;
|
|
29
|
+
/**
|
|
30
|
+
* Add log lines for a step.
|
|
31
|
+
*
|
|
32
|
+
* ANSI codes are stripped from each line before storage.
|
|
33
|
+
* When the buffer exceeds maxLines, the oldest lines are evicted.
|
|
34
|
+
*/
|
|
35
|
+
addLines(key: {
|
|
36
|
+
runId: string;
|
|
37
|
+
jobId: string;
|
|
38
|
+
stepIndex: number;
|
|
39
|
+
}, rawLines: string[]): void;
|
|
40
|
+
/**
|
|
41
|
+
* Get the last N lines and total count for a step.
|
|
42
|
+
*
|
|
43
|
+
* Returns undefined if no lines have been added for this step.
|
|
44
|
+
*/
|
|
45
|
+
getLastLines(key: {
|
|
46
|
+
runId: string;
|
|
47
|
+
jobId: string;
|
|
48
|
+
stepIndex: number;
|
|
49
|
+
}): StepLogEntry | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Remove all entries for a given runId.
|
|
52
|
+
*
|
|
53
|
+
* Called when the execution tracker prunes a completed run from memory.
|
|
54
|
+
*/
|
|
55
|
+
cleanup(runId: string): void;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=step-log-buffer.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for the access log (access_log table).
|
|
3
|
+
*
|
|
4
|
+
* Operator-facing read access to read + orchestrator-admin mutation attempts
|
|
5
|
+
* captured with ActorPrincipal attribution. Mirrors the dashboard's
|
|
6
|
+
* dashboard.access-log.list WS handler but exposed over HTTP + Bearer auth
|
|
7
|
+
* so operators can dogfood from the CLI without going through the dashboard.
|
|
8
|
+
*
|
|
9
|
+
* GET /api/v1/admin/access-log
|
|
10
|
+
* Filters: orgId, actorType, actorId, action, source, outcome,
|
|
11
|
+
* targetType, targetId, from, to, limit, cursor
|
|
12
|
+
* Requires: access_log.read
|
|
13
|
+
*
|
|
14
|
+
* GET /api/v1/admin/access-log/:id
|
|
15
|
+
* Requires: access_log.read
|
|
16
|
+
*/
|
|
17
|
+
import { Hono } from 'hono';
|
|
18
|
+
import type { AccessLogWriter } from '../audit/access-log.js';
|
|
19
|
+
import type { TokenManager } from '../secrets/token-manager.js';
|
|
20
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
21
|
+
export interface AdminAccessLogRoutesDeps {
|
|
22
|
+
accessLog: AccessLogWriter;
|
|
23
|
+
tokenManager: TokenManager;
|
|
24
|
+
rbac: RbacEnforcer;
|
|
25
|
+
}
|
|
26
|
+
type AdminEnv = {
|
|
27
|
+
Variables: {
|
|
28
|
+
role: Role;
|
|
29
|
+
userId: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare function createAdminAccessLogRoutes(deps: AdminAccessLogRoutesDeps): Hono<AdminEnv>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=admin-access-log.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for secret backend management.
|
|
3
|
+
*
|
|
4
|
+
* Provides CRUD, connectivity testing, and sync endpoints for managing
|
|
5
|
+
* secret backends (PG, Vault) through the admin API. Backend credentials
|
|
6
|
+
* are stored encrypted at rest and never exposed in API responses.
|
|
7
|
+
*
|
|
8
|
+
* All routes are mounted under /api/v1/admin/backends and protected by
|
|
9
|
+
* the admin auth middleware in admin.ts.
|
|
10
|
+
*/
|
|
11
|
+
import { Hono } from 'hono';
|
|
12
|
+
import type { BackendSyncManager } from '@kici-dev/engine';
|
|
13
|
+
import type { BackendRegistry } from '../secrets/backend-registry.js';
|
|
14
|
+
import type { BackendHealthChecker } from '../secrets/backend-health.js';
|
|
15
|
+
interface BackendRouteDeps {
|
|
16
|
+
registry: BackendRegistry;
|
|
17
|
+
healthChecker: BackendHealthChecker;
|
|
18
|
+
syncManager?: BackendSyncManager;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create admin API routes for secret backend management.
|
|
22
|
+
*
|
|
23
|
+
* @param deps - Backend route dependencies (registry, health checker, sync manager)
|
|
24
|
+
* @returns Hono app with backend routes
|
|
25
|
+
*/
|
|
26
|
+
export declare function createBackendRoutes(deps: BackendRouteDeps): Hono;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=admin-backends.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin REST API routes for config management.
|
|
3
|
+
*
|
|
4
|
+
* Provides endpoints under /admin/config/* for:
|
|
5
|
+
* - seed: bulk import shared config from JSON body
|
|
6
|
+
* - get: current effective config (merged local + shared + env)
|
|
7
|
+
* - set: update single field in shared config
|
|
8
|
+
* - delete: remove field from shared config
|
|
9
|
+
* - export: dump shared config (redacted)
|
|
10
|
+
* - validate: validate config against schema (no DB mutation)
|
|
11
|
+
* - diff: compare local YAML vs shared DB config
|
|
12
|
+
* - history: version history
|
|
13
|
+
* - rollback: rollback to specific version
|
|
14
|
+
* - reload: trigger config reload
|
|
15
|
+
*
|
|
16
|
+
* All routes protected by Bearer token auth (reuses admin middleware pattern).
|
|
17
|
+
*/
|
|
18
|
+
import { Hono } from 'hono';
|
|
19
|
+
import type { SharedConfigStore } from '../config/shared-store.js';
|
|
20
|
+
import type { ConfigReloader, ReloadResult } from '../config/reload.js';
|
|
21
|
+
import type { LocalConfig } from '../config/types.js';
|
|
22
|
+
/**
|
|
23
|
+
* Result of forwarding a reload request to a peer orchestrator.
|
|
24
|
+
*
|
|
25
|
+
* - `result` carries the ReloadResult from the target peer when delivery succeeded.
|
|
26
|
+
* - `result === null` means the target peer is not connected (or unknown).
|
|
27
|
+
*/
|
|
28
|
+
export interface PeerReloadForwardResult {
|
|
29
|
+
result: ReloadResult | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Dependencies for config admin routes.
|
|
33
|
+
*/
|
|
34
|
+
export interface ConfigRouteDeps {
|
|
35
|
+
sharedStore: SharedConfigStore;
|
|
36
|
+
configReloader: ConfigReloader;
|
|
37
|
+
localConfigPath?: string;
|
|
38
|
+
loadLocalConfig: () => Promise<LocalConfig>;
|
|
39
|
+
/** Admin token for Bearer auth. If undefined, routes return 503. */
|
|
40
|
+
adminToken?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Forward a config reload request to a specific peer instance via the
|
|
43
|
+
* cluster peer connection. Returns the peer's ReloadResult, or `null` if
|
|
44
|
+
* the target peer is unknown / not connected. When omitted, per-instance
|
|
45
|
+
* targeting is unavailable and `target` requests return 501.
|
|
46
|
+
*/
|
|
47
|
+
forwardReloadToPeer?: (targetInstanceId: string, opts: {
|
|
48
|
+
drain?: boolean;
|
|
49
|
+
timeoutMs?: number;
|
|
50
|
+
}) => Promise<ReloadResult | null>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create admin config routes.
|
|
54
|
+
* Returns a Hono app to be mounted at /admin/config.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createConfigAdminRoutes(deps: ConfigRouteDeps): Hono;
|
|
57
|
+
//# sourceMappingURL=admin-config.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for database migration management.
|
|
3
|
+
*
|
|
4
|
+
* Provides endpoints to run pending migrations and check migration status
|
|
5
|
+
* through the admin API. Uses advisory locking for concurrency safety
|
|
6
|
+
* across multiple orchestrator instances.
|
|
7
|
+
*
|
|
8
|
+
* All routes are mounted under /api/v1/admin/db and protected by
|
|
9
|
+
* the admin auth middleware in admin.ts.
|
|
10
|
+
*/
|
|
11
|
+
import { Hono } from 'hono';
|
|
12
|
+
import type { Kysely } from 'kysely';
|
|
13
|
+
import type pg from 'pg';
|
|
14
|
+
interface DbRouteDeps {
|
|
15
|
+
db: Kysely<any>;
|
|
16
|
+
pool: pg.Pool;
|
|
17
|
+
}
|
|
18
|
+
export declare function createDbRoutes(deps: DbRouteDeps): Hono;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=admin-db.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for environment management.
|
|
3
|
+
*
|
|
4
|
+
* POST /api/v1/admin/environments — create (upsert)
|
|
5
|
+
* POST /api/v1/admin/environments/:name/bind — bind a scope pattern
|
|
6
|
+
* PATCH /api/v1/admin/environments/:name/policy — update policy fields
|
|
7
|
+
* GET /api/v1/admin/environments?orgId=<id> — list environments
|
|
8
|
+
* GET /api/v1/admin/environments/:name?orgId=<id> — show env + vars + bindings
|
|
9
|
+
* POST /api/v1/admin/environments/templates — create/update a template
|
|
10
|
+
*
|
|
11
|
+
* Backs the `kici-admin environment` dual-mode CLI. Offline (direct-DB) mode
|
|
12
|
+
* bypasses this router entirely — the CLI calls `*Direct` helpers from
|
|
13
|
+
* @kici-dev/shared. This HTTP surface exists so tooling with only an admin
|
|
14
|
+
* token (no DB reach) can do the same operations.
|
|
15
|
+
*
|
|
16
|
+
* All routes are protected by the admin auth middleware mounted in admin.ts
|
|
17
|
+
* (at `/api/v1/admin/*`). That middleware sets `role` + `userId` on the
|
|
18
|
+
* context, which we use for RBAC gating here.
|
|
19
|
+
*/
|
|
20
|
+
import { Hono } from 'hono';
|
|
21
|
+
import { type Kysely } from 'kysely';
|
|
22
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
23
|
+
export interface AdminEnvironmentRoutesDeps {
|
|
24
|
+
db: Kysely<any>;
|
|
25
|
+
rbac: RbacEnforcer;
|
|
26
|
+
}
|
|
27
|
+
/** Hono env type for admin-environments routes with context variables. */
|
|
28
|
+
type AdminEnvEnv = {
|
|
29
|
+
Variables: {
|
|
30
|
+
role: Role;
|
|
31
|
+
userId: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Create admin API routes for environment management.
|
|
36
|
+
*
|
|
37
|
+
* @param deps - db (Kysely) + rbac enforcer
|
|
38
|
+
* @returns Hono app mounted at /api/v1/admin
|
|
39
|
+
*/
|
|
40
|
+
export declare function createAdminEnvironmentRoutes(deps: AdminEnvironmentRoutesDeps): Hono<AdminEnvEnv>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=admin-environments.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for the event DLQ (dead-letter queue).
|
|
3
|
+
*
|
|
4
|
+
* Exposes the orchestrator-side DLQ — events that exhausted their dispatch
|
|
5
|
+
* retry budget — over Bearer-auth HTTP so operators can list, manually retry,
|
|
6
|
+
* or discard rows from the kici-admin CLI / dashboard.
|
|
7
|
+
*
|
|
8
|
+
* GET /api/v1/admin/event-dlq — list DLQ events (limit + cursor)
|
|
9
|
+
* GET /api/v1/admin/event-dlq/count — number of DLQ events (for badge)
|
|
10
|
+
* POST /api/v1/admin/event-dlq/:id/retry — clear DLQ flag, schedule for retry
|
|
11
|
+
* DELETE /api/v1/admin/event-dlq/:id — permanently discard a DLQ event
|
|
12
|
+
*
|
|
13
|
+
* The retry path also issues `pg_notify('kici_event_channel', id)` so a
|
|
14
|
+
* healthy node picks the event up immediately rather than waiting for the
|
|
15
|
+
* leader-only retry scanner's next tick.
|
|
16
|
+
*
|
|
17
|
+
* Mutations write an access_log row (event_dlq.retry / event_dlq.discard).
|
|
18
|
+
*/
|
|
19
|
+
import { Hono } from 'hono';
|
|
20
|
+
import type { EventStore } from '../events/event-store.js';
|
|
21
|
+
import type { TokenManager } from '../secrets/token-manager.js';
|
|
22
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
23
|
+
import type { AccessLogWriter } from '../audit/access-log.js';
|
|
24
|
+
export interface AdminEventDlqRoutesDeps {
|
|
25
|
+
eventStore: EventStore;
|
|
26
|
+
tokenManager: TokenManager;
|
|
27
|
+
rbac: RbacEnforcer;
|
|
28
|
+
/** Required so retry/discard mutations land in the access log. */
|
|
29
|
+
accessLog?: AccessLogWriter;
|
|
30
|
+
}
|
|
31
|
+
type AdminEnv = {
|
|
32
|
+
Variables: {
|
|
33
|
+
role: Role;
|
|
34
|
+
userId: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare function createAdminEventDlqRoutes(deps: AdminEventDlqRoutesDeps): Hono<AdminEnv>;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=admin-event-dlq.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for the inbound webhook delivery log (event_log table).
|
|
3
|
+
*
|
|
4
|
+
* Operator-facing read access to the per-delivery records the orchestrator
|
|
5
|
+
* persists for every inbound webhook. Mirrors the dashboard's WS handler
|
|
6
|
+
* (`DashboardHandler.handleEventLogList/Detail`) but is exposed over HTTP +
|
|
7
|
+
* Bearer auth so operators can dogfood from the CLI without going through
|
|
8
|
+
* the dashboard.
|
|
9
|
+
*
|
|
10
|
+
* GET /api/v1/admin/event-log
|
|
11
|
+
* Filters: orgId, routingKey, event, status, from, to, deliveryId, limit, offset
|
|
12
|
+
* Requires: event_log.read
|
|
13
|
+
*
|
|
14
|
+
* GET /api/v1/admin/event-log/:deliveryId
|
|
15
|
+
* Query: orgId (required), includePayload (default false)
|
|
16
|
+
* Requires: event_log.read
|
|
17
|
+
* The `includePayload` flag additionally requires event_log.read_payload.
|
|
18
|
+
*/
|
|
19
|
+
import { Hono } from 'hono';
|
|
20
|
+
import { type ColdStore } from '@kici-dev/shared';
|
|
21
|
+
import type { Kysely } from 'kysely';
|
|
22
|
+
import type { Database } from '../db/types.js';
|
|
23
|
+
import type { TokenManager } from '../secrets/token-manager.js';
|
|
24
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
25
|
+
import type { LogStorage } from '../reporting/log-storage.js';
|
|
26
|
+
export interface AdminEventLogRoutesDeps {
|
|
27
|
+
db: Kysely<Database>;
|
|
28
|
+
logStorage: LogStorage;
|
|
29
|
+
tokenManager: TokenManager;
|
|
30
|
+
rbac: RbacEnforcer;
|
|
31
|
+
/** Phase E: optional cold-store for archived event_log rows. */
|
|
32
|
+
coldStore?: ColdStore;
|
|
33
|
+
}
|
|
34
|
+
type AdminEnv = {
|
|
35
|
+
Variables: {
|
|
36
|
+
role: Role;
|
|
37
|
+
userId: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export declare function createAdminEventLogRoutes(deps: AdminEventLogRoutesDeps): Hono<AdminEnv>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=admin-event-log.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for generic webhook sources and trust management.
|
|
3
|
+
*
|
|
4
|
+
* Provides CRUD endpoints for managing generic webhook sources (create, list,
|
|
5
|
+
* get, update, delete, enable, disable) and cross-repo trust relationships.
|
|
6
|
+
*
|
|
7
|
+
* All routes are protected by Bearer token authentication via the existing
|
|
8
|
+
* admin auth middleware pattern from admin.ts.
|
|
9
|
+
*/
|
|
10
|
+
import { Hono } from 'hono';
|
|
11
|
+
import type pg from 'pg';
|
|
12
|
+
import type { GenericSourceManager } from '../webhook/generic-sources.js';
|
|
13
|
+
import type { TrustStore } from '../events/trust-store.js';
|
|
14
|
+
import type { TokenManager } from '../secrets/token-manager.js';
|
|
15
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
16
|
+
/**
|
|
17
|
+
* Dependencies for admin event routes.
|
|
18
|
+
*/
|
|
19
|
+
interface AdminEventRouteDeps {
|
|
20
|
+
sourceManager: GenericSourceManager;
|
|
21
|
+
trustStore: TrustStore;
|
|
22
|
+
tokenManager: TokenManager;
|
|
23
|
+
rbac: RbacEnforcer;
|
|
24
|
+
/**
|
|
25
|
+
* Optional — when provided, the `POST /api/v1/admin/events/emit` route is
|
|
26
|
+
* mounted so operators can INSERT into `kici_events` + `pg_notify` via HTTP.
|
|
27
|
+
* Mirrors `emitKiciEventDirect` in `@kici-dev/shared` (direct-DB CLI mode).
|
|
28
|
+
*/
|
|
29
|
+
pool?: pg.Pool;
|
|
30
|
+
}
|
|
31
|
+
/** Hono env type for admin event routes with context variables. */
|
|
32
|
+
type AdminEventEnv = {
|
|
33
|
+
Variables: {
|
|
34
|
+
role: Role;
|
|
35
|
+
userId: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Create admin API routes for generic webhook sources and trust management.
|
|
40
|
+
*
|
|
41
|
+
* @param deps - Admin event route dependencies
|
|
42
|
+
* @returns Hono app with admin event routes mounted at /api/v1/admin/*
|
|
43
|
+
*/
|
|
44
|
+
export declare function createAdminEventRoutes(deps: AdminEventRouteDeps): Hono<AdminEventEnv>;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=admin-events.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for ops-grade maintenance operations that don't fit
|
|
3
|
+
* cleanly under a single resource namespace:
|
|
4
|
+
*
|
|
5
|
+
* POST /api/v1/admin/queue/clear — TRUNCATE dispatch_queue
|
|
6
|
+
* POST /api/v1/admin/execution/purge-stale — DELETE execution runs + jobs
|
|
7
|
+
* POST /api/v1/admin/sources/purge-stale — DELETE orphan sources + scoped secrets
|
|
8
|
+
* POST /api/v1/admin/secrets/purge — DELETE scoped_secrets (bulk)
|
|
9
|
+
*
|
|
10
|
+
* Each endpoint accepts a minimal JSON body for scoping (e.g. routing key,
|
|
11
|
+
* org ID) and supports a "dry run" mode where applicable. All mutations are
|
|
12
|
+
* gated by the admin auth middleware in admin.ts, so unauthenticated access
|
|
13
|
+
* is impossible.
|
|
14
|
+
*/
|
|
15
|
+
import { Hono } from 'hono';
|
|
16
|
+
import type { Kysely } from 'kysely';
|
|
17
|
+
interface MaintenanceRouteDeps {
|
|
18
|
+
db: Kysely<any>;
|
|
19
|
+
}
|
|
20
|
+
export declare function createMaintenanceRoutes(deps: MaintenanceRouteDeps): Hono;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=admin-maintenance.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for org-level global workflow settings.
|
|
3
|
+
*
|
|
4
|
+
* Exposes GET / PATCH `/api/v1/admin/org-settings/global-workflows` so
|
|
5
|
+
* `kici-admin` can read and write the per-org row in `org_settings`
|
|
6
|
+
* without going through the Platform dashboard proxy — the CLI stays
|
|
7
|
+
* operable even when Platform is unavailable.
|
|
8
|
+
*
|
|
9
|
+
* Mutations require the `secret.write` RBAC capability (already granted to
|
|
10
|
+
* admin / owner roles), matching the gating posture used by source admin.
|
|
11
|
+
*/
|
|
12
|
+
import { Hono } from 'hono';
|
|
13
|
+
import { type Kysely } from 'kysely';
|
|
14
|
+
import type { Database } from '../db/types.js';
|
|
15
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
16
|
+
interface OrgSettingsRouteDeps {
|
|
17
|
+
db: Kysely<Database>;
|
|
18
|
+
rbac: RbacEnforcer;
|
|
19
|
+
}
|
|
20
|
+
type AdminEnv = {
|
|
21
|
+
Variables: {
|
|
22
|
+
role: Role;
|
|
23
|
+
userId: string;
|
|
24
|
+
routingKey: string | null;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare function createOrgSettingsRoutes(deps: OrgSettingsRouteDeps): Hono<AdminEnv>;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=admin-org-settings.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for queue + execution READ operations (5a #3 /).
|
|
3
|
+
*
|
|
4
|
+
* GET /api/v1/admin/queue — list dispatch_queue
|
|
5
|
+
* GET /api/v1/admin/queue/:id — show one dispatch_queue row
|
|
6
|
+
* GET /api/v1/admin/executions — list execution_runs
|
|
7
|
+
* GET /api/v1/admin/executions/:runId — show one run + its jobs
|
|
8
|
+
*
|
|
9
|
+
* All routes are gated by the admin auth middleware mounted in admin.ts
|
|
10
|
+
* and require `secret.read` RBAC (the closest existing read-grade permission).
|
|
11
|
+
*/
|
|
12
|
+
import { Hono } from 'hono';
|
|
13
|
+
import { type Kysely } from 'kysely';
|
|
14
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
15
|
+
export interface AdminQueueExecutionRoutesDeps {
|
|
16
|
+
db: Kysely<any>;
|
|
17
|
+
rbac: RbacEnforcer;
|
|
18
|
+
}
|
|
19
|
+
type AdminQEEnv = {
|
|
20
|
+
Variables: {
|
|
21
|
+
role: Role;
|
|
22
|
+
userId: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare function createAdminQueueExecutionRoutes(deps: AdminQueueExecutionRoutesDeps): Hono<AdminQEEnv>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=admin-queue-execution.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for workflow registration management.
|
|
3
|
+
*
|
|
4
|
+
* Provides endpoints for listing, inspecting, refreshing, and deleting
|
|
5
|
+
* workflow registrations. All routes are protected by Bearer token
|
|
6
|
+
* authentication via the existing admin auth middleware pattern.
|
|
7
|
+
*/
|
|
8
|
+
import { Hono } from 'hono';
|
|
9
|
+
import type { RegistrationStore } from '../registration/registration-store.js';
|
|
10
|
+
import type { RegistrationIndex } from '../registration/registration-index.js';
|
|
11
|
+
import type { TokenManager } from '../secrets/token-manager.js';
|
|
12
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
13
|
+
/**
|
|
14
|
+
* Dependencies for admin registration routes.
|
|
15
|
+
*/
|
|
16
|
+
export interface AdminRegistrationRoutesDeps {
|
|
17
|
+
registrationStore: RegistrationStore;
|
|
18
|
+
registrationIndex: RegistrationIndex;
|
|
19
|
+
tokenManager: TokenManager;
|
|
20
|
+
rbac: RbacEnforcer;
|
|
21
|
+
}
|
|
22
|
+
/** Hono env type for admin registration routes with context variables. */
|
|
23
|
+
type AdminRegEnv = {
|
|
24
|
+
Variables: {
|
|
25
|
+
role: Role;
|
|
26
|
+
userId: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Create admin API routes for workflow registration management.
|
|
31
|
+
*
|
|
32
|
+
* @param deps - Admin registration route dependencies
|
|
33
|
+
* @returns Hono app with registration routes mounted at /api/v1/admin/registrations
|
|
34
|
+
*/
|
|
35
|
+
export declare function createAdminRegistrationRoutes(deps: AdminRegistrationRoutesDeps): Hono<AdminRegEnv>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=admin-registrations.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for execution run inspection.
|
|
3
|
+
*
|
|
4
|
+
* Provides read-only endpoints for listing runs and inspecting per-run
|
|
5
|
+
* sub-resources (jobs, ephemeral key status, secret outputs). All routes
|
|
6
|
+
* are protected by Bearer token authentication and an RBAC permission
|
|
7
|
+
* check (`run.read` for most, `secret.reveal` for the reveal variant of
|
|
8
|
+
* `secret-outputs`).
|
|
9
|
+
*
|
|
10
|
+
* Endpoints:
|
|
11
|
+
* GET /api/v1/admin/runs — list runs with filters
|
|
12
|
+
* GET /api/v1/admin/runs/:runId — run header fields only
|
|
13
|
+
* GET /api/v1/admin/runs/:runId/jobs — jobs list (optional steps)
|
|
14
|
+
* GET /api/v1/admin/runs/:runId/ephemeral-key — scrub status
|
|
15
|
+
* GET /api/v1/admin/runs/:runId/secret-outputs — masked by default; ?reveal=true
|
|
16
|
+
*
|
|
17
|
+
* This is the server-side counterpart to `kici-admin runs` — the dogfooded
|
|
18
|
+
* replacement for hand-rolled curl commands and dashboard clicks when
|
|
19
|
+
* verifying execution state.
|
|
20
|
+
*/
|
|
21
|
+
import { Hono } from 'hono';
|
|
22
|
+
import type { Kysely } from 'kysely';
|
|
23
|
+
import type { Database } from '../db/types.js';
|
|
24
|
+
import type { TokenManager } from '../secrets/token-manager.js';
|
|
25
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
26
|
+
import type { AuditLogger } from '../secrets/audit-logger.js';
|
|
27
|
+
/**
|
|
28
|
+
* Dependencies for admin run routes.
|
|
29
|
+
*/
|
|
30
|
+
export interface AdminRunRoutesDeps {
|
|
31
|
+
db: Kysely<Database>;
|
|
32
|
+
tokenManager: TokenManager;
|
|
33
|
+
rbac: RbacEnforcer;
|
|
34
|
+
/** Required to reveal secret-output plaintext via ?reveal=true. */
|
|
35
|
+
auditLogger?: AuditLogger;
|
|
36
|
+
/**
|
|
37
|
+
* Orchestrator master secret key (raw hex / base64). Required to reveal
|
|
38
|
+
* secret-output plaintext. Derived once per request via deriveKey().
|
|
39
|
+
*/
|
|
40
|
+
masterSecretKey?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Hono env type for admin run routes with context variables. */
|
|
43
|
+
type AdminRunEnv = {
|
|
44
|
+
Variables: {
|
|
45
|
+
role: Role;
|
|
46
|
+
userId: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Create admin API routes for execution run inspection.
|
|
51
|
+
*
|
|
52
|
+
* @param deps - Admin run route dependencies
|
|
53
|
+
* @returns Hono app with run routes mounted at /api/v1/admin/runs
|
|
54
|
+
*/
|
|
55
|
+
export declare function createAdminRunRoutes(deps: AdminRunRoutesDeps): Hono<AdminRunEnv>;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=admin-runs.d.ts.map
|