@things-factory/figure-service 10.1.210 → 10.1.213

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 (47) hide show
  1. package/README.md +1 -1
  2. package/dist-server/service/figure/event-subscriber.js +2 -2
  3. package/dist-server/service/figure/event-subscriber.js.map +1 -1
  4. package/dist-server/service/figure/figure-format.js +1 -1
  5. package/dist-server/service/figure/figure-format.js.map +1 -1
  6. package/dist-server/service/figure/figure-mutation.d.ts +5 -5
  7. package/dist-server/service/figure/figure-mutation.js +6 -6
  8. package/dist-server/service/figure/figure-mutation.js.map +1 -1
  9. package/dist-server/service/figure/figure-query.d.ts +3 -3
  10. package/dist-server/service/figure/figure-query.js +4 -4
  11. package/dist-server/service/figure/figure-query.js.map +1 -1
  12. package/dist-server/service/figure/figure-rename.d.ts +4 -4
  13. package/dist-server/service/figure/figure-rename.js +2 -2
  14. package/dist-server/service/figure/figure-rename.js.map +1 -1
  15. package/dist-server/service/figure/figure-tools.js +9 -9
  16. package/dist-server/service/figure/figure-tools.js.map +1 -1
  17. package/dist-server/service/figure/figure-type.d.ts +2 -2
  18. package/dist-server/service/figure/figure-type.js +2 -2
  19. package/dist-server/service/figure/figure-type.js.map +1 -1
  20. package/dist-server/service/figure/figure.d.ts +2 -2
  21. package/dist-server/service/figure/figure.js +1 -1
  22. package/dist-server/service/figure/figure.js.map +1 -1
  23. package/dist-server/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +6 -6
  25. package/recipes/belt-surface/guide.ko.md +1 -1
  26. package/recipes/roller-row/facts.md +1 -1
  27. package/recipes/roller-row/guide.ko.md +1 -1
  28. package/recipes/sliding-door/facts.md +1 -1
  29. package/recipes/sliding-door/guide.ko.md +1 -1
  30. package/server/service/figure/catalog-db.test.ts +1 -1
  31. package/server/service/figure/event-subscriber.ts +2 -2
  32. package/server/service/figure/figure-blueprint-query.test.ts +3 -3
  33. package/server/service/figure/figure-format.test.ts +7 -7
  34. package/server/service/figure/figure-format.ts +1 -1
  35. package/server/service/figure/figure-llm-smoke.test.ts +1 -1
  36. package/server/service/figure/figure-mutation.ts +6 -6
  37. package/server/service/figure/figure-propose-steps.test.ts +2 -2
  38. package/server/service/figure/figure-query.ts +4 -4
  39. package/server/service/figure/figure-rename-db.test.ts +2 -2
  40. package/server/service/figure/figure-rename.test.ts +3 -3
  41. package/server/service/figure/figure-rename.ts +6 -6
  42. package/server/service/figure/figure-subject.test.ts +1 -1
  43. package/server/service/figure/figure-tools.test.ts +19 -19
  44. package/server/service/figure/figure-tools.ts +9 -9
  45. package/server/service/figure/figure-type.ts +2 -2
  46. package/server/service/figure/figure.ts +2 -2
  47. package/translations/ko.json +31 -31
@@ -1 +1 @@
1
- {"version":3,"file":"figure-rename.js","sourceRoot":"","sources":["../../../server/service/figure/figure-rename.ts"],"names":[],"mappings":";;;AAwCA,gDAeC;AAsBD,0CAuCC;AAUD,kCAgBC;AA9ID,qCAAyC;AACzC,yDAAkE;AAsClE,gHAAgH;AACzG,KAAK,UAAU,kBAAkB,CACtC,YAGC,EACD,MAAsB,EACtB,IAAY;IAEZ,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;QAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAA,aAAG,EAAC,IAAA,gBAAM,GAAE,CAAC,EAAE;QACpE,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,CAAC,IAAI,CAAC;KACf,CAAC,CAAA;IACF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC5D,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,EA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, Not } from 'typeorm'\nimport { TYPE_LENGTH, TYPE_PATTERN } from '@hatiolab/figure-model'\n/**\n * 초안의 타입을 고치는 규칙 — ADR-0063 결정 4.\n *\n * ## 왜 발행 전에만인가\n *\n * `type` 은 도면에 적히는 이름이다. 도면은 `{ type, left, top, width, height }` 만 갖고 늘 최신\n * 발행판을 그리므로, 발행된 도형의 이름을 바꾸면 이미 배치된 도면이 아무 오류 없이 빈 자리가\n * 된다. 한 번도 발행되지 않은 도형은 그려질 자리가 없으니 가리키는 도면도 있을 수 없다.\n *\n * ## 왜 열어야 했나\n *\n * 닫아 두었더니 저작자가 이름을 **한 번도** 정하지 못했다. 새 Figure 에는 기계가 지은 이름이\n * 붙고(`FIGURE_MU6RJH47`) 칸에 자물쇠가 걸려서, 그 이름이 그대로 도면에 적히는 이름이 됐다.\n * 그렇게 남은 초안이 14 개다.\n *\n * ## 셈은 여기, 질의는 부르는 쪽\n *\n * 이 파일은 저장소를 모른다 — 판 번호 · 이력 유무 · 같은 이름의 주인을 **사실로 받는다.**\n * 그래야 규칙을 DB 없이 시험한다. 문(`figure-mutation.ts`)이 그 셋을 읽어 넘긴다.\n */\n\n\n/** 이름을 바꿀 때 알아야 하는 사실. 부르는 쪽이 저장소에서 읽어 온다. */\nexport interface RenameFacts {\n /** 발행 판 번호. 0 이면 한 번도 발행되지 않았다. */\n version?: number\n /** 판본이 하나라도 있나. 되돌리기로 판 번호가 도로 낮아져도 이력은 남는다. */\n hasHistory: boolean\n /** 같은 도메인에서 그 이름을 이미 쓰는 **다른** 도형이 있나. */\n takenByAnother: boolean\n /**\n * 같은 도메인에서 그 이름으로 발행한 뒤 지워진 도형이 있나. 발행한 도형을 지울 수 없게 되기(G4) 전에 지워진 것이다.\n * 그 이름을 다시 쓰면 판 번호가 1부터 다시 매겨져 같은 `ns/type@n` 이 다른 내용을 가리킨다.\n */\n releasedBefore?: boolean\n}\n\n/** Whether a figure of this type was released and then deleted in the domain (deleted before G4 refused it). */\nexport async function typeReleasedBefore(\n repositories: {\n figures: { find(options: any): Promise<{ id?: string }[]> }\n histories: { count(options: any): Promise<number> }\n },\n domain: { id: string },\n type: string\n): Promise<boolean> {\n const deleted = await repositories.figures.find({\n where: { domain: { id: domain.id }, type, deletedAt: Not(IsNull()) },\n withDeleted: true,\n select: ['id']\n })\n const ids = deleted.map(figure => figure.id).filter(Boolean)\n return ids.length > 0 && (await repositories.histories.count({ where: { originalId: In(ids) } })) > 0\n}\n\n/** Said when a type was released and deleted before: a new figure may not take it. */\nexport const releasedBeforeMessage = (type: string) =>\n `type 「${type}」 는 이 도메인에서 발행한 뒤 지운 도형의 이름이다 — 다시 쓰면 같은 판 번호가 다른 내용을 가리키므로 다른 이름을 고른다`\n\nexport class FigureRenameRefused extends Error {\n constructor(\n readonly code: 'empty-type' | 'malformed-type' | 'already-released' | 'type-taken' | 'type-released-before',\n message: string\n ) {\n super(message)\n this.name = 'FigureRenameRefused'\n }\n}\n\n/**\n * 고친 이름과 정본. 못 고치면 **까닭과 함께 던진다** — 조용히 옛 이름으로 두지 않는다.\n *\n * 정본 안에도 `type` 이 있어서 함께 고친다. 한쪽만 고치면 저장된 JSON 과 행이 다른 이름을\n * 말하고, 발행할 때 어느 쪽이 도면에 적히는지가 갈린다.\n */\nexport function renameDraftType(\n current: { type: string; source: string },\n wanted: string,\n facts: RenameFacts\n): { type: string; source: string } {\n const next = wanted.trim()\n\n if (!next) {\n throw new FigureRenameRefused('empty-type', 'type 이 비어 있다 — 도면에 적히는 이름이라 비울 수 없다')\n }\n\n /*\n The shape the modeller has always asked for, now asked here too (designer 2026-09-27, Q-D3): only a type being set\n is held to it -- every type in the development data already keeps it (56 of 56, 2026-09-27), and none is renamed.\n */\n if (!TYPE_PATTERN.test(next) || next.length < TYPE_LENGTH.min || next.length > TYPE_LENGTH.max) {\n throw new FigureRenameRefused(\n 'malformed-type',\n `type 「${next}」 는 소문자로 시작하고 소문자·숫자·하이픈 하나씩만 쓰며 ${TYPE_LENGTH.min}~${TYPE_LENGTH.max}자여야 한다`\n )\n }\n\n if ((facts.version ?? 0) > 0 || facts.hasHistory) {\n throw new FigureRenameRefused(\n 'already-released',\n '발행된 도형의 type 은 바꿀 수 없다 — 이미 배치된 도면이 이 이름을 가리킨다'\n )\n }\n\n if (facts.takenByAnother) {\n throw new FigureRenameRefused('type-taken', `type 「${next}」 는 이 도메인에서 이미 쓰고 있다`)\n }\n\n if (facts.releasedBefore) {\n throw new FigureRenameRefused('type-released-before', releasedBeforeMessage(next))\n }\n\n /* The asset carries no `type`: the name a board uses is the row's alone, so only the row changes. */\n return { type: next, source: current.source }\n}\n\n/**\n * 사실 셋을 저장소에서 읽는다.\n *\n * 규칙에서 떼어 둔 자리이지만 **질의의 모양이 틀리면 저작자에게는 저장 실패로만 보인다.**\n * 실제로 그랬다 — 판본을 `figure: { id }` 로 물었고, `FigureHistory` 는 관계 칸이 아니라\n * `originalId` 로 가리킨다. TypeORM 이 「그런 속성이 없다」로 던졌고 화면에는 영문 오류 한 줄이\n * 떴다. 그래서 이 함수를 내보내 sqlite 를 들고 왕복까지 본다.\n */\nexport async function renameFacts(\n repositories: {\n figures: { findOne(options: any): Promise<{ id?: string } | null>; find(options: any): Promise<{ id?: string }[]> }\n histories: { count(options: any): Promise<number> }\n },\n figure: { id?: string; version?: number },\n domain: { id: string },\n wanted: string\n): Promise<RenameFacts> {\n const next = wanted.trim()\n const hasHistory = (await repositories.histories.count({ where: { originalId: figure.id } })) > 0\n const taken = next ? await repositories.figures.findOne({ where: { domain: { id: domain.id }, type: next } }) : null\n\n const releasedBefore = next ? await typeReleasedBefore(repositories, domain, next) : false\n\n return { version: figure.version, hasHistory, takenByAnother: !!taken && taken.id !== figure.id, releasedBefore }\n}\n"]}
1
+ {"version":3,"file":"figure-rename.js","sourceRoot":"","sources":["../../../server/service/figure/figure-rename.ts"],"names":[],"mappings":";;;AAwCA,gDAeC;AAsBD,0CAuCC;AAUD,kCAgBC;AA9ID,qCAAyC;AACzC,yDAAkE;AAsClE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AE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA;IACjG,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAEpH,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAE1F,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,CAAA;AACnH,CAAC","sourcesContent":["import { In, IsNull, Not } from 'typeorm'\nimport { TYPE_LENGTH, TYPE_PATTERN } from '@hatiolab/figure-model'\n/**\n * 초안의 타입을 고치는 규칙 — ADR-0063 결정 4.\n *\n * ## 왜 발행 전에만인가\n *\n * `type` 은 도면에 적히는 이름이다. 도면은 `{ type, left, top, width, height }` 만 갖고 늘 최신\n * 발행판을 그리므로, 발행된 피규어의 이름을 바꾸면 이미 배치된 도면이 아무 오류 없이 빈 자리가\n * 된다. 한 번도 발행되지 않은 피규어는 그려질 자리가 없으니 가리키는 도면도 있을 수 없다.\n *\n * ## 왜 열어야 했나\n *\n * 닫아 두었더니 저작자가 이름을 **한 번도** 정하지 못했다. 새 Figure 에는 기계가 지은 이름이\n * 붙고(`FIGURE_MU6RJH47`) 칸에 자물쇠가 걸려서, 그 이름이 그대로 도면에 적히는 이름이 됐다.\n * 그렇게 남은 초안이 14 개다.\n *\n * ## 셈은 여기, 질의는 부르는 쪽\n *\n * 이 파일은 저장소를 모른다 — 판 번호 · 이력 유무 · 같은 이름의 주인을 **사실로 받는다.**\n * 그래야 규칙을 DB 없이 시험한다. 문(`figure-mutation.ts`)이 그 셋을 읽어 넘긴다.\n */\n\n\n/** 이름을 바꿀 때 알아야 하는 사실. 부르는 쪽이 저장소에서 읽어 온다. */\nexport interface RenameFacts {\n /** 발행 판 번호. 0 이면 한 번도 발행되지 않았다. */\n version?: number\n /** 판본이 하나라도 있나. 되돌리기로 판 번호가 도로 낮아져도 이력은 남는다. */\n hasHistory: boolean\n /** 같은 도메인에서 그 이름을 이미 쓰는 **다른** 피규어가 있나. */\n takenByAnother: boolean\n /**\n * 같은 도메인에서 그 이름으로 발행한 뒤 지워진 피규어가 있나. 발행한 피규어를 지울 수 없게 되기(G4) 전에 지워진 것이다.\n * 그 이름을 다시 쓰면 판 번호가 1부터 다시 매겨져 같은 `ns/type@n` 이 다른 내용을 가리킨다.\n */\n releasedBefore?: boolean\n}\n\n/** Whether a figure of this type was released and then deleted in the domain (deleted before G4 refused it). */\nexport async function typeReleasedBefore(\n repositories: {\n figures: { find(options: any): Promise<{ id?: string }[]> }\n histories: { count(options: any): Promise<number> }\n },\n domain: { id: string },\n type: string\n): Promise<boolean> {\n const deleted = await repositories.figures.find({\n where: { domain: { id: domain.id }, type, deletedAt: Not(IsNull()) },\n withDeleted: true,\n select: ['id']\n })\n const ids = deleted.map(figure => figure.id).filter(Boolean)\n return ids.length > 0 && (await repositories.histories.count({ where: { originalId: In(ids) } })) > 0\n}\n\n/** Said when a type was released and deleted before: a new figure may not take it. */\nexport const releasedBeforeMessage = (type: string) =>\n `type 「${type}」 는 이 도메인에서 발행한 뒤 지운 피규어의 이름이다 — 다시 쓰면 같은 판 번호가 다른 내용을 가리키므로 다른 이름을 고른다`\n\nexport class FigureRenameRefused extends Error {\n constructor(\n readonly code: 'empty-type' | 'malformed-type' | 'already-released' | 'type-taken' | 'type-released-before',\n message: string\n ) {\n super(message)\n this.name = 'FigureRenameRefused'\n }\n}\n\n/**\n * 고친 이름과 정본. 못 고치면 **까닭과 함께 던진다** — 조용히 옛 이름으로 두지 않는다.\n *\n * 정본 안에도 `type` 이 있어서 함께 고친다. 한쪽만 고치면 저장된 JSON 과 행이 다른 이름을\n * 말하고, 발행할 때 어느 쪽이 도면에 적히는지가 갈린다.\n */\nexport function renameDraftType(\n current: { type: string; source: string },\n wanted: string,\n facts: RenameFacts\n): { type: string; source: string } {\n const next = wanted.trim()\n\n if (!next) {\n throw new FigureRenameRefused('empty-type', 'type 이 비어 있다 — 도면에 적히는 이름이라 비울 수 없다')\n }\n\n /*\n The shape the modeller has always asked for, now asked here too (designer 2026-09-27, Q-D3): only a type being set\n is held to it -- every type in the development data already keeps it (56 of 56, 2026-09-27), and none is renamed.\n */\n if (!TYPE_PATTERN.test(next) || next.length < TYPE_LENGTH.min || next.length > TYPE_LENGTH.max) {\n throw new FigureRenameRefused(\n 'malformed-type',\n `type 「${next}」 는 소문자로 시작하고 소문자·숫자·하이픈 하나씩만 쓰며 ${TYPE_LENGTH.min}~${TYPE_LENGTH.max}자여야 한다`\n )\n }\n\n if ((facts.version ?? 0) > 0 || facts.hasHistory) {\n throw new FigureRenameRefused(\n 'already-released',\n '발행된 피규어의 type 은 바꿀 수 없다 — 이미 배치된 도면이 이 이름을 가리킨다'\n )\n }\n\n if (facts.takenByAnother) {\n throw new FigureRenameRefused('type-taken', `type 「${next}」 는 이 도메인에서 이미 쓰고 있다`)\n }\n\n if (facts.releasedBefore) {\n throw new FigureRenameRefused('type-released-before', releasedBeforeMessage(next))\n }\n\n /* The asset carries no `type`: the name a board uses is the row's alone, so only the row changes. */\n return { type: next, source: current.source }\n}\n\n/**\n * 사실 셋을 저장소에서 읽는다.\n *\n * 규칙에서 떼어 둔 자리이지만 **질의의 모양이 틀리면 저작자에게는 저장 실패로만 보인다.**\n * 실제로 그랬다 — 판본을 `figure: { id }` 로 물었고, `FigureHistory` 는 관계 칸이 아니라\n * `originalId` 로 가리킨다. TypeORM 이 「그런 속성이 없다」로 던졌고 화면에는 영문 오류 한 줄이\n * 떴다. 그래서 이 함수를 내보내 sqlite 를 들고 왕복까지 본다.\n */\nexport async function renameFacts(\n repositories: {\n figures: { findOne(options: any): Promise<{ id?: string } | null>; find(options: any): Promise<{ id?: string }[]> }\n histories: { count(options: any): Promise<number> }\n },\n figure: { id?: string; version?: number },\n domain: { id: string },\n wanted: string\n): Promise<RenameFacts> {\n const next = wanted.trim()\n const hasHistory = (await repositories.histories.count({ where: { originalId: figure.id } })) > 0\n const taken = next ? await repositories.figures.findOne({ where: { domain: { id: domain.id }, type: next } }) : null\n\n const releasedBefore = next ? await typeReleasedBefore(repositories, domain, next) : false\n\n return { version: figure.version, hasHistory, takenByAnother: !!taken && taken.id !== figure.id, releasedBefore }\n}\n"]}
@@ -88,7 +88,7 @@ function requireDomainId(state) {
88
88
  return id;
89
89
  }
90
90
  /**
91
- * 이 도형이 호출자 도메인 것인가.
91
+ * 이 피규어가 호출자 도메인 것인가.
92
92
  *
93
93
  * 모델이 넘긴 id 를 그대로 쓰지 않는다. 없으면 못 찾았다고 말한다 — 「권한이 없다」와 구별해
94
94
  * 알려 줄 것이 없다(다른 테넌트에 그 id 가 있다는 사실 자체가 알려 줄 것이 아니다).
@@ -193,8 +193,8 @@ function focusOf(host, source) {
193
193
  /**
194
194
  * 무엇을 고치라는 것인지 대화면 문맥에서 해소한다.
195
195
  *
196
- * 모델이 대상을 안 줬으면 **저작면이 지금 열고 있는 도형**이다. 사용자에게 식별자를 되묻지
197
- * 않는다 — 화면에 그 도형이 떠 있는데 「어느 도형입니까」를 묻는 것은 문맥을 안 읽은 것이다.
196
+ * 모델이 대상을 안 줬으면 **저작면이 지금 열고 있는 피규어**이다. 사용자에게 식별자를 되묻지
197
+ * 않는다 — 화면에 그 피규어가 떠 있는데 「어느 피규어입니까」를 묻는 것은 문맥을 안 읽은 것이다.
198
198
  */
199
199
  function figureIdFrom(args, host) {
200
200
  const said = typeof args?.figureId === 'string' ? args.figureId.trim() : '';
@@ -277,7 +277,7 @@ function figureToolSpecs() {
277
277
  {
278
278
  kind: 'read',
279
279
  name: 'listFigures',
280
- /* 이 도메인의 도형 목록 — 저장소를 직접 읽지만 같은 일을 하는 문은 이것이다. */
280
+ /* 이 도메인의 피규어 목록 — 저장소를 직접 읽지만 같은 일을 하는 문은 이것이다. */
281
281
  doors: ['Query.figures'],
282
282
  description: 'Lists the figures in this tenant with their type names, states and part counts. ' +
283
283
  'Call it before naming a type — type names are stored identifiers and must not be invented. ' +
@@ -327,8 +327,8 @@ function figureToolSpecs() {
327
327
  {
328
328
  kind: 'read',
329
329
  name: 'getFigureSource',
330
- /* 저장된 도형의 원본. **저장 전 초안**을 물으면 저장소에 갈 것이 없어 화면이 보낸 것을 그대로 돌려준다 —
331
- * 그 갈래에는 닿는 문이 없지만 `doors: []` 로 적지 않는다. 그러면 저장된 도형을 읽는 권한 검사가 선언에서 사라진다. */
330
+ /* 저장된 피규어의 원본. **저장 전 초안**을 물으면 저장소에 갈 것이 없어 화면이 보낸 것을 그대로 돌려준다 —
331
+ * 그 갈래에는 닿는 문이 없지만 `doors: []` 로 적지 않는다. 그러면 저장된 피규어를 읽는 권한 검사가 선언에서 사라진다. */
332
332
  doors: ['Query.figure'],
333
333
  description: 'Returns the source (the figure asset) of one figure, with its measured cost ' +
334
334
  '(triangles, part groups, and how many of it hold 60fps on one screen). Call it before proposing a revision — ' +
@@ -434,12 +434,12 @@ function figureToolSpecs() {
434
434
  if (!prompt)
435
435
  throw new Error('prompt is required: there is nothing to ask for');
436
436
  /*
437
- 고치는 것인지 만드는 것인지를 **문맥에서 정한다.** 열린 도형이 있으면 고치는 것이 기본이고,
438
- 모델이 `create` 를 켜면 만드는 것이다. 이것을 모델의 짐작에 맡기면 열려 있는 도형을 덮어쓰는
437
+ 고치는 것인지 만드는 것인지를 **문맥에서 정한다.** 열린 피규어가 있으면 고치는 것이 기본이고,
438
+ 모델이 `create` 를 켜면 만드는 것이다. 이것을 모델의 짐작에 맡기면 열려 있는 피규어를 덮어쓰는
439
439
  후보가 온다.
440
440
 
441
441
  고치는 제안은 모델러가 **요청 당시의 판(context · revision)** 위에 한 단계로 적용한다(ADR-0094).
442
- 그래서 고칠 수 있는 것은 모델러에 열린 도형뿐이고, 그 판을 문맥이 함께 실어 와야 한다.
442
+ 그래서 고칠 수 있는 것은 모델러에 열린 피규어뿐이고, 그 판을 문맥이 함께 실어 와야 한다.
443
443
  */
444
444
  const host = ctx?.host;
445
445
  const create = args?.create === true || args?.figureId === null;
@@ -1 +1 @@
1
- {"version":3,"file":"figure-tools.js","sourceRoot":"","sources":["../../../server/service/figure/figure-tools.ts"],"names":[],"mappings":";;AAwFA,gEAEC;AAkfD,oEAsBC;AAlmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,mCAAmC;AACnC,qCAA+B;AAC/B,mEASuC;AAEvC,2DAAiG;AAEjG,oDAAoD;AACpD,MAAM,UAAU,GAAG,GAAG,CAAA;AAEtB;;;EAGE;AACF,IAAI,KAAsB,CAAA;AAE1B,SAAS,OAAO;IACd,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,8DAA8D;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;QAC9C,8DAA8D;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAA;QAC/C,8DAA8D;QAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;QACrC,8DAA8D;QAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;QAC5C,8DAA8D;QAC9D,MAAM,QAAQ,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAA;QACrD,KAAK,GAAG;YACN,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,qFAAqF;YACrF,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,YAA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AACjC,CAAC","sourcesContent":["/*\n * figure 저작 도구를 어시스턴트 도구 레지스트리에 등록 — **대화면(도크)에서 저작을 돕기 위함.**\n *\n * 왜 필요한가: `proposeFigure` 는 한 번 시키고 한 번 받는다. 그것으로 되는 일이 있지만, 저작은\n * 대개 「이걸 이렇게 고쳐 봐 → 무게가 얼마나 되나 → 발행은 되나」처럼 여러 차례 오간다. 그 대화를\n * 하려면 어시스턴트가 **지금 무엇이 있는지 읽을 수 있어야** 한다. 읽지 못하면 매번 사람이 정본을\n * 붙여 넣어야 하고, 그러면 대화가 아니다.\n *\n * 능력을 복제하지 않는다. figure-service 가 이미 가진 진입점(`inspectSource` · `proposeFigureSteps` ·\n * 조회)을 레지스트리에 투영한다.\n *\n * ── 전부 조회·제안 전용이다 ─────────────────────────────────────────────────\n * 정본을 고치는 도구를 넣지 않는다. 형식의 설계가 그렇게 정해져 있다 — 어시스턴트는 **후보**를\n * 내고, 받을지 버릴지는 저작자가 정한다(`figure-propose-steps.ts`, ADR-0094). 되돌릴 수 없는 조작이 대화면으로\n * 새지 않으므로 전부 `kind: 'read'` 다.\n *\n * 저장은 저작면이 `updateFigure` 로 한다. 그 mutation 은 `figure:mutation` 이 지키고, 대화는\n * `ai-assistant:mutation` 이 지킨다 — 서로 다른 질문이라 서로 다른 권한이 지킨다. figure 가 board\n * 의 권한을 빌리지 않는다.\n *\n * ── No privilege here. The gate reads what the door declares ─────────────────────\n * Until 2026-09-18 each tool carried `privilege: { category: 'figure', ... }`. It matched the door's\n * directive then, and would drift the day the door changed its declaration — and the looser copy wins.\n * Now the gate reads the declaration of each door in `doors` from AUTH's table (ADR-0071 decision 2,\n * addendum). What stays here is **the doors it reaches**.\n *\n * ── 규율을 도구와 함께 보낸다 ───────────────────────────────────────────────\n * 도구 목록만으로는 「언제 반드시 불러야 하는지」를 모른다. twin 이 그 공백에서 사고를 냈다 —\n * 조치 요청에 도구를 부르지 않고 「제안해 두었습니다」라고만 답해, 사용자에게 **없는 버튼을 누르라고\n * 안내했다.** figure 도 똑같은 자리가 있다: 후보 화면(「지금 / 후보」 두 칸)은 **도구 호출 결과에서만**\n * 만들어진다. 문장으로는 아무 일도 일어나지 않는다.\n *\n * ── LLM 이 넘긴 id 를 믿지 않는다 ───────────────────────────────────────────\n * 사람이 목록에서 고르는 길에서는 드러나지 않지만, 모델은 대화 내용에 이끌려 임의의 id 를 넘길 수\n * 있다. 그래서 호출자 도메인 소속을 먼저 확인한다.\n */\nimport { randomUUID } from 'crypto'\nimport { ILike } from 'typeorm'\nimport {\n aiClientFor,\n registerToolCategory,\n type AIImageMediaType,\n type ToolAttachment,\n type ToolCallContext,\n type ToolCategory,\n type ToolImageAttachment,\n type ToolSpec\n} from '@things-factory/ai-client-base'\n\nimport { FIGURE_CONTEXT_BUDGET, figureViewOf, type FigureReadRequest } from './figure-context.js'\n\n/** How many figures a list without search names. */\nconst LIST_LIMIT = 200\n\n/*\n 서버 의존성은 lazy require 다. 등록은 부팅 초반에 평가되고 그때 typeorm DataSource 가 준비되지\n 않았을 수 있다(board-import · twin-ai 와 같은 정책).\n*/\nlet _deps: any | undefined\n\nfunction getDeps(): any {\n if (!_deps) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const shell = require('@things-factory/shell')\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const model = require('@hatiolab/figure-model')\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const entity = require('./figure.js')\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const format = require('./figure-format.js')\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const proposer = require('./figure-propose-steps.js')\n _deps = {\n getRepository: shell.getRepository,\n Figure: entity.Figure,\n /* The same doors a save and a release go through. The tool reads; it never saves. */\n inspectSource: format.inspectSource,\n parseSource: format.parseSource,\n figureCostOf: model.figureCostOf,\n figureScoreOf: model.figureScoreOf,\n proposeFigureSteps: proposer.proposeFigureSteps,\n isPlaceholderType: model.isPlaceholderType\n }\n }\n return _deps\n}\n\n/** 시험·검증 하네스 전용 주입 시임. 운영 경로에서 호출 금지. */\nexport function __setFigureToolDepsForTest(deps: any): void {\n _deps = deps\n}\n\nfunction requireDomainId(state: any): string {\n const id = state?.domain?.id\n if (!id) {\n // 도메인을 모르면 무엇을 읽어도 남의 것일 수 있다. 조용히 넘기지 않는다.\n throw new Error('domain context is missing — the figure tools cannot resolve tenant scope')\n }\n return id\n}\n\n/**\n * 이 도형이 호출자 도메인 것인가.\n *\n * 모델이 넘긴 id 를 그대로 쓰지 않는다. 없으면 못 찾았다고 말한다 — 「권한이 없다」와 구별해\n * 알려 줄 것이 없다(다른 테넌트에 그 id 가 있다는 사실 자체가 알려 줄 것이 아니다).\n */\nasync function figureInDomain(figureId: string, domainId: string): Promise<any> {\n const { getRepository, Figure } = getDeps()\n const found = await getRepository(Figure).findOne({\n where: { id: figureId, domain: { id: domainId } }\n })\n if (!found) {\n throw new Error(`figure not found in this tenant: ${figureId}`)\n }\n return found\n}\n\n/** The form of a creation id: the row id a new figure's first save inserts it under (`figure-mutation.ts`). */\nconst CREATION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i\n\n/**\n * The figure a tool is about: by id, or by its type name, in the caller's domain. None named: none.\n *\n * A figure not saved yet is a subject too (ADR-0061 decision 3): the modeller names it by its creation id, which its first\n * save inserts the row under (ADR-0072 decision 6), so before that save there is no row. It is the figure open on that\n * screen and nothing else: the id the screen has open, with the draft the screen sent. What is read is that draft, put\n * through the save's door like any draft (`sourceForTool`); nothing the server holds is read for it.\n */\nasync function resolveFigureTarget(figureId: string | undefined, domainId: string, host: any): Promise<any> {\n if (!figureId) return undefined\n const { getRepository, Figure } = getDeps()\n const found =\n (await getRepository(Figure).findOne({ where: { id: figureId, domain: { id: domainId } } })) ??\n (await getRepository(Figure).findOne({ where: { type: figureId, domain: { id: domainId } } }))\n if (found) return found\n const draft = host?.draftSource\n if (CREATION_ID.test(figureId) && host?.figureId === figureId && draft && typeof draft === 'object') {\n return { id: figureId, name: typeof draft.name === 'string' ? draft.name : undefined, source: null }\n }\n throw new Error(`figure not found in this tenant: ${figureId}`)\n}\n\n/**\n * The source a tool reads: the draft on screen when the modeller has this figure open, else the stored one.\n *\n * The host context is the browser's, so it is no ground for access: the row is found in the domain first, and the\n * draft is put through the same door a save goes through before anything reads it.\n */\nconst isFigure = (source: any) => source?.version === 'figure-asset-1'\n\n/**\n * A revision is applied by the modeller on the version the model saw (ADR-0094), so only the figure open there can be\n * revised. Said as what is true, with what the assistant can do instead.\n */\nfunction figureNotOpen() {\n return {\n error: 'FIGURE_NOT_OPEN',\n message: 'A revision can be proposed only for the figure open in the modeller.',\n nextStep:\n 'Tell the person to open the figure in the modeller and ask again there. A new figure needs no open one: call proposeFigureCandidate with create: true.'\n }\n}\n\nfunction sourceForTool(row: any, host: any): { source: any; draft: boolean } {\n const draft = host?.figureId === row.id ? host?.draftSource : undefined\n if (!draft) return { source: row.source ? JSON.parse(row.source) : null, draft: false }\n\n if (typeof draft !== 'object' || Array.isArray(draft)) throw new Error('the unsaved draft is not a figure asset')\n const serialized = JSON.stringify(draft)\n /* Validity is the save door's (the kernel's 1 MiB); how much the model is shown is `figure-context`'s. */\n try {\n getDeps().parseSource(serialized)\n } catch (e: any) {\n const findings = Array.isArray(e?.findings) ? e.findings.map((one: any) => one.message).join(' · ') : String(e?.message ?? e)\n throw new Error(`the unsaved draft is invalid: ${findings}`)\n }\n return { source: draft, draft: true }\n}\n\n/** The finite numbers of an untrusted record, by name; none: undefined. */\nfunction numbersOf(record: any): Record<string, number> | undefined {\n if (!record || typeof record !== 'object' || Array.isArray(record)) return undefined\n const kept = Object.entries(record).filter((entry): entry is [string, number] => typeof entry[1] === 'number' && Number.isFinite(entry[1]))\n return kept.length ? Object.fromEntries(kept) : undefined\n}\n\n/**\n * What the person has in view on the open draft: the part selected and what the preview is trying (ADR-0097 §5.6\n * item 5). The model hears it only here, through a read (ADR-0061 decision 3). Told only when it was seen on the version\n * being read -- a selection from another version may name a part that is gone -- and a part only when the draft has it.\n */\nfunction focusOf(host: any, source: any): { selection?: { part: string }; trying?: { clips?: Record<string, number>; controls?: Record<string, number> } } {\n const onThisVersion = (seen: any) => typeof host?.context === 'string' && seen?.context === host.context && seen?.revision === host.revision\n const focus: ReturnType<typeof focusOf> = {}\n\n const part = host?.selection?.part\n const nodes = source?.document?.model?.nodes\n if (typeof part === 'string' && onThisVersion(host.selection) && Array.isArray(nodes) && nodes.some((node: any) => node?.id === part)) {\n focus.selection = { part }\n }\n\n if (onThisVersion(host?.trying)) {\n const clips = numbersOf(host.trying.clips)\n const controls = numbersOf(host.trying.controls)\n if (clips || controls) focus.trying = { ...(clips ? { clips } : {}), ...(controls ? { controls } : {}) }\n }\n return focus\n}\n\n/**\n * 무엇을 고치라는 것인지 대화면 문맥에서 해소한다.\n *\n * 모델이 대상을 안 줬으면 **저작면이 지금 열고 있는 도형**이다. 사용자에게 식별자를 되묻지\n * 않는다 — 화면에 그 도형이 떠 있는데 「어느 도형입니까」를 묻는 것은 문맥을 안 읽은 것이다.\n */\nfunction figureIdFrom(args: any, host: any): string | undefined {\n const said = typeof args?.figureId === 'string' ? args.figureId.trim() : ''\n if (said) return said\n\n const open = typeof host?.figureId === 'string' ? host.figureId.trim() : ''\n if (open) return open\n\n return undefined\n}\n\nfunction missingFigureTarget() {\n return {\n error: 'FIGURE_TARGET_REQUIRED',\n message: 'No figure is open on this screen.',\n nextStep: 'For an existing figure, call listFigures and match the user’s requested name or type; ask which figure only if ambiguous. For a new figure, call proposeFigureCandidate with create: true and the user’s prompt. Do not invent an id or repeat this call without a target.'\n }\n}\n\nconst FIGURE_ID_ARG = {\n figureId: {\n type: 'string',\n description: 'The figure to read. Omit to read the one open in the modeller — with its unsaved changes, and also when it is a new figure not saved yet; the server fills it in, and you cannot see which it is. A figure not saved yet is readable only while it is open in the modeller. On the catalog nothing is open, so resolve the figure the person asked for with listFigures first.'\n }\n} as const\n\nconst PARTS_ARG = {\n parts: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Only for a figure too large to read whole (the answer then has `outline` and no `source`): the ids of the parts to read in full, from `outline.parts`. Omit to read the part selected.'\n },\n sections: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Only for a figure too large to read whole: JSON Pointers of sections to read, such as one named in `outline.omitted` or its `entries` (for example /document/capabilities/bindings/0).'\n }\n} as const\n\n/**\n * A figure too large to show whole, as the model reads it (ADR-0061 2026-10-16 decision 4): its outline and the parts\n * asked for. The full source stays here; what is measured is measured on it.\n */\nfunction partialRead(source: any, request: FigureReadRequest) {\n const view = figureViewOf(source, request)\n if (view.whole) return { source }\n return {\n outline: view.outline,\n partSources: view.parts,\n ...(Object.keys(view.sections ?? {}).length ? { sectionSources: view.sections } : {}),\n ...(view.notRead ? { notRead: view.notRead } : {}),\n note:\n `This figure is too large to read whole (${view.outline!.chars} characters; ${FIGURE_CONTEXT_BUDGET} are read at once), so this is its outline, the parts in partSources and the sections in sectionSources. ` +\n 'Read what a change touches with parts and sections, then pass the same to proposeFigureCandidate: only parts read in full may be changed, and nothing in a section in outline.omitted that was not read.'\n }\n}\n\n/** The parts the model named, as strings; anything else is dropped. */\nconst stringsOf = (list: unknown): string[] =>\n Array.isArray(list) ? list.filter((one: unknown): one is string => typeof one === 'string' && !!one.trim()).map((one: string) => one.trim()) : []\n\n/** An inspection whose findings would crowd the model's context, cut to the budget with how many there were. */\nfunction findingsWithinBudget(inspection: any) {\n const findings = Array.isArray(inspection?.findings) ? inspection.findings : []\n if (JSON.stringify(inspection).length <= FIGURE_CONTEXT_BUDGET) return inspection\n const head = JSON.stringify({ ...inspection, findings: [], truncated: { shown: findings.length, total: findings.length } }).length\n let room = FIGURE_CONTEXT_BUDGET - head\n const shown: any[] = []\n for (const finding of findings) {\n const cost = JSON.stringify(finding).length + 1\n if (cost > room) break\n shown.push(finding)\n room -= cost\n }\n return { ...inspection, findings: shown, truncated: { shown: shown.length, total: findings.length } }\n}\n\n/**\n * 도구 넷.\n *\n * 목록 · 정본 · 발행 판정 · 후보. 저작 대화에서 실제로 묻는 것이 그 넷이다 — 「무엇이 있나」\n * 「지금 어떻게 생겼나」 「발행이 왜 안 되나」 「이렇게 고쳐 봐」.\n */\nfunction figureToolSpecs(): ToolSpec[] {\n return [\n {\n kind: 'read',\n name: 'listFigures',\n /* 이 도메인의 도형 목록 — 저장소를 직접 읽지만 같은 일을 하는 문은 이것이다. */\n doors: ['Query.figures'],\n description:\n 'Lists the figures in this tenant with their type names, states and part counts. ' +\n 'Call it before naming a type — type names are stored identifiers and must not be invented. ' +\n `Without search it lists the ${LIST_LIMIT} most recently changed; when there are more it says truncated, and a figure the person names may be among the rest - list again with search.`,\n schema: {\n type: 'object',\n properties: {\n search: {\n type: 'string',\n description: 'Part of a figure name or type name, in any case. Omit to list the most recently changed.'\n }\n }\n },\n builder: async (args: any, ctx: any) => {\n const domainId = requireDomainId(ctx?.state)\n const { getRepository, Figure } = getDeps()\n const search = typeof args?.search === 'string' ? args.search.trim() : ''\n const domain = { id: domainId }\n /* `_` and `%` in the words are LIKE wildcards: they can only widen what is found, never hide a match. */\n const where = search\n ? [\n { domain, name: ILike(`%${search}%`) },\n { domain, type: ILike(`%${search}%`) }\n ]\n : { domain }\n /* One more than is shown, to know whether there is more without counting the table. */\n const rows = await getRepository(Figure).find({ where, order: { updatedAt: 'DESC' }, take: LIST_LIMIT + 1 })\n const truncated = rows.length > LIST_LIMIT\n return {\n ...(truncated\n ? {\n truncated: true,\n note: `Only the ${LIST_LIMIT} most recently changed are listed. A figure not here may still exist: call listFigures again with search.`\n }\n : {}),\n figures: rows.slice(0, LIST_LIMIT).map((row: any) => ({\n id: row.id,\n type: row.type,\n name: row.name,\n state: row.state,\n score: row.score,\n triangles: row.triangles\n }))\n }\n }\n },\n {\n kind: 'read',\n name: 'getFigureSource',\n /* 저장된 도형의 원본. **저장 전 초안**을 물으면 저장소에 갈 것이 없어 화면이 보낸 것을 그대로 돌려준다 —\n * 그 갈래에는 닿는 문이 없지만 `doors: []` 로 적지 않는다. 그러면 저장된 도형을 읽는 권한 검사가 선언에서 사라진다. */\n doors: ['Query.figure'],\n description:\n 'Returns the source (the figure asset) of one figure, with its measured cost ' +\n '(triangles, part groups, and how many of it hold 60fps on one screen). Call it before proposing a revision — ' +\n 'revising without reading it means proposing against a guess. On the figure open in the modeller it also says what ' +\n 'the person has in view: `selection.part` is the part selected - \"this part\" or \"the selected one\" means it - and ' +\n '`trying` the clip and control values the preview is trying, which are not part of the figure. ' +\n 'A figure too large to read whole comes as `outline` (every part by name, shape and what it is fastened to) and ' +\n '`partSources` (the parts read in full) instead of `source`.',\n schema: { type: 'object', properties: { ...FIGURE_ID_ARG, ...PARTS_ARG } },\n builder: async (args: any, ctx: any) => {\n const domainId = requireDomainId(ctx?.state)\n const figureId = figureIdFrom(args, ctx?.host)\n const row = await resolveFigureTarget(figureId, domainId, ctx?.host)\n if (!row) return missingFigureTarget()\n\n const current = sourceForTool(row, ctx?.host)\n if (!current.source) {\n // 저장된 정본이 없는 상태가 실제로 있다(새로 만들고 저장 안 한 것). 지어내지 않는다.\n return { id: row.id, type: row.type, name: row.name, source: null, cost: null }\n }\n\n /* Measured as the catalogue measures it: triangles, draw groups, and its grade against one screen. */\n const { figureCostOf, figureScoreOf } = getDeps()\n /* What is in view belongs to the draft on screen; the stored source may be another figure than the one open. */\n const focus = current.draft ? focusOf(ctx?.host, current.source) : {}\n const asked = stringsOf(args?.parts)\n return {\n id: row.id,\n type: row.type,\n name: row.name,\n state: row.state,\n ...partialRead(current.source, { parts: asked.length ? asked : focus.selection ? [focus.selection.part] : [], sections: stringsOf(args?.sections) }),\n draft: current.draft,\n cost: figureCostOf(current.source),\n score: figureScoreOf(current.source) ?? null,\n ...focus\n }\n }\n },\n {\n kind: 'read',\n name: 'inspectFigure',\n /* 검사 결과 — 같은 일을 하는 문. */\n doors: ['Query.inspectFigure'],\n description:\n 'Says whether a figure may be released and, when it may not, what is wrong — each finding ' +\n 'carries why it is a problem and what to change. Call it when asked about releasing, or ' +\n 'when asked to fix a figure that will not release.',\n schema: { type: 'object', properties: { ...FIGURE_ID_ARG } },\n builder: async (args: any, ctx: any) => {\n const domainId = requireDomainId(ctx?.state)\n const figureId = figureIdFrom(args, ctx?.host)\n const row = await resolveFigureTarget(figureId, domainId, ctx?.host)\n if (!row) return missingFigureTarget()\n\n const current = sourceForTool(row, ctx?.host)\n const { inspectSource } = getDeps()\n /* Inspected whole, here; only what the model is told is held to its budget. */\n return { ...findingsWithinBudget(inspectSource(current.source ? JSON.stringify(current.source) : null, null, undefined, row.type, row.category)), draft: current.draft }\n }\n },\n {\n kind: 'read',\n name: 'proposeFigureCandidate',\n /* 후보 생성 — 저장은 하지 않지만 같은 문의 권한을 쓴다. */\n doors: ['Mutation.proposeFigure'],\n description:\n 'Asks for a proposal: the modeller commands that make a new figure or revise the one open in the modeller. ' +\n 'Returns the commands with the score and cost of the figure they make. NOTHING IS SAVED — the author applies ' +\n 'the proposal in the modeller as one step, or leaves it. This is the only way a proposal reaches the screen.',\n schema: {\n type: 'object',\n properties: {\n prompt: {\n type: 'string',\n description: 'What to make or change, in the words the author used, with the sizes as they said them: do not turn sizes into axes.'\n },\n figureId: {\n type: 'string',\n description: 'Revise this figure; it must be the one open in the modeller. Omit to revise the open one; pass null to create anew.'\n },\n name: {\n type: 'string',\n description: 'The name a person reads for a new figure.'\n },\n create: {\n type: 'boolean',\n description: 'True to create rather than revise, even with a figure open.'\n },\n parts: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Only for a figure too large to read whole: the parts this change touches, read first with getFigureSource parts. Only these and the part selected may be changed; new parts may be added and fastened to any part.'\n },\n sections: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Only for a figure too large to read whole: JSON Pointers of the sections in outline.omitted this change touches, read first with getFigureSource sections. Nothing else in those sections may be changed.'\n }\n },\n required: ['prompt']\n },\n builder: async (args: any, ctx: ToolCallContext) => {\n const domainId = requireDomainId(ctx?.state)\n const prompt = typeof args?.prompt === 'string' ? args.prompt.trim() : ''\n if (!prompt) throw new Error('prompt is required: there is nothing to ask for')\n\n /*\n 고치는 것인지 만드는 것인지를 **문맥에서 정한다.** 열린 도형이 있으면 고치는 것이 기본이고,\n 모델이 `create` 를 켜면 만드는 것이다. 이것을 모델의 짐작에 맡기면 열려 있는 도형을 덮어쓰는\n 후보가 온다.\n\n 고치는 제안은 모델러가 **요청 당시의 판(context · revision)** 위에 한 단계로 적용한다(ADR-0094).\n 그래서 고칠 수 있는 것은 모델러에 열린 도형뿐이고, 그 판을 문맥이 함께 실어 와야 한다.\n */\n const host = ctx?.host\n const create = args?.create === true || args?.figureId === null\n let base: unknown\n let figureId: string | undefined\n let focus: ReturnType<typeof focusOf> | undefined\n if (!create) {\n const said = typeof args?.figureId === 'string' ? args.figureId.trim() : ''\n const open = typeof host?.figureId === 'string' ? host.figureId.trim() : ''\n if (said && said !== open) {\n await figureInDomain(said, domainId)\n return figureNotOpen()\n }\n if (!open) return missingFigureTarget()\n const row = await resolveFigureTarget(open, domainId, host)\n if (!row) return missingFigureTarget()\n const current = sourceForTool(row, host)\n base = current.source ?? undefined\n if (!isFigure(base)) return figureNotOpen()\n if (typeof host?.context !== 'string' || !Number.isInteger(host?.revision)) return figureNotOpen()\n figureId = open\n /* \"Make this one bigger\": the part selected is what the request points at. */\n if (current.draft) focus = focusOf(host, base)\n }\n\n /*\n The pictures the person sent with this turn, as the server checked them (ADR-0061, 2026-10-16 decision 2) --\n every one, in the order attached. Never from the host context: the client fills it.\n */\n const images = (ctx?.attachments ?? [])\n .filter((file: ToolAttachment): file is ToolImageAttachment => file.kind === 'image')\n .map(file => ({ data: file.data, mediaType: file.mediaType as AIImageMediaType }))\n\n const { proposeFigureSteps } = getDeps()\n let result: any\n try {\n result = await proposeFigureSteps({\n /* The agent of this conversation's turn - the one the person picked, or the domain default. */\n client: await aiClientFor({\n domain: ctx?.state?.domain,\n user: ctx?.state?.user,\n agentId: ctx?.state?.aiAgentId,\n modeKind: ctx?.mode?.kind\n }),\n prompt,\n base,\n name: typeof args?.name === 'string' && args.name.trim() ? args.name.trim() : undefined,\n ...(images.length ? { images } : {}),\n ...(focus && Object.keys(focus).length ? { focus } : {}),\n ...(!create && (stringsOf(args?.parts).length || stringsOf(args?.sections).length)\n ? { read: { parts: stringsOf(args?.parts), sections: stringsOf(args?.sections) } }\n : {})\n })\n } catch (error) {\n /*\n * 세 번 거절된 끝의 사유를 ProposeFigureFailure.reasons 에만 두면 agentic-loop 은 「만들지 못했습니다」만\n * 받아 화면에는 「응답이 비어있습니다」가 된다. 다시 시도할 수 있는 말로 경계를 넘긴다.\n * 다른 예외(권한·통신)는 원문을 보존한다.\n */\n const reasons = Array.isArray((error as any)?.reasons) ? (error as any).reasons : []\n if (reasons.length > 0) throw new Error([(error as Error).message, ...reasons].join('\\n'))\n throw error\n }\n\n /*\n **`proposed: true` 가 카드를 만든다.** 이 표시가 없으면 제안은 도구 추적 안에 묻히고 화면에는\n 아무것도 생기지 않는다. 카드의 실행 단추가 figure-ui 의 처리기에 넘기고, 처리기가 모델러에 명령\n 목록을 한 단계로 적용한다. `args` 는 같은 제안을 두 번 세지 않기 위한 열쇠의 일부다.\n */\n const name = result.source.name || 'Figure'\n /* The card is read by a person, so the server writes it in the request's language (ADR-0061, 2026-10-16 decision 1). */\n const t = ctx.t\n return {\n proposed: true,\n /*\n The proposal's own name, given once here (ADR-0097 §5.6 item 5; AI lane, 09-27): the dock keys its card by\n it, a new figure made from it is created under it (the row id), and a save records it -- so what became of\n it can be asked after a reload, and the same proposal never makes two figures.\n */\n key: randomUUID(),\n icon: 'view_in_ar',\n label: create\n ? t('figure.proposal.label-create', { name, defaultValue: 'Make {name}' })\n : t('figure.proposal.label-revise', { name, defaultValue: 'Revise {name}' }),\n reason: t('figure.proposal.reason', {\n steps: result.steps.length,\n grade: result.score?.grade ?? '-',\n triangles: result.cost.triangles,\n attempts: result.attempts,\n defaultValue: '{steps} commands · grade {grade} · {triangles} triangles · made in {attempts} tries'\n }),\n args: { prompt, figureId, create },\n create,\n figureId,\n context: create ? undefined : host.context,\n revision: create ? undefined : host.revision,\n steps: result.steps,\n score: result.score,\n cost: result.cost,\n attempts: result.attempts\n }\n }\n }\n ] as ToolSpec[]\n}\n\n/**\n * 등록 — 부팅 시 1회.\n *\n * 범주가 하나다. twin 은 관찰과 생성을 둘로 갈랐는데(운영 협의에 생성 도구가 들려 있으면 대화의\n * 성격이 흐려진다), figure 의 대화면은 저작면 하나뿐이고 그 자리에서 읽기와 후보 요청이 함께 필요하다.\n * 대화면이 늘면 그때 가른다.\n */\nexport function registerFigureToolCategories(): void {\n const authoring: ToolCategory = {\n name: 'figure-authoring',\n description: 'Reads the source, cost and release verdict of the figure being authored, and proposes changes (nothing is saved).',\n guidance: [\n '- **For a request to make or change a figure, always call `proposeFigureCandidate`.** A proposal exists only as the result of that call.',\n ' Writing \"I made a proposal\" or \"press apply\" without the call is **false**: no card appears, and the person looks for a button that does not exist.',\n ' A proposal is a list of modeller commands. The modeller applies it as one step only when the person runs it from the dock card, and one undo takes it all back. Do not say the figure has changed before that.',\n ' A revision can be proposed only for the figure open in the modeller. Say what the result\\'s `steps` do as they are; do not invent changes the commands do not make.',\n '- Never save the source yourself. Propose; the author decides on the screen whether to take it.',\n '- In the prompt to `proposeFigureCandidate`, pass the person\\'s words as they are: their sizes, counts and names. Do not turn them into axes; the writer knows the figure\\'s axes. When you name an axis to the person, the figure\\'s Y is up.',\n '- **For a request to change a figure, call `getFigureSource` first.** Revising without reading proposes against a guess, and a renamed part breaks the bindings of the boards it is already placed on.',\n '- On the catalog nothing is open. To read an existing figure, find the id of the name or type the person said with `listFigures`; ask which figure only when it is ambiguous. To revise an existing figure, tell the person to open it in the modeller and ask there. For a new figure, do not read existing sources: call `proposeFigureCandidate` with create: true.',\n '- Do not invent type names; check them with `listFigures`. **A type name is a stored identifier**, and boards find the figure by it. A new figure\\'s type is set by a person at its first save.',\n '- When asked why a figure will not release, call `inspectFigure`. Do not say it can be released without its verdict.',\n ' Each finding carries **why it is a problem and what to change**. Pass it on as it is; a summary makes the author look again for which axis of which part to fix.',\n '- For weight or triangle counts, use `cost` from `getFigureSource`. Do not estimate.'\n ].join('\\n'),\n specs: figureToolSpecs()\n }\n\n registerToolCategory(authoring)\n}\n"]}
1
+ {"version":3,"file":"figure-tools.js","sourceRoot":"","sources":["../../../server/service/figure/figure-tools.ts"],"names":[],"mappings":";;AAwFA,gEAEC;AAkfD,oEAsBC;AAlmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,mCAAmC;AACnC,qCAA+B;AAC/B,mEASuC;AAEvC,2DAAiG;AAEjG,oDAAoD;AACpD,MAAM,UAAU,GAAG,GAAG,CAAA;AAEtB;;;EAGE;AACF,IAAI,KAAsB,CAAA;AAE1B,SAAS,OAAO;IACd,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,8DAA8D;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;QAC9C,8DAA8D;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAA;QAC/C,8DAA8D;QAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;QACrC,8DAA8D;QAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;QAC5C,8DAA8D;QAC9D,MAAM,QAAQ,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAA;QACrD,KAAK,GAAG;YACN,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,qFAAqF;YACrF,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;YAC/C,iBAAiB,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KAAK,CAAC,MAAM;wBAC1B,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,IAAI,GAAG;wBACjC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS;wBAChC,QAAQ,EAAE,MAAM,CAAC,QAAQ;wBACzB,YAAY,EAAE,qFAAqF;qBACpG,CAAC;oBACF,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE;oBAClC,MAAM;oBACN,QAAQ;oBACR,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO;oBAC1C,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ;oBAC5C,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;iBAC1B,CAAA;YACH,CAAC;SACF;KACY,CAAA;AACjB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,4BAA4B;IAC1C,MAAM,SAAS,GAAiB;QAC9B,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,mHAAmH;QAChI,QAAQ,EAAE;YACR,0IAA0I;YAC1I,uJAAuJ;YACvJ,kNAAkN;YAClN,uKAAuK;YACvK,iGAAiG;YACjG,gPAAgP;YAChP,wMAAwM;YACxM,wWAAwW;YACxW,iMAAiM;YACjM,sHAAsH;YACtH,oKAAoK;YACpK,sFAAsF;SACvF,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,KAAK,EAAE,eAAe,EAAE;KACzB,CAAA;IAED,IAAA,qCAAoB,EAAC,SAAS,CAAC,CAAA;AACjC,CAAC","sourcesContent":["/*\n * figure 저작 도구를 어시스턴트 도구 레지스트리에 등록 — **대화면(도크)에서 저작을 돕기 위함.**\n *\n * 왜 필요한가: `proposeFigure` 는 한 번 시키고 한 번 받는다. 그것으로 되는 일이 있지만, 저작은\n * 대개 「이걸 이렇게 고쳐 봐 → 무게가 얼마나 되나 → 발행은 되나」처럼 여러 차례 오간다. 그 대화를\n * 하려면 어시스턴트가 **지금 무엇이 있는지 읽을 수 있어야** 한다. 읽지 못하면 매번 사람이 정본을\n * 붙여 넣어야 하고, 그러면 대화가 아니다.\n *\n * 능력을 복제하지 않는다. figure-service 가 이미 가진 진입점(`inspectSource` · `proposeFigureSteps` ·\n * 조회)을 레지스트리에 투영한다.\n *\n * ── 전부 조회·제안 전용이다 ─────────────────────────────────────────────────\n * 정본을 고치는 도구를 넣지 않는다. 형식의 설계가 그렇게 정해져 있다 — 어시스턴트는 **후보**를\n * 내고, 받을지 버릴지는 저작자가 정한다(`figure-propose-steps.ts`, ADR-0094). 되돌릴 수 없는 조작이 대화면으로\n * 새지 않으므로 전부 `kind: 'read'` 다.\n *\n * 저장은 저작면이 `updateFigure` 로 한다. 그 mutation 은 `figure:mutation` 이 지키고, 대화는\n * `ai-assistant:mutation` 이 지킨다 — 서로 다른 질문이라 서로 다른 권한이 지킨다. figure 가 board\n * 의 권한을 빌리지 않는다.\n *\n * ── No privilege here. The gate reads what the door declares ─────────────────────\n * Until 2026-09-18 each tool carried `privilege: { category: 'figure', ... }`. It matched the door's\n * directive then, and would drift the day the door changed its declaration — and the looser copy wins.\n * Now the gate reads the declaration of each door in `doors` from AUTH's table (ADR-0071 decision 2,\n * addendum). What stays here is **the doors it reaches**.\n *\n * ── 규율을 도구와 함께 보낸다 ───────────────────────────────────────────────\n * 도구 목록만으로는 「언제 반드시 불러야 하는지」를 모른다. twin 이 그 공백에서 사고를 냈다 —\n * 조치 요청에 도구를 부르지 않고 「제안해 두었습니다」라고만 답해, 사용자에게 **없는 버튼을 누르라고\n * 안내했다.** figure 도 똑같은 자리가 있다: 후보 화면(「지금 / 후보」 두 칸)은 **도구 호출 결과에서만**\n * 만들어진다. 문장으로는 아무 일도 일어나지 않는다.\n *\n * ── LLM 이 넘긴 id 를 믿지 않는다 ───────────────────────────────────────────\n * 사람이 목록에서 고르는 길에서는 드러나지 않지만, 모델은 대화 내용에 이끌려 임의의 id 를 넘길 수\n * 있다. 그래서 호출자 도메인 소속을 먼저 확인한다.\n */\nimport { randomUUID } from 'crypto'\nimport { ILike } from 'typeorm'\nimport {\n aiClientFor,\n registerToolCategory,\n type AIImageMediaType,\n type ToolAttachment,\n type ToolCallContext,\n type ToolCategory,\n type ToolImageAttachment,\n type ToolSpec\n} from '@things-factory/ai-client-base'\n\nimport { FIGURE_CONTEXT_BUDGET, figureViewOf, type FigureReadRequest } from './figure-context.js'\n\n/** How many figures a list without search names. */\nconst LIST_LIMIT = 200\n\n/*\n 서버 의존성은 lazy require 다. 등록은 부팅 초반에 평가되고 그때 typeorm DataSource 가 준비되지\n 않았을 수 있다(board-import · twin-ai 와 같은 정책).\n*/\nlet _deps: any | undefined\n\nfunction getDeps(): any {\n if (!_deps) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const shell = require('@things-factory/shell')\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const model = require('@hatiolab/figure-model')\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const entity = require('./figure.js')\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const format = require('./figure-format.js')\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const proposer = require('./figure-propose-steps.js')\n _deps = {\n getRepository: shell.getRepository,\n Figure: entity.Figure,\n /* The same doors a save and a release go through. The tool reads; it never saves. */\n inspectSource: format.inspectSource,\n parseSource: format.parseSource,\n figureCostOf: model.figureCostOf,\n figureScoreOf: model.figureScoreOf,\n proposeFigureSteps: proposer.proposeFigureSteps,\n isPlaceholderType: model.isPlaceholderType\n }\n }\n return _deps\n}\n\n/** 시험·검증 하네스 전용 주입 시임. 운영 경로에서 호출 금지. */\nexport function __setFigureToolDepsForTest(deps: any): void {\n _deps = deps\n}\n\nfunction requireDomainId(state: any): string {\n const id = state?.domain?.id\n if (!id) {\n // 도메인을 모르면 무엇을 읽어도 남의 것일 수 있다. 조용히 넘기지 않는다.\n throw new Error('domain context is missing — the figure tools cannot resolve tenant scope')\n }\n return id\n}\n\n/**\n * 이 피규어가 호출자 도메인 것인가.\n *\n * 모델이 넘긴 id 를 그대로 쓰지 않는다. 없으면 못 찾았다고 말한다 — 「권한이 없다」와 구별해\n * 알려 줄 것이 없다(다른 테넌트에 그 id 가 있다는 사실 자체가 알려 줄 것이 아니다).\n */\nasync function figureInDomain(figureId: string, domainId: string): Promise<any> {\n const { getRepository, Figure } = getDeps()\n const found = await getRepository(Figure).findOne({\n where: { id: figureId, domain: { id: domainId } }\n })\n if (!found) {\n throw new Error(`figure not found in this tenant: ${figureId}`)\n }\n return found\n}\n\n/** The form of a creation id: the row id a new figure's first save inserts it under (`figure-mutation.ts`). */\nconst CREATION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i\n\n/**\n * The figure a tool is about: by id, or by its type name, in the caller's domain. None named: none.\n *\n * A figure not saved yet is a subject too (ADR-0061 decision 3): the modeller names it by its creation id, which its first\n * save inserts the row under (ADR-0072 decision 6), so before that save there is no row. It is the figure open on that\n * screen and nothing else: the id the screen has open, with the draft the screen sent. What is read is that draft, put\n * through the save's door like any draft (`sourceForTool`); nothing the server holds is read for it.\n */\nasync function resolveFigureTarget(figureId: string | undefined, domainId: string, host: any): Promise<any> {\n if (!figureId) return undefined\n const { getRepository, Figure } = getDeps()\n const found =\n (await getRepository(Figure).findOne({ where: { id: figureId, domain: { id: domainId } } })) ??\n (await getRepository(Figure).findOne({ where: { type: figureId, domain: { id: domainId } } }))\n if (found) return found\n const draft = host?.draftSource\n if (CREATION_ID.test(figureId) && host?.figureId === figureId && draft && typeof draft === 'object') {\n return { id: figureId, name: typeof draft.name === 'string' ? draft.name : undefined, source: null }\n }\n throw new Error(`figure not found in this tenant: ${figureId}`)\n}\n\n/**\n * The source a tool reads: the draft on screen when the modeller has this figure open, else the stored one.\n *\n * The host context is the browser's, so it is no ground for access: the row is found in the domain first, and the\n * draft is put through the same door a save goes through before anything reads it.\n */\nconst isFigure = (source: any) => source?.version === 'figure-asset-1'\n\n/**\n * A revision is applied by the modeller on the version the model saw (ADR-0094), so only the figure open there can be\n * revised. Said as what is true, with what the assistant can do instead.\n */\nfunction figureNotOpen() {\n return {\n error: 'FIGURE_NOT_OPEN',\n message: 'A revision can be proposed only for the figure open in the modeller.',\n nextStep:\n 'Tell the person to open the figure in the modeller and ask again there. A new figure needs no open one: call proposeFigureCandidate with create: true.'\n }\n}\n\nfunction sourceForTool(row: any, host: any): { source: any; draft: boolean } {\n const draft = host?.figureId === row.id ? host?.draftSource : undefined\n if (!draft) return { source: row.source ? JSON.parse(row.source) : null, draft: false }\n\n if (typeof draft !== 'object' || Array.isArray(draft)) throw new Error('the unsaved draft is not a figure asset')\n const serialized = JSON.stringify(draft)\n /* Validity is the save door's (the kernel's 1 MiB); how much the model is shown is `figure-context`'s. */\n try {\n getDeps().parseSource(serialized)\n } catch (e: any) {\n const findings = Array.isArray(e?.findings) ? e.findings.map((one: any) => one.message).join(' · ') : String(e?.message ?? e)\n throw new Error(`the unsaved draft is invalid: ${findings}`)\n }\n return { source: draft, draft: true }\n}\n\n/** The finite numbers of an untrusted record, by name; none: undefined. */\nfunction numbersOf(record: any): Record<string, number> | undefined {\n if (!record || typeof record !== 'object' || Array.isArray(record)) return undefined\n const kept = Object.entries(record).filter((entry): entry is [string, number] => typeof entry[1] === 'number' && Number.isFinite(entry[1]))\n return kept.length ? Object.fromEntries(kept) : undefined\n}\n\n/**\n * What the person has in view on the open draft: the part selected and what the preview is trying (ADR-0097 §5.6\n * item 5). The model hears it only here, through a read (ADR-0061 decision 3). Told only when it was seen on the version\n * being read -- a selection from another version may name a part that is gone -- and a part only when the draft has it.\n */\nfunction focusOf(host: any, source: any): { selection?: { part: string }; trying?: { clips?: Record<string, number>; controls?: Record<string, number> } } {\n const onThisVersion = (seen: any) => typeof host?.context === 'string' && seen?.context === host.context && seen?.revision === host.revision\n const focus: ReturnType<typeof focusOf> = {}\n\n const part = host?.selection?.part\n const nodes = source?.document?.model?.nodes\n if (typeof part === 'string' && onThisVersion(host.selection) && Array.isArray(nodes) && nodes.some((node: any) => node?.id === part)) {\n focus.selection = { part }\n }\n\n if (onThisVersion(host?.trying)) {\n const clips = numbersOf(host.trying.clips)\n const controls = numbersOf(host.trying.controls)\n if (clips || controls) focus.trying = { ...(clips ? { clips } : {}), ...(controls ? { controls } : {}) }\n }\n return focus\n}\n\n/**\n * 무엇을 고치라는 것인지 대화면 문맥에서 해소한다.\n *\n * 모델이 대상을 안 줬으면 **저작면이 지금 열고 있는 피규어**이다. 사용자에게 식별자를 되묻지\n * 않는다 — 화면에 그 피규어가 떠 있는데 「어느 피규어입니까」를 묻는 것은 문맥을 안 읽은 것이다.\n */\nfunction figureIdFrom(args: any, host: any): string | undefined {\n const said = typeof args?.figureId === 'string' ? args.figureId.trim() : ''\n if (said) return said\n\n const open = typeof host?.figureId === 'string' ? host.figureId.trim() : ''\n if (open) return open\n\n return undefined\n}\n\nfunction missingFigureTarget() {\n return {\n error: 'FIGURE_TARGET_REQUIRED',\n message: 'No figure is open on this screen.',\n nextStep: 'For an existing figure, call listFigures and match the user’s requested name or type; ask which figure only if ambiguous. For a new figure, call proposeFigureCandidate with create: true and the user’s prompt. Do not invent an id or repeat this call without a target.'\n }\n}\n\nconst FIGURE_ID_ARG = {\n figureId: {\n type: 'string',\n description: 'The figure to read. Omit to read the one open in the modeller — with its unsaved changes, and also when it is a new figure not saved yet; the server fills it in, and you cannot see which it is. A figure not saved yet is readable only while it is open in the modeller. On the catalog nothing is open, so resolve the figure the person asked for with listFigures first.'\n }\n} as const\n\nconst PARTS_ARG = {\n parts: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Only for a figure too large to read whole (the answer then has `outline` and no `source`): the ids of the parts to read in full, from `outline.parts`. Omit to read the part selected.'\n },\n sections: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Only for a figure too large to read whole: JSON Pointers of sections to read, such as one named in `outline.omitted` or its `entries` (for example /document/capabilities/bindings/0).'\n }\n} as const\n\n/**\n * A figure too large to show whole, as the model reads it (ADR-0061 2026-10-16 decision 4): its outline and the parts\n * asked for. The full source stays here; what is measured is measured on it.\n */\nfunction partialRead(source: any, request: FigureReadRequest) {\n const view = figureViewOf(source, request)\n if (view.whole) return { source }\n return {\n outline: view.outline,\n partSources: view.parts,\n ...(Object.keys(view.sections ?? {}).length ? { sectionSources: view.sections } : {}),\n ...(view.notRead ? { notRead: view.notRead } : {}),\n note:\n `This figure is too large to read whole (${view.outline!.chars} characters; ${FIGURE_CONTEXT_BUDGET} are read at once), so this is its outline, the parts in partSources and the sections in sectionSources. ` +\n 'Read what a change touches with parts and sections, then pass the same to proposeFigureCandidate: only parts read in full may be changed, and nothing in a section in outline.omitted that was not read.'\n }\n}\n\n/** The parts the model named, as strings; anything else is dropped. */\nconst stringsOf = (list: unknown): string[] =>\n Array.isArray(list) ? list.filter((one: unknown): one is string => typeof one === 'string' && !!one.trim()).map((one: string) => one.trim()) : []\n\n/** An inspection whose findings would crowd the model's context, cut to the budget with how many there were. */\nfunction findingsWithinBudget(inspection: any) {\n const findings = Array.isArray(inspection?.findings) ? inspection.findings : []\n if (JSON.stringify(inspection).length <= FIGURE_CONTEXT_BUDGET) return inspection\n const head = JSON.stringify({ ...inspection, findings: [], truncated: { shown: findings.length, total: findings.length } }).length\n let room = FIGURE_CONTEXT_BUDGET - head\n const shown: any[] = []\n for (const finding of findings) {\n const cost = JSON.stringify(finding).length + 1\n if (cost > room) break\n shown.push(finding)\n room -= cost\n }\n return { ...inspection, findings: shown, truncated: { shown: shown.length, total: findings.length } }\n}\n\n/**\n * 도구 넷.\n *\n * 목록 · 정본 · 발행 판정 · 후보. 저작 대화에서 실제로 묻는 것이 그 넷이다 — 「무엇이 있나」\n * 「지금 어떻게 생겼나」 「발행이 왜 안 되나」 「이렇게 고쳐 봐」.\n */\nfunction figureToolSpecs(): ToolSpec[] {\n return [\n {\n kind: 'read',\n name: 'listFigures',\n /* 이 도메인의 피규어 목록 — 저장소를 직접 읽지만 같은 일을 하는 문은 이것이다. */\n doors: ['Query.figures'],\n description:\n 'Lists the figures in this tenant with their type names, states and part counts. ' +\n 'Call it before naming a type — type names are stored identifiers and must not be invented. ' +\n `Without search it lists the ${LIST_LIMIT} most recently changed; when there are more it says truncated, and a figure the person names may be among the rest - list again with search.`,\n schema: {\n type: 'object',\n properties: {\n search: {\n type: 'string',\n description: 'Part of a figure name or type name, in any case. Omit to list the most recently changed.'\n }\n }\n },\n builder: async (args: any, ctx: any) => {\n const domainId = requireDomainId(ctx?.state)\n const { getRepository, Figure } = getDeps()\n const search = typeof args?.search === 'string' ? args.search.trim() : ''\n const domain = { id: domainId }\n /* `_` and `%` in the words are LIKE wildcards: they can only widen what is found, never hide a match. */\n const where = search\n ? [\n { domain, name: ILike(`%${search}%`) },\n { domain, type: ILike(`%${search}%`) }\n ]\n : { domain }\n /* One more than is shown, to know whether there is more without counting the table. */\n const rows = await getRepository(Figure).find({ where, order: { updatedAt: 'DESC' }, take: LIST_LIMIT + 1 })\n const truncated = rows.length > LIST_LIMIT\n return {\n ...(truncated\n ? {\n truncated: true,\n note: `Only the ${LIST_LIMIT} most recently changed are listed. A figure not here may still exist: call listFigures again with search.`\n }\n : {}),\n figures: rows.slice(0, LIST_LIMIT).map((row: any) => ({\n id: row.id,\n type: row.type,\n name: row.name,\n state: row.state,\n score: row.score,\n triangles: row.triangles\n }))\n }\n }\n },\n {\n kind: 'read',\n name: 'getFigureSource',\n /* 저장된 피규어의 원본. **저장 전 초안**을 물으면 저장소에 갈 것이 없어 화면이 보낸 것을 그대로 돌려준다 —\n * 그 갈래에는 닿는 문이 없지만 `doors: []` 로 적지 않는다. 그러면 저장된 피규어를 읽는 권한 검사가 선언에서 사라진다. */\n doors: ['Query.figure'],\n description:\n 'Returns the source (the figure asset) of one figure, with its measured cost ' +\n '(triangles, part groups, and how many of it hold 60fps on one screen). Call it before proposing a revision — ' +\n 'revising without reading it means proposing against a guess. On the figure open in the modeller it also says what ' +\n 'the person has in view: `selection.part` is the part selected - \"this part\" or \"the selected one\" means it - and ' +\n '`trying` the clip and control values the preview is trying, which are not part of the figure. ' +\n 'A figure too large to read whole comes as `outline` (every part by name, shape and what it is fastened to) and ' +\n '`partSources` (the parts read in full) instead of `source`.',\n schema: { type: 'object', properties: { ...FIGURE_ID_ARG, ...PARTS_ARG } },\n builder: async (args: any, ctx: any) => {\n const domainId = requireDomainId(ctx?.state)\n const figureId = figureIdFrom(args, ctx?.host)\n const row = await resolveFigureTarget(figureId, domainId, ctx?.host)\n if (!row) return missingFigureTarget()\n\n const current = sourceForTool(row, ctx?.host)\n if (!current.source) {\n // 저장된 정본이 없는 상태가 실제로 있다(새로 만들고 저장 안 한 것). 지어내지 않는다.\n return { id: row.id, type: row.type, name: row.name, source: null, cost: null }\n }\n\n /* Measured as the catalogue measures it: triangles, draw groups, and its grade against one screen. */\n const { figureCostOf, figureScoreOf } = getDeps()\n /* What is in view belongs to the draft on screen; the stored source may be another figure than the one open. */\n const focus = current.draft ? focusOf(ctx?.host, current.source) : {}\n const asked = stringsOf(args?.parts)\n return {\n id: row.id,\n type: row.type,\n name: row.name,\n state: row.state,\n ...partialRead(current.source, { parts: asked.length ? asked : focus.selection ? [focus.selection.part] : [], sections: stringsOf(args?.sections) }),\n draft: current.draft,\n cost: figureCostOf(current.source),\n score: figureScoreOf(current.source) ?? null,\n ...focus\n }\n }\n },\n {\n kind: 'read',\n name: 'inspectFigure',\n /* 검사 결과 — 같은 일을 하는 문. */\n doors: ['Query.inspectFigure'],\n description:\n 'Says whether a figure may be released and, when it may not, what is wrong — each finding ' +\n 'carries why it is a problem and what to change. Call it when asked about releasing, or ' +\n 'when asked to fix a figure that will not release.',\n schema: { type: 'object', properties: { ...FIGURE_ID_ARG } },\n builder: async (args: any, ctx: any) => {\n const domainId = requireDomainId(ctx?.state)\n const figureId = figureIdFrom(args, ctx?.host)\n const row = await resolveFigureTarget(figureId, domainId, ctx?.host)\n if (!row) return missingFigureTarget()\n\n const current = sourceForTool(row, ctx?.host)\n const { inspectSource } = getDeps()\n /* Inspected whole, here; only what the model is told is held to its budget. */\n return { ...findingsWithinBudget(inspectSource(current.source ? JSON.stringify(current.source) : null, null, undefined, row.type, row.category)), draft: current.draft }\n }\n },\n {\n kind: 'read',\n name: 'proposeFigureCandidate',\n /* 후보 생성 — 저장은 하지 않지만 같은 문의 권한을 쓴다. */\n doors: ['Mutation.proposeFigure'],\n description:\n 'Asks for a proposal: the modeller commands that make a new figure or revise the one open in the modeller. ' +\n 'Returns the commands with the score and cost of the figure they make. NOTHING IS SAVED — the author applies ' +\n 'the proposal in the modeller as one step, or leaves it. This is the only way a proposal reaches the screen.',\n schema: {\n type: 'object',\n properties: {\n prompt: {\n type: 'string',\n description: 'What to make or change, in the words the author used, with the sizes as they said them: do not turn sizes into axes.'\n },\n figureId: {\n type: 'string',\n description: 'Revise this figure; it must be the one open in the modeller. Omit to revise the open one; pass null to create anew.'\n },\n name: {\n type: 'string',\n description: 'The name a person reads for a new figure.'\n },\n create: {\n type: 'boolean',\n description: 'True to create rather than revise, even with a figure open.'\n },\n parts: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Only for a figure too large to read whole: the parts this change touches, read first with getFigureSource parts. Only these and the part selected may be changed; new parts may be added and fastened to any part.'\n },\n sections: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Only for a figure too large to read whole: JSON Pointers of the sections in outline.omitted this change touches, read first with getFigureSource sections. Nothing else in those sections may be changed.'\n }\n },\n required: ['prompt']\n },\n builder: async (args: any, ctx: ToolCallContext) => {\n const domainId = requireDomainId(ctx?.state)\n const prompt = typeof args?.prompt === 'string' ? args.prompt.trim() : ''\n if (!prompt) throw new Error('prompt is required: there is nothing to ask for')\n\n /*\n 고치는 것인지 만드는 것인지를 **문맥에서 정한다.** 열린 피규어가 있으면 고치는 것이 기본이고,\n 모델이 `create` 를 켜면 만드는 것이다. 이것을 모델의 짐작에 맡기면 열려 있는 피규어를 덮어쓰는\n 후보가 온다.\n\n 고치는 제안은 모델러가 **요청 당시의 판(context · revision)** 위에 한 단계로 적용한다(ADR-0094).\n 그래서 고칠 수 있는 것은 모델러에 열린 피규어뿐이고, 그 판을 문맥이 함께 실어 와야 한다.\n */\n const host = ctx?.host\n const create = args?.create === true || args?.figureId === null\n let base: unknown\n let figureId: string | undefined\n let focus: ReturnType<typeof focusOf> | undefined\n if (!create) {\n const said = typeof args?.figureId === 'string' ? args.figureId.trim() : ''\n const open = typeof host?.figureId === 'string' ? host.figureId.trim() : ''\n if (said && said !== open) {\n await figureInDomain(said, domainId)\n return figureNotOpen()\n }\n if (!open) return missingFigureTarget()\n const row = await resolveFigureTarget(open, domainId, host)\n if (!row) return missingFigureTarget()\n const current = sourceForTool(row, host)\n base = current.source ?? undefined\n if (!isFigure(base)) return figureNotOpen()\n if (typeof host?.context !== 'string' || !Number.isInteger(host?.revision)) return figureNotOpen()\n figureId = open\n /* \"Make this one bigger\": the part selected is what the request points at. */\n if (current.draft) focus = focusOf(host, base)\n }\n\n /*\n The pictures the person sent with this turn, as the server checked them (ADR-0061, 2026-10-16 decision 2) --\n every one, in the order attached. Never from the host context: the client fills it.\n */\n const images = (ctx?.attachments ?? [])\n .filter((file: ToolAttachment): file is ToolImageAttachment => file.kind === 'image')\n .map(file => ({ data: file.data, mediaType: file.mediaType as AIImageMediaType }))\n\n const { proposeFigureSteps } = getDeps()\n let result: any\n try {\n result = await proposeFigureSteps({\n /* The agent of this conversation's turn - the one the person picked, or the domain default. */\n client: await aiClientFor({\n domain: ctx?.state?.domain,\n user: ctx?.state?.user,\n agentId: ctx?.state?.aiAgentId,\n modeKind: ctx?.mode?.kind\n }),\n prompt,\n base,\n name: typeof args?.name === 'string' && args.name.trim() ? args.name.trim() : undefined,\n ...(images.length ? { images } : {}),\n ...(focus && Object.keys(focus).length ? { focus } : {}),\n ...(!create && (stringsOf(args?.parts).length || stringsOf(args?.sections).length)\n ? { read: { parts: stringsOf(args?.parts), sections: stringsOf(args?.sections) } }\n : {})\n })\n } catch (error) {\n /*\n * 세 번 거절된 끝의 사유를 ProposeFigureFailure.reasons 에만 두면 agentic-loop 은 「만들지 못했습니다」만\n * 받아 화면에는 「응답이 비어있습니다」가 된다. 다시 시도할 수 있는 말로 경계를 넘긴다.\n * 다른 예외(권한·통신)는 원문을 보존한다.\n */\n const reasons = Array.isArray((error as any)?.reasons) ? (error as any).reasons : []\n if (reasons.length > 0) throw new Error([(error as Error).message, ...reasons].join('\\n'))\n throw error\n }\n\n /*\n **`proposed: true` 가 카드를 만든다.** 이 표시가 없으면 제안은 도구 추적 안에 묻히고 화면에는\n 아무것도 생기지 않는다. 카드의 실행 단추가 figure-ui 의 처리기에 넘기고, 처리기가 모델러에 명령\n 목록을 한 단계로 적용한다. `args` 는 같은 제안을 두 번 세지 않기 위한 열쇠의 일부다.\n */\n const name = result.source.name || 'Figure'\n /* The card is read by a person, so the server writes it in the request's language (ADR-0061, 2026-10-16 decision 1). */\n const t = ctx.t\n return {\n proposed: true,\n /*\n The proposal's own name, given once here (ADR-0097 §5.6 item 5; AI lane, 09-27): the dock keys its card by\n it, a new figure made from it is created under it (the row id), and a save records it -- so what became of\n it can be asked after a reload, and the same proposal never makes two figures.\n */\n key: randomUUID(),\n icon: 'view_in_ar',\n label: create\n ? t('figure.proposal.label-create', { name, defaultValue: 'Make {name}' })\n : t('figure.proposal.label-revise', { name, defaultValue: 'Revise {name}' }),\n reason: t('figure.proposal.reason', {\n steps: result.steps.length,\n grade: result.score?.grade ?? '-',\n triangles: result.cost.triangles,\n attempts: result.attempts,\n defaultValue: '{steps} commands · grade {grade} · {triangles} triangles · made in {attempts} tries'\n }),\n args: { prompt, figureId, create },\n create,\n figureId,\n context: create ? undefined : host.context,\n revision: create ? undefined : host.revision,\n steps: result.steps,\n score: result.score,\n cost: result.cost,\n attempts: result.attempts\n }\n }\n }\n ] as ToolSpec[]\n}\n\n/**\n * 등록 — 부팅 시 1회.\n *\n * 범주가 하나다. twin 은 관찰과 생성을 둘로 갈랐는데(운영 협의에 생성 도구가 들려 있으면 대화의\n * 성격이 흐려진다), figure 의 대화면은 저작면 하나뿐이고 그 자리에서 읽기와 후보 요청이 함께 필요하다.\n * 대화면이 늘면 그때 가른다.\n */\nexport function registerFigureToolCategories(): void {\n const authoring: ToolCategory = {\n name: 'figure-authoring',\n description: 'Reads the source, cost and release verdict of the figure being authored, and proposes changes (nothing is saved).',\n guidance: [\n '- **For a request to make or change a figure, always call `proposeFigureCandidate`.** A proposal exists only as the result of that call.',\n ' Writing \"I made a proposal\" or \"press apply\" without the call is **false**: no card appears, and the person looks for a button that does not exist.',\n ' A proposal is a list of modeller commands. The modeller applies it as one step only when the person runs it from the dock card, and one undo takes it all back. Do not say the figure has changed before that.',\n ' A revision can be proposed only for the figure open in the modeller. Say what the result\\'s `steps` do as they are; do not invent changes the commands do not make.',\n '- Never save the source yourself. Propose; the author decides on the screen whether to take it.',\n '- In the prompt to `proposeFigureCandidate`, pass the person\\'s words as they are: their sizes, counts and names. Do not turn them into axes; the writer knows the figure\\'s axes. When you name an axis to the person, the figure\\'s Y is up.',\n '- **For a request to change a figure, call `getFigureSource` first.** Revising without reading proposes against a guess, and a renamed part breaks the bindings of the boards it is already placed on.',\n '- On the catalog nothing is open. To read an existing figure, find the id of the name or type the person said with `listFigures`; ask which figure only when it is ambiguous. To revise an existing figure, tell the person to open it in the modeller and ask there. For a new figure, do not read existing sources: call `proposeFigureCandidate` with create: true.',\n '- Do not invent type names; check them with `listFigures`. **A type name is a stored identifier**, and boards find the figure by it. A new figure\\'s type is set by a person at its first save.',\n '- When asked why a figure will not release, call `inspectFigure`. Do not say it can be released without its verdict.',\n ' Each finding carries **why it is a problem and what to change**. Pass it on as it is; a summary makes the author look again for which axis of which part to fix.',\n '- For weight or triangle counts, use `cost` from `getFigureSource`. Do not estimate.'\n ].join('\\n'),\n specs: figureToolSpecs()\n }\n\n registerToolCategory(authoring)\n}\n"]}
@@ -23,8 +23,8 @@ export declare class NewFigure {
23
23
  *
24
24
  * `type` 은 **한 번도 발행되지 않은 초안에서만** 바뀐다(ADR-0063 결정 4). 저장되는 식별자라
25
25
  * 발행된 뒤에 바꾸면 이미 배치된 보드가 타입을 못 찾아 오류 없이 빈 화면이 된다. 발행 전에는
26
- * 그 도형을 가리키는 도면이 있을 수 없다 — 도면은 최신 발행판을 그리므로 발행된 적 없는
27
- * 도형은 그려질 자리가 없다.
26
+ * 그 피규어를 가리키는 도면이 있을 수 없다 — 도면은 최신 발행판을 그리므로 발행된 적 없는
27
+ * 피규어는 그려질 자리가 없다.
28
28
  *
29
29
  * 닫아 두었더니 저작자가 이름을 한 번도 정하지 못했다. 새 Figure 에는 기계가 지은 이름이
30
30
  * 붙고(`FIGURE_MU6RJH47`) 칸에 자물쇠가 걸려서, 그 이름이 그대로 도면에 적히는 이름이 됐다.
@@ -63,8 +63,8 @@ exports.NewFigure = NewFigure = tslib_1.__decorate([
63
63
  *
64
64
  * `type` 은 **한 번도 발행되지 않은 초안에서만** 바뀐다(ADR-0063 결정 4). 저장되는 식별자라
65
65
  * 발행된 뒤에 바꾸면 이미 배치된 보드가 타입을 못 찾아 오류 없이 빈 화면이 된다. 발행 전에는
66
- * 그 도형을 가리키는 도면이 있을 수 없다 — 도면은 최신 발행판을 그리므로 발행된 적 없는
67
- * 도형은 그려질 자리가 없다.
66
+ * 그 피규어를 가리키는 도면이 있을 수 없다 — 도면은 최신 발행판을 그리므로 발행된 적 없는
67
+ * 피규어는 그려질 자리가 없다.
68
68
  *
69
69
  * 닫아 두었더니 저작자가 이름을 한 번도 정하지 못했다. 새 Figure 에는 기계가 지은 이름이
70
70
  * 붙고(`FIGURE_MU6RJH47`) 칸에 자물쇠가 걸려서, 그 이름이 그대로 도면에 적히는 이름이 됐다.
@@ -1 +1 @@
1
- {"version":3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Y,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,mEAAmE,EAAE,CAAC;;8CAChF;AAGZ;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,6BAAW,EAAE,EAAE,WAAW,EAAE,uEAAuE,EAAE,CAAC;;iDACrG;2BALL,gBAAgB;IAD5B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;GACzE,gBAAgB,CAM5B","sourcesContent":["import { FigureReplacedDraft } from './figure-replaced-draft.js'\nimport { Field, InputType, Int, ObjectType } from 'type-graphql'\nimport { GraphQLJSON } from 'graphql-scalars'\n\nimport { Figure } from './figure.js'\n\n/**\n * 새 Figure.\n *\n * `score`·`triangles`·`groups` 는 **받지 않는다.** 서버가 `source` 에서 계산한다 —\n * 받으면 거짓이 들어오고 목록이 실물과 다른 것을 보여 준다.\n */\n@InputType({ description: 'Input for creating a new figure.' })\nexport class NewFigure {\n @Field({ description: 'Component type name. Immutable once created, unique per domain.' })\n type: string\n\n @Field({ description: 'Display name shown to authors.' })\n name: string\n\n @Field({ nullable: true, description: 'A detailed description for the figure.' })\n description?: string\n\n @Field({ nullable: true, description: 'Classification code used to group figures in the palette.' })\n category?: string\n\n @Field(type => [String], { nullable: true, description: 'Free-form tags. A figure may carry several.' })\n tags?: string[]\n\n @Field({ description: 'The figure asset JSON (figure-asset-1).' })\n source: string\n\n @Field({ nullable: true, description: 'JSON definition of the master-data fields an instance carries.' })\n properties?: string\n\n @Field({ nullable: true, description: \"Lifecycle state — defaults to 'draft'.\" })\n state?: 'draft' | 'released'\n\n @Field({ nullable: true, description: 'A base64 encoded thumbnail image.' })\n thumbnail?: string\n\n @Field({ nullable: true, description: \"The domain's namespace to create it under; the domain's default when none.\" })\n namespace?: string\n}\n\n/**\n * 수정.\n *\n * `type` 은 **한 번도 발행되지 않은 초안에서만** 바뀐다(ADR-0063 결정 4). 저장되는 식별자라\n * 발행된 뒤에 바꾸면 이미 배치된 보드가 타입을 못 찾아 오류 없이 빈 화면이 된다. 발행 전에는\n * 그 도형을 가리키는 도면이 있을 수 없다 — 도면은 최신 발행판을 그리므로 발행된 적 없는\n * 도형은 그려질 자리가 없다.\n *\n * 닫아 두었더니 저작자가 이름을 한 번도 정하지 못했다. 새 Figure 에는 기계가 지은 이름이\n * 붙고(`FIGURE_MU6RJH47`) 칸에 자물쇠가 걸려서, 그 이름이 그대로 도면에 적히는 이름이 됐다.\n */\n@InputType({ description: 'Input for updating an existing figure. `type` is accepted only while the figure has never been released.' })\nexport class FigurePatch {\n @Field({ nullable: true, description: 'The stored identifier. Accepted only before the first release; rejected once a version exists.' })\n type?: string\n\n @Field({ nullable: true, description: 'The new display name.' })\n name?: string\n\n @Field({ nullable: true, description: 'The new description.' })\n description?: string\n\n /* 언어별 표시 이름. 안 준 것은 그대로, `{}` 는 전부 지운다. */\n @Field(type => GraphQLJSON, { nullable: true, description: 'Display names by language. {} clears them; omitting the field leaves them.' })\n names?: Record<string, string>\n\n @Field({ nullable: true, description: 'The new classification code.' })\n category?: string\n\n /*\n 빈 배열과 안 준 것을 가른다. `undefined` 는 「건드리지 않는다」, `[]` 는 「전부 지운다」다.\n 둘을 뭉개면 태그를 다 지우려는 저작자가 지울 방법을 잃는다.\n */\n @Field(type => [String], { nullable: true, description: 'The new tags. An empty list clears them; omitting the field leaves them.' })\n tags?: string[]\n\n @Field({ nullable: true, description: 'The new figure asset JSON (figure-asset-1).' })\n source?: string\n\n @Field({ nullable: true, description: 'The new master-data field definition.' })\n properties?: string\n\n /*\n `state` 는 여기 없다 — **상태는 저장이 정하지 않는다.**\n\n 발행은 `releaseFigure` 가 한다. 저장으로 상태를 바꿀 수 있게 두면 발행된 판을 덮어쓰면서 같은\n 판 번호로 판본을 또 뜨게 되고(유니크 충돌), 무엇이 약속된 판인지도 흐려진다. board 도 같다.\n */\n\n @Field({ nullable: true, description: 'A base64 encoded thumbnail image.' })\n thumbnail?: string\n}\n\n@ObjectType({ description: 'A paginated list of figures.' })\nexport class FigureList {\n @Field(type => [Figure], { description: 'The figures on this page.' })\n items: Figure[]\n\n @Field(type => Int, { description: 'Total number of figures matching the query.' })\n total: number\n}\n\n/**\n * 검증 결과 한 줄.\n *\n * 정본 형식의 검증은 `@hatiolab/figure-model` 이 두 단계로 나눈다 — `errors` 는\n * 막고, `violations` 는 알린다. 그 경계를 서버가 다시 정하지 않는다.\n */\n@ObjectType({ description: 'One validation finding from figure-model.' })\nexport class FigureFinding {\n @Field({ description: 'Stable code from figure-model (ERROR_CODES / VIOLATION_CODES).' })\n code: string\n\n @Field({ description: 'Human-readable message.' })\n message: string\n\n @Field({ nullable: true, description: 'Path within the source that the finding points at.' })\n at?: string\n}\n\n/**\n * 저장 결과.\n *\n * `violations` 가 있어도 저장은 된다 — 막는 것과 알리는 것을 가른다. 화면이\n * 이것을 그대로 보여 줘야 한다. 조용히 버리면 저작자가 모른다.\n */\n@ObjectType({ description: 'Result of saving a figure, carrying non-blocking violations.' })\nexport class FigureSaveResult {\n @Field(type => Figure, { description: 'The saved figure.' })\n figure: Figure\n\n @Field(type => [FigureFinding], { description: 'Non-blocking findings. The save succeeded despite these.' })\n violations: FigureFinding[]\n}\n\n/** An AI proposal saved into a figure, with the figure's names as they are now (ADR-0097 §5.6 item 5). */\n@ObjectType({ description: 'A figure an AI proposal was saved into.' })\nexport class FigureProposalOutcome {\n @Field({ description: 'The figure it was saved into.' })\n figureId: string\n\n @Field({ nullable: true, description: \"The figure's type name now.\" })\n type?: string\n\n @Field({ nullable: true, description: \"The figure's display name now.\" })\n name?: string\n\n @Field({ nullable: true, description: 'When the save that held it was made.' })\n recordedAt?: Date\n}\n\n/** A revert's outcome: the figure as it now is, and the draft kept for it (ADR-0097 §5.6). */\n@ObjectType({ description: 'The result of a revert, or of an undo of one.' })\nexport class FigureRevertResult {\n @Field(type => Figure, { description: 'The figure, as it now is.' })\n figure: Figure\n\n @Field(type => [FigureFinding], { description: 'Non-blocking findings on the source written.' })\n violations: FigureFinding[]\n\n @Field(type => FigureReplacedDraft, { description: 'The draft kept for this revert -- or, for an undo, the one brought back.' })\n kept: FigureReplacedDraft\n}\n\n/**\n * 발행 판정 한 줄.\n *\n * `FigureFinding` 과 칸이 겹치지만 **`blocking` 이 하나 더 있다.** 저장 쪽 발견은 정의상 막지 않는\n * 것들이라 그 칸이 필요 없었다. 발행 판정은 막는 것과 알리는 것을 함께 내므로, 어느 쪽인지를 값이\n * 스스로 말해야 한다 — 코드를 보고 화면이 다시 분류하면 규칙이 두 벌이 된다.\n */\n@ObjectType({ description: 'One finding from the release gate.' })\nexport class FigureGateFinding {\n @Field({ description: 'Stable code of the gate finding, for example parts-off-placement-face or parts-split-on-resize.' })\n code: string\n\n @Field({ description: 'Human-readable message.' })\n message: string\n\n @Field({ nullable: true, description: 'Why this is a problem — what a person sees when it happens.' })\n why?: string\n\n @Field({ nullable: true, description: 'What to change, naming the part and the value.' })\n how?: string\n\n @Field({ nullable: true, description: 'Where it points: part names that came apart, or a path in the source.' })\n at?: string\n\n @Field({ description: 'True when this finding blocks the release.' })\n blocking: boolean\n}\n\n/**\n * 발행 판정.\n *\n * 화면이 **발행을 누르기 전에** 물어보는 자리다. 눌러 보고 거절당하는 것으로 알게 되면, 무엇을\n * 고쳐야 하는지 모른 채 단추만 두드리게 된다.\n */\n@ObjectType({ description: 'Whether a figure may be released, and why not.' })\nexport class FigureInspection {\n @Field({ description: 'True when at least one finding blocks the release.' })\n blocked: boolean\n\n @Field(type => [FigureGateFinding], { description: 'Findings, blocking and advisory together.' })\n findings: FigureGateFinding[]\n}\n\n/** A GLB kept for mesh parts (ADR-0129): its hash, and what it holds as the upload read it. */\n@ObjectType({ description: 'A GLB kept for mesh parts: its hash and what it holds.' })\nexport class FigureMeshUpload {\n @Field({ description: \"The file's SHA-256, lower-case hex: what a mesh part names it by.\" })\n hash: string\n\n @Field(type => GraphQLJSON, { description: 'Bounds in mm, triangles, primitives and nodes, as read from the file.' })\n summary: unknown\n}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B;CAM5B,CAAA;AANY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,mEAAmE,EAAE,CAAC;;8CAChF;AAGZ;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,6BAAW,EAAE,EAAE,WAAW,EAAE,uEAAuE,EAAE,CAAC;;iDACrG;2BALL,gBAAgB;IAD5B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;GACzE,gBAAgB,CAM5B","sourcesContent":["import { FigureReplacedDraft } from './figure-replaced-draft.js'\nimport { Field, InputType, Int, ObjectType } from 'type-graphql'\nimport { GraphQLJSON } from 'graphql-scalars'\n\nimport { Figure } from './figure.js'\n\n/**\n * 새 Figure.\n *\n * `score`·`triangles`·`groups` 는 **받지 않는다.** 서버가 `source` 에서 계산한다 —\n * 받으면 거짓이 들어오고 목록이 실물과 다른 것을 보여 준다.\n */\n@InputType({ description: 'Input for creating a new figure.' })\nexport class NewFigure {\n @Field({ description: 'Component type name. Immutable once created, unique per domain.' })\n type: string\n\n @Field({ description: 'Display name shown to authors.' })\n name: string\n\n @Field({ nullable: true, description: 'A detailed description for the figure.' })\n description?: string\n\n @Field({ nullable: true, description: 'Classification code used to group figures in the palette.' })\n category?: string\n\n @Field(type => [String], { nullable: true, description: 'Free-form tags. A figure may carry several.' })\n tags?: string[]\n\n @Field({ description: 'The figure asset JSON (figure-asset-1).' })\n source: string\n\n @Field({ nullable: true, description: 'JSON definition of the master-data fields an instance carries.' })\n properties?: string\n\n @Field({ nullable: true, description: \"Lifecycle state — defaults to 'draft'.\" })\n state?: 'draft' | 'released'\n\n @Field({ nullable: true, description: 'A base64 encoded thumbnail image.' })\n thumbnail?: string\n\n @Field({ nullable: true, description: \"The domain's namespace to create it under; the domain's default when none.\" })\n namespace?: string\n}\n\n/**\n * 수정.\n *\n * `type` 은 **한 번도 발행되지 않은 초안에서만** 바뀐다(ADR-0063 결정 4). 저장되는 식별자라\n * 발행된 뒤에 바꾸면 이미 배치된 보드가 타입을 못 찾아 오류 없이 빈 화면이 된다. 발행 전에는\n * 그 피규어를 가리키는 도면이 있을 수 없다 — 도면은 최신 발행판을 그리므로 발행된 적 없는\n * 피규어는 그려질 자리가 없다.\n *\n * 닫아 두었더니 저작자가 이름을 한 번도 정하지 못했다. 새 Figure 에는 기계가 지은 이름이\n * 붙고(`FIGURE_MU6RJH47`) 칸에 자물쇠가 걸려서, 그 이름이 그대로 도면에 적히는 이름이 됐다.\n */\n@InputType({ description: 'Input for updating an existing figure. `type` is accepted only while the figure has never been released.' })\nexport class FigurePatch {\n @Field({ nullable: true, description: 'The stored identifier. Accepted only before the first release; rejected once a version exists.' })\n type?: string\n\n @Field({ nullable: true, description: 'The new display name.' })\n name?: string\n\n @Field({ nullable: true, description: 'The new description.' })\n description?: string\n\n /* 언어별 표시 이름. 안 준 것은 그대로, `{}` 는 전부 지운다. */\n @Field(type => GraphQLJSON, { nullable: true, description: 'Display names by language. {} clears them; omitting the field leaves them.' })\n names?: Record<string, string>\n\n @Field({ nullable: true, description: 'The new classification code.' })\n category?: string\n\n /*\n 빈 배열과 안 준 것을 가른다. `undefined` 는 「건드리지 않는다」, `[]` 는 「전부 지운다」다.\n 둘을 뭉개면 태그를 다 지우려는 저작자가 지울 방법을 잃는다.\n */\n @Field(type => [String], { nullable: true, description: 'The new tags. An empty list clears them; omitting the field leaves them.' })\n tags?: string[]\n\n @Field({ nullable: true, description: 'The new figure asset JSON (figure-asset-1).' })\n source?: string\n\n @Field({ nullable: true, description: 'The new master-data field definition.' })\n properties?: string\n\n /*\n `state` 는 여기 없다 — **상태는 저장이 정하지 않는다.**\n\n 발행은 `releaseFigure` 가 한다. 저장으로 상태를 바꿀 수 있게 두면 발행된 판을 덮어쓰면서 같은\n 판 번호로 판본을 또 뜨게 되고(유니크 충돌), 무엇이 약속된 판인지도 흐려진다. board 도 같다.\n */\n\n @Field({ nullable: true, description: 'A base64 encoded thumbnail image.' })\n thumbnail?: string\n}\n\n@ObjectType({ description: 'A paginated list of figures.' })\nexport class FigureList {\n @Field(type => [Figure], { description: 'The figures on this page.' })\n items: Figure[]\n\n @Field(type => Int, { description: 'Total number of figures matching the query.' })\n total: number\n}\n\n/**\n * 검증 결과 한 줄.\n *\n * 정본 형식의 검증은 `@hatiolab/figure-model` 이 두 단계로 나눈다 — `errors` 는\n * 막고, `violations` 는 알린다. 그 경계를 서버가 다시 정하지 않는다.\n */\n@ObjectType({ description: 'One validation finding from figure-model.' })\nexport class FigureFinding {\n @Field({ description: 'Stable code from figure-model (ERROR_CODES / VIOLATION_CODES).' })\n code: string\n\n @Field({ description: 'Human-readable message.' })\n message: string\n\n @Field({ nullable: true, description: 'Path within the source that the finding points at.' })\n at?: string\n}\n\n/**\n * 저장 결과.\n *\n * `violations` 가 있어도 저장은 된다 — 막는 것과 알리는 것을 가른다. 화면이\n * 이것을 그대로 보여 줘야 한다. 조용히 버리면 저작자가 모른다.\n */\n@ObjectType({ description: 'Result of saving a figure, carrying non-blocking violations.' })\nexport class FigureSaveResult {\n @Field(type => Figure, { description: 'The saved figure.' })\n figure: Figure\n\n @Field(type => [FigureFinding], { description: 'Non-blocking findings. The save succeeded despite these.' })\n violations: FigureFinding[]\n}\n\n/** An AI proposal saved into a figure, with the figure's names as they are now (ADR-0097 §5.6 item 5). */\n@ObjectType({ description: 'A figure an AI proposal was saved into.' })\nexport class FigureProposalOutcome {\n @Field({ description: 'The figure it was saved into.' })\n figureId: string\n\n @Field({ nullable: true, description: \"The figure's type name now.\" })\n type?: string\n\n @Field({ nullable: true, description: \"The figure's display name now.\" })\n name?: string\n\n @Field({ nullable: true, description: 'When the save that held it was made.' })\n recordedAt?: Date\n}\n\n/** A revert's outcome: the figure as it now is, and the draft kept for it (ADR-0097 §5.6). */\n@ObjectType({ description: 'The result of a revert, or of an undo of one.' })\nexport class FigureRevertResult {\n @Field(type => Figure, { description: 'The figure, as it now is.' })\n figure: Figure\n\n @Field(type => [FigureFinding], { description: 'Non-blocking findings on the source written.' })\n violations: FigureFinding[]\n\n @Field(type => FigureReplacedDraft, { description: 'The draft kept for this revert -- or, for an undo, the one brought back.' })\n kept: FigureReplacedDraft\n}\n\n/**\n * 발행 판정 한 줄.\n *\n * `FigureFinding` 과 칸이 겹치지만 **`blocking` 이 하나 더 있다.** 저장 쪽 발견은 정의상 막지 않는\n * 것들이라 그 칸이 필요 없었다. 발행 판정은 막는 것과 알리는 것을 함께 내므로, 어느 쪽인지를 값이\n * 스스로 말해야 한다 — 코드를 보고 화면이 다시 분류하면 규칙이 두 벌이 된다.\n */\n@ObjectType({ description: 'One finding from the release gate.' })\nexport class FigureGateFinding {\n @Field({ description: 'Stable code of the gate finding, for example parts-off-placement-face or parts-split-on-resize.' })\n code: string\n\n @Field({ description: 'Human-readable message.' })\n message: string\n\n @Field({ nullable: true, description: 'Why this is a problem — what a person sees when it happens.' })\n why?: string\n\n @Field({ nullable: true, description: 'What to change, naming the part and the value.' })\n how?: string\n\n @Field({ nullable: true, description: 'Where it points: part names that came apart, or a path in the source.' })\n at?: string\n\n @Field({ description: 'True when this finding blocks the release.' })\n blocking: boolean\n}\n\n/**\n * 발행 판정.\n *\n * 화면이 **발행을 누르기 전에** 물어보는 자리다. 눌러 보고 거절당하는 것으로 알게 되면, 무엇을\n * 고쳐야 하는지 모른 채 단추만 두드리게 된다.\n */\n@ObjectType({ description: 'Whether a figure may be released, and why not.' })\nexport class FigureInspection {\n @Field({ description: 'True when at least one finding blocks the release.' })\n blocked: boolean\n\n @Field(type => [FigureGateFinding], { description: 'Findings, blocking and advisory together.' })\n findings: FigureGateFinding[]\n}\n\n/** A GLB kept for mesh parts (ADR-0129): its hash, and what it holds as the upload read it. */\n@ObjectType({ description: 'A GLB kept for mesh parts: its hash and what it holds.' })\nexport class FigureMeshUpload {\n @Field({ description: \"The file's SHA-256, lower-case hex: what a mesh part names it by.\" })\n hash: string\n\n @Field(type => GraphQLJSON, { description: 'Bounds in mm, triangles, primitives and nodes, as read from the file.' })\n summary: unknown\n}\n"]}
@@ -5,7 +5,7 @@ import { Domain } from '@things-factory/shell';
5
5
  *
6
6
  * `Board` 를 준용한다. 다른 점만 주석으로 적는다.
7
7
  *
8
- * ## 무엇을 담나 — 도형 자산이다, 씬 모델이 아니다
8
+ * ## 무엇을 담나 — 피규어 자산이다, 씬 모델이 아니다
9
9
  *
10
10
  * 형식은 `@hatiolab/figure-model` 이 정한다(`figure-asset-1`). 씬 컴포넌트 트리를 담지 않는다.
11
11
  * 컴파일한 것도 저장하지 않는다 — 원본에서 파생되므로 소비하는 쪽이 커널로 컴파일한다. 저장하면 원본과 갈린다.
@@ -52,7 +52,7 @@ export declare class Figure {
52
52
  /**
53
53
  * 분류 하나. **팔레트에서 묶어 보이는 기준이다.**
54
54
  *
55
- * 도형 하나에 하나뿐이다 — 팔레트는 목록을 한 벌로 나눠 보여 주므로, 한 도형이 두 묶음에
55
+ * 피규어 하나에 하나뿐이다 — 팔레트는 목록을 한 벌로 나눠 보여 주므로, 한 피규어가 두 묶음에
56
56
  * 동시에 있으면 저작자가 같은 것을 두 번 만난다.
57
57
  */
58
58
  category?: string;
@@ -12,7 +12,7 @@ const shell_1 = require("@things-factory/shell");
12
12
  *
13
13
  * `Board` 를 준용한다. 다른 점만 주석으로 적는다.
14
14
  *
15
- * ## 무엇을 담나 — 도형 자산이다, 씬 모델이 아니다
15
+ * ## 무엇을 담나 — 피규어 자산이다, 씬 모델이 아니다
16
16
  *
17
17
  * 형식은 `@hatiolab/figure-model` 이 정한다(`figure-asset-1`). 씬 컴포넌트 트리를 담지 않는다.
18
18
  * 컴파일한 것도 저장하지 않는다 — 원본에서 파생되므로 소비하는 쪽이 커널로 컴파일한다. 저장하면 원본과 갈린다.
@@ -1 +1 @@
1
- {"version":3,"file":"figure.js","sourceRoot":"","sources":["../../../server/service/figure/figure.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAgE;AAChE,qDAA6C;AAE7C,yDAAgD;AAChD,iDAA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E,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qEAAqE,EAAE,CAAC;GACtF,MAAM,CA0MlB","sourcesContent":["import {\n Column,\n CreateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { Field, Float, ID, Int, ObjectType } from 'type-graphql'\nimport { GraphQLJSON } from 'graphql-scalars'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, longTextColumn } from '@things-factory/shell'\n\n/**\n * Figure — 저작된 3D 컴포넌트 한 종류.\n *\n * `Board` 를 준용한다. 다른 점만 주석으로 적는다.\n *\n * ## 무엇을 담나 — 도형 자산이다, 씬 모델이 아니다\n *\n * 형식은 `@hatiolab/figure-model` 이 정한다(`figure-asset-1`). 씬 컴포넌트 트리를 담지 않는다.\n * 컴파일한 것도 저장하지 않는다 — 원본에서 파생되므로 소비하는 쪽이 커널로 컴파일한다. 저장하면 원본과 갈린다.\n *\n * 그래서 부품·움직임·자리 같은 것을 컬럼으로 두지 않는다 — 전부 `source` 안에 이미 있다. 두 벌이면 갈린다.\n *\n * 설계: `docs/design/figure-modules.md` §2\n */\n@Entity()\n@Index('ix_figure_1', (figure: Figure) => [figure.domain, figure.type], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@Index('ix_figure_2', (figure: Figure) => [figure.domain, figure.category])\n@ObjectType({ description: 'An authored 3D component type — its figure asset plus its metadata.' })\nexport class Figure {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { nullable: true, description: 'Unique identifier for the figure.' })\n readonly id?: string\n\n /**\n * 발행된 판의 번호 — **발행할 때만 올라간다.**\n *\n * 저장 횟수가 아니다. 저작 중에는 몇 번을 고쳐 저장하든 그대로이고, `draft` 가 `released` 가\n * 되는 순간에만 하나 오른다. 소비처가 「몇 번째 판을 쓰고 있나」를 이 값으로 말한다.\n *\n * 한 번도 발행되지 않았으면 **0** 이다. 1 로 시작하면 아직 아무에게도 약속하지 않은 초안이\n * 첫 판인 것처럼 보인다.\n */\n @Column({ nullable: true, default: 0 })\n @Field(type => Int, {\n nullable: true,\n description: 'Published version. Raised when the figure is released, not when it is saved. 0 means never released.'\n })\n version?: number = 0\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain this figure belongs to.' })\n domain?: Domain\n\n @RelationId((figure: Figure) => figure.domain)\n domainId?: string\n\n /**\n * 컴포넌트 타입 이름. **저장되는 식별자다.**\n *\n * 배치된 도면이 이 이름으로 타입을 찾는다. 바꾸면 그 도면은 타입을 못 찾아\n * **오류 없이 빈 화면**이 된다. 그래서 만들 때 정하고 잠근다 — 고칠 수 있는 것은\n * 표시 이름(`name`)뿐이다. 수정 리졸버가 이 필드를 받지 않는다.\n *\n * `Board.type`(main/sub/popup)과 뜻이 전혀 다르다. 혼동하지 않는다.\n */\n @Column()\n @Field({ description: 'Component type name. A stored identifier — unique per domain and immutable once created.' })\n type?: string\n\n /**\n * The namespace the figure is published under, copied from the domain setting `figure-namespace` when the figure is\n * made. With the type it forms the full name `{namespace}/{type}` boards store (ADR-0114). Never changes.\n */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Namespace of the full name {namespace}/{type}. Copied from the domain setting when created; never changes.' })\n namespace?: string\n\n @Column()\n @Field({ description: 'Display name shown to authors. Safe to rename.' })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'A detailed description for the figure.' })\n description?: string\n\n /*\n 언어별 표시 이름(ADR-0104 결정 6). 없는 언어는 `name` 을 보인다. 식별자는 여전히 `type` 이다 — 이름은 몇 번을\n 바꿔도 도면이 가리키는 것이 달라지지 않는다.\n */\n @Column('simple-json', { nullable: true, default: null })\n @Field(type => GraphQLJSON, { nullable: true, description: 'Display names by language, e.g. { \"en\": \"...\", \"ko\": \"...\" }. A language not here shows `name`.' })\n names?: Record<string, string>\n\n /*\n 퇴역(ADR-0104 결정 6). 표시일 뿐이다 — 발행판은 지우지 않고 받는 쪽은 그대로 받는다. 무엇으로 대신하라는지는\n `supersededBy`(그 도메인의 type)가 말한다. 퇴역은 저장이 아니라 `setFigureDeprecation` 이 정하고, 발행을 풀지 않는다.\n */\n @Column({ nullable: true, default: false })\n @Field({ nullable: true, description: 'Retired: still released and still served, but not to be chosen for new work.' })\n deprecated?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The type to use instead of a retired figure.' })\n supersededBy?: string\n\n /*\n 공개(LV figure-server design G2). 다른 도메인도 이 figure 의 **발행본**을 읽고 패키지에 담고 도면에서 정식 이름으로\n 부른다. 초안은 소유 도메인만 본다. 고치고 발행하는 것은 소유 도메인뿐이다(G3). `setFigurePublic` 이 정한다.\n */\n @Column({ nullable: true, default: false })\n @Field({ nullable: true, description: 'Public: other domains read its releases, put them in packages and draw them by full name. Only its domain changes it.' })\n public?: boolean\n\n /**\n * 분류 하나. **팔레트에서 묶어 보이는 기준이다.**\n *\n * 도형 하나에 하나뿐이다 — 팔레트는 목록을 한 벌로 나눠 보여 주므로, 한 도형이 두 묶음에\n * 동시에 있으면 저작자가 같은 것을 두 번 만난다.\n */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Classification code used to group figures in the palette. One per figure.' })\n category?: string\n\n /**\n * 태그. **여럿 붙는다.**\n *\n * 분류와 다른 일을 한다. 분류는 「이것이 무엇인가」를 한 번 정하는 것이고, 태그는 「어디에\n * 걸리는가」를 여러 갈래로 적는 것이다 — 컨베이어이면서 반출 구역의 것일 수 있다. 그래서\n * 분류로는 못 하는 찾기가 된다.\n *\n * `simple-json` 으로 담는다. 사내 선례가 그것이고(`ops-master` · `organization` ·\n * `personalization`), 드라이버마다 배열 타입이 다른 것을 피한다.\n */\n /* `simple-json` 과 `default: null` 은 사내 선례 그대로다 — board-template · attachment 가 같은 모양이다. */\n @Column('simple-json', { nullable: true, default: null })\n @Field(type => [String], { nullable: true, description: 'Free-form tags. A figure may carry several.' })\n tags?: string[]\n\n @Column({ nullable: true, default: 'draft' })\n @Field({ nullable: true, description: \"Lifecycle state — 'draft' figures do not appear in the board palette.\" })\n state?: 'draft' | 'released'\n\n /**\n * The figure asset JSON (`figure-asset-1`).\n *\n * `Board.model` 자리이지만 이름을 바꿨다 — 「씬 모델이 아니다」를 필드 이름이\n * 드러내야 한다.\n */\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The figure asset JSON (figure-asset-1) authored by the modeller.' })\n source?: string\n\n // ── 파생값 — 저장하는 이유가 하나뿐이다 ──────────────────────────────────\n //\n // 셋 다 `source` 에서 계산된다. 그런데도 컬럼으로 두는 이유는 **목록 화면이\n // 정렬·필터를 해야** 하기 때문이다. JSON 을 파싱해 정렬할 수는 없다.\n //\n // 저장할 때 `figure-model` 로 계산해 채운다. **클라이언트가 준 값을 받지 않는다** —\n // 받으면 거짓이 들어오고, 목록이 실물과 다른 것을 보여 준다.\n\n /** 재활용 점수 0~100. `scoreOf()` 가 계산한다. */\n @Column({ type: 'float', nullable: true })\n @Field(type => Float, { nullable: true, description: 'Reuse score 0-100, computed from source on save.' })\n score?: number\n\n /** 삼각형 수. `costOf()` 가 계산한다. */\n @Column({ nullable: true })\n @Field(type => Int, { nullable: true, description: 'Triangle count, computed from source on save.' })\n triangles?: number\n\n /** 재질 묶음 수 — 인스턴스당 draw call 의 근거. */\n @Column({ nullable: true })\n @Field(type => Int, { nullable: true, description: 'Material group count — the basis of per-instance draw calls.' })\n groups?: number\n\n /** 기준정보 항목 정의. Figure 를 배치할 때 인스턴스가 채우는 자리. */\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'JSON definition of the master-data fields an instance of this figure carries.' })\n properties?: string\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'A base64 encoded thumbnail image of the figure.' })\n thumbnail?: string\n\n /*\n * 그림의 내용 해시(SHA-256). 그림 자체는 attachment-base 가 갖고(refType `figure-thumbnail`, refBy 이 해시),\n * `/figure-thumbnail/:id` 가 권한을 본 뒤 내준다(ADR-0104 결정 6). `thumbnail` 칸은 옛 base64 가 남은 행을\n * 기동 때 옮기기 위한 칸이다 — 옮긴 뒤에는 비어 있고, 새 그림은 그 칸에 쓰지 않는다.\n */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'SHA-256 of the thumbnail picture; the picture is served by /figure-thumbnail/:id.' })\n thumbnailHash?: string\n\n /**\n * 썸네일이 **썸네일로서** 마지막으로 갱신된 시각. `updatedAt` 과는 별개 도메인이다 —\n * 이름·설명만 고쳤을 때는 갱신되지 않는다. `Board` 와 같은 방식.\n */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Timestamp of the last thumbnail generation. Separate lifecycle from updatedAt.' })\n thumbnailUpdatedAt?: Date\n\n @Column({ type: 'float', nullable: true, default: 0 })\n @Field(type => Float, { nullable: true, description: 'Sort order within a listing.' })\n sortOrder?: number\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Creation timestamp.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Last update timestamp.' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'Soft-delete timestamp.' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created this figure.' })\n creator?: User\n\n @RelationId((figure: Figure) => figure.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated this figure.' })\n updater?: User\n\n @RelationId((figure: Figure) => figure.updater)\n updaterId?: string\n}\n"]}
1
+ {"version":3,"file":"figure.js","sourceRoot":"","sources":["../../../server/service/figure/figure.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAgE;AAChE,qDAA6C;AAE7C,yDAAgD;AAChD,iDAA8D;AAE9D;;;;;;;;;;;;;GAaG;AAQI,IAAM,MAAM,GAAZ,MAAM,MAAM;IAAZ;QAKL;;;;;;;;WAQG;QAMH,YAAO,G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n,\n DeleteDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { Field, Float, ID, Int, ObjectType } from 'type-graphql'\nimport { GraphQLJSON } from 'graphql-scalars'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, longTextColumn } from '@things-factory/shell'\n\n/**\n * Figure — 저작된 3D 컴포넌트 한 종류.\n *\n * `Board` 를 준용한다. 다른 점만 주석으로 적는다.\n *\n * ## 무엇을 담나 — 피규어 자산이다, 씬 모델이 아니다\n *\n * 형식은 `@hatiolab/figure-model` 이 정한다(`figure-asset-1`). 씬 컴포넌트 트리를 담지 않는다.\n * 컴파일한 것도 저장하지 않는다 — 원본에서 파생되므로 소비하는 쪽이 커널로 컴파일한다. 저장하면 원본과 갈린다.\n *\n * 그래서 부품·움직임·자리 같은 것을 컬럼으로 두지 않는다 — 전부 `source` 안에 이미 있다. 두 벌이면 갈린다.\n *\n * 설계: `docs/design/figure-modules.md` §2\n */\n@Entity()\n@Index('ix_figure_1', (figure: Figure) => [figure.domain, figure.type], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@Index('ix_figure_2', (figure: Figure) => [figure.domain, figure.category])\n@ObjectType({ description: 'An authored 3D component type — its figure asset plus its metadata.' })\nexport class Figure {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { nullable: true, description: 'Unique identifier for the figure.' })\n readonly id?: string\n\n /**\n * 발행된 판의 번호 — **발행할 때만 올라간다.**\n *\n * 저장 횟수가 아니다. 저작 중에는 몇 번을 고쳐 저장하든 그대로이고, `draft` 가 `released` 가\n * 되는 순간에만 하나 오른다. 소비처가 「몇 번째 판을 쓰고 있나」를 이 값으로 말한다.\n *\n * 한 번도 발행되지 않았으면 **0** 이다. 1 로 시작하면 아직 아무에게도 약속하지 않은 초안이\n * 첫 판인 것처럼 보인다.\n */\n @Column({ nullable: true, default: 0 })\n @Field(type => Int, {\n nullable: true,\n description: 'Published version. Raised when the figure is released, not when it is saved. 0 means never released.'\n })\n version?: number = 0\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain this figure belongs to.' })\n domain?: Domain\n\n @RelationId((figure: Figure) => figure.domain)\n domainId?: string\n\n /**\n * 컴포넌트 타입 이름. **저장되는 식별자다.**\n *\n * 배치된 도면이 이 이름으로 타입을 찾는다. 바꾸면 그 도면은 타입을 못 찾아\n * **오류 없이 빈 화면**이 된다. 그래서 만들 때 정하고 잠근다 — 고칠 수 있는 것은\n * 표시 이름(`name`)뿐이다. 수정 리졸버가 이 필드를 받지 않는다.\n *\n * `Board.type`(main/sub/popup)과 뜻이 전혀 다르다. 혼동하지 않는다.\n */\n @Column()\n @Field({ description: 'Component type name. A stored identifier — unique per domain and immutable once created.' })\n type?: string\n\n /**\n * The namespace the figure is published under, copied from the domain setting `figure-namespace` when the figure is\n * made. With the type it forms the full name `{namespace}/{type}` boards store (ADR-0114). Never changes.\n */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Namespace of the full name {namespace}/{type}. Copied from the domain setting when created; never changes.' })\n namespace?: string\n\n @Column()\n @Field({ description: 'Display name shown to authors. Safe to rename.' })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'A detailed description for the figure.' })\n description?: string\n\n /*\n 언어별 표시 이름(ADR-0104 결정 6). 없는 언어는 `name` 을 보인다. 식별자는 여전히 `type` 이다 — 이름은 몇 번을\n 바꿔도 도면이 가리키는 것이 달라지지 않는다.\n */\n @Column('simple-json', { nullable: true, default: null })\n @Field(type => GraphQLJSON, { nullable: true, description: 'Display names by language, e.g. { \"en\": \"...\", \"ko\": \"...\" }. A language not here shows `name`.' })\n names?: Record<string, string>\n\n /*\n 퇴역(ADR-0104 결정 6). 표시일 뿐이다 — 발행판은 지우지 않고 받는 쪽은 그대로 받는다. 무엇으로 대신하라는지는\n `supersededBy`(그 도메인의 type)가 말한다. 퇴역은 저장이 아니라 `setFigureDeprecation` 이 정하고, 발행을 풀지 않는다.\n */\n @Column({ nullable: true, default: false })\n @Field({ nullable: true, description: 'Retired: still released and still served, but not to be chosen for new work.' })\n deprecated?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The type to use instead of a retired figure.' })\n supersededBy?: string\n\n /*\n 공개(LV figure-server design G2). 다른 도메인도 이 figure 의 **발행본**을 읽고 패키지에 담고 도면에서 정식 이름으로\n 부른다. 초안은 소유 도메인만 본다. 고치고 발행하는 것은 소유 도메인뿐이다(G3). `setFigurePublic` 이 정한다.\n */\n @Column({ nullable: true, default: false })\n @Field({ nullable: true, description: 'Public: other domains read its releases, put them in packages and draw them by full name. Only its domain changes it.' })\n public?: boolean\n\n /**\n * 분류 하나. **팔레트에서 묶어 보이는 기준이다.**\n *\n * 피규어 하나에 하나뿐이다 — 팔레트는 목록을 한 벌로 나눠 보여 주므로, 한 피규어가 두 묶음에\n * 동시에 있으면 저작자가 같은 것을 두 번 만난다.\n */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Classification code used to group figures in the palette. One per figure.' })\n category?: string\n\n /**\n * 태그. **여럿 붙는다.**\n *\n * 분류와 다른 일을 한다. 분류는 「이것이 무엇인가」를 한 번 정하는 것이고, 태그는 「어디에\n * 걸리는가」를 여러 갈래로 적는 것이다 — 컨베이어이면서 반출 구역의 것일 수 있다. 그래서\n * 분류로는 못 하는 찾기가 된다.\n *\n * `simple-json` 으로 담는다. 사내 선례가 그것이고(`ops-master` · `organization` ·\n * `personalization`), 드라이버마다 배열 타입이 다른 것을 피한다.\n */\n /* `simple-json` 과 `default: null` 은 사내 선례 그대로다 — board-template · attachment 가 같은 모양이다. */\n @Column('simple-json', { nullable: true, default: null })\n @Field(type => [String], { nullable: true, description: 'Free-form tags. A figure may carry several.' })\n tags?: string[]\n\n @Column({ nullable: true, default: 'draft' })\n @Field({ nullable: true, description: \"Lifecycle state — 'draft' figures do not appear in the board palette.\" })\n state?: 'draft' | 'released'\n\n /**\n * The figure asset JSON (`figure-asset-1`).\n *\n * `Board.model` 자리이지만 이름을 바꿨다 — 「씬 모델이 아니다」를 필드 이름이\n * 드러내야 한다.\n */\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The figure asset JSON (figure-asset-1) authored by the modeller.' })\n source?: string\n\n // ── 파생값 — 저장하는 이유가 하나뿐이다 ──────────────────────────────────\n //\n // 셋 다 `source` 에서 계산된다. 그런데도 컬럼으로 두는 이유는 **목록 화면이\n // 정렬·필터를 해야** 하기 때문이다. JSON 을 파싱해 정렬할 수는 없다.\n //\n // 저장할 때 `figure-model` 로 계산해 채운다. **클라이언트가 준 값을 받지 않는다** —\n // 받으면 거짓이 들어오고, 목록이 실물과 다른 것을 보여 준다.\n\n /** 재활용 점수 0~100. `scoreOf()` 가 계산한다. */\n @Column({ type: 'float', nullable: true })\n @Field(type => Float, { nullable: true, description: 'Reuse score 0-100, computed from source on save.' })\n score?: number\n\n /** 삼각형 수. `costOf()` 가 계산한다. */\n @Column({ nullable: true })\n @Field(type => Int, { nullable: true, description: 'Triangle count, computed from source on save.' })\n triangles?: number\n\n /** 재질 묶음 수 — 인스턴스당 draw call 의 근거. */\n @Column({ nullable: true })\n @Field(type => Int, { nullable: true, description: 'Material group count — the basis of per-instance draw calls.' })\n groups?: number\n\n /** 기준정보 항목 정의. Figure 를 배치할 때 인스턴스가 채우는 자리. */\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'JSON definition of the master-data fields an instance of this figure carries.' })\n properties?: string\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'A base64 encoded thumbnail image of the figure.' })\n thumbnail?: string\n\n /*\n * 그림의 내용 해시(SHA-256). 그림 자체는 attachment-base 가 갖고(refType `figure-thumbnail`, refBy 이 해시),\n * `/figure-thumbnail/:id` 가 권한을 본 뒤 내준다(ADR-0104 결정 6). `thumbnail` 칸은 옛 base64 가 남은 행을\n * 기동 때 옮기기 위한 칸이다 — 옮긴 뒤에는 비어 있고, 새 그림은 그 칸에 쓰지 않는다.\n */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'SHA-256 of the thumbnail picture; the picture is served by /figure-thumbnail/:id.' })\n thumbnailHash?: string\n\n /**\n * 썸네일이 **썸네일로서** 마지막으로 갱신된 시각. `updatedAt` 과는 별개 도메인이다 —\n * 이름·설명만 고쳤을 때는 갱신되지 않는다. `Board` 와 같은 방식.\n */\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Timestamp of the last thumbnail generation. Separate lifecycle from updatedAt.' })\n thumbnailUpdatedAt?: Date\n\n @Column({ type: 'float', nullable: true, default: 0 })\n @Field(type => Float, { nullable: true, description: 'Sort order within a listing.' })\n sortOrder?: number\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Creation timestamp.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Last update timestamp.' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'Soft-delete timestamp.' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created this figure.' })\n creator?: User\n\n @RelationId((figure: Figure) => figure.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated this figure.' })\n updater?: User\n\n @RelationId((figure: Figure) => figure.updater)\n updaterId?: string\n}\n"]}