@kombai/cli 0.2.1 → 0.2.3-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/kombai.mjs CHANGED
@@ -62,9 +62,9 @@ var init_env = __esm({
62
62
  preprod: { api: "https://api.assistant.preprod.kombai.com", web: "https://agent.preprod.kombai.com" },
63
63
  prod: { api: "https://api.assistant.app.kombai.com", web: "https://agent.kombai.com" }
64
64
  });
65
- DEFAULT_ENV = Object.hasOwn(ENVIRONMENTS, "prod") ? (
65
+ DEFAULT_ENV = Object.hasOwn(ENVIRONMENTS, "dev") ? (
66
66
  /** @type {EnvName} */
67
- "prod"
67
+ "dev"
68
68
  ) : "prod";
69
69
  }
70
70
  });
@@ -504,6 +504,9 @@ function pick(entry, fields) {
504
504
  function hasGuest(entry) {
505
505
  return typeof entry.guest === "string" && entry.guest !== "";
506
506
  }
507
+ function isMarkedClaimed(guest2) {
508
+ return typeof guest2?.guestClaimed === "string" && guest2.guestClaimed === guest2.guestId;
509
+ }
507
510
  async function writeCredential(home, env, credential) {
508
511
  await updateEntry(home, env, (entry) => {
509
512
  return {
@@ -588,7 +591,14 @@ var init_store = __esm({
588
591
  SIGN_IN_AGAIN = "that signs this machine out, so sign in again after.";
589
592
  NEW_MACHINE_ID = "the CLI then makes a new machine id.";
590
593
  KEY_FIELDS = Object.freeze(["key", "keyId", "userId", "email", "expires"]);
591
- GUEST_FIELDS = Object.freeze(["guest", "guestId", "canvasId", "guestExpires", "claimOrgs"]);
594
+ GUEST_FIELDS = Object.freeze([
595
+ "guest",
596
+ "guestId",
597
+ "canvasId",
598
+ "guestExpires",
599
+ "claimOrgs",
600
+ "guestClaimed"
601
+ ]);
592
602
  }
593
603
  });
594
604
 
@@ -1040,13 +1050,13 @@ var init_version = __esm({
1040
1050
  init_define_KOMBAI_TELEMETRY();
1041
1051
  init_codexKombaiEntry();
1042
1052
  init_place();
1043
- CLI_VERSION = true ? "0.2.1" : (
1053
+ CLI_VERSION = true ? "0.2.3-alpha.1" : (
1044
1054
  /** @type {{ version: string }} */
1045
1055
  JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version
1046
1056
  );
1047
- CLI_NPX_RUN = true ? "npx -y @kombai/cli@0.2.1" : `npx -y ${KOMBAI_CLI_PACKAGE}`;
1057
+ CLI_NPX_RUN = true ? "npx -y @kombai/cli@alpha" : `npx -y ${KOMBAI_CLI_PACKAGE}`;
1048
1058
  CLI_RUN = runLineOf(fileURLToPath(import.meta.url), CLI_VERSION, CLI_NPX_RUN);
1049
- CLI_PACKAGE = true ? "@kombai/cli@0.2.1" : KOMBAI_CLI_PACKAGE;
1059
+ CLI_PACKAGE = true ? "@kombai/cli@alpha" : KOMBAI_CLI_PACKAGE;
1050
1060
  CLI_OUTDATED_NEXT = "A newer Kombai CLI is out; update the Kombai plugin.";
1051
1061
  }
1052
1062
  });
@@ -1732,7 +1742,7 @@ function checkingCommandOf(argv2) {
1732
1742
  const words = tokens.slice(0, i);
1733
1743
  if (words[0] === "update" && words.length === 1) return "update";
1734
1744
  if (words[0] === "mcp" && words[1] === "install") return "mcp install";
1735
- if (words[0] === "skill" && tokens.length === 1) return "skill";
1745
+ if (words[0] === "skill") return "skill";
1736
1746
  return null;
1737
1747
  }
1738
1748
  function report(fields = {}) {
@@ -1754,6 +1764,7 @@ function report(fields = {}) {
1754
1764
  current: null,
1755
1765
  entry: null,
1756
1766
  error: null,
1767
+ withdrawn: null,
1757
1768
  startedAs: fields.install ?? "other",
1758
1769
  ...fields
1759
1770
  };
@@ -1986,6 +1997,10 @@ async function prerun(argv2, deps = realDeps()) {
1986
1997
  }
1987
1998
  }
1988
1999
  }
2000
+ const recorded = place.kind === "managed" ? result.bootstrap : null;
2001
+ if (checking && recorded !== null && blocked.includes(deps.version) && isManagedVersion(recorded) && channelOfVersion(recorded) === channel && !blocked.includes(recorded)) {
2002
+ result.withdrawn = { version: deps.version, bootstrap: recorded };
2003
+ }
1989
2004
  return { handedOff: false, overrides: { selfUpdate: result, ...entryPackage(result.entry ?? null, channel) } };
1990
2005
  }
1991
2006
  async function entryVersion(paths, result, blocked) {
@@ -3074,7 +3089,7 @@ function storageReason(text) {
3074
3089
  const match = /<Code>([^<]+)<\/Code>/.exec(text);
3075
3090
  return match ? match[1] : void 0;
3076
3091
  }
3077
- var CALL_LIMIT_MS, STORAGE_LIMIT_MS, LOST_ANSWER_BACKOFF_MS, MAX_RETRY_AFTER_TRIES, MAX_RETRY_AFTER_MS, PRIVATE_CANVAS, UNKNOWN_OUTCOME_STATUSES, GUEST_CLAIM_PATH, GUEST_CANVAS_PATH, GUEST_GONE_CODES, isGuestGone, LostAnswer, ApiClient, GUEST_ERRORS;
3092
+ var CALL_LIMIT_MS, STORAGE_LIMIT_MS, LOST_ANSWER_BACKOFF_MS, MAX_RETRY_AFTER_TRIES, MAX_RETRY_AFTER_MS, PRIVATE_CANVAS, UNKNOWN_OUTCOME_STATUSES, GUEST_CLAIM_PATH, GUEST_CANVAS_PATH, CliCapability, CLI_CAPS, GUEST_GONE_CODES, isGuestGone, LostAnswer, ApiClient, GUEST_ERRORS;
3078
3093
  var init_api = __esm({
3079
3094
  "src/lib/api.js"() {
3080
3095
  "use strict";
@@ -3093,6 +3108,14 @@ var init_api = __esm({
3093
3108
  UNKNOWN_OUTCOME_STATUSES = /* @__PURE__ */ new Set([500, 502, 504]);
3094
3109
  GUEST_CLAIM_PATH = "/design/guest-claim";
3095
3110
  GUEST_CANVAS_PATH = "/design/canvases/";
3111
+ CliCapability = Object.freeze({
3112
+ /**
3113
+ * A guest token the store calls claimed (SIGNIN_GUEST_CLAIMED) is kept and marked `guestClaimed`, so the next
3114
+ * login's claim repeats and names the canvas: the hosted page may then claim the guest canvas itself.
3115
+ */
3116
+ PageClaim: "page-claim"
3117
+ });
3118
+ CLI_CAPS = Object.values(CliCapability).join(",");
3096
3119
  GUEST_GONE_CODES = /* @__PURE__ */ new Set(["SIGNIN_GUEST_EXPIRED", "SIGNIN_GUEST_CLAIMED"]);
3097
3120
  isGuestGone = (code) => GUEST_GONE_CODES.has(code);
3098
3121
  LostAnswer = class extends CliError {
@@ -3144,6 +3167,7 @@ var init_api = __esm({
3144
3167
  const url2 = `${this.baseUrl}${path30}${queryString(options.query)}`;
3145
3168
  const headers = {
3146
3169
  "x-kombai-cli": this.ctx.version,
3170
+ "x-kombai-cli-caps": CLI_CAPS,
3147
3171
  "x-type": "agent",
3148
3172
  "x-session-id": this.ctx.sessionId
3149
3173
  };
@@ -3344,12 +3368,13 @@ async function openAnySession(ctx, options = {}) {
3344
3368
  ...guestHooks(ctx, env, guest2)
3345
3369
  });
3346
3370
  const session = { kind: "key", env, hosts, credential, guest: guest2, api: api2 };
3347
- if (guest2 && !guest2.claimOrgs && options.claim !== false) {
3371
+ if (guest2 && (!guest2.claimOrgs || isMarkedClaimed(guest2)) && options.claim !== false) {
3348
3372
  const outcome = await settleClaim(ctx, session, void 0, { retry: options.claimRetry ?? "safe" });
3349
3373
  if (outcome.status === "pending") ctx.warnings.add(CLAIM_PENDING);
3350
3374
  }
3351
3375
  return session;
3352
3376
  }
3377
+ if (isClaimedGuest(entry)) throw guestClaimedRefusal();
3353
3378
  if (!guest2 || holdsAccount(entry)) throw notSignedIn(`Not signed in to Kombai (${env}).`, notSignedInReason(entry));
3354
3379
  const api = new ApiClient({ ctx, baseUrl: hosts.api, key: null, deadline, ...guestHooks(ctx, env, guest2) });
3355
3380
  return { kind: "guest", env, hosts, credential: null, guest: guest2, api };
@@ -3357,9 +3382,14 @@ async function openAnySession(ctx, options = {}) {
3357
3382
  function isPureGuest(entry) {
3358
3383
  return hasGuest(entry) && !holdsAccount(entry);
3359
3384
  }
3385
+ function isClaimedGuest(entry) {
3386
+ return isPureGuest(entry) && isMarkedClaimed(entry);
3387
+ }
3360
3388
  async function refuseGuest(ctx) {
3361
3389
  const { env } = await currentEnv(ctx);
3362
- if (isPureGuest(await readEntry(ctx.home, env)))
3390
+ const entry = await readEntry(ctx.home, env);
3391
+ if (isClaimedGuest(entry)) throw guestClaimedRefusal();
3392
+ if (isPureGuest(entry))
3363
3393
  throw signInRequired("This needs a Kombai account, and this machine is a guest: sign in first.");
3364
3394
  }
3365
3395
  function guestHooks(ctx, env, guest2) {
@@ -3368,7 +3398,8 @@ function guestHooks(ctx, env, guest2) {
3368
3398
  let expires = guest2.guestExpires;
3369
3399
  return {
3370
3400
  guest: { token, canvasId: guest2.canvasId ?? null },
3371
- onGuestGone: () => forgetGuest(ctx.home, env, token),
3401
+ /** @param {import('./api.js').GuestGoneCode} code */
3402
+ onGuestGone: (code) => code === "SIGNIN_GUEST_CLAIMED" ? markGuestClaimed(ctx.home, env, token, guest2.guestId) : forgetGuest(ctx.home, env, token),
3372
3403
  /** @param {string} guestExpiresAt */
3373
3404
  onGuestExpires: async (guestExpiresAt) => {
3374
3405
  if (guestExpiresAt === expires) return;
@@ -3416,6 +3447,15 @@ async function forgetGuest(home, env, guest2) {
3416
3447
  for (const field of GUEST_FIELDS) delete record2[field];
3417
3448
  });
3418
3449
  }
3450
+ async function markGuestClaimed(home, env, guest2, guestId) {
3451
+ await writeGuest(home, env, { guestClaimed: guestId }, { ifGuest: guest2 });
3452
+ }
3453
+ function guestClaimedRefusal() {
3454
+ return notSignedIn(
3455
+ "This guest canvas moved into a Kombai account; sign in to reach it.",
3456
+ NotSignedInReason.GUEST_CLAIMED
3457
+ );
3458
+ }
3419
3459
  async function settleClaim(ctx, session, orgId, options = {}) {
3420
3460
  const guest2 = session.guest;
3421
3461
  if (!guest2) return { status: "none" };
@@ -3437,8 +3477,13 @@ async function settleClaim(ctx, session, orgId, options = {}) {
3437
3477
  } catch (error2) {
3438
3478
  if (!(error2 instanceof CliError)) throw error2;
3439
3479
  if (CLAIM_ENDED_CODES.has(error2.code)) {
3480
+ const claimedEarlier = isMarkedClaimed(guest2) && error2.code === "SIGNIN_GUEST_EXPIRED";
3481
+ if (claimedEarlier) error2.message = CLAIMED_EARLIER;
3440
3482
  await forgetGuest(ctx.home, env, guest2.guest);
3441
- ctx.warnings.add({ code: error2.code, message: CLAIM_ENDED_MESSAGES[error2.code] ?? error2.message });
3483
+ ctx.warnings.add({
3484
+ code: error2.code,
3485
+ message: claimedEarlier ? CLAIMED_EARLIER : CLAIM_ENDED_MESSAGES[error2.code] ?? error2.message
3486
+ });
3442
3487
  return settled({ status: "dropped", error: error2 });
3443
3488
  }
3444
3489
  if (error2.status === 401) throw error2;
@@ -3478,7 +3523,7 @@ function claimFields(outcome) {
3478
3523
  return {};
3479
3524
  }
3480
3525
  }
3481
- var NotSignedInReason, CLAIM_PENDING, CLAIM_ENDED_CODES, CLAIM_ENDED_MESSAGES, CLAIM_BAD_ORG_CODES;
3526
+ var NotSignedInReason, CLAIM_PENDING, CLAIM_ENDED_CODES, CLAIM_ENDED_MESSAGES, CLAIMED_EARLIER, CLAIM_BAD_ORG_CODES;
3482
3527
  var init_session = __esm({
3483
3528
  "src/lib/session.js"() {
3484
3529
  "use strict";
@@ -3493,7 +3538,9 @@ var init_session = __esm({
3493
3538
  /** A key is stored but has expired. */
3494
3539
  EXPIRED: "expired",
3495
3540
  /** The key was forgotten after the backend refused it. */
3496
- SIGNED_OUT: "signed_out"
3541
+ SIGNED_OUT: "signed_out",
3542
+ /** No account here, and the guest token held is marked claimed: its canvas moved into an account (guestClaimed). */
3543
+ GUEST_CLAIMED: "guest_claimed"
3497
3544
  });
3498
3545
  CLAIM_PENDING = Object.freeze({
3499
3546
  code: "CLI_CLAIM_PENDING",
@@ -3504,6 +3551,7 @@ var init_session = __esm({
3504
3551
  SIGNIN_GUEST_EXPIRED: "The guest canvas had expired, so there was nothing to move into your account.",
3505
3552
  SIGNIN_GUEST_CLAIMED: "The guest canvas was already moved into an account."
3506
3553
  };
3554
+ CLAIMED_EARLIER = "The guest canvas had already moved into an account.";
3507
3555
  CLAIM_BAD_ORG_CODES = /* @__PURE__ */ new Set(["DESIGN_FORBIDDEN", "DESIGN_BAD_REQUEST"]);
3508
3556
  }
3509
3557
  });
@@ -4949,7 +4997,7 @@ function heldLine(ctx, env, entry) {
4949
4997
  if (holdsAccount(entry)) {
4950
4998
  throw notSignedIn("This machine has signed in to Kombai before; sign in again.", notSignedInReason(entry));
4951
4999
  }
4952
- return hasGuest(entry) ? guestLine(entry, env) : null;
5000
+ return hasGuest(entry) && !isMarkedClaimed(entry) ? guestLine(entry, env) : null;
4953
5001
  }
4954
5002
  function whoamiLine(ctx, env, entry) {
4955
5003
  const credential = keyOf(entry);
@@ -4963,6 +5011,7 @@ function whoamiLine(ctx, env, entry) {
4963
5011
  throw error2;
4964
5012
  }
4965
5013
  if (!hasGuest(entry)) throw error2;
5014
+ if (isMarkedClaimed(entry)) throw guestClaimedRefusal();
4966
5015
  return {
4967
5016
  status: "guest",
4968
5017
  guestId: entry.guestId,
@@ -4973,9 +5022,10 @@ function whoamiLine(ctx, env, entry) {
4973
5022
  }
4974
5023
  function keyLine(credential, env, entry) {
4975
5024
  if (!hasGuest(entry)) return identity(credential, env);
5025
+ const needsOrg = entry.claimOrgs && !isMarkedClaimed(entry);
4976
5026
  return {
4977
5027
  ...identity(credential, env),
4978
- ...entry.claimOrgs ? { claim: "needs_org", orgs: entry.claimOrgs } : { claim: "pending" }
5028
+ ...needsOrg ? { claim: "needs_org", orgs: entry.claimOrgs } : { claim: "pending" }
4979
5029
  };
4980
5030
  }
4981
5031
  function guestLine(entry, env) {
@@ -5182,7 +5232,7 @@ var init_auth = __esm({
5182
5232
  }
5183
5233
  const token = parsed[0];
5184
5234
  const after = await updateEntry(ctx.home, env, (entry) => {
5185
- if (holdsAccount(entry) || hasGuest(entry)) return;
5235
+ if (holdsAccount(entry) || hasGuest(entry) && !isMarkedClaimed(entry)) return;
5186
5236
  const record2 = (
5187
5237
  /** @type {Record<string, unknown>} */
5188
5238
  entry
@@ -9710,7 +9760,7 @@ async function ticketedUrl(ctx, cc) {
9710
9760
  cc.canvasId
9711
9761
  );
9712
9762
  const { projectId } = await projectOf(ctx, cc, await readForLink(cc));
9713
- const guestOwns = cc.session.kind === "key" && cc.session.guest?.canvasId === canvasId;
9763
+ const guestOwns = cc.session.kind === "key" && cc.session.guest?.canvasId === canvasId && !isMarkedClaimed(cc.session.guest);
9714
9764
  const res = await cc.session.api.call({
9715
9765
  method: "POST",
9716
9766
  path: "/design/tickets",
@@ -10353,6 +10403,7 @@ var init_config = __esm({
10353
10403
  const credential = await readCredential(ctx.home, env);
10354
10404
  if (!credential) {
10355
10405
  const entry = await readEntry(ctx.home, env);
10406
+ if (isClaimedGuest(entry)) throw guestClaimedRefusal();
10356
10407
  if (isPureGuest(entry))
10357
10408
  throw signInRequired("The preference is kept per signed-in user, and this machine is a guest: sign in first.");
10358
10409
  throw notSignedIn("Sign in first: the preference is kept per signed-in user.", notSignedInReason(entry));
@@ -10437,12 +10488,15 @@ var init_credits = __esm({
10437
10488
  });
10438
10489
 
10439
10490
  // src/lib/dskit.js
10440
- async function lintDesignSystem(markdown) {
10491
+ async function loadDsKit() {
10441
10492
  const url2 = new URL(BUNDLED ? "./ds-kit.mjs" : "./dskit-entry.js", import.meta.url).href;
10442
- const { lintSource, parse: parse3 } = (
10493
+ return (
10443
10494
  /** @type {typeof import('./dskit-entry.js')} */
10444
10495
  await import(url2)
10445
10496
  );
10497
+ }
10498
+ async function lintDesignSystem(markdown) {
10499
+ const { lintSource, parse: parse3 } = await loadDsKit();
10446
10500
  const result = lintSource(markdown);
10447
10501
  return {
10448
10502
  ...result,
@@ -10454,12 +10508,36 @@ async function lintDesignSystem(markdown) {
10454
10508
  ) }
10455
10509
  };
10456
10510
  }
10457
- var BUNDLED;
10511
+ function shortDescription(text) {
10512
+ const whole = text.trim();
10513
+ if (!whole) return null;
10514
+ const sentence2 = whole.match(/^.*?[.!?](?=\s|$)/s)?.[0];
10515
+ const first = sentence2 && sentence2.length >= SENTENCE_MIN ? sentence2 : whole;
10516
+ if (first.length <= DESCRIPTION_MAX) return first;
10517
+ const cut = first.slice(0, DESCRIPTION_MAX);
10518
+ return `${cut.slice(0, cut.lastIndexOf(" ") > 0 ? cut.lastIndexOf(" ") : DESCRIPTION_MAX).replace(/[\s,;:–—-]+$/, "")}\u2026`;
10519
+ }
10520
+ async function designSystemFacts(markdown, slug) {
10521
+ const { parse: parse3, toPreview } = await loadDsKit();
10522
+ const system = parse3(markdown, slug);
10523
+ return {
10524
+ preview: toPreview(system).preview,
10525
+ description: shortDescription(system.body?.description ?? ""),
10526
+ counts: {
10527
+ colors: Object.keys(system.color?.palette ?? {}).length,
10528
+ text_styles: Object.keys(system.typography?.textStyle ?? {}).length,
10529
+ components: Object.keys(system.components ?? {}).length
10530
+ }
10531
+ };
10532
+ }
10533
+ var BUNDLED, DESCRIPTION_MAX, SENTENCE_MIN;
10458
10534
  var init_dskit = __esm({
10459
10535
  "src/lib/dskit.js"() {
10460
10536
  "use strict";
10461
10537
  init_define_KOMBAI_TELEMETRY();
10462
10538
  BUNDLED = true;
10539
+ DESCRIPTION_MAX = 280;
10540
+ SENTENCE_MIN = 40;
10463
10541
  }
10464
10542
  });
10465
10543
 
@@ -10620,6 +10698,7 @@ function dsPaths(home, env, ownerKey, slug) {
10620
10698
  file: path19.join(dir, `${slug}.ds`),
10621
10699
  baseCopy: path19.join(dir, ".base", `${slug}.ds`),
10622
10700
  baseJson: path19.join(dir, ".base", `${slug}.json`),
10701
+ previousCopy: path19.join(dir, ".base", `${slug}.previous.ds`),
10623
10702
  remote: path19.join(dir, ".remote"),
10624
10703
  orig: path19.join(dir, ".txn", "orig"),
10625
10704
  lock: path19.join(dir, `.${slug}.lock`)
@@ -10628,6 +10707,28 @@ function dsPaths(home, env, ownerKey, slug) {
10628
10707
  function publicDir(home, env) {
10629
10708
  return path19.join(home, env, "design-systems", "public");
10630
10709
  }
10710
+ function pageUrl(web, kind, id) {
10711
+ return `${web}${kind === "mine" ? `/ds/${encodeURIComponent(id)}` : `/ds?preset=${encodeURIComponent(id)}`}`;
10712
+ }
10713
+ function dsPage(ctx, web, kind, id, shared = false) {
10714
+ return linkField(ctx, shared ? null : pageUrl(web, kind, id));
10715
+ }
10716
+ async function ownPageUrl(api, web, slug, ownerKey, owners) {
10717
+ const held = owners ?? (await listAll(api)).filter((i) => i.slug === slug).map((i) => i.ownerKey);
10718
+ return held.length === 1 && held[0] === ownerKey ? pageUrl(web, "mine", slug) : null;
10719
+ }
10720
+ async function ownPage(ctx, session, slug, ownerKey, owners) {
10721
+ if (ctx.codexDesktop) return {};
10722
+ const url2 = await ownPageUrl(session.api, session.hosts.web, slug, ownerKey, owners).catch((error2) => {
10723
+ if (!(error2 instanceof CliError)) ctx.telemetry.capture(error2, "ds page link");
10724
+ ctx.warnings.add({
10725
+ code: error2 instanceof CliError ? error2.code : "CLI_INTERNAL",
10726
+ message: `No page link for ${slug}: ${error2 instanceof Error ? error2.message : String(error2)}`
10727
+ });
10728
+ return null;
10729
+ });
10730
+ return { url: url2 };
10731
+ }
10631
10732
  async function pullPublic(ctx, id) {
10632
10733
  if (!isSafePresetId(id)) {
10633
10734
  throw badValues("ds pull", [`"${id}" is not a public design system id (letters, digits, _ and -)`]);
@@ -10648,7 +10749,7 @@ async function pullPublic(ctx, id) {
10648
10749
  const file2 = path19.join(publicDir(ctx.home, session.env), `${id}.ds`);
10649
10750
  await ensureDir(path19.dirname(file2));
10650
10751
  await writeFileAtomic(file2, doc, { mode: 420 });
10651
- return { id, name: found.name, public: true, file: file2 };
10752
+ return { id, name: found.name, public: true, file: file2, ...dsPage(ctx, session.hosts.web, "public", id) };
10652
10753
  }
10653
10754
  async function forgetDesignSystem(paths, slug, ownerKey) {
10654
10755
  if (!await fs19.stat(paths.dir).catch(() => null)) return null;
@@ -10661,13 +10762,19 @@ async function forgetDesignSystem(paths, slug, ownerKey) {
10661
10762
  const edited = observed !== null && observed !== base?.hash;
10662
10763
  await dropRemotes(paths, slug);
10663
10764
  if (edited) {
10664
- await writeJsonAtomic(paths.baseJson, { slug, ownerKey, hash: "", ...base, version: 0 }, { mode: 420 });
10765
+ const { previous: _gone, ...kept } = (
10766
+ /** @type {Partial<DsBase>} */
10767
+ base ?? {}
10768
+ );
10769
+ await writeJsonAtomic(paths.baseJson, { slug, ownerKey, hash: "", ...kept, version: 0 }, { mode: 420 });
10770
+ await fs19.rm(paths.previousCopy, { force: true });
10665
10771
  return paths.file;
10666
10772
  }
10667
10773
  await Promise.all([
10668
10774
  fs19.rm(paths.file, { force: true }),
10669
10775
  fs19.rm(paths.baseCopy, { force: true }),
10670
- fs19.rm(paths.baseJson, { force: true })
10776
+ fs19.rm(paths.baseJson, { force: true }),
10777
+ fs19.rm(paths.previousCopy, { force: true })
10671
10778
  ]);
10672
10779
  return null;
10673
10780
  });
@@ -10738,7 +10845,11 @@ function normalized(text) {
10738
10845
  async function deletedSinceRead(ctx, env, slug, file2, pulled, owner, error2) {
10739
10846
  if (pulled) {
10740
10847
  const paths = dsPaths(ctx.home, env, pulled.ownerKey, slug);
10741
- await withLock(paths.lock, () => writeJsonAtomic(paths.baseJson, { ...pulled, version: 0 }, { mode: 420 }));
10848
+ const { previous: _gone, ...kept } = pulled;
10849
+ await withLock(paths.lock, async () => {
10850
+ await writeJsonAtomic(paths.baseJson, { ...kept, version: 0 }, { mode: 420 });
10851
+ await fs19.rm(paths.previousCopy, { force: true });
10852
+ });
10742
10853
  }
10743
10854
  const ownerKey = pulled?.ownerKey ?? owner.ownerKey ?? (owner.orgId ? `org:${owner.orgId}` : void 0);
10744
10855
  error2.message = `${slug} was deleted${pulled ? ` from ${pulled.ownerKey} since you pulled it` : ""}. Push it again to save it anew, or leave it deleted.`;
@@ -10746,10 +10857,33 @@ async function deletedSinceRead(ctx, env, slug, file2, pulled, owner, error2) {
10746
10857
  error2.details = { ...error2.details, slug, ...ownerKey ? { ownerKey } : {} };
10747
10858
  return error2;
10748
10859
  }
10749
- async function writeBase(paths, base, bytes) {
10860
+ async function writeBase(paths, base, bytes, previous = null) {
10861
+ if (previous && base.previous) await writeFileAtomic(paths.previousCopy, previous, { mode: 420 });
10862
+ else await fs19.rm(paths.previousCopy, { force: true });
10750
10863
  await writeFileAtomic(paths.baseCopy, bytes, { mode: 420 });
10751
10864
  await writeJsonAtomic(paths.baseJson, base, { mode: 420 });
10752
10865
  }
10866
+ async function previousPushed(home, env, ownerKey, slug, version2, hash2) {
10867
+ const paths = dsPaths(home, env, ownerKey, slug);
10868
+ if (await readJson(paths.baseJson) === void 0) return null;
10869
+ return withLock(paths.lock, async () => {
10870
+ const base = (
10871
+ /** @type {DsBase | undefined} */
10872
+ await readJson(paths.baseJson)
10873
+ );
10874
+ if (!base || base.version !== version2 || base.hash !== hash2 || base.previous !== version2 - 1) return null;
10875
+ const markdown = await readIfThere(paths.previousCopy);
10876
+ return markdown === null ? null : { version: base.previous, markdown: markdown.toString("utf8") };
10877
+ });
10878
+ }
10879
+ async function readIfThere(file2) {
10880
+ try {
10881
+ return await fs19.readFile(file2);
10882
+ } catch (error2) {
10883
+ if (isErrno(error2, "ENOENT")) return null;
10884
+ throw error2;
10885
+ }
10886
+ }
10753
10887
  async function latestRemote(paths, slug) {
10754
10888
  const names = await fs19.readdir(paths.remote).catch(() => (
10755
10889
  /** @type {string[]} */
@@ -10854,6 +10988,7 @@ var init_ds = __esm({
10854
10988
  init_define_KOMBAI_TELEMETRY();
10855
10989
  init_api();
10856
10990
  init_canvasdir();
10991
+ init_codex_app();
10857
10992
  init_contract();
10858
10993
  init_dskit();
10859
10994
  init_fsx();
@@ -10866,7 +11001,7 @@ var init_ds = __esm({
10866
11001
  UTF8 = new TextDecoder("utf-8", { fatal: true });
10867
11002
  dsList = {
10868
11003
  name: "ds list",
10869
- summary: "The user's design systems, across their organizations and their own, and in publicDesignSystems Kombai's public ones (read-only; null, with a warning, when they cannot be read). file is null when not pulled here.",
11004
+ summary: "The user's design systems, across their organizations and their own, and in publicDesignSystems Kombai's public ones (read-only; null, with a warning, when they cannot be read). file is null when not pulled here; url is each one's page on the canvas site (null for a slug in several scopes, whose page may show the other one; none in the Codex app).",
10870
11005
  async run(ctx) {
10871
11006
  const session = await openSession(ctx);
10872
11007
  const [items, listed] = await Promise.all([
@@ -10878,6 +11013,8 @@ var init_ds = __esm({
10878
11013
  })
10879
11014
  ]);
10880
11015
  const publicFolder = publicDir(ctx.home, session.env);
11016
+ const scopes = /* @__PURE__ */ new Map();
11017
+ for (const item of items) scopes.set(item.slug, (scopes.get(item.slug) ?? 0) + 1);
10881
11018
  const publicDesignSystems = listed && await Promise.all(
10882
11019
  listed.map(async (item) => {
10883
11020
  const file2 = path19.join(publicFolder, `${item.id}.ds`);
@@ -10885,7 +11022,8 @@ var init_ds = __esm({
10885
11022
  id: item.id,
10886
11023
  name: item.name,
10887
11024
  description: item.description,
10888
- file: await exists(file2) ? file2 : null
11025
+ file: await exists(file2) ? file2 : null,
11026
+ ...dsPage(ctx, session.hosts.web, "public", item.id)
10889
11027
  };
10890
11028
  })
10891
11029
  );
@@ -10899,7 +11037,8 @@ var init_ds = __esm({
10899
11037
  ownerKey: item.ownerKey,
10900
11038
  version: item.version,
10901
11039
  modified: item.modified,
10902
- file: await hashFile(file2) === null ? null : file2
11040
+ file: await hashFile(file2) === null ? null : file2,
11041
+ ...dsPage(ctx, session.hosts.web, "mine", item.slug, (scopes.get(item.slug) ?? 0) > 1)
10903
11042
  };
10904
11043
  })
10905
11044
  ),
@@ -10909,7 +11048,7 @@ var init_ds = __esm({
10909
11048
  };
10910
11049
  dsPull = {
10911
11050
  name: "ds pull",
10912
- summary: "Get a design system as a .ds file. --owner picks one when the slug is in several scopes. Refused (exit 2) over an edit that was not pushed, unless --discard. --public gets one of Kombai's public design systems by its id (ds list's publicDesignSystems): read-only, written over the last copy.",
11051
+ summary: "Get a design system as a .ds file, and its page on the canvas site as url (null when the slug is in several scopes; none in the Codex app). --owner picks one when the slug is in several scopes. Refused (exit 2) over an edit that was not pushed, unless --discard. --public gets one of Kombai's public design systems by its id (ds list's publicDesignSystems): read-only, written over the last copy.",
10913
11052
  args: [{ name: "slug", required: true }],
10914
11053
  flags: {
10915
11054
  owner: { type: "string", placeholder: "<ownerKey>" },
@@ -10933,8 +11072,9 @@ var init_ds = __esm({
10933
11072
  );
10934
11073
  if (problems.length) throw badValues("ds pull", problems);
10935
11074
  const session = await openSession(ctx);
11075
+ let owners;
10936
11076
  if (!ownerKey) {
10937
- const owners = (await listAll(session.api)).filter((i) => i.slug === slug).map((i) => i.ownerKey);
11077
+ owners = (await listAll(session.api)).filter((i) => i.slug === slug).map((i) => i.ownerKey);
10938
11078
  if (owners.length > 1) {
10939
11079
  throw new CliError("CLI_OWNER_REQUIRED", `${slug} exists in several scopes; say which with --owner.`, {
10940
11080
  next: `kombai ds pull ${slug} --owner <ownerKey>`,
@@ -10967,12 +11107,19 @@ var init_ds = __esm({
10967
11107
  await replaceWorking(paths, observed, bytes, [base?.hash]);
10968
11108
  await writeBase(paths, { slug, ownerKey: read2.ownerKey, version: read2.version, hash: sha256(bytes) }, bytes);
10969
11109
  });
10970
- return { slug, name: read2.name, ownerKey: read2.ownerKey, version: read2.version, file: paths.file };
11110
+ return {
11111
+ slug,
11112
+ name: read2.name,
11113
+ ownerKey: read2.ownerKey,
11114
+ version: read2.version,
11115
+ file: paths.file,
11116
+ ...await ownPage(ctx, session, slug, read2.ownerKey, owners)
11117
+ };
10971
11118
  }
10972
11119
  };
10973
11120
  dsPush = {
10974
11121
  name: "ds push",
10975
- summary: "Validate a .ds file with ds-kit and save it. A pulled file goes back to the owner it came from; a new one takes its slug from its name and its owner from --org, then config org. --merged pushes over the version a conflict saved; --owner says whose, as the conflict's next does.",
11122
+ summary: "Validate a .ds file with ds-kit and save it, and print its page on the canvas site as url (null when the slug is in several scopes; none in the Codex app). A pulled file goes back to the owner it came from; a new one takes its slug from its name and its owner from --org, then config org. --merged pushes over the version a conflict saved; --owner says whose, as the conflict's next does.",
10976
11123
  args: [{ name: "file", required: true }],
10977
11124
  flags: {
10978
11125
  org: { type: "string", placeholder: "<id>", check: orgIdProblem },
@@ -11054,7 +11201,13 @@ var init_ds = __esm({
11054
11201
  const paths2 = dsPaths(ctx.home, session.env, pulled.ownerKey, slug);
11055
11202
  await withLock(paths2.lock, () => replaceWorking(paths2, sha256(bytes), sent, []));
11056
11203
  }
11057
- return { slug, ownerKey: pulled.ownerKey, version: pulled.version, status: "unchanged" };
11204
+ return {
11205
+ slug,
11206
+ ownerKey: pulled.ownerKey,
11207
+ version: pulled.version,
11208
+ status: "unchanged",
11209
+ ...await ownPage(ctx, session, slug, pulled.ownerKey)
11210
+ };
11058
11211
  }
11059
11212
  owner = scope === "user" ? { ownerKey: pulled.ownerKey } : { orgId: id };
11060
11213
  } else {
@@ -11117,7 +11270,21 @@ var init_ds = __esm({
11117
11270
  } else if (sha256(bytes) !== hash2) {
11118
11271
  await replaceWorking(paths, sha256(bytes), sent, []);
11119
11272
  }
11120
- await writeBase(paths, { slug, ownerKey: out.ownerKey, version: out.version, hash: hash2 }, sent);
11273
+ const before = (
11274
+ /** @type {DsBase | undefined} */
11275
+ await readJson(paths.baseJson)
11276
+ );
11277
+ const replaced = before?.version && before.ownerKey === out.ownerKey && out.version === before.version + 1 ? await readIfThere(paths.baseCopy).catch((error2) => {
11278
+ ctx.telemetry.capture(error2, "ds push previous copy");
11279
+ return null;
11280
+ }) : null;
11281
+ const previous = replaced && before && sha256(replaced) === before.hash ? before.version : void 0;
11282
+ await writeBase(
11283
+ paths,
11284
+ { slug, ownerKey: out.ownerKey, version: out.version, hash: hash2, ...previous ? { previous } : {} },
11285
+ sent,
11286
+ previous ? replaced : null
11287
+ );
11121
11288
  });
11122
11289
  if (flags.merged) await dropRemotes(paths, slug);
11123
11290
  return {
@@ -11125,7 +11292,8 @@ var init_ds = __esm({
11125
11292
  ownerKey: out.ownerKey,
11126
11293
  version: out.version,
11127
11294
  status: res.status === 201 ? "created" : res.status === 304 ? "unchanged" : "updated",
11128
- file: paths.file
11295
+ file: paths.file,
11296
+ ...await ownPage(ctx, session, slug, out.ownerKey)
11129
11297
  };
11130
11298
  }
11131
11299
  };
@@ -33755,7 +33923,7 @@ function designBriefsOf(envelope) {
33755
33923
  function explainTasteError(ctx, error2, web) {
33756
33924
  return explainRunError(ctx, error2, web, { noCredits: "TASTE_NO_CREDITS", outdated: "TASTE_CLI_OUTDATED" });
33757
33925
  }
33758
- var BRIEF_MAX_CHARS, DEFAULT_TIMEOUT_S2, WORKER_WRAPPER, DEFERRED_VIDEO_INSTRUCTION, DEFERRED_VIDEO_FOR_CLI, IMAGE_EXTENSIONS, RUN_ID, TASTE_CARD_TOOL, tasteStart, tasteWait, tasteLink;
33926
+ var BRIEF_MAX_CHARS, DEFAULT_TIMEOUT_S2, WORKER_WRAPPER, DEFERRED_VIDEO_INSTRUCTION, DEFERRED_VIDEO_FOR_CLI, IMAGE_EXTENSIONS, RUN_ID, TASTE_CARD_TOOL, TASTE_LINK_NEXT, tasteStart, tasteWait, tasteLink;
33759
33927
  var init_taste = __esm({
33760
33928
  "src/commands/taste.js"() {
33761
33929
  "use strict";
@@ -33776,6 +33944,7 @@ var init_taste = __esm({
33776
33944
  IMAGE_EXTENSIONS = { "image/png": "png", "image/jpeg": "jpg", "image/webp": "webp", "image/gif": "gif" };
33777
33945
  RUN_ID = /^tr_[0-9a-f]{32}$/;
33778
33946
  TASTE_CARD_TOOL = "taste_card";
33947
+ TASTE_LINK_NEXT = "Now, before you read directions.md, tell the user the taste run is done and give them this url on its own line: it shows the taste Kombai settled on, for them to review while you build. Do not hold it for your final message. Then follow directions.md.";
33779
33948
  tasteStart = {
33780
33949
  name: "taste start",
33781
33950
  summary: "Start a taste run: Kombai's design directions for a brief you wrote after reading the repo. Uses credits. --cards says this client has a taste_card tool, so `taste wait` answers with card (and then no page link `url`); add it only where that tool is among your tools (the Codex app lists it only in ALL_TOOLS). Kombai makes AI images where a design needs art rather than a photo, each using credits; --no-generate keeps the run to stock photos and videos, for a user who asked for no AI-generated images.",
@@ -33918,6 +34087,7 @@ var init_taste = __esm({
33918
34087
  ctx.telemetry.capture(error2, "taste wait");
33919
34088
  }
33920
34089
  const wantsCard = start?.cards === void 0 || start.cards === true;
34090
+ const link = hasBriefs && !wantsCard ? linkField(ctx, `${session.hosts.web}/t/${run2}`) : {};
33921
34091
  return {
33922
34092
  run: run2,
33923
34093
  status: "done",
@@ -33927,7 +34097,10 @@ var init_taste = __esm({
33927
34097
  // The client draws the card where it has one; the plain page link (never a ticket: taste link makes that
33928
34098
  // one) is only for a client that cannot, so the answer never carries both.
33929
34099
  ...hasBriefs && wantsCard ? { card: { tool: TASTE_CARD_TOOL, arguments: { run: run2 } } } : {},
33930
- ...hasBriefs && !wantsCard ? linkField(ctx, `${session.hosts.web}/t/${run2}`) : {}
34100
+ ...link,
34101
+ // The skill says to pass the link on (`kombai skill brief`), but that was read before the brief was written;
34102
+ // next says it where the link is, so the agent does not go straight to directions.md.
34103
+ ...link.url ? { next: TASTE_LINK_NEXT } : {}
33931
34104
  };
33932
34105
  }
33933
34106
  const code = state.error?.code ?? "TASTE_FAILED";
@@ -34323,9 +34496,12 @@ var init_client_gate = __esm({
34323
34496
  CODEX_CLIENT_NAME = "codex-mcp-client";
34324
34497
  CLAUDE_CODE_CLIENT_NAME = "claude-code";
34325
34498
  Cards = Object.freeze({
34326
- /** The taste card and the plans card, and the CLI's own sign-in card. */
34499
+ /** The taste card and the plans card, and the CLI's own sign-in, starters, access and design system cards. */
34327
34500
  All: "all",
34328
- /** The taste card only (no sign-in card: cards.js specsIn). */
34501
+ /**
34502
+ * The cards that call no tool of their own, which Claude desktop refuses (cards.js specsIn): the taste card and the
34503
+ * design system card. Named for the gateway's ClientCards.Taste, which is the taste card alone.
34504
+ */
34329
34505
  Taste: "taste",
34330
34506
  None: "none"
34331
34507
  });
@@ -34445,7 +34621,7 @@ function toolDescriptors(resourceUri) {
34445
34621
  {
34446
34622
  name: CANVAS_APP_TOOL,
34447
34623
  title: "Kombai",
34448
- 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.",
34624
+ 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. To show a design system instead of a canvas, pass designSystem (its slug, from `kombai ds list` or `kombai ds push`) or publicDesignSystem (a public one's id, from `kombai ds list`). Do it once per design system per reply, after that reply's last `kombai ds push` that created or updated it (after its design_system_card), and when the user asks to see one: every call opens another tab.",
34449
34625
  inputSchema: {
34450
34626
  type: "object",
34451
34627
  properties: {
@@ -34453,7 +34629,15 @@ function toolDescriptors(resourceUri) {
34453
34629
  type: "string",
34454
34630
  description: "A canvas id (cnv_\u2026), a canvas link (/c/<id>) or a design link (/n/<id>/<node>). Leave it out to show every canvas."
34455
34631
  },
34456
- node: { type: "string", description: "A design id on that canvas to focus." }
34632
+ node: { type: "string", description: "A design id on that canvas to focus." },
34633
+ designSystem: {
34634
+ type: "string",
34635
+ description: "One of the user's design systems to show, by its slug. Give no canvas with it."
34636
+ },
34637
+ publicDesignSystem: {
34638
+ type: "string",
34639
+ description: "One of Kombai's public design systems to show, by its id. Give no canvas with it."
34640
+ }
34457
34641
  },
34458
34642
  additionalProperties: false
34459
34643
  },
@@ -34536,7 +34720,40 @@ async function readCanvas(session, canvasId) {
34536
34720
  }
34537
34721
  return { projectId: body.projectId, name };
34538
34722
  }
34723
+ function designSystemFromArgs(args) {
34724
+ const own = given(args.designSystem);
34725
+ const pub = given(args.publicDesignSystem);
34726
+ if (!own && !pub) return null;
34727
+ if (own && pub) throw badArgument("Give designSystem or publicDesignSystem, not both.");
34728
+ if (given(args.canvas) || given(args.node)) {
34729
+ throw badArgument("A design system is shown on its own: leave canvas and node out.");
34730
+ }
34731
+ if (own) {
34732
+ if (typeof args.designSystem !== "string" || !DESIGN_ID.slug.test(args.designSystem)) {
34733
+ throw badArgument("designSystem must be a design system slug, as `kombai ds list` prints it.");
34734
+ }
34735
+ return { designSystem: args.designSystem };
34736
+ }
34737
+ const id = args.publicDesignSystem;
34738
+ if (typeof id !== "string" || id.length > PUBLIC_DESIGN_SYSTEM_ID_MAX || !isSafePresetId(id)) {
34739
+ throw badArgument("publicDesignSystem must be a public design system's id, as `kombai ds list` prints it.");
34740
+ }
34741
+ return { publicDesignSystem: id };
34742
+ }
34539
34743
  async function callCanvasApp(ctx, args) {
34744
+ const shown = designSystemFromArgs(args);
34745
+ if (shown) {
34746
+ const id = "designSystem" in shown ? shown.designSystem : shown.publicDesignSystem;
34747
+ return {
34748
+ structuredContent: shown,
34749
+ content: [
34750
+ {
34751
+ type: "text",
34752
+ text: `The ${id} design system is open beside this chat. Put no link to it in your reply.`
34753
+ }
34754
+ ]
34755
+ };
34756
+ }
34540
34757
  const { hosts } = await currentEnv(ctx);
34541
34758
  const ref = refFromArgs(args, hosts.web);
34542
34759
  if (!ref) {
@@ -34564,7 +34781,8 @@ async function callCanvasApp(ctx, args) {
34564
34781
  }
34565
34782
  async function canBeGuest(ctx) {
34566
34783
  const { env } = await currentEnv(ctx);
34567
- return !holdsAccount(await readEntry(ctx.home, env));
34784
+ const entry = await readEntry(ctx.home, env);
34785
+ return !holdsAccount(entry) && !isClaimedGuest(entry);
34568
34786
  }
34569
34787
  async function guestCanvasItem(ctx, session) {
34570
34788
  const { guest: guest2 } = session;
@@ -34596,7 +34814,7 @@ async function guestCanvasItem(ctx, session) {
34596
34814
  }
34597
34815
  return (await list2(read2.projectId)).find((i) => i.id === canvasId) ?? null;
34598
34816
  } catch (error2) {
34599
- if (error2 instanceof CliError && isGuestGone(error2.code)) return null;
34817
+ if (error2 instanceof CliError && error2.code === "SIGNIN_GUEST_EXPIRED") return null;
34600
34818
  throw error2;
34601
34819
  }
34602
34820
  }
@@ -34616,6 +34834,9 @@ async function guestHome(ctx, session, ticketFor, hosted) {
34616
34834
  const { projectId } = await resolveCheckout(ctx.cwd, { platform: ctx.platform, home: ctx.home });
34617
34835
  return answer({ status: "guest_home", guestCanvas, hosted, ...minted ?? {}, project: projectId });
34618
34836
  } catch (error2) {
34837
+ if (error2 instanceof CliError && error2.code === "SIGNIN_GUEST_CLAIMED") {
34838
+ return answer({ status: "not_signed_in", error: { code: error2.code, message: error2.message }, hosted });
34839
+ }
34619
34840
  if (error2 instanceof CliError && isGuestGone(error2.code)) {
34620
34841
  return answer({ status: "guest_home", guestCanvas: null, hosted });
34621
34842
  }
@@ -34698,6 +34919,7 @@ function createSessionTool(ctx, { login: runner }) {
34698
34919
  }
34699
34920
  if (session.kind === "key" && session.guest && (!ref || ref.canvasId === await guestCanvasOf(ctx, session))) {
34700
34921
  const { guest: guest2 } = session;
34922
+ if (isMarkedClaimed(guest2)) return answer({ status: "claim_pending", ...ids, hosted: hosts.web });
34701
34923
  if (guest2.claimOrgs?.length) {
34702
34924
  return answer({ status: "needs_org", ...ids, orgs: guest2.claimOrgs, hosted: hosts.web });
34703
34925
  }
@@ -34752,6 +34974,7 @@ async function guestCanvasOf(ctx, session) {
34752
34974
  const guest2 = session.guest;
34753
34975
  if (!guest2) return null;
34754
34976
  if (guest2.canvasId) return guest2.canvasId;
34977
+ if (isMarkedClaimed(guest2)) return null;
34755
34978
  const { projectId } = await resolveCheckout(ctx.cwd, { platform: ctx.platform, home: ctx.home });
34756
34979
  const res = await session.api.call({
34757
34980
  method: "GET",
@@ -34794,7 +35017,7 @@ function answer(structuredContent, viewOnly = []) {
34794
35017
  ), text: JSON.stringify(text) }]
34795
35018
  };
34796
35019
  }
34797
- var CANVAS_APP_TOOL, SESSION_TOOL, RESOURCE_URI_BASE, versionedUri, SIGN_IN_MAX_WAIT_S, INSTRUCTIONS, CODEX_ACCESS, CODEX_INSTRUCTIONS, read, badArgument, given;
35020
+ var CANVAS_APP_TOOL, SESSION_TOOL, RESOURCE_URI_BASE, versionedUri, SIGN_IN_MAX_WAIT_S, INSTRUCTIONS, CODEX_ACCESS, CODEX_INSTRUCTIONS, read, badArgument, given, PUBLIC_DESIGN_SYSTEM_ID_MAX;
34798
35021
  var init_tools = __esm({
34799
35022
  "src/mcp/tools.js"() {
34800
35023
  "use strict";
@@ -34804,6 +35027,7 @@ var init_tools = __esm({
34804
35027
  init_api();
34805
35028
  init_contract();
34806
35029
  init_output();
35030
+ init_presets();
34807
35031
  init_project();
34808
35032
  init_session();
34809
35033
  init_store();
@@ -34814,12 +35038,13 @@ var init_tools = __esm({
34814
35038
  RESOURCE_URI_BASE = "ui://kombai/cli-canvas-app";
34815
35039
  versionedUri = (base, version2) => `${base}?v=${encodeURIComponent(version2)}`;
34816
35040
  SIGN_IN_MAX_WAIT_S = 20;
34817
- 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\`.`;
35041
+ 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. Where design_system_card is among your tools, call it after each \`kombai ds push\` that created or updated one, and again, with the same slug and ownerKey, when the user asks to open one again after its card's link expired. Designs go on a Kombai canvas, or where the user asks (taste runs either way); 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\`.`;
34818
35042
  CODEX_ACCESS = "Kombai's commands need network access and write ~/.kombai (designs' files are there too) and npm's cache (`npm config get cache`, a local read to run first: not always ~/.npm), and every `kombai mcp install codex`, an upgrade included, writes the folder holding Codex's config.toml ($CODEX_HOME, else ~/.codex; for a symlinked config, its target's folder): get that before the first one, never trying it in the sandbox first. Use sandbox_permissions \"require_escalated\" where this chat can approve escalations; where it can't (a chat with no project picked), get it with request_permissions, whose grant can end with the reply: before the first Kombai command or design-file write of each reply, run `node -p \"'network_off='+(process.env.CODEX_SANDBOX_NETWORK_DISABLED||0)\"` on its own; if it prints network_off=1, call request_permissions first, and if network_off=0, the grant still holds, so do not ask. No output alone does not mean the network was off: poll a running session instead of rerunning it; a command that exits with no output is checked the same way and run again only if it prints network_off=1. Retry only a confirmed sandbox denial before any write was sent; for an unknown write outcome, inspect state first. If a later reply in the chat has to ask again (asking twice in one reply does not count), once that reply's Kombai work is done, call access_card with reason granted, once per chat: it shows the user how to stop the prompt on every message. If neither works, run nothing: call access_card with reason blocked, which shows the user how to allow it with a Continue button, and end your turn with one line. ";
34819
- 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\`. ` + CODEX_ACCESS + `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\`.`;
35043
+ 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\`. ` + CODEX_ACCESS + `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. After a reply's last \`kombai ds push\` that created or updated a design system, call design_system_card with the slug and ownerKey it printed, then canvas_app with designSystem (its slug): each once per design system per reply. When the user asks to see one, call canvas_app with designSystem, or publicDesignSystem (a public one's id). The push prints no link here: put none in the reply. Designs go on a Kombai canvas, or where the user asks (taste runs either way); 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\`.`;
34820
35044
  read = { readOnlyHint: true, destructiveHint: false, idempotentHint: false, openWorldHint: false };
34821
35045
  badArgument = (message) => new CliError("CLI_BAD_ARGUMENT", message);
34822
35046
  given = (value) => value !== void 0 && value !== null && value !== "";
35047
+ PUBLIC_DESIGN_SYSTEM_ID_MAX = 128;
34823
35048
  }
34824
35049
  });
34825
35050
 
@@ -35082,6 +35307,7 @@ function createCards(ctx, options) {
35082
35307
  if (spec === PLANS) return [plansTool(uriOf(spec)), checkoutTool()];
35083
35308
  if (spec === STARTERS) return [startersTool(uriOf(spec))];
35084
35309
  if (spec === ACCESS) return [accessTool(uriOf(spec))];
35310
+ if (spec === DESIGN_SYSTEM) return [designSystemTool(uriOf(spec))];
35085
35311
  if (spec === SIGN_IN) return [signInTool(uriOf(spec)), chatSignInTool(), chatGuestTool()];
35086
35312
  return [];
35087
35313
  };
@@ -35137,6 +35363,9 @@ function createCards(ctx, options) {
35137
35363
  if (name === CHECKOUT_TOOL && specs.includes(PLANS)) return inAppWords(await checkout(ctx, args, signInBuilt));
35138
35364
  if (name === STARTERS_CARD_TOOL && specs.includes(STARTERS)) return showStarters(args);
35139
35365
  if (name === ACCESS_CARD_TOOL && specs.includes(ACCESS)) return showAccess(ctx, args);
35366
+ if (name === DESIGN_SYSTEM_CARD_TOOL && specs.includes(DESIGN_SYSTEM)) {
35367
+ return showDesignSystem(ctx, args, set2 === Cards.All);
35368
+ }
35140
35369
  if (name === SIGN_IN_CARD_TOOL && specs.includes(SIGN_IN)) {
35141
35370
  return showSignIn(ctx, args, appBrowser()?.label ?? null);
35142
35371
  }
@@ -35189,6 +35418,97 @@ function showAccess(ctx, args) {
35189
35418
  ]
35190
35419
  };
35191
35420
  }
35421
+ async function showDesignSystem(ctx, args, inView) {
35422
+ const { slug, ownerKey } = args;
35423
+ if (typeof slug !== "string" || !DESIGN_ID.slug.test(slug) || typeof ownerKey !== "string" || !DESIGN_ID.ownerKey.test(ownerKey)) {
35424
+ return failed("slug and ownerKey must be the ones `kombai ds push` printed.");
35425
+ }
35426
+ try {
35427
+ const session = await openSession(ctx);
35428
+ const [read2, url2] = await Promise.all([
35429
+ session.api.call({ method: "GET", path: `/design/design-systems/${slug}`, query: { ownerKey } }),
35430
+ inView ? null : ownPageUrl(session.api, session.hosts.web, slug, ownerKey).catch((error2) => {
35431
+ if (!(error2 instanceof CliError)) ctx.telemetry.capture(error2, "design system card link");
35432
+ return null;
35433
+ })
35434
+ ]);
35435
+ const stored = read2.body ?? {};
35436
+ const name = typeof stored.name === "string" && stored.name.trim() ? stored.name : slug;
35437
+ const version2 = Number.isSafeInteger(stored.version) && Number(stored.version) > 0 ? Number(stored.version) : null;
35438
+ const modified = typeof stored.modified === "string" ? stored.modified : null;
35439
+ const factsOf = (markdown2) => designSystemFacts(markdown2, slug).catch((error2) => {
35440
+ ctx.telemetry.capture(error2, "design system card preview");
35441
+ return null;
35442
+ });
35443
+ const markdown = typeof stored.markdown === "string" ? stored.markdown : null;
35444
+ const [facts, before, opening] = await Promise.all([
35445
+ markdown === null ? null : factsOf(markdown),
35446
+ markdown === null || version2 === null ? null : previousPushed(
35447
+ ctx.home,
35448
+ session.env,
35449
+ ownerKey,
35450
+ slug,
35451
+ version2,
35452
+ sha256(new TextEncoder().encode(markdown))
35453
+ ).catch((error2) => {
35454
+ ctx.telemetry.capture(error2, "design system card previous");
35455
+ return null;
35456
+ }),
35457
+ url2 === null ? null : designSystemsPageLink(ctx, session, url2)
35458
+ ]);
35459
+ const previousFacts = before ? await factsOf(before.markdown) : null;
35460
+ return {
35461
+ structuredContent: {
35462
+ design_system: {
35463
+ name,
35464
+ version: version2,
35465
+ modified,
35466
+ preview: facts?.preview ?? null,
35467
+ description: facts?.description ?? null,
35468
+ counts: facts?.counts ?? null,
35469
+ previous: before && previousFacts ? { version: before.version, preview: previousFacts.preview } : null,
35470
+ open_link: opening?.link ?? null,
35471
+ open_link_expires_at: opening?.expiresAt ?? null,
35472
+ shown_in_view: inView
35473
+ }
35474
+ },
35475
+ content: [
35476
+ {
35477
+ type: "text",
35478
+ text: inView ? `Showing the ${name} design system in the chat. Then open it beside the chat with canvas_app (designSystem "${slug}"), once per design system this reply. Put no link to it in your reply.` : `Showing the ${name} design system in the chat${url2 ? ", with Open for its page" : ""}. Put no link to it in your reply.`
35479
+ }
35480
+ ]
35481
+ };
35482
+ } catch (error2) {
35483
+ if (!(error2 instanceof CliError)) throw error2;
35484
+ if (error2.code === SIGNIN_REQUIRED) return refused(SIGNIN_REQUIRED, error2.message);
35485
+ return shownWords(`Kombai could not show this design system: ${error2.message}`);
35486
+ }
35487
+ }
35488
+ async function designSystemsPageLink(ctx, session, url2) {
35489
+ const plain = { link: url2, expiresAt: null };
35490
+ try {
35491
+ const res = await session.api.call({
35492
+ method: "POST",
35493
+ path: "/design/download-tickets",
35494
+ body: { designSystems: true },
35495
+ // A store from before these tickets answers a key caller 401 UNAUTHORIZED ("this route takes x-kombai-pass or
35496
+ // x-kombai-guest-pass"), before it reads the body: that says nothing about the key, so it must not cost it.
35497
+ keepKey: true,
35498
+ // A lost answer hands the plain page at once (a LostAnswer, a CliError): a second ticket is not worth the wait.
35499
+ retry: "once",
35500
+ // A slow or busy store (a hung call, a 503's Retry-After waits) must not hold the card: past this, a
35501
+ // CLI_TIMEOUT (a CliError) hands the plain link.
35502
+ deadline: session.api.deadline.within(DESIGN_SYSTEMS_TICKET_WAIT_MS)
35503
+ });
35504
+ const ticket = res.body?.ticket;
35505
+ const expiresAt = res.body?.expiresAt;
35506
+ return typeof ticket === "string" && READ_TICKET.test(ticket) && typeof expiresAt === "string" && !Number.isNaN(Date.parse(expiresAt)) ? { link: `${url2}#${READ_PARAM}=${encodeURIComponent(ticket)}`, expiresAt } : plain;
35507
+ } catch (error2) {
35508
+ if (!(error2 instanceof CliError)) ctx.telemetry.capture(error2, "design system card ticket");
35509
+ return plain;
35510
+ }
35511
+ }
35192
35512
  function showStarters(args) {
35193
35513
  const { plugin } = args;
35194
35514
  if (plugin !== void 0 && (typeof plugin !== "string" || !KOMBAI_PLUGIN.test(plugin))) {
@@ -35330,13 +35650,17 @@ function failed(message) {
35330
35650
  function shownWords(message) {
35331
35651
  return { content: [{ type: "text", text: message }] };
35332
35652
  }
35333
- var TASTE_CARD_TOOL2, PLANS_CARD_TOOL, CHECKOUT_TOOL, SIGN_IN_CARD_TOOL, CHAT_SIGN_IN_TOOL, CHAT_GUEST_TOOL, STARTERS_CARD_TOOL, ACCESS_CARD_TOOL, AccessReason, KOMBAI_PLUGIN, STARTER_PROMPTS, SIGNIN_REQUIRED, CARDS_DIR, GOOGLE_FONTS, INLINE, TASTE, PLANS, SIGN_IN, STARTERS, ACCESS, specsIn, reads, acts, icons, tasteTool, plansTool, checkoutTool, signInTool, startersTool, accessTool, chatSignInTool, chatGuestTool;
35653
+ var TASTE_CARD_TOOL2, PLANS_CARD_TOOL, CHECKOUT_TOOL, SIGN_IN_CARD_TOOL, CHAT_SIGN_IN_TOOL, CHAT_GUEST_TOOL, STARTERS_CARD_TOOL, ACCESS_CARD_TOOL, DESIGN_SYSTEM_CARD_TOOL, AccessReason, KOMBAI_PLUGIN, STARTER_PROMPTS, SIGNIN_REQUIRED, CARDS_DIR, GOOGLE_FONTS, INLINE, TASTE, PLANS, SIGN_IN, STARTERS, ACCESS, DESIGN_SYSTEM, specsIn, reads, acts, icons, tasteTool, plansTool, checkoutTool, signInTool, startersTool, accessTool, designSystemTool, chatSignInTool, chatGuestTool, READ_PARAM, READ_TICKET, DESIGN_SYSTEMS_TICKET_WAIT_MS;
35334
35654
  var init_cards = __esm({
35335
35655
  "src/mcp/cards.js"() {
35336
35656
  "use strict";
35337
35657
  init_define_KOMBAI_TELEMETRY();
35338
35658
  init_kombai_icon();
35659
+ init_ds();
35339
35660
  init_taste();
35661
+ init_canvasdir();
35662
+ init_contract();
35663
+ init_dskit();
35340
35664
  init_output();
35341
35665
  init_session();
35342
35666
  init_store();
@@ -35354,6 +35678,7 @@ var init_cards = __esm({
35354
35678
  CHAT_GUEST_TOOL = "chat_guest";
35355
35679
  STARTERS_CARD_TOOL = "starters_card";
35356
35680
  ACCESS_CARD_TOOL = "access_card";
35681
+ DESIGN_SYSTEM_CARD_TOOL = "design_system_card";
35357
35682
  AccessReason = Object.freeze({ Granted: "granted", Blocked: "blocked" });
35358
35683
  KOMBAI_PLUGIN = /^kombai@[A-Za-z0-9][A-Za-z0-9._~-]{0,199}$/;
35359
35684
  STARTER_PROMPTS = Object.freeze([
@@ -35428,7 +35753,22 @@ var init_cards = __esm({
35428
35753
  "openai/widgetHeightHint": 300
35429
35754
  }
35430
35755
  };
35431
- specsIn = (set2) => set2 === Cards.All ? [TASTE, PLANS, STARTERS, ACCESS, SIGN_IN] : set2 === Cards.Taste ? [TASTE] : [];
35756
+ DESIGN_SYSTEM = {
35757
+ uriBase: "ui://kombai/cli-design-system",
35758
+ bundle: "design-system.js",
35759
+ title: "Kombai",
35760
+ rootId: "kombai-design-system",
35761
+ global: "__kombaiDesignSystem",
35762
+ // No fetches of its own: the design system comes in the tool result, and Open (outside Codex) asks the host to open
35763
+ // its page, with the design systems read ticket the CLI minted when it showed the card (designSystemsPageLink). Its
35764
+ // heading and body fonts load from Google Fonts where they are served there, as the taste card's specimens do.
35765
+ meta: {
35766
+ ui: { csp: { connectDomains: [], resourceDomains: GOOGLE_FONTS }, prefersBorder: true },
35767
+ ...INLINE,
35768
+ "openai/widgetHeightHint": 320
35769
+ }
35770
+ };
35771
+ specsIn = (set2) => set2 === Cards.All ? [TASTE, PLANS, STARTERS, ACCESS, DESIGN_SYSTEM, SIGN_IN] : set2 === Cards.Taste ? [TASTE, DESIGN_SYSTEM] : [];
35432
35772
  reads = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
35433
35773
  acts = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true };
35434
35774
  icons = () => KOMBAI_ICONS.map((icon) => ({ ...icon, sizes: [...icon.sizes] }));
@@ -35486,7 +35826,7 @@ var init_cards = __esm({
35486
35826
  signInTool = (resourceUri) => ({
35487
35827
  name: SIGN_IN_CARD_TOOL,
35488
35828
  title: "Kombai",
35489
- 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; assets when AI image or video generation 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.",
35829
+ 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; not for reason guest_claimed, which signs in at once as `kombai skill sign-in` says), 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; assets when AI image or video generation 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, or a command answered SIGNIN_GUEST_CLAIMED or reason guest_claimed \u2014 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.",
35490
35830
  inputSchema: {
35491
35831
  type: "object",
35492
35832
  properties: { reason: { type: "string", enum: Object.values(SignInReason) } },
@@ -35535,6 +35875,23 @@ var init_cards = __esm({
35535
35875
  annotations: reads,
35536
35876
  _meta: { ui: { resourceUri, visibility: ["model", "app"] } }
35537
35877
  });
35878
+ designSystemTool = (resourceUri) => ({
35879
+ name: DESIGN_SYSTEM_CARD_TOOL,
35880
+ title: "Kombai design system",
35881
+ description: "Show one of the user's design systems as a card in this chat: its name, colours, fonts and version, and, when this machine pushed it, the change to its colours, fonts, radius and mode. Call it after each `kombai ds push` that created or updated one, with the slug and ownerKey the push printed. Outside Codex, also call it when the user asks to see that design system again (its Open link lasts 10 minutes), with the same slug and ownerKey (`kombai ds list` shows them). In Codex, call it only once per design system per reply, after that reply's last push, then open it with canvas_app. Put no link to the design system in your reply.",
35882
+ inputSchema: {
35883
+ type: "object",
35884
+ properties: {
35885
+ slug: { type: "string", description: "The slug `kombai ds push` printed." },
35886
+ ownerKey: { type: "string", description: "The ownerKey `kombai ds push` printed (org:<id> or user:<id>)." }
35887
+ },
35888
+ required: ["slug", "ownerKey"],
35889
+ additionalProperties: false
35890
+ },
35891
+ icons: icons(),
35892
+ annotations: reads,
35893
+ _meta: { ui: { resourceUri, visibility: ["model", "app"] } }
35894
+ });
35538
35895
  chatSignInTool = () => ({
35539
35896
  name: CHAT_SIGN_IN_TOOL,
35540
35897
  title: "Sign in to Kombai",
@@ -35561,6 +35918,9 @@ var init_cards = __esm({
35561
35918
  annotations: acts,
35562
35919
  _meta: { ui: { visibility: ["app"] } }
35563
35920
  });
35921
+ READ_PARAM = "read";
35922
+ READ_TICKET = /^tk_[A-Za-z0-9_-]{43}$/;
35923
+ DESIGN_SYSTEMS_TICKET_WAIT_MS = 5e3;
35564
35924
  }
35565
35925
  });
35566
35926
 
@@ -35649,12 +36009,14 @@ html.dark #link{background:#262626}
35649
36009
  html.dark #link b{color:#f0f0f0}
35650
36010
  #link .sm{color:var(--sec)}
35651
36011
  /* The cover over a page being replaced: a veil in the view's background that takes every click, under the hosted
35652
- page's logo loader (components/ui/loader.tsx LogoLoader) as CSS can draw it: the logo's fill, size and glow. */
36012
+ page's logo loader (components/ui/loader.tsx LogoLoader): the same logo file, read from the hosted origin rather
36013
+ than carried in this page (about 8 KB), at the loader's size and glow. Until the logo has loaded it stays hidden,
36014
+ so the cover is the veil alone, never a bare tile. */
35653
36015
  #cover{position:fixed;inset:0;z-index:1;display:grid;place-items:center;cursor:progress;background:rgba(252,251,244,.6)}
35654
36016
  html.dark #cover{background:rgba(30,30,30,.6)}
35655
- #cover::after{content:'';width:56px;height:56px;border-radius:10px;background:#48de94;animation:glow 1.5s ease-in-out infinite alternate}
36017
+ #cover img{width:56px;height:56px;animation:glow 1.5s ease-in-out infinite alternate}
35656
36018
  @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))}}
35657
- @media (prefers-reduced-motion:reduce){#cover::after,#screen.load #title{animation:none}#screen.load #title{color:inherit;background:none}}
36019
+ @media (prefers-reduced-motion:reduce){#cover img,#screen.load #title{animation:none}#screen.load #title{color:inherit;background:none}}
35658
36020
  [hidden]{display:none!important}
35659
36021
  </style>
35660
36022
  </head>
@@ -35663,7 +36025,7 @@ html.dark #cover{background:rgba(30,30,30,.6)}
35663
36025
  <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></div></div>
35664
36026
  <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>
35665
36027
  <iframe id="frame" title="Kombai canvas" allow="clipboard-write"></iframe>
35666
- <div id="cover" role="status" aria-label="Loading" hidden></div>
36028
+ <div id="cover" role="status" aria-label="Loading" hidden><img id="cover-logo" alt="" hidden></div>
35667
36029
  <script>
35668
36030
  (() => {
35669
36031
  var CLI_VERSION = '{{CLI_VERSION}}';
@@ -35680,6 +36042,17 @@ html.dark #cover{background:rgba(30,30,30,.6)}
35680
36042
  var EMBED = 'embed', PROTOCOL = 1;
35681
36043
  var RESULT_WAIT_MS = 2000, SIGN_IN_WAIT_S = 20;
35682
36044
  var CANVAS_ID = /^cnv_[0-9a-f]{12}$/;
36045
+ // A design system to frame: the person's own by slug (the store's DESIGN_ID.slug), or a public one by id (the shared
36046
+ // isSafePresetId, capped at 128 as the page and canvas_app cap it). Anything else is none.
36047
+ var DS_SLUG = /^[a-z0-9][a-z0-9-]{0,63}$/, DS_PUBLIC = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
36048
+ function designSystemOf(m) {
36049
+ if (!m || typeof m !== 'object') return null;
36050
+ if (typeof m.designSystem === 'string' && DS_SLUG.test(m.designSystem)) return { pub: false, id: m.designSystem };
36051
+ if (typeof m.publicDesignSystem === 'string' && DS_PUBLIC.test(m.publicDesignSystem)) {
36052
+ return { pub: true, id: m.publicDesignSystem };
36053
+ }
36054
+ return null;
36055
+ }
35683
36056
  // An organization id as the view passes it to the page and back to the CLI: anything else is dropped.
35684
36057
  var ORG_ID = /^[A-Za-z0-9_-]{1,64}$/;
35685
36058
  var SIGN_IN_STOPPED = 'Sign-in did not finish.';
@@ -35693,6 +36066,12 @@ html.dark #cover{background:rgba(30,30,30,.6)}
35693
36066
  var linkBar = document.getElementById('link');
35694
36067
  var linkText = document.getElementById('link-text');
35695
36068
  var cover = document.getElementById('cover');
36069
+ // The cover's logo: the hosted page's own logo file (components/ui/loader.tsx LOGO_LOADER_SRC, under the hosted
36070
+ // build's /hosted-canvas/ base), read once the session names the hosted origin, so it has usually loaded before
36071
+ // the first switch. Shown only once loaded; a failed read leaves the veil alone.
36072
+ var COVER_LOGO_PATH = '/hosted-canvas/kombai-logo.svg';
36073
+ var coverLogo = document.getElementById('cover-logo');
36074
+ coverLogo.addEventListener('load', function () { coverLogo.hidden = false; });
35696
36075
 
35697
36076
  // A screen of the view's own, in place of the frame: only before the page can load, or when it cannot. opts.icon: a
35698
36077
  // symbol in the sprite (#i-<icon>), drawn above the title. opts.tone: 'warn', the icon's colour. opts.load: a loading
@@ -35765,6 +36144,13 @@ html.dark #cover{background:rgba(30,30,30,.6)}
35765
36144
  var signInState = null, offeredOrgs = [];
35766
36145
  var hosted = null;
35767
36146
  var canvas = null, node = null;
36147
+ // The design system framed in place of a canvas ({ pub, id }), or null; and what its Back frames again: the canvas
36148
+ // and design shown before it ({ canvas, node }), or null for the home.
36149
+ var ds = null, back = null;
36150
+ // The status a page framed with no ticket waits on while it shows its sign-in: watch() asks again until the session
36151
+ // tool answers something else. 'guest_home' for a design system a guest, or a machine that never signed in, asked
36152
+ // for (change 15g); 'not_signed_in' otherwise.
36153
+ var signInFor = 'not_signed_in';
35768
36154
  var openingResult = null, openingError = null, openingArgs = null;
35769
36155
  var claimTries = 0, retryTimer = null;
35770
36156
  // Each open's number: only the latest one's answer is used. The cover's own timer (coverFrame).
@@ -35870,7 +36256,8 @@ html.dark #cover{background:rgba(30,30,30,.6)}
35870
36256
  function hello() {
35871
36257
  // The guest home's facts go only to the loaded guest home.
35872
36258
  return {
35873
- kind: 'hello', theme: theme, canvases: true, signsIn: true, makesGuests: true, opensInAppBrowser: !!APP_BROWSER,
36259
+ kind: 'hello', theme: theme, canvases: true, signsIn: true, makesGuests: true, designSystems: true,
36260
+ opensInAppBrowser: !!APP_BROWSER,
35874
36261
  insets: insets, guest: framedHome && framedGuest ? { canvas: guestCanvas, project: guestProject } : null,
35875
36262
  };
35876
36263
  }
@@ -35918,6 +36305,9 @@ html.dark #cover{background:rgba(30,30,30,.6)}
35918
36305
  if (m.kind === 'open-canvas' && typeof m.canvas === 'string' && CANVAS_ID.test(m.canvas)) {
35919
36306
  canvas = m.canvas;
35920
36307
  node = null;
36308
+ ds = null;
36309
+ back = null;
36310
+ signInFor = 'not_signed_in';
35921
36311
  open();
35922
36312
  return;
35923
36313
  }
@@ -35926,6 +36316,33 @@ html.dark #cover{background:rgba(30,30,30,.6)}
35926
36316
  if (m.kind === 'open-canvases') {
35927
36317
  canvas = null;
35928
36318
  node = null;
36319
+ ds = null;
36320
+ back = null;
36321
+ signInFor = 'not_signed_in';
36322
+ open();
36323
+ return;
36324
+ }
36325
+ // A card in the page's Design systems panel: that design system's page in the canvas's place, on a no-project
36326
+ // ticket. Only a slug or a public id is taken, so a forged message can show nothing but a design system page, which
36327
+ // the store judges by the person's own pass. Back returns to the canvas the first one replaced.
36328
+ if (m.kind === 'open-design-system') {
36329
+ var picked = designSystemOf(m);
36330
+ if (!picked) return;
36331
+ if (!ds) back = { canvas: canvas, node: node };
36332
+ ds = picked;
36333
+ canvas = null;
36334
+ node = null;
36335
+ open();
36336
+ return;
36337
+ }
36338
+ // Back on a design system's page: the canvas (and design) shown before it, or the home.
36339
+ if (m.kind === 'close-design-system') {
36340
+ if (!ds) return;
36341
+ ds = null;
36342
+ signInFor = 'not_signed_in';
36343
+ canvas = back ? back.canvas : null;
36344
+ node = back ? back.node : null;
36345
+ back = null;
35929
36346
  open();
35930
36347
  return;
35931
36348
  }
@@ -36007,10 +36424,13 @@ html.dark #cover{background:rgba(30,30,30,.6)}
36007
36424
  // ticket null: a page with no ticket, the guest home before its guest (guestHome) or a page that draws the sign-in.
36008
36425
  function showFrame(ticket, guestHome) {
36009
36426
  unwatch();
36010
- var guest = !!guestHome && !canvas;
36427
+ var guest = !!guestHome && !canvas && !ds;
36011
36428
  var page = canvas
36012
36429
  ? '/c/' + encodeURIComponent(canvas) + '?embed=' + HOST_EMBED + '&theme=' + theme + (node ? '&node=' + encodeURIComponent(node) : '')
36013
- : '/canvases?embed=' + HOST_EMBED + '&theme=' + theme + (guest ? '&guest=1' : '');
36430
+ : ds
36431
+ ? (ds.pub ? '/ds?preset=' + encodeURIComponent(ds.id) + '&' : '/ds/' + encodeURIComponent(ds.id) + '?') +
36432
+ 'embed=' + HOST_EMBED + '&theme=' + theme
36433
+ : '/canvases?embed=' + HOST_EMBED + '&theme=' + theme + (guest ? '&guest=1' : '');
36014
36434
  var address = hosted + page + (ticket === null ? '' : '#ticket=' + encodeURIComponent(ticket));
36015
36435
  // The same page with a new ticket differs only in its fragment, which the browser would not reload for: a
36016
36436
  // throwaway query parameter, which the hosted page ignores, makes it a new address.
@@ -36028,8 +36448,8 @@ html.dark #cover{background:rgba(30,30,30,.6)}
36028
36448
  closeScreen();
36029
36449
  frame.style.display = 'block';
36030
36450
  framedSignIn = ticket === null && !guest;
36031
- // Trusted as the home only once loaded.
36032
- var home = !canvas;
36451
+ // Trusted as the home only once loaded; a design system's page is never the home.
36452
+ var home = !canvas && !ds;
36033
36453
  framedHome = false;
36034
36454
  framedGuest = false;
36035
36455
  var shown = opens;
@@ -36068,6 +36488,9 @@ html.dark #cover{background:rgba(30,30,30,.6)}
36068
36488
  return Object.assign(args, extra || {});
36069
36489
  }
36070
36490
  function takeIds(answer) {
36491
+ // A design system is framed in a canvas's place: a claim's answer names the guest's canvas, which must not replace
36492
+ // it.
36493
+ if (ds) return;
36071
36494
  if (typeof answer.canvas === 'string') canvas = answer.canvas;
36072
36495
  if (typeof answer.node === 'string') node = answer.node;
36073
36496
  }
@@ -36083,11 +36506,20 @@ html.dark #cover{background:rgba(30,30,30,.6)}
36083
36506
  // The statuses every session answer shares. False for one it does not know: the caller words that.
36084
36507
  function handle(answer) {
36085
36508
  if (typeof answer.hosted === 'string') hosted = answer.hosted;
36509
+ if (hosted && !coverLogo.getAttribute('src')) coverLogo.src = hosted + COVER_LOGO_PATH;
36086
36510
  if (answer.status === 'ticket' || answer.status === 'guest_home') {
36087
36511
  claimTries = 0;
36088
36512
  signInState = null;
36089
36513
  offeredOrgs = [];
36090
36514
  var home = answer.status === 'guest_home';
36515
+ // A design system needs an account: a guest, or a machine that never signed in, gets its page with no ticket,
36516
+ // which draws the sign-in, and the view asks again now and then.
36517
+ if (home && ds) {
36518
+ signInFor = 'guest_home';
36519
+ showFrame(null, false);
36520
+ watch(signInFor);
36521
+ return true;
36522
+ }
36091
36523
  if (home) {
36092
36524
  guestCanvas = answer.guestCanvas && typeof answer.guestCanvas === 'object' ? answer.guestCanvas : null;
36093
36525
  guestProject = typeof answer.project === 'string' ? answer.project : null;
@@ -36147,14 +36579,16 @@ html.dark #cover{background:rgba(30,30,30,.6)}
36147
36579
  if (answer.status === 'not_signed_in' && hosted) {
36148
36580
  signInState = null;
36149
36581
  offeredOrgs = [];
36582
+ signInFor = 'not_signed_in';
36150
36583
  showFrame(null, false);
36151
- watch('not_signed_in');
36584
+ watch(signInFor);
36152
36585
  return;
36153
36586
  }
36154
36587
  askAgent();
36155
36588
  }
36156
36589
  function askAgent() {
36157
36590
  if (canvas) show('This canvas didn’t open', 'Ask your agent to open it again.', { icon: 'msg' });
36591
+ else if (ds) show('This design system didn’t open', 'Ask your agent to open it again.', { icon: 'msg' });
36158
36592
  else show('Kombai didn’t open', 'Ask your agent to open Kombai again.', { icon: 'msg' });
36159
36593
  }
36160
36594
 
@@ -36196,7 +36630,7 @@ html.dark #cover{background:rgba(30,30,30,.6)}
36196
36630
  if (!hosted) { askAgent(); return; }
36197
36631
  needPage();
36198
36632
  tellSignIn({ state: 'failed', message: message });
36199
- if (framedSignIn) watch('not_signed_in');
36633
+ if (framedSignIn) watch(signInFor);
36200
36634
  }
36201
36635
 
36202
36636
  // "Continue as guest" on the guest home's welcome popup: the CLI makes the guest, and its answer, the guest home with
@@ -36229,7 +36663,7 @@ html.dark #cover{background:rgba(30,30,30,.6)}
36229
36663
  framedGuest = false;
36230
36664
  coverFrame();
36231
36665
  } else if (!retry) {
36232
- show('Kombai', canvas ? 'Opening the canvas…' : 'Opening Kombai…', { load: true });
36666
+ show('Kombai', canvas ? 'Opening the canvas…' : ds ? 'Opening the design system…' : 'Opening Kombai…', { load: true });
36233
36667
  }
36234
36668
  callTool(SESSION_TOOL, sessionArgs()).then(function (answer) {
36235
36669
  if (mine === opens) settle(answer);
@@ -36259,6 +36693,9 @@ html.dark #cover{background:rgba(30,30,30,.6)}
36259
36693
  var result = openingResult || openingArgs;
36260
36694
  canvas = result && typeof result.canvas === 'string' ? result.canvas : null;
36261
36695
  node = result && typeof result.node === 'string' ? result.node : null;
36696
+ // canvas_app names a design system in place of a canvas, never beside one; Back from it goes to the home.
36697
+ ds = canvas ? null : designSystemOf(result);
36698
+ back = null;
36262
36699
  open();
36263
36700
  }).catch(function (error) {
36264
36701
  show('Couldn\u2019t connect to ' + HOST_LABEL, error.message, { icon: 'unplug', tone: 'warn' });
@@ -36305,7 +36742,10 @@ function createMcpServer(ctx, options = {}) {
36305
36742
  const resourceMeta = async () => {
36306
36743
  const { hosts } = await currentEnv(ctx);
36307
36744
  return {
36308
- ui: { csp: { connectDomains: [], resourceDomains: [], frameDomains: [hosts.web] }, prefersBorder: false },
36745
+ ui: {
36746
+ csp: { connectDomains: [], resourceDomains: [hosts.web], frameDomains: [hosts.web] },
36747
+ prefersBorder: false
36748
+ },
36309
36749
  "openai/ui": { preferredDisplayMode: "fullscreen", availableDisplayModes: ["fullscreen"] },
36310
36750
  "openai/widgetShowCodexWidgetInline": false
36311
36751
  };
@@ -36495,7 +36935,7 @@ var init_assets = __esm({
36495
36935
  var brief_default;
36496
36936
  var init_brief = __esm({
36497
36937
  "src/skill/brief.md"() {
36498
- 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\nWhen `kombai taste wait` answers with `card`, call taste_card. When it answers with `url` instead, give the user that\nlink in your reply: it shows the taste Kombai settled on. To look at the page in your own browser panel, open the\nlink from `kombai taste link <run> --in-app` instead, and never show that one to the user.\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\nTaste finds stock photos and videos for every run, and makes AI images where a design wants art rather than a\nphoto; each image uses credits. Add `--no-generate` to `kombai taste start` only when the user asked for no\nAI-generated images (stock photos only). Taste never makes videos: a <deferred-video-generation> block in\ndirections.md lists the prompts of the videos it did not make, and says when to make them.\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. Treat a\n<generate-video> the same, unless the user asked for AI video: then make it as `kombai skill assets`\nsays, with its aspect and duration as --aspect and --duration.\n';
36938
+ 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- Where it will be built, if not on a Kombai canvas.\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\nTaste runs the same wherever the design is built. In another design tool (Paper, Figma), or in the\nrepo\'s code when the user asks for that, build and check with that tool\'s own tools, not Kombai\'s canvas\ncommands. "For my site" still means a Kombai canvas. Unsure where: ask.\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\nWhen `kombai taste wait` answers with `card`, call taste_card. When it answers with `url` instead, give the user that\nlink at once, on its own line, before you read directions.md, and not in your final message: it shows the taste Kombai\nsettled on, for them to review while you build. To look at the page in your own browser panel, open the\nlink from `kombai taste link <run> --in-app` instead, and never show that one to the user.\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\nTaste finds stock photos and videos for every run, and makes AI images where a design wants art rather than a\nphoto; each image uses credits. Add `--no-generate` to `kombai taste start` only when the user asked for no\nAI-generated images (stock photos only). Taste never makes videos: a <deferred-video-generation> block in\ndirections.md lists the prompts of the videos it did not make, and says when to make them.\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. Treat a\n<generate-video> the same, unless the user asked for AI video: then make it as `kombai skill assets`\nsays, with its aspect and duration as --aspect and --duration.\n';
36499
36939
  }
36500
36940
  });
36501
36941
 
@@ -36511,7 +36951,7 @@ var init_claude_desktop = __esm({
36511
36951
  var codex_desktop_default;
36512
36952
  var init_codex_desktop = __esm({
36513
36953
  "src/skill/codex-desktop.md"() {
36514
- 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. Do that\n first, before any design work: if none exist, set up Kombai's view as `kombai skill opening` says and move the\n work to a new task, since this one can't show the canvas.\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";
36954
+ 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, design_system_card) are not listed\n up front. Find them in exec with `ALL_TOOLS.filter((t) => t.name.startsWith('mcp__kombai'))` before you\n decide one is missing. Do that first, before any design work: if none exist, set up Kombai's view as\n `kombai skill opening` says and move the work to a new task, since this one can't show the canvas.\n- Other design tools' tools (Paper's, Figma's) are in ALL_TOOLS too: look there before deciding you have\n none.\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- Design systems: after a reply's last `kombai ds push` that created or updated one, call\n design_system_card with the slug and ownerKey it printed, then canvas_app with designSystem (its slug)\n instead of a canvas: each once per design system per reply. When the user asks to see one, call\n canvas_app with designSystem, or publicDesignSystem (a public one's id). Never a link: the commands\n print none here.\n";
36515
36955
  }
36516
36956
  });
36517
36957
 
@@ -36519,7 +36959,7 @@ var init_codex_desktop = __esm({
36519
36959
  var design_system_default;
36520
36960
  var init_design_system = __esm({
36521
36961
  "src/skill/design-system.md"() {
36522
- 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';
36962
+ 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, file (null if not pulled here) and url (its page\n on the canvas site), and in publicDesignSystems Kombai\'s public ones, each with its id, name,\n description, file and url.\n- `kombai ds pull <slug>` writes the file it prints. Edit it, then `kombai ds push <file>`. Both print\n its url too.\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- After a `kombai ds push` that prints status created or updated, call design_system_card with the slug\n and ownerKey it printed when that tool is among yours (even listed by name only): it shows the design\n system as a card, so put no link in your reply. When the user asks to open a design system again\n after its card\'s link expired, call design_system_card again (same slug and ownerKey) for a fresh\n link. Without the tool, give its url as a named link, `[<name> design system](<url>)` with the name\n in the file, never the bare url; give none where url is null or missing. In the Codex app, call it\n once per design system per reply, after that reply\'s last push, then open it with canvas_app, as its\n notes say.\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. To show the user one, give\nthe url `ds list`, `ds pull` or `ds push` prints for it as a named link, `[<name> design system](<url>)`,\nnever bare; never build one yourself. Where the url is null or missing, give none. In the Codex app use\ncanvas_app instead.\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';
36523
36963
  }
36524
36964
  });
36525
36965
 
@@ -36535,7 +36975,7 @@ var init_drawings = __esm({
36535
36975
  var faq_default;
36536
36976
  var init_faq = __esm({
36537
36977
  "src/skill/faq.md"() {
36538
- 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, AI images or video, repo images,\n design systems or 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 Kombai plugin starts a pinned CLI version with `npx`, which then keeps its own copy under\n ~/.kombai/cli/install and runs every later command from it. At the start of each design request (`kombai skill`,\n and `kombai mcp install`) it asks Kombai which version to be on and, when a newer one is out, downloads it from npm,\n checks it against the checksum Kombai names, and switches; a running command never changes version. Nothing else\n runs in the background. `kombai update` checks now. `KOMBAI_CLI_SELF_UPDATE=0` turns it off (it is off by default\n in CI); the copy already there then stays as it is. A global install (`npm i -g`) is never touched and updates\n with npm.\n- **Reporting a problem.** Email support@kombai.com with the command, the JSON line it printed and the version\n `kombai --version` prints.\n";
36978
+ 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), Antigravity, OpenCode,\n Grok Build and Devin (its CLI and desktop app) have Kombai plugins, and Gemini CLI has a Kombai extension; any agent\n with a terminal can run the CLI. The Codex app shows the canvas beside the chat and Kombai's cards (a taste run's\n brief, sign-in); the Claude desktop app's Code tab shows the taste card only. Elsewhere the canvas opens in the\n 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, AI images or video, repo images,\n design systems or 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 Kombai plugin starts a pinned CLI version with `npx`, which then keeps its own copy under\n ~/.kombai/cli/install and runs every later command from it. At the start of each design request (`kombai skill`,\n and `kombai mcp install`) it asks Kombai which version to be on and, when a newer one is out, downloads it from npm,\n checks it against the checksum Kombai names, and switches; a running command never changes version. Nothing else\n runs in the background. `kombai update` checks now. `KOMBAI_CLI_SELF_UPDATE=0` turns it off (it is off by default\n in CI); the copy already there then stays as it is. A global install (`npm i -g`) is never touched and updates\n with npm.\n- **Reporting a problem.** Email support@kombai.com with the command, the JSON line it printed and the version\n `kombai --version` prints.\n";
36539
36979
  }
36540
36980
  });
36541
36981
 
@@ -36567,7 +37007,7 @@ var init_opening = __esm({
36567
37007
  var overview_default;
36568
37008
  var init_overview = __esm({
36569
37009
  "src/skill/overview.md"() {
36570
- 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- AI images/video the user asks Kombai for: read `kombai skill assets`.\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.\nFix and push again, no node lock, 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';
37010
+ overview_default = '# Kombai design\n\nDesign UI on a hosted Kombai canvas, or where the user asks; design systems need no canvas.\n`kombai <command> --help` gives its flags. Read each JSON result: next can be a command, a link or\nadvice. Follow it after handling the error and 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 Kombai canvas or node (a link, "On my Kombai canvas" message, or its name): 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- AI images/video the user asks Kombai for: read `kombai skill assets`.\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.\n2. When taste is needed (never for a guest), tell the user their `kombai credits` balance, then run\n `kombai taste start --brief <file> --variants <1-4>`, one per design (--cards if you have a taste_card\n tool). Do step 3 meanwhile, then `kombai taste wait <run>`: show its card or link, then follow\n directions.md. On TASTE_NO_CREDITS, call plans_card if among your tools, else show next\'s plan link; stop.\n3. Unless built elsewhere, `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. Unless built elsewhere, 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.\nFix and push again, no node lock, 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';
36571
37011
  }
36572
37012
  });
36573
37013
 
@@ -36575,7 +37015,7 @@ var init_overview = __esm({
36575
37015
  var sign_in_default;
36576
37016
  var init_sign_in = __esm({
36577
37017
  "src/skill/sign-in.md"() {
36578
- 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- Make no AI-generated images or video (no `kombai asset generate`): public https images, CSS or SVG 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 saying what signing in unlocks:\n taste directions, AI images and video, 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- assets: `asset generate` or `asset wait` refused (CLI_SIGNIN_REQUIRED), or the user asks a guest for AI images\n or video.\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";
37018
+ 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, and reason guest_claimed signs in with no card. The reasons below apply to any\nexit-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- Exit 3 with reason guest_claimed: the user signed in on the canvas page, so the guest canvas is in their account\n now. Tell them so in one line and sign in now without asking (Signing in), even where `sign_in_card` is among your\n tools; show the match code. The signed-in line then has claimed. If that sign-in is not approved (it expires),\n ask once: sign in again, or start fresh with `kombai guest` (a new guest canvas; the old one stays in 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- Make no AI-generated images or video (no `kombai asset generate`): public https images, CSS or SVG 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 saying what signing in unlocks:\n taste directions, AI images and video, 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 its message in one line (the old\n guest canvas expired and is gone, or had already moved into an account). Never offer `kombai guest`.\n- SIGNIN_GUEST_CLAIMED as an error from a guest's own command: the canvas moved into an account; do as the reason\n guest_claimed line says. As a warning on a signed-in line: nothing to do.\n- DESIGN_GUEST_CLAIMED as a warning on a signed-in line: another account has the guest canvas. Say so in one line\n and carry on in the signed-in account, on a new canvas.\n\n## The sign-in card\n\nWhere `sign_in_card` is among your tools, call it in place of the lines above (except reason guest_claimed, which\nsigns in at once), with the moment's reason, and end your\nturn; don't run or offer `kombai login` in text:\n\n- start: whoami exits 3 with any reason but guest_claimed, in place of asking whether to sign in or try it without\n an account. The user chooses on the 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- assets: `asset generate` or `asset wait` refused (CLI_SIGNIN_REQUIRED), or the user asks a guest for AI images\n or video.\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";
36579
37019
  }
36580
37020
  });
36581
37021
 
@@ -36671,7 +37111,7 @@ var init_skill = __esm({
36671
37111
  }
36672
37112
  const app = skillAppOf(ctx);
36673
37113
  const note = topic === "overview" && app ? await CHANNEL_NOTES[app](ctx) : "";
36674
- const updated = args[0] === void 0 ? updatedLine(ctx.selfUpdate) : "";
37114
+ const updated = updatedLine(ctx.selfUpdate);
36675
37115
  ctx.stdout.write(
36676
37116
  `${updated ? `${updated}
36677
37117
 
@@ -38877,6 +39317,7 @@ ${turnGrant}
38877
39317
  writeOutcome(ctx.stdout, { version: ctx.version }, ctx.warnings, ctx.pretty);
38878
39318
  return Exit.OK;
38879
39319
  }
39320
+ if (ctx.selfUpdate?.withdrawn) throw withdrawnHere(ctx.selfUpdate, argv2);
38880
39321
  running = parsed.command;
38881
39322
  const result = await parsed.command.run(ctx, parsed.input);
38882
39323
  const code = typeof result[EXIT_CODE] === "number" ? result[EXIT_CODE] : Exit.OK;
@@ -38950,6 +39391,26 @@ function sameShape(error2, command) {
38950
39391
  }
38951
39392
  return error2;
38952
39393
  }
39394
+ function withdrawnHere(found, argv2) {
39395
+ const { version: version2, bootstrap } = (
39396
+ /** @type {NonNullable<typeof found.withdrawn>} */
39397
+ found.withdrawn
39398
+ );
39399
+ const failed2 = found.failed ?? null;
39400
+ const replacement = failed2 ? `, and its replacement (${failed2.version}) could not be installed here` : "";
39401
+ return new CliError(
39402
+ "CLI_VERSION_WITHDRAWN",
39403
+ `Kombai CLI ${version2} has been withdrawn${replacement}. Run the next command instead.`,
39404
+ {
39405
+ next: [`npx -y ${PACKAGE_NAME}@${bootstrap}`, ...argv2.map(shellArg)].join(" "),
39406
+ details: {
39407
+ version: version2,
39408
+ runWith: bootstrap,
39409
+ ...failed2 ? { replacement: failed2.version, reason: failed2.reason } : {}
39410
+ }
39411
+ }
39412
+ );
39413
+ }
38953
39414
  function upgradeRequired(ctx, failure) {
38954
39415
  const required2 = typeof failure.details?.required === "string" ? failure.details.required : null;
38955
39416
  const needs = `Kombai now needs CLI ${required2 ?? "a newer version"}${required2 ? " or newer" : ""} for this; this is ${ctx.version}.`;