@roomle/embedding-lib 0.0.0-dev-035a65b → 0.0.0-dev-b3e22ed

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- Third-party software notices for @roomle/embedding-lib 035a65b7c693396b4b4e5537586d8715d93de176
2
- Generated 2026-11-09
1
+ Third-party software notices for @roomle/embedding-lib b3e22ed58302754eb8fb86ca2c3975d509bab7d3
2
+ Generated 2026-11-10
3
3
 
4
4
  This product includes the following third-party components.
5
5
 
package/hi.js CHANGED
@@ -330,10 +330,53 @@ var i = (e, t) => t === e.libraryId ? e : {
330
330
  type: "availability",
331
331
  available: !0
332
332
  });
333
- }, L = {
333
+ }, L = 5e3, R = async ({ serverUrl: e, authorization: t }) => {
334
+ let n = t ? { Authorization: t } : {}, r;
335
+ try {
336
+ let t = await fetch(`${e}/backends/list`, {
337
+ headers: n,
338
+ signal: AbortSignal.timeout(L)
339
+ });
340
+ r = t.ok ? await t.json() : [];
341
+ } catch (e) {
342
+ return console.warn("No HI model proxy: the backend list failed", e), {};
343
+ }
344
+ if (!Array.isArray(r) || r.length !== 1) return {};
345
+ let [{ enableAIPlanning: i, enableAIRendering: a }] = r, o = `${e}/api/ai/v1`;
346
+ return {
347
+ ...i === !0 && { chat: {
348
+ provider: "openai-compatible",
349
+ baseUrl: o,
350
+ model: "planning",
351
+ headers: n,
352
+ responses: !0,
353
+ readsImages: !0
354
+ } },
355
+ ...a === !0 && { rendering: {
356
+ baseUrl: o,
357
+ model: "rendering",
358
+ headers: n
359
+ } }
360
+ };
361
+ }, z = (e = "1:1") => {
362
+ let [t, n] = e.split(":").map(Number);
363
+ return t === n ? "1024x1024" : t > n ? "1536x1024" : "1024x1536";
364
+ }, B = async (e) => (await fetch(e)).blob(), V = async (e, t, { baseUrl: n, model: r, headers: i }) => {
365
+ let { prompt: a, image: o, aspect: s } = JSON.parse(e.body), c = await B(o), l = new FormData();
366
+ l.append("model", r), l.append("prompt", a), l.append("size", z(s)), l.append("quality", "medium"), l.append("output_format", "png"), l.append("image", c, `scene.${c.type.split("/")[1]}`);
367
+ let u = await fetch(`${n}/images/edits`, {
368
+ method: "POST",
369
+ headers: i,
370
+ body: l,
371
+ signal: t
372
+ });
373
+ if (!u.ok) return u;
374
+ let { data: d } = await u.json(), f = d?.[0]?.b64_json, p = new FormData();
375
+ return f ? p.append("image", await B(`data:image/png;base64,${f}`)) : p.append("text", "The endpoint returned no image"), new Response(p);
376
+ }, H = {
334
377
  HIDE: "hide",
335
378
  SHOW_ATTRIBUTES: "attributes",
336
379
  SHOW_ARTICLES: "articles"
337
380
  };
338
381
  //#endregion
339
- export { L as HI_PANEL_ACTION, y as cleanupHi, p as createHiLibraryCallbacks, b as createHiMcpTools, u as libLoadArticleCatalog, f as libLoadCalcScript, d as libLoadMasterData, n as loadChatModel, h as omGetRequest, m as omPostRequest, s as registerLegacyUrlFormat, v as setupHi, I as startPlanningAssistant, c as unregisterLegacyUrlFormat };
382
+ export { H as HI_PANEL_ACTION, y as cleanupHi, p as createHiLibraryCallbacks, b as createHiMcpTools, u as libLoadArticleCatalog, f as libLoadCalcScript, d as libLoadMasterData, n as loadChatModel, h as omGetRequest, m as omPostRequest, s as registerLegacyUrlFormat, V as requestImageEdits, R as resolveHiModelProxy, v as setupHi, I as startPlanningAssistant, c as unregisterLegacyUrlFormat };
package/hi.min.js CHANGED
@@ -294,9 +294,52 @@ var i = (e, t) => t === e.libraryId ? e : {
294
294
  type: "availability",
295
295
  available: !0
296
296
  });
297
- }, M = {
297
+ }, M = async ({ serverUrl: e, authorization: t }) => {
298
+ let n = t ? { Authorization: t } : {}, r;
299
+ try {
300
+ let t = await fetch(`${e}/backends/list`, {
301
+ headers: n,
302
+ signal: AbortSignal.timeout(5e3)
303
+ });
304
+ r = t.ok ? await t.json() : [];
305
+ } catch {
306
+ return {};
307
+ }
308
+ if (!Array.isArray(r) || r.length !== 1) return {};
309
+ let [{ enableAIPlanning: i, enableAIRendering: a }] = r, o = `${e}/api/ai/v1`;
310
+ return {
311
+ ...!0 === i && { chat: {
312
+ provider: "openai-compatible",
313
+ baseUrl: o,
314
+ model: "planning",
315
+ headers: n,
316
+ responses: !0,
317
+ readsImages: !0
318
+ } },
319
+ ...!0 === a && { rendering: {
320
+ baseUrl: o,
321
+ model: "rendering",
322
+ headers: n
323
+ } }
324
+ };
325
+ }, N = async (e) => (await fetch(e)).blob(), P = async (e, t, { baseUrl: n, model: r, headers: i }) => {
326
+ let { prompt: a, image: o, aspect: s } = JSON.parse(e.body), c = await N(o), l = new FormData();
327
+ l.append("model", r), l.append("prompt", a), l.append("size", ((e = "1:1") => {
328
+ let [t, n] = e.split(":").map(Number);
329
+ return t === n ? "1024x1024" : t > n ? "1536x1024" : "1024x1536";
330
+ })(s)), l.append("quality", "medium"), l.append("output_format", "png"), l.append("image", c, `scene.${c.type.split("/")[1]}`);
331
+ let u = await fetch(`${n}/images/edits`, {
332
+ method: "POST",
333
+ headers: i,
334
+ body: l,
335
+ signal: t
336
+ });
337
+ if (!u.ok) return u;
338
+ let { data: d } = await u.json(), f = d?.[0]?.b64_json, p = new FormData();
339
+ return f ? p.append("image", await N(`data:image/png;base64,${f}`)) : p.append("text", "The endpoint returned no image"), new Response(p);
340
+ }, F = {
298
341
  HIDE: "hide",
299
342
  SHOW_ATTRIBUTES: "attributes",
300
343
  SHOW_ARTICLES: "articles"
301
344
  };
302
- export { M as HI_PANEL_ACTION, v as cleanupHi, p as createHiLibraryCallbacks, y as createHiMcpTools, u as libLoadArticleCatalog, f as libLoadCalcScript, d as libLoadMasterData, n as loadChatModel, h as omGetRequest, m as omPostRequest, s as registerLegacyUrlFormat, _ as setupHi, j as startPlanningAssistant, c as unregisterLegacyUrlFormat };
345
+ export { F as HI_PANEL_ACTION, v as cleanupHi, p as createHiLibraryCallbacks, y as createHiMcpTools, u as libLoadArticleCatalog, f as libLoadCalcScript, d as libLoadMasterData, n as loadChatModel, h as omGetRequest, m as omPostRequest, s as registerLegacyUrlFormat, P as requestImageEdits, M as resolveHiModelProxy, _ as setupHi, j as startPlanningAssistant, c as unregisterLegacyUrlFormat };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "0.0.0-dev-035a65b",
3
+ "version": "0.0.0-dev-b3e22ed",
4
4
  "description": "This is a small library which can be used to communicate with the Roomle Configurator. ES modules only (browser-compatible).",
5
5
  "type": "module",
6
6
  "main": "./roomle-embedding-lib.js",
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The iframe hands its AI model requests to the host page ("bring your own
3
+ * endpoint"), over Comlink on a port it sends, like connect_hi
4
+ */
5
+ export type AiFeature = 'lifestyle-rendering';
6
+ /**
7
+ * The feature names what the request is for, so no route, method or headers
8
+ * of a built-in endpoint reach the host. A feature with several operations
9
+ * (e.g. edit, upscale) would add an `operation` field then; today each
10
+ * feature has one.
11
+ */
12
+ export interface AiModelRequest {
13
+ feature: AiFeature;
14
+ /** The feature's input as JSON, e.g. a RenderingInput; never a key */
15
+ body: string;
16
+ }
17
+ /**
18
+ * A rendering request, the same on every route: JSON for a host page's own
19
+ * endpoint, the b2c-api's multipart form for the built-in one. The named
20
+ * fields are the contract; options added later come as further fields, which
21
+ * a host may ignore.
22
+ */
23
+ export interface RenderingInput {
24
+ prompt: string;
25
+ /** The upload as a data URL */
26
+ image: string;
27
+ /** Output size tier, e.g. 2K */
28
+ size?: string;
29
+ /** Supported ratio closest to the image, e.g. 3:2 */
30
+ aspect?: string;
31
+ /** Image model of the backend; unset: its default */
32
+ model?: string;
33
+ [option: string]: unknown;
34
+ }
35
+ export type AiModelAuthReason = 'start' | 'expired';
36
+ export interface AiModelHandlers {
37
+ onAiModelRequest(request: AiModelRequest, signal: AbortSignal): Promise<Response>;
38
+ /**
39
+ * The host's login: 'start' when the chat shows signed out, 'expired'
40
+ * after a 401; true unlocks the AI features. Without it there is no login
41
+ * gate.
42
+ */
43
+ onRequestAiModelAuth?(reason: AiModelAuthReason, feature: AiFeature): Promise<boolean>;
44
+ }
45
+ /** The host page ended the request itself, e.g. aborted its own fetch */
46
+ export declare class AiModelRequestCancelledError extends Error {
47
+ constructor();
48
+ }
49
+ interface AiModelAnswer {
50
+ status: number;
51
+ statusText: string;
52
+ headers: [string, string][];
53
+ body: ArrayBuffer;
54
+ }
55
+ export interface AiModelHost {
56
+ request(request: AiModelRequest, signal: AbortSignal): Promise<AiModelAnswer>;
57
+ auth(reason: AiModelAuthReason, feature: AiFeature): Promise<boolean>;
58
+ }
59
+ export interface AiModelConnection extends AiModelHost {
60
+ /** Ends the connection; the host's side ends with its relay */
61
+ close(): void;
62
+ }
63
+ export declare const connectAiModelHost: (host: Window) => AiModelConnection;
64
+ /** Rejects at once on `signal`'s abort, whether the host stops or not */
65
+ export declare const relayAiModelRequest: (host: AiModelHost, request: AiModelRequest, signal?: AbortSignal) => Promise<Response>;
66
+ /**
67
+ * False once `signal` aborts, whatever the host answers later, and when the
68
+ * relay fails
69
+ */
70
+ export declare const relayAiModelAuth: (host: AiModelHost, reason: AiModelAuthReason, feature: AiFeature, signal?: AbortSignal) => Promise<boolean>;
71
+ export declare const serveAiModelRelay: (source: Window, origin: string, handlers: AiModelHandlers) => (() => void);
72
+ export {};
@@ -1,7 +1,6 @@
1
1
  import { default as RoomleEmbeddingApi } from './roomle-embedding-lib';
2
2
  import { AiFeature, AiModelHandlers } from '../../common/src/utils/ai-model-relay';
3
- export type { AiFeature, AiModelAuthReason, AiModelHandlers, AiModelRequest, } from '../../common/src/utils/ai-model-relay';
4
- export type { RenderingInput } from '../../../src/common/utils/img-gen';
3
+ export type { AiFeature, AiModelAuthReason, AiModelHandlers, AiModelRequest, RenderingInput, } from '../../common/src/utils/ai-model-relay';
5
4
  export interface AiModelHostOptions extends AiModelHandlers {
6
5
  /**
7
6
  * The features the host answers; the others keep the built-in endpoints.
@@ -16,5 +16,7 @@ export { omPostRequest, omGetRequest, } from './homag-intelligence/hi-order-mana
16
16
  export { setupHi, cleanupHi } from './homag-intelligence/hi-setup';
17
17
  export { createHiMcpTools, type HiMcpTool, type HiMcpTools, type HiMcpPlannerApi, } from './homag-intelligence/hi-mcp-tools';
18
18
  export { loadChatModel, startPlanningAssistant, type PlanningAssistantConfig, type PlanningAssistantPlannerApi, } from './homag-intelligence/hi-planning-assistant';
19
+ export { resolveHiModelProxy, type HiModelProxy, type HiModelProxyOptions, } from './homag-intelligence/hi-model-proxy';
20
+ export { requestImageEdits, type ImageEditsEndpoint, } from './homag-intelligence/image-edits';
19
21
  export { type ExternalObjectSnapshotSaveResult, type HiContextAction, } from '../../web-sdk/packages';
20
22
  export { HI_PANEL_ACTION, type HiPanelActionType, type HiOrderHeader, type HiOrder, type HiOrderData, type HiPriceData, type HiCallbacks, } from '../../common/src/hi/hi-types';
@@ -0,0 +1,26 @@
1
+ import { ImageEditsEndpoint } from './image-edits';
2
+ import { PlanningAssistantConfig } from '../planning-assistant/chat-model';
3
+ /**
4
+ * What the model proxy of the HI server serves the HI user. The model, its
5
+ * endpoint and its key stay in the backend; the page sends only its
6
+ * authorization.
7
+ */
8
+ export interface HiModelProxy {
9
+ /** The AI Planning Assistant, when the backend's `enableAIPlanning` is true */
10
+ chat?: PlanningAssistantConfig;
11
+ /** The lifestyle renderings of the AI image chat, when the backend's `enableAIRendering` is true */
12
+ rendering?: ImageEditsEndpoint;
13
+ }
14
+ export interface HiModelProxyOptions {
15
+ /** The HI server, e.g. `https://dfscfgtest01-app.azurewebsites.net`; `''` for the page's own origin */
16
+ serverUrl: string;
17
+ /** The Basic authorization of the HI user; without it, the browser's session of a same-origin page */
18
+ authorization?: string;
19
+ }
20
+ /**
21
+ * Reads the backend list of the HI user and returns what the model proxy of
22
+ * the HI server serves. The proxy serves only a user of exactly one backend:
23
+ * the chat when that backend's `enableAIPlanning` is true, the renderings
24
+ * when its `enableAIRendering` is true. A failed backend list serves neither.
25
+ */
26
+ export declare const resolveHiModelProxy: ({ serverUrl, authorization, }: HiModelProxyOptions) => Promise<HiModelProxy>;
@@ -0,0 +1,21 @@
1
+ import { AiModelRequest } from '../../../common/src/utils/ai-model-relay';
2
+ /**
3
+ * An endpoint that speaks OpenAI images/edits, e.g. the model proxy of the HI
4
+ * server or an Azure AI Foundry resource
5
+ */
6
+ export interface ImageEditsEndpoint {
7
+ /** The OpenAI v1 base URL; the request goes to `<baseUrl>/images/edits` */
8
+ baseUrl: string;
9
+ /** The model name the endpoint expects, e.g. `rendering` on the HI model proxy */
10
+ model: string;
11
+ /** Sent with every request, e.g. `Authorization` or `api-key` */
12
+ headers?: Record<string, string>;
13
+ }
14
+ /**
15
+ * Answers a rendering request of the AI image chat at an images/edits
16
+ * endpoint: sends the prompt and the capture with the endpoint's model and
17
+ * headers, and answers the chat with a form holding the image, or a text when
18
+ * the endpoint returns none. An error answer goes back unchanged: the chat
19
+ * reads its status, its `Retry-After` and OpenAI's `error.message` itself.
20
+ */
21
+ export declare const requestImageEdits: (request: AiModelRequest, signal: AbortSignal, { baseUrl, model, headers }: ImageEditsEndpoint) => Promise<Response>;
@@ -0,0 +1,12 @@
1
+ import { AgentMcpTools } from './mcp-tools';
2
+ /**
3
+ * Records tool execution independently of whether the model finishes its
4
+ * step, so an interrupted reply can say what the tools changed.
5
+ */
6
+ export declare const createChatRecovery: (tools: AgentMcpTools, domain?: {
7
+ subject: string;
8
+ readTools: ReadonlySet<string>;
9
+ }) => {
10
+ tools: AgentMcpTools;
11
+ summary: () => string;
12
+ };
@@ -0,0 +1,17 @@
1
+ import { PlanningAssistantOutput, PlanningAssistantPrompt } from '../planning-assistant';
2
+ import { PlanningAssistantConfig } from './chat-model';
3
+ import { AgentMcpTools } from './mcp-tools';
4
+ /** Runs a browser agent with the tools and prompts supplied by its SDK domain. */
5
+ export declare const createAssistant: (config: PlanningAssistantConfig, signal: AbortSignal, output: (part: PlanningAssistantOutput) => unknown, setupDomain: () => Promise<{
6
+ prompts: {
7
+ systemPrompt: string;
8
+ imagePrompt: string;
9
+ };
10
+ tools: AgentMcpTools;
11
+ }>, turnPolicy?: {
12
+ timeoutMs: number;
13
+ recovery: (tools: AgentMcpTools) => {
14
+ tools: AgentMcpTools;
15
+ summary(): string;
16
+ };
17
+ }) => Promise<(prompt: PlanningAssistantPrompt) => Promise<void>>;
@@ -0,0 +1,36 @@
1
+ /** The message the user sends in the AI Planning Assistant window. */
2
+ export interface PlanningAssistantPrompt {
3
+ /** What the user typed, trimmed; empty when the user sends only an image. */
4
+ text: string;
5
+ /** The images of the message as JPEG data URLs: the long side at most 1568 px, EXIF rotation applied, transparent parts white. */
6
+ images: string[];
7
+ }
8
+ /**
9
+ * One part of the output of the host's planning agent for the AI Planning Assistant window:
10
+ * - "text": a piece of the answer of the running turn, markdown, appended to the answer
11
+ * - "activity": what the agent does now, e.g. the tool it runs, shown in the status line
12
+ * - "error": the turn failed; the text replaces the answer of the turn and ends the turn
13
+ * - "done": the turn is complete; the input is free again
14
+ * - "availability": the input on or off, with the reason shown in the status line; off until the host enables it
15
+ * - "images": the image drop on or off; off until the host enables it
16
+ */
17
+ export type PlanningAssistantOutput = {
18
+ type: 'text';
19
+ text: string;
20
+ } | {
21
+ type: 'activity';
22
+ text: string;
23
+ } | {
24
+ type: 'error';
25
+ text: string;
26
+ statusCode?: number;
27
+ } | {
28
+ type: 'done';
29
+ } | {
30
+ type: 'availability';
31
+ available: boolean;
32
+ text?: string;
33
+ } | {
34
+ type: 'images';
35
+ enabled: boolean;
36
+ };
package/sbom.cdx.json CHANGED
@@ -3,14 +3,14 @@
3
3
  "bomFormat": "CycloneDX",
4
4
  "specVersion": "1.6",
5
5
  "version": 1,
6
- "serialNumber": "urn:uuid:68eb4b07-e841-538c-9290-e0276705160c",
6
+ "serialNumber": "urn:uuid:43c285ff-db6e-571a-bab7-d0365491f0b4",
7
7
  "metadata": {
8
- "timestamp": "2026-11-09T18:41:24.000Z",
8
+ "timestamp": "2026-11-10T10:46:00.000Z",
9
9
  "component": {
10
10
  "type": "library",
11
11
  "name": "@roomle/embedding-lib",
12
- "version": "035a65b7c693396b4b4e5537586d8715d93de176",
13
- "bom-ref": "@roomle/embedding-lib@035a65b7c693396b4b4e5537586d8715d93de176"
12
+ "version": "b3e22ed58302754eb8fb86ca2c3975d509bab7d3",
13
+ "bom-ref": "@roomle/embedding-lib@b3e22ed58302754eb8fb86ca2c3975d509bab7d3"
14
14
  }
15
15
  },
16
16
  "components": [
@@ -351,7 +351,7 @@
351
351
  ],
352
352
  "dependencies": [
353
353
  {
354
- "ref": "@roomle/embedding-lib@035a65b7c693396b4b4e5537586d8715d93de176"
354
+ "ref": "@roomle/embedding-lib@b3e22ed58302754eb8fb86ca2c3975d509bab7d3"
355
355
  },
356
356
  {
357
357
  "ref": "pkg:npm/%40ai-sdk/anthropic@4.0.68"