@things-factory/board-ui 10.0.0-beta.61 → 10.0.0-beta.64

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.
@@ -1,8 +1,21 @@
1
1
  import './things-scene-components.import';
2
2
  import '@operato/board/ox-board-modeller.js';
3
3
  import '@operato/oops';
4
+ import '@things-factory/board-ai';
4
5
  import { BoardModeller } from '@operato/board/ox-board-modeller.js';
5
6
  import { PageView } from '@operato/shell';
7
+ /**
8
+ * AI 의 BoardEditOp 가 지정한 대상 (id 또는 refid) 으로 things-scene component 검색.
9
+ *
10
+ * id (사용자/AI 가 명시적으로 설정한 string identifier) 와
11
+ * refid (things-scene 이 모든 컴포넌트에 자동 발급하는 numeric identifier) 는
12
+ * 서로 별개 개념이고 AI 도 둘을 구별해서 보낸다 — 이 함수는 호스트 측에서 둘 중
13
+ * 어느 쪽으로든 lookup 가능하게 통합. refid 가 universal 이므로 우선.
14
+ */
15
+ export declare function findSceneComponent(scene: any, target: {
16
+ id?: string;
17
+ refid?: number;
18
+ }): any;
6
19
  export declare class BoardModellerPage extends PageView {
7
20
  constructor();
8
21
  static styles: import("lit").CSSResult[];
@@ -17,6 +30,32 @@ export declare class BoardModellerPage extends PageView {
17
30
  componentGroupList?: any[];
18
31
  propertyEditor: any;
19
32
  preparing?: boolean;
33
+ /** AI 협력 세션 id — boardId 변경 시 chatSessionByBoard 또는 startBoardAISession 으로 자동 결정 */
34
+ chatSessionId?: string;
35
+ /** AI 채팅 패널 열림 상태 (기본 닫힘) */
36
+ aiPanelOpen: boolean;
37
+ /**
38
+ * 적용된 patch 별 inverse op 시퀀스 — Revert 기능용.
39
+ *
40
+ * Map<patchId, inverseOps[]>: 각 patch 적용 시점에 계산해 저장. revert 클릭
41
+ * 시 역순 in-place 적용. 페이지 reload 시 손실 — reload 후 revert 시도는
42
+ * notify 로 안내 (메모리 외 영속은 별개 작업).
43
+ */
44
+ private patchInverses;
45
+ /** 모델러에 등록된 컴포넌트 type 목록 — chat 호출 시 LLM 에 전달 (lazy cache) */
46
+ private _knownTypesCache?;
47
+ /** 등록된 type 의 group 분류 — categories 로 LLM 에 전달 */
48
+ private _knownCategoriesCache?;
49
+ private get knownTypes();
50
+ private get knownCategories();
51
+ /**
52
+ * type 별 유효 속성 스킴 — LLM 이 정확한 컴포넌트를 만들도록 (lazy cache).
53
+ *
54
+ * 핵심: 좌표 표현은 type 마다 다르다 (left/top vs cx/cy vs points 등).
55
+ * 따라서 OMIT 하지 않고 `geometryKeys` 로 별도 노출 → LLM 이 type 별 좌표 키 사용 가능.
56
+ */
57
+ private _componentSchemasCache?;
58
+ private get componentSchemas();
20
59
  private board;
21
60
  private _loadTracker?;
22
61
  private _fontCtrl;
@@ -32,6 +71,88 @@ export declare class BoardModellerPage extends PageView {
32
71
  description: string;
33
72
  };
34
73
  refresh(): Promise<void>;
74
+ /** 패널 토글 시 호출 — 열 때만 chatSession 보장 */
75
+ private toggleAIPanel;
76
+ /** boardId 로 ChatSession 조회 또는 생성 (idempotent). */
77
+ private ensureChatSession;
78
+ /**
79
+ * 모델러의 selected (things-scene Component 인스턴스 배열) 에서 refid 추출.
80
+ *
81
+ * refid 는 things-scene 이 모든 컴포넌트에 자동 발급하는 universal numeric handle.
82
+ * AI 의 selection 표현은 항상 refid 기반 (id 는 데이터 바인딩 이름이며 unique 가
83
+ * 아니라 targeting 에 부적합).
84
+ */
85
+ private extractSelectedRefids;
86
+ /**
87
+ * 라이브 보드 모델 — things-scene 캔버스가 들고 있는 가장 최신 상태의 deep clone.
88
+ *
89
+ * 사용자 수작업 편집은 scene.model 에만 반영되고 this.model property 에는 자동
90
+ * 동기화되지 않는다. AI 한테 보드 상태를 넘기거나 patch 를 적용할 때는 반드시
91
+ * 이쪽을 쓴다.
92
+ *
93
+ * id 와 refid 는 별개 필드 — 컴포넌트는 model.id (선택, 사용자/AI 가 명시 설정)
94
+ * 와 model.refid (필수, things-scene 자동 발급) 를 둘 다 가질 수 있고 AI 가
95
+ * 양쪽을 구별해서 다룬다 (tool 인자가 분리됨). 따라서 여기서는 model 을 mutate
96
+ * 하지 않고 raw deep clone 만 반환.
97
+ */
98
+ private getLiveBoard;
99
+ /**
100
+ * 채팅에서 patch 도착 — things-scene 에 in-place 적용.
101
+ *
102
+ * 핵심: `this.model = next` 로 모델을 통째 교체하면 ox-scene-viewer 가 scene 을
103
+ * dispose → 재생성 → undo 히스토리/dirty 플래그가 모두 초기화된다.
104
+ * 따라서 일반 add/modify/remove 는 scene 의 in-place mutation API 로 적용 →
105
+ * commander 가 자동으로 snapshot push → CMD+Z 와 저장 안내 팝업이 정상 동작.
106
+ *
107
+ * 'replace' op (보드 전체 교체) 만은 부득이 wholesale 경로로 빠진다 — 이 경우는
108
+ * 사용자에게 명시적으로 안내 후 진행.
109
+ */
110
+ private onBoardEditPatch;
111
+ /**
112
+ * 'replace' op 적용 — scene 통째로 재생성 (undo 히스토리 초기화).
113
+ *
114
+ * AI 가 보드 전체 재구성을 요청한 경우. 사용자에게 history 손실 안내.
115
+ * board-import 데이터 wholesale 적용 등 드문 케이스에 한정.
116
+ *
117
+ * Revert 지원 — replace 직전 보드 model 을 inverse 로 보관 (또 다른 replace).
118
+ */
119
+ private applyPatchWholesale;
120
+ /**
121
+ * scene 의 모든 컴포넌트 refid 수집 — add 의 inverse 계산용.
122
+ *
123
+ * scene.add 직전/직후 호출해 차집합으로 새 발급된 refid 식별.
124
+ */
125
+ private collectAllRefids;
126
+ /**
127
+ * patch 가 변경하려는 키들에 대해 model 의 현재 값을 deep-clone 으로 캡처.
128
+ * inverse modify / modifyBoard op 의 patch 로 사용.
129
+ */
130
+ private captureOldKeys;
131
+ /**
132
+ * 채팅에서 board-edit-revert 도착 — 누적된 inverse 를 역순 in-place 적용.
133
+ *
134
+ * - 메모리상 patchInverses Map 만 본다. 페이지 reload 후엔 inverse 가 없어
135
+ * 되돌릴 수 없음 (사용자에게 안내).
136
+ * - 성공 시 서버 revertPatch mutation 호출 → PatchEntry.reverted=true 영속.
137
+ * - in-place 적용이라 undo/dirty/selection 보존 (chatViaTools 의 모든 강점 그대로).
138
+ */
139
+ private onBoardEditRevert;
140
+ /**
141
+ * inverse op 시퀀스를 things-scene 위에 in-place 적용 (snapshot/undo 보존).
142
+ * onBoardEditPatch 의 add/remove/modify/modifyBoard 분기와 동일 패턴이지만
143
+ * inverse 누적은 하지 않음 (revert 자체가 revert 가능하지 않은 단방향 동작).
144
+ */
145
+ private applyInverseOpsInPlace;
146
+ /** 서버 PatchEntry.reverted=true 영속 — fail 해도 UI 는 이미 되돌렸으니 warn 만. */
147
+ private recordRevertOnServer;
148
+ /**
149
+ * AI 가 만든 컴포넌트를 things-scene 이 기대하는 완전한 형태로 normalize.
150
+ * BoardModeller 에 등록된 template.model (default 값) 위에 AI 응답을 덮어쓴다.
151
+ * 이 단계 없이 things-scene 에 넣으면 필수 속성 누락 시 render 에서 crash 가능
152
+ * (예: gauge-circle 의 value 가 undefined → toString() TypeError).
153
+ */
154
+ private normalizeComponent;
155
+ private findTemplateByType;
35
156
  updated(changes: any): Promise<void>;
36
157
  pageUpdated(changes: any, lifecycle: any): void;
37
158
  render(): import("lit-html").TemplateResult<1>;