@roomle/embedding-lib 11.0.0-alpha.12 → 11.0.0-alpha.13
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/THIRD-PARTY-NOTICES.txt +2 -2
- package/ai-model-host-CaiYrZkh.mjs +152 -0
- package/ai-model-host-HAJONHCj.mjs +156 -0
- package/ai.js +1 -128
- package/ai.min.js +1 -127
- package/chat-model-DooKwd8I.mjs +117 -0
- package/chat-model-KHuz1Ej9.mjs +118 -0
- package/configurator.js +2 -2
- package/configurator.min.js +2 -2
- package/construction.js +17718 -162
- package/construction.min.js +17397 -177
- package/docs/md/web/embedding/CHANGELOG.md +93 -4
- package/hi.js +91 -393
- package/hi.min.js +88 -351
- package/{mcp-tools-BLB7pCga.mjs → mcp-tools-C6O2gQZW.mjs} +0 -1
- package/{mcp-tools-BirFT2R0.mjs → mcp-tools-m_3IX0vB.mjs} +0 -1
- package/package.json +1 -1
- package/packages/common/src/utils/ai-model-relay.d.ts +1 -1
- package/packages/embedding-lib/src/ai-model-host.d.ts +36 -0
- package/packages/embedding-lib/src/ai.d.ts +11 -27
- package/packages/embedding-lib/src/hi.d.ts +1 -0
- package/packages/embedding-lib/src/homag-intelligence/decisions.d.ts +7 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-model-proxy.d.ts +4 -1
- package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +9 -19
- package/packages/web-sdk/packages/assistant.d.ts +2 -1
- package/packages/web-sdk/packages/common-core/src/planning-assistant/chat-recovery.d.ts +5 -1
- package/packages/web-sdk/packages/common-core/src/planning-assistant/continuation.d.ts +5 -3
- package/packages/web-sdk/packages/common-core/src/planning-assistant/usage.d.ts +31 -0
- package/roomle-embedding-lib.js +37 -37
- package/roomle-embedding-lib.min.js +30 -30
- package/sbom.cdx.json +5 -5
- package/usage-C3HE9yXi.mjs +33 -0
- package/usage-CYqDPQOx.mjs +34 -0
- package/chat-model-B7BO8IhK.mjs +0 -212
- package/chat-model-XYf503pT.mjs +0 -213
- package/continuation-CswXtOus.mjs +0 -10
- package/continuation-NclHDSgS.mjs +0 -9
- package/dist-BZSd56sr.mjs +0 -17422
- package/dist-S9sLSjZ4.mjs +0 -17087
- package/packages/embedding-lib/src/homag-intelligence/hi-planning-usage.d.ts +0 -54
- package/turn-limits-9LbUeSG2.mjs +0 -9
- package/turn-limits-Ciq383Bd.mjs +0 -10
|
@@ -1,5 +1,94 @@
|
|
|
1
|
-
## 11.0.0-alpha.
|
|
1
|
+
## 11.0.0-alpha.13 (2026-11-25)
|
|
2
2
|
|
|
3
|
-
* Merge branch '
|
|
4
|
-
* Merge
|
|
5
|
-
*
|
|
3
|
+
* Merge branch 'feat/isolation-bug-report-RML-18787' into feat/planning-assistant-furnish-and-decorate ([70604e3](https://github.com/roomle-dev/roomle-ui/commit/70604e3))
|
|
4
|
+
* Merge branch 'feat/planner-assistant-session-log-RML-18785' into feat/planning-assistant-furnish-and ([cde218c](https://github.com/roomle-dev/roomle-ui/commit/cde218c))
|
|
5
|
+
* Merge branch 'fix/configuration-asistant-issues' into feat/planning-assistant-furnish-and-decorate-R ([c9f428f](https://github.com/roomle-dev/roomle-ui/commit/c9f428f))
|
|
6
|
+
* Merge branch 'master' into chore/RML-18859-gpu-launch-args ([5ab202b](https://github.com/roomle-dev/roomle-ui/commit/5ab202b))
|
|
7
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([0ee9958](https://github.com/roomle-dev/roomle-ui/commit/0ee9958))
|
|
8
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([021f468](https://github.com/roomle-dev/roomle-ui/commit/021f468))
|
|
9
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([1ed5344](https://github.com/roomle-dev/roomle-ui/commit/1ed5344))
|
|
10
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([33250e9](https://github.com/roomle-dev/roomle-ui/commit/33250e9))
|
|
11
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([a147fb3](https://github.com/roomle-dev/roomle-ui/commit/a147fb3))
|
|
12
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([715a797](https://github.com/roomle-dev/roomle-ui/commit/715a797))
|
|
13
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([43849e8](https://github.com/roomle-dev/roomle-ui/commit/43849e8))
|
|
14
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([8083711](https://github.com/roomle-dev/roomle-ui/commit/8083711))
|
|
15
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([bdb15b4](https://github.com/roomle-dev/roomle-ui/commit/bdb15b4))
|
|
16
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([3447a71](https://github.com/roomle-dev/roomle-ui/commit/3447a71))
|
|
17
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([730acbd](https://github.com/roomle-dev/roomle-ui/commit/730acbd))
|
|
18
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([e365677](https://github.com/roomle-dev/roomle-ui/commit/e365677))
|
|
19
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([aaebac4](https://github.com/roomle-dev/roomle-ui/commit/aaebac4))
|
|
20
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([bafec3c](https://github.com/roomle-dev/roomle-ui/commit/bafec3c))
|
|
21
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([a4c2e4a](https://github.com/roomle-dev/roomle-ui/commit/a4c2e4a))
|
|
22
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([b8ef8fc](https://github.com/roomle-dev/roomle-ui/commit/b8ef8fc))
|
|
23
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([f5c30f3](https://github.com/roomle-dev/roomle-ui/commit/f5c30f3))
|
|
24
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([d07cf6d](https://github.com/roomle-dev/roomle-ui/commit/d07cf6d))
|
|
25
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([9d2bc72](https://github.com/roomle-dev/roomle-ui/commit/9d2bc72))
|
|
26
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([941ba1d](https://github.com/roomle-dev/roomle-ui/commit/941ba1d))
|
|
27
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([2e801d9](https://github.com/roomle-dev/roomle-ui/commit/2e801d9))
|
|
28
|
+
* Merge branch 'master' into feat/planning-assistant-furnish-and-decorate-RML-18637 ([217c946](https://github.com/roomle-dev/roomle-ui/commit/217c946))
|
|
29
|
+
* Merge branch 'master' into fix/buggy-wall-dragging ([2d8c760](https://github.com/roomle-dev/roomle-ui/commit/2d8c760))
|
|
30
|
+
* Merge branch 'master' into fix/custom-api-url-as-given-RML-17813 ([93a0f22](https://github.com/roomle-dev/roomle-ui/commit/93a0f22))
|
|
31
|
+
* Merge branch 'master' into release/test ([93f2016](https://github.com/roomle-dev/roomle-ui/commit/93f2016))
|
|
32
|
+
* Merge branch 'master' into release/test ([376b1e4](https://github.com/roomle-dev/roomle-ui/commit/376b1e4))
|
|
33
|
+
* Merge branch 'master' into release/test ([5e3b414](https://github.com/roomle-dev/roomle-ui/commit/5e3b414))
|
|
34
|
+
* Merge branch 'refactor/hi-planning-assistant-in-the-sdk-RML-18851' into feat/planning-assistant-furn ([195e38e](https://github.com/roomle-dev/roomle-ui/commit/195e38e))
|
|
35
|
+
* Merge pull request #3421 from roomle-dev/feat/planning-assistant-furnish-and-decorate-RML-18637 ([02f2f41](https://github.com/roomle-dev/roomle-ui/commit/02f2f41)), closes [#3421](https://github.com/roomle-dev/roomle-ui/issues/3421)
|
|
36
|
+
* Merge pull request #3468 from roomle-dev/fix/buggy-wall-dragging ([cb05075](https://github.com/roomle-dev/roomle-ui/commit/cb05075)), closes [#3468](https://github.com/roomle-dev/roomle-ui/issues/3468)
|
|
37
|
+
* Merge pull request #3469 from roomle-dev/chore/RML-18859-gpu-launch-args ([2433ca9](https://github.com/roomle-dev/roomle-ui/commit/2433ca9)), closes [#3469](https://github.com/roomle-dev/roomle-ui/issues/3469)
|
|
38
|
+
* Merge pull request #3472 from roomle-dev/fix/custom-api-url-as-given-RML-17813 ([7162c8d](https://github.com/roomle-dev/roomle-ui/commit/7162c8d)), closes [#3472](https://github.com/roomle-dev/roomle-ui/issues/3472)
|
|
39
|
+
* Merge pull request #3473 from roomle-dev/feat/rapi-v3-dashboard-RML-17813 ([0a370f4](https://github.com/roomle-dev/roomle-ui/commit/0a370f4)), closes [#3473](https://github.com/roomle-dev/roomle-ui/issues/3473)
|
|
40
|
+
* Merge pull request #3474 from roomle-dev/fix/rapi-v3-dashboard-glitches-RML-17813 ([183c33c](https://github.com/roomle-dev/roomle-ui/commit/183c33c)), closes [#3474](https://github.com/roomle-dev/roomle-ui/issues/3474)
|
|
41
|
+
* Merge pull request #3475 from roomle-dev/fix/e2e-v2-mocks-embedding-4-44-RML-17813 ([b77d949](https://github.com/roomle-dev/roomle-ui/commit/b77d949)), closes [#3475](https://github.com/roomle-dev/roomle-ui/issues/3475)
|
|
42
|
+
* test(e2e): record v2 mocks for embedding lib 4.44.0 ([e242b74](https://github.com/roomle-dev/roomle-ui/commit/e242b74)), closes [#3472](https://github.com/roomle-dev/roomle-ui/issues/3472)
|
|
43
|
+
* fix: address review comments on PR #3421 ([83084ce](https://github.com/roomle-dev/roomle-ui/commit/83084ce)), closes [#3421](https://github.com/roomle-dev/roomle-ui/issues/3421)
|
|
44
|
+
* fix: address review comments on PR #3421 ([6344de7](https://github.com/roomle-dev/roomle-ui/commit/6344de7)), closes [#3421](https://github.com/roomle-dev/roomle-ui/issues/3421)
|
|
45
|
+
* fix(rapi): address review of customApiUrl as given ([01ddc92](https://github.com/roomle-dev/roomle-ui/commit/01ddc92))
|
|
46
|
+
* fix(rapi): address review of the RAPI v3 dashboard ([4b19af5](https://github.com/roomle-dev/roomle-ui/commit/4b19af5))
|
|
47
|
+
* fix: address the review comments on the host model, the hi session start, the catalog sources and th ([41846ab](https://github.com/roomle-dev/roomle-ui/commit/41846ab))
|
|
48
|
+
* fix: address the review comments on the relay registration, the wall placement, the skill index and ([bb78be9](https://github.com/roomle-dev/roomle-ui/commit/bb78be9))
|
|
49
|
+
* fix: apply the review of the planning tools and share the assistant code ([f972d04](https://github.com/roomle-dev/roomle-ui/commit/f972d04))
|
|
50
|
+
* fix: apply the review on the parameter setter, the catalog walk and the image capability ([816e389](https://github.com/roomle-dev/roomle-ui/commit/816e389))
|
|
51
|
+
* fix(rapi): centre the donut label and reorder the bar counters ([0f3a500](https://github.com/roomle-dev/roomle-ui/commit/0f3a500))
|
|
52
|
+
* fix: find a catalog item through every parent and every source ([6249a33](https://github.com/roomle-dev/roomle-ui/commit/6249a33))
|
|
53
|
+
* fix: keep resume silent during shutdown and close the decisions host on dispose ([10243dc](https://github.com/roomle-dev/roomle-ui/commit/10243dc))
|
|
54
|
+
* fix: keep the types of the assistant entry free of the AI SDK ([3d96dc0](https://github.com/roomle-dev/roomle-ui/commit/3d96dc0))
|
|
55
|
+
* fix: moving the mouse vertically while dragging wall move evenly now ([3750d35](https://github.com/roomle-dev/roomle-ui/commit/3750d35))
|
|
56
|
+
* fix: never let an assistant switch between the planner and isolation ([c2a1cee](https://github.com/roomle-dev/roomle-ui/commit/c2a1cee))
|
|
57
|
+
* fix(rapi): pass defaultApiUrl to AR and the headless SDK ([ea7871f](https://github.com/roomle-dev/roomle-ui/commit/ea7871f))
|
|
58
|
+
* fix(embedding-lib): pass the examples' api url as defaultApiUrl ([39aca45](https://github.com/roomle-dev/roomle-ui/commit/39aca45))
|
|
59
|
+
* fix: review fixes ([8b3ce1c](https://github.com/roomle-dev/roomle-ui/commit/8b3ce1c))
|
|
60
|
+
* fix(rapi): scan only the requests each RAPI helper makes ([48d70f7](https://github.com/roomle-dev/roomle-ui/commit/48d70f7))
|
|
61
|
+
* fix: tell the planning assistant the colour, texture and kind of a wall or floor material ([235a48e](https://github.com/roomle-dev/roomle-ui/commit/235a48e))
|
|
62
|
+
* fix(rapi): use a host's customApiUrl as given ([0316091](https://github.com/roomle-dev/roomle-ui/commit/0316091))
|
|
63
|
+
* chore: align Chromium GPU args with rubens-e2e-testing ([05a4319](https://github.com/roomle-dev/roomle-ui/commit/05a4319))
|
|
64
|
+
* chore: make sure dragged walls do not snap to themselves ([bef997b](https://github.com/roomle-dev/roomle-ui/commit/bef997b))
|
|
65
|
+
* chore: merge master into fix/custom-api-url-as-given-RML-17813 ([c7d29ab](https://github.com/roomle-dev/roomle-ui/commit/c7d29ab))
|
|
66
|
+
* chore(rapi): move the RAPI v3 dashboard to its own PR ([3e6a19d](https://github.com/roomle-dev/roomle-ui/commit/3e6a19d))
|
|
67
|
+
* feat(rapi): add a RAPI v3 migration dashboard page ([fe05216](https://github.com/roomle-dev/roomle-ui/commit/fe05216))
|
|
68
|
+
* feat(rapi): add a RAPI v3 migration dashboard page ([900ecdb](https://github.com/roomle-dev/roomle-ui/commit/900ecdb))
|
|
69
|
+
* feat: add construction elements and catalog objects with the planning tools ([40755e2](https://github.com/roomle-dev/roomle-ui/commit/40755e2))
|
|
70
|
+
* feat: ask for new doors and windows similar to the existing ones ([416be9a](https://github.com/roomle-dev/roomle-ui/commit/416be9a))
|
|
71
|
+
* feat(rapi): expand dashboard bar rows to list missing and v3 endpoints ([f314616](https://github.com/roomle-dev/roomle-ui/commit/f314616))
|
|
72
|
+
* feat: furnish and decorate a room with skills of the planning assistant ([b78ccfd](https://github.com/roomle-dev/roomle-ui/commit/b78ccfd))
|
|
73
|
+
* feat: list every value of a planner parameter ([0ebac43](https://github.com/roomle-dev/roomle-ui/commit/0ebac43))
|
|
74
|
+
* feat: list the items of a catalog search chunk in a random order ([75c496c](https://github.com/roomle-dev/roomle-ui/commit/75c496c))
|
|
75
|
+
* feat: read the skills of the assistants from the roomle ai gateway ([b790eb6](https://github.com/roomle-dev/roomle-ui/commit/b790eb6))
|
|
76
|
+
* feat: read the values of one planner parameter beyond the first 20 ([a6341ed](https://github.com/roomle-dev/roomle-ui/commit/a6341ed))
|
|
77
|
+
* feat(rapi): scan the RAPI endpoints in use for the dashboard ([108d67e](https://github.com/roomle-dev/roomle-ui/commit/108d67e))
|
|
78
|
+
* feat: serve the decisions of the hi planning assistant through the hi model proxy ([12fa696](https://github.com/roomle-dev/roomle-ui/commit/12fa696))
|
|
79
|
+
* feat: show the bug report button of the hi planning assistant in the hi demos ([b6331a3](https://github.com/roomle-dev/roomle-ui/commit/b6331a3))
|
|
80
|
+
* feat: show the loading spinner in the assistant chat while a turn runs ([78432c9](https://github.com/roomle-dev/roomle-ui/commit/78432c9))
|
|
81
|
+
* feat: tell the planning assistant the label of a room ([4a2389e](https://github.com/roomle-dev/roomle-ui/commit/4a2389e))
|
|
82
|
+
* docs: a fix of the HI tools never enlarges the context of the model ([1644b98](https://github.com/roomle-dev/roomle-ui/commit/1644b98))
|
|
83
|
+
* docs: add the hard rules for the context and the tools of the assistants ([cca1a7e](https://github.com/roomle-dev/roomle-ui/commit/cca1a7e))
|
|
84
|
+
* docs: allow limits that tell the agent there is more and let it read on and filter ([8622f67](https://github.com/roomle-dev/roomle-ui/commit/8622f67))
|
|
85
|
+
* docs(agents): describe defaultApiUrl for examples and the v3 dashboard ([0ff0566](https://github.com/roomle-dev/roomle-ui/commit/0ff0566))
|
|
86
|
+
* docs: describe the skills of the assistants on the roomle ai gateway ([12d5fac](https://github.com/roomle-dev/roomle-ui/commit/12d5fac))
|
|
87
|
+
* docs: give the rotations adr the free number 0026 ([8bea796](https://github.com/roomle-dev/roomle-ui/commit/8bea796))
|
|
88
|
+
* docs: name the photo facts as configuration of the hi decision model ([45d3f3a](https://github.com/roomle-dev/roomle-ui/commit/45d3f3a))
|
|
89
|
+
* docs: name the renamed test and backlog files of roomle-hi-example ([ea02904](https://github.com/roomle-dev/roomle-ui/commit/ea02904))
|
|
90
|
+
* style(rapi): format the rapi-version import ([ebe9714](https://github.com/roomle-dev/roomle-ui/commit/ebe9714))
|
|
91
|
+
* refactor: move the skill loader of the HI tools to common-core ([1b525cd](https://github.com/roomle-dev/roomle-ui/commit/1b525cd))
|
|
92
|
+
* refactor: remove the code comments of the planning assistant branch ([6a60efc](https://github.com/roomle-dev/roomle-ui/commit/6a60efc))
|
|
93
|
+
* refactor: run the hi planning assistant in the sdk turn loop ([06e26fa](https://github.com/roomle-dev/roomle-ui/commit/06e26fa))
|
|
94
|
+
* revert: include end panel thickness and template back dimensions in C38 ([5b0cdd3](https://github.com/roomle-dev/roomle-ui/commit/5b0cdd3))
|
package/hi.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
|
|
2
2
|
import { t as e } from "./utils-CJnKZceY.mjs";
|
|
3
3
|
import { t } from "./browser-Cys-y5Hy.mjs";
|
|
4
|
-
import { t as n } from "./
|
|
5
|
-
import {
|
|
6
|
-
import { n as a } from "./
|
|
7
|
-
import {
|
|
4
|
+
import { t as n } from "./chat-model-KHuz1Ej9.mjs";
|
|
5
|
+
import { t as r } from "./mcp-tools-C6O2gQZW.mjs";
|
|
6
|
+
import { n as i, t as a } from "./ai-model-host-HAJONHCj.mjs";
|
|
7
|
+
import { o } from "./usage-CYqDPQOx.mjs";
|
|
8
8
|
var s = (e, t) => t === e.libraryId ? e : {
|
|
9
9
|
...e,
|
|
10
10
|
libraryId: t
|
|
@@ -69,427 +69,97 @@ var s = (e, t) => t === e.libraryId ? e : {
|
|
|
69
69
|
x &&= (window.removeEventListener("message", x), null);
|
|
70
70
|
}, w = async ({ extended: e }) => {
|
|
71
71
|
if (typeof e.getExternalObjectAgentTools != "function") throw Error("The planner has no HI agent tools: it needs a Rubens UI with getExternalObjectAgentTools.");
|
|
72
|
-
return
|
|
73
|
-
}, T = (e) =>
|
|
74
|
-
|
|
75
|
-
outputTokens: T(e.outputTokens),
|
|
76
|
-
totalTokens: T(e.totalTokens) ?? (T(e.inputTokens) !== null && T(e.outputTokens) !== null ? e.inputTokens + e.outputTokens : null)
|
|
77
|
-
}), D = (e) => e.some((e) => e !== null) ? e.reduce((e, t) => e + (t ?? 0), 0) : null, O = (e = {}) => {
|
|
78
|
-
let t = e.raw, n = t?.input_tokens_details ?? t?.prompt_tokens_details, r = t?.output_tokens_details ?? t?.completion_tokens_details, i = T(n?.cached_tokens ?? t?.cache_read_input_tokens), a = T(n?.cache_write_tokens ?? t?.cache_creation_input_tokens), o = (e, t) => t ?? (T(e) !== null && Number(e) > 0 ? Number(e) : null);
|
|
72
|
+
return r(await e.getExternalObjectAgentTools(), (t, n) => e.callExternalObjectAgentTool(t, n), "hi-mcp");
|
|
73
|
+
}, T = (e) => {
|
|
74
|
+
let t = o(e);
|
|
79
75
|
return {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
provider: "host",
|
|
77
|
+
model: e.model,
|
|
78
|
+
readsImages: e.readsImages,
|
|
79
|
+
...t && { responsesProvider: t },
|
|
80
|
+
...e.provider === "azure" && !e.chatCompletions && e.referenceCacheBreakpoint === !0 && { referenceCacheBreakpoint: !0 },
|
|
81
|
+
...e.decisionApiKey && { decisionApiKey: e.decisionApiKey }
|
|
85
82
|
};
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return [t, {
|
|
94
|
-
tokens: D(n),
|
|
95
|
-
status: r === 0 ? "unavailable" : r === e.length ? "complete" : "partial",
|
|
96
|
-
reportedSteps: r,
|
|
97
|
-
observedSteps: e.length
|
|
98
|
-
}];
|
|
99
|
-
})), A = async (e) => {
|
|
100
|
-
let t = new TextEncoder().encode(e), n = await globalThis.crypto?.subtle?.digest("SHA-256", t);
|
|
101
|
-
return {
|
|
102
|
-
bytes: t.byteLength,
|
|
103
|
-
sha256: n ? Array.from(new Uint8Array(n), (e) => e.toString(16).padStart(2, "0")).join("") : null
|
|
83
|
+
}, E = async (e, t, n) => {
|
|
84
|
+
let r = e.extended, o = async (e) => {
|
|
85
|
+
console.log("[planning-assistant]", e), await r.planningAssistantOutput({
|
|
86
|
+
type: "availability",
|
|
87
|
+
available: !1,
|
|
88
|
+
text: e
|
|
89
|
+
});
|
|
104
90
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
let i = 0, a = 0;
|
|
109
|
-
for (let e of r.input) {
|
|
110
|
-
let n = await A(JSON.stringify(e));
|
|
111
|
-
i += n.bytes, n.sha256 === null ? a = null : (t.has(n.sha256) && a !== null && (a += n.bytes), t.add(n.sha256));
|
|
91
|
+
if (typeof r.startExternalObjectPlanningAssistant != "function") {
|
|
92
|
+
await o("The planner has no HI Planning Assistant: it needs a Rubens UI with startExternalObjectPlanningAssistant.");
|
|
93
|
+
return;
|
|
112
94
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
sections: {
|
|
117
|
-
inputBytes: i,
|
|
118
|
-
newInputBytes: a === null ? null : i - a,
|
|
119
|
-
repeatedInputBytes: a,
|
|
120
|
-
toolsBytes: o,
|
|
121
|
-
otherBytes: n.bytes - i - o
|
|
122
|
-
}
|
|
95
|
+
if (n.aborted) return;
|
|
96
|
+
let s = crypto.randomUUID(), { startRelay: c, ui: l } = e, u = c && l ? e : void 0, d = async () => {
|
|
97
|
+
u && await i(u, t);
|
|
123
98
|
};
|
|
124
|
-
}, M = (e) => {
|
|
125
|
-
let t = [e?.present.length ? `- Confirmed: ${e.present.join(", ")}` : "", e?.absent.length ? `- Not present / false: ${e.absent.join(", ")}` : ""].filter(Boolean);
|
|
126
|
-
return t.length === 0 ? "" : `Observed in the photo (high-confidence cues; verify against the image):\n\n${t.join("\n")}`;
|
|
127
|
-
}, ee = (e, t) => {
|
|
128
|
-
let n = M(t);
|
|
129
|
-
return n ? `${e.replace(/\n*$/, "\n")}\n---\n\n${n}` : e;
|
|
130
|
-
}, N = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, te = (e) => e instanceof Error && N.test(e.message), ne = (e) => e.role !== "assistant" || typeof e.content == "string" ? e : {
|
|
131
|
-
...e,
|
|
132
|
-
content: e.content.map((e) => (e.type === "text" || e.type === "reasoning") && e.providerOptions ? {
|
|
133
|
-
...e,
|
|
134
|
-
providerOptions: Object.fromEntries(Object.entries(e.providerOptions).map(([e, t]) => [e, Object.fromEntries(Object.entries(t).filter(([e]) => e !== "itemId"))]))
|
|
135
|
-
} : e)
|
|
136
|
-
}, re = [
|
|
137
|
-
"rooms",
|
|
138
|
-
"groups",
|
|
139
|
-
"obstacles",
|
|
140
|
-
"installationElements"
|
|
141
|
-
], P = 500, F = 240, I = 1500, L = ({ content: e }) => e.filter((e) => e.type === "text").map((e) => e.text).join("\n"), R = async (e, t, n) => {
|
|
142
|
-
let s = e.extended, c = !1, l = !1, u = crypto.randomUUID(), d, f, p = n, m = (e) => !c && !p.aborted ? s.planningAssistantOutput(e) : void 0, h = [], g = null, _ = /* @__PURE__ */ new Set(), v;
|
|
143
99
|
try {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
stepNumber: g
|
|
150
|
-
});
|
|
151
|
-
}),
|
|
152
|
-
s.getExternalObjectAgentPrompts(),
|
|
153
|
-
w(e)
|
|
154
|
-
]);
|
|
100
|
+
let e = u ? await a(u, t) : t;
|
|
101
|
+
await r.startExternalObjectPlanningAssistant(T({
|
|
102
|
+
...e,
|
|
103
|
+
decisionApiKey: t.decisionApiKey
|
|
104
|
+
}), s);
|
|
155
105
|
} catch (e) {
|
|
156
|
-
|
|
157
|
-
type: "availability",
|
|
158
|
-
available: !1,
|
|
159
|
-
text: String(e)
|
|
160
|
-
});
|
|
106
|
+
await o(String(e)), await d();
|
|
161
107
|
return;
|
|
162
108
|
}
|
|
163
|
-
let
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return {
|
|
178
|
-
ms: performance.now() - a,
|
|
179
|
-
decisions: l === "late" ? null : l,
|
|
180
|
-
late: l === "late"
|
|
181
|
-
};
|
|
182
|
-
} finally {
|
|
183
|
-
clearTimeout(o);
|
|
184
|
-
}
|
|
185
|
-
}, K = () => new Set(N.flatMap((e) => e.role === "assistant" && Array.isArray(e.content) ? e.content.flatMap((e) => {
|
|
186
|
-
let t = e.type === "tool-call" && e.toolName === "get-skill" ? e.input : void 0;
|
|
187
|
-
return t && t.file === void 0 ? [String(t.name)] : [];
|
|
188
|
-
}) : [])), ie = async (e) => {
|
|
189
|
-
let t = K();
|
|
190
|
-
return (await Promise.all(e.filter((e) => !U.has(e) && !t.has(e)).map(async (e) => {
|
|
191
|
-
try {
|
|
192
|
-
let t = await C["get-skill"].execute({ name: e });
|
|
193
|
-
return t.isError ? null : {
|
|
194
|
-
name: e,
|
|
195
|
-
text: L(t)
|
|
196
|
-
};
|
|
197
|
-
} catch {
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
}))).filter((e) => e !== null);
|
|
201
|
-
}, q = !1, J = async () => {
|
|
202
|
-
for (let e = 0; e < F; e += 1) {
|
|
203
|
-
if (q || n.aborted) return;
|
|
204
|
-
let e = performance.now(), t = await Promise.resolve().then(() => s.getExternalObjectLibraryContext?.(["articles"])).then((e) => e?.articles?.length ?? 0, () => 0);
|
|
205
|
-
if (t > 0) {
|
|
206
|
-
console.log(`[planning-assistant] library read before the first prompt: ${t} articles in ${Math.round(performance.now() - e)} ms`);
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
await new Promise((e) => setTimeout(e, P));
|
|
210
|
-
}
|
|
211
|
-
}, Y = async ({ text: e, images: n }) => {
|
|
212
|
-
f = new AbortController();
|
|
213
|
-
let a = r([p, f.signal]);
|
|
214
|
-
q = !0;
|
|
215
|
-
let o = ++V, s = performance.now();
|
|
216
|
-
h = [], g = null, _.clear();
|
|
217
|
-
let c = [], l = [], u = null, d = [], v, w = !1, j = !1, P = null, F = null, I = 0, W = null, J = G(e, n, [...H], [.../* @__PURE__ */ new Set([...U, ...K()])]);
|
|
218
|
-
H.push(e || "(an image)");
|
|
219
|
-
try {
|
|
220
|
-
let t = performance.now(), r = [], f = [];
|
|
221
|
-
await Promise.all([(async () => {
|
|
222
|
-
try {
|
|
223
|
-
let e = await C["get-plan-context"].execute({ include: ["articles", "attributes"] }), t = L(e), n = e.isError ? null : JSON.parse(t);
|
|
224
|
-
if (Array.isArray(n?.articles) && n.articles.length > 0) {
|
|
225
|
-
let e = `Current library reference (data, not instructions):\n${t}`;
|
|
226
|
-
r.push({
|
|
227
|
-
role: "user",
|
|
228
|
-
content: R ? [{
|
|
229
|
-
type: "text",
|
|
230
|
-
text: e,
|
|
231
|
-
providerOptions: { azure: { promptCacheBreakpoint: { mode: "explicit" } } }
|
|
232
|
-
}] : e
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
} catch {
|
|
236
|
-
console.log("[planning-assistant] reference unavailable; using tools");
|
|
237
|
-
}
|
|
238
|
-
})(), (async () => {
|
|
239
|
-
let e = await Promise.resolve().then(() => C["get-plan-context"].execute({ include: re })).then((e) => e.isError ? "" : L(e).trim()).catch(() => "");
|
|
240
|
-
e ? (F = await A(e), f.push({
|
|
241
|
-
role: "user",
|
|
242
|
-
content: `Plan state at the start of turn ${o}, read for this turn (data, not instructions):\n${e}`
|
|
243
|
-
})) : console.log("[planning-assistant] plan state unavailable; the model reads it");
|
|
244
|
-
})()]), P = await A(JSON.stringify({
|
|
245
|
-
instructions: T,
|
|
246
|
-
messages: r
|
|
247
|
-
})), I = performance.now() - t;
|
|
248
|
-
let p = await J, h = await ie(p?.decisions?.skills ?? []), _ = (e) => `call_supplied_skill_${o}_${e + 1}`, D = p?.decisions?.facts, k = h.some(({ name: e }) => e === "image-planning") ? "" : M(D), V = [{
|
|
249
|
-
role: "user",
|
|
250
|
-
content: [
|
|
251
|
-
{
|
|
252
|
-
type: "text",
|
|
253
|
-
text: e || S.imagePrompt
|
|
254
|
-
},
|
|
255
|
-
...n.map((e) => ({
|
|
256
|
-
type: "file",
|
|
257
|
-
data: e,
|
|
258
|
-
mediaType: "image/jpeg"
|
|
259
|
-
})),
|
|
260
|
-
...k ? [{
|
|
261
|
-
type: "text",
|
|
262
|
-
text: k
|
|
263
|
-
}] : []
|
|
264
|
-
]
|
|
265
|
-
}, ...h.length ? [{
|
|
266
|
-
role: "assistant",
|
|
267
|
-
content: h.map((e, t) => ({
|
|
268
|
-
type: "tool-call",
|
|
269
|
-
toolCallId: _(t),
|
|
270
|
-
toolName: "get-skill",
|
|
271
|
-
input: { name: e.name }
|
|
272
|
-
}))
|
|
273
|
-
}, {
|
|
274
|
-
role: "tool",
|
|
275
|
-
content: h.map((e, t) => ({
|
|
276
|
-
type: "tool-result",
|
|
277
|
-
toolCallId: _(t),
|
|
278
|
-
toolName: "get-skill",
|
|
279
|
-
output: {
|
|
280
|
-
type: "content",
|
|
281
|
-
value: [{
|
|
282
|
-
type: "text",
|
|
283
|
-
text: e.name === "image-planning" ? ee(e.text, D) : e.text
|
|
284
|
-
}]
|
|
285
|
-
}
|
|
286
|
-
}))
|
|
287
|
-
}] : []];
|
|
288
|
-
h.length > 0 && m({
|
|
289
|
-
type: "activity",
|
|
290
|
-
text: h.map(({ name: e }) => e).join(", ")
|
|
291
|
-
}), W = p && {
|
|
292
|
-
ms: p.ms,
|
|
293
|
-
late: p.late,
|
|
294
|
-
answers: p.decisions?.answers ?? null,
|
|
295
|
-
...D && { facts: D },
|
|
296
|
-
refused: p.decisions?.refused ?? !1,
|
|
297
|
-
skipped: p.decisions?.skipped ?? !1,
|
|
298
|
-
supplied: h.map(({ name: e }) => e)
|
|
299
|
-
};
|
|
300
|
-
let H = [
|
|
301
|
-
...r,
|
|
302
|
-
...N,
|
|
303
|
-
...f,
|
|
304
|
-
...V
|
|
305
|
-
], G = B && f.length > 0 && P.sha256 === B.reference ? B.responseId : void 0, K, q = [], Y = 0, X, Z = !1;
|
|
306
|
-
do {
|
|
307
|
-
X = void 0;
|
|
308
|
-
let e = Y, t = G, n = [], o = y({
|
|
309
|
-
model: x.languageModel,
|
|
310
|
-
providerOptions: R && r.length && P.sha256 ? {
|
|
311
|
-
...x.providerOptions,
|
|
312
|
-
azure: {
|
|
313
|
-
...x.providerOptions?.azure,
|
|
314
|
-
promptCacheKey: P.sha256
|
|
315
|
-
}
|
|
316
|
-
} : x.providerOptions,
|
|
317
|
-
instructions: T,
|
|
318
|
-
messages: Z ? [...H, ...q].map(ne) : [...H, ...q],
|
|
319
|
-
tools: C,
|
|
320
|
-
stopWhen: b(32 - e),
|
|
321
|
-
abortSignal: a,
|
|
322
|
-
onLanguageModelCallEnd: (e) => {
|
|
323
|
-
l.push({
|
|
324
|
-
...E(e.usage),
|
|
325
|
-
...O(e.usage),
|
|
326
|
-
responseTimeMs: e.performance.responseTimeMs,
|
|
327
|
-
timeToFirstOutputMs: e.performance.timeToFirstOutputMs ?? null,
|
|
328
|
-
finishReason: e.finishReason
|
|
329
|
-
});
|
|
330
|
-
},
|
|
331
|
-
onStepEnd: (e) => {
|
|
332
|
-
n.push(...e.response.messages), Y++, K = z ? e.providerMetadata?.[z]?.responseId ?? void 0 : void 0;
|
|
333
|
-
},
|
|
334
|
-
prepareStep: (n) => {
|
|
335
|
-
g = e + n.stepNumber;
|
|
336
|
-
let r = i(g, T);
|
|
337
|
-
if (!z) return r;
|
|
338
|
-
if (n.stepNumber === 0) return t ? {
|
|
339
|
-
instructions: [],
|
|
340
|
-
...i(g),
|
|
341
|
-
messages: [...f, ...V],
|
|
342
|
-
providerOptions: { [z]: {
|
|
343
|
-
previousResponseId: t,
|
|
344
|
-
store: !0
|
|
345
|
-
} }
|
|
346
|
-
} : r;
|
|
347
|
-
let a = n.steps.at(-1), o = a.providerMetadata?.[z]?.responseId;
|
|
348
|
-
if (!o) throw Error("The previous model response has no continuation ID");
|
|
349
|
-
return {
|
|
350
|
-
instructions: [],
|
|
351
|
-
...i(g),
|
|
352
|
-
messages: a.response.messages.filter(({ role: e }) => e === "tool"),
|
|
353
|
-
providerOptions: { [z]: {
|
|
354
|
-
previousResponseId: o,
|
|
355
|
-
store: !0
|
|
356
|
-
} }
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
for await (let e of o.stream) if (e.type === "text-delta") u ??= performance.now() - s, m({
|
|
361
|
-
type: "text",
|
|
362
|
-
text: e.text
|
|
363
|
-
});
|
|
364
|
-
else if (e.type === "tool-input-start" || e.type === "tool-call") m({
|
|
365
|
-
type: "activity",
|
|
366
|
-
text: e.toolName
|
|
367
|
-
});
|
|
368
|
-
else if (e.type === "error") {
|
|
369
|
-
if ((n.length > 0 || t) && te(e.error)) {
|
|
370
|
-
X = e.error;
|
|
371
|
-
break;
|
|
372
|
-
}
|
|
373
|
-
throw e.error;
|
|
374
|
-
} else e.type === "finish-step" ? (d.push(E(e.usage)), c.push(O(e.usage))) : e.type === "finish" ? (v = q.length ? void 0 : E(e.totalUsage), w = !0) : e.type === "abort" && (j = !0);
|
|
375
|
-
X ? (console.log(`[planning-assistant] continuation rejected (${X.message}) - continuing with the whole history`), q.push(...n), G = void 0, Z = !0) : !j && !a.aborted && (N.push(...V, ...q, ...await o.responseMessages), h.forEach(({ name: e }) => U.add(e)), B = K && P.sha256 ? {
|
|
376
|
-
responseId: K,
|
|
377
|
-
reference: P.sha256
|
|
378
|
-
} : null);
|
|
379
|
-
} while (X);
|
|
380
|
-
m({ type: "done" });
|
|
381
|
-
} catch (e) {
|
|
382
|
-
console.log("[planning-assistant]", String(e)), m({
|
|
383
|
-
type: "error",
|
|
384
|
-
text: `The planning assistant failed: ${e instanceof Error ? e.message : String(e)}`
|
|
385
|
-
});
|
|
386
|
-
} finally {
|
|
387
|
-
let e = {
|
|
388
|
-
inputTokens: v?.inputTokens ?? D(d.map((e) => e.inputTokens)),
|
|
389
|
-
outputTokens: v?.outputTokens ?? D(d.map((e) => e.outputTokens)),
|
|
390
|
-
totalTokens: v?.totalTokens ?? D(d.map((e) => e.totalTokens))
|
|
391
|
-
}, n = Object.values(e).some((e) => e !== null), r = w && !j && !a.aborted && Object.values(e).every((e) => e !== null) && d.every((e) => Object.values(e).every((e) => e !== null));
|
|
392
|
-
console.log(`[planning-assistant] usage ${JSON.stringify({
|
|
393
|
-
provider: t.provider,
|
|
394
|
-
model: t.model,
|
|
395
|
-
status: n ? r ? "complete" : "partial" : "unavailable",
|
|
396
|
-
...e,
|
|
397
|
-
diagnostics: {
|
|
398
|
-
version: 1,
|
|
399
|
-
details: k(c),
|
|
400
|
-
modelCalls: l,
|
|
401
|
-
requests: h,
|
|
402
|
-
reference: P,
|
|
403
|
-
planState: F,
|
|
404
|
-
decisions: W,
|
|
405
|
-
referenceAcquisitionMs: I,
|
|
406
|
-
firstTextMs: u,
|
|
407
|
-
turnMs: performance.now() - s
|
|
408
|
-
}
|
|
409
|
-
})}`);
|
|
410
|
-
}
|
|
411
|
-
}, X = async (e) => {
|
|
412
|
-
if (c || p.aborted) throw Error("The planning assistant is suspended.");
|
|
413
|
-
if (d) throw Error("An assistant turn is already running.");
|
|
414
|
-
d = Y(e);
|
|
415
|
-
try {
|
|
416
|
-
await d;
|
|
417
|
-
} finally {
|
|
418
|
-
d = void 0, f = void 0;
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
s.callbacks.onPlanningAssistantPrompt = X;
|
|
422
|
-
let Z = async (e) => {
|
|
423
|
-
e === "isolation" ? (c = !0, f?.abort(/* @__PURE__ */ Error("The assistant changed mode.")), d && await Promise.allSettled([d]), await s.planningAssistantOutput({
|
|
424
|
-
type: "availability",
|
|
425
|
-
available: !1
|
|
426
|
-
})) : !p.aborted && !l && (c = !1, m({
|
|
427
|
-
type: "images",
|
|
428
|
-
enabled: t.readsImages
|
|
429
|
-
}), m({
|
|
430
|
-
type: "availability",
|
|
431
|
-
available: !0
|
|
432
|
-
}));
|
|
433
|
-
};
|
|
434
|
-
s.callbacks.onPlanningAssistantModeChange = Z;
|
|
435
|
-
let ae = async () => {
|
|
436
|
-
l = !0, c = !0, f?.abort(/* @__PURE__ */ Error("The planning assistant stopped.")), d && await Promise.allSettled([d]), await s.stopPlanningAssistant?.(u), s.callbacks.onPlanningAssistantPrompt === X && (s.callbacks.onPlanningAssistantPrompt = void 0, await s.planningAssistantOutput({
|
|
437
|
-
type: "availability",
|
|
438
|
-
available: !1
|
|
439
|
-
})), s.callbacks.onPlanningAssistantModeChange === Z && (s.callbacks.onPlanningAssistantModeChange = void 0), p.removeEventListener("abort", $);
|
|
440
|
-
}, oe, Q = () => oe ??= ae(), $ = () => {
|
|
441
|
-
Q();
|
|
442
|
-
};
|
|
443
|
-
if (p.addEventListener("abort", $, { once: !0 }), p.aborted) await Q();
|
|
444
|
-
else return await s.setPlanningAssistantModel?.({
|
|
445
|
-
model: t.model,
|
|
446
|
-
readsImages: t.readsImages,
|
|
447
|
-
responsesProvider: o(t) ?? void 0
|
|
448
|
-
}, u), s.getExternalObjectLibraryContext && J(), m({
|
|
449
|
-
type: "images",
|
|
450
|
-
enabled: t.readsImages
|
|
451
|
-
}), m({
|
|
452
|
-
type: "availability",
|
|
453
|
-
available: !0
|
|
454
|
-
}), {
|
|
455
|
-
suspend: () => Z("isolation"),
|
|
456
|
-
resume: () => Z("planner"),
|
|
457
|
-
dispose: Q
|
|
109
|
+
let f, p = () => {
|
|
110
|
+
m();
|
|
111
|
+
}, m = () => f ??= (async () => {
|
|
112
|
+
n.removeEventListener("abort", p), await r.stopPlanningAssistant?.(s), await d();
|
|
113
|
+
})();
|
|
114
|
+
if (n.addEventListener("abort", p, { once: !0 }), n.aborted) await m();
|
|
115
|
+
else return {
|
|
116
|
+
suspend: async () => {
|
|
117
|
+
f || await r.suspendPlanningAssistant?.();
|
|
118
|
+
},
|
|
119
|
+
resume: async () => {
|
|
120
|
+
f || await r.resumePlanningAssistant?.();
|
|
121
|
+
},
|
|
122
|
+
dispose: m
|
|
458
123
|
};
|
|
459
|
-
},
|
|
124
|
+
}, D = 5e3, O = async ({ serverUrl: e, authorization: t }) => {
|
|
460
125
|
let n = t ? { Authorization: t } : {}, r;
|
|
461
126
|
try {
|
|
462
127
|
let t = await fetch(`${e}/backends/list`, {
|
|
463
128
|
headers: n,
|
|
464
|
-
signal: AbortSignal.timeout(
|
|
129
|
+
signal: AbortSignal.timeout(D)
|
|
465
130
|
});
|
|
466
131
|
r = t.ok ? await t.json() : [];
|
|
467
132
|
} catch (e) {
|
|
468
133
|
return console.warn("No HI model proxy: the backend list failed", e), {};
|
|
469
134
|
}
|
|
470
135
|
if (!Array.isArray(r) || r.length !== 1) return {};
|
|
471
|
-
let [{ enableAIPlanning: i, enableAIRendering: a }] = r,
|
|
136
|
+
let [{ enableAIPlanning: i, enableAIRendering: a, enableAIDecisions: o }] = r, s = `${e}/api/ai/v1`;
|
|
472
137
|
return {
|
|
473
138
|
...i === !0 && { chat: {
|
|
474
139
|
provider: "openai-compatible",
|
|
475
|
-
baseUrl:
|
|
140
|
+
baseUrl: s,
|
|
476
141
|
model: "planning",
|
|
477
142
|
headers: n,
|
|
478
143
|
responses: !0,
|
|
479
144
|
readsImages: !0
|
|
480
145
|
} },
|
|
481
146
|
...a === !0 && { rendering: {
|
|
482
|
-
baseUrl:
|
|
147
|
+
baseUrl: s,
|
|
483
148
|
model: "rendering",
|
|
484
149
|
headers: n
|
|
150
|
+
} },
|
|
151
|
+
...o === !0 && { decisions: {
|
|
152
|
+
baseUrl: s,
|
|
153
|
+
model: "decision",
|
|
154
|
+
headers: n
|
|
485
155
|
} }
|
|
486
156
|
};
|
|
487
|
-
},
|
|
157
|
+
}, k = (e = "1:1") => {
|
|
488
158
|
let [t, n] = e.split(":").map(Number);
|
|
489
159
|
return t === n ? "1024x1024" : t > n ? "1536x1024" : "1024x1536";
|
|
490
|
-
},
|
|
491
|
-
let { prompt: a, image: o, aspect: s } = JSON.parse(e.body), c = await
|
|
492
|
-
l.append("model", r), l.append("prompt", a), l.append("size",
|
|
160
|
+
}, A = async (e) => (await fetch(e)).blob(), j = async (e, t, { baseUrl: n, model: r, headers: i }) => {
|
|
161
|
+
let { prompt: a, image: o, aspect: s } = JSON.parse(e.body), c = await A(o), l = new FormData();
|
|
162
|
+
l.append("model", r), l.append("prompt", a), l.append("size", k(s)), l.append("quality", "medium"), l.append("output_format", "png"), l.append("image", c, `scene.${c.type.split("/")[1]}`);
|
|
493
163
|
let u = await fetch(`${n}/images/edits`, {
|
|
494
164
|
method: "POST",
|
|
495
165
|
headers: i,
|
|
@@ -498,10 +168,38 @@ var s = (e, t) => t === e.libraryId ? e : {
|
|
|
498
168
|
});
|
|
499
169
|
if (!u.ok) return u;
|
|
500
170
|
let { data: d } = await u.json(), f = d?.[0]?.b64_json, p = new FormData();
|
|
501
|
-
return f ? p.append("image", await
|
|
502
|
-
},
|
|
171
|
+
return f ? p.append("image", await A(`data:image/png;base64,${f}`)) : p.append("text", "The endpoint returned no image"), new Response(p);
|
|
172
|
+
}, M = {
|
|
173
|
+
png: "image/png",
|
|
174
|
+
jpg: "image/jpeg"
|
|
175
|
+
}, N = (e, t, { baseUrl: n, model: r, headers: i }) => {
|
|
176
|
+
let { state: a, questions: o, assets: s = {} } = JSON.parse(e.body);
|
|
177
|
+
return fetch(`${n}/decisions`, {
|
|
178
|
+
method: "POST",
|
|
179
|
+
headers: {
|
|
180
|
+
...i,
|
|
181
|
+
"Content-Type": "application/json"
|
|
182
|
+
},
|
|
183
|
+
body: JSON.stringify({
|
|
184
|
+
model: r,
|
|
185
|
+
input: [{
|
|
186
|
+
type: "text",
|
|
187
|
+
text: JSON.stringify(a)
|
|
188
|
+
}, ...Object.entries(s).flatMap(([e, t]) => [{
|
|
189
|
+
type: "text",
|
|
190
|
+
text: e
|
|
191
|
+
}, {
|
|
192
|
+
type: "image",
|
|
193
|
+
data: t.data_base64,
|
|
194
|
+
mime_type: M[t.format]
|
|
195
|
+
}])],
|
|
196
|
+
questions: o
|
|
197
|
+
}),
|
|
198
|
+
signal: t
|
|
199
|
+
});
|
|
200
|
+
}, P = {
|
|
503
201
|
HIDE: "hide",
|
|
504
202
|
SHOW_ATTRIBUTES: "attributes",
|
|
505
203
|
SHOW_ARTICLES: "articles"
|
|
506
204
|
};
|
|
507
|
-
export {
|
|
205
|
+
export { P as HI_PANEL_ACTION, C as cleanupHi, g as createHiLibraryCallbacks, w as createHiMcpTools, p as libLoadArticleCatalog, h as libLoadCalcScript, m as libLoadMasterData, n as loadChatModel, y as omGetRequest, v as omPostRequest, u as registerLegacyUrlFormat, N as requestDecisions, j as requestImageEdits, O as resolveHiModelProxy, S as setupHi, E as startPlanningAssistant, d as unregisterLegacyUrlFormat };
|