@ignix-social/creator 0.1.4 → 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.
- package/dist/cli.cjs +19 -22
- package/dist/core.cjs +174 -413
- 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
|
|
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 (
|
|
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 (
|
|
27673
|
+
if (aborted2()) return stopped();
|
|
27674
27674
|
return finish("failed", null, event.code);
|
|
27675
27675
|
}
|
|
27676
27676
|
}
|
|
27677
27677
|
} catch (err2) {
|
|
27678
|
-
if (
|
|
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 (
|
|
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 (
|
|
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:
|
|
27714
|
+
raw = { status: aborted2() ? "cancelled" : "error", content: "" };
|
|
27715
27715
|
}
|
|
27716
|
-
if (
|
|
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/
|
|
27864
|
+
// ../../packages/core/src/agent/no-assistant.ts
|
|
27865
27865
|
init_define_CREATOR_BOX_KIT();
|
|
27866
27866
|
init_define_CREATOR_SFX_KIT();
|
|
27867
|
-
|
|
27868
|
-
|
|
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
|
-
|
|
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
|
-
|
|
27955
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
28155
|
-
if (
|
|
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 (
|
|
28159
|
-
const parsed =
|
|
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
|
|
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 (
|
|
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
|
|
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
|
|
31806
|
-
if (
|
|
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 (
|
|
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
|
|
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 (
|
|
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" ||
|
|
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 (
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
40912
|
-
if (
|
|
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 (
|
|
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 =
|
|
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 (
|
|
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
|
|
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,
|
|
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
|
|
42264
|
+
var import_node_crypto14 = require("node:crypto");
|
|
42477
42265
|
function paidKey(scope, body) {
|
|
42478
|
-
const h = (0,
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
42574
|
+
return { kind: "unavailable", reason: REASON_OF[res.status] ?? "failed" };
|
|
42787
42575
|
}
|
|
42788
|
-
const parsed =
|
|
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
|
|
42935
|
-
var
|
|
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:
|
|
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 =
|
|
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
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
44713
|
-
var pieceJobId = (campaignId, key) => `job_${base62((0,
|
|
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,
|
|
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,
|
|
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
|
|
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 ?
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
50839
|
-
var shortTag = () => (0,
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
|
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,
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
}
|
|
@@ -56238,6 +56026,14 @@ function createVideoEngineService(deps) {
|
|
|
56238
56026
|
if (!platform && !unsupported && !installing2) await refresh();
|
|
56239
56027
|
return status();
|
|
56240
56028
|
}
|
|
56029
|
+
async function downloadEstimate() {
|
|
56030
|
+
const p = platform ?? (unsupported ? null : await refresh());
|
|
56031
|
+
const artifact = p ? videoArtifactFor(recipe, p.os, p.arch) : null;
|
|
56032
|
+
if (!p || !artifact) return null;
|
|
56033
|
+
const engineBytes = installedRuntime() ? 0 : videoDownloadBytes(artifact);
|
|
56034
|
+
const editorBytes = editorFiles === "ready" ? 0 : editorDownloadBytes(deps.kitSourceDir, p.os, p.arch, kit.dataDir());
|
|
56035
|
+
return engineBytes + editorBytes;
|
|
56036
|
+
}
|
|
56241
56037
|
async function prepare() {
|
|
56242
56038
|
if (installing2) return status();
|
|
56243
56039
|
error62 = null;
|
|
@@ -56423,6 +56219,7 @@ function createVideoEngineService(deps) {
|
|
|
56423
56219
|
const speech = editorService(5 * 6e4);
|
|
56424
56220
|
return {
|
|
56425
56221
|
getStatus,
|
|
56222
|
+
downloadEstimate,
|
|
56426
56223
|
prepare,
|
|
56427
56224
|
install,
|
|
56428
56225
|
cancel,
|
|
@@ -57165,7 +56962,7 @@ function pointOf(at, n) {
|
|
|
57165
56962
|
|
|
57166
56963
|
// ../../packages/core/src/content/content-service.ts
|
|
57167
56964
|
var BASE624 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
57168
|
-
var newJobId = () => `job_${[...(0,
|
|
56965
|
+
var newJobId = () => `job_${[...(0, import_node_crypto21.randomBytes)(20)].map((b) => BASE624[b % 62] ?? "0").join("")}`;
|
|
57169
56966
|
var RECAST_MAX_SEC = 15;
|
|
57170
56967
|
var STEP = {
|
|
57171
56968
|
en: {
|
|
@@ -58063,7 +57860,7 @@ init_define_CREATOR_SFX_KIT();
|
|
|
58063
57860
|
// ../../packages/core/src/content/sd-provider.ts
|
|
58064
57861
|
init_define_CREATOR_BOX_KIT();
|
|
58065
57862
|
init_define_CREATOR_SFX_KIT();
|
|
58066
|
-
var
|
|
57863
|
+
var import_node_crypto22 = require("node:crypto");
|
|
58067
57864
|
var import_promises24 = require("node:fs/promises");
|
|
58068
57865
|
var ASPECT_OF2 = {
|
|
58069
57866
|
"1:1": "1:1",
|
|
@@ -58151,7 +57948,7 @@ function createSdCppProvider(deps) {
|
|
|
58151
57948
|
},
|
|
58152
57949
|
async *run(job, signal) {
|
|
58153
57950
|
const { request: request2 } = job;
|
|
58154
|
-
const
|
|
57951
|
+
const aborted2 = () => signal.aborted;
|
|
58155
57952
|
if (request2.kind !== "image") {
|
|
58156
57953
|
yield { type: "error", code: "unsupported" };
|
|
58157
57954
|
return;
|
|
@@ -58195,13 +57992,13 @@ function createSdCppProvider(deps) {
|
|
|
58195
57992
|
steps: profile.steps,
|
|
58196
57993
|
cfgScale: profile.cfgScale,
|
|
58197
57994
|
sampler: profile.sampler,
|
|
58198
|
-
seed: (request2.seed ?? deps.seed?.() ?? (0,
|
|
57995
|
+
seed: (request2.seed ?? deps.seed?.() ?? (0, import_node_crypto22.randomInt)(0, 2147483647)) % 2147483647,
|
|
58199
57996
|
prompt: request2.prompt,
|
|
58200
57997
|
reference: ref ? profile.referenceMode : "none",
|
|
58201
57998
|
...ref && profile.referenceMode === "init" ? { strength: profile.referenceStrength } : {}
|
|
58202
57999
|
};
|
|
58203
58000
|
await deps.beforeRun?.();
|
|
58204
|
-
if (
|
|
58001
|
+
if (aborted2()) {
|
|
58205
58002
|
yield { type: "error", code: "cancelled" };
|
|
58206
58003
|
return;
|
|
58207
58004
|
}
|
|
@@ -58241,7 +58038,7 @@ function createSdCppProvider(deps) {
|
|
|
58241
58038
|
}, grace).unref();
|
|
58242
58039
|
};
|
|
58243
58040
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
58244
|
-
if (
|
|
58041
|
+
if (aborted2()) onAbort();
|
|
58245
58042
|
void proc.exited.then((e) => {
|
|
58246
58043
|
run.exit = e;
|
|
58247
58044
|
wake?.();
|
|
@@ -58263,7 +58060,7 @@ function createSdCppProvider(deps) {
|
|
|
58263
58060
|
if (run.exit === null) onAbort();
|
|
58264
58061
|
}
|
|
58265
58062
|
const done2 = run.exit;
|
|
58266
|
-
if (run.killed ||
|
|
58063
|
+
if (run.killed || aborted2()) {
|
|
58267
58064
|
yield { type: "error", code: "cancelled" };
|
|
58268
58065
|
return;
|
|
58269
58066
|
}
|
|
@@ -58715,7 +58512,7 @@ function createIgnixImageProvider(deps) {
|
|
|
58715
58512
|
grants.clear();
|
|
58716
58513
|
},
|
|
58717
58514
|
async *run(job, signal) {
|
|
58718
|
-
const
|
|
58515
|
+
const aborted2 = () => signal.aborted;
|
|
58719
58516
|
const args = ignixImageArgs(job.request);
|
|
58720
58517
|
if (!args) {
|
|
58721
58518
|
yield { type: "error", code: "unsupported" };
|
|
@@ -58741,7 +58538,7 @@ function createIgnixImageProvider(deps) {
|
|
|
58741
58538
|
{ key: ref, bytes: new Uint8Array(bytes), mediaType: info.mediaType },
|
|
58742
58539
|
signal
|
|
58743
58540
|
).catch(() => null) : null;
|
|
58744
|
-
if (
|
|
58541
|
+
if (aborted2()) return;
|
|
58745
58542
|
if (!url2) {
|
|
58746
58543
|
grants.drop(key);
|
|
58747
58544
|
yield { type: "error", code: "failed" };
|
|
@@ -58763,7 +58560,7 @@ function createIgnixImageProvider(deps) {
|
|
|
58763
58560
|
for (; ; ) {
|
|
58764
58561
|
grants.grant(key);
|
|
58765
58562
|
outcome = await deps.port.generate(sent, approved(sent), signal).catch(() => ({ kind: "failed", code: "network", message: null }));
|
|
58766
|
-
if (
|
|
58563
|
+
if (aborted2() || outcome.kind !== "failed" || outcome.code !== "tool_error") break;
|
|
58767
58564
|
const m = outcome.message ?? "";
|
|
58768
58565
|
if (/reservationId is not an open credit reservation/i.test(m) && sent.reservationId) {
|
|
58769
58566
|
const { reservationId: _drop, ...rest } = sent;
|
|
@@ -58777,7 +58574,7 @@ function createIgnixImageProvider(deps) {
|
|
|
58777
58574
|
break;
|
|
58778
58575
|
}
|
|
58779
58576
|
grants.drop(key);
|
|
58780
|
-
if (
|
|
58577
|
+
if (aborted2()) return;
|
|
58781
58578
|
if (outcome.kind !== "ok") {
|
|
58782
58579
|
yield { type: "error", code: ignixFailure(outcome) };
|
|
58783
58580
|
return;
|
|
@@ -58789,7 +58586,7 @@ function createIgnixImageProvider(deps) {
|
|
|
58789
58586
|
}
|
|
58790
58587
|
yield { type: "progress", fraction: 0.85, stage: "finishing" };
|
|
58791
58588
|
const got = await deps.download(result.data.url, signal);
|
|
58792
|
-
if (
|
|
58589
|
+
if (aborted2()) return;
|
|
58793
58590
|
if (!got.ok) {
|
|
58794
58591
|
yield { type: "error", code: "failed" };
|
|
58795
58592
|
return;
|
|
@@ -58805,7 +58602,7 @@ function createIgnixImageProvider(deps) {
|
|
|
58805
58602
|
// ../../packages/core/src/content/cloud-boost.ts
|
|
58806
58603
|
init_define_CREATOR_BOX_KIT();
|
|
58807
58604
|
init_define_CREATOR_SFX_KIT();
|
|
58808
|
-
var
|
|
58605
|
+
var import_node_crypto23 = require("node:crypto");
|
|
58809
58606
|
var import_promises26 = require("node:fs/promises");
|
|
58810
58607
|
|
|
58811
58608
|
// ../../packages/core/src/content/comfy-workflows.ts
|
|
@@ -58916,7 +58713,7 @@ var REASON = {
|
|
|
58916
58713
|
function createBoostProvider(deps) {
|
|
58917
58714
|
const workflows = deps.workflows ?? APPROVED_WORKFLOWS;
|
|
58918
58715
|
const pollMs = deps.pollMs ?? 2e3;
|
|
58919
|
-
const seed = deps.seed ?? (() => (0,
|
|
58716
|
+
const seed = deps.seed ?? (() => (0, import_node_crypto23.randomInt)(0, 2 ** 31));
|
|
58920
58717
|
const grants = createSpendGrants();
|
|
58921
58718
|
const keyOf2 = (r) => JSON.stringify([r.kind, r.kind === "image" ? [r.prompt, r.aspect, r.seed ?? null] : null]);
|
|
58922
58719
|
const runOf = (r, s2) => {
|
|
@@ -58981,7 +58778,7 @@ function createBoostProvider(deps) {
|
|
|
58981
58778
|
return true;
|
|
58982
58779
|
},
|
|
58983
58780
|
async *run(job, signal) {
|
|
58984
|
-
const
|
|
58781
|
+
const aborted2 = () => signal.aborted;
|
|
58985
58782
|
const key = keyOf2(job.request);
|
|
58986
58783
|
const run = runOf(job.request, seed());
|
|
58987
58784
|
if (!run) {
|
|
@@ -58994,7 +58791,7 @@ function createBoostProvider(deps) {
|
|
|
58994
58791
|
}
|
|
58995
58792
|
yield { type: "progress", fraction: 0.02, stage: "queued" };
|
|
58996
58793
|
const started = await deps.gateway.start(run, signal).catch(() => ({ ok: false, code: "failed" }));
|
|
58997
|
-
if (
|
|
58794
|
+
if (aborted2()) return;
|
|
58998
58795
|
if (!started.ok) {
|
|
58999
58796
|
yield { type: "error", code: started.code };
|
|
59000
58797
|
return;
|
|
@@ -59006,7 +58803,7 @@ function createBoostProvider(deps) {
|
|
|
59006
58803
|
let url2 = null;
|
|
59007
58804
|
for (; ; ) {
|
|
59008
58805
|
await new Promise((r) => setTimeout(r, pollMs));
|
|
59009
|
-
if (
|
|
58806
|
+
if (aborted2()) return;
|
|
59010
58807
|
const p = await deps.gateway.poll(runId, signal);
|
|
59011
58808
|
if (p.state === "failed") {
|
|
59012
58809
|
yield { type: "error", code: p.error ?? "failed" };
|
|
@@ -59027,7 +58824,7 @@ function createBoostProvider(deps) {
|
|
|
59027
58824
|
}
|
|
59028
58825
|
yield { type: "progress", fraction: 0.95, stage: "finishing" };
|
|
59029
58826
|
const got = await deps.download(url2, signal);
|
|
59030
|
-
if (
|
|
58827
|
+
if (aborted2()) return;
|
|
59031
58828
|
if (!got.ok) {
|
|
59032
58829
|
yield { type: "error", code: "failed" };
|
|
59033
58830
|
return;
|
|
@@ -59037,7 +58834,7 @@ function createBoostProvider(deps) {
|
|
|
59037
58834
|
yield { type: "output", name, mediaType: got.mediaType };
|
|
59038
58835
|
yield { type: "done" };
|
|
59039
58836
|
} catch {
|
|
59040
|
-
if (!
|
|
58837
|
+
if (!aborted2()) yield { type: "error", code: "failed" };
|
|
59041
58838
|
} finally {
|
|
59042
58839
|
signal.removeEventListener("abort", stop);
|
|
59043
58840
|
}
|
|
@@ -59048,13 +58845,13 @@ function createBoostProvider(deps) {
|
|
|
59048
58845
|
// ../../packages/core/src/content/comfyui-provider.ts
|
|
59049
58846
|
init_define_CREATOR_BOX_KIT();
|
|
59050
58847
|
init_define_CREATOR_SFX_KIT();
|
|
59051
|
-
var
|
|
58848
|
+
var import_node_crypto25 = require("node:crypto");
|
|
59052
58849
|
var import_promises27 = require("node:fs/promises");
|
|
59053
58850
|
|
|
59054
58851
|
// ../../packages/core/src/content/media-download.ts
|
|
59055
58852
|
init_define_CREATOR_BOX_KIT();
|
|
59056
58853
|
init_define_CREATOR_SFX_KIT();
|
|
59057
|
-
var
|
|
58854
|
+
var import_node_crypto24 = require("node:crypto");
|
|
59058
58855
|
var CONTENT_ADDRESSED = /\/([0-9a-f]{64})\.(?:jpe?g|png|webp)$/;
|
|
59059
58856
|
function ignixMediaOrigins(auth) {
|
|
59060
58857
|
const production = ["https://media.ignix.social", "https://media.zernio.com"];
|
|
@@ -59130,7 +58927,7 @@ function createMediaDownloader(deps) {
|
|
|
59130
58927
|
const info = identifyImage(bytes);
|
|
59131
58928
|
if (!info) return { ok: false, reason: "not_an_image" };
|
|
59132
58929
|
const named = CONTENT_ADDRESSED.exec(parsed.pathname)?.[1];
|
|
59133
|
-
if (named && (0,
|
|
58930
|
+
if (named && (0, import_node_crypto24.createHash)("sha256").update(bytes).digest("hex") !== named) {
|
|
59134
58931
|
return { ok: false, reason: "integrity" };
|
|
59135
58932
|
}
|
|
59136
58933
|
return { ok: true, bytes, mediaType: info.mediaType };
|
|
@@ -59170,7 +58967,7 @@ function loopbackBase(url2) {
|
|
|
59170
58967
|
function createComfyUiProvider(deps) {
|
|
59171
58968
|
const workflows = deps.workflows ?? APPROVED_WORKFLOWS;
|
|
59172
58969
|
const pollMs = deps.pollMs ?? 1e3;
|
|
59173
|
-
const seed = deps.seed ?? (() => (0,
|
|
58970
|
+
const seed = deps.seed ?? (() => (0, import_node_crypto25.randomInt)(0, 2 ** 31));
|
|
59174
58971
|
const base = async () => loopbackBase(await deps.endpoint().catch(() => null));
|
|
59175
58972
|
const call = (url2, init, signal) => deps.fetch(url2, {
|
|
59176
58973
|
...init,
|
|
@@ -59226,7 +59023,7 @@ function createComfyUiProvider(deps) {
|
|
|
59226
59023
|
});
|
|
59227
59024
|
},
|
|
59228
59025
|
async *run(job, signal) {
|
|
59229
|
-
const
|
|
59026
|
+
const aborted2 = () => signal.aborted;
|
|
59230
59027
|
const b = await base();
|
|
59231
59028
|
if (!b) {
|
|
59232
59029
|
yield { type: "error", code: "not_ready" };
|
|
@@ -59250,7 +59047,7 @@ function createComfyUiProvider(deps) {
|
|
|
59250
59047
|
}
|
|
59251
59048
|
promptId = sub.data.prompt_id;
|
|
59252
59049
|
} catch {
|
|
59253
|
-
if (!
|
|
59050
|
+
if (!aborted2()) yield { type: "error", code: "engine_crashed" };
|
|
59254
59051
|
return;
|
|
59255
59052
|
}
|
|
59256
59053
|
const stop = () => {
|
|
@@ -59264,7 +59061,7 @@ function createComfyUiProvider(deps) {
|
|
|
59264
59061
|
let image = null;
|
|
59265
59062
|
for (; ; ) {
|
|
59266
59063
|
await new Promise((r) => setTimeout(r, pollMs));
|
|
59267
|
-
if (
|
|
59064
|
+
if (aborted2()) return;
|
|
59268
59065
|
const history = external_exports.record(external_exports.string(), HistoryEntrySchema).safeParse(await json2(`${b}/history/${promptId}`, { method: "GET" }, signal));
|
|
59269
59066
|
const entry = history.success ? history.data[promptId] : void 0;
|
|
59270
59067
|
if (entry?.status?.status_str === "error") {
|
|
@@ -59296,7 +59093,7 @@ function createComfyUiProvider(deps) {
|
|
|
59296
59093
|
fetch: deps.fetch,
|
|
59297
59094
|
maxBytes: deps.maxBytes
|
|
59298
59095
|
})(`${b}/view?${q.toString()}`, signal);
|
|
59299
|
-
if (
|
|
59096
|
+
if (aborted2()) return;
|
|
59300
59097
|
if (!got.ok) {
|
|
59301
59098
|
yield { type: "error", code: "failed" };
|
|
59302
59099
|
return;
|
|
@@ -59306,7 +59103,7 @@ function createComfyUiProvider(deps) {
|
|
|
59306
59103
|
yield { type: "output", name, mediaType: got.mediaType };
|
|
59307
59104
|
yield { type: "done" };
|
|
59308
59105
|
} catch {
|
|
59309
|
-
if (!
|
|
59106
|
+
if (!aborted2()) yield { type: "error", code: "engine_crashed" };
|
|
59310
59107
|
} finally {
|
|
59311
59108
|
signal.removeEventListener("abort", stop);
|
|
59312
59109
|
}
|
|
@@ -59482,7 +59279,7 @@ function createRenderProvider(deps) {
|
|
|
59482
59279
|
};
|
|
59483
59280
|
},
|
|
59484
59281
|
async *run(job, signal) {
|
|
59485
|
-
const
|
|
59282
|
+
const aborted2 = () => signal.aborted;
|
|
59486
59283
|
const request2 = job.request;
|
|
59487
59284
|
if (request2.kind !== "composition" && !isThumbnails(request2)) {
|
|
59488
59285
|
yield { type: "error", code: "unsupported" };
|
|
@@ -59532,7 +59329,7 @@ function createRenderProvider(deps) {
|
|
|
59532
59329
|
await (0, import_promises28.writeFile)(inside(job.staging.locator, RENDER_JOB_FILES.inputs), JSON.stringify(map2), {
|
|
59533
59330
|
mode: 384
|
|
59534
59331
|
});
|
|
59535
|
-
if (
|
|
59332
|
+
if (aborted2()) return;
|
|
59536
59333
|
const events = [];
|
|
59537
59334
|
let wake = null;
|
|
59538
59335
|
let buffer = "";
|
|
@@ -59577,7 +59374,7 @@ function createRenderProvider(deps) {
|
|
|
59577
59374
|
}, grace);
|
|
59578
59375
|
};
|
|
59579
59376
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
59580
|
-
if (
|
|
59377
|
+
if (aborted2()) onAbort();
|
|
59581
59378
|
let done2 = false;
|
|
59582
59379
|
let failure4 = null;
|
|
59583
59380
|
let review = null;
|
|
@@ -59603,7 +59400,7 @@ function createRenderProvider(deps) {
|
|
|
59603
59400
|
failure4 = ERROR_OF[e.code];
|
|
59604
59401
|
}
|
|
59605
59402
|
}
|
|
59606
|
-
if (proc.exited ||
|
|
59403
|
+
if (proc.exited || aborted2()) break;
|
|
59607
59404
|
await new Promise((resolve4) => {
|
|
59608
59405
|
wake = resolve4;
|
|
59609
59406
|
setTimeout(resolve4, 1e3);
|
|
@@ -59618,7 +59415,7 @@ function createRenderProvider(deps) {
|
|
|
59618
59415
|
if (e?.t === "output" && isThumbnails(request2)) outputs.push(e.file);
|
|
59619
59416
|
if (e?.t === "error") failure4 = ERROR_OF[e.code];
|
|
59620
59417
|
}
|
|
59621
|
-
if (
|
|
59418
|
+
if (aborted2()) return;
|
|
59622
59419
|
if (done2 && exit.code === 0) {
|
|
59623
59420
|
yield { type: "progress", fraction: 1, stage: "finishing" };
|
|
59624
59421
|
if (request2.kind === "composition") {
|
|
@@ -59653,7 +59450,7 @@ function createRenderProvider(deps) {
|
|
|
59653
59450
|
// ../../packages/core/src/production/local-video.ts
|
|
59654
59451
|
init_define_CREATOR_BOX_KIT();
|
|
59655
59452
|
init_define_CREATOR_SFX_KIT();
|
|
59656
|
-
var
|
|
59453
|
+
var import_node_crypto26 = require("node:crypto");
|
|
59657
59454
|
var import_promises29 = require("node:fs/promises");
|
|
59658
59455
|
var LOCAL_VIDEO_NODES = {
|
|
59659
59456
|
"wan22-i2v": /* @__PURE__ */ new Set([
|
|
@@ -60075,7 +59872,7 @@ function createLocalVideoProvider(deps) {
|
|
|
60075
59872
|
yield { type: "error", code: "not_ready" };
|
|
60076
59873
|
return;
|
|
60077
59874
|
}
|
|
60078
|
-
const seed = (0,
|
|
59875
|
+
const seed = (0, import_node_crypto26.createHash)("sha256").update(JSON.stringify(r)).update(image).update(audio ?? new Uint8Array()).digest().readUInt32BE(0) % 2 ** 31;
|
|
60079
59876
|
const run = boostVideoRun(r, seed);
|
|
60080
59877
|
if (!run) {
|
|
60081
59878
|
yield { type: "error", code: "unsupported" };
|
|
@@ -60249,7 +60046,7 @@ function createLocalVideoProvider(deps) {
|
|
|
60249
60046
|
yield { type: "error", code: "not_ready" };
|
|
60250
60047
|
return;
|
|
60251
60048
|
}
|
|
60252
|
-
const seed = (0,
|
|
60049
|
+
const seed = (0, import_node_crypto26.createHash)("sha256").update(JSON.stringify(r)).update(job.jobId).digest().readUInt32BE(0) % 2 ** 31;
|
|
60253
60050
|
let promptId;
|
|
60254
60051
|
try {
|
|
60255
60052
|
const sub = `creator-${job.jobId.replace(/[^A-Za-z0-9_-]/g, "").slice(0, 40)}`;
|
|
@@ -60297,7 +60094,7 @@ function createLocalVideoProvider(deps) {
|
|
|
60297
60094
|
// ../../packages/core/src/production/h3-local.ts
|
|
60298
60095
|
init_define_CREATOR_BOX_KIT();
|
|
60299
60096
|
init_define_CREATOR_SFX_KIT();
|
|
60300
|
-
var
|
|
60097
|
+
var import_node_crypto27 = require("node:crypto");
|
|
60301
60098
|
var import_promises30 = require("node:fs/promises");
|
|
60302
60099
|
var import_node_path24 = require("node:path");
|
|
60303
60100
|
var H3_LOCAL_PROVIDER_ID = "freevideo-h3-local";
|
|
@@ -60380,14 +60177,14 @@ function createLocalH3Provider(deps) {
|
|
|
60380
60177
|
return;
|
|
60381
60178
|
}
|
|
60382
60179
|
}
|
|
60383
|
-
const seed = (0,
|
|
60180
|
+
const seed = (0, import_node_crypto27.createHash)("sha256").update(JSON.stringify(r)).update(imageBytes ?? new Uint8Array()).digest().readUInt32BE(0) % 2 ** 31;
|
|
60384
60181
|
const run = h3VideoRun(r, seed, lineSec);
|
|
60385
60182
|
const clip2 = h3Clip(r, lineSec);
|
|
60386
60183
|
if (!run || !clip2) {
|
|
60387
60184
|
yield { type: "error", code: "unsupported" };
|
|
60388
60185
|
return;
|
|
60389
60186
|
}
|
|
60390
|
-
const jobId = `h3-${(0,
|
|
60187
|
+
const jobId = `h3-${(0, import_node_crypto27.createHash)("sha256").update(job.jobId).digest("hex").slice(0, 24)}`;
|
|
60391
60188
|
const dir = inside(deps.jobsRoot, jobId);
|
|
60392
60189
|
yield { type: "progress", fraction: 0.02, stage: "loading" };
|
|
60393
60190
|
deps.freeGpu?.();
|
|
@@ -60645,7 +60442,6 @@ function recommend2(s2, host) {
|
|
|
60645
60442
|
const vram = vramOf(s2);
|
|
60646
60443
|
const comfyHere = host !== null && variantFor(COMFYUI_BOX, host) !== null;
|
|
60647
60444
|
const items = /* @__PURE__ */ new Set(["production_tools"]);
|
|
60648
|
-
if (caps.llm.modelClass !== "unavailable") items.add("assistant");
|
|
60649
60445
|
const comfyImages = comfyHere && (cuda && vram >= 11.5 * GB4 && caps.imageGeneration.level !== "unavailable" || appleSilicon && ram >= 31.5 * GB4 && caps.imageGeneration.level === "strong");
|
|
60650
60446
|
const localVideo = comfyImages && (cuda && caps.videoGeneration.level !== "unavailable" || appleSilicon && caps.videoGeneration.level !== "unavailable");
|
|
60651
60447
|
const localPresenter = localVideo && cuda && vram >= 23.5 * GB4;
|
|
@@ -60728,15 +60524,17 @@ function createEngineService(deps) {
|
|
|
60728
60524
|
switch (id) {
|
|
60729
60525
|
case "production_tools": {
|
|
60730
60526
|
const st = await hosts.video.getStatus();
|
|
60527
|
+
const dl = st.setup?.downloadBytes ?? await hosts.video.downloadEstimate?.().catch(() => null) ?? Math.round(1.2 * GB4);
|
|
60731
60528
|
return {
|
|
60732
60529
|
...base,
|
|
60733
60530
|
engine: "ignix-editor",
|
|
60734
60531
|
state: phase(st.phase, queued, busy),
|
|
60735
60532
|
progress: bytesFraction(st.progress),
|
|
60736
60533
|
running: deps.editor.running(),
|
|
60737
|
-
// Node + browser (~160 MB) and the Editor's tools and models (~1 GB
|
|
60738
|
-
|
|
60739
|
-
|
|
60534
|
+
// Node + browser (~160 MB) and the Editor's tools and models (~1 GB, or
|
|
60535
|
+
// only what the person's own Ignix Editor does not have yet).
|
|
60536
|
+
downloadBytes: dl,
|
|
60537
|
+
diskBytes: Math.round(dl * 1.5)
|
|
60740
60538
|
};
|
|
60741
60539
|
}
|
|
60742
60540
|
case "assistant": {
|
|
@@ -60831,7 +60629,6 @@ function createEngineService(deps) {
|
|
|
60831
60629
|
const r = await recommendation();
|
|
60832
60630
|
const ids = [
|
|
60833
60631
|
"production_tools",
|
|
60834
|
-
"assistant",
|
|
60835
60632
|
"images",
|
|
60836
60633
|
"video",
|
|
60837
60634
|
"presenter",
|
|
@@ -60980,7 +60777,6 @@ function createEngineService(deps) {
|
|
|
60980
60777
|
const wanted = items.length ? [...items] : states.filter((i) => i.state !== "installed").map((i) => i.id);
|
|
60981
60778
|
const order = [
|
|
60982
60779
|
"production_tools",
|
|
60983
|
-
"assistant",
|
|
60984
60780
|
"images",
|
|
60985
60781
|
"video",
|
|
60986
60782
|
"presenter",
|
|
@@ -61059,7 +60855,7 @@ function bytesFraction(p) {
|
|
|
61059
60855
|
}
|
|
61060
60856
|
|
|
61061
60857
|
// ../../packages/core/src/process/entry.ts
|
|
61062
|
-
var
|
|
60858
|
+
var import_node_crypto29 = require("node:crypto");
|
|
61063
60859
|
var import_promises33 = require("node:fs/promises");
|
|
61064
60860
|
var import_node_os5 = require("node:os");
|
|
61065
60861
|
|
|
@@ -61102,11 +60898,11 @@ function createHostBridge(send2, timeoutMs = 15e3) {
|
|
|
61102
60898
|
// ../../packages/core/src/mcp/approvals.ts
|
|
61103
60899
|
init_define_CREATOR_BOX_KIT();
|
|
61104
60900
|
init_define_CREATOR_SFX_KIT();
|
|
61105
|
-
var
|
|
60901
|
+
var import_node_crypto28 = require("node:crypto");
|
|
61106
60902
|
var APPROVAL_TTL_MS = 30 * 6e4;
|
|
61107
60903
|
var KEEP_ANSWERED = 50;
|
|
61108
60904
|
var BASE625 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
61109
|
-
var newId = () => `agr_${[...(0,
|
|
60905
|
+
var newId = () => `agr_${[...(0, import_node_crypto28.randomBytes)(24)].map((b) => BASE625[b % 62] ?? "0").join("")}`;
|
|
61110
60906
|
function createApprovals(deps) {
|
|
61111
60907
|
const now = deps.now ?? Date.now;
|
|
61112
60908
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -62648,9 +62444,9 @@ function createIgnixUpload(deps) {
|
|
|
62648
62444
|
// ../../packages/core/src/mcp/spend-guard.ts
|
|
62649
62445
|
init_define_CREATOR_BOX_KIT();
|
|
62650
62446
|
init_define_CREATOR_SFX_KIT();
|
|
62651
|
-
var
|
|
62447
|
+
var import_node_async_hooks = require("node:async_hooks");
|
|
62652
62448
|
function createSpendGuard() {
|
|
62653
|
-
const store = new
|
|
62449
|
+
const store = new import_node_async_hooks.AsyncLocalStorage();
|
|
62654
62450
|
return {
|
|
62655
62451
|
run: (ctx, fn) => store.run(ctx, fn),
|
|
62656
62452
|
blocked: () => store.getStore()?.paid === false
|
|
@@ -62825,41 +62621,7 @@ async function start(init, port) {
|
|
|
62825
62621
|
});
|
|
62826
62622
|
brainHost = createBrainHost({ backend: localAiBackend, localAi, log: localAiLog });
|
|
62827
62623
|
await localAi.startup();
|
|
62828
|
-
const
|
|
62829
|
-
issuer: init.auth.issuer,
|
|
62830
|
-
http: {
|
|
62831
|
-
fetch: ignixFetch,
|
|
62832
|
-
userAgent: `IgnixCreator/${init.appVersion}`,
|
|
62833
|
-
timeoutMs: 12e4
|
|
62834
|
-
},
|
|
62835
|
-
access: () => auth.getAccess(),
|
|
62836
|
-
token: () => auth.getAccessToken(),
|
|
62837
|
-
invalidate: (token3) => {
|
|
62838
|
-
auth.invalidateAccessToken(token3);
|
|
62839
|
-
}
|
|
62840
|
-
});
|
|
62841
|
-
const ignixBlocked = () => auth.getStatus().status !== "authenticated" ? "signed_out" : auth.getAccess() !== "read_write" ? "read_only" : null;
|
|
62842
|
-
const assistantCredits = async (signal) => {
|
|
62843
|
-
const b = await productionBudget.read(signal);
|
|
62844
|
-
return b ? { available: b.available, perStep: b.rates.assistantTurn } : null;
|
|
62845
|
-
};
|
|
62846
|
-
const assistantSettings = createAssistantSettings({
|
|
62847
|
-
initial: loadedConfig.config,
|
|
62848
|
-
persist: loadedConfig.source !== "fallback",
|
|
62849
|
-
save: (config2) => saveConfig(init.userDataDir, config2),
|
|
62850
|
-
ignixReady: () => ignixBlocked() === null,
|
|
62851
|
-
localReady: async () => await localAi.agentTarget("operate") !== null,
|
|
62852
|
-
credits: assistantCredits
|
|
62853
|
-
});
|
|
62854
|
-
const assistant = createAssistantRouter({
|
|
62855
|
-
setting: () => assistantSettings.model(),
|
|
62856
|
-
ignix: ignixReasoning,
|
|
62857
|
-
local: brainHost,
|
|
62858
|
-
localReady: async (role) => await localAi.agentTarget(role) !== null,
|
|
62859
|
-
localContextTokens: async () => (await localAi.agentTarget())?.contextTokens ?? null,
|
|
62860
|
-
ignixBlocked,
|
|
62861
|
-
credits: assistantCredits
|
|
62862
|
-
});
|
|
62624
|
+
const assistant = createNoAssistant();
|
|
62863
62625
|
const agentLog = createLogger(
|
|
62864
62626
|
"agent",
|
|
62865
62627
|
(entry) => {
|
|
@@ -63009,7 +62771,7 @@ async function start(init, port) {
|
|
|
63009
62771
|
const comfyTemplate = async (id) => {
|
|
63010
62772
|
const name = `comfyui/workflows/${id}.v1.json`;
|
|
63011
62773
|
const bytes = await (0, import_promises33.readFile)((0, import_node_path27.join)(boxKit.dir, ...name.split("/")));
|
|
63012
|
-
if ((0,
|
|
62774
|
+
if ((0, import_node_crypto29.createHash)("sha256").update(bytes).digest("hex") !== boxKit.files[name])
|
|
63013
62775
|
throw new Error("integrity");
|
|
63014
62776
|
return JSON.parse(bytes.toString("utf8"));
|
|
63015
62777
|
};
|
|
@@ -63197,7 +62959,7 @@ async function start(init, port) {
|
|
|
63197
62959
|
const soundFile = (key) => {
|
|
63198
62960
|
if (!key) return null;
|
|
63199
62961
|
const ctx = scoped.current() ?? "_none";
|
|
63200
|
-
const name = (0,
|
|
62962
|
+
const name = (0, import_node_crypto29.createHash)("sha256").update(key).digest("hex").slice(0, 40);
|
|
63201
62963
|
return (0, import_node_path27.join)(contentDir, "ctx", ctx, "sounds", `${name}.wav`);
|
|
63202
62964
|
};
|
|
63203
62965
|
const content = createContentService({
|
|
@@ -63230,7 +62992,7 @@ async function start(init, port) {
|
|
|
63230
62992
|
const sha = define_CREATOR_SFX_KIT_default[file2];
|
|
63231
62993
|
if (!sha || !/^[a-z0-9-]{1,40}$/.test(file2)) return null;
|
|
63232
62994
|
const bytes = await (0, import_promises33.readFile)((0, import_node_path27.join)(__dirname, "sfx-kit", `${file2}.wav`)).catch(() => null);
|
|
63233
|
-
if (!bytes || (0,
|
|
62995
|
+
if (!bytes || (0, import_node_crypto29.createHash)("sha256").update(bytes).digest("hex") !== sha) return null;
|
|
63234
62996
|
return new Uint8Array(bytes);
|
|
63235
62997
|
},
|
|
63236
62998
|
// Sounds made on demand for edits: kept in the context's folder by description.
|
|
@@ -63553,7 +63315,6 @@ async function start(init, port) {
|
|
|
63553
63315
|
imageGen: images,
|
|
63554
63316
|
videoGen: video,
|
|
63555
63317
|
engines,
|
|
63556
|
-
assistant: assistantSettings,
|
|
63557
63318
|
assets: {
|
|
63558
63319
|
read: (id) => assets.read(id),
|
|
63559
63320
|
readRange: (id, start2, end) => assets.readRange(id, start2, end)
|