@kici-dev/agent 0.6.0 → 0.7.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/config.d.ts +38 -38
- package/dist/eval-runner.js +1866 -0
- package/dist/execution/dep-installer.d.ts +28 -7
- package/dist/execution/eval-context.d.ts +114 -0
- package/dist/execution/global-eval-types.d.ts +26 -0
- package/dist/execution/job-runner.d.ts +23 -75
- package/dist/execution/npm-registry-config.d.ts +6 -0
- package/dist/execution/rule-evaluator.d.ts +2 -1
- package/dist/execution/sandbox/bare-metal-sandbox.d.ts +6 -0
- package/dist/execution/sandbox/container-hardening.d.ts +8 -0
- package/dist/execution/sandbox/container-sandbox.d.ts +9 -0
- package/dist/execution/sandbox/eval-dispatch.d.ts +28 -0
- package/dist/execution/sandbox/eval-fork-runner.d.ts +43 -0
- package/dist/execution/sandbox/eval-runner.d.ts +21 -0
- package/dist/execution/sandbox/fork-runner.d.ts +23 -0
- package/dist/execution/sandbox/ipc-protocol.d.ts +82 -8
- package/dist/execution/sandbox/job-network.d.ts +91 -0
- package/dist/execution/sandbox/log-masker.d.ts +38 -0
- package/dist/execution/sandbox/types.d.ts +6 -0
- package/dist/execution/sandbox/workflow-runner.d.ts +1 -1
- package/dist/execution/source-packer.d.ts +4 -4
- package/dist/execution/source-restore.d.ts +28 -13
- package/dist/execution/workflow-loader.d.ts +16 -13
- package/dist/execution/yarnrc-berry-config.d.ts +6 -4
- package/dist/index.js +83 -40
- package/dist/provenance/statement-builder.d.ts +19 -8
- package/dist/server.js +1527 -1665
- package/dist/workflow-runner-bundle.js +1117 -185
- package/dist/workflow-runner.js +395 -149
- package/dist/ws/orchestrator-client.d.ts +4 -0
- package/package.json +6 -5
- package/sbom.spdx.json +66 -66
package/dist/config.d.ts
CHANGED
|
@@ -47,6 +47,10 @@ declare const configSchema: z.ZodObject<{
|
|
|
47
47
|
sandboxHardened: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<boolean, string>>;
|
|
48
48
|
sandboxReadonlyRootfs: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<boolean, string>>;
|
|
49
49
|
sandboxUser: z.ZodOptional<z.ZodString>;
|
|
50
|
+
runnerUser: z.ZodOptional<z.ZodString>;
|
|
51
|
+
runnerDebugStdio: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<boolean, string>>;
|
|
52
|
+
sandboxNetworkIsolation: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<boolean, string>>;
|
|
53
|
+
allowInstallScripts: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<boolean, string>>;
|
|
50
54
|
sandboxPidsLimit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
51
55
|
sandboxMemoryBytes: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
52
56
|
sandboxNanoCpus: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -114,6 +118,10 @@ export declare const envDef: import("@kici-dev/shared/env").DefineEnvResult<{
|
|
|
114
118
|
sandboxHardened: boolean;
|
|
115
119
|
sandboxReadonlyRootfs: boolean;
|
|
116
120
|
sandboxUser?: string | undefined;
|
|
121
|
+
runnerUser?: string | undefined;
|
|
122
|
+
runnerDebugStdio: boolean;
|
|
123
|
+
sandboxNetworkIsolation: boolean;
|
|
124
|
+
allowInstallScripts: boolean;
|
|
117
125
|
sandboxPidsLimit: number;
|
|
118
126
|
sandboxMemoryBytes: number;
|
|
119
127
|
sandboxNanoCpus: number;
|
|
@@ -135,47 +143,39 @@ export declare const envDef: import("@kici-dev/shared/env").DefineEnvResult<{
|
|
|
135
143
|
orphanCleanup: boolean;
|
|
136
144
|
drainOnResetFailure: boolean;
|
|
137
145
|
}>;
|
|
146
|
+
export declare function loadConfig(): AppConfig;
|
|
138
147
|
/**
|
|
139
|
-
*
|
|
148
|
+
* Remove the agent's own credentials from `process.env` after boot.
|
|
149
|
+
*
|
|
150
|
+
* The runner child runs as the agent's user under the default bare-metal
|
|
151
|
+
* backend, so `/proc/<agent-pid>/environ` is readable from inside a job: a step
|
|
152
|
+
* could print the agent token, register a rogue agent with it, and receive every
|
|
153
|
+
* dispatch routed to this one. Stripping the variables closes that read on every
|
|
154
|
+
* platform, whatever backend is selected.
|
|
140
155
|
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* - KICI_PORT (default: 8080)
|
|
148
|
-
* - KICI_LOG_LEVEL (default: info)
|
|
149
|
-
* - KICI_AGENT_TOKEN (optional, kat_ prefixed PSK for orchestrator authentication)
|
|
150
|
-
* - KICI_GITHUB_TOKEN (optional)
|
|
151
|
-
* - KICI_MAX_LOG_SIZE_BYTES (default: 10MB)
|
|
152
|
-
* - KICI_DEFAULT_STEP_TIMEOUT_MS (default: 30 min)
|
|
153
|
-
* - KICI_DOCKER_KEEP_FAILED (default: false)
|
|
154
|
-
* - KICI_JOB_HEARTBEAT_INTERVAL_MS (default: 60000)
|
|
155
|
-
* - KICI_BACKPRESSURE_MODE (default: pause, options: pause | drop)
|
|
156
|
-
* - KICI_SANDBOX (default: false) — enable bubblewrap (bwrap) namespace isolation for bare-metal execution
|
|
157
|
-
* - KICI_TRUSTED_ENV (default: false) — trusted fleet-agent profile: pass the ambient host env (minus the agent's own KiCI identity secrets) through to steps
|
|
158
|
-
* - KICI_IN_PLACE (default: false) — in-place no-clone profile: for a file:// source, use the real repo path as workDir and skip the clone (the routed deploy:stg profile)
|
|
159
|
-
* - KICI_SANDBOX_NETWORK (default: isolated, options: isolated | host) — sandbox network posture for BOTH backends: the bwrap network namespace (when sandbox=true) and the container job network. `host` shares the host network (container backend also binds host /etc/hosts read-only for name resolution); applies to the container backend under the default hardened posture (KICI_SANDBOX_HARDENED=true)
|
|
160
|
-
* - KICI_SANDBOX_HARDENED (default: true) — hardened-by-default job containers (CapDrop ALL, no-new-privileges, cgroup caps, tmpfs /tmp); set false to roll back to the legacy unhardened posture
|
|
161
|
-
* - KICI_SANDBOX_READONLY_ROOTFS (default: false) — opt-in read-only container rootfs (/tmp stays a writable tmpfs)
|
|
162
|
-
* - KICI_SANDBOX_USER (optional) — container user override (uid, uid:gid, or name); honors the image user when unset
|
|
163
|
-
* - KICI_SANDBOX_PIDS_LIMIT (default: 512) — max PIDs in the job container cgroup
|
|
164
|
-
* - KICI_SANDBOX_MEMORY_BYTES (default: 2 GiB) — memory cap in bytes for the job container cgroup
|
|
165
|
-
* - KICI_SANDBOX_NANO_CPUS (default: 2 CPUs) — CPU cap in nano-CPUs for the job container cgroup
|
|
166
|
-
* - KICI_SCALER_MANAGED (set to "1" by the orchestrator's auto-scaler — agent self-shuts down on idle)
|
|
167
|
-
* - KICI_SCALER_CLAIM_CODE (optional single-use claim code the agent exchanges for its own ephemeral credentials before registering; ignored when KICI_AGENT_TOKEN is set)
|
|
168
|
-
* - KICI_SCALER_IDLE_TIMEOUT (ms, default 5000) — how long a scaler-managed agent waits before shutdown after going idle
|
|
169
|
-
* - KICI_SCALER_PENDING_DISPATCH_TIMEOUT (ms, default 60000) — extended idle window when register.ack signals a queued bound job
|
|
170
|
-
* - KICI_EXECUTION_MODE (optional, options: container | bare-metal | firecracker) — override the runner's mode-pick logic
|
|
171
|
-
* - KICI_CONCURRENCY_WAIT_TIMEOUT_MS (default: 3_600_000) — workflow-runner timeout when long-polling for a slot-release follow-up `concurrency.ack`
|
|
172
|
-
* - KICI_AGENT_BETWEEN_JOBS_RESET_COMMAND (optional) — host-reset command run between jobs on a reused agent (fail-open)
|
|
173
|
-
* - KICI_AGENT_BETWEEN_JOBS_RESET_TIMEOUT_MS (default: 60000) — reset command timeout
|
|
174
|
-
* - KICI_AGENT_BETWEEN_JOBS_RESET_RUN_ON (default: always, options: always | on-failure) — when the reset command runs
|
|
175
|
-
* - KICI_AGENT_ORPHAN_CLEANUP (default: true) — reap a finished job's leaked process tree (bare-metal); false = only signal the runner child
|
|
176
|
-
* - KICI_AGENT_DRAIN_ON_RESET_FAILURE (default: false) — drain the agent after repeated consecutive reset failures
|
|
156
|
+
* This is defence in depth, not isolation — a same-uid `ptrace` or
|
|
157
|
+
* `/proc/<pid>/mem` read still reaches the value the config object holds. The
|
|
158
|
+
* boundary is `KICI_RUNNER_USER` (a dedicated uid) or the container backend.
|
|
159
|
+
*
|
|
160
|
+
* Safe because each variable has exactly one reader: `loadConfig()`, which has
|
|
161
|
+
* one caller and runs before this. Returns the names actually removed.
|
|
177
162
|
*/
|
|
178
|
-
export declare function
|
|
163
|
+
export declare function scrubCredentialEnv(): string[];
|
|
164
|
+
/**
|
|
165
|
+
* Describe the runner-isolation posture when it offers no boundary between a
|
|
166
|
+
* job's step code and the agent process, or `undefined` when one is in place.
|
|
167
|
+
*
|
|
168
|
+
* The exposed posture is the default bare-metal one: `KICI_SANDBOX=false` (a
|
|
169
|
+
* plain `fork()`, no namespaces), no `KICI_RUNNER_USER`, and no container
|
|
170
|
+
* backend. The child then runs as the agent's own user, so the env allowlist
|
|
171
|
+
* that keeps the agent's credentials out of the child is not a credential
|
|
172
|
+
* boundary — anything running as that uid can still reach the agent process.
|
|
173
|
+
*
|
|
174
|
+
* Reported as one startup warning naming both remedies, rather than refused:
|
|
175
|
+
* bwrap is Linux-only and the container backend imposes a container runtime, so
|
|
176
|
+
* neither can be a default without breaking existing installs.
|
|
177
|
+
*/
|
|
178
|
+
export declare function describeExposedPosture(config: Pick<AppConfig, 'sandbox' | 'runnerUser' | 'executionMode' | 'jobImageAgent'>): string | undefined;
|
|
179
179
|
/**
|
|
180
180
|
* Connection/identity options for the orchestrator WebSocket client, derived
|
|
181
181
|
* purely from config.
|