@kombai/cli 0.1.2-beta.3 → 0.1.2-beta.5
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/kombai.mjs +937 -81
- package/dist/mcp-apps/design-taste.js +330 -342
- package/dist/mcp-apps/plans.js +344 -380
- package/dist/mcp-apps/sign-in.js +261 -276
- package/package.json +1 -1
package/dist/kombai.mjs
CHANGED
|
@@ -1161,7 +1161,7 @@ function writeOutcome(stdout, outcome, warnings, pretty) {
|
|
|
1161
1161
|
stdout.write(`${formatJson(body, pretty)}
|
|
1162
1162
|
`);
|
|
1163
1163
|
}
|
|
1164
|
-
var Exit, EXIT_CODE, CliError, Warnings;
|
|
1164
|
+
var Exit, EXIT_CODE, SIGN_IN_NEXT, CliError, Warnings;
|
|
1165
1165
|
var init_output = __esm({
|
|
1166
1166
|
"src/lib/output.js"() {
|
|
1167
1167
|
"use strict";
|
|
@@ -1175,6 +1175,7 @@ var init_output = __esm({
|
|
|
1175
1175
|
TIMED_OUT: 4
|
|
1176
1176
|
});
|
|
1177
1177
|
EXIT_CODE = "__exitCode";
|
|
1178
|
+
SIGN_IN_NEXT = "kombai skill sign-in";
|
|
1178
1179
|
CliError = class extends Error {
|
|
1179
1180
|
/**
|
|
1180
1181
|
* @param {string} code the backend's `errorCode`, or a `CLI_*` code the CLI found itself
|
|
@@ -1465,6 +1466,9 @@ function nameProblem(value, flag) {
|
|
|
1465
1466
|
function orgIdProblem(value) {
|
|
1466
1467
|
return DESIGN_ID.orgId.test(String(value)) ? void 0 : `--org "${value}" is not an organization id`;
|
|
1467
1468
|
}
|
|
1469
|
+
function projectIdProblem(value) {
|
|
1470
|
+
return DESIGN_ID.project.test(String(value)) ? void 0 : `--project "${value}" is not a project id (prj_\u2026)`;
|
|
1471
|
+
}
|
|
1468
1472
|
function badValue(problem) {
|
|
1469
1473
|
return new CliError("CLI_BAD_FLAG", `${problem}.`, { details: { problems: [problem] } });
|
|
1470
1474
|
}
|
|
@@ -1758,7 +1762,7 @@ var init_version = __esm({
|
|
|
1758
1762
|
"src/lib/version.js"() {
|
|
1759
1763
|
"use strict";
|
|
1760
1764
|
init_define_KOMBAI_TELEMETRY();
|
|
1761
|
-
CLI_VERSION = true ? "0.1.2-beta.
|
|
1765
|
+
CLI_VERSION = true ? "0.1.2-beta.5" : (
|
|
1762
1766
|
/** @type {{ version: string }} */
|
|
1763
1767
|
JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version
|
|
1764
1768
|
);
|
|
@@ -1807,10 +1811,12 @@ function apiError(status, body, method, path25) {
|
|
|
1807
1811
|
const guestRow = GUEST_ERRORS[code2];
|
|
1808
1812
|
const needsLogin = status === 401 || guestRow !== void 0;
|
|
1809
1813
|
const text = guestRow?.message?.(rest, typeof apiMessage === "string" ? apiMessage : "") ?? message;
|
|
1814
|
+
const secondCanvas = code2 === "DESIGN_GUEST_LIMIT" && typeof rest.canvasId === "string";
|
|
1815
|
+
const next = needsLogin && !secondCanvas ? SIGN_IN_NEXT : void 0;
|
|
1810
1816
|
return new CliError(code2, text, {
|
|
1811
1817
|
status,
|
|
1812
1818
|
exit: guestRow?.exit ?? (status === 401 ? Exit.NOT_SIGNED_IN : Exit.FAILED),
|
|
1813
|
-
next
|
|
1819
|
+
next,
|
|
1814
1820
|
details: Object.keys(rest).length ? rest : void 0
|
|
1815
1821
|
});
|
|
1816
1822
|
}
|
|
@@ -2052,15 +2058,15 @@ var init_api = __esm({
|
|
|
2052
2058
|
DESIGN_SIGNIN_REQUIRED: { exit: Exit.NOT_SIGNED_IN },
|
|
2053
2059
|
SIGNIN_GUEST_EXPIRED: {
|
|
2054
2060
|
exit: Exit.NOT_SIGNED_IN,
|
|
2055
|
-
message: () => "This guest canvas has expired. Sign in
|
|
2061
|
+
message: () => "This guest canvas has expired. Sign in, or run kombai guest to start again."
|
|
2056
2062
|
},
|
|
2057
2063
|
SIGNIN_GUEST_CLAIMED: {
|
|
2058
2064
|
exit: Exit.NOT_SIGNED_IN,
|
|
2059
|
-
message: () => "This guest canvas now belongs to a Kombai account; sign in
|
|
2065
|
+
message: () => "This guest canvas now belongs to a Kombai account; sign in to reach it."
|
|
2060
2066
|
},
|
|
2061
2067
|
DESIGN_GUEST_LIMIT: {
|
|
2062
2068
|
exit: Exit.FAILED,
|
|
2063
|
-
message: (details, apiMessage) => typeof details.canvasId === "string" ? `A guest has one canvas, ${details.canvasId}: use it, or sign in
|
|
2069
|
+
message: (details, apiMessage) => typeof details.canvasId === "string" ? `A guest has one canvas, ${details.canvasId}: use it, or sign in for more.` : `This guest canvas is full: ${sentence(apiMessage || "it has no room left")} Sign in to keep going; signing in keeps the canvas.`
|
|
2064
2070
|
},
|
|
2065
2071
|
SIGNIN_GUEST_RATE: { exit: Exit.FAILED }
|
|
2066
2072
|
};
|
|
@@ -2371,7 +2377,7 @@ var init_store = __esm({
|
|
|
2371
2377
|
init_fsx();
|
|
2372
2378
|
init_lock();
|
|
2373
2379
|
init_output();
|
|
2374
|
-
SIGN_IN_AGAIN = "that signs this machine out, so
|
|
2380
|
+
SIGN_IN_AGAIN = "that signs this machine out, so sign in again after.";
|
|
2375
2381
|
NEW_MACHINE_ID = "the CLI then makes a new machine id.";
|
|
2376
2382
|
KEY_FIELDS = Object.freeze(["key", "keyId", "userId", "email", "expires"]);
|
|
2377
2383
|
GUEST_FIELDS = Object.freeze(["guest", "guestId", "canvasId", "guestExpires", "claimOrgs"]);
|
|
@@ -2382,7 +2388,7 @@ var init_store = __esm({
|
|
|
2382
2388
|
async function openSession(ctx, options = {}) {
|
|
2383
2389
|
const session = await openAnySession(ctx, options);
|
|
2384
2390
|
if (session.kind === "guest") {
|
|
2385
|
-
throw signInRequired("This needs a Kombai account, and this machine is a guest
|
|
2391
|
+
throw signInRequired("This needs a Kombai account, and this machine is a guest: sign in first.");
|
|
2386
2392
|
}
|
|
2387
2393
|
return session;
|
|
2388
2394
|
}
|
|
@@ -2420,7 +2426,7 @@ function isPureGuest(entry) {
|
|
|
2420
2426
|
async function refuseGuest(ctx) {
|
|
2421
2427
|
const { env } = await currentEnv(ctx);
|
|
2422
2428
|
if (isPureGuest(await readEntry(ctx.home, env)))
|
|
2423
|
-
throw signInRequired("This needs a Kombai account, and this machine is a guest
|
|
2429
|
+
throw signInRequired("This needs a Kombai account, and this machine is a guest: sign in first.");
|
|
2424
2430
|
}
|
|
2425
2431
|
function guestHooks(ctx, env, guest2) {
|
|
2426
2432
|
if (!guest2) return {};
|
|
@@ -2440,7 +2446,7 @@ function guestHooks(ctx, env, guest2) {
|
|
|
2440
2446
|
function notSignedIn(message, reason) {
|
|
2441
2447
|
return new CliError("CLI_NOT_SIGNED_IN", message, {
|
|
2442
2448
|
exit: Exit.NOT_SIGNED_IN,
|
|
2443
|
-
next:
|
|
2449
|
+
next: SIGN_IN_NEXT,
|
|
2444
2450
|
details: { reason }
|
|
2445
2451
|
});
|
|
2446
2452
|
}
|
|
@@ -2452,7 +2458,7 @@ function holdsAccount(entry) {
|
|
|
2452
2458
|
return typeof entry.key === "string" && entry.key !== "" || entry.signedIn !== void 0;
|
|
2453
2459
|
}
|
|
2454
2460
|
function signInRequired(message, details) {
|
|
2455
|
-
return new CliError("CLI_SIGNIN_REQUIRED", message, { exit: Exit.NOT_SIGNED_IN, next:
|
|
2461
|
+
return new CliError("CLI_SIGNIN_REQUIRED", message, { exit: Exit.NOT_SIGNED_IN, next: SIGN_IN_NEXT, details });
|
|
2456
2462
|
}
|
|
2457
2463
|
async function forgetKey(home, env, key, reason) {
|
|
2458
2464
|
await updateEntry(home, env, (entry) => {
|
|
@@ -3459,10 +3465,7 @@ function heldLine(ctx, env, entry) {
|
|
|
3459
3465
|
const credential = keyOf(entry);
|
|
3460
3466
|
if (credential && Date.parse(credential.expires) > ctx.now()) return keyLine(credential, env, entry);
|
|
3461
3467
|
if (holdsAccount(entry)) {
|
|
3462
|
-
throw notSignedIn(
|
|
3463
|
-
"This machine has signed in to Kombai before; sign in again with kombai login.",
|
|
3464
|
-
notSignedInReason(entry)
|
|
3465
|
-
);
|
|
3468
|
+
throw notSignedIn("This machine has signed in to Kombai before; sign in again.", notSignedInReason(entry));
|
|
3466
3469
|
}
|
|
3467
3470
|
return hasGuest(entry) ? guestLine(entry, env) : null;
|
|
3468
3471
|
}
|
|
@@ -3482,8 +3485,8 @@ function whoamiLine(ctx, env, entry) {
|
|
|
3482
3485
|
status: "guest",
|
|
3483
3486
|
guestId: entry.guestId,
|
|
3484
3487
|
canvas: entry.canvasId ?? null,
|
|
3485
|
-
expires: entry.guestExpires ?? null
|
|
3486
|
-
next:
|
|
3488
|
+
expires: entry.guestExpires ?? null
|
|
3489
|
+
// No next: a guest already chose to try Kombai without an account, and the sign-in topic says to work on as one.
|
|
3487
3490
|
};
|
|
3488
3491
|
}
|
|
3489
3492
|
function keyLine(credential, env, entry) {
|
|
@@ -3510,10 +3513,10 @@ function unavailable(error2, again) {
|
|
|
3510
3513
|
error2.next = again;
|
|
3511
3514
|
return error2;
|
|
3512
3515
|
}
|
|
3513
|
-
function loginExpired() {
|
|
3516
|
+
function loginExpired(again) {
|
|
3514
3517
|
return new CliError("CLI_LOGIN_EXPIRED", "The sign-in code expired before it was approved.", {
|
|
3515
3518
|
exit: Exit.TIMED_OUT,
|
|
3516
|
-
next:
|
|
3519
|
+
next: again
|
|
3517
3520
|
});
|
|
3518
3521
|
}
|
|
3519
3522
|
var REUSE_KEY_MS, POLL_MS2, RSA_BITS, LOGIN_WINDOW_MS, login, logout, whoami, guest, claim;
|
|
@@ -3536,13 +3539,15 @@ var init_auth = __esm({
|
|
|
3536
3539
|
LOGIN_WINDOW_MS = 6e5;
|
|
3537
3540
|
login = {
|
|
3538
3541
|
name: "login",
|
|
3539
|
-
summary: "Sign in through the browser. Prints a waiting line with a match code at once, then the signed-in line. A key with more than 3 days left is reused. With a guest token here, it then claims the guest canvas into the account.",
|
|
3542
|
+
summary: "Sign in through the browser. Prints a waiting line with a match code at once, then the signed-in line. --no-browser opens nothing: an agent with a browser panel the user can see runs it so and opens the waiting line's url there. A key with more than 3 days left is reused. With a guest token here, it then claims the guest canvas into the account.",
|
|
3540
3543
|
flags: {
|
|
3541
3544
|
force: { type: "boolean" },
|
|
3542
3545
|
"no-browser": { type: "boolean" }
|
|
3543
3546
|
},
|
|
3544
3547
|
example: "kombai login",
|
|
3545
3548
|
async run(ctx, { flags }) {
|
|
3549
|
+
const asked = ["kombai login", flags.force ? "--force" : "", flags["no-browser"] ? "--no-browser" : ""].filter(Boolean).join(" ");
|
|
3550
|
+
const again = asked === "kombai login" ? SIGN_IN_NEXT : asked;
|
|
3546
3551
|
const { env, hosts } = await currentEnv(ctx);
|
|
3547
3552
|
const existing = await readCredential(ctx.home, env);
|
|
3548
3553
|
if (!flags.force && existing && Date.parse(existing.expires) - ctx.now() > REUSE_KEY_MS) {
|
|
@@ -3570,11 +3575,11 @@ var init_auth = __esm({
|
|
|
3570
3575
|
});
|
|
3571
3576
|
const b = res.body;
|
|
3572
3577
|
if (!b || typeof b.code !== "string" || typeof b.matchCode !== "string" || typeof b.approveUrl !== "string" || !b.approveUrl.startsWith(`${hosts.web}/`) || !Number.isFinite(Date.parse(b.expiresAt)))
|
|
3573
|
-
throw new CliError("CLI_BAD_ANSWER", "The sign-in answer was not a login code.", { next:
|
|
3578
|
+
throw new CliError("CLI_BAD_ANSWER", "The sign-in answer was not a login code.", { next: again });
|
|
3574
3579
|
started = b;
|
|
3575
3580
|
serverDate = res.headers.get("date");
|
|
3576
3581
|
} catch (error2) {
|
|
3577
|
-
if (error2 instanceof LostAnswer) error2.next =
|
|
3582
|
+
if (error2 instanceof LostAnswer) error2.next = again;
|
|
3578
3583
|
throw error2;
|
|
3579
3584
|
}
|
|
3580
3585
|
ctx.emit({
|
|
@@ -3597,9 +3602,9 @@ var init_auth = __esm({
|
|
|
3597
3602
|
})).body;
|
|
3598
3603
|
} catch (error2) {
|
|
3599
3604
|
if (!(error2 instanceof CliError)) throw error2;
|
|
3600
|
-
if (error2.code === "CLI_TIMEOUT") throw loginExpired();
|
|
3605
|
+
if (error2.code === "CLI_TIMEOUT") throw loginExpired(again);
|
|
3601
3606
|
if (error2.code === "SIGNIN_LOGIN_GONE") {
|
|
3602
|
-
error2.next =
|
|
3607
|
+
error2.next = again;
|
|
3603
3608
|
throw error2;
|
|
3604
3609
|
}
|
|
3605
3610
|
if (!(error2 instanceof LostAnswer) && error2.status !== 503) throw error2;
|
|
@@ -3620,7 +3625,7 @@ var init_auth = __esm({
|
|
|
3620
3625
|
await writeCredential(ctx.home, env, credential);
|
|
3621
3626
|
return { status: "signed_in", ...identity(credential, env), ...await claimGuest(ctx, env) };
|
|
3622
3627
|
}
|
|
3623
|
-
if (deadline.remaining() <= POLL_MS2) throw loginExpired();
|
|
3628
|
+
if (deadline.remaining() <= POLL_MS2) throw loginExpired(again);
|
|
3624
3629
|
await ctx.sleep(POLL_MS2);
|
|
3625
3630
|
}
|
|
3626
3631
|
}
|
|
@@ -3676,7 +3681,7 @@ var init_auth = __esm({
|
|
|
3676
3681
|
};
|
|
3677
3682
|
guest = {
|
|
3678
3683
|
name: "guest",
|
|
3679
|
-
summary: "Try Kombai without an account: one canvas, no taste runs, repo images, design systems or sharing. Run it only when the user chose that.
|
|
3684
|
+
summary: "Try Kombai without an account: one canvas, no taste runs, repo images, design systems or sharing. Run it only when the user chose that. Signing in later keeps the canvas.",
|
|
3680
3685
|
async run(ctx) {
|
|
3681
3686
|
const { env, hosts } = await currentEnv(ctx);
|
|
3682
3687
|
const held = heldLine(ctx, env, await readEntry(ctx.home, env));
|
|
@@ -6249,25 +6254,812 @@ var init_tailwind_detection = __esm({
|
|
|
6249
6254
|
}
|
|
6250
6255
|
});
|
|
6251
6256
|
|
|
6257
|
+
// ../design-mode/packages/shared/src/convert-viewport-units.ts
|
|
6258
|
+
function convertViewportUnits(html, vw, vh) {
|
|
6259
|
+
if (!html) return html;
|
|
6260
|
+
const min = Math.min(vw, vh);
|
|
6261
|
+
const max = Math.max(vw, vh);
|
|
6262
|
+
return html.replace(UNIT_PATTERN, (_, n, unit) => {
|
|
6263
|
+
const num = parseFloat(n);
|
|
6264
|
+
const u = unit.toLowerCase();
|
|
6265
|
+
let base;
|
|
6266
|
+
if (u.endsWith("vmin")) base = min;
|
|
6267
|
+
else if (u.endsWith("vmax")) base = max;
|
|
6268
|
+
else if (u.endsWith("vw")) base = vw;
|
|
6269
|
+
else base = vh;
|
|
6270
|
+
return `${Math.round(num * base / 100)}px`;
|
|
6271
|
+
});
|
|
6272
|
+
}
|
|
6273
|
+
function buildViewportUnitOverrideCss(vw, vh) {
|
|
6274
|
+
return `
|
|
6275
|
+
.h-screen, .h-dvh, .h-svh, .h-lvh { height: ${vh}px !important; }
|
|
6276
|
+
.min-h-screen, .min-h-dvh, .min-h-svh, .min-h-lvh { min-height: ${vh}px !important; }
|
|
6277
|
+
.max-h-screen, .max-h-dvh, .max-h-svh, .max-h-lvh { max-height: ${vh}px !important; }
|
|
6278
|
+
.w-screen, .w-dvw, .w-svw, .w-lvw { width: ${vw}px !important; }
|
|
6279
|
+
.min-w-screen, .min-w-dvw, .min-w-svw, .min-w-lvw { min-width: ${vw}px !important; }
|
|
6280
|
+
.max-w-screen, .max-w-dvw, .max-w-svw, .max-w-lvw { max-width: ${vw}px !important; }
|
|
6281
|
+
`;
|
|
6282
|
+
}
|
|
6283
|
+
var UNIT_SOURCE, UNIT_PATTERN, HAS_UNIT;
|
|
6284
|
+
var init_convert_viewport_units = __esm({
|
|
6285
|
+
"../design-mode/packages/shared/src/convert-viewport-units.ts"() {
|
|
6286
|
+
"use strict";
|
|
6287
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6288
|
+
UNIT_SOURCE = String.raw`(-?\d*\.?\d+)(dvh|svh|lvh|vh|dvw|svw|lvw|vw|dvmin|svmin|lvmin|vmin|dvmax|svmax|lvmax|vmax)\b`;
|
|
6289
|
+
UNIT_PATTERN = new RegExp(UNIT_SOURCE, "gi");
|
|
6290
|
+
HAS_UNIT = new RegExp(UNIT_SOURCE, "i");
|
|
6291
|
+
}
|
|
6292
|
+
});
|
|
6293
|
+
|
|
6294
|
+
// ../design-mode/packages/shared/src/screenshot-height-metadata.ts
|
|
6295
|
+
var INTRINSIC_VIEWPORT_HEIGHT;
|
|
6296
|
+
var init_screenshot_height_metadata = __esm({
|
|
6297
|
+
"../design-mode/packages/shared/src/screenshot-height-metadata.ts"() {
|
|
6298
|
+
"use strict";
|
|
6299
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6300
|
+
INTRINSIC_VIEWPORT_HEIGHT = 1e3;
|
|
6301
|
+
}
|
|
6302
|
+
});
|
|
6303
|
+
|
|
6304
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/match-media-patch.ts
|
|
6305
|
+
var MATCH_MEDIA_PATCH;
|
|
6306
|
+
var init_match_media_patch = __esm({
|
|
6307
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/match-media-patch.ts"() {
|
|
6308
|
+
"use strict";
|
|
6309
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6310
|
+
MATCH_MEDIA_PATCH = `
|
|
6311
|
+
try {
|
|
6312
|
+
var origMM = window.matchMedia ? window.matchMedia.bind(window) : null;
|
|
6313
|
+
window.matchMedia = function (q) {
|
|
6314
|
+
var base = origMM ? origMM(q) : {
|
|
6315
|
+
media: q, matches: false, onchange: null,
|
|
6316
|
+
addListener: function () {}, removeListener: function () {},
|
|
6317
|
+
addEventListener: function () {}, removeEventListener: function () {},
|
|
6318
|
+
dispatchEvent: function () { return false; }
|
|
6319
|
+
};
|
|
6320
|
+
if (typeof q === 'string' && /prefers-reduced-motion/i.test(q)) {
|
|
6321
|
+
return new Proxy(base, {
|
|
6322
|
+
get: function (t, p) {
|
|
6323
|
+
if (p === 'matches') return true;
|
|
6324
|
+
if (p === 'media') return q;
|
|
6325
|
+
var v = t[p];
|
|
6326
|
+
return typeof v === 'function' ? v.bind(t) : v;
|
|
6327
|
+
}
|
|
6328
|
+
});
|
|
6329
|
+
}
|
|
6330
|
+
return base;
|
|
6331
|
+
};
|
|
6332
|
+
} catch (e) {}
|
|
6333
|
+
`;
|
|
6334
|
+
}
|
|
6335
|
+
});
|
|
6336
|
+
|
|
6337
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/css-freeze.ts
|
|
6338
|
+
var CSS_FREEZE;
|
|
6339
|
+
var init_css_freeze = __esm({
|
|
6340
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/css-freeze.ts"() {
|
|
6341
|
+
"use strict";
|
|
6342
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6343
|
+
CSS_FREEZE = `
|
|
6344
|
+
function installFreezeStyle() {
|
|
6345
|
+
var s = document.createElement('style');
|
|
6346
|
+
s.setAttribute('data-screenshot-freeze', '1');
|
|
6347
|
+
s.textContent = '*, *::before, *::after {' +
|
|
6348
|
+
'animation-duration: 0s !important;' +
|
|
6349
|
+
'animation-delay: 0s !important;' +
|
|
6350
|
+
'transition-duration: 0s !important;' +
|
|
6351
|
+
'transition-delay: 0s !important;' +
|
|
6352
|
+
'caret-color: transparent !important;' +
|
|
6353
|
+
'}';
|
|
6354
|
+
(document.head || document.documentElement).appendChild(s);
|
|
6355
|
+
}
|
|
6356
|
+
if (document.head) {
|
|
6357
|
+
installFreezeStyle();
|
|
6358
|
+
} else {
|
|
6359
|
+
var moHead = new MutationObserver(function (_, obs) {
|
|
6360
|
+
if (document.head) { installFreezeStyle(); obs.disconnect(); }
|
|
6361
|
+
});
|
|
6362
|
+
moHead.observe(document.documentElement, { childList: true, subtree: true });
|
|
6363
|
+
}
|
|
6364
|
+
`;
|
|
6365
|
+
}
|
|
6366
|
+
});
|
|
6367
|
+
|
|
6368
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/detected.ts
|
|
6369
|
+
var DETECT_SNIPPET;
|
|
6370
|
+
var init_detected = __esm({
|
|
6371
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/detected.ts"() {
|
|
6372
|
+
"use strict";
|
|
6373
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6374
|
+
DETECT_SNIPPET = `
|
|
6375
|
+
var __root = document.documentElement;
|
|
6376
|
+
var __hasGsap = typeof window.gsap !== 'undefined';
|
|
6377
|
+
var detected = {
|
|
6378
|
+
lenis: !!(window.lenis || window.__lenis ||
|
|
6379
|
+
__root.classList.contains('lenis') || __root.classList.contains('lenis-smooth')),
|
|
6380
|
+
locomotive: !!(window.locomotive || window.LocomotiveScroll ||
|
|
6381
|
+
__root.classList.contains('has-scroll-smooth') ||
|
|
6382
|
+
!!document.querySelector('[data-scroll-container]')),
|
|
6383
|
+
gsap: __hasGsap,
|
|
6384
|
+
scrolltrigger: !!(window.ScrollTrigger ||
|
|
6385
|
+
(__hasGsap && window.gsap.core && typeof window.gsap.core.getCache === 'function')),
|
|
6386
|
+
anime: typeof window.anime !== 'undefined',
|
|
6387
|
+
animeV4: !!(window.anime && window.anime.engine),
|
|
6388
|
+
motion: typeof window.motion !== 'undefined',
|
|
6389
|
+
waapi_active: document.getAnimations ? document.getAnimations().length : 0
|
|
6390
|
+
};
|
|
6391
|
+
// Read back by the renderer (render.ts) to decide whether the page is worth a live re-measure.
|
|
6392
|
+
window.__kombaiDetected = detected;
|
|
6393
|
+
log('detected', detected);
|
|
6394
|
+
`;
|
|
6395
|
+
}
|
|
6396
|
+
});
|
|
6397
|
+
|
|
6398
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/lenis.ts
|
|
6399
|
+
var LENIS_TEARDOWN;
|
|
6400
|
+
var init_lenis = __esm({
|
|
6401
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/lenis.ts"() {
|
|
6402
|
+
"use strict";
|
|
6403
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6404
|
+
LENIS_TEARDOWN = `
|
|
6405
|
+
var __lenisRoot = document.documentElement;
|
|
6406
|
+
if (
|
|
6407
|
+
window.lenis || window.__lenis ||
|
|
6408
|
+
__lenisRoot.classList.contains('lenis') ||
|
|
6409
|
+
__lenisRoot.classList.contains('lenis-smooth')
|
|
6410
|
+
) {
|
|
6411
|
+
try { window.lenis && window.lenis.destroy && window.lenis.destroy(); } catch (e) {}
|
|
6412
|
+
try { window.__lenis && window.__lenis.destroy && window.__lenis.destroy(); } catch (e) {}
|
|
6413
|
+
__lenisRoot.classList.remove('lenis', 'lenis-smooth', 'lenis-scrolling', 'lenis-stopped');
|
|
6414
|
+
__lenisRoot.style.scrollBehavior = 'auto';
|
|
6415
|
+
var __lenisUnstuck = document.createElement('style');
|
|
6416
|
+
__lenisUnstuck.textContent =
|
|
6417
|
+
'html, body { overflow: auto !important; height: auto !important; }' +
|
|
6418
|
+
'.lenis, .lenis-content, .smooth-wrapper { transform: none !important; }';
|
|
6419
|
+
document.head.appendChild(__lenisUnstuck);
|
|
6420
|
+
}
|
|
6421
|
+
`;
|
|
6422
|
+
}
|
|
6423
|
+
});
|
|
6424
|
+
|
|
6425
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/locomotive.ts
|
|
6426
|
+
var LOCOMOTIVE_TEARDOWN;
|
|
6427
|
+
var init_locomotive = __esm({
|
|
6428
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/locomotive.ts"() {
|
|
6429
|
+
"use strict";
|
|
6430
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6431
|
+
LOCOMOTIVE_TEARDOWN = `
|
|
6432
|
+
var __locoRoot = document.documentElement;
|
|
6433
|
+
if (
|
|
6434
|
+
window.locomotive || window.LocomotiveScroll ||
|
|
6435
|
+
__locoRoot.classList.contains('has-scroll-smooth') ||
|
|
6436
|
+
!!document.querySelector('[data-scroll-container]') ||
|
|
6437
|
+
!!document.querySelector('[data-scroll]')
|
|
6438
|
+
) {
|
|
6439
|
+
try { window.locomotive && window.locomotive.destroy && window.locomotive.destroy(); } catch (e) {}
|
|
6440
|
+
__locoRoot.classList.remove('has-scroll-smooth', 'has-scroll-init');
|
|
6441
|
+
__locoRoot.style.scrollBehavior = 'auto';
|
|
6442
|
+
var __locoUnstuck = document.createElement('style');
|
|
6443
|
+
__locoUnstuck.textContent =
|
|
6444
|
+
'html, body { overflow: auto !important; height: auto !important; }' +
|
|
6445
|
+
'[data-scroll-container] { transform: none !important; }';
|
|
6446
|
+
document.head.appendChild(__locoUnstuck);
|
|
6447
|
+
try {
|
|
6448
|
+
var __locoReveal = document.querySelectorAll('[data-scroll]');
|
|
6449
|
+
for (var __li = 0; __li < __locoReveal.length; __li++) {
|
|
6450
|
+
__locoReveal[__li].classList.add('is-inview', 'is-visible', 'is-revealed');
|
|
6451
|
+
}
|
|
6452
|
+
} catch (e) {}
|
|
6453
|
+
}
|
|
6454
|
+
`;
|
|
6455
|
+
}
|
|
6456
|
+
});
|
|
6457
|
+
|
|
6458
|
+
// src/render/design-mode-shared.js
|
|
6459
|
+
var init_design_mode_shared = __esm({
|
|
6460
|
+
"src/render/design-mode-shared.js"() {
|
|
6461
|
+
"use strict";
|
|
6462
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6463
|
+
init_tailwind_detection();
|
|
6464
|
+
init_tailwind_script();
|
|
6465
|
+
}
|
|
6466
|
+
});
|
|
6467
|
+
|
|
6468
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-ready.ts
|
|
6469
|
+
var TAILWIND_READY_PREDICATE, TAILWIND_WAIT_PREDICATE, TAILWIND_READY_TIMEOUT_MS;
|
|
6470
|
+
var init_tailwind_ready = __esm({
|
|
6471
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-ready.ts"() {
|
|
6472
|
+
"use strict";
|
|
6473
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6474
|
+
init_design_mode_shared();
|
|
6475
|
+
TAILWIND_READY_PREDICATE = `(() => {
|
|
6476
|
+
const probe = document.querySelector('[${TAILWIND_PROBE_ATTR}]');
|
|
6477
|
+
if (probe) return getComputedStyle(probe).display === 'flex';
|
|
6478
|
+
return !document.querySelector(${JSON.stringify(TAILWIND_DOCUMENT_SELECTOR)});
|
|
6479
|
+
})()`;
|
|
6480
|
+
TAILWIND_WAIT_PREDICATE = `(() => {
|
|
6481
|
+
const probe = document.querySelector('[${TAILWIND_PROBE_ATTR}]');
|
|
6482
|
+
if (probe) return getComputedStyle(probe).display === 'flex';
|
|
6483
|
+
if (!document.querySelector(${JSON.stringify(TAILWIND_DOCUMENT_SELECTOR)})) return true;
|
|
6484
|
+
const el = document.querySelector('.overflow-hidden, .overflow-x-hidden');
|
|
6485
|
+
if (el) return getComputedStyle(el).overflow !== 'visible';
|
|
6486
|
+
const flexEl = document.querySelector('.flex');
|
|
6487
|
+
if (flexEl) return getComputedStyle(flexEl).display === 'flex';
|
|
6488
|
+
return true;
|
|
6489
|
+
})()`;
|
|
6490
|
+
TAILWIND_READY_TIMEOUT_MS = 5e3;
|
|
6491
|
+
}
|
|
6492
|
+
});
|
|
6493
|
+
|
|
6494
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-gate.ts
|
|
6495
|
+
var TAILWIND_READY_GATE;
|
|
6496
|
+
var init_tailwind_gate = __esm({
|
|
6497
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-gate.ts"() {
|
|
6498
|
+
"use strict";
|
|
6499
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6500
|
+
init_design_mode_shared();
|
|
6501
|
+
init_tailwind_ready();
|
|
6502
|
+
TAILWIND_READY_GATE = `
|
|
6503
|
+
// A design script can replace <body> wholesale and take the sentinel with it. prepare() runs
|
|
6504
|
+
// on 'load', AFTER those scripts, so this is the first safe point to notice and repair it.
|
|
6505
|
+
// The <script> tag lives in <head> and survives a body wipe, which is how we know the
|
|
6506
|
+
// sentinel was ours to restore rather than one this document never had.
|
|
6507
|
+
//
|
|
6508
|
+
// Re-run on EVERY iteration, not once before the loop: a framework that mounts into <body>
|
|
6509
|
+
// asynchronously can wipe the sentinel at any point during the window, and by construction we
|
|
6510
|
+
// are only still in this loop because Tailwind has not finished compiling \u2014 i.e. on exactly
|
|
6511
|
+
// the heavy, JS-app pages most likely to re-mount. A one-shot restore would leave the
|
|
6512
|
+
// sentinel destroyed for the rest of the window, and render.ts's VERDICT predicate (which
|
|
6513
|
+
// polls concurrently, and now reads a destroyed sentinel as NOT ready) would then refuse a
|
|
6514
|
+
// capture that only needed the sentinel put back.
|
|
6515
|
+
var __twRestoreProbe = function () {
|
|
6516
|
+
try {
|
|
6517
|
+
if (!document.querySelector('[${TAILWIND_PROBE_ATTR}]') &&
|
|
6518
|
+
document.querySelector(${JSON.stringify(TAILWIND_DOCUMENT_SELECTOR)})) {
|
|
6519
|
+
document.body.insertAdjacentHTML('beforeend', ${JSON.stringify(TAILWIND_PROBE_HTML)});
|
|
6520
|
+
}
|
|
6521
|
+
} catch (e) {}
|
|
6522
|
+
};
|
|
6523
|
+
__twRestoreProbe();
|
|
6524
|
+
var __twGateDeadline = performance.now() + ${TAILWIND_READY_TIMEOUT_MS};
|
|
6525
|
+
while (!(${TAILWIND_WAIT_PREDICATE}) && performance.now() < __twGateDeadline) {
|
|
6526
|
+
await raf();
|
|
6527
|
+
__twRestoreProbe();
|
|
6528
|
+
}
|
|
6529
|
+
await raf(); await raf();
|
|
6530
|
+
`;
|
|
6531
|
+
}
|
|
6532
|
+
});
|
|
6533
|
+
|
|
6534
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-asset-watch.ts
|
|
6535
|
+
var TAILWIND_ASSET_FAILED_FLAG, TAILWIND_ASSET_WATCH, TAILWIND_ASSET_FAILED_PREDICATE;
|
|
6536
|
+
var init_tailwind_asset_watch = __esm({
|
|
6537
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-asset-watch.ts"() {
|
|
6538
|
+
"use strict";
|
|
6539
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6540
|
+
init_design_mode_shared();
|
|
6541
|
+
TAILWIND_ASSET_FAILED_FLAG = "__kombaiTailwindAssetFailed";
|
|
6542
|
+
TAILWIND_ASSET_WATCH = `
|
|
6543
|
+
window.${TAILWIND_ASSET_FAILED_FLAG} = false;
|
|
6544
|
+
document.addEventListener('error', function (e) {
|
|
6545
|
+
var t = e && e.target;
|
|
6546
|
+
if (!t || t.tagName !== 'SCRIPT') return;
|
|
6547
|
+
if (!t.matches(${JSON.stringify(TAILWIND_RUNTIME_SELECTOR)})) return;
|
|
6548
|
+
window.${TAILWIND_ASSET_FAILED_FLAG} = true;
|
|
6549
|
+
}, true);
|
|
6550
|
+
`;
|
|
6551
|
+
TAILWIND_ASSET_FAILED_PREDICATE = `window.${TAILWIND_ASSET_FAILED_FLAG} === true`;
|
|
6552
|
+
}
|
|
6553
|
+
});
|
|
6554
|
+
|
|
6555
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/scroll-sweep.ts
|
|
6556
|
+
var SCROLL_SWEEP;
|
|
6557
|
+
var init_scroll_sweep = __esm({
|
|
6558
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/scroll-sweep.ts"() {
|
|
6559
|
+
"use strict";
|
|
6560
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6561
|
+
SCROLL_SWEEP = `
|
|
6562
|
+
var __sweepDeadline = performance.now() + 3000;
|
|
6563
|
+
|
|
6564
|
+
// Inner scrollers first. ScrollTrigger.batch({ scroller }) and
|
|
6565
|
+
// IntersectionObserver({ root }) reveals bind to a custom overflow-y panel,
|
|
6566
|
+
// not window \u2014 scrolling window alone never fires them. (When such a panel is
|
|
6567
|
+
// driven by a smooth-scroll lib we couldn't tear down, this sweep is swallowed
|
|
6568
|
+
// and the reveal-catchall pass is the backstop.)
|
|
6569
|
+
try {
|
|
6570
|
+
var __all = document.querySelectorAll('*');
|
|
6571
|
+
var __scrollers = [];
|
|
6572
|
+
for (var __i = 0; __i < __all.length; __i++) {
|
|
6573
|
+
var __el = __all[__i];
|
|
6574
|
+
var __cs = getComputedStyle(__el);
|
|
6575
|
+
var __oy = __cs.overflowY, __o = __cs.overflow;
|
|
6576
|
+
if ((__oy === 'auto' || __oy === 'scroll' || __o === 'auto' || __o === 'scroll') &&
|
|
6577
|
+
__el.scrollHeight > __el.clientHeight + 4) {
|
|
6578
|
+
__scrollers.push(__el);
|
|
6579
|
+
}
|
|
6580
|
+
}
|
|
6581
|
+
for (var __si = 0; __si < __scrollers.length && performance.now() < __sweepDeadline; __si++) {
|
|
6582
|
+
var __sc = __scrollers[__si];
|
|
6583
|
+
var __scStep = Math.max(__sc.clientHeight / 2, 400);
|
|
6584
|
+
for (var __scY = 0; __scY < __sc.scrollHeight && performance.now() < __sweepDeadline; __scY += __scStep) {
|
|
6585
|
+
__sc.scrollTop = __scY;
|
|
6586
|
+
await raf();
|
|
6587
|
+
}
|
|
6588
|
+
__sc.scrollTop = 0;
|
|
6589
|
+
await raf();
|
|
6590
|
+
}
|
|
6591
|
+
} catch (e) {}
|
|
6592
|
+
|
|
6593
|
+
var __sweepStep = Math.max(window.innerHeight / 2, 600);
|
|
6594
|
+
for (var __sweepY = 0; __sweepY < document.body.scrollHeight && performance.now() < __sweepDeadline; __sweepY += __sweepStep) {
|
|
6595
|
+
window.scrollTo(0, __sweepY);
|
|
6596
|
+
await raf();
|
|
6597
|
+
}
|
|
6598
|
+
window.scrollTo(0, 0);
|
|
6599
|
+
await raf();
|
|
6600
|
+
`;
|
|
6601
|
+
}
|
|
6602
|
+
});
|
|
6603
|
+
|
|
6604
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/image-wait.ts
|
|
6605
|
+
var IMAGE_WAIT;
|
|
6606
|
+
var init_image_wait = __esm({
|
|
6607
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/image-wait.ts"() {
|
|
6608
|
+
"use strict";
|
|
6609
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6610
|
+
IMAGE_WAIT = `
|
|
6611
|
+
var __imgs = Array.prototype.slice.call(document.images);
|
|
6612
|
+
__imgs.forEach(function (img) {
|
|
6613
|
+
if (img.loading === 'lazy') img.loading = 'eager';
|
|
6614
|
+
});
|
|
6615
|
+
var __imgAll = Promise.all(__imgs.map(function (img) {
|
|
6616
|
+
var __loaded = img.complete
|
|
6617
|
+
? Promise.resolve()
|
|
6618
|
+
: new Promise(function (resolve) {
|
|
6619
|
+
img.addEventListener('load', resolve, { once: true });
|
|
6620
|
+
img.addEventListener('error', resolve, { once: true });
|
|
6621
|
+
});
|
|
6622
|
+
return __loaded.then(function () {
|
|
6623
|
+
try { return img.decode ? img.decode().catch(function () {}) : undefined; }
|
|
6624
|
+
catch (e) {}
|
|
6625
|
+
});
|
|
6626
|
+
}));
|
|
6627
|
+
await Promise.race([
|
|
6628
|
+
__imgAll,
|
|
6629
|
+
new Promise(function (resolve) { setTimeout(resolve, 6000); })
|
|
6630
|
+
]);
|
|
6631
|
+
`;
|
|
6632
|
+
}
|
|
6633
|
+
});
|
|
6634
|
+
|
|
6635
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/scrolltrigger.ts
|
|
6636
|
+
var SCROLLTRIGGER_FAST_FORWARD;
|
|
6637
|
+
var init_scrolltrigger = __esm({
|
|
6638
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/scrolltrigger.ts"() {
|
|
6639
|
+
"use strict";
|
|
6640
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6641
|
+
SCROLLTRIGGER_FAST_FORWARD = `
|
|
6642
|
+
if (window.ScrollTrigger) {
|
|
6643
|
+
try {
|
|
6644
|
+
var __sts = window.ScrollTrigger.getAll();
|
|
6645
|
+
var __ffTargets = [];
|
|
6646
|
+
__sts.forEach(function (t) {
|
|
6647
|
+
try {
|
|
6648
|
+
if (t.animation && t.animation.targets) {
|
|
6649
|
+
var __ts = t.animation.targets();
|
|
6650
|
+
if (__ts && __ts.length) Array.prototype.push.apply(__ffTargets, __ts);
|
|
6651
|
+
}
|
|
6652
|
+
} catch (e) {}
|
|
6653
|
+
});
|
|
6654
|
+
try {
|
|
6655
|
+
if (__ffTargets.length && window.gsap && typeof window.gsap.set === 'function') {
|
|
6656
|
+
window.gsap.set(__ffTargets, { clearProps: 'all' });
|
|
6657
|
+
}
|
|
6658
|
+
} catch (e) {}
|
|
6659
|
+
__sts.forEach(function (t) {
|
|
6660
|
+
try { if (t.animation && t.animation.invalidate) t.animation.invalidate(); } catch (e) {}
|
|
6661
|
+
});
|
|
6662
|
+
__sts.forEach(function (t) {
|
|
6663
|
+
try {
|
|
6664
|
+
if (t.animation && typeof t.animation.progress === 'function') {
|
|
6665
|
+
t.animation.progress(1, false);
|
|
6666
|
+
}
|
|
6667
|
+
} catch (e) {}
|
|
6668
|
+
try { t.kill(); } catch (e) {}
|
|
6669
|
+
});
|
|
6670
|
+
} catch (e) {}
|
|
6671
|
+
}
|
|
6672
|
+
`;
|
|
6673
|
+
}
|
|
6674
|
+
});
|
|
6675
|
+
|
|
6676
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/gsap.ts
|
|
6677
|
+
var GSAP_FAST_FORWARD;
|
|
6678
|
+
var init_gsap = __esm({
|
|
6679
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/gsap.ts"() {
|
|
6680
|
+
"use strict";
|
|
6681
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6682
|
+
GSAP_FAST_FORWARD = `
|
|
6683
|
+
if (typeof window.gsap !== 'undefined') {
|
|
6684
|
+
try { window.gsap.globalTimeline.progress(1, false); } catch (e) {}
|
|
6685
|
+
}
|
|
6686
|
+
`;
|
|
6687
|
+
}
|
|
6688
|
+
});
|
|
6689
|
+
|
|
6690
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/anime.ts
|
|
6691
|
+
var ANIME_FAST_FORWARD;
|
|
6692
|
+
var init_anime = __esm({
|
|
6693
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/anime.ts"() {
|
|
6694
|
+
"use strict";
|
|
6695
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6696
|
+
ANIME_FAST_FORWARD = `
|
|
6697
|
+
if (typeof window.anime !== 'undefined') {
|
|
6698
|
+
try {
|
|
6699
|
+
window.anime.running && window.anime.running.slice().forEach(function (a) {
|
|
6700
|
+
a.seek(a.duration);
|
|
6701
|
+
a.pause();
|
|
6702
|
+
});
|
|
6703
|
+
} catch (e) {}
|
|
6704
|
+
try {
|
|
6705
|
+
if (window.anime.engine && window.anime.engine.pause) {
|
|
6706
|
+
window.anime.engine.pause();
|
|
6707
|
+
}
|
|
6708
|
+
} catch (e) {}
|
|
6709
|
+
}
|
|
6710
|
+
`;
|
|
6711
|
+
}
|
|
6712
|
+
});
|
|
6713
|
+
|
|
6714
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/reveal-catchall.ts
|
|
6715
|
+
var REVEAL_CATCHALL;
|
|
6716
|
+
var init_reveal_catchall = __esm({
|
|
6717
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/reveal-catchall.ts"() {
|
|
6718
|
+
"use strict";
|
|
6719
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6720
|
+
REVEAL_CATCHALL = `
|
|
6721
|
+
try {
|
|
6722
|
+
if (window.gsap && typeof window.gsap.set === 'function') {
|
|
6723
|
+
var __revAll = document.querySelectorAll('*');
|
|
6724
|
+
var __revHidden = [];
|
|
6725
|
+
for (var __ri = 0; __ri < __revAll.length; __ri++) {
|
|
6726
|
+
var __re = __revAll[__ri];
|
|
6727
|
+
if (!__re._gsap) continue;
|
|
6728
|
+
var __rcs = getComputedStyle(__re);
|
|
6729
|
+
if (__rcs.visibility === 'hidden' || parseFloat(__rcs.opacity) < 0.01) {
|
|
6730
|
+
__revHidden.push(__re);
|
|
6731
|
+
}
|
|
6732
|
+
}
|
|
6733
|
+
if (__revHidden.length) {
|
|
6734
|
+
log('reveal-catchall un-hiding', __revHidden.length, 'element(s)');
|
|
6735
|
+
window.gsap.set(__revHidden, { autoAlpha: 1 });
|
|
6736
|
+
window.gsap.set(__revHidden, { clearProps: 'transform,translate,rotate,scale,x,y' });
|
|
6737
|
+
}
|
|
6738
|
+
}
|
|
6739
|
+
} catch (e) {}
|
|
6740
|
+
`;
|
|
6741
|
+
}
|
|
6742
|
+
});
|
|
6743
|
+
|
|
6744
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/waapi.ts
|
|
6745
|
+
var WAAPI_FREEZE_SNIPPET;
|
|
6746
|
+
var init_waapi = __esm({
|
|
6747
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/waapi.ts"() {
|
|
6748
|
+
"use strict";
|
|
6749
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6750
|
+
WAAPI_FREEZE_SNIPPET = `
|
|
6751
|
+
try {
|
|
6752
|
+
document.getAnimations().forEach(function (a) {
|
|
6753
|
+
try { a.finish(); } catch (e) {}
|
|
6754
|
+
try { a.pause(); } catch (e) {}
|
|
6755
|
+
});
|
|
6756
|
+
} catch (e) {}
|
|
6757
|
+
`;
|
|
6758
|
+
}
|
|
6759
|
+
});
|
|
6760
|
+
|
|
6761
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/fonts-ready.ts
|
|
6762
|
+
var FONTS_READY;
|
|
6763
|
+
var init_fonts_ready = __esm({
|
|
6764
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/fonts-ready.ts"() {
|
|
6765
|
+
"use strict";
|
|
6766
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6767
|
+
FONTS_READY = `
|
|
6768
|
+
try { await document.fonts.ready; } catch (e) {}
|
|
6769
|
+
`;
|
|
6770
|
+
}
|
|
6771
|
+
});
|
|
6772
|
+
|
|
6773
|
+
// ../design-mode/packages/frame-runtime/src/storage-stand-ins.ts
|
|
6774
|
+
function installStorageStandIns(win, doc, capBytes, DomException, defineProperty) {
|
|
6775
|
+
const bytesOf = (key, value) => (key.length + value.length) * 2;
|
|
6776
|
+
const quotaError = (key) => new DomException(`Setting the value of '${key}' exceeded the quota.`, "QuotaExceededError");
|
|
6777
|
+
const throwsOnRead = (read2) => {
|
|
6778
|
+
try {
|
|
6779
|
+
read2();
|
|
6780
|
+
return false;
|
|
6781
|
+
} catch {
|
|
6782
|
+
return true;
|
|
6783
|
+
}
|
|
6784
|
+
};
|
|
6785
|
+
const memoryStorage = () => {
|
|
6786
|
+
const items = /* @__PURE__ */ new Map();
|
|
6787
|
+
let bytes = 0;
|
|
6788
|
+
const api = {
|
|
6789
|
+
get length() {
|
|
6790
|
+
return items.size;
|
|
6791
|
+
},
|
|
6792
|
+
key(index) {
|
|
6793
|
+
return Array.from(items.keys())[Number(index)] ?? null;
|
|
6794
|
+
},
|
|
6795
|
+
getItem(key) {
|
|
6796
|
+
return items.get(String(key)) ?? null;
|
|
6797
|
+
},
|
|
6798
|
+
setItem(key, value) {
|
|
6799
|
+
const k = String(key);
|
|
6800
|
+
const v = String(value);
|
|
6801
|
+
const prev = items.get(k);
|
|
6802
|
+
const next = bytes - (prev === void 0 ? 0 : bytesOf(k, prev)) + bytesOf(k, v);
|
|
6803
|
+
if (next > capBytes) throw quotaError(k);
|
|
6804
|
+
items.set(k, v);
|
|
6805
|
+
bytes = next;
|
|
6806
|
+
},
|
|
6807
|
+
removeItem(key) {
|
|
6808
|
+
const k = String(key);
|
|
6809
|
+
const prev = items.get(k);
|
|
6810
|
+
if (prev === void 0) return;
|
|
6811
|
+
items.delete(k);
|
|
6812
|
+
bytes -= bytesOf(k, prev);
|
|
6813
|
+
},
|
|
6814
|
+
clear() {
|
|
6815
|
+
items.clear();
|
|
6816
|
+
bytes = 0;
|
|
6817
|
+
}
|
|
6818
|
+
};
|
|
6819
|
+
const own = (p) => typeof p === "symbol" || p in api;
|
|
6820
|
+
return new Proxy(api, {
|
|
6821
|
+
get(target, p, receiver) {
|
|
6822
|
+
if (own(p)) return Reflect.get(target, p, receiver);
|
|
6823
|
+
return target.getItem(p) ?? void 0;
|
|
6824
|
+
},
|
|
6825
|
+
set(target, p, value) {
|
|
6826
|
+
if (own(p)) return false;
|
|
6827
|
+
target.setItem(p, value);
|
|
6828
|
+
return true;
|
|
6829
|
+
},
|
|
6830
|
+
has(_target, p) {
|
|
6831
|
+
return own(p) || items.has(p);
|
|
6832
|
+
},
|
|
6833
|
+
deleteProperty(target, p) {
|
|
6834
|
+
if (!own(p)) target.removeItem(p);
|
|
6835
|
+
return true;
|
|
6836
|
+
},
|
|
6837
|
+
ownKeys() {
|
|
6838
|
+
return Array.from(items.keys());
|
|
6839
|
+
},
|
|
6840
|
+
getOwnPropertyDescriptor(target, p) {
|
|
6841
|
+
if (own(p)) return Reflect.getOwnPropertyDescriptor(target, p);
|
|
6842
|
+
const value = items.get(p);
|
|
6843
|
+
return value === void 0 ? void 0 : { value, writable: true, enumerable: true, configurable: true };
|
|
6844
|
+
}
|
|
6845
|
+
});
|
|
6846
|
+
};
|
|
6847
|
+
const cookieJar = () => {
|
|
6848
|
+
const jar = /* @__PURE__ */ new Map();
|
|
6849
|
+
let bytes = 0;
|
|
6850
|
+
return {
|
|
6851
|
+
get: () => Array.from(jar, ([k, v]) => k ? `${k}=${v}` : v).join("; "),
|
|
6852
|
+
set(raw) {
|
|
6853
|
+
const [pair = "", ...attrs] = String(raw).split(";");
|
|
6854
|
+
const eq = pair.indexOf("=");
|
|
6855
|
+
const name = (eq < 0 ? "" : pair.slice(0, eq)).trim();
|
|
6856
|
+
const value = (eq < 0 ? pair : pair.slice(eq + 1)).trim();
|
|
6857
|
+
const expired = attrs.some((a) => {
|
|
6858
|
+
const [k = "", v = ""] = a.split("=").map((s) => s.trim());
|
|
6859
|
+
if (/^max-age$/i.test(k)) return Number(v) <= 0;
|
|
6860
|
+
if (/^expires$/i.test(k)) return Date.parse(v) <= Date.now();
|
|
6861
|
+
return false;
|
|
6862
|
+
});
|
|
6863
|
+
const prev = jar.get(name);
|
|
6864
|
+
const freed = prev === void 0 ? 0 : bytesOf(name, prev);
|
|
6865
|
+
if (expired) {
|
|
6866
|
+
jar.delete(name);
|
|
6867
|
+
bytes -= freed;
|
|
6868
|
+
return;
|
|
6869
|
+
}
|
|
6870
|
+
const next = bytes - freed + bytesOf(name, value);
|
|
6871
|
+
if (next > capBytes) throw quotaError(name);
|
|
6872
|
+
jar.set(name, value);
|
|
6873
|
+
bytes = next;
|
|
6874
|
+
}
|
|
6875
|
+
};
|
|
6876
|
+
};
|
|
6877
|
+
for (const name of ["localStorage", "sessionStorage"]) {
|
|
6878
|
+
if (!throwsOnRead(() => win[name])) continue;
|
|
6879
|
+
defineProperty(win, name, { value: memoryStorage(), configurable: true, enumerable: true });
|
|
6880
|
+
}
|
|
6881
|
+
if (throwsOnRead(() => doc.cookie)) {
|
|
6882
|
+
const jar = cookieJar();
|
|
6883
|
+
defineProperty(doc, "cookie", { get: jar.get, set: jar.set, configurable: true, enumerable: true });
|
|
6884
|
+
}
|
|
6885
|
+
}
|
|
6886
|
+
var STORAGE_CAP_BYTES;
|
|
6887
|
+
var init_storage_stand_ins = __esm({
|
|
6888
|
+
"../design-mode/packages/frame-runtime/src/storage-stand-ins.ts"() {
|
|
6889
|
+
"use strict";
|
|
6890
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6891
|
+
STORAGE_CAP_BYTES = 5 * 1024 * 1024;
|
|
6892
|
+
}
|
|
6893
|
+
});
|
|
6894
|
+
|
|
6895
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/storage-stand-ins.ts
|
|
6896
|
+
var SCRIPT_BODY, STORAGE_STAND_INS_SCRIPT_TAG;
|
|
6897
|
+
var init_storage_stand_ins2 = __esm({
|
|
6898
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/storage-stand-ins.ts"() {
|
|
6899
|
+
"use strict";
|
|
6900
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6901
|
+
init_storage_stand_ins();
|
|
6902
|
+
SCRIPT_BODY = `(function () {
|
|
6903
|
+
try {
|
|
6904
|
+
(${installStorageStandIns.toString()})(window, document, ${STORAGE_CAP_BYTES}, DOMException, Object.defineProperty);
|
|
6905
|
+
} catch (e) {}
|
|
6906
|
+
})();`;
|
|
6907
|
+
STORAGE_STAND_INS_SCRIPT_TAG = `<script data-kombai-storage-stand-ins>${SCRIPT_BODY}</script>`;
|
|
6908
|
+
}
|
|
6909
|
+
});
|
|
6910
|
+
|
|
6911
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/video-pause.ts
|
|
6912
|
+
var VIDEO_PAUSE_SNIPPET;
|
|
6913
|
+
var init_video_pause = __esm({
|
|
6914
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/video-pause.ts"() {
|
|
6915
|
+
"use strict";
|
|
6916
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6917
|
+
VIDEO_PAUSE_SNIPPET = `
|
|
6918
|
+
document.querySelectorAll('video').forEach(function (v) {
|
|
6919
|
+
v.pause();
|
|
6920
|
+
if (!v.poster && v.readyState >= 2 && v.currentTime === 0) {
|
|
6921
|
+
v.currentTime = 0.1;
|
|
6922
|
+
}
|
|
6923
|
+
});
|
|
6924
|
+
`;
|
|
6925
|
+
}
|
|
6926
|
+
});
|
|
6927
|
+
|
|
6928
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/index.ts
|
|
6929
|
+
var SCREENSHOT_READY_SELECTOR, SCREENSHOT_BOOTSTRAP_MARKER, SCRIPT_BODY2, SCREENSHOT_PREP_SCRIPT_TAG;
|
|
6930
|
+
var init_prep = __esm({
|
|
6931
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/index.ts"() {
|
|
6932
|
+
"use strict";
|
|
6933
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6934
|
+
init_match_media_patch();
|
|
6935
|
+
init_css_freeze();
|
|
6936
|
+
init_detected();
|
|
6937
|
+
init_lenis();
|
|
6938
|
+
init_locomotive();
|
|
6939
|
+
init_tailwind_gate();
|
|
6940
|
+
init_tailwind_asset_watch();
|
|
6941
|
+
init_scroll_sweep();
|
|
6942
|
+
init_image_wait();
|
|
6943
|
+
init_scrolltrigger();
|
|
6944
|
+
init_gsap();
|
|
6945
|
+
init_anime();
|
|
6946
|
+
init_reveal_catchall();
|
|
6947
|
+
init_waapi();
|
|
6948
|
+
init_fonts_ready();
|
|
6949
|
+
init_storage_stand_ins2();
|
|
6950
|
+
init_waapi();
|
|
6951
|
+
init_video_pause();
|
|
6952
|
+
init_tailwind_ready();
|
|
6953
|
+
init_tailwind_asset_watch();
|
|
6954
|
+
SCREENSHOT_READY_SELECTOR = "html[data-screenshot-ready]";
|
|
6955
|
+
SCREENSHOT_BOOTSTRAP_MARKER = "data-kombai-screenshot-bootstrap";
|
|
6956
|
+
SCRIPT_BODY2 = `(function () {
|
|
6957
|
+
// 1. matchMedia patch \u2014 must run before any library reads prefers-reduced-motion.
|
|
6958
|
+
${MATCH_MEDIA_PATCH}
|
|
6959
|
+
|
|
6960
|
+
// 2. CSS freeze \u2014 install ASAP so even early CSS animations don't get a head start.
|
|
6961
|
+
${CSS_FREEZE}
|
|
6962
|
+
|
|
6963
|
+
// 3. Watch for a failed load of OUR tailwind runtime. Must be registered before the
|
|
6964
|
+
// <script> tag is parsed, which is why it lives here and not inside prepare().
|
|
6965
|
+
${TAILWIND_ASSET_WATCH}
|
|
6966
|
+
|
|
6967
|
+
var raf = function () { return new Promise(function (r) { requestAnimationFrame(r); }); };
|
|
6968
|
+
var log = function () {
|
|
6969
|
+
try { console.log.apply(console, ['[screenshot-bootstrap]'].concat([].slice.call(arguments))); } catch (e) {}
|
|
6970
|
+
};
|
|
6971
|
+
async function prepare() {
|
|
6972
|
+
try {
|
|
6973
|
+
// Single detection summary so the [screenshot-bootstrap] console line
|
|
6974
|
+
// tells us which animation libraries were active at start.
|
|
6975
|
+
${DETECT_SNIPPET}
|
|
6976
|
+
|
|
6977
|
+
// Smooth-scroll hijackers must die BEFORE scrollTo, or scroll-triggered
|
|
6978
|
+
// reveals never fire.
|
|
6979
|
+
${LENIS_TEARDOWN}
|
|
6980
|
+
${LOCOMOTIVE_TEARDOWN}
|
|
6981
|
+
|
|
6982
|
+
// Wait for Tailwind's async CSS pass before measuring layout \u2014 'load'
|
|
6983
|
+
// fires before it finishes, so utility classes aren't applied yet and an
|
|
6984
|
+
// unsized <svg viewBox> can inflate body.scrollHeight to ~700000px,
|
|
6985
|
+
// making the sweep below run for ~100s and blow past the ready timeout.
|
|
6986
|
+
${TAILWIND_READY_GATE}
|
|
6987
|
+
|
|
6988
|
+
// RAF scroll sweep so ScrollTrigger / IntersectionObserver register positions.
|
|
6989
|
+
${SCROLL_SWEEP}
|
|
6990
|
+
|
|
6991
|
+
// Wait for all images (lazy promoted to eager so distant lazy images load).
|
|
6992
|
+
${IMAGE_WAIT}
|
|
6993
|
+
|
|
6994
|
+
// Fast-forward JS animations to settled end state.
|
|
6995
|
+
${SCROLLTRIGGER_FAST_FORWARD}
|
|
6996
|
+
${GSAP_FAST_FORWARD}
|
|
6997
|
+
${ANIME_FAST_FORWARD}
|
|
6998
|
+
|
|
6999
|
+
// Reveal catch-all \u2014 un-hide GSAP-managed content whose scroll-bound
|
|
7000
|
+
// reveal never fired (custom-scroller ScrollTrigger.batch, smooth-scroll
|
|
7001
|
+
// libs we couldn't tear down). Runs after the fast-forwards so it only
|
|
7002
|
+
// touches elements still genuinely stuck at opacity/visibility hidden.
|
|
7003
|
+
${REVEAL_CATCHALL}
|
|
7004
|
+
|
|
7005
|
+
// WAAPI catch-all \u2014 covers Motion One, framer-motion-vanilla, any Animation object.
|
|
7006
|
+
${WAAPI_FREEZE_SNIPPET}
|
|
7007
|
+
|
|
7008
|
+
// Fonts + 2\xD7 rAF settle so the final frame is committed.
|
|
7009
|
+
${FONTS_READY}
|
|
7010
|
+
await new Promise(function (r) { requestAnimationFrame(function () { requestAnimationFrame(r); }); });
|
|
7011
|
+
} catch (e) {
|
|
7012
|
+
try { window.__screenshotReadyError = String((e && e.message) || e); } catch (_) {}
|
|
7013
|
+
log('error', e);
|
|
7014
|
+
} finally {
|
|
7015
|
+
try { document.documentElement.setAttribute('data-screenshot-ready', '1'); } catch (_) {}
|
|
7016
|
+
window.__screenshotReady = true;
|
|
7017
|
+
log('ready');
|
|
7018
|
+
}
|
|
7019
|
+
}
|
|
7020
|
+
|
|
7021
|
+
if (document.readyState === 'complete') {
|
|
7022
|
+
prepare();
|
|
7023
|
+
} else {
|
|
7024
|
+
window.addEventListener('load', prepare, { once: true });
|
|
7025
|
+
}
|
|
7026
|
+
})();`;
|
|
7027
|
+
SCREENSHOT_PREP_SCRIPT_TAG = `<script ${SCREENSHOT_BOOTSTRAP_MARKER}>${SCRIPT_BODY2}</script>`;
|
|
7028
|
+
}
|
|
7029
|
+
});
|
|
7030
|
+
|
|
6252
7031
|
// src/render/page.js
|
|
6253
|
-
function composePage({ html, overrides, images }) {
|
|
7032
|
+
function composePage({ html, overrides, images, anchorWidth }) {
|
|
6254
7033
|
const rewrite = (text) => rewriteImages(text, images);
|
|
6255
7034
|
const captured = Boolean(overrides);
|
|
6256
7035
|
const htmlAttrs = overrides?.htmlAttrs ? ` ${overrides.htmlAttrs.trimStart()}` : "";
|
|
6257
7036
|
const bodyAttrs = overrides?.bodyAttrs ? ` ${rewrite(overrides.bodyAttrs.trimStart())}` : "";
|
|
6258
7037
|
const tailwind = needsTailwindRuntime(tailwindScanInput(html, overrides ?? void 0)) ? TAILWIND_CDN_SCRIPT_TAG : "";
|
|
6259
|
-
|
|
7038
|
+
const head = captured ? rewrite(overrides?.head ?? "") : tailwind;
|
|
7039
|
+
const loadsTailwind = hasTailwindRuntime(head + html);
|
|
7040
|
+
const page = `<!DOCTYPE html>
|
|
6260
7041
|
<html${htmlAttrs}>
|
|
6261
7042
|
<head>
|
|
6262
7043
|
<meta charset="utf-8">
|
|
6263
|
-
${
|
|
7044
|
+
${loadsTailwind ? '<meta name="kombai-tailwind-runtime">' : ""}
|
|
7045
|
+
${STORAGE_STAND_INS_SCRIPT_TAG}
|
|
7046
|
+
${SCREENSHOT_PREP_SCRIPT_TAG}
|
|
7047
|
+
<style>${SCREENSHOT_CSS}</style>
|
|
7048
|
+
${head}
|
|
6264
7049
|
<style>${captured ? "" : FRAGMENT_RESET_CSS}
|
|
6265
7050
|
${ROOT_CSS}</style>
|
|
6266
7051
|
</head>
|
|
6267
7052
|
<body${bodyAttrs}>
|
|
6268
|
-
<div id="root">${rewrite(html)}</div
|
|
7053
|
+
<div id="root">${rewrite(html)}</div>${loadsTailwind ? TAILWIND_PROBE_HTML : ""}
|
|
6269
7054
|
</body>
|
|
6270
7055
|
</html>`;
|
|
7056
|
+
return anchorWidth ? anchorViewportUnits(page, anchorWidth) : page;
|
|
7057
|
+
}
|
|
7058
|
+
function anchorViewportUnits(page, width) {
|
|
7059
|
+
const converted = convertViewportUnits(page, width, INTRINSIC_VIEWPORT_HEIGHT);
|
|
7060
|
+
const sheet = `<style data-screenshot-vh-anchor>${buildViewportUnitOverrideCss(width, INTRINSIC_VIEWPORT_HEIGHT)}</style>`;
|
|
7061
|
+
const headEnd = converted.indexOf("</head>");
|
|
7062
|
+
return headEnd === -1 ? sheet + converted : converted.slice(0, headEnd) + sheet + converted.slice(headEnd);
|
|
6271
7063
|
}
|
|
6272
7064
|
function rewriteImages(text, images) {
|
|
6273
7065
|
let out = text;
|
|
@@ -6276,14 +7068,20 @@ function rewriteImages(text, images) {
|
|
|
6276
7068
|
}
|
|
6277
7069
|
return out;
|
|
6278
7070
|
}
|
|
6279
|
-
var FRAGMENT_RESET_CSS, ROOT_CSS;
|
|
7071
|
+
var FRAGMENT_RESET_CSS, ROOT_CSS, SCREENSHOT_CSS;
|
|
6280
7072
|
var init_page = __esm({
|
|
6281
7073
|
"src/render/page.js"() {
|
|
6282
7074
|
"use strict";
|
|
6283
7075
|
init_define_KOMBAI_TELEMETRY();
|
|
6284
7076
|
init_tailwind_detection();
|
|
7077
|
+
init_tailwind_script();
|
|
7078
|
+
init_convert_viewport_units();
|
|
7079
|
+
init_screenshot_height_metadata();
|
|
7080
|
+
init_prep();
|
|
6285
7081
|
FRAGMENT_RESET_CSS = "html, body { margin: 0; padding: 0; }";
|
|
6286
7082
|
ROOT_CSS = "#root { display: contents; }";
|
|
7083
|
+
SCREENSHOT_CSS = `* { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
|
|
7084
|
+
svg:not([height]) { max-height: 20000px !important; }`;
|
|
6287
7085
|
}
|
|
6288
7086
|
});
|
|
6289
7087
|
|
|
@@ -6614,7 +7412,14 @@ var init_proxy = __esm({
|
|
|
6614
7412
|
});
|
|
6615
7413
|
|
|
6616
7414
|
// src/render/render.js
|
|
6617
|
-
async function openRender(ctx, {
|
|
7415
|
+
async function openRender(ctx, {
|
|
7416
|
+
browserPath,
|
|
7417
|
+
page,
|
|
7418
|
+
deadline,
|
|
7419
|
+
width = DEFAULT_RENDER_WIDTH,
|
|
7420
|
+
viewportHeight = INTRINSIC_VIEWPORT_HEIGHT,
|
|
7421
|
+
readyMs = READY_MS
|
|
7422
|
+
}) {
|
|
6618
7423
|
const started = Date.now();
|
|
6619
7424
|
const limit = deadline.within(RENDER_MS);
|
|
6620
7425
|
const proxy = await startProxy();
|
|
@@ -6667,6 +7472,7 @@ async function openRender(ctx, { browserPath, page, deadline, width = 1440, view
|
|
|
6667
7472
|
const readyAt = Date.now() + readyMs;
|
|
6668
7473
|
await s("Page.navigate", { url: proxy.serve(page) });
|
|
6669
7474
|
const ready = await waitForReady(s, readyAt, SIGNALS.test(page));
|
|
7475
|
+
await s("Runtime.evaluate", { expression: SETTLE, awaitPromise: true });
|
|
6670
7476
|
await s("Runtime.evaluate", {
|
|
6671
7477
|
expression: `(() => { const st = document.createElement('style');
|
|
6672
7478
|
st.textContent = '*,*::before,*::after{animation-play-state:paused!important;transition:none!important;caret-color:transparent!important}';
|
|
@@ -6749,24 +7555,27 @@ async function waitForReady(send, readyAt, willSignal) {
|
|
|
6749
7555
|
const read2 = await by(reading, readyAt);
|
|
6750
7556
|
if (read2 === LATE) return "timeout";
|
|
6751
7557
|
const state = (
|
|
6752
|
-
/** @type {{ signalled?: boolean, declared?: boolean, settled?: boolean }} */
|
|
7558
|
+
/** @type {{ signalled?: boolean, declared?: boolean, settled?: boolean, prepared?: boolean }} */
|
|
6753
7559
|
read2.result?.value ?? {}
|
|
6754
7560
|
);
|
|
6755
|
-
if (state.signalled) return "kombai_ready";
|
|
6756
|
-
if (state.settled && !state.declared && !willSignal) return "fonts_and_images";
|
|
7561
|
+
if (state.signalled && state.prepared) return "kombai_ready";
|
|
7562
|
+
if (state.settled && state.prepared && !state.declared && !willSignal) return "fonts_and_images";
|
|
6757
7563
|
const left = readyAt - Date.now();
|
|
6758
7564
|
if (left <= 0) return "timeout";
|
|
6759
7565
|
await new Promise((resolve) => setTimeout(resolve, Math.min(READY_POLL_MS, left)));
|
|
6760
7566
|
}
|
|
6761
7567
|
}
|
|
6762
|
-
var RENDER_MS, READY_MS, READY_POLL_MS, MAX_HEIGHT, JPEG_MAX_BYTES, PNG_MAX_BYTES, JPEG_QUALITIES, RenderFailure, READY_WATCH, SIGNALS, READY_STATE, LATE;
|
|
7568
|
+
var DEFAULT_RENDER_WIDTH, RENDER_MS, READY_MS, READY_POLL_MS, MAX_HEIGHT, JPEG_MAX_BYTES, PNG_MAX_BYTES, JPEG_QUALITIES, RenderFailure, READY_WATCH, SIGNALS, READY_STATE, SETTLE, LATE;
|
|
6763
7569
|
var init_render = __esm({
|
|
6764
7570
|
"src/render/render.js"() {
|
|
6765
7571
|
"use strict";
|
|
6766
7572
|
init_define_KOMBAI_TELEMETRY();
|
|
7573
|
+
init_screenshot_height_metadata();
|
|
7574
|
+
init_prep();
|
|
6767
7575
|
init_contract();
|
|
6768
7576
|
init_cdp();
|
|
6769
7577
|
init_proxy();
|
|
7578
|
+
DEFAULT_RENDER_WIDTH = 1440;
|
|
6770
7579
|
RENDER_MS = 3e4;
|
|
6771
7580
|
READY_MS = 2e4;
|
|
6772
7581
|
READY_POLL_MS = 100;
|
|
@@ -6798,11 +7607,20 @@ var init_render = __esm({
|
|
|
6798
7607
|
SIGNALS = /KOMBAI_READY|kombai:ready/;
|
|
6799
7608
|
READY_STATE = `(() => {
|
|
6800
7609
|
const state = window.__kombaiRender;
|
|
7610
|
+
const prepared = document.readyState !== 'complete' || Boolean(document.querySelector(${JSON.stringify(SCREENSHOT_READY_SELECTOR)}));
|
|
6801
7611
|
return {
|
|
6802
7612
|
signalled: document.readyState !== 'loading' && (window.KOMBAI_READY === true || Boolean(state && state.event)),
|
|
6803
7613
|
declared: 'KOMBAI_READY' in window,
|
|
6804
7614
|
settled: Boolean(state && state.settled),
|
|
7615
|
+
prepared,
|
|
6805
7616
|
};
|
|
7617
|
+
})()`;
|
|
7618
|
+
SETTLE = `(async () => {
|
|
7619
|
+
const frame = () => new Promise((resolve) => requestAnimationFrame(resolve));
|
|
7620
|
+
${VIDEO_PAUSE_SNIPPET}
|
|
7621
|
+
await frame(); await frame();
|
|
7622
|
+
${WAAPI_FREEZE_SNIPPET}
|
|
7623
|
+
await frame();
|
|
6806
7624
|
})()`;
|
|
6807
7625
|
LATE = Symbol("late");
|
|
6808
7626
|
}
|
|
@@ -6944,7 +7762,12 @@ async function renderOne(ctx, { api, canvasId, screenshotsDir, target, deadline,
|
|
|
6944
7762
|
try {
|
|
6945
7763
|
render = await openRender(ctx, {
|
|
6946
7764
|
browserPath,
|
|
6947
|
-
page: composePage({
|
|
7765
|
+
page: composePage({
|
|
7766
|
+
html: target.html,
|
|
7767
|
+
overrides: target.overrides,
|
|
7768
|
+
images: target.images,
|
|
7769
|
+
anchorWidth: target.height === void 0 ? target.width ?? DEFAULT_RENDER_WIDTH : void 0
|
|
7770
|
+
}),
|
|
6948
7771
|
deadline,
|
|
6949
7772
|
width: target.width,
|
|
6950
7773
|
viewportHeight: target.height
|
|
@@ -7049,10 +7872,12 @@ function targetOf(nodeId, version2, files, images, node) {
|
|
|
7049
7872
|
html: files.html ? text.decode(files.html) : "",
|
|
7050
7873
|
overrides,
|
|
7051
7874
|
images,
|
|
7052
|
-
// Like the canvas's own capture: a node renders at its width, a mobile one at 390 px. A
|
|
7053
|
-
//
|
|
7875
|
+
// Like the canvas's own capture: a node renders at its width, a mobile one at 390 px. A node the canvas shows at
|
|
7876
|
+
// a height of its own renders in a window that tall: a text node, and a design with a set height, which the
|
|
7877
|
+
// canvas shows as a window onto its page (any rect.h above 0). A content-height design loads in the canvas's
|
|
7878
|
+
// measuring window, INTRINSIC_VIEWPORT_HEIGHT, with its viewport units pinned (renderOne, page.js).
|
|
7054
7879
|
width: sizeOf(node?.rect?.w, MIN_WIDTH),
|
|
7055
|
-
height: node?.type === "text" ?
|
|
7880
|
+
height: sizeOf(node?.rect?.h, node?.type === "text" ? MIN_TEXT_HEIGHT : 1)
|
|
7056
7881
|
};
|
|
7057
7882
|
}
|
|
7058
7883
|
function sizeOf(value, min) {
|
|
@@ -7115,15 +7940,19 @@ function layoutPatch(entry, layout, ifVersion, settled = []) {
|
|
|
7115
7940
|
} else if (field === "rect" && settledRect === "all") {
|
|
7116
7941
|
patch.rect = value;
|
|
7117
7942
|
} else if (field === "rect" && isRecord(value) && isRecord(entry.layout.rect)) {
|
|
7118
|
-
const
|
|
7943
|
+
const was2 = entry.layout.rect;
|
|
7119
7944
|
const sides = Object.entries(value).filter(
|
|
7120
|
-
([side, v]) => v !== void 0 && (settledRect.includes(side) || !sameValue(
|
|
7945
|
+
([side, v]) => v !== void 0 && (settledRect.includes(side) || !sameValue(was2[side], v))
|
|
7121
7946
|
);
|
|
7122
7947
|
patch.rect = sides.length ? Object.fromEntries(sides) : value;
|
|
7123
7948
|
} else {
|
|
7124
7949
|
patch[field] = value;
|
|
7125
7950
|
}
|
|
7126
7951
|
}
|
|
7952
|
+
const rect = patch.rect;
|
|
7953
|
+
const was = entry.layout.rect;
|
|
7954
|
+
if (entry.type === "variant" && !fields.has("viewportAuto") && layout.viewportAuto !== false && isRecord(rect) && rect.h !== void 0 && !(isRecord(was) && sameValue(was.h, rect.h)))
|
|
7955
|
+
patch.viewportAuto = false;
|
|
7127
7956
|
return Object.keys(patch).length > 1 ? patch : null;
|
|
7128
7957
|
}
|
|
7129
7958
|
function isRecord(value) {
|
|
@@ -7154,6 +7983,7 @@ async function recordLanded(ctx, paths, base, working, patches, results, seq, sa
|
|
|
7154
7983
|
if (value === null) delete layout[field];
|
|
7155
7984
|
else if (pushedOver && field === "rect" && isRecord(value) && isRecord(layout.rect))
|
|
7156
7985
|
layout.rect = { ...layout.rect, ...value };
|
|
7986
|
+
else if (field === "viewportAuto") layout[field] = value;
|
|
7157
7987
|
else layout[field] = now[field];
|
|
7158
7988
|
}
|
|
7159
7989
|
const filesBehind = saved[nodeId]?.fields.includes("files");
|
|
@@ -7465,9 +8295,7 @@ var init_canvas = __esm({
|
|
|
7465
8295
|
}
|
|
7466
8296
|
);
|
|
7467
8297
|
}
|
|
7468
|
-
if (error2 instanceof CliError && error2.code === "DESIGN_ORG_REQUIRED")
|
|
7469
|
-
error2.next = `kombai canvas create --name ${JSON.stringify(name)} --org <id>`;
|
|
7470
|
-
}
|
|
8298
|
+
if (error2 instanceof CliError && error2.code === "DESIGN_ORG_REQUIRED") error2.next = "kombai config org <id>";
|
|
7471
8299
|
if (error2 instanceof CliError && error2.code === "DESIGN_GUEST_LIMIT" && typeof error2.details?.canvasId === "string")
|
|
7472
8300
|
await rememberGuestCanvas(ctx, cc, error2.details.canvasId);
|
|
7473
8301
|
throw error2;
|
|
@@ -7511,13 +8339,18 @@ var init_canvas = __esm({
|
|
|
7511
8339
|
};
|
|
7512
8340
|
canvasList = {
|
|
7513
8341
|
name: "canvas list",
|
|
7514
|
-
summary: "List this repo's
|
|
7515
|
-
flags: {
|
|
7516
|
-
|
|
8342
|
+
summary: "List every canvas you can see, in every project: this repo's first, then the rest, each newest first within each owner; with --project, only that project's. projectId names each one's project and checkoutProjectId this repo's; dir is null for a canvas not pulled in this checkout. deleted names canvases deleted since, whose folders here were kept for work that was not pushed.",
|
|
8343
|
+
flags: {
|
|
8344
|
+
project: { type: "string", placeholder: "<id>", check: projectIdProblem },
|
|
8345
|
+
// Every project is the default; kept so an older skill's `canvas list --all` still runs.
|
|
8346
|
+
all: { type: "boolean", hidden: true }
|
|
8347
|
+
},
|
|
8348
|
+
exclusive: [["project", "all"]],
|
|
8349
|
+
example: "kombai canvas list --project prj_0123456789abcdef",
|
|
7517
8350
|
async run(ctx, { flags }) {
|
|
7518
8351
|
const cc = await canvasContext(ctx, flags, { allowGuest: flags.all !== true });
|
|
7519
|
-
const
|
|
7520
|
-
const listPath =
|
|
8352
|
+
const project = typeof flags.project === "string" ? flags.project : cc.session.kind === "guest" ? cc.checkout.projectId : null;
|
|
8353
|
+
const listPath = project ? `/design/projects/${project}/canvases` : "/design/canvases";
|
|
7521
8354
|
const items = [];
|
|
7522
8355
|
let cursor;
|
|
7523
8356
|
do {
|
|
@@ -7529,9 +8362,15 @@ var init_canvas = __esm({
|
|
|
7529
8362
|
items.push(...res.body.items);
|
|
7530
8363
|
cursor = res.body.nextCursor ?? void 0;
|
|
7531
8364
|
} while (cursor);
|
|
7532
|
-
const
|
|
8365
|
+
const named2 = items.map((item) => ({
|
|
8366
|
+
item,
|
|
8367
|
+
/** @type {string | null} */
|
|
8368
|
+
projectId: typeof item.projectId === "string" && item.projectId ? item.projectId : project
|
|
8369
|
+
}));
|
|
8370
|
+
const here = (entry) => entry.projectId === cc.checkout.projectId;
|
|
8371
|
+
const listed = [...named2.filter(here), ...named2.filter((entry) => !here(entry))];
|
|
7533
8372
|
const ws = await loadWorkspace(cc.work, cc.checkout, (ws2) => {
|
|
7534
|
-
for (const item of
|
|
8373
|
+
for (const { item, projectId } of listed) if (projectId) ws2.canvases[item.id] = projectId;
|
|
7535
8374
|
});
|
|
7536
8375
|
const deleted = [];
|
|
7537
8376
|
for (const [canvasId, at] of Object.entries(ws.deleted)) {
|
|
@@ -7546,8 +8385,7 @@ var init_canvas = __esm({
|
|
|
7546
8385
|
});
|
|
7547
8386
|
}
|
|
7548
8387
|
const canvases = await Promise.all(
|
|
7549
|
-
|
|
7550
|
-
const projectId = projectOfItem(item);
|
|
8388
|
+
listed.map(async ({ item, projectId }) => {
|
|
7551
8389
|
const dir = canvasPaths(cc.work, item.id).dir;
|
|
7552
8390
|
return {
|
|
7553
8391
|
canvasId: item.id,
|
|
@@ -7558,11 +8396,11 @@ var init_canvas = __esm({
|
|
|
7558
8396
|
sharing: item.sharing,
|
|
7559
8397
|
ownerKey: item.ownerKey,
|
|
7560
8398
|
projectId,
|
|
7561
|
-
dir:
|
|
8399
|
+
dir: await exists(dir) ? dir : null
|
|
7562
8400
|
};
|
|
7563
8401
|
})
|
|
7564
8402
|
);
|
|
7565
|
-
return { canvases, ...deleted.length ? { deleted } : {} };
|
|
8403
|
+
return { checkoutProjectId: cc.checkout.projectId, canvases, ...deleted.length ? { deleted } : {} };
|
|
7566
8404
|
}
|
|
7567
8405
|
};
|
|
7568
8406
|
canvasDelete = {
|
|
@@ -7923,14 +8761,13 @@ var init_canvas = __esm({
|
|
|
7923
8761
|
flags: { canvas: { type: "string", required: true, placeholder: "<id|link>", check: canvasRefProblem } },
|
|
7924
8762
|
async run(ctx, { flags }) {
|
|
7925
8763
|
const cc = await canvasContext(ctx, flags, { allowGuest: true });
|
|
7926
|
-
const inApp = `kombai canvas url --canvas ${cc.canvasId} --in-app`;
|
|
7927
8764
|
if (!ctx.hasDisplay) {
|
|
7928
8765
|
await readForLink(cc);
|
|
7929
|
-
return { url: `${cc.session.hosts.web}/c/${cc.canvasId}`, opened: false
|
|
8766
|
+
return { url: `${cc.session.hosts.web}/c/${cc.canvasId}`, opened: false };
|
|
7930
8767
|
}
|
|
7931
8768
|
const url2 = await ticketedUrl(ctx, cc);
|
|
7932
8769
|
const opened = await ctx.openUrl(url2);
|
|
7933
|
-
return { url: url2.split("#")[0], opened
|
|
8770
|
+
return { url: url2.split("#")[0], opened };
|
|
7934
8771
|
}
|
|
7935
8772
|
};
|
|
7936
8773
|
}
|
|
@@ -7984,9 +8821,7 @@ var init_config = __esm({
|
|
|
7984
8821
|
if (!credential) {
|
|
7985
8822
|
const entry = await readEntry(ctx.home, env);
|
|
7986
8823
|
if (isPureGuest(entry))
|
|
7987
|
-
throw signInRequired(
|
|
7988
|
-
"The preference is kept per signed-in user, and this machine is a guest. Sign in with kombai login."
|
|
7989
|
-
);
|
|
8824
|
+
throw signInRequired("The preference is kept per signed-in user, and this machine is a guest: sign in first.");
|
|
7990
8825
|
throw notSignedIn("Sign in first: the preference is kept per signed-in user.", notSignedInReason(entry));
|
|
7991
8826
|
}
|
|
7992
8827
|
if (org !== void 0) await checkMember(ctx, org);
|
|
@@ -31362,7 +32197,7 @@ function toolDescriptors(resourceUri) {
|
|
|
31362
32197
|
{
|
|
31363
32198
|
name: CANVAS_APP_TOOL,
|
|
31364
32199
|
title: "Kombai",
|
|
31365
|
-
description: "Show a Kombai canvas beside this chat. Pass the canvas id (cnv_\u2026) or its link; node is a design id to focus. With no canvas it shows every canvas the person can open when signed in, the guest home to a guest or to someone who never signed in, and asks someone who signed in before to sign in there. Open a canvas once: every canvas_app call opens another tab. The canvas is the live Kombai page, so it shows every change as it lands. Changes go through the work-with-kombai skill's commands, never through this tool.
|
|
32200
|
+
description: "Show a Kombai canvas beside this chat. Pass the canvas id (cnv_\u2026) or its link; node is a design id to focus. With no canvas it shows every canvas the person can open when signed in, the guest home to a guest or to someone who never signed in, and asks someone who signed in before to sign in there. Open a canvas once: every canvas_app call opens another tab. The canvas is the live Kombai page, so it shows every change as it lands. Changes go through the work-with-kombai skill's commands, never through this tool. While it shows the canvas, put no canvas or design link in your replies: name designs by their labels, and give a link only when the person asks for one. Such a link is a Kombai page, which opens in this client's browser, never a Kombai app link.",
|
|
31366
32201
|
inputSchema: {
|
|
31367
32202
|
type: "object",
|
|
31368
32203
|
properties: {
|
|
@@ -32436,7 +33271,7 @@ var init_cards = __esm({
|
|
|
32436
33271
|
signInTool = (resourceUri) => ({
|
|
32437
33272
|
name: SIGN_IN_CARD_TOOL,
|
|
32438
33273
|
title: "Kombai",
|
|
32439
|
-
description: "Show Kombai's sign-in card in this chat for a guest (kombai whoami printed status guest, or claim pending), or for a machine with neither a guest nor an account (reason start). Call it with the reason instead of offering kombai login in text: start when kombai whoami exits 3 (CLI_NOT_SIGNED_IN), in place of asking whether to sign in or try Kombai without an account; canvas_full for DESIGN_GUEST_LIMIT with no canvasId in details; second_canvas for DESIGN_GUEST_LIMIT with one (still use that canvas); taste when taste is refused or asked for; repo_images for CLI_SIGNIN_REQUIRED with images in details; account for any other CLI_SIGNIN_REQUIRED or DESIGN_SIGNIN_REQUIRED; ending once per conversation when whoami's expires is within 7 days. Then end your turn, except after ending, a reminder, where you carry on with the request. The user signs in from the card; never run kombai login for them unless they ask in the chat. When they say they have signed in, run kombai whoami.",
|
|
33274
|
+
description: "Show Kombai's sign-in card in this chat for a guest (kombai whoami printed status guest, or claim pending), or for a machine with neither a guest nor an account (reason start). Call it with the reason instead of offering kombai login in text: start when kombai whoami exits 3 (CLI_NOT_SIGNED_IN), in place of asking whether to sign in or try Kombai without an account; canvas_full for DESIGN_GUEST_LIMIT with no canvasId in details; second_canvas for DESIGN_GUEST_LIMIT with one (still use that canvas); taste when taste is refused or asked for; repo_images for CLI_SIGNIN_REQUIRED with images in details; account for any other CLI_SIGNIN_REQUIRED or DESIGN_SIGNIN_REQUIRED; ending once per conversation when whoami's expires is within 7 days. Then end your turn, except after ending, a reminder, where you carry on with the request. The user signs in from the card; never run kombai login for them unless they ask in the chat, and then sign in as `kombai skill sign-in` says: with a browser panel the user can see, `kombai login --no-browser`, its url opened in that panel. When they say they have signed in, run kombai whoami.",
|
|
32440
33275
|
inputSchema: {
|
|
32441
33276
|
type: "object",
|
|
32442
33277
|
properties: { reason: { type: "string", enum: Object.values(SignInReason) } },
|
|
@@ -32873,6 +33708,21 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
32873
33708
|
postToFrame({ kind: 'download-failed', canvasId: id, message: error.message, code: error.code || null });
|
|
32874
33709
|
});
|
|
32875
33710
|
}
|
|
33711
|
+
// A draft's blocks (draftContent in the file header).
|
|
33712
|
+
var PARTS_MAX = 100, TITLE_MAX = 200;
|
|
33713
|
+
function draftContent(m) {
|
|
33714
|
+
var parts = m.parts;
|
|
33715
|
+
var valid = Array.isArray(parts) && parts.length > 0 && parts.length <= PARTS_MAX &&
|
|
33716
|
+
parts.every(function (p) { return !!p && typeof p.text === 'string' && p.text.length > 0; });
|
|
33717
|
+
if (!valid) return [{ type: 'text', text: m.text }];
|
|
33718
|
+
return parts.map(function (p) {
|
|
33719
|
+
var block = { type: 'text', text: p.text };
|
|
33720
|
+
if (typeof p.title === 'string' && p.title.length > 0 && p.title.length <= TITLE_MAX) {
|
|
33721
|
+
block._meta = { 'openai/title': p.title };
|
|
33722
|
+
}
|
|
33723
|
+
return block;
|
|
33724
|
+
});
|
|
33725
|
+
}
|
|
32876
33726
|
function fromPage(m) {
|
|
32877
33727
|
if (!m || m.kombai !== EMBED || m.v !== PROTOCOL || typeof m.kind !== 'string') return;
|
|
32878
33728
|
if (m.kind === 'ready') { postToFrame(hello()); return; }
|
|
@@ -32891,7 +33741,7 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
32891
33741
|
var send = SEND_ACTIONS && m.kind === 'action';
|
|
32892
33742
|
request('ui/message', {
|
|
32893
33743
|
role: 'user',
|
|
32894
|
-
content:
|
|
33744
|
+
content: draftContent(m),
|
|
32895
33745
|
_meta: { 'openai/message': { target: 'active', send: send } },
|
|
32896
33746
|
}).catch(function () {});
|
|
32897
33747
|
return;
|
|
@@ -33386,7 +34236,7 @@ var init_server3 = __esm({
|
|
|
33386
34236
|
var actions_default;
|
|
33387
34237
|
var init_actions = __esm({
|
|
33388
34238
|
"src/skill/actions.md"() {
|
|
33389
|
-
actions_default = '# Requests from the canvas\n\nThe user can ask for work from the hosted canvas: the page copies a message for them to paste into this\nchat, or, in the Kombai view beside the chat, puts it in the message box. Each request is one sentence
|
|
34239
|
+
actions_default = '# Requests from the canvas\n\nThe user can ask for work from the hosted canvas: the page copies a message for them to paste into this\nchat, or, in the Kombai view beside the chat, puts it in the message box (an Add to context becomes a\ncontext item instead). Each request is one sentence, then a link on its own line (Add to context\'s is\none line with no sentence, below):\n\n On my Kombai canvas "Checkout redesign", make 3 variants of "Variant A" with improved styles.\n https://agent.kombai.com/c/cnv_8f2a1b9c3d7e?node=nd_31a\n\nThe link names the canvas (after /c/) and the design (?node=). One message can hold several requests,\nsplit by blank lines; do each. The user may add their own words; they win where they differ.\n\nFor a whole-canvas request, use `kombai canvas pull --canvas <link>` and follow the user\'s request.\nFor a node request, use `kombai node pull --canvas <link> --node <node>`; if you will change that design,\nrun `kombai node lock --canvas <link> --node <node>` before the pull. Read the HTML file it prints,\nand look at its thumbnail with `kombai screenshot wait --canvas <link> --node <node> --tiles`. An element\nnamed with data-kid="<id>" is the element with that attribute in the HTML.\n\nBefore writing or changing design HTML, read `kombai skill html`. When the request needs taste, read\n`kombai skill brief` first. A request copied from the canvas comes from a page the user has open: don\'t show\nthe canvas again. A canvas the user only named: show it once, as `kombai skill opening` says.\n\nThen do what the sentence asks:\n\n- **make 3 variants of "<label>"**, maybe with a direction (improved styles, structure, interactions or\n responsiveness, or "that improve the design") and a style in parentheses. Make 3 new designs with\n `kombai node start --canvas <id> --label "<label>" --parent <node>`, each a clear take on that\n direction and different from the others, keeping the content. Run taste first only when the request\n wants new ideas rather than a change of the same design.\n- **make a [dark mode] [mobile | tablet | laptop | custom-width] version of "<label>"**, maybe with a\n width and the user\'s instructions after a colon. One new design with --parent <node> and the content\n kept. Add `--viewport mobile` (390 px), `--viewport tablet` (768 px) or `--viewport desktop` (laptop,\n 1280 px) to node start. For a custom width, give the node its width before its first push, so the\n thumbnail is rendered once, at that width; a later width change drops it until the next\n `kombai screenshot fill`. After node start, set the node\'s rect w in canvas.json to that width and\n run `kombai canvas push --canvas <id>`, then write the HTML and push it. Dark mode: the same design\n in a dark palette. No taste: reflow, don\'t redesign.\n- **regenerate "<label>"**: write a fresh, better version of the same concept into the pulled file and\n push it to the same node. **with the "<name>" design system**: find its slug in `kombai ds list`, pull\n it (`kombai skill design-system`) and use its tokens.\n- **in "<label>", change the <element>: <what to do>**: edit only that element in the pulled file and\n push. Leave the rest of the design as it is.\n- **build "<label>" in this project**, or **build the <element> of "<label>"**: write it as code in this\n repo, in the repo\'s framework, components and styles, using the pulled HTML and the thumbnail as the\n reference. This changes the repo, not the canvas.\n- **"<label>" <link>**, **The <element> in "<label>" <link>** or **The canvas "<name>" <link>**: one line\n with no sentence (Add to context; in the Kombai view beside the chat it arrives as a context item titled\n with the name). Context for the user\'s own words in the same message. Use the pulled node or canvas and\n do what they ask; if they asked nothing, describe it and ask what they want.\n- **refer design system: <name>**: one line with no link (Add to context in the Design systems panel).\n Context for the user\'s own words in the same message: `kombai skill design-system` says how to find\n and pull it by name.\n\nA lock lasts 10 minutes: run node lock again for a longer edit, and before each fix after a push (the push\nends it). If you stop without pushing, or drop your edit with node pull --discard, run\n`kombai node unlock --canvas <link> --node <node>`. If node lock fails, go on without it; a drawing takes\nno lock.\n\nAfter a design\'s last HTML push, follow "Check a finished design" in the overview. When you are done,\ntell the user what changed; the canvas they have open shows it live.\n';
|
|
33390
34240
|
}
|
|
33391
34241
|
});
|
|
33392
34242
|
|
|
@@ -33394,7 +34244,7 @@ var init_actions = __esm({
|
|
|
33394
34244
|
var brief_default;
|
|
33395
34245
|
var init_brief = __esm({
|
|
33396
34246
|
"src/skill/brief.md"() {
|
|
33397
|
-
brief_default = '# Writing a taste brief\n\nTaste reads only the brief: it cannot see the repo, the chat or any file. Write everything it needs into\nthe brief, at most 8,000 characters, in a file outside the repo, then pass it to\n`kombai taste start --brief <file> --variants <1-4>`.\n\nGive ground truth, not design advice. Taste\'s job is to bring the design ideas; ideas you add make it\ncopy yours. For "a joyful, light CRM", write "A joyful light-theme CRM application", not "a light CRM\ndashboard with a soft purple gradient".\n\nA brief says:\n\n- What to design, in plain words that name the kind of UI: a pricing section, sign-in, onboarding, a\n dashboard, a data table, an AI chat, an empty state.\n- The scope: a full page, one section, a screen, a multi-screen flow, or one reusable component. For a\n component taste returns lighter options (arrangements, looks, graphic ideas) and no assets.\n- Every fact the design shows: the product and who uses it, the real copy (names, numbers, plans,\n prices, navigation), the content of each section, and the states that matter.\n- What is already decided, from the repo or the user: brand colors, fonts, logo, an existing design\n system (its tokens, copied from tailwind config, globals.css, theme or token files), and what must stay\n as it is. Copy the values; taste cannot open the files.\n- What is still open, only when the user said so: "explore the layout", "keep our colors".\n\nSkip taste when the work copies or reflows a design instead of making a new one: a clone of a page,\nscreenshot or mock the user gave, a build of the repo\'s existing screens, a version of a design for\nanother device or mode, or an edit to part of a design. Then write the HTML straight from the reference\nor the pulled node.\n\nA taste run takes a few minutes. Tell the user it has started, and create and open the canvas while it\nruns. Run `kombai taste wait <run>` in the foreground, one wait at a time: it returns within 90 seconds,\nso while its status is running, tell the user the run is still going, as expected, and wait again.\n\nAfter `kombai taste wait`, follow directions.md: one direction per variant. In it, <stock-image> tags\ndescribe photos and <icon> tags name icons from the library its <icon-library> tag names: put icons in as\ninline SVG from that library, and photos as images, from a public https URL or saved in the repo. Its\nasset links are real; use them as given and never invent one.\n\ndirections.md is written for
|
|
34247
|
+
brief_default = '# Writing a taste brief\n\nTaste reads only the brief: it cannot see the repo, the chat or any file. Write everything it needs into\nthe brief, at most 8,000 characters, in a file outside the repo, then pass it to\n`kombai taste start --brief <file> --variants <1-4>`.\n\nGive ground truth, not design advice. Taste\'s job is to bring the design ideas; ideas you add make it\ncopy yours. For "a joyful, light CRM", write "A joyful light-theme CRM application", not "a light CRM\ndashboard with a soft purple gradient".\n\nA brief says:\n\n- What to design, in plain words that name the kind of UI: a pricing section, sign-in, onboarding, a\n dashboard, a data table, an AI chat, an empty state.\n- The scope: a full page, one section, a screen, a multi-screen flow, or one reusable component. For a\n component taste returns lighter options (arrangements, looks, graphic ideas) and no assets.\n- Every fact the design shows: the product and who uses it, the real copy (names, numbers, plans,\n prices, navigation), the content of each section, and the states that matter.\n- What is already decided, from the repo or the user: brand colors, fonts, logo, an existing design\n system (its tokens, copied from tailwind config, globals.css, theme or token files), and what must stay\n as it is. Copy the values; taste cannot open the files.\n- What is still open, only when the user said so: "explore the layout", "keep our colors".\n\nSkip taste when the work copies or reflows a design instead of making a new one: a clone of a page,\nscreenshot or mock the user gave, a build of the repo\'s existing screens, a version of a design for\nanother device or mode, or an edit to part of a design. Then write the HTML straight from the reference\nor the pulled node.\n\nA taste run takes a few minutes. Tell the user it has started, and create and open the canvas while it\nruns. Run `kombai taste wait <run>` in the foreground, one wait at a time: it returns within 90 seconds,\nso while its status is running, tell the user the run is still going, as expected, and wait again.\n\nAfter `kombai taste wait`, follow directions.md: one direction per variant. In it, <stock-image> tags\ndescribe photos and <icon> tags name icons from the library its <icon-library> tag names: put icons in as\ninline SVG from that library, and photos as images, from a public https URL or saved in the repo. Its\nasset links are real; use them as given and never invent one.\n\ndirections.md is written for a page on a canvas, as Kombai\'s own Design mode writes it. What it asks for\nruns there: scroll-driven motion (parallax, reveal or count-up on scroll, pinning), smooth scrolling\n(Lenis, Locomotive), sticky or fixed elements, and the Sticky Layout Rule it may add, once the design has a\nheight of its own (`kombai skill html`, Size and position). A\n<stock-image> or <stock-video> with no link has no asset: draw it as SVG or leave it out.\n';
|
|
33398
34248
|
}
|
|
33399
34249
|
});
|
|
33400
34250
|
|
|
@@ -33410,7 +34260,7 @@ var init_claude_desktop = __esm({
|
|
|
33410
34260
|
var design_system_default;
|
|
33411
34261
|
var init_design_system = __esm({
|
|
33412
34262
|
"src/skill/design-system.md"() {
|
|
33413
|
-
design_system_default = '# Design systems\n\nA design system is a .ds file in the user\'s Kombai account, not the repo: YAML front matter between\n`---` lines holds the tokens; the markdown after it says how to use them. Read a pulled one as the\nmodel. `kombai ds push` checks it with ds-kit.\n\n- `name` (required) and `modes`: `[light]`, `[dark]` or `[light, dark]`.\n- `color.palette` (required): named colors as quoted hex, rgb() or hsl().\n- `color.semantic`: the 11 roles in the example. Each is a ref, or `{ light: <ref>, dark: <ref> }`.\n- `typography.family`, and `typography.textStyle` with fontFamily, fontSize, fontWeight, lineHeight.\n- Optional: spacing, radius, shadow, border, opacity, motion, breakpoint, components.\n\nEvery ref must name a key you defined: `{colors.X}` (palette, also written `{color.palette.X}`), `{typography.X}` (textStyle),\n`{radius.X}`, `{spacing.X}`, `{shadow.X}`. One ref per value. The body starts with a `>` line, then\noptional `##` sections: Instructions, Brand & Accent, Surface, Text, Status & Semantic, Fonts, Layout,\nComponents, Do, Don\'t, Notes. At most 1 MB.\n\n```\n---\nname: Acme\nmodes: [light]\ncolor:\n palette: { brand: "#3b5bdb", white: "#ffffff", ink: "#16181d", line: "#e4e7ec" }\n semantic:\n background.canvas: "{colors.white}"\n surface.default: "{colors.white}"\n surface.raised: "{colors.white}"\n text.primary: "{colors.ink}"\n text.secondary: "{colors.ink}"\n text.tertiary: "{colors.ink}"\n text.link: "{colors.brand}"\n border.default: "{colors.line}"\n border.focus: "{colors.brand}"\n primary.bg: "{colors.brand}"\n primary.fg: "{colors.white}"\ntypography:\n family: { sans: "Inter" }\n textStyle:\n body: { fontFamily: "Inter", fontSize: "16px", fontWeight: 400, lineHeight: 1.5 }\ncomponents:\n button: { type: button, label: "Get started", backgroundColor: "{colors.brand}", textColor: "{colors.white}", typography: "{typography.body}", padding: "10px 18px" }\n---\n\n> One indigo accent on white, Inter throughout.\n```\n\n## Commands\n\n- `kombai ds list`: each one\'s slug, name, ownerKey, and file (null if not pulled here), and in\n publicDesignSystems Kombai\'s public ones, each with its id, name, description and file.\n- `kombai ds pull <slug>` writes the file it prints. Edit it, then `kombai ds push <file>`.\n- A public one is read-only: `kombai ds pull <id> --public` writes the file it prints. Use it as it is;\n never push or delete it.\n- To make one, write `<slug>.ds` outside the repo and push it. The file name gives the slug (lowercase\n letters, digits, dashes; a leading `ds-` is dropped); pick one `ds list` does not show. Then edit\n the file the push prints: pushing your first file again is a conflict.\n- A refused file exits 1 with CLI_INVALID_DESIGN_SYSTEM naming each problem: fix them and push again.\n Fix its warnings too.\n- `kombai ds delete <slug>` deletes one for everyone. Run it only when the user asks.\n\nownerKey is `org:<id>` (an organization\'s) or `user:<id>` (the user\'s own). A pulled file goes back to\nits owner; a new one goes to `--org <id>`, else the organization `kombai config org` saved. On\nDESIGN_ORG_REQUIRED, ask the user which of details.orgIds, then push with `--org <id>`. On\nCLI_OWNER_REQUIRED (a slug in several scopes), add `--owner <ownerKey>` from details.ownerKeys, asking\nthe user if unclear.\n\n## From a repo\n\n1. Read the Tailwind config, CSS custom properties (globals.css :root and .dark), theme or token\n files, the font setup and the shared components.\n2. Copy values; never invent a color. Name keys as the code does. Write `--primary: 222 47% 11%` as\n `"hsl(222 47% 11%)"`, and oklch or named colors as hex.\n3. Map each role by how the code uses a color: page, cards, text levels, links, dividers, focus ring,\n primary button and its text. With no match, reuse the closest ref.\n4. `[light, dark]` only when the code has dark values; roles that change become light/dark maps.\n5. Add text styles (headings, body, labels) and the spacing, radius, shadow and breakpoint scales the\n code defines.\n6. Add each real component and variant, typed button, link, icon, icon-round, input, tab, badge, nav,\n avatar, logo, section, card, divider or check, with a label from the UI.\n7. Body: up to 8 Instructions (which token for what), color sections naming `{colors.X}`, Fonts,\n Layout (max width, grid, gutters), a line per component, Do and Don\'t, and Notes for gaps.\n8. Check every ref, then push.\n\n## In designs\n\nDesigns do not link to a design system: canvas.json and nodes have no field for it. Pull it and write\nits values into the HTML (`bg-[#3b5bdb]`, or CSS variables in a `<style>`), following its\nInstructions, Do and Don\'t. The canvas\'s Apply menu asks to regenerate a design "with the <name>\ndesign system": find it by name in `kombai ds list`, pull it and the node, restyle the design keeping\nits content, and push the node. A pasted `
|
|
34263
|
+
design_system_default = '# Design systems\n\nA design system is a .ds file in the user\'s Kombai account, not the repo: YAML front matter between\n`---` lines holds the tokens; the markdown after it says how to use them. Read a pulled one as the\nmodel. `kombai ds push` checks it with ds-kit.\n\n- `name` (required) and `modes`: `[light]`, `[dark]` or `[light, dark]`.\n- `color.palette` (required): named colors as quoted hex, rgb() or hsl().\n- `color.semantic`: the 11 roles in the example. Each is a ref, or `{ light: <ref>, dark: <ref> }`.\n- `typography.family`, and `typography.textStyle` with fontFamily, fontSize, fontWeight, lineHeight.\n- Optional: spacing, radius, shadow, border, opacity, motion, breakpoint, components.\n\nEvery ref must name a key you defined: `{colors.X}` (palette, also written `{color.palette.X}`), `{typography.X}` (textStyle),\n`{radius.X}`, `{spacing.X}`, `{shadow.X}`. One ref per value. The body starts with a `>` line, then\noptional `##` sections: Instructions, Brand & Accent, Surface, Text, Status & Semantic, Fonts, Layout,\nComponents, Do, Don\'t, Notes. At most 1 MB.\n\n```\n---\nname: Acme\nmodes: [light]\ncolor:\n palette: { brand: "#3b5bdb", white: "#ffffff", ink: "#16181d", line: "#e4e7ec" }\n semantic:\n background.canvas: "{colors.white}"\n surface.default: "{colors.white}"\n surface.raised: "{colors.white}"\n text.primary: "{colors.ink}"\n text.secondary: "{colors.ink}"\n text.tertiary: "{colors.ink}"\n text.link: "{colors.brand}"\n border.default: "{colors.line}"\n border.focus: "{colors.brand}"\n primary.bg: "{colors.brand}"\n primary.fg: "{colors.white}"\ntypography:\n family: { sans: "Inter" }\n textStyle:\n body: { fontFamily: "Inter", fontSize: "16px", fontWeight: 400, lineHeight: 1.5 }\ncomponents:\n button: { type: button, label: "Get started", backgroundColor: "{colors.brand}", textColor: "{colors.white}", typography: "{typography.body}", padding: "10px 18px" }\n---\n\n> One indigo accent on white, Inter throughout.\n```\n\n## Commands\n\n- `kombai ds list`: each one\'s slug, name, ownerKey, and file (null if not pulled here), and in\n publicDesignSystems Kombai\'s public ones, each with its id, name, description and file.\n- `kombai ds pull <slug>` writes the file it prints. Edit it, then `kombai ds push <file>`.\n- A public one is read-only: `kombai ds pull <id> --public` writes the file it prints. Use it as it is;\n never push or delete it.\n- To make one, write `<slug>.ds` outside the repo and push it. The file name gives the slug (lowercase\n letters, digits, dashes; a leading `ds-` is dropped); pick one `ds list` does not show. Then edit\n the file the push prints: pushing your first file again is a conflict.\n- A refused file exits 1 with CLI_INVALID_DESIGN_SYSTEM naming each problem: fix them and push again.\n Fix its warnings too.\n- `kombai ds delete <slug>` deletes one for everyone. Run it only when the user asks.\n\nownerKey is `org:<id>` (an organization\'s) or `user:<id>` (the user\'s own). A pulled file goes back to\nits owner; a new one goes to `--org <id>`, else the organization `kombai config org` saved. On\nDESIGN_ORG_REQUIRED, ask the user which of details.orgIds, then push with `--org <id>`. On\nCLI_OWNER_REQUIRED (a slug in several scopes), add `--owner <ownerKey>` from details.ownerKeys, asking\nthe user if unclear.\n\n## From a repo\n\n1. Read the Tailwind config, CSS custom properties (globals.css :root and .dark), theme or token\n files, the font setup and the shared components.\n2. Copy values; never invent a color. Name keys as the code does. Write `--primary: 222 47% 11%` as\n `"hsl(222 47% 11%)"`, and oklch or named colors as hex.\n3. Map each role by how the code uses a color: page, cards, text levels, links, dividers, focus ring,\n primary button and its text. With no match, reuse the closest ref.\n4. `[light, dark]` only when the code has dark values; roles that change become light/dark maps.\n5. Add text styles (headings, body, labels) and the spacing, radius, shadow and breakpoint scales the\n code defines.\n6. Add each real component and variant, typed button, link, icon, icon-round, input, tab, badge, nav,\n avatar, logo, section, card, divider or check, with a label from the UI.\n7. Body: up to 8 Instructions (which token for what), color sections naming `{colors.X}`, Fonts,\n Layout (max width, grid, gutters), a line per component, Do and Don\'t, and Notes for gaps.\n8. Check every ref, then push.\n\n## In designs\n\nDesigns do not link to a design system: canvas.json and nodes have no field for it. Pull it and write\nits values into the HTML (`bg-[#3b5bdb]`, or CSS variables in a `<style>`), following its\nInstructions, Do and Don\'t. The canvas\'s Apply menu asks to regenerate a design "with the <name>\ndesign system": find it by name in `kombai ds list`, pull it and the node, restyle the design keeping\nits content, and push the node. A pasted `refer design system: <name>` (Add to context in the Design\nsystems panel) names it: find that name in `kombai ds list`, in designSystems (pull with `kombai ds\npull <slug>`) or publicDesignSystems (`kombai ds pull <id> --public`), and use it for the user\'s\nrequest in the same message. If the name matches more than one, ask which. The user can view one at\n/ds/<slug>, a public one at /ds?preset=<id>, on the canvas site.\n\n## Conflicts\n\nExit 2 on a push (DESIGN_DESIGN_SYSTEM_CHANGED): it changed since you pulled it, or already existed.\nThe stored version is saved at details.remote. Merge it into your file and run the error\'s next\n(`kombai ds push <file> --merged`); if it is a different design system, rename your file instead.\n`kombai ds pull <slug> --discard` takes the stored one. Exit 2 on a pull: push your edits first, or\npull with --discard.\n';
|
|
33414
34264
|
}
|
|
33415
34265
|
});
|
|
33416
34266
|
|
|
@@ -33426,7 +34276,7 @@ var init_drawings = __esm({
|
|
|
33426
34276
|
var faq_default;
|
|
33427
34277
|
var init_faq = __esm({
|
|
33428
34278
|
"src/skill/faq.md"() {
|
|
33429
|
-
faq_default = "# Questions about Kombai\n\nAnswer the user's question from this text, briefly and in your own words. To answer, run only commands that\nchange nothing (`kombai whoami`, `kombai credits`, `kombai canvas list`). If the answer is not here, say so and\npoint them to support@kombai.com; don't guess. For design work, run `kombai skill` and follow it.\n\n## What Kombai is\n\n- **What it does.** Kombai is an AI design engineer. The coding agent runs the Kombai CLI: Kombai's taste agent\n writes design directions grounded in the user's brief and repo, and the agent builds each design as HTML on a\n hosted Kombai canvas, where the user compares, edits and refines the designs in the browser.\n- **Which agents.** Claude Code, Codex and Cursor have Kombai plugins; any agent with a terminal can run the CLI.\n
|
|
34279
|
+
faq_default = "# Questions about Kombai\n\nAnswer the user's question from this text, briefly and in your own words. To answer, run only commands that\nchange nothing (`kombai whoami`, `kombai credits`, `kombai canvas list`). If the answer is not here, say so and\npoint them to support@kombai.com; don't guess. For design work, run `kombai skill` and follow it.\n\n## What Kombai is\n\n- **What it does.** Kombai is an AI design engineer. The coding agent runs the Kombai CLI: Kombai's taste agent\n writes design directions grounded in the user's brief and repo, and the agent builds each design as HTML on a\n hosted Kombai canvas, where the user compares, edits and refines the designs in the browser.\n- **Which agents.** Claude Code, Codex and Cursor have Kombai plugins; any agent with a terminal can run the CLI.\n The Codex app shows the canvas beside the chat, and it and the Claude desktop app's Code tab show Kombai's cards\n (a taste run's brief, sign-in); elsewhere the canvas opens in the agent's own browser panel or the browser.\n- **The Kombai desktop app** is not needed: the CLI designs on a hosted canvas whether or not it is installed.\n- **Requirements.** Node.js 20 or later, and a Kombai account or guest mode. Thumbnails need a Chromium browser\n (Chrome, Edge, Brave, Arc or Chromium); without one, `kombai browser install` downloads a headless Chromium of\n about 100 MB, after asking.\n\n## Account and credits\n\n- **Without an account.** `kombai guest` gives one canvas, with no taste runs, repo images, design systems or\n sharing. The guest canvas ends on the date `kombai whoami` shows; signing in keeps it.\n- **Signing in.** `kombai login` shows a match code and opens a Kombai page in the browser, or in the agent's own\n browser panel: approve there only if the codes match. `kombai whoami` shows who is signed in. `kombai logout`\n signs this machine out; `kombai logout --everywhere` also signs out every other key, the Kombai app and the website.\n- **Credits.** Taste runs spend Kombai credits; `kombai credits` shows what is left, the plan and when it refills.\n On a team plan they are the team's shared pool. With none left, its next is the plans page. The designs\n themselves are written by the user's own coding agent, on that agent's usage.\n- **Organizations.** With several, `kombai config org <id>` sets which one owns new canvases and design systems.\n\n## Designs and data\n\n- **Where designs live.** On hosted canvases in the user's Kombai account. `kombai canvas list` lists every\n one (`--project <id>` one project's; this repo's carry its `checkoutProjectId`), and\n `kombai canvas open --canvas <id>` opens one in the browser.\n- **Editing.** The user can edit text, styles and layout on the canvas, or ask for a change from it: the canvas\n gives them a request to paste into this chat.\n- **Into code.** Ask the agent to build a design in this project: it writes it in the repo's own framework,\n components and styles, with the design as the reference.\n- **Design systems** are .ds files in the Kombai account and need no canvas; `kombai ds list` lists them.\n- **Sharing.** A new canvas is private. `kombai canvas share --canvas <id> --on` lets anyone with the link view it\n and teammates edit it; `--off` turns that off. Only the canvas's owner can.\n- **What Kombai receives.** The brief the agent writes for a taste run, each design's HTML, the repo images a\n design uses, files the agent uploads, design systems it pushes, and the thumbnails rendered on this machine.\n The rest of the repo is not uploaded.\n- **What stays here.** The sign-in key and the working copies of canvases, under ~/.kombai/cli.\n- **Usage data.** The CLI sends Kombai an event for each command (which ran, how it ended, how long it took) and\n reports unexpected errors. `DO_NOT_TRACK=1` turns both off.\n- **Deleting.** `kombai canvas delete --canvas <id>` and `kombai ds delete <slug>` delete for everyone. Deleting\n ~/.kombai removes what is stored on this machine. To close the account, email support@kombai.com.\n\n## Setup and problems\n\n- **Permissions.** Kombai needs network access and writes ~/.kombai, so an agent with a sandbox asks to run it\n outside.\n- **The desktop app's skills.** The first Kombai command on a machine removes the skills the Kombai desktop app\n wrote into the agents' skills folders (`design-with-kombai`, `kombai-faq`, `kombai-status` and the rest), which\n drive the app instead of the CLI. Only the app's own copies go; other skills, the user's own included, stay. An\n agent session that was already open lists them until it restarts.\n- **Updates.** The plugins run the CLI through npx, which fetches the newest release itself; a global install\n updates with npm. The plugin updates through the agent's own plugin manager.\n- **Reporting a problem.** Email support@kombai.com with the command, the JSON line it printed and the version\n `kombai --version` prints.\n";
|
|
33430
34280
|
}
|
|
33431
34281
|
});
|
|
33432
34282
|
|
|
@@ -33434,7 +34284,7 @@ var init_faq = __esm({
|
|
|
33434
34284
|
var html_default;
|
|
33435
34285
|
var init_html = __esm({
|
|
33436
34286
|
"src/skill/html.md"() {
|
|
33437
|
-
html_default = '# Writing a design\'s HTML\n\nThe file `kombai node start` prints holds one design. The canvas shows it live in a frame, and\n`kombai screenshot fill` renders the thumbnail most viewers see. Write it so both look the same.\n\n## Build in passes\n\nnode start creates the file, empty. Read it right after node start, before your first write, even though\nit is empty: an editor that writes only files it has read refuses the write otherwise, and the page you\nwrote is lost. Push the first pass within 30 minutes of node start, or the placeholder expires.\n\n1. First pass: every section in order, with its layout, headings and real copy.\n2. Each later pass: one or two sections\' art, motion and interactions.\n\nPush after each pass, and only once its write has succeeded: never in the same batch of tool calls as\nthe write. The canvas shows each push live, so the user watches the page fill in. Check the design once,\nafter its last pass ("Check a finished design" in the overview).\n\n## The file\n\n- Body content only: no `<!DOCTYPE>`, `<html>`, `<head>` or `<body>`. The canvas and the thumbnail\n both wrap it in their own page, inside a `<div id="root">`, so `body > \u2026` selectors match nothing.\n- So the file is a fragment, not a web page: opened on its own it looks broken. Never open, preview or\n serve it, and never link or name its path to the user. To point the user at a design, give the `url`\n node start, node pull and node push print for it: the canvas, with that design in focus. A guest\'s
|
|
34287
|
+
html_default = '# Writing a design\'s HTML\n\nThe file `kombai node start` prints holds one design. The canvas shows it live in a frame, and\n`kombai screenshot fill` renders the thumbnail most viewers see. Write it so both look the same.\n\n## Build in passes\n\nnode start creates the file, empty. Read it right after node start, before your first write, even though\nit is empty: an editor that writes only files it has read refuses the write otherwise, and the page you\nwrote is lost. Push the first pass within 30 minutes of node start, or the placeholder expires.\n\n1. First pass: every section in order, with its layout, headings and real copy.\n2. Each later pass: one or two sections\' art, motion and interactions.\n\nPush after each pass, and only once its write has succeeded: never in the same batch of tool calls as\nthe write. The canvas shows each push live, so the user watches the page fill in. Check the design once,\nafter its last pass ("Check a finished design" in the overview).\n\n## The file\n\n- Body content only: no `<!DOCTYPE>`, `<html>`, `<head>` or `<body>`. The canvas and the thumbnail\n both wrap it in their own page, inside a `<div id="root">`, so `body > \u2026` selectors match nothing.\n- So the file is a fragment, not a web page: opened on its own it looks broken. Never open, preview or\n serve it, and never link or name its path to the user. To point the user at a design, give the `url`\n node start, node pull and node push print for it: the canvas, with that design in focus. Where\n `canvas_app` shows the canvas beside the chat, name the design instead, with no link unless the user\n asks for one. A guest\'s `url` is null: point them at the canvas you showed them.\n- Style with Tailwind v4 classes or with your own CSS in a `<style>`. Put every `<style>`, `<link>` and\n library `<script>` at the top of the body. Load Google Fonts with `@import url(\u2026)` as the first line of a\n `<style>`. Set the font, text color and background on your outermost element.\n- Tailwind: add no Tailwind script; Kombai loads Tailwind v4 when the design uses its classes. The canvas\n builds CSS only from classes written in `class="\u2026"`: no config, `@apply`, `@theme` or\n `<style type="text/tailwindcss">`, and a class only a script adds gets no CSS there; write that styling as\n plain CSS in a `<style>`. Use v4 utilities (`bg-black/50`, not `bg-opacity-50`), and CSS variables as\n `bg-(--brand)` or `bg-[var(--brand)]`, never `bg-[--brand]`. On a page with Tailwind classes, style\n no `*` or bare tags in a `<style>`: CSS there beats every Tailwind class.\n- Your own CSS, with no Tailwind classes: the page owns its defaults. Start its `<style>` with a reset\n (margin, padding and box-sizing on `*`) and style headings, lists, links, buttons and images yourself,\n so the page looks the same whether or not Tailwind is loaded. Don\'t name classes like Tailwind\n utilities (`flex`, `hidden`, `text-center`, `p-4`): the canvas may take the page for Tailwind.\n- Define every `@keyframes` you use.\n- `kombai node push` writes a `data-kid="\u2026"` id onto each element of a changed file before it sends it: the id\n the canvas and the user\'s requests name an element by. Read the file again before your next pass to get them.\n Keep the ids when you edit; give a new element none, the next push numbers it.\n\n## Size and position\n\n- A design is 1280 px wide. `--viewport mobile`, `--viewport tablet` or `--viewport desktop` on\n `kombai node start` makes it 390, 768 or 1280. Design for that width: one design per device, not one\n with breakpoints.\n- A design is content height unless you give it a height: its frame is as tall as its page and never\n scrolls. So:\n - Give heights in px (`h-[720px]`, `min-height: 640px`). `h-screen`, `min-h-screen` and `100vh` come out\n 1000 px tall, on the canvas and in the thumbnail.\n - Do not size anything from `window.innerHeight`: on the canvas it is the whole page\'s height.\n- What needs the page to scroll needs a design with a height of its own: scroll-driven effects (scroll\n listeners, parallax, pinned or scrubbed sections, GSAP ScrollTrigger), `sticky` and `fixed` elements, and\n smooth scrolling (Lenis, Locomotive). At content height nothing scrolls, so none of them run: a pinned\n section\'s runway shows as empty space, a sticky element never sticks, and a fixed bottom bar lands 1000 px\n down, mid-page; selected, the canvas shows a page that pins in a device-height window it cannot scroll.\n So after the first push, set the design\'s `rect.h` in canvas.json to its device height (desktop 800,\n tablet 1024, mobile 812) and run `kombai canvas push --canvas <id>`. Selected, it then scrolls inside that\n window and all of these run as on a real page. A reveal that only waits to come into view\n (IntersectionObserver) needs no height: it runs as the viewer pans to it.\n- The thumbnail scrolls the page through once and settles its animations, so it shows the page as a\n visitor who scrolled to the bottom left it: every reveal shown, pinned sections and parallax layers at\n their end, no runway. It takes scrubbed animations at their end too, so an element that fades or slides\n out as the page scrolls is missing from it: animate things in, not out. A design with a height gets the\n whole page as its thumbnail, seen through its window: a sticky element shows where it starts, and a fixed\n one where it sits on the first screen, so a bar fixed to the bottom shows at that screen\'s foot, mid-page.\n- The thumbnail stops at 16,000 px.\n\n## Scripts\n\n- Load each library from a CDN with its own `<script src>` and a pinned version: Chart.js for charts,\n GSAP or Motion for animation. Only public https hosts load.\n- The thumbnail renders with reduced motion. It scrolls the page through, runs GSAP, ScrollTrigger, anime\n and Web Animations to their end, pauses CSS animations and video, and is taken once fonts and images\n are in. The page must look finished by then:\n - Chart.js: `options: { animation: false }`.\n - CSS entrance animations: behind `motion-safe:` or `@media (prefers-reduced-motion: no-preference)`.\n - A page that fills in late (JS entrance animations, content a script draws) sets\n `window.KOMBAI_READY = false` at the top, and `true` when done (or dispatches a `kombai:ready`\n event on window). The thumbnail waits up to 20 s, then takes the page as it is. A page whose text\n names either is waited for, so name them only if you signal.\n\n## Images and video\n\n- Repo files: `/api/local/images/<path from the repo root>`, in src, srcset, poster or CSS `url()`.\n `kombai node push` uploads each one: png, jpg, jpeg, webp, gif, svg, mp4 or webm, up to 20 MB, at\n most 100 per design. Write each path in full, with spaces as `%20`; a path a script builds is not\n uploaded.\n- A file outside the repo, such as an image you generated: `kombai asset push <file> --canvas <id>`\n prints its url. Use that url.\n- Stock photos: use the links directions.md gives, with size params added. images.unsplash.com:\n `?auto=format&w=<px>&q=80&fit=crop`. images.pexels.com: `?auto=compress&cs=tinysrgb&w=<px>&q=80`.\n The bare link is the full-size original.\n- Icons: inline SVG from the library directions.md names.\n- `<img decoding="async" alt="\u2026">`. `loading="lazy"` is fine: the thumbnail loads every image first.\n- Video: `<video src="\u2026" poster="\u2026" autoplay muted loop playsinline preload="metadata">`. Always set a\n poster: it shows until the video plays. Drop autoplay and loop only for click-to-play, such as a\n walkthrough.\n- Every other URL is absolute and public https: relative paths do not resolve, and the thumbnail\n refuses localhost and private addresses.\n- Never invent an image URL.\n\n## Content\n\n- Real copy from the brief and the repo: real names, numbers and dates. No lorem ipsum. No text for the\n reviewer: no design notes, captions explaining the layout, or "click to see".\n- Plain section headings, as a product\'s UI would have them: "Plans", "Details", "Team", not "What it\n costs", "How it works" or "Who is on site this week".\n- One page or screen per design; a modal or drawer is its own design. For a component, design only\n it, on a plain background.\n- Give each meaningful element a `data-name` saying what it is ("pricing card", "hero headline"): the\n canvas editor shows it.\n- No `dark:` classes or `prefers-color-scheme` queries: they follow the viewer\'s theme, so the canvas and\n the thumbnail can differ. A dark version is its own design.\n\n## Patterns to avoid, unless asked\n\n- Drop shadows on cards; gradient-filled headline text.\n- The stock hero: headline, image, two buttons, badges.\n- Three icon-topped cards in a row; plain pricing, testimonial or two-row stat cards.\n- A footer of only links and a logo; a form or call-out as one big card.\n- Fade-in on appear and lift on hover as the only motion; buttons with the usual radius and hover.\n';
|
|
33438
34288
|
}
|
|
33439
34289
|
});
|
|
33440
34290
|
|
|
@@ -33442,7 +34292,7 @@ var init_html = __esm({
|
|
|
33442
34292
|
var opening_default;
|
|
33443
34293
|
var init_opening = __esm({
|
|
33444
34294
|
"src/skill/opening.md"() {
|
|
33445
|
-
opening_default = "# Showing the canvas\n\nShow a canvas to the user once, when you create or first use it. The page updates live as you push, so\nnever open it again after a push. Pick the first of these that fits:\n\n1. **A `canvas_app` tool is listed** (the Kombai view): call `canvas_app` with the canvas id, and `node`\n set to a design id to focus one. It shows the canvas beside the chat. Call it once per canvas: each\n call opens another view. Make changes with the commands, never through the view.\n2. **You have a browser panel
|
|
34295
|
+
opening_default = "# Showing the canvas\n\nShow a canvas to the user once, when you create or first use it. The page updates live as you push, so\nnever open it again after a push. Pick the first of these that fits:\n\n1. **A `canvas_app` tool is listed** (the Kombai view): call `canvas_app` with the canvas id, and `node`\n set to a design id to focus one. It shows the canvas beside the chat. Call it once per canvas: each\n call opens another view. Make changes with the commands, never through the view.\n2. **You have a browser panel the user can see** (the one you sign in with, `kombai skill sign-in`):\n `kombai canvas url --canvas <id> --in-app` prints a signed-in link. Open it in your panel. It works once,\n within 10 minutes; for a later visit, run it again.\n3. **Otherwise**: `kombai canvas open --canvas <id>` opens the canvas in the user's browser, signed in.\n If it answers opened: false (no browser on this machine), give the user the link it printed instead.\n\nTo point the user at one design, give the `url` node start, node pull or node push printed for it, or\nadd ?node=<node> to the canvas link. Never the design's .html file, and never a link that holds a\n#ticket=; it signs in whoever opens it first.\n\n**Beside the chat, no links.** Once `canvas_app` shows the canvas, the user watches every change there.\nEnd with a short line on what you made or changed, naming designs by their labels. Put no canvas or\ndesign link in your replies, and don't ask the user to open the canvas. Give a link only when the user\nasks for one.\n\n**A new canvas is private.** When you give the user a link, don't suggest they send it to anyone before sharing it.\n\n**Never turn sharing on by yourself.** Run `kombai canvas share --on` only when the user asks for a link others can open, and tell them in the reply that anyone with the link can now view it and teammates can edit it.\n";
|
|
33446
34296
|
}
|
|
33447
34297
|
});
|
|
33448
34298
|
|
|
@@ -33450,7 +34300,7 @@ var init_opening = __esm({
|
|
|
33450
34300
|
var overview_default;
|
|
33451
34301
|
var init_overview = __esm({
|
|
33452
34302
|
"src/skill/overview.md"() {
|
|
33453
|
-
overview_default = '# Kombai design\n\nDesign UI on a hosted Kombai canvas; design systems need no canvas. `kombai <command> --help` gives its\nflags. Read each JSON result: next can be a command, a link or advice. Follow it after handling the error\nand any required user choice.\nSkill text and default help are plain text. Tell the user in one line before and after each step that\ntakes more than a few seconds.\n\n{{RUN}}\n\nRun `kombai` outside any sandbox from the first try: it needs network and writes ~/.kombai.\n\n{{APP}}\n\n## Choose the task\n\n- New design: follow New designs below.\n- Existing canvas or node (a link, "On my Kombai canvas" message, or a named canvas): read\n `kombai skill actions`, pull the target and follow that request. An edit needs no
|
|
34303
|
+
overview_default = '# Kombai design\n\nDesign UI on a hosted Kombai canvas; design systems need no canvas. `kombai <command> --help` gives its\nflags. Read each JSON result: next can be a command, a link or advice. Follow it after handling the error\nand any required user choice.\nSkill text and default help are plain text. Tell the user in one line before and after each step that\ntakes more than a few seconds.\n\n{{RUN}}\n\nRun `kombai` outside any sandbox from the first try: it needs network and writes ~/.kombai.\n\n{{APP}}\n\n## Choose the task\n\n- New design: follow New designs below.\n- Existing canvas or node (a link, "On my Kombai canvas" message, or a named canvas): read\n `kombai skill actions`, pull the target and follow that request. An edit needs no taste; variants\n seeking new ideas do. Neither needs a new canvas.\n- Design systems (.ds): read `kombai skill design-system`.\n- Shapes, pictures or layout: read `kombai skill drawings`.\n- Questions about Kombai itself (account, credits, data, setup): read `kombai skill faq`.\n\nAt the start of each request, run `kombai whoami`. Unless it prints an email with no claim, read\n`kombai skill sign-in` and follow it. Read it before any `kombai login`.\n\n## New designs\n\n1. Read `kombai skill brief` and the repo before writing a brief outside the repo. The topic says\n when a reference or reflow skips taste.\n2. When taste is needed (never for a guest), tell the user their `kombai credits` balance first,\n then run `kombai taste start --brief <file> --variants <1-4>`, one per design. A run takes minutes:\n do step 3 meanwhile, then `kombai taste wait <run>`, again while its status is running. Follow\n directions.md. On TASTE_NO_CREDITS, call plans_card if listed, else show next\'s plan link; stop.\n3. Create a canvas: `kombai canvas create --name "<what it is>"`. Reuse one only when the user points\n to it or this conversation made it; `kombai canvas list` finds it by name (this repo\'s carry its\n `checkoutProjectId` as `projectId`). Ask if the target is unclear. On DESIGN_ORG_REQUIRED, ask which listed org, save `kombai config org <id>`, then retry.\n Read `kombai skill opening` and show the canvas once when creating or first using it.\n It starts private; share only when asked.\n4. Before writing HTML, read `kombai skill html`: it says how to build in passes. For each design,\n `kombai node start --canvas <id> --label "<label>"` (`--parent <node>` for a variant), then write\n and push it as that topic says.\n\n## Check a finished design\n\nAfter a design\'s last push, run the complete screenshot fill its next names in the background. Then run\n`kombai screenshot wait --canvas <id> --node <node> --tiles` and inspect each image it prints.\nRun node lock, fix and push again, at most 3 rounds. On CLI_NO_BROWSER or CLI_LAUNCH_FAILED from fill,\nask before the roughly 100 MB download; then `kombai browser install --yes` and retry fill.\nIf wait reports CLI_NOTHING_RENDERING, run its suggested fill only if none is running; on\nCLI_SCREENSHOT_FAILED, inspect the failure reason before retrying.\n\n## Recover from errors\n\nExit 2 is not always a changed node.\nFor DESIGN_NODE_CHANGED on node push, merge the stored version at error.details.remote into your\nfile, then `kombai node push --canvas <id> --node <node> --merged`. Only to discard your edit, use\n`kombai node pull --canvas <id> --node <node> --discard`.\n\nRun commands that change a canvas\'s files (node start, node push, node pull, canvas pull, canvas push)\none at a time per canvas, and edit files only between them; screenshot fill and screenshot wait can run\nbeside them.\n\nExit codes: 0 done, 1 failed, 2 refused or conflict, 3 not signed in, 4 timed out. A wait timeout\ndoes not mean the work failed: follow its next; check a fill\'s result if no image arrives.\n';
|
|
33454
34304
|
}
|
|
33455
34305
|
});
|
|
33456
34306
|
|
|
@@ -33458,7 +34308,7 @@ var init_overview = __esm({
|
|
|
33458
34308
|
var sign_in_default;
|
|
33459
34309
|
var init_sign_in = __esm({
|
|
33460
34310
|
"src/skill/sign-in.md"() {
|
|
33461
|
-
sign_in_default = "# Signing in, or trying Kombai as a guest\n\nWhat `kombai whoami` printed decides. The reasons
|
|
34311
|
+
sign_in_default = "# Signing in, or trying Kombai as a guest\n\nWhat `kombai whoami` printed decides. Where your tools list `sign_in_card`, it asks the sign-in questions below in\nyour place (read The sign-in card at the end first); you still ask the claim needs_org question yourself. The reasons\nbelow apply to any exit-3 CLI_NOT_SIGNED_IN, not just whoami's:\n\n- Exit 3 with details.reason none: ask once, \"Kombai works best signed in. Sign in now, or try it without an account?\"\n Sign in: see Signing in. Try it: run `kombai guest`, then work as a guest (below).\n- Exit 3 with reason expired or signed_out: the user has an account. Offer sign-in only, never guest mode. With\n claim pending in details, signing in also moves the guest canvas into the account.\n- Any other or missing reason: offer sign-in only.\n- Exit 0 with status guest: the user already chose. Work as a guest without asking again.\n- An email with claim needs_org: ask which listed organization gets the guest canvas, then run\n `kombai claim --org <id>`. With claim pending, the next command finishes it.\n\n## Signing in\n\nBefore any `kombai login`, check whether you have a browser panel the user can see. That decides the command; run\nit in the background:\n\n1. You have a browser panel the user can see (the Codex app's in-app browser, the Claude desktop app's Browser pane):\n run `kombai login --no-browser`, show the matchCode from its first line, and open the url from that line in your\n panel. The user signs in and approves there. With such a panel, never run `kombai login` without --no-browser.\n2. No such panel: run `kombai login` and show the matchCode from its first line. The user approves on the page it\n opens in their browser, or, if they see none, at the url from that line.\n\nNever type into, click on or approve that page yourself: the approval is the user's check that the match code is\ntheirs. If they'd rather use their own browser, give them that url, for them alone: whoever approves it signs this\nCLI into their account. When the signed-in line has claimed, the guest canvas is now in the account, same link. When\nit has claim needs_org, ask as above.\n\n## As a guest\n\n- The whoami at the start of each request matters most here: the user may have signed in since, in another chat or\n on a card. When it no longer says guest, drop everything below.\n- Skip taste: no brief and no `kombai taste start`. Go straight to `kombai canvas create`. A guest has one canvas: when\n canvas create answers DESIGN_GUEST_LIMIT with a canvasId in details, use that canvas.\n- Use no repo images (/api/local/images/\u2026): CSS, inline SVG or public https images instead.\n- The canvas link is the user's own. Open it for them; don't suggest sending it to anyone.\n- When whoami's expires is within 7 days, say once in this conversation that the guest canvas ends on that date and\n that signing in keeps it.\n- End each turn with one line: signing in unlocks taste directions, repo images, design systems and sharing.\n\n## Refusals\n\n- DESIGN_SIGNIN_REQUIRED or CLI_SIGNIN_REQUIRED: tell the user in one line what signing in unlocks, and sign in\n (Signing in) only if they agree.\n- DESIGN_GUEST_LIMIT on any other command (node start, node push, screenshot fill): the guest canvas is full. Say so\n in one line, and that signing in keeps the canvas and lifts the limit; sign in only if they agree. Don't retry or\n work around it, and keep the unpushed files: push them again after sign-in.\n- SIGNIN_GUEST_RATE from `kombai guest`: this network has made too many guests today. Say so in one line, and offer\n sign-in only (Signing in); don't run `kombai guest` again today.\n- SIGNIN_GUEST_EXPIRED as an error from a guest's own command: say the guest canvas expired, and ask again: sign in,\n or start fresh with `kombai guest`.\n- SIGNIN_GUEST_EXPIRED as a warning on a signed-in line (an email is printed): say in one line that the old guest\n canvas expired and is gone. Never offer `kombai guest`.\n- SIGNIN_GUEST_CLAIMED as an error from a guest's own command: the canvas moved into an account; signing in reaches\n it. As a warning on a signed-in line: nothing to do.\n\n## The sign-in card\n\nWhere your tools list `sign_in_card`, call it in place of the lines above, with the moment's reason, and end your\nturn; don't run or offer `kombai login` in text:\n\n- start: whoami exits 3, in place of asking whether to sign in or try it without an account. The user chooses on the\n card; when they say to carry on, run `kombai whoami` and go on as it says.\n- canvas_full: DESIGN_GUEST_LIMIT with no canvasId in details. second_canvas: with one (still use that canvas).\n- taste: taste refused or asked for. repo_images: CLI_SIGNIN_REQUIRED with images in details.\n- account: any other DESIGN_SIGNIN_REQUIRED or CLI_SIGNIN_REQUIRED.\n- ending: once, when whoami's expires is within 7 days. It is a reminder, not a refusal: don't end your turn after\n it; carry on with the request.\n\nIf the user then asks you in the chat to sign them in, do it as Signing in says.\nWithout `sign_in_card`, use the lines above.\n";
|
|
33462
34312
|
}
|
|
33463
34313
|
});
|
|
33464
34314
|
|
|
@@ -33942,7 +34792,7 @@ async function storeDrawingPicture(cc, projectId, drawing, file2, nodeId, stored
|
|
|
33942
34792
|
}
|
|
33943
34793
|
function repoImagesRefused({ nodeId, images }) {
|
|
33944
34794
|
return signInRequired(
|
|
33945
|
-
"Repo images need a Kombai account. Use CSS, inline SVG or a public https image instead, or sign in
|
|
34795
|
+
"Repo images need a Kombai account. Use CSS, inline SVG or a public https image instead, or sign in.",
|
|
33946
34796
|
{ ...nodeId === void 0 ? {} : { nodeId }, images }
|
|
33947
34797
|
);
|
|
33948
34798
|
}
|
|
@@ -34444,7 +35294,7 @@ var init_node = __esm({
|
|
|
34444
35294
|
};
|
|
34445
35295
|
nodeLock = {
|
|
34446
35296
|
name: "node lock",
|
|
34447
|
-
summary: "Mark a design as being edited, so the canvas shows it busy: run it
|
|
35297
|
+
summary: "Mark a design as being edited, so the canvas shows it busy: run it before you pull and change a design already on the canvas, and before each fix after a push. A new design needs none: the canvas shows its placeholder busy. It lasts 10 minutes; run it again to keep it. node push ends it.",
|
|
34448
35298
|
flags: {
|
|
34449
35299
|
canvas: { type: "string", required: true, placeholder: "<id|link>", check: canvasRefProblem },
|
|
34450
35300
|
node: { type: "string", required: true, placeholder: "<id>", check: (value) => nodeIdProblem(value) }
|
|
@@ -34860,7 +35710,7 @@ var init_screenshot = __esm({
|
|
|
34860
35710
|
if (result.signedOut)
|
|
34861
35711
|
throw new CliError("UNAUTHORIZED", "The key stopped working.", {
|
|
34862
35712
|
exit: Exit.NOT_SIGNED_IN,
|
|
34863
|
-
next:
|
|
35713
|
+
next: SIGN_IN_NEXT,
|
|
34864
35714
|
details: lists()
|
|
34865
35715
|
});
|
|
34866
35716
|
if (result.guestFull) {
|
|
@@ -35104,7 +35954,7 @@ var init_commands = __esm({
|
|
|
35104
35954
|
});
|
|
35105
35955
|
|
|
35106
35956
|
// src/lib/app-skills.js
|
|
35107
|
-
import { access, readdir, rm } from "node:fs/promises";
|
|
35957
|
+
import { access, lstat, readdir, rm } from "node:fs/promises";
|
|
35108
35958
|
import path23 from "node:path";
|
|
35109
35959
|
function appSkillDirsOf(home, env) {
|
|
35110
35960
|
const dirs = [
|
|
@@ -35157,10 +36007,16 @@ async function removeIfApps(folder) {
|
|
|
35157
36007
|
} catch (error2) {
|
|
35158
36008
|
return isAbsent(error2);
|
|
35159
36009
|
}
|
|
35160
|
-
|
|
35161
|
-
()
|
|
35162
|
-
|
|
35163
|
-
|
|
36010
|
+
try {
|
|
36011
|
+
if ((await lstat(folder)).isDirectory()) {
|
|
36012
|
+
const names = (await readdir(folder)).filter((name) => name !== APP_MARKER);
|
|
36013
|
+
await Promise.all(names.map((name) => rm(path23.join(folder, name), { recursive: true, force: true })));
|
|
36014
|
+
}
|
|
36015
|
+
await rm(folder, { recursive: true, force: true });
|
|
36016
|
+
return true;
|
|
36017
|
+
} catch {
|
|
36018
|
+
return false;
|
|
36019
|
+
}
|
|
35164
36020
|
}
|
|
35165
36021
|
function isAbsent(error2) {
|
|
35166
36022
|
return isErrno(error2, "ENOENT") || isErrno(error2, "ENOTDIR");
|