@ignix-social/creator 0.1.5 → 0.2.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.
Files changed (3) hide show
  1. package/dist/cli.cjs +19 -22
  2. package/dist/core.cjs +160 -410
  3. package/package.json +5 -4
package/dist/core.cjs CHANGED
@@ -27626,7 +27626,7 @@ async function runAgentTurn(input2) {
27626
27626
  const emit = (e) => input2.onEvent?.(e);
27627
27627
  const deadline = AbortSignal.timeout(limits.deadlineMs);
27628
27628
  const signal = input2.signal ? AbortSignal.any([input2.signal, deadline]) : deadline;
27629
- const aborted3 = () => signal.aborted;
27629
+ const aborted2 = () => signal.aborted;
27630
27630
  let steps = 0;
27631
27631
  let calls = 0;
27632
27632
  const finish = (status, text2, failure4 = null) => {
@@ -27651,7 +27651,7 @@ async function runAgentTurn(input2) {
27651
27651
  const base = compiled.request;
27652
27652
  const messages = [...base.messages];
27653
27653
  while (steps < limits.maxSteps) {
27654
- if (aborted3()) return stopped();
27654
+ if (aborted2()) return stopped();
27655
27655
  steps += 1;
27656
27656
  emit({ type: "step_started", step: steps });
27657
27657
  if (estimateTokens(messages, base.tools ?? []) + base.maxTokens > input2.maxContextTokens) {
@@ -27670,16 +27670,16 @@ async function runAgentTurn(input2) {
27670
27670
  } else if (event.type === "tool_call") {
27671
27671
  toolCalls.push(event.call);
27672
27672
  } else if (event.type === "error") {
27673
- if (aborted3()) return stopped();
27673
+ if (aborted2()) return stopped();
27674
27674
  return finish("failed", null, event.code);
27675
27675
  }
27676
27676
  }
27677
27677
  } catch (err2) {
27678
- if (aborted3()) return stopped();
27678
+ if (aborted2()) return stopped();
27679
27679
  const code = err2 instanceof ReasoningError || err2 instanceof BrainError ? err2.code : "internal";
27680
27680
  return finish("failed", null, code);
27681
27681
  }
27682
- if (aborted3()) return stopped();
27682
+ if (aborted2()) return stopped();
27683
27683
  if (toolCalls.length === 0) return finish("completed", text2);
27684
27684
  messages.push({ role: "assistant", content: text2, toolCalls: toolCalls.slice(0, 16) });
27685
27685
  for (const call of toolCalls.slice(0, 16)) {
@@ -27696,7 +27696,7 @@ async function runAgentTurn(input2) {
27696
27696
  approval: input2.approval,
27697
27697
  signal
27698
27698
  });
27699
- if (aborted3()) return stopped();
27699
+ if (aborted2()) return stopped();
27700
27700
  if (decision.kind === "denied") {
27701
27701
  emit({ type: "capability_denied", reason: decision.reason });
27702
27702
  content = JSON.stringify({ status: "denied", reason: decision.reason });
@@ -27711,9 +27711,9 @@ async function runAgentTurn(input2) {
27711
27711
  try {
27712
27712
  raw = await executor.execute(decision.request, signal);
27713
27713
  } catch {
27714
- raw = { status: aborted3() ? "cancelled" : "error", content: "" };
27714
+ raw = { status: aborted2() ? "cancelled" : "error", content: "" };
27715
27715
  }
27716
- if (aborted3()) return stopped();
27716
+ if (aborted2()) return stopped();
27717
27717
  const out = resultForModel(
27718
27718
  raw,
27719
27719
  Math.min(limits.maxResultBytes, decision.request.capability.info.result.maxBytes)
@@ -27861,237 +27861,25 @@ function createBrainHost(deps) {
27861
27861
  };
27862
27862
  }
27863
27863
 
27864
- // ../../packages/core/src/agent/ignix-reasoning.ts
27864
+ // ../../packages/core/src/agent/no-assistant.ts
27865
27865
  init_define_CREATOR_BOX_KIT();
27866
27866
  init_define_CREATOR_SFX_KIT();
27867
- var import_node_crypto5 = require("node:crypto");
27868
- var ASSISTANT_GENERATE_PATH = "/api/creator/assistant/generate";
27869
- var IgnixReasoningError = class extends ReasoningError {
27870
- constructor(reason) {
27871
- super("unavailable");
27872
- this.reason = reason;
27873
- this.name = "IgnixReasoningError";
27874
- }
27875
- reason;
27876
- };
27877
- var MAX_RESPONSE_BYTES = 1024 * 1024;
27878
- var ResponseSchema = external_exports.object({
27879
- events: external_exports.array(external_exports.unknown()).min(1).max(64),
27880
- credits: external_exports.object({
27881
- charged: external_exports.number().int().nonnegative(),
27882
- remaining: external_exports.number().int().nullable()
27883
- })
27884
- });
27885
- var aborted2 = (signal) => signal.aborted;
27886
- var REASON_OF = {
27887
- 402: "no_credits",
27888
- 429: "rate_limited"
27889
- };
27890
- function createIgnixReasoning(deps) {
27891
- const url2 = `${deps.issuer.replace(/\/+$/, "")}${ASSISTANT_GENERATE_PATH}`;
27892
- const newKey = deps.newKey ?? (() => `ca.${(0, import_node_crypto5.randomBytes)(18).toString("base64url")}`);
27893
- let inFlight = 0;
27894
- async function generate(request2, signal, role = "operate") {
27895
- const valid = GenerateRequestSchema.safeParse(request2);
27896
- if (!valid.success) throw new ReasoningError("invalid_request");
27897
- const access4 = deps.access();
27898
- if (access4 === null) throw new IgnixReasoningError("signed_out");
27899
- if (access4 !== "read_write") throw new IgnixReasoningError("read_only");
27900
- const { temperature: _t, stop: _s, ...rest } = valid.data;
27901
- const body = { ...rest, role, idempotencyKey: newKey() };
27902
- inFlight += 1;
27903
- try {
27904
- for (let attempt = 0; attempt < 2; attempt++) {
27905
- if (signal.aborted) throw new ReasoningError("cancelled");
27906
- let token3;
27907
- try {
27908
- token3 = await deps.token();
27909
- } catch {
27910
- throw new IgnixReasoningError("signed_out");
27911
- }
27912
- let res;
27913
- try {
27914
- res = await postJson(deps.http, url2, body, token3, {
27915
- signal,
27916
- maxBytes: MAX_RESPONSE_BYTES
27917
- });
27918
- } catch (err2) {
27919
- if (aborted2(signal)) throw new ReasoningError("cancelled");
27920
- throw new IgnixReasoningError(
27921
- err2 instanceof OAuthHttpError && err2.kind === "network" ? "offline" : "failed"
27922
- );
27923
- }
27924
- if (res.status === 401) {
27925
- deps.invalidate(token3);
27926
- continue;
27927
- }
27928
- if (res.status === 403) {
27929
- const code = res.body?.error;
27930
- throw new IgnixReasoningError(code === "not_entitled" ? "not_entitled" : "read_only");
27931
- }
27932
- if (res.status !== 200) throw new IgnixReasoningError(REASON_OF[res.status] ?? "failed");
27933
- const parsed = ResponseSchema.safeParse(res.body);
27934
- if (!parsed.success) throw new IgnixReasoningError("failed");
27935
- const events = [];
27936
- for (const raw of parsed.data.events) {
27937
- const event = GenerateEventSchema.safeParse(raw);
27938
- if (!event.success) throw new IgnixReasoningError("failed");
27939
- events.push(event.data);
27940
- }
27941
- if (events.findIndex((e) => e.type === "done") !== events.length - 1)
27942
- throw new IgnixReasoningError("failed");
27943
- return { events, credits: parsed.data.credits };
27944
- }
27945
- throw new IgnixReasoningError("signed_out");
27946
- } finally {
27947
- inFlight -= 1;
27948
- }
27949
- }
27867
+ function createNoAssistant() {
27868
+ const status = { state: "unavailable" };
27950
27869
  return {
27951
- status: () => ({
27952
- state: deps.access() === null ? "unavailable" : inFlight > 0 ? "busy" : "ready"
27870
+ status: () => status,
27871
+ // Never yields: there is no model to ask.
27872
+ stream: () => ({
27873
+ [Symbol.asyncIterator]: () => ({
27874
+ next: () => Promise.reject(new ReasoningError("unavailable"))
27875
+ })
27953
27876
  }),
27954
- generate,
27955
- async *stream(request2, signal, options2) {
27956
- const answer = await generate(request2, signal, options2?.role ?? "operate");
27957
- yield* answer.events;
27958
- }
27959
- };
27960
- }
27961
-
27962
- // ../../packages/core/src/agent/assistant-router.ts
27963
- init_define_CREATOR_BOX_KIT();
27964
- init_define_CREATOR_SFX_KIT();
27965
- var import_node_async_hooks = require("node:async_hooks");
27966
- var IGNIX_CONTEXT_TOKENS = 8192;
27967
- var COOLDOWN_MS = {
27968
- signed_out: 0,
27969
- read_only: 0,
27970
- not_entitled: 10 * 6e4,
27971
- no_credits: 6e4,
27972
- rate_limited: 6e4,
27973
- offline: 6e4,
27974
- failed: 6e4
27975
- };
27976
- function createAssistantRouter(deps) {
27977
- const now = deps.now ?? Date.now;
27978
- const turns = new import_node_async_hooks.AsyncLocalStorage();
27979
- let cooldown = null;
27980
- const said = /* @__PURE__ */ new Set();
27981
- async function blocked(signal) {
27982
- const live = deps.ignixBlocked();
27983
- if (live) return live;
27984
- if (cooldown && now() < cooldown.until) return cooldown.reason;
27985
- cooldown = null;
27986
- const c = await deps.credits(signal).catch(() => null);
27987
- if (c && c.available !== null && c.available < c.perStep) return "no_credits";
27988
- return null;
27989
- }
27990
- const notice = (state, reason, local) => {
27991
- if (!state || state.notice) return;
27992
- const key = `${reason}:${String(local)}`;
27993
- if (said.has(key)) return;
27994
- said.add(key);
27995
- state.notice = { reason, local };
27996
- };
27997
- async function* runLocal(request2, signal, role, state) {
27998
- if (state) state.backend = "local";
27999
- yield* deps.local.stream(request2, signal, { role });
28000
- }
28001
- async function* stream(request2, signal, options2) {
28002
- const role = options2?.role ?? "operate";
28003
- const state = turns.getStore();
28004
- if (deps.setting() === "local" || state?.backend === "local") {
28005
- yield* runLocal(request2, signal, role, state);
28006
- return;
28007
- }
28008
- const startedOnIgnix = state?.backend === "ignix";
28009
- let reason = startedOnIgnix ? null : await blocked(signal);
28010
- if (!reason) {
28011
- try {
28012
- const answer = await deps.ignix.generate(request2, signal, role);
28013
- if (state) {
28014
- state.backend = "ignix";
28015
- state.credits += answer.credits.charged;
28016
- }
28017
- yield* answer.events;
28018
- return;
28019
- } catch (err2) {
28020
- if (!(err2 instanceof IgnixReasoningError)) throw err2;
28021
- reason = err2.reason;
28022
- if (COOLDOWN_MS[reason] > 0) cooldown = { reason, until: now() + COOLDOWN_MS[reason] };
28023
- if (startedOnIgnix) {
28024
- notice(state, reason, false);
28025
- throw err2;
28026
- }
28027
- }
28028
- }
28029
- if (!await deps.localReady(role)) {
28030
- notice(state, reason, false);
28031
- throw new ReasoningError("unavailable");
28032
- }
28033
- notice(state, reason, true);
28034
- yield* runLocal(request2, signal, role, state);
28035
- }
28036
- return {
28037
- status() {
28038
- return deps.setting() === "local" ? deps.local.status() : deps.ignix.status();
28039
- },
28040
- stream,
28041
- async ready(role = "operate") {
28042
- if (deps.setting() === "local") return deps.localReady(role);
28043
- if (!deps.ignixBlocked() && !(cooldown && now() < cooldown.until)) return true;
28044
- return deps.localReady(role);
28045
- },
28046
- async contextTokens() {
28047
- const local = await deps.localContextTokens().catch(() => null);
28048
- if (deps.setting() === "local") return local;
28049
- return local ?? IGNIX_CONTEXT_TOKENS;
28050
- },
27877
+ ready: () => Promise.resolve(false),
27878
+ contextTokens: () => Promise.resolve(null),
28051
27879
  async turn(fn) {
28052
- const state = { backend: null, credits: 0, notice: null };
28053
- const value = await turns.run(state, fn);
28054
- return {
28055
- value,
28056
- report: { backend: state.backend, credits: state.credits, notice: state.notice }
28057
- };
27880
+ return { value: await fn(), report: { backend: null, credits: 0, notice: null } };
28058
27881
  },
28059
- reset() {
28060
- cooldown = null;
28061
- said.clear();
28062
- }
28063
- };
28064
- }
28065
-
28066
- // ../../packages/core/src/agent/assistant-settings.ts
28067
- init_define_CREATOR_BOX_KIT();
28068
- init_define_CREATOR_SFX_KIT();
28069
- function createAssistantSettings(deps) {
28070
- let config2 = deps.initial;
28071
- async function get() {
28072
- const ignixReady = deps.ignixReady();
28073
- const [localReady, credits] = await Promise.all([
28074
- deps.localReady().catch(() => false),
28075
- ignixReady ? deps.credits(AbortSignal.timeout(15e3)).catch(() => null) : Promise.resolve(null)
28076
- ]);
28077
- return {
28078
- model: config2.assistant.model,
28079
- ignixReady,
28080
- localReady,
28081
- creditsPerStep: credits?.perStep ?? null,
28082
- creditsAvailable: credits?.available ?? null
28083
- };
28084
- }
28085
- return {
28086
- model: () => config2.assistant.model,
28087
- get,
28088
- async setModel(model) {
28089
- if (model !== config2.assistant.model) {
28090
- config2 = { ...config2, assistant: { model } };
28091
- if (deps.persist) await deps.save(config2);
28092
- }
28093
- return get();
28094
- }
27882
+ reset: () => void 0
28095
27883
  };
28096
27884
  }
28097
27885
 
@@ -28121,7 +27909,7 @@ function createAuthenticatedTransport(deps) {
28121
27909
  // ../../packages/core/src/chat/chat-service.ts
28122
27910
  init_define_CREATOR_BOX_KIT();
28123
27911
  init_define_CREATOR_SFX_KIT();
28124
- var import_node_crypto6 = require("node:crypto");
27912
+ var import_node_crypto5 = require("node:crypto");
28125
27913
 
28126
27914
  // ../../packages/ignix-mcp/src/index.ts
28127
27915
  init_define_CREATOR_BOX_KIT();
@@ -28142,7 +27930,7 @@ var McpError = class extends Error {
28142
27930
  // ../../packages/ignix-mcp/src/client.ts
28143
27931
  init_define_CREATOR_BOX_KIT();
28144
27932
  init_define_CREATOR_SFX_KIT();
28145
- var ResponseSchema2 = external_exports.object({
27933
+ var ResponseSchema = external_exports.object({
28146
27934
  jsonrpc: external_exports.literal("2.0"),
28147
27935
  id: external_exports.union([external_exports.number(), external_exports.string(), external_exports.null()]),
28148
27936
  result: external_exports.unknown().optional(),
@@ -28151,12 +27939,12 @@ var ResponseSchema2 = external_exports.object({
28151
27939
  function createMcpClient(transport) {
28152
27940
  let nextId = 1;
28153
27941
  const rpc = async (method, params, signal) => {
28154
- const aborted3 = () => signal.aborted;
28155
- if (aborted3()) throw new McpError("cancelled");
27942
+ const aborted2 = () => signal.aborted;
27943
+ if (aborted2()) throw new McpError("cancelled");
28156
27944
  const id = nextId++;
28157
27945
  const raw = await transport.send({ jsonrpc: "2.0", id, method, params }, signal);
28158
- if (aborted3()) throw new McpError("cancelled");
28159
- const parsed = ResponseSchema2.safeParse(raw);
27946
+ if (aborted2()) throw new McpError("cancelled");
27947
+ const parsed = ResponseSchema.safeParse(raw);
28160
27948
  if (!parsed.success || parsed.data.id !== id) throw new McpError("invalid_response");
28161
27949
  if (parsed.data.error) throw new McpError("rpc_error");
28162
27950
  if (!("result" in parsed.data)) throw new McpError("invalid_response");
@@ -30724,7 +30512,7 @@ function createSkillRuntime(deps) {
30724
30512
  message: typeof rec7.message === "string" ? rec7.message : null
30725
30513
  };
30726
30514
  };
30727
- const aborted3 = () => deps.signal.aborted;
30515
+ const aborted2 = () => deps.signal.aborted;
30728
30516
  return {
30729
30517
  signal: deps.signal,
30730
30518
  async available(toolName) {
@@ -30748,12 +30536,12 @@ function createSkillRuntime(deps) {
30748
30536
  signal: deps.signal
30749
30537
  }
30750
30538
  );
30751
- if (aborted3()) return { kind: "cancelled" };
30539
+ if (aborted2()) return { kind: "cancelled" };
30752
30540
  if (decision.kind === "denied") return { kind: "denied", reason: decision.reason };
30753
30541
  try {
30754
30542
  return parse3(await deps.executor.execute(decision.request, deps.signal));
30755
30543
  } catch {
30756
- return aborted3() ? { kind: "cancelled" } : { kind: "failed", code: "invalid_result", message: null };
30544
+ return aborted2() ? { kind: "cancelled" } : { kind: "failed", code: "invalid_result", message: null };
30757
30545
  }
30758
30546
  }
30759
30547
  };
@@ -31802,15 +31590,15 @@ var IGNIX_MCP_MAX_RESPONSE_BYTES = 2 * 1024 * 1024;
31802
31590
  function createIgnixMcpTransport(deps) {
31803
31591
  return {
31804
31592
  async send(message, signal) {
31805
- const aborted3 = () => signal.aborted;
31806
- if (aborted3()) throw new McpError("cancelled");
31593
+ const aborted2 = () => signal.aborted;
31594
+ if (aborted2()) throw new McpError("cancelled");
31807
31595
  try {
31808
31596
  return await deps.transport.send(message, {
31809
31597
  signal,
31810
31598
  maxBytes: deps.maxBytes ?? IGNIX_MCP_MAX_RESPONSE_BYTES
31811
31599
  });
31812
31600
  } catch (err2) {
31813
- if (aborted3()) throw new McpError("cancelled");
31601
+ if (aborted2()) throw new McpError("cancelled");
31814
31602
  throw new McpError(mcpFailureOf(err2));
31815
31603
  }
31816
31604
  }
@@ -32136,7 +31924,7 @@ function createIgnixAgentService(deps) {
32136
31924
  const finish = (result2, path, skill) => ({ ...result2, known: known3, focus, path, skill });
32137
31925
  const lang = conversationLang(personTexts);
32138
31926
  const steps = STEP_TEXT[lang];
32139
- const aborted3 = () => signal.aborted;
31927
+ const aborted2 = () => signal.aborted;
32140
31928
  progress({ kind: "step", label: steps.understanding });
32141
31929
  if (known3.length === 0) {
32142
31930
  quiet = true;
@@ -32144,7 +31932,7 @@ function createIgnixAgentService(deps) {
32144
31932
  await (tracer ? tracer.time("warmup", null, () => preparer.warm(WARMUP_LOOKUPS, signal)) : preparer.warm(WARMUP_LOOKUPS, signal));
32145
31933
  quiet = false;
32146
31934
  }
32147
- if (aborted3()) return finish(cancelledResult(), "none", null);
31935
+ if (aborted2()) return finish(cancelledResult(), "none", null);
32148
31936
  const runSkillPath = async (intent, skillLang, path) => {
32149
31937
  tracer?.setPath(path, intent.skill);
32150
31938
  quiet = true;
@@ -32169,7 +31957,7 @@ function createIgnixAgentService(deps) {
32169
31957
  status: outcome.status,
32170
31958
  error: outcome.error
32171
31959
  });
32172
- if (outcome.status === "cancelled" || aborted3()) {
31960
+ if (outcome.status === "cancelled" || aborted2()) {
32173
31961
  return finish(cancelledResult(), path, intent.skill);
32174
31962
  }
32175
31963
  if (outcome.status === "failed" && outcome.error && MCP_FAILURES.includes(outcome.error)) {
@@ -32247,7 +32035,7 @@ function createIgnixAgentService(deps) {
32247
32035
  maxContextTokens: await deps.contextTokens() ?? 8192,
32248
32036
  signal
32249
32037
  }).catch(() => null);
32250
- if (aborted3()) return finish(cancelledResult(), "classified_skill", null);
32038
+ if (aborted2()) return finish(cancelledResult(), "classified_skill", null);
32251
32039
  if (intent) return runSkillPath(intent, lang, "classified_skill");
32252
32040
  }
32253
32041
  }
@@ -33081,7 +32869,7 @@ function routeEditStyle(text2, attachments) {
33081
32869
 
33082
32870
  // ../../packages/core/src/chat/chat-service.ts
33083
32871
  var BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
33084
- var token = (prefix, length) => `${prefix}_${[...(0, import_node_crypto6.randomBytes)(length)].map((b) => BASE62[b % 62]).join("")}`;
32872
+ var token = (prefix, length) => `${prefix}_${[...(0, import_node_crypto5.randomBytes)(length)].map((b) => BASE62[b % 62]).join("")}`;
33085
32873
  var REFUSAL_LABEL = {
33086
32874
  ambiguous: "Several items match \u2014 please say which one",
33087
32875
  not_found: "Could not find that item",
@@ -34056,16 +33844,16 @@ function inside(base, ...segments) {
34056
33844
  // ../../packages/engine-manager/src/fs/files.ts
34057
33845
  init_define_CREATOR_BOX_KIT();
34058
33846
  init_define_CREATOR_SFX_KIT();
34059
- var import_node_crypto7 = require("node:crypto");
33847
+ var import_node_crypto6 = require("node:crypto");
34060
33848
  var import_node_fs = require("node:fs");
34061
33849
  var import_promises6 = require("node:fs/promises");
34062
33850
  var import_node_path6 = require("node:path");
34063
33851
  async function sha256File(path, signal) {
34064
- const hash2 = (0, import_node_crypto7.createHash)("sha256");
33852
+ const hash2 = (0, import_node_crypto6.createHash)("sha256");
34065
33853
  for await (const chunk of (0, import_node_fs.createReadStream)(path, { signal })) hash2.update(chunk);
34066
33854
  return hash2.digest("hex");
34067
33855
  }
34068
- var randomId = (bytes = 8) => (0, import_node_crypto7.randomBytes)(bytes).toString("hex");
33856
+ var randomId = (bytes = 8) => (0, import_node_crypto6.randomBytes)(bytes).toString("hex");
34069
33857
  function writeFileAtomicSync(path, data, mode = 384) {
34070
33858
  const tmp = (0, import_node_path6.join)((0, import_node_path6.dirname)(path), `.${randomId()}.tmp`);
34071
33859
  const fd = (0, import_node_fs.openSync)(tmp, "wx", mode);
@@ -34118,7 +33906,7 @@ async function wipeDir(dir) {
34118
33906
  // ../../packages/engine-manager/src/download/downloader.ts
34119
33907
  init_define_CREATOR_BOX_KIT();
34120
33908
  init_define_CREATOR_SFX_KIT();
34121
- var import_node_crypto8 = require("node:crypto");
33909
+ var import_node_crypto7 = require("node:crypto");
34122
33910
  var import_node_fs2 = require("node:fs");
34123
33911
  var import_promises7 = require("node:fs/promises");
34124
33912
 
@@ -34324,7 +34112,7 @@ async function downloadVerified(spec, dest, options2) {
34324
34112
  await sleep(err2.waitMs ?? Math.min(1e3 * 2 ** (attempt - 1), RETRY_CAP_MS), signal);
34325
34113
  }
34326
34114
  }
34327
- const hash2 = (0, import_node_crypto8.createHash)("sha256");
34115
+ const hash2 = (0, import_node_crypto7.createHash)("sha256");
34328
34116
  const bytes = await hashExisting(part, hash2, signal);
34329
34117
  if (bytes !== spec.sizeBytes) {
34330
34118
  await (0, import_promises7.rm)(part, { force: true });
@@ -35689,7 +35477,7 @@ var EntryLedger = class {
35689
35477
  // ../../packages/engine-manager/src/archive/extract.ts
35690
35478
  init_define_CREATOR_BOX_KIT();
35691
35479
  init_define_CREATOR_SFX_KIT();
35692
- var import_node_crypto9 = require("node:crypto");
35480
+ var import_node_crypto8 = require("node:crypto");
35693
35481
  var import_promises9 = require("node:fs/promises");
35694
35482
 
35695
35483
  // ../../packages/engine-manager/src/archive/tar.ts
@@ -35904,7 +35692,7 @@ async function extractAllowlisted(archivePath, format, files, stagingDir, caps =
35904
35692
  if (entry.size !== file2.sizeBytes) throw new ArchiveRejected("allowlisted_entry_size");
35905
35693
  const bytes = await entry.read();
35906
35694
  if (bytes.length !== file2.sizeBytes) throw new ArchiveRejected("allowlisted_entry_size");
35907
- if ((0, import_node_crypto9.createHash)("sha256").update(bytes).digest("hex") !== file2.sha256) {
35695
+ if ((0, import_node_crypto8.createHash)("sha256").update(bytes).digest("hex") !== file2.sha256) {
35908
35696
  throw new ArchiveRejected("allowlisted_entry_hash");
35909
35697
  }
35910
35698
  const handle = await (0, import_promises9.open)(inside(stagingDir, file2.name), "wx", 384);
@@ -36268,7 +36056,7 @@ var RENDER_JOB_FILES = Object.freeze({
36268
36056
  // ../../packages/engine-manager/src/runtime/editor-kit.ts
36269
36057
  init_define_CREATOR_BOX_KIT();
36270
36058
  init_define_CREATOR_SFX_KIT();
36271
- var import_node_crypto10 = require("node:crypto");
36059
+ var import_node_crypto9 = require("node:crypto");
36272
36060
  var import_promises11 = require("node:fs/promises");
36273
36061
  var import_node_path8 = require("node:path");
36274
36062
  var SEGMENT2 = /^[A-Za-z0-9@_+.-]{1,128}$/;
@@ -36323,7 +36111,7 @@ function createEditorKitStore(deps) {
36323
36111
  } catch {
36324
36112
  throw new LocalAiError("not_installed");
36325
36113
  }
36326
- if ((0, import_node_crypto10.createHash)("sha256").update(bytes).digest("hex") !== deps.manifestSha256) {
36114
+ if ((0, import_node_crypto9.createHash)("sha256").update(bytes).digest("hex") !== deps.manifestSha256) {
36327
36115
  throw new LocalAiError("integrity_failed");
36328
36116
  }
36329
36117
  let parsed;
@@ -36385,7 +36173,7 @@ function createEditorKitStore(deps) {
36385
36173
  for (const f3 of manifest.files) {
36386
36174
  const segs = f3.path.split("/");
36387
36175
  const bytes = await (0, import_promises11.readFile)(kitPath(sourceDir, f3.path));
36388
- if (bytes.length !== f3.sizeBytes || (0, import_node_crypto10.createHash)("sha256").update(bytes).digest("hex") !== f3.sha256) {
36176
+ if (bytes.length !== f3.sizeBytes || (0, import_node_crypto9.createHash)("sha256").update(bytes).digest("hex") !== f3.sha256) {
36389
36177
  throw new LocalAiError("integrity_failed");
36390
36178
  }
36391
36179
  if (segs.length > 1)
@@ -36798,7 +36586,7 @@ function comfyArgs(input2) {
36798
36586
  // ../../packages/engine-manager/src/boxes/tree.ts
36799
36587
  init_define_CREATOR_BOX_KIT();
36800
36588
  init_define_CREATOR_SFX_KIT();
36801
- var import_node_crypto11 = require("node:crypto");
36589
+ var import_node_crypto10 = require("node:crypto");
36802
36590
  var import_promises13 = require("node:fs/promises");
36803
36591
  var import_node_path9 = require("node:path");
36804
36592
  function under(base, rel) {
@@ -36855,7 +36643,7 @@ async function listFiles2(dir, prefix = "") {
36855
36643
  return out;
36856
36644
  }
36857
36645
  function shapeDigest(files) {
36858
- const h = (0, import_node_crypto11.createHash)("sha256");
36646
+ const h = (0, import_node_crypto10.createHash)("sha256");
36859
36647
  for (const f3 of [...files].sort((a, b) => a.path < b.path ? -1 : 1))
36860
36648
  h.update(`${f3.path}\0${String(f3.size)}
36861
36649
  `);
@@ -37433,12 +37221,12 @@ function createH3Box(deps) {
37433
37221
  // ../../packages/engine-manager/src/runtime/credential.ts
37434
37222
  init_define_CREATOR_BOX_KIT();
37435
37223
  init_define_CREATOR_SFX_KIT();
37436
- var import_node_crypto12 = require("node:crypto");
37224
+ var import_node_crypto11 = require("node:crypto");
37437
37225
  var REDACTED2 = "[runtime-credential]";
37438
37226
  var secrets = /* @__PURE__ */ new WeakMap();
37439
37227
  var RuntimeCredential = class {
37440
37228
  constructor() {
37441
- secrets.set(this, (0, import_node_crypto12.randomBytes)(32).toString("base64url"));
37229
+ secrets.set(this, (0, import_node_crypto11.randomBytes)(32).toString("base64url"));
37442
37230
  }
37443
37231
  /** `Authorization` header value for loopback requests to this runtime. */
37444
37232
  authorization() {
@@ -38414,7 +38202,7 @@ function boxEstimate(recipe, platform, packs) {
38414
38202
  // ../../packages/engine-manager/src/boxes/manager.ts
38415
38203
  init_define_CREATOR_BOX_KIT();
38416
38204
  init_define_CREATOR_SFX_KIT();
38417
- var import_node_crypto13 = require("node:crypto");
38205
+ var import_node_crypto12 = require("node:crypto");
38418
38206
  var import_promises17 = require("node:fs/promises");
38419
38207
  var import_node_fs6 = require("node:fs");
38420
38208
  var import_node_path13 = require("node:path");
@@ -38538,7 +38326,7 @@ function createBoxManager(deps) {
38538
38326
  const want = deps.kit.files[name];
38539
38327
  if (!want) throw new LocalAiError("internal");
38540
38328
  const bytes = await (0, import_promises17.readFile)((0, import_node_path13.join)(deps.kit.dir, ...name.split("/")));
38541
- if ((0, import_node_crypto13.createHash)("sha256").update(bytes).digest("hex") !== want)
38329
+ if ((0, import_node_crypto12.createHash)("sha256").update(bytes).digest("hex") !== want)
38542
38330
  throw new LocalAiError("integrity_failed");
38543
38331
  return bytes;
38544
38332
  }
@@ -40908,8 +40696,8 @@ function createGenerationEngine(deps) {
40908
40696
  };
40909
40697
  const run = async (id, provider, request2, inputs) => {
40910
40698
  const controller = controllers.get(id) ?? new AbortController();
40911
- const aborted3 = () => controller.signal.aborted;
40912
- if (aborted3()) return;
40699
+ const aborted2 = () => controller.signal.aborted;
40700
+ if (aborted2()) return;
40913
40701
  const timeout = setTimeout(
40914
40702
  () => {
40915
40703
  controller.abort(new Error("timeout"));
@@ -40928,7 +40716,7 @@ function createGenerationEngine(deps) {
40928
40716
  { jobId: id, request: request2, inputs, staging, ...paid ? { paid } : {} },
40929
40717
  controller.signal
40930
40718
  )) {
40931
- if (aborted3()) break;
40719
+ if (aborted2()) break;
40932
40720
  if (event.type === "progress") {
40933
40721
  const fraction = Math.min(
40934
40722
  1,
@@ -40952,13 +40740,13 @@ function createGenerationEngine(deps) {
40952
40740
  }
40953
40741
  }
40954
40742
  } catch {
40955
- error62 = aborted3() ? null : "engine_crashed";
40743
+ error62 = aborted2() ? null : "engine_crashed";
40956
40744
  } finally {
40957
40745
  clearTimeout(timeout);
40958
40746
  if (staging) await deps.assets.discardStaging(staging).catch(() => void 0);
40959
40747
  }
40960
40748
  const reason = controller.signal.reason;
40961
- if (aborted3()) {
40749
+ if (aborted2()) {
40962
40750
  const timedOut = reason instanceof Error && reason.message === "timeout";
40963
40751
  update(
40964
40752
  id,
@@ -41715,7 +41503,7 @@ var import_node_path19 = require("node:path");
41715
41503
  // ../../packages/core/src/content/asset-store.ts
41716
41504
  init_define_CREATOR_BOX_KIT();
41717
41505
  init_define_CREATOR_SFX_KIT();
41718
- var import_node_crypto14 = require("node:crypto");
41506
+ var import_node_crypto13 = require("node:crypto");
41719
41507
  var import_node_fs10 = require("node:fs");
41720
41508
  var import_promises21 = require("node:fs/promises");
41721
41509
  var import_node_path17 = require("node:path");
@@ -42110,7 +41898,7 @@ async function isoHead(path) {
42110
41898
  // ../../packages/core/src/content/asset-store.ts
42111
41899
  var ASSET_ID = /^asset_[A-Za-z0-9]{24}$/;
42112
41900
  var BASE623 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
42113
- var newAssetId = () => `asset_${Array.from((0, import_node_crypto14.randomBytes)(24), (b) => BASE623[b % 62] ?? "0").join("")}`;
41901
+ var newAssetId = () => `asset_${Array.from((0, import_node_crypto13.randomBytes)(24), (b) => BASE623[b % 62] ?? "0").join("")}`;
42114
41902
  var MAX_IMAGE_BYTES = 32 * 1024 * 1024;
42115
41903
  var MAX_VIDEO_BYTES = 256 * 1024 * 1024;
42116
41904
  var MAX_LONG_VIDEO_BYTES2 = 8 * 1024 * 1024 * 1024;
@@ -42473,9 +42261,9 @@ init_define_CREATOR_SFX_KIT();
42473
42261
  // ../../packages/core/src/production/paid.ts
42474
42262
  init_define_CREATOR_BOX_KIT();
42475
42263
  init_define_CREATOR_SFX_KIT();
42476
- var import_node_crypto15 = require("node:crypto");
42264
+ var import_node_crypto14 = require("node:crypto");
42477
42265
  function paidKey(scope, body) {
42478
- const h = (0, import_node_crypto15.createHash)("sha256");
42266
+ const h = (0, import_node_crypto14.createHash)("sha256");
42479
42267
  h.update(scope);
42480
42268
  h.update("\0");
42481
42269
  h.update(stableJson(body));
@@ -42530,7 +42318,7 @@ var CREATIVE_EDIT_PATH = "/api/creator/creative/edit";
42530
42318
  var CREATIVE_CLIPS_PATH = "/api/creator/creative/clips";
42531
42319
  var CREATIVE_TRANSLATE_PATH = "/api/creator/creative/translate";
42532
42320
  var CREATIVE_SOUND_PATH = "/api/creator/sound";
42533
- var MAX_RESPONSE_BYTES2 = 512 * 1024;
42321
+ var MAX_RESPONSE_BYTES = 512 * 1024;
42534
42322
  var ClipsResponseSchema = external_exports.object({
42535
42323
  clips: external_exports.unknown(),
42536
42324
  credits: external_exports.object({
@@ -42566,14 +42354,14 @@ var EditResponseSchema = external_exports.object({
42566
42354
  remaining: external_exports.number().int().nonnegative().nullable()
42567
42355
  })
42568
42356
  });
42569
- var ResponseSchema3 = external_exports.object({
42357
+ var ResponseSchema2 = external_exports.object({
42570
42358
  plans: external_exports.array(external_exports.unknown()).min(1).max(5),
42571
42359
  credits: external_exports.object({
42572
42360
  charged: external_exports.number().int().nonnegative(),
42573
42361
  remaining: external_exports.number().int().nonnegative().nullable()
42574
42362
  })
42575
42363
  });
42576
- var REASON_OF2 = {
42364
+ var REASON_OF = {
42577
42365
  402: "credits_exhausted",
42578
42366
  403: "not_entitled",
42579
42367
  409: "vocabulary_unsupported",
@@ -42606,7 +42394,7 @@ function createCreativeBrain(deps) {
42606
42394
  async function send2(body, signal, paid) {
42607
42395
  const res = await post(url2, body, signal, paid);
42608
42396
  if (res.kind !== "ok") return res;
42609
- const parsed = ResponseSchema3.safeParse(res.body);
42397
+ const parsed = ResponseSchema2.safeParse(res.body);
42610
42398
  if (!parsed.success) return { kind: "unavailable", reason: "failed" };
42611
42399
  return { kind: "ok", plans: parsed.data.plans, credits: parsed.data.credits };
42612
42400
  }
@@ -42629,7 +42417,7 @@ function createCreativeBrain(deps) {
42629
42417
  target,
42630
42418
  body,
42631
42419
  token3,
42632
- { signal, maxBytes: MAX_RESPONSE_BYTES2 },
42420
+ { signal, maxBytes: MAX_RESPONSE_BYTES },
42633
42421
  paid
42634
42422
  );
42635
42423
  } catch (err2) {
@@ -42651,7 +42439,7 @@ function createCreativeBrain(deps) {
42651
42439
  continue;
42652
42440
  }
42653
42441
  if (res.status !== 200)
42654
- return { kind: "unavailable", reason: REASON_OF2[res.status] ?? "failed" };
42442
+ return { kind: "unavailable", reason: REASON_OF[res.status] ?? "failed" };
42655
42443
  return { kind: "ok", body: res.body };
42656
42444
  }
42657
42445
  return { kind: "unavailable", reason: "signed_out" };
@@ -42772,7 +42560,7 @@ function createCreativeBrain(deps) {
42772
42560
  try {
42773
42561
  res = await postJson(deps.http, url2, body, token3, {
42774
42562
  signal,
42775
- maxBytes: MAX_RESPONSE_BYTES2
42563
+ maxBytes: MAX_RESPONSE_BYTES
42776
42564
  });
42777
42565
  } catch (err2) {
42778
42566
  const offline = err2 instanceof OAuthHttpError && err2.kind === "network";
@@ -42783,9 +42571,9 @@ function createCreativeBrain(deps) {
42783
42571
  continue;
42784
42572
  }
42785
42573
  if (res.status !== 200) {
42786
- return { kind: "unavailable", reason: REASON_OF2[res.status] ?? "failed" };
42574
+ return { kind: "unavailable", reason: REASON_OF[res.status] ?? "failed" };
42787
42575
  }
42788
- const parsed = ResponseSchema3.safeParse(res.body);
42576
+ const parsed = ResponseSchema2.safeParse(res.body);
42789
42577
  if (!parsed.success) return { kind: "unavailable", reason: "failed" };
42790
42578
  const plans = parsed.data.plans.flatMap((p) => {
42791
42579
  const ok3 = ProductionPlanSchema.safeParse(p);
@@ -42931,8 +42719,8 @@ var durationOf = (pcm) => pcm.samples.length / pcm.sampleRate;
42931
42719
 
42932
42720
  // ../../packages/core/src/production/ignix-speech.ts
42933
42721
  var SPEECH_PATH = "/api/creator/speech";
42934
- var MAX_RESPONSE_BYTES3 = 8 * 1024 * 1024;
42935
- var ResponseSchema4 = external_exports.object({
42722
+ var MAX_RESPONSE_BYTES2 = 8 * 1024 * 1024;
42723
+ var ResponseSchema3 = external_exports.object({
42936
42724
  audio: external_exports.string().min(100).max(75e5),
42937
42725
  mediaType: external_exports.literal("audio/wav"),
42938
42726
  durationSec: external_exports.number().positive().max(60),
@@ -43044,7 +42832,7 @@ function createIgnixSpeechProvider(deps) {
43044
42832
  url2,
43045
42833
  body,
43046
42834
  token3,
43047
- { signal, maxBytes: MAX_RESPONSE_BYTES3 },
42835
+ { signal, maxBytes: MAX_RESPONSE_BYTES2 },
43048
42836
  job.paid
43049
42837
  );
43050
42838
  } catch (err2) {
@@ -43077,7 +42865,7 @@ function createIgnixSpeechProvider(deps) {
43077
42865
  yield { type: "error", code: CODE_OF[res.status] ?? "failed" };
43078
42866
  return;
43079
42867
  }
43080
- const parsed = ResponseSchema4.safeParse(res.body);
42868
+ const parsed = ResponseSchema3.safeParse(res.body);
43081
42869
  const pcm = parsed.success ? decodeWav(new Uint8Array(Buffer.from(parsed.data.audio, "base64"))) : null;
43082
42870
  if (!pcm) {
43083
42871
  yield { type: "error", code: "failed" };
@@ -43103,13 +42891,13 @@ function createIgnixSpeechProvider(deps) {
43103
42891
  // ../../packages/core/src/production/boost-video.ts
43104
42892
  init_define_CREATOR_BOX_KIT();
43105
42893
  init_define_CREATOR_SFX_KIT();
43106
- var import_node_crypto17 = require("node:crypto");
42894
+ var import_node_crypto16 = require("node:crypto");
43107
42895
  var import_promises23 = require("node:fs/promises");
43108
42896
 
43109
42897
  // ../../packages/core/src/production/workflows.ts
43110
42898
  init_define_CREATOR_BOX_KIT();
43111
42899
  init_define_CREATOR_SFX_KIT();
43112
- var import_node_crypto16 = require("node:crypto");
42900
+ var import_node_crypto15 = require("node:crypto");
43113
42901
  var BOOST_VIDEO_WORKFLOWS = {
43114
42902
  /** Image → video, subtle motion (Wan 2.2 TI2V-5B, Apache-2.0), 24 fps: this computer's. */
43115
42903
  "wan22-i2v": { version: 1, estimateSeconds: 240, typicalGpuSeconds: 195, fps: 24 },
@@ -43165,7 +42953,7 @@ var SIZE = {
43165
42953
  var h3Size = (aspect) => aspect === "16:9" || aspect === "4:3" ? { width: 1344, height: 768 } : { width: 768, height: 1344 };
43166
42954
  var h3Seconds = (s2) => Math.min(H3_MAX_SECONDS, Math.max(2, Math.ceil(s2 - 1e-9)));
43167
42955
  var aspectOf = (a) => a === "16:9" ? "16:9" : a === "1:1" ? "1:1" : "9:16";
43168
- function boostVideoRun(r, seed = (0, import_node_crypto16.randomInt)(0, 2 ** 31), i2v = "wan22-i2v") {
42956
+ function boostVideoRun(r, seed = (0, import_node_crypto15.randomInt)(0, 2 ** 31), i2v = "wan22-i2v") {
43169
42957
  if (r.kind === "image_to_video") {
43170
42958
  const fps = BOOST_VIDEO_WORKFLOWS[i2v].fps;
43171
42959
  const frames = Math.min(
@@ -43192,7 +42980,7 @@ function boostVideoRun(r, seed = (0, import_node_crypto16.randomInt)(0, 2 ** 31)
43192
42980
  }
43193
42981
  return null;
43194
42982
  }
43195
- function h3VideoRun(r, seed = (0, import_node_crypto16.randomInt)(0, 2 ** 31), lineSec = null, presenterVoice = "own") {
42983
+ function h3VideoRun(r, seed = (0, import_node_crypto15.randomInt)(0, 2 ** 31), lineSec = null, presenterVoice = "own") {
43196
42984
  const run = (workflow, aspect, prompt, seconds) => ({
43197
42985
  workflow,
43198
42986
  version: BOOST_VIDEO_WORKFLOWS[workflow].version,
@@ -43320,7 +43108,7 @@ function workflowFor(r) {
43320
43108
  var isH3Workflow = (wf) => wf.startsWith("h3-");
43321
43109
  function boostIdempotencyKey(run, image, audio) {
43322
43110
  const { seed: _seed, ...params } = run.params;
43323
- const h = (0, import_node_crypto17.createHash)("sha256");
43111
+ const h = (0, import_node_crypto16.createHash)("sha256");
43324
43112
  h.update(JSON.stringify({ w: run.workflow, v: run.version, p: params }));
43325
43113
  h.update(image);
43326
43114
  if (audio) h.update(audio);
@@ -43415,12 +43203,12 @@ function createBoostVideoProvider(deps) {
43415
43203
  yield { type: "error", code: "invalid_input" };
43416
43204
  return;
43417
43205
  }
43418
- const h = (0, import_node_crypto17.createHash)("sha256");
43206
+ const h = (0, import_node_crypto16.createHash)("sha256");
43419
43207
  h.update(JSON.stringify({ w: "recast", v: 1, p: { seconds: r.seconds, person: r.person } }));
43420
43208
  h.update(video);
43421
43209
  h.update(reference2);
43422
43210
  const idempotencyKey = h.digest("base64url").slice(0, 40);
43423
- const seed = (0, import_node_crypto17.createHash)("sha256").update(idempotencyKey).digest().readUInt32BE(0) % 2 ** 31;
43211
+ const seed = (0, import_node_crypto16.createHash)("sha256").update(idempotencyKey).digest().readUInt32BE(0) % 2 ** 31;
43424
43212
  yield { type: "progress", fraction: 0.01, stage: "queued" };
43425
43213
  const upload = async (purpose, bytes, contentType) => {
43426
43214
  const res = await call(
@@ -43650,7 +43438,7 @@ function createBoostVideoProvider(deps) {
43650
43438
  ...draft,
43651
43439
  params: {
43652
43440
  ...draft.params,
43653
- seed: (0, import_node_crypto17.createHash)("sha256").update(idempotencyKey).digest().readUInt32BE(0) % 2 ** 31
43441
+ seed: (0, import_node_crypto16.createHash)("sha256").update(idempotencyKey).digest().readUInt32BE(0) % 2 ** 31
43654
43442
  }
43655
43443
  };
43656
43444
  yield { type: "progress", fraction: 0.02, stage: "queued" };
@@ -44015,7 +43803,7 @@ function createProductionLedger(deps) {
44015
43803
  // ../../packages/core/src/growth/service.ts
44016
43804
  init_define_CREATOR_BOX_KIT();
44017
43805
  init_define_CREATOR_SFX_KIT();
44018
- var import_node_crypto18 = require("node:crypto");
43806
+ var import_node_crypto17 = require("node:crypto");
44019
43807
 
44020
43808
  // ../../packages/core/src/operator/upload.ts
44021
43809
  init_define_CREATOR_BOX_KIT();
@@ -44709,8 +44497,8 @@ var base62 = (buf) => {
44709
44497
  for (const b of buf) out += A.charAt(b % 62);
44710
44498
  return out;
44711
44499
  };
44712
- var newCampaignId = () => `cmp_${base62((0, import_node_crypto18.randomBytes)(20))}`;
44713
- var pieceJobId = (campaignId, key) => `job_${base62((0, import_node_crypto18.createHash)("sha256").update(`${campaignId}:${key}`).digest()).slice(0, 24)}`;
44500
+ var newCampaignId = () => `cmp_${base62((0, import_node_crypto17.randomBytes)(20))}`;
44501
+ var pieceJobId = (campaignId, key) => `job_${base62((0, import_node_crypto17.createHash)("sha256").update(`${campaignId}:${key}`).digest()).slice(0, 24)}`;
44714
44502
  function createCampaignService(deps) {
44715
44503
  const now = deps.now ?? Date.now;
44716
44504
  const records = /* @__PURE__ */ new Map();
@@ -44863,7 +44651,7 @@ function createCampaignService(deps) {
44863
44651
  return { ...s2, pieces };
44864
44652
  }
44865
44653
  function planHashOf(rec7) {
44866
- return (0, import_node_crypto18.createHash)("sha256").update(
44654
+ return (0, import_node_crypto17.createHash)("sha256").update(
44867
44655
  canonicalJson({
44868
44656
  v: 1,
44869
44657
  id: rec7.id,
@@ -45264,7 +45052,7 @@ ${line}`.slice(0, 2200);
45264
45052
  await deps.ignix.update(rec7.ignixId ?? "", { state: "failed" }, signal).catch(() => null);
45265
45053
  return;
45266
45054
  }
45267
- rec7.scheduleHash = (0, import_node_crypto18.createHash)("sha256").update(
45055
+ rec7.scheduleHash = (0, import_node_crypto17.createHash)("sha256").update(
45268
45056
  canonicalJson({
45269
45057
  v: 1,
45270
45058
  id: rec7.id,
@@ -46157,7 +45945,7 @@ var ObservationSchema = external_exports.object({
46157
45945
  focus: external_exports.array(external_exports.object({ label: external_exports.string().max(60), box: BoxSchema2 })).max(3),
46158
45946
  bestFrame: external_exports.number().int().min(0).max(5).nullable()
46159
45947
  });
46160
- var ResponseSchema5 = external_exports.object({
45948
+ var ResponseSchema4 = external_exports.object({
46161
45949
  observations: external_exports.array(external_exports.unknown()).min(1).max(10),
46162
45950
  credits: external_exports.object({
46163
45951
  charged: external_exports.number().int().nonnegative(),
@@ -46254,7 +46042,7 @@ function createMediaUnderstanding(deps) {
46254
46042
  deps.invalidate(token3);
46255
46043
  continue;
46256
46044
  }
46257
- const parsed = res.status === 200 ? ResponseSchema5.safeParse(res.body) : null;
46045
+ const parsed = res.status === 200 ? ResponseSchema4.safeParse(res.body) : null;
46258
46046
  if (!parsed?.success) return 0;
46259
46047
  for (const raw of parsed.data.observations) {
46260
46048
  const o = ObservationSchema.safeParse(raw);
@@ -48354,14 +48142,14 @@ function spokenWindow(t, opts) {
48354
48142
  // ../../packages/core/src/production/montage.ts
48355
48143
  init_define_CREATOR_BOX_KIT();
48356
48144
  init_define_CREATOR_SFX_KIT();
48357
- var import_node_crypto19 = require("node:crypto");
48145
+ var import_node_crypto18 = require("node:crypto");
48358
48146
  var import_node_path22 = require("node:path");
48359
48147
  var REPLACE_GENERATED = 0.27;
48360
48148
  var REPLACE_DESIGN = 0.26;
48361
48149
  function createMontage(deps) {
48362
48150
  const dirOf = () => (0, import_node_path22.join)(
48363
48151
  deps.workRoot,
48364
- `om3-${(0, import_node_crypto19.createHash)("sha256").update(deps.context() ?? "_none").digest("hex").slice(0, 24)}`
48152
+ `om3-${(0, import_node_crypto18.createHash)("sha256").update(deps.context() ?? "_none").digest("hex").slice(0, 24)}`
48365
48153
  );
48366
48154
  const known3 = /* @__PURE__ */ new Map();
48367
48155
  const inflight = /* @__PURE__ */ new Map();
@@ -50605,7 +50393,7 @@ function stockQuery(plan) {
50605
50393
  // ../../packages/core/src/operator/service.ts
50606
50394
  init_define_CREATOR_BOX_KIT();
50607
50395
  init_define_CREATOR_SFX_KIT();
50608
- var import_node_crypto20 = require("node:crypto");
50396
+ var import_node_crypto19 = require("node:crypto");
50609
50397
 
50610
50398
  // ../../packages/core/src/operator/copy.ts
50611
50399
  init_define_CREATOR_BOX_KIT();
@@ -50835,8 +50623,8 @@ var READ_TOOLS = [
50835
50623
  "list_posts",
50836
50624
  "list_accounts"
50837
50625
  ];
50838
- var token2 = (prefix, n = 24) => `${prefix}_${(0, import_node_crypto20.randomBytes)(n).toString("base64url").replace(/[^A-Za-z0-9]/g, "").slice(0, n)}`;
50839
- var shortTag = () => (0, import_node_crypto20.randomBytes)(4).toString("hex");
50626
+ var token2 = (prefix, n = 24) => `${prefix}_${(0, import_node_crypto19.randomBytes)(n).toString("base64url").replace(/[^A-Za-z0-9]/g, "").slice(0, n)}`;
50627
+ var shortTag = () => (0, import_node_crypto19.randomBytes)(4).toString("hex");
50840
50628
  function classify(r) {
50841
50629
  if (r.kind === "ok") return { done: true, certain: true, error: "failed" };
50842
50630
  if (r.kind === "denied") return { done: false, certain: true, error: "plan_changed" };
@@ -51208,7 +50996,7 @@ ${t.ctaLine(kw)}` : t.ctaLine(kw);
51208
50996
  set2(rec7, "failed", "failed");
51209
50997
  return;
51210
50998
  }
51211
- const hash2 = (0, import_node_crypto20.createHash)("sha256").update(canonicalJson({ v: 1, account: account.id, assetId, steps })).digest("hex").slice(0, 32);
50999
+ const hash2 = (0, import_node_crypto19.createHash)("sha256").update(canonicalJson({ v: 1, account: account.id, assetId, steps })).digest("hex").slice(0, 32);
51212
51000
  rec7.plan = {
51213
51001
  steps,
51214
51002
  hash: hash2,
@@ -51822,7 +51610,7 @@ function createIgnixPhotoUpload(deps) {
51822
51610
  // ../../packages/core/src/brand/service.ts
51823
51611
  init_define_CREATOR_BOX_KIT();
51824
51612
  init_define_CREATOR_SFX_KIT();
51825
- var import_node_crypto21 = require("node:crypto");
51613
+ var import_node_crypto20 = require("node:crypto");
51826
51614
 
51827
51615
  // ../../packages/core/src/operator/port.ts
51828
51616
  init_define_CREATOR_BOX_KIT();
@@ -52012,7 +51800,7 @@ var BRAND_TEXT = {
52012
51800
  };
52013
51801
 
52014
51802
  // ../../packages/core/src/brand/service.ts
52015
- var cardId = () => `brd_${(0, import_node_crypto21.randomBytes)(18).toString("base64url").replace(/[^A-Za-z0-9]/g, "").slice(0, 22).padEnd(16, "0")}`;
51803
+ var cardId = () => `brd_${(0, import_node_crypto20.randomBytes)(18).toString("base64url").replace(/[^A-Za-z0-9]/g, "").slice(0, 22).padEnd(16, "0")}`;
52016
51804
  var rec6 = (v) => typeof v === "object" && v !== null && !Array.isArray(v) ? v : {};
52017
51805
  var str3 = (v, n = 200) => typeof v === "string" && v.trim() ? v.replace(/\s+/g, " ").trim().slice(0, n) : null;
52018
51806
  function sentences(parts, max) {
@@ -52547,7 +52335,7 @@ function createBrandService(deps) {
52547
52335
  // ../../packages/core/src/content/content-service.ts
52548
52336
  init_define_CREATOR_BOX_KIT();
52549
52337
  init_define_CREATOR_SFX_KIT();
52550
- var import_node_crypto22 = require("node:crypto");
52338
+ var import_node_crypto21 = require("node:crypto");
52551
52339
 
52552
52340
  // ../../packages/core/src/content/brief.ts
52553
52341
  init_define_CREATOR_BOX_KIT();
@@ -55032,7 +54820,7 @@ function createTalkEditor(deps) {
55032
54820
  const r = await deps.assets.importGenerated(wav).catch(() => null);
55033
54821
  return r?.ok ? { asset: r.asset.id, level: 0.5, credits } : null;
55034
54822
  }
55035
- async function produceClips(set2, signal, aborted3) {
54823
+ async function produceClips(set2, signal, aborted2) {
55036
54824
  const transcriber = deps.transcriber;
55037
54825
  if (!transcriber) return;
55038
54826
  set2.state = "running";
@@ -55046,7 +54834,7 @@ function createTalkEditor(deps) {
55046
54834
  transcriber.transcribe(set2.source.id, sourceSec, signal),
55047
54835
  w > h && deps.faces ? deps.faces(set2.source, signal).catch(() => null) : Promise.resolve(null)
55048
54836
  ]);
55049
- if (aborted3()) return;
54837
+ if (aborted2()) return;
55050
54838
  if (!transcript) {
55051
54839
  fail(set2, "engine_failed");
55052
54840
  return;
@@ -55091,7 +54879,7 @@ function createTalkEditor(deps) {
55091
54879
  },
55092
54880
  signal
55093
54881
  );
55094
- if (aborted3()) return;
54882
+ if (aborted2()) return;
55095
54883
  if (res.kind !== "ok") {
55096
54884
  fail(
55097
54885
  set2,
@@ -55173,7 +54961,7 @@ function createTalkEditor(deps) {
55173
54961
  }))
55174
54962
  );
55175
54963
  for (const r of made) {
55176
- if (aborted3()) return;
54964
+ if (aborted2()) return;
55177
54965
  await produce(r);
55178
54966
  }
55179
54967
  }
@@ -55440,14 +55228,14 @@ function createTalkEditor(deps) {
55440
55228
  }
55441
55229
  async function produce(rec7) {
55442
55230
  const signal = rec7.controller.signal;
55443
- const aborted3 = () => signal.aborted;
55231
+ const aborted2 = () => signal.aborted;
55444
55232
  try {
55445
55233
  if (!deps.transcriber?.available() || !await renderReady()) {
55446
55234
  fail(rec7, "not_set_up");
55447
55235
  return;
55448
55236
  }
55449
55237
  if (rec7.mode === "clips") {
55450
- await produceClips(rec7, signal, aborted3);
55238
+ await produceClips(rec7, signal, aborted2);
55451
55239
  return;
55452
55240
  }
55453
55241
  rec7.state = "running";
@@ -55465,7 +55253,7 @@ function createTalkEditor(deps) {
55465
55253
  rec7.voice = imported?.ok ? imported.asset.id : null;
55466
55254
  rec7.voiceStart = rec7.window?.fromSec ?? 0;
55467
55255
  }
55468
- if (aborted3()) return;
55256
+ if (aborted2()) return;
55469
55257
  if (!transcript) {
55470
55258
  fail(rec7, "engine_failed");
55471
55259
  return;
@@ -55509,7 +55297,7 @@ function createTalkEditor(deps) {
55509
55297
  reframe: t.reframe === false ? null : t.reframe === true || (rec7.reframe?.coverage ?? 0) >= 0.4 ? rec7.reframe : null
55510
55298
  };
55511
55299
  const directed = rec7.mode === "revision" || rec7.mode === "clip" ? rec7.decision ? { decision: rec7.decision, broll: rec7.brollAssets } : null : await direct(rec7, transcript, signal);
55512
- if (aborted3()) return;
55300
+ if (aborted2()) return;
55513
55301
  let music = null;
55514
55302
  if (directed) {
55515
55303
  const d = directed.decision;
@@ -55565,7 +55353,7 @@ function createTalkEditor(deps) {
55565
55353
  continue;
55566
55354
  }
55567
55355
  const got = await askedSound(s2.what, signal);
55568
- if (aborted3()) return;
55356
+ if (aborted2()) return;
55569
55357
  if (!got) {
55570
55358
  deps.log.warn("Asked sound: none to place", { library: packSound(s2.what) ?? "none" });
55571
55359
  continue;
@@ -55585,7 +55373,7 @@ function createTalkEditor(deps) {
55585
55373
  rec7.dubPost = null;
55586
55374
  if (t.dub && final.talk) {
55587
55375
  const dubbed = await dubEdit(rec7, final, transcript, t, signal);
55588
- if (aborted3()) return;
55376
+ if (aborted2()) return;
55589
55377
  if ("error" in dubbed) {
55590
55378
  fail(rec7, dubbed.error);
55591
55379
  return;
@@ -55636,7 +55424,7 @@ function createTalkEditor(deps) {
55636
55424
  deps.changed();
55637
55425
  const job = await deps.engine.wait(res.job.id);
55638
55426
  rec7.activeJob = null;
55639
- if (aborted3()) return;
55427
+ if (aborted2()) return;
55640
55428
  const ref = job?.state === "succeeded" ? job.artifacts[0]?.ref : null;
55641
55429
  if (!ref) {
55642
55430
  fail(rec7, job?.error === "out_of_memory" ? "out_of_memory" : "engine_failed");
@@ -55657,7 +55445,7 @@ function createTalkEditor(deps) {
55657
55445
  });
55658
55446
  deps.changed();
55659
55447
  } catch (err2) {
55660
- if (aborted3()) return;
55448
+ if (aborted2()) return;
55661
55449
  deps.log.warn("Talk edit failed", { error: err2 instanceof Error ? err2.name : "unknown" });
55662
55450
  fail(rec7, "failed");
55663
55451
  }
@@ -57174,7 +56962,7 @@ function pointOf(at, n) {
57174
56962
 
57175
56963
  // ../../packages/core/src/content/content-service.ts
57176
56964
  var BASE624 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
57177
- var newJobId = () => `job_${[...(0, import_node_crypto22.randomBytes)(20)].map((b) => BASE624[b % 62] ?? "0").join("")}`;
56965
+ var newJobId = () => `job_${[...(0, import_node_crypto21.randomBytes)(20)].map((b) => BASE624[b % 62] ?? "0").join("")}`;
57178
56966
  var RECAST_MAX_SEC = 15;
57179
56967
  var STEP = {
57180
56968
  en: {
@@ -58072,7 +57860,7 @@ init_define_CREATOR_SFX_KIT();
58072
57860
  // ../../packages/core/src/content/sd-provider.ts
58073
57861
  init_define_CREATOR_BOX_KIT();
58074
57862
  init_define_CREATOR_SFX_KIT();
58075
- var import_node_crypto23 = require("node:crypto");
57863
+ var import_node_crypto22 = require("node:crypto");
58076
57864
  var import_promises24 = require("node:fs/promises");
58077
57865
  var ASPECT_OF2 = {
58078
57866
  "1:1": "1:1",
@@ -58160,7 +57948,7 @@ function createSdCppProvider(deps) {
58160
57948
  },
58161
57949
  async *run(job, signal) {
58162
57950
  const { request: request2 } = job;
58163
- const aborted3 = () => signal.aborted;
57951
+ const aborted2 = () => signal.aborted;
58164
57952
  if (request2.kind !== "image") {
58165
57953
  yield { type: "error", code: "unsupported" };
58166
57954
  return;
@@ -58204,13 +57992,13 @@ function createSdCppProvider(deps) {
58204
57992
  steps: profile.steps,
58205
57993
  cfgScale: profile.cfgScale,
58206
57994
  sampler: profile.sampler,
58207
- seed: (request2.seed ?? deps.seed?.() ?? (0, import_node_crypto23.randomInt)(0, 2147483647)) % 2147483647,
57995
+ seed: (request2.seed ?? deps.seed?.() ?? (0, import_node_crypto22.randomInt)(0, 2147483647)) % 2147483647,
58208
57996
  prompt: request2.prompt,
58209
57997
  reference: ref ? profile.referenceMode : "none",
58210
57998
  ...ref && profile.referenceMode === "init" ? { strength: profile.referenceStrength } : {}
58211
57999
  };
58212
58000
  await deps.beforeRun?.();
58213
- if (aborted3()) {
58001
+ if (aborted2()) {
58214
58002
  yield { type: "error", code: "cancelled" };
58215
58003
  return;
58216
58004
  }
@@ -58250,7 +58038,7 @@ function createSdCppProvider(deps) {
58250
58038
  }, grace).unref();
58251
58039
  };
58252
58040
  signal.addEventListener("abort", onAbort, { once: true });
58253
- if (aborted3()) onAbort();
58041
+ if (aborted2()) onAbort();
58254
58042
  void proc.exited.then((e) => {
58255
58043
  run.exit = e;
58256
58044
  wake?.();
@@ -58272,7 +58060,7 @@ function createSdCppProvider(deps) {
58272
58060
  if (run.exit === null) onAbort();
58273
58061
  }
58274
58062
  const done2 = run.exit;
58275
- if (run.killed || aborted3()) {
58063
+ if (run.killed || aborted2()) {
58276
58064
  yield { type: "error", code: "cancelled" };
58277
58065
  return;
58278
58066
  }
@@ -58724,7 +58512,7 @@ function createIgnixImageProvider(deps) {
58724
58512
  grants.clear();
58725
58513
  },
58726
58514
  async *run(job, signal) {
58727
- const aborted3 = () => signal.aborted;
58515
+ const aborted2 = () => signal.aborted;
58728
58516
  const args = ignixImageArgs(job.request);
58729
58517
  if (!args) {
58730
58518
  yield { type: "error", code: "unsupported" };
@@ -58750,7 +58538,7 @@ function createIgnixImageProvider(deps) {
58750
58538
  { key: ref, bytes: new Uint8Array(bytes), mediaType: info.mediaType },
58751
58539
  signal
58752
58540
  ).catch(() => null) : null;
58753
- if (aborted3()) return;
58541
+ if (aborted2()) return;
58754
58542
  if (!url2) {
58755
58543
  grants.drop(key);
58756
58544
  yield { type: "error", code: "failed" };
@@ -58772,7 +58560,7 @@ function createIgnixImageProvider(deps) {
58772
58560
  for (; ; ) {
58773
58561
  grants.grant(key);
58774
58562
  outcome = await deps.port.generate(sent, approved(sent), signal).catch(() => ({ kind: "failed", code: "network", message: null }));
58775
- if (aborted3() || outcome.kind !== "failed" || outcome.code !== "tool_error") break;
58563
+ if (aborted2() || outcome.kind !== "failed" || outcome.code !== "tool_error") break;
58776
58564
  const m = outcome.message ?? "";
58777
58565
  if (/reservationId is not an open credit reservation/i.test(m) && sent.reservationId) {
58778
58566
  const { reservationId: _drop, ...rest } = sent;
@@ -58786,7 +58574,7 @@ function createIgnixImageProvider(deps) {
58786
58574
  break;
58787
58575
  }
58788
58576
  grants.drop(key);
58789
- if (aborted3()) return;
58577
+ if (aborted2()) return;
58790
58578
  if (outcome.kind !== "ok") {
58791
58579
  yield { type: "error", code: ignixFailure(outcome) };
58792
58580
  return;
@@ -58798,7 +58586,7 @@ function createIgnixImageProvider(deps) {
58798
58586
  }
58799
58587
  yield { type: "progress", fraction: 0.85, stage: "finishing" };
58800
58588
  const got = await deps.download(result.data.url, signal);
58801
- if (aborted3()) return;
58589
+ if (aborted2()) return;
58802
58590
  if (!got.ok) {
58803
58591
  yield { type: "error", code: "failed" };
58804
58592
  return;
@@ -58814,7 +58602,7 @@ function createIgnixImageProvider(deps) {
58814
58602
  // ../../packages/core/src/content/cloud-boost.ts
58815
58603
  init_define_CREATOR_BOX_KIT();
58816
58604
  init_define_CREATOR_SFX_KIT();
58817
- var import_node_crypto24 = require("node:crypto");
58605
+ var import_node_crypto23 = require("node:crypto");
58818
58606
  var import_promises26 = require("node:fs/promises");
58819
58607
 
58820
58608
  // ../../packages/core/src/content/comfy-workflows.ts
@@ -58925,7 +58713,7 @@ var REASON = {
58925
58713
  function createBoostProvider(deps) {
58926
58714
  const workflows = deps.workflows ?? APPROVED_WORKFLOWS;
58927
58715
  const pollMs = deps.pollMs ?? 2e3;
58928
- const seed = deps.seed ?? (() => (0, import_node_crypto24.randomInt)(0, 2 ** 31));
58716
+ const seed = deps.seed ?? (() => (0, import_node_crypto23.randomInt)(0, 2 ** 31));
58929
58717
  const grants = createSpendGrants();
58930
58718
  const keyOf2 = (r) => JSON.stringify([r.kind, r.kind === "image" ? [r.prompt, r.aspect, r.seed ?? null] : null]);
58931
58719
  const runOf = (r, s2) => {
@@ -58990,7 +58778,7 @@ function createBoostProvider(deps) {
58990
58778
  return true;
58991
58779
  },
58992
58780
  async *run(job, signal) {
58993
- const aborted3 = () => signal.aborted;
58781
+ const aborted2 = () => signal.aborted;
58994
58782
  const key = keyOf2(job.request);
58995
58783
  const run = runOf(job.request, seed());
58996
58784
  if (!run) {
@@ -59003,7 +58791,7 @@ function createBoostProvider(deps) {
59003
58791
  }
59004
58792
  yield { type: "progress", fraction: 0.02, stage: "queued" };
59005
58793
  const started = await deps.gateway.start(run, signal).catch(() => ({ ok: false, code: "failed" }));
59006
- if (aborted3()) return;
58794
+ if (aborted2()) return;
59007
58795
  if (!started.ok) {
59008
58796
  yield { type: "error", code: started.code };
59009
58797
  return;
@@ -59015,7 +58803,7 @@ function createBoostProvider(deps) {
59015
58803
  let url2 = null;
59016
58804
  for (; ; ) {
59017
58805
  await new Promise((r) => setTimeout(r, pollMs));
59018
- if (aborted3()) return;
58806
+ if (aborted2()) return;
59019
58807
  const p = await deps.gateway.poll(runId, signal);
59020
58808
  if (p.state === "failed") {
59021
58809
  yield { type: "error", code: p.error ?? "failed" };
@@ -59036,7 +58824,7 @@ function createBoostProvider(deps) {
59036
58824
  }
59037
58825
  yield { type: "progress", fraction: 0.95, stage: "finishing" };
59038
58826
  const got = await deps.download(url2, signal);
59039
- if (aborted3()) return;
58827
+ if (aborted2()) return;
59040
58828
  if (!got.ok) {
59041
58829
  yield { type: "error", code: "failed" };
59042
58830
  return;
@@ -59046,7 +58834,7 @@ function createBoostProvider(deps) {
59046
58834
  yield { type: "output", name, mediaType: got.mediaType };
59047
58835
  yield { type: "done" };
59048
58836
  } catch {
59049
- if (!aborted3()) yield { type: "error", code: "failed" };
58837
+ if (!aborted2()) yield { type: "error", code: "failed" };
59050
58838
  } finally {
59051
58839
  signal.removeEventListener("abort", stop);
59052
58840
  }
@@ -59057,13 +58845,13 @@ function createBoostProvider(deps) {
59057
58845
  // ../../packages/core/src/content/comfyui-provider.ts
59058
58846
  init_define_CREATOR_BOX_KIT();
59059
58847
  init_define_CREATOR_SFX_KIT();
59060
- var import_node_crypto26 = require("node:crypto");
58848
+ var import_node_crypto25 = require("node:crypto");
59061
58849
  var import_promises27 = require("node:fs/promises");
59062
58850
 
59063
58851
  // ../../packages/core/src/content/media-download.ts
59064
58852
  init_define_CREATOR_BOX_KIT();
59065
58853
  init_define_CREATOR_SFX_KIT();
59066
- var import_node_crypto25 = require("node:crypto");
58854
+ var import_node_crypto24 = require("node:crypto");
59067
58855
  var CONTENT_ADDRESSED = /\/([0-9a-f]{64})\.(?:jpe?g|png|webp)$/;
59068
58856
  function ignixMediaOrigins(auth) {
59069
58857
  const production = ["https://media.ignix.social", "https://media.zernio.com"];
@@ -59139,7 +58927,7 @@ function createMediaDownloader(deps) {
59139
58927
  const info = identifyImage(bytes);
59140
58928
  if (!info) return { ok: false, reason: "not_an_image" };
59141
58929
  const named = CONTENT_ADDRESSED.exec(parsed.pathname)?.[1];
59142
- if (named && (0, import_node_crypto25.createHash)("sha256").update(bytes).digest("hex") !== named) {
58930
+ if (named && (0, import_node_crypto24.createHash)("sha256").update(bytes).digest("hex") !== named) {
59143
58931
  return { ok: false, reason: "integrity" };
59144
58932
  }
59145
58933
  return { ok: true, bytes, mediaType: info.mediaType };
@@ -59179,7 +58967,7 @@ function loopbackBase(url2) {
59179
58967
  function createComfyUiProvider(deps) {
59180
58968
  const workflows = deps.workflows ?? APPROVED_WORKFLOWS;
59181
58969
  const pollMs = deps.pollMs ?? 1e3;
59182
- const seed = deps.seed ?? (() => (0, import_node_crypto26.randomInt)(0, 2 ** 31));
58970
+ const seed = deps.seed ?? (() => (0, import_node_crypto25.randomInt)(0, 2 ** 31));
59183
58971
  const base = async () => loopbackBase(await deps.endpoint().catch(() => null));
59184
58972
  const call = (url2, init, signal) => deps.fetch(url2, {
59185
58973
  ...init,
@@ -59235,7 +59023,7 @@ function createComfyUiProvider(deps) {
59235
59023
  });
59236
59024
  },
59237
59025
  async *run(job, signal) {
59238
- const aborted3 = () => signal.aborted;
59026
+ const aborted2 = () => signal.aborted;
59239
59027
  const b = await base();
59240
59028
  if (!b) {
59241
59029
  yield { type: "error", code: "not_ready" };
@@ -59259,7 +59047,7 @@ function createComfyUiProvider(deps) {
59259
59047
  }
59260
59048
  promptId = sub.data.prompt_id;
59261
59049
  } catch {
59262
- if (!aborted3()) yield { type: "error", code: "engine_crashed" };
59050
+ if (!aborted2()) yield { type: "error", code: "engine_crashed" };
59263
59051
  return;
59264
59052
  }
59265
59053
  const stop = () => {
@@ -59273,7 +59061,7 @@ function createComfyUiProvider(deps) {
59273
59061
  let image = null;
59274
59062
  for (; ; ) {
59275
59063
  await new Promise((r) => setTimeout(r, pollMs));
59276
- if (aborted3()) return;
59064
+ if (aborted2()) return;
59277
59065
  const history = external_exports.record(external_exports.string(), HistoryEntrySchema).safeParse(await json2(`${b}/history/${promptId}`, { method: "GET" }, signal));
59278
59066
  const entry = history.success ? history.data[promptId] : void 0;
59279
59067
  if (entry?.status?.status_str === "error") {
@@ -59305,7 +59093,7 @@ function createComfyUiProvider(deps) {
59305
59093
  fetch: deps.fetch,
59306
59094
  maxBytes: deps.maxBytes
59307
59095
  })(`${b}/view?${q.toString()}`, signal);
59308
- if (aborted3()) return;
59096
+ if (aborted2()) return;
59309
59097
  if (!got.ok) {
59310
59098
  yield { type: "error", code: "failed" };
59311
59099
  return;
@@ -59315,7 +59103,7 @@ function createComfyUiProvider(deps) {
59315
59103
  yield { type: "output", name, mediaType: got.mediaType };
59316
59104
  yield { type: "done" };
59317
59105
  } catch {
59318
- if (!aborted3()) yield { type: "error", code: "engine_crashed" };
59106
+ if (!aborted2()) yield { type: "error", code: "engine_crashed" };
59319
59107
  } finally {
59320
59108
  signal.removeEventListener("abort", stop);
59321
59109
  }
@@ -59491,7 +59279,7 @@ function createRenderProvider(deps) {
59491
59279
  };
59492
59280
  },
59493
59281
  async *run(job, signal) {
59494
- const aborted3 = () => signal.aborted;
59282
+ const aborted2 = () => signal.aborted;
59495
59283
  const request2 = job.request;
59496
59284
  if (request2.kind !== "composition" && !isThumbnails(request2)) {
59497
59285
  yield { type: "error", code: "unsupported" };
@@ -59541,7 +59329,7 @@ function createRenderProvider(deps) {
59541
59329
  await (0, import_promises28.writeFile)(inside(job.staging.locator, RENDER_JOB_FILES.inputs), JSON.stringify(map2), {
59542
59330
  mode: 384
59543
59331
  });
59544
- if (aborted3()) return;
59332
+ if (aborted2()) return;
59545
59333
  const events = [];
59546
59334
  let wake = null;
59547
59335
  let buffer = "";
@@ -59586,7 +59374,7 @@ function createRenderProvider(deps) {
59586
59374
  }, grace);
59587
59375
  };
59588
59376
  signal.addEventListener("abort", onAbort, { once: true });
59589
- if (aborted3()) onAbort();
59377
+ if (aborted2()) onAbort();
59590
59378
  let done2 = false;
59591
59379
  let failure4 = null;
59592
59380
  let review = null;
@@ -59612,7 +59400,7 @@ function createRenderProvider(deps) {
59612
59400
  failure4 = ERROR_OF[e.code];
59613
59401
  }
59614
59402
  }
59615
- if (proc.exited || aborted3()) break;
59403
+ if (proc.exited || aborted2()) break;
59616
59404
  await new Promise((resolve4) => {
59617
59405
  wake = resolve4;
59618
59406
  setTimeout(resolve4, 1e3);
@@ -59627,7 +59415,7 @@ function createRenderProvider(deps) {
59627
59415
  if (e?.t === "output" && isThumbnails(request2)) outputs.push(e.file);
59628
59416
  if (e?.t === "error") failure4 = ERROR_OF[e.code];
59629
59417
  }
59630
- if (aborted3()) return;
59418
+ if (aborted2()) return;
59631
59419
  if (done2 && exit.code === 0) {
59632
59420
  yield { type: "progress", fraction: 1, stage: "finishing" };
59633
59421
  if (request2.kind === "composition") {
@@ -59662,7 +59450,7 @@ function createRenderProvider(deps) {
59662
59450
  // ../../packages/core/src/production/local-video.ts
59663
59451
  init_define_CREATOR_BOX_KIT();
59664
59452
  init_define_CREATOR_SFX_KIT();
59665
- var import_node_crypto27 = require("node:crypto");
59453
+ var import_node_crypto26 = require("node:crypto");
59666
59454
  var import_promises29 = require("node:fs/promises");
59667
59455
  var LOCAL_VIDEO_NODES = {
59668
59456
  "wan22-i2v": /* @__PURE__ */ new Set([
@@ -60084,7 +59872,7 @@ function createLocalVideoProvider(deps) {
60084
59872
  yield { type: "error", code: "not_ready" };
60085
59873
  return;
60086
59874
  }
60087
- const seed = (0, import_node_crypto27.createHash)("sha256").update(JSON.stringify(r)).update(image).update(audio ?? new Uint8Array()).digest().readUInt32BE(0) % 2 ** 31;
59875
+ const seed = (0, import_node_crypto26.createHash)("sha256").update(JSON.stringify(r)).update(image).update(audio ?? new Uint8Array()).digest().readUInt32BE(0) % 2 ** 31;
60088
59876
  const run = boostVideoRun(r, seed);
60089
59877
  if (!run) {
60090
59878
  yield { type: "error", code: "unsupported" };
@@ -60258,7 +60046,7 @@ function createLocalVideoProvider(deps) {
60258
60046
  yield { type: "error", code: "not_ready" };
60259
60047
  return;
60260
60048
  }
60261
- const seed = (0, import_node_crypto27.createHash)("sha256").update(JSON.stringify(r)).update(job.jobId).digest().readUInt32BE(0) % 2 ** 31;
60049
+ const seed = (0, import_node_crypto26.createHash)("sha256").update(JSON.stringify(r)).update(job.jobId).digest().readUInt32BE(0) % 2 ** 31;
60262
60050
  let promptId;
60263
60051
  try {
60264
60052
  const sub = `creator-${job.jobId.replace(/[^A-Za-z0-9_-]/g, "").slice(0, 40)}`;
@@ -60306,7 +60094,7 @@ function createLocalVideoProvider(deps) {
60306
60094
  // ../../packages/core/src/production/h3-local.ts
60307
60095
  init_define_CREATOR_BOX_KIT();
60308
60096
  init_define_CREATOR_SFX_KIT();
60309
- var import_node_crypto28 = require("node:crypto");
60097
+ var import_node_crypto27 = require("node:crypto");
60310
60098
  var import_promises30 = require("node:fs/promises");
60311
60099
  var import_node_path24 = require("node:path");
60312
60100
  var H3_LOCAL_PROVIDER_ID = "freevideo-h3-local";
@@ -60389,14 +60177,14 @@ function createLocalH3Provider(deps) {
60389
60177
  return;
60390
60178
  }
60391
60179
  }
60392
- const seed = (0, import_node_crypto28.createHash)("sha256").update(JSON.stringify(r)).update(imageBytes ?? new Uint8Array()).digest().readUInt32BE(0) % 2 ** 31;
60180
+ const seed = (0, import_node_crypto27.createHash)("sha256").update(JSON.stringify(r)).update(imageBytes ?? new Uint8Array()).digest().readUInt32BE(0) % 2 ** 31;
60393
60181
  const run = h3VideoRun(r, seed, lineSec);
60394
60182
  const clip2 = h3Clip(r, lineSec);
60395
60183
  if (!run || !clip2) {
60396
60184
  yield { type: "error", code: "unsupported" };
60397
60185
  return;
60398
60186
  }
60399
- const jobId = `h3-${(0, import_node_crypto28.createHash)("sha256").update(job.jobId).digest("hex").slice(0, 24)}`;
60187
+ const jobId = `h3-${(0, import_node_crypto27.createHash)("sha256").update(job.jobId).digest("hex").slice(0, 24)}`;
60400
60188
  const dir = inside(deps.jobsRoot, jobId);
60401
60189
  yield { type: "progress", fraction: 0.02, stage: "loading" };
60402
60190
  deps.freeGpu?.();
@@ -60654,7 +60442,6 @@ function recommend2(s2, host) {
60654
60442
  const vram = vramOf(s2);
60655
60443
  const comfyHere = host !== null && variantFor(COMFYUI_BOX, host) !== null;
60656
60444
  const items = /* @__PURE__ */ new Set(["production_tools"]);
60657
- if (caps.llm.modelClass !== "unavailable") items.add("assistant");
60658
60445
  const comfyImages = comfyHere && (cuda && vram >= 11.5 * GB4 && caps.imageGeneration.level !== "unavailable" || appleSilicon && ram >= 31.5 * GB4 && caps.imageGeneration.level === "strong");
60659
60446
  const localVideo = comfyImages && (cuda && caps.videoGeneration.level !== "unavailable" || appleSilicon && caps.videoGeneration.level !== "unavailable");
60660
60447
  const localPresenter = localVideo && cuda && vram >= 23.5 * GB4;
@@ -60842,7 +60629,6 @@ function createEngineService(deps) {
60842
60629
  const r = await recommendation();
60843
60630
  const ids = [
60844
60631
  "production_tools",
60845
- "assistant",
60846
60632
  "images",
60847
60633
  "video",
60848
60634
  "presenter",
@@ -60991,7 +60777,6 @@ function createEngineService(deps) {
60991
60777
  const wanted = items.length ? [...items] : states.filter((i) => i.state !== "installed").map((i) => i.id);
60992
60778
  const order = [
60993
60779
  "production_tools",
60994
- "assistant",
60995
60780
  "images",
60996
60781
  "video",
60997
60782
  "presenter",
@@ -61070,7 +60855,7 @@ function bytesFraction(p) {
61070
60855
  }
61071
60856
 
61072
60857
  // ../../packages/core/src/process/entry.ts
61073
- var import_node_crypto30 = require("node:crypto");
60858
+ var import_node_crypto29 = require("node:crypto");
61074
60859
  var import_promises33 = require("node:fs/promises");
61075
60860
  var import_node_os5 = require("node:os");
61076
60861
 
@@ -61113,11 +60898,11 @@ function createHostBridge(send2, timeoutMs = 15e3) {
61113
60898
  // ../../packages/core/src/mcp/approvals.ts
61114
60899
  init_define_CREATOR_BOX_KIT();
61115
60900
  init_define_CREATOR_SFX_KIT();
61116
- var import_node_crypto29 = require("node:crypto");
60901
+ var import_node_crypto28 = require("node:crypto");
61117
60902
  var APPROVAL_TTL_MS = 30 * 6e4;
61118
60903
  var KEEP_ANSWERED = 50;
61119
60904
  var BASE625 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
61120
- var newId = () => `agr_${[...(0, import_node_crypto29.randomBytes)(24)].map((b) => BASE625[b % 62] ?? "0").join("")}`;
60905
+ var newId = () => `agr_${[...(0, import_node_crypto28.randomBytes)(24)].map((b) => BASE625[b % 62] ?? "0").join("")}`;
61121
60906
  function createApprovals(deps) {
61122
60907
  const now = deps.now ?? Date.now;
61123
60908
  const entries = /* @__PURE__ */ new Map();
@@ -62659,9 +62444,9 @@ function createIgnixUpload(deps) {
62659
62444
  // ../../packages/core/src/mcp/spend-guard.ts
62660
62445
  init_define_CREATOR_BOX_KIT();
62661
62446
  init_define_CREATOR_SFX_KIT();
62662
- var import_node_async_hooks2 = require("node:async_hooks");
62447
+ var import_node_async_hooks = require("node:async_hooks");
62663
62448
  function createSpendGuard() {
62664
- const store = new import_node_async_hooks2.AsyncLocalStorage();
62449
+ const store = new import_node_async_hooks.AsyncLocalStorage();
62665
62450
  return {
62666
62451
  run: (ctx, fn) => store.run(ctx, fn),
62667
62452
  blocked: () => store.getStore()?.paid === false
@@ -62836,41 +62621,7 @@ async function start(init, port) {
62836
62621
  });
62837
62622
  brainHost = createBrainHost({ backend: localAiBackend, localAi, log: localAiLog });
62838
62623
  await localAi.startup();
62839
- const ignixReasoning = createIgnixReasoning({
62840
- issuer: init.auth.issuer,
62841
- http: {
62842
- fetch: ignixFetch,
62843
- userAgent: `IgnixCreator/${init.appVersion}`,
62844
- timeoutMs: 12e4
62845
- },
62846
- access: () => auth.getAccess(),
62847
- token: () => auth.getAccessToken(),
62848
- invalidate: (token3) => {
62849
- auth.invalidateAccessToken(token3);
62850
- }
62851
- });
62852
- const ignixBlocked = () => auth.getStatus().status !== "authenticated" ? "signed_out" : auth.getAccess() !== "read_write" ? "read_only" : null;
62853
- const assistantCredits = async (signal) => {
62854
- const b = await productionBudget.read(signal);
62855
- return b ? { available: b.available, perStep: b.rates.assistantTurn } : null;
62856
- };
62857
- const assistantSettings = createAssistantSettings({
62858
- initial: loadedConfig.config,
62859
- persist: loadedConfig.source !== "fallback",
62860
- save: (config2) => saveConfig(init.userDataDir, config2),
62861
- ignixReady: () => ignixBlocked() === null,
62862
- localReady: async () => await localAi.agentTarget("operate") !== null,
62863
- credits: assistantCredits
62864
- });
62865
- const assistant = createAssistantRouter({
62866
- setting: () => assistantSettings.model(),
62867
- ignix: ignixReasoning,
62868
- local: brainHost,
62869
- localReady: async (role) => await localAi.agentTarget(role) !== null,
62870
- localContextTokens: async () => (await localAi.agentTarget())?.contextTokens ?? null,
62871
- ignixBlocked,
62872
- credits: assistantCredits
62873
- });
62624
+ const assistant = createNoAssistant();
62874
62625
  const agentLog = createLogger(
62875
62626
  "agent",
62876
62627
  (entry) => {
@@ -63020,7 +62771,7 @@ async function start(init, port) {
63020
62771
  const comfyTemplate = async (id) => {
63021
62772
  const name = `comfyui/workflows/${id}.v1.json`;
63022
62773
  const bytes = await (0, import_promises33.readFile)((0, import_node_path27.join)(boxKit.dir, ...name.split("/")));
63023
- if ((0, import_node_crypto30.createHash)("sha256").update(bytes).digest("hex") !== boxKit.files[name])
62774
+ if ((0, import_node_crypto29.createHash)("sha256").update(bytes).digest("hex") !== boxKit.files[name])
63024
62775
  throw new Error("integrity");
63025
62776
  return JSON.parse(bytes.toString("utf8"));
63026
62777
  };
@@ -63208,7 +62959,7 @@ async function start(init, port) {
63208
62959
  const soundFile = (key) => {
63209
62960
  if (!key) return null;
63210
62961
  const ctx = scoped.current() ?? "_none";
63211
- const name = (0, import_node_crypto30.createHash)("sha256").update(key).digest("hex").slice(0, 40);
62962
+ const name = (0, import_node_crypto29.createHash)("sha256").update(key).digest("hex").slice(0, 40);
63212
62963
  return (0, import_node_path27.join)(contentDir, "ctx", ctx, "sounds", `${name}.wav`);
63213
62964
  };
63214
62965
  const content = createContentService({
@@ -63241,7 +62992,7 @@ async function start(init, port) {
63241
62992
  const sha = define_CREATOR_SFX_KIT_default[file2];
63242
62993
  if (!sha || !/^[a-z0-9-]{1,40}$/.test(file2)) return null;
63243
62994
  const bytes = await (0, import_promises33.readFile)((0, import_node_path27.join)(__dirname, "sfx-kit", `${file2}.wav`)).catch(() => null);
63244
- if (!bytes || (0, import_node_crypto30.createHash)("sha256").update(bytes).digest("hex") !== sha) return null;
62995
+ if (!bytes || (0, import_node_crypto29.createHash)("sha256").update(bytes).digest("hex") !== sha) return null;
63245
62996
  return new Uint8Array(bytes);
63246
62997
  },
63247
62998
  // Sounds made on demand for edits: kept in the context's folder by description.
@@ -63564,7 +63315,6 @@ async function start(init, port) {
63564
63315
  imageGen: images,
63565
63316
  videoGen: video,
63566
63317
  engines,
63567
- assistant: assistantSettings,
63568
63318
  assets: {
63569
63319
  read: (id) => assets.read(id),
63570
63320
  readRange: (id, start2, end) => assets.readRange(id, start2, end)