openapi: 3.0.3 info: title: Task Interleaving API version: 1.0.0 description: | The WES-tier advisor of task interleaving in the warehouse-systems platform (ADR 0001, ADR 0002). When a station completes a task, this context looks at the open-task pool and, if one or more open tasks are close enough to where the operator now stands, issues an **interleaving hint**: a short ranked list of candidate tasks. Policy `rectilinear-v1`: the detour of a candidate is the rectilinear distance `|dx| + |dy| + verticalWeight*|dz|` in metres, rounded to 0.1 m, from the station's position to the candidate's first location. The hint is **advisory**. fulfillment-execution may use it only as a tie-break inside one priority band, fails open when it is absent or expired, and keeps `claimNext` as its only claim path; nothing in this API assigns work to a worker (ADR 0001, ADR 0002). A site is **inert** until an operator declares its interleaving policy with `PUT /sites/{siteId}/policy`: no hint is issued for a site without one. Hints are computed from local copies fed by events (open-task pool, claims, location geometry; ADR 0003); this API never calls a sibling context. Events are published as CloudEvents on `warehouse.task-interleaving.events` through a transactional outbox (see `apis/asyncapi.yaml`). Mutable resources carry a `version` (starts at 1, +1 per accepted change) and a matching strong `ETag: ""` header. A policy update sends `If-Match`; a stale value is a 412 `version-mismatch`, and a write that loses a race at the database is a 409 `concurrent-modification`. Errors are RFC 7807 problem documents with `type = https://errors.task-interleaving.warehouse-systems.dev/`. There is no authentication layer (fleet decision 2026-09-11). contact: name: task-interleaving maintainers url: https://github.com/IQVO/task-interleaving license: name: UNLICENSED servers: - url: http://localhost:8080 description: Local development - url: http://localhost:8000/api/task-interleaving description: Local kind cluster through Kong tags: - name: Policy description: The per-site interleaving policy; a site without one is inert. - name: Hints description: The interleaving hints issued to stations and their outcome. - name: Stations description: What the context knows about a station - its position and active hint. - name: Recommendations description: Read-only simulation of the recommender; issues nothing. - name: Reports description: | The analytics read side (ADR 0008), served read-only by the separate ti-reports binary (Service `-reports`). - name: Health description: Liveness and readiness probes. paths: /sites/{siteId}/policy: parameters: - $ref: "#/components/parameters/SiteId" put: operationId: declareInterleavingPolicy summary: Declare or replace a site's interleaving policy description: | Declares the interleaving policy of a site, or replaces it with a new version. Until a site has a policy no hint is issued for it. Validation: `maxDetourM` greater than 0, `maxCandidates` 1 to 5, `hintTtlSeconds` greater than 0, `eligibleTaskTypes` non-empty and a subset of `PICK`, `PACK`, `REBIN`, `SLAM`, `RELOCATE`, `REPLENISH`, `verticalWeight` at least 0 (default 1). The first declaration sends no `If-Match`; once a policy exists, `If-Match` must carry its current version. A stale or missing `If-Match` on an existing policy is a 412 `version-mismatch`. Declaring the same values again still advances the version. tags: [Policy] parameters: - $ref: "#/components/parameters/IfMatch" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DeclarePolicyRequest" example: maxDetourM: 25 maxCandidates: 3 hintTtlSeconds: 90 eligibleTaskTypes: [PICK, REPLENISH] verticalWeight: 1.5 responses: "200": description: The policy is declared at its new version. headers: ETag: $ref: "#/components/headers/ETag" content: application/json: schema: $ref: "#/components/schemas/Policy" example: siteId: SITE-1 maxDetourM: 25 maxCandidates: 3 hintTtlSeconds: 90 eligibleTaskTypes: [PICK, REPLENISH] verticalWeight: 1.5 version: 2 declaredAt: "2026-10-17T12:00:00Z" "400": $ref: "#/components/responses/BadRequest" "409": $ref: "#/components/responses/Conflict" "412": $ref: "#/components/responses/VersionMismatch" "500": $ref: "#/components/responses/InternalError" get: operationId: getInterleavingPolicy summary: Get a site's interleaving policy description: | Returns the current policy of the site with its `version` (also as the `ETag`). A site that never declared one is a 404 `policy-not-found`: it is inert and issues no hints. tags: [Policy] x-pagination-exempt: view responses: "200": description: The policy. headers: ETag: $ref: "#/components/headers/ETag" content: application/json: schema: $ref: "#/components/schemas/Policy" "400": $ref: "#/components/responses/BadRequest" "404": $ref: "#/components/responses/PolicyNotFound" "500": $ref: "#/components/responses/InternalError" /hints: get: operationId: listHints summary: List interleaving hints description: | Lists hints newest first, a page at a time. `cursor` is the opaque `nextCursor` of the previous page; a response without `nextCursor` is the last page. Optional filters narrow by station, site and state. `limit` and `cursor` may each be given once; an empty or repeated `limit` is `invalid-limit`, a repeated `cursor` is `invalid-cursor`, and a query parameter this operation does not declare is `unknown-query-parameter`. tags: [Hints] parameters: - $ref: "#/components/parameters/Limit" - $ref: "#/components/parameters/Cursor" - name: stationId in: query description: Only hints issued to this station. schema: type: string pattern: '\S' - name: siteId in: query description: Only hints of this site. schema: type: string pattern: '\S' - name: state in: query description: Only hints in this state. schema: $ref: "#/components/schemas/HintState" responses: "200": description: One page of hints. content: application/json: schema: $ref: "#/components/schemas/HintPage" example: items: - hintId: hint-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 stationId: STN-07 siteId: SITE-1 state: Active afterTaskId: task-8a1f originLocation: WH1-FWD-A01-01-01-A issuedAt: "2026-10-17T12:00:00Z" expiresAt: "2026-10-17T12:01:30Z" policyVersion: 2 candidates: - { rank: 1, taskId: task-9c2e, taskType: PICK, location: WH1-FWD-A01-02-01-A, detourM: 4.5 } version: 1 nextCursor: aGludC0z "400": $ref: "#/components/responses/BadRequest" "500": $ref: "#/components/responses/InternalError" /hints/{hintId}: parameters: - $ref: "#/components/parameters/HintId" get: operationId: getHint summary: Get an interleaving hint description: | Returns the hint with its ranked candidates and its outcome: `Active` until a claim of one of its candidates by the hinted station marks it `Consumed`, the clock marks it `Expired`, or a newer completion at the same station marks it `Superseded`. tags: [Hints] responses: "200": description: The hint. headers: ETag: $ref: "#/components/headers/ETag" content: application/json: schema: $ref: "#/components/schemas/Hint" "400": $ref: "#/components/responses/BadRequest" "404": $ref: "#/components/responses/HintNotFound" "500": $ref: "#/components/responses/InternalError" /stations/{stationId}: parameters: - $ref: "#/components/parameters/StationId" get: operationId: getStation summary: Get a station's position and active hint description: | Returns what the context knows about the station: its position (the end location of the last task it completed), the last completed task and the Active hint, if any. A station that has completed no task since this context started listening is a 404 `station-not-found`. tags: [Stations] responses: "200": description: The station. headers: ETag: $ref: "#/components/headers/ETag" content: application/json: schema: $ref: "#/components/schemas/Station" example: stationId: STN-07 siteId: SITE-1 position: location: WH1-FWD-A01-01-01-A point: { xM: 4.2, yM: 10.5, zM: 0.4 } lastCompletedTaskId: task-8a1f lastCompletedAt: "2026-10-17T12:00:00Z" activeHint: hintId: hint-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 state: Active issuedAt: "2026-10-17T12:00:00Z" expiresAt: "2026-10-17T12:01:30Z" policyVersion: 2 candidates: - { rank: 1, taskId: task-9c2e, taskType: PICK, location: WH1-FWD-A01-02-01-A, detourM: 4.5 } version: 3 "400": $ref: "#/components/responses/BadRequest" "404": $ref: "#/components/responses/StationNotFound" "500": $ref: "#/components/responses/InternalError" /recommendations: post: operationId: recommendTasks summary: Simulate the recommender for a station description: | A read-only simulation: runs the same pure recommender that issues hints against the current open-task pool and the site's policy, and returns the ranked candidates. It issues no hint, publishes no event and changes no state. The origin is the station's recorded position, or `fromLocation` when given (a what-if). The site is the station's site, or the site of `fromLocation`. An empty `candidates` list means no hint would be issued. The site must have a declared policy (422 `policy-not-declared` otherwise) and the origin must have known geometry (422 `origin-unknown`). Requires an `Idempotency-Key`; replaying the same key and request within 24 hours returns the original answer with `Idempotency-Replayed: true` when that answer is final for the request: a 200, or a refusal that is a function of the request alone (400 `malformed-request`, `invalid-station-id`). A refusal that depends on state that can change (422 `policy-not-declared`, `origin-unknown`, `station-position-unknown`) and every 5xx is NOT stored: the key is released and the same request under the same key executes again. A copy that arrives while the original is still in flight answers the original's stored answer, never a refusal of its own. tags: [Recommendations] parameters: - $ref: "#/components/parameters/IdempotencyKey" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RecommendationRequest" example: stationId: STN-07 fromLocation: WH1-FWD-A01-01-01-A responses: "200": description: The ranked candidates; possibly empty. headers: Idempotency-Replayed: $ref: "#/components/headers/IdempotencyReplayed" content: application/json: schema: $ref: "#/components/schemas/Recommendation" example: stationId: STN-07 siteId: SITE-1 originLocation: WH1-FWD-A01-01-01-A policyVersion: 2 candidates: - { rank: 1, taskId: task-9c2e, taskType: PICK, location: WH1-FWD-A01-02-01-A, detourM: 4.5 } - { rank: 2, taskId: task-9d10, taskType: REPLENISH, location: WH1-FWD-A02-01-01-A, detourM: 12.0 } "400": $ref: "#/components/responses/BadRequest" "409": $ref: "#/components/responses/Conflict" "422": $ref: "#/components/responses/Unprocessable" "500": $ref: "#/components/responses/InternalError" /healthz: get: operationId: healthz summary: Liveness probe description: 200 while the process is running. tags: [Health] responses: "200": description: Alive. content: application/json: schema: $ref: "#/components/schemas/Status" /readyz: get: operationId: readyz summary: Readiness probe description: 200 when the service can serve traffic. 503 while draining for shutdown (`{'status':'not_ready'}`) or while Postgres or the Kafka broker is unreachable (problem `dependency-unavailable`). Kafka readiness is reachability only (a broker answers a metadata request); a missing topic never makes the service unready, the broker auto-creates topics on first write. The dependency verdict is cached for a few seconds. tags: [Health] responses: "200": description: Ready. content: application/json: schema: $ref: "#/components/schemas/Status" "503": description: Not ready. content: application/json: schema: $ref: "#/components/schemas/Status" application/problem+json: schema: $ref: "#/components/schemas/Problem" example: type: https://errors.task-interleaving.warehouse-systems.dev/dependency-unavailable title: A runtime dependency is unavailable status: 503 detail: "not ready: kafka" instance: /readyz /reports/hint-adoption: servers: - url: http://localhost:8092 description: ti-reports (cluster-internal Service -reports) get: operationId: getHintAdoption summary: How much of the issued advice operators take, per day tags: [Reports] x-pagination-exempt: report description: | Do operators act on interleaving hints? `days[]` has one row per UTC calendar day intersecting `[from, to)` (zeros included); a day's counts cover the part of the day inside the range. `hints_issued`, `hints_consumed` and `hints_expired` count the hints whose own milestone (the `InterleavingHintIssued`, `InterleavingHintConsumed` and `InterleavingHintExpired` event `time`) fell in the window. `adoption_rate` is consumed / (consumed + expired) of the hints that ended in the window, null while none did; a hint superseded by a newer one emits neither ending event and is in no denominator. `consumed_first_rank` counts the consumed hints whose candidate was rank 1 and `mean_detour_m` is the mean detour of the consumed candidates (null when none). `time_to_consume` is the issued-to-consumed time of the hints consumed in the window whose issue the projection also saw; `p50_seconds` / `p95_seconds` are linear-interpolated percentiles and are null when `count` is 0. `siteId` narrows every counter to one site (omitted = every site); `granularity` is `day` (the only bucket; the default). The data is as fresh as `GET /reports/freshness` says. parameters: - $ref: "#/components/parameters/ReportFrom" - $ref: "#/components/parameters/ReportTo" - name: siteId in: query required: false description: Narrows every counter to one site. Omitted = every site. schema: type: string example: SITE-1 - name: granularity in: query required: false description: The time-bucket resolution; only `day` exists (the default). schema: type: string enum: [day] example: day responses: "200": description: The adoption for the effective range. content: application/json: schema: $ref: "#/components/schemas/HintAdoptionReport" example: from: "2026-10-05T00:00:00Z" to: "2026-10-07T00:00:00Z" site_id: "SITE-1" granularity: day days: - day: "2026-10-05" hints_issued: 120 hints_consumed: 54 hints_expired: 40 adoption_rate: 0.574 consumed_first_rank: 41 mean_detour_m: 6.3 time_to_consume: { count: 54, p50_seconds: 21.5, p95_seconds: 74 } - day: "2026-10-06" hints_issued: 0 hints_consumed: 0 hints_expired: 0 adoption_rate: null consumed_first_rank: 0 mean_detour_m: null time_to_consume: { count: 0, p50_seconds: null, p95_seconds: null } "400": description: "`from` / `to` are not RFC 3339, empty or inverted, span more than 366 days, or `granularity` is not `day`." content: application/problem+json: schema: $ref: "#/components/schemas/Problem" examples: invalid-report-range: value: type: https://errors.task-interleaving.warehouse-systems.dev/invalid-report-range title: from and to must form a valid RFC 3339 range of at most 366 days status: 400 detail: from must be strictly before to instance: /reports/hint-adoption invalid-report-granularity: value: type: https://errors.task-interleaving.warehouse-systems.dev/invalid-report-granularity title: granularity must be "day" status: 400 detail: 'granularity must be "day", got "hour"' instance: /reports/hint-adoption "500": $ref: "#/components/responses/ReportStoreError" /reports/freshness: servers: - url: http://localhost:8092 description: ti-reports (cluster-internal Service -reports) get: operationId: getReportsFreshness summary: How far the analytics projection is behind tags: [Reports] description: | The freshness lag of the projection the report reads: `as_of` is the CloudEvents time of the newest event the projector has applied and `lag_seconds` is now minus `as_of` (never negative). Both are null until the first event is applied. A growing lag means the projector is down or behind, not that the report is wrong: it catches up when the projector does. responses: "200": description: The freshness (null fields while nothing was projected). content: application/json: schema: $ref: "#/components/schemas/ReportsFreshness" example: as_of: "2026-10-07T11:59:55Z" lag_seconds: 4.2 "500": $ref: "#/components/responses/ReportStoreError" components: headers: ETag: description: 'Strong entity tag of the resource: the quoted `version`, for example `"3"`.' schema: type: string example: '"3"' IdempotencyReplayed: description: >- `true` when this response is the stored answer of an earlier request with the same `Idempotency-Key` and the same method, path and body (the handler did not run again): a success or a refusal that is final for the request. Absent on the first execution, and on the retry of a released key (a refusal that depends on changeable state is not stored). schema: type: string enum: ["true"] parameters: ReportFrom: name: from in: query required: false description: RFC 3339 instant, inclusive. Defaults to `to` minus 30 days. schema: type: string format: date-time example: "2026-10-05T00:00:00Z" ReportTo: name: to in: query required: false description: RFC 3339 instant, exclusive. Defaults to now. At most 366 days after `from`. schema: type: string format: date-time example: "2026-10-07T00:00:00Z" SiteId: name: siteId in: path required: true description: The site (the fleet's site code), 1 to 64 characters without whitespace or `/`. schema: type: string minLength: 1 maxLength: 64 pattern: "^[^\\s/]+$" example: SITE-1 StationId: name: stationId in: path required: true description: The station id, 1 to 64 characters without whitespace or `/`. schema: type: string minLength: 1 maxLength: 64 pattern: "^[^\\s/]+$" example: STN-07 HintId: name: hintId in: path required: true description: The hint id (`hint-` followed by a unique suffix, at most 64 characters). schema: type: string minLength: 6 maxLength: 64 pattern: "^hint-[^\\s/]+$" example: hint-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 Limit: name: limit in: query description: Page size, 1 to 500 (default 100). schema: type: integer format: int32 minimum: 1 maximum: 500 default: 100 Cursor: name: cursor in: query description: The `nextCursor` value from the previous page. schema: type: string IfMatch: name: If-Match in: header required: false description: | The `ETag` the caller last saw. Omitted only for the first declaration; for an existing policy a missing or stale value is refused with 412 `version-mismatch`. schema: type: string example: '"2"' IdempotencyKey: name: Idempotency-Key in: header required: true description: | Caller-generated unique key (a UUID per logical submit) that makes a retried request safe. The service always runs on Postgres, so it is required on every deployment and answered with 400 `idempotency-key-required` when absent; a replay with the same key and the same request (method, path and body) returns the original response with the header `Idempotency-Replayed: true` when that answer was a success or a refusal that is final for the request, while the same key with a different request is 409 `idempotency-key-reused`. A stored answer is replayed for 24 hours; after that the key is a new request again. A refusal that depends on state that can change (422 `policy-not-declared`, `origin-unknown`, `station-position-unknown`) and every 5xx are not stored: the key is released, the same request under the same key executes again and a different body under it is a new request. Before such an unstored answer goes out the key is read again, so a copy sent while the first request was in flight replays its stored answer. schema: type: string minLength: 1 maxLength: 128 responses: ReportStoreError: description: The analytical database query failed (ti-reports only). content: application/problem+json: schema: $ref: "#/components/schemas/Problem" example: type: https://errors.task-interleaving.warehouse-systems.dev/report-store-error title: The report could not be served status: 500 detail: the analytical database query failed instance: /reports/hint-adoption BadRequest: description: Malformed JSON body, an unknown field, an invalid policy value, or an invalid path or query parameter. content: application/problem+json: schema: $ref: "#/components/schemas/Problem" examples: malformedBody: summary: Malformed JSON body or unknown field value: type: https://errors.task-interleaving.warehouse-systems.dev/malformed-request title: Malformed request status: 400 detail: request body is not valid JSON for this operation instance: /recommendations invalidSite: summary: Invalid site id value: type: https://errors.task-interleaving.warehouse-systems.dev/invalid-site-id title: Site id is invalid status: 400 detail: "siteId must be 1..64 characters without whitespace, control characters or '/'" instance: /sites/bad%20site/policy invalidStation: summary: Invalid station id value: type: https://errors.task-interleaving.warehouse-systems.dev/invalid-station-id title: Station id is invalid status: 400 detail: "stationId must be 1..64 characters without whitespace, control characters or '/'" instance: /stations/bad%20station invalidHintId: summary: Invalid hint id value: type: https://errors.task-interleaving.warehouse-systems.dev/invalid-hint-id title: Hint id is invalid status: 400 detail: "hint id must start with hint- and have no whitespace, control characters or '/'" instance: /hints/nope invalidPolicy: summary: Policy values out of range value: type: https://errors.task-interleaving.warehouse-systems.dev/invalid-policy title: Policy is invalid status: 400 detail: maxCandidates must be between 1 and 5 instance: /sites/SITE-1/policy invalidTaskType: summary: Unknown or empty eligible task types value: type: https://errors.task-interleaving.warehouse-systems.dev/invalid-task-type title: Eligible task types are invalid status: 400 detail: "eligibleTaskTypes must be a non-empty subset of PICK, PACK, REBIN, SLAM, RELOCATE, REPLENISH" instance: /sites/SITE-1/policy invalidCursor: summary: Invalid cursor value: type: https://errors.task-interleaving.warehouse-systems.dev/invalid-cursor title: Cursor is invalid status: 400 detail: cursor is not a value returned by this API instance: /hints invalidLimit: summary: Invalid limit value: type: https://errors.task-interleaving.warehouse-systems.dev/invalid-limit title: Limit is invalid status: 400 detail: limit must be between 1 and 500 instance: /hints unknownQueryParameter: summary: Undeclared query parameter on a paged list value: type: https://errors.task-interleaving.warehouse-systems.dev/unknown-query-parameter title: Unknown query parameter status: 400 detail: "unknown query parameter: after" instance: /hints invalidState: summary: Unknown hint state filter value: type: https://errors.task-interleaving.warehouse-systems.dev/invalid-state title: State is invalid status: 400 detail: "state must be one of Active, Consumed, Expired, Superseded" instance: /hints idempotencyKeyRequired: summary: Missing Idempotency-Key value: type: https://errors.task-interleaving.warehouse-systems.dev/idempotency-key-required title: Idempotency-Key header is required status: 400 detail: send an Idempotency-Key header with a unique value per logical request instance: /recommendations idempotencyKeyInvalid: summary: Malformed Idempotency-Key value: type: https://errors.task-interleaving.warehouse-systems.dev/idempotency-key-invalid title: Idempotency-Key header is invalid status: 400 detail: the Idempotency-Key header must be 1 to 128 printable ASCII characters instance: /recommendations Unprocessable: description: | The request is well-formed but cannot be simulated: `policy-not-declared` (the site is inert), `origin-unknown` (the origin has no known geometry), `station-position-unknown` (no `fromLocation` and no recorded position). content: application/problem+json: schema: $ref: "#/components/schemas/Problem" examples: policyNotDeclared: summary: The site has no interleaving policy value: type: https://errors.task-interleaving.warehouse-systems.dev/policy-not-declared title: The site has no interleaving policy status: 422 detail: declare a policy with PUT /sites/{siteId}/policy before simulating instance: /recommendations originUnknown: summary: The origin has no known geometry value: type: https://errors.task-interleaving.warehouse-systems.dev/origin-unknown title: The origin location has no known geometry status: 422 detail: no geometry is known for location WH1-FWD-A01-01-01-A instance: /recommendations stationPositionUnknown: summary: No fromLocation and no recorded position value: type: https://errors.task-interleaving.warehouse-systems.dev/station-position-unknown title: The station position is unknown status: 422 detail: the station has no recorded position; send fromLocation instance: /recommendations PolicyNotFound: description: The site has no interleaving policy (it is inert). content: application/problem+json: schema: $ref: "#/components/schemas/Problem" example: type: https://errors.task-interleaving.warehouse-systems.dev/policy-not-found title: Interleaving policy not found status: 404 detail: the site has not declared an interleaving policy instance: /sites/SITE-1/policy HintNotFound: description: No hint has this id. content: application/problem+json: schema: $ref: "#/components/schemas/Problem" example: type: https://errors.task-interleaving.warehouse-systems.dev/hint-not-found title: Hint not found status: 404 detail: interleaving hint not found instance: /hints/hint-unknown StationNotFound: description: The context has recorded no completion for this station. content: application/problem+json: schema: $ref: "#/components/schemas/Problem" example: type: https://errors.task-interleaving.warehouse-systems.dev/station-not-found title: Station not found status: 404 detail: no completion has been recorded for the station instance: /stations/STN-99 VersionMismatch: description: The `If-Match` value is missing or does not match the policy's current version; re-fetch and retry. content: application/problem+json: schema: $ref: "#/components/schemas/Problem" example: type: https://errors.task-interleaving.warehouse-systems.dev/version-mismatch title: The If-Match version is stale status: 412 detail: if-match does not match the current version instance: /sites/SITE-1/policy Conflict: description: Another request changed the policy first (`concurrent-modification`), or the Idempotency-Key was already used with a different request (`idempotency-key-reused`). content: application/problem+json: schema: $ref: "#/components/schemas/Problem" examples: concurrentModification: summary: Another request changed the policy first value: type: https://errors.task-interleaving.warehouse-systems.dev/concurrent-modification title: The resource was modified by another request; re-fetch the latest version and retry status: 409 detail: concurrent modification instance: /sites/SITE-1/policy idempotencyKeyReused: summary: The Idempotency-Key was used with a different request value: type: https://errors.task-interleaving.warehouse-systems.dev/idempotency-key-reused title: Idempotency-Key was already used with a different request status: 409 detail: the Idempotency-Key was used with a different request (method, path or body) instance: /recommendations InternalError: description: Unexpected server error. content: application/problem+json: schema: $ref: "#/components/schemas/Problem" example: type: https://errors.task-interleaving.warehouse-systems.dev/internal-error title: Internal server error status: 500 detail: an unexpected error occurred instance: /hints schemas: HintAdoptionReport: type: object required: [from, to, granularity, days] properties: from: { type: string, format: date-time, description: The effective range start (inclusive). } to: { type: string, format: date-time, description: The effective range end (exclusive). } site_id: { type: string, description: The site scope; omitted when the report covers every site. } granularity: { type: string, enum: [day] } days: type: array description: One dense row per UTC calendar day intersecting the range, zeros included. items: { $ref: "#/components/schemas/HintAdoptionDay" } HintAdoptionDay: type: object required: [day, hints_issued, hints_consumed, hints_expired, adoption_rate, consumed_first_rank, mean_detour_m, time_to_consume] properties: day: { type: string, format: date, description: The UTC calendar day. } hints_issued: { type: integer, minimum: 0, description: InterleavingHintIssued events that fell in the day's window. } hints_consumed: { type: integer, minimum: 0, description: InterleavingHintConsumed events that fell in the day's window. } hints_expired: { type: integer, minimum: 0, description: InterleavingHintExpired events that fell in the day's window. } adoption_rate: { type: number, format: double, nullable: true, minimum: 0, maximum: 1, description: "consumed / (consumed + expired) in the window; null while no hint ended." } consumed_first_rank: { type: integer, minimum: 0, description: Consumed hints whose candidate was rank 1. } mean_detour_m: { type: number, format: double, nullable: true, minimum: 0, description: Mean detour in metres of the consumed candidates; null when none. } time_to_consume: { $ref: "#/components/schemas/ConsumeTiming" } ConsumeTiming: type: object required: [count, p50_seconds, p95_seconds] properties: count: { type: integer, minimum: 0, description: Hints consumed in the window whose issue the projection also saw. } p50_seconds: { type: number, format: double, nullable: true, minimum: 0, description: Median seconds from issue to consumption; null when count is 0. } p95_seconds: { type: number, format: double, nullable: true, minimum: 0, description: 95th percentile seconds from issue to consumption; null when count is 0. } ReportsFreshness: type: object required: [as_of, lag_seconds] properties: as_of: { type: string, format: date-time, nullable: true, description: The CloudEvents time of the newest applied event; null until the first. } lag_seconds: { type: number, format: double, nullable: true, minimum: 0, description: "now - as_of, never negative; null until the first event." } TaskType: type: string description: A task type an interleaving hint may point at. enum: [PICK, PACK, REBIN, SLAM, RELOCATE, REPLENISH] HintState: type: string description: | Lifecycle state of a hint. `Active` moves to exactly one terminal state: `Consumed` (a candidate was claimed by the hinted station), `Expired` (`expiresAt` passed) or `Superseded` (a newer completion at the station issued a newer hint, or cleared it). enum: [Active, Consumed, Expired, Superseded] DeclarePolicyRequest: type: object additionalProperties: false required: [maxDetourM, maxCandidates, hintTtlSeconds, eligibleTaskTypes] properties: maxDetourM: type: number format: double exclusiveMinimum: true minimum: 0 description: Largest detour, in metres, a candidate may have. Greater than 0. maxCandidates: type: integer format: int32 minimum: 1 maximum: 5 description: How many candidates a hint lists at most. hintTtlSeconds: type: integer format: int32 minimum: 1 maximum: 2147483647 description: How long a hint stays valid, in seconds. Greater than 0 and at most 2147483647 (400 `invalid-policy` otherwise). eligibleTaskTypes: type: array minItems: 1 description: The task types a hint may point at. Non-empty; a repeated type is accepted and collapses to one. items: $ref: "#/components/schemas/TaskType" verticalWeight: type: number format: double minimum: 0 default: 1 nullable: true description: Weight of the vertical distance in the rectilinear travel model. At least 0. Absent or null means the default 1. Policy: type: object required: [siteId, maxDetourM, maxCandidates, hintTtlSeconds, eligibleTaskTypes, verticalWeight, version, declaredAt] properties: siteId: { type: string, example: SITE-1 } maxDetourM: { type: number, format: double } maxCandidates: { type: integer, format: int32 } hintTtlSeconds: { type: integer, format: int32 } eligibleTaskTypes: type: array items: { $ref: "#/components/schemas/TaskType" } verticalWeight: { type: number, format: double } version: { type: integer, format: int64, description: "Starts at 1, +1 per declaration." } declaredAt: { type: string, format: date-time } Point: type: object description: A position in the site's local coordinate frame, in metres (facility-layout geometry). required: [xM, yM, zM] properties: xM: { type: number, format: double } yM: { type: number, format: double } zM: { type: number, format: double, description: Height above floor level. } Position: type: object description: Where a station is, as the end location of the last task it completed. required: [location] properties: location: { type: string, description: The facility-layout location code. } point: $ref: "#/components/schemas/Point" Candidate: type: object required: [rank, taskId, taskType, location, detourM] properties: rank: { type: integer, format: int32, minimum: 1, description: "1 is the closest; ranked by detourM, then taskId." } taskId: { type: string } taskType: { $ref: "#/components/schemas/TaskType" } location: { type: string, description: The location the operator must go to first. } detourM: { type: number, format: double, minimum: 0, description: "Rectilinear detour in metres, rounded to 0.1 m." } Hint: type: object required: [hintId, stationId, siteId, state, afterTaskId, originLocation, issuedAt, expiresAt, policyVersion, candidates, version] properties: hintId: { type: string, example: hint-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 } stationId: { type: string } siteId: { type: string } state: { $ref: "#/components/schemas/HintState" } afterTaskId: { type: string, description: The completed task this hint follows. } originLocation: { type: string, description: Where the station stood when the hint was issued. } issuedAt: { type: string, format: date-time } expiresAt: { type: string, format: date-time, description: "issuedAt + the policy's hintTtlSeconds." } policyVersion: { type: integer, format: int64, description: The policy version the hint was computed with. } candidates: type: array minItems: 1 description: In rank order. items: { $ref: "#/components/schemas/Candidate" } consumedTaskId: { type: string, description: The candidate that was claimed; present only when Consumed. } consumedAt: { type: string, format: date-time } supersededAt: { type: string, format: date-time } version: { type: integer, format: int64, description: "Starts at 1, +1 per accepted transition." } HintPage: type: object required: [items] properties: items: type: array items: { $ref: "#/components/schemas/Hint" } nextCursor: type: string description: Opaque cursor for the next page; absent on the last page. ActiveHint: type: object description: The Active hint of a station. required: [hintId, state, issuedAt, expiresAt, policyVersion, candidates] properties: hintId: { type: string } state: { $ref: "#/components/schemas/HintState" } issuedAt: { type: string, format: date-time } expiresAt: { type: string, format: date-time } policyVersion: { type: integer, format: int64 } candidates: type: array items: { $ref: "#/components/schemas/Candidate" } Station: type: object required: [stationId, siteId, position, lastCompletedTaskId, lastCompletedAt, version] properties: stationId: { type: string } siteId: { type: string } position: { $ref: "#/components/schemas/Position" } lastCompletedTaskId: { type: string } lastCompletedAt: { type: string, format: date-time } activeHint: { $ref: "#/components/schemas/ActiveHint" } version: { type: integer, format: int64, description: "Starts at 1, +1 per accepted change." } RecommendationRequest: type: object additionalProperties: false required: [stationId] properties: stationId: type: string minLength: 1 maxLength: 64 pattern: '\S' description: The station to simulate for. fromLocation: type: string minLength: 1 maxLength: 128 pattern: '\S' description: A what-if origin location code; defaults to the station's recorded position. Recommendation: type: object required: [stationId, siteId, originLocation, policyVersion, candidates] properties: stationId: { type: string } siteId: { type: string } originLocation: { type: string } policyVersion: { type: integer, format: int64 } candidates: type: array description: In rank order; empty when no hint would be issued. items: { $ref: "#/components/schemas/Candidate" } Problem: type: object description: RFC 7807 problem document used for every non-2xx response. required: [type, title, status, detail, instance] properties: type: { type: string, format: uri } title: { type: string } status: { type: integer, format: int32 } detail: { type: string } instance: { type: string } Status: type: object required: [status] properties: status: { type: string, example: ok }