@kensnzk/koyu 0.18.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/src/draw/plan.ts CHANGED
@@ -266,6 +266,37 @@ export function svgPlan(model: Model, opts: PlanOptions = {}): string {
266
266
  );
267
267
  }
268
268
 
269
+ // 北矢印 (ADR-0057) — azimuth が書かれているときだけ描く。**表現であって形ではない**ので
270
+ // Form には無く、紙の座標に直接置く。これがある理由は装飾ではない — 方位の 180度違い・
271
+ // 余角違い・磁北の書き写しは、どれも範囲内の整った数として通る。**絵だけが捕まえる。**
272
+ //
273
+ // 画面上の北: モデルの +Y は上、+X は右。真方位角は +Y から時計回りなので、画面でも時計回り
274
+ if (model.azimuth) {
275
+ const rad = (model.azimuth.deg * Math.PI) / 180;
276
+ const nx = Math.sin(rad);
277
+ const ny = -Math.cos(rad);
278
+ const cx = W - M / 2; // 右余白の中央 (通り芯記号と同じ帯に、離して置く)
279
+ const cy = M / 2;
280
+ const R = 21;
281
+ const px = -ny; // 軸に直交する向き (矢羽根の底辺)
282
+ const py = nx;
283
+ const r2 = (n: number): string => String(Math.round(n * 100) / 100);
284
+ const head = [
285
+ [cx + nx * R, cy + ny * R],
286
+ [cx + nx * R * 0.42 + px * 4.6, cy + ny * R * 0.42 + py * 4.6],
287
+ [cx + nx * R * 0.42 - px * 4.6, cy + ny * R * 0.42 - py * 4.6],
288
+ ]
289
+ .map(([x, y]) => `${r2(x!)},${r2(y!)}`)
290
+ .join(" ");
291
+ parts.push(
292
+ `<g class="north-arrow">`,
293
+ `<line x1="${r2(cx - nx * R * 0.8)}" y1="${r2(cy - ny * R * 0.8)}" x2="${r2(cx + nx * R)}" y2="${r2(cy + ny * R)}" stroke="${INK}" stroke-width="1"/>`,
294
+ `<polygon points="${head}" fill="${INK}"/>`,
295
+ `<text x="${r2(cx + nx * (R + 10))}" y="${r2(cy + ny * (R + 10) + 3.4)}" text-anchor="middle" font-size="9" fill="${INK}">N</text>`,
296
+ `</g>`,
297
+ );
298
+ }
299
+
269
300
  // 表題
270
301
  const title = `${model.name ?? "Untitled"} — ${level} plan`;
271
302
  parts.push(
package/src/mcp.ts CHANGED
@@ -121,6 +121,21 @@ function summarize(model: Model, file: string): unknown {
121
121
  ...(model.polygons.size
122
122
  ? { sitePolygons: [...model.polygons.keys()] }
123
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 } : {}),
124
139
  totalFloorM2: Math.round(indoor.reduce((a, s) => a + (areaM2(s) ?? 0), 0) * 100) / 100,
125
140
  semiOutdoorM2: Math.round(semi.reduce((a, s) => a + (areaM2(s) ?? 0), 0) * 100) / 100,
126
141
  floorsM2: byLevel,
@@ -415,7 +430,7 @@ function handle(msg: Json): void {
415
430
  result(id, {
416
431
  protocolVersion: (params.protocolVersion as string) ?? "2025-06-18",
417
432
  capabilities: { tools: {} },
418
- serverInfo: { name: "koyu", version: "0.18.0" },
433
+ serverInfo: { name: "koyu", version: "0.19.0" },
419
434
  instructions:
420
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.",
421
436
  });
package/src/model.ts CHANGED
@@ -5,6 +5,7 @@ export type {
5
5
  Asset,
6
6
  Attrs,
7
7
  AttrValue,
8
+ Azimuth,
8
9
  Boundary,
9
10
  BoundaryKind,
10
11
  Column,
@@ -19,6 +20,7 @@ export type {
19
20
  Pt,
20
21
  Rect,
21
22
  Seg,
23
+ SiteOrigin,
22
24
  SitePolygon,
23
25
  Space,
24
26
  Zone,