@kombai/cli 0.1.2-beta.4 → 0.1.2-beta.6
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/README.md +2 -2
- package/dist/kombai.mjs +453 -191
- 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
|
}
|
|
@@ -1553,9 +1557,9 @@ var init_env = __esm({
|
|
|
1553
1557
|
preprod: { api: "https://api.assistant.preprod.kombai.com", web: "https://agent.preprod.kombai.com" },
|
|
1554
1558
|
prod: { api: "https://api.assistant.app.kombai.com", web: "https://agent.kombai.com" }
|
|
1555
1559
|
});
|
|
1556
|
-
DEFAULT_ENV = Object.hasOwn(ENVIRONMENTS, "
|
|
1560
|
+
DEFAULT_ENV = Object.hasOwn(ENVIRONMENTS, "preprod") ? (
|
|
1557
1561
|
/** @type {EnvName} */
|
|
1558
|
-
"
|
|
1562
|
+
"preprod"
|
|
1559
1563
|
) : "prod";
|
|
1560
1564
|
}
|
|
1561
1565
|
});
|
|
@@ -1758,11 +1762,11 @@ 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.6" : (
|
|
1762
1766
|
/** @type {{ version: string }} */
|
|
1763
1767
|
JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version
|
|
1764
1768
|
);
|
|
1765
|
-
CLI_RUN = true ? "npx -y @kombai/cli@
|
|
1769
|
+
CLI_RUN = true ? "npx -y @kombai/cli@beta" : "npx -y @kombai/cli@latest";
|
|
1766
1770
|
}
|
|
1767
1771
|
});
|
|
1768
1772
|
|
|
@@ -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));
|
|
@@ -3736,6 +3741,36 @@ var init_auth = __esm({
|
|
|
3736
3741
|
}
|
|
3737
3742
|
});
|
|
3738
3743
|
|
|
3744
|
+
// src/lib/codex-app.js
|
|
3745
|
+
function linkField(ctx, url2) {
|
|
3746
|
+
return ctx.codexDesktop ? {} : { url: url2 };
|
|
3747
|
+
}
|
|
3748
|
+
function canvasJsonLink(ctx, url2) {
|
|
3749
|
+
return ctx.codexDesktop ? null : url2;
|
|
3750
|
+
}
|
|
3751
|
+
function inCodexDesktop(env) {
|
|
3752
|
+
return Boolean(env.CODEX_THREAD_ID) && env.CLAUDECODE !== "1" && env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE === CODEX_DESKTOP_ORIGINATOR;
|
|
3753
|
+
}
|
|
3754
|
+
function showWithCanvasApp(canvas) {
|
|
3755
|
+
return `Call the canvas_app tool with ${JSON.stringify({ canvas })} (find it with ${FIND_CANVAS_APP}).`;
|
|
3756
|
+
}
|
|
3757
|
+
function viewInstead(canvas) {
|
|
3758
|
+
return {
|
|
3759
|
+
shown: false,
|
|
3760
|
+
next: `${showWithCanvasApp(canvas)} In the Codex app it shows the canvas beside the chat. ${VIEW_MISSING}`
|
|
3761
|
+
};
|
|
3762
|
+
}
|
|
3763
|
+
var CODEX_DESKTOP_ORIGINATOR, FIND_CANVAS_APP, VIEW_MISSING;
|
|
3764
|
+
var init_codex_app = __esm({
|
|
3765
|
+
"src/lib/codex-app.js"() {
|
|
3766
|
+
"use strict";
|
|
3767
|
+
init_define_KOMBAI_TELEMETRY();
|
|
3768
|
+
CODEX_DESKTOP_ORIGINATOR = "Codex Desktop";
|
|
3769
|
+
FIND_CANVAS_APP = "ALL_TOOLS.filter((t) => t.name.endsWith('canvas_app'))";
|
|
3770
|
+
VIEW_MISSING = "If no canvas_app tool exists, Kombai's view is not connected in this chat: tell the user it comes with the Kombai plugin (install or turn it on, or start a new chat if it is on), and show no link instead.";
|
|
3771
|
+
}
|
|
3772
|
+
});
|
|
3773
|
+
|
|
3739
3774
|
// ../../node_modules/escape-string-regexp/index.js
|
|
3740
3775
|
var require_escape_string_regexp = __commonJS({
|
|
3741
3776
|
"../../node_modules/escape-string-regexp/index.js"(exports, module) {
|
|
@@ -8217,7 +8252,7 @@ async function restoreLost(ctx, paths, base, observed) {
|
|
|
8217
8252
|
return { nodeId, entry, layout: entry.layout, info: infoOf(paths, nodeId, entry.type, entry.state, hasFile) };
|
|
8218
8253
|
}),
|
|
8219
8254
|
observed,
|
|
8220
|
-
{ canvas: { name: base.name, url: base.url } }
|
|
8255
|
+
{ canvas: { name: base.name, url: canvasJsonLink(ctx, base.url ?? void 0) } }
|
|
8221
8256
|
);
|
|
8222
8257
|
return moved;
|
|
8223
8258
|
}
|
|
@@ -8249,6 +8284,7 @@ var init_canvas = __esm({
|
|
|
8249
8284
|
init_api();
|
|
8250
8285
|
init_canvasops();
|
|
8251
8286
|
init_canvasdir();
|
|
8287
|
+
init_codex_app();
|
|
8252
8288
|
init_contract();
|
|
8253
8289
|
init_screenshots();
|
|
8254
8290
|
init_fsx();
|
|
@@ -8290,9 +8326,7 @@ var init_canvas = __esm({
|
|
|
8290
8326
|
}
|
|
8291
8327
|
);
|
|
8292
8328
|
}
|
|
8293
|
-
if (error2 instanceof CliError && error2.code === "DESIGN_ORG_REQUIRED")
|
|
8294
|
-
error2.next = `kombai canvas create --name ${JSON.stringify(name)} --org <id>`;
|
|
8295
|
-
}
|
|
8329
|
+
if (error2 instanceof CliError && error2.code === "DESIGN_ORG_REQUIRED") error2.next = "kombai config org <id>";
|
|
8296
8330
|
if (error2 instanceof CliError && error2.code === "DESIGN_GUEST_LIMIT" && typeof error2.details?.canvasId === "string")
|
|
8297
8331
|
await rememberGuestCanvas(ctx, cc, error2.details.canvasId);
|
|
8298
8332
|
throw error2;
|
|
@@ -8302,7 +8336,7 @@ var init_canvas = __esm({
|
|
|
8302
8336
|
await Promise.all([ensureDir(paths.nodes), ensureDir(paths.baseNodes)]);
|
|
8303
8337
|
await writeJsonAtomic(
|
|
8304
8338
|
paths.canvasJson,
|
|
8305
|
-
{ canvasId: created.id, name: created.name, url: created.url, nodes: {} },
|
|
8339
|
+
{ canvasId: created.id, name: created.name, url: canvasJsonLink(ctx, created.url), nodes: {} },
|
|
8306
8340
|
{ mode: 420 }
|
|
8307
8341
|
);
|
|
8308
8342
|
await writeJsonAtomic(
|
|
@@ -8326,23 +8360,31 @@ var init_canvas = __esm({
|
|
|
8326
8360
|
return {
|
|
8327
8361
|
canvasId: created.id,
|
|
8328
8362
|
name: created.name,
|
|
8329
|
-
|
|
8363
|
+
...linkField(ctx, created.url),
|
|
8330
8364
|
sharing: created.sharing,
|
|
8331
8365
|
projectId: cc.checkout.projectId,
|
|
8332
8366
|
ownerKey: created.ownerKey,
|
|
8333
|
-
dir: paths.dir
|
|
8367
|
+
dir: paths.dir,
|
|
8368
|
+
// In the Codex app the view shows the new canvas before any design is written (opening-codex.md), as the next
|
|
8369
|
+
// step an agent takes without reading further.
|
|
8370
|
+
...ctx.codexDesktop ? { next: `${showWithCanvasApp(created.id)} Do it now, before you write any design. ${VIEW_MISSING}` } : {}
|
|
8334
8371
|
};
|
|
8335
8372
|
}
|
|
8336
8373
|
};
|
|
8337
8374
|
canvasList = {
|
|
8338
8375
|
name: "canvas list",
|
|
8339
|
-
summary: "List this repo's
|
|
8340
|
-
flags: {
|
|
8341
|
-
|
|
8376
|
+
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.",
|
|
8377
|
+
flags: {
|
|
8378
|
+
project: { type: "string", placeholder: "<id>", check: projectIdProblem },
|
|
8379
|
+
// Every project is the default; kept so an older skill's `canvas list --all` still runs.
|
|
8380
|
+
all: { type: "boolean", hidden: true }
|
|
8381
|
+
},
|
|
8382
|
+
exclusive: [["project", "all"]],
|
|
8383
|
+
example: "kombai canvas list --project prj_0123456789abcdef",
|
|
8342
8384
|
async run(ctx, { flags }) {
|
|
8343
8385
|
const cc = await canvasContext(ctx, flags, { allowGuest: flags.all !== true });
|
|
8344
|
-
const
|
|
8345
|
-
const listPath =
|
|
8386
|
+
const project = typeof flags.project === "string" ? flags.project : cc.session.kind === "guest" ? cc.checkout.projectId : null;
|
|
8387
|
+
const listPath = project ? `/design/projects/${project}/canvases` : "/design/canvases";
|
|
8346
8388
|
const items = [];
|
|
8347
8389
|
let cursor;
|
|
8348
8390
|
do {
|
|
@@ -8354,9 +8396,19 @@ var init_canvas = __esm({
|
|
|
8354
8396
|
items.push(...res.body.items);
|
|
8355
8397
|
cursor = res.body.nextCursor ?? void 0;
|
|
8356
8398
|
} while (cursor);
|
|
8357
|
-
const
|
|
8399
|
+
const named2 = items.map((item) => ({
|
|
8400
|
+
item,
|
|
8401
|
+
/** @type {string | null} */
|
|
8402
|
+
projectId: typeof item.projectId === "string" && item.projectId ? item.projectId : project
|
|
8403
|
+
}));
|
|
8404
|
+
const here = (entry) => entry.projectId === cc.checkout.projectId;
|
|
8405
|
+
const listed = [...named2.filter(here), ...named2.filter((entry) => !here(entry))];
|
|
8406
|
+
const ids = new Set(listed.map(({ item }) => item.id));
|
|
8358
8407
|
const ws = await loadWorkspace(cc.work, cc.checkout, (ws2) => {
|
|
8359
|
-
|
|
8408
|
+
if (!project) {
|
|
8409
|
+
for (const id of Object.keys(ws2.canvases)) if (!ids.has(id)) delete ws2.canvases[id];
|
|
8410
|
+
}
|
|
8411
|
+
for (const { item, projectId } of listed) if (projectId) ws2.canvases[item.id] = projectId;
|
|
8360
8412
|
});
|
|
8361
8413
|
const deleted = [];
|
|
8362
8414
|
for (const [canvasId, at] of Object.entries(ws.deleted)) {
|
|
@@ -8371,23 +8423,22 @@ var init_canvas = __esm({
|
|
|
8371
8423
|
});
|
|
8372
8424
|
}
|
|
8373
8425
|
const canvases = await Promise.all(
|
|
8374
|
-
|
|
8375
|
-
const projectId = projectOfItem(item);
|
|
8426
|
+
listed.map(async ({ item, projectId }) => {
|
|
8376
8427
|
const dir = canvasPaths(cc.work, item.id).dir;
|
|
8377
8428
|
return {
|
|
8378
8429
|
canvasId: item.id,
|
|
8379
8430
|
name: item.name,
|
|
8380
|
-
|
|
8431
|
+
...linkField(ctx, `${cc.session.hosts.web}/c/${item.id}`),
|
|
8381
8432
|
modified: item.modified,
|
|
8382
8433
|
designCount: item.designCount,
|
|
8383
8434
|
sharing: item.sharing,
|
|
8384
8435
|
ownerKey: item.ownerKey,
|
|
8385
8436
|
projectId,
|
|
8386
|
-
dir:
|
|
8437
|
+
dir: await exists(dir) ? dir : null
|
|
8387
8438
|
};
|
|
8388
8439
|
})
|
|
8389
8440
|
);
|
|
8390
|
-
return { canvases, ...deleted.length ? { deleted } : {} };
|
|
8441
|
+
return { checkoutProjectId: cc.checkout.projectId, canvases, ...deleted.length ? { deleted } : {} };
|
|
8391
8442
|
}
|
|
8392
8443
|
};
|
|
8393
8444
|
canvasDelete = {
|
|
@@ -8502,7 +8553,7 @@ var init_canvas = __esm({
|
|
|
8502
8553
|
discard,
|
|
8503
8554
|
canvas: {
|
|
8504
8555
|
name: read2.document.name,
|
|
8505
|
-
url: `${cc.session.hosts.web}/c/${canvasId}
|
|
8556
|
+
url: canvasJsonLink(ctx, `${cc.session.hosts.web}/c/${canvasId}`),
|
|
8506
8557
|
seq: read2.seq,
|
|
8507
8558
|
projectId: project.projectId,
|
|
8508
8559
|
projectSource: project.source === "read" ? "listed" : project.source
|
|
@@ -8695,19 +8746,21 @@ var init_canvas = __esm({
|
|
|
8695
8746
|
};
|
|
8696
8747
|
canvasUrl = {
|
|
8697
8748
|
name: "canvas url",
|
|
8698
|
-
|
|
8749
|
+
notInCodexDesktop: true,
|
|
8750
|
+
summary: "The canvas link for the agent's own browser panel, already signed in. The ticket in it works once, within 10 minutes. In the Codex app it prints no link: Kombai's view (the canvas_app tool) shows the canvas there.",
|
|
8699
8751
|
flags: {
|
|
8700
8752
|
canvas: { type: "string", required: true, placeholder: "<id|link>", check: canvasRefProblem },
|
|
8701
8753
|
"in-app": { type: "boolean", required: true }
|
|
8702
8754
|
},
|
|
8703
8755
|
async run(ctx, { flags }) {
|
|
8756
|
+
if (ctx.codexDesktop) return viewInstead(String(flags.canvas));
|
|
8704
8757
|
const cc = await canvasContext(ctx, flags, { allowGuest: true });
|
|
8705
8758
|
return { url: await ticketedUrl(ctx, cc) };
|
|
8706
8759
|
}
|
|
8707
8760
|
};
|
|
8708
8761
|
canvasShare = {
|
|
8709
8762
|
name: "canvas share",
|
|
8710
|
-
summary: "Turn the canvas link on (--on) or off (--off). A new canvas is private to its owner; with the link on, anyone with the link can view it and teammates can edit it. Only the canvas's owner can change this. Prints the plain link, which opens for whoever may see the canvas.",
|
|
8763
|
+
summary: "Turn the canvas link on (--on) or off (--off). A new canvas is private to its owner; with the link on, anyone with the link can view it and teammates can edit it. Only the canvas's owner can change this. Prints the plain link, which opens for whoever may see the canvas; in the Codex app it prints none (the view's Share button copies it).",
|
|
8711
8764
|
flags: {
|
|
8712
8765
|
canvas: { type: "string", required: true, placeholder: "<id|link>", check: canvasRefProblem },
|
|
8713
8766
|
on: { type: "boolean" },
|
|
@@ -8739,23 +8792,28 @@ var init_canvas = __esm({
|
|
|
8739
8792
|
}
|
|
8740
8793
|
throw await canvasGone(cc, error2);
|
|
8741
8794
|
}
|
|
8742
|
-
return {
|
|
8795
|
+
return {
|
|
8796
|
+
canvasId,
|
|
8797
|
+
sharing: answer2?.sharing ?? sharing,
|
|
8798
|
+
...linkField(ctx, `${cc.session.hosts.web}/c/${canvasId}`)
|
|
8799
|
+
};
|
|
8743
8800
|
}
|
|
8744
8801
|
};
|
|
8745
8802
|
canvasOpen = {
|
|
8746
8803
|
name: "canvas open",
|
|
8747
|
-
|
|
8804
|
+
notInCodexDesktop: true,
|
|
8805
|
+
summary: "Open the canvas in the user's browser, already signed in. Prints the link without its ticket. In the Codex app it opens nothing: Kombai's view (the canvas_app tool) shows the canvas there.",
|
|
8748
8806
|
flags: { canvas: { type: "string", required: true, placeholder: "<id|link>", check: canvasRefProblem } },
|
|
8749
8807
|
async run(ctx, { flags }) {
|
|
8808
|
+
if (ctx.codexDesktop) return viewInstead(String(flags.canvas));
|
|
8750
8809
|
const cc = await canvasContext(ctx, flags, { allowGuest: true });
|
|
8751
|
-
const inApp = `kombai canvas url --canvas ${cc.canvasId} --in-app`;
|
|
8752
8810
|
if (!ctx.hasDisplay) {
|
|
8753
8811
|
await readForLink(cc);
|
|
8754
|
-
return { url: `${cc.session.hosts.web}/c/${cc.canvasId}`, opened: false
|
|
8812
|
+
return { url: `${cc.session.hosts.web}/c/${cc.canvasId}`, opened: false };
|
|
8755
8813
|
}
|
|
8756
8814
|
const url2 = await ticketedUrl(ctx, cc);
|
|
8757
8815
|
const opened = await ctx.openUrl(url2);
|
|
8758
|
-
return { url: url2.split("#")[0], opened
|
|
8816
|
+
return { url: url2.split("#")[0], opened };
|
|
8759
8817
|
}
|
|
8760
8818
|
};
|
|
8761
8819
|
}
|
|
@@ -8809,9 +8867,7 @@ var init_config = __esm({
|
|
|
8809
8867
|
if (!credential) {
|
|
8810
8868
|
const entry = await readEntry(ctx.home, env);
|
|
8811
8869
|
if (isPureGuest(entry))
|
|
8812
|
-
throw signInRequired(
|
|
8813
|
-
"The preference is kept per signed-in user, and this machine is a guest. Sign in with kombai login."
|
|
8814
|
-
);
|
|
8870
|
+
throw signInRequired("The preference is kept per signed-in user, and this machine is a guest: sign in first.");
|
|
8815
8871
|
throw notSignedIn("Sign in first: the preference is kept per signed-in user.", notSignedInReason(entry));
|
|
8816
8872
|
}
|
|
8817
8873
|
if (org !== void 0) await checkMember(ctx, org);
|
|
@@ -31737,7 +31793,7 @@ var init_taste = __esm({
|
|
|
31737
31793
|
TASTE_CARD_TOOL = "taste_card";
|
|
31738
31794
|
tasteStart = {
|
|
31739
31795
|
name: "taste start",
|
|
31740
|
-
summary: "Start a taste run: Kombai's design directions for a brief you wrote after reading the repo. Uses credits. --cards also writes the design brief for a taste_card tool; add it only where that tool is
|
|
31796
|
+
summary: "Start a taste run: Kombai's design directions for a brief you wrote after reading the repo. Uses credits. --cards also writes the design brief for a taste_card tool; add it only where that tool is among your tools (the Codex app lists it only in ALL_TOOLS).",
|
|
31741
31797
|
flags: {
|
|
31742
31798
|
brief: { type: "string", required: true, placeholder: "<file>" },
|
|
31743
31799
|
variants: {
|
|
@@ -31980,7 +32036,7 @@ var init_client_gate = __esm({
|
|
|
31980
32036
|
Cards = Object.freeze({
|
|
31981
32037
|
/** The taste card and the plans card, and the CLI's own sign-in card. */
|
|
31982
32038
|
All: "all",
|
|
31983
|
-
/** The taste card
|
|
32039
|
+
/** The taste card only (no sign-in card: cards.js specsIn). */
|
|
31984
32040
|
Taste: "taste",
|
|
31985
32041
|
None: "none"
|
|
31986
32042
|
});
|
|
@@ -31990,14 +32046,23 @@ var init_client_gate = __esm({
|
|
|
31990
32046
|
label: "Codex",
|
|
31991
32047
|
embed: "codex",
|
|
31992
32048
|
ticketFor: "codex",
|
|
31993
|
-
appWide: (place) => isCodexAppWideFolder(place.cwd, place.osHome, place.platform, place.env.CODEX_HOME)
|
|
32049
|
+
appWide: (place) => isCodexAppWideFolder(place.cwd, place.osHome, place.platform, place.env.CODEX_HOME),
|
|
32050
|
+
// Codex's in-app browser: a view may open only https: and codex: links, and this one opens `url` there. The same
|
|
32051
|
+
// link the hosted canvas uses for Kombai's chat page (design-mode host/mcp-app/kombai-chat.ts codexBrowserLink).
|
|
32052
|
+
browserLink: (url2) => `codex://browser?url=${encodeURIComponent(url2)}`
|
|
31994
32053
|
}
|
|
31995
32054
|
]);
|
|
31996
32055
|
}
|
|
31997
32056
|
});
|
|
31998
32057
|
|
|
31999
32058
|
// src/mcp/login-runner.js
|
|
32000
|
-
function
|
|
32059
|
+
function firstOpen(state) {
|
|
32060
|
+
if (state.linkOpened) return false;
|
|
32061
|
+
state.linkOpened = true;
|
|
32062
|
+
return true;
|
|
32063
|
+
}
|
|
32064
|
+
function createLoginRunner(ctx, options = {}) {
|
|
32065
|
+
const inApp = () => options.inApp?.() === true;
|
|
32001
32066
|
let current = null;
|
|
32002
32067
|
const unread = /* @__PURE__ */ new Map();
|
|
32003
32068
|
const takeUnread = (reader) => {
|
|
@@ -32012,7 +32077,7 @@ function createLoginRunner(ctx) {
|
|
|
32012
32077
|
const started = new Promise((resolve) => {
|
|
32013
32078
|
markStarted = resolve;
|
|
32014
32079
|
});
|
|
32015
|
-
const state = { started, settled: Promise.resolve({ ok: true, claim: null }), waiting: null };
|
|
32080
|
+
const state = { started, settled: Promise.resolve({ ok: true, claim: null }), waiting: null, linkOpened: false };
|
|
32016
32081
|
let claim2 = null;
|
|
32017
32082
|
const loginCtx = {
|
|
32018
32083
|
...ctx,
|
|
@@ -32024,7 +32089,7 @@ function createLoginRunner(ctx) {
|
|
|
32024
32089
|
claim2 = outcome;
|
|
32025
32090
|
}
|
|
32026
32091
|
};
|
|
32027
|
-
state.settled = login.run(loginCtx, { flags: {}, args: [] }).then(
|
|
32092
|
+
state.settled = login.run(loginCtx, { flags: inApp() ? { "no-browser": true } : {}, args: [] }).then(
|
|
32028
32093
|
() => (
|
|
32029
32094
|
/** @type {SettledLogin} */
|
|
32030
32095
|
{ ok: true, claim: claim2 }
|
|
@@ -32052,7 +32117,7 @@ function createLoginRunner(ctx) {
|
|
|
32052
32117
|
start,
|
|
32053
32118
|
reopen: async () => {
|
|
32054
32119
|
const url2 = current?.waiting?.url;
|
|
32055
|
-
if (typeof url2 !== "string" || !ctx.hasDisplay) return false;
|
|
32120
|
+
if (typeof url2 !== "string" || !ctx.hasDisplay || inApp()) return false;
|
|
32056
32121
|
return ctx.openUrl(url2);
|
|
32057
32122
|
},
|
|
32058
32123
|
running: () => current !== null,
|
|
@@ -32187,7 +32252,7 @@ function toolDescriptors(resourceUri) {
|
|
|
32187
32252
|
{
|
|
32188
32253
|
name: CANVAS_APP_TOOL,
|
|
32189
32254
|
title: "Kombai",
|
|
32190
|
-
description: "
|
|
32255
|
+
description: "Open a Kombai canvas in this conversation, beside the chat: the way to show one here, in place of any browser or link. Call it right after kombai canvas create, before any design. 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, again only when the person asks to see it: 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. Put no canvas or design link in your replies: name designs by their labels. A person who wants a link copies it from the view (the canvas's Share, or a design's Copy link); never open one yourself.",
|
|
32191
32256
|
inputSchema: {
|
|
32192
32257
|
type: "object",
|
|
32193
32258
|
properties: {
|
|
@@ -32335,33 +32400,28 @@ async function readCanvas(session, canvasId) {
|
|
|
32335
32400
|
}
|
|
32336
32401
|
return { projectId: body.projectId, name };
|
|
32337
32402
|
}
|
|
32338
|
-
function canvasPageUrl(webHost, ref) {
|
|
32339
|
-
return `${webHost}/c/${ref.canvasId}${ref.nodeId ? `?node=${encodeURIComponent(ref.nodeId)}` : ""}`;
|
|
32340
|
-
}
|
|
32341
32403
|
async function callCanvasApp(ctx, args) {
|
|
32342
32404
|
const { hosts } = await currentEnv(ctx);
|
|
32343
32405
|
const ref = refFromArgs(args, hosts.web);
|
|
32344
32406
|
if (!ref) {
|
|
32345
|
-
const url3 = `${hosts.web}/canvases`;
|
|
32346
32407
|
return {
|
|
32347
|
-
structuredContent: {
|
|
32408
|
+
structuredContent: {},
|
|
32348
32409
|
content: [
|
|
32349
32410
|
{
|
|
32350
32411
|
type: "text",
|
|
32351
|
-
text:
|
|
32412
|
+
text: "Kombai's canvas view is open beside this chat. Signed in, it lists every canvas the person can open; a guest, or someone who never signed in, sees Kombai's home as a guest; anyone who signed in before is asked to sign in there, so do not run kombai login for it."
|
|
32352
32413
|
}
|
|
32353
32414
|
]
|
|
32354
32415
|
};
|
|
32355
32416
|
}
|
|
32356
32417
|
const session = await openAnySession(ctx);
|
|
32357
32418
|
const { projectId, name } = await readCanvas(session, ref.canvasId);
|
|
32358
|
-
const url2 = canvasPageUrl(hosts.web, ref);
|
|
32359
32419
|
return {
|
|
32360
|
-
structuredContent: { canvas: ref.canvasId, ...ref.nodeId ? { node: ref.nodeId } : {}, name, projectId
|
|
32420
|
+
structuredContent: { canvas: ref.canvasId, ...ref.nodeId ? { node: ref.nodeId } : {}, name, projectId },
|
|
32361
32421
|
content: [
|
|
32362
32422
|
{
|
|
32363
32423
|
type: "text",
|
|
32364
|
-
text: `Canvas "${name}" is open beside this chat
|
|
32424
|
+
text: `Canvas "${name}" is open beside this chat. Changes go through the work-with-kombai skill.`
|
|
32365
32425
|
}
|
|
32366
32426
|
]
|
|
32367
32427
|
};
|
|
@@ -32548,7 +32608,19 @@ function createSessionTool(ctx, { login: runner }) {
|
|
|
32548
32608
|
const outcome = await Promise.race([state.settled, ctx.sleep(waitS * 1e3).then(() => null)]);
|
|
32549
32609
|
if (outcome === null) {
|
|
32550
32610
|
const waiting = state.waiting ?? {};
|
|
32551
|
-
|
|
32611
|
+
const url2 = typeof waiting.url === "string" ? waiting.url : null;
|
|
32612
|
+
return answer(
|
|
32613
|
+
{
|
|
32614
|
+
status: "signing_in",
|
|
32615
|
+
...ids,
|
|
32616
|
+
matchCode: waiting.matchCode ?? null,
|
|
32617
|
+
url: url2,
|
|
32618
|
+
// The host's own browser (Codex's): the login opened nothing here, so the view opens the approval page there,
|
|
32619
|
+
// itself only on the login's first such answer (openNow, firstOpen); later ones offer Open the page again.
|
|
32620
|
+
...url2 && host.browserLink ? { openLink: host.browserLink(url2), openNow: firstOpen(state) } : {}
|
|
32621
|
+
},
|
|
32622
|
+
["url", "openLink", "openNow"]
|
|
32623
|
+
);
|
|
32552
32624
|
}
|
|
32553
32625
|
runner.takeUnread(LoginReader.View);
|
|
32554
32626
|
if (!outcome.ok) {
|
|
@@ -32651,16 +32723,17 @@ async function mintGuestTicket(ctx, session, canvasId, ticketFor) {
|
|
|
32651
32723
|
return null;
|
|
32652
32724
|
}
|
|
32653
32725
|
}
|
|
32654
|
-
function answer(structuredContent) {
|
|
32726
|
+
function answer(structuredContent, viewOnly = []) {
|
|
32727
|
+
const text = Object.fromEntries(Object.entries(structuredContent).filter(([key]) => !viewOnly.includes(key)));
|
|
32655
32728
|
return {
|
|
32656
32729
|
structuredContent,
|
|
32657
32730
|
content: [{ type: (
|
|
32658
32731
|
/** @type {const} */
|
|
32659
32732
|
"text"
|
|
32660
|
-
), text: JSON.stringify(
|
|
32733
|
+
), text: JSON.stringify(text) }]
|
|
32661
32734
|
};
|
|
32662
32735
|
}
|
|
32663
|
-
var CANVAS_APP_TOOL, SESSION_TOOL, ACCOUNT_TOOL, CREATE_TOOL, RENAME_TOOL, DELETE_TOOL, DOWNLOAD_TOOL, ONLY_OWNER_DELETES, DOWNLOAD_DEADLINE_MS, MANAGE_DEADLINE_MS, MULTI_TEAM_NOT_SUPPORTED, RESOURCE_URI_BASE, versionedUri, SIGN_IN_MAX_WAIT_S, INSTRUCTIONS, read, badArgument, given;
|
|
32736
|
+
var CANVAS_APP_TOOL, SESSION_TOOL, ACCOUNT_TOOL, CREATE_TOOL, RENAME_TOOL, DELETE_TOOL, DOWNLOAD_TOOL, ONLY_OWNER_DELETES, DOWNLOAD_DEADLINE_MS, MANAGE_DEADLINE_MS, MULTI_TEAM_NOT_SUPPORTED, RESOURCE_URI_BASE, versionedUri, SIGN_IN_MAX_WAIT_S, INSTRUCTIONS, CODEX_INSTRUCTIONS, read, badArgument, given;
|
|
32664
32737
|
var init_tools = __esm({
|
|
32665
32738
|
"src/mcp/tools.js"() {
|
|
32666
32739
|
"use strict";
|
|
@@ -32693,7 +32766,8 @@ var init_tools = __esm({
|
|
|
32693
32766
|
RESOURCE_URI_BASE = "ui://kombai/cli-canvas-app";
|
|
32694
32767
|
versionedUri = (base, version2) => `${base}?v=${encodeURIComponent(version2)}`;
|
|
32695
32768
|
SIGN_IN_MAX_WAIT_S = 20;
|
|
32696
|
-
INSTRUCTIONS = `Kombai designs live on a Kombai canvas; design systems are .ds files in the Kombai account and need no canvas.
|
|
32769
|
+
INSTRUCTIONS = `Designs and design systems: follow \`${CLI_RUN} skill\`. Where taste_card is among your tools, even listed by name only, add --cards to every \`kombai taste start\`, and call taste_card when \`kombai taste wait\` answers with card. Kombai designs live on a Kombai canvas; design systems are .ds files in the Kombai account and need no canvas. Questions about Kombai itself (account, credits, data, setup) are answered by \`${CLI_RUN} skill faq\`.`;
|
|
32770
|
+
CODEX_INSTRUCTIONS = `Show Kombai canvases with canvas_app (find it in ALL_TOOLS): right after kombai canvas create, before any design, or on first use of a canvas not open beside the chat. It is the only way: no browser, no in-app browser, no link. Designs and design systems: follow \`${CLI_RUN} skill\`. A user who wants a link copies it from the view: the canvas's Share, or a design's Copy link. Add --cards to every \`kombai taste start\`, and call taste_card when \`kombai taste wait\` answers with card. Kombai designs live on a Kombai canvas; design systems are .ds files in the Kombai account and need no canvas. Call canvas_app once per canvas, only to show it (again only when the user asks): make changes with the commands. Questions about Kombai itself (account, credits, data, setup) are answered by \`${CLI_RUN} skill faq\`.`;
|
|
32697
32771
|
read = { readOnlyHint: true, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
32698
32772
|
badArgument = (message) => new CliError("CLI_BAD_ARGUMENT", message);
|
|
32699
32773
|
given = (value) => value !== void 0 && value !== null && value !== "";
|
|
@@ -32715,7 +32789,8 @@ function refusalText(code2, message, plansLink, extra) {
|
|
|
32715
32789
|
...extra
|
|
32716
32790
|
});
|
|
32717
32791
|
}
|
|
32718
|
-
async function signInCardData(ctx, reason) {
|
|
32792
|
+
async function signInCardData(ctx, reason, appBrowser = null) {
|
|
32793
|
+
const where = appBrowser ? { app_browser: appBrowser } : {};
|
|
32719
32794
|
const reasons = (
|
|
32720
32795
|
/** @type {unknown[]} */
|
|
32721
32796
|
Object.values(SignInReason)
|
|
@@ -32732,9 +32807,10 @@ async function signInCardData(ctx, reason) {
|
|
|
32732
32807
|
if (!hasGuest(entry)) {
|
|
32733
32808
|
const keyLive = typeof entry.key === "string" && entry.key !== "" && Date.parse(entry.expires ?? "") > ctx.now();
|
|
32734
32809
|
if (keyLive) return cardWords("signed_in", "This machine is signed in to Kombai.", void 0, emailOf(entry));
|
|
32735
|
-
return { reason: SignInReason.Start, line: LINES[SignInReason.Start], guest: !holdsAccount(entry) };
|
|
32810
|
+
return { reason: SignInReason.Start, line: LINES[SignInReason.Start], guest: !holdsAccount(entry), ...where };
|
|
32736
32811
|
}
|
|
32737
|
-
if (valid === SignInReason.Start)
|
|
32812
|
+
if (valid === SignInReason.Start)
|
|
32813
|
+
return { reason: SignInReason.Account, line: LINES[SignInReason.Account], ...where };
|
|
32738
32814
|
if (valid === SignInReason.Ending) {
|
|
32739
32815
|
const daysLeft = Math.ceil((Date.parse(entry.guestExpires ?? "") - ctx.now()) / DAY_MS);
|
|
32740
32816
|
if (!(daysLeft >= 1 && daysLeft <= ENDING_DAYS)) {
|
|
@@ -32742,19 +32818,19 @@ async function signInCardData(ctx, reason) {
|
|
|
32742
32818
|
"not_ending",
|
|
32743
32819
|
`This guest canvas does not end within ${ENDING_DAYS} days.`,
|
|
32744
32820
|
void 0,
|
|
32745
|
-
typeof entry.guestExpires === "string" && daysLeft > ENDING_DAYS ? { ends_at: entry.guestExpires } : void 0
|
|
32821
|
+
typeof entry.guestExpires === "string" && daysLeft > ENDING_DAYS ? { ends_at: entry.guestExpires, ...where } : void 0
|
|
32746
32822
|
);
|
|
32747
32823
|
}
|
|
32748
32824
|
const line = daysLeft === 1 ? "Your guest canvas ends tomorrow." : `Your guest canvas ends in ${daysLeft} days.`;
|
|
32749
|
-
return { reason: valid, line };
|
|
32825
|
+
return { reason: valid, line, ...where };
|
|
32750
32826
|
}
|
|
32751
|
-
return { reason: valid, line: LINES[valid] };
|
|
32827
|
+
return { reason: valid, line: LINES[valid], ...where };
|
|
32752
32828
|
}
|
|
32753
32829
|
function emailOf(entry) {
|
|
32754
32830
|
return typeof entry.email === "string" && entry.email ? { email: entry.email } : void 0;
|
|
32755
32831
|
}
|
|
32756
|
-
async function showSignIn(ctx, args) {
|
|
32757
|
-
const data = await signInCardData(ctx, args.reason);
|
|
32832
|
+
async function showSignIn(ctx, args, appBrowser = null) {
|
|
32833
|
+
const data = await signInCardData(ctx, args.reason, appBrowser);
|
|
32758
32834
|
if ("content" in data) return data;
|
|
32759
32835
|
const text = data.reason === SignInReason.Start ? data.guest ? `Showing Kombai's sign-in card in the chat, which asks the user to sign in or try Kombai without an account. Don't ask in text: ${END_TURN} When the user says to carry on, run kombai whoami.` : `Showing Kombai's sign-in card in the chat. This machine has signed in before, so it offers sign-in only: ${END_TURN} When the user says to carry on, run kombai whoami.` : data.reason === SignInReason.Ending ? (
|
|
32760
32836
|
// A reminder, not a refusal: the guest can still design, so the request goes on.
|
|
@@ -32794,7 +32870,7 @@ function statusOfClaim(claim2) {
|
|
|
32794
32870
|
}
|
|
32795
32871
|
}
|
|
32796
32872
|
}
|
|
32797
|
-
async function chatSignIn(ctx, runner, args, besideChat) {
|
|
32873
|
+
async function chatSignIn(ctx, runner, args, besideChat, appBrowser = null) {
|
|
32798
32874
|
const waitS = typeof args.wait === "number" && Number.isFinite(args.wait) ? Math.min(SIGN_IN_MAX_WAIT_S, Math.max(0, Math.floor(args.wait))) : 0;
|
|
32799
32875
|
if (args.reopen === true) return answer({ reopened: await runner.reopen() });
|
|
32800
32876
|
const { claimOrg } = args;
|
|
@@ -32811,7 +32887,16 @@ async function chatSignIn(ctx, runner, args, besideChat) {
|
|
|
32811
32887
|
const settled = await Promise.race([state.settled, ctx.sleep(waitS * 1e3).then(() => null)]);
|
|
32812
32888
|
if (settled === null) {
|
|
32813
32889
|
const matchCode = state.waiting?.matchCode;
|
|
32814
|
-
|
|
32890
|
+
const url2 = state.waiting?.url;
|
|
32891
|
+
return answer(
|
|
32892
|
+
{
|
|
32893
|
+
status: SignInStatus.SigningIn,
|
|
32894
|
+
match_code: typeof matchCode === "string" ? matchCode : null,
|
|
32895
|
+
// open_now: the card opens the page itself only on the login's first such answer (firstOpen).
|
|
32896
|
+
...appBrowser && typeof url2 === "string" ? { open_link: appBrowser.link(url2), open_now: firstOpen(state) } : {}
|
|
32897
|
+
},
|
|
32898
|
+
["open_link", "open_now"]
|
|
32899
|
+
);
|
|
32815
32900
|
}
|
|
32816
32901
|
runner.takeUnread(LoginReader.Card);
|
|
32817
32902
|
return answer(await withCanvas(ctx, statusOfLogin(settled), besideChat));
|
|
@@ -32920,6 +33005,7 @@ import fs18 from "node:fs/promises";
|
|
|
32920
33005
|
import path19 from "node:path";
|
|
32921
33006
|
import { fileURLToPath } from "node:url";
|
|
32922
33007
|
function createCards(ctx, options) {
|
|
33008
|
+
const appBrowser = () => options.appBrowser?.() ?? null;
|
|
32923
33009
|
const dir = options.dir ?? CARDS_DIR;
|
|
32924
33010
|
const scripts = /* @__PURE__ */ new Map();
|
|
32925
33011
|
const script = (spec) => {
|
|
@@ -32983,12 +33069,23 @@ function createCards(ctx, options) {
|
|
|
32983
33069
|
async call(set2, name, args) {
|
|
32984
33070
|
const specs = await available(set2);
|
|
32985
33071
|
const signInBuilt = specs.includes(SIGN_IN);
|
|
32986
|
-
|
|
32987
|
-
|
|
32988
|
-
|
|
32989
|
-
|
|
33072
|
+
const inAppWords = (result) => {
|
|
33073
|
+
const browser = appBrowser();
|
|
33074
|
+
const content = result.structuredContent;
|
|
33075
|
+
if (!browser || !content || typeof content.sign_in !== "object" || content.sign_in === null) return result;
|
|
33076
|
+
return {
|
|
33077
|
+
...result,
|
|
33078
|
+
structuredContent: { ...content, sign_in: { ...content.sign_in, app_browser: browser.label } }
|
|
33079
|
+
};
|
|
33080
|
+
};
|
|
33081
|
+
if (name === TASTE_CARD_TOOL2 && specs.includes(TASTE)) return inAppWords(await showTaste(ctx, args, signInBuilt));
|
|
33082
|
+
if (name === PLANS_CARD_TOOL && specs.includes(PLANS)) return inAppWords(await showPlans(ctx, signInBuilt));
|
|
33083
|
+
if (name === CHECKOUT_TOOL && specs.includes(PLANS)) return inAppWords(await checkout(ctx, args, signInBuilt));
|
|
33084
|
+
if (name === SIGN_IN_CARD_TOOL && specs.includes(SIGN_IN)) {
|
|
33085
|
+
return showSignIn(ctx, args, appBrowser()?.label ?? null);
|
|
33086
|
+
}
|
|
32990
33087
|
if (name === CHAT_SIGN_IN_TOOL && specs.includes(SIGN_IN)) {
|
|
32991
|
-
return chatSignIn(ctx, options.login, args, set2 === Cards.All);
|
|
33088
|
+
return chatSignIn(ctx, options.login, args, set2 === Cards.All, appBrowser());
|
|
32992
33089
|
}
|
|
32993
33090
|
if (name === CHAT_GUEST_TOOL && specs.includes(SIGN_IN)) return chatGuest(ctx);
|
|
32994
33091
|
return null;
|
|
@@ -33203,7 +33300,7 @@ var init_cards = __esm({
|
|
|
33203
33300
|
"openai/widgetHeightHint": 180
|
|
33204
33301
|
}
|
|
33205
33302
|
};
|
|
33206
|
-
specsIn = (set2) => set2 === Cards.All ? [TASTE, PLANS, SIGN_IN] : set2 === Cards.Taste ? [TASTE
|
|
33303
|
+
specsIn = (set2) => set2 === Cards.All ? [TASTE, PLANS, SIGN_IN] : set2 === Cards.Taste ? [TASTE] : [];
|
|
33207
33304
|
reads = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
33208
33305
|
acts = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true };
|
|
33209
33306
|
icons = () => KOMBAI_ICONS.map((icon) => ({ ...icon, sizes: [...icon.sizes] }));
|
|
@@ -33261,7 +33358,7 @@ var init_cards = __esm({
|
|
|
33261
33358
|
signInTool = (resourceUri) => ({
|
|
33262
33359
|
name: SIGN_IN_CARD_TOOL,
|
|
33263
33360
|
title: "Kombai",
|
|
33264
|
-
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.",
|
|
33361
|
+
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.",
|
|
33265
33362
|
inputSchema: {
|
|
33266
33363
|
type: "object",
|
|
33267
33364
|
properties: { reason: { type: "string", enum: Object.values(SignInReason) } },
|
|
@@ -33339,9 +33436,9 @@ var init_stdio3 = __esm({
|
|
|
33339
33436
|
|
|
33340
33437
|
// src/mcp/view-html.js
|
|
33341
33438
|
function viewHtml(version2, host, options = {}) {
|
|
33342
|
-
return
|
|
33439
|
+
return SERVED_HTML.replace("{{CLI_VERSION}}", version2).replaceAll("{{BROWSER}}", host.browserLink ? `${host.label}\\u2019s browser` : "your browser").replaceAll("{{HOST_LABEL}}", host.label).replaceAll("{{HOST_EMBED}}", host.embed).replace("{{CLAIM_RETRY_MS}}", String(options.claimRetryMs ?? CLAIM_RETRY_MS)).replace("{{COVER_MS}}", String(options.coverMs ?? COVER_MS)).replace("{{RECHECK_MS}}", String(options.recheckMs ?? RECHECK_MS)).replace("{{MANAGE_WAIT_MS}}", String(options.manageWaitMs ?? MANAGE_WAIT_MS)).replace("{{DOWNLOAD_WAIT_MS}}", String(options.downloadWaitMs ?? DOWNLOAD_WAIT_MS));
|
|
33343
33440
|
}
|
|
33344
|
-
var VIEW_HTML, CLAIM_RETRY_MS, COVER_MS, RECHECK_MS, MANAGE_WAIT_MS, DOWNLOAD_WAIT_MS;
|
|
33441
|
+
var VIEW_HTML, CLAIM_RETRY_MS, COVER_MS, RECHECK_MS, MANAGE_WAIT_MS, DOWNLOAD_WAIT_MS, SERVED_HTML;
|
|
33345
33442
|
var init_view_html = __esm({
|
|
33346
33443
|
"src/mcp/view-html.js"() {
|
|
33347
33444
|
"use strict";
|
|
@@ -33353,50 +33450,82 @@ var init_view_html = __esm({
|
|
|
33353
33450
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
33354
33451
|
<title>Kombai</title>
|
|
33355
33452
|
<style>
|
|
33356
|
-
html,body{margin:0;height:100%;overflow:hidden;font:13px system-ui,sans-serif;color:#
|
|
33357
|
-
html.dark body{color:#
|
|
33453
|
+
html,body{margin:0;height:100%;overflow:hidden;font:13px system-ui,sans-serif;color:#1a1a1a;background:#fcfbf4}
|
|
33454
|
+
html.dark body{color:#f0f0f0;background:#1e1e1e}
|
|
33358
33455
|
#frame{position:fixed;inset:0;width:100%;height:100%;border:0;display:none;background:transparent}
|
|
33359
|
-
#screen{position:fixed;inset:0;display:grid;place-items:center;text-align:center;padding:
|
|
33360
|
-
#screen.
|
|
33456
|
+
#screen{position:fixed;inset:0;display:grid;place-items:center;text-align:center;padding:40px 32px 48px;--sec:#4c4b4a;--ter:#747472;--line:#e2e2de;--shine:#1a1a1a}
|
|
33457
|
+
html.dark #screen,html.dark #link,html.dark #notice{--sec:#c4c4c4;--ter:#979797;--line:#3a3a3a;--shine:#fff}
|
|
33458
|
+
#screen.over{z-index:3;padding:24px;background:rgba(252,251,244,.72);backdrop-filter:blur(2px)}
|
|
33361
33459
|
html.dark #screen.over{background:rgba(20,20,20,.72)}
|
|
33362
|
-
#panel{max-width:
|
|
33363
|
-
#screen.over #panel{text-align:left;padding:24px;border:1px solid
|
|
33364
|
-
html.dark #screen.over #panel{background:#262626;
|
|
33365
|
-
#
|
|
33366
|
-
#screen
|
|
33367
|
-
|
|
33368
|
-
#
|
|
33369
|
-
|
|
33370
|
-
#
|
|
33371
|
-
#screen.
|
|
33372
|
-
#
|
|
33373
|
-
|
|
33374
|
-
|
|
33375
|
-
|
|
33460
|
+
#panel{width:100%;max-width:340px}
|
|
33461
|
+
#screen.over #panel{text-align:left;padding:24px;box-sizing:border-box;border:1px solid var(--line);border-radius:10px;background:#fff;box-shadow:0 12px 32px rgba(0,0,0,.12),0 2px 6px rgba(0,0,0,.05)}
|
|
33462
|
+
html.dark #screen.over #panel{background:#262626;box-shadow:0 12px 32px rgba(0,0,0,.4)}
|
|
33463
|
+
#head{display:flex;flex-direction:column;align-items:center;gap:16px}
|
|
33464
|
+
#screen.over #head{flex-direction:row;gap:8px}
|
|
33465
|
+
#lead{display:flex;color:var(--sec)}
|
|
33466
|
+
#lead:empty,#title:empty{display:none}
|
|
33467
|
+
#screen.warn #lead{color:#e8a418}
|
|
33468
|
+
html.dark #screen.warn #lead{color:#f59e0b}
|
|
33469
|
+
#screen.ok #lead{color:#17864f}
|
|
33470
|
+
html.dark #screen.ok #lead{color:#48de94}
|
|
33471
|
+
.ic{width:32px;height:32px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:none}
|
|
33472
|
+
#screen.over .ic{width:18px;height:18px;stroke-width:2}
|
|
33473
|
+
.sm,#screen.over .sm{width:16px;height:16px;stroke-width:2}
|
|
33474
|
+
.spin{animation:spin 1s linear infinite}
|
|
33475
|
+
@keyframes spin{to{transform:rotate(360deg)}}
|
|
33476
|
+
#title{display:block;font-size:20px;line-height:28px;font-weight:600;letter-spacing:-.012em;text-wrap:balance}
|
|
33477
|
+
#screen.over #title{font-size:16px;line-height:24px;letter-spacing:0}
|
|
33478
|
+
#screen p{margin:8px 0 0;color:var(--sec);font-size:14px;line-height:22px;text-wrap:pretty}
|
|
33479
|
+
#screen.over p{margin-top:6px}
|
|
33480
|
+
/* A loading screen: the name, with a shine sweeping left to right, and the line under it. */
|
|
33481
|
+
#screen.load #title{color:transparent;background:linear-gradient(90deg,var(--ter) 40%,var(--shine) 50%,var(--ter) 60%) 100% 0/200% 100%;-webkit-background-clip:text;background-clip:text;animation:shine 1.8s linear infinite}
|
|
33482
|
+
@keyframes shine{to{background-position:0 0}}
|
|
33483
|
+
#code{display:grid;place-items:center;height:56px;margin-top:20px;border:1px solid var(--line);border-radius:8px;background:#f4f3ee;font:600 22px ui-monospace,Menlo,monospace;letter-spacing:.14em}
|
|
33484
|
+
html.dark #code{background:#2b2b2b}
|
|
33485
|
+
#wait{display:flex;align-items:center;gap:8px;margin-top:20px;color:var(--ter);font-size:12.5px;line-height:18px}
|
|
33486
|
+
#screen:not(.over) #wait{justify-content:center}
|
|
33487
|
+
#actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:24px}
|
|
33488
|
+
#actions:empty{display:none}
|
|
33489
|
+
#screen.over #actions{justify-content:flex-end}
|
|
33490
|
+
#actions.stack{flex-direction:column;align-items:stretch;margin-top:20px}
|
|
33491
|
+
button{font:500 12px system-ui,sans-serif;height:32px;padding:0 16px;border-radius:6px;border:0;background:transparent;color:inherit;cursor:pointer}
|
|
33492
|
+
button:hover{background:rgba(26,26,26,.06)}
|
|
33493
|
+
html.dark button:hover{background:rgba(255,255,255,.08)}
|
|
33376
33494
|
button:focus-visible{outline:2px solid #48de94;outline-offset:1px}
|
|
33377
|
-
|
|
33378
|
-
button.primary,html.dark button.primary{background:#
|
|
33379
|
-
button
|
|
33380
|
-
#
|
|
33381
|
-
|
|
33382
|
-
#
|
|
33383
|
-
#
|
|
33384
|
-
|
|
33385
|
-
|
|
33495
|
+
button.primary{min-width:120px;background:#48de94;color:#151615}
|
|
33496
|
+
button.primary:hover,html.dark button.primary:hover{background:#3bc583}
|
|
33497
|
+
#link button,#notice button{min-width:0;flex:none}
|
|
33498
|
+
#actions .org{display:flex;align-items:center;gap:12px;height:44px;padding:0 12px 0 8px;border:1px solid var(--line);background:#fff;text-align:left;font:500 14px system-ui,sans-serif}
|
|
33499
|
+
#actions .org:hover{border-color:#b0b0ad;background:#fafaf7}
|
|
33500
|
+
html.dark #actions .org{background:#262626}
|
|
33501
|
+
html.dark #actions .org:hover{border-color:#5a5a5a;background:#2b2b2b}
|
|
33502
|
+
.org i{display:grid;place-items:center;width:28px;height:28px;flex:none;border-radius:6px;background:#efeee8;color:var(--sec);font:600 12px system-ui,sans-serif}
|
|
33503
|
+
html.dark .org i{background:#333}
|
|
33504
|
+
.org span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
33505
|
+
.org .sm{color:var(--ter)}
|
|
33506
|
+
#link,#notice{position:fixed;left:0;right:0;top:0;display:none;align-items:center;gap:10px;min-height:48px;box-sizing:border-box;padding:8px 8px 8px 14px;background:#fff;border-bottom:1px solid var(--line);box-shadow:0 1px 3px rgba(0,0,0,.05);z-index:2;--sec:#4c4b4a;--line:#e2e2de}
|
|
33507
|
+
html.dark #link,html.dark #notice{background:#262626}
|
|
33508
|
+
#link>span,#notice>span{flex:1;min-width:0;color:var(--sec);line-height:20px;text-wrap:pretty}
|
|
33509
|
+
#link b,#notice b{font-weight:500;color:#1a1a1a}
|
|
33510
|
+
html.dark #link b,html.dark #notice b{color:#f0f0f0}
|
|
33511
|
+
#link .sm{color:var(--sec)}
|
|
33512
|
+
#notice .sm{color:#e8a418}
|
|
33513
|
+
html.dark #notice .sm{color:#f59e0b}
|
|
33386
33514
|
/* The cover over a page being replaced: a veil in the view's background that takes every click, under the hosted
|
|
33387
33515
|
page's logo loader (components/ui/loader.tsx LogoLoader) as CSS can draw it: the logo's fill, size and glow. */
|
|
33388
33516
|
#cover{position:fixed;inset:0;z-index:1;display:grid;place-items:center;cursor:progress;background:rgba(252,251,244,.6)}
|
|
33389
33517
|
html.dark #cover{background:rgba(30,30,30,.6)}
|
|
33390
33518
|
#cover::after{content:'';width:56px;height:56px;border-radius:10px;background:#48de94;animation:glow 1.5s ease-in-out infinite alternate}
|
|
33391
33519
|
@keyframes glow{from{opacity:.35;filter:drop-shadow(0 0 0 rgba(72,222,148,0))}to{opacity:1;filter:drop-shadow(0 0 16px rgba(72,222,148,.55))}}
|
|
33392
|
-
@media (prefers-reduced-motion:reduce){#cover::after{animation:none}}
|
|
33520
|
+
@media (prefers-reduced-motion:reduce){#cover::after,.spin,#screen.load #title{animation:none}#screen.load #title{color:inherit;background:none}}
|
|
33393
33521
|
[hidden]{display:none!important}
|
|
33394
33522
|
</style>
|
|
33395
33523
|
</head>
|
|
33396
33524
|
<body>
|
|
33397
|
-
<
|
|
33398
|
-
<div id="
|
|
33399
|
-
<div id="
|
|
33525
|
+
<svg hidden><symbol id="i-app" viewBox="0 0 24 24"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="M10 4v4"/><path d="M2 8h20"/><path d="M6 4v4"/></symbol><symbol id="i-canvas" viewBox="0 0 24 24"><path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"/><path d="M5 3a2 2 0 0 0-2 2"/><path d="M19 3a2 2 0 0 1 2 2"/><path d="M5 21a2 2 0 0 1-2-2"/><path d="M9 3h1"/><path d="M9 21h2"/><path d="M14 3h1"/><path d="M3 9v1"/><path d="M21 9v2"/><path d="M3 14v1"/></symbol><symbol id="i-login" viewBox="0 0 24 24"><path d="m10 17 5-5-5-5"/><path d="M15 12H3"/><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/></symbol><symbol id="i-org" viewBox="0 0 24 24"><path d="M10 12h4"/><path d="M10 8h4"/><path d="M14 21v-3a2 2 0 0 0-4 0v3"/><path d="M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2"/><path d="M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16"/></symbol><symbol id="i-spin" viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></symbol><symbol id="i-wait" viewBox="0 0 24 24"><path d="M5 22h14"/><path d="M5 2h14"/><path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"/><path d="M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"/></symbol><symbol id="i-msg" viewBox="0 0 24 24"><path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/><path d="M7 11h10"/><path d="M7 15h6"/><path d="M7 7h8"/></symbol><symbol id="i-unplug" viewBox="0 0 24 24"><path d="m19 5 3-3"/><path d="m2 22 3-3"/><path d="M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z"/><path d="M7.5 13.5 10 11"/><path d="M10.5 16.5 13 14"/><path d="m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z"/></symbol><symbol id="i-alert" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></symbol><symbol id="i-link" viewBox="0 0 24 24"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></symbol><symbol id="i-next" viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></symbol></svg>
|
|
33526
|
+
<div id="screen" class="load" role="status"><div id="panel"><div id="head"><span id="lead"></span><b id="title">Kombai</b></div><p id="body">Connecting to {{HOST_LABEL}}…</p><code id="code" hidden></code><div id="actions"></div><div id="wait" hidden><svg class="ic sm spin" aria-hidden="true"><use href="#i-spin"/></svg><span id="wait-text"></span></div></div></div>
|
|
33527
|
+
<div id="link"><svg class="ic sm" aria-hidden="true"><use href="#i-link"/></svg><span id="link-text"></span><button id="link-dismiss" type="button">Not now</button><button id="link-open" class="primary" type="button">Open</button></div>
|
|
33528
|
+
<div id="notice"><svg class="ic sm" aria-hidden="true"><use href="#i-alert"/></svg><span><b>Sign-in didn't finish.</b> Your canvas is still moving into your account.</span><button id="notice-retry" class="primary" type="button">Try again</button></div>
|
|
33400
33529
|
<iframe id="frame" title="Kombai canvas" allow="clipboard-write"></iframe>
|
|
33401
33530
|
<div id="cover" role="status" aria-label="Loading" hidden></div>
|
|
33402
33531
|
<script>
|
|
@@ -33425,6 +33554,8 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33425
33554
|
var body = document.getElementById('body');
|
|
33426
33555
|
var actions = document.getElementById('actions');
|
|
33427
33556
|
var code = document.getElementById('code');
|
|
33557
|
+
var lead = document.getElementById('lead');
|
|
33558
|
+
var wait = document.getElementById('wait');
|
|
33428
33559
|
var frame = document.getElementById('frame');
|
|
33429
33560
|
var linkBar = document.getElementById('link');
|
|
33430
33561
|
var linkText = document.getElementById('link-text');
|
|
@@ -33432,26 +33563,46 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33432
33563
|
var cover = document.getElementById('cover');
|
|
33433
33564
|
|
|
33434
33565
|
// opts.code: a match code, shown on its own line to compare with the browser's. opts.over: drawn over the framed
|
|
33435
|
-
// canvas, which stays as it is underneath, so closing the screen needs no reload. opts.stack: one
|
|
33566
|
+
// canvas, which stays as it is underneath, so closing the screen needs no reload. opts.stack: one organization per
|
|
33567
|
+
// row. opts.icon: a symbol in the sprite (#i-<icon>), drawn above the title; over the canvas only the spinner is,
|
|
33568
|
+
// beside it. opts.tone: 'warn' or 'ok', the icon's colour. opts.load: a loading screen, the name with a shine over
|
|
33569
|
+
// it and the line under it. opts.wait: a line under a spinner at the foot.
|
|
33436
33570
|
function show(t, b, buttons, opts) {
|
|
33437
33571
|
opts = opts || {};
|
|
33438
33572
|
unwatch();
|
|
33573
|
+
var over = !!opts.over && framed();
|
|
33439
33574
|
title.textContent = t;
|
|
33440
33575
|
body.textContent = b;
|
|
33441
33576
|
code.textContent = opts.code || '';
|
|
33442
33577
|
code.hidden = !opts.code;
|
|
33578
|
+
// Only fixed markup goes in here: the sprite's ids, never a server string.
|
|
33579
|
+
var icon = over && opts.icon !== 'spin' ? '' : opts.icon;
|
|
33580
|
+
lead.innerHTML = icon && !opts.load
|
|
33581
|
+
? '<svg class="ic' + (icon === 'spin' ? ' spin' : '') + '" aria-hidden="true"><use href="#i-' + icon + '"/></svg>' : '';
|
|
33582
|
+
document.getElementById('wait-text').textContent = opts.wait || '';
|
|
33583
|
+
wait.hidden = !opts.wait;
|
|
33443
33584
|
actions.textContent = '';
|
|
33444
33585
|
actions.className = opts.stack ? 'stack' : '';
|
|
33445
33586
|
(buttons || []).forEach(function (spec) {
|
|
33446
33587
|
var button = document.createElement('button');
|
|
33447
33588
|
button.type = 'button';
|
|
33448
|
-
|
|
33449
|
-
|
|
33589
|
+
if (spec.org) {
|
|
33590
|
+
// An organization's row: its first letter, its name, and a chevron. The name only ever goes in as text.
|
|
33591
|
+
button.className = 'org';
|
|
33592
|
+
var initial = document.createElement('i');
|
|
33593
|
+
initial.textContent = (Array.from(spec.label.trim())[0] || '').toUpperCase();
|
|
33594
|
+
var name = document.createElement('span');
|
|
33595
|
+
name.textContent = spec.label;
|
|
33596
|
+
button.append(initial, name);
|
|
33597
|
+
button.insertAdjacentHTML('beforeend', '<svg class="ic sm" aria-hidden="true"><use href="#i-next"/></svg>');
|
|
33598
|
+
} else {
|
|
33599
|
+
button.textContent = spec.label;
|
|
33600
|
+
if (spec.primary) button.className = 'primary';
|
|
33601
|
+
}
|
|
33450
33602
|
button.addEventListener('click', spec.onClick);
|
|
33451
33603
|
actions.appendChild(button);
|
|
33452
33604
|
});
|
|
33453
|
-
|
|
33454
|
-
screen.classList.toggle('over', over);
|
|
33605
|
+
screen.className = [over ? 'over' : '', opts.load ? 'load' : '', opts.tone || ''].join(' ').trim();
|
|
33455
33606
|
screen.hidden = false;
|
|
33456
33607
|
notice.style.display = 'none';
|
|
33457
33608
|
// A screen replaces the cover over a page switch; one drawn over the page leaves the page as it is.
|
|
@@ -33486,7 +33637,10 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33486
33637
|
});
|
|
33487
33638
|
function closeScreen() { screen.hidden = true; screen.classList.remove('over'); }
|
|
33488
33639
|
|
|
33489
|
-
if (window.parent === window) {
|
|
33640
|
+
if (window.parent === window) {
|
|
33641
|
+
show('Open this from ' + HOST_LABEL, 'This page runs inside ' + HOST_LABEL + '. Open Kombai from a ' + HOST_LABEL + ' chat.', [], { icon: 'app' });
|
|
33642
|
+
return;
|
|
33643
|
+
}
|
|
33490
33644
|
|
|
33491
33645
|
var pending = {};
|
|
33492
33646
|
var next = 1;
|
|
@@ -33698,6 +33852,21 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33698
33852
|
postToFrame({ kind: 'download-failed', canvasId: id, message: error.message, code: error.code || null });
|
|
33699
33853
|
});
|
|
33700
33854
|
}
|
|
33855
|
+
// A draft's blocks (draftContent in the file header).
|
|
33856
|
+
var PARTS_MAX = 100, TITLE_MAX = 200;
|
|
33857
|
+
function draftContent(m) {
|
|
33858
|
+
var parts = m.parts;
|
|
33859
|
+
var valid = Array.isArray(parts) && parts.length > 0 && parts.length <= PARTS_MAX &&
|
|
33860
|
+
parts.every(function (p) { return !!p && typeof p.text === 'string' && p.text.length > 0; });
|
|
33861
|
+
if (!valid) return [{ type: 'text', text: m.text }];
|
|
33862
|
+
return parts.map(function (p) {
|
|
33863
|
+
var block = { type: 'text', text: p.text };
|
|
33864
|
+
if (typeof p.title === 'string' && p.title.length > 0 && p.title.length <= TITLE_MAX) {
|
|
33865
|
+
block._meta = { 'openai/title': p.title };
|
|
33866
|
+
}
|
|
33867
|
+
return block;
|
|
33868
|
+
});
|
|
33869
|
+
}
|
|
33701
33870
|
function fromPage(m) {
|
|
33702
33871
|
if (!m || m.kombai !== EMBED || m.v !== PROTOCOL || typeof m.kind !== 'string') return;
|
|
33703
33872
|
if (m.kind === 'ready') { postToFrame(hello()); return; }
|
|
@@ -33716,7 +33885,7 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33716
33885
|
var send = SEND_ACTIONS && m.kind === 'action';
|
|
33717
33886
|
request('ui/message', {
|
|
33718
33887
|
role: 'user',
|
|
33719
|
-
content:
|
|
33888
|
+
content: draftContent(m),
|
|
33720
33889
|
_meta: { 'openai/message': { target: 'active', send: send } },
|
|
33721
33890
|
}).catch(function () {});
|
|
33722
33891
|
return;
|
|
@@ -33783,7 +33952,11 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33783
33952
|
offeredUrl = url;
|
|
33784
33953
|
var host = '';
|
|
33785
33954
|
try { host = new URL(url).host; } catch (e) { host = url; }
|
|
33786
|
-
|
|
33955
|
+
// The host only ever goes in as text.
|
|
33956
|
+
var bold = document.createElement('b');
|
|
33957
|
+
bold.textContent = host;
|
|
33958
|
+
linkText.textContent = 'Open ';
|
|
33959
|
+
linkText.append(bold, ' in your browser?');
|
|
33787
33960
|
linkBar.style.display = 'flex';
|
|
33788
33961
|
}
|
|
33789
33962
|
document.getElementById('link-open').addEventListener('click', function () {
|
|
@@ -33864,22 +34037,28 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33864
34037
|
if (typeof answer.canvas === 'string') canvas = answer.canvas;
|
|
33865
34038
|
if (typeof answer.node === 'string') node = answer.node;
|
|
33866
34039
|
}
|
|
33867
|
-
var SIGNING_IN = '
|
|
33868
|
-
var CHECK_CODE = 'Check that
|
|
34040
|
+
var SIGNING_IN = 'Kombai\u2019s sign-in is open in {{BROWSER}}. This view follows.';
|
|
34041
|
+
var CHECK_CODE = 'Check that {{BROWSER}} shows this code, then approve.';
|
|
34042
|
+
var APPROVE_IN = 'Approve in {{BROWSER}}';
|
|
34043
|
+
var OPENS_IN = 'Kombai\u2019s sign-in opens in {{BROWSER}}';
|
|
34044
|
+
var WAITING_FOR = 'Waiting for {{BROWSER}}';
|
|
34045
|
+
var approveLink = null;
|
|
34046
|
+
function openApproval() { if (approveLink) request('ui/open-link', { url: approveLink }).catch(function () {}); }
|
|
33869
34047
|
// replace: the framed page is of no use behind the screen (it could not redeem its ticket), so the screen takes its
|
|
33870
34048
|
// place, as with nothing framed.
|
|
33871
34049
|
function signInScreen(message, replace) {
|
|
34050
|
+
// Not now, when there is one, comes first: the filled Sign in ends the row.
|
|
33872
34051
|
var buttons = [{ label: 'Sign in', primary: true, onClick: function () { signIn(); } }];
|
|
33873
34052
|
// Over a framed canvas (a guest's, whose page asked to sign in): Not now just closes this, and the canvas is as it
|
|
33874
34053
|
// was. A frame loaded but hidden by an earlier screen opens again; with none there is nothing to go back to.
|
|
33875
34054
|
if (framed() && !replace) {
|
|
33876
|
-
buttons.
|
|
33877
|
-
show('Sign in to Kombai', message || 'Your guest canvas comes with you, at the same link.
|
|
34055
|
+
buttons.unshift({ label: 'Not now', onClick: closeScreen });
|
|
34056
|
+
show('Sign in to Kombai', message || 'Your guest canvas comes with you, at the same link. ' + OPENS_IN + '.', buttons, { over: true });
|
|
33878
34057
|
return;
|
|
33879
34058
|
}
|
|
33880
|
-
if (frame.getAttribute('src')) buttons.
|
|
33881
|
-
var title = canvas ? 'Sign in to
|
|
33882
|
-
show(title, message ||
|
|
34059
|
+
if (frame.getAttribute('src')) buttons.unshift({ label: 'Not now', onClick: function () { open(); } });
|
|
34060
|
+
var title = canvas ? 'Sign in to see this canvas' : 'Sign in to see your canvases';
|
|
34061
|
+
show(title, message || OPENS_IN + '. This view follows.', buttons, { icon: 'login' });
|
|
33883
34062
|
watch('not_signed_in');
|
|
33884
34063
|
}
|
|
33885
34064
|
|
|
@@ -33900,39 +34079,47 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33900
34079
|
showFrame(null);
|
|
33901
34080
|
return true;
|
|
33902
34081
|
}
|
|
33903
|
-
if (answer.status === 'no_canvas') {
|
|
34082
|
+
if (answer.status === 'no_canvas') {
|
|
34083
|
+
show('No canvas yet', 'Ask your agent to make a design. It opens here once it\u2019s made.', [], { icon: 'canvas' });
|
|
34084
|
+
watch('no_canvas');
|
|
34085
|
+
return true;
|
|
34086
|
+
}
|
|
33904
34087
|
if (answer.status === 'needs_org') {
|
|
33905
34088
|
var buttons = (Array.isArray(answer.orgs) ? answer.orgs : [])
|
|
33906
34089
|
.filter(function (org) {
|
|
33907
34090
|
return org && typeof org.name === 'string' && typeof org.id === 'string' && /^[A-Za-z0-9_-]{1,64}$/.test(org.id);
|
|
33908
34091
|
})
|
|
33909
|
-
.map(function (org) { return { label: org.name, onClick: function () { claim(org.id); } }; });
|
|
34092
|
+
.map(function (org) { return { label: org.name, org: true, onClick: function () { claim(org.id); } }; });
|
|
33910
34093
|
if (!buttons.length) { askAgent(); return true; }
|
|
33911
|
-
show('Choose where this canvas goes', 'You\u2019re in more than one organization. The canvas moves into the one you pick.', buttons, { over: true, stack: true });
|
|
34094
|
+
show('Choose where this canvas goes', 'You\u2019re in more than one organization. The canvas moves into the one you pick.', buttons, { over: true, stack: true, icon: 'org' });
|
|
33912
34095
|
return true;
|
|
33913
34096
|
}
|
|
33914
34097
|
if (answer.status === 'claim_pending') {
|
|
33915
34098
|
if (claimTries < CLAIM_TRIES) {
|
|
33916
34099
|
claimTries++;
|
|
33917
|
-
show('Finishing sign-in', 'Moving this canvas into your account…');
|
|
34100
|
+
show('Finishing sign-in', 'Moving this canvas into your account…', [], { icon: 'spin', tone: 'ok' });
|
|
33918
34101
|
retryTimer = setTimeout(function () { open(true); }, CLAIM_RETRY_MS);
|
|
33919
34102
|
return true;
|
|
33920
34103
|
}
|
|
33921
|
-
// Still not moved: the guest canvas stays usable meanwhile.
|
|
34104
|
+
// Still not moved: the guest canvas stays usable meanwhile, under the notice's Try again. With no canvas to
|
|
34105
|
+
// frame, the screen has Try again itself.
|
|
33922
34106
|
if (typeof answer.ticket === 'string' && typeof answer.hosted === 'string') {
|
|
33923
34107
|
hosted = answer.hosted;
|
|
33924
34108
|
showFrame(answer.ticket);
|
|
34109
|
+
notice.style.display = 'flex';
|
|
33925
34110
|
} else {
|
|
33926
|
-
show('
|
|
34111
|
+
show('Sign-in didn\u2019t finish', 'Your canvas is still moving into your account.',
|
|
34112
|
+
[{ label: 'Try again', primary: true, onClick: retryClaim }], { icon: 'wait', tone: 'warn' });
|
|
33927
34113
|
}
|
|
33928
|
-
notice.style.display = 'flex';
|
|
33929
34114
|
return true;
|
|
33930
34115
|
}
|
|
33931
34116
|
return false;
|
|
33932
34117
|
}
|
|
33933
34118
|
function claim(orgId) {
|
|
33934
|
-
show('Signing in…', 'Moving this canvas into your account…', [], { over: true });
|
|
33935
|
-
callTool(SESSION_TOOL, sessionArgs({ claimOrg: orgId })).then(settle, function (error) {
|
|
34119
|
+
show('Signing in…', 'Moving this canvas into your account…', [], { over: true, icon: 'spin', tone: 'ok' });
|
|
34120
|
+
callTool(SESSION_TOOL, sessionArgs({ claimOrg: orgId })).then(settle, function (error) {
|
|
34121
|
+
show('Sign-in didn\u2019t finish', error.message, [], { icon: 'alert', tone: 'warn' });
|
|
34122
|
+
});
|
|
33936
34123
|
}
|
|
33937
34124
|
function settle(answer) {
|
|
33938
34125
|
takeIds(answer);
|
|
@@ -33941,13 +34128,15 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33941
34128
|
else askAgent();
|
|
33942
34129
|
}
|
|
33943
34130
|
function askAgent() {
|
|
33944
|
-
show('
|
|
34131
|
+
if (canvas) show('This canvas didn\u2019t open', 'Ask your agent to open it again.', [], { icon: 'msg' });
|
|
34132
|
+
else show('Kombai didn\u2019t open', 'Ask your agent to open Kombai again.', [], { icon: 'msg' });
|
|
33945
34133
|
}
|
|
33946
|
-
|
|
34134
|
+
function retryClaim() {
|
|
33947
34135
|
claimTries = 0;
|
|
33948
34136
|
notice.style.display = 'none';
|
|
33949
34137
|
open();
|
|
33950
|
-
}
|
|
34138
|
+
}
|
|
34139
|
+
document.getElementById('notice-retry').addEventListener('click', retryClaim);
|
|
33951
34140
|
|
|
33952
34141
|
// The first call asks with no wait, so the match code is on screen before the person approves in the browser, as
|
|
33953
34142
|
// the sign-in card's first call does; each later call waits for the approval. A call that brings no code keeps the
|
|
@@ -33955,10 +34144,18 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33955
34144
|
function signIn(code, polling) {
|
|
33956
34145
|
clearTimeout(retryTimer);
|
|
33957
34146
|
signingIn = true;
|
|
33958
|
-
|
|
34147
|
+
if (!polling) approveLink = null;
|
|
34148
|
+
var again = approveLink ? [{ label: 'Open the page again', onClick: openApproval }] : [];
|
|
34149
|
+
show(APPROVE_IN, code ? CHECK_CODE : SIGNING_IN, again, { code: code, over: true, icon: 'login', wait: WAITING_FOR });
|
|
33959
34150
|
callTool(SESSION_TOOL, sessionArgs({ signIn: true, wait: polling ? SIGN_IN_WAIT_S : 0 })).then(function (answer) {
|
|
33960
34151
|
takeIds(answer);
|
|
33961
34152
|
if (answer.status === 'signing_in') {
|
|
34153
|
+
// Opened once per login (openNow, the CLI's firstOpen): a Sign in pressed again, or a login the card started,
|
|
34154
|
+
// keeps the page that is already open and only offers Open the page again.
|
|
34155
|
+
if (typeof answer.openLink === 'string') {
|
|
34156
|
+
approveLink = answer.openLink;
|
|
34157
|
+
if (answer.openNow === true) openApproval();
|
|
34158
|
+
}
|
|
33962
34159
|
signIn(typeof answer.matchCode === 'string' && answer.matchCode ? answer.matchCode : code, true);
|
|
33963
34160
|
return;
|
|
33964
34161
|
}
|
|
@@ -33968,6 +34165,8 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33968
34165
|
}, function (error) { signingIn = false; signInScreen(error.message); });
|
|
33969
34166
|
}
|
|
33970
34167
|
|
|
34168
|
+
function couldNotOpen(message) { show('Couldn\u2019t open Kombai', message, [], { icon: 'unplug', tone: 'warn' }); }
|
|
34169
|
+
|
|
33971
34170
|
// retry is the claim's own timer: the screen it set stays. A page on screen stays there under the cover until the
|
|
33972
34171
|
// next one loads; with none, the opening screen. Only the latest open's answer is used: an earlier one's frames
|
|
33973
34172
|
// nothing, however late it comes.
|
|
@@ -33981,12 +34180,12 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
33981
34180
|
framedGuest = false;
|
|
33982
34181
|
coverFrame();
|
|
33983
34182
|
} else if (!retry) {
|
|
33984
|
-
show('Kombai', canvas ? 'Opening the canvas…' : 'Opening Kombai…');
|
|
34183
|
+
show('Kombai', canvas ? 'Opening the canvas…' : 'Opening Kombai…', [], { load: true });
|
|
33985
34184
|
}
|
|
33986
34185
|
callTool(SESSION_TOOL, sessionArgs()).then(function (answer) {
|
|
33987
34186
|
if (mine === opens) settle(answer);
|
|
33988
34187
|
}, function (error) {
|
|
33989
|
-
if (mine === opens)
|
|
34188
|
+
if (mine === opens) couldNotOpen(error.message);
|
|
33990
34189
|
});
|
|
33991
34190
|
}
|
|
33992
34191
|
|
|
@@ -34005,14 +34204,16 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
34005
34204
|
// panel with no call gets none.
|
|
34006
34205
|
return Promise.race([resultSeen, new Promise(function (resolve) { setTimeout(resolve, RESULT_WAIT_MS); })]);
|
|
34007
34206
|
}).then(function () {
|
|
34008
|
-
if (openingError !== null) {
|
|
34207
|
+
if (openingError !== null) { couldNotOpen(openingError); return; }
|
|
34009
34208
|
// No canvas (the view opened from Codex's app menu, or a thread's panel with no canvas_app call): every canvas the
|
|
34010
34209
|
// person may see, from which open-canvas opens one.
|
|
34011
34210
|
var result = openingResult || openingArgs;
|
|
34012
34211
|
canvas = result && typeof result.canvas === 'string' ? result.canvas : null;
|
|
34013
34212
|
node = result && typeof result.node === 'string' ? result.node : null;
|
|
34014
34213
|
open();
|
|
34015
|
-
}).catch(function (error) {
|
|
34214
|
+
}).catch(function (error) {
|
|
34215
|
+
show('Couldn\u2019t connect to ' + HOST_LABEL, error.message, [], { icon: 'unplug', tone: 'warn' });
|
|
34216
|
+
});
|
|
34016
34217
|
})();
|
|
34017
34218
|
</script>
|
|
34018
34219
|
</body>
|
|
@@ -34022,6 +34223,7 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
34022
34223
|
RECHECK_MS = 2e4;
|
|
34023
34224
|
MANAGE_WAIT_MS = 6e4;
|
|
34024
34225
|
DOWNLOAD_WAIT_MS = 12e4;
|
|
34226
|
+
SERVED_HTML = VIEW_HTML.replace(/^[ \t]+/gm, "").replace(/^\/\/.*\n/gm, "");
|
|
34025
34227
|
}
|
|
34026
34228
|
});
|
|
34027
34229
|
|
|
@@ -34044,10 +34246,15 @@ function createMcpServer(ctx, options = {}) {
|
|
|
34044
34246
|
const resourceUri = versionedUri(RESOURCE_URI_BASE, ctx.version);
|
|
34045
34247
|
const clientName = () => server.getClientVersion()?.name ?? server.rawClientName;
|
|
34046
34248
|
const viewHost = () => viewHostFor(clientName(), server.showsAppViews, place);
|
|
34249
|
+
server.instructionsFor = () => viewHost()?.clientName === CODEX_CLIENT_NAME ? CODEX_INSTRUCTIONS : INSTRUCTIONS;
|
|
34047
34250
|
const cardSet = () => cardsFor(clientName(), server.showsAppViews, place);
|
|
34048
|
-
const
|
|
34251
|
+
const appBrowser = () => {
|
|
34252
|
+
const host = viewHost();
|
|
34253
|
+
return host?.browserLink ? { label: host.label, link: host.browserLink } : null;
|
|
34254
|
+
};
|
|
34255
|
+
const login2 = createLoginRunner(ctx, { inApp: () => appBrowser() !== null });
|
|
34049
34256
|
const callSession = createSessionTool(ctx, { login: login2 });
|
|
34050
|
-
const cards = createCards(ctx, { dir: options.cardsDir, login: login2 });
|
|
34257
|
+
const cards = createCards(ctx, { dir: options.cardsDir, login: login2, appBrowser });
|
|
34051
34258
|
const downloadsDir = path20.join(place.osHome, "Downloads");
|
|
34052
34259
|
const resourceMeta = async () => {
|
|
34053
34260
|
const { hosts } = await currentEnv(ctx);
|
|
@@ -34186,6 +34393,12 @@ var init_server3 = __esm({
|
|
|
34186
34393
|
* which is after `oninitialized` when the first frames arrive in one chunk. */
|
|
34187
34394
|
/** @type {string | undefined} */
|
|
34188
34395
|
rawClientName = void 0;
|
|
34396
|
+
/** The id of the client's `initialize`, whose answer carries the instructions. */
|
|
34397
|
+
/** @type {string | number | undefined} */
|
|
34398
|
+
initializeId = void 0;
|
|
34399
|
+
/** This client's instructions, read when `initialize` is answered; unset, the constructor's go to every client. */
|
|
34400
|
+
/** @type {(() => string) | undefined} */
|
|
34401
|
+
instructionsFor = void 0;
|
|
34189
34402
|
/** @param {import('@modelcontextprotocol/sdk/shared/transport.js').Transport} transport */
|
|
34190
34403
|
async connect(transport) {
|
|
34191
34404
|
const next = transport.onmessage;
|
|
@@ -34198,11 +34411,25 @@ var init_server3 = __esm({
|
|
|
34198
34411
|
this.showsAppViews = declaresMcpApps(params?.capabilities);
|
|
34199
34412
|
const name = params?.clientInfo?.name;
|
|
34200
34413
|
this.rawClientName = typeof name === "string" ? name : void 0;
|
|
34414
|
+
if ("id" in message) this.initializeId = message.id;
|
|
34201
34415
|
}
|
|
34202
34416
|
next?.(message, extra);
|
|
34203
34417
|
};
|
|
34418
|
+
const send = transport.send.bind(transport);
|
|
34419
|
+
transport.send = (message, options) => send(this.withClientInstructions(message), options);
|
|
34204
34420
|
await super.connect(transport);
|
|
34205
34421
|
}
|
|
34422
|
+
/**
|
|
34423
|
+
* The answer to `initialize` with this client's instructions in place of the constructor's; any other message as
|
|
34424
|
+
* it is.
|
|
34425
|
+
* @param {import('@modelcontextprotocol/sdk/types.js').JSONRPCMessage} message
|
|
34426
|
+
* @returns {import('@modelcontextprotocol/sdk/types.js').JSONRPCMessage}
|
|
34427
|
+
*/
|
|
34428
|
+
withClientInstructions(message) {
|
|
34429
|
+
if (!this.instructionsFor || !("result" in message) || message.id !== this.initializeId) return message;
|
|
34430
|
+
if (typeof message.result.instructions !== "string") return message;
|
|
34431
|
+
return { ...message, result: { ...message.result, instructions: this.instructionsFor() } };
|
|
34432
|
+
}
|
|
34206
34433
|
};
|
|
34207
34434
|
}
|
|
34208
34435
|
});
|
|
@@ -34211,7 +34438,7 @@ var init_server3 = __esm({
|
|
|
34211
34438
|
var actions_default;
|
|
34212
34439
|
var init_actions = __esm({
|
|
34213
34440
|
"src/skill/actions.md"() {
|
|
34214
|
-
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
|
|
34441
|
+
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 from the canvas (copied from its page, or put in the message box by the\nKombai view) comes from a canvas the user has open: don\'t show the canvas again. A canvas the user only named:\nshow 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';
|
|
34215
34442
|
}
|
|
34216
34443
|
});
|
|
34217
34444
|
|
|
@@ -34219,7 +34446,7 @@ var init_actions = __esm({
|
|
|
34219
34446
|
var brief_default;
|
|
34220
34447
|
var init_brief = __esm({
|
|
34221
34448
|
"src/skill/brief.md"() {
|
|
34222
|
-
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
|
|
34449
|
+
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 the canvas and show it\n(`kombai skill opening`) while it runs. Run `kombai taste wait <run>` in the foreground, one wait at a\ntime: it returns within 90 seconds, so while its status is running, tell the user the run is still going,\nas 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';
|
|
34223
34450
|
}
|
|
34224
34451
|
});
|
|
34225
34452
|
|
|
@@ -34231,11 +34458,19 @@ var init_claude_desktop = __esm({
|
|
|
34231
34458
|
}
|
|
34232
34459
|
});
|
|
34233
34460
|
|
|
34461
|
+
// src/skill/codex-desktop.md
|
|
34462
|
+
var codex_desktop_default;
|
|
34463
|
+
var init_codex_desktop = __esm({
|
|
34464
|
+
"src/skill/codex-desktop.md"() {
|
|
34465
|
+
codex_desktop_default = "You are running in the Codex app. Notes for it:\n\n- Kombai's tools here (canvas_app, sign_in_card, taste_card, plans_card) are not listed up front. Find them in\n exec with `ALL_TOOLS.filter((t) => t.name.startsWith('mcp__kombai'))` before you decide one is missing.\n- The canvas: Kombai's view, the canvas_app tool, is the only way to show it here. Call it with the canvas id\n right after `kombai canvas create`, before you write any design, or when you first use a canvas that isn't\n already open beside the chat, as `kombai skill opening` says. Never open a canvas in a browser or the in-app\n browser, and put no canvas or design link in a reply: the commands print none here, and a user who wants one\n copies it from the view (the canvas's Share, or a design's Copy link).\n- Taste: add --cards to every `kombai taste start`, and call taste_card when `kombai taste wait` answers with\n card.\n";
|
|
34466
|
+
}
|
|
34467
|
+
});
|
|
34468
|
+
|
|
34234
34469
|
// src/skill/design-system.md
|
|
34235
34470
|
var design_system_default;
|
|
34236
34471
|
var init_design_system = __esm({
|
|
34237
34472
|
"src/skill/design-system.md"() {
|
|
34238
|
-
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 `
|
|
34473
|
+
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';
|
|
34239
34474
|
}
|
|
34240
34475
|
});
|
|
34241
34476
|
|
|
@@ -34251,7 +34486,7 @@ var init_drawings = __esm({
|
|
|
34251
34486
|
var faq_default;
|
|
34252
34487
|
var init_faq = __esm({
|
|
34253
34488
|
"src/skill/faq.md"() {
|
|
34254
|
-
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
|
|
34489
|
+
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, Cursor, VS Code (GitHub Copilot's agent plugins) and Antigravity have\n Kombai plugins, and Gemini CLI has a Kombai extension; any agent with a terminal can run the CLI. The Codex app\n shows the canvas beside the chat and Kombai's cards (a taste run's brief, sign-in); the Claude desktop app's Code\n tab shows the taste card only. 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 skill opening` says how to show one to the user.\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";
|
|
34255
34490
|
}
|
|
34256
34491
|
});
|
|
34257
34492
|
|
|
@@ -34259,7 +34494,15 @@ var init_faq = __esm({
|
|
|
34259
34494
|
var html_default;
|
|
34260
34495
|
var init_html = __esm({
|
|
34261
34496
|
"src/skill/html.md"() {
|
|
34262
|
-
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
|
|
34497
|
+
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, and anywhere in the Codex app (whose commands print no link),\n name the design instead, with no link unless the user asks for one. A guest\'s `url` is null: point them at the\n 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';
|
|
34498
|
+
}
|
|
34499
|
+
});
|
|
34500
|
+
|
|
34501
|
+
// src/skill/opening-codex.md
|
|
34502
|
+
var opening_codex_default;
|
|
34503
|
+
var init_opening_codex = __esm({
|
|
34504
|
+
"src/skill/opening-codex.md"() {
|
|
34505
|
+
opening_codex_default = "# Showing the canvas\n\nIn the Codex app, Kombai's view shows a canvas beside the chat. It is the only way to show one here: no\nbrowser, no in-app browser, no link.\n\n1. **Find the view.** Codex lists no MCP tool up front, so search even when you see none: in exec,\n `ALL_TOOLS.filter((t) => t.name.endsWith('canvas_app'))`.\n2. **Call `canvas_app` with the canvas id** right after `kombai canvas create`, before you write any design,\n or when you first use a canvas that isn't already open beside the chat. A request from the canvas, copied\n from its page or put in the message box by the view, comes from a canvas the user has open: don't call it\n for that one. Set `node` to a design id to focus one. Each call opens another view, and the view updates\n live as you push, so call it again only when the user asks to see the canvas again or says they closed it.\n3. **No canvas_app tool?** Then Kombai's view is not connected in this chat. Tell the user in one line that\n the canvas can't be shown here: the view comes with the Kombai plugin, so they can install or turn it on,\n or start a new chat if it is on. Don't show it any other way.\n4. **canvas_app answers an error?** Tell the user what it says in one line. Don't show the canvas any other\n way.\n\nMake changes with the commands, never through the view.\n\n**No links.** The commands print no canvas or design link here. The user watches every change in the view: end\nwith a short line on what you made or changed, naming designs by their labels, and don't ask them to open the\ncanvas. If the user asks for a link, tell them the view copies it: the canvas's Share button, or Copy link on a\ndesign's right-click menu. Never give the design's .html file. A user who wants the canvas in their own browser\nopens that copied link there; never open one yourself.\n\n**A new canvas is private.** Don't suggest the user send its link to anyone before sharing is on.\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, that teammates can edit it, and that the canvas's Share button copies it.\n";
|
|
34263
34506
|
}
|
|
34264
34507
|
});
|
|
34265
34508
|
|
|
@@ -34267,7 +34510,7 @@ var init_html = __esm({
|
|
|
34267
34510
|
var opening_default;
|
|
34268
34511
|
var init_opening = __esm({
|
|
34269
34512
|
"src/skill/opening.md"() {
|
|
34270
|
-
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
|
|
34513
|
+
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 among your tools** (the Kombai view; the Codex app lists no MCP tool up front, so\n filter ALL_TOOLS for canvas_app there before you pick): 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 call\n opens another view. Make changes with the commands, never through the view.\n2. **No `canvas_app`, and you have a browser panel the user can see** (the one you sign in with,\n `kombai skill sign-in`: the Claude desktop app's Browser pane, VS Code's Integrated Browser through\n `open_browser_page`): `kombai canvas url --canvas <id> --in-app` prints a signed-in link. Open it in your\n panel. It works once, 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\nIn the Codex app use 1 alone: with no canvas_app there, tell the user Kombai's view isn't connected in this chat,\nand show no link.\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";
|
|
34271
34514
|
}
|
|
34272
34515
|
});
|
|
34273
34516
|
|
|
@@ -34275,7 +34518,7 @@ var init_opening = __esm({
|
|
|
34275
34518
|
var overview_default;
|
|
34276
34519
|
var init_overview = __esm({
|
|
34277
34520
|
"src/skill/overview.md"() {
|
|
34278
|
-
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
|
|
34521
|
+
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 among your tools, 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';
|
|
34279
34522
|
}
|
|
34280
34523
|
});
|
|
34281
34524
|
|
|
@@ -34283,17 +34526,23 @@ var init_overview = __esm({
|
|
|
34283
34526
|
var sign_in_default;
|
|
34284
34527
|
var init_sign_in = __esm({
|
|
34285
34528
|
"src/skill/sign-in.md"() {
|
|
34286
|
-
sign_in_default = "# Signing in, or trying Kombai as a guest\n\nWhat `kombai whoami` printed decides. The reasons below 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:
|
|
34529
|
+
sign_in_default = "# Signing in, or trying Kombai as a guest\n\nWhat `kombai whoami` printed decides. Where `sign_in_card` is among your tools (the Codex app lists it only in\nALL_TOOLS), it asks the sign-in questions below in your place (read The sign-in card at the end first); you still ask\nthe claim needs_org question yourself. The reasons below 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 VS Code's Integrated Browser through `open_browser_page`): run `kombai login --no-browser`, show the matchCode\n from its first line, and open the url from that line in your panel. The user signs in and approves there. With\n 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 is the user's own. Show it to them as `kombai skill opening` says; don't suggest sending its link 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 `sign_in_card` is among your tools, 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";
|
|
34287
34530
|
}
|
|
34288
34531
|
});
|
|
34289
34532
|
|
|
34290
34533
|
// src/commands/skill.js
|
|
34291
|
-
function
|
|
34292
|
-
return
|
|
34534
|
+
function skillAppOf(ctx) {
|
|
34535
|
+
return ctx.codexDesktop ? "codex-desktop" : ctx.claudeDesktop ? "claude-desktop" : null;
|
|
34536
|
+
}
|
|
34537
|
+
function fillSkillText(text, app) {
|
|
34538
|
+
return text.replaceAll("{{RUN}}", () => RUN).replaceAll("{{APP}}\n\n", () => app ? `${APP_NOTES[app].trimEnd()}
|
|
34293
34539
|
|
|
34294
34540
|
` : "").trimEnd();
|
|
34295
34541
|
}
|
|
34296
|
-
|
|
34542
|
+
function topicText(topic, app) {
|
|
34543
|
+
return fillSkillText(topic === "opening" && app === "codex-desktop" ? opening_codex_default : TOPICS[topic], app);
|
|
34544
|
+
}
|
|
34545
|
+
var TOPICS, RUN, APP_NOTES, skill, PLAIN_TEXT;
|
|
34297
34546
|
var init_skill = __esm({
|
|
34298
34547
|
"src/commands/skill.js"() {
|
|
34299
34548
|
"use strict";
|
|
@@ -34303,10 +34552,12 @@ var init_skill = __esm({
|
|
|
34303
34552
|
init_actions();
|
|
34304
34553
|
init_brief();
|
|
34305
34554
|
init_claude_desktop();
|
|
34555
|
+
init_codex_desktop();
|
|
34306
34556
|
init_design_system();
|
|
34307
34557
|
init_drawings();
|
|
34308
34558
|
init_faq();
|
|
34309
34559
|
init_html();
|
|
34560
|
+
init_opening_codex();
|
|
34310
34561
|
init_opening();
|
|
34311
34562
|
init_overview();
|
|
34312
34563
|
init_sign_in();
|
|
@@ -34323,6 +34574,7 @@ var init_skill = __esm({
|
|
|
34323
34574
|
};
|
|
34324
34575
|
RUN = `Commands here are written as \`kombai <command>\`. If \`kombai --version\` does not run, put
|
|
34325
34576
|
\`${CLI_RUN}\` in place of \`kombai\` in every command, in full, never from a variable.`;
|
|
34577
|
+
APP_NOTES = { "claude-desktop": claude_desktop_default, "codex-desktop": codex_desktop_default };
|
|
34326
34578
|
skill = {
|
|
34327
34579
|
name: "skill",
|
|
34328
34580
|
summary: "Print the skill's text, or one topic of it. Plain text: these are the agent's instructions.",
|
|
@@ -34336,10 +34588,11 @@ var init_skill = __esm({
|
|
|
34336
34588
|
details: { topics: Object.keys(TOPICS) }
|
|
34337
34589
|
});
|
|
34338
34590
|
}
|
|
34339
|
-
ctx.stdout.write(`${
|
|
34591
|
+
ctx.stdout.write(`${topicText(
|
|
34340
34592
|
/** @type {keyof typeof TOPICS} */
|
|
34341
|
-
topic
|
|
34342
|
-
|
|
34593
|
+
topic,
|
|
34594
|
+
skillAppOf(ctx)
|
|
34595
|
+
)}
|
|
34343
34596
|
`);
|
|
34344
34597
|
return { [PLAIN_TEXT]: true };
|
|
34345
34598
|
}
|
|
@@ -34767,7 +35020,7 @@ async function storeDrawingPicture(cc, projectId, drawing, file2, nodeId, stored
|
|
|
34767
35020
|
}
|
|
34768
35021
|
function repoImagesRefused({ nodeId, images }) {
|
|
34769
35022
|
return signInRequired(
|
|
34770
|
-
"Repo images need a Kombai account. Use CSS, inline SVG or a public https image instead, or sign in
|
|
35023
|
+
"Repo images need a Kombai account. Use CSS, inline SVG or a public https image instead, or sign in.",
|
|
34771
35024
|
{ ...nodeId === void 0 ? {} : { nodeId }, images }
|
|
34772
35025
|
);
|
|
34773
35026
|
}
|
|
@@ -34955,6 +35208,7 @@ var init_node = __esm({
|
|
|
34955
35208
|
"use strict";
|
|
34956
35209
|
init_define_KOMBAI_TELEMETRY();
|
|
34957
35210
|
init_api();
|
|
35211
|
+
init_codex_app();
|
|
34958
35212
|
init_canvasops();
|
|
34959
35213
|
init_canvasdir();
|
|
34960
35214
|
init_contract();
|
|
@@ -35122,7 +35376,7 @@ var init_node = __esm({
|
|
|
35122
35376
|
version: read2.version,
|
|
35123
35377
|
state: read2.state,
|
|
35124
35378
|
file: workingFile(paths, nodeId, isDrawing ? "content" : "html"),
|
|
35125
|
-
|
|
35379
|
+
...linkField(ctx, nodeLink(cc, nodeId)),
|
|
35126
35380
|
expiresAt: read2.expiresAt ?? null
|
|
35127
35381
|
};
|
|
35128
35382
|
}
|
|
@@ -35211,7 +35465,7 @@ var init_node = __esm({
|
|
|
35211
35465
|
version: read2.version,
|
|
35212
35466
|
state: read2.state,
|
|
35213
35467
|
file: info.file ? path21.join(paths.dir, info.file) : null,
|
|
35214
|
-
|
|
35468
|
+
...linkField(ctx, nodeLink(cc, nodeId)),
|
|
35215
35469
|
overrides: files.overrides ? workingFile(paths, nodeId, "overrides") : null,
|
|
35216
35470
|
images: read2.images ?? [],
|
|
35217
35471
|
screenshotState: read2.screenshotState ?? null,
|
|
@@ -35243,7 +35497,7 @@ var init_node = __esm({
|
|
|
35243
35497
|
for (const nodeId of nodeIds) {
|
|
35244
35498
|
try {
|
|
35245
35499
|
const result = await pushOne(ctx, cc, projectId, nodeId, Boolean(flags.merged));
|
|
35246
|
-
nodes.push({ ...result,
|
|
35500
|
+
nodes.push({ ...result, ...linkField(ctx, nodeLink(cc, nodeId)) });
|
|
35247
35501
|
if (result.status !== "unchanged") pushed.push(nodeId);
|
|
35248
35502
|
} catch (error2) {
|
|
35249
35503
|
if (!(error2 instanceof CliError)) ctx.telemetry.capture(error2, "node push");
|
|
@@ -35269,7 +35523,7 @@ var init_node = __esm({
|
|
|
35269
35523
|
};
|
|
35270
35524
|
nodeLock = {
|
|
35271
35525
|
name: "node lock",
|
|
35272
|
-
summary: "Mark a design as being edited, so the canvas shows it busy: run it
|
|
35526
|
+
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.",
|
|
35273
35527
|
flags: {
|
|
35274
35528
|
canvas: { type: "string", required: true, placeholder: "<id|link>", check: canvasRefProblem },
|
|
35275
35529
|
node: { type: "string", required: true, placeholder: "<id>", check: (value) => nodeIdProblem(value) }
|
|
@@ -35685,7 +35939,7 @@ var init_screenshot = __esm({
|
|
|
35685
35939
|
if (result.signedOut)
|
|
35686
35940
|
throw new CliError("UNAUTHORIZED", "The key stopped working.", {
|
|
35687
35941
|
exit: Exit.NOT_SIGNED_IN,
|
|
35688
|
-
next:
|
|
35942
|
+
next: SIGN_IN_NEXT,
|
|
35689
35943
|
details: lists()
|
|
35690
35944
|
});
|
|
35691
35945
|
if (result.guestFull) {
|
|
@@ -36022,7 +36276,7 @@ var init_app_skills = __esm({
|
|
|
36022
36276
|
});
|
|
36023
36277
|
|
|
36024
36278
|
// src/lib/args.js
|
|
36025
|
-
function parseArgv(argv, commands) {
|
|
36279
|
+
function parseArgv(argv, commands, listed = (command) => !command.hidden) {
|
|
36026
36280
|
const pretty = argv.includes("--pretty");
|
|
36027
36281
|
const json2 = argv.includes("--json");
|
|
36028
36282
|
const tokens = argv.filter((token) => !GLOBAL_FLAGS.has(token));
|
|
@@ -36040,7 +36294,7 @@ function parseArgv(argv, commands) {
|
|
|
36040
36294
|
const command = findCommand(words, commands);
|
|
36041
36295
|
if (!command) {
|
|
36042
36296
|
const asked = words.slice(0, 2).join(" ");
|
|
36043
|
-
const group = commands.filter((c) =>
|
|
36297
|
+
const group = commands.filter((c) => listed(c) && c.name.startsWith(`${words[0]} `)).map((c) => c.name);
|
|
36044
36298
|
if (help && group.length && words.length === 1)
|
|
36045
36299
|
return { kind: "help", command: null, group: words[0], json: json2, pretty };
|
|
36046
36300
|
throw new CliError(
|
|
@@ -36319,7 +36573,10 @@ function eventsOf(ctx, ran, scope, machine) {
|
|
|
36319
36573
|
os: ctx.platform,
|
|
36320
36574
|
arch: process.arch,
|
|
36321
36575
|
nodeVersion: process.versions.node,
|
|
36322
|
-
ci: Boolean(process.env.CI)
|
|
36576
|
+
ci: Boolean(process.env.CI),
|
|
36577
|
+
// Whether the CLI took this for an agent in the Codex desktop app (codex-app.js). Its marker is internal to
|
|
36578
|
+
// Codex, so a drop to none here is how a release that renamed it shows up.
|
|
36579
|
+
codexDesktop: ctx.codexDesktop
|
|
36323
36580
|
}
|
|
36324
36581
|
}
|
|
36325
36582
|
];
|
|
@@ -36464,6 +36721,7 @@ function createContext(overrides = {}) {
|
|
|
36464
36721
|
telemetry: new Telemetry(process.env.DO_NOT_TRACK === "1" ? null : TELEMETRY_KEYS, postDetached),
|
|
36465
36722
|
sandbox: sandboxOf(process.env),
|
|
36466
36723
|
claudeDesktop: process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop",
|
|
36724
|
+
codexDesktop: inCodexDesktop(process.env),
|
|
36467
36725
|
changeSent: false,
|
|
36468
36726
|
appSkillDirs: appSkillDirsOf(os4.homedir(), process.env),
|
|
36469
36727
|
...overrides
|
|
@@ -36475,6 +36733,7 @@ var init_context = __esm({
|
|
|
36475
36733
|
"use strict";
|
|
36476
36734
|
init_define_KOMBAI_TELEMETRY();
|
|
36477
36735
|
init_app_skills();
|
|
36736
|
+
init_codex_app();
|
|
36478
36737
|
init_deadline();
|
|
36479
36738
|
init_open();
|
|
36480
36739
|
init_output();
|
|
@@ -36503,7 +36762,7 @@ async function run(argv, overrides = {}) {
|
|
|
36503
36762
|
async function execute(ctx, argv, ran) {
|
|
36504
36763
|
let running = null;
|
|
36505
36764
|
try {
|
|
36506
|
-
const parsed = parseArgv(argv, COMMANDS);
|
|
36765
|
+
const parsed = parseArgv(argv, COMMANDS, (c) => listedIn(ctx, c));
|
|
36507
36766
|
ran.command = parsed.kind === "version" ? "--version" : parsed.command?.name ?? null;
|
|
36508
36767
|
if (parsed.kind === "help") {
|
|
36509
36768
|
ran.help = true;
|
|
@@ -36532,8 +36791,11 @@ async function execute(ctx, argv, ran) {
|
|
|
36532
36791
|
return failure.exit;
|
|
36533
36792
|
}
|
|
36534
36793
|
}
|
|
36794
|
+
function listedIn(ctx, command) {
|
|
36795
|
+
return !command.hidden && !(ctx.codexDesktop && command.notInCodexDesktop);
|
|
36796
|
+
}
|
|
36535
36797
|
function printHelp(ctx, command, group, json2) {
|
|
36536
|
-
const listed = command ? [command] : COMMANDS.filter((c) =>
|
|
36798
|
+
const listed = command ? [command] : COMMANDS.filter((c) => listedIn(ctx, c) && (group === void 0 || c.name.startsWith(`${group} `)));
|
|
36537
36799
|
if (json2) {
|
|
36538
36800
|
const commands = listed.map((c) => ({
|
|
36539
36801
|
usage: usageOf(c),
|
|
@@ -36597,7 +36859,7 @@ var init_cli = __esm({
|
|
|
36597
36859
|
init_define_KOMBAI_TELEMETRY();
|
|
36598
36860
|
var major = Number(process.versions.node.split(".")[0]);
|
|
36599
36861
|
if (major < 20) {
|
|
36600
|
-
process.
|
|
36862
|
+
process.stderr.write(
|
|
36601
36863
|
`${JSON.stringify({ error: { code: "CLI_NODE_TOO_OLD", message: `kombai needs Node 20 or later; this is ${process.version}.` } })}
|
|
36602
36864
|
`
|
|
36603
36865
|
);
|