@operato/ops-contract 0.9.47 → 0.9.49

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/README.md CHANGED
@@ -13,7 +13,7 @@ IEC 61850 · ISO 50001 전기 계통과 성과지표
13
13
 
14
14
  ## 패키지의 책임
15
15
 
16
- 여기 있는 것은 **타입 · 판별 함수 · 정합 검증 · 어휘 상수**입니다. 입력값으로 판별과 검증을 수행합니다.
16
+ 이 패키지는 **타입, 판별 함수, 정합성 검사, 공통 상수**를 제공합니다. 함수는 전달받은 인자만 사용하며, 내부 상태나 현재 시각에 의존하지 않습니다.
17
17
 
18
18
  여기 없는 것은 **정책과 엔진**입니다. 그 사실로 무엇을 할지는 `@operato/twin-kernel` 이 정합니다.
19
19
 
@@ -94,6 +94,25 @@ assertOperationalAttentionV1(attention)
94
94
  `locationStatusOf` · `dockDoorStatusOf`(도어의 동시 수용 한도 `dockDoorCapacityOf` — 정수, 최소 1, 1.5 는 1). 이 기준을 넘는 판정 — 예약 규칙 · 우선순위 ·
95
95
  아래 생산자의 전이 판정 — 은 계약에 올리지 않습니다.
96
96
 
97
+ **구내 반송**(2026-12-03, operato-application ADR-0266) — 새 온톨로지가 아니라 기존 축에 선택 칸을 더했습니다.
98
+ 경로망은 자리 사이의 연결(`route-network.ts` — 길이 · 방향 · 속도 제한 · 동시 점유 수 · 지나갈 수 있는 장비 분류, 고정 경로, 발행 판)이고
99
+ 좌표는 담지 않습니다. 구조 검사(`validateRouteNetwork`)만 여기서 하고, 도달 가능성 같은 그래프 탐색은 판단하는 쪽(앱의 규칙, 커널의 실행 정책)이 합니다.
100
+ 관제를 받는 장비는 능력 `guided` 와 운행 상태(`travel.ts` — 마지막으로 지난 자리 · 진행 방향 · 예약 구간 · 통신 상태 · 측정 위치)를 갖고,
101
+ 배터리는 `energyStoring` 의 `soc` 를 씁니다. 반송 어휘는 `intralogistics-profile.ts`, 정책의 선언(규칙 이름 · 파라미터)은 `transport-policy.ts`,
102
+ 용기가 실을 수 있는 품목은 `asset-acceptance.ts`(받는다 · 안 받는다 · 판단할 수 없다)입니다. 운행 사건 넷을 상태로 접는 일은 커널의 다음 단계입니다.
103
+
104
+ **전기 요금표 읽기**(`tariff.ts`, 2026-11-27) — 요금제와 시간대 구간은 ops-master가 저장합니다. 이 계약은 지정한 시각의 단가(`bandAt`)와
105
+ 하루 24시간에 요금 구간이 빠짐없이 지정됐는지(`tariffCoverageIssues`)를 판정합니다. 검사 결과는 `{ field, code, params }` 형식으로 반환하고 화면에서 번역합니다.
106
+ 원천 사실의 단가(`EnergyUsagePeriodData.unitPrice`)를 마스터에 설정한 구간 단가보다 우선 적용합니다. 새 국가의 요금은 데이터 행으로 추가합니다. 구간 코드는 요금제별로 정의하고,
107
+ 요금 비교에 쓰는 등급(`TARIFF_LOAD_CLASSES`)만 고정합니다. 일요일과 공휴일은 구분하며, 공휴일 규칙을 요일 규칙보다 우선 적용합니다. 요금제는 공휴일 달력을 이름으로 참조합니다.
108
+
109
+ > **기준의 예외 하나 — 예정된 두 번째 소비처.** 지금 이 규칙을 부르는 곳은 ops-master 하나입니다. ems 커넥터가 붙으면
110
+ > (operato-application `design/charters/operato-energy.md` §4) 원천 사실에 단가가 없는 구간마다 `bandAt` 으로 단가를 구해 사용량 요금을 더하고,
111
+ > 그 합을 커널 `electricityCost({ energyChargeFromPeriods })` 에 넘깁니다 — 이것이 두 번째 소비처입니다. 나라별 요금을 행으로만 받는다는
112
+ > 결정(ADR-0239 결정 7)이 화면과 트윈의 같은 답을 요구하므로 먼저 두었습니다(2026-11-27 사용자 결정). 그 커넥터가 서지 않기로 하면 ops-master 로 돌립니다.
113
+ > **다시 보는 시점:** ems 커넥터를 세울지 정하는 자리에서 이 예외도 함께 닫습니다 — 서면 트윈이 실제로 부르는 것을 확인하고 이 문단을
114
+ > 지우고, 서지 않으면 `tariff.ts` 를 ops-master 로 돌립니다. 예외가 기한 없이 남지 않게 합니다.
115
+
97
116
  **생산자가 전이를 어떻게 정하는지**(새 판정과 기존 항목의 대조, 판정으로 해소할 수 있는 항목 유형, 근거 지문 계산)는
98
117
  생산자의 정책입니다. 데이터를 보내는 제품들이 공통으로 쓰는 구현은 `@things-factory/webhook` 의 `reconcileAttentions` · `attentionFingerprint`(SHA-256)에
99
118
  있습니다 — 이 계약에 두었다가 옮겼습니다(정책은 이 층에 두지 않는다).
@@ -0,0 +1,27 @@
1
+ import type { ResourceProperty } from './contract.ts';
2
+ export interface AssetAcceptance {
3
+ materialDefinitionIds?: string[];
4
+ materialClassIds?: string[];
5
+ /** At most this much in one carrier. */
6
+ maxQuantity?: {
7
+ value: number;
8
+ uom: string;
9
+ };
10
+ /** Conditions such as dividers or temperature keeping. Carried, not judged here. */
11
+ properties?: ResourceProperty[];
12
+ }
13
+ export interface AcceptanceQuery {
14
+ materialDefinitionId?: string;
15
+ /** The material's classes, base classes included if the caller wants them counted. */
16
+ materialClassIds?: readonly string[];
17
+ quantity?: {
18
+ value: number;
19
+ uom: string;
20
+ };
21
+ }
22
+ /**
23
+ * Whether an asset class with `accepts` may carry this material (and this quantity).
24
+ *
25
+ * `undefined` when it cannot tell: nothing declared, no material named, or a quantity in a unit other than the declared maximum's.
26
+ */
27
+ export declare function acceptsMaterial(accepts: AssetAcceptance | undefined, query: AcceptanceQuery): boolean | undefined;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Whether an asset class with `accepts` may carry this material (and this quantity).
3
+ *
4
+ * `undefined` when it cannot tell: nothing declared, no material named, or a quantity in a unit other than the declared maximum's.
5
+ */
6
+ export function acceptsMaterial(accepts, query) {
7
+ if (!accepts)
8
+ return undefined;
9
+ const defs = accepts.materialDefinitionIds ?? [];
10
+ const classes = accepts.materialClassIds ?? [];
11
+ const named = query.materialDefinitionId !== undefined || (query.materialClassIds?.length ?? 0) > 0;
12
+ if (!named)
13
+ return undefined;
14
+ let material;
15
+ if (defs.length === 0 && classes.length === 0)
16
+ material = undefined;
17
+ else {
18
+ const byDef = query.materialDefinitionId !== undefined && defs.includes(query.materialDefinitionId);
19
+ const byClass = (query.materialClassIds ?? []).some(id => classes.includes(id));
20
+ material = byDef || byClass;
21
+ }
22
+ if (material === false)
23
+ return false;
24
+ let quantity = true;
25
+ if (query.quantity && accepts.maxQuantity) {
26
+ quantity = query.quantity.uom === accepts.maxQuantity.uom ? query.quantity.value <= accepts.maxQuantity.value : undefined;
27
+ }
28
+ if (quantity === false)
29
+ return false;
30
+ if (material === undefined || quantity === undefined)
31
+ return undefined;
32
+ return true;
33
+ }
@@ -1,5 +1,5 @@
1
1
  import type { EquipmentStatus } from './contract.ts';
2
- export type CapabilityKey = 'operable' | 'storable' | 'mobile' | 'processable' | 'trackable' | 'switching' | 'metered' | 'curtailable' | 'energyGenerating' | 'energyStoring';
2
+ export type CapabilityKey = 'operable' | 'storable' | 'mobile' | 'processable' | 'trackable' | 'switching' | 'metered' | 'curtailable' | 'energyGenerating' | 'energyStoring' | 'guided';
3
3
  /** 이동 관측 — Mobile 이 노출. */
4
4
  export interface Motion {
5
5
  fromNode: string;
@@ -88,9 +88,24 @@ export const CAPABILITIES = {
88
88
  key: 'energyStoring', label: 'twin.capability.energyStoring', semantics: '전력을 저장하고 공급합니다. 손실과 수명을 평가할 수 있도록 충전과 방전을 구분합니다.',
89
89
  commands: [],
90
90
  stateFields: ['soc', 'chargeKW', 'dischargeKW'], models: ['StoringState'], invariants: ['0 <= soc <= 100'], results: ['stored', 'discharged']
91
+ },
92
+ /*
93
+ * ── Guided — travels the route network under transport control (2026-12-03, operato-application ADR-0266) ──────────────
94
+ *
95
+ * `mobile` says a resource moves between locations; a forklift a person drives has it. Last location passed, reserved
96
+ * connections and link state mean something only for equipment under transport control, so they are a capability of their
97
+ * own, declared together with `mobile`. Battery is not repeated here: guided equipment declares `energyStoring` as well.
98
+ *
99
+ * No commands. The twin does not drive robots: dispatch, pause and resume are the transport control product's instructions
100
+ * to its equipment (VDA 5050 instant actions), not stimuli inside the kernel, so they do not belong in `CMD`.
101
+ */
102
+ guided: {
103
+ key: 'guided', label: 'twin.capability.guided', semantics: '경로망 위를 관제에 따라 다니는 장비 — 마지막으로 지난 자리 · 진행 방향 · 예약 구간 · 통신 상태 · 측정 위치. mobile 과 함께 선언한다.',
104
+ commands: [],
105
+ stateFields: ['travel'], models: ['TravelState'], invariants: ['guided => mobile', '0 <= heading < 360'], results: ['passed', 'reserved', 'linkChanged', 'poseReported']
91
106
  }
92
107
  };
93
- export const CAPABILITY_KEYS = ['operable', 'storable', 'mobile', 'processable', 'trackable', 'switching', 'metered', 'curtailable', 'energyGenerating', 'energyStoring'];
108
+ export const CAPABILITY_KEYS = ['operable', 'storable', 'mobile', 'processable', 'trackable', 'switching', 'metered', 'curtailable', 'energyGenerating', 'energyStoring', 'guided'];
94
109
  /** 능력 집합이 관측 노출하는 상태 필드 합집합(직교이므로 단순 병합). */
95
110
  export function stateFieldsOf(caps) {
96
111
  const out = new Set();
@@ -1,5 +1,5 @@
1
- import { type WorkCalendarEntry } from './contract.ts';
2
1
  import type { OperationDef } from './domain-definition.ts';
2
+ import type { WorkCalendarEntry } from './contract.ts';
3
3
  /** 제약이 걸린 축 — 무엇을 늘려야 하는지가 여기서 갈린다. */
4
4
  export type CapacityAxis = 'equipment' | 'personnel' | 'asset' | 'location';
5
5
  export interface CapacityRequirement {
@@ -77,38 +77,3 @@ export interface CapacityInput {
77
77
  }
78
78
  /** ISO 8601 기간 → 시간. 명세가 쓰는 표기 그대로 읽는다(`PT1H40M`). */
79
79
  export declare function isoDurationHours(iso: string | undefined): number;
80
- /**
81
- * 근무 캘린더에서 **가용 시간과 조업일**을 읽는다 — 1분 간격 샘플링.
82
- *
83
- * 교대·휴게·비근무 규칙을 여기 다시 적지 않는다. 규칙은 `inWorkCalendarAt` 한 곳에만 있고, 이 함수는
84
- * 그것에 묻기만 한다. 두 벌이 되면 달력을 고칠 때 한쪽만 고쳐져 어긋난다.
85
- *
86
- * 캘린더가 없으면 **종일 가동**으로 본다(7일 × 24h) — 제약이 없는 것이 아니라 **선언되지 않은** 것이고,
87
- * 선언이 없으면 커널은 멈출 이유를 모른다.
88
- */
89
- export declare function workingTimeOfWeek(calendar: readonly WorkCalendarEntry[] | undefined, weekStartMs: number, utcOffsetMinutes?: number): {
90
- hoursPerWeek: number;
91
- daysPerWeek: number;
92
- };
93
- /**
94
- * 이 창에서 **조업이 계획되지 않은 시간**(ms) — 없으면 `undefined`.
95
- *
96
- * ── 무엇에 쓰나 ─────────────────────────────────────────────────────────────
97
- * ISO 22400 의 계획 조업 시간(PBT)에서 뺄 값이다(`OeeCounters.holdMs`). 커널의 PBT 가 「재기 시작한
98
- * 뒤 흐른 시간 전부」였고, 그래서 주말·야간·휴일이 계획 조업으로 세어졌다.
99
- *
100
- * ── 선언이 없으면 `undefined` 다 ────────────────────────────────────────────
101
- * **0 을 내지 않는다.** 0 은 「비근무 시간이 없다」는 주장이고, 그것은 24시간 365일 도는 현장에
102
- * 대해서만 참이다. 선언이 없는 것은 **모르는 것**이고, 부르는 쪽이 그 둘을 갈라야 한다 — 0 을 받으면
103
- * 「달력을 확인했고 쉬는 시간이 없었다」로 읽는다.
104
- *
105
- * `workingTimeOfWeek` 이 캘린더가 없을 때 종일 가동으로 보는 것과 방향이 반대로 보이지만, 그쪽은
106
- * **능력**을 묻는 자리라 「최대 얼마나 돌 수 있나」에 답해야 하고, 이쪽은 **실적 지표**의 분모라
107
- * 모르는 것을 채우면 그 수가 조용히 틀린다.
108
- *
109
- * ── 분 단위로 센다 ──────────────────────────────────────────────────────────
110
- * `workingTimeOfWeek` 과 같은 방식이다(`inWorkCalendarAt` 을 분마다 묻는다). 구간 대수로 풀면
111
- * 되풀이·요일·절대 구간이 겹칠 때의 규칙을 여기서 다시 적게 되고, 그 규칙은 이미 그 함수 안에 있다 —
112
- * 두 곳이 다른 답을 내는 것이 이 저장소에서 여러 번 났다.
113
- */
114
- export declare function nonWorkingMsIn(calendar: readonly WorkCalendarEntry[] | undefined, fromMs: number, toMs: number, utcOffsetMinutes?: number): number | undefined;
package/dist/capacity.js CHANGED
@@ -1,13 +1,3 @@
1
- /*
2
- * 용량 분석의 **입력 · 보고서 모양**과 근무 캘린더 읽기 — 계약 쪽.
3
- *
4
- * 분석 자체(`analyzeCapacity`)는 엔진의 판정이라 `@operato/twin-kernel` 의 `capacity.ts` 에 있다(2026-11-19 이동).
5
- * 여기 남은 것은 두 가지다:
6
- * · 보고서와 입력의 타입 — 커널 밖(호스트 · 화면 · 레퍼런스 마스터)이 그 모양을 읽는다.
7
- * · 근무 캘린더 읽기(`workingTimeOfWeek` · `nonWorkingMsIn`) — 선언된 캘린더만 보고 답하고, 호스트와 커널이
8
- * 같은 답을 내야 한다(`inWorkCalendarAt` 과 같은 결). README 「파생의 기준」.
9
- */
10
- import { inWorkCalendarAt } from "./contract.js";
11
1
  /** ISO 8601 기간 → 시간. 명세가 쓰는 표기 그대로 읽는다(`PT1H40M`). */
12
2
  export function isoDurationHours(iso) {
13
3
  if (!iso)
@@ -17,73 +7,3 @@ export function isoDurationHours(iso) {
17
7
  throw new Error(`기간 표기를 읽을 수 없다: ${iso}`);
18
8
  return Number(m[1] ?? 0) * 24 + Number(m[2] ?? 0) + Number(m[3] ?? 0) / 60 + Number(m[4] ?? 0) / 3600;
19
9
  }
20
- /**
21
- * 근무 캘린더에서 **가용 시간과 조업일**을 읽는다 — 1분 간격 샘플링.
22
- *
23
- * 교대·휴게·비근무 규칙을 여기 다시 적지 않는다. 규칙은 `inWorkCalendarAt` 한 곳에만 있고, 이 함수는
24
- * 그것에 묻기만 한다. 두 벌이 되면 달력을 고칠 때 한쪽만 고쳐져 어긋난다.
25
- *
26
- * 캘린더가 없으면 **종일 가동**으로 본다(7일 × 24h) — 제약이 없는 것이 아니라 **선언되지 않은** 것이고,
27
- * 선언이 없으면 커널은 멈출 이유를 모른다.
28
- */
29
- export function workingTimeOfWeek(calendar, weekStartMs, utcOffsetMinutes) {
30
- if (!calendar?.length)
31
- return { hoursPerWeek: 7 * 24, daysPerWeek: 7 };
32
- let minutes = 0;
33
- const touched = new Set();
34
- for (let m = 0; m < 7 * 24 * 60; m++) {
35
- if (!inWorkCalendarAt(calendar, weekStartMs + m * 60_000, utcOffsetMinutes))
36
- continue;
37
- minutes++;
38
- touched.add(Math.floor((m + (utcOffsetMinutes ?? 0)) / (24 * 60)));
39
- }
40
- /*
41
- * 조업일은 **선언이 말하는 것**이지 타임라인이 번진 자국이 아니다.
42
- *
43
- * 야간 교대는 자정을 넘는다 — 금요일 밤에 시작한 교대는 토요일 새벽에 끝난다. 샘플링한 분을
44
- * 날짜로 세면 월~금 3교대가 **6일**로 나오고, 그러면 주간 수요가 20% 부풀어 필요 없는 설비를
45
- * 사라고 답한다. 교대는 "월~금에 **시작한다**" 고 선언돼 있고(`daysOfWeek`), 그것이 조업일이다.
46
- *
47
- * 요일 선언이 아예 없는 달력(절대 구간만 쓰는 경우)에서는 셀 근거가 없으므로 번진 자국을 쓴다.
48
- */
49
- const declared = new Set();
50
- for (const e of calendar)
51
- if (e.entryType !== 'non-working')
52
- for (const d of e.daysOfWeek ?? [])
53
- declared.add(d);
54
- return { hoursPerWeek: minutes / 60, daysPerWeek: declared.size || touched.size };
55
- }
56
- /**
57
- * 이 창에서 **조업이 계획되지 않은 시간**(ms) — 없으면 `undefined`.
58
- *
59
- * ── 무엇에 쓰나 ─────────────────────────────────────────────────────────────
60
- * ISO 22400 의 계획 조업 시간(PBT)에서 뺄 값이다(`OeeCounters.holdMs`). 커널의 PBT 가 「재기 시작한
61
- * 뒤 흐른 시간 전부」였고, 그래서 주말·야간·휴일이 계획 조업으로 세어졌다.
62
- *
63
- * ── 선언이 없으면 `undefined` 다 ────────────────────────────────────────────
64
- * **0 을 내지 않는다.** 0 은 「비근무 시간이 없다」는 주장이고, 그것은 24시간 365일 도는 현장에
65
- * 대해서만 참이다. 선언이 없는 것은 **모르는 것**이고, 부르는 쪽이 그 둘을 갈라야 한다 — 0 을 받으면
66
- * 「달력을 확인했고 쉬는 시간이 없었다」로 읽는다.
67
- *
68
- * `workingTimeOfWeek` 이 캘린더가 없을 때 종일 가동으로 보는 것과 방향이 반대로 보이지만, 그쪽은
69
- * **능력**을 묻는 자리라 「최대 얼마나 돌 수 있나」에 답해야 하고, 이쪽은 **실적 지표**의 분모라
70
- * 모르는 것을 채우면 그 수가 조용히 틀린다.
71
- *
72
- * ── 분 단위로 센다 ──────────────────────────────────────────────────────────
73
- * `workingTimeOfWeek` 과 같은 방식이다(`inWorkCalendarAt` 을 분마다 묻는다). 구간 대수로 풀면
74
- * 되풀이·요일·절대 구간이 겹칠 때의 규칙을 여기서 다시 적게 되고, 그 규칙은 이미 그 함수 안에 있다 —
75
- * 두 곳이 다른 답을 내는 것이 이 저장소에서 여러 번 났다.
76
- */
77
- export function nonWorkingMsIn(calendar, fromMs, toMs, utcOffsetMinutes) {
78
- if (!calendar?.length)
79
- return undefined;
80
- if (!Number.isFinite(fromMs) || !Number.isFinite(toMs) || toMs <= fromMs)
81
- return undefined;
82
- const minutes = Math.floor((toMs - fromMs) / 60_000);
83
- let closed = 0;
84
- for (let m = 0; m < minutes; m++) {
85
- if (!inWorkCalendarAt(calendar, fromMs + m * 60_000, utcOffsetMinutes))
86
- closed++;
87
- }
88
- return closed * 60_000;
89
- }
@@ -1,6 +1,10 @@
1
1
  import { type RatedUsage, type UsedUsage } from './rated-usage.ts';
2
2
  import type { FoldedOrders, OrderFoldPolicy } from './order-fold.ts';
3
3
  import type { ReferencedLocation } from './referenced-location.ts';
4
+ import type { FixedRoute, LocationConnection, RouteNetworkEdition } from './route-network.ts';
5
+ import type { TravelState } from './travel.ts';
6
+ import type { TransportPolicySet } from './transport-policy.ts';
7
+ import type { AssetAcceptance } from './asset-acceptance.ts';
4
8
  export type ISOTime = string;
5
9
  export interface CanonicalEnvelope<T = unknown> {
6
10
  eventId: string;
@@ -860,6 +864,8 @@ export interface ResourceClassDef extends EffectivePeriod {
860
864
  properties?: ResourceProperty[];
861
865
  /** 이 등급의 적격을 정하는 시험 명세들 — 표준 `TestSpecificationID`. */
862
866
  testSpecificationIds?: TestSpecificationRefs;
867
+ /** What a carrier of this asset class may hold (ADR-0266 decision 8 ③, `asset-acceptance.ts`). Meaningful on asset classes only. */
868
+ accepts?: AssetAcceptance;
863
869
  }
864
870
  export declare function classClosure(directIds: readonly string[] | undefined, defs: readonly ResourceClassDef[] | undefined, at?: ISOTime): Set<string>;
865
871
  /**
@@ -1680,6 +1686,8 @@ export interface EquipmentState extends EffectivePeriod {
1680
1686
  status: string;
1681
1687
  taskId?: string;
1682
1688
  motion?: EquipmentMotion;
1689
+ /** Where guided equipment is on the route network (`guided` capability, `travel.ts`). Absent for equipment that is not guided. */
1690
+ travel?: TravelState;
1683
1691
  oee?: OeeMetrics;
1684
1692
  held?: boolean;
1685
1693
  /**
@@ -2958,6 +2966,10 @@ export declare const OP_EVENT: {
2958
2966
  * 두 채널을 합치지 않는 이유는 에너지 쪽이 **구간에 누적되는 표본**이라 처리가 다르기 때문이다.
2959
2967
  */
2960
2968
  readonly observation: "location.measured";
2969
+ readonly travelPassed: "equipment.passed";
2970
+ readonly travelReservation: "equipment.reservation";
2971
+ readonly travelLink: "equipment.link";
2972
+ readonly travelPose: "equipment.pose";
2961
2973
  };
2962
2974
  /**
2963
2975
  * 에너지 트윈의 사건 — **물(物)의 계보가 아니라 스칼라의 시계열.**
@@ -3909,6 +3921,20 @@ export interface TwinModelDef {
3909
3921
  * 물품은 이 트윈의 재고에서 빠진다. 없으면 참조하는 자리가 없다.
3910
3922
  */
3911
3923
  referencedLocations?: ReferencedLocation[];
3924
+ /**
3925
+ * **Route network** - the paths guided equipment travels (operato-application ADR-0266 decision 8 ①, `route-network.ts`).
3926
+ * The places are locations; these are the edges between them and the ordered edge lists some equipment must follow.
3927
+ * No coordinates: geometry is the board's. `routeNetwork` names the published edition both simulation and live control read.
3928
+ */
3929
+ connections?: LocationConnection[];
3930
+ fixedRoutes?: FixedRoute[];
3931
+ routeNetwork?: RouteNetworkEdition;
3932
+ /**
3933
+ * **Transport policy** - the dispatch, routing, traffic, charging and alternate-destination rules transport control and its
3934
+ * simulation decide by (ADR-0266 decision 8 ⑤, `transport-policy.ts`). Versioned; a declaration of the twin, like
3935
+ * `allocationPolicy`, not an axis.
3936
+ */
3937
+ transportPolicy?: TransportPolicySet;
3912
3938
  /**
3913
3939
  * 설비 — ISA-95 `Equipment`. mtbfMs/mttrMs 지정 시 확률적 고장 모델 참여(OEE Availability 손실).
3914
3940
  * 미지정=고장 없음. `window` 지정 시 그 시간대에만 일한다(교대·가동시간) — 미지정이면 24시간 가용.
package/dist/contract.js CHANGED
@@ -1271,7 +1271,21 @@ export const OP_EVENT = {
1271
1271
  * 이름을 `energy.measured` 와 같은 결로 둔다 — 그쪽이 에너지 계량의 도착이고 이쪽이 그 일반형이다.
1272
1272
  * 두 채널을 합치지 않는 이유는 에너지 쪽이 **구간에 누적되는 표본**이라 처리가 다르기 때문이다.
1273
1273
  */
1274
- observation: 'location.measured'
1274
+ observation: 'location.measured',
1275
+ /*
1276
+ * ── Travel of guided equipment (2026-12-03, operato-application ADR-0266 decision 8 ②, `travel.ts`) ────────────────────
1277
+ *
1278
+ * The four facts that carry `EquipmentState.travel` into the journal (state ⊆ events). Sent on change, never per tick.
1279
+ * Payloads: `TravelPassedFact` · `TravelReservationFact` · `TravelLinkFact` · `TravelPoseFact`.
1280
+ *
1281
+ * The transport control product sends them as canonical envelopes, so they need no connector mapping in
1282
+ * `operational-ingest`. Folding them into state is the kernel's next stage (ADR-0266 §5 stage 6); until then the mirror
1283
+ * does not show travel.
1284
+ */
1285
+ travelPassed: 'equipment.passed',
1286
+ travelReservation: 'equipment.reservation',
1287
+ travelLink: 'equipment.link',
1288
+ travelPose: 'equipment.pose'
1275
1289
  };
1276
1290
  // ── 에너지(EMS) 사건 — 네 번째 종류의 어휘 ────────────────────────────────
1277
1291
  /**
@@ -20,7 +20,7 @@ import type { EquipmentLevel } from './contract.ts';
20
20
  * ⚠ **복수형이 정본이다.** 이 이름이 `TwinModelDef` 의 키 그대로여야 하고(그 키가 복수다), 어긋나면
21
21
  * 저장된 이름과 화면이 부르는 이름이 달라진다 — 그 어긋남은 오류를 내지 않고 **빈 목록**을 돌려준다.
22
22
  */
23
- export type TwinAxis = 'locations' | 'equipment' | 'persons' | 'assets' | 'materials' | 'materialDefinitions' | 'items' | 'operations' | 'orders' | 'tasks' | 'recipes' | 'routes' | 'productionSpec' | 'testSpecifications' | 'demandWindows' | 'equipmentClasses' | 'personnelClasses' | 'materialClasses' | 'assetClasses';
23
+ export type TwinAxis = 'locations' | 'equipment' | 'persons' | 'assets' | 'materials' | 'materialDefinitions' | 'items' | 'operations' | 'orders' | 'tasks' | 'recipes' | 'routes' | 'productionSpec' | 'testSpecifications' | 'demandWindows' | 'equipmentClasses' | 'personnelClasses' | 'materialClasses' | 'assetClasses' | 'connections' | 'fixedRoutes';
24
24
  /**
25
25
  * 트윈의 종류 — 한 현실을 비추는 렌즈의 갈래.
26
26
  *
@@ -231,7 +231,18 @@ export const TWIN_AXES = [
231
231
  * 선언이 답하게 한다 — 축이 사는 자리(`path`)를 선언하는 것과 같은 이유다.
232
232
  */
233
233
  { axis: 'demandWindows', path: 'energy.closed', idField: 'startMs', label: 'twin.axis.demandWindows', kind: 'instance',
234
- source: 'state', historical: true, standardClass: {}, systems: ['ems'] }
234
+ source: 'state', historical: true, standardClass: {}, systems: ['ems'] },
235
+ /*
236
+ * ── Route network (2026-12-03, operato-application ADR-0266 decision 8 ①) ──────────────────────────
237
+ *
238
+ * The edges guided equipment travels between locations, and the ordered edge lists some equipment must follow.
239
+ * No standard names them: ISA-95 and EPCIS have no route network, and VDA 5050 is a protocol, not an ontology this
240
+ * catalogue projects to. So `standardClass` stays empty rather than borrowing a near name.
241
+ *
242
+ * An energy twin has no travelling equipment, so both axes are logistics-only (`LOGISTICS`).
243
+ */
244
+ { axis: 'connections', path: 'connections', label: 'twin.axis.connections', kind: 'instance', standardClass: {}, systems: LOGISTICS },
245
+ { axis: 'fixedRoutes', path: 'fixedRoutes', label: 'twin.axis.fixedRoutes', kind: 'spec', standardClass: {}, systems: LOGISTICS }
235
246
  ];
236
247
  /**
237
248
  * 화면이 이 관계를 **담아 두어도 되나** — `standing` 만 그렇다.
@@ -349,7 +360,20 @@ export const TWIN_RELATIONS = [
349
360
  { from: 'materialClasses', field: 'testSpecificationIds[]', target: { kind: 'axis', axis: 'testSpecifications' }, via: 'ops.rel.test', optional: true, tense: 'standing' },
350
361
  /* 공정이 도는 자리·자원 — 항목이 아니라 **타입**을 가리킨다 */
351
362
  { from: 'operations', field: 'locationType', target: { kind: 'type', role: 'location' }, via: 'ops.rel.at', optional: true, tense: 'standing' },
352
- { from: 'operations', field: 'resourceType', target: { kind: 'type', role: 'equipment' }, via: 'ops.rel.by', optional: true, tense: 'standing' }
363
+ { from: 'operations', field: 'resourceType', target: { kind: 'type', role: 'equipment' }, via: 'ops.rel.by', optional: true, tense: 'standing' },
364
+ /*
365
+ * Route network (ADR-0266). A connection's ends are locations of this lens or referenced ones of another lens
366
+ * (`referencedLocations`), so the target is the either-kind, like `locations.parentId`. Structure inside a published
367
+ * edition has no time of its own - it holds for as long as the edition does - so these are `standing`, like a location's parent.
368
+ */
369
+ { from: 'connections', field: 'from', target: { kind: 'axis-or-external', axis: 'locations', entity: 'lens.referencedLocation' }, via: 'ops.rel.from', tense: 'standing' },
370
+ { from: 'connections', field: 'to', target: { kind: 'axis-or-external', axis: 'locations', entity: 'lens.referencedLocation' }, via: 'ops.rel.to', tense: 'standing' },
371
+ { from: 'connections', field: 'equipmentClassIds[]', target: { kind: 'axis', axis: 'equipmentClasses' }, via: 'ops.rel.allows', optional: true, tense: 'standing' },
372
+ { from: 'fixedRoutes', field: 'connectionIds[]', target: { kind: 'axis', axis: 'connections' }, via: 'ops.rel.along', tense: 'standing' },
373
+ { from: 'fixedRoutes', field: 'equipmentClassIds[]', target: { kind: 'axis', axis: 'equipmentClasses' }, via: 'ops.rel.allows', optional: true, tense: 'standing' },
374
+ /* What a carrier accepts (ADR-0266 decision 8 ③) - a property of the asset class, so standing like the class itself. */
375
+ { from: 'assetClasses', field: 'accepts.materialDefinitionIds[]', target: { kind: 'axis', axis: 'materialDefinitions' }, via: 'ops.rel.accepts', optional: true, tense: 'standing' },
376
+ { from: 'assetClasses', field: 'accepts.materialClassIds[]', target: { kind: 'axis', axis: 'materialClasses' }, via: 'ops.rel.accepts', optional: true, tense: 'standing' }
353
377
  ];
354
378
  /**
355
379
  * 오늘 **실제로 짝이 서는 것**만 선언한다. 그럴듯한 속성을 미리 적어 두면 화면이 빈칸을 줄줄이
package/dist/epcis.d.ts CHANGED
@@ -338,12 +338,14 @@ interface EpcisActionEvent extends EpcisHeader {
338
338
  }
339
339
  export interface EpcisObjectEvent extends EpcisActionEvent {
340
340
  type: 'ObjectEvent';
341
- epcList: string[];
341
+ /** Optional as in EPCIS 2.0 §7.4.2 - an event may carry only `quantityList`; one of the two must have an entry. */
342
+ epcList?: string[];
342
343
  quantityList?: QuantityElement[];
343
344
  }
344
345
  export interface EpcisAggregationEvent extends EpcisActionEvent {
345
346
  type: 'AggregationEvent';
346
- parentID: string;
347
+ /** Optional when action is OBSERVE, required otherwise (EPCIS 2.0 §7.4.3). */
348
+ parentID?: string;
347
349
  childEPCs?: string[];
348
350
  childQuantityList?: QuantityElement[];
349
351
  }
package/dist/epcis.js CHANGED
@@ -887,14 +887,15 @@ export function validateEpcisEvent(e) {
887
887
  v.push('eventTimeZoneOffset 형식 오류');
888
888
  /*
889
889
  * ── 표준보다 좁은 곳 (2026-11-19, EPCIS 2.0 원문과 대조) ─────────────────────────
890
- * 이 검증기는 표준이 허용하는 것 셋을 **일부러** 거절한다. 셋 다 표준을 잘못 읽은 것이 아니라 이 트윈이
890
+ * 이 검증기는 표준이 허용하는 것 둘을 **일부러** 거절한다. 둘 다 표준을 잘못 읽은 것이 아니라 이 트윈이
891
891
  * 받는 입구의 선택이다 — 넓히려면 아래 「전제하는 곳」을 먼저 고쳐야 한다.
892
892
  * · `bizStep` — 표준은 모든 이벤트에서 선택(§7.4.2–7.4.6). 우리 저널은 이 칸으로 사건 종류를 가르고
893
893
  * (headless-twin `twin-event-keys` · `event-type-split`) 모든 생산자가 단계를 밝힌다.
894
- * · `ObjectEvent.epcList` — 표준은 `quantityList` 만 있는 이벤트도 허용(§7.4.2: 둘 중 하나 이상).
895
- * 커널 `observed-reducer` 가 `ev.epcList` 를 그대로 순회한다.
896
- * · `AggregationEvent.parentID` — 표준은 OBSERVE 에서 선택(§7.4.3), DELETE 에서는 자식 목록이 비어도
897
- * 된다(전부 해체). 커널의 집계 반영이 부모를 열쇠로 쓴다.
894
+ * (`ObjectEvent.epcList` 는 2026-11-27 표준 폭으로 넓혔다 — `quantityList` 만 있는 이벤트를 받는다. 커널 reducer 가
895
+ * 없는 목록을 빈 목록으로 읽게 먼저 고쳤다.)
896
+ * · `AggregationEvent` 의 자식 목록 — 표준은 DELETE 에서 비어도 된다(§7.4.3: 부모의 모든 담김 해체). 커널
897
+ * reducer 는 그 뜻을 이미 읽지만(저장한 담김을 모두 푼다) 검증기는 아직 넓히지 않았다.
898
+ * (`AggregationEvent.parentID` 는 2026-11-27 표준대로 OBSERVE 에서만 선택 — 커널은 부모 없는 관측을 세고 건너뛴다.)
898
899
  */
899
900
  if (typeof e.bizStep !== 'string' || !e.bizStep)
900
901
  v.push('bizStep 누락');
@@ -953,16 +954,17 @@ export function validateEpcisEvent(e) {
953
954
  if (e.type === 'ObjectEvent') {
954
955
  if (!ACTIONS.includes(e.action))
955
956
  v.push(`지원하지 않는 action 값: ${e.action}`);
956
- if (!Array.isArray(e.epcList))
957
- v.push('ObjectEvent.epcList 누락');
958
- else if (e.epcList.length === 0 && !e.quantityList?.length)
957
+ if (e.epcList !== undefined && !Array.isArray(e.epcList))
958
+ v.push('ObjectEvent.epcList 는 배열이어야 합니다');
959
+ else if (!e.epcList?.length && !e.quantityList?.length)
959
960
  v.push('ObjectEvent: epcList 또는 quantityList에 항목을 하나 이상 지정하세요.');
960
961
  }
961
962
  else if (e.type === 'AggregationEvent') {
962
963
  if (!ACTIONS.includes(e.action))
963
964
  v.push(`지원하지 않는 action 값: ${e.action}`);
964
- if (!e.parentID)
965
- v.push('AggregationEvent.parentID 누락');
965
+ /* 표준: OBSERVE 에서는 선택, ADD · DELETE 에서는 필수(EPCIS 2.0 §7.4.3). */
966
+ if (!e.parentID && e.action !== 'OBSERVE')
967
+ v.push('AggregationEvent.parentID 누락 — ADD · DELETE 에는 필수입니다');
966
968
  if (!e.childEPCs?.length && !e.childQuantityList?.length)
967
969
  v.push('AggregationEvent: childEPCs 또는 childQuantityList에 항목을 하나 이상 지정하세요.');
968
970
  }
package/dist/index.d.ts CHANGED
@@ -5,10 +5,16 @@ export * from './domain-catalog.ts';
5
5
  export * from './domain-definition.ts';
6
6
  export * from './ems-profile.ts';
7
7
  export * from './energy-ingest.ts';
8
+ export * from './tariff.ts';
8
9
  export * from './epcis.ts';
9
10
  export * from './gs1.ts';
10
11
  export * from './order-fold.ts';
11
12
  export * from './referenced-location.ts';
13
+ export * from './route-network.ts';
14
+ export * from './travel.ts';
15
+ export * from './intralogistics-profile.ts';
16
+ export * from './transport-policy.ts';
17
+ export * from './asset-acceptance.ts';
12
18
  export * from './face2-adapter.ts';
13
19
  export * from './iso-duration.ts';
14
20
  export * from './master-data.ts';
package/dist/index.js CHANGED
@@ -26,10 +26,16 @@ export * from "./domain-catalog.js";
26
26
  export * from "./domain-definition.js";
27
27
  export * from "./ems-profile.js";
28
28
  export * from "./energy-ingest.js";
29
+ export * from "./tariff.js";
29
30
  export * from "./epcis.js";
30
31
  export * from "./gs1.js";
31
32
  export * from "./order-fold.js";
32
33
  export * from "./referenced-location.js";
34
+ export * from "./route-network.js";
35
+ export * from "./travel.js";
36
+ export * from "./intralogistics-profile.js";
37
+ export * from "./transport-policy.js";
38
+ export * from "./asset-acceptance.js";
33
39
  export * from "./face2-adapter.js";
34
40
  export * from "./iso-duration.js";
35
41
  export * from "./master-data.js";
@@ -0,0 +1,80 @@
1
+ import type { TwinTypeInfo } from './domain-catalog.ts';
2
+ /**
3
+ * CBV steps for a carrier moving between ports. All three are CBV's own (ref.gs1.org/cbv) - checked by the CBV bizStep test.
4
+ *
5
+ * The transport control product speaks only of the carrier (GRAI). Stock moving in or out is the warehouse's and the plant's to say
6
+ * (ADR-0266 decision 9) - items in the carrier follow through `carriedBy`.
7
+ */
8
+ export declare const ILG_BIZSTEP: {
9
+ /** The carrier left a port. */
10
+ readonly departing: "urn:epcglobal:cbv:bizstep:departing";
11
+ /** The carrier reached a port. */
12
+ readonly arriving: "urn:epcglobal:cbv:bizstep:arriving";
13
+ /** The carrier is on its way. */
14
+ readonly transporting: "urn:epcglobal:cbv:bizstep:transporting";
15
+ };
16
+ /** Location types of the route network. */
17
+ export declare const ILG_LOCATION_TYPES: readonly ["waypoint", "port", "charger", "parking"];
18
+ export type IlgLocationType = (typeof ILG_LOCATION_TYPES)[number];
19
+ export declare const ILG_TYPES: TwinTypeInfo[];
20
+ /** This list's entry for a type key, or `undefined`. */
21
+ export declare function intralogisticsTypeOf(key: string): TwinTypeInfo | undefined;
22
+ /** A transport command (MCS) - `OrderState.kind`. */
23
+ export declare const ILG_ORDER_KIND: {
24
+ readonly transport: "transport";
25
+ };
26
+ export type IlgOrderKind = (typeof ILG_ORDER_KIND)[keyof typeof ILG_ORDER_KIND];
27
+ /**
28
+ * Transport jobs (MCS) - `TaskState.kind`.
29
+ *
30
+ * · `transport-leg` - one leg, port to port. A command can split into several legs (a stop on the way, an alternate destination).
31
+ * · `charge` - occupies a charger. Charging takes a place, so it is a task.
32
+ * · `park` - to a parking spot.
33
+ */
34
+ export declare const ILG_TASK_KIND: {
35
+ readonly leg: "transport-leg";
36
+ readonly charge: "charge";
37
+ readonly park: "park";
38
+ };
39
+ export type IlgTaskKind = (typeof ILG_TASK_KIND)[keyof typeof ILG_TASK_KIND];
40
+ /**
41
+ * Why a transport command failed. Closed: a reason the receiver does not know cannot be shown or counted. Values are refusal codes
42
+ * (kebab-case); wording is the presentation layer's.
43
+ */
44
+ export declare const TRANSPORT_FAILURE_REASON: readonly ["no-route", "destination-unavailable", "carrier-not-found", "carrier-mismatch", "cancelled-by-source", "equipment-fault"];
45
+ export type TransportFailureReason = (typeof TRANSPORT_FAILURE_REASON)[number];
46
+ export declare function isTransportFailureReason(v: unknown): v is TransportFailureReason;
47
+ /**
48
+ * Operational attention kinds the transport control product raises - `<product>.<code>` (`operational-attention.ts`).
49
+ * Keys and values only; no sentences (the kernel's rule for attentions).
50
+ */
51
+ export declare const ILG_ATTENTION_KIND: {
52
+ readonly deadlock: "intralogic.traffic-deadlock";
53
+ readonly blocked: "intralogic.traffic-blocked";
54
+ readonly lowCharge: "intralogic.low-charge";
55
+ readonly linkLost: "intralogic.link-lost";
56
+ readonly noRoute: "intralogic.no-route";
57
+ readonly rerouted: "intralogic.rerouted";
58
+ readonly carrierUnidentified: "intralogic.carrier-unidentified";
59
+ readonly carrierDuplicate: "intralogic.carrier-duplicate";
60
+ };
61
+ export type IlgAttentionKind = (typeof ILG_ATTENTION_KIND)[keyof typeof ILG_ATTENTION_KIND];
62
+ /**
63
+ * What a transport command carries beyond the common order fields.
64
+ *
65
+ * `sourceRef` is the upper system's own reference - a warehouse task id, a material move's `moveId`, a production order id. It is
66
+ * another product's id, so it is not declared as a relation into an axis.
67
+ */
68
+ export interface TransportCommandAttributes {
69
+ /** `assets.id` of the carrier to move. */
70
+ carrierId: string;
71
+ from: string;
72
+ to: string;
73
+ /** Larger first. Absent = the policy's default. */
74
+ priority?: number;
75
+ dueAt?: string;
76
+ sourceRef?: {
77
+ system: string;
78
+ id: string;
79
+ };
80
+ }