@popcraft/cli 0.57.2 → 0.58.1
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/popcraft.mjs +1168 -338
- package/package.json +2 -2
package/dist/popcraft.mjs
CHANGED
|
@@ -1198,7 +1198,7 @@ function operations(spec = openapi) {
|
|
|
1198
1198
|
}
|
|
1199
1199
|
async function call(target2, method, path, opts = {}) {
|
|
1200
1200
|
const qs = new URLSearchParams(opts.query ?? {}).toString();
|
|
1201
|
-
const headers = { "user-agent": `popcraft-cli/${"0.
|
|
1201
|
+
const headers = { "user-agent": `popcraft-cli/${"0.58.1"}`, ...opts.headers };
|
|
1202
1202
|
if (target2.token) headers.authorization = `Bearer ${target2.token}`;
|
|
1203
1203
|
if (opts.contentType) headers["content-type"] = opts.contentType;
|
|
1204
1204
|
try {
|
|
@@ -2430,10 +2430,10 @@ function tokenize(src, has) {
|
|
|
2430
2430
|
continue;
|
|
2431
2431
|
}
|
|
2432
2432
|
NUM.lastIndex = i2;
|
|
2433
|
-
const
|
|
2434
|
-
if (
|
|
2435
|
-
out.push({ t: "num", v: Number(
|
|
2436
|
-
i2 +=
|
|
2433
|
+
const num13 = NUM.exec(src);
|
|
2434
|
+
if (num13 && /[\d.]/.test(c2)) {
|
|
2435
|
+
out.push({ t: "num", v: Number(num13[0]), at: i2 });
|
|
2436
|
+
i2 += num13[0].length;
|
|
2437
2437
|
continue;
|
|
2438
2438
|
}
|
|
2439
2439
|
IDENT.lastIndex = i2;
|
|
@@ -3996,14 +3996,14 @@ function describeTextTarget(doc2, n) {
|
|
|
3996
3996
|
names.unshift(p2.name);
|
|
3997
3997
|
p2 = p2.parentId ? doc2.nodes[p2.parentId] : void 0;
|
|
3998
3998
|
}
|
|
3999
|
-
const
|
|
4000
|
-
const charsPerLine = n.textAutoResize === "WIDTH_AND_HEIGHT" ? Math.max(
|
|
4001
|
-
const lines2 = n.textAutoResize === "NONE" ? Math.max(1, Math.floor(n.height / Math.max(1, n.fontSize * 1.2))) : Math.max(1,
|
|
3999
|
+
const current6 = str2(n.characters ?? "", 400);
|
|
4000
|
+
const charsPerLine = n.textAutoResize === "WIDTH_AND_HEIGHT" ? Math.max(current6.length, 8) : Math.max(4, Math.floor(n.width / Math.max(1, n.fontSize * 0.52)));
|
|
4001
|
+
const lines2 = n.textAutoResize === "NONE" ? Math.max(1, Math.floor(n.height / Math.max(1, n.fontSize * 1.2))) : Math.max(1, current6.split("\n").length, Math.round(n.height / Math.max(1, n.fontSize * 1.2)));
|
|
4002
4002
|
return {
|
|
4003
4003
|
id: n.id,
|
|
4004
4004
|
name: str2(n.name, AI_LIMITS.maxNameChars),
|
|
4005
4005
|
role: inferTextRole(n, names),
|
|
4006
|
-
current:
|
|
4006
|
+
current: current6,
|
|
4007
4007
|
maxChars: Math.max(4, Math.min(AI_LIMITS.maxTextChars, charsPerLine * lines2)),
|
|
4008
4008
|
path: str2(names.join(" / "), 200)
|
|
4009
4009
|
};
|
|
@@ -6502,21 +6502,21 @@ function glyphInstancesToRings(instances) {
|
|
|
6502
6502
|
}
|
|
6503
6503
|
const commands2 = glyph2?.path?.commands;
|
|
6504
6504
|
if (!commands2?.length) continue;
|
|
6505
|
-
let
|
|
6505
|
+
let current6 = [];
|
|
6506
6506
|
const push2 = () => {
|
|
6507
|
-
if (
|
|
6508
|
-
|
|
6507
|
+
if (current6.length >= 3) rings.push(closeRing(current6));
|
|
6508
|
+
current6 = [];
|
|
6509
6509
|
};
|
|
6510
6510
|
const t3 = glyphTransform(g);
|
|
6511
6511
|
const turn = glyphTurn(g);
|
|
6512
6512
|
flattenPath(commands2, t3, (x0, y0, x1, y1) => {
|
|
6513
6513
|
const [ax, ay] = turn(x0, y0), [bx, by] = turn(x1, y1);
|
|
6514
|
-
const last3 =
|
|
6514
|
+
const last3 = current6[current6.length - 1];
|
|
6515
6515
|
if (!last3 || last3[0] !== ax || last3[1] !== ay) {
|
|
6516
6516
|
push2();
|
|
6517
|
-
|
|
6517
|
+
current6.push([ax, ay]);
|
|
6518
6518
|
}
|
|
6519
|
-
|
|
6519
|
+
current6.push([bx, by]);
|
|
6520
6520
|
});
|
|
6521
6521
|
push2();
|
|
6522
6522
|
}
|
|
@@ -6976,8 +6976,8 @@ function addHeaderFooterToMaster(doc2, masterId, kind) {
|
|
|
6976
6976
|
return { doc: updated, textId: text.id };
|
|
6977
6977
|
}
|
|
6978
6978
|
function reorderPrintPages(doc2, pageId2, orderedIds) {
|
|
6979
|
-
const
|
|
6980
|
-
const rest =
|
|
6979
|
+
const current6 = listPrintPages(doc2, pageId2);
|
|
6980
|
+
const rest = current6.map((f2) => f2.id).filter((id3) => !orderedIds.includes(id3));
|
|
6981
6981
|
const patches = {};
|
|
6982
6982
|
[...orderedIds, ...rest].forEach((id3, index2) => {
|
|
6983
6983
|
const f2 = doc2.nodes[id3];
|
|
@@ -7781,12 +7781,12 @@ function getAncestors(document2, nodeId2) {
|
|
|
7781
7781
|
const ancestors = [];
|
|
7782
7782
|
const node2 = document2.nodes[nodeId2];
|
|
7783
7783
|
if (!node2) return ancestors;
|
|
7784
|
-
let
|
|
7785
|
-
while (
|
|
7786
|
-
const parent = document2.nodes[
|
|
7784
|
+
let current6 = node2;
|
|
7785
|
+
while (current6.parentId) {
|
|
7786
|
+
const parent = document2.nodes[current6.parentId];
|
|
7787
7787
|
if (parent) {
|
|
7788
7788
|
ancestors.push(parent);
|
|
7789
|
-
|
|
7789
|
+
current6 = parent;
|
|
7790
7790
|
} else {
|
|
7791
7791
|
break;
|
|
7792
7792
|
}
|
|
@@ -8583,15 +8583,15 @@ function resolveStepRefs(params2, results) {
|
|
|
8583
8583
|
return fill(params2);
|
|
8584
8584
|
}
|
|
8585
8585
|
function documentContext(doc2, opts) {
|
|
8586
|
-
let
|
|
8586
|
+
let current6 = doc2;
|
|
8587
8587
|
let pageId2 = opts.pageId && doc2.pages.includes(opts.pageId) ? opts.pageId : doc2.pages[0];
|
|
8588
8588
|
let selection = (opts.selection ?? []).filter((id3) => id3 in doc2.nodes);
|
|
8589
8589
|
const notices = [];
|
|
8590
8590
|
const caps = opts.capabilities ?? [];
|
|
8591
8591
|
const ctx2 = {
|
|
8592
|
-
doc: () =>
|
|
8592
|
+
doc: () => current6,
|
|
8593
8593
|
commit: (next2) => {
|
|
8594
|
-
|
|
8594
|
+
current6 = next2;
|
|
8595
8595
|
},
|
|
8596
8596
|
pageId: () => pageId2,
|
|
8597
8597
|
selection: () => [...selection],
|
|
@@ -8615,18 +8615,18 @@ function documentContext(doc2, opts) {
|
|
|
8615
8615
|
},
|
|
8616
8616
|
create: (name2) => {
|
|
8617
8617
|
const page = createPage(name2);
|
|
8618
|
-
|
|
8618
|
+
current6 = { ...current6, pages: [...current6.pages, page.id], nodes: { ...current6.nodes, [page.id]: page } };
|
|
8619
8619
|
pageId2 = page.id;
|
|
8620
8620
|
selection = [];
|
|
8621
8621
|
return page.id;
|
|
8622
8622
|
},
|
|
8623
8623
|
rename: (id3, name2) => {
|
|
8624
|
-
|
|
8624
|
+
current6 = updateNode(current6, id3, { name: name2 });
|
|
8625
8625
|
}
|
|
8626
8626
|
},
|
|
8627
8627
|
readOnlyReason: () => null
|
|
8628
8628
|
};
|
|
8629
|
-
return { ctx: ctx2, document: () =>
|
|
8629
|
+
return { ctx: ctx2, document: () => current6, pageId: () => pageId2, selection: () => [...selection], notices };
|
|
8630
8630
|
}
|
|
8631
8631
|
var BROWSER_NEEDS, SIGNIN_DOMAINS, APP_ONLY, UNAVAILABLE, STORE_BOUND, STEP_REF;
|
|
8632
8632
|
var init_headless = __esm({
|
|
@@ -29359,6 +29359,7 @@ function scaleSubtreePatches(nodes, id3, sx, sy, includeSelf = true) {
|
|
|
29359
29359
|
var scalePoint;
|
|
29360
29360
|
var init_scale_geometry = __esm({
|
|
29361
29361
|
"lib/document/scale-geometry.ts"() {
|
|
29362
|
+
"use strict";
|
|
29362
29363
|
scalePoint = (p2, sx, sy) => ({
|
|
29363
29364
|
...p2,
|
|
29364
29365
|
x: p2.x * sx,
|
|
@@ -30833,8 +30834,8 @@ var require_base64_js = __commonJS({
|
|
|
30833
30834
|
}
|
|
30834
30835
|
return arr2;
|
|
30835
30836
|
}
|
|
30836
|
-
function tripletToBase64(
|
|
30837
|
-
return lookup[
|
|
30837
|
+
function tripletToBase64(num13) {
|
|
30838
|
+
return lookup[num13 >> 18 & 63] + lookup[num13 >> 12 & 63] + lookup[num13 >> 6 & 63] + lookup[num13 & 63];
|
|
30838
30839
|
}
|
|
30839
30840
|
function encodeChunk(uint82, start2, end) {
|
|
30840
30841
|
var tmp;
|
|
@@ -30942,16 +30943,16 @@ var require_tiny_inflate = __commonJS({
|
|
|
30942
30943
|
for (i2 = 0; i2 < 32; ++i2) dt.trans[i2] = i2;
|
|
30943
30944
|
}
|
|
30944
30945
|
var offs = new Uint16Array(16);
|
|
30945
|
-
function tinf_build_tree(t3, lengths3, off,
|
|
30946
|
+
function tinf_build_tree(t3, lengths3, off, num13) {
|
|
30946
30947
|
var i2, sum;
|
|
30947
30948
|
for (i2 = 0; i2 < 16; ++i2) t3.table[i2] = 0;
|
|
30948
|
-
for (i2 = 0; i2 <
|
|
30949
|
+
for (i2 = 0; i2 < num13; ++i2) t3.table[lengths3[off + i2]]++;
|
|
30949
30950
|
t3.table[0] = 0;
|
|
30950
30951
|
for (sum = 0, i2 = 0; i2 < 16; ++i2) {
|
|
30951
30952
|
offs[i2] = sum;
|
|
30952
30953
|
sum += t3.table[i2];
|
|
30953
30954
|
}
|
|
30954
|
-
for (i2 = 0; i2 <
|
|
30955
|
+
for (i2 = 0; i2 < num13; ++i2) {
|
|
30955
30956
|
if (lengths3[off + i2]) t3.trans[offs[lengths3[off + i2]]++] = i2;
|
|
30956
30957
|
}
|
|
30957
30958
|
}
|
|
@@ -30964,16 +30965,16 @@ var require_tiny_inflate = __commonJS({
|
|
|
30964
30965
|
d.tag >>>= 1;
|
|
30965
30966
|
return bit;
|
|
30966
30967
|
}
|
|
30967
|
-
function tinf_read_bits(d,
|
|
30968
|
-
if (!
|
|
30968
|
+
function tinf_read_bits(d, num13, base) {
|
|
30969
|
+
if (!num13)
|
|
30969
30970
|
return base;
|
|
30970
30971
|
while (d.bitcount < 24) {
|
|
30971
30972
|
d.tag |= d.source[d.sourceIndex++] << d.bitcount;
|
|
30972
30973
|
d.bitcount += 8;
|
|
30973
30974
|
}
|
|
30974
|
-
var val = d.tag & 65535 >>> 16 -
|
|
30975
|
-
d.tag >>>=
|
|
30976
|
-
d.bitcount -=
|
|
30975
|
+
var val = d.tag & 65535 >>> 16 - num13;
|
|
30976
|
+
d.tag >>>= num13;
|
|
30977
|
+
d.bitcount -= num13;
|
|
30977
30978
|
return val + base;
|
|
30978
30979
|
}
|
|
30979
30980
|
function tinf_decode_symbol(d, t3) {
|
|
@@ -30996,7 +30997,7 @@ var require_tiny_inflate = __commonJS({
|
|
|
30996
30997
|
}
|
|
30997
30998
|
function tinf_decode_trees(d, lt, dt) {
|
|
30998
30999
|
var hlit, hdist, hclen;
|
|
30999
|
-
var i2,
|
|
31000
|
+
var i2, num13, length2;
|
|
31000
31001
|
hlit = tinf_read_bits(d, 5, 257);
|
|
31001
31002
|
hdist = tinf_read_bits(d, 5, 1);
|
|
31002
31003
|
hclen = tinf_read_bits(d, 4, 4);
|
|
@@ -31006,27 +31007,27 @@ var require_tiny_inflate = __commonJS({
|
|
|
31006
31007
|
lengths2[clcidx[i2]] = clen2;
|
|
31007
31008
|
}
|
|
31008
31009
|
tinf_build_tree(code_tree, lengths2, 0, 19);
|
|
31009
|
-
for (
|
|
31010
|
+
for (num13 = 0; num13 < hlit + hdist; ) {
|
|
31010
31011
|
var sym = tinf_decode_symbol(d, code_tree);
|
|
31011
31012
|
switch (sym) {
|
|
31012
31013
|
case 16:
|
|
31013
|
-
var prev = lengths2[
|
|
31014
|
+
var prev = lengths2[num13 - 1];
|
|
31014
31015
|
for (length2 = tinf_read_bits(d, 2, 3); length2; --length2) {
|
|
31015
|
-
lengths2[
|
|
31016
|
+
lengths2[num13++] = prev;
|
|
31016
31017
|
}
|
|
31017
31018
|
break;
|
|
31018
31019
|
case 17:
|
|
31019
31020
|
for (length2 = tinf_read_bits(d, 3, 3); length2; --length2) {
|
|
31020
|
-
lengths2[
|
|
31021
|
+
lengths2[num13++] = 0;
|
|
31021
31022
|
}
|
|
31022
31023
|
break;
|
|
31023
31024
|
case 18:
|
|
31024
31025
|
for (length2 = tinf_read_bits(d, 7, 11); length2; --length2) {
|
|
31025
|
-
lengths2[
|
|
31026
|
+
lengths2[num13++] = 0;
|
|
31026
31027
|
}
|
|
31027
31028
|
break;
|
|
31028
31029
|
default:
|
|
31029
|
-
lengths2[
|
|
31030
|
+
lengths2[num13++] = sym;
|
|
31030
31031
|
break;
|
|
31031
31032
|
}
|
|
31032
31033
|
}
|
|
@@ -172572,7 +172573,6 @@ async function sha256Prefix(bytes2) {
|
|
|
172572
172573
|
}
|
|
172573
172574
|
var init_media_hash = __esm({
|
|
172574
172575
|
"lib/storage/media-hash.ts"() {
|
|
172575
|
-
"use strict";
|
|
172576
172576
|
}
|
|
172577
172577
|
});
|
|
172578
172578
|
|
|
@@ -172955,7 +172955,6 @@ function releaseMediaMemory(hash3) {
|
|
|
172955
172955
|
var key2, peaksKey, objectUrls, sourceKey, remoteResolver, MEDIA_FETCH_TIMEOUT_MS, SHIPPED_MEDIA_PATH, notShipped, MEDIA_SCHEME, isImageDataUrl, memory, pendingLoads, sourceAliases, PAINT_KEYS, URL_KEYS;
|
|
172956
172956
|
var init_media_store = __esm({
|
|
172957
172957
|
"lib/storage/media-store.ts"() {
|
|
172958
|
-
"use strict";
|
|
172959
172958
|
init_media_types();
|
|
172960
172959
|
init_idb();
|
|
172961
172960
|
init_media_hash();
|
|
@@ -174556,8 +174555,8 @@ var require_decompress_binding = __commonJS({
|
|
|
174556
174555
|
function _abort() {
|
|
174557
174556
|
abort("");
|
|
174558
174557
|
}
|
|
174559
|
-
function _emscripten_memcpy_big(dest, src,
|
|
174560
|
-
HEAPU8.copyWithin(dest, src, src +
|
|
174558
|
+
function _emscripten_memcpy_big(dest, src, num13) {
|
|
174559
|
+
HEAPU8.copyWithin(dest, src, src + num13);
|
|
174561
174560
|
}
|
|
174562
174561
|
function emscripten_realloc_buffer(size6) {
|
|
174563
174562
|
try {
|
|
@@ -176241,6 +176240,7 @@ var init_frame_labels = __esm({
|
|
|
176241
176240
|
var MODE_PROFILES, isTimelineMode, FOCUS_PROFILES, MODE_LIST, FOCUS_BY_PRECEDENCE;
|
|
176242
176241
|
var init_registry2 = __esm({
|
|
176243
176242
|
"lib/editor/modes/registry.ts"() {
|
|
176243
|
+
"use strict";
|
|
176244
176244
|
MODE_PROFILES = {
|
|
176245
176245
|
DESIGN: {
|
|
176246
176246
|
id: "DESIGN",
|
|
@@ -177965,13 +177965,13 @@ function compositionAt(comp, t3) {
|
|
|
177965
177965
|
else return EMPTY_MOMENT;
|
|
177966
177966
|
}
|
|
177967
177967
|
const clip = clips2[index2];
|
|
177968
|
-
const
|
|
177968
|
+
const current6 = { clip, index: index2, local: clipLocalTime(clip, t3) };
|
|
177969
177969
|
const tr = clip.transitionIn;
|
|
177970
177970
|
const prev = index2 > 0 ? clips2[index2 - 1] : void 0;
|
|
177971
|
-
if (!tr || !prev || tr.duration <= 0 || t3 >= clip.start + tr.duration || t3 < clip.start) return { current:
|
|
177971
|
+
if (!tr || !prev || tr.duration <= 0 || t3 >= clip.start + tr.duration || t3 < clip.start) return { current: current6, previous: null, transition: null };
|
|
177972
177972
|
const progress2 = evalInterp(tr.interp, (t3 - clip.start) / tr.duration, tr.duration);
|
|
177973
177973
|
return {
|
|
177974
|
-
current:
|
|
177974
|
+
current: current6,
|
|
177975
177975
|
previous: { clip: prev, index: index2 - 1, local: clipLocalTime(prev, t3) },
|
|
177976
177976
|
transition: { type: tr.type, progress: progress2, params: tr.params }
|
|
177977
177977
|
};
|
|
@@ -183384,6 +183384,13 @@ var init_en2 = __esm({
|
|
|
183384
183384
|
"agentPanel.manage": "Manage",
|
|
183385
183385
|
"agentPanel.messageCount": "{count, plural, one {# message} other {# messages}}",
|
|
183386
183386
|
"agentPanel.newChat": "New chat",
|
|
183387
|
+
"agentPanel.orchestration": "Orchestration",
|
|
183388
|
+
"agentPanel.orchestrationAuto": "Auto",
|
|
183389
|
+
"agentPanel.orchestrationAutoHint": "An orchestration skill picks the models for each task",
|
|
183390
|
+
"agentPanel.orchestrationOff": "Off",
|
|
183391
|
+
"agentPanel.orchestrationOffHint": "One model: the one you picked",
|
|
183392
|
+
"agentPanel.orchestrationUltra": "Ultra",
|
|
183393
|
+
"agentPanel.orchestrationUltraHint": "A lead, a parallel swarm and a reviewing advisor, set by an orchestration skill",
|
|
183387
183394
|
"agentPanel.resuming": "Resuming\u2026",
|
|
183388
183395
|
"agentPanel.sendEnter": "Send (Enter)",
|
|
183389
183396
|
"agentPanel.skill": "Skill: {name}",
|
|
@@ -252577,6 +252584,7 @@ function hasMessage(key5) {
|
|
|
252577
252584
|
var current3, loading2, listeners2, formats, asts;
|
|
252578
252585
|
var init_runtime = __esm({
|
|
252579
252586
|
"lib/i18n/runtime.ts"() {
|
|
252587
|
+
"use strict";
|
|
252580
252588
|
init_intl_messageformat();
|
|
252581
252589
|
init_icu_messageformat_parser();
|
|
252582
252590
|
init_catalogs();
|
|
@@ -254376,7 +254384,6 @@ function repairDocumentPaints(doc2) {
|
|
|
254376
254384
|
var broken;
|
|
254377
254385
|
var init_paint_repair = __esm({
|
|
254378
254386
|
"lib/document/paint-repair.ts"() {
|
|
254379
|
-
"use strict";
|
|
254380
254387
|
init_shader_graph();
|
|
254381
254388
|
broken = (p2) => {
|
|
254382
254389
|
if (!p2 || typeof p2 !== "object") return false;
|
|
@@ -254976,6 +254983,7 @@ function relinkCopies(doc2, copies) {
|
|
|
254976
254983
|
var TEXT_PATH_SOURCE_TYPES, isPathSource;
|
|
254977
254984
|
var init_text_links = __esm({
|
|
254978
254985
|
"lib/document/text-links.ts"() {
|
|
254986
|
+
"use strict";
|
|
254979
254987
|
init_transform();
|
|
254980
254988
|
TEXT_PATH_SOURCE_TYPES = ["VECTOR", "ELLIPSE", "RECTANGLE", "POLYGON", "STAR", "LINE", "ARROW", "FRAME"];
|
|
254981
254989
|
isPathSource = (n) => !!n && TEXT_PATH_SOURCE_TYPES.includes(n.type);
|
|
@@ -260658,6 +260666,7 @@ function repairFx(raw) {
|
|
|
260658
260666
|
var isObj5, finite6, optFinite, isVec2, TIMELINE_COLOR_IDS, TIMELINE_COLORS, UNITS, ORDERS, PROP_KEYS, ANIMATOR_ID, MOTION_TYPES, TRANSITIONS, isFraction, MEDIA_HASH, LAYER_KINDS, ADJUSTMENT_TYPES, OPACITY_PROPERTY, CAPTION_PRESET_NAMES, inRange;
|
|
260659
260667
|
var init_invariants = __esm({
|
|
260660
260668
|
"lib/motion/invariants.ts"() {
|
|
260669
|
+
"use strict";
|
|
260661
260670
|
init_adjustments();
|
|
260662
260671
|
init_captions();
|
|
260663
260672
|
init_lut();
|
|
@@ -263466,6 +263475,7 @@ function resizeWindow(doc2, target2, rect) {
|
|
|
263466
263475
|
}
|
|
263467
263476
|
var init_crop = __esm({
|
|
263468
263477
|
"lib/editor/crop.ts"() {
|
|
263478
|
+
"use strict";
|
|
263469
263479
|
init_dist_node();
|
|
263470
263480
|
init_scene_graph();
|
|
263471
263481
|
init_photo_frames();
|
|
@@ -263716,6 +263726,7 @@ function getActiveRenderer() {
|
|
|
263716
263726
|
var active;
|
|
263717
263727
|
var init_renderer_registry = __esm({
|
|
263718
263728
|
"lib/engine/renderer-registry.ts"() {
|
|
263729
|
+
"use strict";
|
|
263719
263730
|
active = null;
|
|
263720
263731
|
}
|
|
263721
263732
|
});
|
|
@@ -266495,6 +266506,7 @@ fn shade(uv: vec2<f32>, res: vec2<f32>, tm: f32) -> vec4<f32> {
|
|
|
266495
266506
|
var SHADER_PRESETS, shaderPreset, legacyPresetOf, DEFAULT_SHADER_PRESET, DEFAULT_TEXTURE_PARAMS, f, vec4, NOISE_LIB;
|
|
266496
266507
|
var init_shader_presets = __esm({
|
|
266497
266508
|
"lib/engine/shader-presets.ts"() {
|
|
266509
|
+
"use strict";
|
|
266498
266510
|
init_shader_graph();
|
|
266499
266511
|
init_shader_graph_presets();
|
|
266500
266512
|
init_shader_presets_legacy();
|
|
@@ -268298,6 +268310,7 @@ async function docExists(id3) {
|
|
|
268298
268310
|
var INDEX_KEY, docKey, thumbKey, THUMB_MAX_BYTES, THUMB_TYPES, LEGACY_DATA_URL, migrating, SPLIT_LAYOUT, nodeKey, WRITER, persisted, saving, deletedHere, keyval, keyvalStore;
|
|
268299
268311
|
var init_document_library = __esm({
|
|
268300
268312
|
"lib/storage/document-library.ts"() {
|
|
268313
|
+
"use strict";
|
|
268301
268314
|
init_idb();
|
|
268302
268315
|
init_media_types();
|
|
268303
268316
|
init_collapse_duplicates();
|
|
@@ -268369,6 +268382,7 @@ function onTabMessage(fn) {
|
|
|
268369
268382
|
var EDITOR_HOME, localDocPath, cloudFilePath, CHANNEL2, channel2;
|
|
268370
268383
|
var init_tab_mode = __esm({
|
|
268371
268384
|
"lib/desktop/tab-mode.ts"() {
|
|
268385
|
+
"use strict";
|
|
268372
268386
|
EDITOR_HOME = "/home";
|
|
268373
268387
|
localDocPath = (docId) => `${EDITOR_HOME}?doc=${encodeURIComponent(docId)}`;
|
|
268374
268388
|
cloudFilePath = (key5) => `/pop/${encodeURIComponent(key5)}`;
|
|
@@ -269970,6 +269984,7 @@ function staggerDocument(doc2, ids2, opts) {
|
|
|
269970
269984
|
var PRESET_IDS, num6, restOpacity, overshoots, fadeCurve, span, enter2, leave2, fadeIn, fadeOut, along, scaleSpan, wave, BLUR_ID, SMEAR_ID, SHAKE_STEPS, SHAKE, clips, clipping, WIPE_MIN, wipeGroupId, wipeMaskId, any2, CONTAINERS2, isContainer, autoRise, CAM, zoomOf, camTravel, camArrive, dollyAxis, cameraOrGroup, isPlainText, TEXT_NEEDS, unitRise, cascade, cascadeKeys, cascadeAmount, slideDistance, LIBRARY, BY_ID2, MOTION_PRESETS, presetById2, lengthenedTo;
|
|
269971
269985
|
var init_presets = __esm({
|
|
269972
269986
|
"lib/motion/presets.ts"() {
|
|
269987
|
+
"use strict";
|
|
269973
269988
|
init_author();
|
|
269974
269989
|
init_keys();
|
|
269975
269990
|
init_markers();
|
|
@@ -271131,6 +271146,7 @@ function retuneShaderAudio(node2, fillId) {
|
|
|
271131
271146
|
}
|
|
271132
271147
|
var init_shader_audio = __esm({
|
|
271133
271148
|
"lib/motion/shader-audio.ts"() {
|
|
271149
|
+
"use strict";
|
|
271134
271150
|
init_shader_params();
|
|
271135
271151
|
init_modifier_edit();
|
|
271136
271152
|
init_keys();
|
|
@@ -271923,6 +271939,7 @@ function breakpointView(state, doc2 = state.document) {
|
|
|
271923
271939
|
var storedDocument;
|
|
271924
271940
|
var init_view = __esm({
|
|
271925
271941
|
"lib/motion/view.ts"() {
|
|
271942
|
+
"use strict";
|
|
271926
271943
|
init_registry2();
|
|
271927
271944
|
init_motion_slice();
|
|
271928
271945
|
init_transport_clock();
|
|
@@ -272308,8 +272325,8 @@ function scopeOf(doc2, key5, record2) {
|
|
|
272308
272325
|
const c2 = r && doc2.collections?.[r.collectionId];
|
|
272309
272326
|
return withKey(r && c2 ? itemScope(c2, r, vars) : vars, key5);
|
|
272310
272327
|
}
|
|
272311
|
-
function setVariableValue(action3, variable,
|
|
272312
|
-
if (action3.variableToggle) return !
|
|
272328
|
+
function setVariableValue(action3, variable, current6, doc2, key5, record2) {
|
|
272329
|
+
if (action3.variableToggle) return !current6;
|
|
272313
272330
|
if (action3.variableExpression !== void 0 && action3.variableExpression.trim()) {
|
|
272314
272331
|
const v = tryEvaluate(action3.variableExpression, scopeOf(doc2, key5, record2));
|
|
272315
272332
|
return v === void 0 ? void 0 : coerceToVariable(variable.type, v);
|
|
@@ -272356,7 +272373,7 @@ function scrollerOf(nodes, id3) {
|
|
|
272356
272373
|
for (let cur = nodes[id3]?.parentId; cur; cur = nodes[cur]?.parentId) if (scrolls(nodes[cur])) return cur;
|
|
272357
272374
|
return null;
|
|
272358
272375
|
}
|
|
272359
|
-
function placed(doc2, frameId,
|
|
272376
|
+
function placed(doc2, frameId, current6, x2, y) {
|
|
272360
272377
|
const node2 = doc2.nodes[frameId];
|
|
272361
272378
|
if (!scrolls(node2)) return null;
|
|
272362
272379
|
const bounds2 = getNodeBounds(doc2, frameId);
|
|
@@ -272364,8 +272381,8 @@ function placed(doc2, frameId, current5, x2, y) {
|
|
|
272364
272381
|
const maxX = Math.max(0, bounds2.width - node2.width);
|
|
272365
272382
|
const maxY = Math.max(0, bounds2.height - node2.height);
|
|
272366
272383
|
return {
|
|
272367
|
-
x: node2.overflowScrolling === "HORIZONTAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxX, x2)) :
|
|
272368
|
-
y: node2.overflowScrolling === "VERTICAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxY, y)) :
|
|
272384
|
+
x: node2.overflowScrolling === "HORIZONTAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxX, x2)) : current6.x,
|
|
272385
|
+
y: node2.overflowScrolling === "VERTICAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxY, y)) : current6.y
|
|
272369
272386
|
};
|
|
272370
272387
|
}
|
|
272371
272388
|
function scrollBy(state, frameId, dx, dy) {
|
|
@@ -273772,7 +273789,6 @@ function planEntryAction({ home }) {
|
|
|
273772
273789
|
var STORAGE_KEY2, useHyperyTeam, TEAM_PROMPT_ENABLED, TEAM_PROMPTED_KEY, PROMPTED_KEY, useTeamPrompt, started;
|
|
273773
273790
|
var init_team = __esm({
|
|
273774
273791
|
"lib/client/cloud/team.ts"() {
|
|
273775
|
-
"use strict";
|
|
273776
273792
|
init_esm();
|
|
273777
273793
|
init_api4();
|
|
273778
273794
|
init_session();
|
|
@@ -274083,7 +274099,7 @@ var init_number = __esm({
|
|
|
274083
274099
|
MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
274084
274100
|
MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER;
|
|
274085
274101
|
LOWEST_INT32 = 1 << 31;
|
|
274086
|
-
isInteger = Number.isInteger || ((
|
|
274102
|
+
isInteger = Number.isInteger || ((num13) => typeof num13 === "number" && isFinite(num13) && floor(num13) === num13);
|
|
274087
274103
|
isNaN3 = Number.isNaN;
|
|
274088
274104
|
parseInt2 = Number.parseInt;
|
|
274089
274105
|
}
|
|
@@ -274165,33 +274181,33 @@ var init_encoding = __esm({
|
|
|
274165
274181
|
encoder.cpos = 0;
|
|
274166
274182
|
}
|
|
274167
274183
|
};
|
|
274168
|
-
write = (encoder,
|
|
274184
|
+
write = (encoder, num13) => {
|
|
274169
274185
|
const bufferLen = encoder.cbuf.length;
|
|
274170
274186
|
if (encoder.cpos === bufferLen) {
|
|
274171
274187
|
encoder.bufs.push(encoder.cbuf);
|
|
274172
274188
|
encoder.cbuf = new Uint8Array(bufferLen * 2);
|
|
274173
274189
|
encoder.cpos = 0;
|
|
274174
274190
|
}
|
|
274175
|
-
encoder.cbuf[encoder.cpos++] =
|
|
274191
|
+
encoder.cbuf[encoder.cpos++] = num13;
|
|
274176
274192
|
};
|
|
274177
274193
|
writeUint8 = write;
|
|
274178
|
-
writeVarUint = (encoder,
|
|
274179
|
-
while (
|
|
274180
|
-
write(encoder, BIT8 | BITS7 &
|
|
274181
|
-
|
|
274194
|
+
writeVarUint = (encoder, num13) => {
|
|
274195
|
+
while (num13 > BITS7) {
|
|
274196
|
+
write(encoder, BIT8 | BITS7 & num13);
|
|
274197
|
+
num13 = floor(num13 / 128);
|
|
274182
274198
|
}
|
|
274183
|
-
write(encoder, BITS7 &
|
|
274199
|
+
write(encoder, BITS7 & num13);
|
|
274184
274200
|
};
|
|
274185
|
-
writeVarInt = (encoder,
|
|
274186
|
-
const isNegative = isNegativeZero(
|
|
274201
|
+
writeVarInt = (encoder, num13) => {
|
|
274202
|
+
const isNegative = isNegativeZero(num13);
|
|
274187
274203
|
if (isNegative) {
|
|
274188
|
-
|
|
274204
|
+
num13 = -num13;
|
|
274189
274205
|
}
|
|
274190
|
-
write(encoder, (
|
|
274191
|
-
|
|
274192
|
-
while (
|
|
274193
|
-
write(encoder, (
|
|
274194
|
-
|
|
274206
|
+
write(encoder, (num13 > BITS6 ? BIT8 : 0) | (isNegative ? BIT7 : 0) | BITS6 & num13);
|
|
274207
|
+
num13 = floor(num13 / 64);
|
|
274208
|
+
while (num13 > 0) {
|
|
274209
|
+
write(encoder, (num13 > BITS7 ? BIT8 : 0) | BITS7 & num13);
|
|
274210
|
+
num13 = floor(num13 / 128);
|
|
274195
274211
|
}
|
|
274196
274212
|
};
|
|
274197
274213
|
_strBuffer = new Uint8Array(3e4);
|
|
@@ -274245,16 +274261,16 @@ var init_encoding = __esm({
|
|
|
274245
274261
|
encoder.cpos += len3;
|
|
274246
274262
|
return dview;
|
|
274247
274263
|
};
|
|
274248
|
-
writeFloat32 = (encoder,
|
|
274249
|
-
writeFloat64 = (encoder,
|
|
274250
|
-
writeBigInt64 = (encoder,
|
|
274264
|
+
writeFloat32 = (encoder, num13) => writeOnDataView(encoder, 4).setFloat32(0, num13, false);
|
|
274265
|
+
writeFloat64 = (encoder, num13) => writeOnDataView(encoder, 8).setFloat64(0, num13, false);
|
|
274266
|
+
writeBigInt64 = (encoder, num13) => (
|
|
274251
274267
|
/** @type {any} */
|
|
274252
|
-
writeOnDataView(encoder, 8).setBigInt64(0,
|
|
274268
|
+
writeOnDataView(encoder, 8).setBigInt64(0, num13, false)
|
|
274253
274269
|
);
|
|
274254
274270
|
floatTestBed = new DataView(new ArrayBuffer(4));
|
|
274255
|
-
isFloat32 = (
|
|
274256
|
-
floatTestBed.setFloat32(0,
|
|
274257
|
-
return floatTestBed.getFloat32(0) ===
|
|
274271
|
+
isFloat32 = (num13) => {
|
|
274272
|
+
floatTestBed.setFloat32(0, num13);
|
|
274273
|
+
return floatTestBed.getFloat32(0) === num13;
|
|
274258
274274
|
};
|
|
274259
274275
|
writeAny = (encoder, data) => {
|
|
274260
274276
|
switch (typeof data) {
|
|
@@ -274495,17 +274511,17 @@ var init_decoding = __esm({
|
|
|
274495
274511
|
readVarUint8Array = (decoder) => readUint8Array(decoder, readVarUint(decoder));
|
|
274496
274512
|
readUint8 = (decoder) => decoder.arr[decoder.pos++];
|
|
274497
274513
|
readVarUint = (decoder) => {
|
|
274498
|
-
let
|
|
274514
|
+
let num13 = 0;
|
|
274499
274515
|
let mult = 1;
|
|
274500
274516
|
const len3 = decoder.arr.length;
|
|
274501
274517
|
while (decoder.pos < len3) {
|
|
274502
274518
|
const r = decoder.arr[decoder.pos++];
|
|
274503
|
-
|
|
274519
|
+
num13 = num13 + (r & BITS7) * mult;
|
|
274504
274520
|
mult *= 128;
|
|
274505
274521
|
if (r < BIT8) {
|
|
274506
|
-
return
|
|
274522
|
+
return num13;
|
|
274507
274523
|
}
|
|
274508
|
-
if (
|
|
274524
|
+
if (num13 > MAX_SAFE_INTEGER) {
|
|
274509
274525
|
throw errorIntegerOutOfRange;
|
|
274510
274526
|
}
|
|
274511
274527
|
}
|
|
@@ -274513,21 +274529,21 @@ var init_decoding = __esm({
|
|
|
274513
274529
|
};
|
|
274514
274530
|
readVarInt = (decoder) => {
|
|
274515
274531
|
let r = decoder.arr[decoder.pos++];
|
|
274516
|
-
let
|
|
274532
|
+
let num13 = r & BITS6;
|
|
274517
274533
|
let mult = 64;
|
|
274518
274534
|
const sign = (r & BIT7) > 0 ? -1 : 1;
|
|
274519
274535
|
if ((r & BIT8) === 0) {
|
|
274520
|
-
return sign *
|
|
274536
|
+
return sign * num13;
|
|
274521
274537
|
}
|
|
274522
274538
|
const len3 = decoder.arr.length;
|
|
274523
274539
|
while (decoder.pos < len3) {
|
|
274524
274540
|
r = decoder.arr[decoder.pos++];
|
|
274525
|
-
|
|
274541
|
+
num13 = num13 + (r & BITS7) * mult;
|
|
274526
274542
|
mult *= 128;
|
|
274527
274543
|
if (r < BIT8) {
|
|
274528
|
-
return sign *
|
|
274544
|
+
return sign * num13;
|
|
274529
274545
|
}
|
|
274530
|
-
if (
|
|
274546
|
+
if (num13 > MAX_SAFE_INTEGER) {
|
|
274531
274547
|
throw errorIntegerOutOfRange;
|
|
274532
274548
|
}
|
|
274533
274549
|
}
|
|
@@ -282276,11 +282292,11 @@ function repairTree(nodes, pages2) {
|
|
|
282276
282292
|
});
|
|
282277
282293
|
if (keep.length !== kids.length) put3({ ...node2, childIds: keep });
|
|
282278
282294
|
}
|
|
282279
|
-
const
|
|
282280
|
-
for (const id3 in
|
|
282281
|
-
const node2 =
|
|
282295
|
+
const current6 = out ?? nodes;
|
|
282296
|
+
for (const id3 in current6) {
|
|
282297
|
+
const node2 = current6[id3];
|
|
282282
282298
|
if (pages2.includes(id3)) continue;
|
|
282283
|
-
const parents = (listedBy.get(id3) ?? []).filter((p2) => (
|
|
282299
|
+
const parents = (listedBy.get(id3) ?? []).filter((p2) => (current6[p2].childIds ?? []).includes(id3));
|
|
282284
282300
|
const parent = parents[0] ?? null;
|
|
282285
282301
|
if (parent && node2.parentId !== parent) put3({ ...node2, parentId: parent });
|
|
282286
282302
|
}
|
|
@@ -282326,7 +282342,7 @@ function finishDocument(ydoc, base, nodes) {
|
|
|
282326
282342
|
}
|
|
282327
282343
|
return doc2;
|
|
282328
282344
|
}
|
|
282329
|
-
function applyYEventsToDocument(ydoc,
|
|
282345
|
+
function applyYEventsToDocument(ydoc, current6, events) {
|
|
282330
282346
|
const ynodes = yNodes(ydoc);
|
|
282331
282347
|
const touched = /* @__PURE__ */ new Set();
|
|
282332
282348
|
let structure = false;
|
|
@@ -282344,9 +282360,9 @@ function applyYEventsToDocument(ydoc, current5, events) {
|
|
|
282344
282360
|
structure = true;
|
|
282345
282361
|
}
|
|
282346
282362
|
}
|
|
282347
|
-
let nodes =
|
|
282363
|
+
let nodes = current6.nodes;
|
|
282348
282364
|
if (touched.size) {
|
|
282349
|
-
nodes = { ...
|
|
282365
|
+
nodes = { ...current6.nodes };
|
|
282350
282366
|
for (const id3 of touched) {
|
|
282351
282367
|
if (!isSafeKey(id3)) continue;
|
|
282352
282368
|
const ynode = ynodes.get(id3);
|
|
@@ -282354,9 +282370,9 @@ function applyYEventsToDocument(ydoc, current5, events) {
|
|
|
282354
282370
|
else delete nodes[id3];
|
|
282355
282371
|
}
|
|
282356
282372
|
}
|
|
282357
|
-
if (!touched.size && !structure) return
|
|
282358
|
-
if (!structure && !tree) return { ...
|
|
282359
|
-
return finishDocument(ydoc,
|
|
282373
|
+
if (!touched.size && !structure) return current6;
|
|
282374
|
+
if (!structure && !tree) return { ...current6, nodes };
|
|
282375
|
+
return finishDocument(ydoc, current6, nodes);
|
|
282360
282376
|
}
|
|
282361
282377
|
var LOCAL_ORIGIN, RECORD_FIELDS, META_FIELDS, sameSyncedFields, yRecordMaps, TRACK_PREFIX, MACHINE_PARTS, MACHINE_PREFIX, MAX_DOC_NAME, UNSAFE_KEYS, isSafeKey, yNodes, yPages, yMeta;
|
|
282362
282378
|
var init_ydoc = __esm({
|
|
@@ -283522,12 +283538,12 @@ function startCollabSession(docId, opts) {
|
|
|
283522
283538
|
if (!bound || tr.origin === LOCAL_ORIGIN || !isActive()) return;
|
|
283523
283539
|
if (useEditorStore.getState().isVersionHistoryMode) return;
|
|
283524
283540
|
if (sendTimer) flush();
|
|
283525
|
-
const
|
|
283526
|
-
const sharedCurrent = withoutPrivate(
|
|
283541
|
+
const current6 = useEditorStore.getState().document;
|
|
283542
|
+
const sharedCurrent = withoutPrivate(current6);
|
|
283527
283543
|
const shared = applyYEventsToDocument(ydoc, sharedCurrent, events);
|
|
283528
283544
|
if (shared === sharedCurrent) return;
|
|
283529
|
-
const next2 = repairDocumentPaints(migrateDocumentMotion(restorePrivate(shared,
|
|
283530
|
-
if (!(tr.origin instanceof UndoManager)) noteRemoteChanges(
|
|
283545
|
+
const next2 = repairDocumentPaints(migrateDocumentMotion(restorePrivate(shared, current6)));
|
|
283546
|
+
if (!(tr.origin instanceof UndoManager)) noteRemoteChanges(current6, next2, changedIds(current6, next2, events));
|
|
283531
283547
|
if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent("popcraft-media-retry"));
|
|
283532
283548
|
applyingRemote = true;
|
|
283533
283549
|
synced = shared;
|
|
@@ -283665,9 +283681,9 @@ function withDeadline(p2, ms3) {
|
|
|
283665
283681
|
return Promise.race([p2, deadline]).finally(() => clearTimeout(timer));
|
|
283666
283682
|
}
|
|
283667
283683
|
async function trackOpen(run4, opts = {}) {
|
|
283668
|
-
const
|
|
283669
|
-
if (
|
|
283670
|
-
const joined = { stage: (s) => patch(
|
|
283684
|
+
const current6 = useOpenProgress.getState().open;
|
|
283685
|
+
if (current6 && !current6.error) {
|
|
283686
|
+
const joined = { stage: (s) => patch(current6.id, { stage: s }) };
|
|
283671
283687
|
return run4(joined);
|
|
283672
283688
|
}
|
|
283673
283689
|
const id3 = nextId++;
|
|
@@ -283936,6 +283952,7 @@ async function prepareTemplate(t3) {
|
|
|
283936
283952
|
var templateMediaSources, MEDIA_FETCH_TIMEOUT_MS2, PREPARE_BUDGET_MS, MEDIA_CONCURRENCY, timeoutOf;
|
|
283937
283953
|
var init_use = __esm({
|
|
283938
283954
|
"lib/templates/use.ts"() {
|
|
283955
|
+
"use strict";
|
|
283939
283956
|
init_capture();
|
|
283940
283957
|
templateMediaSources = (t3, hash3) => [
|
|
283941
283958
|
`/templates/media/${hash3}`,
|
|
@@ -291782,15 +291799,15 @@ var init_isobmff_demuxer = __esm({
|
|
|
291782
291799
|
break;
|
|
291783
291800
|
}
|
|
291784
291801
|
assert2(track3.info?.type === "video");
|
|
291785
|
-
const
|
|
291802
|
+
const num13 = readU32Be(slice2);
|
|
291786
291803
|
const den = readU32Be(slice2);
|
|
291787
|
-
if (
|
|
291804
|
+
if (num13 > 0 && den > 0) {
|
|
291788
291805
|
track3.info.squarePixelWidth = track3.info.width;
|
|
291789
291806
|
track3.info.squarePixelHeight = track3.info.height;
|
|
291790
|
-
if (
|
|
291791
|
-
track3.info.squarePixelWidth = Math.round(track3.info.width *
|
|
291807
|
+
if (num13 > den) {
|
|
291808
|
+
track3.info.squarePixelWidth = Math.round(track3.info.width * num13 / den);
|
|
291792
291809
|
} else {
|
|
291793
|
-
track3.info.squarePixelHeight = Math.round(track3.info.height * den /
|
|
291810
|
+
track3.info.squarePixelHeight = Math.round(track3.info.height * den / num13);
|
|
291794
291811
|
}
|
|
291795
291812
|
}
|
|
291796
291813
|
}
|
|
@@ -293608,16 +293625,16 @@ var init_isobmff_demuxer = __esm({
|
|
|
293608
293625
|
if (info2.type !== "video") {
|
|
293609
293626
|
return;
|
|
293610
293627
|
}
|
|
293611
|
-
const { num:
|
|
293612
|
-
if (!(
|
|
293628
|
+
const { num: num13, den } = pixelAspectRatio;
|
|
293629
|
+
if (!(num13 > 0 && den > 0) || num13 === den) {
|
|
293613
293630
|
return;
|
|
293614
293631
|
}
|
|
293615
|
-
if (
|
|
293616
|
-
info2.squarePixelWidth = Math.round(info2.width *
|
|
293632
|
+
if (num13 > den) {
|
|
293633
|
+
info2.squarePixelWidth = Math.round(info2.width * num13 / den);
|
|
293617
293634
|
info2.squarePixelHeight = info2.height;
|
|
293618
293635
|
} else {
|
|
293619
293636
|
info2.squarePixelWidth = info2.width;
|
|
293620
|
-
info2.squarePixelHeight = Math.round(info2.height * den /
|
|
293637
|
+
info2.squarePixelHeight = Math.round(info2.height * den / num13);
|
|
293621
293638
|
}
|
|
293622
293639
|
};
|
|
293623
293640
|
sampleTableIsEmpty = (sampleTable) => {
|
|
@@ -295133,13 +295150,13 @@ var init_matroska_demuxer = __esm({
|
|
|
295133
295150
|
this.currentTrack.info.squarePixelWidth = this.currentTrack.info.width;
|
|
295134
295151
|
this.currentTrack.info.squarePixelHeight = this.currentTrack.info.height;
|
|
295135
295152
|
if (this.currentTrack.info.displayWidth !== null && this.currentTrack.info.displayHeight !== null) {
|
|
295136
|
-
const
|
|
295153
|
+
const num13 = this.currentTrack.info.displayWidth * this.currentTrack.info.height;
|
|
295137
295154
|
const den = this.currentTrack.info.displayHeight * this.currentTrack.info.width;
|
|
295138
|
-
if (
|
|
295139
|
-
if (
|
|
295140
|
-
this.currentTrack.info.squarePixelWidth = Math.round(this.currentTrack.info.width *
|
|
295155
|
+
if (num13 > 0 && den > 0) {
|
|
295156
|
+
if (num13 > den) {
|
|
295157
|
+
this.currentTrack.info.squarePixelWidth = Math.round(this.currentTrack.info.width * num13 / den);
|
|
295141
295158
|
} else {
|
|
295142
|
-
this.currentTrack.info.squarePixelHeight = Math.round(this.currentTrack.info.height * den /
|
|
295159
|
+
this.currentTrack.info.squarePixelHeight = Math.round(this.currentTrack.info.height * den / num13);
|
|
295143
295160
|
}
|
|
295144
295161
|
}
|
|
295145
295162
|
}
|
|
@@ -299040,7 +299057,7 @@ var init_flac_demuxer = __esm({
|
|
|
299040
299057
|
if (reservedZero !== 0) {
|
|
299041
299058
|
return null;
|
|
299042
299059
|
}
|
|
299043
|
-
const
|
|
299060
|
+
const num13 = readCodedNumber(slice2);
|
|
299044
299061
|
const blockSize = readBlockSize(slice2, blockSizeOrUncommon);
|
|
299045
299062
|
const sampleRate = readSampleRate(slice2, sampleRateOrUncommon);
|
|
299046
299063
|
if (sampleRate === null) {
|
|
@@ -299057,7 +299074,7 @@ var init_flac_demuxer = __esm({
|
|
|
299057
299074
|
if (crc2 !== crcCalculated) {
|
|
299058
299075
|
return null;
|
|
299059
299076
|
}
|
|
299060
|
-
return { num:
|
|
299077
|
+
return { num: num13, blockSize, sampleRate };
|
|
299061
299078
|
}
|
|
299062
299079
|
async advanceReader() {
|
|
299063
299080
|
await this.readMetadata();
|
|
@@ -299590,15 +299607,15 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
299590
299607
|
const spsInfo = parseAvcSps(spsUnit);
|
|
299591
299608
|
elementaryStream.info.width = spsInfo.displayWidth;
|
|
299592
299609
|
elementaryStream.info.height = spsInfo.displayHeight;
|
|
299593
|
-
const
|
|
299610
|
+
const num13 = spsInfo.pixelAspectRatio.num;
|
|
299594
299611
|
const den = spsInfo.pixelAspectRatio.den;
|
|
299595
299612
|
elementaryStream.info.squarePixelWidth = elementaryStream.info.width;
|
|
299596
299613
|
elementaryStream.info.squarePixelHeight = elementaryStream.info.height;
|
|
299597
|
-
if (
|
|
299598
|
-
if (
|
|
299599
|
-
elementaryStream.info.squarePixelWidth = Math.round(elementaryStream.info.width *
|
|
299614
|
+
if (num13 > 0 && den > 0) {
|
|
299615
|
+
if (num13 > den) {
|
|
299616
|
+
elementaryStream.info.squarePixelWidth = Math.round(elementaryStream.info.width * num13 / den);
|
|
299600
299617
|
} else {
|
|
299601
|
-
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den /
|
|
299618
|
+
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den / num13);
|
|
299602
299619
|
}
|
|
299603
299620
|
}
|
|
299604
299621
|
elementaryStream.info.colorSpace = {
|
|
@@ -299623,15 +299640,15 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
299623
299640
|
const spsInfo = parseHevcSps(spsUnit);
|
|
299624
299641
|
elementaryStream.info.width = spsInfo.displayWidth;
|
|
299625
299642
|
elementaryStream.info.height = spsInfo.displayHeight;
|
|
299626
|
-
const
|
|
299643
|
+
const num13 = spsInfo.pixelAspectRatio.num;
|
|
299627
299644
|
const den = spsInfo.pixelAspectRatio.den;
|
|
299628
299645
|
elementaryStream.info.squarePixelWidth = elementaryStream.info.width;
|
|
299629
299646
|
elementaryStream.info.squarePixelHeight = elementaryStream.info.height;
|
|
299630
|
-
if (
|
|
299631
|
-
if (
|
|
299632
|
-
elementaryStream.info.squarePixelWidth = Math.round(elementaryStream.info.width *
|
|
299647
|
+
if (num13 > 0 && den > 0) {
|
|
299648
|
+
if (num13 > den) {
|
|
299649
|
+
elementaryStream.info.squarePixelWidth = Math.round(elementaryStream.info.width * num13 / den);
|
|
299633
299650
|
} else {
|
|
299634
|
-
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den /
|
|
299651
|
+
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den / num13);
|
|
299635
299652
|
}
|
|
299636
299653
|
}
|
|
299637
299654
|
elementaryStream.info.colorSpace = {
|
|
@@ -301032,10 +301049,10 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
301032
301049
|
return true;
|
|
301033
301050
|
}
|
|
301034
301051
|
async ensureCurrentPacketHasNext() {
|
|
301035
|
-
const
|
|
301036
|
-
assert2(
|
|
301052
|
+
const current6 = this.decodeOrderPackets[0];
|
|
301053
|
+
assert2(current6);
|
|
301037
301054
|
while (true) {
|
|
301038
|
-
const presentationIndex = this.presentationOrderPackets.indexOf(
|
|
301055
|
+
const presentationIndex = this.presentationOrderPackets.indexOf(current6);
|
|
301039
301056
|
if (presentationIndex !== -1 && presentationIndex <= this.presentationOrderPackets.length - 2) {
|
|
301040
301057
|
break;
|
|
301041
301058
|
}
|
|
@@ -301144,8 +301161,8 @@ var init_hls_misc = __esm({
|
|
|
301144
301161
|
if (value3 === null) {
|
|
301145
301162
|
return null;
|
|
301146
301163
|
}
|
|
301147
|
-
const
|
|
301148
|
-
return Number.isFinite(
|
|
301164
|
+
const num13 = Number(value3);
|
|
301165
|
+
return Number.isFinite(num13) ? num13 : null;
|
|
301149
301166
|
}
|
|
301150
301167
|
merge(other) {
|
|
301151
301168
|
Object.assign(this._attributes, other._attributes);
|
|
@@ -308525,9 +308542,9 @@ var init_input_track = __esm({
|
|
|
308525
308542
|
};
|
|
308526
308543
|
simplestFractionBetween = (lo, hi, maxDenominator) => {
|
|
308527
308544
|
for (let den = 1; den <= maxDenominator; den++) {
|
|
308528
|
-
const
|
|
308529
|
-
if (
|
|
308530
|
-
return simplifyRational({ num:
|
|
308545
|
+
const num13 = Math.floor(lo * den) + 1;
|
|
308546
|
+
if (num13 / den < hi) {
|
|
308547
|
+
return simplifyRational({ num: num13, den });
|
|
308531
308548
|
}
|
|
308532
308549
|
}
|
|
308533
308550
|
return null;
|
|
@@ -320480,9 +320497,9 @@ function arcToCubics(p0, rx, ry, phiDeg, large, sweep, p2) {
|
|
|
320480
320497
|
rx *= Math.sqrt(lambda);
|
|
320481
320498
|
ry *= Math.sqrt(lambda);
|
|
320482
320499
|
}
|
|
320483
|
-
const
|
|
320500
|
+
const num13 = rx * rx * ry * ry - rx * rx * y1 * y1 - ry * ry * x1 * x1;
|
|
320484
320501
|
const den = rx * rx * y1 * y1 + ry * ry * x1 * x1;
|
|
320485
|
-
const k2 = (large === sweep ? -1 : 1) * Math.sqrt(Math.max(0,
|
|
320502
|
+
const k2 = (large === sweep ? -1 : 1) * Math.sqrt(Math.max(0, num13 / den));
|
|
320486
320503
|
const cx1 = k2 * rx * y1 / ry, cy1 = -k2 * ry * x1 / rx;
|
|
320487
320504
|
const cx = cos * cx1 - sin * cy1 + (p0.x + p2.x) / 2, cy = sin * cx1 + cos * cy1 + (p0.y + p2.y) / 2;
|
|
320488
320505
|
const ang = (ux, uy, vx, vy) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);
|
|
@@ -320510,7 +320527,7 @@ function parsePathData(d) {
|
|
|
320510
320527
|
let lastC2 = null, lastQ = null;
|
|
320511
320528
|
let cmd = "", i2 = 0;
|
|
320512
320529
|
const isCmd = (t3) => /^[a-zA-Z]$/.test(t3);
|
|
320513
|
-
const
|
|
320530
|
+
const num13 = () => Number(tokens[i2++]);
|
|
320514
320531
|
const hasNum = () => i2 < tokens.length && !isCmd(tokens[i2]);
|
|
320515
320532
|
const flag = () => {
|
|
320516
320533
|
const t3 = tokens[i2] ?? "0";
|
|
@@ -320552,7 +320569,7 @@ function parsePathData(d) {
|
|
|
320552
320569
|
switch (cmd.toUpperCase()) {
|
|
320553
320570
|
case "M": {
|
|
320554
320571
|
if (!hasNum()) break;
|
|
320555
|
-
const p2 = { x: ox +
|
|
320572
|
+
const p2 = { x: ox + num13(), y: oy + num13() };
|
|
320556
320573
|
cur = p2;
|
|
320557
320574
|
start2 = p2;
|
|
320558
320575
|
sub2 = { start: { ...p2 }, segs: [], closed: false };
|
|
@@ -320564,34 +320581,34 @@ function parsePathData(d) {
|
|
|
320564
320581
|
}
|
|
320565
320582
|
case "L":
|
|
320566
320583
|
if (!hasNum()) break;
|
|
320567
|
-
line({ x: ox +
|
|
320584
|
+
line({ x: ox + num13(), y: oy + num13() });
|
|
320568
320585
|
break;
|
|
320569
320586
|
case "H":
|
|
320570
320587
|
if (!hasNum()) break;
|
|
320571
|
-
line({ x: ox +
|
|
320588
|
+
line({ x: ox + num13(), y: cur.y });
|
|
320572
320589
|
break;
|
|
320573
320590
|
case "V":
|
|
320574
320591
|
if (!hasNum()) break;
|
|
320575
|
-
line({ x: cur.x, y: oy +
|
|
320592
|
+
line({ x: cur.x, y: oy + num13() });
|
|
320576
320593
|
break;
|
|
320577
320594
|
case "C": {
|
|
320578
320595
|
if (!hasNum()) break;
|
|
320579
|
-
const c1 = { x: ox +
|
|
320596
|
+
const c1 = { x: ox + num13(), y: oy + num13() }, c2 = { x: ox + num13(), y: oy + num13() }, p2 = { x: ox + num13(), y: oy + num13() };
|
|
320580
320597
|
cubic(c1, c2, p2);
|
|
320581
320598
|
break;
|
|
320582
320599
|
}
|
|
320583
320600
|
case "S": {
|
|
320584
320601
|
if (!hasNum()) break;
|
|
320585
320602
|
const c1 = lastC2 ? { x: 2 * cur.x - lastC2.x, y: 2 * cur.y - lastC2.y } : { ...cur };
|
|
320586
|
-
const c2 = { x: ox +
|
|
320603
|
+
const c2 = { x: ox + num13(), y: oy + num13() }, p2 = { x: ox + num13(), y: oy + num13() };
|
|
320587
320604
|
cubic(c1, c2, p2);
|
|
320588
320605
|
break;
|
|
320589
320606
|
}
|
|
320590
320607
|
case "Q":
|
|
320591
320608
|
case "T": {
|
|
320592
320609
|
if (!hasNum()) break;
|
|
320593
|
-
const q = cmd.toUpperCase() === "Q" ? { x: ox +
|
|
320594
|
-
const p2 = { x: ox +
|
|
320610
|
+
const q = cmd.toUpperCase() === "Q" ? { x: ox + num13(), y: oy + num13() } : lastQ ? { x: 2 * cur.x - lastQ.x, y: 2 * cur.y - lastQ.y } : { ...cur };
|
|
320611
|
+
const p2 = { x: ox + num13(), y: oy + num13() };
|
|
320595
320612
|
const p0 = cur;
|
|
320596
320613
|
cubic({ x: p0.x + 2 / 3 * (q.x - p0.x), y: p0.y + 2 / 3 * (q.y - p0.y) }, { x: p2.x + 2 / 3 * (q.x - p2.x), y: p2.y + 2 / 3 * (q.y - p2.y) }, p2);
|
|
320597
320614
|
lastQ = q;
|
|
@@ -320599,8 +320616,8 @@ function parsePathData(d) {
|
|
|
320599
320616
|
}
|
|
320600
320617
|
case "A": {
|
|
320601
320618
|
if (!hasNum()) break;
|
|
320602
|
-
const rx =
|
|
320603
|
-
const p2 = { x: ox +
|
|
320619
|
+
const rx = num13(), ry = num13(), rot = num13(), large = flag(), sweep = flag();
|
|
320620
|
+
const p2 = { x: ox + num13(), y: oy + num13() };
|
|
320604
320621
|
const parts = arcToCubics(cur, rx, ry, rot, large, sweep, p2);
|
|
320605
320622
|
for (const s of parts) cubic(s.c1, s.c2, s.p);
|
|
320606
320623
|
lastC2 = null;
|
|
@@ -320686,11 +320703,11 @@ function pathBounds(paths) {
|
|
|
320686
320703
|
}
|
|
320687
320704
|
return minX === Infinity ? null : { minX, minY, maxX, maxY };
|
|
320688
320705
|
}
|
|
320689
|
-
function parseColor2(input2,
|
|
320706
|
+
function parseColor2(input2, current6) {
|
|
320690
320707
|
if (!input2) return null;
|
|
320691
320708
|
const s = input2.trim().toLowerCase();
|
|
320692
320709
|
if (!s || s === "none" || s === "transparent") return null;
|
|
320693
|
-
if (s === "currentcolor") return
|
|
320710
|
+
if (s === "currentcolor") return current6 ?? { r: 0, g: 0, b: 0, a: 1 };
|
|
320694
320711
|
const hex10 = s.startsWith("#") ? s.slice(1) : NAMED[s];
|
|
320695
320712
|
if (hex10 && /^[0-9a-f]+$/.test(hex10)) {
|
|
320696
320713
|
const full = hex10.length <= 4 ? hex10.split("").map((c2) => c2 + c2).join("") : hex10;
|
|
@@ -322163,8 +322180,8 @@ function reflectUrl() {
|
|
|
322163
322180
|
const base = documentPath({ linkKey: activeLink?.key, localDocId });
|
|
322164
322181
|
const atSameAddress = window.location.pathname === base.split("?")[0];
|
|
322165
322182
|
const path = atSameAddress ? withDeepLink(base, parseDeepLink(window.location.search)) : base;
|
|
322166
|
-
const
|
|
322167
|
-
if (
|
|
322183
|
+
const current6 = window.location.pathname + (isDesktopTabs() || localDocId || path.includes("?") ? window.location.search : "");
|
|
322184
|
+
if (current6 !== path) window.history.replaceState(null, "", path);
|
|
322168
322185
|
}
|
|
322169
322186
|
function onSyncStatus(fn) {
|
|
322170
322187
|
statusListeners.add(fn);
|
|
@@ -322631,7 +322648,6 @@ function startCloudSync() {
|
|
|
322631
322648
|
var status, readOnlyDoc, activeLink, statusListeners, notice, urlArmed, opening, syncStatus, canEdit, uploaded, MEDIA_UPLOAD_PARALLEL, pushTimer, pushing, dirty, pendingMedia, collab, collabSession, collabAnonymous, uploadedThumbs, thumbCheckedAt, THUMB_EVERY_MS, THUMB_MIN_GAP_MS, putThumbnail, openingFiles, mediaHealed, SEEN_KEY, started2;
|
|
322632
322649
|
var init_sync2 = __esm({
|
|
322633
322650
|
"lib/client/cloud/sync.ts"() {
|
|
322634
|
-
"use strict";
|
|
322635
322651
|
init_kinds();
|
|
322636
322652
|
init_paint_repair();
|
|
322637
322653
|
init_migrate();
|
|
@@ -323242,6 +323258,7 @@ function creditLine(c2) {
|
|
|
323242
323258
|
var MAX_PHOTO_PAGE, MAX_PHOTO_QUERY, UUID, isPhotoId, photoImagePath;
|
|
323243
323259
|
var init_stock = __esm({
|
|
323244
323260
|
"lib/photos/stock.ts"() {
|
|
323261
|
+
"use strict";
|
|
323245
323262
|
MAX_PHOTO_PAGE = 12;
|
|
323246
323263
|
MAX_PHOTO_QUERY = 200;
|
|
323247
323264
|
UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -323903,6 +323920,7 @@ function applyTextPath(layout2, path, tp, rebase = true) {
|
|
|
323903
323920
|
var defaultCircleRadius, ownsPath, mapPoint;
|
|
323904
323921
|
var init_text_path = __esm({
|
|
323905
323922
|
"lib/engine/text/text-path.ts"() {
|
|
323923
|
+
"use strict";
|
|
323906
323924
|
init_scene_graph();
|
|
323907
323925
|
init_transform();
|
|
323908
323926
|
init_shape_to_path();
|
|
@@ -324020,6 +324038,7 @@ function areaBounds(rings) {
|
|
|
324020
324038
|
}
|
|
324021
324039
|
var init_text_area = __esm({
|
|
324022
324040
|
"lib/engine/text/text-area.ts"() {
|
|
324041
|
+
"use strict";
|
|
324023
324042
|
}
|
|
324024
324043
|
});
|
|
324025
324044
|
|
|
@@ -326203,25 +326222,25 @@ function effectFilter(node2, ctx2, totalMat) {
|
|
|
326203
326222
|
const sigma = (blur) => Math.max(0.5, blur / 3);
|
|
326204
326223
|
const id3 = uid(ctx2, "fx");
|
|
326205
326224
|
let parts = "";
|
|
326206
|
-
let
|
|
326225
|
+
let current6 = "SourceGraphic";
|
|
326207
326226
|
if (drop) {
|
|
326208
326227
|
const [dx, dy] = localOffset(drop.offset.x, drop.offset.y);
|
|
326209
326228
|
const spread2 = drop.spread || 0;
|
|
326210
326229
|
const knock = drop.showBehindTransparent === false;
|
|
326211
326230
|
if (!spread2 && !knock) {
|
|
326212
|
-
parts += `<feDropShadow in="${
|
|
326231
|
+
parts += `<feDropShadow in="${current6}" dx="${fmt(dx)}" dy="${fmt(dy)}" stdDeviation="${fmt(sigma(drop.blur))}" flood-color="${colorToSVG(drop.color)}" flood-opacity="${fmt(drop.color.a ?? 1)}" result="withdrop"/>`;
|
|
326213
326232
|
} else {
|
|
326214
|
-
parts += (spread2 ? `<feMorphology in="SourceAlpha" operator="${spread2 > 0 ? "dilate" : "erode"}" radius="${fmt(Math.abs(spread2))}" result="dropspread"/>` : "") + `<feGaussianBlur in="${spread2 ? "dropspread" : "SourceAlpha"}" stdDeviation="${fmt(drop.blur > 0 ? sigma(drop.blur) : 0)}" result="dropblur"/><feOffset in="dropblur" dx="${fmt(dx)}" dy="${fmt(dy)}" result="dropoff"/><feFlood flood-color="${colorToSVG(drop.color)}" flood-opacity="${fmt(drop.color.a ?? 1)}" result="dropcol"/><feComposite in="dropcol" in2="dropoff" operator="in" result="dropshadow"/>` + (knock ? `<feComposite in="dropshadow" in2="SourceAlpha" operator="out" result="dropshadow"/>` : "") + `<feMerge result="withdrop"><feMergeNode in="dropshadow"/><feMergeNode in="${
|
|
326233
|
+
parts += (spread2 ? `<feMorphology in="SourceAlpha" operator="${spread2 > 0 ? "dilate" : "erode"}" radius="${fmt(Math.abs(spread2))}" result="dropspread"/>` : "") + `<feGaussianBlur in="${spread2 ? "dropspread" : "SourceAlpha"}" stdDeviation="${fmt(drop.blur > 0 ? sigma(drop.blur) : 0)}" result="dropblur"/><feOffset in="dropblur" dx="${fmt(dx)}" dy="${fmt(dy)}" result="dropoff"/><feFlood flood-color="${colorToSVG(drop.color)}" flood-opacity="${fmt(drop.color.a ?? 1)}" result="dropcol"/><feComposite in="dropcol" in2="dropoff" operator="in" result="dropshadow"/>` + (knock ? `<feComposite in="dropshadow" in2="SourceAlpha" operator="out" result="dropshadow"/>` : "") + `<feMerge result="withdrop"><feMergeNode in="dropshadow"/><feMergeNode in="${current6}"/></feMerge>`;
|
|
326215
326234
|
}
|
|
326216
|
-
|
|
326235
|
+
current6 = "withdrop";
|
|
326217
326236
|
}
|
|
326218
326237
|
if (inner) {
|
|
326219
326238
|
const [dx, dy] = localOffset(inner.offset.x, inner.offset.y);
|
|
326220
326239
|
const spread2 = inner.spread || 0;
|
|
326221
|
-
parts += `<feComponentTransfer in="SourceAlpha" result="inv"><feFuncA type="table" tableValues="1 0"/></feComponentTransfer>` + (spread2 > 0 ? `<feMorphology in="inv" operator="dilate" radius="${fmt(spread2)}" result="inv"/>` : "") + `<feGaussianBlur in="inv" stdDeviation="${fmt(sigma(inner.blur))}" result="innerblur"/><feOffset in="innerblur" dx="${fmt(dx)}" dy="${fmt(dy)}" result="inneroff"/><feComposite in="inneroff" in2="SourceAlpha" operator="in" result="innermask"/><feFlood flood-color="${colorToSVG(inner.color)}" flood-opacity="${fmt(inner.color.a ?? 1)}" result="innercol"/><feComposite in="innercol" in2="innermask" operator="in" result="inner"/><feMerge result="withinner"><feMergeNode in="${
|
|
326222
|
-
|
|
326240
|
+
parts += `<feComponentTransfer in="SourceAlpha" result="inv"><feFuncA type="table" tableValues="1 0"/></feComponentTransfer>` + (spread2 > 0 ? `<feMorphology in="inv" operator="dilate" radius="${fmt(spread2)}" result="inv"/>` : "") + `<feGaussianBlur in="inv" stdDeviation="${fmt(sigma(inner.blur))}" result="innerblur"/><feOffset in="innerblur" dx="${fmt(dx)}" dy="${fmt(dy)}" result="inneroff"/><feComposite in="inneroff" in2="SourceAlpha" operator="in" result="innermask"/><feFlood flood-color="${colorToSVG(inner.color)}" flood-opacity="${fmt(inner.color.a ?? 1)}" result="innercol"/><feComposite in="innercol" in2="innermask" operator="in" result="inner"/><feMerge result="withinner"><feMergeNode in="${current6}"/><feMergeNode in="inner"/></feMerge>`;
|
|
326241
|
+
current6 = "withinner";
|
|
326223
326242
|
}
|
|
326224
|
-
if (layerBlur) parts += `<feGaussianBlur in="${
|
|
326243
|
+
if (layerBlur) parts += `<feGaussianBlur in="${current6}" stdDeviation="${fmt(sigma(layerBlur.radius))}"/>`;
|
|
326225
326244
|
ctx2.defs.push(`<filter id="${id3}" ${region}>${parts}</filter>`);
|
|
326226
326245
|
return ` filter="url(#${id3})"`;
|
|
326227
326246
|
}
|
|
@@ -327145,13 +327164,13 @@ ${num7(c2[0])} ${num7(c2[1])} ${num7(c2[2])} ${num7(c2[3])} ${num7(c2[4])} ${num
|
|
|
327145
327164
|
for (const run4 of item.runs) {
|
|
327146
327165
|
this.w(`q /${this.gs(opacity * run4.alpha, 1, blend2)} gs ${this.res.color.fill(run4.color)} BT
|
|
327147
327166
|
`);
|
|
327148
|
-
let
|
|
327167
|
+
let current6 = "";
|
|
327149
327168
|
for (const g of run4.glyphs) {
|
|
327150
327169
|
const { resource, gid } = this.res.fonts.use(g.font, g.gid, g.codePoints);
|
|
327151
|
-
if (resource !==
|
|
327170
|
+
if (resource !== current6) {
|
|
327152
327171
|
this.w(`/${resource} ${num7(run4.size)} Tf
|
|
327153
327172
|
`);
|
|
327154
|
-
|
|
327173
|
+
current6 = resource;
|
|
327155
327174
|
}
|
|
327156
327175
|
this.w(`1 0 0 -1 ${num7(g.x)} ${num7(g.y)} Tm <${gid.toString(16).padStart(4, "0")}> Tj
|
|
327157
327176
|
`);
|
|
@@ -327941,13 +327960,13 @@ async function encodeImageData(imageData, format, quality = 0.9, dpi) {
|
|
|
327941
327960
|
}
|
|
327942
327961
|
function sliceRegion(node2, doc2) {
|
|
327943
327962
|
let pageId2 = null;
|
|
327944
|
-
let
|
|
327945
|
-
while (
|
|
327946
|
-
if (
|
|
327947
|
-
pageId2 =
|
|
327963
|
+
let current6 = node2;
|
|
327964
|
+
while (current6) {
|
|
327965
|
+
if (current6.type === "PAGE") {
|
|
327966
|
+
pageId2 = current6.id;
|
|
327948
327967
|
break;
|
|
327949
327968
|
}
|
|
327950
|
-
|
|
327969
|
+
current6 = current6.parentId ? doc2.nodes[current6.parentId] : void 0;
|
|
327951
327970
|
}
|
|
327952
327971
|
if (!pageId2) return null;
|
|
327953
327972
|
const page = doc2.nodes[pageId2];
|
|
@@ -328060,6 +328079,7 @@ async function exportSettingFile(renderer, node2, setting, doc2, styles) {
|
|
|
328060
328079
|
var MIME, DEFAULT_EXPORT, exportSettingsOf;
|
|
328061
328080
|
var init_export = __esm({
|
|
328062
328081
|
"lib/io/export.ts"() {
|
|
328082
|
+
"use strict";
|
|
328063
328083
|
init_download();
|
|
328064
328084
|
init_scene_graph();
|
|
328065
328085
|
init_codecs();
|
|
@@ -328151,6 +328171,7 @@ async function selectionReferenceImages(doc2, selection, opts = {}) {
|
|
|
328151
328171
|
var FIT_QUALITIES, FIT_SCALES, blobToDataUrl;
|
|
328152
328172
|
var init_reference_images = __esm({
|
|
328153
328173
|
"lib/ai/reference-images.ts"() {
|
|
328174
|
+
"use strict";
|
|
328154
328175
|
init_export();
|
|
328155
328176
|
init_selection_bounds();
|
|
328156
328177
|
init_renderer_registry();
|
|
@@ -331021,8 +331042,8 @@ var init_node = __esm({
|
|
|
331021
331042
|
const patches = /* @__PURE__ */ new Map();
|
|
331022
331043
|
for (const id3 of ids2) {
|
|
331023
331044
|
const n = resolvedNodeOrThrow(doc2, id3);
|
|
331024
|
-
const
|
|
331025
|
-
const next2 = args2.degrees !== void 0 ? args2.degrees :
|
|
331045
|
+
const current6 = n.rotation ?? 0;
|
|
331046
|
+
const next2 = args2.degrees !== void 0 ? args2.degrees : current6 + (args2.by ?? 0);
|
|
331026
331047
|
patches.set(id3, { rotation: (next2 % 360 + 360) % 360 });
|
|
331027
331048
|
}
|
|
331028
331049
|
commitUpdates(ctx2, doc2, patches);
|
|
@@ -339053,7 +339074,7 @@ var init_package = __esm({
|
|
|
339053
339074
|
"packages/runtime/package.json"() {
|
|
339054
339075
|
package_default = {
|
|
339055
339076
|
name: "@popcraft/runtime",
|
|
339056
|
-
version: "0.
|
|
339077
|
+
version: "0.58.1",
|
|
339057
339078
|
description: "What code exported from PopCraft shares: the meaning of expressions (operators and functions) and, as it grows, the parts of a design's behaviour that are common code rather than generated React.",
|
|
339058
339079
|
license: "MIT",
|
|
339059
339080
|
homepage: "https://popcraft.app/docs/exporting/nextjs",
|
|
@@ -340191,8 +340212,8 @@ var require_types = __commonJS({
|
|
|
340191
340212
|
TokenType2[TokenType2["IS_POSTFIX"] = IS_POSTFIX] = "IS_POSTFIX";
|
|
340192
340213
|
const IS_EXPRESSION_START = 1 << 9;
|
|
340193
340214
|
TokenType2[TokenType2["IS_EXPRESSION_START"] = IS_EXPRESSION_START] = "IS_EXPRESSION_START";
|
|
340194
|
-
const
|
|
340195
|
-
TokenType2[TokenType2["num"] =
|
|
340215
|
+
const num13 = 512;
|
|
340216
|
+
TokenType2[TokenType2["num"] = num13] = "num";
|
|
340196
340217
|
const bigint4 = 1536;
|
|
340197
340218
|
TokenType2[TokenType2["bigint"] = bigint4] = "bigint";
|
|
340198
340219
|
const decimal = 2560;
|
|
@@ -352829,19 +352850,19 @@ var require_sourcemap_codec_umd = __commonJS({
|
|
|
352829
352850
|
} while (integer2 & 32);
|
|
352830
352851
|
return value3;
|
|
352831
352852
|
}
|
|
352832
|
-
function decodeSign(
|
|
352833
|
-
return
|
|
352853
|
+
function decodeSign(num13) {
|
|
352854
|
+
return num13 & 1 ? -2147483648 | -(num13 >>> 1) : num13 >>> 1;
|
|
352834
352855
|
}
|
|
352835
|
-
function encodeInteger(builder,
|
|
352856
|
+
function encodeInteger(builder, num13) {
|
|
352836
352857
|
do {
|
|
352837
|
-
let clamped =
|
|
352838
|
-
|
|
352839
|
-
if (
|
|
352858
|
+
let clamped = num13 & 31;
|
|
352859
|
+
num13 >>>= 5;
|
|
352860
|
+
if (num13 > 0) clamped |= 32;
|
|
352840
352861
|
builder.write(intToChar[clamped]);
|
|
352841
|
-
} while (
|
|
352862
|
+
} while (num13 > 0);
|
|
352842
352863
|
}
|
|
352843
|
-
function encodeSign(
|
|
352844
|
-
return
|
|
352864
|
+
function encodeSign(num13) {
|
|
352865
|
+
return num13 < 0 ? -num13 << 1 | 1 : num13 << 1;
|
|
352845
352866
|
}
|
|
352846
352867
|
function hasMoreVlq(reader, max3) {
|
|
352847
352868
|
if (reader.pos >= max3) return false;
|
|
@@ -354263,8 +354284,8 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
354263
354284
|
function getColumnIndex(line, genColumn) {
|
|
354264
354285
|
let index2 = line.length;
|
|
354265
354286
|
for (let i2 = index2 - 1; i2 >= 0; index2 = i2--) {
|
|
354266
|
-
const
|
|
354267
|
-
if (genColumn >=
|
|
354287
|
+
const current6 = line[i2];
|
|
354288
|
+
if (genColumn >= current6[COLUMN]) break;
|
|
354268
354289
|
}
|
|
354269
354290
|
return index2;
|
|
354270
354291
|
}
|
|
@@ -363719,6 +363740,7 @@ function exportsOf(source3) {
|
|
|
363719
363740
|
var CODE_LIMITS, packageOf;
|
|
363720
363741
|
var init_source2 = __esm({
|
|
363721
363742
|
"lib/code/source.ts"() {
|
|
363743
|
+
"use strict";
|
|
363722
363744
|
CODE_LIMITS = { modules: 100, sourceLength: 2e5, packages: 12 };
|
|
363723
363745
|
packageOf = (spec) => spec.split("/").slice(0, spec.startsWith("@") ? 2 : 1).join("/");
|
|
363724
363746
|
}
|
|
@@ -363761,6 +363783,7 @@ function compileModule(module2) {
|
|
|
363761
363783
|
var import_sucrase, BUILT_IN, memo7;
|
|
363762
363784
|
var init_compile2 = __esm({
|
|
363763
363785
|
"lib/code/compile.ts"() {
|
|
363786
|
+
"use strict";
|
|
363764
363787
|
import_sucrase = __toESM(require_dist2());
|
|
363765
363788
|
init_source2();
|
|
363766
363789
|
init_source2();
|
|
@@ -366583,9 +366606,9 @@ var init_meta = __esm({
|
|
|
366583
366606
|
throw new ToolError("Only one todo may be in_progress at a time.");
|
|
366584
366607
|
}
|
|
366585
366608
|
const done = todos.filter((t3) => t3.status === "done").length;
|
|
366586
|
-
const
|
|
366609
|
+
const current6 = todos.find((t3) => t3.status === "in_progress");
|
|
366587
366610
|
return {
|
|
366588
|
-
summary: todos.length ? `${done}/${todos.length} done${
|
|
366611
|
+
summary: todos.length ? `${done}/${todos.length} done${current6 ? ` \u2014 ${current6.title}` : ""}` : "Cleared the plan",
|
|
366589
366612
|
data: { todos }
|
|
366590
366613
|
};
|
|
366591
366614
|
}
|
|
@@ -369105,17 +369128,17 @@ function bestLag2(a, b, maxLag) {
|
|
|
369105
369128
|
};
|
|
369106
369129
|
const ma = mean(a), mb = mean(b);
|
|
369107
369130
|
for (let lag = -maxLag; lag <= maxLag; lag++) {
|
|
369108
|
-
let
|
|
369131
|
+
let num13 = 0, ea = 0, eb = 0, count2 = 0;
|
|
369109
369132
|
const from2 = Math.max(0, -lag), to = Math.min(a.length, b.length - lag);
|
|
369110
369133
|
for (let i2 = from2; i2 < to; i2++) {
|
|
369111
369134
|
const x2 = a[i2] - ma, y = b[i2 + lag] - mb;
|
|
369112
|
-
|
|
369135
|
+
num13 += x2 * y;
|
|
369113
369136
|
ea += x2 * x2;
|
|
369114
369137
|
eb += y * y;
|
|
369115
369138
|
count2++;
|
|
369116
369139
|
}
|
|
369117
369140
|
if (count2 < ENVELOPE_HZ) continue;
|
|
369118
|
-
const s =
|
|
369141
|
+
const s = num13 / Math.sqrt(ea * eb || 1);
|
|
369119
369142
|
if (s > score) {
|
|
369120
369143
|
score = s;
|
|
369121
369144
|
best = lag;
|
|
@@ -370936,6 +370959,7 @@ function diagnosticsText(diagnostics) {
|
|
|
370936
370959
|
var HARNESS_NAMES, plainDiagnostics;
|
|
370937
370960
|
var init_shader_diagnostics = __esm({
|
|
370938
370961
|
"lib/engine/shader-diagnostics.ts"() {
|
|
370962
|
+
"use strict";
|
|
370939
370963
|
HARNESS_NAMES = ["ShaderUniforms", "VOut", "vs_main", "fs_main", "u", "p"];
|
|
370940
370964
|
plainDiagnostics = (errors2) => errors2.map((message) => ({ line: null, column: null, message, severity: "error" }));
|
|
370941
370965
|
}
|
|
@@ -376342,6 +376366,109 @@ are whole stores to begin from.
|
|
|
376342
376366
|
}
|
|
376343
376367
|
});
|
|
376344
376368
|
|
|
376369
|
+
// lib/agent/skills/builtin/pixel-sprites.ts
|
|
376370
|
+
var pixelSprites;
|
|
376371
|
+
var init_pixel_sprites = __esm({
|
|
376372
|
+
"lib/agent/skills/builtin/pixel-sprites.ts"() {
|
|
376373
|
+
"use strict";
|
|
376374
|
+
pixelSprites = {
|
|
376375
|
+
id: "pixel-sprites",
|
|
376376
|
+
name: "Pixel sprites",
|
|
376377
|
+
description: "Sprites, characters, tiles and items as pixel art in real Pixel canvases, still or animated.",
|
|
376378
|
+
whenToUse: "the user asks for sprites, pixel art, a sprite sheet, game characters, items, tiles or 8-bit / 16-bit art",
|
|
376379
|
+
tools: ["ask_user", "write_design", "get_design_script", "look_at", "get_document_outline", "select", "zoom_to", "manage_todos"],
|
|
376380
|
+
instructions: `# Pixel sprites
|
|
376381
|
+
|
|
376382
|
+
Pixel art goes in Pixel canvases, never in rects or vectors: the user edits it with the pixel tools, animates it in
|
|
376383
|
+
the frame strip and exports it as a sprite sheet. Build each sprite with \`k.pixels\` in one \`write_design\` script.
|
|
376384
|
+
|
|
376385
|
+
## 1. Ask first, when it is not already clear
|
|
376386
|
+
This is required, not optional: a still sprite and an animated one are built differently, so guessing wastes the
|
|
376387
|
+
user's time. If the request leaves either of these open, ask both in ONE \`ask_user\` call before reading the document
|
|
376388
|
+
or building anything:
|
|
376389
|
+
- **Pixel canvas or vector?** \u2014 "Pixel art (editable pixel by pixel)" / "Smooth vector shapes". Skip this when they said
|
|
376390
|
+
pixel art, sprite, 8-bit, 16-bit or retro, or named a pixel size.
|
|
376391
|
+
- **Still or animated?** \u2014 e.g. "Still", "Idle loop (2\u20134 frames)", "Walk cycle (4\u20136 frames)". Skip this when they said.
|
|
376392
|
+
Also ask the size if none was given and it matters (default 32\xD732 for characters, 16\xD716 for items and tiles). Never ask
|
|
376393
|
+
anything they already answered.
|
|
376394
|
+
|
|
376395
|
+
## Size, palette, background \u2014 always what they asked
|
|
376396
|
+
- **Size**: any size they name, exactly (8\xD78, 16\xD716, 24\xD732, 48\xD748, 64\xD764\u2026): that many rows of that many characters.
|
|
376397
|
+
- **Palette**: when they name one ("PICO-8", "Game Boy", "NES-style", "4 colours", "use my brand colours"), pass it as
|
|
376398
|
+
\`palette\` \u2014 a preset (\`'PICO-8'\`, \`'DB32'\`, \`'Endesga 32'\`, \`'Game Boy'\`) or the list of hexes \u2014 and use only those
|
|
376399
|
+
colours in \`key\`. A colour count ("4 colours") means at most that many in \`key\`, outline included.
|
|
376400
|
+
- **Background**: transparent unless they ask for one. Clear the sheet's white paper with \`k.patch(k.sheet, { fills: [] })\`
|
|
376401
|
+
and give the set's frame no fill. A backdrop, when asked for, is its own layer behind the canvases.
|
|
376402
|
+
|
|
376403
|
+
## 2. Build
|
|
376404
|
+
- One Pixel canvas per sprite: \`k.pixels(sheet, frames, key, { cell, ms, name, absolute: { x, y } })\`.
|
|
376405
|
+
- Size it to the request (32\xD732 rows of 32 characters). \`cell\` scales it for viewing: pick it so each sprite shows at
|
|
376406
|
+
about 128\u2013256 on the canvas (cell 4\u20138 for 32 px). Never stretch it with width/height.
|
|
376407
|
+
- One shared \`key\` (palette) across the set, 6\u201316 colours: a dark outline, a highlight and a shadow per material.
|
|
376408
|
+
- Animated: every frame the same size, \`ms\` 80\u2013150 (walk) or 200\u2013400 (idle). Change only what moves between frames.
|
|
376409
|
+
- Lay the set out on one frame named after it ("Platformer sprites"), a sprite per slot in a row, evenly spaced
|
|
376410
|
+
(\`absolute\` positions, a gap of at least one sprite's width), each named for what it is ("Hero", "Coin").
|
|
376411
|
+
- Transparent inside every canvas; never paint a background into the pixels.
|
|
376412
|
+
|
|
376413
|
+
## 3. Check
|
|
376414
|
+
\`look_at\` the set. Each sprite reads as its subject at 1\xD7: a clear silhouette, a consistent light direction (top-left),
|
|
376415
|
+
no stray single pixels, no banding. Fix and look again before you finish.`
|
|
376416
|
+
};
|
|
376417
|
+
}
|
|
376418
|
+
});
|
|
376419
|
+
|
|
376420
|
+
// lib/agent/skills/builtin/orchestration.ts
|
|
376421
|
+
var autoLight, ultraBigBuild, ORCHESTRATION_SKILLS;
|
|
376422
|
+
var init_orchestration = __esm({
|
|
376423
|
+
"lib/agent/skills/builtin/orchestration.ts"() {
|
|
376424
|
+
"use strict";
|
|
376425
|
+
autoLight = {
|
|
376426
|
+
id: "auto-light",
|
|
376427
|
+
name: "Auto",
|
|
376428
|
+
description: "Everyday edits: one model does the work.",
|
|
376429
|
+
whenToUse: "picked automatically in Auto mode",
|
|
376430
|
+
tools: [],
|
|
376431
|
+
instructions: `---
|
|
376432
|
+
name: auto-light
|
|
376433
|
+
kind: orchestration
|
|
376434
|
+
description: Everyday design edits \u2014 one model does the work.
|
|
376435
|
+
modes: auto
|
|
376436
|
+
lead: anthropic/claude-sonnet-5.5
|
|
376437
|
+
lead_effort: medium
|
|
376438
|
+
lead_fallback: anthropic/claude-sonnet-4.5
|
|
376439
|
+
swarm: anthropic/claude-haiku-5.5
|
|
376440
|
+
max_concurrent: 2
|
|
376441
|
+
---
|
|
376442
|
+
Do the work yourself.`
|
|
376443
|
+
};
|
|
376444
|
+
ultraBigBuild = {
|
|
376445
|
+
id: "ultra-big-build",
|
|
376446
|
+
name: "Ultra",
|
|
376447
|
+
description: "Big builds: a whole website, a game, a sprite set, an animation or a video, built in parallel and checked before it ships.",
|
|
376448
|
+
whenToUse: "picked automatically in Ultra mode",
|
|
376449
|
+
tools: [],
|
|
376450
|
+
instructions: `---
|
|
376451
|
+
name: ultra-big-build
|
|
376452
|
+
kind: orchestration
|
|
376453
|
+
description: Big builds \u2014 a whole website, a game, a sprite set, an animation or a video, with many pages, frames, scenes or formats.
|
|
376454
|
+
modes: ultra
|
|
376455
|
+
lead: anthropic/claude-sonnet-5.5
|
|
376456
|
+
lead_effort: high
|
|
376457
|
+
lead_fallback: anthropic/claude-sonnet-4.5
|
|
376458
|
+
swarm: anthropic/claude-haiku-5.5
|
|
376459
|
+
swarm_fallback: anthropic/claude-haiku-4.5
|
|
376460
|
+
advisor: anthropic/claude-opus-5.5
|
|
376461
|
+
advisor_triggers: plan, done
|
|
376462
|
+
max_concurrent: 6
|
|
376463
|
+
---
|
|
376464
|
+
Split the build into pieces \u2014 pages, levels, sprites, scenes, formats \u2014 and build them in parallel where they don't depend on each other. Keep one look across all of them.
|
|
376465
|
+
|
|
376466
|
+
Advisor: check the plan covers everything asked for; at the end, look at the result and flag anything missing, broken or off-brand.`
|
|
376467
|
+
};
|
|
376468
|
+
ORCHESTRATION_SKILLS = [autoLight, ultraBigBuild];
|
|
376469
|
+
}
|
|
376470
|
+
});
|
|
376471
|
+
|
|
376345
376472
|
// lib/agent/skills/builtin/index.ts
|
|
376346
376473
|
var BUILTIN_SKILLS;
|
|
376347
376474
|
var init_builtin2 = __esm({
|
|
@@ -376367,6 +376494,8 @@ var init_builtin2 = __esm({
|
|
|
376367
376494
|
init_design_review();
|
|
376368
376495
|
init_web_app();
|
|
376369
376496
|
init_storefront2();
|
|
376497
|
+
init_pixel_sprites();
|
|
376498
|
+
init_orchestration();
|
|
376370
376499
|
BUILTIN_SKILLS = [
|
|
376371
376500
|
fillContent,
|
|
376372
376501
|
autoLayout,
|
|
@@ -376387,7 +376516,9 @@ var init_builtin2 = __esm({
|
|
|
376387
376516
|
designCode,
|
|
376388
376517
|
designReview,
|
|
376389
376518
|
webApp,
|
|
376390
|
-
storefront
|
|
376519
|
+
storefront,
|
|
376520
|
+
pixelSprites,
|
|
376521
|
+
...ORCHESTRATION_SKILLS
|
|
376391
376522
|
].map((s) => ({ ...s, source: "builtin" }));
|
|
376392
376523
|
}
|
|
376393
376524
|
});
|
|
@@ -376944,7 +377075,7 @@ var init_open_intent = __esm({
|
|
|
376944
377075
|
}
|
|
376945
377076
|
});
|
|
376946
377077
|
|
|
376947
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
377078
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/hypery-model.js
|
|
376948
377079
|
function agentModelError(message, code, status3) {
|
|
376949
377080
|
{
|
|
376950
377081
|
return { name: "AgentModelError", message, code: code ?? "ai_upstream", status: ((__v) => __v == null ? "null" : typeof __v)(status3) === "number" ? status3 : 502 };
|
|
@@ -377122,13 +377253,15 @@ function createHyperyModel(opts) {
|
|
|
377122
377253
|
if (base.endsWith("/") ?? null) {
|
|
377123
377254
|
base = base.slice(0, base.length - 1) ?? null;
|
|
377124
377255
|
}
|
|
377125
|
-
return async (messages, tools, hooks, signal, req) => {
|
|
377256
|
+
return async (messages, tools, hooks, signal, req = null) => {
|
|
377126
377257
|
{
|
|
377127
377258
|
let token = await (resolve2(opts.token) ?? null);
|
|
377128
377259
|
if (((__v) => __v == null ? "null" : typeof __v)(token) !== "string" || token === "") {
|
|
377129
377260
|
throw agentModelError("Sign in to Hypery to use the agent.", "ai_reauth", 401) ?? null;
|
|
377130
377261
|
}
|
|
377131
|
-
let
|
|
377262
|
+
let hasReq = req != null && ((__v) => __v == null ? "null" : typeof __v)(req) === "object";
|
|
377263
|
+
let model = hasReq && ((__v) => __v == null ? "null" : typeof __v)(req.model) === "string" && req.model !== "" ? req.model : await (resolve2(opts.model) ?? null);
|
|
377264
|
+
let effort = hasReq && ((__v) => __v == null ? "null" : typeof __v)(req.effort) === "string" ? req.effort : await (resolve2(opts.effort) ?? null);
|
|
377132
377265
|
let team = await (resolve2(opts.team) ?? null);
|
|
377133
377266
|
let paymentSource = await (resolve2(opts.paymentSource) ?? null);
|
|
377134
377267
|
let hasTools = (Array.isArray(tools) ?? null) && tools.length > 0;
|
|
@@ -377136,9 +377269,12 @@ function createHyperyModel(opts) {
|
|
|
377136
377269
|
if (((__v) => __v == null ? "null" : typeof __v)(opts.temperature) === "number") {
|
|
377137
377270
|
request2.temperature = opts.temperature;
|
|
377138
377271
|
}
|
|
377272
|
+
if (((__v) => __v == null ? "null" : typeof __v)(effort) === "string" && effort !== "") {
|
|
377273
|
+
request2.reasoning = { effort };
|
|
377274
|
+
}
|
|
377139
377275
|
if (hasTools) {
|
|
377140
377276
|
request2.tools = tools;
|
|
377141
|
-
let choice =
|
|
377277
|
+
let choice = hasReq ? req.toolChoice ?? null : null;
|
|
377142
377278
|
request2.tool_choice = choice != null ? choice : "auto";
|
|
377143
377279
|
}
|
|
377144
377280
|
let body = JSON.stringify(request2) ?? null;
|
|
@@ -377266,7 +377402,7 @@ function createHyperyModel(opts) {
|
|
|
377266
377402
|
}
|
|
377267
377403
|
var delay, utf8Complete, utf8Decode, MAX_REQUEST_BYTES, DEFAULT_IDLE_TIMEOUT_MS, HYPERY_TEAM_HEADER2, HYPERY_PAYMENT_SOURCE_HEADER2;
|
|
377268
377404
|
var init_hypery_model = __esm({
|
|
377269
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
377405
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/hypery-model.js"() {
|
|
377270
377406
|
delay = ((ms3) => new Promise((settle4) => setTimeout(() => settle4(null), Math.max(0, Number(ms3) || 0))));
|
|
377271
377407
|
utf8Complete = ((b) => {
|
|
377272
377408
|
if (!Array.isArray(b)) return null;
|
|
@@ -377287,7 +377423,221 @@ var init_hypery_model = __esm({
|
|
|
377287
377423
|
}
|
|
377288
377424
|
});
|
|
377289
377425
|
|
|
377290
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
377426
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/roles.js
|
|
377427
|
+
function isModelRole(v) {
|
|
377428
|
+
{
|
|
377429
|
+
return ((__v) => __v == null ? "null" : typeof __v)(v) === "string" && (MODEL_ROLES.includes(v) ?? null);
|
|
377430
|
+
}
|
|
377431
|
+
}
|
|
377432
|
+
function roleOfProfileModel(model) {
|
|
377433
|
+
{
|
|
377434
|
+
if ((model ?? null) == null || model === "" || model === "inherit") {
|
|
377435
|
+
return "lead";
|
|
377436
|
+
}
|
|
377437
|
+
if (model === "fast") {
|
|
377438
|
+
return "swarm";
|
|
377439
|
+
}
|
|
377440
|
+
if (isModelRole(model) ?? null) {
|
|
377441
|
+
return model;
|
|
377442
|
+
}
|
|
377443
|
+
return null;
|
|
377444
|
+
}
|
|
377445
|
+
}
|
|
377446
|
+
function resolveCatalogModel(wanted, fallback2, catalog2) {
|
|
377447
|
+
{
|
|
377448
|
+
if (!(Array.isArray(catalog2) ?? null) || catalog2.length === 0) {
|
|
377449
|
+
return wanted;
|
|
377450
|
+
}
|
|
377451
|
+
let ids2 = new Set(catalog2.map((m) => {
|
|
377452
|
+
{
|
|
377453
|
+
return ((__v) => __v == null ? "null" : typeof __v)(m) === "string" ? m : m != null && ((__v) => __v == null ? "null" : typeof __v)(m) === "object" ? m.id : "";
|
|
377454
|
+
}
|
|
377455
|
+
}) ?? null) ?? null;
|
|
377456
|
+
if (ids2.has(wanted) ?? null) {
|
|
377457
|
+
return wanted;
|
|
377458
|
+
}
|
|
377459
|
+
for (const f2 of fallback2 ?? []) {
|
|
377460
|
+
if (ids2.has(f2) ?? null) {
|
|
377461
|
+
return f2;
|
|
377462
|
+
}
|
|
377463
|
+
}
|
|
377464
|
+
return wanted;
|
|
377465
|
+
}
|
|
377466
|
+
}
|
|
377467
|
+
function resolveRole(role, roles, catalog2) {
|
|
377468
|
+
{
|
|
377469
|
+
let spec = roles != null && ((__v) => __v == null ? "null" : typeof __v)(roles) === "object" ? roles[role] ?? null ?? null : null;
|
|
377470
|
+
if (spec == null || ((__v) => __v == null ? "null" : typeof __v)(spec.model) !== "string" || spec.model === "") {
|
|
377471
|
+
return null;
|
|
377472
|
+
}
|
|
377473
|
+
return { model: resolveCatalogModel(spec.model, spec.fallback ?? null, catalog2) ?? null, effort: spec.effort ?? null, fallback: spec.fallback ?? null };
|
|
377474
|
+
}
|
|
377475
|
+
}
|
|
377476
|
+
function mergeRoles(roles, overrides2) {
|
|
377477
|
+
{
|
|
377478
|
+
let base = roles != null && ((__v) => __v == null ? "null" : typeof __v)(roles) === "object" ? roles : {};
|
|
377479
|
+
if ((overrides2 ?? null) == null || ((__v) => __v == null ? "null" : typeof __v)(overrides2) !== "object") {
|
|
377480
|
+
return base;
|
|
377481
|
+
}
|
|
377482
|
+
let out = { ...base };
|
|
377483
|
+
for (const r of MODEL_ROLES) {
|
|
377484
|
+
let o = overrides2[r] ?? null ?? null;
|
|
377485
|
+
if (o == null) {
|
|
377486
|
+
continue;
|
|
377487
|
+
}
|
|
377488
|
+
out[r] = ((__v) => __v == null ? "null" : typeof __v)(o) === "string" ? { ...base[r] ?? null ?? {}, model: o } : { ...base[r] ?? null ?? {}, ...o };
|
|
377489
|
+
}
|
|
377490
|
+
return out;
|
|
377491
|
+
}
|
|
377492
|
+
}
|
|
377493
|
+
function roleModel(callModel, spec) {
|
|
377494
|
+
{
|
|
377495
|
+
return async (messages, tools, hooks = null, signal = null, req = null) => {
|
|
377496
|
+
{
|
|
377497
|
+
let r = (req ?? null) != null && ((__v) => __v == null ? "null" : typeof __v)(req) === "object" ? req : {};
|
|
377498
|
+
let merged = { ...r, model: r.model ?? spec.model, effort: r.effort ?? spec.effort ?? null };
|
|
377499
|
+
return await (callModel(messages, tools, hooks, signal, merged) ?? null);
|
|
377500
|
+
}
|
|
377501
|
+
};
|
|
377502
|
+
}
|
|
377503
|
+
}
|
|
377504
|
+
var MODEL_ROLES;
|
|
377505
|
+
var init_roles = __esm({
|
|
377506
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/roles.js"() {
|
|
377507
|
+
MODEL_ROLES = ["lead", "swarm", "advisor", "router"];
|
|
377508
|
+
}
|
|
377509
|
+
});
|
|
377510
|
+
|
|
377511
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/advisor.js
|
|
377512
|
+
function contentText(c2) {
|
|
377513
|
+
{
|
|
377514
|
+
if (((__v) => __v == null ? "null" : typeof __v)(c2) === "string") {
|
|
377515
|
+
return c2;
|
|
377516
|
+
}
|
|
377517
|
+
if (Array.isArray(c2) ?? null) {
|
|
377518
|
+
return (c2.map((p2) => {
|
|
377519
|
+
{
|
|
377520
|
+
return ((__v) => __v == null ? "null" : typeof __v)(p2.text) === "string" ? p2.text : "[image]";
|
|
377521
|
+
}
|
|
377522
|
+
}) ?? null).join(" ") ?? null;
|
|
377523
|
+
}
|
|
377524
|
+
return "";
|
|
377525
|
+
}
|
|
377526
|
+
}
|
|
377527
|
+
function renderTranscript(messages, maxChars) {
|
|
377528
|
+
{
|
|
377529
|
+
let lines2 = [];
|
|
377530
|
+
for (const m of messages) {
|
|
377531
|
+
let text = contentText(m.content) ?? null;
|
|
377532
|
+
if (Array.isArray(m.tool_calls) ?? null) {
|
|
377533
|
+
for (const c2 of m.tool_calls) {
|
|
377534
|
+
text = text + "\n\u2192 " + (c2["function"] ?? null).name + " " + (c2["function"] ?? null).arguments;
|
|
377535
|
+
}
|
|
377536
|
+
}
|
|
377537
|
+
lines2.push("[" + m.role + (((__v) => __v == null ? "null" : typeof __v)(m.name) === "string" ? " " + m.name : "") + "] " + text) ?? null;
|
|
377538
|
+
}
|
|
377539
|
+
let all4 = lines2.join("\n\n") ?? null;
|
|
377540
|
+
return all4.length > maxChars ? "\u2026" + (all4.slice(all4.length - maxChars) ?? null) : all4;
|
|
377541
|
+
}
|
|
377542
|
+
}
|
|
377543
|
+
function parseAdvice(text) {
|
|
377544
|
+
{
|
|
377545
|
+
let t3 = text.trim() ?? null;
|
|
377546
|
+
let start2 = t3.indexOf("{") ?? null;
|
|
377547
|
+
let end = t3.lastIndexOf("}") ?? null;
|
|
377548
|
+
if (start2 >= 0 && end > start2) {
|
|
377549
|
+
try {
|
|
377550
|
+
{
|
|
377551
|
+
let j = JSON.parse(t3.slice(start2, end + 1) ?? null) ?? null;
|
|
377552
|
+
let advice = Array.isArray(j.advice) ?? null ? j.advice.filter((a) => {
|
|
377553
|
+
{
|
|
377554
|
+
return ((__v) => __v == null ? "null" : typeof __v)(a) === "string" && (a.trim() ?? null) !== "";
|
|
377555
|
+
}
|
|
377556
|
+
}) ?? null : [];
|
|
377557
|
+
return { verdict: j.verdict === "ok" ? "ok" : "revise", advice };
|
|
377558
|
+
}
|
|
377559
|
+
} catch (e) {
|
|
377560
|
+
{
|
|
377561
|
+
}
|
|
377562
|
+
}
|
|
377563
|
+
}
|
|
377564
|
+
return { verdict: t3 === "" ? "ok" : "revise", advice: t3 === "" ? [] : [t3] };
|
|
377565
|
+
}
|
|
377566
|
+
}
|
|
377567
|
+
function createAdvisor(opts) {
|
|
377568
|
+
{
|
|
377569
|
+
let call2 = roleModel(opts.callModel, opts.spec) ?? null;
|
|
377570
|
+
let maxCalls = ((__v) => __v == null ? "null" : typeof __v)(opts.maxCalls) === "number" ? opts.maxCalls : 8;
|
|
377571
|
+
let maxChars = ((__v) => __v == null ? "null" : typeof __v)(opts.maxChars) === "number" ? opts.maxChars : 6e5;
|
|
377572
|
+
let triggers = opts.triggers ?? {};
|
|
377573
|
+
let calls = 0;
|
|
377574
|
+
let tokensRead = 0;
|
|
377575
|
+
let emit6 = (e) => {
|
|
377576
|
+
{
|
|
377577
|
+
if (((__v) => __v == null ? "null" : typeof __v)(opts.onEvent) === "function") {
|
|
377578
|
+
opts.onEvent(e) ?? null;
|
|
377579
|
+
}
|
|
377580
|
+
}
|
|
377581
|
+
};
|
|
377582
|
+
return { stats: () => {
|
|
377583
|
+
{
|
|
377584
|
+
return { calls, tokensRead };
|
|
377585
|
+
}
|
|
377586
|
+
}, advise: async (req) => {
|
|
377587
|
+
{
|
|
377588
|
+
if ((triggers[req.trigger] ?? null) === false || calls >= maxCalls) {
|
|
377589
|
+
return null;
|
|
377590
|
+
}
|
|
377591
|
+
let transcript = renderTranscript(req.messages, maxChars) ?? null;
|
|
377592
|
+
calls = calls + 1;
|
|
377593
|
+
tokensRead = tokensRead + (Math.ceil(transcript.length / 4) ?? null);
|
|
377594
|
+
emit6({ type: "advisor:call", trigger: req.trigger, model: opts.spec.model, calls, tokensRead }) ?? null;
|
|
377595
|
+
let ask2 = (TRIGGER_ASK[req.trigger] ?? null) + (((__v) => __v == null ? "null" : typeof __v)(req.detail) === "string" && req.detail !== "" ? "\n\n" + req.detail : "");
|
|
377596
|
+
let turn = null;
|
|
377597
|
+
try {
|
|
377598
|
+
{
|
|
377599
|
+
turn = await (call2([{ role: "system", content: ((__v) => __v == null ? "null" : typeof __v)(opts.guidance) === "string" && (opts.guidance.trim() ?? null) !== "" ? ADVISOR_PROMPT + "\n\nGuidance for this kind of task:\n" + (opts.guidance.trim() ?? null) : ADVISOR_PROMPT }, { role: "user", content: "The session so far:\n\n" + transcript + "\n\n---\n" + ask2 }], [], {}, null, null) ?? null);
|
|
377600
|
+
}
|
|
377601
|
+
} catch (err2) {
|
|
377602
|
+
{
|
|
377603
|
+
return null;
|
|
377604
|
+
}
|
|
377605
|
+
}
|
|
377606
|
+
let parsed2 = parseAdvice(turn.text ?? "") ?? null;
|
|
377607
|
+
emit6({ type: "advisor:advice", trigger: req.trigger, model: opts.spec.model, calls, tokensRead, advice: parsed2.advice, verdict: parsed2.verdict }) ?? null;
|
|
377608
|
+
if (parsed2.verdict === "ok" || parsed2.advice.length === 0) {
|
|
377609
|
+
return null;
|
|
377610
|
+
}
|
|
377611
|
+
return "Advisor (" + req.trigger + "):\n" + ((parsed2.advice.map((a) => {
|
|
377612
|
+
{
|
|
377613
|
+
return "\xBB " + a;
|
|
377614
|
+
}
|
|
377615
|
+
}) ?? null).join("\n") ?? null);
|
|
377616
|
+
}
|
|
377617
|
+
} };
|
|
377618
|
+
}
|
|
377619
|
+
}
|
|
377620
|
+
function errorSignature(run4) {
|
|
377621
|
+
{
|
|
377622
|
+
let s = (run4.summary ?? "").toLowerCase() ?? null;
|
|
377623
|
+
let out = "";
|
|
377624
|
+
for (const ch of s) {
|
|
377625
|
+
out = out + (ch >= "0" && ch <= "9" ? "#" : ch);
|
|
377626
|
+
}
|
|
377627
|
+
return run4.name + ":" + (out.slice(0, 200) ?? null);
|
|
377628
|
+
}
|
|
377629
|
+
}
|
|
377630
|
+
var REPEATED_ERROR_COUNT, ADVISOR_PROMPT, TRIGGER_ASK;
|
|
377631
|
+
var init_advisor = __esm({
|
|
377632
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/advisor.js"() {
|
|
377633
|
+
init_roles();
|
|
377634
|
+
REPEATED_ERROR_COUNT = 2;
|
|
377635
|
+
ADVISOR_PROMPT = ["You are the advisor to a coding agent (the lead). You read its whole session and give it short, specific advice. You never write code or call tools yourself.", 'Answer with JSON only: {"verdict": "ok" | "revise", "advice": ["..."]}. At most 4 advice items, each one sentence, concrete (files, commands, the likely cause).', 'Use "ok" with no advice when the lead is on track \u2014 do not add advice for its own sake.'].join("\n") ?? null;
|
|
377636
|
+
TRIGGER_ASK = { plan: "The lead is about to plan. Point out anything it should know before choosing an approach.", done: "The lead is about to say it is done. Check the work against the request: anything missing, wrong or unverified?", error: "The lead hit the same error again. Diagnose the likely cause and the next thing to try.", ask: "The lead asked for your advice." };
|
|
377637
|
+
}
|
|
377638
|
+
});
|
|
377639
|
+
|
|
377640
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/context.js
|
|
377291
377641
|
function sizeOf2(messages) {
|
|
377292
377642
|
{
|
|
377293
377643
|
return (JSON.stringify(messages) ?? null).length;
|
|
@@ -377425,13 +377775,13 @@ async function compactTranscript(messages, opts) {
|
|
|
377425
377775
|
}
|
|
377426
377776
|
var RENDER_TURN_PREFIX, KEEP_IMAGE_TURNS;
|
|
377427
377777
|
var init_context2 = __esm({
|
|
377428
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
377778
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/context.js"() {
|
|
377429
377779
|
RENDER_TURN_PREFIX = "Result of ";
|
|
377430
377780
|
KEEP_IMAGE_TURNS = 2;
|
|
377431
377781
|
}
|
|
377432
377782
|
});
|
|
377433
377783
|
|
|
377434
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
377784
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/loop.js
|
|
377435
377785
|
function batchCalls(calls, isParallel, max3) {
|
|
377436
377786
|
{
|
|
377437
377787
|
let batches = [];
|
|
@@ -377622,7 +377972,36 @@ async function runAgentLoop(opts) {
|
|
|
377622
377972
|
}
|
|
377623
377973
|
}
|
|
377624
377974
|
};
|
|
377975
|
+
let advise = ((__v) => __v == null ? "null" : typeof __v)(opts.advise) === "function" ? opts.advise : null;
|
|
377976
|
+
let route2 = ((__v) => __v == null ? "null" : typeof __v)(opts.route) === "function" ? opts.route : null;
|
|
377977
|
+
let errorCounts = /* @__PURE__ */ new Map() ?? null;
|
|
377978
|
+
let doneChecked = false;
|
|
377979
|
+
let consult = async (trigger, detail) => {
|
|
377980
|
+
{
|
|
377981
|
+
if (advise == null) {
|
|
377982
|
+
return false;
|
|
377983
|
+
}
|
|
377984
|
+
let note2 = null;
|
|
377985
|
+
try {
|
|
377986
|
+
{
|
|
377987
|
+
note2 = await (advise({ trigger, messages: messages.slice() ?? null, detail }) ?? null);
|
|
377988
|
+
}
|
|
377989
|
+
} catch (e) {
|
|
377990
|
+
{
|
|
377991
|
+
note2 = null;
|
|
377992
|
+
}
|
|
377993
|
+
}
|
|
377994
|
+
if (((__v) => __v == null ? "null" : typeof __v)(note2) !== "string" || note2 === "") {
|
|
377995
|
+
return false;
|
|
377996
|
+
}
|
|
377997
|
+
messages.push({ role: "user", content: note2 }) ?? null;
|
|
377998
|
+
return true;
|
|
377999
|
+
}
|
|
378000
|
+
};
|
|
377625
378001
|
let round5 = ((__v) => __v == null ? "null" : typeof __v)(resume.round) === "number" ? resume.round : 0;
|
|
378002
|
+
if (round5 === 0) {
|
|
378003
|
+
await (consult("plan", null) ?? null);
|
|
378004
|
+
}
|
|
377626
378005
|
while (maxRounds === 0 || round5 < maxRounds) {
|
|
377627
378006
|
if (isStopped() ?? null) {
|
|
377628
378007
|
await (save(round5, true) ?? null);
|
|
@@ -377640,7 +378019,19 @@ async function runAgentLoop(opts) {
|
|
|
377640
378019
|
if (onStart != null) {
|
|
377641
378020
|
onStart(round5) ?? null;
|
|
377642
378021
|
}
|
|
377643
|
-
let
|
|
378022
|
+
let choice = choiceFor(round5) ?? null;
|
|
378023
|
+
if (choice == null && route2 != null && specs.length > 0) {
|
|
378024
|
+
try {
|
|
378025
|
+
{
|
|
378026
|
+
choice = await (route2({ round: round5, messages: messages.slice() ?? null, tools: specs }) ?? null);
|
|
378027
|
+
}
|
|
378028
|
+
} catch (e) {
|
|
378029
|
+
{
|
|
378030
|
+
choice = null;
|
|
378031
|
+
}
|
|
378032
|
+
}
|
|
378033
|
+
}
|
|
378034
|
+
let turn = await (call2(messages, specs, choice ?? null) ?? null);
|
|
377644
378035
|
text = turn.text;
|
|
377645
378036
|
let toolCalls = Array.isArray(turn.toolCalls) ?? null ? turn.toolCalls : [];
|
|
377646
378037
|
if (toolCalls.length > 0) {
|
|
@@ -377665,6 +378056,14 @@ async function runAgentLoop(opts) {
|
|
|
377665
378056
|
round5 = round5 + 1;
|
|
377666
378057
|
continue;
|
|
377667
378058
|
}
|
|
378059
|
+
if (!doneChecked) {
|
|
378060
|
+
doneChecked = true;
|
|
378061
|
+
if (await (consult("done", null) ?? null)) {
|
|
378062
|
+
await (save(round5 + 1, false) ?? null);
|
|
378063
|
+
round5 = round5 + 1;
|
|
378064
|
+
continue;
|
|
378065
|
+
}
|
|
378066
|
+
}
|
|
377668
378067
|
if (require3 != null && !acted && nudgesLeft > 0 && actingNames.size > 0) {
|
|
377669
378068
|
nudgesLeft = nudgesLeft - 1;
|
|
377670
378069
|
let nudge = ((__v) => __v == null ? "null" : typeof __v)(require3.message) === "string" ? require3.message : DEFAULT_ACTION_NUDGE;
|
|
@@ -377686,6 +378085,8 @@ async function runAgentLoop(opts) {
|
|
|
377686
378085
|
}
|
|
377687
378086
|
}) ?? null;
|
|
377688
378087
|
let imageTurns = [];
|
|
378088
|
+
let repeated = [];
|
|
378089
|
+
doneChecked = false;
|
|
377689
378090
|
for (const batch of batchCalls(calls, (n) => {
|
|
377690
378091
|
{
|
|
377691
378092
|
return parallelNames.has(n) ?? null;
|
|
@@ -377734,6 +378135,14 @@ async function runAgentLoop(opts) {
|
|
|
377734
378135
|
if (onToolEnd != null) {
|
|
377735
378136
|
onToolEnd(run4) ?? null;
|
|
377736
378137
|
}
|
|
378138
|
+
if (run4.ok !== true && advise != null) {
|
|
378139
|
+
let sig = errorSignature(run4) ?? null;
|
|
378140
|
+
let n = (errorCounts.get(sig) ?? null ?? 0) + 1;
|
|
378141
|
+
errorCounts.set(sig, n) ?? null;
|
|
378142
|
+
if (n === REPEATED_ERROR_COUNT) {
|
|
378143
|
+
repeated.push(run4.name + ": " + run4.summary) ?? null;
|
|
378144
|
+
}
|
|
378145
|
+
}
|
|
377737
378146
|
messages.push({ role: "tool", tool_call_id: run4.id, name: run4.name, content: truncateResult(run4.content, maxResultChars) ?? null }) ?? null;
|
|
377738
378147
|
if ((Array.isArray(run4.images) ?? null) && run4.images.length > 0) {
|
|
377739
378148
|
let label3 = run4.images.length === 1 ? "the rendered view" : (String(run4.images.length) ?? null) + " rendered views";
|
|
@@ -377748,6 +378157,9 @@ async function runAgentLoop(opts) {
|
|
|
377748
378157
|
for (const m of imageTurns) {
|
|
377749
378158
|
messages.push(m) ?? null;
|
|
377750
378159
|
}
|
|
378160
|
+
for (const err2 of repeated) {
|
|
378161
|
+
await (consult("error", "The error, seen " + (String(REPEATED_ERROR_COUNT) ?? null) + " times: " + err2) ?? null);
|
|
378162
|
+
}
|
|
377751
378163
|
let onRoundEnd = hook(hooks, "onRoundEnd") ?? null;
|
|
377752
378164
|
if (onRoundEnd != null) {
|
|
377753
378165
|
onRoundEnd(round5) ?? null;
|
|
@@ -377764,7 +378176,8 @@ async function runAgentLoop(opts) {
|
|
|
377764
378176
|
}
|
|
377765
378177
|
var DEFAULT_MAX_ROUNDS, DEFAULT_MAX_PARALLEL, DEFAULT_ACTION_NUDGE, RENDER_TURN_PREFIX2, RECOVERABLE_WORDS;
|
|
377766
378178
|
var init_loop = __esm({
|
|
377767
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378179
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/loop.js"() {
|
|
378180
|
+
init_advisor();
|
|
377768
378181
|
init_context2();
|
|
377769
378182
|
DEFAULT_MAX_ROUNDS = 40;
|
|
377770
378183
|
DEFAULT_MAX_PARALLEL = 4;
|
|
@@ -377774,7 +378187,7 @@ var init_loop = __esm({
|
|
|
377774
378187
|
}
|
|
377775
378188
|
});
|
|
377776
378189
|
|
|
377777
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378190
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/runtime.js
|
|
377778
378191
|
function isBusy(s) {
|
|
377779
378192
|
{
|
|
377780
378193
|
return s != null && (s.status === "running" || s.status === "queued");
|
|
@@ -377818,7 +378231,17 @@ function createAgentRuntime(host) {
|
|
|
377818
378231
|
let waiting3 = [];
|
|
377819
378232
|
let listeners9 = [];
|
|
377820
378233
|
let pendingSaves = 0;
|
|
377821
|
-
let
|
|
378234
|
+
let orch = host.orchestration ?? null;
|
|
378235
|
+
let maxConcurrent = () => {
|
|
378236
|
+
{
|
|
378237
|
+
let h = ((__v) => __v == null ? "null" : typeof __v)(host.maxConcurrent) === "function" ? host.maxConcurrent() ?? null : host.maxConcurrent;
|
|
378238
|
+
if (((__v) => __v == null ? "null" : typeof __v)(h) === "number" && h > 0) {
|
|
378239
|
+
return h;
|
|
378240
|
+
}
|
|
378241
|
+
let o = orch != null ? orch.maxConcurrent ?? null : null;
|
|
378242
|
+
return ((__v) => __v == null ? "null" : typeof __v)(o) === "number" && o > 0 ? o : 4;
|
|
378243
|
+
}
|
|
378244
|
+
};
|
|
377822
378245
|
let now3 = () => {
|
|
377823
378246
|
{
|
|
377824
378247
|
return ((__v) => __v == null ? "null" : typeof __v)(host.now) === "function" ? host.now() ?? null : Date.now() ?? null;
|
|
@@ -377907,6 +378330,9 @@ function createAgentRuntime(host) {
|
|
|
377907
378330
|
let ctx2 = { session: session3, profile, readOnly: forceReadOnly || profile.readOnly === true, signal: control.signal };
|
|
377908
378331
|
let tools = (host.childTools(ctx2) ?? null).concat([REPORT_SPEC]) ?? null;
|
|
377909
378332
|
let childModel = ((__v) => __v == null ? "null" : typeof __v)(host.childModel) === "function" ? host.childModel(ctx2) ?? null : null;
|
|
378333
|
+
if (((__v) => __v == null ? "null" : typeof __v)(childModel) !== "function" && orch != null) {
|
|
378334
|
+
childModel = orch.childModel(ctx2.readOnly && (profile.model ?? null) == null ? "fast" : profile.model ?? null) ?? null;
|
|
378335
|
+
}
|
|
377910
378336
|
let budget = ((__v) => __v == null ? "null" : typeof __v)(profile.maxRounds) === "number" && profile.maxRounds > 0 ? profile.maxRounds : ((__v) => __v == null ? "null" : typeof __v)(host.maxRounds) === "number" && host.maxRounds > 0 ? host.maxRounds : 30;
|
|
377911
378337
|
let ok2 = true;
|
|
377912
378338
|
let summary = "";
|
|
@@ -378025,10 +378451,10 @@ function createAgentRuntime(host) {
|
|
|
378025
378451
|
{
|
|
378026
378452
|
}
|
|
378027
378453
|
}
|
|
378028
|
-
job = takeNext() ?? null;
|
|
378454
|
+
job = active4 <= (maxConcurrent() ?? null) ? takeNext() ?? null : null;
|
|
378029
378455
|
if (job == null) {
|
|
378030
378456
|
active4 = Math.max(0, active4 - 1) ?? null;
|
|
378031
|
-
if (waiting3.length > 0 && active4 < maxConcurrent) {
|
|
378457
|
+
if (waiting3.length > 0 && active4 < (maxConcurrent() ?? null)) {
|
|
378032
378458
|
active4 = active4 + 1;
|
|
378033
378459
|
job = takeNext() ?? null;
|
|
378034
378460
|
if (job == null) {
|
|
@@ -378043,7 +378469,15 @@ function createAgentRuntime(host) {
|
|
|
378043
378469
|
};
|
|
378044
378470
|
let startBackground = (session3, go) => {
|
|
378045
378471
|
{
|
|
378046
|
-
|
|
378472
|
+
while (waiting3.length > 0 && active4 < (maxConcurrent() ?? null)) {
|
|
378473
|
+
let next2 = takeNext() ?? null;
|
|
378474
|
+
if (next2 == null) {
|
|
378475
|
+
break;
|
|
378476
|
+
}
|
|
378477
|
+
active4 = active4 + 1;
|
|
378478
|
+
runSlot(next2) ?? null;
|
|
378479
|
+
}
|
|
378480
|
+
if (active4 < (maxConcurrent() ?? null)) {
|
|
378047
378481
|
active4 = active4 + 1;
|
|
378048
378482
|
runSlot({ session: session3, go }) ?? null;
|
|
378049
378483
|
return;
|
|
@@ -378234,7 +378668,7 @@ function createAgentRuntime(host) {
|
|
|
378234
378668
|
}
|
|
378235
378669
|
var delay2, REPORT_TOOL, REPORT_SPEC, WAIT_STEP_MS;
|
|
378236
378670
|
var init_runtime5 = __esm({
|
|
378237
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378671
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/runtime.js"() {
|
|
378238
378672
|
init_loop();
|
|
378239
378673
|
delay2 = ((ms3) => new Promise((settle4) => setTimeout(() => settle4(null), Math.max(0, Number(ms3) || 0))));
|
|
378240
378674
|
REPORT_TOOL = "report_to_parent";
|
|
@@ -378243,44 +378677,44 @@ var init_runtime5 = __esm({
|
|
|
378243
378677
|
}
|
|
378244
378678
|
});
|
|
378245
378679
|
|
|
378246
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378680
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/types.js
|
|
378247
378681
|
function forceTool(name2) {
|
|
378248
378682
|
{
|
|
378249
378683
|
return { type: "function", function: { name: name2 } };
|
|
378250
378684
|
}
|
|
378251
378685
|
}
|
|
378252
378686
|
var init_types9 = __esm({
|
|
378253
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378687
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/types.js"() {
|
|
378254
378688
|
}
|
|
378255
378689
|
});
|
|
378256
378690
|
|
|
378257
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378258
|
-
var
|
|
378259
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378691
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/orchestration.js
|
|
378692
|
+
var init_orchestration2 = __esm({
|
|
378693
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/orchestration.js"() {
|
|
378260
378694
|
}
|
|
378261
378695
|
});
|
|
378262
378696
|
|
|
378263
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378697
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/profiles.js
|
|
378264
378698
|
var ORCHESTRATOR_GUIDANCE;
|
|
378265
378699
|
var init_profiles2 = __esm({
|
|
378266
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378700
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/profiles.js"() {
|
|
378267
378701
|
ORCHESTRATOR_GUIDANCE = ["You orchestrate agents. For anything beyond a small edit:", "1. Plan: break the request into steps (a planner agent for big requests).", "2. Do: hand independent steps to agents in parallel (builder for changes, explorer to find things); do small steps yourself.", "3. Check: when the work is done, have a reviewer agent check it against the request.", "4. Repeat: on FAIL, send the fixes to the agent that built it (send_message keeps its context) and review again \u2014 at most three rounds \u2014 then report honestly what is still wrong.", "Steer running agents with send_message, stop ones going wrong with stop_agent, and answer their reports. Finish only when the work is done and checked."].join("\n") ?? null;
|
|
378268
378702
|
}
|
|
378269
378703
|
});
|
|
378270
378704
|
|
|
378271
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378705
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/supervisor.js
|
|
378272
378706
|
var init_supervisor = __esm({
|
|
378273
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378707
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/supervisor.js"() {
|
|
378274
378708
|
}
|
|
378275
378709
|
});
|
|
378276
378710
|
|
|
378277
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378711
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/todos.js
|
|
378278
378712
|
var init_todos = __esm({
|
|
378279
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378713
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/todos.js"() {
|
|
378280
378714
|
}
|
|
378281
378715
|
});
|
|
378282
378716
|
|
|
378283
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378717
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/store.js
|
|
378284
378718
|
async function loadAll(kv, prefix) {
|
|
378285
378719
|
{
|
|
378286
378720
|
let out = [];
|
|
@@ -378334,11 +378768,11 @@ function runStore(kv, scope) {
|
|
|
378334
378768
|
}
|
|
378335
378769
|
}
|
|
378336
378770
|
var init_store = __esm({
|
|
378337
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378771
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/store.js"() {
|
|
378338
378772
|
}
|
|
378339
378773
|
});
|
|
378340
378774
|
|
|
378341
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378775
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/run.js
|
|
378342
378776
|
function errorMessage3(err2) {
|
|
378343
378777
|
{
|
|
378344
378778
|
if (err2 != null && ((__v) => __v == null ? "null" : typeof __v)(err2) === "object" && ((__v) => __v == null ? "null" : typeof __v)(err2.message) === "string") {
|
|
@@ -378422,29 +378856,327 @@ async function resumeRun(id3, runs2, options) {
|
|
|
378422
378856
|
}
|
|
378423
378857
|
}
|
|
378424
378858
|
var init_run = __esm({
|
|
378425
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378859
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/run.js"() {
|
|
378426
378860
|
init_loop();
|
|
378427
378861
|
}
|
|
378428
378862
|
});
|
|
378429
378863
|
|
|
378430
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378864
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/router.js
|
|
378865
|
+
function createRouter(opts) {
|
|
378866
|
+
{
|
|
378867
|
+
let call2 = roleModel(opts.callModel, opts.spec) ?? null;
|
|
378868
|
+
let threshold = ((__v) => __v == null ? "null" : typeof __v)(opts.threshold) === "number" ? opts.threshold : 0.8;
|
|
378869
|
+
let maxChars = ((__v) => __v == null ? "null" : typeof __v)(opts.maxChars) === "number" ? opts.maxChars : 12e3;
|
|
378870
|
+
return async (req) => {
|
|
378871
|
+
{
|
|
378872
|
+
if (!(Array.isArray(req.tools) ?? null) || req.tools.length === 0) {
|
|
378873
|
+
return null;
|
|
378874
|
+
}
|
|
378875
|
+
let names = req.tools.map((t4) => {
|
|
378876
|
+
{
|
|
378877
|
+
return (t4["function"] ?? null).name;
|
|
378878
|
+
}
|
|
378879
|
+
}) ?? null;
|
|
378880
|
+
let turn = null;
|
|
378881
|
+
try {
|
|
378882
|
+
{
|
|
378883
|
+
turn = await (call2([{ role: "system", content: ROUTER_PROMPT }, { role: "user", content: "Tools: " + (names.join(", ") ?? null) + "\n\nRecent session:\n" + (renderTranscript(req.messages, maxChars) ?? null) }], [], {}, null, null) ?? null);
|
|
378884
|
+
}
|
|
378885
|
+
} catch (err2) {
|
|
378886
|
+
{
|
|
378887
|
+
return null;
|
|
378888
|
+
}
|
|
378889
|
+
}
|
|
378890
|
+
let tool2 = null;
|
|
378891
|
+
let p2 = 0;
|
|
378892
|
+
let t3 = (turn.text ?? "").trim() ?? null;
|
|
378893
|
+
let start2 = t3.indexOf("{") ?? null;
|
|
378894
|
+
let end = t3.lastIndexOf("}") ?? null;
|
|
378895
|
+
if (start2 >= 0 && end > start2) {
|
|
378896
|
+
try {
|
|
378897
|
+
{
|
|
378898
|
+
let j = JSON.parse(t3.slice(start2, end + 1) ?? null) ?? null;
|
|
378899
|
+
if (((__v) => __v == null ? "null" : typeof __v)(j.tool) === "string" && (names.includes(j.tool) ?? null)) {
|
|
378900
|
+
tool2 = j.tool;
|
|
378901
|
+
}
|
|
378902
|
+
if (((__v) => __v == null ? "null" : typeof __v)(j.p) === "number") {
|
|
378903
|
+
p2 = j.p;
|
|
378904
|
+
}
|
|
378905
|
+
}
|
|
378906
|
+
} catch (e) {
|
|
378907
|
+
{
|
|
378908
|
+
}
|
|
378909
|
+
}
|
|
378910
|
+
}
|
|
378911
|
+
let sharp = tool2 != null && p2 >= threshold;
|
|
378912
|
+
if (((__v) => __v == null ? "null" : typeof __v)(opts.onEvent) === "function") {
|
|
378913
|
+
opts.onEvent({ type: "router:pick", round: req.round, model: opts.spec.model, tool: tool2, p: p2, sharp }) ?? null;
|
|
378914
|
+
}
|
|
378915
|
+
return sharp ? forceTool(tool2) ?? null : null;
|
|
378916
|
+
}
|
|
378917
|
+
};
|
|
378918
|
+
}
|
|
378919
|
+
}
|
|
378920
|
+
var ROUTER_PROMPT;
|
|
378921
|
+
var init_router = __esm({
|
|
378922
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/router.js"() {
|
|
378923
|
+
init_types9();
|
|
378924
|
+
init_roles();
|
|
378925
|
+
init_advisor();
|
|
378926
|
+
ROUTER_PROMPT = 'You pick the next tool for a coding agent. Answer with JSON only: {"tool": "<one of the tool names, or none>", "p": <your confidence 0..1>}. Pick "none" when the agent should answer in words or the choice is unclear.';
|
|
378927
|
+
}
|
|
378928
|
+
});
|
|
378929
|
+
|
|
378930
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/auto.js
|
|
378931
|
+
function normalizeMode(mode2) {
|
|
378932
|
+
{
|
|
378933
|
+
if (mode2 === "off" || mode2 === false) {
|
|
378934
|
+
return "off";
|
|
378935
|
+
}
|
|
378936
|
+
if (mode2 === "ultra") {
|
|
378937
|
+
return "ultra";
|
|
378938
|
+
}
|
|
378939
|
+
return "auto";
|
|
378940
|
+
}
|
|
378941
|
+
}
|
|
378942
|
+
function createOrchestration(callModel, opts) {
|
|
378943
|
+
{
|
|
378944
|
+
let o = opts ?? {};
|
|
378945
|
+
let mode2 = normalizeMode(o.mode ?? "auto") ?? null;
|
|
378946
|
+
let skill = o.skill != null && ((__v) => __v == null ? "null" : typeof __v)(o.skill) === "object" ? o.skill : null;
|
|
378947
|
+
let catalog2 = o.catalog ?? null;
|
|
378948
|
+
let emit6 = (e) => {
|
|
378949
|
+
{
|
|
378950
|
+
if (((__v) => __v == null ? "null" : typeof __v)(o.onEvent) === "function") {
|
|
378951
|
+
o.onEvent(e) ?? null;
|
|
378952
|
+
}
|
|
378953
|
+
}
|
|
378954
|
+
};
|
|
378955
|
+
let hostLimit = ((__v) => __v == null ? "null" : typeof __v)(o.maxConcurrent) === "number" ? o.maxConcurrent : null;
|
|
378956
|
+
if (mode2 === "off" || skill == null) {
|
|
378957
|
+
return { mode: mode2, skill: null, roles: {}, maxConcurrent: hostLimit, guidance: "", callModel, childModel: (m) => {
|
|
378958
|
+
{
|
|
378959
|
+
return null;
|
|
378960
|
+
}
|
|
378961
|
+
}, advise: null, route: null };
|
|
378962
|
+
}
|
|
378963
|
+
emit6({ type: "skill", skill: skill.name }) ?? null;
|
|
378964
|
+
let roles = mergeRoles(skill.roles, o.roles ?? null) ?? null;
|
|
378965
|
+
if (((__v) => __v == null ? "null" : typeof __v)(o.effort) === "string" && (roles.lead ?? null) != null) {
|
|
378966
|
+
roles = mergeRoles(roles, { lead: { effort: o.effort } }) ?? null;
|
|
378967
|
+
}
|
|
378968
|
+
let specs = {};
|
|
378969
|
+
let calls = {};
|
|
378970
|
+
let callFor = (role) => {
|
|
378971
|
+
{
|
|
378972
|
+
if ((calls[role] ?? null ?? null) == null) {
|
|
378973
|
+
let spec = resolveRole(role, roles, catalog2) ?? null;
|
|
378974
|
+
if (spec == null) {
|
|
378975
|
+
return null;
|
|
378976
|
+
}
|
|
378977
|
+
specs[role] = spec;
|
|
378978
|
+
calls[role] = roleModel(callModel, spec) ?? null;
|
|
378979
|
+
emit6({ type: "role:model", role, model: spec.model }) ?? null;
|
|
378980
|
+
}
|
|
378981
|
+
return calls[role] ?? null;
|
|
378982
|
+
}
|
|
378983
|
+
};
|
|
378984
|
+
let lead = callFor("lead") ?? null ?? callModel;
|
|
378985
|
+
let advise = null;
|
|
378986
|
+
let route2 = null;
|
|
378987
|
+
if ((callFor("advisor") ?? null) != null) {
|
|
378988
|
+
let triggers = null;
|
|
378989
|
+
if (Array.isArray(skill.advisorTriggers) ?? null) {
|
|
378990
|
+
triggers = { plan: skill.advisorTriggers.includes("plan") ?? null, done: skill.advisorTriggers.includes("done") ?? null, error: skill.advisorTriggers.includes("error") ?? null, ask: skill.advisorTriggers.includes("ask") ?? null };
|
|
378991
|
+
}
|
|
378992
|
+
advise = (createAdvisor({ callModel, spec: specs.advisor, triggers, maxCalls: skill.advisorMaxCalls ?? null, maxChars: null, guidance: skill.guidance, onEvent: (e) => {
|
|
378993
|
+
{
|
|
378994
|
+
emit6(e) ?? null;
|
|
378995
|
+
}
|
|
378996
|
+
} }) ?? null).advise;
|
|
378997
|
+
}
|
|
378998
|
+
if (((__v) => __v == null ? "null" : typeof __v)(skill.routerThreshold) === "number" && (callFor("router") ?? null) != null) {
|
|
378999
|
+
route2 = createRouter({ callModel, spec: specs.router, threshold: skill.routerThreshold, onEvent: (e) => {
|
|
379000
|
+
{
|
|
379001
|
+
emit6(e) ?? null;
|
|
379002
|
+
}
|
|
379003
|
+
} }) ?? null;
|
|
379004
|
+
}
|
|
379005
|
+
return { mode: mode2, skill, roles, maxConcurrent: hostLimit ?? skill.maxConcurrent ?? null, guidance: skill.guidance, callModel: lead, childModel: (profileModel) => {
|
|
379006
|
+
{
|
|
379007
|
+
let role = roleOfProfileModel(profileModel) ?? null;
|
|
379008
|
+
if (role == null) {
|
|
379009
|
+
return roleModel(callModel, { model: profileModel, effort: (specs.lead ?? {}).effort ?? null, fallback: null }) ?? null;
|
|
379010
|
+
}
|
|
379011
|
+
return callFor(role) ?? null ?? lead;
|
|
379012
|
+
}
|
|
379013
|
+
}, advise, route: route2 };
|
|
379014
|
+
}
|
|
379015
|
+
}
|
|
379016
|
+
var init_auto = __esm({
|
|
379017
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/auto.js"() {
|
|
379018
|
+
init_roles();
|
|
379019
|
+
init_advisor();
|
|
379020
|
+
init_router();
|
|
379021
|
+
}
|
|
379022
|
+
});
|
|
379023
|
+
|
|
379024
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/orchestration-skill.js
|
|
379025
|
+
function splitList(v) {
|
|
379026
|
+
{
|
|
379027
|
+
if ((v ?? null) == null) {
|
|
379028
|
+
return [];
|
|
379029
|
+
}
|
|
379030
|
+
return ((v.split(",") ?? null).map((s) => {
|
|
379031
|
+
{
|
|
379032
|
+
return s.trim() ?? null;
|
|
379033
|
+
}
|
|
379034
|
+
}) ?? null).filter((s) => {
|
|
379035
|
+
{
|
|
379036
|
+
return s !== "";
|
|
379037
|
+
}
|
|
379038
|
+
}) ?? null;
|
|
379039
|
+
}
|
|
379040
|
+
}
|
|
379041
|
+
function unquote(v) {
|
|
379042
|
+
{
|
|
379043
|
+
let t3 = v.trim() ?? null;
|
|
379044
|
+
if (t3.length >= 2 && ((t3.startsWith('"') ?? null) && (t3.endsWith('"') ?? null) || (t3.startsWith("'") ?? null) && (t3.endsWith("'") ?? null))) {
|
|
379045
|
+
return t3.slice(1, t3.length - 1) ?? null;
|
|
379046
|
+
}
|
|
379047
|
+
return t3;
|
|
379048
|
+
}
|
|
379049
|
+
}
|
|
379050
|
+
function num11(v) {
|
|
379051
|
+
{
|
|
379052
|
+
if ((v ?? null) == null || v === "") {
|
|
379053
|
+
return null;
|
|
379054
|
+
}
|
|
379055
|
+
let n = Number(v) ?? null;
|
|
379056
|
+
return Number.isFinite(n) ?? null ? n : null;
|
|
379057
|
+
}
|
|
379058
|
+
}
|
|
379059
|
+
function parseOrchestrationSkill(text) {
|
|
379060
|
+
{
|
|
379061
|
+
let src = ((__v) => __v == null ? "null" : typeof __v)(text) === "string" ? (text.split("\r\n") ?? null).join("\n") ?? null : "";
|
|
379062
|
+
if (!(src.startsWith("---\n") ?? null)) {
|
|
379063
|
+
return null;
|
|
379064
|
+
}
|
|
379065
|
+
let end = src.indexOf("\n---", 4) ?? null;
|
|
379066
|
+
if (end < 0) {
|
|
379067
|
+
return null;
|
|
379068
|
+
}
|
|
379069
|
+
let head2 = src.slice(4, end) ?? null;
|
|
379070
|
+
let body = src.slice(end + 4) ?? null;
|
|
379071
|
+
if (body.startsWith("\n") ?? null) {
|
|
379072
|
+
body = body.slice(1) ?? null;
|
|
379073
|
+
}
|
|
379074
|
+
let f2 = {};
|
|
379075
|
+
for (const line of head2.split("\n") ?? null) {
|
|
379076
|
+
let i2 = line.indexOf(":") ?? null;
|
|
379077
|
+
if (i2 <= 0 || ((line.trim() ?? null).startsWith("#") ?? null)) {
|
|
379078
|
+
continue;
|
|
379079
|
+
}
|
|
379080
|
+
f2[((line.slice(0, i2) ?? null).trim() ?? null).toLowerCase() ?? null] = unquote(line.slice(i2 + 1) ?? null) ?? null;
|
|
379081
|
+
}
|
|
379082
|
+
if ((f2["kind"] ?? null ?? "") !== "orchestration") {
|
|
379083
|
+
return null;
|
|
379084
|
+
}
|
|
379085
|
+
let roles = {};
|
|
379086
|
+
for (const r of MODEL_ROLES) {
|
|
379087
|
+
let model = f2[r] ?? null ?? "";
|
|
379088
|
+
if (model === "") {
|
|
379089
|
+
continue;
|
|
379090
|
+
}
|
|
379091
|
+
let spec = { model, effort: (f2[r + "_effort"] ?? null ?? "") !== "" ? f2[r + "_effort"] ?? null : null, fallback: splitList(f2[r + "_fallback"] ?? null ?? null) ?? null };
|
|
379092
|
+
roles[r] = spec;
|
|
379093
|
+
}
|
|
379094
|
+
let triggers = splitList(f2["advisor_triggers"] ?? null ?? null) ?? null;
|
|
379095
|
+
return { name: (f2["name"] ?? null ?? "") !== "" ? f2["name"] ?? null : "orchestration", description: f2["description"] ?? null ?? "", modes: (splitList(f2["modes"] ?? null ?? null) ?? null).map((m) => {
|
|
379096
|
+
{
|
|
379097
|
+
return m.toLowerCase() ?? null;
|
|
379098
|
+
}
|
|
379099
|
+
}) ?? null, roles, advisorTriggers: triggers.length > 0 ? triggers : null, advisorMaxCalls: num11(f2["advisor_max_calls"] ?? null ?? null) ?? null, routerThreshold: num11(f2["router_threshold"] ?? null ?? null) ?? null, maxConcurrent: num11(f2["max_concurrent"] ?? null ?? null) ?? null, guidance: body.trim() ?? null };
|
|
379100
|
+
}
|
|
379101
|
+
}
|
|
379102
|
+
function skillsForMode(skills, mode2) {
|
|
379103
|
+
{
|
|
379104
|
+
if (mode2 === "off" || !(Array.isArray(skills) ?? null)) {
|
|
379105
|
+
return [];
|
|
379106
|
+
}
|
|
379107
|
+
return skills.filter((s) => {
|
|
379108
|
+
{
|
|
379109
|
+
return s != null && ((__v) => __v == null ? "null" : typeof __v)(s) === "object" && (s.modes.length === 0 || (s.modes.includes(mode2) ?? null));
|
|
379110
|
+
}
|
|
379111
|
+
}) ?? null;
|
|
379112
|
+
}
|
|
379113
|
+
}
|
|
379114
|
+
async function chooseOrchestrationSkill(callModel, skills, task, mode2) {
|
|
379115
|
+
{
|
|
379116
|
+
let candidates2 = skillsForMode(skills, mode2) ?? null;
|
|
379117
|
+
if (candidates2.length === 0) {
|
|
379118
|
+
return null;
|
|
379119
|
+
}
|
|
379120
|
+
if (candidates2.length === 1) {
|
|
379121
|
+
return candidates2[0] ?? null;
|
|
379122
|
+
}
|
|
379123
|
+
let list2 = (candidates2.map((s) => {
|
|
379124
|
+
{
|
|
379125
|
+
return "- " + s.name + ": " + s.description;
|
|
379126
|
+
}
|
|
379127
|
+
}) ?? null).join("\n") ?? null;
|
|
379128
|
+
let messages = [{ role: "system", content: "Pick the orchestration skill that fits the task. Reply with its name only, or `none`." }, { role: "user", content: "Skills:\n" + list2 + "\n\nTask:\n" + task }];
|
|
379129
|
+
let turn = null;
|
|
379130
|
+
try {
|
|
379131
|
+
{
|
|
379132
|
+
turn = await (callModel(messages, [], {}, null, null) ?? null);
|
|
379133
|
+
}
|
|
379134
|
+
} catch (err2) {
|
|
379135
|
+
{
|
|
379136
|
+
return null;
|
|
379137
|
+
}
|
|
379138
|
+
}
|
|
379139
|
+
let said = ((String(turn.text ?? "") ?? null).trim() ?? null).toLowerCase() ?? null;
|
|
379140
|
+
for (const ch of ["`", "'", '"', "*", "."]) {
|
|
379141
|
+
said = (said.split(ch) ?? null).join("") ?? null;
|
|
379142
|
+
}
|
|
379143
|
+
for (const s of candidates2) {
|
|
379144
|
+
if (said === (s.name.toLowerCase() ?? null) || (said.includes(s.name.toLowerCase() ?? null) ?? null)) {
|
|
379145
|
+
return s;
|
|
379146
|
+
}
|
|
379147
|
+
}
|
|
379148
|
+
return null;
|
|
379149
|
+
}
|
|
379150
|
+
}
|
|
379151
|
+
var init_orchestration_skill = __esm({
|
|
379152
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/orchestration-skill.js"() {
|
|
379153
|
+
init_roles();
|
|
379154
|
+
}
|
|
379155
|
+
});
|
|
379156
|
+
|
|
379157
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/index.js
|
|
378431
379158
|
var init_core3 = __esm({
|
|
378432
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
379159
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/core/index.js"() {
|
|
378433
379160
|
init_types9();
|
|
378434
379161
|
init_loop();
|
|
378435
379162
|
init_context2();
|
|
378436
379163
|
init_runtime5();
|
|
378437
|
-
|
|
379164
|
+
init_orchestration2();
|
|
378438
379165
|
init_profiles2();
|
|
378439
379166
|
init_supervisor();
|
|
378440
379167
|
init_todos();
|
|
378441
379168
|
init_store();
|
|
378442
379169
|
init_run();
|
|
378443
379170
|
init_hypery_model();
|
|
379171
|
+
init_roles();
|
|
379172
|
+
init_advisor();
|
|
379173
|
+
init_router();
|
|
379174
|
+
init_auto();
|
|
379175
|
+
init_orchestration_skill();
|
|
378444
379176
|
}
|
|
378445
379177
|
});
|
|
378446
379178
|
|
|
378447
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
379179
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/indexeddb.js
|
|
378448
379180
|
function indexedDbStore(name2 = "hypery-agents") {
|
|
378449
379181
|
let db3 = null;
|
|
378450
379182
|
const open4 = () => db3 ?? (db3 = new Promise((res, rej) => {
|
|
@@ -378476,11 +379208,11 @@ function indexedDbStore(name2 = "hypery-agents") {
|
|
|
378476
379208
|
};
|
|
378477
379209
|
}
|
|
378478
379210
|
var init_indexeddb2 = __esm({
|
|
378479
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
379211
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/indexeddb.js"() {
|
|
378480
379212
|
}
|
|
378481
379213
|
});
|
|
378482
379214
|
|
|
378483
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
379215
|
+
// node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/index.js
|
|
378484
379216
|
function createHyperyModel2(opts) {
|
|
378485
379217
|
return createHyperyModel({ ...opts, fetch: opts.fetch ?? ((url4, init) => fetch(url4, init)) });
|
|
378486
379218
|
}
|
|
@@ -378496,7 +379228,7 @@ function createAgentRuntime2(host) {
|
|
|
378496
379228
|
});
|
|
378497
379229
|
}
|
|
378498
379230
|
var init_agents = __esm({
|
|
378499
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
379231
|
+
"node_modules/.pnpm/@hyperyai+sdk@3.1.1_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@19.3.0_re_d69693b791dff3e94d3ba5e17f14c5e0/node_modules/@hyperyai/sdk/dist/agents/index.js"() {
|
|
378500
379232
|
init_hypery_model();
|
|
378501
379233
|
init_runtime5();
|
|
378502
379234
|
init_core3();
|
|
@@ -378730,6 +379462,47 @@ var init_turn_recovery = __esm({
|
|
|
378730
379462
|
}
|
|
378731
379463
|
});
|
|
378732
379464
|
|
|
379465
|
+
// lib/agent/orchestration.ts
|
|
379466
|
+
function loadMode() {
|
|
379467
|
+
try {
|
|
379468
|
+
return normalizeMode(typeof localStorage === "undefined" ? null : localStorage.getItem(MODE_KEY2));
|
|
379469
|
+
} catch {
|
|
379470
|
+
return "auto";
|
|
379471
|
+
}
|
|
379472
|
+
}
|
|
379473
|
+
async function orchestrateTurn(opts) {
|
|
379474
|
+
const mode2 = opts.mode ?? orchestrationMode();
|
|
379475
|
+
let skill = null;
|
|
379476
|
+
if (mode2 !== "off") {
|
|
379477
|
+
skill = await chooseOrchestrationSkill(opts.callModel, opts.skills ?? orchestrationSkills(), opts.task, mode2).catch(() => null);
|
|
379478
|
+
}
|
|
379479
|
+
if (skill && opts.explicitModel && skill.roles?.lead) {
|
|
379480
|
+
const { lead: _lead, ...roles } = skill.roles;
|
|
379481
|
+
skill = { ...skill, roles };
|
|
379482
|
+
}
|
|
379483
|
+
current5 = createOrchestration(opts.callModel, { mode: mode2, skill, onEvent: opts.onEvent });
|
|
379484
|
+
return current5;
|
|
379485
|
+
}
|
|
379486
|
+
function endOrchestration(orch) {
|
|
379487
|
+
if (current5 === orch) current5 = null;
|
|
379488
|
+
}
|
|
379489
|
+
var MODE_KEY2, useOrchestrationStore, orchestrationMode, orchestrationSkillOf, orchestrationSkills, current5, currentOrchestration;
|
|
379490
|
+
var init_orchestration3 = __esm({
|
|
379491
|
+
"lib/agent/orchestration.ts"() {
|
|
379492
|
+
"use strict";
|
|
379493
|
+
init_esm();
|
|
379494
|
+
init_agents();
|
|
379495
|
+
init_skills();
|
|
379496
|
+
MODE_KEY2 = "popcraft-agent-orchestration";
|
|
379497
|
+
useOrchestrationStore = create2(() => ({ mode: loadMode() }));
|
|
379498
|
+
orchestrationMode = () => useOrchestrationStore.getState().mode;
|
|
379499
|
+
orchestrationSkillOf = (skill) => parseOrchestrationSkill(skill.instructions);
|
|
379500
|
+
orchestrationSkills = (skills = allSkills()) => skills.map(orchestrationSkillOf).filter((s) => s !== null);
|
|
379501
|
+
current5 = null;
|
|
379502
|
+
currentOrchestration = () => current5;
|
|
379503
|
+
}
|
|
379504
|
+
});
|
|
379505
|
+
|
|
378733
379506
|
// lib/agent/prompt.ts
|
|
378734
379507
|
function buildContextBlock(ctx2, maxChars = PROMPT_LIMITS.maxContextChars) {
|
|
378735
379508
|
const { doc: doc2, pageId: pageId2, selection } = ctx2;
|
|
@@ -378752,7 +379525,7 @@ function buildContextBlock(ctx2, maxChars = PROMPT_LIMITS.maxContextChars) {
|
|
|
378752
379525
|
return joinWithin(lines2, maxChars);
|
|
378753
379526
|
}
|
|
378754
379527
|
function buildSkillIndex(skills, maxChars = PROMPT_LIMITS.maxSkillIndexChars) {
|
|
378755
|
-
return joinWithin(skills.map(skillIndexLine), maxChars);
|
|
379528
|
+
return joinWithin(skills.filter((s) => parseOrchestrationSkill(s.instructions) === null).map(skillIndexLine), maxChars);
|
|
378756
379529
|
}
|
|
378757
379530
|
function buildProfileIndex(profiles, maxChars = PROMPT_LIMITS.maxProfileIndexChars) {
|
|
378758
379531
|
return joinWithin(profiles.map(profileIndexLine), maxChars);
|
|
@@ -378791,11 +379564,12 @@ var init_prompt = __esm({
|
|
|
378791
379564
|
init_limits();
|
|
378792
379565
|
init_context();
|
|
378793
379566
|
init_skills();
|
|
379567
|
+
init_agents();
|
|
378794
379568
|
init_profiles();
|
|
378795
379569
|
init_mentions();
|
|
378796
379570
|
PROMPT_LIMITS = {
|
|
378797
|
-
maxPromptChars:
|
|
378798
|
-
maxSkillIndexChars:
|
|
379571
|
+
maxPromptChars: 14400,
|
|
379572
|
+
maxSkillIndexChars: 5200,
|
|
378799
379573
|
maxProfileIndexChars: 1600,
|
|
378800
379574
|
maxContextChars: AI_LIMITS.maxContextChars,
|
|
378801
379575
|
maxSelectionItems: 12
|
|
@@ -378808,6 +379582,7 @@ var init_prompt = __esm({
|
|
|
378808
379582
|
- Stay inside the scope the user pointed at. The selection is the default scope; do not touch the rest of the page unless asked.
|
|
378809
379583
|
- Explain briefly. A line or two about what you did and why, with counts rather than lists. No preamble, no restating the request.
|
|
378810
379584
|
- Use skills. Before a multi-step job, read the matching skill with read_skill and follow it; skills carry the rules that make the result look designed rather than generated.
|
|
379585
|
+
- Pixel art (sprites, characters, items, tiles, 8-/16-bit) always goes in Pixel canvases made with k.pixels, never rects or vectors \u2014 even when the file already holds vector sprites. Read the pixel-sprites skill first. When the request does not say whether the sprite is still or animated (or pixel versus vector), ask with ask_user before building: that choice is consequential, so it is an exception to asking rarely.
|
|
378811
379586
|
- Plan visibly for anything longer than a couple of steps: manage_todos puts the plan in front of the user and keeps you honest.
|
|
378812
379587
|
- When a tool fails, read the error and fix the call \u2014 do not retry the same arguments, and do not pretend a failed edit happened.
|
|
378813
379588
|
- Ask only when you genuinely cannot proceed (a structural ambiguity), and ask once. ask_user puts the question in front of them with options to click \u2014 use it when a choice is both ambiguous AND consequential, and never when you can reasonably infer the answer from the document or the request, or when you could just try it and let them undo. If they skip the question, pick sensibly and say which way you went.
|
|
@@ -378874,9 +379649,16 @@ function subagentHost(deps = {}) {
|
|
|
378874
379649
|
profiles,
|
|
378875
379650
|
callModel: modelCall(parentModel),
|
|
378876
379651
|
childModel: (ctx2) => {
|
|
379652
|
+
const orch = currentOrchestration();
|
|
379653
|
+
if (orch?.skill) {
|
|
379654
|
+
const call2 = orch.childModel(readOnly(ctx2) ? "swarm" : profileOf(ctx2).model ?? null);
|
|
379655
|
+
if (call2) return call2;
|
|
379656
|
+
}
|
|
378877
379657
|
const model = pickChildModel(profileOf(ctx2), parentModel(), catalog2());
|
|
378878
379658
|
return modelCall(() => model);
|
|
378879
379659
|
},
|
|
379660
|
+
// The turn's skill sets how many background children run at once (null: the SDK's default).
|
|
379661
|
+
maxConcurrent: () => currentOrchestration()?.maxConcurrent ?? null,
|
|
378880
379662
|
childSystemPrompt: (ctx2) => buildSubagentPrompt(ctx2.profile.instructions, promptContext()),
|
|
378881
379663
|
childTools: (ctx2) => {
|
|
378882
379664
|
const all4 = registered3();
|
|
@@ -378946,6 +379728,7 @@ var PARENT_ONLY_TOOLS, AGENT_SESSIONS_DB, FAST_HINTS, isFastModelId, childToolLi
|
|
|
378946
379728
|
var init_subagent = __esm({
|
|
378947
379729
|
"lib/agent/subagent.ts"() {
|
|
378948
379730
|
"use strict";
|
|
379731
|
+
init_orchestration3();
|
|
378949
379732
|
init_editor_store();
|
|
378950
379733
|
init_client_store();
|
|
378951
379734
|
init_agents();
|
|
@@ -379450,6 +380233,7 @@ var init_doc2 = __esm({
|
|
|
379450
380233
|
var POSTER_KEY, MAX_PREVIEW_BYTES2, PREVIEW_STILL_TYPE, previewPath;
|
|
379451
380234
|
var init_motion3 = __esm({
|
|
379452
380235
|
"lib/marketplace/motion.ts"() {
|
|
380236
|
+
"use strict";
|
|
379453
380237
|
init_instances2();
|
|
379454
380238
|
POSTER_KEY = "poster";
|
|
379455
380239
|
MAX_PREVIEW_BYTES2 = 4 * 1024 * 1024;
|
|
@@ -379565,6 +380349,7 @@ async function renderLibraryPreviews(renderer, doc2, listing, format = pickPrevi
|
|
|
379565
380349
|
var PREVIEW_FORMATS, PREVIEW_FPS, PREVIEW_MAX_MS2, PREVIEW_HOLD_MS, PREVIEW_BOX, POSTER_CELL, PREVIEW_MAX_SCALE, POSTER_COLS, POSTER_MAX, previewScale, componentSchedule;
|
|
379566
380350
|
var init_library_previews = __esm({
|
|
379567
380351
|
"lib/motion/library-previews.ts"() {
|
|
380352
|
+
"use strict";
|
|
379568
380353
|
init_codecs();
|
|
379569
380354
|
init_gpu_pixels();
|
|
379570
380355
|
init_render_frames();
|
|
@@ -379655,8 +380440,8 @@ async function reviewUpdate(update3) {
|
|
|
379655
380440
|
}
|
|
379656
380441
|
function acceptUpdate(update3, payload, accept) {
|
|
379657
380442
|
const lib = useLibraries.getState().available.find((l) => l.id === update3.libraryId);
|
|
379658
|
-
const
|
|
379659
|
-
const doc2 = applyLibrary(liveDoc(), update3.libraryId, { name: update3.name, version: update3.to, fileKey: lib?.fileKey ??
|
|
380443
|
+
const current6 = liveDoc().libraries?.[update3.libraryId];
|
|
380444
|
+
const doc2 = applyLibrary(liveDoc(), update3.libraryId, { name: update3.name, version: update3.to, fileKey: lib?.fileKey ?? current6?.fileKey ?? void 0, importedAt: Date.now() }, payload, accept);
|
|
379660
380445
|
useEditorStore.getState().commitDocument(doc2, `Update library: ${update3.name}`);
|
|
379661
380446
|
computeUpdates();
|
|
379662
380447
|
}
|
|
@@ -379853,17 +380638,17 @@ function sanitizeWidgetTree(raw) {
|
|
|
379853
380638
|
switch (e.type) {
|
|
379854
380639
|
case "AutoLayout": {
|
|
379855
380640
|
let padding3;
|
|
379856
|
-
if (typeof e.padding === "number") padding3 =
|
|
380641
|
+
if (typeof e.padding === "number") padding3 = num12(e.padding, 0, 1e3);
|
|
379857
380642
|
else if (e.padding && typeof e.padding === "object") {
|
|
379858
380643
|
const p2 = e.padding;
|
|
379859
|
-
padding3 = { top:
|
|
380644
|
+
padding3 = { top: num12(p2.top, 0, 1e3), right: num12(p2.right, 0, 1e3), bottom: num12(p2.bottom, 0, 1e3), left: num12(p2.left, 0, 1e3), horizontal: num12(p2.horizontal, 0, 1e3), vertical: num12(p2.vertical, 0, 1e3) };
|
|
379860
380645
|
}
|
|
379861
380646
|
const children = Array.isArray(e.children) ? e.children.filter((c2) => c2 !== null && c2 !== void 0 && c2 !== false).map((c2) => visit2(c2, depth + 1)) : [];
|
|
379862
380647
|
return strip({
|
|
379863
380648
|
type: "AutoLayout",
|
|
379864
380649
|
...base,
|
|
379865
380650
|
direction: e.direction === "vertical" ? "vertical" : "horizontal",
|
|
379866
|
-
spacing:
|
|
380651
|
+
spacing: num12(e.spacing, 0, 1e3),
|
|
379867
380652
|
padding: padding3,
|
|
379868
380653
|
width: size5(e.width),
|
|
379869
380654
|
height: size5(e.height),
|
|
@@ -379871,8 +380656,8 @@ function sanitizeWidgetTree(raw) {
|
|
|
379871
380656
|
verticalAlign: align3(e.verticalAlign),
|
|
379872
380657
|
fill: color3(e.fill),
|
|
379873
380658
|
stroke: color3(e.stroke),
|
|
379874
|
-
strokeWidth:
|
|
379875
|
-
cornerRadius:
|
|
380659
|
+
strokeWidth: num12(e.strokeWidth, 0, 100),
|
|
380660
|
+
cornerRadius: num12(e.cornerRadius, 0, 2e3),
|
|
379876
380661
|
children
|
|
379877
380662
|
});
|
|
379878
380663
|
}
|
|
@@ -379881,22 +380666,22 @@ function sanitizeWidgetTree(raw) {
|
|
|
379881
380666
|
type: "Text",
|
|
379882
380667
|
...base,
|
|
379883
380668
|
characters: String(e.characters ?? "").slice(0, 2e3),
|
|
379884
|
-
fontSize:
|
|
379885
|
-
fontWeight:
|
|
380669
|
+
fontSize: num12(e.fontSize, 1, 400),
|
|
380670
|
+
fontWeight: num12(e.fontWeight, 100, 900),
|
|
379886
380671
|
fill: color3(e.fill),
|
|
379887
|
-
width:
|
|
380672
|
+
width: num12(e.width, 0, 4e3)
|
|
379888
380673
|
});
|
|
379889
380674
|
case "Rectangle":
|
|
379890
380675
|
case "Ellipse":
|
|
379891
380676
|
return strip({
|
|
379892
380677
|
type: e.type,
|
|
379893
380678
|
...base,
|
|
379894
|
-
width:
|
|
379895
|
-
height:
|
|
380679
|
+
width: num12(e.width, 0, 4e3, 0),
|
|
380680
|
+
height: num12(e.height, 0, 4e3, 0),
|
|
379896
380681
|
fill: color3(e.fill),
|
|
379897
380682
|
stroke: color3(e.stroke),
|
|
379898
|
-
strokeWidth:
|
|
379899
|
-
cornerRadius:
|
|
380683
|
+
strokeWidth: num12(e.strokeWidth, 0, 100),
|
|
380684
|
+
cornerRadius: num12(e.cornerRadius, 0, 2e3)
|
|
379900
380685
|
});
|
|
379901
380686
|
default:
|
|
379902
380687
|
throw new WidgetTreeError(`Unknown widget element type ${JSON.stringify(e.type)}`);
|
|
@@ -380002,7 +380787,7 @@ function padding(el) {
|
|
|
380002
380787
|
right: p2?.right ?? p2?.horizontal ?? 0
|
|
380003
380788
|
};
|
|
380004
380789
|
}
|
|
380005
|
-
var MAX_WIDGET_ELEMENTS, MAX_WIDGET_DEPTH, MAX_WIDGET_STATE_BYTES, WidgetTreeError,
|
|
380790
|
+
var MAX_WIDGET_ELEMENTS, MAX_WIDGET_DEPTH, MAX_WIDGET_STATE_BYTES, WidgetTreeError, num12, HEX, color3, str3, align3, size5, DEFAULT_FONT_SIZE, TEXT_COLOR, layoutCache2;
|
|
380006
380791
|
var init_layout4 = __esm({
|
|
380007
380792
|
"lib/extensions/widget/layout.ts"() {
|
|
380008
380793
|
MAX_WIDGET_ELEMENTS = 400;
|
|
@@ -380010,7 +380795,7 @@ var init_layout4 = __esm({
|
|
|
380010
380795
|
MAX_WIDGET_STATE_BYTES = 64 * 1024;
|
|
380011
380796
|
WidgetTreeError = class extends Error {
|
|
380012
380797
|
};
|
|
380013
|
-
|
|
380798
|
+
num12 = (v, min2, max3, fallback2) => {
|
|
380014
380799
|
if (typeof v !== "number" || !Number.isFinite(v)) return fallback2;
|
|
380015
380800
|
return Math.max(min2, Math.min(max3, v));
|
|
380016
380801
|
};
|
|
@@ -380018,7 +380803,7 @@ var init_layout4 = __esm({
|
|
|
380018
380803
|
color3 = (v) => typeof v === "string" && HEX.test(v) ? v : void 0;
|
|
380019
380804
|
str3 = (v, max3) => typeof v === "string" ? v.slice(0, max3) : void 0;
|
|
380020
380805
|
align3 = (v) => v === "start" || v === "center" || v === "end" ? v : void 0;
|
|
380021
|
-
size5 = (v) => v === "hug" ? "hug" :
|
|
380806
|
+
size5 = (v) => v === "hug" ? "hug" : num12(v, 0, 4e3);
|
|
380022
380807
|
DEFAULT_FONT_SIZE = 16;
|
|
380023
380808
|
TEXT_COLOR = { r: 0.12, g: 0.12, b: 0.14, a: 1 };
|
|
380024
380809
|
layoutCache2 = /* @__PURE__ */ new WeakMap();
|
|
@@ -392884,20 +393669,20 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
392884
393669
|
graphics.current.updateClipFromPath();
|
|
392885
393670
|
}
|
|
392886
393671
|
setFillAndStrokeStyleToContext(graphics, paintType, color4) {
|
|
392887
|
-
const context = graphics.ctx,
|
|
392888
|
-
|
|
393672
|
+
const context = graphics.ctx, current6 = graphics.current;
|
|
393673
|
+
current6.patternFill = current6.patternStroke = false;
|
|
392889
393674
|
switch (paintType) {
|
|
392890
393675
|
case PaintType.COLORED:
|
|
392891
393676
|
const {
|
|
392892
393677
|
fillStyle,
|
|
392893
393678
|
strokeStyle
|
|
392894
393679
|
} = this.ctx;
|
|
392895
|
-
context.fillStyle =
|
|
392896
|
-
context.strokeStyle =
|
|
393680
|
+
context.fillStyle = current6.fillColor = fillStyle;
|
|
393681
|
+
context.strokeStyle = current6.strokeColor = strokeStyle;
|
|
392897
393682
|
break;
|
|
392898
393683
|
case PaintType.UNCOLORED:
|
|
392899
393684
|
context.fillStyle = context.strokeStyle = color4;
|
|
392900
|
-
|
|
393685
|
+
current6.fillColor = current6.strokeColor = color4;
|
|
392901
393686
|
break;
|
|
392902
393687
|
default:
|
|
392903
393688
|
throw new FormatError2(`Unsupported paint type: ${paintType}`);
|
|
@@ -394134,19 +394919,19 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394134
394919
|
setFont(opIdx, fontRefName, size6) {
|
|
394135
394920
|
this.dependencyTracker?.recordSimpleData("font", opIdx).recordSimpleDataFromNamed("fontObj", fontRefName, opIdx);
|
|
394136
394921
|
const fontObj = this.commonObjs.get(fontRefName);
|
|
394137
|
-
const
|
|
394922
|
+
const current6 = this.current;
|
|
394138
394923
|
if (!fontObj) {
|
|
394139
394924
|
throw new Error(`Can't find font for ${fontRefName}`);
|
|
394140
394925
|
}
|
|
394141
|
-
|
|
394142
|
-
if (
|
|
394926
|
+
current6.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;
|
|
394927
|
+
if (current6.fontMatrix[0] === 0 || current6.fontMatrix[3] === 0) {
|
|
394143
394928
|
warn3("Invalid font matrix for font " + fontRefName);
|
|
394144
394929
|
}
|
|
394145
394930
|
if (size6 < 0) {
|
|
394146
394931
|
size6 = -size6;
|
|
394147
|
-
|
|
394932
|
+
current6.fontDirection = -1;
|
|
394148
394933
|
} else {
|
|
394149
|
-
|
|
394934
|
+
current6.fontDirection = 1;
|
|
394150
394935
|
}
|
|
394151
394936
|
this.current.font = fontObj;
|
|
394152
394937
|
this.current.fontSize = size6;
|
|
@@ -394186,12 +394971,12 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394186
394971
|
setTextMatrix(opIdx, matrix) {
|
|
394187
394972
|
this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix", opIdx);
|
|
394188
394973
|
const {
|
|
394189
|
-
current:
|
|
394974
|
+
current: current6
|
|
394190
394975
|
} = this;
|
|
394191
|
-
|
|
394192
|
-
|
|
394193
|
-
|
|
394194
|
-
|
|
394976
|
+
current6.textMatrix = matrix;
|
|
394977
|
+
current6.textMatrixScale = Math.hypot(matrix[0], matrix[1]);
|
|
394978
|
+
current6.x = current6.lineX = 0;
|
|
394979
|
+
current6.y = current6.lineY = 0;
|
|
394195
394980
|
}
|
|
394196
394981
|
nextLine(opIdx) {
|
|
394197
394982
|
this.moveText(opIdx, 0, this.current.leading);
|
|
@@ -394204,14 +394989,14 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394204
394989
|
}
|
|
394205
394990
|
paintChar(opIdx, character, x2, y, patternFillTransform, patternStrokeTransform) {
|
|
394206
394991
|
const ctx2 = this.ctx;
|
|
394207
|
-
const
|
|
394208
|
-
const font =
|
|
394209
|
-
const textRenderingMode =
|
|
394210
|
-
const fontSize =
|
|
394992
|
+
const current6 = this.current;
|
|
394993
|
+
const font = current6.font;
|
|
394994
|
+
const textRenderingMode = current6.textRenderingMode;
|
|
394995
|
+
const fontSize = current6.fontSize / current6.fontSizeScale;
|
|
394211
394996
|
const fillStrokeMode = textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
|
394212
394997
|
const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
|
|
394213
|
-
const patternFill =
|
|
394214
|
-
const patternStroke =
|
|
394998
|
+
const patternFill = current6.patternFill && !font.missingFile;
|
|
394999
|
+
const patternStroke = current6.patternStroke && !font.missingFile;
|
|
394215
395000
|
let path;
|
|
394216
395001
|
if ((font.disableFontFace || isAddToPathSet || patternFill || patternStroke) && !font.missingFile) {
|
|
394217
395002
|
path = font.getPathGenerator(this.commonObjs, character);
|
|
@@ -394300,49 +395085,49 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394300
395085
|
this.dependencyTracker.recordFutureForcedDependency("textClip", opIdx).inheritPendingDependenciesAsFutureForcedDependencies();
|
|
394301
395086
|
}
|
|
394302
395087
|
}
|
|
394303
|
-
const
|
|
394304
|
-
const font =
|
|
395088
|
+
const current6 = this.current;
|
|
395089
|
+
const font = current6.font;
|
|
394305
395090
|
if (font.isType3Font) {
|
|
394306
|
-
const started9 = this.#beginKnockoutElement(
|
|
395091
|
+
const started9 = this.#beginKnockoutElement(current6.fillAlpha);
|
|
394307
395092
|
this.showType3Text(opIdx, glyphs);
|
|
394308
395093
|
this.dependencyTracker?.recordShowTextOperation(opIdx);
|
|
394309
395094
|
this.#endKnockoutElement(started9);
|
|
394310
395095
|
return;
|
|
394311
395096
|
}
|
|
394312
|
-
const fontSize =
|
|
395097
|
+
const fontSize = current6.fontSize;
|
|
394313
395098
|
if (fontSize === 0) {
|
|
394314
395099
|
this.dependencyTracker?.recordOperation(opIdx);
|
|
394315
395100
|
return;
|
|
394316
395101
|
}
|
|
394317
|
-
const started8 = this.#beginKnockoutElement(
|
|
395102
|
+
const started8 = this.#beginKnockoutElement(current6.fillAlpha);
|
|
394318
395103
|
const ctx2 = this.ctx;
|
|
394319
|
-
const fontSizeScale =
|
|
394320
|
-
const charSpacing =
|
|
394321
|
-
const wordSpacing =
|
|
394322
|
-
const fontDirection =
|
|
394323
|
-
const textHScale =
|
|
395104
|
+
const fontSizeScale = current6.fontSizeScale;
|
|
395105
|
+
const charSpacing = current6.charSpacing;
|
|
395106
|
+
const wordSpacing = current6.wordSpacing;
|
|
395107
|
+
const fontDirection = current6.fontDirection;
|
|
395108
|
+
const textHScale = current6.textHScale * fontDirection;
|
|
394324
395109
|
const glyphsLength = glyphs.length;
|
|
394325
395110
|
const vertical = font.vertical;
|
|
394326
395111
|
const spacingDir = vertical ? 1 : -1;
|
|
394327
395112
|
const defaultVMetrics = font.defaultVMetrics;
|
|
394328
|
-
const widthAdvanceScale = fontSize *
|
|
394329
|
-
const simpleFillText =
|
|
395113
|
+
const widthAdvanceScale = fontSize * current6.fontMatrix[0];
|
|
395114
|
+
const simpleFillText = current6.textRenderingMode === TextRenderingMode.FILL && !font.disableFontFace && !current6.patternFill;
|
|
394330
395115
|
ctx2.save();
|
|
394331
|
-
if (
|
|
394332
|
-
ctx2.transform(...
|
|
395116
|
+
if (current6.textMatrix) {
|
|
395117
|
+
ctx2.transform(...current6.textMatrix);
|
|
394333
395118
|
}
|
|
394334
|
-
ctx2.translate(
|
|
395119
|
+
ctx2.translate(current6.x, current6.y + current6.textRise);
|
|
394335
395120
|
if (fontDirection > 0) {
|
|
394336
395121
|
ctx2.scale(textHScale, -1);
|
|
394337
395122
|
} else {
|
|
394338
395123
|
ctx2.scale(textHScale, 1);
|
|
394339
395124
|
}
|
|
394340
395125
|
let patternFillTransform, patternStrokeTransform;
|
|
394341
|
-
const fillStrokeMode =
|
|
395126
|
+
const fillStrokeMode = current6.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
|
394342
395127
|
const needsFill = fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
|
394343
395128
|
const needsStroke = fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
|
394344
|
-
let lineWidth2 =
|
|
394345
|
-
const scale =
|
|
395129
|
+
let lineWidth2 = current6.lineWidth;
|
|
395130
|
+
const scale = current6.textMatrixScale;
|
|
394346
395131
|
if (scale === 0 || lineWidth2 === 0) {
|
|
394347
395132
|
if (needsStroke) {
|
|
394348
395133
|
lineWidth2 = this.getSinglePixelWidth();
|
|
@@ -394355,16 +395140,16 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394355
395140
|
lineWidth2 /= fontSizeScale;
|
|
394356
395141
|
}
|
|
394357
395142
|
ctx2.lineWidth = lineWidth2;
|
|
394358
|
-
if (needsFill &&
|
|
395143
|
+
if (needsFill && current6.patternFill) {
|
|
394359
395144
|
ctx2.save();
|
|
394360
|
-
const pattern =
|
|
395145
|
+
const pattern = current6.fillColor.getPattern(ctx2, this, getCurrentTransformInverse(ctx2), PathType.FILL, opIdx);
|
|
394361
395146
|
patternFillTransform = getCurrentTransform(ctx2);
|
|
394362
395147
|
ctx2.restore();
|
|
394363
395148
|
ctx2.fillStyle = pattern;
|
|
394364
395149
|
}
|
|
394365
|
-
if (needsStroke &&
|
|
395150
|
+
if (needsStroke && current6.patternStroke) {
|
|
394366
395151
|
ctx2.save();
|
|
394367
|
-
const pattern =
|
|
395152
|
+
const pattern = current6.strokeColor.getPattern(ctx2, this, getCurrentTransformInverse(ctx2), PathType.STROKE, opIdx);
|
|
394368
395153
|
patternStrokeTransform = getCurrentTransform(ctx2);
|
|
394369
395154
|
ctx2.restore();
|
|
394370
395155
|
ctx2.strokeStyle = pattern;
|
|
@@ -394382,7 +395167,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394382
395167
|
const measure4 = ctx2.measureText(joinedChars);
|
|
394383
395168
|
this.dependencyTracker.recordBBox(opIdx, this.ctx, -measure4.actualBoundingBoxLeft, measure4.actualBoundingBoxRight, -measure4.actualBoundingBoxAscent, measure4.actualBoundingBoxDescent).recordShowTextOperation(opIdx);
|
|
394384
395169
|
}
|
|
394385
|
-
|
|
395170
|
+
current6.x += width * widthAdvanceScale * textHScale;
|
|
394386
395171
|
ctx2.restore();
|
|
394387
395172
|
this.compose();
|
|
394388
395173
|
this.#endKnockoutElement(started8);
|
|
@@ -394448,9 +395233,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394448
395233
|
}
|
|
394449
395234
|
}
|
|
394450
395235
|
if (vertical) {
|
|
394451
|
-
|
|
395236
|
+
current6.y -= x2;
|
|
394452
395237
|
} else {
|
|
394453
|
-
|
|
395238
|
+
current6.x += x2 * textHScale;
|
|
394454
395239
|
}
|
|
394455
395240
|
ctx2.restore();
|
|
394456
395241
|
this.compose();
|
|
@@ -394459,17 +395244,17 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394459
395244
|
}
|
|
394460
395245
|
showType3Text(opIdx, glyphs) {
|
|
394461
395246
|
const ctx2 = this.ctx;
|
|
394462
|
-
const
|
|
394463
|
-
const font =
|
|
394464
|
-
const fontSize =
|
|
394465
|
-
const fontDirection =
|
|
395247
|
+
const current6 = this.current;
|
|
395248
|
+
const font = current6.font;
|
|
395249
|
+
const fontSize = current6.fontSize;
|
|
395250
|
+
const fontDirection = current6.fontDirection;
|
|
394466
395251
|
const spacingDir = font.vertical ? 1 : -1;
|
|
394467
|
-
const charSpacing =
|
|
394468
|
-
const wordSpacing =
|
|
394469
|
-
const textHScale =
|
|
394470
|
-
const fontMatrix =
|
|
395252
|
+
const charSpacing = current6.charSpacing;
|
|
395253
|
+
const wordSpacing = current6.wordSpacing;
|
|
395254
|
+
const textHScale = current6.textHScale * fontDirection;
|
|
395255
|
+
const fontMatrix = current6.fontMatrix || FONT_IDENTITY_MATRIX;
|
|
394471
395256
|
const glyphsLength = glyphs.length;
|
|
394472
|
-
const isTextInvisible =
|
|
395257
|
+
const isTextInvisible = current6.textRenderingMode === TextRenderingMode.INVISIBLE;
|
|
394473
395258
|
let i2, glyph2, width, spacingLength;
|
|
394474
395259
|
if (isTextInvisible || fontSize === 0) {
|
|
394475
395260
|
return;
|
|
@@ -394477,10 +395262,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394477
395262
|
this._cachedScaleForStroking[0] = -1;
|
|
394478
395263
|
this._cachedGetSinglePixelWidth = null;
|
|
394479
395264
|
ctx2.save();
|
|
394480
|
-
if (
|
|
394481
|
-
ctx2.transform(...
|
|
395265
|
+
if (current6.textMatrix) {
|
|
395266
|
+
ctx2.transform(...current6.textMatrix);
|
|
394482
395267
|
}
|
|
394483
|
-
ctx2.translate(
|
|
395268
|
+
ctx2.translate(current6.x, current6.y + current6.textRise);
|
|
394484
395269
|
ctx2.scale(textHScale, fontDirection);
|
|
394485
395270
|
const dependencyTracker = this.dependencyTracker;
|
|
394486
395271
|
this.dependencyTracker = dependencyTracker ? new CanvasNestedDependencyTracker(dependencyTracker, opIdx) : null;
|
|
@@ -394489,7 +395274,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394489
395274
|
if (typeof glyph2 === "number") {
|
|
394490
395275
|
spacingLength = spacingDir * glyph2 * fontSize / 1e3;
|
|
394491
395276
|
this.ctx.translate(spacingLength, 0);
|
|
394492
|
-
|
|
395277
|
+
current6.x += spacingLength * textHScale;
|
|
394493
395278
|
continue;
|
|
394494
395279
|
}
|
|
394495
395280
|
const spacing = (glyph2.isSpace ? wordSpacing : 0) + charSpacing;
|
|
@@ -394499,7 +395284,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394499
395284
|
} else if (this.contentVisible) {
|
|
394500
395285
|
this.save();
|
|
394501
395286
|
if (operatorList.fnArray[0] === OPS2.setCharWidth) {
|
|
394502
|
-
|
|
395287
|
+
current6.fillAlpha = current6.strokeAlpha = 1;
|
|
394503
395288
|
ctx2.globalAlpha = 1;
|
|
394504
395289
|
}
|
|
394505
395290
|
ctx2.scale(fontSize, fontSize);
|
|
@@ -394511,7 +395296,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394511
395296
|
Util.applyTransform(p2, fontMatrix);
|
|
394512
395297
|
width = p2[0] * fontSize + spacing;
|
|
394513
395298
|
ctx2.translate(width, 0);
|
|
394514
|
-
|
|
395299
|
+
current6.x += width * textHScale;
|
|
394515
395300
|
}
|
|
394516
395301
|
ctx2.restore();
|
|
394517
395302
|
if (dependencyTracker) {
|
|
@@ -410637,8 +411422,8 @@ async function ensureBackgroundSession(pluginId, command) {
|
|
|
410637
411422
|
}
|
|
410638
411423
|
async function callPluginTool(plugin, tool2, args2, options) {
|
|
410639
411424
|
const id3 = plugin.manifest.id;
|
|
410640
|
-
const
|
|
410641
|
-
if (!
|
|
411425
|
+
const current6 = await getPlugin(id3);
|
|
411426
|
+
if (!current6?.enabled || current6.granted === null) throw new Error(`${plugin.manifest.name} is disabled or has not been allowed to run`);
|
|
410642
411427
|
const session3 = await ensureBackgroundSession(id3, "agent");
|
|
410643
411428
|
if (!session3?.env) throw new Error(`${plugin.manifest.name} could not start`);
|
|
410644
411429
|
const env = session3.env;
|
|
@@ -412896,6 +413681,7 @@ function placeDesign(doc2, built, source3, size6, name2, at5) {
|
|
|
412896
413681
|
var DESIGN_NAMESPACES, DERIVED2, templateOfBuild;
|
|
412897
413682
|
var init_build3 = __esm({
|
|
412898
413683
|
"lib/agent/design-script/build.ts"() {
|
|
413684
|
+
"use strict";
|
|
412899
413685
|
init_hash();
|
|
412900
413686
|
init_scene_graph();
|
|
412901
413687
|
init_libraries();
|
|
@@ -412925,6 +413711,7 @@ function designFrameOf(doc2, id3) {
|
|
|
412925
413711
|
}
|
|
412926
413712
|
var init_locate = __esm({
|
|
412927
413713
|
"lib/agent/design-script/locate.ts"() {
|
|
413714
|
+
"use strict";
|
|
412928
413715
|
}
|
|
412929
413716
|
});
|
|
412930
413717
|
|
|
@@ -413403,7 +414190,20 @@ function resilientModel(model, turn, parts) {
|
|
|
413403
414190
|
}
|
|
413404
414191
|
};
|
|
413405
414192
|
}
|
|
413406
|
-
|
|
414193
|
+
function lastUserText(messages) {
|
|
414194
|
+
const m = [...messages].reverse().find((x2) => x2.role === "user");
|
|
414195
|
+
return typeof m?.content === "string" ? m.content : m ? JSON.stringify(m.content) : "";
|
|
414196
|
+
}
|
|
414197
|
+
function withGuidance(messages, guidance) {
|
|
414198
|
+
const i2 = messages.findIndex((m) => m.role === "system");
|
|
414199
|
+
if (i2 < 0) return [{ role: "system", content: guidance }, ...messages];
|
|
414200
|
+
const sys = messages[i2];
|
|
414201
|
+
return messages.map((m, j) => j === i2 ? { ...sys, content: `${typeof sys.content === "string" ? sys.content : ""}
|
|
414202
|
+
|
|
414203
|
+
${guidance}` } : m);
|
|
414204
|
+
}
|
|
414205
|
+
async function drive(meta3, initial) {
|
|
414206
|
+
let start2 = initial;
|
|
413407
414207
|
const model = agentModel2();
|
|
413408
414208
|
if (!model) {
|
|
413409
414209
|
useAgentStore.setState({ error: { message: "Pick a chat model for the agent first.", code: "no_model" } });
|
|
@@ -413438,6 +414238,17 @@ async function drive(meta3, start2) {
|
|
|
413438
414238
|
const readOnly = !!editBlockReason();
|
|
413439
414239
|
registerTurnTools({ readOnly, signal: abort.signal });
|
|
413440
414240
|
const runtime = agentRuntime();
|
|
414241
|
+
const fresh = "messages" in start2 ? start2 : null;
|
|
414242
|
+
const resumed = !fresh;
|
|
414243
|
+
const pool = orchestrationSkills();
|
|
414244
|
+
const orch = await orchestrateTurn({
|
|
414245
|
+
callModel: agentModel(() => model),
|
|
414246
|
+
task: fresh ? lastUserText(fresh.messages) : "",
|
|
414247
|
+
mode: resumed && !meta3.orchestrationSkill ? "off" : void 0,
|
|
414248
|
+
skills: resumed ? pool.filter((s) => s.name === meta3.orchestrationSkill) : pool
|
|
414249
|
+
}).catch(() => null);
|
|
414250
|
+
meta3.orchestrationSkill = orch?.skill?.name ?? null;
|
|
414251
|
+
if (fresh && orch?.guidance) start2 = { ...fresh, messages: withGuidance(fresh.messages, orch.guidance) };
|
|
413441
414252
|
const tools = loopTools(meta3.skillId);
|
|
413442
414253
|
const canWrite2 = !readOnly && meta3.wantsChange;
|
|
413443
414254
|
const writeTool = tools.some((t3) => t3.spec.function.name === DESIGN_TOOL2) ? DESIGN_TOOL2 : null;
|
|
@@ -413480,7 +414291,9 @@ async function drive(meta3, start2) {
|
|
|
413480
414291
|
isRecoverable: (err2) => !abort.signal.aborted && isInterruption(err2),
|
|
413481
414292
|
requireAction: canWrite2 ? { nudges: ACTION_NUDGES, message: ACTION_NUDGE } : false,
|
|
413482
414293
|
toolChoice: () => guard2.toolChoice(),
|
|
413483
|
-
|
|
414294
|
+
advise: orch?.advise ?? void 0,
|
|
414295
|
+
route: orch?.route ?? void 0,
|
|
414296
|
+
callModel: resilientModel(orch?.skill ? orch.callModel : agentModel(() => model), abort.signal, { get: () => parts, set: (p2) => {
|
|
413484
414297
|
parts = p2;
|
|
413485
414298
|
flush();
|
|
413486
414299
|
} }),
|
|
@@ -413588,6 +414401,7 @@ async function drive(meta3, start2) {
|
|
|
413588
414401
|
parts = [...parts, { type: "error", message, code }];
|
|
413589
414402
|
}
|
|
413590
414403
|
} finally {
|
|
414404
|
+
endOrchestration(orch);
|
|
413591
414405
|
offPage();
|
|
413592
414406
|
preview.end();
|
|
413593
414407
|
if (abort.signal.aborted) {
|
|
@@ -413618,6 +414432,7 @@ var init_runner = __esm({
|
|
|
413618
414432
|
init_dangerous();
|
|
413619
414433
|
init_skill();
|
|
413620
414434
|
init_prompt();
|
|
414435
|
+
init_orchestration3();
|
|
413621
414436
|
init_skills();
|
|
413622
414437
|
init_parts();
|
|
413623
414438
|
init_store2();
|
|
@@ -416103,6 +416918,13 @@ Every layer call returns its id. **Name** every layer a cue, count or swap must
|
|
|
416103
416918
|
\u2014 live text. \`autoWidth: true\` hugs the words (labels, buttons); \`width: 'FILL'\` wraps in the column.
|
|
416104
416919
|
- \`k.rect(parent, w | 'FILL', h, fill, { radius, stroke, effects, opacity, absolute, name, mask })\`, \`k.ellipse(parent, size, fill, o)\`,
|
|
416105
416920
|
\`k.star(parent, size, fill, o)\`.
|
|
416921
|
+
- \`k.pixels(parent, frames, key, { cell, ms, name, absolute, palette })\` \u2014 pixel art as a real Pixel canvas the pixel
|
|
416922
|
+
tools edit: each frame is rows of characters, each a colour from \`key\` (\`{ R: '#d8453a', K: '#1b1020' }\`; \`.\` is
|
|
416923
|
+
transparent), every row the same width \u2014 any size (8\xD78, 16\xD716, 24\xD732, 48\xD748\u2026). Several frames are an animation playing
|
|
416924
|
+
\`ms\` a frame. \`cell\` is the on-canvas size of one pixel. \`palette\` limits the colours to a preset (\`'PICO-8'\`,
|
|
416925
|
+
\`'DB32'\`, \`'Endesga 32'\`, \`'Game Boy'\`) or a list of hexes; a key colour outside it throws with the nearest allowed
|
|
416926
|
+
one. Use it for every sprite, tile, icon or character asked for as pixel art \u2014 never rects or vectors. For a transparent
|
|
416927
|
+
background, clear the sheet's paper: \`k.patch(k.sheet, { fills: [] })\`.
|
|
416106
416928
|
- \`k.vector(parent, w, h, [paths], fill, { strokeWidth, stroke, absolute, name, effects })\` \u2014 paths are
|
|
416107
416929
|
\`{ closed, points: [{ x, y }] }\` in the vector's own w \xD7 h box. Helpers: \`draw.box\`, \`draw.line\`, \`draw.poly\`,
|
|
416108
416930
|
\`draw.circle\`, \`draw.smooth\`; \`marks.gridPaths\`, \`marks.dotPaths\`, \`marks.confettiPaths\`, \`marks.burstPath\`,
|
|
@@ -420371,11 +421193,11 @@ var init_editor_store = __esm({
|
|
|
420371
421193
|
return newNode;
|
|
420372
421194
|
};
|
|
420373
421195
|
const traverse = (currentId, sx, sy) => {
|
|
420374
|
-
const
|
|
420375
|
-
if (!
|
|
420376
|
-
newNodes[currentId] = scaleProps(
|
|
420377
|
-
if ("childIds" in
|
|
420378
|
-
for (const childId of
|
|
421196
|
+
const current6 = sourceNodes[currentId];
|
|
421197
|
+
if (!current6) return;
|
|
421198
|
+
newNodes[currentId] = scaleProps(current6, sx, sy);
|
|
421199
|
+
if ("childIds" in current6 && current6.childIds) {
|
|
421200
|
+
for (const childId of current6.childIds) {
|
|
420379
421201
|
traverse(childId, sx, sy);
|
|
420380
421202
|
}
|
|
420381
421203
|
}
|
|
@@ -420763,10 +421585,10 @@ var init_editor_store = __esm({
|
|
|
420763
421585
|
const state = get4();
|
|
420764
421586
|
const newExpanded = new Set(state.expandedLayerNodes);
|
|
420765
421587
|
ids2.forEach((id3) => {
|
|
420766
|
-
let
|
|
420767
|
-
for (let guard2 = 0;
|
|
420768
|
-
newExpanded.add(
|
|
420769
|
-
|
|
421588
|
+
let current6 = resolveVirtualNode2(state.document.nodes, id3);
|
|
421589
|
+
for (let guard2 = 0; current6?.parentId && guard2 < 64; guard2++) {
|
|
421590
|
+
newExpanded.add(current6.parentId);
|
|
421591
|
+
current6 = resolveVirtualNode2(state.document.nodes, current6.parentId);
|
|
420770
421592
|
}
|
|
420771
421593
|
});
|
|
420772
421594
|
const cellSel = state.tableCellSelection;
|
|
@@ -420778,10 +421600,10 @@ var init_editor_store = __esm({
|
|
|
420778
421600
|
addToSelection: (id3) => {
|
|
420779
421601
|
const state = get4();
|
|
420780
421602
|
const newExpanded = new Set(state.expandedLayerNodes);
|
|
420781
|
-
let
|
|
420782
|
-
while (
|
|
420783
|
-
newExpanded.add(
|
|
420784
|
-
|
|
421603
|
+
let current6 = state.document.nodes[id3];
|
|
421604
|
+
while (current6 && current6.parentId) {
|
|
421605
|
+
newExpanded.add(current6.parentId);
|
|
421606
|
+
current6 = state.document.nodes[current6.parentId];
|
|
420785
421607
|
}
|
|
420786
421608
|
set4({
|
|
420787
421609
|
selection: [...state.selection, id3],
|
|
@@ -421320,11 +422142,11 @@ var init_editor_store = __esm({
|
|
|
421320
422142
|
if (!pages2.length) return;
|
|
421321
422143
|
const cam = state.camera;
|
|
421322
422144
|
const selected = pages2.findIndex((pg) => state.selection.includes(pg.id));
|
|
421323
|
-
const
|
|
422145
|
+
const current6 = selected >= 0 ? selected : pages2.reduce((best, pg, i2) => {
|
|
421324
422146
|
const d = Math.hypot(pg.x + pg.width / 2 - cam.x, pg.y + pg.height / 2 - cam.y);
|
|
421325
422147
|
return d < best.d ? { i: i2, d } : best;
|
|
421326
422148
|
}, { i: 0, d: Infinity }).i;
|
|
421327
|
-
const target2 = typeof to === "number" ? to : to === "first" ? 0 : to === "last" ? pages2.length - 1 :
|
|
422149
|
+
const target2 = typeof to === "number" ? to : to === "first" ? 0 : to === "last" ? pages2.length - 1 : current6 + (to === "next" ? 1 : -1);
|
|
421328
422150
|
const page = pages2[Math.max(0, Math.min(pages2.length - 1, target2))];
|
|
421329
422151
|
set4({ selection: [page.id] });
|
|
421330
422152
|
get4().zoomToNodes([page.id], 0.1);
|
|
@@ -424128,9 +424950,14 @@ async function launch2(headful) {
|
|
|
424128
424950
|
const profile = await mkdtemp(join5(tmpdir(), "popcraft-cli-"));
|
|
424129
424951
|
const browser = await puppeteer.launch({
|
|
424130
424952
|
headless: !headful,
|
|
424953
|
+
// A long export on a software renderer outlasts puppeteer's 180 s default for one page.evaluate.
|
|
424954
|
+
protocolTimeout: 0,
|
|
424131
424955
|
userDataDir: profile,
|
|
424132
424956
|
// The same switches as the docs screenshots: WebGPU on a software adapter, so a machine with no GPU still renders.
|
|
424133
|
-
|
|
424957
|
+
// Linux with no GPU (containers, CI, cloud workers): a WebGPU canvas crashes the GPU process on its first present
|
|
424958
|
+
// ("Could not find SharedImageBackingFactory … WebgpuSwapChainTexture", then "A valid external Instance reference
|
|
424959
|
+
// no longer exists") unless the compositor runs ANGLE on Vulkan, which can share the swap-chain image.
|
|
424960
|
+
args: ["--enable-unsafe-webgpu", ...process.platform === "linux" ? ["--enable-features=Vulkan,DefaultANGLEVulkan,VulkanFromANGLE", "--use-angle=vulkan"] : ["--enable-features=Vulkan"], "--enable-unsafe-swiftshader", "--hide-scrollbars", "--mute-audio", "--autoplay-policy=no-user-gesture-required", ...process.env.CI ? ["--no-sandbox"] : []]
|
|
424134
424961
|
});
|
|
424135
424962
|
return { browser, close: async () => {
|
|
424136
424963
|
await browser.close();
|
|
@@ -424954,7 +425781,10 @@ async function openEditor(base, o = {}) {
|
|
|
424954
425781
|
userDataDir: profile,
|
|
424955
425782
|
// A film export is one evaluate that runs for minutes (the hero, the trailer): puppeteer's 3-minute default cut it.
|
|
424956
425783
|
protocolTimeout: 15 * 6e4,
|
|
424957
|
-
|
|
425784
|
+
// Linux with no GPU (containers, CI, cloud workers): a WebGPU canvas crashes the GPU process on its first present
|
|
425785
|
+
// ("Could not find SharedImageBackingFactory … WebgpuSwapChainTexture", then "A valid external Instance reference
|
|
425786
|
+
// no longer exists") unless the compositor runs ANGLE on Vulkan, which can share the swap-chain image.
|
|
425787
|
+
args: ["--enable-unsafe-webgpu", ...process.platform === "linux" ? ["--enable-features=Vulkan,DefaultANGLEVulkan,VulkanFromANGLE", "--use-angle=vulkan"] : ["--enable-features=Vulkan"], "--enable-unsafe-swiftshader", "--hide-scrollbars", ...process.env.CI ? ["--no-sandbox"] : []]
|
|
424958
425788
|
});
|
|
424959
425789
|
let page;
|
|
424960
425790
|
const newTab = async () => {
|
|
@@ -425752,7 +426582,7 @@ init_resources();
|
|
|
425752
426582
|
init_desktop();
|
|
425753
426583
|
init_hypery();
|
|
425754
426584
|
import { createInterface } from "node:readline";
|
|
425755
|
-
var VERSION2 = "0.
|
|
426585
|
+
var VERSION2 = "0.58.1";
|
|
425756
426586
|
var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
|
|
425757
426587
|
|
|
425758
426588
|
Files (headless, on .popcraft files):
|