@polycyphers/bim 0.1.2 → 0.1.6

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/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Commercial React sketch-to-layout and BIM studio. One browser UI calls the canonical server engine; no architectural catalogue, geometry solver, exporter, provider key or machine credential ships in this npm package.
4
4
 
5
+ ## 0.1.6 release candidate
6
+
7
+ This source candidate makes studio body text and form values 16px, supporting labels at least 14px, and actions at least 48px high. It keeps the Geist/Geist Mono paper/ink/teal presentation, strengthens text contrast, and adapts to the embedded container width including Arabic RTL. Engine SVG/drawing geometry and annotations are unchanged. It also retains the 0.1.5 fix for workflow selection after choosing a local image or writing a sketch brief: preserving an existing plan keeps the image, upload acknowledgements and brief, without starting upload, AI recognition or generation. An uploaded image stays attached to the same project when switching workflows. Unsaved geometry, pending edit previews and active operations still prevent a switch. The package retains durable pending-draft persistence and typed quota/purchase responses from the canonical API. A pending draft is not a validated layout or a paid entitlement; resume and payment actions remain subject to server ownership, version and entitlement checks. Version 0.1.3 was not approved for a public paid launch. Neither this candidate nor its local consumer proof authorizes public checkout, provider processing or deployment. Publication and live application pins require a separate owner release.
8
+
5
9
  ```sh
6
10
  npm install @polycyphers/bim react react-dom
7
11
  ```
@@ -16,7 +20,7 @@ setLicense(import.meta.env.VITE_BIM_UI_LICENSE); // browser-safe signed UI token
16
20
 
17
21
  UI installation tokens are issued under catalog `bim-ui`, signed claim `pkg:["bim"]`, version `0.1.x`, and the licensed hostnames. Server licenses are issued separately under `bim` with `pkg:["Polycyphers.Bim"]`. A browser token grants no server compute, AI budget, tenant access or paid project rights. Never expose server license secrets, HMAC credentials, Stripe or Anthropic keys through Vite environment variables.
18
22
 
19
- Version 0.1.2 requires a valid signed component license before mounting any studio workflow. Missing, invalid, expired, revoked or unverified grants render only the installation-license screen: no project hooks, storage handles, user session or engine API transport starts. A configured token alone is insufficient. The package reuses the actual `@polycyphers/license` Ed25519 verifier and strictly checks package, version, hostname, tier, issue/expiry times and token identity. Development hosts require a genuine grant too. Only `pro`, `team`, `enterprise` and `internal` installation tiers enable BIM; signed OSS or public-trial tokens are rejected.
23
+ Version 0.1.6 retains the signed component license requirement before mounting any studio workflow. Missing, invalid, expired, revoked or unverified grants render only the installation-license screen: no project hooks, storage handles, user session or engine API transport starts. A configured token alone is insufficient. The package reuses the actual `@polycyphers/license` Ed25519 verifier and strictly checks package, version, hostname, tier, issue/expiry times and token identity. Development hosts require a genuine grant too. Only `pro`, `team`, `enterprise` and `internal` installation tiers enable BIM; signed OSS or public-trial tokens are rejected.
20
24
 
21
25
  Fresh signed revocation evidence comes from the existing fixed management endpoint using a bounded, timed request. Unsigned local caches, network failures, stale or inconsistent revocation envelopes do not grant access. An in-memory grant lease lasts at most sixty seconds, is refreshed every thirty seconds and never exceeds signed expiry; every engine transport checks that lease again. Changing or clearing the token immediately closes the studio. These checks protect the supplied component, not arbitrary modified JavaScript: server licensing, tenant access, original AI quotas and project entitlements remain independent and authoritative.
22
26
 
@@ -61,3 +65,21 @@ Host language changes update labels and RTL in place; they do not remount the st
61
65
  Measurement fields and stage/proposal switches lock during an operation. Editing a measurement invalidates the earlier reconciliation evidence and confirmation; an engine-requested diagonal remains editable. Switching the displayed proposal clears bundles for the earlier proposal, while its owner-authorized saved artifacts remain accessible with their original metadata. A result without proposals shows its engine status/findings and a return to measurements, without export controls or a success claim. Programme and build-up form labels use the server's per-field origins; omitted concept defaults stay estimated. Locally typing a value makes it user-given and unconfirmed, never measured or certified. The server discards browser-supplied origin maps and derives its own field-presence/adoption evidence.
62
66
 
63
67
  Version history is loaded on demand through owner-authorized GET `/history`; comparison calls GET `/compare?left=…&right=…` and shows the server's changed-input list, selected layout IDs and area delta marked calculated/unconfirmed. These reads do not request AI or generation/export credits. Restore calls the normal CAS `/undo` endpoint with the current expected version and chosen earlier target, creating a new version. Earlier versions are immutable, stale restore conflicts remain visible, and history/comparison state clears on trusted workspace changes. The studio content resets only when the verified workspace changes, never when its language changes.
68
+
69
+ ### Existing-plan review
70
+
71
+ `enableExistingPlanReview` is opt-in and defaults to false, preserving existing
72
+ hosts. Enable it only after deploying the authenticated digitization API and
73
+ updating the host's scoped Client/gateway routes. It provides manual metric
74
+ coordinates, rooms and hosted-opening review. Explicit image recognition can
75
+ request unconfirmed pixel observations from Anthropic; that provider path still
76
+ requires live accuracy and cost validation. A calibration preview requires a
77
+ user-entered known distance and keeps every resulting dimension estimated. It
78
+ assumes a rectified image, reports missing values, and does not correct perspective
79
+ or confirm source geometry. Starting review from these suggestions keeps numeric
80
+ fields unconfirmed until the user supplies source values individually. Values entered by the user remain user-given, never certified
81
+ measurements. No save/export is trusted solely because the browser checked a box.
82
+ The server validates the exact graph hash, provenance and reviewed paths and
83
+ requires a successfully funded revision before export. PDF scale/paper options
84
+ appear only when the service reports PDF availability. The existing default
85
+ layout workflow and the frozen published 0.1.2 archive remain unchanged.
@@ -5,6 +5,7 @@ export interface StudioState {
5
5
  hasUnsavedChanges: boolean;
6
6
  }
7
7
  export interface StudioProps {
8
+ enableExistingPlanReview?: boolean;
8
9
  onStateChange?: (state: StudioState) => void;
9
10
  language?: Lang;
10
11
  brand?: 'baulynq' | 'karamentreprises';
@@ -0,0 +1,22 @@
1
+ import type { PendingDraft, Snapshot } from './types';
2
+ import type { Lang, Bundle } from './types';
3
+ import { type PlanApi } from './digitizationTypes';
4
+ export declare function DigitizationReview({ projectId, projectVersion, language, api, onState, onDownload, disabled, sourceObjectId, imageUrl, pendingDraft, persistPending, onPendingSaved, registerPendingSaver, loadSavedOnMount }: {
5
+ projectId: string;
6
+ projectVersion: number;
7
+ loadSavedOnMount?: boolean;
8
+ pendingDraft?: PendingDraft;
9
+ persistPending?: (pending: PendingDraft, expectedVersion: number, projectId: string) => Promise<Snapshot>;
10
+ onPendingSaved?: (snapshot: Snapshot) => void;
11
+ registerPendingSaver?: (save: (() => Promise<Snapshot | null>) | null) => void;
12
+ language: Lang;
13
+ sourceObjectId?: string;
14
+ imageUrl?: string;
15
+ disabled?: boolean;
16
+ api: PlanApi;
17
+ onState: (s: {
18
+ busy: boolean;
19
+ hasUnsavedChanges: boolean;
20
+ }) => void;
21
+ onDownload: (format: string, bundle: Bundle) => void;
22
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,125 @@
1
+ import type { ValueReport } from './types';
2
+ export type PlanValue = {
3
+ value: number;
4
+ origin: 'measured' | 'user-given' | 'calculated' | 'estimated';
5
+ source: string;
6
+ };
7
+ export type ExistingGraph = {
8
+ schemaVersion: number;
9
+ units: string;
10
+ vertices: {
11
+ id: string;
12
+ x: PlanValue;
13
+ y: PlanValue;
14
+ }[];
15
+ boundaryVertexIds: string[];
16
+ walls: {
17
+ id: string;
18
+ startVertexId: string;
19
+ endVertexId: string;
20
+ thickness: PlanValue;
21
+ type: string;
22
+ }[];
23
+ rooms: {
24
+ id: string;
25
+ name: string;
26
+ function: string;
27
+ vertexIds: string[];
28
+ }[];
29
+ openings: {
30
+ id: string;
31
+ kind: string;
32
+ hostWallId: string;
33
+ offset: PlanValue;
34
+ width: PlanValue;
35
+ height?: PlanValue | null;
36
+ sill?: PlanValue | null;
37
+ operation: string;
38
+ }[];
39
+ };
40
+ export type PlanReview = {
41
+ pricingNotice?: string;
42
+ requiredReviewPaths?: string[];
43
+ svg?: string;
44
+ contentHash: string;
45
+ geometryValidated: boolean;
46
+ canExport: boolean;
47
+ values: ValueReport;
48
+ findings: {
49
+ code: string;
50
+ message: string;
51
+ suggestedAction?: string;
52
+ }[];
53
+ };
54
+ export type PlanRevision = {
55
+ revision: number;
56
+ graph: ExistingGraph;
57
+ review: PlanReview;
58
+ sourceObjectId?: string | null;
59
+ svg?: string;
60
+ availableFormats?: string[];
61
+ pricingNotice?: string;
62
+ };
63
+ export type PlanApi = <T>(path: string, body?: unknown, method?: string) => Promise<T>;
64
+ export declare const emptyGraph: () => ExistingGraph;
65
+ export declare const enteredValue: (value: number) => PlanValue;
66
+ export declare const draftValue: () => PlanValue;
67
+ export declare const reviewedPaths: (r: PlanReview) => string[];
68
+ export declare const geometryNumbersPresent: (g: ExistingGraph) => boolean;
69
+ export type RasterReading = {
70
+ needsCalibration: boolean;
71
+ questions: string[];
72
+ findings: unknown[];
73
+ candidate: null | {
74
+ imageWidthPx: number;
75
+ imageHeightPx: number;
76
+ units: string;
77
+ vertices: {
78
+ id: string;
79
+ xPx: number;
80
+ yPx: number;
81
+ }[];
82
+ walls: {
83
+ id: string;
84
+ startVertexId: string;
85
+ endVertexId: string;
86
+ }[];
87
+ };
88
+ };
89
+ export type MetricDraft = {
90
+ schemaVersion: number;
91
+ units: string;
92
+ vertices: ExistingGraph['vertices'];
93
+ boundaryVertexIds: string[];
94
+ walls: {
95
+ id: string;
96
+ startVertexId: string;
97
+ endVertexId: string;
98
+ thickness: PlanValue | null;
99
+ type: string;
100
+ }[];
101
+ rooms: ExistingGraph['rooms'];
102
+ openings: {
103
+ id: string;
104
+ kind: string;
105
+ hostWallId: string;
106
+ offset: PlanValue | null;
107
+ width: PlanValue | null;
108
+ operation: string;
109
+ }[];
110
+ };
111
+ export type CalibrationResult = {
112
+ draft: MetricDraft | null;
113
+ findings: {
114
+ code: string;
115
+ message: string;
116
+ }[];
117
+ questions: string[];
118
+ independentCheck?: {
119
+ predictedLengthM: number;
120
+ independentLengthM: number;
121
+ signedResidualM: number;
122
+ } | null;
123
+ };
124
+ /** Draft observations are suggestions only. Caller review cannot turn them into confirmed measurements. */
125
+ export declare function graphFromSuggestions(d: MetricDraft): ExistingGraph;