Karyo
Documentation/ Architecture

Engine boundaries and the one distribution

Karyo 2.1.1rendered at build time
On this page

At the Karyo 2.0.0 release Karyo becomes one Apache-2.0 product. Every module - all shared libraries, every -api and -core module, and the aggregator application - lives in this repository, and the assembled application image carries the complete set of ten engine capabilities: wave fulfilment, cross-docking, order streaming, cartonization, document templates, event monitors, 3PL billing, demand forecasting, slotting and reorder simulation. There is one build shape, one image, one product.

This document describes how those capabilities sit in the one distribution: per module and per capability key, what is left of the retired licence gate, and where slotting draws its boundary with Loci. Every capability is available on every installation (ADR 0030), no screen locks (ADR 0031), and the installation's Core or Extended profile decides which capabilities the console shows (ADR 0052).

The capabilities are ordinary modules of one distribution

Each engine is a -core module beside the code it extends, exactly like every other domain:

Capability Module Capability key
Wave fulfilment karyo-wave-core advanced-fulfillment
Cross-docking karyo-crossdock-core advanced-fulfillment
Order streaming karyo-streaming-core advanced-fulfillment
Cartonization karyo-cartonization-core cartonization
Document templates karyo-doctemplates-core documents
Event monitors karyo-monitors-core monitors
3PL billing karyo-monitors-core three-pl
Demand forecasting karyo-forecasting-core forecasting
Slotting (Loci integration) karyo-slotting-core slotting
Reorder simulation karyo-simulation-core simulation

Three capabilities share one key: wave fulfilment, cross-docking and order streaming are advanced-fulfillment. One module carries two engines: karyo-monitors-core holds 3PL billing, under its own three-pl key, beside event monitors. The keys are the 1.x entitlement vocabulary, kept only as what GET /api/v1/license reports to integrations; the console does not read them. Engine capabilities describes what each does.

settings.gradle.kts includes all of them unconditionally; there is no overlay, no external checkout and no second build shape. services/karyo-app/build.gradle.kts depends on each engine module directly, the engines' test suites live in the aggregator's own src/test, and the application image is Apache-2.0 only (Building, Container images).

Ten capabilities as ordinary Karyo modules around the one warehouse core and schema: fulfilment orchestration (wave fulfilment, order streaming, cross-docking, cartonization) drives the shared ports; insight (event monitors, demand forecasting, slotting, reorder simulation) reads the schema and writes nothing; document templates and 3PL billing are per goods owner. Only slotting reaches outside, to the separate, optional Loci engine, and only when configured.

Ten capabilities, one product, one schema; only slotting reaches outside, and only when configured. How the modules are assembled into the one JVM is the architecture overview's figure. Derived from engine capabilities and settings.gradle.kts; source docs/diagrams/02-capability-map.mmd.

One build shape

Gradle subprojects 53, unconditional
karyo-app dependencies every -core and the shared libraries
Tests and detekt the whole suite, in services/karyo-app/src/test, no grafting
Image one product; all capabilities present
Image licence label Apache-2.0, a literal
Build command ./gradlew :services:karyo-app:quarkusBuild

ADR 0029 is the decision that replaced the old per-module free/commercial split (ADR 0020, superseded, kept as history).

The licence gate is retired; its interfaces remain for compatibility

No engine consults a licence (ADR 0030). The engines' require and isEntitled call sites, the per-engine LicensedModuleInstallation markers, LicenseEdition and the license-required refusal are gone, and no engine module depends on libs/karyo-license. What remains is there so nothing that talks to a 1.x installation breaks:

Kept What it does now
LicenseService Reports the frozen set of the eight capability keys, and warns at startup about each retired setting still carried
GET /api/v1/license Same route, status and shapes; community to every caller, and all eight keys to a signed-in one
KARYO_LICENSE, KARYO_LICENSE_KEY, KARYO_LICENSE_PUBLIC_KEY Accepted whatever they hold and ignored; a startup warning names each one present

The console is not on that list: it no longer has a licence hook, an Add-ons group, a locked state or a withheld figure, and it never calls the endpoint (ADR 0031, Unconfigured states). What the console shows is the installation's profile, a capability and never a licence (ADR 0052).

Authorization never depended on the gate: every engine route declares its catalogue action with @DeclaredAction (operations.view to read, operations.supervise or operations.execute to change), checked against the caller's grants (ADR 0048), and statement preview and document templates keep their operating-company guards. services/karyo-app/src/test/kotlin/com/karyo/security/EngineRouteAuthorizationTest.kt pins the boundary of every engine route. Licence settings (retired) describes the detail.

The slotting boundary: Loci advises, Karyo decides

Loci is the slotting engine (ADR 0029 named it; ADR 0031 wires it; ADR 0033 makes it the only source of slotting analysis). It is a separate Apache-2.0 product, deployed on its own: Karyo talks to it over HTTP when an operator names it, and every other capability works without it, but slotting advice requires it. The boundary is fixed on both sides and lives in karyo-slotting-core:

Karyo owns Where
The warehouse facts: pickable stock with its on-hand quantity, picks in the demand window, zones and location order, fixed-location assignments, each read by id from the shared schema reader/SlotReader.kt, reader/VelocityReader.kt, reader/FixAssignmentReader.kt
The neutral contract Loci reads, built from those facts: demand, placements in whole units, locations with their zone and proximity rank, fixedLocation constraints, class thresholds loci/LociContractBuilder.kt, loci/LociContract.kt
The call: one multipart POST /api/v1/recommend, no redirects, nothing stored on either side. When KARYO_LOCI_TOKEN_URL is set, Karyo authenticates as a machine account at Loci's provider (client_credentials) and sends Authorization: Bearer; unset, it sends no credential, which only an unauthenticated Loci on a private network accepts loci/LociClient.kt, loci/LociTokenSource.kt
The hard constraints, enforced whatever the engine advised: a SKU pinned by a fixed-location assignment becomes HOLD with the constraint on the row service/SlottingService.kt (holdFixed)
Authorization (@DeclaredAction(Actions.OPERATIONS_VIEW), Facility scope), the review vocabulary the screen shows, and applying an accepted move through Karyo's own workflows api/v1/SlottingResource.kt; the console
The truthful state without Loci: no base URL is a 503 problem (slotting-engine-not-configured) that names the setting, before any fact is read, never invented or empty advice service/SlottingService.kt, exception/SlottingExceptionMapper.kt
The truthful failure: a configured Loci that does not answer, rejects the credential, or refuses the snapshot is a 502 problem (slotting-engine-unavailable, slotting-snapshot-rejected); Karyo has no analysis of its own to fall back on; a zone name longer than the 64 characters of Loci's contract is refused before the request exception/SlottingExceptionMapper.kt, loci/LociContractBuilder.kt
Loci owns
Velocity classes and ranking, the promote/demote/hold direction, the target zone tier, the review ask (PROPOSE or ESCALATE), the reason, and the severity
The advice level: L1 prioritization from demand alone, L2 slot-class advice once every location a placement references has a zone (moves only for the tiers FORWARD, MID and RESERVE). Karyo always asks for the auto level, so Loci reports what the evidence grants and exact-bin (L3) advice is never requested
Its own validity window (stateAsOf, validUntil) and its own engine version string
Karyo owns the warehouse facts, builds the neutral contract in whole units, and posts it to Loci's /api/v1/recommend; Loci, separate and deployed on its own, owns the analysis: velocity classes, rank, direction and advice level. A fixed location is always HOLD, the slotting page shows Loci's advice, and a planner reviews and applies through Karyo's workflows. Without a base URL the page says, from a 503, that slotting advice requires Loci; a Loci that does not answer is a 502 shown on the page.

Karyo supplies the facts and enforces the rule; Loci alone supplies the analysis; no Loci is a 503 and a Loci that does not answer is a 502, each shown on the page. Derived from the two tables above and karyo-slotting-core (service/SlottingService.kt, loci/LociClient.kt, exception/SlottingExceptionMapper.kt); source docs/diagrams/04-karyo-loci-boundary.mmd.

The one setting that connects the two is karyo.slotting.loci.base-url (KARYO_LOCI_BASE_URL), an ops-controlled entry of SystemPropertyCatalog that a goods owner cannot write, resolved like every runtime knob (Business Unit override, then Company configuration key 0, then configuration); karyo.slotting.loci.timeout tunes the call. Karyo authenticates to Loci as a machine account at Loci's provider when KARYO_LOCI_TOKEN_URL, KARYO_LOCI_CLIENT_ID and KARYO_LOCI_CLIENT_SECRET are set (ADR 0034); those three, and KARYO_LOCI_TOKEN_SCOPE, are environment-only and not catalogue keys. The envelope the console reads, SlottingAdviceDto, names Loci and whether it was asked, so the screen says "Loci connected" or "Loci configured"; without a base URL there is no envelope, and the screen says that slotting advice requires Loci and names the setting. Karyo keeps no slotting analysis of its own and no in-process seam for one.

The source map