@genex-ai/cli-demo 1.29.0-dev.633 → 1.30.0-dev.635

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.
@@ -7,7 +7,7 @@ import {
7
7
  isRenderMode,
8
8
  sceneSummary,
9
9
  sheetOf
10
- } from "./chunk-KVWA6BLY.js";
10
+ } from "./chunk-2COG4P3T.js";
11
11
  import {
12
12
  getCliVersion
13
13
  } from "./chunk-HYCSNWYX.js";
@@ -176,11 +176,11 @@ async function handle(msg) {
176
176
  const args = msg.params?.arguments ?? {};
177
177
  const tool = TOOLS.find((t) => t.name === name);
178
178
  if (!tool) return fail(id, -32602, `Unknown tool: ${name}`);
179
- const base = await mcpEndpoint();
180
- if (!base) {
181
- return reply(id, { content: [{ type: "text", text: blenderSetupHint() }], isError: true });
182
- }
183
179
  try {
180
+ const base = await mcpEndpoint();
181
+ if (!base) {
182
+ return reply(id, { content: [{ type: "text", text: blenderSetupHint() }], isError: true });
183
+ }
184
184
  return reply(id, await tool.run(args, base));
185
185
  } catch (err) {
186
186
  return reply(id, {
@@ -201,7 +201,10 @@ var stderrLog = {
201
201
  };
202
202
  async function mcpEndpoint() {
203
203
  const seat = await acquireSeat({ log: stderrLog });
204
- if (seat.kind === "granted") return seat.grant.url;
204
+ if (seat.kind === "granted") {
205
+ await blenderCall(seat.grant.url, "/health");
206
+ return seat.grant.url;
207
+ }
205
208
  if (seat.kind === "refused") stderrLog.error(`no Blender seat: ${seat.reason}`);
206
209
  if (seat.kind === "warming") stderrLog.warn("the Blender seat is still warming \u2014 the next call will try again");
207
210
  return blenderEndpoint();
@@ -781,6 +781,16 @@ ${json.trace.slice(-4e3)}` : "";
781
781
  throw new Error(`${route} failed (${res.status}): ${json.error ?? text.slice(0, 200)}${stage}${detail}${mutationWarning}${trace}`);
782
782
  }
783
783
  if (seat?.kind === "cli") void touchCliSeat();
784
+ if (seat?.kind === "hosted" && seat.seatId && route === "/health") {
785
+ const token = await readUserToken();
786
+ if (!token) throw new Error("Cannot acknowledge Blender readiness: not signed in");
787
+ const claim = await apiFetch(`${getApiUrl()}/api/blender/seat/touch`, {
788
+ method: "POST",
789
+ headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
790
+ body: JSON.stringify({ seatId: seat.seatId })
791
+ });
792
+ if (!claim.ok) throw new Error("Blender readiness acknowledgement failed; no scene command was sent. Run the command again.");
793
+ }
784
794
  return json;
785
795
  } catch (err) {
786
796
  if (err instanceof Error && err.name === "AbortError") {
@@ -815,14 +825,15 @@ async function acquireSeat(opts) {
815
825
  for (; ; ) {
816
826
  const res = await doFetch(`${getApiUrl()}/api/blender/seat`, {
817
827
  method: "POST",
818
- headers: { Authorization: `Bearer ${token}` }
828
+ headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
829
+ body: JSON.stringify({ acknowledgeReadiness: true })
819
830
  });
820
831
  if (res.status === 201) {
821
832
  const body = await res.json();
822
833
  if (typeof body.url !== "string" || typeof body.token !== "string") {
823
834
  return { kind: "refused", reason: "the API answered a seat without a url and token" };
824
835
  }
825
- const grant = { url: body.url, token: body.token, kind: "hosted" };
836
+ const grant = { url: body.url, token: body.token, kind: "hosted", ...typeof body.seatId === "string" ? { seatId: body.seatId } : {} };
826
837
  writeSeatGrant(grant, opts.cwd);
827
838
  return { kind: "granted", grant };
828
839
  }
@@ -856,7 +867,7 @@ async function acquireCliSeat(opts) {
856
867
  const res = await doFetch(`${getApiUrl()}/api/blender/seat`, {
857
868
  method: "POST",
858
869
  headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
859
- body: JSON.stringify({ cli: true, scope: opts.scope })
870
+ body: JSON.stringify({ cli: true, scope: opts.scope, acknowledgeReadiness: true })
860
871
  });
861
872
  if (res.status === 201) {
862
873
  const body = await res.json();