@operato/twin-kernel 0.8.0 → 0.8.2

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.
Files changed (62) hide show
  1. package/dist/class-master-table.d.ts +1 -1
  2. package/dist/counterfactual.d.ts +1 -1
  3. package/dist/divergence.d.ts +1 -1
  4. package/dist/divergence.js +1 -1
  5. package/dist/ems-kernel.d.ts +1 -1
  6. package/dist/ems-kernel.js +4 -4
  7. package/dist/event-journal.d.ts +1 -1
  8. package/dist/flow-engine.d.ts +6 -6
  9. package/dist/flow-engine.js +8 -8
  10. package/dist/forecast.d.ts +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/job-response.d.ts +1 -1
  13. package/dist/kernel.d.ts +1 -1
  14. package/dist/kernel.js +4 -4
  15. package/dist/make-to-order.d.ts +1 -1
  16. package/dist/mes-kernel.d.ts +3 -3
  17. package/dist/mes-kernel.js +4 -4
  18. package/dist/observed-reducer.d.ts +2 -2
  19. package/dist/observed-reducer.js +3 -3
  20. package/dist/runtime.d.ts +1 -1
  21. package/dist/task-fold.d.ts +1 -1
  22. package/dist/twin-observer.d.ts +1 -1
  23. package/dist/yms-kernel.d.ts +1 -1
  24. package/dist/yms-kernel.js +3 -3
  25. package/dist-cjs/index.cjs +15 -15
  26. package/package.json +2 -2
  27. package/dist/capability.d.ts +0 -142
  28. package/dist/capability.js +0 -127
  29. package/dist/capacity.d.ts +0 -99
  30. package/dist/capacity.js +0 -172
  31. package/dist/contract.d.ts +0 -3489
  32. package/dist/contract.js +0 -1216
  33. package/dist/domain-catalog.d.ts +0 -280
  34. package/dist/domain-catalog.js +0 -322
  35. package/dist/domain-definition.d.ts +0 -306
  36. package/dist/domain-definition.js +0 -102
  37. package/dist/ems-profile.d.ts +0 -147
  38. package/dist/ems-profile.js +0 -367
  39. package/dist/energy-ingest.d.ts +0 -214
  40. package/dist/energy-ingest.js +0 -801
  41. package/dist/epcis.d.ts +0 -458
  42. package/dist/epcis.js +0 -640
  43. package/dist/face2-adapter.d.ts +0 -191
  44. package/dist/face2-adapter.js +0 -284
  45. package/dist/iso-duration.d.ts +0 -5
  46. package/dist/iso-duration.js +0 -43
  47. package/dist/master-data.d.ts +0 -80
  48. package/dist/master-data.js +0 -168
  49. package/dist/mes-profile.d.ts +0 -14
  50. package/dist/mes-profile.js +0 -59
  51. package/dist/operational-ingest.d.ts +0 -44
  52. package/dist/operational-ingest.js +0 -379
  53. package/dist/operations-capability.d.ts +0 -117
  54. package/dist/operations-capability.js +0 -120
  55. package/dist/scenario-validate.d.ts +0 -15
  56. package/dist/scenario-validate.js +0 -72
  57. package/dist/vocabulary.d.ts +0 -28
  58. package/dist/vocabulary.js +0 -81
  59. package/dist/wms-profile.d.ts +0 -20
  60. package/dist/wms-profile.js +0 -58
  61. package/dist/yms-profile.d.ts +0 -15
  62. package/dist/yms-profile.js +0 -39
@@ -1,4 +1,4 @@
1
- import type { VocabularyElement } from '@operato/operations-contract';
1
+ import type { VocabularyElement } from '@operato/ops-contract';
2
2
  /**
3
3
  * 클래스 단위 마스터 표 — 관측 리듀서가 든다.
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Command, CommandAck, ScenarioControl, StateSnapshot } from '@operato/operations-contract';
1
+ import type { Command, CommandAck, ScenarioControl, StateSnapshot } from '@operato/ops-contract';
2
2
  import { type StateDivergence } from './divergence.ts';
3
3
  /** fork·구동·행위 가능한 트윈(FlowEngine 이 만족). */
4
4
  export interface CounterfactualTwin {
@@ -1,4 +1,4 @@
1
- import type { StateSnapshot } from '@operato/operations-contract';
1
+ import type { StateSnapshot } from '@operato/ops-contract';
2
2
  export interface FieldDiff<T> {
3
3
  id: string;
4
4
  predicted: T | undefined;
@@ -5,7 +5,7 @@
5
5
  * 상태를 같은 시점에 비교해 **드리프트(모델과 현실의 이탈)** 를 탐지한다. 발산 = 이상/개입 신호.
6
6
  * (fork 로 예측 → 관측으로 실제 → 여기서 대조. execution-model.md 시뮬↔모니터링 커플링.)
7
7
  */
8
- import { itemKeyOf } from '@operato/operations-contract';
8
+ import { itemKeyOf } from '@operato/ops-contract';
9
9
  function diffBy(predicted, actual, idOf, valOf) {
10
10
  const p = new Map(predicted.map(e => [idOf(e), valOf(e)]));
11
11
  const a = new Map(actual.map(e => [idOf(e), valOf(e)]));
@@ -1,6 +1,6 @@
1
1
  import { FlowEngine } from './flow-engine.ts';
2
2
  import { type AllocationPolicy } from './allocation-policy.ts';
3
- import { type CanonicalEnvelope, type DemandWindowState, type EnergyState, type StateSnapshot, type Attention, type StructureShift, type TwinModelDef } from '@operato/operations-contract';
3
+ import { type CanonicalEnvelope, type DemandWindowState, type EnergyState, type StateSnapshot, type Attention, type StructureShift, type TwinModelDef } from '@operato/ops-contract';
4
4
  /** 수요 구간 — 요금의 알갱이다. 15분은 한국·다수 요금제의 최대수요 산정 단위다. */
5
5
  export declare const DEMAND_WINDOW_MS: number;
6
6
  /** 그 시각이 속한 구간의 시작 — 벽시계 경계(00·15·30·45분)에 맞춘다. */
@@ -27,12 +27,12 @@
27
27
  */
28
28
  import { FlowEngine } from "./flow-engine.js";
29
29
  /* 기간 사실의 이름은 유입 문과 한 규칙이다(§`periodFactId`). */
30
- import { periodFactId } from '@operato/operations-contract';
30
+ import { periodFactId } from '@operato/ops-contract';
31
31
  /* 「이 시각에 유효한가」는 커널에 규칙이 한 벌이다 — 선언 축도 그것을 쓴다. */
32
- import { effectivityAt } from '@operato/operations-contract';
32
+ import { effectivityAt } from '@operato/ops-contract';
33
33
  import { firstFitPolicy } from "./allocation-policy.js";
34
- import { CMD, ENERGY_EVENT, minuteOfDayAt, localDayIndexAt, localDayStartMs } from '@operato/operations-contract';
35
- import { EMS_PROPERTY, METER_DIRECTION, electricalUpstreamOf, generationFractionAt } from '@operato/operations-contract';
34
+ import { CMD, ENERGY_EVENT, minuteOfDayAt, localDayIndexAt, localDayStartMs } from '@operato/ops-contract';
35
+ import { EMS_PROPERTY, METER_DIRECTION, electricalUpstreamOf, generationFractionAt } from '@operato/ops-contract';
36
36
  /** 수요 구간 — 요금의 알갱이다. 15분은 한국·다수 요금제의 최대수요 산정 단위다. */
37
37
  export const DEMAND_WINDOW_MS = 15 * 60 * 1000;
38
38
  /** 그 시각이 속한 구간의 시작 — 벽시계 경계(00·15·30·45분)에 맞춘다. */
@@ -1,4 +1,4 @@
1
- import type { TwinModelDef, CanonicalEnvelope, StructureShift } from '@operato/operations-contract';
1
+ import type { TwinModelDef, CanonicalEnvelope, StructureShift } from '@operato/ops-contract';
2
2
  import { type ProjectedState, type ReducerCheckpoint } from './state-projector.ts';
3
3
  /** 저장된 기록을 처리할 것 — 도메인 커널 또는 `StateProjector`. 계약은 넷뿐이다. */
4
4
  export interface JournalProjector {
@@ -1,12 +1,12 @@
1
- import type { TestResult, ISOTime, MaterialQuantity, WorkCalendarEntry, EffectivePeriod, Effectivity, OffCalendarReason, ResourceProperty, ResourceClassDef, MaterialDefinition, Attention, TwinModelDef, CanonicalEnvelope, Command, CommandAck, EventHandler, EquipmentMotion, OeeMetrics, AssetState, GeneratorSpec, InterventionOutcome, OrderState, PersonState, ScenarioControl, ScenarioOverride, StateSnapshot, TwinKernel, Unsubscribe, LocationState, ItemState, EquipmentState, OrderStatusDelta, TaskState, TaskStatus, StructureShift, IdentityGroundingView, IdentityDeclaration, TestSpecificationCriterion, LocationObservation } from '@operato/operations-contract';
2
- import type { VocabularyElement } from '@operato/operations-contract';
1
+ import type { TestResult, ISOTime, MaterialQuantity, WorkCalendarEntry, EffectivePeriod, Effectivity, OffCalendarReason, ResourceProperty, ResourceClassDef, MaterialDefinition, Attention, TwinModelDef, CanonicalEnvelope, Command, CommandAck, EventHandler, EquipmentMotion, OeeMetrics, AssetState, GeneratorSpec, InterventionOutcome, OrderState, PersonState, ScenarioControl, ScenarioOverride, StateSnapshot, TwinKernel, Unsubscribe, LocationState, ItemState, EquipmentState, OrderStatusDelta, TaskState, TaskStatus, StructureShift, IdentityGroundingView, IdentityDeclaration, TestSpecificationCriterion, LocationObservation } from '@operato/ops-contract';
2
+ import type { VocabularyElement } from '@operato/ops-contract';
3
3
  import type { ReducerCheckpoint } from './observed-reducer.ts';
4
- import type { EpcisEvent, BizTransactionElement } from '@operato/operations-contract';
4
+ import type { EpcisEvent, BizTransactionElement } from '@operato/ops-contract';
5
5
  import type { AllocationPolicy, SlotView } from './allocation-policy.ts';
6
6
  import type { DurationEstimator, DurationContext } from './duration-estimator.ts';
7
- import type { OperationDef, IsoDuration, OpMaterialSpecification } from '@operato/operations-contract';
8
- import { type CapacityAnalysis } from '@operato/operations-contract';
9
- import { type CommittedDemand, type OperationsCapabilityReport } from '@operato/operations-contract';
7
+ import type { OperationDef, IsoDuration, OpMaterialSpecification } from '@operato/ops-contract';
8
+ import { type CapacityAnalysis } from '@operato/ops-contract';
9
+ import { type CommittedDemand, type OperationsCapabilityReport } from '@operato/ops-contract';
10
10
  export interface FlowLocation {
11
11
  id: string;
12
12
  type: string;
@@ -9,17 +9,17 @@
9
9
  * 통합 타입은 도메인 필드를 옵셔널로 넓혀(FlowItem.gtin?, FlowOrder.shipmentEpc? 등) 두 도메인을 담는다.
10
10
  * (roadmap Phase5 발견 → 추출. [[project_flow_single_base_vision]] FlowLocation 단일 base 방향과 정합.)
11
11
  */
12
- import { OP_EVENT, CMD, locationStatusOf, readBoardEquipment, readBoardLocations, readBoardAssets, classClosure, capabilityOf, requiredTestsFor, priorityRank, dueStatusOf, isOrderTerminal, effectivityAt, offCalendarAt, offCalendarReasonAt, minuteOfDayAt, activeShiftAt, subLotIdOf, itemKeyOf, identityGroundingOf, outsideLimit } from '@operato/operations-contract';
12
+ import { OP_EVENT, CMD, locationStatusOf, readBoardEquipment, readBoardLocations, readBoardAssets, classClosure, capabilityOf, requiredTestsFor, priorityRank, dueStatusOf, isOrderTerminal, effectivityAt, offCalendarAt, offCalendarReasonAt, minuteOfDayAt, activeShiftAt, subLotIdOf, itemKeyOf, identityGroundingOf, outsideLimit } from '@operato/ops-contract';
13
13
  import { ObservedReducer } from "./observed-reducer.js";
14
14
  /* 주체를 정하는 규칙은 유입 문과 한 벌이다 — 두 곳에 적으면 한쪽만 고쳐진다. */
15
- import { resolveSubject } from '@operato/operations-contract';
16
- import { transformationEvent, aggregationEvent, objectEvent, parseEpc, DISP, ILMD_ATTR, CBV_BIZSTEP, objectUri, bizTransactionUri, gdtiUri } from '@operato/operations-contract';
17
- import { OP_PARAM } from '@operato/operations-contract';
18
- import { parseIsoDuration } from '@operato/operations-contract';
19
- import { analyzeCapacity } from '@operato/operations-contract';
20
- import { operationsCapabilityOf } from '@operato/operations-contract';
15
+ import { resolveSubject } from '@operato/ops-contract';
16
+ import { transformationEvent, aggregationEvent, objectEvent, parseEpc, DISP, ILMD_ATTR, CBV_BIZSTEP, objectUri, bizTransactionUri, gdtiUri } from '@operato/ops-contract';
17
+ import { OP_PARAM } from '@operato/ops-contract';
18
+ import { parseIsoDuration } from '@operato/ops-contract';
19
+ import { analyzeCapacity } from '@operato/ops-contract';
20
+ import { operationsCapabilityOf } from '@operato/ops-contract';
21
21
  /* 에너지 상태 필드는 **능력 선언에서 뽑는다** — 손으로 적으면 능력에 필드를 더한 날 스냅샷이 빠진다. */
22
- import { stateFieldsOf } from '@operato/operations-contract';
22
+ import { stateFieldsOf } from '@operato/ops-contract';
23
23
  const BASE_EPOCH = Date.parse('2026-01-01T00:00:00Z');
24
24
  /**
25
25
  * 선언한 유효 기간만 뽑는다 — 마스터가 말하지 않으면 필드를 만들지 않는다.
@@ -1,4 +1,4 @@
1
- import type { ScenarioControl, ScenarioDef, StateSnapshot } from '@operato/operations-contract';
1
+ import type { ScenarioControl, ScenarioDef, StateSnapshot } from '@operato/ops-contract';
2
2
  /** fork·시나리오 구동 가능한 트윈(FlowEngine 이 만족). */
3
3
  export interface ForecastTwin {
4
4
  getSnapshot(): StateSnapshot;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * 커널의 진입점 — **엔진만 내보낸다.**
3
3
  *
4
4
  * ── 계약을 다시 내보내지 않는다 (2026-08-30) ──────────────────────────────
5
- * 어휘·타입·판별 함수는 `@operato/operations-contract` 에 있다. 여기서 그것을 다시 내보내면 같은 이름을
5
+ * 어휘·타입·판별 함수는 `@operato/ops-contract` 에 있다. 여기서 그것을 다시 내보내면 같은 이름을
6
6
  * **두 경로로** 가져올 수 있게 되고, 새 코드가 편한 쪽을 쓰면 계약이 커널 뒤에 숨는다. 그때 층은
7
7
  * 이름만 남는다 — 사실을 만들기만 하는 쪽(MES · WMS · 커넥터)이 엔진을 거쳐 어휘를 얻게 된다.
8
8
  *
@@ -1,4 +1,4 @@
1
- import type { ISOTime } from '@operato/operations-contract';
1
+ import type { ISOTime } from '@operato/ops-contract';
2
2
  import { type TaskDeltaRow } from './task-fold.ts';
3
3
  /** 표준 `JobState` — 우리 작업 상태를 표준 낱말로 옮긴다. */
4
4
  export type JobState = 'ready' | 'running' | 'completed';
package/dist/kernel.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Command, CommandAck, GeneratorSpec } from '@operato/operations-contract';
1
+ import type { Command, CommandAck, GeneratorSpec } from '@operato/ops-contract';
2
2
  import type { AllocationPolicy } from './allocation-policy.ts';
3
3
  import { FlowEngine } from './flow-engine.ts';
4
4
  import type { FlowOrder, FlowTask } from './flow-engine.ts';
package/dist/kernel.js CHANGED
@@ -5,13 +5,13 @@
5
5
  * 입고: 도착 → receiving(Txn PO + Agg 팔레트←케이스 + Object) → putaway → storing.
6
6
  * 출고: SO 오더 → 할당(Txn SO) → pick(bin→staging) → picking → packing(Agg 화물←팔레트) → staging → shipping(DELETE).
7
7
  */
8
- import { CMD } from '@operato/operations-contract';
8
+ import { CMD } from '@operato/ops-contract';
9
9
  import { firstFitPolicy } from "./allocation-policy.js";
10
10
  import { FlowEngine } from "./flow-engine.js";
11
11
  import { planMakeToOrder } from "./make-to-order.js";
12
- import { BIZSTEP, BTT } from '@operato/operations-contract';
13
- import { DISP, ILMD_ATTR, aggregationEvent, objectEvent, transactionEvent } from '@operato/operations-contract';
14
- import { subLotIdOf, itemKeyOf } from '@operato/operations-contract';
12
+ import { BIZSTEP, BTT } from '@operato/ops-contract';
13
+ import { DISP, ILMD_ATTR, aggregationEvent, objectEvent, transactionEvent } from '@operato/ops-contract';
14
+ import { subLotIdOf, itemKeyOf } from '@operato/ops-contract';
15
15
  const TRAVEL_MS = 30_000;
16
16
  const SHELF_MS = 30 * 24 * 3_600_000; // 기본 유통기한(30일)
17
17
  const SHELF_JITTER_MS = 5 * 24 * 3_600_000; // 로트별 만료 편차(FEFO 가 FIFO 와 갈리게)
@@ -1,4 +1,4 @@
1
- import type { OperationDef } from '@operato/operations-contract';
1
+ import type { OperationDef } from '@operato/ops-contract';
2
2
  /** 이 판단이 보는 재고 한 줄 — 무엇이 어디에 얼마나, 팔 수 있나. */
3
3
  export interface StockLine {
4
4
  /** 품목 식별자(GTIN). */
@@ -1,8 +1,8 @@
1
- import type { GeneratorSpec, Command, CommandAck, ProductionSpec, TwinModelDef, IdentityGroundingView, Attention } from '@operato/operations-contract';
1
+ import type { GeneratorSpec, Command, CommandAck, ProductionSpec, TwinModelDef, IdentityGroundingView, Attention } from '@operato/ops-contract';
2
2
  import type { AllocationPolicy } from './allocation-policy.ts';
3
3
  import { FlowEngine } from './flow-engine.ts';
4
4
  import type { FlowOrder, FlowTask } from './flow-engine.ts';
5
- import { type OpMaterialSpecification } from '@operato/operations-contract';
5
+ import { type OpMaterialSpecification } from '@operato/ops-contract';
6
6
  export declare class MesKernel extends FlowEngine {
7
7
  private wipSeq;
8
8
  private prodSeq;
@@ -60,7 +60,7 @@ export declare class MesKernel extends FlowEngine {
60
60
  * 모델 자리(§`TwinModelDef.identity`)로 옮기면 이 override 는 사라진다. 두 자리를 동시에 읽는 것이
61
61
  * 아니라 **하나를 고르는** 것이므로 규칙이 갈리지 않는다.
62
62
  */
63
- protected identityDeclaration(): import("@operato/operations-contract").IdentityDeclaration | undefined;
63
+ protected identityDeclaration(): import("@operato/ops-contract").IdentityDeclaration | undefined;
64
64
  protected identityGroundingView(): IdentityGroundingView;
65
65
  /**
66
66
  * 선언이 말하는 자리 타입이 **이 트윈에 있나** — 로드 시점에 한 번, 모아서 말한다 (2026-08-20).
@@ -8,12 +8,12 @@
8
8
  * ③ 셋업/체인지오버 = work-center 가 제품 전환 시 셋업(changeoverKey=제품 gtin) → OEE Availability.
9
9
  * ④ OEE = base 가 설비(설비)별 계측(가동/셋업/기아/품질). cut=cutter·weld=welder 이종 자원.
10
10
  */
11
- import { identityGroundingOf } from '@operato/operations-contract';
11
+ import { identityGroundingOf } from '@operato/ops-contract';
12
12
  import { firstFitPolicy } from "./allocation-policy.js";
13
13
  import { FlowEngine } from "./flow-engine.js";
14
- import { DISP, objectEvent, transactionEvent, gdtiUri, sgtinClass, bizTransactionUri } from '@operato/operations-contract';
15
- import { MES_BIZSTEP, BTT_PRODORDER, sgtinUri } from '@operato/operations-contract';
16
- import { OP_PARAM } from '@operato/operations-contract';
14
+ import { DISP, objectEvent, transactionEvent, gdtiUri, sgtinClass, bizTransactionUri } from '@operato/ops-contract';
15
+ import { MES_BIZSTEP, BTT_PRODORDER, sgtinUri } from '@operato/ops-contract';
16
+ import { OP_PARAM } from '@operato/ops-contract';
17
17
  /* 아래 셋은 **기본값**이다 — 명세(OperationDef.duration·parameters)가 있으면 그 값이 이긴다.
18
18
  * 이름에 DEFAULT 를 붙인 이유: 예전에는 이것이 유일한 값이어서 "현장 명세" 와 구별되지 않았고,
19
19
  * 그 상수가 수율 판단(주목 신호)까지 만들어 냈다. 무엇을 기본값으로 굴렸는지는 specCoverage() 가 밝힌다. */
@@ -1,5 +1,5 @@
1
- import type { AssetState, TestResult, MaterialQuantity, TwinModelDef, CanonicalEnvelope, LocationState, ItemState, LocationObservation, EquipmentState, PersonState, TaskState, OrderState, StructureShift } from '@operato/operations-contract';
2
- import { type VocabularyElement } from '@operato/operations-contract';
1
+ import type { AssetState, TestResult, MaterialQuantity, TwinModelDef, CanonicalEnvelope, LocationState, ItemState, LocationObservation, EquipmentState, PersonState, TaskState, OrderState, StructureShift } from '@operato/ops-contract';
2
+ import { type VocabularyElement } from '@operato/ops-contract';
3
3
  interface ProjItem {
4
4
  epc: string;
5
5
  /** 로트의 부분(표준 MaterialSubLot.ID) — 비직렬 로트가 자리마다 갈릴 때만. */
@@ -19,9 +19,9 @@
19
19
  * - 운영 델타(task/equipment/order.status) → tasks·equipment·orders (EPCIS 로 재구성 불가한 절반)
20
20
  * 마스터(로케이션)는 board 초기화 + applyMaster 로 갱신(마스터 동기).
21
21
  */
22
- import { OP_EVENT, capabilityOf, itemKeyOf, judgeAgainstSpec, requiredTestsFor, locationStatusOf, readBoardEquipment, readBoardLocations, readBoardAssets, effectivityAt, offCalendarAt, offCalendarReasonAt, activeShiftAt } from '@operato/operations-contract';
23
- import { ILMD_ATTR, parseEpc } from '@operato/operations-contract';
24
- import { expiryFromAttributes, lotFromAttributes } from '@operato/operations-contract';
22
+ import { OP_EVENT, capabilityOf, itemKeyOf, judgeAgainstSpec, requiredTestsFor, locationStatusOf, readBoardEquipment, readBoardLocations, readBoardAssets, effectivityAt, offCalendarAt, offCalendarReasonAt, activeShiftAt } from '@operato/ops-contract';
23
+ import { ILMD_ATTR, parseEpc } from '@operato/ops-contract';
24
+ import { expiryFromAttributes, lotFromAttributes } from '@operato/ops-contract';
25
25
  /* 클래스 마스터 표는 상태를 들므로 커널에 있다(§`class-master-table`). */
26
26
  import { ClassMasterTable } from "./class-master-table.js";
27
27
  /**
package/dist/runtime.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CanonicalEnvelope, Command, CommandAck, ScenarioControl, StateSnapshot, TwinKernel } from '@operato/operations-contract';
1
+ import type { CanonicalEnvelope, Command, CommandAck, ScenarioControl, StateSnapshot, TwinKernel } from '@operato/ops-contract';
2
2
  export type SubscriptionMessage = {
3
3
  kind: 'snapshot';
4
4
  revision: number;
@@ -1,4 +1,4 @@
1
- import type { TaskStatusDelta } from '@operato/operations-contract';
1
+ import type { TaskStatusDelta } from '@operato/ops-contract';
2
2
  /**
3
3
  * 되읽을 저널 한 줄 — 필요한 것만.
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { StateSnapshot } from '@operato/operations-contract';
1
+ import type { StateSnapshot } from '@operato/ops-contract';
2
2
  import { type StateDivergence } from './divergence.ts';
3
3
  /** 관찰 대상 = fork 가능한 트윈(FlowEngine 이 만족). */
4
4
  export interface ObservableTwin {
@@ -1,4 +1,4 @@
1
- import type { GeneratorSpec } from '@operato/operations-contract';
1
+ import type { GeneratorSpec } from '@operato/ops-contract';
2
2
  import type { AllocationPolicy } from './allocation-policy.ts';
3
3
  import { FlowEngine } from './flow-engine.ts';
4
4
  import type { FlowOrder, FlowTask } from './flow-engine.ts';
@@ -15,11 +15,11 @@
15
15
  * - drop(기본): 트레일러를 야드 슬롯에 내려놓고(주차) 창 도래 시 호슬러가 도크로 pull. 야드 버퍼 사용.
16
16
  * - live: 게이트에서 대기하다 창 도래 시 도크로 직행(야드 미경유). 게이트/도크를 더 오래 점유.
17
17
  */
18
- import { itemKeyOf } from '@operato/operations-contract';
18
+ import { itemKeyOf } from '@operato/ops-contract';
19
19
  import { firstFitPolicy } from "./allocation-policy.js";
20
20
  import { FlowEngine } from "./flow-engine.js";
21
- import { DISP, objectEvent, transactionEvent } from '@operato/operations-contract';
22
- import { YARD_BIZSTEP, BTT_DELIVERY } from '@operato/operations-contract';
21
+ import { DISP, objectEvent, transactionEvent } from '@operato/ops-contract';
22
+ import { YARD_BIZSTEP, BTT_DELIVERY } from '@operato/ops-contract';
23
23
  const TRAVEL_MS = 20_000; // 야드 이동
24
24
  const DWELL_MS = 30_000; // 도크 체류(상·하차) — depart 이동에 folded
25
25
  const WINDOW_DELAY_MS = 40_000; // 도착 후 어포인트먼트 창까지(early arrival → 대기)
@@ -63,7 +63,7 @@ __export(index_exports, {
63
63
  });
64
64
  module.exports = __toCommonJS(index_exports);
65
65
 
66
- // ../operations-contract/dist/capability.js
66
+ // ../ops-contract/dist/capability.js
67
67
  var CAPABILITIES = {
68
68
  operable: {
69
69
  key: "operable",
@@ -198,7 +198,7 @@ function stateFieldsOf(caps) {
198
198
  return [...out];
199
199
  }
200
200
 
201
- // ../operations-contract/dist/contract.js
201
+ // ../ops-contract/dist/contract.js
202
202
  var ORDER_TERMINAL_STATUS = ["completed", "cancelled"];
203
203
  function isOrderTerminal(o) {
204
204
  const status = String(o?.status ?? "").trim().toLowerCase();
@@ -779,7 +779,7 @@ function gs1Namespaces(prefix) {
779
779
  return [`urn:epc:idpat:sgtin:${prefix}.`, `urn:epc:class:lgtin:${prefix}.`, `urn:epc:id:sgtin:${prefix}.`];
780
780
  }
781
781
 
782
- // ../operations-contract/dist/capacity.js
782
+ // ../ops-contract/dist/capacity.js
783
783
  function isoDurationHours(iso2) {
784
784
  if (!iso2)
785
785
  return 0;
@@ -887,7 +887,7 @@ function analyzeCapacity(input) {
887
887
  };
888
888
  }
889
889
 
890
- // ../operations-contract/dist/wms-profile.js
890
+ // ../ops-contract/dist/wms-profile.js
891
891
  var BIZSTEP = {
892
892
  receiving: "urn:epcglobal:cbv:bizstep:receiving",
893
893
  storing: "urn:epcglobal:cbv:bizstep:storing",
@@ -917,7 +917,7 @@ var WMS_TYPES = [
917
917
  { key: "packer", role: "equipment", label: "twin.type.packer", standardClass: { epcis: "object", isa95: "Equipment" }, identity: { scheme: "gs1:GIAI" }, capabilities: ["processable", "operable"] }
918
918
  ];
919
919
 
920
- // ../operations-contract/dist/yms-profile.js
920
+ // ../ops-contract/dist/yms-profile.js
921
921
  var YARD_BIZSTEP = {
922
922
  arriving: "urn:epcglobal:cbv:bizstep:arriving",
923
923
  // 게이트-인
@@ -943,7 +943,7 @@ var YMS_TYPES = [
943
943
  { key: "hostler", role: "equipment", label: "twin.type.hostler", standardClass: { epcis: "object", iso55000: "Asset" }, identity: { scheme: "gs1:GIAI" }, capabilities: ["mobile", "operable"] }
944
944
  ];
945
945
 
946
- // ../operations-contract/dist/mes-profile.js
946
+ // ../ops-contract/dist/mes-profile.js
947
947
  var MES_BIZSTEP = {
948
948
  receiving: "urn:epcglobal:cbv:bizstep:receiving",
949
949
  // 원자재 수령
@@ -981,7 +981,7 @@ var MES_TYPES = [
981
981
  { key: "assembler", role: "equipment", label: "twin.type.assembler", standardClass: { isa95: "Equipment", iso55000: "Asset" }, identity: { scheme: "gs1:GIAI" }, capabilities: ["processable", "operable"] }
982
982
  ];
983
983
 
984
- // ../operations-contract/dist/ems-profile.js
984
+ // ../ops-contract/dist/ems-profile.js
985
985
  var EMS_LOCATION_TYPES = ["incoming", "feeder", "submeter-zone"];
986
986
  var METER_DIRECTION = ["import", "export", "bidirectional"];
987
987
  var EMS_PROPERTY = {
@@ -1302,7 +1302,7 @@ function isElectricalLocationType(type) {
1302
1302
  return EMS_LOCATION_TYPES.includes(type);
1303
1303
  }
1304
1304
 
1305
- // ../operations-contract/dist/domain-catalog.js
1305
+ // ../ops-contract/dist/domain-catalog.js
1306
1306
  var locationKeys = (types) => types.filter((t) => t.role === "location").map((t) => t.key);
1307
1307
  var DOMAIN_CATALOG = {
1308
1308
  // label 은 언어 중립 i18n 키(twin.system.<code>) — 사람 언어는 표현계층이 렌더(L2).
@@ -1312,7 +1312,7 @@ var DOMAIN_CATALOG = {
1312
1312
  ems: { system: "ems", label: "twin.system.ems", types: EMS_TYPES, locationTypes: locationKeys(EMS_TYPES) }
1313
1313
  };
1314
1314
 
1315
- // ../operations-contract/dist/domain-definition.js
1315
+ // ../ops-contract/dist/domain-definition.js
1316
1316
  var OP_PARAM = {
1317
1317
  /** 양품률(0..1, 무차원). 없으면 커널 기본값 — 기본값을 쓴 사실은 `specCoverage()` 가 밝힌다. */
1318
1318
  yield: "yield",
@@ -1321,7 +1321,7 @@ var OP_PARAM = {
1321
1321
  setupDuration: "setupDuration"
1322
1322
  };
1323
1323
 
1324
- // ../operations-contract/dist/energy-ingest.js
1324
+ // ../ops-contract/dist/energy-ingest.js
1325
1325
  function resolveSubject(kind, localId, opts) {
1326
1326
  const declared = opts.identityOf?.(kind, localId);
1327
1327
  if (declared)
@@ -1332,7 +1332,7 @@ function periodFactId(tenantId, kind, subject, from, to) {
1332
1332
  return [tenantId, kind, subject, from, to].join("|");
1333
1333
  }
1334
1334
 
1335
- // ../operations-contract/dist/epcis.js
1335
+ // ../ops-contract/dist/epcis.js
1336
1336
  var EPCIS_CONTEXT = "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld";
1337
1337
  var UTC_OFFSET = "+00:00";
1338
1338
  var DISP = {
@@ -1591,7 +1591,7 @@ function transformationEvent(p) {
1591
1591
  return e;
1592
1592
  }
1593
1593
 
1594
- // ../operations-contract/dist/iso-duration.js
1594
+ // ../ops-contract/dist/iso-duration.js
1595
1595
  var RE = /^(-)?P(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/;
1596
1596
  function parseIsoDuration(text) {
1597
1597
  if (typeof text !== "string")
@@ -1617,7 +1617,7 @@ function parseIsoDuration(text) {
1617
1617
  return sign ? -ms2 : ms2;
1618
1618
  }
1619
1619
 
1620
- // ../operations-contract/dist/master-data.js
1620
+ // ../ops-contract/dist/master-data.js
1621
1621
  function expiryFromAttributes(attrs) {
1622
1622
  return readEpochMs(attrs?.[ILMD_ATTR.expiry]);
1623
1623
  }
@@ -1634,7 +1634,7 @@ function readEpochMs(raw) {
1634
1634
  return Number.isNaN(at) ? void 0 : at;
1635
1635
  }
1636
1636
 
1637
- // ../operations-contract/dist/operational-ingest.js
1637
+ // ../ops-contract/dist/operational-ingest.js
1638
1638
  var TASK_STATUS = ["created", "assigned", "in-progress", "completed"];
1639
1639
  var EQUIPMENT_STATUS = ["idle", "busy", "down"];
1640
1640
  var PERSON_STATUS = ["idle", "busy"];
@@ -1842,7 +1842,7 @@ var SPECS = {
1842
1842
  }
1843
1843
  };
1844
1844
 
1845
- // ../operations-contract/dist/operations-capability.js
1845
+ // ../ops-contract/dist/operations-capability.js
1846
1846
  function workingHoursBetween(calendar, fromMs, toMs, utcOffsetMinutes) {
1847
1847
  if (!(toMs > fromMs))
1848
1848
  return 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/twin-kernel",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "description": "Twin Domain Kernel — framework-agnostic, zero-dep (domain + sim + 3-channel contract). WMS/YMS/MES, EPCIS 2.0 · ISA-95.",
6
6
  "publishConfig": {
@@ -28,6 +28,6 @@
28
28
  "test": "node --test test/*.test.ts"
29
29
  },
30
30
  "dependencies": {
31
- "@operato/operations-contract": "^0.1.0"
31
+ "@operato/ops-contract": "^0.1.0"
32
32
  }
33
33
  }
@@ -1,142 +0,0 @@
1
- export type CapabilityKey = 'operable' | 'storable' | 'mobile' | 'processable' | 'trackable' | 'switching' | 'metered' | 'curtailable' | 'energyGenerating' | 'energyStoring';
2
- /** 이동 관측 — Mobile 이 노출. */
3
- export interface Motion {
4
- fromNode: string;
5
- toNode: string;
6
- startedAtSimMs: number;
7
- durationMs: number;
8
- progress: number;
9
- elapsedMs: number;
10
- }
11
- export interface OperableState {
12
- status: 'idle' | 'busy' | 'down';
13
- }
14
- export interface StorableState {
15
- occupancy: number;
16
- capacity: number;
17
- }
18
- export interface MobileState {
19
- location: string;
20
- motion?: Motion;
21
- }
22
- export interface ProcessableState {
23
- output?: {
24
- good: number;
25
- scrap: number;
26
- };
27
- }
28
- export interface TrackableState {
29
- lifecycle: string;
30
- progress?: number;
31
- held: boolean;
32
- }
33
- /**
34
- * 계량 — 이 자원은 **자기 소비를 잰다.**
35
- *
36
- * `kW` 는 그 계량 주기의 평균이고 순시값이 아니다(순시는 전력 품질의 영역이라 범위 밖).
37
- * `kWh` 는 계기 누적값 — 차분은 소비처가 한다(계기 교체·리셋을 우리가 지어내지 않는다).
38
- * 값이 오지 않는 계량기는 `0` 이 아니라 **모르는 것**이므로 필드가 없다(선택 필드인 이유).
39
- */
40
- export interface MeteredState {
41
- kW?: number;
42
- kWh?: number;
43
- powerFactor?: number;
44
- }
45
- /** 감축 가능 — 줄일 수 있다. `minKW` 는 최소 유지(그 아래로 내리면 공정이 죽는다). */
46
- export interface CurtailableState {
47
- curtailable: boolean;
48
- minKW?: number;
49
- }
50
- /**
51
- * 전기 계측 — 전압(V)·전류(A). 전기를 만들거나 쓰는 어떤 설비에서나 같은 모양이다.
52
- *
53
- * 발전·저장·개폐 어느 능력에나 붙을 수 있어 따로 둔다. 상별 값은 배열이다(단상이면 원소 하나).
54
- */
55
- export interface ElectricalMeasurementState {
56
- dcVoltage?: number;
57
- dcCurrent?: number;
58
- acVoltage?: number[];
59
- acCurrent?: number[];
60
- }
61
- /** 발전 — 만든다. 역송(`exportKW`)은 소비의 음수가 아니라 별개 사실이다. */
62
- export interface GeneratingState extends ElectricalMeasurementState {
63
- generatedKW?: number;
64
- exportKW?: number;
65
- generatedKWh?: number;
66
- generatedKWhResetAt?: string;
67
- /** 지금 든 적산이 무엇부터 쌓인 것인가 — 원본이 말했을 때만 있다. */
68
- generatedKWhSince?: string;
69
- /** 되돌아간 판정이 사실인가 짐작인가 — 'declared' 또는 'inferred'. */
70
- generatedKWhBasis?: 'declared' | 'inferred';
71
- /** 어떤 누적인가 — 원본이 말하지 않으면 'unknown' 이다(칸이 비지 않는다). */
72
- generatedKWhAccumulation?: 'lifetime' | 'daily' | 'monthly' | 'billing' | 'unknown';
73
- /** 끝난 기간의 발전량(kWh) — 성과지표가 기간당 에너지로 정의된다. */
74
- generatedKWhLastPeriod?: number;
75
- /** 그 기간이 끝난 시각. */
76
- generatedKWhLastPeriodEnd?: string;
77
- /** 그 기간에서 처음·마지막으로 관측한 시각 — 기간 경계와 다르면 그만큼 재지 않았다. */
78
- generatedKWhLastPeriodObservedFrom?: string;
79
- generatedKWhLastPeriodObservedTo?: string;
80
- }
81
- /** 저장 — 담고 낸다. 충전과 방전을 나눈다(손실·수명 판단이 둘을 구별해야 한다). */
82
- export interface StoringState {
83
- soc?: number;
84
- chargeKW?: number;
85
- dischargeKW?: number;
86
- }
87
- /**
88
- * 개폐 위치 — IEC 61850 `XCBR.Pos`·`XSWI.Pos` 의 넷 값을 그대로 쓴다.
89
- *
90
- * `intermediate`(과도)와 `bad`(위치 불량)를 **뭉개지 않는다**: 실 계통에서 이 둘은 이중 접점이 서로
91
- * 다른 말을 하는 상태이고, 「열림/닫힘」으로 반올림하면 트윈이 없는 확신을 갖는다.
92
- */
93
- export interface SwitchingState {
94
- position?: 'open' | 'closed' | 'intermediate' | 'bad';
95
- }
96
- /** 능력 관측 계약 메타(발견·검증). ops 없음(원칙 ①). */
97
- export interface CapabilitySpec {
98
- key: CapabilityKey;
99
- label: string;
100
- semantics: string;
101
- /** 관측 상태 필드(데이터 형식). 직교 — 어느 필드도 두 능력에 중복 없음(원칙 ②). */
102
- stateFields: string[];
103
- /**
104
- * 이 능력을 가진 자원이 **받는 명령** — 나가는 사실(`results`)의 짝.
105
- *
106
- * ── 계약이 반쪽이었다 (2026-08-15) ────────────────────────────────────────
107
- * 능력은 「무슨 값을 내보내는가」만 선언하고 있었다. 그런데 저작면이 알아야 할 것이 하나 더 있다:
108
- * 「여기에 제어를 붙여도 되는가」. 적을 자리가 없어서 **능력 이름으로 눈치껏** 판단했다 —
109
- * `operable` 이면 제어를 권하고 아니면 안 권했다.
110
- *
111
- * 차단기에서 그 방식이 막혔다. 상태는 보여주고 싶은데 `operable` 을 주면 화면이 우리가 하지 않기로
112
- * 한 조작을 권한다. 그래서 능력을 새로 만들었고(`switching`), 능력은 상태 필드로 정의되므로 새
113
- * 필드가 필요했는데 마침 표준이 `position` 이라는 이름을 줘서 됐다 — **그건 운이었다.**
114
- *
115
- * 없던 것은 참/거짓 하나가 아니라 **대칭**이다: 나가는 것은 선언돼 있고 들어오는 것은 없었다.
116
- * 명령 어휘(`CMD`)는 이미 능력별로 묶여 있었지만 그 묶임이 **주석에만** 있었다 — 여기로 옮긴다.
117
- *
118
- * 비어 있다는 것이 곧 「조작하지 않는다」이다. 「명령을 받나」는 이 목록에서 **파생**된다 —
119
- * 그래서 형용사를 새로 만들지 않는다.
120
- *
121
- * 트윈 수준 명령(`attention.ack`·`resource.add`)은 특정 자원의 능력이 아니므로 여기 넣지 않는다.
122
- * 모든 명령이 능력에 속해야 한다는 규칙을 만들면 그것이 다음 땜빵이 된다.
123
- */
124
- commands: string[];
125
- /** 교환 데이터 모델 이름. */
126
- models?: string[];
127
- /** 불변식(모두 준수·신뢰). */
128
- invariants?: string[];
129
- /** 실행 결과(이벤트) 형식. */
130
- results?: string[];
131
- }
132
- export declare const CAPABILITIES: Record<CapabilityKey, CapabilitySpec>;
133
- export declare const CAPABILITY_KEYS: CapabilityKey[];
134
- /** 능력 집합이 관측 노출하는 상태 필드 합집합(직교이므로 단순 병합). */
135
- export declare function stateFieldsOf(caps: CapabilityKey[]): string[];
136
- /**
137
- * 능력 집합이 **받는 명령**의 합집합 — `stateFieldsOf` 의 짝.
138
- *
139
- * 「이 자원에 제어를 붙여도 되는가」는 이 목록이 비었는지로 **파생**한다. 그래서 `controllable` 같은
140
- * 형용사를 따로 두지 않는다 — 형용사를 두면 목록과 형용사가 언젠가 어긋나고, 어긋난 쪽이 화면이 된다.
141
- */
142
- export declare function commandsOf(caps: CapabilityKey[]): string[];