@popcraft/cli 0.57.2 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/popcraft.mjs +1157 -336
- 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.0"}`, ...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({
|
|
@@ -29244,6 +29244,7 @@ function selectionWorldBounds(nodes, ids2, scrollState) {
|
|
|
29244
29244
|
}
|
|
29245
29245
|
var init_selection_bounds = __esm({
|
|
29246
29246
|
"lib/editor/selection-bounds.ts"() {
|
|
29247
|
+
"use strict";
|
|
29247
29248
|
init_scene_graph();
|
|
29248
29249
|
init_transform();
|
|
29249
29250
|
}
|
|
@@ -29359,6 +29360,7 @@ function scaleSubtreePatches(nodes, id3, sx, sy, includeSelf = true) {
|
|
|
29359
29360
|
var scalePoint;
|
|
29360
29361
|
var init_scale_geometry = __esm({
|
|
29361
29362
|
"lib/document/scale-geometry.ts"() {
|
|
29363
|
+
"use strict";
|
|
29362
29364
|
scalePoint = (p2, sx, sy) => ({
|
|
29363
29365
|
...p2,
|
|
29364
29366
|
x: p2.x * sx,
|
|
@@ -30833,8 +30835,8 @@ var require_base64_js = __commonJS({
|
|
|
30833
30835
|
}
|
|
30834
30836
|
return arr2;
|
|
30835
30837
|
}
|
|
30836
|
-
function tripletToBase64(
|
|
30837
|
-
return lookup[
|
|
30838
|
+
function tripletToBase64(num13) {
|
|
30839
|
+
return lookup[num13 >> 18 & 63] + lookup[num13 >> 12 & 63] + lookup[num13 >> 6 & 63] + lookup[num13 & 63];
|
|
30838
30840
|
}
|
|
30839
30841
|
function encodeChunk(uint82, start2, end) {
|
|
30840
30842
|
var tmp;
|
|
@@ -30942,16 +30944,16 @@ var require_tiny_inflate = __commonJS({
|
|
|
30942
30944
|
for (i2 = 0; i2 < 32; ++i2) dt.trans[i2] = i2;
|
|
30943
30945
|
}
|
|
30944
30946
|
var offs = new Uint16Array(16);
|
|
30945
|
-
function tinf_build_tree(t3, lengths3, off,
|
|
30947
|
+
function tinf_build_tree(t3, lengths3, off, num13) {
|
|
30946
30948
|
var i2, sum;
|
|
30947
30949
|
for (i2 = 0; i2 < 16; ++i2) t3.table[i2] = 0;
|
|
30948
|
-
for (i2 = 0; i2 <
|
|
30950
|
+
for (i2 = 0; i2 < num13; ++i2) t3.table[lengths3[off + i2]]++;
|
|
30949
30951
|
t3.table[0] = 0;
|
|
30950
30952
|
for (sum = 0, i2 = 0; i2 < 16; ++i2) {
|
|
30951
30953
|
offs[i2] = sum;
|
|
30952
30954
|
sum += t3.table[i2];
|
|
30953
30955
|
}
|
|
30954
|
-
for (i2 = 0; i2 <
|
|
30956
|
+
for (i2 = 0; i2 < num13; ++i2) {
|
|
30955
30957
|
if (lengths3[off + i2]) t3.trans[offs[lengths3[off + i2]]++] = i2;
|
|
30956
30958
|
}
|
|
30957
30959
|
}
|
|
@@ -30964,16 +30966,16 @@ var require_tiny_inflate = __commonJS({
|
|
|
30964
30966
|
d.tag >>>= 1;
|
|
30965
30967
|
return bit;
|
|
30966
30968
|
}
|
|
30967
|
-
function tinf_read_bits(d,
|
|
30968
|
-
if (!
|
|
30969
|
+
function tinf_read_bits(d, num13, base) {
|
|
30970
|
+
if (!num13)
|
|
30969
30971
|
return base;
|
|
30970
30972
|
while (d.bitcount < 24) {
|
|
30971
30973
|
d.tag |= d.source[d.sourceIndex++] << d.bitcount;
|
|
30972
30974
|
d.bitcount += 8;
|
|
30973
30975
|
}
|
|
30974
|
-
var val = d.tag & 65535 >>> 16 -
|
|
30975
|
-
d.tag >>>=
|
|
30976
|
-
d.bitcount -=
|
|
30976
|
+
var val = d.tag & 65535 >>> 16 - num13;
|
|
30977
|
+
d.tag >>>= num13;
|
|
30978
|
+
d.bitcount -= num13;
|
|
30977
30979
|
return val + base;
|
|
30978
30980
|
}
|
|
30979
30981
|
function tinf_decode_symbol(d, t3) {
|
|
@@ -30996,7 +30998,7 @@ var require_tiny_inflate = __commonJS({
|
|
|
30996
30998
|
}
|
|
30997
30999
|
function tinf_decode_trees(d, lt, dt) {
|
|
30998
31000
|
var hlit, hdist, hclen;
|
|
30999
|
-
var i2,
|
|
31001
|
+
var i2, num13, length2;
|
|
31000
31002
|
hlit = tinf_read_bits(d, 5, 257);
|
|
31001
31003
|
hdist = tinf_read_bits(d, 5, 1);
|
|
31002
31004
|
hclen = tinf_read_bits(d, 4, 4);
|
|
@@ -31006,27 +31008,27 @@ var require_tiny_inflate = __commonJS({
|
|
|
31006
31008
|
lengths2[clcidx[i2]] = clen2;
|
|
31007
31009
|
}
|
|
31008
31010
|
tinf_build_tree(code_tree, lengths2, 0, 19);
|
|
31009
|
-
for (
|
|
31011
|
+
for (num13 = 0; num13 < hlit + hdist; ) {
|
|
31010
31012
|
var sym = tinf_decode_symbol(d, code_tree);
|
|
31011
31013
|
switch (sym) {
|
|
31012
31014
|
case 16:
|
|
31013
|
-
var prev = lengths2[
|
|
31015
|
+
var prev = lengths2[num13 - 1];
|
|
31014
31016
|
for (length2 = tinf_read_bits(d, 2, 3); length2; --length2) {
|
|
31015
|
-
lengths2[
|
|
31017
|
+
lengths2[num13++] = prev;
|
|
31016
31018
|
}
|
|
31017
31019
|
break;
|
|
31018
31020
|
case 17:
|
|
31019
31021
|
for (length2 = tinf_read_bits(d, 3, 3); length2; --length2) {
|
|
31020
|
-
lengths2[
|
|
31022
|
+
lengths2[num13++] = 0;
|
|
31021
31023
|
}
|
|
31022
31024
|
break;
|
|
31023
31025
|
case 18:
|
|
31024
31026
|
for (length2 = tinf_read_bits(d, 7, 11); length2; --length2) {
|
|
31025
|
-
lengths2[
|
|
31027
|
+
lengths2[num13++] = 0;
|
|
31026
31028
|
}
|
|
31027
31029
|
break;
|
|
31028
31030
|
default:
|
|
31029
|
-
lengths2[
|
|
31031
|
+
lengths2[num13++] = sym;
|
|
31030
31032
|
break;
|
|
31031
31033
|
}
|
|
31032
31034
|
}
|
|
@@ -172572,7 +172574,6 @@ async function sha256Prefix(bytes2) {
|
|
|
172572
172574
|
}
|
|
172573
172575
|
var init_media_hash = __esm({
|
|
172574
172576
|
"lib/storage/media-hash.ts"() {
|
|
172575
|
-
"use strict";
|
|
172576
172577
|
}
|
|
172577
172578
|
});
|
|
172578
172579
|
|
|
@@ -172955,7 +172956,6 @@ function releaseMediaMemory(hash3) {
|
|
|
172955
172956
|
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
172957
|
var init_media_store = __esm({
|
|
172957
172958
|
"lib/storage/media-store.ts"() {
|
|
172958
|
-
"use strict";
|
|
172959
172959
|
init_media_types();
|
|
172960
172960
|
init_idb();
|
|
172961
172961
|
init_media_hash();
|
|
@@ -174556,8 +174556,8 @@ var require_decompress_binding = __commonJS({
|
|
|
174556
174556
|
function _abort() {
|
|
174557
174557
|
abort("");
|
|
174558
174558
|
}
|
|
174559
|
-
function _emscripten_memcpy_big(dest, src,
|
|
174560
|
-
HEAPU8.copyWithin(dest, src, src +
|
|
174559
|
+
function _emscripten_memcpy_big(dest, src, num13) {
|
|
174560
|
+
HEAPU8.copyWithin(dest, src, src + num13);
|
|
174561
174561
|
}
|
|
174562
174562
|
function emscripten_realloc_buffer(size6) {
|
|
174563
174563
|
try {
|
|
@@ -176241,6 +176241,7 @@ var init_frame_labels = __esm({
|
|
|
176241
176241
|
var MODE_PROFILES, isTimelineMode, FOCUS_PROFILES, MODE_LIST, FOCUS_BY_PRECEDENCE;
|
|
176242
176242
|
var init_registry2 = __esm({
|
|
176243
176243
|
"lib/editor/modes/registry.ts"() {
|
|
176244
|
+
"use strict";
|
|
176244
176245
|
MODE_PROFILES = {
|
|
176245
176246
|
DESIGN: {
|
|
176246
176247
|
id: "DESIGN",
|
|
@@ -177965,13 +177966,13 @@ function compositionAt(comp, t3) {
|
|
|
177965
177966
|
else return EMPTY_MOMENT;
|
|
177966
177967
|
}
|
|
177967
177968
|
const clip = clips2[index2];
|
|
177968
|
-
const
|
|
177969
|
+
const current6 = { clip, index: index2, local: clipLocalTime(clip, t3) };
|
|
177969
177970
|
const tr = clip.transitionIn;
|
|
177970
177971
|
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:
|
|
177972
|
+
if (!tr || !prev || tr.duration <= 0 || t3 >= clip.start + tr.duration || t3 < clip.start) return { current: current6, previous: null, transition: null };
|
|
177972
177973
|
const progress2 = evalInterp(tr.interp, (t3 - clip.start) / tr.duration, tr.duration);
|
|
177973
177974
|
return {
|
|
177974
|
-
current:
|
|
177975
|
+
current: current6,
|
|
177975
177976
|
previous: { clip: prev, index: index2 - 1, local: clipLocalTime(prev, t3) },
|
|
177976
177977
|
transition: { type: tr.type, progress: progress2, params: tr.params }
|
|
177977
177978
|
};
|
|
@@ -183384,6 +183385,13 @@ var init_en2 = __esm({
|
|
|
183384
183385
|
"agentPanel.manage": "Manage",
|
|
183385
183386
|
"agentPanel.messageCount": "{count, plural, one {# message} other {# messages}}",
|
|
183386
183387
|
"agentPanel.newChat": "New chat",
|
|
183388
|
+
"agentPanel.orchestration": "Orchestration",
|
|
183389
|
+
"agentPanel.orchestrationAuto": "Auto",
|
|
183390
|
+
"agentPanel.orchestrationAutoHint": "An orchestration skill picks the models for each task",
|
|
183391
|
+
"agentPanel.orchestrationOff": "Off",
|
|
183392
|
+
"agentPanel.orchestrationOffHint": "One model: the one you picked",
|
|
183393
|
+
"agentPanel.orchestrationUltra": "Ultra",
|
|
183394
|
+
"agentPanel.orchestrationUltraHint": "A lead, a parallel swarm and a reviewing advisor, set by an orchestration skill",
|
|
183387
183395
|
"agentPanel.resuming": "Resuming\u2026",
|
|
183388
183396
|
"agentPanel.sendEnter": "Send (Enter)",
|
|
183389
183397
|
"agentPanel.skill": "Skill: {name}",
|
|
@@ -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();
|
|
@@ -260764,6 +260773,7 @@ function resyncText(doc2, ids2) {
|
|
|
260764
260773
|
var isVirtualId;
|
|
260765
260774
|
var init_invariants2 = __esm({
|
|
260766
260775
|
"lib/document/invariants.ts"() {
|
|
260776
|
+
"use strict";
|
|
260767
260777
|
init_auto_layout();
|
|
260768
260778
|
init_scene_graph();
|
|
260769
260779
|
init_text_bounds();
|
|
@@ -261795,6 +261805,7 @@ function beforeWrite() {
|
|
|
261795
261805
|
var leave;
|
|
261796
261806
|
var init_read_only = __esm({
|
|
261797
261807
|
"lib/editor/modes/read-only.ts"() {
|
|
261808
|
+
"use strict";
|
|
261798
261809
|
leave = null;
|
|
261799
261810
|
}
|
|
261800
261811
|
});
|
|
@@ -263466,6 +263477,7 @@ function resizeWindow(doc2, target2, rect) {
|
|
|
263466
263477
|
}
|
|
263467
263478
|
var init_crop = __esm({
|
|
263468
263479
|
"lib/editor/crop.ts"() {
|
|
263480
|
+
"use strict";
|
|
263469
263481
|
init_dist_node();
|
|
263470
263482
|
init_scene_graph();
|
|
263471
263483
|
init_photo_frames();
|
|
@@ -263716,6 +263728,7 @@ function getActiveRenderer() {
|
|
|
263716
263728
|
var active;
|
|
263717
263729
|
var init_renderer_registry = __esm({
|
|
263718
263730
|
"lib/engine/renderer-registry.ts"() {
|
|
263731
|
+
"use strict";
|
|
263719
263732
|
active = null;
|
|
263720
263733
|
}
|
|
263721
263734
|
});
|
|
@@ -266495,6 +266508,7 @@ fn shade(uv: vec2<f32>, res: vec2<f32>, tm: f32) -> vec4<f32> {
|
|
|
266495
266508
|
var SHADER_PRESETS, shaderPreset, legacyPresetOf, DEFAULT_SHADER_PRESET, DEFAULT_TEXTURE_PARAMS, f, vec4, NOISE_LIB;
|
|
266496
266509
|
var init_shader_presets = __esm({
|
|
266497
266510
|
"lib/engine/shader-presets.ts"() {
|
|
266511
|
+
"use strict";
|
|
266498
266512
|
init_shader_graph();
|
|
266499
266513
|
init_shader_graph_presets();
|
|
266500
266514
|
init_shader_presets_legacy();
|
|
@@ -267045,7 +267059,6 @@ function mergeFonts(fonts, incoming) {
|
|
|
267045
267059
|
var fontWeightOf, fontStyleOf, sameSlot, hashOf, documentFontHashes;
|
|
267046
267060
|
var init_document_fonts = __esm({
|
|
267047
267061
|
"lib/fonts/document-fonts.ts"() {
|
|
267048
|
-
"use strict";
|
|
267049
267062
|
init_media_store();
|
|
267050
267063
|
init_media_hash();
|
|
267051
267064
|
fontWeightOf = (f2) => f2.weight ?? 400;
|
|
@@ -267458,6 +267471,7 @@ function followPeers(peers) {
|
|
|
267458
267471
|
var PALETTE, usePresence, awareness, CURSOR_SEND_MS, VIEWPORT_SEND_MS, cursorTimer, pendingCursor, sentCursor, EMOTE_MS, lastFollowCamera;
|
|
267459
267472
|
var init_presence = __esm({
|
|
267460
267473
|
"lib/collab/presence.ts"() {
|
|
267474
|
+
"use strict";
|
|
267461
267475
|
init_esm();
|
|
267462
267476
|
init_editor_store();
|
|
267463
267477
|
init_status_announcements();
|
|
@@ -268298,6 +268312,7 @@ async function docExists(id3) {
|
|
|
268298
268312
|
var INDEX_KEY, docKey, thumbKey, THUMB_MAX_BYTES, THUMB_TYPES, LEGACY_DATA_URL, migrating, SPLIT_LAYOUT, nodeKey, WRITER, persisted, saving, deletedHere, keyval, keyvalStore;
|
|
268299
268313
|
var init_document_library = __esm({
|
|
268300
268314
|
"lib/storage/document-library.ts"() {
|
|
268315
|
+
"use strict";
|
|
268301
268316
|
init_idb();
|
|
268302
268317
|
init_media_types();
|
|
268303
268318
|
init_collapse_duplicates();
|
|
@@ -268369,6 +268384,7 @@ function onTabMessage(fn) {
|
|
|
268369
268384
|
var EDITOR_HOME, localDocPath, cloudFilePath, CHANNEL2, channel2;
|
|
268370
268385
|
var init_tab_mode = __esm({
|
|
268371
268386
|
"lib/desktop/tab-mode.ts"() {
|
|
268387
|
+
"use strict";
|
|
268372
268388
|
EDITOR_HOME = "/home";
|
|
268373
268389
|
localDocPath = (docId) => `${EDITOR_HOME}?doc=${encodeURIComponent(docId)}`;
|
|
268374
268390
|
cloudFilePath = (key5) => `/pop/${encodeURIComponent(key5)}`;
|
|
@@ -269970,6 +269986,7 @@ function staggerDocument(doc2, ids2, opts) {
|
|
|
269970
269986
|
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
269987
|
var init_presets = __esm({
|
|
269972
269988
|
"lib/motion/presets.ts"() {
|
|
269989
|
+
"use strict";
|
|
269973
269990
|
init_author();
|
|
269974
269991
|
init_keys();
|
|
269975
269992
|
init_markers();
|
|
@@ -271131,6 +271148,7 @@ function retuneShaderAudio(node2, fillId) {
|
|
|
271131
271148
|
}
|
|
271132
271149
|
var init_shader_audio = __esm({
|
|
271133
271150
|
"lib/motion/shader-audio.ts"() {
|
|
271151
|
+
"use strict";
|
|
271134
271152
|
init_shader_params();
|
|
271135
271153
|
init_modifier_edit();
|
|
271136
271154
|
init_keys();
|
|
@@ -271923,6 +271941,7 @@ function breakpointView(state, doc2 = state.document) {
|
|
|
271923
271941
|
var storedDocument;
|
|
271924
271942
|
var init_view = __esm({
|
|
271925
271943
|
"lib/motion/view.ts"() {
|
|
271944
|
+
"use strict";
|
|
271926
271945
|
init_registry2();
|
|
271927
271946
|
init_motion_slice();
|
|
271928
271947
|
init_transport_clock();
|
|
@@ -272308,8 +272327,8 @@ function scopeOf(doc2, key5, record2) {
|
|
|
272308
272327
|
const c2 = r && doc2.collections?.[r.collectionId];
|
|
272309
272328
|
return withKey(r && c2 ? itemScope(c2, r, vars) : vars, key5);
|
|
272310
272329
|
}
|
|
272311
|
-
function setVariableValue(action3, variable,
|
|
272312
|
-
if (action3.variableToggle) return !
|
|
272330
|
+
function setVariableValue(action3, variable, current6, doc2, key5, record2) {
|
|
272331
|
+
if (action3.variableToggle) return !current6;
|
|
272313
272332
|
if (action3.variableExpression !== void 0 && action3.variableExpression.trim()) {
|
|
272314
272333
|
const v = tryEvaluate(action3.variableExpression, scopeOf(doc2, key5, record2));
|
|
272315
272334
|
return v === void 0 ? void 0 : coerceToVariable(variable.type, v);
|
|
@@ -272356,7 +272375,7 @@ function scrollerOf(nodes, id3) {
|
|
|
272356
272375
|
for (let cur = nodes[id3]?.parentId; cur; cur = nodes[cur]?.parentId) if (scrolls(nodes[cur])) return cur;
|
|
272357
272376
|
return null;
|
|
272358
272377
|
}
|
|
272359
|
-
function placed(doc2, frameId,
|
|
272378
|
+
function placed(doc2, frameId, current6, x2, y) {
|
|
272360
272379
|
const node2 = doc2.nodes[frameId];
|
|
272361
272380
|
if (!scrolls(node2)) return null;
|
|
272362
272381
|
const bounds2 = getNodeBounds(doc2, frameId);
|
|
@@ -272364,8 +272383,8 @@ function placed(doc2, frameId, current5, x2, y) {
|
|
|
272364
272383
|
const maxX = Math.max(0, bounds2.width - node2.width);
|
|
272365
272384
|
const maxY = Math.max(0, bounds2.height - node2.height);
|
|
272366
272385
|
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)) :
|
|
272386
|
+
x: node2.overflowScrolling === "HORIZONTAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxX, x2)) : current6.x,
|
|
272387
|
+
y: node2.overflowScrolling === "VERTICAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxY, y)) : current6.y
|
|
272369
272388
|
};
|
|
272370
272389
|
}
|
|
272371
272390
|
function scrollBy(state, frameId, dx, dy) {
|
|
@@ -274083,7 +274102,7 @@ var init_number = __esm({
|
|
|
274083
274102
|
MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
274084
274103
|
MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER;
|
|
274085
274104
|
LOWEST_INT32 = 1 << 31;
|
|
274086
|
-
isInteger = Number.isInteger || ((
|
|
274105
|
+
isInteger = Number.isInteger || ((num13) => typeof num13 === "number" && isFinite(num13) && floor(num13) === num13);
|
|
274087
274106
|
isNaN3 = Number.isNaN;
|
|
274088
274107
|
parseInt2 = Number.parseInt;
|
|
274089
274108
|
}
|
|
@@ -274165,33 +274184,33 @@ var init_encoding = __esm({
|
|
|
274165
274184
|
encoder.cpos = 0;
|
|
274166
274185
|
}
|
|
274167
274186
|
};
|
|
274168
|
-
write = (encoder,
|
|
274187
|
+
write = (encoder, num13) => {
|
|
274169
274188
|
const bufferLen = encoder.cbuf.length;
|
|
274170
274189
|
if (encoder.cpos === bufferLen) {
|
|
274171
274190
|
encoder.bufs.push(encoder.cbuf);
|
|
274172
274191
|
encoder.cbuf = new Uint8Array(bufferLen * 2);
|
|
274173
274192
|
encoder.cpos = 0;
|
|
274174
274193
|
}
|
|
274175
|
-
encoder.cbuf[encoder.cpos++] =
|
|
274194
|
+
encoder.cbuf[encoder.cpos++] = num13;
|
|
274176
274195
|
};
|
|
274177
274196
|
writeUint8 = write;
|
|
274178
|
-
writeVarUint = (encoder,
|
|
274179
|
-
while (
|
|
274180
|
-
write(encoder, BIT8 | BITS7 &
|
|
274181
|
-
|
|
274197
|
+
writeVarUint = (encoder, num13) => {
|
|
274198
|
+
while (num13 > BITS7) {
|
|
274199
|
+
write(encoder, BIT8 | BITS7 & num13);
|
|
274200
|
+
num13 = floor(num13 / 128);
|
|
274182
274201
|
}
|
|
274183
|
-
write(encoder, BITS7 &
|
|
274202
|
+
write(encoder, BITS7 & num13);
|
|
274184
274203
|
};
|
|
274185
|
-
writeVarInt = (encoder,
|
|
274186
|
-
const isNegative = isNegativeZero(
|
|
274204
|
+
writeVarInt = (encoder, num13) => {
|
|
274205
|
+
const isNegative = isNegativeZero(num13);
|
|
274187
274206
|
if (isNegative) {
|
|
274188
|
-
|
|
274207
|
+
num13 = -num13;
|
|
274189
274208
|
}
|
|
274190
|
-
write(encoder, (
|
|
274191
|
-
|
|
274192
|
-
while (
|
|
274193
|
-
write(encoder, (
|
|
274194
|
-
|
|
274209
|
+
write(encoder, (num13 > BITS6 ? BIT8 : 0) | (isNegative ? BIT7 : 0) | BITS6 & num13);
|
|
274210
|
+
num13 = floor(num13 / 64);
|
|
274211
|
+
while (num13 > 0) {
|
|
274212
|
+
write(encoder, (num13 > BITS7 ? BIT8 : 0) | BITS7 & num13);
|
|
274213
|
+
num13 = floor(num13 / 128);
|
|
274195
274214
|
}
|
|
274196
274215
|
};
|
|
274197
274216
|
_strBuffer = new Uint8Array(3e4);
|
|
@@ -274245,16 +274264,16 @@ var init_encoding = __esm({
|
|
|
274245
274264
|
encoder.cpos += len3;
|
|
274246
274265
|
return dview;
|
|
274247
274266
|
};
|
|
274248
|
-
writeFloat32 = (encoder,
|
|
274249
|
-
writeFloat64 = (encoder,
|
|
274250
|
-
writeBigInt64 = (encoder,
|
|
274267
|
+
writeFloat32 = (encoder, num13) => writeOnDataView(encoder, 4).setFloat32(0, num13, false);
|
|
274268
|
+
writeFloat64 = (encoder, num13) => writeOnDataView(encoder, 8).setFloat64(0, num13, false);
|
|
274269
|
+
writeBigInt64 = (encoder, num13) => (
|
|
274251
274270
|
/** @type {any} */
|
|
274252
|
-
writeOnDataView(encoder, 8).setBigInt64(0,
|
|
274271
|
+
writeOnDataView(encoder, 8).setBigInt64(0, num13, false)
|
|
274253
274272
|
);
|
|
274254
274273
|
floatTestBed = new DataView(new ArrayBuffer(4));
|
|
274255
|
-
isFloat32 = (
|
|
274256
|
-
floatTestBed.setFloat32(0,
|
|
274257
|
-
return floatTestBed.getFloat32(0) ===
|
|
274274
|
+
isFloat32 = (num13) => {
|
|
274275
|
+
floatTestBed.setFloat32(0, num13);
|
|
274276
|
+
return floatTestBed.getFloat32(0) === num13;
|
|
274258
274277
|
};
|
|
274259
274278
|
writeAny = (encoder, data) => {
|
|
274260
274279
|
switch (typeof data) {
|
|
@@ -274495,17 +274514,17 @@ var init_decoding = __esm({
|
|
|
274495
274514
|
readVarUint8Array = (decoder) => readUint8Array(decoder, readVarUint(decoder));
|
|
274496
274515
|
readUint8 = (decoder) => decoder.arr[decoder.pos++];
|
|
274497
274516
|
readVarUint = (decoder) => {
|
|
274498
|
-
let
|
|
274517
|
+
let num13 = 0;
|
|
274499
274518
|
let mult = 1;
|
|
274500
274519
|
const len3 = decoder.arr.length;
|
|
274501
274520
|
while (decoder.pos < len3) {
|
|
274502
274521
|
const r = decoder.arr[decoder.pos++];
|
|
274503
|
-
|
|
274522
|
+
num13 = num13 + (r & BITS7) * mult;
|
|
274504
274523
|
mult *= 128;
|
|
274505
274524
|
if (r < BIT8) {
|
|
274506
|
-
return
|
|
274525
|
+
return num13;
|
|
274507
274526
|
}
|
|
274508
|
-
if (
|
|
274527
|
+
if (num13 > MAX_SAFE_INTEGER) {
|
|
274509
274528
|
throw errorIntegerOutOfRange;
|
|
274510
274529
|
}
|
|
274511
274530
|
}
|
|
@@ -274513,21 +274532,21 @@ var init_decoding = __esm({
|
|
|
274513
274532
|
};
|
|
274514
274533
|
readVarInt = (decoder) => {
|
|
274515
274534
|
let r = decoder.arr[decoder.pos++];
|
|
274516
|
-
let
|
|
274535
|
+
let num13 = r & BITS6;
|
|
274517
274536
|
let mult = 64;
|
|
274518
274537
|
const sign = (r & BIT7) > 0 ? -1 : 1;
|
|
274519
274538
|
if ((r & BIT8) === 0) {
|
|
274520
|
-
return sign *
|
|
274539
|
+
return sign * num13;
|
|
274521
274540
|
}
|
|
274522
274541
|
const len3 = decoder.arr.length;
|
|
274523
274542
|
while (decoder.pos < len3) {
|
|
274524
274543
|
r = decoder.arr[decoder.pos++];
|
|
274525
|
-
|
|
274544
|
+
num13 = num13 + (r & BITS7) * mult;
|
|
274526
274545
|
mult *= 128;
|
|
274527
274546
|
if (r < BIT8) {
|
|
274528
|
-
return sign *
|
|
274547
|
+
return sign * num13;
|
|
274529
274548
|
}
|
|
274530
|
-
if (
|
|
274549
|
+
if (num13 > MAX_SAFE_INTEGER) {
|
|
274531
274550
|
throw errorIntegerOutOfRange;
|
|
274532
274551
|
}
|
|
274533
274552
|
}
|
|
@@ -282276,11 +282295,11 @@ function repairTree(nodes, pages2) {
|
|
|
282276
282295
|
});
|
|
282277
282296
|
if (keep.length !== kids.length) put3({ ...node2, childIds: keep });
|
|
282278
282297
|
}
|
|
282279
|
-
const
|
|
282280
|
-
for (const id3 in
|
|
282281
|
-
const node2 =
|
|
282298
|
+
const current6 = out ?? nodes;
|
|
282299
|
+
for (const id3 in current6) {
|
|
282300
|
+
const node2 = current6[id3];
|
|
282282
282301
|
if (pages2.includes(id3)) continue;
|
|
282283
|
-
const parents = (listedBy.get(id3) ?? []).filter((p2) => (
|
|
282302
|
+
const parents = (listedBy.get(id3) ?? []).filter((p2) => (current6[p2].childIds ?? []).includes(id3));
|
|
282284
282303
|
const parent = parents[0] ?? null;
|
|
282285
282304
|
if (parent && node2.parentId !== parent) put3({ ...node2, parentId: parent });
|
|
282286
282305
|
}
|
|
@@ -282326,7 +282345,7 @@ function finishDocument(ydoc, base, nodes) {
|
|
|
282326
282345
|
}
|
|
282327
282346
|
return doc2;
|
|
282328
282347
|
}
|
|
282329
|
-
function applyYEventsToDocument(ydoc,
|
|
282348
|
+
function applyYEventsToDocument(ydoc, current6, events) {
|
|
282330
282349
|
const ynodes = yNodes(ydoc);
|
|
282331
282350
|
const touched = /* @__PURE__ */ new Set();
|
|
282332
282351
|
let structure = false;
|
|
@@ -282344,9 +282363,9 @@ function applyYEventsToDocument(ydoc, current5, events) {
|
|
|
282344
282363
|
structure = true;
|
|
282345
282364
|
}
|
|
282346
282365
|
}
|
|
282347
|
-
let nodes =
|
|
282366
|
+
let nodes = current6.nodes;
|
|
282348
282367
|
if (touched.size) {
|
|
282349
|
-
nodes = { ...
|
|
282368
|
+
nodes = { ...current6.nodes };
|
|
282350
282369
|
for (const id3 of touched) {
|
|
282351
282370
|
if (!isSafeKey(id3)) continue;
|
|
282352
282371
|
const ynode = ynodes.get(id3);
|
|
@@ -282354,9 +282373,9 @@ function applyYEventsToDocument(ydoc, current5, events) {
|
|
|
282354
282373
|
else delete nodes[id3];
|
|
282355
282374
|
}
|
|
282356
282375
|
}
|
|
282357
|
-
if (!touched.size && !structure) return
|
|
282358
|
-
if (!structure && !tree) return { ...
|
|
282359
|
-
return finishDocument(ydoc,
|
|
282376
|
+
if (!touched.size && !structure) return current6;
|
|
282377
|
+
if (!structure && !tree) return { ...current6, nodes };
|
|
282378
|
+
return finishDocument(ydoc, current6, nodes);
|
|
282360
282379
|
}
|
|
282361
282380
|
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
282381
|
var init_ydoc = __esm({
|
|
@@ -283522,12 +283541,12 @@ function startCollabSession(docId, opts) {
|
|
|
283522
283541
|
if (!bound || tr.origin === LOCAL_ORIGIN || !isActive()) return;
|
|
283523
283542
|
if (useEditorStore.getState().isVersionHistoryMode) return;
|
|
283524
283543
|
if (sendTimer) flush();
|
|
283525
|
-
const
|
|
283526
|
-
const sharedCurrent = withoutPrivate(
|
|
283544
|
+
const current6 = useEditorStore.getState().document;
|
|
283545
|
+
const sharedCurrent = withoutPrivate(current6);
|
|
283527
283546
|
const shared = applyYEventsToDocument(ydoc, sharedCurrent, events);
|
|
283528
283547
|
if (shared === sharedCurrent) return;
|
|
283529
|
-
const next2 = repairDocumentPaints(migrateDocumentMotion(restorePrivate(shared,
|
|
283530
|
-
if (!(tr.origin instanceof UndoManager)) noteRemoteChanges(
|
|
283548
|
+
const next2 = repairDocumentPaints(migrateDocumentMotion(restorePrivate(shared, current6)));
|
|
283549
|
+
if (!(tr.origin instanceof UndoManager)) noteRemoteChanges(current6, next2, changedIds(current6, next2, events));
|
|
283531
283550
|
if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent("popcraft-media-retry"));
|
|
283532
283551
|
applyingRemote = true;
|
|
283533
283552
|
synced = shared;
|
|
@@ -283665,9 +283684,9 @@ function withDeadline(p2, ms3) {
|
|
|
283665
283684
|
return Promise.race([p2, deadline]).finally(() => clearTimeout(timer));
|
|
283666
283685
|
}
|
|
283667
283686
|
async function trackOpen(run4, opts = {}) {
|
|
283668
|
-
const
|
|
283669
|
-
if (
|
|
283670
|
-
const joined = { stage: (s) => patch(
|
|
283687
|
+
const current6 = useOpenProgress.getState().open;
|
|
283688
|
+
if (current6 && !current6.error) {
|
|
283689
|
+
const joined = { stage: (s) => patch(current6.id, { stage: s }) };
|
|
283671
283690
|
return run4(joined);
|
|
283672
283691
|
}
|
|
283673
283692
|
const id3 = nextId++;
|
|
@@ -283936,6 +283955,7 @@ async function prepareTemplate(t3) {
|
|
|
283936
283955
|
var templateMediaSources, MEDIA_FETCH_TIMEOUT_MS2, PREPARE_BUDGET_MS, MEDIA_CONCURRENCY, timeoutOf;
|
|
283937
283956
|
var init_use = __esm({
|
|
283938
283957
|
"lib/templates/use.ts"() {
|
|
283958
|
+
"use strict";
|
|
283939
283959
|
init_capture();
|
|
283940
283960
|
templateMediaSources = (t3, hash3) => [
|
|
283941
283961
|
`/templates/media/${hash3}`,
|
|
@@ -291782,15 +291802,15 @@ var init_isobmff_demuxer = __esm({
|
|
|
291782
291802
|
break;
|
|
291783
291803
|
}
|
|
291784
291804
|
assert2(track3.info?.type === "video");
|
|
291785
|
-
const
|
|
291805
|
+
const num13 = readU32Be(slice2);
|
|
291786
291806
|
const den = readU32Be(slice2);
|
|
291787
|
-
if (
|
|
291807
|
+
if (num13 > 0 && den > 0) {
|
|
291788
291808
|
track3.info.squarePixelWidth = track3.info.width;
|
|
291789
291809
|
track3.info.squarePixelHeight = track3.info.height;
|
|
291790
|
-
if (
|
|
291791
|
-
track3.info.squarePixelWidth = Math.round(track3.info.width *
|
|
291810
|
+
if (num13 > den) {
|
|
291811
|
+
track3.info.squarePixelWidth = Math.round(track3.info.width * num13 / den);
|
|
291792
291812
|
} else {
|
|
291793
|
-
track3.info.squarePixelHeight = Math.round(track3.info.height * den /
|
|
291813
|
+
track3.info.squarePixelHeight = Math.round(track3.info.height * den / num13);
|
|
291794
291814
|
}
|
|
291795
291815
|
}
|
|
291796
291816
|
}
|
|
@@ -293608,16 +293628,16 @@ var init_isobmff_demuxer = __esm({
|
|
|
293608
293628
|
if (info2.type !== "video") {
|
|
293609
293629
|
return;
|
|
293610
293630
|
}
|
|
293611
|
-
const { num:
|
|
293612
|
-
if (!(
|
|
293631
|
+
const { num: num13, den } = pixelAspectRatio;
|
|
293632
|
+
if (!(num13 > 0 && den > 0) || num13 === den) {
|
|
293613
293633
|
return;
|
|
293614
293634
|
}
|
|
293615
|
-
if (
|
|
293616
|
-
info2.squarePixelWidth = Math.round(info2.width *
|
|
293635
|
+
if (num13 > den) {
|
|
293636
|
+
info2.squarePixelWidth = Math.round(info2.width * num13 / den);
|
|
293617
293637
|
info2.squarePixelHeight = info2.height;
|
|
293618
293638
|
} else {
|
|
293619
293639
|
info2.squarePixelWidth = info2.width;
|
|
293620
|
-
info2.squarePixelHeight = Math.round(info2.height * den /
|
|
293640
|
+
info2.squarePixelHeight = Math.round(info2.height * den / num13);
|
|
293621
293641
|
}
|
|
293622
293642
|
};
|
|
293623
293643
|
sampleTableIsEmpty = (sampleTable) => {
|
|
@@ -295133,13 +295153,13 @@ var init_matroska_demuxer = __esm({
|
|
|
295133
295153
|
this.currentTrack.info.squarePixelWidth = this.currentTrack.info.width;
|
|
295134
295154
|
this.currentTrack.info.squarePixelHeight = this.currentTrack.info.height;
|
|
295135
295155
|
if (this.currentTrack.info.displayWidth !== null && this.currentTrack.info.displayHeight !== null) {
|
|
295136
|
-
const
|
|
295156
|
+
const num13 = this.currentTrack.info.displayWidth * this.currentTrack.info.height;
|
|
295137
295157
|
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 *
|
|
295158
|
+
if (num13 > 0 && den > 0) {
|
|
295159
|
+
if (num13 > den) {
|
|
295160
|
+
this.currentTrack.info.squarePixelWidth = Math.round(this.currentTrack.info.width * num13 / den);
|
|
295141
295161
|
} else {
|
|
295142
|
-
this.currentTrack.info.squarePixelHeight = Math.round(this.currentTrack.info.height * den /
|
|
295162
|
+
this.currentTrack.info.squarePixelHeight = Math.round(this.currentTrack.info.height * den / num13);
|
|
295143
295163
|
}
|
|
295144
295164
|
}
|
|
295145
295165
|
}
|
|
@@ -299040,7 +299060,7 @@ var init_flac_demuxer = __esm({
|
|
|
299040
299060
|
if (reservedZero !== 0) {
|
|
299041
299061
|
return null;
|
|
299042
299062
|
}
|
|
299043
|
-
const
|
|
299063
|
+
const num13 = readCodedNumber(slice2);
|
|
299044
299064
|
const blockSize = readBlockSize(slice2, blockSizeOrUncommon);
|
|
299045
299065
|
const sampleRate = readSampleRate(slice2, sampleRateOrUncommon);
|
|
299046
299066
|
if (sampleRate === null) {
|
|
@@ -299057,7 +299077,7 @@ var init_flac_demuxer = __esm({
|
|
|
299057
299077
|
if (crc2 !== crcCalculated) {
|
|
299058
299078
|
return null;
|
|
299059
299079
|
}
|
|
299060
|
-
return { num:
|
|
299080
|
+
return { num: num13, blockSize, sampleRate };
|
|
299061
299081
|
}
|
|
299062
299082
|
async advanceReader() {
|
|
299063
299083
|
await this.readMetadata();
|
|
@@ -299590,15 +299610,15 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
299590
299610
|
const spsInfo = parseAvcSps(spsUnit);
|
|
299591
299611
|
elementaryStream.info.width = spsInfo.displayWidth;
|
|
299592
299612
|
elementaryStream.info.height = spsInfo.displayHeight;
|
|
299593
|
-
const
|
|
299613
|
+
const num13 = spsInfo.pixelAspectRatio.num;
|
|
299594
299614
|
const den = spsInfo.pixelAspectRatio.den;
|
|
299595
299615
|
elementaryStream.info.squarePixelWidth = elementaryStream.info.width;
|
|
299596
299616
|
elementaryStream.info.squarePixelHeight = elementaryStream.info.height;
|
|
299597
|
-
if (
|
|
299598
|
-
if (
|
|
299599
|
-
elementaryStream.info.squarePixelWidth = Math.round(elementaryStream.info.width *
|
|
299617
|
+
if (num13 > 0 && den > 0) {
|
|
299618
|
+
if (num13 > den) {
|
|
299619
|
+
elementaryStream.info.squarePixelWidth = Math.round(elementaryStream.info.width * num13 / den);
|
|
299600
299620
|
} else {
|
|
299601
|
-
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den /
|
|
299621
|
+
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den / num13);
|
|
299602
299622
|
}
|
|
299603
299623
|
}
|
|
299604
299624
|
elementaryStream.info.colorSpace = {
|
|
@@ -299623,15 +299643,15 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
299623
299643
|
const spsInfo = parseHevcSps(spsUnit);
|
|
299624
299644
|
elementaryStream.info.width = spsInfo.displayWidth;
|
|
299625
299645
|
elementaryStream.info.height = spsInfo.displayHeight;
|
|
299626
|
-
const
|
|
299646
|
+
const num13 = spsInfo.pixelAspectRatio.num;
|
|
299627
299647
|
const den = spsInfo.pixelAspectRatio.den;
|
|
299628
299648
|
elementaryStream.info.squarePixelWidth = elementaryStream.info.width;
|
|
299629
299649
|
elementaryStream.info.squarePixelHeight = elementaryStream.info.height;
|
|
299630
|
-
if (
|
|
299631
|
-
if (
|
|
299632
|
-
elementaryStream.info.squarePixelWidth = Math.round(elementaryStream.info.width *
|
|
299650
|
+
if (num13 > 0 && den > 0) {
|
|
299651
|
+
if (num13 > den) {
|
|
299652
|
+
elementaryStream.info.squarePixelWidth = Math.round(elementaryStream.info.width * num13 / den);
|
|
299633
299653
|
} else {
|
|
299634
|
-
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den /
|
|
299654
|
+
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den / num13);
|
|
299635
299655
|
}
|
|
299636
299656
|
}
|
|
299637
299657
|
elementaryStream.info.colorSpace = {
|
|
@@ -301032,10 +301052,10 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
301032
301052
|
return true;
|
|
301033
301053
|
}
|
|
301034
301054
|
async ensureCurrentPacketHasNext() {
|
|
301035
|
-
const
|
|
301036
|
-
assert2(
|
|
301055
|
+
const current6 = this.decodeOrderPackets[0];
|
|
301056
|
+
assert2(current6);
|
|
301037
301057
|
while (true) {
|
|
301038
|
-
const presentationIndex = this.presentationOrderPackets.indexOf(
|
|
301058
|
+
const presentationIndex = this.presentationOrderPackets.indexOf(current6);
|
|
301039
301059
|
if (presentationIndex !== -1 && presentationIndex <= this.presentationOrderPackets.length - 2) {
|
|
301040
301060
|
break;
|
|
301041
301061
|
}
|
|
@@ -301144,8 +301164,8 @@ var init_hls_misc = __esm({
|
|
|
301144
301164
|
if (value3 === null) {
|
|
301145
301165
|
return null;
|
|
301146
301166
|
}
|
|
301147
|
-
const
|
|
301148
|
-
return Number.isFinite(
|
|
301167
|
+
const num13 = Number(value3);
|
|
301168
|
+
return Number.isFinite(num13) ? num13 : null;
|
|
301149
301169
|
}
|
|
301150
301170
|
merge(other) {
|
|
301151
301171
|
Object.assign(this._attributes, other._attributes);
|
|
@@ -308525,9 +308545,9 @@ var init_input_track = __esm({
|
|
|
308525
308545
|
};
|
|
308526
308546
|
simplestFractionBetween = (lo, hi, maxDenominator) => {
|
|
308527
308547
|
for (let den = 1; den <= maxDenominator; den++) {
|
|
308528
|
-
const
|
|
308529
|
-
if (
|
|
308530
|
-
return simplifyRational({ num:
|
|
308548
|
+
const num13 = Math.floor(lo * den) + 1;
|
|
308549
|
+
if (num13 / den < hi) {
|
|
308550
|
+
return simplifyRational({ num: num13, den });
|
|
308531
308551
|
}
|
|
308532
308552
|
}
|
|
308533
308553
|
return null;
|
|
@@ -320480,9 +320500,9 @@ function arcToCubics(p0, rx, ry, phiDeg, large, sweep, p2) {
|
|
|
320480
320500
|
rx *= Math.sqrt(lambda);
|
|
320481
320501
|
ry *= Math.sqrt(lambda);
|
|
320482
320502
|
}
|
|
320483
|
-
const
|
|
320503
|
+
const num13 = rx * rx * ry * ry - rx * rx * y1 * y1 - ry * ry * x1 * x1;
|
|
320484
320504
|
const den = rx * rx * y1 * y1 + ry * ry * x1 * x1;
|
|
320485
|
-
const k2 = (large === sweep ? -1 : 1) * Math.sqrt(Math.max(0,
|
|
320505
|
+
const k2 = (large === sweep ? -1 : 1) * Math.sqrt(Math.max(0, num13 / den));
|
|
320486
320506
|
const cx1 = k2 * rx * y1 / ry, cy1 = -k2 * ry * x1 / rx;
|
|
320487
320507
|
const cx = cos * cx1 - sin * cy1 + (p0.x + p2.x) / 2, cy = sin * cx1 + cos * cy1 + (p0.y + p2.y) / 2;
|
|
320488
320508
|
const ang = (ux, uy, vx, vy) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);
|
|
@@ -320510,7 +320530,7 @@ function parsePathData(d) {
|
|
|
320510
320530
|
let lastC2 = null, lastQ = null;
|
|
320511
320531
|
let cmd = "", i2 = 0;
|
|
320512
320532
|
const isCmd = (t3) => /^[a-zA-Z]$/.test(t3);
|
|
320513
|
-
const
|
|
320533
|
+
const num13 = () => Number(tokens[i2++]);
|
|
320514
320534
|
const hasNum = () => i2 < tokens.length && !isCmd(tokens[i2]);
|
|
320515
320535
|
const flag = () => {
|
|
320516
320536
|
const t3 = tokens[i2] ?? "0";
|
|
@@ -320552,7 +320572,7 @@ function parsePathData(d) {
|
|
|
320552
320572
|
switch (cmd.toUpperCase()) {
|
|
320553
320573
|
case "M": {
|
|
320554
320574
|
if (!hasNum()) break;
|
|
320555
|
-
const p2 = { x: ox +
|
|
320575
|
+
const p2 = { x: ox + num13(), y: oy + num13() };
|
|
320556
320576
|
cur = p2;
|
|
320557
320577
|
start2 = p2;
|
|
320558
320578
|
sub2 = { start: { ...p2 }, segs: [], closed: false };
|
|
@@ -320564,34 +320584,34 @@ function parsePathData(d) {
|
|
|
320564
320584
|
}
|
|
320565
320585
|
case "L":
|
|
320566
320586
|
if (!hasNum()) break;
|
|
320567
|
-
line({ x: ox +
|
|
320587
|
+
line({ x: ox + num13(), y: oy + num13() });
|
|
320568
320588
|
break;
|
|
320569
320589
|
case "H":
|
|
320570
320590
|
if (!hasNum()) break;
|
|
320571
|
-
line({ x: ox +
|
|
320591
|
+
line({ x: ox + num13(), y: cur.y });
|
|
320572
320592
|
break;
|
|
320573
320593
|
case "V":
|
|
320574
320594
|
if (!hasNum()) break;
|
|
320575
|
-
line({ x: cur.x, y: oy +
|
|
320595
|
+
line({ x: cur.x, y: oy + num13() });
|
|
320576
320596
|
break;
|
|
320577
320597
|
case "C": {
|
|
320578
320598
|
if (!hasNum()) break;
|
|
320579
|
-
const c1 = { x: ox +
|
|
320599
|
+
const c1 = { x: ox + num13(), y: oy + num13() }, c2 = { x: ox + num13(), y: oy + num13() }, p2 = { x: ox + num13(), y: oy + num13() };
|
|
320580
320600
|
cubic(c1, c2, p2);
|
|
320581
320601
|
break;
|
|
320582
320602
|
}
|
|
320583
320603
|
case "S": {
|
|
320584
320604
|
if (!hasNum()) break;
|
|
320585
320605
|
const c1 = lastC2 ? { x: 2 * cur.x - lastC2.x, y: 2 * cur.y - lastC2.y } : { ...cur };
|
|
320586
|
-
const c2 = { x: ox +
|
|
320606
|
+
const c2 = { x: ox + num13(), y: oy + num13() }, p2 = { x: ox + num13(), y: oy + num13() };
|
|
320587
320607
|
cubic(c1, c2, p2);
|
|
320588
320608
|
break;
|
|
320589
320609
|
}
|
|
320590
320610
|
case "Q":
|
|
320591
320611
|
case "T": {
|
|
320592
320612
|
if (!hasNum()) break;
|
|
320593
|
-
const q = cmd.toUpperCase() === "Q" ? { x: ox +
|
|
320594
|
-
const p2 = { x: ox +
|
|
320613
|
+
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 };
|
|
320614
|
+
const p2 = { x: ox + num13(), y: oy + num13() };
|
|
320595
320615
|
const p0 = cur;
|
|
320596
320616
|
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
320617
|
lastQ = q;
|
|
@@ -320599,8 +320619,8 @@ function parsePathData(d) {
|
|
|
320599
320619
|
}
|
|
320600
320620
|
case "A": {
|
|
320601
320621
|
if (!hasNum()) break;
|
|
320602
|
-
const rx =
|
|
320603
|
-
const p2 = { x: ox +
|
|
320622
|
+
const rx = num13(), ry = num13(), rot = num13(), large = flag(), sweep = flag();
|
|
320623
|
+
const p2 = { x: ox + num13(), y: oy + num13() };
|
|
320604
320624
|
const parts = arcToCubics(cur, rx, ry, rot, large, sweep, p2);
|
|
320605
320625
|
for (const s of parts) cubic(s.c1, s.c2, s.p);
|
|
320606
320626
|
lastC2 = null;
|
|
@@ -320686,11 +320706,11 @@ function pathBounds(paths) {
|
|
|
320686
320706
|
}
|
|
320687
320707
|
return minX === Infinity ? null : { minX, minY, maxX, maxY };
|
|
320688
320708
|
}
|
|
320689
|
-
function parseColor2(input2,
|
|
320709
|
+
function parseColor2(input2, current6) {
|
|
320690
320710
|
if (!input2) return null;
|
|
320691
320711
|
const s = input2.trim().toLowerCase();
|
|
320692
320712
|
if (!s || s === "none" || s === "transparent") return null;
|
|
320693
|
-
if (s === "currentcolor") return
|
|
320713
|
+
if (s === "currentcolor") return current6 ?? { r: 0, g: 0, b: 0, a: 1 };
|
|
320694
320714
|
const hex10 = s.startsWith("#") ? s.slice(1) : NAMED[s];
|
|
320695
320715
|
if (hex10 && /^[0-9a-f]+$/.test(hex10)) {
|
|
320696
320716
|
const full = hex10.length <= 4 ? hex10.split("").map((c2) => c2 + c2).join("") : hex10;
|
|
@@ -322163,8 +322183,8 @@ function reflectUrl() {
|
|
|
322163
322183
|
const base = documentPath({ linkKey: activeLink?.key, localDocId });
|
|
322164
322184
|
const atSameAddress = window.location.pathname === base.split("?")[0];
|
|
322165
322185
|
const path = atSameAddress ? withDeepLink(base, parseDeepLink(window.location.search)) : base;
|
|
322166
|
-
const
|
|
322167
|
-
if (
|
|
322186
|
+
const current6 = window.location.pathname + (isDesktopTabs() || localDocId || path.includes("?") ? window.location.search : "");
|
|
322187
|
+
if (current6 !== path) window.history.replaceState(null, "", path);
|
|
322168
322188
|
}
|
|
322169
322189
|
function onSyncStatus(fn) {
|
|
322170
322190
|
statusListeners.add(fn);
|
|
@@ -322631,7 +322651,6 @@ function startCloudSync() {
|
|
|
322631
322651
|
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
322652
|
var init_sync2 = __esm({
|
|
322633
322653
|
"lib/client/cloud/sync.ts"() {
|
|
322634
|
-
"use strict";
|
|
322635
322654
|
init_kinds();
|
|
322636
322655
|
init_paint_repair();
|
|
322637
322656
|
init_migrate();
|
|
@@ -323903,6 +323922,7 @@ function applyTextPath(layout2, path, tp, rebase = true) {
|
|
|
323903
323922
|
var defaultCircleRadius, ownsPath, mapPoint;
|
|
323904
323923
|
var init_text_path = __esm({
|
|
323905
323924
|
"lib/engine/text/text-path.ts"() {
|
|
323925
|
+
"use strict";
|
|
323906
323926
|
init_scene_graph();
|
|
323907
323927
|
init_transform();
|
|
323908
323928
|
init_shape_to_path();
|
|
@@ -324020,6 +324040,7 @@ function areaBounds(rings) {
|
|
|
324020
324040
|
}
|
|
324021
324041
|
var init_text_area = __esm({
|
|
324022
324042
|
"lib/engine/text/text-area.ts"() {
|
|
324043
|
+
"use strict";
|
|
324023
324044
|
}
|
|
324024
324045
|
});
|
|
324025
324046
|
|
|
@@ -326203,25 +326224,25 @@ function effectFilter(node2, ctx2, totalMat) {
|
|
|
326203
326224
|
const sigma = (blur) => Math.max(0.5, blur / 3);
|
|
326204
326225
|
const id3 = uid(ctx2, "fx");
|
|
326205
326226
|
let parts = "";
|
|
326206
|
-
let
|
|
326227
|
+
let current6 = "SourceGraphic";
|
|
326207
326228
|
if (drop) {
|
|
326208
326229
|
const [dx, dy] = localOffset(drop.offset.x, drop.offset.y);
|
|
326209
326230
|
const spread2 = drop.spread || 0;
|
|
326210
326231
|
const knock = drop.showBehindTransparent === false;
|
|
326211
326232
|
if (!spread2 && !knock) {
|
|
326212
|
-
parts += `<feDropShadow in="${
|
|
326233
|
+
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
326234
|
} 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="${
|
|
326235
|
+
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
326236
|
}
|
|
326216
|
-
|
|
326237
|
+
current6 = "withdrop";
|
|
326217
326238
|
}
|
|
326218
326239
|
if (inner) {
|
|
326219
326240
|
const [dx, dy] = localOffset(inner.offset.x, inner.offset.y);
|
|
326220
326241
|
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
|
-
|
|
326242
|
+
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>`;
|
|
326243
|
+
current6 = "withinner";
|
|
326223
326244
|
}
|
|
326224
|
-
if (layerBlur) parts += `<feGaussianBlur in="${
|
|
326245
|
+
if (layerBlur) parts += `<feGaussianBlur in="${current6}" stdDeviation="${fmt(sigma(layerBlur.radius))}"/>`;
|
|
326225
326246
|
ctx2.defs.push(`<filter id="${id3}" ${region}>${parts}</filter>`);
|
|
326226
326247
|
return ` filter="url(#${id3})"`;
|
|
326227
326248
|
}
|
|
@@ -327145,13 +327166,13 @@ ${num7(c2[0])} ${num7(c2[1])} ${num7(c2[2])} ${num7(c2[3])} ${num7(c2[4])} ${num
|
|
|
327145
327166
|
for (const run4 of item.runs) {
|
|
327146
327167
|
this.w(`q /${this.gs(opacity * run4.alpha, 1, blend2)} gs ${this.res.color.fill(run4.color)} BT
|
|
327147
327168
|
`);
|
|
327148
|
-
let
|
|
327169
|
+
let current6 = "";
|
|
327149
327170
|
for (const g of run4.glyphs) {
|
|
327150
327171
|
const { resource, gid } = this.res.fonts.use(g.font, g.gid, g.codePoints);
|
|
327151
|
-
if (resource !==
|
|
327172
|
+
if (resource !== current6) {
|
|
327152
327173
|
this.w(`/${resource} ${num7(run4.size)} Tf
|
|
327153
327174
|
`);
|
|
327154
|
-
|
|
327175
|
+
current6 = resource;
|
|
327155
327176
|
}
|
|
327156
327177
|
this.w(`1 0 0 -1 ${num7(g.x)} ${num7(g.y)} Tm <${gid.toString(16).padStart(4, "0")}> Tj
|
|
327157
327178
|
`);
|
|
@@ -327941,13 +327962,13 @@ async function encodeImageData(imageData, format, quality = 0.9, dpi) {
|
|
|
327941
327962
|
}
|
|
327942
327963
|
function sliceRegion(node2, doc2) {
|
|
327943
327964
|
let pageId2 = null;
|
|
327944
|
-
let
|
|
327945
|
-
while (
|
|
327946
|
-
if (
|
|
327947
|
-
pageId2 =
|
|
327965
|
+
let current6 = node2;
|
|
327966
|
+
while (current6) {
|
|
327967
|
+
if (current6.type === "PAGE") {
|
|
327968
|
+
pageId2 = current6.id;
|
|
327948
327969
|
break;
|
|
327949
327970
|
}
|
|
327950
|
-
|
|
327971
|
+
current6 = current6.parentId ? doc2.nodes[current6.parentId] : void 0;
|
|
327951
327972
|
}
|
|
327952
327973
|
if (!pageId2) return null;
|
|
327953
327974
|
const page = doc2.nodes[pageId2];
|
|
@@ -328060,6 +328081,7 @@ async function exportSettingFile(renderer, node2, setting, doc2, styles) {
|
|
|
328060
328081
|
var MIME, DEFAULT_EXPORT, exportSettingsOf;
|
|
328061
328082
|
var init_export = __esm({
|
|
328062
328083
|
"lib/io/export.ts"() {
|
|
328084
|
+
"use strict";
|
|
328063
328085
|
init_download();
|
|
328064
328086
|
init_scene_graph();
|
|
328065
328087
|
init_codecs();
|
|
@@ -331021,8 +331043,8 @@ var init_node = __esm({
|
|
|
331021
331043
|
const patches = /* @__PURE__ */ new Map();
|
|
331022
331044
|
for (const id3 of ids2) {
|
|
331023
331045
|
const n = resolvedNodeOrThrow(doc2, id3);
|
|
331024
|
-
const
|
|
331025
|
-
const next2 = args2.degrees !== void 0 ? args2.degrees :
|
|
331046
|
+
const current6 = n.rotation ?? 0;
|
|
331047
|
+
const next2 = args2.degrees !== void 0 ? args2.degrees : current6 + (args2.by ?? 0);
|
|
331026
331048
|
patches.set(id3, { rotation: (next2 % 360 + 360) % 360 });
|
|
331027
331049
|
}
|
|
331028
331050
|
commitUpdates(ctx2, doc2, patches);
|
|
@@ -339053,7 +339075,7 @@ var init_package = __esm({
|
|
|
339053
339075
|
"packages/runtime/package.json"() {
|
|
339054
339076
|
package_default = {
|
|
339055
339077
|
name: "@popcraft/runtime",
|
|
339056
|
-
version: "0.
|
|
339078
|
+
version: "0.58.0",
|
|
339057
339079
|
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
339080
|
license: "MIT",
|
|
339059
339081
|
homepage: "https://popcraft.app/docs/exporting/nextjs",
|
|
@@ -340191,8 +340213,8 @@ var require_types = __commonJS({
|
|
|
340191
340213
|
TokenType2[TokenType2["IS_POSTFIX"] = IS_POSTFIX] = "IS_POSTFIX";
|
|
340192
340214
|
const IS_EXPRESSION_START = 1 << 9;
|
|
340193
340215
|
TokenType2[TokenType2["IS_EXPRESSION_START"] = IS_EXPRESSION_START] = "IS_EXPRESSION_START";
|
|
340194
|
-
const
|
|
340195
|
-
TokenType2[TokenType2["num"] =
|
|
340216
|
+
const num13 = 512;
|
|
340217
|
+
TokenType2[TokenType2["num"] = num13] = "num";
|
|
340196
340218
|
const bigint4 = 1536;
|
|
340197
340219
|
TokenType2[TokenType2["bigint"] = bigint4] = "bigint";
|
|
340198
340220
|
const decimal = 2560;
|
|
@@ -352829,19 +352851,19 @@ var require_sourcemap_codec_umd = __commonJS({
|
|
|
352829
352851
|
} while (integer2 & 32);
|
|
352830
352852
|
return value3;
|
|
352831
352853
|
}
|
|
352832
|
-
function decodeSign(
|
|
352833
|
-
return
|
|
352854
|
+
function decodeSign(num13) {
|
|
352855
|
+
return num13 & 1 ? -2147483648 | -(num13 >>> 1) : num13 >>> 1;
|
|
352834
352856
|
}
|
|
352835
|
-
function encodeInteger(builder,
|
|
352857
|
+
function encodeInteger(builder, num13) {
|
|
352836
352858
|
do {
|
|
352837
|
-
let clamped =
|
|
352838
|
-
|
|
352839
|
-
if (
|
|
352859
|
+
let clamped = num13 & 31;
|
|
352860
|
+
num13 >>>= 5;
|
|
352861
|
+
if (num13 > 0) clamped |= 32;
|
|
352840
352862
|
builder.write(intToChar[clamped]);
|
|
352841
|
-
} while (
|
|
352863
|
+
} while (num13 > 0);
|
|
352842
352864
|
}
|
|
352843
|
-
function encodeSign(
|
|
352844
|
-
return
|
|
352865
|
+
function encodeSign(num13) {
|
|
352866
|
+
return num13 < 0 ? -num13 << 1 | 1 : num13 << 1;
|
|
352845
352867
|
}
|
|
352846
352868
|
function hasMoreVlq(reader, max3) {
|
|
352847
352869
|
if (reader.pos >= max3) return false;
|
|
@@ -354263,8 +354285,8 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
354263
354285
|
function getColumnIndex(line, genColumn) {
|
|
354264
354286
|
let index2 = line.length;
|
|
354265
354287
|
for (let i2 = index2 - 1; i2 >= 0; index2 = i2--) {
|
|
354266
|
-
const
|
|
354267
|
-
if (genColumn >=
|
|
354288
|
+
const current6 = line[i2];
|
|
354289
|
+
if (genColumn >= current6[COLUMN]) break;
|
|
354268
354290
|
}
|
|
354269
354291
|
return index2;
|
|
354270
354292
|
}
|
|
@@ -366583,9 +366605,9 @@ var init_meta = __esm({
|
|
|
366583
366605
|
throw new ToolError("Only one todo may be in_progress at a time.");
|
|
366584
366606
|
}
|
|
366585
366607
|
const done = todos.filter((t3) => t3.status === "done").length;
|
|
366586
|
-
const
|
|
366608
|
+
const current6 = todos.find((t3) => t3.status === "in_progress");
|
|
366587
366609
|
return {
|
|
366588
|
-
summary: todos.length ? `${done}/${todos.length} done${
|
|
366610
|
+
summary: todos.length ? `${done}/${todos.length} done${current6 ? ` \u2014 ${current6.title}` : ""}` : "Cleared the plan",
|
|
366589
366611
|
data: { todos }
|
|
366590
366612
|
};
|
|
366591
366613
|
}
|
|
@@ -369105,17 +369127,17 @@ function bestLag2(a, b, maxLag) {
|
|
|
369105
369127
|
};
|
|
369106
369128
|
const ma = mean(a), mb = mean(b);
|
|
369107
369129
|
for (let lag = -maxLag; lag <= maxLag; lag++) {
|
|
369108
|
-
let
|
|
369130
|
+
let num13 = 0, ea = 0, eb = 0, count2 = 0;
|
|
369109
369131
|
const from2 = Math.max(0, -lag), to = Math.min(a.length, b.length - lag);
|
|
369110
369132
|
for (let i2 = from2; i2 < to; i2++) {
|
|
369111
369133
|
const x2 = a[i2] - ma, y = b[i2 + lag] - mb;
|
|
369112
|
-
|
|
369134
|
+
num13 += x2 * y;
|
|
369113
369135
|
ea += x2 * x2;
|
|
369114
369136
|
eb += y * y;
|
|
369115
369137
|
count2++;
|
|
369116
369138
|
}
|
|
369117
369139
|
if (count2 < ENVELOPE_HZ) continue;
|
|
369118
|
-
const s =
|
|
369140
|
+
const s = num13 / Math.sqrt(ea * eb || 1);
|
|
369119
369141
|
if (s > score) {
|
|
369120
369142
|
score = s;
|
|
369121
369143
|
best = lag;
|
|
@@ -370936,6 +370958,7 @@ function diagnosticsText(diagnostics) {
|
|
|
370936
370958
|
var HARNESS_NAMES, plainDiagnostics;
|
|
370937
370959
|
var init_shader_diagnostics = __esm({
|
|
370938
370960
|
"lib/engine/shader-diagnostics.ts"() {
|
|
370961
|
+
"use strict";
|
|
370939
370962
|
HARNESS_NAMES = ["ShaderUniforms", "VOut", "vs_main", "fs_main", "u", "p"];
|
|
370940
370963
|
plainDiagnostics = (errors2) => errors2.map((message) => ({ line: null, column: null, message, severity: "error" }));
|
|
370941
370964
|
}
|
|
@@ -376342,6 +376365,109 @@ are whole stores to begin from.
|
|
|
376342
376365
|
}
|
|
376343
376366
|
});
|
|
376344
376367
|
|
|
376368
|
+
// lib/agent/skills/builtin/pixel-sprites.ts
|
|
376369
|
+
var pixelSprites;
|
|
376370
|
+
var init_pixel_sprites = __esm({
|
|
376371
|
+
"lib/agent/skills/builtin/pixel-sprites.ts"() {
|
|
376372
|
+
"use strict";
|
|
376373
|
+
pixelSprites = {
|
|
376374
|
+
id: "pixel-sprites",
|
|
376375
|
+
name: "Pixel sprites",
|
|
376376
|
+
description: "Sprites, characters, tiles and items as pixel art in real Pixel canvases, still or animated.",
|
|
376377
|
+
whenToUse: "the user asks for sprites, pixel art, a sprite sheet, game characters, items, tiles or 8-bit / 16-bit art",
|
|
376378
|
+
tools: ["ask_user", "write_design", "get_design_script", "look_at", "get_document_outline", "select", "zoom_to", "manage_todos"],
|
|
376379
|
+
instructions: `# Pixel sprites
|
|
376380
|
+
|
|
376381
|
+
Pixel art goes in Pixel canvases, never in rects or vectors: the user edits it with the pixel tools, animates it in
|
|
376382
|
+
the frame strip and exports it as a sprite sheet. Build each sprite with \`k.pixels\` in one \`write_design\` script.
|
|
376383
|
+
|
|
376384
|
+
## 1. Ask first, when it is not already clear
|
|
376385
|
+
This is required, not optional: a still sprite and an animated one are built differently, so guessing wastes the
|
|
376386
|
+
user's time. If the request leaves either of these open, ask both in ONE \`ask_user\` call before reading the document
|
|
376387
|
+
or building anything:
|
|
376388
|
+
- **Pixel canvas or vector?** \u2014 "Pixel art (editable pixel by pixel)" / "Smooth vector shapes". Skip this when they said
|
|
376389
|
+
pixel art, sprite, 8-bit, 16-bit or retro, or named a pixel size.
|
|
376390
|
+
- **Still or animated?** \u2014 e.g. "Still", "Idle loop (2\u20134 frames)", "Walk cycle (4\u20136 frames)". Skip this when they said.
|
|
376391
|
+
Also ask the size if none was given and it matters (default 32\xD732 for characters, 16\xD716 for items and tiles). Never ask
|
|
376392
|
+
anything they already answered.
|
|
376393
|
+
|
|
376394
|
+
## Size, palette, background \u2014 always what they asked
|
|
376395
|
+
- **Size**: any size they name, exactly (8\xD78, 16\xD716, 24\xD732, 48\xD748, 64\xD764\u2026): that many rows of that many characters.
|
|
376396
|
+
- **Palette**: when they name one ("PICO-8", "Game Boy", "NES-style", "4 colours", "use my brand colours"), pass it as
|
|
376397
|
+
\`palette\` \u2014 a preset (\`'PICO-8'\`, \`'DB32'\`, \`'Endesga 32'\`, \`'Game Boy'\`) or the list of hexes \u2014 and use only those
|
|
376398
|
+
colours in \`key\`. A colour count ("4 colours") means at most that many in \`key\`, outline included.
|
|
376399
|
+
- **Background**: transparent unless they ask for one. Clear the sheet's white paper with \`k.patch(k.sheet, { fills: [] })\`
|
|
376400
|
+
and give the set's frame no fill. A backdrop, when asked for, is its own layer behind the canvases.
|
|
376401
|
+
|
|
376402
|
+
## 2. Build
|
|
376403
|
+
- One Pixel canvas per sprite: \`k.pixels(sheet, frames, key, { cell, ms, name, absolute: { x, y } })\`.
|
|
376404
|
+
- Size it to the request (32\xD732 rows of 32 characters). \`cell\` scales it for viewing: pick it so each sprite shows at
|
|
376405
|
+
about 128\u2013256 on the canvas (cell 4\u20138 for 32 px). Never stretch it with width/height.
|
|
376406
|
+
- One shared \`key\` (palette) across the set, 6\u201316 colours: a dark outline, a highlight and a shadow per material.
|
|
376407
|
+
- Animated: every frame the same size, \`ms\` 80\u2013150 (walk) or 200\u2013400 (idle). Change only what moves between frames.
|
|
376408
|
+
- Lay the set out on one frame named after it ("Platformer sprites"), a sprite per slot in a row, evenly spaced
|
|
376409
|
+
(\`absolute\` positions, a gap of at least one sprite's width), each named for what it is ("Hero", "Coin").
|
|
376410
|
+
- Transparent inside every canvas; never paint a background into the pixels.
|
|
376411
|
+
|
|
376412
|
+
## 3. Check
|
|
376413
|
+
\`look_at\` the set. Each sprite reads as its subject at 1\xD7: a clear silhouette, a consistent light direction (top-left),
|
|
376414
|
+
no stray single pixels, no banding. Fix and look again before you finish.`
|
|
376415
|
+
};
|
|
376416
|
+
}
|
|
376417
|
+
});
|
|
376418
|
+
|
|
376419
|
+
// lib/agent/skills/builtin/orchestration.ts
|
|
376420
|
+
var autoLight, ultraBigBuild, ORCHESTRATION_SKILLS;
|
|
376421
|
+
var init_orchestration = __esm({
|
|
376422
|
+
"lib/agent/skills/builtin/orchestration.ts"() {
|
|
376423
|
+
"use strict";
|
|
376424
|
+
autoLight = {
|
|
376425
|
+
id: "auto-light",
|
|
376426
|
+
name: "Auto",
|
|
376427
|
+
description: "Everyday edits: one model does the work.",
|
|
376428
|
+
whenToUse: "picked automatically in Auto mode",
|
|
376429
|
+
tools: [],
|
|
376430
|
+
instructions: `---
|
|
376431
|
+
name: auto-light
|
|
376432
|
+
kind: orchestration
|
|
376433
|
+
description: Everyday design edits \u2014 one model does the work.
|
|
376434
|
+
modes: auto
|
|
376435
|
+
lead: anthropic/claude-sonnet-5.5
|
|
376436
|
+
lead_effort: medium
|
|
376437
|
+
lead_fallback: anthropic/claude-sonnet-4.5
|
|
376438
|
+
swarm: anthropic/claude-haiku-5.5
|
|
376439
|
+
max_concurrent: 2
|
|
376440
|
+
---
|
|
376441
|
+
Do the work yourself.`
|
|
376442
|
+
};
|
|
376443
|
+
ultraBigBuild = {
|
|
376444
|
+
id: "ultra-big-build",
|
|
376445
|
+
name: "Ultra",
|
|
376446
|
+
description: "Big builds: a whole website, a game, a sprite set, an animation or a video, built in parallel and checked before it ships.",
|
|
376447
|
+
whenToUse: "picked automatically in Ultra mode",
|
|
376448
|
+
tools: [],
|
|
376449
|
+
instructions: `---
|
|
376450
|
+
name: ultra-big-build
|
|
376451
|
+
kind: orchestration
|
|
376452
|
+
description: Big builds \u2014 a whole website, a game, a sprite set, an animation or a video, with many pages, frames, scenes or formats.
|
|
376453
|
+
modes: ultra
|
|
376454
|
+
lead: anthropic/claude-sonnet-5.5
|
|
376455
|
+
lead_effort: high
|
|
376456
|
+
lead_fallback: anthropic/claude-sonnet-4.5
|
|
376457
|
+
swarm: anthropic/claude-haiku-5.5
|
|
376458
|
+
swarm_fallback: anthropic/claude-haiku-4.5
|
|
376459
|
+
advisor: anthropic/claude-opus-5.5
|
|
376460
|
+
advisor_triggers: plan, done
|
|
376461
|
+
max_concurrent: 6
|
|
376462
|
+
---
|
|
376463
|
+
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.
|
|
376464
|
+
|
|
376465
|
+
Advisor: check the plan covers everything asked for; at the end, look at the result and flag anything missing, broken or off-brand.`
|
|
376466
|
+
};
|
|
376467
|
+
ORCHESTRATION_SKILLS = [autoLight, ultraBigBuild];
|
|
376468
|
+
}
|
|
376469
|
+
});
|
|
376470
|
+
|
|
376345
376471
|
// lib/agent/skills/builtin/index.ts
|
|
376346
376472
|
var BUILTIN_SKILLS;
|
|
376347
376473
|
var init_builtin2 = __esm({
|
|
@@ -376367,6 +376493,8 @@ var init_builtin2 = __esm({
|
|
|
376367
376493
|
init_design_review();
|
|
376368
376494
|
init_web_app();
|
|
376369
376495
|
init_storefront2();
|
|
376496
|
+
init_pixel_sprites();
|
|
376497
|
+
init_orchestration();
|
|
376370
376498
|
BUILTIN_SKILLS = [
|
|
376371
376499
|
fillContent,
|
|
376372
376500
|
autoLayout,
|
|
@@ -376387,7 +376515,9 @@ var init_builtin2 = __esm({
|
|
|
376387
376515
|
designCode,
|
|
376388
376516
|
designReview,
|
|
376389
376517
|
webApp,
|
|
376390
|
-
storefront
|
|
376518
|
+
storefront,
|
|
376519
|
+
pixelSprites,
|
|
376520
|
+
...ORCHESTRATION_SKILLS
|
|
376391
376521
|
].map((s) => ({ ...s, source: "builtin" }));
|
|
376392
376522
|
}
|
|
376393
376523
|
});
|
|
@@ -376944,7 +377074,7 @@ var init_open_intent = __esm({
|
|
|
376944
377074
|
}
|
|
376945
377075
|
});
|
|
376946
377076
|
|
|
376947
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
377077
|
+
// 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
377078
|
function agentModelError(message, code, status3) {
|
|
376949
377079
|
{
|
|
376950
377080
|
return { name: "AgentModelError", message, code: code ?? "ai_upstream", status: ((__v) => __v == null ? "null" : typeof __v)(status3) === "number" ? status3 : 502 };
|
|
@@ -377122,13 +377252,15 @@ function createHyperyModel(opts) {
|
|
|
377122
377252
|
if (base.endsWith("/") ?? null) {
|
|
377123
377253
|
base = base.slice(0, base.length - 1) ?? null;
|
|
377124
377254
|
}
|
|
377125
|
-
return async (messages, tools, hooks, signal, req) => {
|
|
377255
|
+
return async (messages, tools, hooks, signal, req = null) => {
|
|
377126
377256
|
{
|
|
377127
377257
|
let token = await (resolve2(opts.token) ?? null);
|
|
377128
377258
|
if (((__v) => __v == null ? "null" : typeof __v)(token) !== "string" || token === "") {
|
|
377129
377259
|
throw agentModelError("Sign in to Hypery to use the agent.", "ai_reauth", 401) ?? null;
|
|
377130
377260
|
}
|
|
377131
|
-
let
|
|
377261
|
+
let hasReq = req != null && ((__v) => __v == null ? "null" : typeof __v)(req) === "object";
|
|
377262
|
+
let model = hasReq && ((__v) => __v == null ? "null" : typeof __v)(req.model) === "string" && req.model !== "" ? req.model : await (resolve2(opts.model) ?? null);
|
|
377263
|
+
let effort = hasReq && ((__v) => __v == null ? "null" : typeof __v)(req.effort) === "string" ? req.effort : await (resolve2(opts.effort) ?? null);
|
|
377132
377264
|
let team = await (resolve2(opts.team) ?? null);
|
|
377133
377265
|
let paymentSource = await (resolve2(opts.paymentSource) ?? null);
|
|
377134
377266
|
let hasTools = (Array.isArray(tools) ?? null) && tools.length > 0;
|
|
@@ -377136,9 +377268,12 @@ function createHyperyModel(opts) {
|
|
|
377136
377268
|
if (((__v) => __v == null ? "null" : typeof __v)(opts.temperature) === "number") {
|
|
377137
377269
|
request2.temperature = opts.temperature;
|
|
377138
377270
|
}
|
|
377271
|
+
if (((__v) => __v == null ? "null" : typeof __v)(effort) === "string" && effort !== "") {
|
|
377272
|
+
request2.reasoning = { effort };
|
|
377273
|
+
}
|
|
377139
377274
|
if (hasTools) {
|
|
377140
377275
|
request2.tools = tools;
|
|
377141
|
-
let choice =
|
|
377276
|
+
let choice = hasReq ? req.toolChoice ?? null : null;
|
|
377142
377277
|
request2.tool_choice = choice != null ? choice : "auto";
|
|
377143
377278
|
}
|
|
377144
377279
|
let body = JSON.stringify(request2) ?? null;
|
|
@@ -377266,7 +377401,7 @@ function createHyperyModel(opts) {
|
|
|
377266
377401
|
}
|
|
377267
377402
|
var delay, utf8Complete, utf8Decode, MAX_REQUEST_BYTES, DEFAULT_IDLE_TIMEOUT_MS, HYPERY_TEAM_HEADER2, HYPERY_PAYMENT_SOURCE_HEADER2;
|
|
377268
377403
|
var init_hypery_model = __esm({
|
|
377269
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
377404
|
+
"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
377405
|
delay = ((ms3) => new Promise((settle4) => setTimeout(() => settle4(null), Math.max(0, Number(ms3) || 0))));
|
|
377271
377406
|
utf8Complete = ((b) => {
|
|
377272
377407
|
if (!Array.isArray(b)) return null;
|
|
@@ -377287,7 +377422,221 @@ var init_hypery_model = __esm({
|
|
|
377287
377422
|
}
|
|
377288
377423
|
});
|
|
377289
377424
|
|
|
377290
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
377425
|
+
// 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
|
|
377426
|
+
function isModelRole(v) {
|
|
377427
|
+
{
|
|
377428
|
+
return ((__v) => __v == null ? "null" : typeof __v)(v) === "string" && (MODEL_ROLES.includes(v) ?? null);
|
|
377429
|
+
}
|
|
377430
|
+
}
|
|
377431
|
+
function roleOfProfileModel(model) {
|
|
377432
|
+
{
|
|
377433
|
+
if ((model ?? null) == null || model === "" || model === "inherit") {
|
|
377434
|
+
return "lead";
|
|
377435
|
+
}
|
|
377436
|
+
if (model === "fast") {
|
|
377437
|
+
return "swarm";
|
|
377438
|
+
}
|
|
377439
|
+
if (isModelRole(model) ?? null) {
|
|
377440
|
+
return model;
|
|
377441
|
+
}
|
|
377442
|
+
return null;
|
|
377443
|
+
}
|
|
377444
|
+
}
|
|
377445
|
+
function resolveCatalogModel(wanted, fallback2, catalog2) {
|
|
377446
|
+
{
|
|
377447
|
+
if (!(Array.isArray(catalog2) ?? null) || catalog2.length === 0) {
|
|
377448
|
+
return wanted;
|
|
377449
|
+
}
|
|
377450
|
+
let ids2 = new Set(catalog2.map((m) => {
|
|
377451
|
+
{
|
|
377452
|
+
return ((__v) => __v == null ? "null" : typeof __v)(m) === "string" ? m : m != null && ((__v) => __v == null ? "null" : typeof __v)(m) === "object" ? m.id : "";
|
|
377453
|
+
}
|
|
377454
|
+
}) ?? null) ?? null;
|
|
377455
|
+
if (ids2.has(wanted) ?? null) {
|
|
377456
|
+
return wanted;
|
|
377457
|
+
}
|
|
377458
|
+
for (const f2 of fallback2 ?? []) {
|
|
377459
|
+
if (ids2.has(f2) ?? null) {
|
|
377460
|
+
return f2;
|
|
377461
|
+
}
|
|
377462
|
+
}
|
|
377463
|
+
return wanted;
|
|
377464
|
+
}
|
|
377465
|
+
}
|
|
377466
|
+
function resolveRole(role, roles, catalog2) {
|
|
377467
|
+
{
|
|
377468
|
+
let spec = roles != null && ((__v) => __v == null ? "null" : typeof __v)(roles) === "object" ? roles[role] ?? null ?? null : null;
|
|
377469
|
+
if (spec == null || ((__v) => __v == null ? "null" : typeof __v)(spec.model) !== "string" || spec.model === "") {
|
|
377470
|
+
return null;
|
|
377471
|
+
}
|
|
377472
|
+
return { model: resolveCatalogModel(spec.model, spec.fallback ?? null, catalog2) ?? null, effort: spec.effort ?? null, fallback: spec.fallback ?? null };
|
|
377473
|
+
}
|
|
377474
|
+
}
|
|
377475
|
+
function mergeRoles(roles, overrides2) {
|
|
377476
|
+
{
|
|
377477
|
+
let base = roles != null && ((__v) => __v == null ? "null" : typeof __v)(roles) === "object" ? roles : {};
|
|
377478
|
+
if ((overrides2 ?? null) == null || ((__v) => __v == null ? "null" : typeof __v)(overrides2) !== "object") {
|
|
377479
|
+
return base;
|
|
377480
|
+
}
|
|
377481
|
+
let out = { ...base };
|
|
377482
|
+
for (const r of MODEL_ROLES) {
|
|
377483
|
+
let o = overrides2[r] ?? null ?? null;
|
|
377484
|
+
if (o == null) {
|
|
377485
|
+
continue;
|
|
377486
|
+
}
|
|
377487
|
+
out[r] = ((__v) => __v == null ? "null" : typeof __v)(o) === "string" ? { ...base[r] ?? null ?? {}, model: o } : { ...base[r] ?? null ?? {}, ...o };
|
|
377488
|
+
}
|
|
377489
|
+
return out;
|
|
377490
|
+
}
|
|
377491
|
+
}
|
|
377492
|
+
function roleModel(callModel, spec) {
|
|
377493
|
+
{
|
|
377494
|
+
return async (messages, tools, hooks = null, signal = null, req = null) => {
|
|
377495
|
+
{
|
|
377496
|
+
let r = (req ?? null) != null && ((__v) => __v == null ? "null" : typeof __v)(req) === "object" ? req : {};
|
|
377497
|
+
let merged = { ...r, model: r.model ?? spec.model, effort: r.effort ?? spec.effort ?? null };
|
|
377498
|
+
return await (callModel(messages, tools, hooks, signal, merged) ?? null);
|
|
377499
|
+
}
|
|
377500
|
+
};
|
|
377501
|
+
}
|
|
377502
|
+
}
|
|
377503
|
+
var MODEL_ROLES;
|
|
377504
|
+
var init_roles = __esm({
|
|
377505
|
+
"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"() {
|
|
377506
|
+
MODEL_ROLES = ["lead", "swarm", "advisor", "router"];
|
|
377507
|
+
}
|
|
377508
|
+
});
|
|
377509
|
+
|
|
377510
|
+
// 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
|
|
377511
|
+
function contentText(c2) {
|
|
377512
|
+
{
|
|
377513
|
+
if (((__v) => __v == null ? "null" : typeof __v)(c2) === "string") {
|
|
377514
|
+
return c2;
|
|
377515
|
+
}
|
|
377516
|
+
if (Array.isArray(c2) ?? null) {
|
|
377517
|
+
return (c2.map((p2) => {
|
|
377518
|
+
{
|
|
377519
|
+
return ((__v) => __v == null ? "null" : typeof __v)(p2.text) === "string" ? p2.text : "[image]";
|
|
377520
|
+
}
|
|
377521
|
+
}) ?? null).join(" ") ?? null;
|
|
377522
|
+
}
|
|
377523
|
+
return "";
|
|
377524
|
+
}
|
|
377525
|
+
}
|
|
377526
|
+
function renderTranscript(messages, maxChars) {
|
|
377527
|
+
{
|
|
377528
|
+
let lines2 = [];
|
|
377529
|
+
for (const m of messages) {
|
|
377530
|
+
let text = contentText(m.content) ?? null;
|
|
377531
|
+
if (Array.isArray(m.tool_calls) ?? null) {
|
|
377532
|
+
for (const c2 of m.tool_calls) {
|
|
377533
|
+
text = text + "\n\u2192 " + (c2["function"] ?? null).name + " " + (c2["function"] ?? null).arguments;
|
|
377534
|
+
}
|
|
377535
|
+
}
|
|
377536
|
+
lines2.push("[" + m.role + (((__v) => __v == null ? "null" : typeof __v)(m.name) === "string" ? " " + m.name : "") + "] " + text) ?? null;
|
|
377537
|
+
}
|
|
377538
|
+
let all4 = lines2.join("\n\n") ?? null;
|
|
377539
|
+
return all4.length > maxChars ? "\u2026" + (all4.slice(all4.length - maxChars) ?? null) : all4;
|
|
377540
|
+
}
|
|
377541
|
+
}
|
|
377542
|
+
function parseAdvice(text) {
|
|
377543
|
+
{
|
|
377544
|
+
let t3 = text.trim() ?? null;
|
|
377545
|
+
let start2 = t3.indexOf("{") ?? null;
|
|
377546
|
+
let end = t3.lastIndexOf("}") ?? null;
|
|
377547
|
+
if (start2 >= 0 && end > start2) {
|
|
377548
|
+
try {
|
|
377549
|
+
{
|
|
377550
|
+
let j = JSON.parse(t3.slice(start2, end + 1) ?? null) ?? null;
|
|
377551
|
+
let advice = Array.isArray(j.advice) ?? null ? j.advice.filter((a) => {
|
|
377552
|
+
{
|
|
377553
|
+
return ((__v) => __v == null ? "null" : typeof __v)(a) === "string" && (a.trim() ?? null) !== "";
|
|
377554
|
+
}
|
|
377555
|
+
}) ?? null : [];
|
|
377556
|
+
return { verdict: j.verdict === "ok" ? "ok" : "revise", advice };
|
|
377557
|
+
}
|
|
377558
|
+
} catch (e) {
|
|
377559
|
+
{
|
|
377560
|
+
}
|
|
377561
|
+
}
|
|
377562
|
+
}
|
|
377563
|
+
return { verdict: t3 === "" ? "ok" : "revise", advice: t3 === "" ? [] : [t3] };
|
|
377564
|
+
}
|
|
377565
|
+
}
|
|
377566
|
+
function createAdvisor(opts) {
|
|
377567
|
+
{
|
|
377568
|
+
let call2 = roleModel(opts.callModel, opts.spec) ?? null;
|
|
377569
|
+
let maxCalls = ((__v) => __v == null ? "null" : typeof __v)(opts.maxCalls) === "number" ? opts.maxCalls : 8;
|
|
377570
|
+
let maxChars = ((__v) => __v == null ? "null" : typeof __v)(opts.maxChars) === "number" ? opts.maxChars : 6e5;
|
|
377571
|
+
let triggers = opts.triggers ?? {};
|
|
377572
|
+
let calls = 0;
|
|
377573
|
+
let tokensRead = 0;
|
|
377574
|
+
let emit6 = (e) => {
|
|
377575
|
+
{
|
|
377576
|
+
if (((__v) => __v == null ? "null" : typeof __v)(opts.onEvent) === "function") {
|
|
377577
|
+
opts.onEvent(e) ?? null;
|
|
377578
|
+
}
|
|
377579
|
+
}
|
|
377580
|
+
};
|
|
377581
|
+
return { stats: () => {
|
|
377582
|
+
{
|
|
377583
|
+
return { calls, tokensRead };
|
|
377584
|
+
}
|
|
377585
|
+
}, advise: async (req) => {
|
|
377586
|
+
{
|
|
377587
|
+
if ((triggers[req.trigger] ?? null) === false || calls >= maxCalls) {
|
|
377588
|
+
return null;
|
|
377589
|
+
}
|
|
377590
|
+
let transcript = renderTranscript(req.messages, maxChars) ?? null;
|
|
377591
|
+
calls = calls + 1;
|
|
377592
|
+
tokensRead = tokensRead + (Math.ceil(transcript.length / 4) ?? null);
|
|
377593
|
+
emit6({ type: "advisor:call", trigger: req.trigger, model: opts.spec.model, calls, tokensRead }) ?? null;
|
|
377594
|
+
let ask2 = (TRIGGER_ASK[req.trigger] ?? null) + (((__v) => __v == null ? "null" : typeof __v)(req.detail) === "string" && req.detail !== "" ? "\n\n" + req.detail : "");
|
|
377595
|
+
let turn = null;
|
|
377596
|
+
try {
|
|
377597
|
+
{
|
|
377598
|
+
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);
|
|
377599
|
+
}
|
|
377600
|
+
} catch (err2) {
|
|
377601
|
+
{
|
|
377602
|
+
return null;
|
|
377603
|
+
}
|
|
377604
|
+
}
|
|
377605
|
+
let parsed2 = parseAdvice(turn.text ?? "") ?? null;
|
|
377606
|
+
emit6({ type: "advisor:advice", trigger: req.trigger, model: opts.spec.model, calls, tokensRead, advice: parsed2.advice, verdict: parsed2.verdict }) ?? null;
|
|
377607
|
+
if (parsed2.verdict === "ok" || parsed2.advice.length === 0) {
|
|
377608
|
+
return null;
|
|
377609
|
+
}
|
|
377610
|
+
return "Advisor (" + req.trigger + "):\n" + ((parsed2.advice.map((a) => {
|
|
377611
|
+
{
|
|
377612
|
+
return "\xBB " + a;
|
|
377613
|
+
}
|
|
377614
|
+
}) ?? null).join("\n") ?? null);
|
|
377615
|
+
}
|
|
377616
|
+
} };
|
|
377617
|
+
}
|
|
377618
|
+
}
|
|
377619
|
+
function errorSignature(run4) {
|
|
377620
|
+
{
|
|
377621
|
+
let s = (run4.summary ?? "").toLowerCase() ?? null;
|
|
377622
|
+
let out = "";
|
|
377623
|
+
for (const ch of s) {
|
|
377624
|
+
out = out + (ch >= "0" && ch <= "9" ? "#" : ch);
|
|
377625
|
+
}
|
|
377626
|
+
return run4.name + ":" + (out.slice(0, 200) ?? null);
|
|
377627
|
+
}
|
|
377628
|
+
}
|
|
377629
|
+
var REPEATED_ERROR_COUNT, ADVISOR_PROMPT, TRIGGER_ASK;
|
|
377630
|
+
var init_advisor = __esm({
|
|
377631
|
+
"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"() {
|
|
377632
|
+
init_roles();
|
|
377633
|
+
REPEATED_ERROR_COUNT = 2;
|
|
377634
|
+
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;
|
|
377635
|
+
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." };
|
|
377636
|
+
}
|
|
377637
|
+
});
|
|
377638
|
+
|
|
377639
|
+
// 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
377640
|
function sizeOf2(messages) {
|
|
377292
377641
|
{
|
|
377293
377642
|
return (JSON.stringify(messages) ?? null).length;
|
|
@@ -377425,13 +377774,13 @@ async function compactTranscript(messages, opts) {
|
|
|
377425
377774
|
}
|
|
377426
377775
|
var RENDER_TURN_PREFIX, KEEP_IMAGE_TURNS;
|
|
377427
377776
|
var init_context2 = __esm({
|
|
377428
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
377777
|
+
"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
377778
|
RENDER_TURN_PREFIX = "Result of ";
|
|
377430
377779
|
KEEP_IMAGE_TURNS = 2;
|
|
377431
377780
|
}
|
|
377432
377781
|
});
|
|
377433
377782
|
|
|
377434
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
377783
|
+
// 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
377784
|
function batchCalls(calls, isParallel, max3) {
|
|
377436
377785
|
{
|
|
377437
377786
|
let batches = [];
|
|
@@ -377622,7 +377971,36 @@ async function runAgentLoop(opts) {
|
|
|
377622
377971
|
}
|
|
377623
377972
|
}
|
|
377624
377973
|
};
|
|
377974
|
+
let advise = ((__v) => __v == null ? "null" : typeof __v)(opts.advise) === "function" ? opts.advise : null;
|
|
377975
|
+
let route2 = ((__v) => __v == null ? "null" : typeof __v)(opts.route) === "function" ? opts.route : null;
|
|
377976
|
+
let errorCounts = /* @__PURE__ */ new Map() ?? null;
|
|
377977
|
+
let doneChecked = false;
|
|
377978
|
+
let consult = async (trigger, detail) => {
|
|
377979
|
+
{
|
|
377980
|
+
if (advise == null) {
|
|
377981
|
+
return false;
|
|
377982
|
+
}
|
|
377983
|
+
let note2 = null;
|
|
377984
|
+
try {
|
|
377985
|
+
{
|
|
377986
|
+
note2 = await (advise({ trigger, messages: messages.slice() ?? null, detail }) ?? null);
|
|
377987
|
+
}
|
|
377988
|
+
} catch (e) {
|
|
377989
|
+
{
|
|
377990
|
+
note2 = null;
|
|
377991
|
+
}
|
|
377992
|
+
}
|
|
377993
|
+
if (((__v) => __v == null ? "null" : typeof __v)(note2) !== "string" || note2 === "") {
|
|
377994
|
+
return false;
|
|
377995
|
+
}
|
|
377996
|
+
messages.push({ role: "user", content: note2 }) ?? null;
|
|
377997
|
+
return true;
|
|
377998
|
+
}
|
|
377999
|
+
};
|
|
377625
378000
|
let round5 = ((__v) => __v == null ? "null" : typeof __v)(resume.round) === "number" ? resume.round : 0;
|
|
378001
|
+
if (round5 === 0) {
|
|
378002
|
+
await (consult("plan", null) ?? null);
|
|
378003
|
+
}
|
|
377626
378004
|
while (maxRounds === 0 || round5 < maxRounds) {
|
|
377627
378005
|
if (isStopped() ?? null) {
|
|
377628
378006
|
await (save(round5, true) ?? null);
|
|
@@ -377640,7 +378018,19 @@ async function runAgentLoop(opts) {
|
|
|
377640
378018
|
if (onStart != null) {
|
|
377641
378019
|
onStart(round5) ?? null;
|
|
377642
378020
|
}
|
|
377643
|
-
let
|
|
378021
|
+
let choice = choiceFor(round5) ?? null;
|
|
378022
|
+
if (choice == null && route2 != null && specs.length > 0) {
|
|
378023
|
+
try {
|
|
378024
|
+
{
|
|
378025
|
+
choice = await (route2({ round: round5, messages: messages.slice() ?? null, tools: specs }) ?? null);
|
|
378026
|
+
}
|
|
378027
|
+
} catch (e) {
|
|
378028
|
+
{
|
|
378029
|
+
choice = null;
|
|
378030
|
+
}
|
|
378031
|
+
}
|
|
378032
|
+
}
|
|
378033
|
+
let turn = await (call2(messages, specs, choice ?? null) ?? null);
|
|
377644
378034
|
text = turn.text;
|
|
377645
378035
|
let toolCalls = Array.isArray(turn.toolCalls) ?? null ? turn.toolCalls : [];
|
|
377646
378036
|
if (toolCalls.length > 0) {
|
|
@@ -377665,6 +378055,14 @@ async function runAgentLoop(opts) {
|
|
|
377665
378055
|
round5 = round5 + 1;
|
|
377666
378056
|
continue;
|
|
377667
378057
|
}
|
|
378058
|
+
if (!doneChecked) {
|
|
378059
|
+
doneChecked = true;
|
|
378060
|
+
if (await (consult("done", null) ?? null)) {
|
|
378061
|
+
await (save(round5 + 1, false) ?? null);
|
|
378062
|
+
round5 = round5 + 1;
|
|
378063
|
+
continue;
|
|
378064
|
+
}
|
|
378065
|
+
}
|
|
377668
378066
|
if (require3 != null && !acted && nudgesLeft > 0 && actingNames.size > 0) {
|
|
377669
378067
|
nudgesLeft = nudgesLeft - 1;
|
|
377670
378068
|
let nudge = ((__v) => __v == null ? "null" : typeof __v)(require3.message) === "string" ? require3.message : DEFAULT_ACTION_NUDGE;
|
|
@@ -377686,6 +378084,8 @@ async function runAgentLoop(opts) {
|
|
|
377686
378084
|
}
|
|
377687
378085
|
}) ?? null;
|
|
377688
378086
|
let imageTurns = [];
|
|
378087
|
+
let repeated = [];
|
|
378088
|
+
doneChecked = false;
|
|
377689
378089
|
for (const batch of batchCalls(calls, (n) => {
|
|
377690
378090
|
{
|
|
377691
378091
|
return parallelNames.has(n) ?? null;
|
|
@@ -377734,6 +378134,14 @@ async function runAgentLoop(opts) {
|
|
|
377734
378134
|
if (onToolEnd != null) {
|
|
377735
378135
|
onToolEnd(run4) ?? null;
|
|
377736
378136
|
}
|
|
378137
|
+
if (run4.ok !== true && advise != null) {
|
|
378138
|
+
let sig = errorSignature(run4) ?? null;
|
|
378139
|
+
let n = (errorCounts.get(sig) ?? null ?? 0) + 1;
|
|
378140
|
+
errorCounts.set(sig, n) ?? null;
|
|
378141
|
+
if (n === REPEATED_ERROR_COUNT) {
|
|
378142
|
+
repeated.push(run4.name + ": " + run4.summary) ?? null;
|
|
378143
|
+
}
|
|
378144
|
+
}
|
|
377737
378145
|
messages.push({ role: "tool", tool_call_id: run4.id, name: run4.name, content: truncateResult(run4.content, maxResultChars) ?? null }) ?? null;
|
|
377738
378146
|
if ((Array.isArray(run4.images) ?? null) && run4.images.length > 0) {
|
|
377739
378147
|
let label3 = run4.images.length === 1 ? "the rendered view" : (String(run4.images.length) ?? null) + " rendered views";
|
|
@@ -377748,6 +378156,9 @@ async function runAgentLoop(opts) {
|
|
|
377748
378156
|
for (const m of imageTurns) {
|
|
377749
378157
|
messages.push(m) ?? null;
|
|
377750
378158
|
}
|
|
378159
|
+
for (const err2 of repeated) {
|
|
378160
|
+
await (consult("error", "The error, seen " + (String(REPEATED_ERROR_COUNT) ?? null) + " times: " + err2) ?? null);
|
|
378161
|
+
}
|
|
377751
378162
|
let onRoundEnd = hook(hooks, "onRoundEnd") ?? null;
|
|
377752
378163
|
if (onRoundEnd != null) {
|
|
377753
378164
|
onRoundEnd(round5) ?? null;
|
|
@@ -377764,7 +378175,8 @@ async function runAgentLoop(opts) {
|
|
|
377764
378175
|
}
|
|
377765
378176
|
var DEFAULT_MAX_ROUNDS, DEFAULT_MAX_PARALLEL, DEFAULT_ACTION_NUDGE, RENDER_TURN_PREFIX2, RECOVERABLE_WORDS;
|
|
377766
378177
|
var init_loop = __esm({
|
|
377767
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378178
|
+
"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"() {
|
|
378179
|
+
init_advisor();
|
|
377768
378180
|
init_context2();
|
|
377769
378181
|
DEFAULT_MAX_ROUNDS = 40;
|
|
377770
378182
|
DEFAULT_MAX_PARALLEL = 4;
|
|
@@ -377774,7 +378186,7 @@ var init_loop = __esm({
|
|
|
377774
378186
|
}
|
|
377775
378187
|
});
|
|
377776
378188
|
|
|
377777
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378189
|
+
// 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
378190
|
function isBusy(s) {
|
|
377779
378191
|
{
|
|
377780
378192
|
return s != null && (s.status === "running" || s.status === "queued");
|
|
@@ -377818,7 +378230,17 @@ function createAgentRuntime(host) {
|
|
|
377818
378230
|
let waiting3 = [];
|
|
377819
378231
|
let listeners9 = [];
|
|
377820
378232
|
let pendingSaves = 0;
|
|
377821
|
-
let
|
|
378233
|
+
let orch = host.orchestration ?? null;
|
|
378234
|
+
let maxConcurrent = () => {
|
|
378235
|
+
{
|
|
378236
|
+
let h = ((__v) => __v == null ? "null" : typeof __v)(host.maxConcurrent) === "function" ? host.maxConcurrent() ?? null : host.maxConcurrent;
|
|
378237
|
+
if (((__v) => __v == null ? "null" : typeof __v)(h) === "number" && h > 0) {
|
|
378238
|
+
return h;
|
|
378239
|
+
}
|
|
378240
|
+
let o = orch != null ? orch.maxConcurrent ?? null : null;
|
|
378241
|
+
return ((__v) => __v == null ? "null" : typeof __v)(o) === "number" && o > 0 ? o : 4;
|
|
378242
|
+
}
|
|
378243
|
+
};
|
|
377822
378244
|
let now3 = () => {
|
|
377823
378245
|
{
|
|
377824
378246
|
return ((__v) => __v == null ? "null" : typeof __v)(host.now) === "function" ? host.now() ?? null : Date.now() ?? null;
|
|
@@ -377907,6 +378329,9 @@ function createAgentRuntime(host) {
|
|
|
377907
378329
|
let ctx2 = { session: session3, profile, readOnly: forceReadOnly || profile.readOnly === true, signal: control.signal };
|
|
377908
378330
|
let tools = (host.childTools(ctx2) ?? null).concat([REPORT_SPEC]) ?? null;
|
|
377909
378331
|
let childModel = ((__v) => __v == null ? "null" : typeof __v)(host.childModel) === "function" ? host.childModel(ctx2) ?? null : null;
|
|
378332
|
+
if (((__v) => __v == null ? "null" : typeof __v)(childModel) !== "function" && orch != null) {
|
|
378333
|
+
childModel = orch.childModel(ctx2.readOnly && (profile.model ?? null) == null ? "fast" : profile.model ?? null) ?? null;
|
|
378334
|
+
}
|
|
377910
378335
|
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
378336
|
let ok2 = true;
|
|
377912
378337
|
let summary = "";
|
|
@@ -378025,10 +378450,10 @@ function createAgentRuntime(host) {
|
|
|
378025
378450
|
{
|
|
378026
378451
|
}
|
|
378027
378452
|
}
|
|
378028
|
-
job = takeNext() ?? null;
|
|
378453
|
+
job = active4 <= (maxConcurrent() ?? null) ? takeNext() ?? null : null;
|
|
378029
378454
|
if (job == null) {
|
|
378030
378455
|
active4 = Math.max(0, active4 - 1) ?? null;
|
|
378031
|
-
if (waiting3.length > 0 && active4 < maxConcurrent) {
|
|
378456
|
+
if (waiting3.length > 0 && active4 < (maxConcurrent() ?? null)) {
|
|
378032
378457
|
active4 = active4 + 1;
|
|
378033
378458
|
job = takeNext() ?? null;
|
|
378034
378459
|
if (job == null) {
|
|
@@ -378043,7 +378468,15 @@ function createAgentRuntime(host) {
|
|
|
378043
378468
|
};
|
|
378044
378469
|
let startBackground = (session3, go) => {
|
|
378045
378470
|
{
|
|
378046
|
-
|
|
378471
|
+
while (waiting3.length > 0 && active4 < (maxConcurrent() ?? null)) {
|
|
378472
|
+
let next2 = takeNext() ?? null;
|
|
378473
|
+
if (next2 == null) {
|
|
378474
|
+
break;
|
|
378475
|
+
}
|
|
378476
|
+
active4 = active4 + 1;
|
|
378477
|
+
runSlot(next2) ?? null;
|
|
378478
|
+
}
|
|
378479
|
+
if (active4 < (maxConcurrent() ?? null)) {
|
|
378047
378480
|
active4 = active4 + 1;
|
|
378048
378481
|
runSlot({ session: session3, go }) ?? null;
|
|
378049
378482
|
return;
|
|
@@ -378234,7 +378667,7 @@ function createAgentRuntime(host) {
|
|
|
378234
378667
|
}
|
|
378235
378668
|
var delay2, REPORT_TOOL, REPORT_SPEC, WAIT_STEP_MS;
|
|
378236
378669
|
var init_runtime5 = __esm({
|
|
378237
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378670
|
+
"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
378671
|
init_loop();
|
|
378239
378672
|
delay2 = ((ms3) => new Promise((settle4) => setTimeout(() => settle4(null), Math.max(0, Number(ms3) || 0))));
|
|
378240
378673
|
REPORT_TOOL = "report_to_parent";
|
|
@@ -378243,44 +378676,44 @@ var init_runtime5 = __esm({
|
|
|
378243
378676
|
}
|
|
378244
378677
|
});
|
|
378245
378678
|
|
|
378246
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378679
|
+
// 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
378680
|
function forceTool(name2) {
|
|
378248
378681
|
{
|
|
378249
378682
|
return { type: "function", function: { name: name2 } };
|
|
378250
378683
|
}
|
|
378251
378684
|
}
|
|
378252
378685
|
var init_types9 = __esm({
|
|
378253
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378686
|
+
"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
378687
|
}
|
|
378255
378688
|
});
|
|
378256
378689
|
|
|
378257
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378258
|
-
var
|
|
378259
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378690
|
+
// 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
|
|
378691
|
+
var init_orchestration2 = __esm({
|
|
378692
|
+
"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
378693
|
}
|
|
378261
378694
|
});
|
|
378262
378695
|
|
|
378263
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378696
|
+
// 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
378697
|
var ORCHESTRATOR_GUIDANCE;
|
|
378265
378698
|
var init_profiles2 = __esm({
|
|
378266
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378699
|
+
"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
378700
|
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
378701
|
}
|
|
378269
378702
|
});
|
|
378270
378703
|
|
|
378271
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378704
|
+
// 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
378705
|
var init_supervisor = __esm({
|
|
378273
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378706
|
+
"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
378707
|
}
|
|
378275
378708
|
});
|
|
378276
378709
|
|
|
378277
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378710
|
+
// 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
378711
|
var init_todos = __esm({
|
|
378279
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378712
|
+
"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
378713
|
}
|
|
378281
378714
|
});
|
|
378282
378715
|
|
|
378283
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378716
|
+
// 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
378717
|
async function loadAll(kv, prefix) {
|
|
378285
378718
|
{
|
|
378286
378719
|
let out = [];
|
|
@@ -378334,11 +378767,11 @@ function runStore(kv, scope) {
|
|
|
378334
378767
|
}
|
|
378335
378768
|
}
|
|
378336
378769
|
var init_store = __esm({
|
|
378337
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378770
|
+
"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
378771
|
}
|
|
378339
378772
|
});
|
|
378340
378773
|
|
|
378341
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378774
|
+
// 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
378775
|
function errorMessage3(err2) {
|
|
378343
378776
|
{
|
|
378344
378777
|
if (err2 != null && ((__v) => __v == null ? "null" : typeof __v)(err2) === "object" && ((__v) => __v == null ? "null" : typeof __v)(err2.message) === "string") {
|
|
@@ -378422,29 +378855,327 @@ async function resumeRun(id3, runs2, options) {
|
|
|
378422
378855
|
}
|
|
378423
378856
|
}
|
|
378424
378857
|
var init_run = __esm({
|
|
378425
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
378858
|
+
"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
378859
|
init_loop();
|
|
378427
378860
|
}
|
|
378428
378861
|
});
|
|
378429
378862
|
|
|
378430
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378863
|
+
// 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
|
|
378864
|
+
function createRouter(opts) {
|
|
378865
|
+
{
|
|
378866
|
+
let call2 = roleModel(opts.callModel, opts.spec) ?? null;
|
|
378867
|
+
let threshold = ((__v) => __v == null ? "null" : typeof __v)(opts.threshold) === "number" ? opts.threshold : 0.8;
|
|
378868
|
+
let maxChars = ((__v) => __v == null ? "null" : typeof __v)(opts.maxChars) === "number" ? opts.maxChars : 12e3;
|
|
378869
|
+
return async (req) => {
|
|
378870
|
+
{
|
|
378871
|
+
if (!(Array.isArray(req.tools) ?? null) || req.tools.length === 0) {
|
|
378872
|
+
return null;
|
|
378873
|
+
}
|
|
378874
|
+
let names = req.tools.map((t4) => {
|
|
378875
|
+
{
|
|
378876
|
+
return (t4["function"] ?? null).name;
|
|
378877
|
+
}
|
|
378878
|
+
}) ?? null;
|
|
378879
|
+
let turn = null;
|
|
378880
|
+
try {
|
|
378881
|
+
{
|
|
378882
|
+
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);
|
|
378883
|
+
}
|
|
378884
|
+
} catch (err2) {
|
|
378885
|
+
{
|
|
378886
|
+
return null;
|
|
378887
|
+
}
|
|
378888
|
+
}
|
|
378889
|
+
let tool2 = null;
|
|
378890
|
+
let p2 = 0;
|
|
378891
|
+
let t3 = (turn.text ?? "").trim() ?? null;
|
|
378892
|
+
let start2 = t3.indexOf("{") ?? null;
|
|
378893
|
+
let end = t3.lastIndexOf("}") ?? null;
|
|
378894
|
+
if (start2 >= 0 && end > start2) {
|
|
378895
|
+
try {
|
|
378896
|
+
{
|
|
378897
|
+
let j = JSON.parse(t3.slice(start2, end + 1) ?? null) ?? null;
|
|
378898
|
+
if (((__v) => __v == null ? "null" : typeof __v)(j.tool) === "string" && (names.includes(j.tool) ?? null)) {
|
|
378899
|
+
tool2 = j.tool;
|
|
378900
|
+
}
|
|
378901
|
+
if (((__v) => __v == null ? "null" : typeof __v)(j.p) === "number") {
|
|
378902
|
+
p2 = j.p;
|
|
378903
|
+
}
|
|
378904
|
+
}
|
|
378905
|
+
} catch (e) {
|
|
378906
|
+
{
|
|
378907
|
+
}
|
|
378908
|
+
}
|
|
378909
|
+
}
|
|
378910
|
+
let sharp = tool2 != null && p2 >= threshold;
|
|
378911
|
+
if (((__v) => __v == null ? "null" : typeof __v)(opts.onEvent) === "function") {
|
|
378912
|
+
opts.onEvent({ type: "router:pick", round: req.round, model: opts.spec.model, tool: tool2, p: p2, sharp }) ?? null;
|
|
378913
|
+
}
|
|
378914
|
+
return sharp ? forceTool(tool2) ?? null : null;
|
|
378915
|
+
}
|
|
378916
|
+
};
|
|
378917
|
+
}
|
|
378918
|
+
}
|
|
378919
|
+
var ROUTER_PROMPT;
|
|
378920
|
+
var init_router = __esm({
|
|
378921
|
+
"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"() {
|
|
378922
|
+
init_types9();
|
|
378923
|
+
init_roles();
|
|
378924
|
+
init_advisor();
|
|
378925
|
+
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.';
|
|
378926
|
+
}
|
|
378927
|
+
});
|
|
378928
|
+
|
|
378929
|
+
// 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
|
|
378930
|
+
function normalizeMode(mode2) {
|
|
378931
|
+
{
|
|
378932
|
+
if (mode2 === "off" || mode2 === false) {
|
|
378933
|
+
return "off";
|
|
378934
|
+
}
|
|
378935
|
+
if (mode2 === "ultra") {
|
|
378936
|
+
return "ultra";
|
|
378937
|
+
}
|
|
378938
|
+
return "auto";
|
|
378939
|
+
}
|
|
378940
|
+
}
|
|
378941
|
+
function createOrchestration(callModel, opts) {
|
|
378942
|
+
{
|
|
378943
|
+
let o = opts ?? {};
|
|
378944
|
+
let mode2 = normalizeMode(o.mode ?? "auto") ?? null;
|
|
378945
|
+
let skill = o.skill != null && ((__v) => __v == null ? "null" : typeof __v)(o.skill) === "object" ? o.skill : null;
|
|
378946
|
+
let catalog2 = o.catalog ?? null;
|
|
378947
|
+
let emit6 = (e) => {
|
|
378948
|
+
{
|
|
378949
|
+
if (((__v) => __v == null ? "null" : typeof __v)(o.onEvent) === "function") {
|
|
378950
|
+
o.onEvent(e) ?? null;
|
|
378951
|
+
}
|
|
378952
|
+
}
|
|
378953
|
+
};
|
|
378954
|
+
let hostLimit = ((__v) => __v == null ? "null" : typeof __v)(o.maxConcurrent) === "number" ? o.maxConcurrent : null;
|
|
378955
|
+
if (mode2 === "off" || skill == null) {
|
|
378956
|
+
return { mode: mode2, skill: null, roles: {}, maxConcurrent: hostLimit, guidance: "", callModel, childModel: (m) => {
|
|
378957
|
+
{
|
|
378958
|
+
return null;
|
|
378959
|
+
}
|
|
378960
|
+
}, advise: null, route: null };
|
|
378961
|
+
}
|
|
378962
|
+
emit6({ type: "skill", skill: skill.name }) ?? null;
|
|
378963
|
+
let roles = mergeRoles(skill.roles, o.roles ?? null) ?? null;
|
|
378964
|
+
if (((__v) => __v == null ? "null" : typeof __v)(o.effort) === "string" && (roles.lead ?? null) != null) {
|
|
378965
|
+
roles = mergeRoles(roles, { lead: { effort: o.effort } }) ?? null;
|
|
378966
|
+
}
|
|
378967
|
+
let specs = {};
|
|
378968
|
+
let calls = {};
|
|
378969
|
+
let callFor = (role) => {
|
|
378970
|
+
{
|
|
378971
|
+
if ((calls[role] ?? null ?? null) == null) {
|
|
378972
|
+
let spec = resolveRole(role, roles, catalog2) ?? null;
|
|
378973
|
+
if (spec == null) {
|
|
378974
|
+
return null;
|
|
378975
|
+
}
|
|
378976
|
+
specs[role] = spec;
|
|
378977
|
+
calls[role] = roleModel(callModel, spec) ?? null;
|
|
378978
|
+
emit6({ type: "role:model", role, model: spec.model }) ?? null;
|
|
378979
|
+
}
|
|
378980
|
+
return calls[role] ?? null;
|
|
378981
|
+
}
|
|
378982
|
+
};
|
|
378983
|
+
let lead = callFor("lead") ?? null ?? callModel;
|
|
378984
|
+
let advise = null;
|
|
378985
|
+
let route2 = null;
|
|
378986
|
+
if ((callFor("advisor") ?? null) != null) {
|
|
378987
|
+
let triggers = null;
|
|
378988
|
+
if (Array.isArray(skill.advisorTriggers) ?? null) {
|
|
378989
|
+
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 };
|
|
378990
|
+
}
|
|
378991
|
+
advise = (createAdvisor({ callModel, spec: specs.advisor, triggers, maxCalls: skill.advisorMaxCalls ?? null, maxChars: null, guidance: skill.guidance, onEvent: (e) => {
|
|
378992
|
+
{
|
|
378993
|
+
emit6(e) ?? null;
|
|
378994
|
+
}
|
|
378995
|
+
} }) ?? null).advise;
|
|
378996
|
+
}
|
|
378997
|
+
if (((__v) => __v == null ? "null" : typeof __v)(skill.routerThreshold) === "number" && (callFor("router") ?? null) != null) {
|
|
378998
|
+
route2 = createRouter({ callModel, spec: specs.router, threshold: skill.routerThreshold, onEvent: (e) => {
|
|
378999
|
+
{
|
|
379000
|
+
emit6(e) ?? null;
|
|
379001
|
+
}
|
|
379002
|
+
} }) ?? null;
|
|
379003
|
+
}
|
|
379004
|
+
return { mode: mode2, skill, roles, maxConcurrent: hostLimit ?? skill.maxConcurrent ?? null, guidance: skill.guidance, callModel: lead, childModel: (profileModel) => {
|
|
379005
|
+
{
|
|
379006
|
+
let role = roleOfProfileModel(profileModel) ?? null;
|
|
379007
|
+
if (role == null) {
|
|
379008
|
+
return roleModel(callModel, { model: profileModel, effort: (specs.lead ?? {}).effort ?? null, fallback: null }) ?? null;
|
|
379009
|
+
}
|
|
379010
|
+
return callFor(role) ?? null ?? lead;
|
|
379011
|
+
}
|
|
379012
|
+
}, advise, route: route2 };
|
|
379013
|
+
}
|
|
379014
|
+
}
|
|
379015
|
+
var init_auto = __esm({
|
|
379016
|
+
"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"() {
|
|
379017
|
+
init_roles();
|
|
379018
|
+
init_advisor();
|
|
379019
|
+
init_router();
|
|
379020
|
+
}
|
|
379021
|
+
});
|
|
379022
|
+
|
|
379023
|
+
// 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
|
|
379024
|
+
function splitList(v) {
|
|
379025
|
+
{
|
|
379026
|
+
if ((v ?? null) == null) {
|
|
379027
|
+
return [];
|
|
379028
|
+
}
|
|
379029
|
+
return ((v.split(",") ?? null).map((s) => {
|
|
379030
|
+
{
|
|
379031
|
+
return s.trim() ?? null;
|
|
379032
|
+
}
|
|
379033
|
+
}) ?? null).filter((s) => {
|
|
379034
|
+
{
|
|
379035
|
+
return s !== "";
|
|
379036
|
+
}
|
|
379037
|
+
}) ?? null;
|
|
379038
|
+
}
|
|
379039
|
+
}
|
|
379040
|
+
function unquote(v) {
|
|
379041
|
+
{
|
|
379042
|
+
let t3 = v.trim() ?? null;
|
|
379043
|
+
if (t3.length >= 2 && ((t3.startsWith('"') ?? null) && (t3.endsWith('"') ?? null) || (t3.startsWith("'") ?? null) && (t3.endsWith("'") ?? null))) {
|
|
379044
|
+
return t3.slice(1, t3.length - 1) ?? null;
|
|
379045
|
+
}
|
|
379046
|
+
return t3;
|
|
379047
|
+
}
|
|
379048
|
+
}
|
|
379049
|
+
function num11(v) {
|
|
379050
|
+
{
|
|
379051
|
+
if ((v ?? null) == null || v === "") {
|
|
379052
|
+
return null;
|
|
379053
|
+
}
|
|
379054
|
+
let n = Number(v) ?? null;
|
|
379055
|
+
return Number.isFinite(n) ?? null ? n : null;
|
|
379056
|
+
}
|
|
379057
|
+
}
|
|
379058
|
+
function parseOrchestrationSkill(text) {
|
|
379059
|
+
{
|
|
379060
|
+
let src = ((__v) => __v == null ? "null" : typeof __v)(text) === "string" ? (text.split("\r\n") ?? null).join("\n") ?? null : "";
|
|
379061
|
+
if (!(src.startsWith("---\n") ?? null)) {
|
|
379062
|
+
return null;
|
|
379063
|
+
}
|
|
379064
|
+
let end = src.indexOf("\n---", 4) ?? null;
|
|
379065
|
+
if (end < 0) {
|
|
379066
|
+
return null;
|
|
379067
|
+
}
|
|
379068
|
+
let head2 = src.slice(4, end) ?? null;
|
|
379069
|
+
let body = src.slice(end + 4) ?? null;
|
|
379070
|
+
if (body.startsWith("\n") ?? null) {
|
|
379071
|
+
body = body.slice(1) ?? null;
|
|
379072
|
+
}
|
|
379073
|
+
let f2 = {};
|
|
379074
|
+
for (const line of head2.split("\n") ?? null) {
|
|
379075
|
+
let i2 = line.indexOf(":") ?? null;
|
|
379076
|
+
if (i2 <= 0 || ((line.trim() ?? null).startsWith("#") ?? null)) {
|
|
379077
|
+
continue;
|
|
379078
|
+
}
|
|
379079
|
+
f2[((line.slice(0, i2) ?? null).trim() ?? null).toLowerCase() ?? null] = unquote(line.slice(i2 + 1) ?? null) ?? null;
|
|
379080
|
+
}
|
|
379081
|
+
if ((f2["kind"] ?? null ?? "") !== "orchestration") {
|
|
379082
|
+
return null;
|
|
379083
|
+
}
|
|
379084
|
+
let roles = {};
|
|
379085
|
+
for (const r of MODEL_ROLES) {
|
|
379086
|
+
let model = f2[r] ?? null ?? "";
|
|
379087
|
+
if (model === "") {
|
|
379088
|
+
continue;
|
|
379089
|
+
}
|
|
379090
|
+
let spec = { model, effort: (f2[r + "_effort"] ?? null ?? "") !== "" ? f2[r + "_effort"] ?? null : null, fallback: splitList(f2[r + "_fallback"] ?? null ?? null) ?? null };
|
|
379091
|
+
roles[r] = spec;
|
|
379092
|
+
}
|
|
379093
|
+
let triggers = splitList(f2["advisor_triggers"] ?? null ?? null) ?? null;
|
|
379094
|
+
return { name: (f2["name"] ?? null ?? "") !== "" ? f2["name"] ?? null : "orchestration", description: f2["description"] ?? null ?? "", modes: (splitList(f2["modes"] ?? null ?? null) ?? null).map((m) => {
|
|
379095
|
+
{
|
|
379096
|
+
return m.toLowerCase() ?? null;
|
|
379097
|
+
}
|
|
379098
|
+
}) ?? 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 };
|
|
379099
|
+
}
|
|
379100
|
+
}
|
|
379101
|
+
function skillsForMode(skills, mode2) {
|
|
379102
|
+
{
|
|
379103
|
+
if (mode2 === "off" || !(Array.isArray(skills) ?? null)) {
|
|
379104
|
+
return [];
|
|
379105
|
+
}
|
|
379106
|
+
return skills.filter((s) => {
|
|
379107
|
+
{
|
|
379108
|
+
return s != null && ((__v) => __v == null ? "null" : typeof __v)(s) === "object" && (s.modes.length === 0 || (s.modes.includes(mode2) ?? null));
|
|
379109
|
+
}
|
|
379110
|
+
}) ?? null;
|
|
379111
|
+
}
|
|
379112
|
+
}
|
|
379113
|
+
async function chooseOrchestrationSkill(callModel, skills, task, mode2) {
|
|
379114
|
+
{
|
|
379115
|
+
let candidates2 = skillsForMode(skills, mode2) ?? null;
|
|
379116
|
+
if (candidates2.length === 0) {
|
|
379117
|
+
return null;
|
|
379118
|
+
}
|
|
379119
|
+
if (candidates2.length === 1) {
|
|
379120
|
+
return candidates2[0] ?? null;
|
|
379121
|
+
}
|
|
379122
|
+
let list2 = (candidates2.map((s) => {
|
|
379123
|
+
{
|
|
379124
|
+
return "- " + s.name + ": " + s.description;
|
|
379125
|
+
}
|
|
379126
|
+
}) ?? null).join("\n") ?? null;
|
|
379127
|
+
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 }];
|
|
379128
|
+
let turn = null;
|
|
379129
|
+
try {
|
|
379130
|
+
{
|
|
379131
|
+
turn = await (callModel(messages, [], {}, null, null) ?? null);
|
|
379132
|
+
}
|
|
379133
|
+
} catch (err2) {
|
|
379134
|
+
{
|
|
379135
|
+
return null;
|
|
379136
|
+
}
|
|
379137
|
+
}
|
|
379138
|
+
let said = ((String(turn.text ?? "") ?? null).trim() ?? null).toLowerCase() ?? null;
|
|
379139
|
+
for (const ch of ["`", "'", '"', "*", "."]) {
|
|
379140
|
+
said = (said.split(ch) ?? null).join("") ?? null;
|
|
379141
|
+
}
|
|
379142
|
+
for (const s of candidates2) {
|
|
379143
|
+
if (said === (s.name.toLowerCase() ?? null) || (said.includes(s.name.toLowerCase() ?? null) ?? null)) {
|
|
379144
|
+
return s;
|
|
379145
|
+
}
|
|
379146
|
+
}
|
|
379147
|
+
return null;
|
|
379148
|
+
}
|
|
379149
|
+
}
|
|
379150
|
+
var init_orchestration_skill = __esm({
|
|
379151
|
+
"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"() {
|
|
379152
|
+
init_roles();
|
|
379153
|
+
}
|
|
379154
|
+
});
|
|
379155
|
+
|
|
379156
|
+
// 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
379157
|
var init_core3 = __esm({
|
|
378432
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
379158
|
+
"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
379159
|
init_types9();
|
|
378434
379160
|
init_loop();
|
|
378435
379161
|
init_context2();
|
|
378436
379162
|
init_runtime5();
|
|
378437
|
-
|
|
379163
|
+
init_orchestration2();
|
|
378438
379164
|
init_profiles2();
|
|
378439
379165
|
init_supervisor();
|
|
378440
379166
|
init_todos();
|
|
378441
379167
|
init_store();
|
|
378442
379168
|
init_run();
|
|
378443
379169
|
init_hypery_model();
|
|
379170
|
+
init_roles();
|
|
379171
|
+
init_advisor();
|
|
379172
|
+
init_router();
|
|
379173
|
+
init_auto();
|
|
379174
|
+
init_orchestration_skill();
|
|
378444
379175
|
}
|
|
378445
379176
|
});
|
|
378446
379177
|
|
|
378447
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
379178
|
+
// 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
379179
|
function indexedDbStore(name2 = "hypery-agents") {
|
|
378449
379180
|
let db3 = null;
|
|
378450
379181
|
const open4 = () => db3 ?? (db3 = new Promise((res, rej) => {
|
|
@@ -378476,11 +379207,11 @@ function indexedDbStore(name2 = "hypery-agents") {
|
|
|
378476
379207
|
};
|
|
378477
379208
|
}
|
|
378478
379209
|
var init_indexeddb2 = __esm({
|
|
378479
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
379210
|
+
"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
379211
|
}
|
|
378481
379212
|
});
|
|
378482
379213
|
|
|
378483
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
379214
|
+
// 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
379215
|
function createHyperyModel2(opts) {
|
|
378485
379216
|
return createHyperyModel({ ...opts, fetch: opts.fetch ?? ((url4, init) => fetch(url4, init)) });
|
|
378486
379217
|
}
|
|
@@ -378496,7 +379227,7 @@ function createAgentRuntime2(host) {
|
|
|
378496
379227
|
});
|
|
378497
379228
|
}
|
|
378498
379229
|
var init_agents = __esm({
|
|
378499
|
-
"node_modules/.pnpm/@hyperyai+sdk@
|
|
379230
|
+
"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
379231
|
init_hypery_model();
|
|
378501
379232
|
init_runtime5();
|
|
378502
379233
|
init_core3();
|
|
@@ -378730,6 +379461,47 @@ var init_turn_recovery = __esm({
|
|
|
378730
379461
|
}
|
|
378731
379462
|
});
|
|
378732
379463
|
|
|
379464
|
+
// lib/agent/orchestration.ts
|
|
379465
|
+
function loadMode() {
|
|
379466
|
+
try {
|
|
379467
|
+
return normalizeMode(typeof localStorage === "undefined" ? null : localStorage.getItem(MODE_KEY2));
|
|
379468
|
+
} catch {
|
|
379469
|
+
return "auto";
|
|
379470
|
+
}
|
|
379471
|
+
}
|
|
379472
|
+
async function orchestrateTurn(opts) {
|
|
379473
|
+
const mode2 = opts.mode ?? orchestrationMode();
|
|
379474
|
+
let skill = null;
|
|
379475
|
+
if (mode2 !== "off") {
|
|
379476
|
+
skill = await chooseOrchestrationSkill(opts.callModel, opts.skills ?? orchestrationSkills(), opts.task, mode2).catch(() => null);
|
|
379477
|
+
}
|
|
379478
|
+
if (skill && opts.explicitModel && skill.roles?.lead) {
|
|
379479
|
+
const { lead: _lead, ...roles } = skill.roles;
|
|
379480
|
+
skill = { ...skill, roles };
|
|
379481
|
+
}
|
|
379482
|
+
current5 = createOrchestration(opts.callModel, { mode: mode2, skill, onEvent: opts.onEvent });
|
|
379483
|
+
return current5;
|
|
379484
|
+
}
|
|
379485
|
+
function endOrchestration(orch) {
|
|
379486
|
+
if (current5 === orch) current5 = null;
|
|
379487
|
+
}
|
|
379488
|
+
var MODE_KEY2, useOrchestrationStore, orchestrationMode, orchestrationSkillOf, orchestrationSkills, current5, currentOrchestration;
|
|
379489
|
+
var init_orchestration3 = __esm({
|
|
379490
|
+
"lib/agent/orchestration.ts"() {
|
|
379491
|
+
"use strict";
|
|
379492
|
+
init_esm();
|
|
379493
|
+
init_agents();
|
|
379494
|
+
init_skills();
|
|
379495
|
+
MODE_KEY2 = "popcraft-agent-orchestration";
|
|
379496
|
+
useOrchestrationStore = create2(() => ({ mode: loadMode() }));
|
|
379497
|
+
orchestrationMode = () => useOrchestrationStore.getState().mode;
|
|
379498
|
+
orchestrationSkillOf = (skill) => parseOrchestrationSkill(skill.instructions);
|
|
379499
|
+
orchestrationSkills = (skills = allSkills()) => skills.map(orchestrationSkillOf).filter((s) => s !== null);
|
|
379500
|
+
current5 = null;
|
|
379501
|
+
currentOrchestration = () => current5;
|
|
379502
|
+
}
|
|
379503
|
+
});
|
|
379504
|
+
|
|
378733
379505
|
// lib/agent/prompt.ts
|
|
378734
379506
|
function buildContextBlock(ctx2, maxChars = PROMPT_LIMITS.maxContextChars) {
|
|
378735
379507
|
const { doc: doc2, pageId: pageId2, selection } = ctx2;
|
|
@@ -378752,7 +379524,7 @@ function buildContextBlock(ctx2, maxChars = PROMPT_LIMITS.maxContextChars) {
|
|
|
378752
379524
|
return joinWithin(lines2, maxChars);
|
|
378753
379525
|
}
|
|
378754
379526
|
function buildSkillIndex(skills, maxChars = PROMPT_LIMITS.maxSkillIndexChars) {
|
|
378755
|
-
return joinWithin(skills.map(skillIndexLine), maxChars);
|
|
379527
|
+
return joinWithin(skills.filter((s) => parseOrchestrationSkill(s.instructions) === null).map(skillIndexLine), maxChars);
|
|
378756
379528
|
}
|
|
378757
379529
|
function buildProfileIndex(profiles, maxChars = PROMPT_LIMITS.maxProfileIndexChars) {
|
|
378758
379530
|
return joinWithin(profiles.map(profileIndexLine), maxChars);
|
|
@@ -378791,11 +379563,12 @@ var init_prompt = __esm({
|
|
|
378791
379563
|
init_limits();
|
|
378792
379564
|
init_context();
|
|
378793
379565
|
init_skills();
|
|
379566
|
+
init_agents();
|
|
378794
379567
|
init_profiles();
|
|
378795
379568
|
init_mentions();
|
|
378796
379569
|
PROMPT_LIMITS = {
|
|
378797
|
-
maxPromptChars:
|
|
378798
|
-
maxSkillIndexChars:
|
|
379570
|
+
maxPromptChars: 14400,
|
|
379571
|
+
maxSkillIndexChars: 5200,
|
|
378799
379572
|
maxProfileIndexChars: 1600,
|
|
378800
379573
|
maxContextChars: AI_LIMITS.maxContextChars,
|
|
378801
379574
|
maxSelectionItems: 12
|
|
@@ -378808,6 +379581,7 @@ var init_prompt = __esm({
|
|
|
378808
379581
|
- 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
379582
|
- Explain briefly. A line or two about what you did and why, with counts rather than lists. No preamble, no restating the request.
|
|
378810
379583
|
- 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.
|
|
379584
|
+
- 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
379585
|
- 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
379586
|
- 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
379587
|
- 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 +379648,16 @@ function subagentHost(deps = {}) {
|
|
|
378874
379648
|
profiles,
|
|
378875
379649
|
callModel: modelCall(parentModel),
|
|
378876
379650
|
childModel: (ctx2) => {
|
|
379651
|
+
const orch = currentOrchestration();
|
|
379652
|
+
if (orch?.skill) {
|
|
379653
|
+
const call2 = orch.childModel(readOnly(ctx2) ? "swarm" : profileOf(ctx2).model ?? null);
|
|
379654
|
+
if (call2) return call2;
|
|
379655
|
+
}
|
|
378877
379656
|
const model = pickChildModel(profileOf(ctx2), parentModel(), catalog2());
|
|
378878
379657
|
return modelCall(() => model);
|
|
378879
379658
|
},
|
|
379659
|
+
// The turn's skill sets how many background children run at once (null: the SDK's default).
|
|
379660
|
+
maxConcurrent: () => currentOrchestration()?.maxConcurrent ?? null,
|
|
378880
379661
|
childSystemPrompt: (ctx2) => buildSubagentPrompt(ctx2.profile.instructions, promptContext()),
|
|
378881
379662
|
childTools: (ctx2) => {
|
|
378882
379663
|
const all4 = registered3();
|
|
@@ -378946,6 +379727,7 @@ var PARENT_ONLY_TOOLS, AGENT_SESSIONS_DB, FAST_HINTS, isFastModelId, childToolLi
|
|
|
378946
379727
|
var init_subagent = __esm({
|
|
378947
379728
|
"lib/agent/subagent.ts"() {
|
|
378948
379729
|
"use strict";
|
|
379730
|
+
init_orchestration3();
|
|
378949
379731
|
init_editor_store();
|
|
378950
379732
|
init_client_store();
|
|
378951
379733
|
init_agents();
|
|
@@ -379450,6 +380232,7 @@ var init_doc2 = __esm({
|
|
|
379450
380232
|
var POSTER_KEY, MAX_PREVIEW_BYTES2, PREVIEW_STILL_TYPE, previewPath;
|
|
379451
380233
|
var init_motion3 = __esm({
|
|
379452
380234
|
"lib/marketplace/motion.ts"() {
|
|
380235
|
+
"use strict";
|
|
379453
380236
|
init_instances2();
|
|
379454
380237
|
POSTER_KEY = "poster";
|
|
379455
380238
|
MAX_PREVIEW_BYTES2 = 4 * 1024 * 1024;
|
|
@@ -379565,6 +380348,7 @@ async function renderLibraryPreviews(renderer, doc2, listing, format = pickPrevi
|
|
|
379565
380348
|
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
380349
|
var init_library_previews = __esm({
|
|
379567
380350
|
"lib/motion/library-previews.ts"() {
|
|
380351
|
+
"use strict";
|
|
379568
380352
|
init_codecs();
|
|
379569
380353
|
init_gpu_pixels();
|
|
379570
380354
|
init_render_frames();
|
|
@@ -379655,8 +380439,8 @@ async function reviewUpdate(update3) {
|
|
|
379655
380439
|
}
|
|
379656
380440
|
function acceptUpdate(update3, payload, accept) {
|
|
379657
380441
|
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 ??
|
|
380442
|
+
const current6 = liveDoc().libraries?.[update3.libraryId];
|
|
380443
|
+
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
380444
|
useEditorStore.getState().commitDocument(doc2, `Update library: ${update3.name}`);
|
|
379661
380445
|
computeUpdates();
|
|
379662
380446
|
}
|
|
@@ -379853,17 +380637,17 @@ function sanitizeWidgetTree(raw) {
|
|
|
379853
380637
|
switch (e.type) {
|
|
379854
380638
|
case "AutoLayout": {
|
|
379855
380639
|
let padding3;
|
|
379856
|
-
if (typeof e.padding === "number") padding3 =
|
|
380640
|
+
if (typeof e.padding === "number") padding3 = num12(e.padding, 0, 1e3);
|
|
379857
380641
|
else if (e.padding && typeof e.padding === "object") {
|
|
379858
380642
|
const p2 = e.padding;
|
|
379859
|
-
padding3 = { top:
|
|
380643
|
+
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
380644
|
}
|
|
379861
380645
|
const children = Array.isArray(e.children) ? e.children.filter((c2) => c2 !== null && c2 !== void 0 && c2 !== false).map((c2) => visit2(c2, depth + 1)) : [];
|
|
379862
380646
|
return strip({
|
|
379863
380647
|
type: "AutoLayout",
|
|
379864
380648
|
...base,
|
|
379865
380649
|
direction: e.direction === "vertical" ? "vertical" : "horizontal",
|
|
379866
|
-
spacing:
|
|
380650
|
+
spacing: num12(e.spacing, 0, 1e3),
|
|
379867
380651
|
padding: padding3,
|
|
379868
380652
|
width: size5(e.width),
|
|
379869
380653
|
height: size5(e.height),
|
|
@@ -379871,8 +380655,8 @@ function sanitizeWidgetTree(raw) {
|
|
|
379871
380655
|
verticalAlign: align3(e.verticalAlign),
|
|
379872
380656
|
fill: color3(e.fill),
|
|
379873
380657
|
stroke: color3(e.stroke),
|
|
379874
|
-
strokeWidth:
|
|
379875
|
-
cornerRadius:
|
|
380658
|
+
strokeWidth: num12(e.strokeWidth, 0, 100),
|
|
380659
|
+
cornerRadius: num12(e.cornerRadius, 0, 2e3),
|
|
379876
380660
|
children
|
|
379877
380661
|
});
|
|
379878
380662
|
}
|
|
@@ -379881,22 +380665,22 @@ function sanitizeWidgetTree(raw) {
|
|
|
379881
380665
|
type: "Text",
|
|
379882
380666
|
...base,
|
|
379883
380667
|
characters: String(e.characters ?? "").slice(0, 2e3),
|
|
379884
|
-
fontSize:
|
|
379885
|
-
fontWeight:
|
|
380668
|
+
fontSize: num12(e.fontSize, 1, 400),
|
|
380669
|
+
fontWeight: num12(e.fontWeight, 100, 900),
|
|
379886
380670
|
fill: color3(e.fill),
|
|
379887
|
-
width:
|
|
380671
|
+
width: num12(e.width, 0, 4e3)
|
|
379888
380672
|
});
|
|
379889
380673
|
case "Rectangle":
|
|
379890
380674
|
case "Ellipse":
|
|
379891
380675
|
return strip({
|
|
379892
380676
|
type: e.type,
|
|
379893
380677
|
...base,
|
|
379894
|
-
width:
|
|
379895
|
-
height:
|
|
380678
|
+
width: num12(e.width, 0, 4e3, 0),
|
|
380679
|
+
height: num12(e.height, 0, 4e3, 0),
|
|
379896
380680
|
fill: color3(e.fill),
|
|
379897
380681
|
stroke: color3(e.stroke),
|
|
379898
|
-
strokeWidth:
|
|
379899
|
-
cornerRadius:
|
|
380682
|
+
strokeWidth: num12(e.strokeWidth, 0, 100),
|
|
380683
|
+
cornerRadius: num12(e.cornerRadius, 0, 2e3)
|
|
379900
380684
|
});
|
|
379901
380685
|
default:
|
|
379902
380686
|
throw new WidgetTreeError(`Unknown widget element type ${JSON.stringify(e.type)}`);
|
|
@@ -380002,7 +380786,7 @@ function padding(el) {
|
|
|
380002
380786
|
right: p2?.right ?? p2?.horizontal ?? 0
|
|
380003
380787
|
};
|
|
380004
380788
|
}
|
|
380005
|
-
var MAX_WIDGET_ELEMENTS, MAX_WIDGET_DEPTH, MAX_WIDGET_STATE_BYTES, WidgetTreeError,
|
|
380789
|
+
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
380790
|
var init_layout4 = __esm({
|
|
380007
380791
|
"lib/extensions/widget/layout.ts"() {
|
|
380008
380792
|
MAX_WIDGET_ELEMENTS = 400;
|
|
@@ -380010,7 +380794,7 @@ var init_layout4 = __esm({
|
|
|
380010
380794
|
MAX_WIDGET_STATE_BYTES = 64 * 1024;
|
|
380011
380795
|
WidgetTreeError = class extends Error {
|
|
380012
380796
|
};
|
|
380013
|
-
|
|
380797
|
+
num12 = (v, min2, max3, fallback2) => {
|
|
380014
380798
|
if (typeof v !== "number" || !Number.isFinite(v)) return fallback2;
|
|
380015
380799
|
return Math.max(min2, Math.min(max3, v));
|
|
380016
380800
|
};
|
|
@@ -380018,7 +380802,7 @@ var init_layout4 = __esm({
|
|
|
380018
380802
|
color3 = (v) => typeof v === "string" && HEX.test(v) ? v : void 0;
|
|
380019
380803
|
str3 = (v, max3) => typeof v === "string" ? v.slice(0, max3) : void 0;
|
|
380020
380804
|
align3 = (v) => v === "start" || v === "center" || v === "end" ? v : void 0;
|
|
380021
|
-
size5 = (v) => v === "hug" ? "hug" :
|
|
380805
|
+
size5 = (v) => v === "hug" ? "hug" : num12(v, 0, 4e3);
|
|
380022
380806
|
DEFAULT_FONT_SIZE = 16;
|
|
380023
380807
|
TEXT_COLOR = { r: 0.12, g: 0.12, b: 0.14, a: 1 };
|
|
380024
380808
|
layoutCache2 = /* @__PURE__ */ new WeakMap();
|
|
@@ -392884,20 +393668,20 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
392884
393668
|
graphics.current.updateClipFromPath();
|
|
392885
393669
|
}
|
|
392886
393670
|
setFillAndStrokeStyleToContext(graphics, paintType, color4) {
|
|
392887
|
-
const context = graphics.ctx,
|
|
392888
|
-
|
|
393671
|
+
const context = graphics.ctx, current6 = graphics.current;
|
|
393672
|
+
current6.patternFill = current6.patternStroke = false;
|
|
392889
393673
|
switch (paintType) {
|
|
392890
393674
|
case PaintType.COLORED:
|
|
392891
393675
|
const {
|
|
392892
393676
|
fillStyle,
|
|
392893
393677
|
strokeStyle
|
|
392894
393678
|
} = this.ctx;
|
|
392895
|
-
context.fillStyle =
|
|
392896
|
-
context.strokeStyle =
|
|
393679
|
+
context.fillStyle = current6.fillColor = fillStyle;
|
|
393680
|
+
context.strokeStyle = current6.strokeColor = strokeStyle;
|
|
392897
393681
|
break;
|
|
392898
393682
|
case PaintType.UNCOLORED:
|
|
392899
393683
|
context.fillStyle = context.strokeStyle = color4;
|
|
392900
|
-
|
|
393684
|
+
current6.fillColor = current6.strokeColor = color4;
|
|
392901
393685
|
break;
|
|
392902
393686
|
default:
|
|
392903
393687
|
throw new FormatError2(`Unsupported paint type: ${paintType}`);
|
|
@@ -394134,19 +394918,19 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394134
394918
|
setFont(opIdx, fontRefName, size6) {
|
|
394135
394919
|
this.dependencyTracker?.recordSimpleData("font", opIdx).recordSimpleDataFromNamed("fontObj", fontRefName, opIdx);
|
|
394136
394920
|
const fontObj = this.commonObjs.get(fontRefName);
|
|
394137
|
-
const
|
|
394921
|
+
const current6 = this.current;
|
|
394138
394922
|
if (!fontObj) {
|
|
394139
394923
|
throw new Error(`Can't find font for ${fontRefName}`);
|
|
394140
394924
|
}
|
|
394141
|
-
|
|
394142
|
-
if (
|
|
394925
|
+
current6.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;
|
|
394926
|
+
if (current6.fontMatrix[0] === 0 || current6.fontMatrix[3] === 0) {
|
|
394143
394927
|
warn3("Invalid font matrix for font " + fontRefName);
|
|
394144
394928
|
}
|
|
394145
394929
|
if (size6 < 0) {
|
|
394146
394930
|
size6 = -size6;
|
|
394147
|
-
|
|
394931
|
+
current6.fontDirection = -1;
|
|
394148
394932
|
} else {
|
|
394149
|
-
|
|
394933
|
+
current6.fontDirection = 1;
|
|
394150
394934
|
}
|
|
394151
394935
|
this.current.font = fontObj;
|
|
394152
394936
|
this.current.fontSize = size6;
|
|
@@ -394186,12 +394970,12 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394186
394970
|
setTextMatrix(opIdx, matrix) {
|
|
394187
394971
|
this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix", opIdx);
|
|
394188
394972
|
const {
|
|
394189
|
-
current:
|
|
394973
|
+
current: current6
|
|
394190
394974
|
} = this;
|
|
394191
|
-
|
|
394192
|
-
|
|
394193
|
-
|
|
394194
|
-
|
|
394975
|
+
current6.textMatrix = matrix;
|
|
394976
|
+
current6.textMatrixScale = Math.hypot(matrix[0], matrix[1]);
|
|
394977
|
+
current6.x = current6.lineX = 0;
|
|
394978
|
+
current6.y = current6.lineY = 0;
|
|
394195
394979
|
}
|
|
394196
394980
|
nextLine(opIdx) {
|
|
394197
394981
|
this.moveText(opIdx, 0, this.current.leading);
|
|
@@ -394204,14 +394988,14 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394204
394988
|
}
|
|
394205
394989
|
paintChar(opIdx, character, x2, y, patternFillTransform, patternStrokeTransform) {
|
|
394206
394990
|
const ctx2 = this.ctx;
|
|
394207
|
-
const
|
|
394208
|
-
const font =
|
|
394209
|
-
const textRenderingMode =
|
|
394210
|
-
const fontSize =
|
|
394991
|
+
const current6 = this.current;
|
|
394992
|
+
const font = current6.font;
|
|
394993
|
+
const textRenderingMode = current6.textRenderingMode;
|
|
394994
|
+
const fontSize = current6.fontSize / current6.fontSizeScale;
|
|
394211
394995
|
const fillStrokeMode = textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
|
394212
394996
|
const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
|
|
394213
|
-
const patternFill =
|
|
394214
|
-
const patternStroke =
|
|
394997
|
+
const patternFill = current6.patternFill && !font.missingFile;
|
|
394998
|
+
const patternStroke = current6.patternStroke && !font.missingFile;
|
|
394215
394999
|
let path;
|
|
394216
395000
|
if ((font.disableFontFace || isAddToPathSet || patternFill || patternStroke) && !font.missingFile) {
|
|
394217
395001
|
path = font.getPathGenerator(this.commonObjs, character);
|
|
@@ -394300,49 +395084,49 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394300
395084
|
this.dependencyTracker.recordFutureForcedDependency("textClip", opIdx).inheritPendingDependenciesAsFutureForcedDependencies();
|
|
394301
395085
|
}
|
|
394302
395086
|
}
|
|
394303
|
-
const
|
|
394304
|
-
const font =
|
|
395087
|
+
const current6 = this.current;
|
|
395088
|
+
const font = current6.font;
|
|
394305
395089
|
if (font.isType3Font) {
|
|
394306
|
-
const started9 = this.#beginKnockoutElement(
|
|
395090
|
+
const started9 = this.#beginKnockoutElement(current6.fillAlpha);
|
|
394307
395091
|
this.showType3Text(opIdx, glyphs);
|
|
394308
395092
|
this.dependencyTracker?.recordShowTextOperation(opIdx);
|
|
394309
395093
|
this.#endKnockoutElement(started9);
|
|
394310
395094
|
return;
|
|
394311
395095
|
}
|
|
394312
|
-
const fontSize =
|
|
395096
|
+
const fontSize = current6.fontSize;
|
|
394313
395097
|
if (fontSize === 0) {
|
|
394314
395098
|
this.dependencyTracker?.recordOperation(opIdx);
|
|
394315
395099
|
return;
|
|
394316
395100
|
}
|
|
394317
|
-
const started8 = this.#beginKnockoutElement(
|
|
395101
|
+
const started8 = this.#beginKnockoutElement(current6.fillAlpha);
|
|
394318
395102
|
const ctx2 = this.ctx;
|
|
394319
|
-
const fontSizeScale =
|
|
394320
|
-
const charSpacing =
|
|
394321
|
-
const wordSpacing =
|
|
394322
|
-
const fontDirection =
|
|
394323
|
-
const textHScale =
|
|
395103
|
+
const fontSizeScale = current6.fontSizeScale;
|
|
395104
|
+
const charSpacing = current6.charSpacing;
|
|
395105
|
+
const wordSpacing = current6.wordSpacing;
|
|
395106
|
+
const fontDirection = current6.fontDirection;
|
|
395107
|
+
const textHScale = current6.textHScale * fontDirection;
|
|
394324
395108
|
const glyphsLength = glyphs.length;
|
|
394325
395109
|
const vertical = font.vertical;
|
|
394326
395110
|
const spacingDir = vertical ? 1 : -1;
|
|
394327
395111
|
const defaultVMetrics = font.defaultVMetrics;
|
|
394328
|
-
const widthAdvanceScale = fontSize *
|
|
394329
|
-
const simpleFillText =
|
|
395112
|
+
const widthAdvanceScale = fontSize * current6.fontMatrix[0];
|
|
395113
|
+
const simpleFillText = current6.textRenderingMode === TextRenderingMode.FILL && !font.disableFontFace && !current6.patternFill;
|
|
394330
395114
|
ctx2.save();
|
|
394331
|
-
if (
|
|
394332
|
-
ctx2.transform(...
|
|
395115
|
+
if (current6.textMatrix) {
|
|
395116
|
+
ctx2.transform(...current6.textMatrix);
|
|
394333
395117
|
}
|
|
394334
|
-
ctx2.translate(
|
|
395118
|
+
ctx2.translate(current6.x, current6.y + current6.textRise);
|
|
394335
395119
|
if (fontDirection > 0) {
|
|
394336
395120
|
ctx2.scale(textHScale, -1);
|
|
394337
395121
|
} else {
|
|
394338
395122
|
ctx2.scale(textHScale, 1);
|
|
394339
395123
|
}
|
|
394340
395124
|
let patternFillTransform, patternStrokeTransform;
|
|
394341
|
-
const fillStrokeMode =
|
|
395125
|
+
const fillStrokeMode = current6.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
|
394342
395126
|
const needsFill = fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
|
394343
395127
|
const needsStroke = fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
|
394344
|
-
let lineWidth2 =
|
|
394345
|
-
const scale =
|
|
395128
|
+
let lineWidth2 = current6.lineWidth;
|
|
395129
|
+
const scale = current6.textMatrixScale;
|
|
394346
395130
|
if (scale === 0 || lineWidth2 === 0) {
|
|
394347
395131
|
if (needsStroke) {
|
|
394348
395132
|
lineWidth2 = this.getSinglePixelWidth();
|
|
@@ -394355,16 +395139,16 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394355
395139
|
lineWidth2 /= fontSizeScale;
|
|
394356
395140
|
}
|
|
394357
395141
|
ctx2.lineWidth = lineWidth2;
|
|
394358
|
-
if (needsFill &&
|
|
395142
|
+
if (needsFill && current6.patternFill) {
|
|
394359
395143
|
ctx2.save();
|
|
394360
|
-
const pattern =
|
|
395144
|
+
const pattern = current6.fillColor.getPattern(ctx2, this, getCurrentTransformInverse(ctx2), PathType.FILL, opIdx);
|
|
394361
395145
|
patternFillTransform = getCurrentTransform(ctx2);
|
|
394362
395146
|
ctx2.restore();
|
|
394363
395147
|
ctx2.fillStyle = pattern;
|
|
394364
395148
|
}
|
|
394365
|
-
if (needsStroke &&
|
|
395149
|
+
if (needsStroke && current6.patternStroke) {
|
|
394366
395150
|
ctx2.save();
|
|
394367
|
-
const pattern =
|
|
395151
|
+
const pattern = current6.strokeColor.getPattern(ctx2, this, getCurrentTransformInverse(ctx2), PathType.STROKE, opIdx);
|
|
394368
395152
|
patternStrokeTransform = getCurrentTransform(ctx2);
|
|
394369
395153
|
ctx2.restore();
|
|
394370
395154
|
ctx2.strokeStyle = pattern;
|
|
@@ -394382,7 +395166,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394382
395166
|
const measure4 = ctx2.measureText(joinedChars);
|
|
394383
395167
|
this.dependencyTracker.recordBBox(opIdx, this.ctx, -measure4.actualBoundingBoxLeft, measure4.actualBoundingBoxRight, -measure4.actualBoundingBoxAscent, measure4.actualBoundingBoxDescent).recordShowTextOperation(opIdx);
|
|
394384
395168
|
}
|
|
394385
|
-
|
|
395169
|
+
current6.x += width * widthAdvanceScale * textHScale;
|
|
394386
395170
|
ctx2.restore();
|
|
394387
395171
|
this.compose();
|
|
394388
395172
|
this.#endKnockoutElement(started8);
|
|
@@ -394448,9 +395232,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394448
395232
|
}
|
|
394449
395233
|
}
|
|
394450
395234
|
if (vertical) {
|
|
394451
|
-
|
|
395235
|
+
current6.y -= x2;
|
|
394452
395236
|
} else {
|
|
394453
|
-
|
|
395237
|
+
current6.x += x2 * textHScale;
|
|
394454
395238
|
}
|
|
394455
395239
|
ctx2.restore();
|
|
394456
395240
|
this.compose();
|
|
@@ -394459,17 +395243,17 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394459
395243
|
}
|
|
394460
395244
|
showType3Text(opIdx, glyphs) {
|
|
394461
395245
|
const ctx2 = this.ctx;
|
|
394462
|
-
const
|
|
394463
|
-
const font =
|
|
394464
|
-
const fontSize =
|
|
394465
|
-
const fontDirection =
|
|
395246
|
+
const current6 = this.current;
|
|
395247
|
+
const font = current6.font;
|
|
395248
|
+
const fontSize = current6.fontSize;
|
|
395249
|
+
const fontDirection = current6.fontDirection;
|
|
394466
395250
|
const spacingDir = font.vertical ? 1 : -1;
|
|
394467
|
-
const charSpacing =
|
|
394468
|
-
const wordSpacing =
|
|
394469
|
-
const textHScale =
|
|
394470
|
-
const fontMatrix =
|
|
395251
|
+
const charSpacing = current6.charSpacing;
|
|
395252
|
+
const wordSpacing = current6.wordSpacing;
|
|
395253
|
+
const textHScale = current6.textHScale * fontDirection;
|
|
395254
|
+
const fontMatrix = current6.fontMatrix || FONT_IDENTITY_MATRIX;
|
|
394471
395255
|
const glyphsLength = glyphs.length;
|
|
394472
|
-
const isTextInvisible =
|
|
395256
|
+
const isTextInvisible = current6.textRenderingMode === TextRenderingMode.INVISIBLE;
|
|
394473
395257
|
let i2, glyph2, width, spacingLength;
|
|
394474
395258
|
if (isTextInvisible || fontSize === 0) {
|
|
394475
395259
|
return;
|
|
@@ -394477,10 +395261,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394477
395261
|
this._cachedScaleForStroking[0] = -1;
|
|
394478
395262
|
this._cachedGetSinglePixelWidth = null;
|
|
394479
395263
|
ctx2.save();
|
|
394480
|
-
if (
|
|
394481
|
-
ctx2.transform(...
|
|
395264
|
+
if (current6.textMatrix) {
|
|
395265
|
+
ctx2.transform(...current6.textMatrix);
|
|
394482
395266
|
}
|
|
394483
|
-
ctx2.translate(
|
|
395267
|
+
ctx2.translate(current6.x, current6.y + current6.textRise);
|
|
394484
395268
|
ctx2.scale(textHScale, fontDirection);
|
|
394485
395269
|
const dependencyTracker = this.dependencyTracker;
|
|
394486
395270
|
this.dependencyTracker = dependencyTracker ? new CanvasNestedDependencyTracker(dependencyTracker, opIdx) : null;
|
|
@@ -394489,7 +395273,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394489
395273
|
if (typeof glyph2 === "number") {
|
|
394490
395274
|
spacingLength = spacingDir * glyph2 * fontSize / 1e3;
|
|
394491
395275
|
this.ctx.translate(spacingLength, 0);
|
|
394492
|
-
|
|
395276
|
+
current6.x += spacingLength * textHScale;
|
|
394493
395277
|
continue;
|
|
394494
395278
|
}
|
|
394495
395279
|
const spacing = (glyph2.isSpace ? wordSpacing : 0) + charSpacing;
|
|
@@ -394499,7 +395283,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394499
395283
|
} else if (this.contentVisible) {
|
|
394500
395284
|
this.save();
|
|
394501
395285
|
if (operatorList.fnArray[0] === OPS2.setCharWidth) {
|
|
394502
|
-
|
|
395286
|
+
current6.fillAlpha = current6.strokeAlpha = 1;
|
|
394503
395287
|
ctx2.globalAlpha = 1;
|
|
394504
395288
|
}
|
|
394505
395289
|
ctx2.scale(fontSize, fontSize);
|
|
@@ -394511,7 +395295,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394511
395295
|
Util.applyTransform(p2, fontMatrix);
|
|
394512
395296
|
width = p2[0] * fontSize + spacing;
|
|
394513
395297
|
ctx2.translate(width, 0);
|
|
394514
|
-
|
|
395298
|
+
current6.x += width * textHScale;
|
|
394515
395299
|
}
|
|
394516
395300
|
ctx2.restore();
|
|
394517
395301
|
if (dependencyTracker) {
|
|
@@ -410637,8 +411421,8 @@ async function ensureBackgroundSession(pluginId, command) {
|
|
|
410637
411421
|
}
|
|
410638
411422
|
async function callPluginTool(plugin, tool2, args2, options) {
|
|
410639
411423
|
const id3 = plugin.manifest.id;
|
|
410640
|
-
const
|
|
410641
|
-
if (!
|
|
411424
|
+
const current6 = await getPlugin(id3);
|
|
411425
|
+
if (!current6?.enabled || current6.granted === null) throw new Error(`${plugin.manifest.name} is disabled or has not been allowed to run`);
|
|
410642
411426
|
const session3 = await ensureBackgroundSession(id3, "agent");
|
|
410643
411427
|
if (!session3?.env) throw new Error(`${plugin.manifest.name} could not start`);
|
|
410644
411428
|
const env = session3.env;
|
|
@@ -412896,6 +413680,7 @@ function placeDesign(doc2, built, source3, size6, name2, at5) {
|
|
|
412896
413680
|
var DESIGN_NAMESPACES, DERIVED2, templateOfBuild;
|
|
412897
413681
|
var init_build3 = __esm({
|
|
412898
413682
|
"lib/agent/design-script/build.ts"() {
|
|
413683
|
+
"use strict";
|
|
412899
413684
|
init_hash();
|
|
412900
413685
|
init_scene_graph();
|
|
412901
413686
|
init_libraries();
|
|
@@ -412925,6 +413710,7 @@ function designFrameOf(doc2, id3) {
|
|
|
412925
413710
|
}
|
|
412926
413711
|
var init_locate = __esm({
|
|
412927
413712
|
"lib/agent/design-script/locate.ts"() {
|
|
413713
|
+
"use strict";
|
|
412928
413714
|
}
|
|
412929
413715
|
});
|
|
412930
413716
|
|
|
@@ -413403,7 +414189,20 @@ function resilientModel(model, turn, parts) {
|
|
|
413403
414189
|
}
|
|
413404
414190
|
};
|
|
413405
414191
|
}
|
|
413406
|
-
|
|
414192
|
+
function lastUserText(messages) {
|
|
414193
|
+
const m = [...messages].reverse().find((x2) => x2.role === "user");
|
|
414194
|
+
return typeof m?.content === "string" ? m.content : m ? JSON.stringify(m.content) : "";
|
|
414195
|
+
}
|
|
414196
|
+
function withGuidance(messages, guidance) {
|
|
414197
|
+
const i2 = messages.findIndex((m) => m.role === "system");
|
|
414198
|
+
if (i2 < 0) return [{ role: "system", content: guidance }, ...messages];
|
|
414199
|
+
const sys = messages[i2];
|
|
414200
|
+
return messages.map((m, j) => j === i2 ? { ...sys, content: `${typeof sys.content === "string" ? sys.content : ""}
|
|
414201
|
+
|
|
414202
|
+
${guidance}` } : m);
|
|
414203
|
+
}
|
|
414204
|
+
async function drive(meta3, initial) {
|
|
414205
|
+
let start2 = initial;
|
|
413407
414206
|
const model = agentModel2();
|
|
413408
414207
|
if (!model) {
|
|
413409
414208
|
useAgentStore.setState({ error: { message: "Pick a chat model for the agent first.", code: "no_model" } });
|
|
@@ -413438,6 +414237,17 @@ async function drive(meta3, start2) {
|
|
|
413438
414237
|
const readOnly = !!editBlockReason();
|
|
413439
414238
|
registerTurnTools({ readOnly, signal: abort.signal });
|
|
413440
414239
|
const runtime = agentRuntime();
|
|
414240
|
+
const fresh = "messages" in start2 ? start2 : null;
|
|
414241
|
+
const resumed = !fresh;
|
|
414242
|
+
const pool = orchestrationSkills();
|
|
414243
|
+
const orch = await orchestrateTurn({
|
|
414244
|
+
callModel: agentModel(() => model),
|
|
414245
|
+
task: fresh ? lastUserText(fresh.messages) : "",
|
|
414246
|
+
mode: resumed && !meta3.orchestrationSkill ? "off" : void 0,
|
|
414247
|
+
skills: resumed ? pool.filter((s) => s.name === meta3.orchestrationSkill) : pool
|
|
414248
|
+
}).catch(() => null);
|
|
414249
|
+
meta3.orchestrationSkill = orch?.skill?.name ?? null;
|
|
414250
|
+
if (fresh && orch?.guidance) start2 = { ...fresh, messages: withGuidance(fresh.messages, orch.guidance) };
|
|
413441
414251
|
const tools = loopTools(meta3.skillId);
|
|
413442
414252
|
const canWrite2 = !readOnly && meta3.wantsChange;
|
|
413443
414253
|
const writeTool = tools.some((t3) => t3.spec.function.name === DESIGN_TOOL2) ? DESIGN_TOOL2 : null;
|
|
@@ -413480,7 +414290,9 @@ async function drive(meta3, start2) {
|
|
|
413480
414290
|
isRecoverable: (err2) => !abort.signal.aborted && isInterruption(err2),
|
|
413481
414291
|
requireAction: canWrite2 ? { nudges: ACTION_NUDGES, message: ACTION_NUDGE } : false,
|
|
413482
414292
|
toolChoice: () => guard2.toolChoice(),
|
|
413483
|
-
|
|
414293
|
+
advise: orch?.advise ?? void 0,
|
|
414294
|
+
route: orch?.route ?? void 0,
|
|
414295
|
+
callModel: resilientModel(orch?.skill ? orch.callModel : agentModel(() => model), abort.signal, { get: () => parts, set: (p2) => {
|
|
413484
414296
|
parts = p2;
|
|
413485
414297
|
flush();
|
|
413486
414298
|
} }),
|
|
@@ -413588,6 +414400,7 @@ async function drive(meta3, start2) {
|
|
|
413588
414400
|
parts = [...parts, { type: "error", message, code }];
|
|
413589
414401
|
}
|
|
413590
414402
|
} finally {
|
|
414403
|
+
endOrchestration(orch);
|
|
413591
414404
|
offPage();
|
|
413592
414405
|
preview.end();
|
|
413593
414406
|
if (abort.signal.aborted) {
|
|
@@ -413618,6 +414431,7 @@ var init_runner = __esm({
|
|
|
413618
414431
|
init_dangerous();
|
|
413619
414432
|
init_skill();
|
|
413620
414433
|
init_prompt();
|
|
414434
|
+
init_orchestration3();
|
|
413621
414435
|
init_skills();
|
|
413622
414436
|
init_parts();
|
|
413623
414437
|
init_store2();
|
|
@@ -416103,6 +416917,13 @@ Every layer call returns its id. **Name** every layer a cue, count or swap must
|
|
|
416103
416917
|
\u2014 live text. \`autoWidth: true\` hugs the words (labels, buttons); \`width: 'FILL'\` wraps in the column.
|
|
416104
416918
|
- \`k.rect(parent, w | 'FILL', h, fill, { radius, stroke, effects, opacity, absolute, name, mask })\`, \`k.ellipse(parent, size, fill, o)\`,
|
|
416105
416919
|
\`k.star(parent, size, fill, o)\`.
|
|
416920
|
+
- \`k.pixels(parent, frames, key, { cell, ms, name, absolute, palette })\` \u2014 pixel art as a real Pixel canvas the pixel
|
|
416921
|
+
tools edit: each frame is rows of characters, each a colour from \`key\` (\`{ R: '#d8453a', K: '#1b1020' }\`; \`.\` is
|
|
416922
|
+
transparent), every row the same width \u2014 any size (8\xD78, 16\xD716, 24\xD732, 48\xD748\u2026). Several frames are an animation playing
|
|
416923
|
+
\`ms\` a frame. \`cell\` is the on-canvas size of one pixel. \`palette\` limits the colours to a preset (\`'PICO-8'\`,
|
|
416924
|
+
\`'DB32'\`, \`'Endesga 32'\`, \`'Game Boy'\`) or a list of hexes; a key colour outside it throws with the nearest allowed
|
|
416925
|
+
one. Use it for every sprite, tile, icon or character asked for as pixel art \u2014 never rects or vectors. For a transparent
|
|
416926
|
+
background, clear the sheet's paper: \`k.patch(k.sheet, { fills: [] })\`.
|
|
416106
416927
|
- \`k.vector(parent, w, h, [paths], fill, { strokeWidth, stroke, absolute, name, effects })\` \u2014 paths are
|
|
416107
416928
|
\`{ closed, points: [{ x, y }] }\` in the vector's own w \xD7 h box. Helpers: \`draw.box\`, \`draw.line\`, \`draw.poly\`,
|
|
416108
416929
|
\`draw.circle\`, \`draw.smooth\`; \`marks.gridPaths\`, \`marks.dotPaths\`, \`marks.confettiPaths\`, \`marks.burstPath\`,
|
|
@@ -420371,11 +421192,11 @@ var init_editor_store = __esm({
|
|
|
420371
421192
|
return newNode;
|
|
420372
421193
|
};
|
|
420373
421194
|
const traverse = (currentId, sx, sy) => {
|
|
420374
|
-
const
|
|
420375
|
-
if (!
|
|
420376
|
-
newNodes[currentId] = scaleProps(
|
|
420377
|
-
if ("childIds" in
|
|
420378
|
-
for (const childId of
|
|
421195
|
+
const current6 = sourceNodes[currentId];
|
|
421196
|
+
if (!current6) return;
|
|
421197
|
+
newNodes[currentId] = scaleProps(current6, sx, sy);
|
|
421198
|
+
if ("childIds" in current6 && current6.childIds) {
|
|
421199
|
+
for (const childId of current6.childIds) {
|
|
420379
421200
|
traverse(childId, sx, sy);
|
|
420380
421201
|
}
|
|
420381
421202
|
}
|
|
@@ -420763,10 +421584,10 @@ var init_editor_store = __esm({
|
|
|
420763
421584
|
const state = get4();
|
|
420764
421585
|
const newExpanded = new Set(state.expandedLayerNodes);
|
|
420765
421586
|
ids2.forEach((id3) => {
|
|
420766
|
-
let
|
|
420767
|
-
for (let guard2 = 0;
|
|
420768
|
-
newExpanded.add(
|
|
420769
|
-
|
|
421587
|
+
let current6 = resolveVirtualNode2(state.document.nodes, id3);
|
|
421588
|
+
for (let guard2 = 0; current6?.parentId && guard2 < 64; guard2++) {
|
|
421589
|
+
newExpanded.add(current6.parentId);
|
|
421590
|
+
current6 = resolveVirtualNode2(state.document.nodes, current6.parentId);
|
|
420770
421591
|
}
|
|
420771
421592
|
});
|
|
420772
421593
|
const cellSel = state.tableCellSelection;
|
|
@@ -420778,10 +421599,10 @@ var init_editor_store = __esm({
|
|
|
420778
421599
|
addToSelection: (id3) => {
|
|
420779
421600
|
const state = get4();
|
|
420780
421601
|
const newExpanded = new Set(state.expandedLayerNodes);
|
|
420781
|
-
let
|
|
420782
|
-
while (
|
|
420783
|
-
newExpanded.add(
|
|
420784
|
-
|
|
421602
|
+
let current6 = state.document.nodes[id3];
|
|
421603
|
+
while (current6 && current6.parentId) {
|
|
421604
|
+
newExpanded.add(current6.parentId);
|
|
421605
|
+
current6 = state.document.nodes[current6.parentId];
|
|
420785
421606
|
}
|
|
420786
421607
|
set4({
|
|
420787
421608
|
selection: [...state.selection, id3],
|
|
@@ -421320,11 +422141,11 @@ var init_editor_store = __esm({
|
|
|
421320
422141
|
if (!pages2.length) return;
|
|
421321
422142
|
const cam = state.camera;
|
|
421322
422143
|
const selected = pages2.findIndex((pg) => state.selection.includes(pg.id));
|
|
421323
|
-
const
|
|
422144
|
+
const current6 = selected >= 0 ? selected : pages2.reduce((best, pg, i2) => {
|
|
421324
422145
|
const d = Math.hypot(pg.x + pg.width / 2 - cam.x, pg.y + pg.height / 2 - cam.y);
|
|
421325
422146
|
return d < best.d ? { i: i2, d } : best;
|
|
421326
422147
|
}, { i: 0, d: Infinity }).i;
|
|
421327
|
-
const target2 = typeof to === "number" ? to : to === "first" ? 0 : to === "last" ? pages2.length - 1 :
|
|
422148
|
+
const target2 = typeof to === "number" ? to : to === "first" ? 0 : to === "last" ? pages2.length - 1 : current6 + (to === "next" ? 1 : -1);
|
|
421328
422149
|
const page = pages2[Math.max(0, Math.min(pages2.length - 1, target2))];
|
|
421329
422150
|
set4({ selection: [page.id] });
|
|
421330
422151
|
get4().zoomToNodes([page.id], 0.1);
|
|
@@ -425752,7 +426573,7 @@ init_resources();
|
|
|
425752
426573
|
init_desktop();
|
|
425753
426574
|
init_hypery();
|
|
425754
426575
|
import { createInterface } from "node:readline";
|
|
425755
|
-
var VERSION2 = "0.
|
|
426576
|
+
var VERSION2 = "0.58.0";
|
|
425756
426577
|
var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
|
|
425757
426578
|
|
|
425758
426579
|
Files (headless, on .popcraft files):
|