@kici-dev/shared 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/agent-platform.d.ts +32 -0
- package/dist/agent-platform.js +27 -0
- package/dist/agent-platform.test.d.ts +2 -0
- package/dist/ci-env.d.ts +2 -0
- package/dist/ci-env.js +3 -0
- package/dist/cold-store/bucket.d.ts +1 -1
- package/dist/cold-store/cold-store.d.ts +24 -1
- package/dist/cold-store/cold-store.js +17 -5
- package/dist/cold-store/index.js +1 -1
- package/dist/db-admin.d.ts +206 -65
- package/dist/db-admin.js +236 -122
- package/dist/db-collation.d.ts +49 -0
- package/dist/db-collation.js +68 -1
- package/dist/db.d.ts +34 -0
- package/dist/db.js +30 -1
- package/dist/diagnostics/bundle-archive.js +5 -5
- package/dist/env/allowlist.d.ts +5 -0
- package/dist/env/allowlist.js +6 -1
- package/dist/env/define-env.d.ts +19 -2
- package/dist/env/define-env.js +18 -3
- package/dist/env/logger-env.d.ts +11 -9
- package/dist/env/logger-env.js +25 -9
- package/dist/idempotency-files.d.ts +7 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -4
- package/dist/telemetry/init.d.ts +18 -7
- package/dist/telemetry/init.js +36 -11
- package/dist/tmp-dir.d.ts +14 -0
- package/dist/tmp-dir.js +13 -0
- package/dist/tmp-dir.test.d.ts +2 -0
- package/dist/tmp.d.ts +2 -0
- package/dist/tmp.js +3 -0
- package/package.json +26 -17
- package/sbom.spdx.json +1222 -1618
package/dist/db-collation.d.ts
CHANGED
|
@@ -57,4 +57,53 @@ export declare function reindexDatabaseConcurrently(pool: pg.Pool, dbName: strin
|
|
|
57
57
|
* Metadata-only; safe to run any time after a REINDEX has rebuilt the indexes.
|
|
58
58
|
*/
|
|
59
59
|
export declare function refreshDatabaseCollationVersion(pool: pg.Pool, dbName: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* The two-step operator remediation for collation drift on `dbName`, as a
|
|
62
|
+
* single copy-pasteable string. Surfaced in the startup ERROR line and the
|
|
63
|
+
* hard-fail message so an operator sees exactly what to run.
|
|
64
|
+
*/
|
|
65
|
+
export declare function collationDriftRemediation(dbName: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Minimal structural logger the startup check needs. `winston.Logger`
|
|
68
|
+
* satisfies it, so both the orchestrator and Platform pass their own logger
|
|
69
|
+
* without a shared winston dependency here.
|
|
70
|
+
*/
|
|
71
|
+
export interface CollationDriftStartupLogger {
|
|
72
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
73
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
74
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
75
|
+
}
|
|
76
|
+
/** Env var name that turns a detected drift into a startup refusal. */
|
|
77
|
+
export declare const FAIL_ON_COLLATION_DRIFT_ENV = "KICI_DB_FAIL_ON_COLLATION_DRIFT";
|
|
78
|
+
/**
|
|
79
|
+
* Read the opt-in hard-fail toggle from an environment map. When set to
|
|
80
|
+
* `true`, {@link checkCollationDriftAtStartup} throws on detected drift instead
|
|
81
|
+
* of logging and continuing. Defaults to off (detect + warn loudly).
|
|
82
|
+
*/
|
|
83
|
+
export declare function shouldFailOnCollationDrift(env: NodeJS.ProcessEnv): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Boot-time collation-drift guard shared by the orchestrator and Platform.
|
|
86
|
+
*
|
|
87
|
+
* Runs {@link getDatabaseCollationDrift} after the DB connection + migrations
|
|
88
|
+
* are up and before the service starts serving. Behavior:
|
|
89
|
+
*
|
|
90
|
+
* - **No drift** → logs one info line and returns `null`.
|
|
91
|
+
* - **Drift** → logs a single loud, structured ERROR line naming the database,
|
|
92
|
+
* the recorded-vs-actual collation versions, the exact remediation command,
|
|
93
|
+
* and the risk (text index lookups may silently miss present rows — the
|
|
94
|
+
* failure mode that read a present source private key back as absent). Does
|
|
95
|
+
* NOT crash by default; a drifted DB still serves most traffic and crashing
|
|
96
|
+
* every node is worse than a loud, alertable warning. Returns the drift.
|
|
97
|
+
* - **`failOnDrift: true`** (opt-in via {@link FAIL_ON_COLLATION_DRIFT_ENV})
|
|
98
|
+
* → throws after logging, so strict operators can refuse to boot on drift.
|
|
99
|
+
* - **Probe failure** (the query itself throws) → logs a WARN and returns
|
|
100
|
+
* `null`. A probe bug must never take down every node; unconfirmed drift is
|
|
101
|
+
* not a reason to crash, and `failOnDrift` gates confirmed drift only.
|
|
102
|
+
*
|
|
103
|
+
* The caller is responsible for reflecting the result into its
|
|
104
|
+
* `kici_db_collation_drift{database=…}` gauge (1 on drift, 0 clean).
|
|
105
|
+
*/
|
|
106
|
+
export declare function checkCollationDriftAtStartup(pool: pg.Pool, dbName: string, logger: CollationDriftStartupLogger, options?: {
|
|
107
|
+
failOnDrift?: boolean;
|
|
108
|
+
}): Promise<CollationDrift | null>;
|
|
60
109
|
//# sourceMappingURL=db-collation.d.ts.map
|
package/dist/db-collation.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
import pg from "pg";
|
|
3
|
+
import { toErrorMessage } from "@kici-dev/core";
|
|
3
4
|
//#region src/db-collation.ts
|
|
4
5
|
/**
|
|
5
6
|
* Read `pg_database.datcollversion` and
|
|
@@ -46,7 +47,73 @@ async function refreshDatabaseCollationVersion(pool, dbName) {
|
|
|
46
47
|
const quoted = pg.escapeIdentifier(dbName);
|
|
47
48
|
await pool.query(`ALTER DATABASE ${quoted} REFRESH COLLATION VERSION`);
|
|
48
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* The two-step operator remediation for collation drift on `dbName`, as a
|
|
52
|
+
* single copy-pasteable string. Surfaced in the startup ERROR line and the
|
|
53
|
+
* hard-fail message so an operator sees exactly what to run.
|
|
54
|
+
*/
|
|
55
|
+
function collationDriftRemediation(dbName) {
|
|
56
|
+
const quoted = pg.escapeIdentifier(dbName);
|
|
57
|
+
return `REINDEX DATABASE CONCURRENTLY ${quoted}; ALTER DATABASE ${quoted} REFRESH COLLATION VERSION;`;
|
|
58
|
+
}
|
|
59
|
+
/** Env var name that turns a detected drift into a startup refusal. */
|
|
60
|
+
const FAIL_ON_COLLATION_DRIFT_ENV = "KICI_DB_FAIL_ON_COLLATION_DRIFT";
|
|
61
|
+
/**
|
|
62
|
+
* Read the opt-in hard-fail toggle from an environment map. When set to
|
|
63
|
+
* `true`, {@link checkCollationDriftAtStartup} throws on detected drift instead
|
|
64
|
+
* of logging and continuing. Defaults to off (detect + warn loudly).
|
|
65
|
+
*/
|
|
66
|
+
function shouldFailOnCollationDrift(env) {
|
|
67
|
+
return env[FAIL_ON_COLLATION_DRIFT_ENV] === "true";
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Boot-time collation-drift guard shared by the orchestrator and Platform.
|
|
71
|
+
*
|
|
72
|
+
* Runs {@link getDatabaseCollationDrift} after the DB connection + migrations
|
|
73
|
+
* are up and before the service starts serving. Behavior:
|
|
74
|
+
*
|
|
75
|
+
* - **No drift** → logs one info line and returns `null`.
|
|
76
|
+
* - **Drift** → logs a single loud, structured ERROR line naming the database,
|
|
77
|
+
* the recorded-vs-actual collation versions, the exact remediation command,
|
|
78
|
+
* and the risk (text index lookups may silently miss present rows — the
|
|
79
|
+
* failure mode that read a present source private key back as absent). Does
|
|
80
|
+
* NOT crash by default; a drifted DB still serves most traffic and crashing
|
|
81
|
+
* every node is worse than a loud, alertable warning. Returns the drift.
|
|
82
|
+
* - **`failOnDrift: true`** (opt-in via {@link FAIL_ON_COLLATION_DRIFT_ENV})
|
|
83
|
+
* → throws after logging, so strict operators can refuse to boot on drift.
|
|
84
|
+
* - **Probe failure** (the query itself throws) → logs a WARN and returns
|
|
85
|
+
* `null`. A probe bug must never take down every node; unconfirmed drift is
|
|
86
|
+
* not a reason to crash, and `failOnDrift` gates confirmed drift only.
|
|
87
|
+
*
|
|
88
|
+
* The caller is responsible for reflecting the result into its
|
|
89
|
+
* `kici_db_collation_drift{database=…}` gauge (1 on drift, 0 clean).
|
|
90
|
+
*/
|
|
91
|
+
async function checkCollationDriftAtStartup(pool, dbName, logger, options = {}) {
|
|
92
|
+
let drift;
|
|
93
|
+
try {
|
|
94
|
+
drift = await getDatabaseCollationDrift(pool, dbName);
|
|
95
|
+
} catch (err) {
|
|
96
|
+
logger.warn("Collation-drift startup probe failed; skipping drift check", {
|
|
97
|
+
database: dbName,
|
|
98
|
+
error: toErrorMessage(err)
|
|
99
|
+
});
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
if (!drift) {
|
|
103
|
+
logger.info("Database collation version is consistent", { database: dbName });
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
logger.error("Database collation drift detected — text-column b-tree indexes may silently miss present rows (e.g. secrets/sources reads reporting present rows as missing). Repair with the remediation below.", {
|
|
107
|
+
database: dbName,
|
|
108
|
+
stampedCollationVersion: drift.stamped,
|
|
109
|
+
actualCollationVersion: drift.actual,
|
|
110
|
+
remediation: collationDriftRemediation(dbName),
|
|
111
|
+
risk: "corrupted-text-btree-index"
|
|
112
|
+
});
|
|
113
|
+
if (options.failOnDrift) throw new Error(`Database "${dbName}" has collation drift (stamped=${drift.stamped}, actual=${drift.actual}) and ${FAIL_ON_COLLATION_DRIFT_ENV} is set. Remediate: ${collationDriftRemediation(dbName)}`);
|
|
114
|
+
return drift;
|
|
115
|
+
}
|
|
49
116
|
//#endregion
|
|
50
|
-
export { getDatabaseCollationDrift, refreshDatabaseCollationVersion, reindexDatabaseConcurrently };
|
|
117
|
+
export { FAIL_ON_COLLATION_DRIFT_ENV, checkCollationDriftAtStartup, collationDriftRemediation, getDatabaseCollationDrift, refreshDatabaseCollationVersion, reindexDatabaseConcurrently, shouldFailOnCollationDrift };
|
|
51
118
|
|
|
52
119
|
//# sourceMappingURL=db-collation.js.map
|
package/dist/db.d.ts
CHANGED
|
@@ -2,6 +2,15 @@ import pg from 'pg';
|
|
|
2
2
|
import { Kysely } from 'kysely';
|
|
3
3
|
/** Where a pg connection error surfaced. */
|
|
4
4
|
export type PgPoolErrorSource = 'idle-pool' | 'client';
|
|
5
|
+
/**
|
|
6
|
+
* Outcome of a single pool acquire.
|
|
7
|
+
*
|
|
8
|
+
* `'timeout'` means the caller waited the pool's full `connectionTimeoutMillis`
|
|
9
|
+
* and was refused a connection — a load condition. A backend that cannot be
|
|
10
|
+
* reached rejects with a connection error instead and is deliberately NOT
|
|
11
|
+
* reported here; that is a different condition with a different owner.
|
|
12
|
+
*/
|
|
13
|
+
export type PoolAcquireOutcome = 'ok' | 'timeout';
|
|
5
14
|
export interface CreatePoolOptions {
|
|
6
15
|
/** Extra pg.Pool config merged over the connection string (e.g. max, connectionTimeoutMillis). */
|
|
7
16
|
config?: Omit<pg.PoolConfig, 'connectionString'>;
|
|
@@ -11,6 +20,23 @@ export interface CreatePoolOptions {
|
|
|
11
20
|
* never replaces the log.
|
|
12
21
|
*/
|
|
13
22
|
onError?: (err: Error, source: PgPoolErrorSource) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Optional hook invoked once per `pool.connect()` acquire on this pool, with
|
|
25
|
+
* the outcome and how long the caller waited.
|
|
26
|
+
*
|
|
27
|
+
* Only the promise form of `connect` is instrumented, so an acquire made via
|
|
28
|
+
* `pool.query(...)` is NOT reported — pg implements `query` on top of the
|
|
29
|
+
* callback form of `connect`. The exclusion is symmetric (neither outcome is
|
|
30
|
+
* reported), so a ratio derived from this hook stays well-formed; but work
|
|
31
|
+
* whose acquires must be counted has to go through `pool.connect()`, as
|
|
32
|
+
* Kysely's PostgresDialect does.
|
|
33
|
+
*
|
|
34
|
+
* Opt-in: a pool created without it behaves exactly as before. A consumer
|
|
35
|
+
* that derives a load signal from acquire outcomes wires it on the pool whose
|
|
36
|
+
* saturation actually matters to it — one hook shared across unrelated pools
|
|
37
|
+
* would attribute one pool's exhaustion to another pool's traffic.
|
|
38
|
+
*/
|
|
39
|
+
onAcquire?: (outcome: PoolAcquireOutcome, waitedMs: number) => void;
|
|
14
40
|
}
|
|
15
41
|
/**
|
|
16
42
|
* Create PostgreSQL connection pool.
|
|
@@ -23,6 +49,14 @@ export interface CreatePoolOptions {
|
|
|
23
49
|
* the next acquire. In-flight query failures still reject to their callers.
|
|
24
50
|
*/
|
|
25
51
|
export declare function createPool(databaseUrl: string, options?: CreatePoolOptions): pg.Pool;
|
|
52
|
+
/**
|
|
53
|
+
* node-postgres rejects a pool-acquire timeout (the `connectionTimeoutMillis`
|
|
54
|
+
* window elapsed with no free connection) with this exact message. It is the
|
|
55
|
+
* only signal pg exposes to tell "pool busy (load)" apart from "backend
|
|
56
|
+
* unreachable". Centralized here + covered by one unit test so a pg-version
|
|
57
|
+
* bump that changes the string fails loudly in one place.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isPoolAcquireTimeout(err: unknown): boolean;
|
|
26
60
|
/**
|
|
27
61
|
* Create Kysely database instance (PostgreSQL only).
|
|
28
62
|
*
|
package/dist/db.js
CHANGED
|
@@ -38,9 +38,38 @@ function createPool(databaseUrl, options) {
|
|
|
38
38
|
pool.on("connect", (client) => {
|
|
39
39
|
client.on("error", (err) => handle(err, "client"));
|
|
40
40
|
});
|
|
41
|
+
if (options?.onAcquire) {
|
|
42
|
+
const report = options.onAcquire;
|
|
43
|
+
const original = pool.connect.bind(pool);
|
|
44
|
+
pool.connect = function connect(cb) {
|
|
45
|
+
if (typeof cb === "function") return original(cb);
|
|
46
|
+
const startedAt = Date.now();
|
|
47
|
+
return original().then((client) => {
|
|
48
|
+
try {
|
|
49
|
+
report("ok", Date.now() - startedAt);
|
|
50
|
+
} catch {}
|
|
51
|
+
return client;
|
|
52
|
+
}, (err) => {
|
|
53
|
+
try {
|
|
54
|
+
if (isPoolAcquireTimeout(err)) report("timeout", Date.now() - startedAt);
|
|
55
|
+
} catch {}
|
|
56
|
+
throw err;
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
}
|
|
41
60
|
return pool;
|
|
42
61
|
}
|
|
43
62
|
/**
|
|
63
|
+
* node-postgres rejects a pool-acquire timeout (the `connectionTimeoutMillis`
|
|
64
|
+
* window elapsed with no free connection) with this exact message. It is the
|
|
65
|
+
* only signal pg exposes to tell "pool busy (load)" apart from "backend
|
|
66
|
+
* unreachable". Centralized here + covered by one unit test so a pg-version
|
|
67
|
+
* bump that changes the string fails loudly in one place.
|
|
68
|
+
*/
|
|
69
|
+
function isPoolAcquireTimeout(err) {
|
|
70
|
+
return err instanceof Error && err.message === "timeout exceeded when trying to connect";
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
44
73
|
* Create Kysely database instance (PostgreSQL only).
|
|
45
74
|
*
|
|
46
75
|
* Generic over the database type so each consumer can provide
|
|
@@ -50,6 +79,6 @@ function createDb(pool) {
|
|
|
50
79
|
return new Kysely({ dialect: new PostgresDialect({ pool }) });
|
|
51
80
|
}
|
|
52
81
|
//#endregion
|
|
53
|
-
export { createDb, createPool };
|
|
82
|
+
export { createDb, createPool, isPoolAcquireTimeout };
|
|
54
83
|
|
|
55
84
|
//# sourceMappingURL=db.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
|
-
import * as path from "node:path";
|
|
3
|
+
import * as path$1 from "node:path";
|
|
4
4
|
//#region src/diagnostics/bundle-archive.ts
|
|
5
5
|
/**
|
|
6
6
|
* Shared debug-bundle archive primitives.
|
|
@@ -103,18 +103,18 @@ async function addLogsToArchive(archive, logDir, logWindowHours) {
|
|
|
103
103
|
const cutoff = Date.now() - logWindowHours * 60 * 60 * 1e3;
|
|
104
104
|
const entries = fs.readdirSync(logDir).filter((f) => {
|
|
105
105
|
if (!f.endsWith(".log")) return false;
|
|
106
|
-
return fs.statSync(path.join(logDir, f)).mtimeMs >= cutoff;
|
|
106
|
+
return fs.statSync(path$1.join(logDir, f)).mtimeMs >= cutoff;
|
|
107
107
|
});
|
|
108
108
|
entries.sort((a, b) => {
|
|
109
|
-
const aStat = fs.statSync(path.join(logDir, a));
|
|
110
|
-
return fs.statSync(path.join(logDir, b)).mtimeMs - aStat.mtimeMs;
|
|
109
|
+
const aStat = fs.statSync(path$1.join(logDir, a));
|
|
110
|
+
return fs.statSync(path$1.join(logDir, b)).mtimeMs - aStat.mtimeMs;
|
|
111
111
|
});
|
|
112
112
|
let totalBytes = 0;
|
|
113
113
|
let totalLines = 0;
|
|
114
114
|
let errors = 0;
|
|
115
115
|
let warnings = 0;
|
|
116
116
|
for (const entry of entries) {
|
|
117
|
-
const filePath = path.join(logDir, entry);
|
|
117
|
+
const filePath = path$1.join(logDir, entry);
|
|
118
118
|
const stat = fs.statSync(filePath);
|
|
119
119
|
if (totalBytes + stat.size > 52428800) break;
|
|
120
120
|
const content = fs.readFileSync(filePath, "utf-8");
|
package/dist/env/allowlist.d.ts
CHANGED
|
@@ -71,6 +71,11 @@
|
|
|
71
71
|
* dashboard's vite.config consults to disable
|
|
72
72
|
* the dev proxy), HEADED (Playwright convention
|
|
73
73
|
* for `--headed` runs).
|
|
74
|
+
* - Vitest runtime — VITEST_* (vitest's own names, which it reads
|
|
75
|
+
* after config resolution: VITEST_MAX_WORKERS
|
|
76
|
+
* carries the per-process worker ceiling
|
|
77
|
+
* `hack/lib/vitest-workers.ts` publishes, and
|
|
78
|
+
* VITEST_POOL_ID marks a pool worker).
|
|
74
79
|
*/
|
|
75
80
|
export declare const OS_SDK_ALLOWLIST_REGEX: RegExp;
|
|
76
81
|
/**
|
package/dist/env/allowlist.js
CHANGED
|
@@ -73,8 +73,13 @@ import "../rolldown-runtime-ClRpJifh.js";
|
|
|
73
73
|
* dashboard's vite.config consults to disable
|
|
74
74
|
* the dev proxy), HEADED (Playwright convention
|
|
75
75
|
* for `--headed` runs).
|
|
76
|
+
* - Vitest runtime — VITEST_* (vitest's own names, which it reads
|
|
77
|
+
* after config resolution: VITEST_MAX_WORKERS
|
|
78
|
+
* carries the per-process worker ceiling
|
|
79
|
+
* `hack/lib/vitest-workers.ts` publishes, and
|
|
80
|
+
* VITEST_POOL_ID marks a pool worker).
|
|
76
81
|
*/
|
|
77
|
-
const OS_SDK_ALLOWLIST_REGEX = /^(KICI_.*|NODE_ENV|HOME|PATH|TZ|LANG|TMPDIR|USER|USERNAME|SHELL|COMSPEC|PWD|OLDPWD|HOSTNAME|PROCESSOR_ARCHITECTURE|COLUMNS|LINES|TERM|COLORTERM|DISPLAY|WAYLAND_DISPLAY|LOCALAPPDATA|XDG_CACHE_HOME|XDG_CONFIG_HOME|XDG_DATA_HOME|XDG_RUNTIME_DIR|XDG_STATE_HOME|INIT_CWD|npm_.*|SSH_.*|CI|GITHUB_ACTIONS|GITHUB_ENV|GITHUB_OUTPUT|GITHUB_PATH|GITHUB_STEP_SUMMARY|GITLAB_CI|AWS_.*|REDIS_.*|OTEL_.*|STRIPE_.*|DOCKER_.*|GIT_.*|CONTAINER_HOST|container|PGHOST|PGPORT|PGUSER|PGPASSWORD|PGDATABASE|PGSERVICEFILE|PGSSLMODE|FORGEJO_URL|FORGEJO_CONTAINER|KEYCLOAK_.*|VITE_.*|PLAYWRIGHT|HEADED)$/;
|
|
82
|
+
const OS_SDK_ALLOWLIST_REGEX = /^(KICI_.*|NODE_ENV|HOME|PATH|TZ|LANG|TMPDIR|USER|USERNAME|SHELL|COMSPEC|PWD|OLDPWD|HOSTNAME|PROCESSOR_ARCHITECTURE|COLUMNS|LINES|TERM|COLORTERM|DISPLAY|WAYLAND_DISPLAY|LOCALAPPDATA|XDG_CACHE_HOME|XDG_CONFIG_HOME|XDG_DATA_HOME|XDG_RUNTIME_DIR|XDG_STATE_HOME|INIT_CWD|npm_.*|SSH_.*|CI|GITHUB_ACTIONS|GITHUB_ENV|GITHUB_OUTPUT|GITHUB_PATH|GITHUB_STEP_SUMMARY|GITLAB_CI|AWS_.*|REDIS_.*|OTEL_.*|STRIPE_.*|DOCKER_.*|GIT_.*|CONTAINER_HOST|container|PGHOST|PGPORT|PGUSER|PGPASSWORD|PGDATABASE|PGSERVICEFILE|PGSSLMODE|FORGEJO_URL|FORGEJO_CONTAINER|KEYCLOAK_.*|VITE_.*|VITEST_.*|PLAYWRIGHT|HEADED)$/;
|
|
78
83
|
/**
|
|
79
84
|
* Returns true when `name` is allowed under the KiCI env-var convention:
|
|
80
85
|
* it matches the OS/SDK allowlist regex (which includes the `KICI_*`
|
package/dist/env/define-env.d.ts
CHANGED
|
@@ -66,8 +66,15 @@ export interface DefineEnvOptions<TShape extends z.ZodRawShape> {
|
|
|
66
66
|
descriptions?: Record<string, string>;
|
|
67
67
|
}
|
|
68
68
|
export interface DefineEnvResult<T> {
|
|
69
|
-
/**
|
|
70
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Parse `env` (defaults to `process.env`) into a typed config.
|
|
71
|
+
*
|
|
72
|
+
* `parserOverride` is an optional per-call parser (e.g. a scope-narrowed
|
|
73
|
+
* `.superRefine`) that replaces the default parser for this parse only —
|
|
74
|
+
* used to validate the same env map under a looser/stricter cross-field
|
|
75
|
+
* rule set without duplicating the envMap.
|
|
76
|
+
*/
|
|
77
|
+
parse(env?: NodeJS.ProcessEnv, parserOverride?: z.ZodType): T;
|
|
71
78
|
/** Machine-readable field specs for docs generation. */
|
|
72
79
|
describe(): EnvFieldSpec[];
|
|
73
80
|
/** Flat list of every env var the schema reads (for the unknown-var scanner). */
|
|
@@ -101,6 +108,16 @@ export declare function defineEnv<TShape extends z.ZodRawShape>(opts: DefineEnvO
|
|
|
101
108
|
* (on POSIX it's a shell-local var that doesn't leak).
|
|
102
109
|
* - `KICI_DEV`: the dev-mode toggle itself — read by the scanner to flip
|
|
103
110
|
* to warn-only, so it must not trip the scanner.
|
|
111
|
+
* - `KICI_BUILD_COUNTER_NO_COMMIT`: a build-tooling flag read only by
|
|
112
|
+
* `hack/lib/commit-build-counter.mjs` (skip the per-build `.build-counter`
|
|
113
|
+
* commit on a force-synced checkout, e.g. a remote E2E executor). Set in the
|
|
114
|
+
* ambient shell for `pnpm build`; the native orchestrator spawn inherits it.
|
|
115
|
+
* - `KICI_TEST_ISOLATION`: the test-isolation marker set at config-eval time
|
|
116
|
+
* by every vitest config in this repository (`hack/lib/vitest-isolation.ts`,
|
|
117
|
+
* enforced by `hack/check-vitest-isolation.ts`). It makes the CLI's
|
|
118
|
+
* `getConfigDir` refuse the developer machine's ambient `~/.kici` config, and
|
|
119
|
+
* it is inherited by every service a test spawns — same leak-by-inheritance
|
|
120
|
+
* shape as the `KICI_E2E_` prefix below.
|
|
104
121
|
*
|
|
105
122
|
* Keep this list small and well-justified. Every addition is a typo we can
|
|
106
123
|
* no longer catch, so only list things that are (a) actually set in the
|
package/dist/env/define-env.js
CHANGED
|
@@ -155,8 +155,8 @@ function describeFieldRecursive(shape, envMap, fieldPath, descriptions, out) {
|
|
|
155
155
|
* const config = envDef.parse();
|
|
156
156
|
*/
|
|
157
157
|
function defineEnv(opts) {
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
function parse(env = process.env, parserOverride) {
|
|
159
|
+
const parserSchema = parserOverride ?? opts.parser ?? opts.schema;
|
|
160
160
|
const raw = readEnv(opts.envMap, env);
|
|
161
161
|
const result = parserSchema.safeParse(raw);
|
|
162
162
|
if (!result.success) {
|
|
@@ -227,12 +227,27 @@ function suggestClosest(name, candidates) {
|
|
|
227
227
|
* (on POSIX it's a shell-local var that doesn't leak).
|
|
228
228
|
* - `KICI_DEV`: the dev-mode toggle itself — read by the scanner to flip
|
|
229
229
|
* to warn-only, so it must not trip the scanner.
|
|
230
|
+
* - `KICI_BUILD_COUNTER_NO_COMMIT`: a build-tooling flag read only by
|
|
231
|
+
* `hack/lib/commit-build-counter.mjs` (skip the per-build `.build-counter`
|
|
232
|
+
* commit on a force-synced checkout, e.g. a remote E2E executor). Set in the
|
|
233
|
+
* ambient shell for `pnpm build`; the native orchestrator spawn inherits it.
|
|
234
|
+
* - `KICI_TEST_ISOLATION`: the test-isolation marker set at config-eval time
|
|
235
|
+
* by every vitest config in this repository (`hack/lib/vitest-isolation.ts`,
|
|
236
|
+
* enforced by `hack/check-vitest-isolation.ts`). It makes the CLI's
|
|
237
|
+
* `getConfigDir` refuse the developer machine's ambient `~/.kici` config, and
|
|
238
|
+
* it is inherited by every service a test spawns — same leak-by-inheritance
|
|
239
|
+
* shape as the `KICI_E2E_` prefix below.
|
|
230
240
|
*
|
|
231
241
|
* Keep this list small and well-justified. Every addition is a typo we can
|
|
232
242
|
* no longer catch, so only list things that are (a) actually set in the
|
|
233
243
|
* wild by our own tooling and (b) could never be a config typo.
|
|
234
244
|
*/
|
|
235
|
-
const RESERVED_NON_SCHEMA_KICI_VARS = [
|
|
245
|
+
const RESERVED_NON_SCHEMA_KICI_VARS = [
|
|
246
|
+
"KICI_CACHE",
|
|
247
|
+
"KICI_DEV",
|
|
248
|
+
"KICI_BUILD_COUNTER_NO_COMMIT",
|
|
249
|
+
"KICI_TEST_ISOLATION"
|
|
250
|
+
];
|
|
236
251
|
/**
|
|
237
252
|
* `KICI_*` prefixes that are entirely outside the service-config namespace —
|
|
238
253
|
* usually set by our own test / dev tooling and inherited into a child
|
package/dist/env/logger-env.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared LoggerEnv schema.
|
|
3
3
|
*
|
|
4
|
-
* The logger (packages/
|
|
5
|
-
* the per-service config loads
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* The logger (packages/core/src/logger.ts) reads these env vars *before*
|
|
5
|
+
* the per-service config loads — as does `kiciTmpBase()`
|
|
6
|
+
* (packages/core/src/tmp.ts) for the `KICI_TMPDIR` entry below — so we can't
|
|
7
|
+
* include them in the service schemas the normal way. We still want them in
|
|
8
|
+
* `docs/operator/env-reference.md` and in `validateUnknownKiciVars()`'s
|
|
9
|
+
* known-var set, so this schema documents them in one place. Each service
|
|
10
|
+
* includes the keys here when computing its "known KICI_* vars" list, and the
|
|
11
|
+
* docs generator emits a "Logger / shared" section from this schema.
|
|
11
12
|
*
|
|
12
13
|
* IMPORTANT: do not change the runtime behaviour of `logger.ts` from this
|
|
13
14
|
* schema — the schema is documentation + the unknown-var allowlist, not the
|
|
@@ -20,16 +21,17 @@ export declare const LoggerEnvSchema: z.ZodObject<{
|
|
|
20
21
|
KICI_LOG_MAX_SIZE: z.ZodDefault<z.ZodString>;
|
|
21
22
|
KICI_LOG_RETENTION_DAYS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
22
23
|
KICI_LOG_FORMAT: z.ZodDefault<z.ZodEnum<{
|
|
23
|
-
json: "json";
|
|
24
24
|
auto: "auto";
|
|
25
|
+
json: "json";
|
|
25
26
|
plain: "plain";
|
|
26
27
|
}>>;
|
|
27
28
|
KICI_CLUSTER_INSTANCE_ID: z.ZodOptional<z.ZodString>;
|
|
28
29
|
KICI_AGENT_ID: z.ZodOptional<z.ZodString>;
|
|
29
30
|
KICI_PLATFORM_INSTANCE_ID: z.ZodOptional<z.ZodString>;
|
|
31
|
+
KICI_TMPDIR: z.ZodOptional<z.ZodString>;
|
|
30
32
|
}, z.core.$strip>;
|
|
31
33
|
/** All env vars the logger reads, for the unknown-KICI-var scanner. */
|
|
32
|
-
export declare const LOGGER_ENV_VARS: readonly [
|
|
34
|
+
export declare const LOGGER_ENV_VARS: readonly ['KICI_LOG_DIR', 'KICI_LOG_MAX_SIZE', 'KICI_LOG_RETENTION_DAYS', 'KICI_LOG_FORMAT', 'KICI_CLUSTER_INSTANCE_ID', 'KICI_AGENT_ID', 'KICI_PLATFORM_INSTANCE_ID', 'KICI_TMPDIR'];
|
|
33
35
|
/** Doc-friendly description map (consumed by the env-reference generator). */
|
|
34
36
|
export declare const LOGGER_ENV_FIELD_SPECS: EnvFieldSpec[];
|
|
35
37
|
//# sourceMappingURL=logger-env.d.ts.map
|
package/dist/env/logger-env.js
CHANGED
|
@@ -4,13 +4,14 @@ import { z } from "zod";
|
|
|
4
4
|
/**
|
|
5
5
|
* Shared LoggerEnv schema.
|
|
6
6
|
*
|
|
7
|
-
* The logger (packages/
|
|
8
|
-
* the per-service config loads
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
7
|
+
* The logger (packages/core/src/logger.ts) reads these env vars *before*
|
|
8
|
+
* the per-service config loads — as does `kiciTmpBase()`
|
|
9
|
+
* (packages/core/src/tmp.ts) for the `KICI_TMPDIR` entry below — so we can't
|
|
10
|
+
* include them in the service schemas the normal way. We still want them in
|
|
11
|
+
* `docs/operator/env-reference.md` and in `validateUnknownKiciVars()`'s
|
|
12
|
+
* known-var set, so this schema documents them in one place. Each service
|
|
13
|
+
* includes the keys here when computing its "known KICI_* vars" list, and the
|
|
14
|
+
* docs generator emits a "Logger / shared" section from this schema.
|
|
14
15
|
*
|
|
15
16
|
* IMPORTANT: do not change the runtime behaviour of `logger.ts` from this
|
|
16
17
|
* schema — the schema is documentation + the unknown-var allowlist, not the
|
|
@@ -36,7 +37,13 @@ const LoggerEnvSchema = z.object({
|
|
|
36
37
|
/** Set by the agent process; used as a filename suffix. */
|
|
37
38
|
KICI_AGENT_ID: z.string().optional(),
|
|
38
39
|
/** Set by the platform process; used as a filename suffix. */
|
|
39
|
-
KICI_PLATFORM_INSTANCE_ID: z.string().optional()
|
|
40
|
+
KICI_PLATFORM_INSTANCE_ID: z.string().optional(),
|
|
41
|
+
/**
|
|
42
|
+
* Base directory for KiCI-created temp files (repo clones, build scratch,
|
|
43
|
+
* deploy render dirs). Read by `kiciTmpBase()` before any service config
|
|
44
|
+
* loads; defaults to the OS temp dir when unset.
|
|
45
|
+
*/
|
|
46
|
+
KICI_TMPDIR: z.string().optional()
|
|
40
47
|
});
|
|
41
48
|
/** All env vars the logger reads, for the unknown-KICI-var scanner. */
|
|
42
49
|
const LOGGER_ENV_VARS = [
|
|
@@ -46,7 +53,8 @@ const LOGGER_ENV_VARS = [
|
|
|
46
53
|
"KICI_LOG_FORMAT",
|
|
47
54
|
"KICI_CLUSTER_INSTANCE_ID",
|
|
48
55
|
"KICI_AGENT_ID",
|
|
49
|
-
"KICI_PLATFORM_INSTANCE_ID"
|
|
56
|
+
"KICI_PLATFORM_INSTANCE_ID",
|
|
57
|
+
"KICI_TMPDIR"
|
|
50
58
|
];
|
|
51
59
|
/** Doc-friendly description map (consumed by the env-reference generator). */
|
|
52
60
|
const LOGGER_ENV_FIELD_SPECS = [
|
|
@@ -108,6 +116,14 @@ const LOGGER_ENV_FIELD_SPECS = [
|
|
|
108
116
|
required: false,
|
|
109
117
|
type: "string",
|
|
110
118
|
description: "Stable Platform identifier; appended to the platform log filename so multiple instances can share one KICI_LOG_DIR."
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
envVar: "KICI_TMPDIR",
|
|
122
|
+
aliases: [],
|
|
123
|
+
fieldPath: "KICI_TMPDIR",
|
|
124
|
+
required: false,
|
|
125
|
+
type: "string",
|
|
126
|
+
description: "Base directory for KiCI-created temporary files (repo clones, build scratch, deploy render dirs). Defaults to the operating system temp directory. Set it to a path on a volume with free space when the default temp filesystem is small."
|
|
111
127
|
}
|
|
112
128
|
];
|
|
113
129
|
//#endregion
|
|
@@ -63,6 +63,13 @@ export interface FileDriftEntry {
|
|
|
63
63
|
remoteContent?: string;
|
|
64
64
|
/** Set when content capture was intentionally skipped — used by the renderer to explain the gap. */
|
|
65
65
|
contentSkipped?: ContentSkipReason;
|
|
66
|
+
/**
|
|
67
|
+
* Fleet machine the remote side of this comparison lives on. Stamped by the
|
|
68
|
+
* preview helpers, which already know the box. Consumers that aggregate
|
|
69
|
+
* drift across a whole fleet need it to attribute a file to a machine —
|
|
70
|
+
* `remotePath` alone is identical on every box.
|
|
71
|
+
*/
|
|
72
|
+
box?: string;
|
|
66
73
|
/**
|
|
67
74
|
* Renderer hint. When omitted, the renderer auto-detects from
|
|
68
75
|
* `remotePath`: `.env` → `'env-semantic'`, `.yaml` / `.yml` →
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
export * from '@kici-dev/core';
|
|
2
|
+
export * from './agent-platform.js';
|
|
2
3
|
export { encrypt, decrypt, deriveKey, generateMasterKey, type EncryptedValue, } from './secret-crypto.js';
|
|
3
4
|
export { RingBuffer } from './ring-buffer.js';
|
|
4
5
|
export { redactConfig, addLogsToArchive, MAX_LOG_BYTES } from './diagnostics/bundle-archive.js';
|
|
5
6
|
export { chunkBuffer, BundleChunkAssembler, ChunkRequestWaiter, FLEET_CHUNK_BYTES, type BundleChunkFrame, } from './diagnostics/bundle-chunks.js';
|
|
6
|
-
export { createPool, createDb, type CreatePoolOptions, type PgPoolErrorSource } from './db.js';
|
|
7
|
+
export { createPool, createDb, isPoolAcquireTimeout, type CreatePoolOptions, type PgPoolErrorSource, type PoolAcquireOutcome, } from './db.js';
|
|
7
8
|
export { isPgUniqueViolation } from './pg-errors.js';
|
|
8
|
-
export { parseDatabaseUrl, maskDatabaseUrl, dropAndCreateDatabase, dropDatabaseDirect, ensureDatabase, type EnsureDatabaseOpts, createDbRole, createReadOnlyDbUser, computeMigrationsHash, storeMigrationContentHash, readStoredMigrationContentHash, isSchemaCurrent, clearDispatchQueueDirect, purgeStaleExecutionDirect, purgeStaleSourcesDirect, purgeScopedSecretsDirect,
|
|
9
|
+
export { parseDatabaseUrl, maskDatabaseUrl, dropAndCreateDatabase, dropDatabaseDirect, ensureDatabase, type EnsureDatabaseOpts, createDbRole, createReadOnlyDbUser, computeMigrationsHash, storeMigrationContentHash, readStoredMigrationContentHash, isSchemaCurrent, clearDispatchQueueDirect, purgeStaleExecutionDirect, purgeStaleSourcesDirect, purgeScopedSecretsDirect, purgeContextsDirect, seedContextDirect, deleteContextDirect, seedContextBindingDirect, setContextPolicyDirect, listContextsDirect, showContextDirect, createContextTemplateDirect, setContextSecretDirect, listQueueDirect, showQueueEntryDirect, listExecutionRunsDirect, showExecutionRunDirect, listCheckRunTrackingDirect, listExecutionJobsDirect, listRegistrationsDirect, showRegistrationDirect, registerWorkflowManualDirect, resetRaftStateDirect, emitKiciEventDirect, seedGenericWebhookSourceDirect, purgeSecretBackendsDirect, apiKeyExistsDirect, seedApiKeyInlineDirect, platformConnectionExistsDirect, countWebhookSourcesByConnectionIdDirect, getWebhookSourceByRoutingKeyDirect, findAnyUserApiKeyIdDirect, seedSyntheticGithubSourceDirect, seedWebhookSecretDirect, seedSourcePrivateKeyDirect, bumpRegistryVersionDirect, pollKiciEventsDirect, waitForPostgresDirect, waitForRunCompletionDirect, cleanupExecutionRowsDirect, isSchemaCurrentFromFilesDirect, storeMigrationContentHashInTableDirect, createJoinTokenDirect, deleteJoinTokensByCreatedByDirect, updateSourceRoutingKeyDirect, prunePeerCredentialsDirect, waitForPlatformRegistrationsDirect, seedUniversalGitSourceDirect, seedCiSecurityFixturesDirect, CI_SECURITY_OTHER_REPO, waitForExecutionRunReachesStatusSinceDirect, latestExecutionRunByStatusDirect, waitForLatestExecutionJobStatusDirect, describeTableColumnsDirect, tableExistsDirect, insertKiciEventRawDirect, showKiciEventDirect, listKiciEventsDirect, deleteKiciEventsDirect, insertKiciEventAtDirect, paginateUnprocessedEventsKeysetDirect, verifyKiciEventNotifyDirect, seedCrossRepoTrustDirect, listCrossRepoTrustBySourceRoutingKeyDirect, deleteCrossRepoTrustDirect, insertCrossRepoTrustStrictDirect, deleteWorkflowRegistrationsDirect, getWorkflowRegistrationByIdDirect, listRegistrationsByRoutingKeyDirect, waitForRegistrationsByRoutingKeyDirect, waitForRegistrationsUpdatedAtAdvanceDirect, updateWorkflowRegistrationCommitShaDirect, insertWorkflowRegistrationRawDirect, insertWorkflowRegistrationStrictDirect, getRegistryVersionDirect, bumpRegistryVersionSimpleDirect, upsertCronLastFiredDirect, countCronLastFiredDirect, insertCronLastFiredNowDirect, deleteCronLastFiredDirect, deleteExecutionRunsByWorkflowNameDirect, getGenericWebhookSourceByRoutingKeyDirect, listActiveGenericWebhookSourcesDirect, updateGenericWebhookVerificationConfigDirect, deleteGenericWebhookSourcesByNameDirect, restoreSoftDeletedGenericWebhookSourceDirect, upsertOrgSettingsGlobalWorkflowsDirect, updateOrgSettingsDeniedReposDirect, deleteOrgSettingsByCustomerIdDirect, getExecutionRunSecurityDirect, getHeldRunByIdDirect, listHeldRunApprovalsDirect, countHeldRunsByRunIdDirect, waitForPlatformExecutionRunStatusDirect, waitForPlatformEventLogDistinctRoutedDirect, waitForEventLogRowByDeliveryIdDirect, resolvePlatformWebhookSourceRoutingKeyDirect, ensureOrgOwnerMemberDirect, deletePeerCredentialsByInstanceIdLikeDirect, insertPeerCredentialExpiredDirect, getPeerCredentialRevokedAtDirect, listActivePeerCredentialsExcludingDirect, clearPeerCredentialsRevokedAtByIdsDirect, countActivePeerCredentialsByInstanceDirect, terminateIdleDbBackendsDirect, type ColumnInfo, type KiciEventRow, type CrossRepoTrustRow, type WorkflowRegistrationFullRow, type RegistrationsScopedResult, type LatestExecutionRunResult, type WaitForLatestJobResult, type ExecutionRunSecurityRow, type HeldRunSecurityRow, type EventLogRow as PlatformEventLogRow, type UpsertOrgSettingsOpts, type OrgSettingsRepoPatternEntry, type InsertKiciEventRawOpts, type EmitKiciEventOpts, type SeedGenericWebhookSourceOpts, REGISTERABLE_TRIGGER_TYPES, MIGRATION_HASH_TABLE, type PurgeStaleExecutionResult, type PurgeStaleSourcesResult, type SeedContextOpts, type SeedContextResult, type SeedContextBindingOpts, type SetContextPolicyOpts, type ContextRow, type ContextVariableRow, type ContextBindingRow, type ShowContextResult, type CreateContextTemplateOpts, type SetContextSecretOpts, type DispatchQueueRow, type ListQueueOpts, type ExecutionRunRow, type ExecutionJobRow, type ListExecutionRunsOpts, type CheckRunTrackingDirectRow, type ListCheckRunTrackingOpts, type WorkflowRegistrationRow, type ListRegistrationsOpts, type ListRegistrationsResult, type ShowRegistrationResult, type RegisterWorkflowManualOpts, type RegisterWorkflowManualResult, } from './db-admin.js';
|
|
9
10
|
export { createMetricsRoutes, type MetricsRoutesDeps } from './routes/metrics.js';
|
|
10
11
|
export { createHealthRoutes, type HealthRoutesDeps } from './routes/health.js';
|
|
11
12
|
export { getReconnectDelay } from './reconnect-delay.js';
|
|
12
13
|
export { initTelemetry, getPrometheusExporter, collectRuntimeMetricNames, createMeter, type TelemetryConfig, } from './telemetry/index.js';
|
|
13
14
|
export { setupGracefulShutdown, type ShutdownStep, type ShutdownLogger, type ShutdownHandle, type GracefulShutdownOptions, } from './graceful-shutdown.js';
|
|
14
15
|
export { validateRequiredTools, type ToolRequirement } from './tool-check.js';
|
|
16
|
+
export { kiciTmpBase, kiciMkdtemp } from './tmp-dir.js';
|
|
15
17
|
export { createS3Client, type CreateS3ClientOptions, type SharedS3Config } from './s3-client.js';
|
|
16
18
|
export { BaseColdStore, ChunkLru, COLD_BUCKET_NAMES, DEFAULT_TABLE_CONFIG, chunkObjectKey, coldDaysToBucket, coldStoreArchiveBytesTotal, coldStoreArchiveCyclesTotal, coldStoreArchiveDurationSeconds, coldStoreArchiveRowsTotal, coldStorePurgeBytesTotal, coldStorePurgeChunksTotal, coldStorePurgeDurationSeconds, coldStoreRehydrateBytesTotal, coldStoreRehydrateDurationSeconds, coldStoreRehydrateRequestsTotal, coldStoreReplayDurationSeconds, coldStoreReplayRowsTotal, coldStoreVerifyFailuresTotal, computeChunkId, decodeChunk, encodeChunk, encodeKeySegment, isLongerColdRetention, parseManifest, resolveTableConfig, serializeManifest, tablePrefix, tenantDayBucketPrefix, tenantDayPrefix, type ArchiveCycleSummary, type BaseColdStoreDeps, type ChunkCommitMetadata, type ChunkLruOptions, type ChunkManifest, type ColdBucketName, type ColdRetention, type ColdStore, type ColdStoreConfig, type ColdStoreFetchRangeArgs, type ColdStoreReplayChunkArgs, type ColdStoreReplayResult, type ColdStoreReplayRowArgs, type ColdStoreTableConfig, type DbKind, type DecodeChunkArgs, type EligiblePartition, type EncodeChunkArgs, type EncodedChunk, type PurgeableChunk, type PurgeChunkResult, type PurgeExpiredChunksOpts, type PurgeExpiredChunksSummary, type TableAdapter, } from './cold-store/index.js';
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./rolldown-runtime-ClRpJifh.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { AgentDeliveryMode, AgentPlatform, splitAgentPlatform } from "./agent-platform.js";
|
|
3
|
+
import { createDb, createPool, isPoolAcquireTimeout } from "./db.js";
|
|
4
|
+
import { CI_SECURITY_OTHER_REPO, MIGRATION_HASH_TABLE, REGISTERABLE_TRIGGER_TYPES, apiKeyExistsDirect, bumpRegistryVersionDirect, bumpRegistryVersionSimpleDirect, cleanupExecutionRowsDirect, clearDispatchQueueDirect, clearPeerCredentialsRevokedAtByIdsDirect, computeMigrationsHash, countActivePeerCredentialsByInstanceDirect, countCronLastFiredDirect, countHeldRunsByRunIdDirect, countWebhookSourcesByConnectionIdDirect, createContextTemplateDirect, createDbRole, createJoinTokenDirect, createReadOnlyDbUser, deleteContextDirect, deleteCronLastFiredDirect, deleteCrossRepoTrustDirect, deleteExecutionRunsByWorkflowNameDirect, deleteGenericWebhookSourcesByNameDirect, deleteJoinTokensByCreatedByDirect, deleteKiciEventsDirect, deleteOrgSettingsByCustomerIdDirect, deletePeerCredentialsByInstanceIdLikeDirect, deleteWorkflowRegistrationsDirect, describeTableColumnsDirect, dropAndCreateDatabase, dropDatabaseDirect, emitKiciEventDirect, ensureDatabase, ensureOrgOwnerMemberDirect, findAnyUserApiKeyIdDirect, getExecutionRunSecurityDirect, getGenericWebhookSourceByRoutingKeyDirect, getHeldRunByIdDirect, getPeerCredentialRevokedAtDirect, getRegistryVersionDirect, getWebhookSourceByRoutingKeyDirect, getWorkflowRegistrationByIdDirect, insertCronLastFiredNowDirect, insertCrossRepoTrustStrictDirect, insertKiciEventAtDirect, insertKiciEventRawDirect, insertPeerCredentialExpiredDirect, insertWorkflowRegistrationRawDirect, insertWorkflowRegistrationStrictDirect, isSchemaCurrent, isSchemaCurrentFromFilesDirect, latestExecutionRunByStatusDirect, listActiveGenericWebhookSourcesDirect, listActivePeerCredentialsExcludingDirect, listCheckRunTrackingDirect, listContextsDirect, listCrossRepoTrustBySourceRoutingKeyDirect, listExecutionJobsDirect, listExecutionRunsDirect, listHeldRunApprovalsDirect, listKiciEventsDirect, listQueueDirect, listRegistrationsByRoutingKeyDirect, listRegistrationsDirect, maskDatabaseUrl, paginateUnprocessedEventsKeysetDirect, parseDatabaseUrl, platformConnectionExistsDirect, pollKiciEventsDirect, prunePeerCredentialsDirect, purgeContextsDirect, purgeScopedSecretsDirect, purgeSecretBackendsDirect, purgeStaleExecutionDirect, purgeStaleSourcesDirect, readStoredMigrationContentHash, registerWorkflowManualDirect, resetRaftStateDirect, resolvePlatformWebhookSourceRoutingKeyDirect, restoreSoftDeletedGenericWebhookSourceDirect, seedApiKeyInlineDirect, seedCiSecurityFixturesDirect, seedContextBindingDirect, seedContextDirect, seedCrossRepoTrustDirect, seedGenericWebhookSourceDirect, seedSourcePrivateKeyDirect, seedSyntheticGithubSourceDirect, seedUniversalGitSourceDirect, seedWebhookSecretDirect, setContextPolicyDirect, setContextSecretDirect, showContextDirect, showExecutionRunDirect, showKiciEventDirect, showQueueEntryDirect, showRegistrationDirect, storeMigrationContentHash, storeMigrationContentHashInTableDirect, tableExistsDirect, terminateIdleDbBackendsDirect, updateGenericWebhookVerificationConfigDirect, updateOrgSettingsDeniedReposDirect, updateSourceRoutingKeyDirect, updateWorkflowRegistrationCommitShaDirect, upsertCronLastFiredDirect, upsertOrgSettingsGlobalWorkflowsDirect, verifyKiciEventNotifyDirect, waitForEventLogRowByDeliveryIdDirect, waitForExecutionRunReachesStatusSinceDirect, waitForLatestExecutionJobStatusDirect, waitForPlatformEventLogDistinctRoutedDirect, waitForPlatformExecutionRunStatusDirect, waitForPlatformRegistrationsDirect, waitForPostgresDirect, waitForRegistrationsByRoutingKeyDirect, waitForRegistrationsUpdatedAtAdvanceDirect, waitForRunCompletionDirect } from "./db-admin.js";
|
|
4
5
|
import { setupGracefulShutdown } from "./graceful-shutdown.js";
|
|
5
6
|
import { decrypt, deriveKey, encrypt, generateMasterKey } from "./secret-crypto.js";
|
|
6
7
|
import { RingBuffer } from "./ring-buffer.js";
|
|
@@ -14,6 +15,7 @@ import { collectRuntimeMetricNames, getPrometheusExporter, initTelemetry } from
|
|
|
14
15
|
import { createMeter } from "./telemetry/metrics.js";
|
|
15
16
|
import "./telemetry/index.js";
|
|
16
17
|
import { validateRequiredTools } from "./tool-check.js";
|
|
18
|
+
import { kiciMkdtemp, kiciTmpBase } from "./tmp-dir.js";
|
|
17
19
|
import { createS3Client } from "./s3-client.js";
|
|
18
20
|
import { chunkObjectKey, encodeKeySegment, tablePrefix, tenantDayBucketPrefix, tenantDayPrefix } from "./cold-store/key.js";
|
|
19
21
|
import { COLD_BUCKET_NAMES, coldDaysToBucket, isLongerColdRetention } from "./cold-store/bucket.js";
|
|
@@ -21,9 +23,9 @@ import { computeChunkId } from "./cold-store/chunk-id.js";
|
|
|
21
23
|
import { decodeChunk, encodeChunk } from "./cold-store/chunk-encoder.js";
|
|
22
24
|
import { parseManifest, serializeManifest } from "./cold-store/manifest.js";
|
|
23
25
|
import { coldStoreArchiveBytesTotal, coldStoreArchiveCyclesTotal, coldStoreArchiveDurationSeconds, coldStoreArchiveRowsTotal, coldStorePurgeBytesTotal, coldStorePurgeChunksTotal, coldStorePurgeDurationSeconds, coldStoreRehydrateBytesTotal, coldStoreRehydrateDurationSeconds, coldStoreRehydrateRequestsTotal, coldStoreReplayDurationSeconds, coldStoreReplayRowsTotal, coldStoreVerifyFailuresTotal } from "./cold-store/metrics.js";
|
|
26
|
+
import { DEFAULT_TABLE_CONFIG, resolveTableConfig } from "./cold-store/config.js";
|
|
24
27
|
import { BaseColdStore } from "./cold-store/cold-store.js";
|
|
25
28
|
import { ChunkLru } from "./cold-store/lru.js";
|
|
26
|
-
import { DEFAULT_TABLE_CONFIG, resolveTableConfig } from "./cold-store/config.js";
|
|
27
29
|
import "./cold-store/index.js";
|
|
28
30
|
export * from "@kici-dev/core";
|
|
29
|
-
export { BaseColdStore, BundleChunkAssembler, COLD_BUCKET_NAMES, ChunkLru, ChunkRequestWaiter, DEFAULT_TABLE_CONFIG, FLEET_CHUNK_BYTES, MAX_LOG_BYTES, MIGRATION_HASH_TABLE, REGISTERABLE_TRIGGER_TYPES, RingBuffer, addLogsToArchive, apiKeyExistsDirect, bumpRegistryVersionDirect, bumpRegistryVersionSimpleDirect, chunkBuffer, chunkObjectKey, cleanupExecutionRowsDirect, clearDispatchQueueDirect, clearPeerCredentialsRevokedAtByIdsDirect, coldDaysToBucket, coldStoreArchiveBytesTotal, coldStoreArchiveCyclesTotal, coldStoreArchiveDurationSeconds, coldStoreArchiveRowsTotal, coldStorePurgeBytesTotal, coldStorePurgeChunksTotal, coldStorePurgeDurationSeconds, coldStoreRehydrateBytesTotal, coldStoreRehydrateDurationSeconds, coldStoreRehydrateRequestsTotal, coldStoreReplayDurationSeconds, coldStoreReplayRowsTotal, coldStoreVerifyFailuresTotal, collectRuntimeMetricNames, computeChunkId, computeMigrationsHash, countActivePeerCredentialsByInstanceDirect, countCronLastFiredDirect, countHeldRunsByRunIdDirect, countWebhookSourcesByConnectionIdDirect, createDb, createDbRole,
|
|
31
|
+
export { AgentDeliveryMode, AgentPlatform, BaseColdStore, BundleChunkAssembler, CI_SECURITY_OTHER_REPO, COLD_BUCKET_NAMES, ChunkLru, ChunkRequestWaiter, DEFAULT_TABLE_CONFIG, FLEET_CHUNK_BYTES, MAX_LOG_BYTES, MIGRATION_HASH_TABLE, REGISTERABLE_TRIGGER_TYPES, RingBuffer, addLogsToArchive, apiKeyExistsDirect, bumpRegistryVersionDirect, bumpRegistryVersionSimpleDirect, chunkBuffer, chunkObjectKey, cleanupExecutionRowsDirect, clearDispatchQueueDirect, clearPeerCredentialsRevokedAtByIdsDirect, coldDaysToBucket, coldStoreArchiveBytesTotal, coldStoreArchiveCyclesTotal, coldStoreArchiveDurationSeconds, coldStoreArchiveRowsTotal, coldStorePurgeBytesTotal, coldStorePurgeChunksTotal, coldStorePurgeDurationSeconds, coldStoreRehydrateBytesTotal, coldStoreRehydrateDurationSeconds, coldStoreRehydrateRequestsTotal, coldStoreReplayDurationSeconds, coldStoreReplayRowsTotal, coldStoreVerifyFailuresTotal, collectRuntimeMetricNames, computeChunkId, computeMigrationsHash, countActivePeerCredentialsByInstanceDirect, countCronLastFiredDirect, countHeldRunsByRunIdDirect, countWebhookSourcesByConnectionIdDirect, createContextTemplateDirect, createDb, createDbRole, createHealthRoutes, createJoinTokenDirect, createMeter, createMetricsRoutes, createPool, createReadOnlyDbUser, createS3Client, decodeChunk, decrypt, deleteContextDirect, deleteCronLastFiredDirect, deleteCrossRepoTrustDirect, deleteExecutionRunsByWorkflowNameDirect, deleteGenericWebhookSourcesByNameDirect, deleteJoinTokensByCreatedByDirect, deleteKiciEventsDirect, deleteOrgSettingsByCustomerIdDirect, deletePeerCredentialsByInstanceIdLikeDirect, deleteWorkflowRegistrationsDirect, deriveKey, describeTableColumnsDirect, dropAndCreateDatabase, dropDatabaseDirect, emitKiciEventDirect, encodeChunk, encodeKeySegment, encrypt, ensureDatabase, ensureOrgOwnerMemberDirect, findAnyUserApiKeyIdDirect, generateMasterKey, getExecutionRunSecurityDirect, getGenericWebhookSourceByRoutingKeyDirect, getHeldRunByIdDirect, getPeerCredentialRevokedAtDirect, getPrometheusExporter, getReconnectDelay, getRegistryVersionDirect, getWebhookSourceByRoutingKeyDirect, getWorkflowRegistrationByIdDirect, initTelemetry, insertCronLastFiredNowDirect, insertCrossRepoTrustStrictDirect, insertKiciEventAtDirect, insertKiciEventRawDirect, insertPeerCredentialExpiredDirect, insertWorkflowRegistrationRawDirect, insertWorkflowRegistrationStrictDirect, isLongerColdRetention, isPgUniqueViolation, isPoolAcquireTimeout, isSchemaCurrent, isSchemaCurrentFromFilesDirect, kiciMkdtemp, kiciTmpBase, latestExecutionRunByStatusDirect, listActiveGenericWebhookSourcesDirect, listActivePeerCredentialsExcludingDirect, listCheckRunTrackingDirect, listContextsDirect, listCrossRepoTrustBySourceRoutingKeyDirect, listExecutionJobsDirect, listExecutionRunsDirect, listHeldRunApprovalsDirect, listKiciEventsDirect, listQueueDirect, listRegistrationsByRoutingKeyDirect, listRegistrationsDirect, maskDatabaseUrl, paginateUnprocessedEventsKeysetDirect, parseDatabaseUrl, parseManifest, platformConnectionExistsDirect, pollKiciEventsDirect, prunePeerCredentialsDirect, purgeContextsDirect, purgeScopedSecretsDirect, purgeSecretBackendsDirect, purgeStaleExecutionDirect, purgeStaleSourcesDirect, readStoredMigrationContentHash, redactConfig, registerWorkflowManualDirect, resetRaftStateDirect, resolvePlatformWebhookSourceRoutingKeyDirect, resolveTableConfig, restoreSoftDeletedGenericWebhookSourceDirect, seedApiKeyInlineDirect, seedCiSecurityFixturesDirect, seedContextBindingDirect, seedContextDirect, seedCrossRepoTrustDirect, seedGenericWebhookSourceDirect, seedSourcePrivateKeyDirect, seedSyntheticGithubSourceDirect, seedUniversalGitSourceDirect, seedWebhookSecretDirect, serializeManifest, setContextPolicyDirect, setContextSecretDirect, setupGracefulShutdown, showContextDirect, showExecutionRunDirect, showKiciEventDirect, showQueueEntryDirect, showRegistrationDirect, splitAgentPlatform, storeMigrationContentHash, storeMigrationContentHashInTableDirect, tableExistsDirect, tablePrefix, tenantDayBucketPrefix, tenantDayPrefix, terminateIdleDbBackendsDirect, updateGenericWebhookVerificationConfigDirect, updateOrgSettingsDeniedReposDirect, updateSourceRoutingKeyDirect, updateWorkflowRegistrationCommitShaDirect, upsertCronLastFiredDirect, upsertOrgSettingsGlobalWorkflowsDirect, validateRequiredTools, verifyKiciEventNotifyDirect, waitForEventLogRowByDeliveryIdDirect, waitForExecutionRunReachesStatusSinceDirect, waitForLatestExecutionJobStatusDirect, waitForPlatformEventLogDistinctRoutedDirect, waitForPlatformExecutionRunStatusDirect, waitForPlatformRegistrationsDirect, waitForPostgresDirect, waitForRegistrationsByRoutingKeyDirect, waitForRegistrationsUpdatedAtAdvanceDirect, waitForRunCompletionDirect };
|