@popcraft/cli 0.57.1 → 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 +1139 -342
- 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({
|
|
@@ -30835,8 +30835,8 @@ var require_base64_js = __commonJS({
|
|
|
30835
30835
|
}
|
|
30836
30836
|
return arr2;
|
|
30837
30837
|
}
|
|
30838
|
-
function tripletToBase64(
|
|
30839
|
-
return lookup[
|
|
30838
|
+
function tripletToBase64(num13) {
|
|
30839
|
+
return lookup[num13 >> 18 & 63] + lookup[num13 >> 12 & 63] + lookup[num13 >> 6 & 63] + lookup[num13 & 63];
|
|
30840
30840
|
}
|
|
30841
30841
|
function encodeChunk(uint82, start2, end) {
|
|
30842
30842
|
var tmp;
|
|
@@ -30944,16 +30944,16 @@ var require_tiny_inflate = __commonJS({
|
|
|
30944
30944
|
for (i2 = 0; i2 < 32; ++i2) dt.trans[i2] = i2;
|
|
30945
30945
|
}
|
|
30946
30946
|
var offs = new Uint16Array(16);
|
|
30947
|
-
function tinf_build_tree(t3, lengths3, off,
|
|
30947
|
+
function tinf_build_tree(t3, lengths3, off, num13) {
|
|
30948
30948
|
var i2, sum;
|
|
30949
30949
|
for (i2 = 0; i2 < 16; ++i2) t3.table[i2] = 0;
|
|
30950
|
-
for (i2 = 0; i2 <
|
|
30950
|
+
for (i2 = 0; i2 < num13; ++i2) t3.table[lengths3[off + i2]]++;
|
|
30951
30951
|
t3.table[0] = 0;
|
|
30952
30952
|
for (sum = 0, i2 = 0; i2 < 16; ++i2) {
|
|
30953
30953
|
offs[i2] = sum;
|
|
30954
30954
|
sum += t3.table[i2];
|
|
30955
30955
|
}
|
|
30956
|
-
for (i2 = 0; i2 <
|
|
30956
|
+
for (i2 = 0; i2 < num13; ++i2) {
|
|
30957
30957
|
if (lengths3[off + i2]) t3.trans[offs[lengths3[off + i2]]++] = i2;
|
|
30958
30958
|
}
|
|
30959
30959
|
}
|
|
@@ -30966,16 +30966,16 @@ var require_tiny_inflate = __commonJS({
|
|
|
30966
30966
|
d.tag >>>= 1;
|
|
30967
30967
|
return bit;
|
|
30968
30968
|
}
|
|
30969
|
-
function tinf_read_bits(d,
|
|
30970
|
-
if (!
|
|
30969
|
+
function tinf_read_bits(d, num13, base) {
|
|
30970
|
+
if (!num13)
|
|
30971
30971
|
return base;
|
|
30972
30972
|
while (d.bitcount < 24) {
|
|
30973
30973
|
d.tag |= d.source[d.sourceIndex++] << d.bitcount;
|
|
30974
30974
|
d.bitcount += 8;
|
|
30975
30975
|
}
|
|
30976
|
-
var val = d.tag & 65535 >>> 16 -
|
|
30977
|
-
d.tag >>>=
|
|
30978
|
-
d.bitcount -=
|
|
30976
|
+
var val = d.tag & 65535 >>> 16 - num13;
|
|
30977
|
+
d.tag >>>= num13;
|
|
30978
|
+
d.bitcount -= num13;
|
|
30979
30979
|
return val + base;
|
|
30980
30980
|
}
|
|
30981
30981
|
function tinf_decode_symbol(d, t3) {
|
|
@@ -30998,7 +30998,7 @@ var require_tiny_inflate = __commonJS({
|
|
|
30998
30998
|
}
|
|
30999
30999
|
function tinf_decode_trees(d, lt, dt) {
|
|
31000
31000
|
var hlit, hdist, hclen;
|
|
31001
|
-
var i2,
|
|
31001
|
+
var i2, num13, length2;
|
|
31002
31002
|
hlit = tinf_read_bits(d, 5, 257);
|
|
31003
31003
|
hdist = tinf_read_bits(d, 5, 1);
|
|
31004
31004
|
hclen = tinf_read_bits(d, 4, 4);
|
|
@@ -31008,27 +31008,27 @@ var require_tiny_inflate = __commonJS({
|
|
|
31008
31008
|
lengths2[clcidx[i2]] = clen2;
|
|
31009
31009
|
}
|
|
31010
31010
|
tinf_build_tree(code_tree, lengths2, 0, 19);
|
|
31011
|
-
for (
|
|
31011
|
+
for (num13 = 0; num13 < hlit + hdist; ) {
|
|
31012
31012
|
var sym = tinf_decode_symbol(d, code_tree);
|
|
31013
31013
|
switch (sym) {
|
|
31014
31014
|
case 16:
|
|
31015
|
-
var prev = lengths2[
|
|
31015
|
+
var prev = lengths2[num13 - 1];
|
|
31016
31016
|
for (length2 = tinf_read_bits(d, 2, 3); length2; --length2) {
|
|
31017
|
-
lengths2[
|
|
31017
|
+
lengths2[num13++] = prev;
|
|
31018
31018
|
}
|
|
31019
31019
|
break;
|
|
31020
31020
|
case 17:
|
|
31021
31021
|
for (length2 = tinf_read_bits(d, 3, 3); length2; --length2) {
|
|
31022
|
-
lengths2[
|
|
31022
|
+
lengths2[num13++] = 0;
|
|
31023
31023
|
}
|
|
31024
31024
|
break;
|
|
31025
31025
|
case 18:
|
|
31026
31026
|
for (length2 = tinf_read_bits(d, 7, 11); length2; --length2) {
|
|
31027
|
-
lengths2[
|
|
31027
|
+
lengths2[num13++] = 0;
|
|
31028
31028
|
}
|
|
31029
31029
|
break;
|
|
31030
31030
|
default:
|
|
31031
|
-
lengths2[
|
|
31031
|
+
lengths2[num13++] = sym;
|
|
31032
31032
|
break;
|
|
31033
31033
|
}
|
|
31034
31034
|
}
|
|
@@ -172956,7 +172956,6 @@ function releaseMediaMemory(hash3) {
|
|
|
172956
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;
|
|
172957
172957
|
var init_media_store = __esm({
|
|
172958
172958
|
"lib/storage/media-store.ts"() {
|
|
172959
|
-
"use strict";
|
|
172960
172959
|
init_media_types();
|
|
172961
172960
|
init_idb();
|
|
172962
172961
|
init_media_hash();
|
|
@@ -174557,8 +174556,8 @@ var require_decompress_binding = __commonJS({
|
|
|
174557
174556
|
function _abort() {
|
|
174558
174557
|
abort("");
|
|
174559
174558
|
}
|
|
174560
|
-
function _emscripten_memcpy_big(dest, src,
|
|
174561
|
-
HEAPU8.copyWithin(dest, src, src +
|
|
174559
|
+
function _emscripten_memcpy_big(dest, src, num13) {
|
|
174560
|
+
HEAPU8.copyWithin(dest, src, src + num13);
|
|
174562
174561
|
}
|
|
174563
174562
|
function emscripten_realloc_buffer(size6) {
|
|
174564
174563
|
try {
|
|
@@ -177967,13 +177966,13 @@ function compositionAt(comp, t3) {
|
|
|
177967
177966
|
else return EMPTY_MOMENT;
|
|
177968
177967
|
}
|
|
177969
177968
|
const clip = clips2[index2];
|
|
177970
|
-
const
|
|
177969
|
+
const current6 = { clip, index: index2, local: clipLocalTime(clip, t3) };
|
|
177971
177970
|
const tr = clip.transitionIn;
|
|
177972
177971
|
const prev = index2 > 0 ? clips2[index2 - 1] : void 0;
|
|
177973
|
-
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 };
|
|
177974
177973
|
const progress2 = evalInterp(tr.interp, (t3 - clip.start) / tr.duration, tr.duration);
|
|
177975
177974
|
return {
|
|
177976
|
-
current:
|
|
177975
|
+
current: current6,
|
|
177977
177976
|
previous: { clip: prev, index: index2 - 1, local: clipLocalTime(prev, t3) },
|
|
177978
177977
|
transition: { type: tr.type, progress: progress2, params: tr.params }
|
|
177979
177978
|
};
|
|
@@ -183386,6 +183385,13 @@ var init_en2 = __esm({
|
|
|
183386
183385
|
"agentPanel.manage": "Manage",
|
|
183387
183386
|
"agentPanel.messageCount": "{count, plural, one {# message} other {# messages}}",
|
|
183388
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",
|
|
183389
183395
|
"agentPanel.resuming": "Resuming\u2026",
|
|
183390
183396
|
"agentPanel.sendEnter": "Send (Enter)",
|
|
183391
183397
|
"agentPanel.skill": "Skill: {name}",
|
|
@@ -252579,7 +252585,6 @@ function hasMessage(key5) {
|
|
|
252579
252585
|
var current3, loading2, listeners2, formats, asts;
|
|
252580
252586
|
var init_runtime = __esm({
|
|
252581
252587
|
"lib/i18n/runtime.ts"() {
|
|
252582
|
-
"use strict";
|
|
252583
252588
|
init_intl_messageformat();
|
|
252584
252589
|
init_icu_messageformat_parser();
|
|
252585
252590
|
init_catalogs();
|
|
@@ -254379,7 +254384,6 @@ function repairDocumentPaints(doc2) {
|
|
|
254379
254384
|
var broken;
|
|
254380
254385
|
var init_paint_repair = __esm({
|
|
254381
254386
|
"lib/document/paint-repair.ts"() {
|
|
254382
|
-
"use strict";
|
|
254383
254387
|
init_shader_graph();
|
|
254384
254388
|
broken = (p2) => {
|
|
254385
254389
|
if (!p2 || typeof p2 !== "object") return false;
|
|
@@ -260662,6 +260666,7 @@ function repairFx(raw) {
|
|
|
260662
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;
|
|
260663
260667
|
var init_invariants = __esm({
|
|
260664
260668
|
"lib/motion/invariants.ts"() {
|
|
260669
|
+
"use strict";
|
|
260665
260670
|
init_adjustments();
|
|
260666
260671
|
init_captions();
|
|
260667
260672
|
init_lut();
|
|
@@ -260768,6 +260773,7 @@ function resyncText(doc2, ids2) {
|
|
|
260768
260773
|
var isVirtualId;
|
|
260769
260774
|
var init_invariants2 = __esm({
|
|
260770
260775
|
"lib/document/invariants.ts"() {
|
|
260776
|
+
"use strict";
|
|
260771
260777
|
init_auto_layout();
|
|
260772
260778
|
init_scene_graph();
|
|
260773
260779
|
init_text_bounds();
|
|
@@ -261799,6 +261805,7 @@ function beforeWrite() {
|
|
|
261799
261805
|
var leave;
|
|
261800
261806
|
var init_read_only = __esm({
|
|
261801
261807
|
"lib/editor/modes/read-only.ts"() {
|
|
261808
|
+
"use strict";
|
|
261802
261809
|
leave = null;
|
|
261803
261810
|
}
|
|
261804
261811
|
});
|
|
@@ -263470,6 +263477,7 @@ function resizeWindow(doc2, target2, rect) {
|
|
|
263470
263477
|
}
|
|
263471
263478
|
var init_crop = __esm({
|
|
263472
263479
|
"lib/editor/crop.ts"() {
|
|
263480
|
+
"use strict";
|
|
263473
263481
|
init_dist_node();
|
|
263474
263482
|
init_scene_graph();
|
|
263475
263483
|
init_photo_frames();
|
|
@@ -266500,6 +266508,7 @@ fn shade(uv: vec2<f32>, res: vec2<f32>, tm: f32) -> vec4<f32> {
|
|
|
266500
266508
|
var SHADER_PRESETS, shaderPreset, legacyPresetOf, DEFAULT_SHADER_PRESET, DEFAULT_TEXTURE_PARAMS, f, vec4, NOISE_LIB;
|
|
266501
266509
|
var init_shader_presets = __esm({
|
|
266502
266510
|
"lib/engine/shader-presets.ts"() {
|
|
266511
|
+
"use strict";
|
|
266503
266512
|
init_shader_graph();
|
|
266504
266513
|
init_shader_graph_presets();
|
|
266505
266514
|
init_shader_presets_legacy();
|
|
@@ -267050,7 +267059,6 @@ function mergeFonts(fonts, incoming) {
|
|
|
267050
267059
|
var fontWeightOf, fontStyleOf, sameSlot, hashOf, documentFontHashes;
|
|
267051
267060
|
var init_document_fonts = __esm({
|
|
267052
267061
|
"lib/fonts/document-fonts.ts"() {
|
|
267053
|
-
"use strict";
|
|
267054
267062
|
init_media_store();
|
|
267055
267063
|
init_media_hash();
|
|
267056
267064
|
fontWeightOf = (f2) => f2.weight ?? 400;
|
|
@@ -267463,6 +267471,7 @@ function followPeers(peers) {
|
|
|
267463
267471
|
var PALETTE, usePresence, awareness, CURSOR_SEND_MS, VIEWPORT_SEND_MS, cursorTimer, pendingCursor, sentCursor, EMOTE_MS, lastFollowCamera;
|
|
267464
267472
|
var init_presence = __esm({
|
|
267465
267473
|
"lib/collab/presence.ts"() {
|
|
267474
|
+
"use strict";
|
|
267466
267475
|
init_esm();
|
|
267467
267476
|
init_editor_store();
|
|
267468
267477
|
init_status_announcements();
|
|
@@ -272318,8 +272327,8 @@ function scopeOf(doc2, key5, record2) {
|
|
|
272318
272327
|
const c2 = r && doc2.collections?.[r.collectionId];
|
|
272319
272328
|
return withKey(r && c2 ? itemScope(c2, r, vars) : vars, key5);
|
|
272320
272329
|
}
|
|
272321
|
-
function setVariableValue(action3, variable,
|
|
272322
|
-
if (action3.variableToggle) return !
|
|
272330
|
+
function setVariableValue(action3, variable, current6, doc2, key5, record2) {
|
|
272331
|
+
if (action3.variableToggle) return !current6;
|
|
272323
272332
|
if (action3.variableExpression !== void 0 && action3.variableExpression.trim()) {
|
|
272324
272333
|
const v = tryEvaluate(action3.variableExpression, scopeOf(doc2, key5, record2));
|
|
272325
272334
|
return v === void 0 ? void 0 : coerceToVariable(variable.type, v);
|
|
@@ -272366,7 +272375,7 @@ function scrollerOf(nodes, id3) {
|
|
|
272366
272375
|
for (let cur = nodes[id3]?.parentId; cur; cur = nodes[cur]?.parentId) if (scrolls(nodes[cur])) return cur;
|
|
272367
272376
|
return null;
|
|
272368
272377
|
}
|
|
272369
|
-
function placed(doc2, frameId,
|
|
272378
|
+
function placed(doc2, frameId, current6, x2, y) {
|
|
272370
272379
|
const node2 = doc2.nodes[frameId];
|
|
272371
272380
|
if (!scrolls(node2)) return null;
|
|
272372
272381
|
const bounds2 = getNodeBounds(doc2, frameId);
|
|
@@ -272374,8 +272383,8 @@ function placed(doc2, frameId, current5, x2, y) {
|
|
|
272374
272383
|
const maxX = Math.max(0, bounds2.width - node2.width);
|
|
272375
272384
|
const maxY = Math.max(0, bounds2.height - node2.height);
|
|
272376
272385
|
return {
|
|
272377
|
-
x: node2.overflowScrolling === "HORIZONTAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxX, x2)) :
|
|
272378
|
-
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
|
|
272379
272388
|
};
|
|
272380
272389
|
}
|
|
272381
272390
|
function scrollBy(state, frameId, dx, dy) {
|
|
@@ -273316,8 +273325,7 @@ function isAppPage(href, origin) {
|
|
|
273316
273325
|
function chromeIntent(href) {
|
|
273317
273326
|
const url4 = new URL(href);
|
|
273318
273327
|
if (url4.protocol !== "https:" && url4.protocol !== "http:") return null;
|
|
273319
|
-
|
|
273320
|
-
return `intent://${url4.host}${url4.pathname}${url4.search}#Intent;scheme=${scheme};package=com.android.chrome;S.browser_fallback_url=${encodeURIComponent(url4.href)};end`;
|
|
273328
|
+
return `intent://open?url=${encodeURIComponent(url4.href)}#Intent;scheme=popcraft;package=app.popcraft;S.browser_fallback_url=${encodeURIComponent(url4.href)};end`;
|
|
273321
273329
|
}
|
|
273322
273330
|
function openOutside(href) {
|
|
273323
273331
|
const url4 = new URL(href, window.location.href);
|
|
@@ -274094,7 +274102,7 @@ var init_number = __esm({
|
|
|
274094
274102
|
MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
274095
274103
|
MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER;
|
|
274096
274104
|
LOWEST_INT32 = 1 << 31;
|
|
274097
|
-
isInteger = Number.isInteger || ((
|
|
274105
|
+
isInteger = Number.isInteger || ((num13) => typeof num13 === "number" && isFinite(num13) && floor(num13) === num13);
|
|
274098
274106
|
isNaN3 = Number.isNaN;
|
|
274099
274107
|
parseInt2 = Number.parseInt;
|
|
274100
274108
|
}
|
|
@@ -274176,33 +274184,33 @@ var init_encoding = __esm({
|
|
|
274176
274184
|
encoder.cpos = 0;
|
|
274177
274185
|
}
|
|
274178
274186
|
};
|
|
274179
|
-
write = (encoder,
|
|
274187
|
+
write = (encoder, num13) => {
|
|
274180
274188
|
const bufferLen = encoder.cbuf.length;
|
|
274181
274189
|
if (encoder.cpos === bufferLen) {
|
|
274182
274190
|
encoder.bufs.push(encoder.cbuf);
|
|
274183
274191
|
encoder.cbuf = new Uint8Array(bufferLen * 2);
|
|
274184
274192
|
encoder.cpos = 0;
|
|
274185
274193
|
}
|
|
274186
|
-
encoder.cbuf[encoder.cpos++] =
|
|
274194
|
+
encoder.cbuf[encoder.cpos++] = num13;
|
|
274187
274195
|
};
|
|
274188
274196
|
writeUint8 = write;
|
|
274189
|
-
writeVarUint = (encoder,
|
|
274190
|
-
while (
|
|
274191
|
-
write(encoder, BIT8 | BITS7 &
|
|
274192
|
-
|
|
274197
|
+
writeVarUint = (encoder, num13) => {
|
|
274198
|
+
while (num13 > BITS7) {
|
|
274199
|
+
write(encoder, BIT8 | BITS7 & num13);
|
|
274200
|
+
num13 = floor(num13 / 128);
|
|
274193
274201
|
}
|
|
274194
|
-
write(encoder, BITS7 &
|
|
274202
|
+
write(encoder, BITS7 & num13);
|
|
274195
274203
|
};
|
|
274196
|
-
writeVarInt = (encoder,
|
|
274197
|
-
const isNegative = isNegativeZero(
|
|
274204
|
+
writeVarInt = (encoder, num13) => {
|
|
274205
|
+
const isNegative = isNegativeZero(num13);
|
|
274198
274206
|
if (isNegative) {
|
|
274199
|
-
|
|
274207
|
+
num13 = -num13;
|
|
274200
274208
|
}
|
|
274201
|
-
write(encoder, (
|
|
274202
|
-
|
|
274203
|
-
while (
|
|
274204
|
-
write(encoder, (
|
|
274205
|
-
|
|
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);
|
|
274206
274214
|
}
|
|
274207
274215
|
};
|
|
274208
274216
|
_strBuffer = new Uint8Array(3e4);
|
|
@@ -274256,16 +274264,16 @@ var init_encoding = __esm({
|
|
|
274256
274264
|
encoder.cpos += len3;
|
|
274257
274265
|
return dview;
|
|
274258
274266
|
};
|
|
274259
|
-
writeFloat32 = (encoder,
|
|
274260
|
-
writeFloat64 = (encoder,
|
|
274261
|
-
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) => (
|
|
274262
274270
|
/** @type {any} */
|
|
274263
|
-
writeOnDataView(encoder, 8).setBigInt64(0,
|
|
274271
|
+
writeOnDataView(encoder, 8).setBigInt64(0, num13, false)
|
|
274264
274272
|
);
|
|
274265
274273
|
floatTestBed = new DataView(new ArrayBuffer(4));
|
|
274266
|
-
isFloat32 = (
|
|
274267
|
-
floatTestBed.setFloat32(0,
|
|
274268
|
-
return floatTestBed.getFloat32(0) ===
|
|
274274
|
+
isFloat32 = (num13) => {
|
|
274275
|
+
floatTestBed.setFloat32(0, num13);
|
|
274276
|
+
return floatTestBed.getFloat32(0) === num13;
|
|
274269
274277
|
};
|
|
274270
274278
|
writeAny = (encoder, data) => {
|
|
274271
274279
|
switch (typeof data) {
|
|
@@ -274506,17 +274514,17 @@ var init_decoding = __esm({
|
|
|
274506
274514
|
readVarUint8Array = (decoder) => readUint8Array(decoder, readVarUint(decoder));
|
|
274507
274515
|
readUint8 = (decoder) => decoder.arr[decoder.pos++];
|
|
274508
274516
|
readVarUint = (decoder) => {
|
|
274509
|
-
let
|
|
274517
|
+
let num13 = 0;
|
|
274510
274518
|
let mult = 1;
|
|
274511
274519
|
const len3 = decoder.arr.length;
|
|
274512
274520
|
while (decoder.pos < len3) {
|
|
274513
274521
|
const r = decoder.arr[decoder.pos++];
|
|
274514
|
-
|
|
274522
|
+
num13 = num13 + (r & BITS7) * mult;
|
|
274515
274523
|
mult *= 128;
|
|
274516
274524
|
if (r < BIT8) {
|
|
274517
|
-
return
|
|
274525
|
+
return num13;
|
|
274518
274526
|
}
|
|
274519
|
-
if (
|
|
274527
|
+
if (num13 > MAX_SAFE_INTEGER) {
|
|
274520
274528
|
throw errorIntegerOutOfRange;
|
|
274521
274529
|
}
|
|
274522
274530
|
}
|
|
@@ -274524,21 +274532,21 @@ var init_decoding = __esm({
|
|
|
274524
274532
|
};
|
|
274525
274533
|
readVarInt = (decoder) => {
|
|
274526
274534
|
let r = decoder.arr[decoder.pos++];
|
|
274527
|
-
let
|
|
274535
|
+
let num13 = r & BITS6;
|
|
274528
274536
|
let mult = 64;
|
|
274529
274537
|
const sign = (r & BIT7) > 0 ? -1 : 1;
|
|
274530
274538
|
if ((r & BIT8) === 0) {
|
|
274531
|
-
return sign *
|
|
274539
|
+
return sign * num13;
|
|
274532
274540
|
}
|
|
274533
274541
|
const len3 = decoder.arr.length;
|
|
274534
274542
|
while (decoder.pos < len3) {
|
|
274535
274543
|
r = decoder.arr[decoder.pos++];
|
|
274536
|
-
|
|
274544
|
+
num13 = num13 + (r & BITS7) * mult;
|
|
274537
274545
|
mult *= 128;
|
|
274538
274546
|
if (r < BIT8) {
|
|
274539
|
-
return sign *
|
|
274547
|
+
return sign * num13;
|
|
274540
274548
|
}
|
|
274541
|
-
if (
|
|
274549
|
+
if (num13 > MAX_SAFE_INTEGER) {
|
|
274542
274550
|
throw errorIntegerOutOfRange;
|
|
274543
274551
|
}
|
|
274544
274552
|
}
|
|
@@ -282287,11 +282295,11 @@ function repairTree(nodes, pages2) {
|
|
|
282287
282295
|
});
|
|
282288
282296
|
if (keep.length !== kids.length) put3({ ...node2, childIds: keep });
|
|
282289
282297
|
}
|
|
282290
|
-
const
|
|
282291
|
-
for (const id3 in
|
|
282292
|
-
const node2 =
|
|
282298
|
+
const current6 = out ?? nodes;
|
|
282299
|
+
for (const id3 in current6) {
|
|
282300
|
+
const node2 = current6[id3];
|
|
282293
282301
|
if (pages2.includes(id3)) continue;
|
|
282294
|
-
const parents = (listedBy.get(id3) ?? []).filter((p2) => (
|
|
282302
|
+
const parents = (listedBy.get(id3) ?? []).filter((p2) => (current6[p2].childIds ?? []).includes(id3));
|
|
282295
282303
|
const parent = parents[0] ?? null;
|
|
282296
282304
|
if (parent && node2.parentId !== parent) put3({ ...node2, parentId: parent });
|
|
282297
282305
|
}
|
|
@@ -282337,7 +282345,7 @@ function finishDocument(ydoc, base, nodes) {
|
|
|
282337
282345
|
}
|
|
282338
282346
|
return doc2;
|
|
282339
282347
|
}
|
|
282340
|
-
function applyYEventsToDocument(ydoc,
|
|
282348
|
+
function applyYEventsToDocument(ydoc, current6, events) {
|
|
282341
282349
|
const ynodes = yNodes(ydoc);
|
|
282342
282350
|
const touched = /* @__PURE__ */ new Set();
|
|
282343
282351
|
let structure = false;
|
|
@@ -282355,9 +282363,9 @@ function applyYEventsToDocument(ydoc, current5, events) {
|
|
|
282355
282363
|
structure = true;
|
|
282356
282364
|
}
|
|
282357
282365
|
}
|
|
282358
|
-
let nodes =
|
|
282366
|
+
let nodes = current6.nodes;
|
|
282359
282367
|
if (touched.size) {
|
|
282360
|
-
nodes = { ...
|
|
282368
|
+
nodes = { ...current6.nodes };
|
|
282361
282369
|
for (const id3 of touched) {
|
|
282362
282370
|
if (!isSafeKey(id3)) continue;
|
|
282363
282371
|
const ynode = ynodes.get(id3);
|
|
@@ -282365,9 +282373,9 @@ function applyYEventsToDocument(ydoc, current5, events) {
|
|
|
282365
282373
|
else delete nodes[id3];
|
|
282366
282374
|
}
|
|
282367
282375
|
}
|
|
282368
|
-
if (!touched.size && !structure) return
|
|
282369
|
-
if (!structure && !tree) return { ...
|
|
282370
|
-
return finishDocument(ydoc,
|
|
282376
|
+
if (!touched.size && !structure) return current6;
|
|
282377
|
+
if (!structure && !tree) return { ...current6, nodes };
|
|
282378
|
+
return finishDocument(ydoc, current6, nodes);
|
|
282371
282379
|
}
|
|
282372
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;
|
|
282373
282381
|
var init_ydoc = __esm({
|
|
@@ -283533,12 +283541,12 @@ function startCollabSession(docId, opts) {
|
|
|
283533
283541
|
if (!bound || tr.origin === LOCAL_ORIGIN || !isActive()) return;
|
|
283534
283542
|
if (useEditorStore.getState().isVersionHistoryMode) return;
|
|
283535
283543
|
if (sendTimer) flush();
|
|
283536
|
-
const
|
|
283537
|
-
const sharedCurrent = withoutPrivate(
|
|
283544
|
+
const current6 = useEditorStore.getState().document;
|
|
283545
|
+
const sharedCurrent = withoutPrivate(current6);
|
|
283538
283546
|
const shared = applyYEventsToDocument(ydoc, sharedCurrent, events);
|
|
283539
283547
|
if (shared === sharedCurrent) return;
|
|
283540
|
-
const next2 = repairDocumentPaints(migrateDocumentMotion(restorePrivate(shared,
|
|
283541
|
-
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));
|
|
283542
283550
|
if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent("popcraft-media-retry"));
|
|
283543
283551
|
applyingRemote = true;
|
|
283544
283552
|
synced = shared;
|
|
@@ -283676,9 +283684,9 @@ function withDeadline(p2, ms3) {
|
|
|
283676
283684
|
return Promise.race([p2, deadline]).finally(() => clearTimeout(timer));
|
|
283677
283685
|
}
|
|
283678
283686
|
async function trackOpen(run4, opts = {}) {
|
|
283679
|
-
const
|
|
283680
|
-
if (
|
|
283681
|
-
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 }) };
|
|
283682
283690
|
return run4(joined);
|
|
283683
283691
|
}
|
|
283684
283692
|
const id3 = nextId++;
|
|
@@ -291794,15 +291802,15 @@ var init_isobmff_demuxer = __esm({
|
|
|
291794
291802
|
break;
|
|
291795
291803
|
}
|
|
291796
291804
|
assert2(track3.info?.type === "video");
|
|
291797
|
-
const
|
|
291805
|
+
const num13 = readU32Be(slice2);
|
|
291798
291806
|
const den = readU32Be(slice2);
|
|
291799
|
-
if (
|
|
291807
|
+
if (num13 > 0 && den > 0) {
|
|
291800
291808
|
track3.info.squarePixelWidth = track3.info.width;
|
|
291801
291809
|
track3.info.squarePixelHeight = track3.info.height;
|
|
291802
|
-
if (
|
|
291803
|
-
track3.info.squarePixelWidth = Math.round(track3.info.width *
|
|
291810
|
+
if (num13 > den) {
|
|
291811
|
+
track3.info.squarePixelWidth = Math.round(track3.info.width * num13 / den);
|
|
291804
291812
|
} else {
|
|
291805
|
-
track3.info.squarePixelHeight = Math.round(track3.info.height * den /
|
|
291813
|
+
track3.info.squarePixelHeight = Math.round(track3.info.height * den / num13);
|
|
291806
291814
|
}
|
|
291807
291815
|
}
|
|
291808
291816
|
}
|
|
@@ -293620,16 +293628,16 @@ var init_isobmff_demuxer = __esm({
|
|
|
293620
293628
|
if (info2.type !== "video") {
|
|
293621
293629
|
return;
|
|
293622
293630
|
}
|
|
293623
|
-
const { num:
|
|
293624
|
-
if (!(
|
|
293631
|
+
const { num: num13, den } = pixelAspectRatio;
|
|
293632
|
+
if (!(num13 > 0 && den > 0) || num13 === den) {
|
|
293625
293633
|
return;
|
|
293626
293634
|
}
|
|
293627
|
-
if (
|
|
293628
|
-
info2.squarePixelWidth = Math.round(info2.width *
|
|
293635
|
+
if (num13 > den) {
|
|
293636
|
+
info2.squarePixelWidth = Math.round(info2.width * num13 / den);
|
|
293629
293637
|
info2.squarePixelHeight = info2.height;
|
|
293630
293638
|
} else {
|
|
293631
293639
|
info2.squarePixelWidth = info2.width;
|
|
293632
|
-
info2.squarePixelHeight = Math.round(info2.height * den /
|
|
293640
|
+
info2.squarePixelHeight = Math.round(info2.height * den / num13);
|
|
293633
293641
|
}
|
|
293634
293642
|
};
|
|
293635
293643
|
sampleTableIsEmpty = (sampleTable) => {
|
|
@@ -295145,13 +295153,13 @@ var init_matroska_demuxer = __esm({
|
|
|
295145
295153
|
this.currentTrack.info.squarePixelWidth = this.currentTrack.info.width;
|
|
295146
295154
|
this.currentTrack.info.squarePixelHeight = this.currentTrack.info.height;
|
|
295147
295155
|
if (this.currentTrack.info.displayWidth !== null && this.currentTrack.info.displayHeight !== null) {
|
|
295148
|
-
const
|
|
295156
|
+
const num13 = this.currentTrack.info.displayWidth * this.currentTrack.info.height;
|
|
295149
295157
|
const den = this.currentTrack.info.displayHeight * this.currentTrack.info.width;
|
|
295150
|
-
if (
|
|
295151
|
-
if (
|
|
295152
|
-
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);
|
|
295153
295161
|
} else {
|
|
295154
|
-
this.currentTrack.info.squarePixelHeight = Math.round(this.currentTrack.info.height * den /
|
|
295162
|
+
this.currentTrack.info.squarePixelHeight = Math.round(this.currentTrack.info.height * den / num13);
|
|
295155
295163
|
}
|
|
295156
295164
|
}
|
|
295157
295165
|
}
|
|
@@ -299052,7 +299060,7 @@ var init_flac_demuxer = __esm({
|
|
|
299052
299060
|
if (reservedZero !== 0) {
|
|
299053
299061
|
return null;
|
|
299054
299062
|
}
|
|
299055
|
-
const
|
|
299063
|
+
const num13 = readCodedNumber(slice2);
|
|
299056
299064
|
const blockSize = readBlockSize(slice2, blockSizeOrUncommon);
|
|
299057
299065
|
const sampleRate = readSampleRate(slice2, sampleRateOrUncommon);
|
|
299058
299066
|
if (sampleRate === null) {
|
|
@@ -299069,7 +299077,7 @@ var init_flac_demuxer = __esm({
|
|
|
299069
299077
|
if (crc2 !== crcCalculated) {
|
|
299070
299078
|
return null;
|
|
299071
299079
|
}
|
|
299072
|
-
return { num:
|
|
299080
|
+
return { num: num13, blockSize, sampleRate };
|
|
299073
299081
|
}
|
|
299074
299082
|
async advanceReader() {
|
|
299075
299083
|
await this.readMetadata();
|
|
@@ -299602,15 +299610,15 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
299602
299610
|
const spsInfo = parseAvcSps(spsUnit);
|
|
299603
299611
|
elementaryStream.info.width = spsInfo.displayWidth;
|
|
299604
299612
|
elementaryStream.info.height = spsInfo.displayHeight;
|
|
299605
|
-
const
|
|
299613
|
+
const num13 = spsInfo.pixelAspectRatio.num;
|
|
299606
299614
|
const den = spsInfo.pixelAspectRatio.den;
|
|
299607
299615
|
elementaryStream.info.squarePixelWidth = elementaryStream.info.width;
|
|
299608
299616
|
elementaryStream.info.squarePixelHeight = elementaryStream.info.height;
|
|
299609
|
-
if (
|
|
299610
|
-
if (
|
|
299611
|
-
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);
|
|
299612
299620
|
} else {
|
|
299613
|
-
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den /
|
|
299621
|
+
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den / num13);
|
|
299614
299622
|
}
|
|
299615
299623
|
}
|
|
299616
299624
|
elementaryStream.info.colorSpace = {
|
|
@@ -299635,15 +299643,15 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
299635
299643
|
const spsInfo = parseHevcSps(spsUnit);
|
|
299636
299644
|
elementaryStream.info.width = spsInfo.displayWidth;
|
|
299637
299645
|
elementaryStream.info.height = spsInfo.displayHeight;
|
|
299638
|
-
const
|
|
299646
|
+
const num13 = spsInfo.pixelAspectRatio.num;
|
|
299639
299647
|
const den = spsInfo.pixelAspectRatio.den;
|
|
299640
299648
|
elementaryStream.info.squarePixelWidth = elementaryStream.info.width;
|
|
299641
299649
|
elementaryStream.info.squarePixelHeight = elementaryStream.info.height;
|
|
299642
|
-
if (
|
|
299643
|
-
if (
|
|
299644
|
-
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);
|
|
299645
299653
|
} else {
|
|
299646
|
-
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den /
|
|
299654
|
+
elementaryStream.info.squarePixelHeight = Math.round(elementaryStream.info.height * den / num13);
|
|
299647
299655
|
}
|
|
299648
299656
|
}
|
|
299649
299657
|
elementaryStream.info.colorSpace = {
|
|
@@ -301044,10 +301052,10 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
301044
301052
|
return true;
|
|
301045
301053
|
}
|
|
301046
301054
|
async ensureCurrentPacketHasNext() {
|
|
301047
|
-
const
|
|
301048
|
-
assert2(
|
|
301055
|
+
const current6 = this.decodeOrderPackets[0];
|
|
301056
|
+
assert2(current6);
|
|
301049
301057
|
while (true) {
|
|
301050
|
-
const presentationIndex = this.presentationOrderPackets.indexOf(
|
|
301058
|
+
const presentationIndex = this.presentationOrderPackets.indexOf(current6);
|
|
301051
301059
|
if (presentationIndex !== -1 && presentationIndex <= this.presentationOrderPackets.length - 2) {
|
|
301052
301060
|
break;
|
|
301053
301061
|
}
|
|
@@ -301156,8 +301164,8 @@ var init_hls_misc = __esm({
|
|
|
301156
301164
|
if (value3 === null) {
|
|
301157
301165
|
return null;
|
|
301158
301166
|
}
|
|
301159
|
-
const
|
|
301160
|
-
return Number.isFinite(
|
|
301167
|
+
const num13 = Number(value3);
|
|
301168
|
+
return Number.isFinite(num13) ? num13 : null;
|
|
301161
301169
|
}
|
|
301162
301170
|
merge(other) {
|
|
301163
301171
|
Object.assign(this._attributes, other._attributes);
|
|
@@ -308537,9 +308545,9 @@ var init_input_track = __esm({
|
|
|
308537
308545
|
};
|
|
308538
308546
|
simplestFractionBetween = (lo, hi, maxDenominator) => {
|
|
308539
308547
|
for (let den = 1; den <= maxDenominator; den++) {
|
|
308540
|
-
const
|
|
308541
|
-
if (
|
|
308542
|
-
return simplifyRational({ num:
|
|
308548
|
+
const num13 = Math.floor(lo * den) + 1;
|
|
308549
|
+
if (num13 / den < hi) {
|
|
308550
|
+
return simplifyRational({ num: num13, den });
|
|
308543
308551
|
}
|
|
308544
308552
|
}
|
|
308545
308553
|
return null;
|
|
@@ -320492,9 +320500,9 @@ function arcToCubics(p0, rx, ry, phiDeg, large, sweep, p2) {
|
|
|
320492
320500
|
rx *= Math.sqrt(lambda);
|
|
320493
320501
|
ry *= Math.sqrt(lambda);
|
|
320494
320502
|
}
|
|
320495
|
-
const
|
|
320503
|
+
const num13 = rx * rx * ry * ry - rx * rx * y1 * y1 - ry * ry * x1 * x1;
|
|
320496
320504
|
const den = rx * rx * y1 * y1 + ry * ry * x1 * x1;
|
|
320497
|
-
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));
|
|
320498
320506
|
const cx1 = k2 * rx * y1 / ry, cy1 = -k2 * ry * x1 / rx;
|
|
320499
320507
|
const cx = cos * cx1 - sin * cy1 + (p0.x + p2.x) / 2, cy = sin * cx1 + cos * cy1 + (p0.y + p2.y) / 2;
|
|
320500
320508
|
const ang = (ux, uy, vx, vy) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);
|
|
@@ -320522,7 +320530,7 @@ function parsePathData(d) {
|
|
|
320522
320530
|
let lastC2 = null, lastQ = null;
|
|
320523
320531
|
let cmd = "", i2 = 0;
|
|
320524
320532
|
const isCmd = (t3) => /^[a-zA-Z]$/.test(t3);
|
|
320525
|
-
const
|
|
320533
|
+
const num13 = () => Number(tokens[i2++]);
|
|
320526
320534
|
const hasNum = () => i2 < tokens.length && !isCmd(tokens[i2]);
|
|
320527
320535
|
const flag = () => {
|
|
320528
320536
|
const t3 = tokens[i2] ?? "0";
|
|
@@ -320564,7 +320572,7 @@ function parsePathData(d) {
|
|
|
320564
320572
|
switch (cmd.toUpperCase()) {
|
|
320565
320573
|
case "M": {
|
|
320566
320574
|
if (!hasNum()) break;
|
|
320567
|
-
const p2 = { x: ox +
|
|
320575
|
+
const p2 = { x: ox + num13(), y: oy + num13() };
|
|
320568
320576
|
cur = p2;
|
|
320569
320577
|
start2 = p2;
|
|
320570
320578
|
sub2 = { start: { ...p2 }, segs: [], closed: false };
|
|
@@ -320576,34 +320584,34 @@ function parsePathData(d) {
|
|
|
320576
320584
|
}
|
|
320577
320585
|
case "L":
|
|
320578
320586
|
if (!hasNum()) break;
|
|
320579
|
-
line({ x: ox +
|
|
320587
|
+
line({ x: ox + num13(), y: oy + num13() });
|
|
320580
320588
|
break;
|
|
320581
320589
|
case "H":
|
|
320582
320590
|
if (!hasNum()) break;
|
|
320583
|
-
line({ x: ox +
|
|
320591
|
+
line({ x: ox + num13(), y: cur.y });
|
|
320584
320592
|
break;
|
|
320585
320593
|
case "V":
|
|
320586
320594
|
if (!hasNum()) break;
|
|
320587
|
-
line({ x: cur.x, y: oy +
|
|
320595
|
+
line({ x: cur.x, y: oy + num13() });
|
|
320588
320596
|
break;
|
|
320589
320597
|
case "C": {
|
|
320590
320598
|
if (!hasNum()) break;
|
|
320591
|
-
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() };
|
|
320592
320600
|
cubic(c1, c2, p2);
|
|
320593
320601
|
break;
|
|
320594
320602
|
}
|
|
320595
320603
|
case "S": {
|
|
320596
320604
|
if (!hasNum()) break;
|
|
320597
320605
|
const c1 = lastC2 ? { x: 2 * cur.x - lastC2.x, y: 2 * cur.y - lastC2.y } : { ...cur };
|
|
320598
|
-
const c2 = { x: ox +
|
|
320606
|
+
const c2 = { x: ox + num13(), y: oy + num13() }, p2 = { x: ox + num13(), y: oy + num13() };
|
|
320599
320607
|
cubic(c1, c2, p2);
|
|
320600
320608
|
break;
|
|
320601
320609
|
}
|
|
320602
320610
|
case "Q":
|
|
320603
320611
|
case "T": {
|
|
320604
320612
|
if (!hasNum()) break;
|
|
320605
|
-
const q = cmd.toUpperCase() === "Q" ? { x: ox +
|
|
320606
|
-
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() };
|
|
320607
320615
|
const p0 = cur;
|
|
320608
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);
|
|
320609
320617
|
lastQ = q;
|
|
@@ -320611,8 +320619,8 @@ function parsePathData(d) {
|
|
|
320611
320619
|
}
|
|
320612
320620
|
case "A": {
|
|
320613
320621
|
if (!hasNum()) break;
|
|
320614
|
-
const rx =
|
|
320615
|
-
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() };
|
|
320616
320624
|
const parts = arcToCubics(cur, rx, ry, rot, large, sweep, p2);
|
|
320617
320625
|
for (const s of parts) cubic(s.c1, s.c2, s.p);
|
|
320618
320626
|
lastC2 = null;
|
|
@@ -320698,11 +320706,11 @@ function pathBounds(paths) {
|
|
|
320698
320706
|
}
|
|
320699
320707
|
return minX === Infinity ? null : { minX, minY, maxX, maxY };
|
|
320700
320708
|
}
|
|
320701
|
-
function parseColor2(input2,
|
|
320709
|
+
function parseColor2(input2, current6) {
|
|
320702
320710
|
if (!input2) return null;
|
|
320703
320711
|
const s = input2.trim().toLowerCase();
|
|
320704
320712
|
if (!s || s === "none" || s === "transparent") return null;
|
|
320705
|
-
if (s === "currentcolor") return
|
|
320713
|
+
if (s === "currentcolor") return current6 ?? { r: 0, g: 0, b: 0, a: 1 };
|
|
320706
320714
|
const hex10 = s.startsWith("#") ? s.slice(1) : NAMED[s];
|
|
320707
320715
|
if (hex10 && /^[0-9a-f]+$/.test(hex10)) {
|
|
320708
320716
|
const full = hex10.length <= 4 ? hex10.split("").map((c2) => c2 + c2).join("") : hex10;
|
|
@@ -322175,8 +322183,8 @@ function reflectUrl() {
|
|
|
322175
322183
|
const base = documentPath({ linkKey: activeLink?.key, localDocId });
|
|
322176
322184
|
const atSameAddress = window.location.pathname === base.split("?")[0];
|
|
322177
322185
|
const path = atSameAddress ? withDeepLink(base, parseDeepLink(window.location.search)) : base;
|
|
322178
|
-
const
|
|
322179
|
-
if (
|
|
322186
|
+
const current6 = window.location.pathname + (isDesktopTabs() || localDocId || path.includes("?") ? window.location.search : "");
|
|
322187
|
+
if (current6 !== path) window.history.replaceState(null, "", path);
|
|
322180
322188
|
}
|
|
322181
322189
|
function onSyncStatus(fn) {
|
|
322182
322190
|
statusListeners.add(fn);
|
|
@@ -322854,7 +322862,6 @@ async function dispatchShaped(key5, options) {
|
|
|
322854
322862
|
var onViolation;
|
|
322855
322863
|
var init_dispatch = __esm({
|
|
322856
322864
|
"lib/commands/dispatch.ts"() {
|
|
322857
|
-
"use strict";
|
|
322858
322865
|
init_errors();
|
|
322859
322866
|
init_registry();
|
|
322860
322867
|
init_confirm();
|
|
@@ -323254,7 +323261,6 @@ function creditLine(c2) {
|
|
|
323254
323261
|
var MAX_PHOTO_PAGE, MAX_PHOTO_QUERY, UUID, isPhotoId, photoImagePath;
|
|
323255
323262
|
var init_stock = __esm({
|
|
323256
323263
|
"lib/photos/stock.ts"() {
|
|
323257
|
-
"use strict";
|
|
323258
323264
|
MAX_PHOTO_PAGE = 12;
|
|
323259
323265
|
MAX_PHOTO_QUERY = 200;
|
|
323260
323266
|
UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -326218,25 +326224,25 @@ function effectFilter(node2, ctx2, totalMat) {
|
|
|
326218
326224
|
const sigma = (blur) => Math.max(0.5, blur / 3);
|
|
326219
326225
|
const id3 = uid(ctx2, "fx");
|
|
326220
326226
|
let parts = "";
|
|
326221
|
-
let
|
|
326227
|
+
let current6 = "SourceGraphic";
|
|
326222
326228
|
if (drop) {
|
|
326223
326229
|
const [dx, dy] = localOffset(drop.offset.x, drop.offset.y);
|
|
326224
326230
|
const spread2 = drop.spread || 0;
|
|
326225
326231
|
const knock = drop.showBehindTransparent === false;
|
|
326226
326232
|
if (!spread2 && !knock) {
|
|
326227
|
-
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"/>`;
|
|
326228
326234
|
} else {
|
|
326229
|
-
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>`;
|
|
326230
326236
|
}
|
|
326231
|
-
|
|
326237
|
+
current6 = "withdrop";
|
|
326232
326238
|
}
|
|
326233
326239
|
if (inner) {
|
|
326234
326240
|
const [dx, dy] = localOffset(inner.offset.x, inner.offset.y);
|
|
326235
326241
|
const spread2 = inner.spread || 0;
|
|
326236
|
-
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="${
|
|
326237
|
-
|
|
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";
|
|
326238
326244
|
}
|
|
326239
|
-
if (layerBlur) parts += `<feGaussianBlur in="${
|
|
326245
|
+
if (layerBlur) parts += `<feGaussianBlur in="${current6}" stdDeviation="${fmt(sigma(layerBlur.radius))}"/>`;
|
|
326240
326246
|
ctx2.defs.push(`<filter id="${id3}" ${region}>${parts}</filter>`);
|
|
326241
326247
|
return ` filter="url(#${id3})"`;
|
|
326242
326248
|
}
|
|
@@ -327160,13 +327166,13 @@ ${num7(c2[0])} ${num7(c2[1])} ${num7(c2[2])} ${num7(c2[3])} ${num7(c2[4])} ${num
|
|
|
327160
327166
|
for (const run4 of item.runs) {
|
|
327161
327167
|
this.w(`q /${this.gs(opacity * run4.alpha, 1, blend2)} gs ${this.res.color.fill(run4.color)} BT
|
|
327162
327168
|
`);
|
|
327163
|
-
let
|
|
327169
|
+
let current6 = "";
|
|
327164
327170
|
for (const g of run4.glyphs) {
|
|
327165
327171
|
const { resource, gid } = this.res.fonts.use(g.font, g.gid, g.codePoints);
|
|
327166
|
-
if (resource !==
|
|
327172
|
+
if (resource !== current6) {
|
|
327167
327173
|
this.w(`/${resource} ${num7(run4.size)} Tf
|
|
327168
327174
|
`);
|
|
327169
|
-
|
|
327175
|
+
current6 = resource;
|
|
327170
327176
|
}
|
|
327171
327177
|
this.w(`1 0 0 -1 ${num7(g.x)} ${num7(g.y)} Tm <${gid.toString(16).padStart(4, "0")}> Tj
|
|
327172
327178
|
`);
|
|
@@ -327956,13 +327962,13 @@ async function encodeImageData(imageData, format, quality = 0.9, dpi) {
|
|
|
327956
327962
|
}
|
|
327957
327963
|
function sliceRegion(node2, doc2) {
|
|
327958
327964
|
let pageId2 = null;
|
|
327959
|
-
let
|
|
327960
|
-
while (
|
|
327961
|
-
if (
|
|
327962
|
-
pageId2 =
|
|
327965
|
+
let current6 = node2;
|
|
327966
|
+
while (current6) {
|
|
327967
|
+
if (current6.type === "PAGE") {
|
|
327968
|
+
pageId2 = current6.id;
|
|
327963
327969
|
break;
|
|
327964
327970
|
}
|
|
327965
|
-
|
|
327971
|
+
current6 = current6.parentId ? doc2.nodes[current6.parentId] : void 0;
|
|
327966
327972
|
}
|
|
327967
327973
|
if (!pageId2) return null;
|
|
327968
327974
|
const page = doc2.nodes[pageId2];
|
|
@@ -331037,8 +331043,8 @@ var init_node = __esm({
|
|
|
331037
331043
|
const patches = /* @__PURE__ */ new Map();
|
|
331038
331044
|
for (const id3 of ids2) {
|
|
331039
331045
|
const n = resolvedNodeOrThrow(doc2, id3);
|
|
331040
|
-
const
|
|
331041
|
-
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);
|
|
331042
331048
|
patches.set(id3, { rotation: (next2 % 360 + 360) % 360 });
|
|
331043
331049
|
}
|
|
331044
331050
|
commitUpdates(ctx2, doc2, patches);
|
|
@@ -339069,7 +339075,7 @@ var init_package = __esm({
|
|
|
339069
339075
|
"packages/runtime/package.json"() {
|
|
339070
339076
|
package_default = {
|
|
339071
339077
|
name: "@popcraft/runtime",
|
|
339072
|
-
version: "0.
|
|
339078
|
+
version: "0.58.0",
|
|
339073
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.",
|
|
339074
339080
|
license: "MIT",
|
|
339075
339081
|
homepage: "https://popcraft.app/docs/exporting/nextjs",
|
|
@@ -340207,8 +340213,8 @@ var require_types = __commonJS({
|
|
|
340207
340213
|
TokenType2[TokenType2["IS_POSTFIX"] = IS_POSTFIX] = "IS_POSTFIX";
|
|
340208
340214
|
const IS_EXPRESSION_START = 1 << 9;
|
|
340209
340215
|
TokenType2[TokenType2["IS_EXPRESSION_START"] = IS_EXPRESSION_START] = "IS_EXPRESSION_START";
|
|
340210
|
-
const
|
|
340211
|
-
TokenType2[TokenType2["num"] =
|
|
340216
|
+
const num13 = 512;
|
|
340217
|
+
TokenType2[TokenType2["num"] = num13] = "num";
|
|
340212
340218
|
const bigint4 = 1536;
|
|
340213
340219
|
TokenType2[TokenType2["bigint"] = bigint4] = "bigint";
|
|
340214
340220
|
const decimal = 2560;
|
|
@@ -352845,19 +352851,19 @@ var require_sourcemap_codec_umd = __commonJS({
|
|
|
352845
352851
|
} while (integer2 & 32);
|
|
352846
352852
|
return value3;
|
|
352847
352853
|
}
|
|
352848
|
-
function decodeSign(
|
|
352849
|
-
return
|
|
352854
|
+
function decodeSign(num13) {
|
|
352855
|
+
return num13 & 1 ? -2147483648 | -(num13 >>> 1) : num13 >>> 1;
|
|
352850
352856
|
}
|
|
352851
|
-
function encodeInteger(builder,
|
|
352857
|
+
function encodeInteger(builder, num13) {
|
|
352852
352858
|
do {
|
|
352853
|
-
let clamped =
|
|
352854
|
-
|
|
352855
|
-
if (
|
|
352859
|
+
let clamped = num13 & 31;
|
|
352860
|
+
num13 >>>= 5;
|
|
352861
|
+
if (num13 > 0) clamped |= 32;
|
|
352856
352862
|
builder.write(intToChar[clamped]);
|
|
352857
|
-
} while (
|
|
352863
|
+
} while (num13 > 0);
|
|
352858
352864
|
}
|
|
352859
|
-
function encodeSign(
|
|
352860
|
-
return
|
|
352865
|
+
function encodeSign(num13) {
|
|
352866
|
+
return num13 < 0 ? -num13 << 1 | 1 : num13 << 1;
|
|
352861
352867
|
}
|
|
352862
352868
|
function hasMoreVlq(reader, max3) {
|
|
352863
352869
|
if (reader.pos >= max3) return false;
|
|
@@ -354279,8 +354285,8 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
354279
354285
|
function getColumnIndex(line, genColumn) {
|
|
354280
354286
|
let index2 = line.length;
|
|
354281
354287
|
for (let i2 = index2 - 1; i2 >= 0; index2 = i2--) {
|
|
354282
|
-
const
|
|
354283
|
-
if (genColumn >=
|
|
354288
|
+
const current6 = line[i2];
|
|
354289
|
+
if (genColumn >= current6[COLUMN]) break;
|
|
354284
354290
|
}
|
|
354285
354291
|
return index2;
|
|
354286
354292
|
}
|
|
@@ -363777,7 +363783,6 @@ function compileModule(module2) {
|
|
|
363777
363783
|
var import_sucrase, BUILT_IN, memo7;
|
|
363778
363784
|
var init_compile2 = __esm({
|
|
363779
363785
|
"lib/code/compile.ts"() {
|
|
363780
|
-
"use strict";
|
|
363781
363786
|
import_sucrase = __toESM(require_dist2());
|
|
363782
363787
|
init_source2();
|
|
363783
363788
|
init_source2();
|
|
@@ -366600,9 +366605,9 @@ var init_meta = __esm({
|
|
|
366600
366605
|
throw new ToolError("Only one todo may be in_progress at a time.");
|
|
366601
366606
|
}
|
|
366602
366607
|
const done = todos.filter((t3) => t3.status === "done").length;
|
|
366603
|
-
const
|
|
366608
|
+
const current6 = todos.find((t3) => t3.status === "in_progress");
|
|
366604
366609
|
return {
|
|
366605
|
-
summary: todos.length ? `${done}/${todos.length} done${
|
|
366610
|
+
summary: todos.length ? `${done}/${todos.length} done${current6 ? ` \u2014 ${current6.title}` : ""}` : "Cleared the plan",
|
|
366606
366611
|
data: { todos }
|
|
366607
366612
|
};
|
|
366608
366613
|
}
|
|
@@ -369122,17 +369127,17 @@ function bestLag2(a, b, maxLag) {
|
|
|
369122
369127
|
};
|
|
369123
369128
|
const ma = mean(a), mb = mean(b);
|
|
369124
369129
|
for (let lag = -maxLag; lag <= maxLag; lag++) {
|
|
369125
|
-
let
|
|
369130
|
+
let num13 = 0, ea = 0, eb = 0, count2 = 0;
|
|
369126
369131
|
const from2 = Math.max(0, -lag), to = Math.min(a.length, b.length - lag);
|
|
369127
369132
|
for (let i2 = from2; i2 < to; i2++) {
|
|
369128
369133
|
const x2 = a[i2] - ma, y = b[i2 + lag] - mb;
|
|
369129
|
-
|
|
369134
|
+
num13 += x2 * y;
|
|
369130
369135
|
ea += x2 * x2;
|
|
369131
369136
|
eb += y * y;
|
|
369132
369137
|
count2++;
|
|
369133
369138
|
}
|
|
369134
369139
|
if (count2 < ENVELOPE_HZ) continue;
|
|
369135
|
-
const s =
|
|
369140
|
+
const s = num13 / Math.sqrt(ea * eb || 1);
|
|
369136
369141
|
if (s > score) {
|
|
369137
369142
|
score = s;
|
|
369138
369143
|
best = lag;
|
|
@@ -373941,7 +373946,6 @@ var init_source_monitor = __esm({
|
|
|
373941
373946
|
var storeOpsSeam;
|
|
373942
373947
|
var init_seams = __esm({
|
|
373943
373948
|
"lib/commands/seams.ts"() {
|
|
373944
|
-
"use strict";
|
|
373945
373949
|
storeOpsSeam = (st3) => ({
|
|
373946
373950
|
booleanOperation: (op4) => st3().booleanOperation(op4),
|
|
373947
373951
|
flatten: () => st3().flattenSelection(),
|
|
@@ -376361,6 +376365,109 @@ are whole stores to begin from.
|
|
|
376361
376365
|
}
|
|
376362
376366
|
});
|
|
376363
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
|
+
|
|
376364
376471
|
// lib/agent/skills/builtin/index.ts
|
|
376365
376472
|
var BUILTIN_SKILLS;
|
|
376366
376473
|
var init_builtin2 = __esm({
|
|
@@ -376386,6 +376493,8 @@ var init_builtin2 = __esm({
|
|
|
376386
376493
|
init_design_review();
|
|
376387
376494
|
init_web_app();
|
|
376388
376495
|
init_storefront2();
|
|
376496
|
+
init_pixel_sprites();
|
|
376497
|
+
init_orchestration();
|
|
376389
376498
|
BUILTIN_SKILLS = [
|
|
376390
376499
|
fillContent,
|
|
376391
376500
|
autoLayout,
|
|
@@ -376406,7 +376515,9 @@ var init_builtin2 = __esm({
|
|
|
376406
376515
|
designCode,
|
|
376407
376516
|
designReview,
|
|
376408
376517
|
webApp,
|
|
376409
|
-
storefront
|
|
376518
|
+
storefront,
|
|
376519
|
+
pixelSprites,
|
|
376520
|
+
...ORCHESTRATION_SKILLS
|
|
376410
376521
|
].map((s) => ({ ...s, source: "builtin" }));
|
|
376411
376522
|
}
|
|
376412
376523
|
});
|
|
@@ -376963,7 +377074,7 @@ var init_open_intent = __esm({
|
|
|
376963
377074
|
}
|
|
376964
377075
|
});
|
|
376965
377076
|
|
|
376966
|
-
// 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
|
|
376967
377078
|
function agentModelError(message, code, status3) {
|
|
376968
377079
|
{
|
|
376969
377080
|
return { name: "AgentModelError", message, code: code ?? "ai_upstream", status: ((__v) => __v == null ? "null" : typeof __v)(status3) === "number" ? status3 : 502 };
|
|
@@ -377141,13 +377252,15 @@ function createHyperyModel(opts) {
|
|
|
377141
377252
|
if (base.endsWith("/") ?? null) {
|
|
377142
377253
|
base = base.slice(0, base.length - 1) ?? null;
|
|
377143
377254
|
}
|
|
377144
|
-
return async (messages, tools, hooks, signal, req) => {
|
|
377255
|
+
return async (messages, tools, hooks, signal, req = null) => {
|
|
377145
377256
|
{
|
|
377146
377257
|
let token = await (resolve2(opts.token) ?? null);
|
|
377147
377258
|
if (((__v) => __v == null ? "null" : typeof __v)(token) !== "string" || token === "") {
|
|
377148
377259
|
throw agentModelError("Sign in to Hypery to use the agent.", "ai_reauth", 401) ?? null;
|
|
377149
377260
|
}
|
|
377150
|
-
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);
|
|
377151
377264
|
let team = await (resolve2(opts.team) ?? null);
|
|
377152
377265
|
let paymentSource = await (resolve2(opts.paymentSource) ?? null);
|
|
377153
377266
|
let hasTools = (Array.isArray(tools) ?? null) && tools.length > 0;
|
|
@@ -377155,9 +377268,12 @@ function createHyperyModel(opts) {
|
|
|
377155
377268
|
if (((__v) => __v == null ? "null" : typeof __v)(opts.temperature) === "number") {
|
|
377156
377269
|
request2.temperature = opts.temperature;
|
|
377157
377270
|
}
|
|
377271
|
+
if (((__v) => __v == null ? "null" : typeof __v)(effort) === "string" && effort !== "") {
|
|
377272
|
+
request2.reasoning = { effort };
|
|
377273
|
+
}
|
|
377158
377274
|
if (hasTools) {
|
|
377159
377275
|
request2.tools = tools;
|
|
377160
|
-
let choice =
|
|
377276
|
+
let choice = hasReq ? req.toolChoice ?? null : null;
|
|
377161
377277
|
request2.tool_choice = choice != null ? choice : "auto";
|
|
377162
377278
|
}
|
|
377163
377279
|
let body = JSON.stringify(request2) ?? null;
|
|
@@ -377285,7 +377401,7 @@ function createHyperyModel(opts) {
|
|
|
377285
377401
|
}
|
|
377286
377402
|
var delay, utf8Complete, utf8Decode, MAX_REQUEST_BYTES, DEFAULT_IDLE_TIMEOUT_MS, HYPERY_TEAM_HEADER2, HYPERY_PAYMENT_SOURCE_HEADER2;
|
|
377287
377403
|
var init_hypery_model = __esm({
|
|
377288
|
-
"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"() {
|
|
377289
377405
|
delay = ((ms3) => new Promise((settle4) => setTimeout(() => settle4(null), Math.max(0, Number(ms3) || 0))));
|
|
377290
377406
|
utf8Complete = ((b) => {
|
|
377291
377407
|
if (!Array.isArray(b)) return null;
|
|
@@ -377306,7 +377422,221 @@ var init_hypery_model = __esm({
|
|
|
377306
377422
|
}
|
|
377307
377423
|
});
|
|
377308
377424
|
|
|
377309
|
-
// 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
|
|
377310
377640
|
function sizeOf2(messages) {
|
|
377311
377641
|
{
|
|
377312
377642
|
return (JSON.stringify(messages) ?? null).length;
|
|
@@ -377444,13 +377774,13 @@ async function compactTranscript(messages, opts) {
|
|
|
377444
377774
|
}
|
|
377445
377775
|
var RENDER_TURN_PREFIX, KEEP_IMAGE_TURNS;
|
|
377446
377776
|
var init_context2 = __esm({
|
|
377447
|
-
"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"() {
|
|
377448
377778
|
RENDER_TURN_PREFIX = "Result of ";
|
|
377449
377779
|
KEEP_IMAGE_TURNS = 2;
|
|
377450
377780
|
}
|
|
377451
377781
|
});
|
|
377452
377782
|
|
|
377453
|
-
// 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
|
|
377454
377784
|
function batchCalls(calls, isParallel, max3) {
|
|
377455
377785
|
{
|
|
377456
377786
|
let batches = [];
|
|
@@ -377641,7 +377971,36 @@ async function runAgentLoop(opts) {
|
|
|
377641
377971
|
}
|
|
377642
377972
|
}
|
|
377643
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
|
+
};
|
|
377644
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
|
+
}
|
|
377645
378004
|
while (maxRounds === 0 || round5 < maxRounds) {
|
|
377646
378005
|
if (isStopped() ?? null) {
|
|
377647
378006
|
await (save(round5, true) ?? null);
|
|
@@ -377659,7 +378018,19 @@ async function runAgentLoop(opts) {
|
|
|
377659
378018
|
if (onStart != null) {
|
|
377660
378019
|
onStart(round5) ?? null;
|
|
377661
378020
|
}
|
|
377662
|
-
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);
|
|
377663
378034
|
text = turn.text;
|
|
377664
378035
|
let toolCalls = Array.isArray(turn.toolCalls) ?? null ? turn.toolCalls : [];
|
|
377665
378036
|
if (toolCalls.length > 0) {
|
|
@@ -377684,6 +378055,14 @@ async function runAgentLoop(opts) {
|
|
|
377684
378055
|
round5 = round5 + 1;
|
|
377685
378056
|
continue;
|
|
377686
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
|
+
}
|
|
377687
378066
|
if (require3 != null && !acted && nudgesLeft > 0 && actingNames.size > 0) {
|
|
377688
378067
|
nudgesLeft = nudgesLeft - 1;
|
|
377689
378068
|
let nudge = ((__v) => __v == null ? "null" : typeof __v)(require3.message) === "string" ? require3.message : DEFAULT_ACTION_NUDGE;
|
|
@@ -377705,6 +378084,8 @@ async function runAgentLoop(opts) {
|
|
|
377705
378084
|
}
|
|
377706
378085
|
}) ?? null;
|
|
377707
378086
|
let imageTurns = [];
|
|
378087
|
+
let repeated = [];
|
|
378088
|
+
doneChecked = false;
|
|
377708
378089
|
for (const batch of batchCalls(calls, (n) => {
|
|
377709
378090
|
{
|
|
377710
378091
|
return parallelNames.has(n) ?? null;
|
|
@@ -377753,6 +378134,14 @@ async function runAgentLoop(opts) {
|
|
|
377753
378134
|
if (onToolEnd != null) {
|
|
377754
378135
|
onToolEnd(run4) ?? null;
|
|
377755
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
|
+
}
|
|
377756
378145
|
messages.push({ role: "tool", tool_call_id: run4.id, name: run4.name, content: truncateResult(run4.content, maxResultChars) ?? null }) ?? null;
|
|
377757
378146
|
if ((Array.isArray(run4.images) ?? null) && run4.images.length > 0) {
|
|
377758
378147
|
let label3 = run4.images.length === 1 ? "the rendered view" : (String(run4.images.length) ?? null) + " rendered views";
|
|
@@ -377767,6 +378156,9 @@ async function runAgentLoop(opts) {
|
|
|
377767
378156
|
for (const m of imageTurns) {
|
|
377768
378157
|
messages.push(m) ?? null;
|
|
377769
378158
|
}
|
|
378159
|
+
for (const err2 of repeated) {
|
|
378160
|
+
await (consult("error", "The error, seen " + (String(REPEATED_ERROR_COUNT) ?? null) + " times: " + err2) ?? null);
|
|
378161
|
+
}
|
|
377770
378162
|
let onRoundEnd = hook(hooks, "onRoundEnd") ?? null;
|
|
377771
378163
|
if (onRoundEnd != null) {
|
|
377772
378164
|
onRoundEnd(round5) ?? null;
|
|
@@ -377783,7 +378175,8 @@ async function runAgentLoop(opts) {
|
|
|
377783
378175
|
}
|
|
377784
378176
|
var DEFAULT_MAX_ROUNDS, DEFAULT_MAX_PARALLEL, DEFAULT_ACTION_NUDGE, RENDER_TURN_PREFIX2, RECOVERABLE_WORDS;
|
|
377785
378177
|
var init_loop = __esm({
|
|
377786
|
-
"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();
|
|
377787
378180
|
init_context2();
|
|
377788
378181
|
DEFAULT_MAX_ROUNDS = 40;
|
|
377789
378182
|
DEFAULT_MAX_PARALLEL = 4;
|
|
@@ -377793,7 +378186,7 @@ var init_loop = __esm({
|
|
|
377793
378186
|
}
|
|
377794
378187
|
});
|
|
377795
378188
|
|
|
377796
|
-
// 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
|
|
377797
378190
|
function isBusy(s) {
|
|
377798
378191
|
{
|
|
377799
378192
|
return s != null && (s.status === "running" || s.status === "queued");
|
|
@@ -377837,7 +378230,17 @@ function createAgentRuntime(host) {
|
|
|
377837
378230
|
let waiting3 = [];
|
|
377838
378231
|
let listeners9 = [];
|
|
377839
378232
|
let pendingSaves = 0;
|
|
377840
|
-
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
|
+
};
|
|
377841
378244
|
let now3 = () => {
|
|
377842
378245
|
{
|
|
377843
378246
|
return ((__v) => __v == null ? "null" : typeof __v)(host.now) === "function" ? host.now() ?? null : Date.now() ?? null;
|
|
@@ -377926,6 +378329,9 @@ function createAgentRuntime(host) {
|
|
|
377926
378329
|
let ctx2 = { session: session3, profile, readOnly: forceReadOnly || profile.readOnly === true, signal: control.signal };
|
|
377927
378330
|
let tools = (host.childTools(ctx2) ?? null).concat([REPORT_SPEC]) ?? null;
|
|
377928
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
|
+
}
|
|
377929
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;
|
|
377930
378336
|
let ok2 = true;
|
|
377931
378337
|
let summary = "";
|
|
@@ -378044,10 +378450,10 @@ function createAgentRuntime(host) {
|
|
|
378044
378450
|
{
|
|
378045
378451
|
}
|
|
378046
378452
|
}
|
|
378047
|
-
job = takeNext() ?? null;
|
|
378453
|
+
job = active4 <= (maxConcurrent() ?? null) ? takeNext() ?? null : null;
|
|
378048
378454
|
if (job == null) {
|
|
378049
378455
|
active4 = Math.max(0, active4 - 1) ?? null;
|
|
378050
|
-
if (waiting3.length > 0 && active4 < maxConcurrent) {
|
|
378456
|
+
if (waiting3.length > 0 && active4 < (maxConcurrent() ?? null)) {
|
|
378051
378457
|
active4 = active4 + 1;
|
|
378052
378458
|
job = takeNext() ?? null;
|
|
378053
378459
|
if (job == null) {
|
|
@@ -378062,7 +378468,15 @@ function createAgentRuntime(host) {
|
|
|
378062
378468
|
};
|
|
378063
378469
|
let startBackground = (session3, go) => {
|
|
378064
378470
|
{
|
|
378065
|
-
|
|
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)) {
|
|
378066
378480
|
active4 = active4 + 1;
|
|
378067
378481
|
runSlot({ session: session3, go }) ?? null;
|
|
378068
378482
|
return;
|
|
@@ -378253,7 +378667,7 @@ function createAgentRuntime(host) {
|
|
|
378253
378667
|
}
|
|
378254
378668
|
var delay2, REPORT_TOOL, REPORT_SPEC, WAIT_STEP_MS;
|
|
378255
378669
|
var init_runtime5 = __esm({
|
|
378256
|
-
"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"() {
|
|
378257
378671
|
init_loop();
|
|
378258
378672
|
delay2 = ((ms3) => new Promise((settle4) => setTimeout(() => settle4(null), Math.max(0, Number(ms3) || 0))));
|
|
378259
378673
|
REPORT_TOOL = "report_to_parent";
|
|
@@ -378262,44 +378676,44 @@ var init_runtime5 = __esm({
|
|
|
378262
378676
|
}
|
|
378263
378677
|
});
|
|
378264
378678
|
|
|
378265
|
-
// 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
|
|
378266
378680
|
function forceTool(name2) {
|
|
378267
378681
|
{
|
|
378268
378682
|
return { type: "function", function: { name: name2 } };
|
|
378269
378683
|
}
|
|
378270
378684
|
}
|
|
378271
378685
|
var init_types9 = __esm({
|
|
378272
|
-
"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"() {
|
|
378273
378687
|
}
|
|
378274
378688
|
});
|
|
378275
378689
|
|
|
378276
|
-
// node_modules/.pnpm/@hyperyai+sdk@
|
|
378277
|
-
var
|
|
378278
|
-
"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"() {
|
|
378279
378693
|
}
|
|
378280
378694
|
});
|
|
378281
378695
|
|
|
378282
|
-
// 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
|
|
378283
378697
|
var ORCHESTRATOR_GUIDANCE;
|
|
378284
378698
|
var init_profiles2 = __esm({
|
|
378285
|
-
"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"() {
|
|
378286
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;
|
|
378287
378701
|
}
|
|
378288
378702
|
});
|
|
378289
378703
|
|
|
378290
|
-
// 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
|
|
378291
378705
|
var init_supervisor = __esm({
|
|
378292
|
-
"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"() {
|
|
378293
378707
|
}
|
|
378294
378708
|
});
|
|
378295
378709
|
|
|
378296
|
-
// 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
|
|
378297
378711
|
var init_todos = __esm({
|
|
378298
|
-
"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"() {
|
|
378299
378713
|
}
|
|
378300
378714
|
});
|
|
378301
378715
|
|
|
378302
|
-
// 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
|
|
378303
378717
|
async function loadAll(kv, prefix) {
|
|
378304
378718
|
{
|
|
378305
378719
|
let out = [];
|
|
@@ -378353,11 +378767,11 @@ function runStore(kv, scope) {
|
|
|
378353
378767
|
}
|
|
378354
378768
|
}
|
|
378355
378769
|
var init_store = __esm({
|
|
378356
|
-
"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"() {
|
|
378357
378771
|
}
|
|
378358
378772
|
});
|
|
378359
378773
|
|
|
378360
|
-
// 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
|
|
378361
378775
|
function errorMessage3(err2) {
|
|
378362
378776
|
{
|
|
378363
378777
|
if (err2 != null && ((__v) => __v == null ? "null" : typeof __v)(err2) === "object" && ((__v) => __v == null ? "null" : typeof __v)(err2.message) === "string") {
|
|
@@ -378441,29 +378855,327 @@ async function resumeRun(id3, runs2, options) {
|
|
|
378441
378855
|
}
|
|
378442
378856
|
}
|
|
378443
378857
|
var init_run = __esm({
|
|
378444
|
-
"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"() {
|
|
378445
378859
|
init_loop();
|
|
378446
378860
|
}
|
|
378447
378861
|
});
|
|
378448
378862
|
|
|
378449
|
-
// 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
|
|
378450
379157
|
var init_core3 = __esm({
|
|
378451
|
-
"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"() {
|
|
378452
379159
|
init_types9();
|
|
378453
379160
|
init_loop();
|
|
378454
379161
|
init_context2();
|
|
378455
379162
|
init_runtime5();
|
|
378456
|
-
|
|
379163
|
+
init_orchestration2();
|
|
378457
379164
|
init_profiles2();
|
|
378458
379165
|
init_supervisor();
|
|
378459
379166
|
init_todos();
|
|
378460
379167
|
init_store();
|
|
378461
379168
|
init_run();
|
|
378462
379169
|
init_hypery_model();
|
|
379170
|
+
init_roles();
|
|
379171
|
+
init_advisor();
|
|
379172
|
+
init_router();
|
|
379173
|
+
init_auto();
|
|
379174
|
+
init_orchestration_skill();
|
|
378463
379175
|
}
|
|
378464
379176
|
});
|
|
378465
379177
|
|
|
378466
|
-
// 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
|
|
378467
379179
|
function indexedDbStore(name2 = "hypery-agents") {
|
|
378468
379180
|
let db3 = null;
|
|
378469
379181
|
const open4 = () => db3 ?? (db3 = new Promise((res, rej) => {
|
|
@@ -378495,11 +379207,11 @@ function indexedDbStore(name2 = "hypery-agents") {
|
|
|
378495
379207
|
};
|
|
378496
379208
|
}
|
|
378497
379209
|
var init_indexeddb2 = __esm({
|
|
378498
|
-
"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"() {
|
|
378499
379211
|
}
|
|
378500
379212
|
});
|
|
378501
379213
|
|
|
378502
|
-
// 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
|
|
378503
379215
|
function createHyperyModel2(opts) {
|
|
378504
379216
|
return createHyperyModel({ ...opts, fetch: opts.fetch ?? ((url4, init) => fetch(url4, init)) });
|
|
378505
379217
|
}
|
|
@@ -378515,7 +379227,7 @@ function createAgentRuntime2(host) {
|
|
|
378515
379227
|
});
|
|
378516
379228
|
}
|
|
378517
379229
|
var init_agents = __esm({
|
|
378518
|
-
"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"() {
|
|
378519
379231
|
init_hypery_model();
|
|
378520
379232
|
init_runtime5();
|
|
378521
379233
|
init_core3();
|
|
@@ -378749,6 +379461,47 @@ var init_turn_recovery = __esm({
|
|
|
378749
379461
|
}
|
|
378750
379462
|
});
|
|
378751
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
|
+
|
|
378752
379505
|
// lib/agent/prompt.ts
|
|
378753
379506
|
function buildContextBlock(ctx2, maxChars = PROMPT_LIMITS.maxContextChars) {
|
|
378754
379507
|
const { doc: doc2, pageId: pageId2, selection } = ctx2;
|
|
@@ -378771,7 +379524,7 @@ function buildContextBlock(ctx2, maxChars = PROMPT_LIMITS.maxContextChars) {
|
|
|
378771
379524
|
return joinWithin(lines2, maxChars);
|
|
378772
379525
|
}
|
|
378773
379526
|
function buildSkillIndex(skills, maxChars = PROMPT_LIMITS.maxSkillIndexChars) {
|
|
378774
|
-
return joinWithin(skills.map(skillIndexLine), maxChars);
|
|
379527
|
+
return joinWithin(skills.filter((s) => parseOrchestrationSkill(s.instructions) === null).map(skillIndexLine), maxChars);
|
|
378775
379528
|
}
|
|
378776
379529
|
function buildProfileIndex(profiles, maxChars = PROMPT_LIMITS.maxProfileIndexChars) {
|
|
378777
379530
|
return joinWithin(profiles.map(profileIndexLine), maxChars);
|
|
@@ -378810,11 +379563,12 @@ var init_prompt = __esm({
|
|
|
378810
379563
|
init_limits();
|
|
378811
379564
|
init_context();
|
|
378812
379565
|
init_skills();
|
|
379566
|
+
init_agents();
|
|
378813
379567
|
init_profiles();
|
|
378814
379568
|
init_mentions();
|
|
378815
379569
|
PROMPT_LIMITS = {
|
|
378816
|
-
maxPromptChars:
|
|
378817
|
-
maxSkillIndexChars:
|
|
379570
|
+
maxPromptChars: 14400,
|
|
379571
|
+
maxSkillIndexChars: 5200,
|
|
378818
379572
|
maxProfileIndexChars: 1600,
|
|
378819
379573
|
maxContextChars: AI_LIMITS.maxContextChars,
|
|
378820
379574
|
maxSelectionItems: 12
|
|
@@ -378827,6 +379581,7 @@ var init_prompt = __esm({
|
|
|
378827
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.
|
|
378828
379582
|
- Explain briefly. A line or two about what you did and why, with counts rather than lists. No preamble, no restating the request.
|
|
378829
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.
|
|
378830
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.
|
|
378831
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.
|
|
378832
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.
|
|
@@ -378893,9 +379648,16 @@ function subagentHost(deps = {}) {
|
|
|
378893
379648
|
profiles,
|
|
378894
379649
|
callModel: modelCall(parentModel),
|
|
378895
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
|
+
}
|
|
378896
379656
|
const model = pickChildModel(profileOf(ctx2), parentModel(), catalog2());
|
|
378897
379657
|
return modelCall(() => model);
|
|
378898
379658
|
},
|
|
379659
|
+
// The turn's skill sets how many background children run at once (null: the SDK's default).
|
|
379660
|
+
maxConcurrent: () => currentOrchestration()?.maxConcurrent ?? null,
|
|
378899
379661
|
childSystemPrompt: (ctx2) => buildSubagentPrompt(ctx2.profile.instructions, promptContext()),
|
|
378900
379662
|
childTools: (ctx2) => {
|
|
378901
379663
|
const all4 = registered3();
|
|
@@ -378965,6 +379727,7 @@ var PARENT_ONLY_TOOLS, AGENT_SESSIONS_DB, FAST_HINTS, isFastModelId, childToolLi
|
|
|
378965
379727
|
var init_subagent = __esm({
|
|
378966
379728
|
"lib/agent/subagent.ts"() {
|
|
378967
379729
|
"use strict";
|
|
379730
|
+
init_orchestration3();
|
|
378968
379731
|
init_editor_store();
|
|
378969
379732
|
init_client_store();
|
|
378970
379733
|
init_agents();
|
|
@@ -379676,8 +380439,8 @@ async function reviewUpdate(update3) {
|
|
|
379676
380439
|
}
|
|
379677
380440
|
function acceptUpdate(update3, payload, accept) {
|
|
379678
380441
|
const lib = useLibraries.getState().available.find((l) => l.id === update3.libraryId);
|
|
379679
|
-
const
|
|
379680
|
-
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);
|
|
379681
380444
|
useEditorStore.getState().commitDocument(doc2, `Update library: ${update3.name}`);
|
|
379682
380445
|
computeUpdates();
|
|
379683
380446
|
}
|
|
@@ -379874,17 +380637,17 @@ function sanitizeWidgetTree(raw) {
|
|
|
379874
380637
|
switch (e.type) {
|
|
379875
380638
|
case "AutoLayout": {
|
|
379876
380639
|
let padding3;
|
|
379877
|
-
if (typeof e.padding === "number") padding3 =
|
|
380640
|
+
if (typeof e.padding === "number") padding3 = num12(e.padding, 0, 1e3);
|
|
379878
380641
|
else if (e.padding && typeof e.padding === "object") {
|
|
379879
380642
|
const p2 = e.padding;
|
|
379880
|
-
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) };
|
|
379881
380644
|
}
|
|
379882
380645
|
const children = Array.isArray(e.children) ? e.children.filter((c2) => c2 !== null && c2 !== void 0 && c2 !== false).map((c2) => visit2(c2, depth + 1)) : [];
|
|
379883
380646
|
return strip({
|
|
379884
380647
|
type: "AutoLayout",
|
|
379885
380648
|
...base,
|
|
379886
380649
|
direction: e.direction === "vertical" ? "vertical" : "horizontal",
|
|
379887
|
-
spacing:
|
|
380650
|
+
spacing: num12(e.spacing, 0, 1e3),
|
|
379888
380651
|
padding: padding3,
|
|
379889
380652
|
width: size5(e.width),
|
|
379890
380653
|
height: size5(e.height),
|
|
@@ -379892,8 +380655,8 @@ function sanitizeWidgetTree(raw) {
|
|
|
379892
380655
|
verticalAlign: align3(e.verticalAlign),
|
|
379893
380656
|
fill: color3(e.fill),
|
|
379894
380657
|
stroke: color3(e.stroke),
|
|
379895
|
-
strokeWidth:
|
|
379896
|
-
cornerRadius:
|
|
380658
|
+
strokeWidth: num12(e.strokeWidth, 0, 100),
|
|
380659
|
+
cornerRadius: num12(e.cornerRadius, 0, 2e3),
|
|
379897
380660
|
children
|
|
379898
380661
|
});
|
|
379899
380662
|
}
|
|
@@ -379902,22 +380665,22 @@ function sanitizeWidgetTree(raw) {
|
|
|
379902
380665
|
type: "Text",
|
|
379903
380666
|
...base,
|
|
379904
380667
|
characters: String(e.characters ?? "").slice(0, 2e3),
|
|
379905
|
-
fontSize:
|
|
379906
|
-
fontWeight:
|
|
380668
|
+
fontSize: num12(e.fontSize, 1, 400),
|
|
380669
|
+
fontWeight: num12(e.fontWeight, 100, 900),
|
|
379907
380670
|
fill: color3(e.fill),
|
|
379908
|
-
width:
|
|
380671
|
+
width: num12(e.width, 0, 4e3)
|
|
379909
380672
|
});
|
|
379910
380673
|
case "Rectangle":
|
|
379911
380674
|
case "Ellipse":
|
|
379912
380675
|
return strip({
|
|
379913
380676
|
type: e.type,
|
|
379914
380677
|
...base,
|
|
379915
|
-
width:
|
|
379916
|
-
height:
|
|
380678
|
+
width: num12(e.width, 0, 4e3, 0),
|
|
380679
|
+
height: num12(e.height, 0, 4e3, 0),
|
|
379917
380680
|
fill: color3(e.fill),
|
|
379918
380681
|
stroke: color3(e.stroke),
|
|
379919
|
-
strokeWidth:
|
|
379920
|
-
cornerRadius:
|
|
380682
|
+
strokeWidth: num12(e.strokeWidth, 0, 100),
|
|
380683
|
+
cornerRadius: num12(e.cornerRadius, 0, 2e3)
|
|
379921
380684
|
});
|
|
379922
380685
|
default:
|
|
379923
380686
|
throw new WidgetTreeError(`Unknown widget element type ${JSON.stringify(e.type)}`);
|
|
@@ -380023,7 +380786,7 @@ function padding(el) {
|
|
|
380023
380786
|
right: p2?.right ?? p2?.horizontal ?? 0
|
|
380024
380787
|
};
|
|
380025
380788
|
}
|
|
380026
|
-
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;
|
|
380027
380790
|
var init_layout4 = __esm({
|
|
380028
380791
|
"lib/extensions/widget/layout.ts"() {
|
|
380029
380792
|
MAX_WIDGET_ELEMENTS = 400;
|
|
@@ -380031,7 +380794,7 @@ var init_layout4 = __esm({
|
|
|
380031
380794
|
MAX_WIDGET_STATE_BYTES = 64 * 1024;
|
|
380032
380795
|
WidgetTreeError = class extends Error {
|
|
380033
380796
|
};
|
|
380034
|
-
|
|
380797
|
+
num12 = (v, min2, max3, fallback2) => {
|
|
380035
380798
|
if (typeof v !== "number" || !Number.isFinite(v)) return fallback2;
|
|
380036
380799
|
return Math.max(min2, Math.min(max3, v));
|
|
380037
380800
|
};
|
|
@@ -380039,7 +380802,7 @@ var init_layout4 = __esm({
|
|
|
380039
380802
|
color3 = (v) => typeof v === "string" && HEX.test(v) ? v : void 0;
|
|
380040
380803
|
str3 = (v, max3) => typeof v === "string" ? v.slice(0, max3) : void 0;
|
|
380041
380804
|
align3 = (v) => v === "start" || v === "center" || v === "end" ? v : void 0;
|
|
380042
|
-
size5 = (v) => v === "hug" ? "hug" :
|
|
380805
|
+
size5 = (v) => v === "hug" ? "hug" : num12(v, 0, 4e3);
|
|
380043
380806
|
DEFAULT_FONT_SIZE = 16;
|
|
380044
380807
|
TEXT_COLOR = { r: 0.12, g: 0.12, b: 0.14, a: 1 };
|
|
380045
380808
|
layoutCache2 = /* @__PURE__ */ new WeakMap();
|
|
@@ -392905,20 +393668,20 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
392905
393668
|
graphics.current.updateClipFromPath();
|
|
392906
393669
|
}
|
|
392907
393670
|
setFillAndStrokeStyleToContext(graphics, paintType, color4) {
|
|
392908
|
-
const context = graphics.ctx,
|
|
392909
|
-
|
|
393671
|
+
const context = graphics.ctx, current6 = graphics.current;
|
|
393672
|
+
current6.patternFill = current6.patternStroke = false;
|
|
392910
393673
|
switch (paintType) {
|
|
392911
393674
|
case PaintType.COLORED:
|
|
392912
393675
|
const {
|
|
392913
393676
|
fillStyle,
|
|
392914
393677
|
strokeStyle
|
|
392915
393678
|
} = this.ctx;
|
|
392916
|
-
context.fillStyle =
|
|
392917
|
-
context.strokeStyle =
|
|
393679
|
+
context.fillStyle = current6.fillColor = fillStyle;
|
|
393680
|
+
context.strokeStyle = current6.strokeColor = strokeStyle;
|
|
392918
393681
|
break;
|
|
392919
393682
|
case PaintType.UNCOLORED:
|
|
392920
393683
|
context.fillStyle = context.strokeStyle = color4;
|
|
392921
|
-
|
|
393684
|
+
current6.fillColor = current6.strokeColor = color4;
|
|
392922
393685
|
break;
|
|
392923
393686
|
default:
|
|
392924
393687
|
throw new FormatError2(`Unsupported paint type: ${paintType}`);
|
|
@@ -394155,19 +394918,19 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394155
394918
|
setFont(opIdx, fontRefName, size6) {
|
|
394156
394919
|
this.dependencyTracker?.recordSimpleData("font", opIdx).recordSimpleDataFromNamed("fontObj", fontRefName, opIdx);
|
|
394157
394920
|
const fontObj = this.commonObjs.get(fontRefName);
|
|
394158
|
-
const
|
|
394921
|
+
const current6 = this.current;
|
|
394159
394922
|
if (!fontObj) {
|
|
394160
394923
|
throw new Error(`Can't find font for ${fontRefName}`);
|
|
394161
394924
|
}
|
|
394162
|
-
|
|
394163
|
-
if (
|
|
394925
|
+
current6.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;
|
|
394926
|
+
if (current6.fontMatrix[0] === 0 || current6.fontMatrix[3] === 0) {
|
|
394164
394927
|
warn3("Invalid font matrix for font " + fontRefName);
|
|
394165
394928
|
}
|
|
394166
394929
|
if (size6 < 0) {
|
|
394167
394930
|
size6 = -size6;
|
|
394168
|
-
|
|
394931
|
+
current6.fontDirection = -1;
|
|
394169
394932
|
} else {
|
|
394170
|
-
|
|
394933
|
+
current6.fontDirection = 1;
|
|
394171
394934
|
}
|
|
394172
394935
|
this.current.font = fontObj;
|
|
394173
394936
|
this.current.fontSize = size6;
|
|
@@ -394207,12 +394970,12 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394207
394970
|
setTextMatrix(opIdx, matrix) {
|
|
394208
394971
|
this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix", opIdx);
|
|
394209
394972
|
const {
|
|
394210
|
-
current:
|
|
394973
|
+
current: current6
|
|
394211
394974
|
} = this;
|
|
394212
|
-
|
|
394213
|
-
|
|
394214
|
-
|
|
394215
|
-
|
|
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;
|
|
394216
394979
|
}
|
|
394217
394980
|
nextLine(opIdx) {
|
|
394218
394981
|
this.moveText(opIdx, 0, this.current.leading);
|
|
@@ -394225,14 +394988,14 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394225
394988
|
}
|
|
394226
394989
|
paintChar(opIdx, character, x2, y, patternFillTransform, patternStrokeTransform) {
|
|
394227
394990
|
const ctx2 = this.ctx;
|
|
394228
|
-
const
|
|
394229
|
-
const font =
|
|
394230
|
-
const textRenderingMode =
|
|
394231
|
-
const fontSize =
|
|
394991
|
+
const current6 = this.current;
|
|
394992
|
+
const font = current6.font;
|
|
394993
|
+
const textRenderingMode = current6.textRenderingMode;
|
|
394994
|
+
const fontSize = current6.fontSize / current6.fontSizeScale;
|
|
394232
394995
|
const fillStrokeMode = textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
|
394233
394996
|
const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
|
|
394234
|
-
const patternFill =
|
|
394235
|
-
const patternStroke =
|
|
394997
|
+
const patternFill = current6.patternFill && !font.missingFile;
|
|
394998
|
+
const patternStroke = current6.patternStroke && !font.missingFile;
|
|
394236
394999
|
let path;
|
|
394237
395000
|
if ((font.disableFontFace || isAddToPathSet || patternFill || patternStroke) && !font.missingFile) {
|
|
394238
395001
|
path = font.getPathGenerator(this.commonObjs, character);
|
|
@@ -394321,49 +395084,49 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394321
395084
|
this.dependencyTracker.recordFutureForcedDependency("textClip", opIdx).inheritPendingDependenciesAsFutureForcedDependencies();
|
|
394322
395085
|
}
|
|
394323
395086
|
}
|
|
394324
|
-
const
|
|
394325
|
-
const font =
|
|
395087
|
+
const current6 = this.current;
|
|
395088
|
+
const font = current6.font;
|
|
394326
395089
|
if (font.isType3Font) {
|
|
394327
|
-
const started9 = this.#beginKnockoutElement(
|
|
395090
|
+
const started9 = this.#beginKnockoutElement(current6.fillAlpha);
|
|
394328
395091
|
this.showType3Text(opIdx, glyphs);
|
|
394329
395092
|
this.dependencyTracker?.recordShowTextOperation(opIdx);
|
|
394330
395093
|
this.#endKnockoutElement(started9);
|
|
394331
395094
|
return;
|
|
394332
395095
|
}
|
|
394333
|
-
const fontSize =
|
|
395096
|
+
const fontSize = current6.fontSize;
|
|
394334
395097
|
if (fontSize === 0) {
|
|
394335
395098
|
this.dependencyTracker?.recordOperation(opIdx);
|
|
394336
395099
|
return;
|
|
394337
395100
|
}
|
|
394338
|
-
const started8 = this.#beginKnockoutElement(
|
|
395101
|
+
const started8 = this.#beginKnockoutElement(current6.fillAlpha);
|
|
394339
395102
|
const ctx2 = this.ctx;
|
|
394340
|
-
const fontSizeScale =
|
|
394341
|
-
const charSpacing =
|
|
394342
|
-
const wordSpacing =
|
|
394343
|
-
const fontDirection =
|
|
394344
|
-
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;
|
|
394345
395108
|
const glyphsLength = glyphs.length;
|
|
394346
395109
|
const vertical = font.vertical;
|
|
394347
395110
|
const spacingDir = vertical ? 1 : -1;
|
|
394348
395111
|
const defaultVMetrics = font.defaultVMetrics;
|
|
394349
|
-
const widthAdvanceScale = fontSize *
|
|
394350
|
-
const simpleFillText =
|
|
395112
|
+
const widthAdvanceScale = fontSize * current6.fontMatrix[0];
|
|
395113
|
+
const simpleFillText = current6.textRenderingMode === TextRenderingMode.FILL && !font.disableFontFace && !current6.patternFill;
|
|
394351
395114
|
ctx2.save();
|
|
394352
|
-
if (
|
|
394353
|
-
ctx2.transform(...
|
|
395115
|
+
if (current6.textMatrix) {
|
|
395116
|
+
ctx2.transform(...current6.textMatrix);
|
|
394354
395117
|
}
|
|
394355
|
-
ctx2.translate(
|
|
395118
|
+
ctx2.translate(current6.x, current6.y + current6.textRise);
|
|
394356
395119
|
if (fontDirection > 0) {
|
|
394357
395120
|
ctx2.scale(textHScale, -1);
|
|
394358
395121
|
} else {
|
|
394359
395122
|
ctx2.scale(textHScale, 1);
|
|
394360
395123
|
}
|
|
394361
395124
|
let patternFillTransform, patternStrokeTransform;
|
|
394362
|
-
const fillStrokeMode =
|
|
395125
|
+
const fillStrokeMode = current6.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
|
394363
395126
|
const needsFill = fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
|
394364
395127
|
const needsStroke = fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
|
394365
|
-
let lineWidth2 =
|
|
394366
|
-
const scale =
|
|
395128
|
+
let lineWidth2 = current6.lineWidth;
|
|
395129
|
+
const scale = current6.textMatrixScale;
|
|
394367
395130
|
if (scale === 0 || lineWidth2 === 0) {
|
|
394368
395131
|
if (needsStroke) {
|
|
394369
395132
|
lineWidth2 = this.getSinglePixelWidth();
|
|
@@ -394376,16 +395139,16 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394376
395139
|
lineWidth2 /= fontSizeScale;
|
|
394377
395140
|
}
|
|
394378
395141
|
ctx2.lineWidth = lineWidth2;
|
|
394379
|
-
if (needsFill &&
|
|
395142
|
+
if (needsFill && current6.patternFill) {
|
|
394380
395143
|
ctx2.save();
|
|
394381
|
-
const pattern =
|
|
395144
|
+
const pattern = current6.fillColor.getPattern(ctx2, this, getCurrentTransformInverse(ctx2), PathType.FILL, opIdx);
|
|
394382
395145
|
patternFillTransform = getCurrentTransform(ctx2);
|
|
394383
395146
|
ctx2.restore();
|
|
394384
395147
|
ctx2.fillStyle = pattern;
|
|
394385
395148
|
}
|
|
394386
|
-
if (needsStroke &&
|
|
395149
|
+
if (needsStroke && current6.patternStroke) {
|
|
394387
395150
|
ctx2.save();
|
|
394388
|
-
const pattern =
|
|
395151
|
+
const pattern = current6.strokeColor.getPattern(ctx2, this, getCurrentTransformInverse(ctx2), PathType.STROKE, opIdx);
|
|
394389
395152
|
patternStrokeTransform = getCurrentTransform(ctx2);
|
|
394390
395153
|
ctx2.restore();
|
|
394391
395154
|
ctx2.strokeStyle = pattern;
|
|
@@ -394403,7 +395166,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394403
395166
|
const measure4 = ctx2.measureText(joinedChars);
|
|
394404
395167
|
this.dependencyTracker.recordBBox(opIdx, this.ctx, -measure4.actualBoundingBoxLeft, measure4.actualBoundingBoxRight, -measure4.actualBoundingBoxAscent, measure4.actualBoundingBoxDescent).recordShowTextOperation(opIdx);
|
|
394405
395168
|
}
|
|
394406
|
-
|
|
395169
|
+
current6.x += width * widthAdvanceScale * textHScale;
|
|
394407
395170
|
ctx2.restore();
|
|
394408
395171
|
this.compose();
|
|
394409
395172
|
this.#endKnockoutElement(started8);
|
|
@@ -394469,9 +395232,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394469
395232
|
}
|
|
394470
395233
|
}
|
|
394471
395234
|
if (vertical) {
|
|
394472
|
-
|
|
395235
|
+
current6.y -= x2;
|
|
394473
395236
|
} else {
|
|
394474
|
-
|
|
395237
|
+
current6.x += x2 * textHScale;
|
|
394475
395238
|
}
|
|
394476
395239
|
ctx2.restore();
|
|
394477
395240
|
this.compose();
|
|
@@ -394480,17 +395243,17 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394480
395243
|
}
|
|
394481
395244
|
showType3Text(opIdx, glyphs) {
|
|
394482
395245
|
const ctx2 = this.ctx;
|
|
394483
|
-
const
|
|
394484
|
-
const font =
|
|
394485
|
-
const fontSize =
|
|
394486
|
-
const fontDirection =
|
|
395246
|
+
const current6 = this.current;
|
|
395247
|
+
const font = current6.font;
|
|
395248
|
+
const fontSize = current6.fontSize;
|
|
395249
|
+
const fontDirection = current6.fontDirection;
|
|
394487
395250
|
const spacingDir = font.vertical ? 1 : -1;
|
|
394488
|
-
const charSpacing =
|
|
394489
|
-
const wordSpacing =
|
|
394490
|
-
const textHScale =
|
|
394491
|
-
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;
|
|
394492
395255
|
const glyphsLength = glyphs.length;
|
|
394493
|
-
const isTextInvisible =
|
|
395256
|
+
const isTextInvisible = current6.textRenderingMode === TextRenderingMode.INVISIBLE;
|
|
394494
395257
|
let i2, glyph2, width, spacingLength;
|
|
394495
395258
|
if (isTextInvisible || fontSize === 0) {
|
|
394496
395259
|
return;
|
|
@@ -394498,10 +395261,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394498
395261
|
this._cachedScaleForStroking[0] = -1;
|
|
394499
395262
|
this._cachedGetSinglePixelWidth = null;
|
|
394500
395263
|
ctx2.save();
|
|
394501
|
-
if (
|
|
394502
|
-
ctx2.transform(...
|
|
395264
|
+
if (current6.textMatrix) {
|
|
395265
|
+
ctx2.transform(...current6.textMatrix);
|
|
394503
395266
|
}
|
|
394504
|
-
ctx2.translate(
|
|
395267
|
+
ctx2.translate(current6.x, current6.y + current6.textRise);
|
|
394505
395268
|
ctx2.scale(textHScale, fontDirection);
|
|
394506
395269
|
const dependencyTracker = this.dependencyTracker;
|
|
394507
395270
|
this.dependencyTracker = dependencyTracker ? new CanvasNestedDependencyTracker(dependencyTracker, opIdx) : null;
|
|
@@ -394510,7 +395273,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394510
395273
|
if (typeof glyph2 === "number") {
|
|
394511
395274
|
spacingLength = spacingDir * glyph2 * fontSize / 1e3;
|
|
394512
395275
|
this.ctx.translate(spacingLength, 0);
|
|
394513
|
-
|
|
395276
|
+
current6.x += spacingLength * textHScale;
|
|
394514
395277
|
continue;
|
|
394515
395278
|
}
|
|
394516
395279
|
const spacing = (glyph2.isSpace ? wordSpacing : 0) + charSpacing;
|
|
@@ -394520,7 +395283,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394520
395283
|
} else if (this.contentVisible) {
|
|
394521
395284
|
this.save();
|
|
394522
395285
|
if (operatorList.fnArray[0] === OPS2.setCharWidth) {
|
|
394523
|
-
|
|
395286
|
+
current6.fillAlpha = current6.strokeAlpha = 1;
|
|
394524
395287
|
ctx2.globalAlpha = 1;
|
|
394525
395288
|
}
|
|
394526
395289
|
ctx2.scale(fontSize, fontSize);
|
|
@@ -394532,7 +395295,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
394532
395295
|
Util.applyTransform(p2, fontMatrix);
|
|
394533
395296
|
width = p2[0] * fontSize + spacing;
|
|
394534
395297
|
ctx2.translate(width, 0);
|
|
394535
|
-
|
|
395298
|
+
current6.x += width * textHScale;
|
|
394536
395299
|
}
|
|
394537
395300
|
ctx2.restore();
|
|
394538
395301
|
if (dependencyTracker) {
|
|
@@ -410658,8 +411421,8 @@ async function ensureBackgroundSession(pluginId, command) {
|
|
|
410658
411421
|
}
|
|
410659
411422
|
async function callPluginTool(plugin, tool2, args2, options) {
|
|
410660
411423
|
const id3 = plugin.manifest.id;
|
|
410661
|
-
const
|
|
410662
|
-
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`);
|
|
410663
411426
|
const session3 = await ensureBackgroundSession(id3, "agent");
|
|
410664
411427
|
if (!session3?.env) throw new Error(`${plugin.manifest.name} could not start`);
|
|
410665
411428
|
const env = session3.env;
|
|
@@ -413426,7 +414189,20 @@ function resilientModel(model, turn, parts) {
|
|
|
413426
414189
|
}
|
|
413427
414190
|
};
|
|
413428
414191
|
}
|
|
413429
|
-
|
|
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;
|
|
413430
414206
|
const model = agentModel2();
|
|
413431
414207
|
if (!model) {
|
|
413432
414208
|
useAgentStore.setState({ error: { message: "Pick a chat model for the agent first.", code: "no_model" } });
|
|
@@ -413461,6 +414237,17 @@ async function drive(meta3, start2) {
|
|
|
413461
414237
|
const readOnly = !!editBlockReason();
|
|
413462
414238
|
registerTurnTools({ readOnly, signal: abort.signal });
|
|
413463
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) };
|
|
413464
414251
|
const tools = loopTools(meta3.skillId);
|
|
413465
414252
|
const canWrite2 = !readOnly && meta3.wantsChange;
|
|
413466
414253
|
const writeTool = tools.some((t3) => t3.spec.function.name === DESIGN_TOOL2) ? DESIGN_TOOL2 : null;
|
|
@@ -413503,7 +414290,9 @@ async function drive(meta3, start2) {
|
|
|
413503
414290
|
isRecoverable: (err2) => !abort.signal.aborted && isInterruption(err2),
|
|
413504
414291
|
requireAction: canWrite2 ? { nudges: ACTION_NUDGES, message: ACTION_NUDGE } : false,
|
|
413505
414292
|
toolChoice: () => guard2.toolChoice(),
|
|
413506
|
-
|
|
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) => {
|
|
413507
414296
|
parts = p2;
|
|
413508
414297
|
flush();
|
|
413509
414298
|
} }),
|
|
@@ -413611,6 +414400,7 @@ async function drive(meta3, start2) {
|
|
|
413611
414400
|
parts = [...parts, { type: "error", message, code }];
|
|
413612
414401
|
}
|
|
413613
414402
|
} finally {
|
|
414403
|
+
endOrchestration(orch);
|
|
413614
414404
|
offPage();
|
|
413615
414405
|
preview.end();
|
|
413616
414406
|
if (abort.signal.aborted) {
|
|
@@ -413641,6 +414431,7 @@ var init_runner = __esm({
|
|
|
413641
414431
|
init_dangerous();
|
|
413642
414432
|
init_skill();
|
|
413643
414433
|
init_prompt();
|
|
414434
|
+
init_orchestration3();
|
|
413644
414435
|
init_skills();
|
|
413645
414436
|
init_parts();
|
|
413646
414437
|
init_store2();
|
|
@@ -416126,6 +416917,13 @@ Every layer call returns its id. **Name** every layer a cue, count or swap must
|
|
|
416126
416917
|
\u2014 live text. \`autoWidth: true\` hugs the words (labels, buttons); \`width: 'FILL'\` wraps in the column.
|
|
416127
416918
|
- \`k.rect(parent, w | 'FILL', h, fill, { radius, stroke, effects, opacity, absolute, name, mask })\`, \`k.ellipse(parent, size, fill, o)\`,
|
|
416128
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: [] })\`.
|
|
416129
416927
|
- \`k.vector(parent, w, h, [paths], fill, { strokeWidth, stroke, absolute, name, effects })\` \u2014 paths are
|
|
416130
416928
|
\`{ closed, points: [{ x, y }] }\` in the vector's own w \xD7 h box. Helpers: \`draw.box\`, \`draw.line\`, \`draw.poly\`,
|
|
416131
416929
|
\`draw.circle\`, \`draw.smooth\`; \`marks.gridPaths\`, \`marks.dotPaths\`, \`marks.confettiPaths\`, \`marks.burstPath\`,
|
|
@@ -418144,7 +418942,6 @@ function registerBuiltinCommands() {
|
|
|
418144
418942
|
var builtinCommands, uiOnlyCommands;
|
|
418145
418943
|
var init_builtin4 = __esm({
|
|
418146
418944
|
"lib/commands/builtin.ts"() {
|
|
418147
|
-
"use strict";
|
|
418148
418945
|
init_registry();
|
|
418149
418946
|
init_node();
|
|
418150
418947
|
init_node();
|
|
@@ -420395,11 +421192,11 @@ var init_editor_store = __esm({
|
|
|
420395
421192
|
return newNode;
|
|
420396
421193
|
};
|
|
420397
421194
|
const traverse = (currentId, sx, sy) => {
|
|
420398
|
-
const
|
|
420399
|
-
if (!
|
|
420400
|
-
newNodes[currentId] = scaleProps(
|
|
420401
|
-
if ("childIds" in
|
|
420402
|
-
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) {
|
|
420403
421200
|
traverse(childId, sx, sy);
|
|
420404
421201
|
}
|
|
420405
421202
|
}
|
|
@@ -420787,10 +421584,10 @@ var init_editor_store = __esm({
|
|
|
420787
421584
|
const state = get4();
|
|
420788
421585
|
const newExpanded = new Set(state.expandedLayerNodes);
|
|
420789
421586
|
ids2.forEach((id3) => {
|
|
420790
|
-
let
|
|
420791
|
-
for (let guard2 = 0;
|
|
420792
|
-
newExpanded.add(
|
|
420793
|
-
|
|
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);
|
|
420794
421591
|
}
|
|
420795
421592
|
});
|
|
420796
421593
|
const cellSel = state.tableCellSelection;
|
|
@@ -420802,10 +421599,10 @@ var init_editor_store = __esm({
|
|
|
420802
421599
|
addToSelection: (id3) => {
|
|
420803
421600
|
const state = get4();
|
|
420804
421601
|
const newExpanded = new Set(state.expandedLayerNodes);
|
|
420805
|
-
let
|
|
420806
|
-
while (
|
|
420807
|
-
newExpanded.add(
|
|
420808
|
-
|
|
421602
|
+
let current6 = state.document.nodes[id3];
|
|
421603
|
+
while (current6 && current6.parentId) {
|
|
421604
|
+
newExpanded.add(current6.parentId);
|
|
421605
|
+
current6 = state.document.nodes[current6.parentId];
|
|
420809
421606
|
}
|
|
420810
421607
|
set4({
|
|
420811
421608
|
selection: [...state.selection, id3],
|
|
@@ -421344,11 +422141,11 @@ var init_editor_store = __esm({
|
|
|
421344
422141
|
if (!pages2.length) return;
|
|
421345
422142
|
const cam = state.camera;
|
|
421346
422143
|
const selected = pages2.findIndex((pg) => state.selection.includes(pg.id));
|
|
421347
|
-
const
|
|
422144
|
+
const current6 = selected >= 0 ? selected : pages2.reduce((best, pg, i2) => {
|
|
421348
422145
|
const d = Math.hypot(pg.x + pg.width / 2 - cam.x, pg.y + pg.height / 2 - cam.y);
|
|
421349
422146
|
return d < best.d ? { i: i2, d } : best;
|
|
421350
422147
|
}, { i: 0, d: Infinity }).i;
|
|
421351
|
-
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);
|
|
421352
422149
|
const page = pages2[Math.max(0, Math.min(pages2.length - 1, target2))];
|
|
421353
422150
|
set4({ selection: [page.id] });
|
|
421354
422151
|
get4().zoomToNodes([page.id], 0.1);
|
|
@@ -425776,7 +426573,7 @@ init_resources();
|
|
|
425776
426573
|
init_desktop();
|
|
425777
426574
|
init_hypery();
|
|
425778
426575
|
import { createInterface } from "node:readline";
|
|
425779
|
-
var VERSION2 = "0.
|
|
426576
|
+
var VERSION2 = "0.58.0";
|
|
425780
426577
|
var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
|
|
425781
426578
|
|
|
425782
426579
|
Files (headless, on .popcraft files):
|