@kici-dev/compiler 0.5.0 → 0.6.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/dist/cli.js +46 -8
- package/dist/commands/approve.d.ts +12 -0
- package/dist/commands/approve.js +5 -2
- package/dist/commands/compile.js +4 -2
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/endpoints.js +4 -6
- package/dist/commands/feedback.d.ts +53 -0
- package/dist/commands/feedback.js +142 -0
- package/dist/commands/held-run-client.d.ts +21 -1
- package/dist/commands/held-run-client.js +34 -15
- package/dist/commands/hook.js +22 -20
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.js +3 -1
- package/dist/commands/init.d.ts +9 -2
- package/dist/commands/init.js +43 -16
- package/dist/commands/login.js +1 -1
- package/dist/commands/orchestrators.js +3 -2
- package/dist/commands/reject.d.ts +12 -0
- package/dist/commands/reject.js +5 -2
- package/dist/commands/report/collect.d.ts +82 -0
- package/dist/commands/report/collect.js +234 -0
- package/dist/commands/report/identity.d.ts +48 -0
- package/dist/commands/report/identity.js +49 -0
- package/dist/commands/report/index.d.ts +63 -0
- package/dist/commands/report/index.js +119 -0
- package/dist/commands/report/upload.d.ts +38 -0
- package/dist/commands/report/upload.js +64 -0
- package/dist/commands/run-hold-watch.js +2 -2
- package/dist/commands/run.js +6 -3
- package/dist/commands/runs/show.js +80 -1
- package/dist/commands/types.js +51 -8
- package/dist/execution/sdk-alias.js +4 -2
- package/dist/fixtures/compiler.js +2 -1
- package/dist/format.js +3 -3
- package/dist/generators/secrets-dts.d.ts +8 -2
- package/dist/generators/secrets-dts.js +3 -2
- package/dist/hooks/installer.js +2 -1
- package/dist/llm-context/llms-architecture.txt +35 -13
- package/dist/llm-context/llms-cli-remote.txt +2347 -0
- package/dist/llm-context/llms-cli.txt +284 -2470
- package/dist/llm-context/llms-features-execution.txt +2028 -0
- package/dist/llm-context/llms-features.txt +298 -1483
- package/dist/llm-context/llms-full.txt +6153 -4639
- package/dist/llm-context/llms-getting-started.txt +292 -12
- package/dist/llm-context/llms-patterns.txt +176 -1
- package/dist/llm-context/llms-providers.txt +11 -27
- package/dist/llm-context/llms-sdk-runtime.txt +25 -4
- package/dist/llm-context/llms-sdk.txt +31 -1
- package/dist/llm-context/llms.txt +33 -18
- package/dist/local-plane/paths.d.ts +15 -0
- package/dist/local-plane/paths.js +22 -1
- package/dist/local-plane/plane-manager.js +2 -2
- package/dist/local-plane/port-holder.js +1 -1
- package/dist/local-plane/postgres.d.ts +3 -16
- package/dist/local-plane/postgres.js +10 -15
- package/dist/lockfile/generator.d.ts +12 -0
- package/dist/lockfile/generator.js +47 -14
- package/dist/postinstall.js +2 -1
- package/dist/remote/config.d.ts +2 -15
- package/dist/remote/config.js +2 -16
- package/dist/remote/dashboard-client.d.ts +39 -0
- package/dist/remote/dashboard-client.js +41 -0
- package/dist/remote/oauth.js +7 -5
- package/dist/remote/uploader.js +2 -2
- package/dist/templates/package-json.js +1 -1
- package/dist/test-runner/dry-run.js +4 -2
- package/dist/test-runner/git-detector.js +2 -1
- package/dist/test-runner/job-executor.js +2 -1
- package/dist/test-runner/payload-builder.js +11 -17
- package/dist/types.d.ts +33 -3
- package/dist/validation/validator.js +23 -6
- package/package.json +16 -11
- package/sbom.spdx.json +953 -901
|
@@ -316,10 +316,13 @@ The `ProviderRegistry` maps routing keys to provider bundles. Each routing key (
|
|
|
316
316
|
- `FileContentsFetcher` -- reads arbitrary repository files at a ref, for the declarative content-requirements (`requires`) filter
|
|
317
317
|
- `CloneTokenProvider` -- generates clone tokens for agents
|
|
318
318
|
- `RepoUrlBuilder` -- builds clone URLs and raw file URLs
|
|
319
|
-
- `ContributorResolver` -- resolves contributor permissions for trust-tier gating
|
|
320
319
|
- `CheckStatusPoster` -- posts check statuses (approval/hold) to the git provider
|
|
321
320
|
|
|
322
|
-
A
|
|
321
|
+
A bundle also carries a `hasForkModel` flag, set for a provider whose head ref can live outside the base repository. It is what admits a pull-request event to the org fork switch. GitHub sets it; a generic source (whose trust boundary is its verification secret) and a local source (whose trust boundary is on-disk ownership) do not.
|
|
322
|
+
|
|
323
|
+
A GitHub App source populates all seven. The file-contents capability arrives as a per-delivery factory rather than a prebuilt instance: a GitHub client is scoped to one installation, and the installation id is known only once the delivery's credentials are resolved.
|
|
324
|
+
|
|
325
|
+
A plain generic webhook source carries only the normalizer, because it has no repository API to fetch a lock file or post a check against. The pipeline skips the stages whose interface is absent rather than failing the delivery.
|
|
323
326
|
|
|
324
327
|
Provider registrations are managed via the `sources` database table, not via `SharedConfig`. When the orchestrator connects to the Platform relay, it reads source records from the DB and sends `source.register` messages. Changes to sources (add/remove) are detected via PostgreSQL LISTEN/NOTIFY on the `sources_change` channel and pushed to the Platform via `source.secrets` and `source.register`/`source.deregister`.
|
|
325
328
|
|
|
@@ -439,7 +442,18 @@ Orchestrator Agent Sandbox (child pro
|
|
|
439
442
|
|
|
440
443
|
### Agent pipeline
|
|
441
444
|
|
|
442
|
-
The agent delegates job execution to an `ExecutionSandbox` (container, bare-metal, or firecracker). The sandbox runs customer code in an isolated child process -- never in the agent's V8 isolate.
|
|
445
|
+
The agent delegates job execution to an `ExecutionSandbox` (container, bare-metal, or firecracker). The sandbox runs customer code in an isolated child process -- never in the agent's V8 isolate.
|
|
446
|
+
|
|
447
|
+
Six job types are handled. Only the first uses a sandbox; the other five run in-process, because they never execute customer workflow steps:
|
|
448
|
+
|
|
449
|
+
- **Execution jobs** -- the standard sandbox path.
|
|
450
|
+
- **Init-only jobs** -- dynamic field resolution.
|
|
451
|
+
- **Global-eval-round jobs** -- filters and generators for the candidate global workflows of one workflow repo.
|
|
452
|
+
- **DynamicJobFn evaluation jobs** -- runtime job generation.
|
|
453
|
+
- **Bring-up jobs** -- init-runner SSH bring-up. No clone, no sandbox.
|
|
454
|
+
- **Build-only jobs** -- cache population.
|
|
455
|
+
|
|
456
|
+
See [Job execution lifecycle](https://docs.kici.dev/architecture/execution/job-execution/) for details.
|
|
443
457
|
|
|
444
458
|
1. **Report running** -- Send `job.status: running` immediately upon accepting the dispatch
|
|
445
459
|
2. **Sandbox selection** -- Determine execution mode (container, bare-metal, firecracker) from job config and environment
|
|
@@ -512,7 +526,7 @@ Build Job Dispatch --> Build Agent (kici:role:builder + matching kici:os:/kici:a
|
|
|
512
526
|
| |-- Pack .kici/ source (portable tar.gz, excludes node_modules)
|
|
513
527
|
| |-- Pack .kici/node_modules (portable tar.gz)
|
|
514
528
|
| |-- Upload source tarball to cache (source/{contentHash}.tar.gz)
|
|
515
|
-
| |-- Upload deps tarball to cache (deps/{plat}-{arch}/{
|
|
529
|
+
| |-- Upload deps tarball to cache (deps/{plat}-{arch}/{depsHash}.tar.gz)
|
|
516
530
|
| |-- Upload deps companion .hash file
|
|
517
531
|
| |-- Report success (cache.upload.complete × 2)
|
|
518
532
|
| |
|
|
@@ -586,7 +600,7 @@ Dep cache misses alone do **not** trigger a build job. Deps are platform-specifi
|
|
|
586
600
|
|
|
587
601
|
### Cross-source / no-contentHash workflows
|
|
588
602
|
|
|
589
|
-
- **Lock files without `contentHash`** (schema v1) skip the source cache entirely; agents compile from source. Regenerate lock files with `kici compile` to enable caching. The current lock file schema version is
|
|
603
|
+
- **Lock files without `contentHash`** (schema v1) skip the source cache entirely; agents compile from source. Regenerate lock files with `kici compile` to enable caching. The current lock file schema version is 39.
|
|
590
604
|
- **Cross-source / global-workflow dispatch** (a workflow registered against source A fired by a webhook on source B) bypasses both caches. The registration's lock file entry still carries `contentHash`, but the cross-source path always clone-and-installs — the eval temp dir doesn't ship `@kici-dev/sdk`. The execution agent still verifies `contentHash` against the cloned source for drift detection.
|
|
591
605
|
|
|
592
606
|
### Build deduplication
|
|
@@ -626,7 +640,10 @@ Both source and dep caches use `S3CacheStorage` as the sole backend. The `CacheS
|
|
|
626
640
|
Cache keys reflect that source tarballs and deps have different platform characteristics:
|
|
627
641
|
|
|
628
642
|
- **Source:** `source/{contentHash}.tar.gz` — platform-agnostic. Raw TypeScript source is identical regardless of CPU architecture, so one entry is shared across all platforms. `contentHash` is the per-workflow hash from the lock file (`SHA-256(COMPILE_SCHEMA_VERSION + ":" + rawSource [+ "\0" + assetDigest])`, where `COMPILE_SCHEMA_VERSION = 5` and line endings are normalized to LF so the hash agrees across platforms).
|
|
629
|
-
- **Deps:** `deps/{platform}-{arch}/{
|
|
643
|
+
- **Deps:** `deps/{platform}-{arch}/{depsHash}.tar.gz`, with a
|
|
644
|
+
`deps/{platform}-{arch}/{lockfileHash}.hash` pointer holding that hash — the
|
|
645
|
+
tarball is addressed by its own content, so two builds sharing a lock file
|
|
646
|
+
cannot leave a tarball and an integrity hash that disagree. Platform-specific. Native dependencies in `node_modules` differ across architectures, so each platform/arch combination gets its own cache entry.
|
|
630
647
|
|
|
631
648
|
The orchestrator derives the target platform/arch for dep cache lookups by probing `AgentRegistry.findAvailable()` with the workflow's first job's `runsOn` labels to find a representative matching agent, then using that agent's platform and arch. Falls back to `linux/x64` if no matching agents are registered.
|
|
632
649
|
|
|
@@ -1304,7 +1321,7 @@ The orchestrator is the execution brain. It decides what to run and dispatches w
|
|
|
1304
1321
|
- **Job queue** -- PostgreSQL-backed FIFO queue for reliable dispatch.
|
|
1305
1322
|
- **Webhook pipeline** -- Dedup, event mapping, lock file fetch, trigger matching, and job dispatch in a single pipeline.
|
|
1306
1323
|
- **Multi-orchestrator clustering** -- Optional peer-to-peer coordination via direct WebSocket connections. Enables cross-architecture job routing (e.g., x64 coordinator reroutes arm64 jobs to a peer), high availability, and dedicated coordinator topologies. Uses Raft consensus for leader election (orphan recovery). See [Multi-Orchestrator Architecture](https://docs.kici.dev/architecture/clustering/multi-orchestrator/).
|
|
1307
|
-
- **Auto-scaler** -- Optional pluggable module for ephemeral agent provisioning.
|
|
1324
|
+
- **Auto-scaler** -- Optional pluggable module for ephemeral agent provisioning. Four backends are configurable: containers (Docker/Podman), bare-metal processes, Firecracker microVMs, and the event backend, which performs no local compute -- it emits reserved scale-up / scale-down events that a customer-authored provisioning workflow consumes to boot and tear down a cloud instance. Spawns agents on demand when no matching agent is connected, with label-based routing, two-level capacity limits (global + per-backend), warm pools, YAML configuration (`scalers.d/` directory support), and SIGHUP reload. Disabled by default -- orchestrator works without it.
|
|
1308
1325
|
- **Independent database** -- Has its own PostgreSQL database separate from the Platform. Stores execution runs/jobs/steps, dispatch queue, webhook secrets, dedup cache, and scaler state. The orchestrator's `execution_runs` and `execution_jobs` are the authoritative source of truth. The Platform receives execution status updates via WebSocket messages (`execution.status`, `job.status.forward`).
|
|
1309
1326
|
|
|
1310
1327
|
> Source: `packages/orchestrator/src/pipeline/processor.ts` (webhook pipeline), `packages/orchestrator/src/cluster/` (P2P coordination), `packages/orchestrator/src/scaler/` (auto-scaler module), `packages/orchestrator/src/server.ts` (Platform/hybrid entry point)
|
|
@@ -1314,6 +1331,7 @@ The orchestrator is the execution brain. It decides what to run and dispatches w
|
|
|
1314
1331
|
The agent is the execution worker. It runs on customer infrastructure and has full access to customer code.
|
|
1315
1332
|
|
|
1316
1333
|
- **Repository cloning** -- Clones the target repo with token-based auth (token in HTTP headers, not URLs, to prevent leakage).
|
|
1334
|
+
- **Git credential helper** -- Registers a credential helper for the job's git operations. Every network operation asks the orchestrator's broker for a credential, so a token is minted seconds before use rather than held for the life of the job. Write access is opt-in and time-boxed: `ctx.repo.withWrite(...)` adds a repository-scoped grant for the duration of its callback and revokes it afterwards, with a TTL backstop.
|
|
1317
1335
|
- **Step execution** -- Runs steps in declaration order with full `StepContext` (zx shell, logger, environment, workflow/job metadata). Steps wrapped in a `parallel()` group run concurrently behind a `maxParallel` window, and each child reports as its own observable step with its own logs, status, timing, and retry.
|
|
1318
1336
|
- **Execution sandboxes** -- Runs the workflow runner as a separate child process with a sanitized environment, in one of three sandboxes: bare metal (process fork, with optional bubblewrap namespace isolation), a container runtime (the whole job lifecycle runs inside a disposable container), or inside a Firecracker microVM. Agent-internal credentials never reach customer workflow code.
|
|
1319
1337
|
- **Log streaming** -- Chunked log streaming back to the orchestrator with configurable size limits.
|
|
@@ -1329,11 +1347,14 @@ The agent is the execution worker. It runs on customer infrastructure and has fu
|
|
|
1329
1347
|
Shared business logic used by all three tiers. Single source of truth for cross-tier concerns. Has no internal `@kici-dev/*` dependencies -- only a handful of third-party libraries.
|
|
1330
1348
|
|
|
1331
1349
|
- Protocol message schemas (Zod-based, direction-specific unions including dashboard REST-over-WS, browser live streaming, the test-relay control plane, log pull, run events, peer-to-peer, cluster join, and source registration)
|
|
1332
|
-
- Provider interfaces (WebhookNormalizer, LockFileFetcher, ChangedFilesFetcher, FileContentsFetcher, CloneTokenProvider, RepoUrlBuilder,
|
|
1350
|
+
- Provider interfaces (WebhookNormalizer, LockFileFetcher, ChangedFilesFetcher, FileContentsFetcher, CloneTokenProvider, RepoUrlBuilder, CheckStatusPoster), plus the deprecated `ContributorResolver` the pipeline no longer calls
|
|
1351
|
+
- Git credential vocabulary (forge names plus the credential reference, grant, request, and result shapes the SDK declares and the orchestrator's broker resolves) and the agent→orchestrator relay protocol its credential helper calls. See [Git credentials](https://docs.kici.dev/user/patterns/git-credentials/)
|
|
1333
1352
|
- Trigger matching engine (branch, path, event evaluation)
|
|
1353
|
+
- Content-requirement matcher (the declarative `requires` filter -- pure data describing a query over the bytes of one source file at the event's ref, interpreted by the orchestrator via the `FileContentsFetcher` so no author code runs there) and the shared text-match vocabulary (`contains` / `notContains` / `matches` / `notMatches`) it shares with the commit-message trigger filter
|
|
1334
1354
|
- Dispatch inputs (input descriptors, extraction from the trigger event, and coercion to typed values)
|
|
1335
1355
|
- Matrix expansion and fanout (combination expansion with include/exclude, job-name suffix formatting, and materialization of one matrix or multi-host job into N dispatchable children)
|
|
1336
|
-
- Execution status vocabulary (run/job/step status enums + terminal-state sets; lifecycle owned by the orchestrator's execution tracker)
|
|
1356
|
+
- Execution status vocabulary (run/job/step status enums + terminal-state sets; lifecycle owned by the orchestrator's execution tracker) and its presentation layer (the total precedence order that decides which status wins a roll-up, legacy-spelling resolution, and the per-status failure classification every consumer asks about)
|
|
1357
|
+
- Job-kind discriminator, alongside the status enums. It separates a `standard` job running steps from an invoke `gate` and from the `proxy` job that mirrors a summoned run
|
|
1337
1358
|
- Check mode (the idempotent run modes `apply` / `check` / `check-fail-on-drift` and the per-step outcome vocabulary)
|
|
1338
1359
|
- Webhook signature verification (HMAC-SHA256, timing-safe)
|
|
1339
1360
|
- WebSocket close codes (unified across all tiers)
|
|
@@ -1344,12 +1365,13 @@ Shared business logic used by all three tiers. Single source of truth for cross-
|
|
|
1344
1365
|
- Approval requirements (normalized approver clauses shared by the orchestrator gate, the resolver, the held-run store, and the agent step round-trip)
|
|
1345
1366
|
- Build provenance (in-toto statement schema, DSSE envelope, attestation bundle, verification)
|
|
1346
1367
|
- Artifact name contract (the shared filesystem/URL-safe name schema the orchestrator, agent, and SDK all validate against)
|
|
1347
|
-
- Developer MCP tool schemas (argument schemas for the AI-agent tool surface)
|
|
1368
|
+
- Developer MCP tool schemas (argument schemas for the AI-agent tool surface) and the untrusted-content fence that wraps every repository- or contributor-supplied value an agent reads in a per-response random nonce, so log lines and error text cannot be read as instructions
|
|
1348
1369
|
- Developer-operations contract (one row per workflow-developer operation declaring which entrypoints expose it -- the shared REST API behind the web UI and the `kici` CLI, the AI-agent tool surface, and a curated UI flag -- asserted against each real surface by congruence tests)
|
|
1349
1370
|
- Label utilities (platform label derivation, runsOn normalization, `kici:*` set-only reserved namespace, role labels)
|
|
1350
1371
|
- Host inventory (the canonical queryable host-roster schema shared by the orchestrator's roster store, the agent-facing inventory API, and the SDK's `ctx.kici.inventory`)
|
|
1351
1372
|
- Audit policy and retention (per-action access-log sampling, warm-retention windows for cold-store eligibility, federated activity row schema)
|
|
1352
|
-
- Scaler backend type enum (`container`, `bare-metal`, `firecracker`, `kubernetes`)
|
|
1373
|
+
- Scaler backend type enum (`container`, `bare-metal`, `firecracker`, `kubernetes`, `event`) and the reserved `kici.` event-name prefix that keeps a user step from forging a system event
|
|
1374
|
+
- Job resource vocabulary (the requests/limits shape the SDK accepts, the compiler validates and emits, the orchestrator uses for capacity math and kernel-side enforcement, and the dashboard displays)
|
|
1353
1375
|
- Registration trigger type enum (registerable trigger discriminator)
|
|
1354
1376
|
- Sandbox capability set (the Linux capability names a container sandbox may add or drop, shared by the SDK validator, the compiler, and the dispatch resolver)
|
|
1355
1377
|
- Plan tier vocabulary (the hosted plan tiers and the purchasable subset, shared by the Platform and the browser dashboard)
|
|
@@ -1375,7 +1397,7 @@ It also runs the **local dev plane** -- an on-demand, fully local execution stac
|
|
|
1375
1397
|
|
|
1376
1398
|
### `@kici-dev/core`
|
|
1377
1399
|
|
|
1378
|
-
Light shared utilities with no server-side dependencies
|
|
1400
|
+
Light shared utilities with no server-side dependencies. It provides JSON-structured logging, error helpers, async-local-storage request context, and human-readable formatting (`formatBytes`/`formatDuration`/`formatUptime`). It also provides cryptographic helpers (`sha256`/`sha256File`/`deriveSharedSecret` plus symmetric encrypt/decrypt), retry-backoff computation, and the shared diagnostics-result contract. The rest of its surface ships as subpath entry points: the temp-directory allocator and its garbage collector, package-manager detection, CI-environment detection, and the idempotent-step runner (the check / confirm / apply primitive behind idempotent steps). Finally it supplies zx initialization (`initZx()`) and the TypeScript loader hook that transforms TypeScript on import. It is the dependency-light core that the SDK, compiler, and `kici` CLI consume directly so they stay free of heavier server-only dependencies. `@kici-dev/shared` re-exports it, so existing `@kici-dev/shared` import paths keep working.
|
|
1379
1401
|
|
|
1380
1402
|
> Source: `packages/core/src/`
|
|
1381
1403
|
|
|
@@ -1463,7 +1485,7 @@ The orchestrator connects outbound to the Platform WebSocket endpoint. After aut
|
|
|
1463
1485
|
|
|
1464
1486
|
When multiple orchestrators are deployed, they establish direct WebSocket connections to each other on the `/ws/peer` endpoint. Peers are discovered via the Platform matchmaker (Platform/hybrid modes) or static configuration (`KICI_CLUSTER_PEERS` env var, independent mode). Connections are authenticated with a mutual pre-shared key (PSK). Traffic includes agent inventory heartbeats, job rerouting, progress reporting, cancel propagation, and Raft leader election. These messages never transit the Platform tier.
|
|
1465
1487
|
|
|
1466
|
-
> See [Multi-Orchestrator Architecture](https://docs.kici.dev/architecture/clustering/multi-orchestrator/) for clustering details and [Protocol Messages](https://docs.kici.dev/architecture/protocol/dashboard/#orchestrator
|
|
1488
|
+
> See [Multi-Orchestrator Architecture](https://docs.kici.dev/architecture/clustering/multi-orchestrator/) for clustering details and [Protocol Messages](https://docs.kici.dev/architecture/protocol/dashboard/#orchestrator---orchestrator-messages-peer-to-peer) for message schemas.
|
|
1467
1489
|
|
|
1468
1490
|
### Orchestrator ↔ Agent
|
|
1469
1491
|
|