@kensnzk/koyu 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analysis/contracts.d.ts +217 -0
- package/dist/analysis/contracts.d.ts.map +1 -0
- package/dist/analysis/contracts.js +27 -0
- package/dist/analysis/contracts.js.map +1 -0
- package/dist/analysis/index.d.ts +5 -0
- package/dist/analysis/index.d.ts.map +1 -0
- package/dist/analysis/index.js +17 -0
- package/dist/analysis/index.js.map +1 -0
- package/dist/analysis/json.d.ts +21 -0
- package/dist/analysis/json.d.ts.map +1 -0
- package/dist/analysis/json.js +111 -0
- package/dist/analysis/json.js.map +1 -0
- package/dist/cli.js +116 -26
- package/dist/cli.js.map +1 -1
- package/dist/core/diagnose.d.ts +1 -0
- package/dist/core/diagnose.d.ts.map +1 -1
- package/dist/core/diagnose.js +11 -1
- package/dist/core/diagnose.js.map +1 -1
- package/dist/core/model.d.ts +50 -3
- package/dist/core/model.d.ts.map +1 -1
- package/dist/core/model.js +19 -3
- package/dist/core/model.js.map +1 -1
- package/dist/core/parse.d.ts.map +1 -1
- package/dist/core/parse.js +79 -0
- package/dist/core/parse.js.map +1 -1
- package/dist/core/site.d.ts +9 -0
- package/dist/core/site.d.ts.map +1 -1
- package/dist/core/site.js +6 -0
- package/dist/core/site.js.map +1 -1
- package/dist/core/vocabulary.d.ts.map +1 -1
- package/dist/core/vocabulary.js +11 -0
- package/dist/core/vocabulary.js.map +1 -1
- package/dist/diagnostics.d.ts +2 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +3 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/diff.d.ts +2 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +3 -0
- package/dist/diff.js.map +1 -0
- package/dist/draw/plan.d.ts.map +1 -1
- package/dist/draw/plan.js +24 -0
- package/dist/draw/plan.js.map +1 -1
- package/dist/form.d.ts +5 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +4 -0
- package/dist/form.js.map +1 -0
- package/dist/graph.d.ts +2 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +3 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +2 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -50
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +55 -20
- package/dist/mcp.js.map +1 -1
- package/dist/model.d.ts +3 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +3 -0
- package/dist/model.js.map +1 -0
- package/dist/validate/assessment.d.ts +8 -0
- package/dist/validate/assessment.d.ts.map +1 -0
- package/dist/validate/assessment.js +1738 -0
- package/dist/validate/assessment.js.map +1 -0
- package/dist/validate/builtin/access.d.ts +55 -0
- package/dist/validate/builtin/access.d.ts.map +1 -0
- package/dist/validate/builtin/access.js +494 -0
- package/dist/validate/builtin/access.js.map +1 -0
- package/dist/validate/builtin/daylight.d.ts +44 -0
- package/dist/validate/builtin/daylight.d.ts.map +1 -0
- package/dist/validate/builtin/daylight.js +233 -0
- package/dist/validate/builtin/daylight.js.map +1 -0
- package/dist/validate/builtin/door-column-collisions.d.ts +47 -0
- package/dist/validate/builtin/door-column-collisions.d.ts.map +1 -0
- package/dist/validate/builtin/door-column-collisions.js +189 -0
- package/dist/validate/builtin/door-column-collisions.js.map +1 -0
- package/dist/validate/builtin/envelope.d.ts +30 -0
- package/dist/validate/builtin/envelope.d.ts.map +1 -0
- package/dist/validate/builtin/envelope.js +169 -0
- package/dist/validate/builtin/envelope.js.map +1 -0
- package/dist/validate/builtin/freeze.d.ts +3 -0
- package/dist/validate/builtin/freeze.d.ts.map +1 -0
- package/dist/validate/builtin/freeze.js +21 -0
- package/dist/validate/builtin/freeze.js.map +1 -0
- package/dist/validate/builtin/index.d.ts +38 -0
- package/dist/validate/builtin/index.d.ts.map +1 -0
- package/dist/validate/builtin/index.js +106 -0
- package/dist/validate/builtin/index.js.map +1 -0
- package/dist/validate/builtin/site.d.ts +62 -0
- package/dist/validate/builtin/site.d.ts.map +1 -0
- package/dist/validate/builtin/site.js +333 -0
- package/dist/validate/builtin/site.js.map +1 -0
- package/dist/validate/builtin/vertical-runs.d.ts +53 -0
- package/dist/validate/builtin/vertical-runs.d.ts.map +1 -0
- package/dist/validate/builtin/vertical-runs.js +290 -0
- package/dist/validate/builtin/vertical-runs.js.map +1 -0
- package/dist/validate/contracts.d.ts +188 -0
- package/dist/validate/contracts.d.ts.map +1 -0
- package/dist/validate/contracts.js +28 -0
- package/dist/validate/contracts.js.map +1 -0
- package/dist/validate/index.d.ts +2 -59
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +22 -70
- package/dist/validate/index.js.map +1 -1
- package/dist/vocabulary.d.ts +2 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +3 -0
- package/dist/vocabulary.js.map +1 -0
- package/editors/vscode/syntaxes/koyu.tmLanguage.json +2 -2
- package/examples/tower/site-geometry.muro +9 -0
- package/examples/two-rooms.canonical.json +1 -1
- package/package.json +37 -5
- package/src/analysis/contracts.ts +234 -0
- package/src/analysis/index.ts +61 -0
- package/src/analysis/json.ts +117 -0
- package/src/cli.ts +127 -28
- package/src/core/diagnose.ts +11 -1
- package/src/core/model.ts +67 -3
- package/src/core/parse.ts +99 -0
- package/src/core/site.ts +17 -0
- package/src/core/vocabulary.ts +12 -0
- package/src/diagnostics.ts +8 -0
- package/src/diff.ts +14 -0
- package/src/draw/plan.ts +31 -0
- package/src/form.ts +37 -0
- package/src/graph.ts +12 -0
- package/src/index.ts +39 -195
- package/src/mcp.ts +57 -25
- package/src/model.ts +45 -0
- package/src/validate/assessment.ts +1934 -0
- package/src/validate/builtin/access.ts +642 -0
- package/src/validate/builtin/daylight.ts +321 -0
- package/src/validate/builtin/door-column-collisions.ts +266 -0
- package/src/validate/builtin/envelope.ts +227 -0
- package/src/validate/builtin/freeze.ts +19 -0
- package/src/validate/builtin/index.ts +156 -0
- package/src/validate/builtin/site.ts +445 -0
- package/src/validate/builtin/vertical-runs.ts +390 -0
- package/src/validate/contracts.ts +240 -0
- package/src/validate/index.ts +45 -99
- package/src/vocabulary.ts +9 -0
- package/dist/validate/access.d.ts +0 -6
- package/dist/validate/access.d.ts.map +0 -1
- package/dist/validate/access.js +0 -248
- package/dist/validate/access.js.map +0 -1
- package/dist/validate/envelope.d.ts +0 -4
- package/dist/validate/envelope.d.ts.map +0 -1
- package/dist/validate/envelope.js +0 -55
- package/dist/validate/envelope.js.map +0 -1
- package/dist/validate/light.d.ts +0 -6
- package/dist/validate/light.d.ts.map +0 -1
- package/dist/validate/light.js +0 -28
- package/dist/validate/light.js.map +0 -1
- package/dist/validate/runs.d.ts +0 -16
- package/dist/validate/runs.d.ts.map +0 -1
- package/dist/validate/runs.js +0 -60
- package/dist/validate/runs.js.map +0 -1
- package/dist/validate/site.d.ts +0 -6
- package/dist/validate/site.d.ts.map +0 -1
- package/dist/validate/site.js +0 -63
- package/dist/validate/site.js.map +0 -1
- package/src/validate/access.ts +0 -291
- package/src/validate/envelope.ts +0 -59
- package/src/validate/light.ts +0 -43
- package/src/validate/runs.ts +0 -87
- package/src/validate/site.ts +0 -84
package/src/index.ts
CHANGED
|
@@ -1,211 +1,55 @@
|
|
|
1
|
-
// koyu —
|
|
1
|
+
// koyu — the root surface (`@kensnzk/koyu`)
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
// export
|
|
5
|
-
//
|
|
3
|
+
// **Only the names written down here are promised.** `export *` is never used: the moment a
|
|
4
|
+
// module gains an export, a promise nobody declared would freeze into the surface. A surface
|
|
5
|
+
// that freezes has to be written out by hand (docs/reference/scope.md).
|
|
6
6
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
7
|
+
// **root is not a shorthand for every subpath.** What lives here is the minimum needed to begin
|
|
8
|
+
// the standard loop — read a `.muro`, confirm it is not self-contradictory, and take the
|
|
9
|
+
// canonical form — plus the types those signatures cannot be written without. Domain names
|
|
10
|
+
// (`model`, `graph`, `form`, `analysis`, `validate`, `draw`, `node`) are **not** re-exported
|
|
11
|
+
// from here. A caller who needs a domain names that domain, and the import line then says which
|
|
12
|
+
// contract is being relied on: the face that freezes, the face that computes from external
|
|
13
|
+
// conditions, the face that concludes, the presentation that may change freely, and the
|
|
14
|
+
// Node-specific adapter never get mixed together.
|
|
15
15
|
//
|
|
16
|
-
//
|
|
16
|
+
// root is browser-safe: nothing reachable from here pulls a Node builtin.
|
|
17
|
+
//
|
|
18
|
+
// The twelve entry points:
|
|
19
|
+
//
|
|
20
|
+
// @kensnzk/koyu this file — compose, check, canonicalise
|
|
21
|
+
// @kensnzk/koyu/model Model, and the questions the model answers alone
|
|
22
|
+
// @kensnzk/koyu/diagnostics structural-consistency diagnostics
|
|
23
|
+
// @kensnzk/koyu/graph adjacency, passability, routes, boundary segments
|
|
24
|
+
// @kensnzk/koyu/form the one derivation of shape
|
|
25
|
+
// @kensnzk/koyu/analysis facts made under an explicit context and profile
|
|
26
|
+
// @kensnzk/koyu/diff the semantic difference between two models
|
|
27
|
+
// @kensnzk/koyu/vocabulary the attribute ledger
|
|
28
|
+
// @kensnzk/koyu/validate the rule SPI, the runner, AssessmentReport
|
|
29
|
+
// @kensnzk/koyu/validate/builtin the rules, rule set and profile koyu ships
|
|
30
|
+
// @kensnzk/koyu/draw presentation of the Form
|
|
31
|
+
// @kensnzk/koyu/node filesystem and other Node-specific adapters
|
|
32
|
+
//
|
|
33
|
+
// This list and the table in docs/reference/api/index.md agree as sets — test/public-api.test.ts
|
|
34
|
+
// binds them.
|
|
17
35
|
|
|
18
36
|
// ---- 解析と合成 (docs/reference/muro/import.md) ----
|
|
19
37
|
export { parse, parseFiles, parseWith, tokenize, type LayerLoader } from "./core/parse.js";
|
|
20
38
|
|
|
21
|
-
// ----
|
|
22
|
-
export type {
|
|
23
|
-
Area,
|
|
24
|
-
Asset,
|
|
25
|
-
Attrs,
|
|
26
|
-
AttrValue,
|
|
27
|
-
Boundary,
|
|
28
|
-
BoundaryKind,
|
|
29
|
-
Column,
|
|
30
|
-
ColumnDecl,
|
|
31
|
-
DrawnLine,
|
|
32
|
-
Edge,
|
|
33
|
-
GridAxis,
|
|
34
|
-
GridRef,
|
|
35
|
-
Level,
|
|
36
|
-
Model,
|
|
37
|
-
Opening,
|
|
38
|
-
Pt,
|
|
39
|
-
Rect,
|
|
40
|
-
Seg,
|
|
41
|
-
SitePolygon,
|
|
42
|
-
Space,
|
|
43
|
-
Zone,
|
|
44
|
-
} from "./core/model.js";
|
|
45
|
-
|
|
46
|
-
// ---- モデルへの問い・導出・機械形式 ----
|
|
47
|
-
// **合否は言わない** (docs/reference/scope.md)。数と形を返すところまでが core である
|
|
48
|
-
export {
|
|
49
|
-
areaM2,
|
|
50
|
-
canonicalBoundaryOrder,
|
|
51
|
-
columnsFor,
|
|
52
|
-
DEFAULT_LANGUAGE_VERSION,
|
|
53
|
-
displayName,
|
|
54
|
-
effectiveUse,
|
|
55
|
-
heff,
|
|
56
|
-
isCoveredAbove,
|
|
57
|
-
isIndoor,
|
|
58
|
-
isOutside,
|
|
59
|
-
isSemiOutdoor,
|
|
60
|
-
isVoid,
|
|
61
|
-
levelsSorted,
|
|
62
|
-
newUids,
|
|
63
|
-
pointInPolygon,
|
|
64
|
-
polyBounds,
|
|
65
|
-
polygonAreaM2,
|
|
66
|
-
rectToPoly,
|
|
67
|
-
SourceError,
|
|
68
|
-
srcRef,
|
|
69
|
-
SUPPORTED_LANGUAGE_VERSIONS,
|
|
70
|
-
toCanonical,
|
|
71
|
-
unionAreaM2,
|
|
72
|
-
zoneAreaM2,
|
|
73
|
-
} from "./core/model.js";
|
|
74
|
-
|
|
75
|
-
// ---- 構造整合の診断 (ADR-0016) ----
|
|
39
|
+
// ---- 構造整合の確認 — **合否は言わない。**書かれたものが矛盾していないかまで ----
|
|
76
40
|
export {
|
|
77
41
|
check,
|
|
78
42
|
checkDiagnostics,
|
|
79
|
-
DIAGNOSTIC_CODES,
|
|
80
43
|
type CheckResult,
|
|
81
44
|
type Diagnostic,
|
|
82
45
|
type DiagnosticCode,
|
|
83
46
|
} from "./core/diagnose.js";
|
|
84
47
|
|
|
85
|
-
// ----
|
|
86
|
-
export {
|
|
87
|
-
deriveDefaultBoundaries,
|
|
88
|
-
doorsBetween,
|
|
89
|
-
envelopeGaps,
|
|
90
|
-
neighbors,
|
|
91
|
-
passable,
|
|
92
|
-
placeBand,
|
|
93
|
-
placeOpening,
|
|
94
|
-
segmentsFor,
|
|
95
|
-
type Band,
|
|
96
|
-
type BandCode,
|
|
97
|
-
type BandError,
|
|
98
|
-
type NeighborInfo,
|
|
99
|
-
type PlacedBand,
|
|
100
|
-
type Route,
|
|
101
|
-
type Segment,
|
|
102
|
-
} from "./core/graph.js";
|
|
103
|
-
|
|
104
|
-
// ---- 形の参照実装 (ADR-0040) — **これが形の唯一の入口である** ----
|
|
105
|
-
// Form は見た目を持たない (docs/reference/scope.md)。規則は docs/reference/form/index.md が持つ
|
|
106
|
-
// 実体の構成子 (thicken / bandLine / band / columnRect / runPrism) も core が唯一の実装を
|
|
107
|
-
// 持つ — 芯線と厚みから四辺形や角柱を起こす規則も導出の一部だからである
|
|
108
|
-
export {
|
|
109
|
-
band,
|
|
110
|
-
bandLine,
|
|
111
|
-
columnRect,
|
|
112
|
-
derive,
|
|
113
|
-
DERIVATION_CONSTANTS,
|
|
114
|
-
levelPitch,
|
|
115
|
-
runPrism,
|
|
116
|
-
thicken,
|
|
117
|
-
type DeriveOptions,
|
|
118
|
-
type Form,
|
|
119
|
-
type FormBoundary,
|
|
120
|
-
type FormColumn,
|
|
121
|
-
type FormInput,
|
|
122
|
-
type FormLevel,
|
|
123
|
-
type FormOpening,
|
|
124
|
-
type FormPanel,
|
|
125
|
-
type FormPlan,
|
|
126
|
-
type FormPrism,
|
|
127
|
-
type FormRun,
|
|
128
|
-
type FormSeg,
|
|
129
|
-
type FormSite,
|
|
130
|
-
type FormSpace,
|
|
131
|
-
type FormSwing,
|
|
132
|
-
type PlanClass,
|
|
133
|
-
type PlanEntity,
|
|
134
|
-
type PlanRole,
|
|
135
|
-
type PlanSubject,
|
|
136
|
-
} from "./core/derive.js";
|
|
137
|
-
export { TOLERANCES } from "./core/tolerance.js";
|
|
138
|
-
|
|
139
|
-
// ---- 床・天井・屋根 (ADR-0024) ----
|
|
140
|
-
export { slabs, type Slab, type SlabKind } from "./core/fabric.js";
|
|
141
|
-
|
|
142
|
-
// ---- 採光の入力 (ADR-0020) ----
|
|
143
|
-
export { daylightInputs, type DaylightInput } from "./core/light.js";
|
|
144
|
-
|
|
145
|
-
// ---- 縦動線 (ADR-0021) ----
|
|
146
|
-
export {
|
|
147
|
-
RUN_KEYS,
|
|
148
|
-
runDecls,
|
|
149
|
-
runDrawsForLevel,
|
|
150
|
-
runSolids,
|
|
151
|
-
slopeText,
|
|
152
|
-
verticalRuns,
|
|
153
|
-
type RunArrow,
|
|
154
|
-
type RunDecl,
|
|
155
|
-
type RunDevice,
|
|
156
|
-
type RunDraw,
|
|
157
|
-
type RunForm,
|
|
158
|
-
type RunPart,
|
|
159
|
-
type RunSolid,
|
|
160
|
-
type Seg2,
|
|
161
|
-
type VerticalRun,
|
|
162
|
-
} from "./core/vertical.js";
|
|
163
|
-
|
|
164
|
-
// ---- 敷地 (ADR-0009 / ADR-0011) ----
|
|
165
|
-
export { siteReport, type RoadFrontage, type SiteReport } from "./core/site.js";
|
|
166
|
-
|
|
167
|
-
// ---- 構成の言葉の差分 (ADR-0018) ----
|
|
168
|
-
export {
|
|
169
|
-
renderDiff,
|
|
170
|
-
semanticDiff,
|
|
171
|
-
type BoundaryChange,
|
|
172
|
-
type BoundaryItem,
|
|
173
|
-
type ChangedItem,
|
|
174
|
-
type ColumnItem,
|
|
175
|
-
type FieldChange,
|
|
176
|
-
type GridChange,
|
|
177
|
-
type ModelDiff,
|
|
178
|
-
type RenamedItem,
|
|
179
|
-
type SpaceItem,
|
|
180
|
-
} from "./core/diff.js";
|
|
181
|
-
|
|
182
|
-
// ---- 属性の台帳 — **書いてよいキーの一覧であって、読むキーの一覧ではない** ----
|
|
183
|
-
//
|
|
184
|
-
// 利用者の側にも境界が要る。台帳を出していなかった間、消費側のアプリは
|
|
185
|
-
// 「この鍵はこの要素に書けるか」を答えるために台帳を手で写すしかなく、写しは必ずずれる。
|
|
186
|
-
// `outside` と `void` を型の位置から台帳へ移した以上、その台帳は読めなければ意味がない。
|
|
48
|
+
// ---- 機械形式と、版 ----
|
|
187
49
|
export {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
type AttrSpec,
|
|
195
|
-
type AttrTier,
|
|
196
|
-
} from "./core/vocabulary.js";
|
|
197
|
-
|
|
198
|
-
// ---- 生成 — **凍らない** (docs/reference/scope.md)。SVGの中身は約束の外にある ----
|
|
199
|
-
// 領域としては `@kensnzk/koyu/draw` にも分けてある
|
|
200
|
-
export { svgPlan, type PlanOptions } from "./draw/plan.js";
|
|
201
|
-
export { svgAxo, type AxoOptions } from "./draw/axo.js";
|
|
202
|
-
|
|
203
|
-
// ---- 検証 — **core ではない。**凍らない・増える・合否を言う (docs/reference/scope.md) ----
|
|
204
|
-
// Finding は Diagnostic と別の型で、フィールド名から違う (rule/level と code/severity)。
|
|
205
|
-
// 領域としては `@kensnzk/koyu/validate` にも分けてある
|
|
206
|
-
export {
|
|
207
|
-
validate,
|
|
208
|
-
VALIDATION_RULES,
|
|
209
|
-
type Finding,
|
|
210
|
-
type ValidationRule,
|
|
211
|
-
} from "./validate/index.js";
|
|
50
|
+
DEFAULT_LANGUAGE_VERSION,
|
|
51
|
+
SourceError,
|
|
52
|
+
SUPPORTED_LANGUAGE_VERSIONS,
|
|
53
|
+
toCanonical,
|
|
54
|
+
type Model,
|
|
55
|
+
} from "./core/model.js";
|
package/src/mcp.ts
CHANGED
|
@@ -8,28 +8,30 @@
|
|
|
8
8
|
|
|
9
9
|
import { mkdirSync, readFileSync, realpathSync, renameSync, writeFileSync } from "node:fs";
|
|
10
10
|
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
11
|
+
import { daylightInputs } from "./core/light.js";
|
|
12
|
+
import { polygonAreaM2 } from "./core/model.js";
|
|
13
|
+
import { check } from "./core/diagnose.js";
|
|
14
|
+
import { siteReport } from "./core/site.js";
|
|
15
|
+
import { assess } from "./validate/assessment.js";
|
|
16
|
+
import { createSchematicRegistry, SCHEMATIC_PROFILE_ID } from "./validate/builtin/index.js";
|
|
17
|
+
import { checkDiagnostics } from "./diagnostics.js";
|
|
18
|
+
import { svgPlan } from "./draw/index.js";
|
|
19
|
+
import { doorsBetween } from "./graph.js";
|
|
11
20
|
import {
|
|
12
21
|
areaM2,
|
|
13
22
|
isIndoor,
|
|
14
|
-
daylightInputs,
|
|
15
|
-
validate,
|
|
16
23
|
displayName,
|
|
17
|
-
doorsBetween,
|
|
18
24
|
effectiveUse,
|
|
19
25
|
isOutside,
|
|
20
26
|
isSemiOutdoor,
|
|
21
27
|
isVoid,
|
|
22
28
|
levelsSorted,
|
|
23
29
|
newUids,
|
|
24
|
-
polygonAreaM2,
|
|
25
30
|
toCanonical,
|
|
26
31
|
zoneAreaM2,
|
|
27
32
|
type Model,
|
|
28
33
|
type Space,
|
|
29
|
-
} from "./
|
|
30
|
-
import { check, checkDiagnostics } from "./core/diagnose.js";
|
|
31
|
-
import { svgPlan } from "./draw/plan.js";
|
|
32
|
-
import { siteReport } from "./core/site.js";
|
|
34
|
+
} from "./model.js";
|
|
33
35
|
import { parseFile, parseFileWith } from "./parse-file.js";
|
|
34
36
|
|
|
35
37
|
// ---- モデルの読み込みと要約 ----
|
|
@@ -119,6 +121,21 @@ function summarize(model: Model, file: string): unknown {
|
|
|
119
121
|
...(model.polygons.size
|
|
120
122
|
? { sitePolygons: [...model.polygons.keys()] }
|
|
121
123
|
: {}),
|
|
124
|
+
// 測地の枠 (ADR-0057) — 書かれていれば返す。**何も導出されていない。**
|
|
125
|
+
// origin の値はメートル、azimuth は +Y の真方位角 (真北から時計回り、0以上360未満)。
|
|
126
|
+
// 不在は 0 ではなく「未知」なので、鍵ごと出ない
|
|
127
|
+
...(model.origin
|
|
128
|
+
? {
|
|
129
|
+
origin: {
|
|
130
|
+
epsg: model.origin.epsg,
|
|
131
|
+
easting: model.origin.easting,
|
|
132
|
+
northing: model.origin.northing,
|
|
133
|
+
...(model.origin.elevation !== undefined ? { elevation: model.origin.elevation } : {}),
|
|
134
|
+
...(model.origin.vertical !== undefined ? { vertical: model.origin.vertical } : {}),
|
|
135
|
+
},
|
|
136
|
+
}
|
|
137
|
+
: {}),
|
|
138
|
+
...(model.azimuth ? { azimuth: model.azimuth.deg } : {}),
|
|
122
139
|
totalFloorM2: Math.round(indoor.reduce((a, s) => a + (areaM2(s) ?? 0), 0) * 100) / 100,
|
|
123
140
|
semiOutdoorM2: Math.round(semi.reduce((a, s) => a + (areaM2(s) ?? 0), 0) * 100) / 100,
|
|
124
141
|
floorsM2: byLevel,
|
|
@@ -312,37 +329,52 @@ const TOOLS: Record<string, Tool> = {
|
|
|
312
329
|
},
|
|
313
330
|
validate: {
|
|
314
331
|
description:
|
|
315
|
-
"Architectural verdicts: daylight, envelope continuity, stair proportions, slopes, reachability, column/door collisions, and the site.
|
|
316
|
-
schema: {
|
|
332
|
+
"Architectural verdicts under an explicit rule profile: daylight, envelope continuity, stair proportions, slopes, reachability, column/door collisions, and the site. Returns a full AssessmentReport — the profile and rule identities, every rule's outcome, the evidence behind it, and a summary that keeps pass, not-applicable, indeterminate and error apart. **A different surface from the check guarantee**, and not frozen. `profile` is required: no jurisdiction or effective date is inferred",
|
|
333
|
+
schema: {
|
|
334
|
+
type: "object",
|
|
335
|
+
properties: {
|
|
336
|
+
...FILE_PROP,
|
|
337
|
+
profile: {
|
|
338
|
+
type: "string",
|
|
339
|
+
description: `Rule profile id. koyu ships one: ${SCHEMATIC_PROFILE_ID.id}`,
|
|
340
|
+
},
|
|
341
|
+
asOf: {
|
|
342
|
+
type: "string",
|
|
343
|
+
description: "Effective date as YYYY-MM-DD. Not read from the clock, so the same input judges the same way twice",
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
required: ["file", "profile", "asOf"],
|
|
347
|
+
},
|
|
317
348
|
run: (a) => {
|
|
318
349
|
const m = load(str(a.file, "file"));
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
350
|
+
const profile = str(a.profile, "profile");
|
|
351
|
+
if (profile !== SCHEMATIC_PROFILE_ID.id) {
|
|
352
|
+
throw new Error(`Unknown profile: ${profile} (koyu ships one: ${SCHEMATIC_PROFILE_ID.id})`);
|
|
353
|
+
}
|
|
354
|
+
return assess(m, {
|
|
355
|
+
registry: createSchematicRegistry(),
|
|
356
|
+
profile: SCHEMATIC_PROFILE_ID,
|
|
357
|
+
context: { schema: "koyu-context/1", asOf: str(a.asOf, "asOf"), values: {} },
|
|
358
|
+
});
|
|
326
359
|
},
|
|
327
360
|
},
|
|
328
361
|
site: {
|
|
329
|
-
description:
|
|
362
|
+
description:
|
|
363
|
+
"Site query: site area (declared against derived), road frontage, footprint, and the coverage and floor-area ratios. **Numbers only** — whether the declared and derived areas agree closely enough is a verdict, and comes from the validate tool",
|
|
330
364
|
schema: { type: "object", properties: FILE_PROP, required: ["file"] },
|
|
331
365
|
run: (a) => {
|
|
366
|
+
// The ratios and their rounding belong to core, which is also what the site rules read.
|
|
367
|
+
// Dividing here again is how an adapter and a rule drift apart.
|
|
332
368
|
const r = siteReport(load(str(a.file, "file")));
|
|
333
|
-
const site = r.declaredArea ?? r.derivedArea;
|
|
334
369
|
return {
|
|
335
370
|
...(r.siteZone ? { siteZone: r.siteZone.path } : {}),
|
|
336
371
|
...(r.polygon ? { polygonVertices: r.polygon.points.length } : {}),
|
|
337
372
|
declaredAreaM2: r.declaredArea,
|
|
338
373
|
derivedAreaM2: r.derivedArea,
|
|
339
|
-
...(r.declaredArea !== undefined && r.derivedArea !== undefined
|
|
340
|
-
? { areaMatch: Math.abs(r.declaredArea - r.derivedArea) < 0.05 }
|
|
341
|
-
: {}),
|
|
342
374
|
footprintM2: r.footprint,
|
|
343
375
|
totalFloorM2: r.totalFloor,
|
|
344
|
-
coverageRatio:
|
|
345
|
-
floorAreaRatio:
|
|
376
|
+
coverageRatio: r.coveragePercent,
|
|
377
|
+
floorAreaRatio: r.floorAreaRatioPercent,
|
|
346
378
|
roads: r.roads.map((rd) => ({
|
|
347
379
|
path: rd.road.path,
|
|
348
380
|
name: displayName(rd.road),
|
|
@@ -398,7 +430,7 @@ function handle(msg: Json): void {
|
|
|
398
430
|
result(id, {
|
|
399
431
|
protocolVersion: (params.protocolVersion as string) ?? "2025-06-18",
|
|
400
432
|
capabilities: { tools: {} },
|
|
401
|
-
serverInfo: { name: "koyu", version: "0.
|
|
433
|
+
serverInfo: { name: "koyu", version: "0.19.0" },
|
|
402
434
|
instructions:
|
|
403
435
|
"Server for koyu, a space-first architectural description. Grasp the building with model_summary, read the original layers with layers, and edit with write_layer. check is the gatekeeper of the build and returns errors tagged layer:line — it guarantees structural consistency only. validate delivers the architectural verdicts, which are a separate and unfrozen surface. doors/light/site/spaces are different questions put to the same description. Form (plan_svg) is generated, never written.",
|
|
404
436
|
});
|
package/src/model.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Public model surface. Keep this facade explicit: adding an export is adding a package promise.
|
|
2
|
+
|
|
3
|
+
export type {
|
|
4
|
+
Area,
|
|
5
|
+
Asset,
|
|
6
|
+
Attrs,
|
|
7
|
+
AttrValue,
|
|
8
|
+
Azimuth,
|
|
9
|
+
Boundary,
|
|
10
|
+
BoundaryKind,
|
|
11
|
+
Column,
|
|
12
|
+
ColumnDecl,
|
|
13
|
+
DrawnLine,
|
|
14
|
+
Edge,
|
|
15
|
+
GridAxis,
|
|
16
|
+
GridRef,
|
|
17
|
+
Level,
|
|
18
|
+
Model,
|
|
19
|
+
Opening,
|
|
20
|
+
Pt,
|
|
21
|
+
Rect,
|
|
22
|
+
Seg,
|
|
23
|
+
SiteOrigin,
|
|
24
|
+
SitePolygon,
|
|
25
|
+
Space,
|
|
26
|
+
Zone,
|
|
27
|
+
} from "./core/model.js";
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
areaM2,
|
|
31
|
+
DEFAULT_LANGUAGE_VERSION,
|
|
32
|
+
displayName,
|
|
33
|
+
effectiveUse,
|
|
34
|
+
heff,
|
|
35
|
+
isCoveredAbove,
|
|
36
|
+
isIndoor,
|
|
37
|
+
isOutside,
|
|
38
|
+
isSemiOutdoor,
|
|
39
|
+
isVoid,
|
|
40
|
+
levelsSorted,
|
|
41
|
+
newUids,
|
|
42
|
+
SUPPORTED_LANGUAGE_VERSIONS,
|
|
43
|
+
toCanonical,
|
|
44
|
+
zoneAreaM2,
|
|
45
|
+
} from "./core/model.js";
|