@kombai/cli 0.1.2-beta.5 → 0.1.2-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/kombai.mjs CHANGED
@@ -1557,9 +1557,9 @@ var init_env = __esm({
1557
1557
  preprod: { api: "https://api.assistant.preprod.kombai.com", web: "https://agent.preprod.kombai.com" },
1558
1558
  prod: { api: "https://api.assistant.app.kombai.com", web: "https://agent.kombai.com" }
1559
1559
  });
1560
- DEFAULT_ENV = Object.hasOwn(ENVIRONMENTS, "dev") ? (
1560
+ DEFAULT_ENV = Object.hasOwn(ENVIRONMENTS, "preprod") ? (
1561
1561
  /** @type {EnvName} */
1562
- "dev"
1562
+ "preprod"
1563
1563
  ) : "prod";
1564
1564
  }
1565
1565
  });
@@ -1762,11 +1762,11 @@ var init_version = __esm({
1762
1762
  "src/lib/version.js"() {
1763
1763
  "use strict";
1764
1764
  init_define_KOMBAI_TELEMETRY();
1765
- CLI_VERSION = true ? "0.1.2-beta.5" : (
1765
+ CLI_VERSION = true ? "0.1.2-beta.6" : (
1766
1766
  /** @type {{ version: string }} */
1767
1767
  JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version
1768
1768
  );
1769
- CLI_RUN = true ? "npx -y @kombai/cli@next" : "npx -y @kombai/cli@latest";
1769
+ CLI_RUN = true ? "npx -y @kombai/cli@beta" : "npx -y @kombai/cli@latest";
1770
1770
  }
1771
1771
  });
1772
1772
 
@@ -3741,6 +3741,36 @@ var init_auth = __esm({
3741
3741
  }
3742
3742
  });
3743
3743
 
3744
+ // src/lib/codex-app.js
3745
+ function linkField(ctx, url2) {
3746
+ return ctx.codexDesktop ? {} : { url: url2 };
3747
+ }
3748
+ function canvasJsonLink(ctx, url2) {
3749
+ return ctx.codexDesktop ? null : url2;
3750
+ }
3751
+ function inCodexDesktop(env) {
3752
+ return Boolean(env.CODEX_THREAD_ID) && env.CLAUDECODE !== "1" && env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE === CODEX_DESKTOP_ORIGINATOR;
3753
+ }
3754
+ function showWithCanvasApp(canvas) {
3755
+ return `Call the canvas_app tool with ${JSON.stringify({ canvas })} (find it with ${FIND_CANVAS_APP}).`;
3756
+ }
3757
+ function viewInstead(canvas) {
3758
+ return {
3759
+ shown: false,
3760
+ next: `${showWithCanvasApp(canvas)} In the Codex app it shows the canvas beside the chat. ${VIEW_MISSING}`
3761
+ };
3762
+ }
3763
+ var CODEX_DESKTOP_ORIGINATOR, FIND_CANVAS_APP, VIEW_MISSING;
3764
+ var init_codex_app = __esm({
3765
+ "src/lib/codex-app.js"() {
3766
+ "use strict";
3767
+ init_define_KOMBAI_TELEMETRY();
3768
+ CODEX_DESKTOP_ORIGINATOR = "Codex Desktop";
3769
+ FIND_CANVAS_APP = "ALL_TOOLS.filter((t) => t.name.endsWith('canvas_app'))";
3770
+ VIEW_MISSING = "If no canvas_app tool exists, Kombai's view is not connected in this chat: tell the user it comes with the Kombai plugin (install or turn it on, or start a new chat if it is on), and show no link instead.";
3771
+ }
3772
+ });
3773
+
3744
3774
  // ../../node_modules/escape-string-regexp/index.js
3745
3775
  var require_escape_string_regexp = __commonJS({
3746
3776
  "../../node_modules/escape-string-regexp/index.js"(exports, module) {
@@ -8222,7 +8252,7 @@ async function restoreLost(ctx, paths, base, observed) {
8222
8252
  return { nodeId, entry, layout: entry.layout, info: infoOf(paths, nodeId, entry.type, entry.state, hasFile) };
8223
8253
  }),
8224
8254
  observed,
8225
- { canvas: { name: base.name, url: base.url } }
8255
+ { canvas: { name: base.name, url: canvasJsonLink(ctx, base.url ?? void 0) } }
8226
8256
  );
8227
8257
  return moved;
8228
8258
  }
@@ -8254,6 +8284,7 @@ var init_canvas = __esm({
8254
8284
  init_api();
8255
8285
  init_canvasops();
8256
8286
  init_canvasdir();
8287
+ init_codex_app();
8257
8288
  init_contract();
8258
8289
  init_screenshots();
8259
8290
  init_fsx();
@@ -8305,7 +8336,7 @@ var init_canvas = __esm({
8305
8336
  await Promise.all([ensureDir(paths.nodes), ensureDir(paths.baseNodes)]);
8306
8337
  await writeJsonAtomic(
8307
8338
  paths.canvasJson,
8308
- { canvasId: created.id, name: created.name, url: created.url, nodes: {} },
8339
+ { canvasId: created.id, name: created.name, url: canvasJsonLink(ctx, created.url), nodes: {} },
8309
8340
  { mode: 420 }
8310
8341
  );
8311
8342
  await writeJsonAtomic(
@@ -8329,11 +8360,14 @@ var init_canvas = __esm({
8329
8360
  return {
8330
8361
  canvasId: created.id,
8331
8362
  name: created.name,
8332
- url: created.url,
8363
+ ...linkField(ctx, created.url),
8333
8364
  sharing: created.sharing,
8334
8365
  projectId: cc.checkout.projectId,
8335
8366
  ownerKey: created.ownerKey,
8336
- dir: paths.dir
8367
+ dir: paths.dir,
8368
+ // In the Codex app the view shows the new canvas before any design is written (opening-codex.md), as the next
8369
+ // step an agent takes without reading further.
8370
+ ...ctx.codexDesktop ? { next: `${showWithCanvasApp(created.id)} Do it now, before you write any design. ${VIEW_MISSING}` } : {}
8337
8371
  };
8338
8372
  }
8339
8373
  };
@@ -8369,7 +8403,11 @@ var init_canvas = __esm({
8369
8403
  }));
8370
8404
  const here = (entry) => entry.projectId === cc.checkout.projectId;
8371
8405
  const listed = [...named2.filter(here), ...named2.filter((entry) => !here(entry))];
8406
+ const ids = new Set(listed.map(({ item }) => item.id));
8372
8407
  const ws = await loadWorkspace(cc.work, cc.checkout, (ws2) => {
8408
+ if (!project) {
8409
+ for (const id of Object.keys(ws2.canvases)) if (!ids.has(id)) delete ws2.canvases[id];
8410
+ }
8373
8411
  for (const { item, projectId } of listed) if (projectId) ws2.canvases[item.id] = projectId;
8374
8412
  });
8375
8413
  const deleted = [];
@@ -8390,7 +8428,7 @@ var init_canvas = __esm({
8390
8428
  return {
8391
8429
  canvasId: item.id,
8392
8430
  name: item.name,
8393
- url: `${cc.session.hosts.web}/c/${item.id}`,
8431
+ ...linkField(ctx, `${cc.session.hosts.web}/c/${item.id}`),
8394
8432
  modified: item.modified,
8395
8433
  designCount: item.designCount,
8396
8434
  sharing: item.sharing,
@@ -8515,7 +8553,7 @@ var init_canvas = __esm({
8515
8553
  discard,
8516
8554
  canvas: {
8517
8555
  name: read2.document.name,
8518
- url: `${cc.session.hosts.web}/c/${canvasId}`,
8556
+ url: canvasJsonLink(ctx, `${cc.session.hosts.web}/c/${canvasId}`),
8519
8557
  seq: read2.seq,
8520
8558
  projectId: project.projectId,
8521
8559
  projectSource: project.source === "read" ? "listed" : project.source
@@ -8708,19 +8746,21 @@ var init_canvas = __esm({
8708
8746
  };
8709
8747
  canvasUrl = {
8710
8748
  name: "canvas url",
8711
- summary: "The canvas link for the agent's own browser panel, already signed in. The ticket in it works once, within 10 minutes.",
8749
+ notInCodexDesktop: true,
8750
+ summary: "The canvas link for the agent's own browser panel, already signed in. The ticket in it works once, within 10 minutes. In the Codex app it prints no link: Kombai's view (the canvas_app tool) shows the canvas there.",
8712
8751
  flags: {
8713
8752
  canvas: { type: "string", required: true, placeholder: "<id|link>", check: canvasRefProblem },
8714
8753
  "in-app": { type: "boolean", required: true }
8715
8754
  },
8716
8755
  async run(ctx, { flags }) {
8756
+ if (ctx.codexDesktop) return viewInstead(String(flags.canvas));
8717
8757
  const cc = await canvasContext(ctx, flags, { allowGuest: true });
8718
8758
  return { url: await ticketedUrl(ctx, cc) };
8719
8759
  }
8720
8760
  };
8721
8761
  canvasShare = {
8722
8762
  name: "canvas share",
8723
- summary: "Turn the canvas link on (--on) or off (--off). A new canvas is private to its owner; with the link on, anyone with the link can view it and teammates can edit it. Only the canvas's owner can change this. Prints the plain link, which opens for whoever may see the canvas.",
8763
+ summary: "Turn the canvas link on (--on) or off (--off). A new canvas is private to its owner; with the link on, anyone with the link can view it and teammates can edit it. Only the canvas's owner can change this. Prints the plain link, which opens for whoever may see the canvas; in the Codex app it prints none (the view's Share button copies it).",
8724
8764
  flags: {
8725
8765
  canvas: { type: "string", required: true, placeholder: "<id|link>", check: canvasRefProblem },
8726
8766
  on: { type: "boolean" },
@@ -8752,14 +8792,20 @@ var init_canvas = __esm({
8752
8792
  }
8753
8793
  throw await canvasGone(cc, error2);
8754
8794
  }
8755
- return { canvasId, sharing: answer2?.sharing ?? sharing, url: `${cc.session.hosts.web}/c/${canvasId}` };
8795
+ return {
8796
+ canvasId,
8797
+ sharing: answer2?.sharing ?? sharing,
8798
+ ...linkField(ctx, `${cc.session.hosts.web}/c/${canvasId}`)
8799
+ };
8756
8800
  }
8757
8801
  };
8758
8802
  canvasOpen = {
8759
8803
  name: "canvas open",
8760
- summary: "Open the canvas in the user's browser, already signed in. Prints the link without its ticket.",
8804
+ notInCodexDesktop: true,
8805
+ summary: "Open the canvas in the user's browser, already signed in. Prints the link without its ticket. In the Codex app it opens nothing: Kombai's view (the canvas_app tool) shows the canvas there.",
8761
8806
  flags: { canvas: { type: "string", required: true, placeholder: "<id|link>", check: canvasRefProblem } },
8762
8807
  async run(ctx, { flags }) {
8808
+ if (ctx.codexDesktop) return viewInstead(String(flags.canvas));
8763
8809
  const cc = await canvasContext(ctx, flags, { allowGuest: true });
8764
8810
  if (!ctx.hasDisplay) {
8765
8811
  await readForLink(cc);
@@ -31747,7 +31793,7 @@ var init_taste = __esm({
31747
31793
  TASTE_CARD_TOOL = "taste_card";
31748
31794
  tasteStart = {
31749
31795
  name: "taste start",
31750
- summary: "Start a taste run: Kombai's design directions for a brief you wrote after reading the repo. Uses credits. --cards also writes the design brief for a taste_card tool; add it only where that tool is listed.",
31796
+ summary: "Start a taste run: Kombai's design directions for a brief you wrote after reading the repo. Uses credits. --cards also writes the design brief for a taste_card tool; add it only where that tool is among your tools (the Codex app lists it only in ALL_TOOLS).",
31751
31797
  flags: {
31752
31798
  brief: { type: "string", required: true, placeholder: "<file>" },
31753
31799
  variants: {
@@ -31990,7 +32036,7 @@ var init_client_gate = __esm({
31990
32036
  Cards = Object.freeze({
31991
32037
  /** The taste card and the plans card, and the CLI's own sign-in card. */
31992
32038
  All: "all",
31993
- /** The taste card, and the CLI's own sign-in card. */
32039
+ /** The taste card only (no sign-in card: cards.js specsIn). */
31994
32040
  Taste: "taste",
31995
32041
  None: "none"
31996
32042
  });
@@ -32000,14 +32046,23 @@ var init_client_gate = __esm({
32000
32046
  label: "Codex",
32001
32047
  embed: "codex",
32002
32048
  ticketFor: "codex",
32003
- appWide: (place) => isCodexAppWideFolder(place.cwd, place.osHome, place.platform, place.env.CODEX_HOME)
32049
+ appWide: (place) => isCodexAppWideFolder(place.cwd, place.osHome, place.platform, place.env.CODEX_HOME),
32050
+ // Codex's in-app browser: a view may open only https: and codex: links, and this one opens `url` there. The same
32051
+ // link the hosted canvas uses for Kombai's chat page (design-mode host/mcp-app/kombai-chat.ts codexBrowserLink).
32052
+ browserLink: (url2) => `codex://browser?url=${encodeURIComponent(url2)}`
32004
32053
  }
32005
32054
  ]);
32006
32055
  }
32007
32056
  });
32008
32057
 
32009
32058
  // src/mcp/login-runner.js
32010
- function createLoginRunner(ctx) {
32059
+ function firstOpen(state) {
32060
+ if (state.linkOpened) return false;
32061
+ state.linkOpened = true;
32062
+ return true;
32063
+ }
32064
+ function createLoginRunner(ctx, options = {}) {
32065
+ const inApp = () => options.inApp?.() === true;
32011
32066
  let current = null;
32012
32067
  const unread = /* @__PURE__ */ new Map();
32013
32068
  const takeUnread = (reader) => {
@@ -32022,7 +32077,7 @@ function createLoginRunner(ctx) {
32022
32077
  const started = new Promise((resolve) => {
32023
32078
  markStarted = resolve;
32024
32079
  });
32025
- const state = { started, settled: Promise.resolve({ ok: true, claim: null }), waiting: null };
32080
+ const state = { started, settled: Promise.resolve({ ok: true, claim: null }), waiting: null, linkOpened: false };
32026
32081
  let claim2 = null;
32027
32082
  const loginCtx = {
32028
32083
  ...ctx,
@@ -32034,7 +32089,7 @@ function createLoginRunner(ctx) {
32034
32089
  claim2 = outcome;
32035
32090
  }
32036
32091
  };
32037
- state.settled = login.run(loginCtx, { flags: {}, args: [] }).then(
32092
+ state.settled = login.run(loginCtx, { flags: inApp() ? { "no-browser": true } : {}, args: [] }).then(
32038
32093
  () => (
32039
32094
  /** @type {SettledLogin} */
32040
32095
  { ok: true, claim: claim2 }
@@ -32062,7 +32117,7 @@ function createLoginRunner(ctx) {
32062
32117
  start,
32063
32118
  reopen: async () => {
32064
32119
  const url2 = current?.waiting?.url;
32065
- if (typeof url2 !== "string" || !ctx.hasDisplay) return false;
32120
+ if (typeof url2 !== "string" || !ctx.hasDisplay || inApp()) return false;
32066
32121
  return ctx.openUrl(url2);
32067
32122
  },
32068
32123
  running: () => current !== null,
@@ -32197,7 +32252,7 @@ function toolDescriptors(resourceUri) {
32197
32252
  {
32198
32253
  name: CANVAS_APP_TOOL,
32199
32254
  title: "Kombai",
32200
- description: "Show a Kombai canvas beside this chat. Pass the canvas id (cnv_\u2026) or its link; node is a design id to focus. With no canvas it shows every canvas the person can open when signed in, the guest home to a guest or to someone who never signed in, and asks someone who signed in before to sign in there. Open a canvas once: every canvas_app call opens another tab. The canvas is the live Kombai page, so it shows every change as it lands. Changes go through the work-with-kombai skill's commands, never through this tool. While it shows the canvas, put no canvas or design link in your replies: name designs by their labels, and give a link only when the person asks for one. Such a link is a Kombai page, which opens in this client's browser, never a Kombai app link.",
32255
+ description: "Open a Kombai canvas in this conversation, beside the chat: the way to show one here, in place of any browser or link. Call it right after kombai canvas create, before any design. Pass the canvas id (cnv_\u2026) or its link; node is a design id to focus. With no canvas it shows every canvas the person can open when signed in, the guest home to a guest or to someone who never signed in, and asks someone who signed in before to sign in there. Open a canvas once, again only when the person asks to see it: every canvas_app call opens another tab. The canvas is the live Kombai page, so it shows every change as it lands. Changes go through the work-with-kombai skill's commands, never through this tool. Put no canvas or design link in your replies: name designs by their labels. A person who wants a link copies it from the view (the canvas's Share, or a design's Copy link); never open one yourself.",
32201
32256
  inputSchema: {
32202
32257
  type: "object",
32203
32258
  properties: {
@@ -32345,33 +32400,28 @@ async function readCanvas(session, canvasId) {
32345
32400
  }
32346
32401
  return { projectId: body.projectId, name };
32347
32402
  }
32348
- function canvasPageUrl(webHost, ref) {
32349
- return `${webHost}/c/${ref.canvasId}${ref.nodeId ? `?node=${encodeURIComponent(ref.nodeId)}` : ""}`;
32350
- }
32351
32403
  async function callCanvasApp(ctx, args) {
32352
32404
  const { hosts } = await currentEnv(ctx);
32353
32405
  const ref = refFromArgs(args, hosts.web);
32354
32406
  if (!ref) {
32355
- const url3 = `${hosts.web}/canvases`;
32356
32407
  return {
32357
- structuredContent: { url: url3 },
32408
+ structuredContent: {},
32358
32409
  content: [
32359
32410
  {
32360
32411
  type: "text",
32361
- text: `Kombai's canvas view is open beside this chat (${url3}). Signed in, it lists every canvas the person can open; a guest, or someone who never signed in, sees Kombai's home as a guest; anyone who signed in before is asked to sign in there, so do not run kombai login for it.`
32412
+ text: "Kombai's canvas view is open beside this chat. Signed in, it lists every canvas the person can open; a guest, or someone who never signed in, sees Kombai's home as a guest; anyone who signed in before is asked to sign in there, so do not run kombai login for it."
32362
32413
  }
32363
32414
  ]
32364
32415
  };
32365
32416
  }
32366
32417
  const session = await openAnySession(ctx);
32367
32418
  const { projectId, name } = await readCanvas(session, ref.canvasId);
32368
- const url2 = canvasPageUrl(hosts.web, ref);
32369
32419
  return {
32370
- structuredContent: { canvas: ref.canvasId, ...ref.nodeId ? { node: ref.nodeId } : {}, name, projectId, url: url2 },
32420
+ structuredContent: { canvas: ref.canvasId, ...ref.nodeId ? { node: ref.nodeId } : {}, name, projectId },
32371
32421
  content: [
32372
32422
  {
32373
32423
  type: "text",
32374
- text: `Canvas "${name}" is open beside this chat: ${url2}. Changes go through the work-with-kombai skill.`
32424
+ text: `Canvas "${name}" is open beside this chat. Changes go through the work-with-kombai skill.`
32375
32425
  }
32376
32426
  ]
32377
32427
  };
@@ -32558,7 +32608,19 @@ function createSessionTool(ctx, { login: runner }) {
32558
32608
  const outcome = await Promise.race([state.settled, ctx.sleep(waitS * 1e3).then(() => null)]);
32559
32609
  if (outcome === null) {
32560
32610
  const waiting = state.waiting ?? {};
32561
- return answer({ status: "signing_in", ...ids, matchCode: waiting.matchCode ?? null, url: waiting.url ?? null });
32611
+ const url2 = typeof waiting.url === "string" ? waiting.url : null;
32612
+ return answer(
32613
+ {
32614
+ status: "signing_in",
32615
+ ...ids,
32616
+ matchCode: waiting.matchCode ?? null,
32617
+ url: url2,
32618
+ // The host's own browser (Codex's): the login opened nothing here, so the view opens the approval page there,
32619
+ // itself only on the login's first such answer (openNow, firstOpen); later ones offer Open the page again.
32620
+ ...url2 && host.browserLink ? { openLink: host.browserLink(url2), openNow: firstOpen(state) } : {}
32621
+ },
32622
+ ["url", "openLink", "openNow"]
32623
+ );
32562
32624
  }
32563
32625
  runner.takeUnread(LoginReader.View);
32564
32626
  if (!outcome.ok) {
@@ -32661,16 +32723,17 @@ async function mintGuestTicket(ctx, session, canvasId, ticketFor) {
32661
32723
  return null;
32662
32724
  }
32663
32725
  }
32664
- function answer(structuredContent) {
32726
+ function answer(structuredContent, viewOnly = []) {
32727
+ const text = Object.fromEntries(Object.entries(structuredContent).filter(([key]) => !viewOnly.includes(key)));
32665
32728
  return {
32666
32729
  structuredContent,
32667
32730
  content: [{ type: (
32668
32731
  /** @type {const} */
32669
32732
  "text"
32670
- ), text: JSON.stringify(structuredContent) }]
32733
+ ), text: JSON.stringify(text) }]
32671
32734
  };
32672
32735
  }
32673
- var CANVAS_APP_TOOL, SESSION_TOOL, ACCOUNT_TOOL, CREATE_TOOL, RENAME_TOOL, DELETE_TOOL, DOWNLOAD_TOOL, ONLY_OWNER_DELETES, DOWNLOAD_DEADLINE_MS, MANAGE_DEADLINE_MS, MULTI_TEAM_NOT_SUPPORTED, RESOURCE_URI_BASE, versionedUri, SIGN_IN_MAX_WAIT_S, INSTRUCTIONS, read, badArgument, given;
32736
+ var CANVAS_APP_TOOL, SESSION_TOOL, ACCOUNT_TOOL, CREATE_TOOL, RENAME_TOOL, DELETE_TOOL, DOWNLOAD_TOOL, ONLY_OWNER_DELETES, DOWNLOAD_DEADLINE_MS, MANAGE_DEADLINE_MS, MULTI_TEAM_NOT_SUPPORTED, RESOURCE_URI_BASE, versionedUri, SIGN_IN_MAX_WAIT_S, INSTRUCTIONS, CODEX_INSTRUCTIONS, read, badArgument, given;
32674
32737
  var init_tools = __esm({
32675
32738
  "src/mcp/tools.js"() {
32676
32739
  "use strict";
@@ -32703,7 +32766,8 @@ var init_tools = __esm({
32703
32766
  RESOURCE_URI_BASE = "ui://kombai/cli-canvas-app";
32704
32767
  versionedUri = (base, version2) => `${base}?v=${encodeURIComponent(version2)}`;
32705
32768
  SIGN_IN_MAX_WAIT_S = 20;
32706
- INSTRUCTIONS = `Kombai designs live on a Kombai canvas; design systems are .ds files in the Kombai account and need no canvas. Use the work-with-kombai skill (\`${CLI_RUN} skill\`) for designs and design systems. Questions about Kombai itself (account, credits, data, setup) are answered by \`${CLI_RUN} skill faq\`. Call canvas_app only to show a canvas beside this chat; call it once per canvas. 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.`;
32769
+ INSTRUCTIONS = `Designs and design systems: follow \`${CLI_RUN} skill\`. Where taste_card is among your tools, even listed by name only, add --cards to every \`kombai taste start\`, and call taste_card when \`kombai taste wait\` answers with card. Kombai designs live on a Kombai canvas; design systems are .ds files in the Kombai account and need no canvas. Questions about Kombai itself (account, credits, data, setup) are answered by \`${CLI_RUN} skill faq\`.`;
32770
+ CODEX_INSTRUCTIONS = `Show Kombai canvases with canvas_app (find it in ALL_TOOLS): right after kombai canvas create, before any design, or on first use of a canvas not open beside the chat. It is the only way: no browser, no in-app browser, no link. Designs and design systems: follow \`${CLI_RUN} skill\`. A user who wants a link copies it from the view: the canvas's Share, or a design's Copy link. Add --cards to every \`kombai taste start\`, and call taste_card when \`kombai taste wait\` answers with card. Kombai designs live on a Kombai canvas; design systems are .ds files in the Kombai account and need no canvas. Call canvas_app once per canvas, only to show it (again only when the user asks): make changes with the commands. Questions about Kombai itself (account, credits, data, setup) are answered by \`${CLI_RUN} skill faq\`.`;
32707
32771
  read = { readOnlyHint: true, destructiveHint: false, idempotentHint: false, openWorldHint: false };
32708
32772
  badArgument = (message) => new CliError("CLI_BAD_ARGUMENT", message);
32709
32773
  given = (value) => value !== void 0 && value !== null && value !== "";
@@ -32725,7 +32789,8 @@ function refusalText(code2, message, plansLink, extra) {
32725
32789
  ...extra
32726
32790
  });
32727
32791
  }
32728
- async function signInCardData(ctx, reason) {
32792
+ async function signInCardData(ctx, reason, appBrowser = null) {
32793
+ const where = appBrowser ? { app_browser: appBrowser } : {};
32729
32794
  const reasons = (
32730
32795
  /** @type {unknown[]} */
32731
32796
  Object.values(SignInReason)
@@ -32742,9 +32807,10 @@ async function signInCardData(ctx, reason) {
32742
32807
  if (!hasGuest(entry)) {
32743
32808
  const keyLive = typeof entry.key === "string" && entry.key !== "" && Date.parse(entry.expires ?? "") > ctx.now();
32744
32809
  if (keyLive) return cardWords("signed_in", "This machine is signed in to Kombai.", void 0, emailOf(entry));
32745
- return { reason: SignInReason.Start, line: LINES[SignInReason.Start], guest: !holdsAccount(entry) };
32810
+ return { reason: SignInReason.Start, line: LINES[SignInReason.Start], guest: !holdsAccount(entry), ...where };
32746
32811
  }
32747
- if (valid === SignInReason.Start) return { reason: SignInReason.Account, line: LINES[SignInReason.Account] };
32812
+ if (valid === SignInReason.Start)
32813
+ return { reason: SignInReason.Account, line: LINES[SignInReason.Account], ...where };
32748
32814
  if (valid === SignInReason.Ending) {
32749
32815
  const daysLeft = Math.ceil((Date.parse(entry.guestExpires ?? "") - ctx.now()) / DAY_MS);
32750
32816
  if (!(daysLeft >= 1 && daysLeft <= ENDING_DAYS)) {
@@ -32752,19 +32818,19 @@ async function signInCardData(ctx, reason) {
32752
32818
  "not_ending",
32753
32819
  `This guest canvas does not end within ${ENDING_DAYS} days.`,
32754
32820
  void 0,
32755
- typeof entry.guestExpires === "string" && daysLeft > ENDING_DAYS ? { ends_at: entry.guestExpires } : void 0
32821
+ typeof entry.guestExpires === "string" && daysLeft > ENDING_DAYS ? { ends_at: entry.guestExpires, ...where } : void 0
32756
32822
  );
32757
32823
  }
32758
32824
  const line = daysLeft === 1 ? "Your guest canvas ends tomorrow." : `Your guest canvas ends in ${daysLeft} days.`;
32759
- return { reason: valid, line };
32825
+ return { reason: valid, line, ...where };
32760
32826
  }
32761
- return { reason: valid, line: LINES[valid] };
32827
+ return { reason: valid, line: LINES[valid], ...where };
32762
32828
  }
32763
32829
  function emailOf(entry) {
32764
32830
  return typeof entry.email === "string" && entry.email ? { email: entry.email } : void 0;
32765
32831
  }
32766
- async function showSignIn(ctx, args) {
32767
- const data = await signInCardData(ctx, args.reason);
32832
+ async function showSignIn(ctx, args, appBrowser = null) {
32833
+ const data = await signInCardData(ctx, args.reason, appBrowser);
32768
32834
  if ("content" in data) return data;
32769
32835
  const text = data.reason === SignInReason.Start ? data.guest ? `Showing Kombai's sign-in card in the chat, which asks the user to sign in or try Kombai without an account. Don't ask in text: ${END_TURN} When the user says to carry on, run kombai whoami.` : `Showing Kombai's sign-in card in the chat. This machine has signed in before, so it offers sign-in only: ${END_TURN} When the user says to carry on, run kombai whoami.` : data.reason === SignInReason.Ending ? (
32770
32836
  // A reminder, not a refusal: the guest can still design, so the request goes on.
@@ -32804,7 +32870,7 @@ function statusOfClaim(claim2) {
32804
32870
  }
32805
32871
  }
32806
32872
  }
32807
- async function chatSignIn(ctx, runner, args, besideChat) {
32873
+ async function chatSignIn(ctx, runner, args, besideChat, appBrowser = null) {
32808
32874
  const waitS = typeof args.wait === "number" && Number.isFinite(args.wait) ? Math.min(SIGN_IN_MAX_WAIT_S, Math.max(0, Math.floor(args.wait))) : 0;
32809
32875
  if (args.reopen === true) return answer({ reopened: await runner.reopen() });
32810
32876
  const { claimOrg } = args;
@@ -32821,7 +32887,16 @@ async function chatSignIn(ctx, runner, args, besideChat) {
32821
32887
  const settled = await Promise.race([state.settled, ctx.sleep(waitS * 1e3).then(() => null)]);
32822
32888
  if (settled === null) {
32823
32889
  const matchCode = state.waiting?.matchCode;
32824
- return answer({ status: SignInStatus.SigningIn, match_code: typeof matchCode === "string" ? matchCode : null });
32890
+ const url2 = state.waiting?.url;
32891
+ return answer(
32892
+ {
32893
+ status: SignInStatus.SigningIn,
32894
+ match_code: typeof matchCode === "string" ? matchCode : null,
32895
+ // open_now: the card opens the page itself only on the login's first such answer (firstOpen).
32896
+ ...appBrowser && typeof url2 === "string" ? { open_link: appBrowser.link(url2), open_now: firstOpen(state) } : {}
32897
+ },
32898
+ ["open_link", "open_now"]
32899
+ );
32825
32900
  }
32826
32901
  runner.takeUnread(LoginReader.Card);
32827
32902
  return answer(await withCanvas(ctx, statusOfLogin(settled), besideChat));
@@ -32930,6 +33005,7 @@ import fs18 from "node:fs/promises";
32930
33005
  import path19 from "node:path";
32931
33006
  import { fileURLToPath } from "node:url";
32932
33007
  function createCards(ctx, options) {
33008
+ const appBrowser = () => options.appBrowser?.() ?? null;
32933
33009
  const dir = options.dir ?? CARDS_DIR;
32934
33010
  const scripts = /* @__PURE__ */ new Map();
32935
33011
  const script = (spec) => {
@@ -32993,12 +33069,23 @@ function createCards(ctx, options) {
32993
33069
  async call(set2, name, args) {
32994
33070
  const specs = await available(set2);
32995
33071
  const signInBuilt = specs.includes(SIGN_IN);
32996
- if (name === TASTE_CARD_TOOL2 && specs.includes(TASTE)) return showTaste(ctx, args, signInBuilt);
32997
- if (name === PLANS_CARD_TOOL && specs.includes(PLANS)) return showPlans(ctx, signInBuilt);
32998
- if (name === CHECKOUT_TOOL && specs.includes(PLANS)) return checkout(ctx, args, signInBuilt);
32999
- if (name === SIGN_IN_CARD_TOOL && specs.includes(SIGN_IN)) return showSignIn(ctx, args);
33072
+ const inAppWords = (result) => {
33073
+ const browser = appBrowser();
33074
+ const content = result.structuredContent;
33075
+ if (!browser || !content || typeof content.sign_in !== "object" || content.sign_in === null) return result;
33076
+ return {
33077
+ ...result,
33078
+ structuredContent: { ...content, sign_in: { ...content.sign_in, app_browser: browser.label } }
33079
+ };
33080
+ };
33081
+ if (name === TASTE_CARD_TOOL2 && specs.includes(TASTE)) return inAppWords(await showTaste(ctx, args, signInBuilt));
33082
+ if (name === PLANS_CARD_TOOL && specs.includes(PLANS)) return inAppWords(await showPlans(ctx, signInBuilt));
33083
+ if (name === CHECKOUT_TOOL && specs.includes(PLANS)) return inAppWords(await checkout(ctx, args, signInBuilt));
33084
+ if (name === SIGN_IN_CARD_TOOL && specs.includes(SIGN_IN)) {
33085
+ return showSignIn(ctx, args, appBrowser()?.label ?? null);
33086
+ }
33000
33087
  if (name === CHAT_SIGN_IN_TOOL && specs.includes(SIGN_IN)) {
33001
- return chatSignIn(ctx, options.login, args, set2 === Cards.All);
33088
+ return chatSignIn(ctx, options.login, args, set2 === Cards.All, appBrowser());
33002
33089
  }
33003
33090
  if (name === CHAT_GUEST_TOOL && specs.includes(SIGN_IN)) return chatGuest(ctx);
33004
33091
  return null;
@@ -33213,7 +33300,7 @@ var init_cards = __esm({
33213
33300
  "openai/widgetHeightHint": 180
33214
33301
  }
33215
33302
  };
33216
- specsIn = (set2) => set2 === Cards.All ? [TASTE, PLANS, SIGN_IN] : set2 === Cards.Taste ? [TASTE, SIGN_IN] : [];
33303
+ specsIn = (set2) => set2 === Cards.All ? [TASTE, PLANS, SIGN_IN] : set2 === Cards.Taste ? [TASTE] : [];
33217
33304
  reads = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
33218
33305
  acts = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true };
33219
33306
  icons = () => KOMBAI_ICONS.map((icon) => ({ ...icon, sizes: [...icon.sizes] }));
@@ -33349,9 +33436,9 @@ var init_stdio3 = __esm({
33349
33436
 
33350
33437
  // src/mcp/view-html.js
33351
33438
  function viewHtml(version2, host, options = {}) {
33352
- return VIEW_HTML.replace("{{CLI_VERSION}}", version2).replaceAll("{{HOST_LABEL}}", host.label).replaceAll("{{HOST_EMBED}}", host.embed).replace("{{CLAIM_RETRY_MS}}", String(options.claimRetryMs ?? CLAIM_RETRY_MS)).replace("{{COVER_MS}}", String(options.coverMs ?? COVER_MS)).replace("{{RECHECK_MS}}", String(options.recheckMs ?? RECHECK_MS)).replace("{{MANAGE_WAIT_MS}}", String(options.manageWaitMs ?? MANAGE_WAIT_MS)).replace("{{DOWNLOAD_WAIT_MS}}", String(options.downloadWaitMs ?? DOWNLOAD_WAIT_MS));
33439
+ return SERVED_HTML.replace("{{CLI_VERSION}}", version2).replaceAll("{{BROWSER}}", host.browserLink ? `${host.label}\\u2019s browser` : "your browser").replaceAll("{{HOST_LABEL}}", host.label).replaceAll("{{HOST_EMBED}}", host.embed).replace("{{CLAIM_RETRY_MS}}", String(options.claimRetryMs ?? CLAIM_RETRY_MS)).replace("{{COVER_MS}}", String(options.coverMs ?? COVER_MS)).replace("{{RECHECK_MS}}", String(options.recheckMs ?? RECHECK_MS)).replace("{{MANAGE_WAIT_MS}}", String(options.manageWaitMs ?? MANAGE_WAIT_MS)).replace("{{DOWNLOAD_WAIT_MS}}", String(options.downloadWaitMs ?? DOWNLOAD_WAIT_MS));
33353
33440
  }
33354
- var VIEW_HTML, CLAIM_RETRY_MS, COVER_MS, RECHECK_MS, MANAGE_WAIT_MS, DOWNLOAD_WAIT_MS;
33441
+ var VIEW_HTML, CLAIM_RETRY_MS, COVER_MS, RECHECK_MS, MANAGE_WAIT_MS, DOWNLOAD_WAIT_MS, SERVED_HTML;
33355
33442
  var init_view_html = __esm({
33356
33443
  "src/mcp/view-html.js"() {
33357
33444
  "use strict";
@@ -33363,50 +33450,82 @@ var init_view_html = __esm({
33363
33450
  <meta name="viewport" content="width=device-width,initial-scale=1">
33364
33451
  <title>Kombai</title>
33365
33452
  <style>
33366
- html,body{margin:0;height:100%;overflow:hidden;font:13px system-ui,sans-serif;color:#272c31;background:#fcfbf4}
33367
- html.dark body{color:#f1f3f5;background:#1e1e1e}
33453
+ html,body{margin:0;height:100%;overflow:hidden;font:13px system-ui,sans-serif;color:#1a1a1a;background:#fcfbf4}
33454
+ html.dark body{color:#f0f0f0;background:#1e1e1e}
33368
33455
  #frame{position:fixed;inset:0;width:100%;height:100%;border:0;display:none;background:transparent}
33369
- #screen{position:fixed;inset:0;display:grid;place-items:center;text-align:center;padding:24px}
33370
- #screen.over{z-index:3;background:rgba(252,251,244,.72);backdrop-filter:blur(2px)}
33456
+ #screen{position:fixed;inset:0;display:grid;place-items:center;text-align:center;padding:40px 32px 48px;--sec:#4c4b4a;--ter:#747472;--line:#e2e2de;--shine:#1a1a1a}
33457
+ html.dark #screen,html.dark #link,html.dark #notice{--sec:#c4c4c4;--ter:#979797;--line:#3a3a3a;--shine:#fff}
33458
+ #screen.over{z-index:3;padding:24px;background:rgba(252,251,244,.72);backdrop-filter:blur(2px)}
33371
33459
  html.dark #screen.over{background:rgba(20,20,20,.72)}
33372
- #panel{max-width:380px}
33373
- #screen.over #panel{text-align:left;padding:24px;border:1px solid #e3e5e8;border-radius:12px;background:#fff;box-shadow:0 8px 28px rgba(0,0,0,.12)}
33374
- html.dark #screen.over #panel{background:#262626;border-color:#3a3a3a;box-shadow:0 8px 28px rgba(0,0,0,.4)}
33375
- #screen b{display:block;font-size:16px;font-weight:600;margin-bottom:6px}
33376
- #screen p{margin:0 0 16px;color:#68717b;max-width:36em;line-height:1.5}
33377
- html.dark #screen p{color:#9aa3ad}
33378
- #code{display:inline-block;margin:0 0 16px;padding:6px 12px;border:1px solid #d8dbdf;border-radius:8px;background:rgba(0,0,0,.03);font:600 20px ui-monospace,Menlo,monospace;letter-spacing:.08em}
33379
- html.dark #code{border-color:#444;background:rgba(255,255,255,.05)}
33380
- #actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
33381
- #screen.over #actions{justify-content:flex-start}
33382
- #actions.stack{flex-direction:column;align-items:stretch}
33383
- #actions.stack button{text-align:left}
33384
- button{font:inherit;padding:7px 14px;border-radius:8px;border:1px solid #c9ccd1;background:#fff;color:#272c31;cursor:pointer}
33385
- html.dark button{background:#2a2a2a;color:#f1f3f5;border-color:#444}
33460
+ #panel{width:100%;max-width:340px}
33461
+ #screen.over #panel{text-align:left;padding:24px;box-sizing:border-box;border:1px solid var(--line);border-radius:10px;background:#fff;box-shadow:0 12px 32px rgba(0,0,0,.12),0 2px 6px rgba(0,0,0,.05)}
33462
+ html.dark #screen.over #panel{background:#262626;box-shadow:0 12px 32px rgba(0,0,0,.4)}
33463
+ #head{display:flex;flex-direction:column;align-items:center;gap:16px}
33464
+ #screen.over #head{flex-direction:row;gap:8px}
33465
+ #lead{display:flex;color:var(--sec)}
33466
+ #lead:empty,#title:empty{display:none}
33467
+ #screen.warn #lead{color:#e8a418}
33468
+ html.dark #screen.warn #lead{color:#f59e0b}
33469
+ #screen.ok #lead{color:#17864f}
33470
+ html.dark #screen.ok #lead{color:#48de94}
33471
+ .ic{width:32px;height:32px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:none}
33472
+ #screen.over .ic{width:18px;height:18px;stroke-width:2}
33473
+ .sm,#screen.over .sm{width:16px;height:16px;stroke-width:2}
33474
+ .spin{animation:spin 1s linear infinite}
33475
+ @keyframes spin{to{transform:rotate(360deg)}}
33476
+ #title{display:block;font-size:20px;line-height:28px;font-weight:600;letter-spacing:-.012em;text-wrap:balance}
33477
+ #screen.over #title{font-size:16px;line-height:24px;letter-spacing:0}
33478
+ #screen p{margin:8px 0 0;color:var(--sec);font-size:14px;line-height:22px;text-wrap:pretty}
33479
+ #screen.over p{margin-top:6px}
33480
+ /* A loading screen: the name, with a shine sweeping left to right, and the line under it. */
33481
+ #screen.load #title{color:transparent;background:linear-gradient(90deg,var(--ter) 40%,var(--shine) 50%,var(--ter) 60%) 100% 0/200% 100%;-webkit-background-clip:text;background-clip:text;animation:shine 1.8s linear infinite}
33482
+ @keyframes shine{to{background-position:0 0}}
33483
+ #code{display:grid;place-items:center;height:56px;margin-top:20px;border:1px solid var(--line);border-radius:8px;background:#f4f3ee;font:600 22px ui-monospace,Menlo,monospace;letter-spacing:.14em}
33484
+ html.dark #code{background:#2b2b2b}
33485
+ #wait{display:flex;align-items:center;gap:8px;margin-top:20px;color:var(--ter);font-size:12.5px;line-height:18px}
33486
+ #screen:not(.over) #wait{justify-content:center}
33487
+ #actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:24px}
33488
+ #actions:empty{display:none}
33489
+ #screen.over #actions{justify-content:flex-end}
33490
+ #actions.stack{flex-direction:column;align-items:stretch;margin-top:20px}
33491
+ button{font:500 12px system-ui,sans-serif;height:32px;padding:0 16px;border-radius:6px;border:0;background:transparent;color:inherit;cursor:pointer}
33492
+ button:hover{background:rgba(26,26,26,.06)}
33493
+ html.dark button:hover{background:rgba(255,255,255,.08)}
33386
33494
  button:focus-visible{outline:2px solid #48de94;outline-offset:1px}
33387
- /* Both selectors: html.dark button would otherwise win over a lone button.primary and grey the main action out. */
33388
- button.primary,html.dark button.primary{background:#48de94;color:#151615;border-color:#48de94;font-weight:600}
33389
- button.primary:hover,html.dark button.primary:hover{background:#3bc583;border-color:#3bc583}
33390
- #link{position:fixed;left:0;right:0;top:0;display:none;align-items:center;gap:10px;padding:8px 12px;background:#fff;border-bottom:1px solid #e3e5e8;box-shadow:0 2px 8px rgba(0,0,0,.08);z-index:2}
33391
- html.dark #link{background:#262626;border-color:#3a3a3a}
33392
- #link span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
33393
- #notice{position:fixed;left:0;right:0;top:0;display:none;align-items:center;gap:10px;padding:8px 12px;background:#fff;border-bottom:1px solid #e3e5e8;box-shadow:0 2px 8px rgba(0,0,0,.08);z-index:2}
33394
- html.dark #notice{background:#262626;border-color:#3a3a3a}
33395
- #notice span{flex:1;min-width:0}
33495
+ button.primary{min-width:120px;background:#48de94;color:#151615}
33496
+ button.primary:hover,html.dark button.primary:hover{background:#3bc583}
33497
+ #link button,#notice button{min-width:0;flex:none}
33498
+ #actions .org{display:flex;align-items:center;gap:12px;height:44px;padding:0 12px 0 8px;border:1px solid var(--line);background:#fff;text-align:left;font:500 14px system-ui,sans-serif}
33499
+ #actions .org:hover{border-color:#b0b0ad;background:#fafaf7}
33500
+ html.dark #actions .org{background:#262626}
33501
+ html.dark #actions .org:hover{border-color:#5a5a5a;background:#2b2b2b}
33502
+ .org i{display:grid;place-items:center;width:28px;height:28px;flex:none;border-radius:6px;background:#efeee8;color:var(--sec);font:600 12px system-ui,sans-serif}
33503
+ html.dark .org i{background:#333}
33504
+ .org span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
33505
+ .org .sm{color:var(--ter)}
33506
+ #link,#notice{position:fixed;left:0;right:0;top:0;display:none;align-items:center;gap:10px;min-height:48px;box-sizing:border-box;padding:8px 8px 8px 14px;background:#fff;border-bottom:1px solid var(--line);box-shadow:0 1px 3px rgba(0,0,0,.05);z-index:2;--sec:#4c4b4a;--line:#e2e2de}
33507
+ html.dark #link,html.dark #notice{background:#262626}
33508
+ #link>span,#notice>span{flex:1;min-width:0;color:var(--sec);line-height:20px;text-wrap:pretty}
33509
+ #link b,#notice b{font-weight:500;color:#1a1a1a}
33510
+ html.dark #link b,html.dark #notice b{color:#f0f0f0}
33511
+ #link .sm{color:var(--sec)}
33512
+ #notice .sm{color:#e8a418}
33513
+ html.dark #notice .sm{color:#f59e0b}
33396
33514
  /* The cover over a page being replaced: a veil in the view's background that takes every click, under the hosted
33397
33515
  page's logo loader (components/ui/loader.tsx LogoLoader) as CSS can draw it: the logo's fill, size and glow. */
33398
33516
  #cover{position:fixed;inset:0;z-index:1;display:grid;place-items:center;cursor:progress;background:rgba(252,251,244,.6)}
33399
33517
  html.dark #cover{background:rgba(30,30,30,.6)}
33400
33518
  #cover::after{content:'';width:56px;height:56px;border-radius:10px;background:#48de94;animation:glow 1.5s ease-in-out infinite alternate}
33401
33519
  @keyframes glow{from{opacity:.35;filter:drop-shadow(0 0 0 rgba(72,222,148,0))}to{opacity:1;filter:drop-shadow(0 0 16px rgba(72,222,148,.55))}}
33402
- @media (prefers-reduced-motion:reduce){#cover::after{animation:none}}
33520
+ @media (prefers-reduced-motion:reduce){#cover::after,.spin,#screen.load #title{animation:none}#screen.load #title{color:inherit;background:none}}
33403
33521
  [hidden]{display:none!important}
33404
33522
  </style>
33405
33523
  </head>
33406
33524
  <body>
33407
- <div id="screen" role="status"><div id="panel"><b id="title">Kombai</b><p id="body">Connecting to {{HOST_LABEL}}…</p><code id="code" hidden></code><div id="actions"></div></div></div>
33408
- <div id="link"><span id="link-text"></span><button id="link-open" class="primary" type="button">Open</button><button id="link-dismiss" type="button">Not now</button></div>
33409
- <div id="notice"><span>Sign-in didn't finish.</span><button id="notice-retry" class="primary" type="button">Try again</button></div>
33525
+ <svg hidden><symbol id="i-app" viewBox="0 0 24 24"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="M10 4v4"/><path d="M2 8h20"/><path d="M6 4v4"/></symbol><symbol id="i-canvas" viewBox="0 0 24 24"><path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"/><path d="M5 3a2 2 0 0 0-2 2"/><path d="M19 3a2 2 0 0 1 2 2"/><path d="M5 21a2 2 0 0 1-2-2"/><path d="M9 3h1"/><path d="M9 21h2"/><path d="M14 3h1"/><path d="M3 9v1"/><path d="M21 9v2"/><path d="M3 14v1"/></symbol><symbol id="i-login" viewBox="0 0 24 24"><path d="m10 17 5-5-5-5"/><path d="M15 12H3"/><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/></symbol><symbol id="i-org" viewBox="0 0 24 24"><path d="M10 12h4"/><path d="M10 8h4"/><path d="M14 21v-3a2 2 0 0 0-4 0v3"/><path d="M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2"/><path d="M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16"/></symbol><symbol id="i-spin" viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></symbol><symbol id="i-wait" viewBox="0 0 24 24"><path d="M5 22h14"/><path d="M5 2h14"/><path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"/><path d="M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"/></symbol><symbol id="i-msg" viewBox="0 0 24 24"><path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/><path d="M7 11h10"/><path d="M7 15h6"/><path d="M7 7h8"/></symbol><symbol id="i-unplug" viewBox="0 0 24 24"><path d="m19 5 3-3"/><path d="m2 22 3-3"/><path d="M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z"/><path d="M7.5 13.5 10 11"/><path d="M10.5 16.5 13 14"/><path d="m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z"/></symbol><symbol id="i-alert" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></symbol><symbol id="i-link" viewBox="0 0 24 24"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></symbol><symbol id="i-next" viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></symbol></svg>
33526
+ <div id="screen" class="load" role="status"><div id="panel"><div id="head"><span id="lead"></span><b id="title">Kombai</b></div><p id="body">Connecting to {{HOST_LABEL}}…</p><code id="code" hidden></code><div id="actions"></div><div id="wait" hidden><svg class="ic sm spin" aria-hidden="true"><use href="#i-spin"/></svg><span id="wait-text"></span></div></div></div>
33527
+ <div id="link"><svg class="ic sm" aria-hidden="true"><use href="#i-link"/></svg><span id="link-text"></span><button id="link-dismiss" type="button">Not now</button><button id="link-open" class="primary" type="button">Open</button></div>
33528
+ <div id="notice"><svg class="ic sm" aria-hidden="true"><use href="#i-alert"/></svg><span><b>Sign-in didn't finish.</b> Your canvas is still moving into your account.</span><button id="notice-retry" class="primary" type="button">Try again</button></div>
33410
33529
  <iframe id="frame" title="Kombai canvas" allow="clipboard-write"></iframe>
33411
33530
  <div id="cover" role="status" aria-label="Loading" hidden></div>
33412
33531
  <script>
@@ -33435,6 +33554,8 @@ html.dark #cover{background:rgba(30,30,30,.6)}
33435
33554
  var body = document.getElementById('body');
33436
33555
  var actions = document.getElementById('actions');
33437
33556
  var code = document.getElementById('code');
33557
+ var lead = document.getElementById('lead');
33558
+ var wait = document.getElementById('wait');
33438
33559
  var frame = document.getElementById('frame');
33439
33560
  var linkBar = document.getElementById('link');
33440
33561
  var linkText = document.getElementById('link-text');
@@ -33442,26 +33563,46 @@ html.dark #cover{background:rgba(30,30,30,.6)}
33442
33563
  var cover = document.getElementById('cover');
33443
33564
 
33444
33565
  // opts.code: a match code, shown on its own line to compare with the browser's. opts.over: drawn over the framed
33445
- // canvas, which stays as it is underneath, so closing the screen needs no reload. opts.stack: one button per row.
33566
+ // canvas, which stays as it is underneath, so closing the screen needs no reload. opts.stack: one organization per
33567
+ // row. opts.icon: a symbol in the sprite (#i-<icon>), drawn above the title; over the canvas only the spinner is,
33568
+ // beside it. opts.tone: 'warn' or 'ok', the icon's colour. opts.load: a loading screen, the name with a shine over
33569
+ // it and the line under it. opts.wait: a line under a spinner at the foot.
33446
33570
  function show(t, b, buttons, opts) {
33447
33571
  opts = opts || {};
33448
33572
  unwatch();
33573
+ var over = !!opts.over && framed();
33449
33574
  title.textContent = t;
33450
33575
  body.textContent = b;
33451
33576
  code.textContent = opts.code || '';
33452
33577
  code.hidden = !opts.code;
33578
+ // Only fixed markup goes in here: the sprite's ids, never a server string.
33579
+ var icon = over && opts.icon !== 'spin' ? '' : opts.icon;
33580
+ lead.innerHTML = icon && !opts.load
33581
+ ? '<svg class="ic' + (icon === 'spin' ? ' spin' : '') + '" aria-hidden="true"><use href="#i-' + icon + '"/></svg>' : '';
33582
+ document.getElementById('wait-text').textContent = opts.wait || '';
33583
+ wait.hidden = !opts.wait;
33453
33584
  actions.textContent = '';
33454
33585
  actions.className = opts.stack ? 'stack' : '';
33455
33586
  (buttons || []).forEach(function (spec) {
33456
33587
  var button = document.createElement('button');
33457
33588
  button.type = 'button';
33458
- button.textContent = spec.label;
33459
- if (spec.primary) button.className = 'primary';
33589
+ if (spec.org) {
33590
+ // An organization's row: its first letter, its name, and a chevron. The name only ever goes in as text.
33591
+ button.className = 'org';
33592
+ var initial = document.createElement('i');
33593
+ initial.textContent = (Array.from(spec.label.trim())[0] || '').toUpperCase();
33594
+ var name = document.createElement('span');
33595
+ name.textContent = spec.label;
33596
+ button.append(initial, name);
33597
+ button.insertAdjacentHTML('beforeend', '<svg class="ic sm" aria-hidden="true"><use href="#i-next"/></svg>');
33598
+ } else {
33599
+ button.textContent = spec.label;
33600
+ if (spec.primary) button.className = 'primary';
33601
+ }
33460
33602
  button.addEventListener('click', spec.onClick);
33461
33603
  actions.appendChild(button);
33462
33604
  });
33463
- var over = !!opts.over && framed();
33464
- screen.classList.toggle('over', over);
33605
+ screen.className = [over ? 'over' : '', opts.load ? 'load' : '', opts.tone || ''].join(' ').trim();
33465
33606
  screen.hidden = false;
33466
33607
  notice.style.display = 'none';
33467
33608
  // A screen replaces the cover over a page switch; one drawn over the page leaves the page as it is.
@@ -33496,7 +33637,10 @@ html.dark #cover{background:rgba(30,30,30,.6)}
33496
33637
  });
33497
33638
  function closeScreen() { screen.hidden = true; screen.classList.remove('over'); }
33498
33639
 
33499
- if (window.parent === window) { show('Kombai', 'Open this view from ' + HOST_LABEL + '.'); return; }
33640
+ if (window.parent === window) {
33641
+ show('Open this from ' + HOST_LABEL, 'This page runs inside ' + HOST_LABEL + '. Open Kombai from a ' + HOST_LABEL + ' chat.', [], { icon: 'app' });
33642
+ return;
33643
+ }
33500
33644
 
33501
33645
  var pending = {};
33502
33646
  var next = 1;
@@ -33808,7 +33952,11 @@ html.dark #cover{background:rgba(30,30,30,.6)}
33808
33952
  offeredUrl = url;
33809
33953
  var host = '';
33810
33954
  try { host = new URL(url).host; } catch (e) { host = url; }
33811
- linkText.textContent = 'Open ' + host + ' in your browser?';
33955
+ // The host only ever goes in as text.
33956
+ var bold = document.createElement('b');
33957
+ bold.textContent = host;
33958
+ linkText.textContent = 'Open ';
33959
+ linkText.append(bold, ' in your browser?');
33812
33960
  linkBar.style.display = 'flex';
33813
33961
  }
33814
33962
  document.getElementById('link-open').addEventListener('click', function () {
@@ -33889,22 +34037,28 @@ html.dark #cover{background:rgba(30,30,30,.6)}
33889
34037
  if (typeof answer.canvas === 'string') canvas = answer.canvas;
33890
34038
  if (typeof answer.node === 'string') node = answer.node;
33891
34039
  }
33892
- var SIGNING_IN = 'Finish in the browser; this view follows.';
33893
- var CHECK_CODE = 'Check that your browser shows this code, then approve. This view follows.';
34040
+ var SIGNING_IN = 'Kombai\u2019s sign-in is open in {{BROWSER}}. This view follows.';
34041
+ var CHECK_CODE = 'Check that {{BROWSER}} shows this code, then approve.';
34042
+ var APPROVE_IN = 'Approve in {{BROWSER}}';
34043
+ var OPENS_IN = 'Kombai\u2019s sign-in opens in {{BROWSER}}';
34044
+ var WAITING_FOR = 'Waiting for {{BROWSER}}';
34045
+ var approveLink = null;
34046
+ function openApproval() { if (approveLink) request('ui/open-link', { url: approveLink }).catch(function () {}); }
33894
34047
  // replace: the framed page is of no use behind the screen (it could not redeem its ticket), so the screen takes its
33895
34048
  // place, as with nothing framed.
33896
34049
  function signInScreen(message, replace) {
34050
+ // Not now, when there is one, comes first: the filled Sign in ends the row.
33897
34051
  var buttons = [{ label: 'Sign in', primary: true, onClick: function () { signIn(); } }];
33898
34052
  // Over a framed canvas (a guest's, whose page asked to sign in): Not now just closes this, and the canvas is as it
33899
34053
  // was. A frame loaded but hidden by an earlier screen opens again; with none there is nothing to go back to.
33900
34054
  if (framed() && !replace) {
33901
- buttons.push({ label: 'Not now', onClick: closeScreen });
33902
- show('Sign in to Kombai', message || 'Your guest canvas comes with you, at the same link. Kombai\u2019s sign-in opens in your browser.', buttons, { over: true });
34055
+ buttons.unshift({ label: 'Not now', onClick: closeScreen });
34056
+ show('Sign in to Kombai', message || 'Your guest canvas comes with you, at the same link. ' + OPENS_IN + '.', buttons, { over: true });
33903
34057
  return;
33904
34058
  }
33905
- if (frame.getAttribute('src')) buttons.push({ label: 'Not now', onClick: function () { open(); } });
33906
- var title = canvas ? 'Sign in to Kombai to see this canvas' : 'Sign in to Kombai to see your canvases';
33907
- show(title, message || 'Kombai\u2019s sign-in opens in your browser; this view follows.', buttons);
34059
+ if (frame.getAttribute('src')) buttons.unshift({ label: 'Not now', onClick: function () { open(); } });
34060
+ var title = canvas ? 'Sign in to see this canvas' : 'Sign in to see your canvases';
34061
+ show(title, message || OPENS_IN + '. This view follows.', buttons, { icon: 'login' });
33908
34062
  watch('not_signed_in');
33909
34063
  }
33910
34064
 
@@ -33925,39 +34079,47 @@ html.dark #cover{background:rgba(30,30,30,.6)}
33925
34079
  showFrame(null);
33926
34080
  return true;
33927
34081
  }
33928
- if (answer.status === 'no_canvas') { show('Kombai', 'Ask your agent to make a design.'); watch('no_canvas'); return true; }
34082
+ if (answer.status === 'no_canvas') {
34083
+ show('No canvas yet', 'Ask your agent to make a design. It opens here once it\u2019s made.', [], { icon: 'canvas' });
34084
+ watch('no_canvas');
34085
+ return true;
34086
+ }
33929
34087
  if (answer.status === 'needs_org') {
33930
34088
  var buttons = (Array.isArray(answer.orgs) ? answer.orgs : [])
33931
34089
  .filter(function (org) {
33932
34090
  return org && typeof org.name === 'string' && typeof org.id === 'string' && /^[A-Za-z0-9_-]{1,64}$/.test(org.id);
33933
34091
  })
33934
- .map(function (org) { return { label: org.name, onClick: function () { claim(org.id); } }; });
34092
+ .map(function (org) { return { label: org.name, org: true, onClick: function () { claim(org.id); } }; });
33935
34093
  if (!buttons.length) { askAgent(); return true; }
33936
- show('Choose where this canvas goes', 'You\u2019re in more than one organization. The canvas moves into the one you pick.', buttons, { over: true, stack: true });
34094
+ show('Choose where this canvas goes', 'You\u2019re in more than one organization. The canvas moves into the one you pick.', buttons, { over: true, stack: true, icon: 'org' });
33937
34095
  return true;
33938
34096
  }
33939
34097
  if (answer.status === 'claim_pending') {
33940
34098
  if (claimTries < CLAIM_TRIES) {
33941
34099
  claimTries++;
33942
- show('Finishing sign-in', 'Moving this canvas into your account…');
34100
+ show('Finishing sign-in', 'Moving this canvas into your account…', [], { icon: 'spin', tone: 'ok' });
33943
34101
  retryTimer = setTimeout(function () { open(true); }, CLAIM_RETRY_MS);
33944
34102
  return true;
33945
34103
  }
33946
- // Still not moved: the guest canvas stays usable meanwhile.
34104
+ // Still not moved: the guest canvas stays usable meanwhile, under the notice's Try again. With no canvas to
34105
+ // frame, the screen has Try again itself.
33947
34106
  if (typeof answer.ticket === 'string' && typeof answer.hosted === 'string') {
33948
34107
  hosted = answer.hosted;
33949
34108
  showFrame(answer.ticket);
34109
+ notice.style.display = 'flex';
33950
34110
  } else {
33951
- show('Kombai', 'Your canvas is still moving into your account.');
34111
+ show('Sign-in didn\u2019t finish', 'Your canvas is still moving into your account.',
34112
+ [{ label: 'Try again', primary: true, onClick: retryClaim }], { icon: 'wait', tone: 'warn' });
33952
34113
  }
33953
- notice.style.display = 'flex';
33954
34114
  return true;
33955
34115
  }
33956
34116
  return false;
33957
34117
  }
33958
34118
  function claim(orgId) {
33959
- show('Signing in…', 'Moving this canvas into your account…', [], { over: true });
33960
- callTool(SESSION_TOOL, sessionArgs({ claimOrg: orgId })).then(settle, function (error) { show('Kombai', error.message); });
34119
+ show('Signing in…', 'Moving this canvas into your account…', [], { over: true, icon: 'spin', tone: 'ok' });
34120
+ callTool(SESSION_TOOL, sessionArgs({ claimOrg: orgId })).then(settle, function (error) {
34121
+ show('Sign-in didn\u2019t finish', error.message, [], { icon: 'alert', tone: 'warn' });
34122
+ });
33961
34123
  }
33962
34124
  function settle(answer) {
33963
34125
  takeIds(answer);
@@ -33966,13 +34128,15 @@ html.dark #cover{background:rgba(30,30,30,.6)}
33966
34128
  else askAgent();
33967
34129
  }
33968
34130
  function askAgent() {
33969
- show('Kombai', canvas ? 'Ask your agent to open this canvas again.' : 'Ask your agent to open Kombai again.');
34131
+ if (canvas) show('This canvas didn\u2019t open', 'Ask your agent to open it again.', [], { icon: 'msg' });
34132
+ else show('Kombai didn\u2019t open', 'Ask your agent to open Kombai again.', [], { icon: 'msg' });
33970
34133
  }
33971
- document.getElementById('notice-retry').addEventListener('click', function () {
34134
+ function retryClaim() {
33972
34135
  claimTries = 0;
33973
34136
  notice.style.display = 'none';
33974
34137
  open();
33975
- });
34138
+ }
34139
+ document.getElementById('notice-retry').addEventListener('click', retryClaim);
33976
34140
 
33977
34141
  // The first call asks with no wait, so the match code is on screen before the person approves in the browser, as
33978
34142
  // the sign-in card's first call does; each later call waits for the approval. A call that brings no code keeps the
@@ -33980,10 +34144,18 @@ html.dark #cover{background:rgba(30,30,30,.6)}
33980
34144
  function signIn(code, polling) {
33981
34145
  clearTimeout(retryTimer);
33982
34146
  signingIn = true;
33983
- show('Approve in your browser', code ? CHECK_CODE : SIGNING_IN, [], { code: code, over: true });
34147
+ if (!polling) approveLink = null;
34148
+ var again = approveLink ? [{ label: 'Open the page again', onClick: openApproval }] : [];
34149
+ show(APPROVE_IN, code ? CHECK_CODE : SIGNING_IN, again, { code: code, over: true, icon: 'login', wait: WAITING_FOR });
33984
34150
  callTool(SESSION_TOOL, sessionArgs({ signIn: true, wait: polling ? SIGN_IN_WAIT_S : 0 })).then(function (answer) {
33985
34151
  takeIds(answer);
33986
34152
  if (answer.status === 'signing_in') {
34153
+ // Opened once per login (openNow, the CLI's firstOpen): a Sign in pressed again, or a login the card started,
34154
+ // keeps the page that is already open and only offers Open the page again.
34155
+ if (typeof answer.openLink === 'string') {
34156
+ approveLink = answer.openLink;
34157
+ if (answer.openNow === true) openApproval();
34158
+ }
33987
34159
  signIn(typeof answer.matchCode === 'string' && answer.matchCode ? answer.matchCode : code, true);
33988
34160
  return;
33989
34161
  }
@@ -33993,6 +34165,8 @@ html.dark #cover{background:rgba(30,30,30,.6)}
33993
34165
  }, function (error) { signingIn = false; signInScreen(error.message); });
33994
34166
  }
33995
34167
 
34168
+ function couldNotOpen(message) { show('Couldn\u2019t open Kombai', message, [], { icon: 'unplug', tone: 'warn' }); }
34169
+
33996
34170
  // retry is the claim's own timer: the screen it set stays. A page on screen stays there under the cover until the
33997
34171
  // next one loads; with none, the opening screen. Only the latest open's answer is used: an earlier one's frames
33998
34172
  // nothing, however late it comes.
@@ -34006,12 +34180,12 @@ html.dark #cover{background:rgba(30,30,30,.6)}
34006
34180
  framedGuest = false;
34007
34181
  coverFrame();
34008
34182
  } else if (!retry) {
34009
- show('Kombai', canvas ? 'Opening the canvas…' : 'Opening Kombai…');
34183
+ show('Kombai', canvas ? 'Opening the canvas…' : 'Opening Kombai…', [], { load: true });
34010
34184
  }
34011
34185
  callTool(SESSION_TOOL, sessionArgs()).then(function (answer) {
34012
34186
  if (mine === opens) settle(answer);
34013
34187
  }, function (error) {
34014
- if (mine === opens) show('Kombai', error.message);
34188
+ if (mine === opens) couldNotOpen(error.message);
34015
34189
  });
34016
34190
  }
34017
34191
 
@@ -34030,14 +34204,16 @@ html.dark #cover{background:rgba(30,30,30,.6)}
34030
34204
  // panel with no call gets none.
34031
34205
  return Promise.race([resultSeen, new Promise(function (resolve) { setTimeout(resolve, RESULT_WAIT_MS); })]);
34032
34206
  }).then(function () {
34033
- if (openingError !== null) { show('Kombai', openingError); return; }
34207
+ if (openingError !== null) { couldNotOpen(openingError); return; }
34034
34208
  // No canvas (the view opened from Codex's app menu, or a thread's panel with no canvas_app call): every canvas the
34035
34209
  // person may see, from which open-canvas opens one.
34036
34210
  var result = openingResult || openingArgs;
34037
34211
  canvas = result && typeof result.canvas === 'string' ? result.canvas : null;
34038
34212
  node = result && typeof result.node === 'string' ? result.node : null;
34039
34213
  open();
34040
- }).catch(function (error) { show('Kombai', 'Could not connect to ' + HOST_LABEL + ': ' + error.message); });
34214
+ }).catch(function (error) {
34215
+ show('Couldn\u2019t connect to ' + HOST_LABEL, error.message, [], { icon: 'unplug', tone: 'warn' });
34216
+ });
34041
34217
  })();
34042
34218
  </script>
34043
34219
  </body>
@@ -34047,6 +34223,7 @@ html.dark #cover{background:rgba(30,30,30,.6)}
34047
34223
  RECHECK_MS = 2e4;
34048
34224
  MANAGE_WAIT_MS = 6e4;
34049
34225
  DOWNLOAD_WAIT_MS = 12e4;
34226
+ SERVED_HTML = VIEW_HTML.replace(/^[ \t]+/gm, "").replace(/^\/\/.*\n/gm, "");
34050
34227
  }
34051
34228
  });
34052
34229
 
@@ -34069,10 +34246,15 @@ function createMcpServer(ctx, options = {}) {
34069
34246
  const resourceUri = versionedUri(RESOURCE_URI_BASE, ctx.version);
34070
34247
  const clientName = () => server.getClientVersion()?.name ?? server.rawClientName;
34071
34248
  const viewHost = () => viewHostFor(clientName(), server.showsAppViews, place);
34249
+ server.instructionsFor = () => viewHost()?.clientName === CODEX_CLIENT_NAME ? CODEX_INSTRUCTIONS : INSTRUCTIONS;
34072
34250
  const cardSet = () => cardsFor(clientName(), server.showsAppViews, place);
34073
- const login2 = createLoginRunner(ctx);
34251
+ const appBrowser = () => {
34252
+ const host = viewHost();
34253
+ return host?.browserLink ? { label: host.label, link: host.browserLink } : null;
34254
+ };
34255
+ const login2 = createLoginRunner(ctx, { inApp: () => appBrowser() !== null });
34074
34256
  const callSession = createSessionTool(ctx, { login: login2 });
34075
- const cards = createCards(ctx, { dir: options.cardsDir, login: login2 });
34257
+ const cards = createCards(ctx, { dir: options.cardsDir, login: login2, appBrowser });
34076
34258
  const downloadsDir = path20.join(place.osHome, "Downloads");
34077
34259
  const resourceMeta = async () => {
34078
34260
  const { hosts } = await currentEnv(ctx);
@@ -34211,6 +34393,12 @@ var init_server3 = __esm({
34211
34393
  * which is after `oninitialized` when the first frames arrive in one chunk. */
34212
34394
  /** @type {string | undefined} */
34213
34395
  rawClientName = void 0;
34396
+ /** The id of the client's `initialize`, whose answer carries the instructions. */
34397
+ /** @type {string | number | undefined} */
34398
+ initializeId = void 0;
34399
+ /** This client's instructions, read when `initialize` is answered; unset, the constructor's go to every client. */
34400
+ /** @type {(() => string) | undefined} */
34401
+ instructionsFor = void 0;
34214
34402
  /** @param {import('@modelcontextprotocol/sdk/shared/transport.js').Transport} transport */
34215
34403
  async connect(transport) {
34216
34404
  const next = transport.onmessage;
@@ -34223,11 +34411,25 @@ var init_server3 = __esm({
34223
34411
  this.showsAppViews = declaresMcpApps(params?.capabilities);
34224
34412
  const name = params?.clientInfo?.name;
34225
34413
  this.rawClientName = typeof name === "string" ? name : void 0;
34414
+ if ("id" in message) this.initializeId = message.id;
34226
34415
  }
34227
34416
  next?.(message, extra);
34228
34417
  };
34418
+ const send = transport.send.bind(transport);
34419
+ transport.send = (message, options) => send(this.withClientInstructions(message), options);
34229
34420
  await super.connect(transport);
34230
34421
  }
34422
+ /**
34423
+ * The answer to `initialize` with this client's instructions in place of the constructor's; any other message as
34424
+ * it is.
34425
+ * @param {import('@modelcontextprotocol/sdk/types.js').JSONRPCMessage} message
34426
+ * @returns {import('@modelcontextprotocol/sdk/types.js').JSONRPCMessage}
34427
+ */
34428
+ withClientInstructions(message) {
34429
+ if (!this.instructionsFor || !("result" in message) || message.id !== this.initializeId) return message;
34430
+ if (typeof message.result.instructions !== "string") return message;
34431
+ return { ...message, result: { ...message.result, instructions: this.instructionsFor() } };
34432
+ }
34231
34433
  };
34232
34434
  }
34233
34435
  });
@@ -34236,7 +34438,7 @@ var init_server3 = __esm({
34236
34438
  var actions_default;
34237
34439
  var init_actions = __esm({
34238
34440
  "src/skill/actions.md"() {
34239
- actions_default = '# Requests from the canvas\n\nThe user can ask for work from the hosted canvas: the page copies a message for them to paste into this\nchat, or, in the Kombai view beside the chat, puts it in the message box (an Add to context becomes a\ncontext item instead). Each request is one sentence, then a link on its own line (Add to context\'s is\none line with no sentence, below):\n\n On my Kombai canvas "Checkout redesign", make 3 variants of "Variant A" with improved styles.\n https://agent.kombai.com/c/cnv_8f2a1b9c3d7e?node=nd_31a\n\nThe link names the canvas (after /c/) and the design (?node=). One message can hold several requests,\nsplit by blank lines; do each. The user may add their own words; they win where they differ.\n\nFor a whole-canvas request, use `kombai canvas pull --canvas <link>` and follow the user\'s request.\nFor a node request, use `kombai node pull --canvas <link> --node <node>`; if you will change that design,\nrun `kombai node lock --canvas <link> --node <node>` before the pull. Read the HTML file it prints,\nand look at its thumbnail with `kombai screenshot wait --canvas <link> --node <node> --tiles`. An element\nnamed with data-kid="<id>" is the element with that attribute in the HTML.\n\nBefore writing or changing design HTML, read `kombai skill html`. When the request needs taste, read\n`kombai skill brief` first. A request copied from the canvas comes from a page the user has open: don\'t show\nthe canvas again. A canvas the user only named: show it once, as `kombai skill opening` says.\n\nThen do what the sentence asks:\n\n- **make 3 variants of "<label>"**, maybe with a direction (improved styles, structure, interactions or\n responsiveness, or "that improve the design") and a style in parentheses. Make 3 new designs with\n `kombai node start --canvas <id> --label "<label>" --parent <node>`, each a clear take on that\n direction and different from the others, keeping the content. Run taste first only when the request\n wants new ideas rather than a change of the same design.\n- **make a [dark mode] [mobile | tablet | laptop | custom-width] version of "<label>"**, maybe with a\n width and the user\'s instructions after a colon. One new design with --parent <node> and the content\n kept. Add `--viewport mobile` (390 px), `--viewport tablet` (768 px) or `--viewport desktop` (laptop,\n 1280 px) to node start. For a custom width, give the node its width before its first push, so the\n thumbnail is rendered once, at that width; a later width change drops it until the next\n `kombai screenshot fill`. After node start, set the node\'s rect w in canvas.json to that width and\n run `kombai canvas push --canvas <id>`, then write the HTML and push it. Dark mode: the same design\n in a dark palette. No taste: reflow, don\'t redesign.\n- **regenerate "<label>"**: write a fresh, better version of the same concept into the pulled file and\n push it to the same node. **with the "<name>" design system**: find its slug in `kombai ds list`, pull\n it (`kombai skill design-system`) and use its tokens.\n- **in "<label>", change the <element>: <what to do>**: edit only that element in the pulled file and\n push. Leave the rest of the design as it is.\n- **build "<label>" in this project**, or **build the <element> of "<label>"**: write it as code in this\n repo, in the repo\'s framework, components and styles, using the pulled HTML and the thumbnail as the\n reference. This changes the repo, not the canvas.\n- **"<label>" <link>**, **The <element> in "<label>" <link>** or **The canvas "<name>" <link>**: one line\n with no sentence (Add to context; in the Kombai view beside the chat it arrives as a context item titled\n with the name). Context for the user\'s own words in the same message. Use the pulled node or canvas and\n do what they ask; if they asked nothing, describe it and ask what they want.\n- **refer design system: <name>**: one line with no link (Add to context in the Design systems panel).\n Context for the user\'s own words in the same message: `kombai skill design-system` says how to find\n and pull it by name.\n\nA lock lasts 10 minutes: run node lock again for a longer edit, and before each fix after a push (the push\nends it). If you stop without pushing, or drop your edit with node pull --discard, run\n`kombai node unlock --canvas <link> --node <node>`. If node lock fails, go on without it; a drawing takes\nno lock.\n\nAfter a design\'s last HTML push, follow "Check a finished design" in the overview. When you are done,\ntell the user what changed; the canvas they have open shows it live.\n';
34441
+ actions_default = '# Requests from the canvas\n\nThe user can ask for work from the hosted canvas: the page copies a message for them to paste into this\nchat, or, in the Kombai view beside the chat, puts it in the message box (an Add to context becomes a\ncontext item instead). Each request is one sentence, then a link on its own line (Add to context\'s is\none line with no sentence, below):\n\n On my Kombai canvas "Checkout redesign", make 3 variants of "Variant A" with improved styles.\n https://agent.kombai.com/c/cnv_8f2a1b9c3d7e?node=nd_31a\n\nThe link names the canvas (after /c/) and the design (?node=). One message can hold several requests,\nsplit by blank lines; do each. The user may add their own words; they win where they differ.\n\nFor a whole-canvas request, use `kombai canvas pull --canvas <link>` and follow the user\'s request.\nFor a node request, use `kombai node pull --canvas <link> --node <node>`; if you will change that design,\nrun `kombai node lock --canvas <link> --node <node>` before the pull. Read the HTML file it prints,\nand look at its thumbnail with `kombai screenshot wait --canvas <link> --node <node> --tiles`. An element\nnamed with data-kid="<id>" is the element with that attribute in the HTML.\n\nBefore writing or changing design HTML, read `kombai skill html`. When the request needs taste, read\n`kombai skill brief` first. A request from the canvas (copied from its page, or put in the message box by the\nKombai view) comes from a canvas the user has open: don\'t show the canvas again. A canvas the user only named:\nshow it once, as `kombai skill opening` says.\n\nThen do what the sentence asks:\n\n- **make 3 variants of "<label>"**, maybe with a direction (improved styles, structure, interactions or\n responsiveness, or "that improve the design") and a style in parentheses. Make 3 new designs with\n `kombai node start --canvas <id> --label "<label>" --parent <node>`, each a clear take on that\n direction and different from the others, keeping the content. Run taste first only when the request\n wants new ideas rather than a change of the same design.\n- **make a [dark mode] [mobile | tablet | laptop | custom-width] version of "<label>"**, maybe with a\n width and the user\'s instructions after a colon. One new design with --parent <node> and the content\n kept. Add `--viewport mobile` (390 px), `--viewport tablet` (768 px) or `--viewport desktop` (laptop,\n 1280 px) to node start. For a custom width, give the node its width before its first push, so the\n thumbnail is rendered once, at that width; a later width change drops it until the next\n `kombai screenshot fill`. After node start, set the node\'s rect w in canvas.json to that width and\n run `kombai canvas push --canvas <id>`, then write the HTML and push it. Dark mode: the same design\n in a dark palette. No taste: reflow, don\'t redesign.\n- **regenerate "<label>"**: write a fresh, better version of the same concept into the pulled file and\n push it to the same node. **with the "<name>" design system**: find its slug in `kombai ds list`, pull\n it (`kombai skill design-system`) and use its tokens.\n- **in "<label>", change the <element>: <what to do>**: edit only that element in the pulled file and\n push. Leave the rest of the design as it is.\n- **build "<label>" in this project**, or **build the <element> of "<label>"**: write it as code in this\n repo, in the repo\'s framework, components and styles, using the pulled HTML and the thumbnail as the\n reference. This changes the repo, not the canvas.\n- **"<label>" <link>**, **The <element> in "<label>" <link>** or **The canvas "<name>" <link>**: one line\n with no sentence (Add to context; in the Kombai view beside the chat it arrives as a context item titled\n with the name). Context for the user\'s own words in the same message. Use the pulled node or canvas and\n do what they ask; if they asked nothing, describe it and ask what they want.\n- **refer design system: <name>**: one line with no link (Add to context in the Design systems panel).\n Context for the user\'s own words in the same message: `kombai skill design-system` says how to find\n and pull it by name.\n\nA lock lasts 10 minutes: run node lock again for a longer edit, and before each fix after a push (the push\nends it). If you stop without pushing, or drop your edit with node pull --discard, run\n`kombai node unlock --canvas <link> --node <node>`. If node lock fails, go on without it; a drawing takes\nno lock.\n\nAfter a design\'s last HTML push, follow "Check a finished design" in the overview. When you are done,\ntell the user what changed; the canvas they have open shows it live.\n';
34240
34442
  }
34241
34443
  });
34242
34444
 
@@ -34244,7 +34446,7 @@ var init_actions = __esm({
34244
34446
  var brief_default;
34245
34447
  var init_brief = __esm({
34246
34448
  "src/skill/brief.md"() {
34247
- brief_default = '# Writing a taste brief\n\nTaste reads only the brief: it cannot see the repo, the chat or any file. Write everything it needs into\nthe brief, at most 8,000 characters, in a file outside the repo, then pass it to\n`kombai taste start --brief <file> --variants <1-4>`.\n\nGive ground truth, not design advice. Taste\'s job is to bring the design ideas; ideas you add make it\ncopy yours. For "a joyful, light CRM", write "A joyful light-theme CRM application", not "a light CRM\ndashboard with a soft purple gradient".\n\nA brief says:\n\n- What to design, in plain words that name the kind of UI: a pricing section, sign-in, onboarding, a\n dashboard, a data table, an AI chat, an empty state.\n- The scope: a full page, one section, a screen, a multi-screen flow, or one reusable component. For a\n component taste returns lighter options (arrangements, looks, graphic ideas) and no assets.\n- Every fact the design shows: the product and who uses it, the real copy (names, numbers, plans,\n prices, navigation), the content of each section, and the states that matter.\n- What is already decided, from the repo or the user: brand colors, fonts, logo, an existing design\n system (its tokens, copied from tailwind config, globals.css, theme or token files), and what must stay\n as it is. Copy the values; taste cannot open the files.\n- What is still open, only when the user said so: "explore the layout", "keep our colors".\n\nSkip taste when the work copies or reflows a design instead of making a new one: a clone of a page,\nscreenshot or mock the user gave, a build of the repo\'s existing screens, a version of a design for\nanother device or mode, or an edit to part of a design. Then write the HTML straight from the reference\nor the pulled node.\n\nA taste run takes a few minutes. Tell the user it has started, and create and open the canvas while it\nruns. Run `kombai taste wait <run>` in the foreground, one wait at a time: it returns within 90 seconds,\nso while its status is running, tell the user the run is still going, as expected, and wait again.\n\nAfter `kombai taste wait`, follow directions.md: one direction per variant. In it, <stock-image> tags\ndescribe photos and <icon> tags name icons from the library its <icon-library> tag names: put icons in as\ninline SVG from that library, and photos as images, from a public https URL or saved in the repo. Its\nasset links are real; use them as given and never invent one.\n\ndirections.md is written for a page on a canvas, as Kombai\'s own Design mode writes it. What it asks for\nruns there: scroll-driven motion (parallax, reveal or count-up on scroll, pinning), smooth scrolling\n(Lenis, Locomotive), sticky or fixed elements, and the Sticky Layout Rule it may add, once the design has a\nheight of its own (`kombai skill html`, Size and position). A\n<stock-image> or <stock-video> with no link has no asset: draw it as SVG or leave it out.\n';
34449
+ brief_default = '# Writing a taste brief\n\nTaste reads only the brief: it cannot see the repo, the chat or any file. Write everything it needs into\nthe brief, at most 8,000 characters, in a file outside the repo, then pass it to\n`kombai taste start --brief <file> --variants <1-4>`.\n\nGive ground truth, not design advice. Taste\'s job is to bring the design ideas; ideas you add make it\ncopy yours. For "a joyful, light CRM", write "A joyful light-theme CRM application", not "a light CRM\ndashboard with a soft purple gradient".\n\nA brief says:\n\n- What to design, in plain words that name the kind of UI: a pricing section, sign-in, onboarding, a\n dashboard, a data table, an AI chat, an empty state.\n- The scope: a full page, one section, a screen, a multi-screen flow, or one reusable component. For a\n component taste returns lighter options (arrangements, looks, graphic ideas) and no assets.\n- Every fact the design shows: the product and who uses it, the real copy (names, numbers, plans,\n prices, navigation), the content of each section, and the states that matter.\n- What is already decided, from the repo or the user: brand colors, fonts, logo, an existing design\n system (its tokens, copied from tailwind config, globals.css, theme or token files), and what must stay\n as it is. Copy the values; taste cannot open the files.\n- What is still open, only when the user said so: "explore the layout", "keep our colors".\n\nSkip taste when the work copies or reflows a design instead of making a new one: a clone of a page,\nscreenshot or mock the user gave, a build of the repo\'s existing screens, a version of a design for\nanother device or mode, or an edit to part of a design. Then write the HTML straight from the reference\nor the pulled node.\n\nA taste run takes a few minutes. Tell the user it has started, and create the canvas and show it\n(`kombai skill opening`) while it runs. Run `kombai taste wait <run>` in the foreground, one wait at a\ntime: it returns within 90 seconds, so while its status is running, tell the user the run is still going,\nas expected, and wait again.\n\nAfter `kombai taste wait`, follow directions.md: one direction per variant. In it, <stock-image> tags\ndescribe photos and <icon> tags name icons from the library its <icon-library> tag names: put icons in as\ninline SVG from that library, and photos as images, from a public https URL or saved in the repo. Its\nasset links are real; use them as given and never invent one.\n\ndirections.md is written for a page on a canvas, as Kombai\'s own Design mode writes it. What it asks for\nruns there: scroll-driven motion (parallax, reveal or count-up on scroll, pinning), smooth scrolling\n(Lenis, Locomotive), sticky or fixed elements, and the Sticky Layout Rule it may add, once the design has a\nheight of its own (`kombai skill html`, Size and position). A\n<stock-image> or <stock-video> with no link has no asset: draw it as SVG or leave it out.\n';
34248
34450
  }
34249
34451
  });
34250
34452
 
@@ -34256,6 +34458,14 @@ var init_claude_desktop = __esm({
34256
34458
  }
34257
34459
  });
34258
34460
 
34461
+ // src/skill/codex-desktop.md
34462
+ var codex_desktop_default;
34463
+ var init_codex_desktop = __esm({
34464
+ "src/skill/codex-desktop.md"() {
34465
+ codex_desktop_default = "You are running in the Codex app. Notes for it:\n\n- Kombai's tools here (canvas_app, sign_in_card, taste_card, plans_card) are not listed up front. Find them in\n exec with `ALL_TOOLS.filter((t) => t.name.startsWith('mcp__kombai'))` before you decide one is missing.\n- The canvas: Kombai's view, the canvas_app tool, is the only way to show it here. Call it with the canvas id\n right after `kombai canvas create`, before you write any design, or when you first use a canvas that isn't\n already open beside the chat, as `kombai skill opening` says. Never open a canvas in a browser or the in-app\n browser, and put no canvas or design link in a reply: the commands print none here, and a user who wants one\n copies it from the view (the canvas's Share, or a design's Copy link).\n- Taste: add --cards to every `kombai taste start`, and call taste_card when `kombai taste wait` answers with\n card.\n";
34466
+ }
34467
+ });
34468
+
34259
34469
  // src/skill/design-system.md
34260
34470
  var design_system_default;
34261
34471
  var init_design_system = __esm({
@@ -34276,7 +34486,7 @@ var init_drawings = __esm({
34276
34486
  var faq_default;
34277
34487
  var init_faq = __esm({
34278
34488
  "src/skill/faq.md"() {
34279
- faq_default = "# Questions about Kombai\n\nAnswer the user's question from this text, briefly and in your own words. To answer, run only commands that\nchange nothing (`kombai whoami`, `kombai credits`, `kombai canvas list`). If the answer is not here, say so and\npoint them to support@kombai.com; don't guess. For design work, run `kombai skill` and follow it.\n\n## What Kombai is\n\n- **What it does.** Kombai is an AI design engineer. The coding agent runs the Kombai CLI: Kombai's taste agent\n writes design directions grounded in the user's brief and repo, and the agent builds each design as HTML on a\n hosted Kombai canvas, where the user compares, edits and refines the designs in the browser.\n- **Which agents.** Claude Code, Codex and Cursor have Kombai plugins; any agent with a terminal can run the CLI.\n The Codex app shows the canvas beside the chat, and it and the Claude desktop app's Code tab show Kombai's cards\n (a taste run's brief, sign-in); elsewhere the canvas opens in the agent's own browser panel or the browser.\n- **The Kombai desktop app** is not needed: the CLI designs on a hosted canvas whether or not it is installed.\n- **Requirements.** Node.js 20 or later, and a Kombai account or guest mode. Thumbnails need a Chromium browser\n (Chrome, Edge, Brave, Arc or Chromium); without one, `kombai browser install` downloads a headless Chromium of\n about 100 MB, after asking.\n\n## Account and credits\n\n- **Without an account.** `kombai guest` gives one canvas, with no taste runs, repo images, design systems or\n sharing. The guest canvas ends on the date `kombai whoami` shows; signing in keeps it.\n- **Signing in.** `kombai login` shows a match code and opens a Kombai page in the browser, or in the agent's own\n browser panel: approve there only if the codes match. `kombai whoami` shows who is signed in. `kombai logout`\n signs this machine out; `kombai logout --everywhere` also signs out every other key, the Kombai app and the website.\n- **Credits.** Taste runs spend Kombai credits; `kombai credits` shows what is left, the plan and when it refills.\n On a team plan they are the team's shared pool. With none left, its next is the plans page. The designs\n themselves are written by the user's own coding agent, on that agent's usage.\n- **Organizations.** With several, `kombai config org <id>` sets which one owns new canvases and design systems.\n\n## Designs and data\n\n- **Where designs live.** On hosted canvases in the user's Kombai account. `kombai canvas list` lists every\n one (`--project <id>` one project's; this repo's carry its `checkoutProjectId`), and\n `kombai canvas open --canvas <id>` opens one in the browser.\n- **Editing.** The user can edit text, styles and layout on the canvas, or ask for a change from it: the canvas\n gives them a request to paste into this chat.\n- **Into code.** Ask the agent to build a design in this project: it writes it in the repo's own framework,\n components and styles, with the design as the reference.\n- **Design systems** are .ds files in the Kombai account and need no canvas; `kombai ds list` lists them.\n- **Sharing.** A new canvas is private. `kombai canvas share --canvas <id> --on` lets anyone with the link view it\n and teammates edit it; `--off` turns that off. Only the canvas's owner can.\n- **What Kombai receives.** The brief the agent writes for a taste run, each design's HTML, the repo images a\n design uses, files the agent uploads, design systems it pushes, and the thumbnails rendered on this machine.\n The rest of the repo is not uploaded.\n- **What stays here.** The sign-in key and the working copies of canvases, under ~/.kombai/cli.\n- **Usage data.** The CLI sends Kombai an event for each command (which ran, how it ended, how long it took) and\n reports unexpected errors. `DO_NOT_TRACK=1` turns both off.\n- **Deleting.** `kombai canvas delete --canvas <id>` and `kombai ds delete <slug>` delete for everyone. Deleting\n ~/.kombai removes what is stored on this machine. To close the account, email support@kombai.com.\n\n## Setup and problems\n\n- **Permissions.** Kombai needs network access and writes ~/.kombai, so an agent with a sandbox asks to run it\n outside.\n- **The desktop app's skills.** The first Kombai command on a machine removes the skills the Kombai desktop app\n wrote into the agents' skills folders (`design-with-kombai`, `kombai-faq`, `kombai-status` and the rest), which\n drive the app instead of the CLI. Only the app's own copies go; other skills, the user's own included, stay. An\n agent session that was already open lists them until it restarts.\n- **Updates.** The plugins run the CLI through npx, which fetches the newest release itself; a global install\n updates with npm. The plugin updates through the agent's own plugin manager.\n- **Reporting a problem.** Email support@kombai.com with the command, the JSON line it printed and the version\n `kombai --version` prints.\n";
34489
+ faq_default = "# Questions about Kombai\n\nAnswer the user's question from this text, briefly and in your own words. To answer, run only commands that\nchange nothing (`kombai whoami`, `kombai credits`, `kombai canvas list`). If the answer is not here, say so and\npoint them to support@kombai.com; don't guess. For design work, run `kombai skill` and follow it.\n\n## What Kombai is\n\n- **What it does.** Kombai is an AI design engineer. The coding agent runs the Kombai CLI: Kombai's taste agent\n writes design directions grounded in the user's brief and repo, and the agent builds each design as HTML on a\n hosted Kombai canvas, where the user compares, edits and refines the designs in the browser.\n- **Which agents.** Claude Code, Codex, Cursor, VS Code (GitHub Copilot's agent plugins) and Antigravity have\n Kombai plugins, and Gemini CLI has a Kombai extension; any agent with a terminal can run the CLI. The Codex app\n shows the canvas beside the chat and Kombai's cards (a taste run's brief, sign-in); the Claude desktop app's Code\n tab shows the taste card only. Elsewhere the canvas opens in the agent's own browser panel or the browser.\n- **The Kombai desktop app** is not needed: the CLI designs on a hosted canvas whether or not it is installed.\n- **Requirements.** Node.js 20 or later, and a Kombai account or guest mode. Thumbnails need a Chromium browser\n (Chrome, Edge, Brave, Arc or Chromium); without one, `kombai browser install` downloads a headless Chromium of\n about 100 MB, after asking.\n\n## Account and credits\n\n- **Without an account.** `kombai guest` gives one canvas, with no taste runs, repo images, design systems or\n sharing. The guest canvas ends on the date `kombai whoami` shows; signing in keeps it.\n- **Signing in.** `kombai login` shows a match code and opens a Kombai page in the browser, or in the agent's own\n browser panel: approve there only if the codes match. `kombai whoami` shows who is signed in. `kombai logout`\n signs this machine out; `kombai logout --everywhere` also signs out every other key, the Kombai app and the website.\n- **Credits.** Taste runs spend Kombai credits; `kombai credits` shows what is left, the plan and when it refills.\n On a team plan they are the team's shared pool. With none left, its next is the plans page. The designs\n themselves are written by the user's own coding agent, on that agent's usage.\n- **Organizations.** With several, `kombai config org <id>` sets which one owns new canvases and design systems.\n\n## Designs and data\n\n- **Where designs live.** On hosted canvases in the user's Kombai account. `kombai canvas list` lists every\n one (`--project <id>` one project's; this repo's carry its `checkoutProjectId`), and\n `kombai skill opening` says how to show one to the user.\n- **Editing.** The user can edit text, styles and layout on the canvas, or ask for a change from it: the canvas\n gives them a request to paste into this chat.\n- **Into code.** Ask the agent to build a design in this project: it writes it in the repo's own framework,\n components and styles, with the design as the reference.\n- **Design systems** are .ds files in the Kombai account and need no canvas; `kombai ds list` lists them.\n- **Sharing.** A new canvas is private. `kombai canvas share --canvas <id> --on` lets anyone with the link view it\n and teammates edit it; `--off` turns that off. Only the canvas's owner can.\n- **What Kombai receives.** The brief the agent writes for a taste run, each design's HTML, the repo images a\n design uses, files the agent uploads, design systems it pushes, and the thumbnails rendered on this machine.\n The rest of the repo is not uploaded.\n- **What stays here.** The sign-in key and the working copies of canvases, under ~/.kombai/cli.\n- **Usage data.** The CLI sends Kombai an event for each command (which ran, how it ended, how long it took) and\n reports unexpected errors. `DO_NOT_TRACK=1` turns both off.\n- **Deleting.** `kombai canvas delete --canvas <id>` and `kombai ds delete <slug>` delete for everyone. Deleting\n ~/.kombai removes what is stored on this machine. To close the account, email support@kombai.com.\n\n## Setup and problems\n\n- **Permissions.** Kombai needs network access and writes ~/.kombai, so an agent with a sandbox asks to run it\n outside.\n- **The desktop app's skills.** The first Kombai command on a machine removes the skills the Kombai desktop app\n wrote into the agents' skills folders (`design-with-kombai`, `kombai-faq`, `kombai-status` and the rest), which\n drive the app instead of the CLI. Only the app's own copies go; other skills, the user's own included, stay. An\n agent session that was already open lists them until it restarts.\n- **Updates.** The plugins run the CLI through npx, which fetches the newest release itself; a global install\n updates with npm. The plugin updates through the agent's own plugin manager.\n- **Reporting a problem.** Email support@kombai.com with the command, the JSON line it printed and the version\n `kombai --version` prints.\n";
34280
34490
  }
34281
34491
  });
34282
34492
 
@@ -34284,7 +34494,15 @@ var init_faq = __esm({
34284
34494
  var html_default;
34285
34495
  var init_html = __esm({
34286
34496
  "src/skill/html.md"() {
34287
- html_default = '# Writing a design\'s HTML\n\nThe file `kombai node start` prints holds one design. The canvas shows it live in a frame, and\n`kombai screenshot fill` renders the thumbnail most viewers see. Write it so both look the same.\n\n## Build in passes\n\nnode start creates the file, empty. Read it right after node start, before your first write, even though\nit is empty: an editor that writes only files it has read refuses the write otherwise, and the page you\nwrote is lost. Push the first pass within 30 minutes of node start, or the placeholder expires.\n\n1. First pass: every section in order, with its layout, headings and real copy.\n2. Each later pass: one or two sections\' art, motion and interactions.\n\nPush after each pass, and only once its write has succeeded: never in the same batch of tool calls as\nthe write. The canvas shows each push live, so the user watches the page fill in. Check the design once,\nafter its last pass ("Check a finished design" in the overview).\n\n## The file\n\n- Body content only: no `<!DOCTYPE>`, `<html>`, `<head>` or `<body>`. The canvas and the thumbnail\n both wrap it in their own page, inside a `<div id="root">`, so `body > \u2026` selectors match nothing.\n- So the file is a fragment, not a web page: opened on its own it looks broken. Never open, preview or\n serve it, and never link or name its path to the user. To point the user at a design, give the `url`\n node start, node pull and node push print for it: the canvas, with that design in focus. Where\n `canvas_app` shows the canvas beside the chat, name the design instead, with no link unless the user\n asks for one. A guest\'s `url` is null: point them at the canvas you showed them.\n- Style with Tailwind v4 classes or with your own CSS in a `<style>`. Put every `<style>`, `<link>` and\n library `<script>` at the top of the body. Load Google Fonts with `@import url(\u2026)` as the first line of a\n `<style>`. Set the font, text color and background on your outermost element.\n- Tailwind: add no Tailwind script; Kombai loads Tailwind v4 when the design uses its classes. The canvas\n builds CSS only from classes written in `class="\u2026"`: no config, `@apply`, `@theme` or\n `<style type="text/tailwindcss">`, and a class only a script adds gets no CSS there; write that styling as\n plain CSS in a `<style>`. Use v4 utilities (`bg-black/50`, not `bg-opacity-50`), and CSS variables as\n `bg-(--brand)` or `bg-[var(--brand)]`, never `bg-[--brand]`. On a page with Tailwind classes, style\n no `*` or bare tags in a `<style>`: CSS there beats every Tailwind class.\n- Your own CSS, with no Tailwind classes: the page owns its defaults. Start its `<style>` with a reset\n (margin, padding and box-sizing on `*`) and style headings, lists, links, buttons and images yourself,\n so the page looks the same whether or not Tailwind is loaded. Don\'t name classes like Tailwind\n utilities (`flex`, `hidden`, `text-center`, `p-4`): the canvas may take the page for Tailwind.\n- Define every `@keyframes` you use.\n- `kombai node push` writes a `data-kid="\u2026"` id onto each element of a changed file before it sends it: the id\n the canvas and the user\'s requests name an element by. Read the file again before your next pass to get them.\n Keep the ids when you edit; give a new element none, the next push numbers it.\n\n## Size and position\n\n- A design is 1280 px wide. `--viewport mobile`, `--viewport tablet` or `--viewport desktop` on\n `kombai node start` makes it 390, 768 or 1280. Design for that width: one design per device, not one\n with breakpoints.\n- A design is content height unless you give it a height: its frame is as tall as its page and never\n scrolls. So:\n - Give heights in px (`h-[720px]`, `min-height: 640px`). `h-screen`, `min-h-screen` and `100vh` come out\n 1000 px tall, on the canvas and in the thumbnail.\n - Do not size anything from `window.innerHeight`: on the canvas it is the whole page\'s height.\n- What needs the page to scroll needs a design with a height of its own: scroll-driven effects (scroll\n listeners, parallax, pinned or scrubbed sections, GSAP ScrollTrigger), `sticky` and `fixed` elements, and\n smooth scrolling (Lenis, Locomotive). At content height nothing scrolls, so none of them run: a pinned\n section\'s runway shows as empty space, a sticky element never sticks, and a fixed bottom bar lands 1000 px\n down, mid-page; selected, the canvas shows a page that pins in a device-height window it cannot scroll.\n So after the first push, set the design\'s `rect.h` in canvas.json to its device height (desktop 800,\n tablet 1024, mobile 812) and run `kombai canvas push --canvas <id>`. Selected, it then scrolls inside that\n window and all of these run as on a real page. A reveal that only waits to come into view\n (IntersectionObserver) needs no height: it runs as the viewer pans to it.\n- The thumbnail scrolls the page through once and settles its animations, so it shows the page as a\n visitor who scrolled to the bottom left it: every reveal shown, pinned sections and parallax layers at\n their end, no runway. It takes scrubbed animations at their end too, so an element that fades or slides\n out as the page scrolls is missing from it: animate things in, not out. A design with a height gets the\n whole page as its thumbnail, seen through its window: a sticky element shows where it starts, and a fixed\n one where it sits on the first screen, so a bar fixed to the bottom shows at that screen\'s foot, mid-page.\n- The thumbnail stops at 16,000 px.\n\n## Scripts\n\n- Load each library from a CDN with its own `<script src>` and a pinned version: Chart.js for charts,\n GSAP or Motion for animation. Only public https hosts load.\n- The thumbnail renders with reduced motion. It scrolls the page through, runs GSAP, ScrollTrigger, anime\n and Web Animations to their end, pauses CSS animations and video, and is taken once fonts and images\n are in. The page must look finished by then:\n - Chart.js: `options: { animation: false }`.\n - CSS entrance animations: behind `motion-safe:` or `@media (prefers-reduced-motion: no-preference)`.\n - A page that fills in late (JS entrance animations, content a script draws) sets\n `window.KOMBAI_READY = false` at the top, and `true` when done (or dispatches a `kombai:ready`\n event on window). The thumbnail waits up to 20 s, then takes the page as it is. A page whose text\n names either is waited for, so name them only if you signal.\n\n## Images and video\n\n- Repo files: `/api/local/images/<path from the repo root>`, in src, srcset, poster or CSS `url()`.\n `kombai node push` uploads each one: png, jpg, jpeg, webp, gif, svg, mp4 or webm, up to 20 MB, at\n most 100 per design. Write each path in full, with spaces as `%20`; a path a script builds is not\n uploaded.\n- A file outside the repo, such as an image you generated: `kombai asset push <file> --canvas <id>`\n prints its url. Use that url.\n- Stock photos: use the links directions.md gives, with size params added. images.unsplash.com:\n `?auto=format&w=<px>&q=80&fit=crop`. images.pexels.com: `?auto=compress&cs=tinysrgb&w=<px>&q=80`.\n The bare link is the full-size original.\n- Icons: inline SVG from the library directions.md names.\n- `<img decoding="async" alt="\u2026">`. `loading="lazy"` is fine: the thumbnail loads every image first.\n- Video: `<video src="\u2026" poster="\u2026" autoplay muted loop playsinline preload="metadata">`. Always set a\n poster: it shows until the video plays. Drop autoplay and loop only for click-to-play, such as a\n walkthrough.\n- Every other URL is absolute and public https: relative paths do not resolve, and the thumbnail\n refuses localhost and private addresses.\n- Never invent an image URL.\n\n## Content\n\n- Real copy from the brief and the repo: real names, numbers and dates. No lorem ipsum. No text for the\n reviewer: no design notes, captions explaining the layout, or "click to see".\n- Plain section headings, as a product\'s UI would have them: "Plans", "Details", "Team", not "What it\n costs", "How it works" or "Who is on site this week".\n- One page or screen per design; a modal or drawer is its own design. For a component, design only\n it, on a plain background.\n- Give each meaningful element a `data-name` saying what it is ("pricing card", "hero headline"): the\n canvas editor shows it.\n- No `dark:` classes or `prefers-color-scheme` queries: they follow the viewer\'s theme, so the canvas and\n the thumbnail can differ. A dark version is its own design.\n\n## Patterns to avoid, unless asked\n\n- Drop shadows on cards; gradient-filled headline text.\n- The stock hero: headline, image, two buttons, badges.\n- Three icon-topped cards in a row; plain pricing, testimonial or two-row stat cards.\n- A footer of only links and a logo; a form or call-out as one big card.\n- Fade-in on appear and lift on hover as the only motion; buttons with the usual radius and hover.\n';
34497
+ html_default = '# Writing a design\'s HTML\n\nThe file `kombai node start` prints holds one design. The canvas shows it live in a frame, and\n`kombai screenshot fill` renders the thumbnail most viewers see. Write it so both look the same.\n\n## Build in passes\n\nnode start creates the file, empty. Read it right after node start, before your first write, even though\nit is empty: an editor that writes only files it has read refuses the write otherwise, and the page you\nwrote is lost. Push the first pass within 30 minutes of node start, or the placeholder expires.\n\n1. First pass: every section in order, with its layout, headings and real copy.\n2. Each later pass: one or two sections\' art, motion and interactions.\n\nPush after each pass, and only once its write has succeeded: never in the same batch of tool calls as\nthe write. The canvas shows each push live, so the user watches the page fill in. Check the design once,\nafter its last pass ("Check a finished design" in the overview).\n\n## The file\n\n- Body content only: no `<!DOCTYPE>`, `<html>`, `<head>` or `<body>`. The canvas and the thumbnail\n both wrap it in their own page, inside a `<div id="root">`, so `body > \u2026` selectors match nothing.\n- So the file is a fragment, not a web page: opened on its own it looks broken. Never open, preview or\n serve it, and never link or name its path to the user. To point the user at a design, give the `url`\n node start, node pull and node push print for it: the canvas, with that design in focus. Where\n `canvas_app` shows the canvas beside the chat, and anywhere in the Codex app (whose commands print no link),\n name the design instead, with no link unless the user asks for one. A guest\'s `url` is null: point them at the\n canvas you showed them.\n- Style with Tailwind v4 classes or with your own CSS in a `<style>`. Put every `<style>`, `<link>` and\n library `<script>` at the top of the body. Load Google Fonts with `@import url(\u2026)` as the first line of a\n `<style>`. Set the font, text color and background on your outermost element.\n- Tailwind: add no Tailwind script; Kombai loads Tailwind v4 when the design uses its classes. The canvas\n builds CSS only from classes written in `class="\u2026"`: no config, `@apply`, `@theme` or\n `<style type="text/tailwindcss">`, and a class only a script adds gets no CSS there; write that styling as\n plain CSS in a `<style>`. Use v4 utilities (`bg-black/50`, not `bg-opacity-50`), and CSS variables as\n `bg-(--brand)` or `bg-[var(--brand)]`, never `bg-[--brand]`. On a page with Tailwind classes, style\n no `*` or bare tags in a `<style>`: CSS there beats every Tailwind class.\n- Your own CSS, with no Tailwind classes: the page owns its defaults. Start its `<style>` with a reset\n (margin, padding and box-sizing on `*`) and style headings, lists, links, buttons and images yourself,\n so the page looks the same whether or not Tailwind is loaded. Don\'t name classes like Tailwind\n utilities (`flex`, `hidden`, `text-center`, `p-4`): the canvas may take the page for Tailwind.\n- Define every `@keyframes` you use.\n- `kombai node push` writes a `data-kid="\u2026"` id onto each element of a changed file before it sends it: the id\n the canvas and the user\'s requests name an element by. Read the file again before your next pass to get them.\n Keep the ids when you edit; give a new element none, the next push numbers it.\n\n## Size and position\n\n- A design is 1280 px wide. `--viewport mobile`, `--viewport tablet` or `--viewport desktop` on\n `kombai node start` makes it 390, 768 or 1280. Design for that width: one design per device, not one\n with breakpoints.\n- A design is content height unless you give it a height: its frame is as tall as its page and never\n scrolls. So:\n - Give heights in px (`h-[720px]`, `min-height: 640px`). `h-screen`, `min-h-screen` and `100vh` come out\n 1000 px tall, on the canvas and in the thumbnail.\n - Do not size anything from `window.innerHeight`: on the canvas it is the whole page\'s height.\n- What needs the page to scroll needs a design with a height of its own: scroll-driven effects (scroll\n listeners, parallax, pinned or scrubbed sections, GSAP ScrollTrigger), `sticky` and `fixed` elements, and\n smooth scrolling (Lenis, Locomotive). At content height nothing scrolls, so none of them run: a pinned\n section\'s runway shows as empty space, a sticky element never sticks, and a fixed bottom bar lands 1000 px\n down, mid-page; selected, the canvas shows a page that pins in a device-height window it cannot scroll.\n So after the first push, set the design\'s `rect.h` in canvas.json to its device height (desktop 800,\n tablet 1024, mobile 812) and run `kombai canvas push --canvas <id>`. Selected, it then scrolls inside that\n window and all of these run as on a real page. A reveal that only waits to come into view\n (IntersectionObserver) needs no height: it runs as the viewer pans to it.\n- The thumbnail scrolls the page through once and settles its animations, so it shows the page as a\n visitor who scrolled to the bottom left it: every reveal shown, pinned sections and parallax layers at\n their end, no runway. It takes scrubbed animations at their end too, so an element that fades or slides\n out as the page scrolls is missing from it: animate things in, not out. A design with a height gets the\n whole page as its thumbnail, seen through its window: a sticky element shows where it starts, and a fixed\n one where it sits on the first screen, so a bar fixed to the bottom shows at that screen\'s foot, mid-page.\n- The thumbnail stops at 16,000 px.\n\n## Scripts\n\n- Load each library from a CDN with its own `<script src>` and a pinned version: Chart.js for charts,\n GSAP or Motion for animation. Only public https hosts load.\n- The thumbnail renders with reduced motion. It scrolls the page through, runs GSAP, ScrollTrigger, anime\n and Web Animations to their end, pauses CSS animations and video, and is taken once fonts and images\n are in. The page must look finished by then:\n - Chart.js: `options: { animation: false }`.\n - CSS entrance animations: behind `motion-safe:` or `@media (prefers-reduced-motion: no-preference)`.\n - A page that fills in late (JS entrance animations, content a script draws) sets\n `window.KOMBAI_READY = false` at the top, and `true` when done (or dispatches a `kombai:ready`\n event on window). The thumbnail waits up to 20 s, then takes the page as it is. A page whose text\n names either is waited for, so name them only if you signal.\n\n## Images and video\n\n- Repo files: `/api/local/images/<path from the repo root>`, in src, srcset, poster or CSS `url()`.\n `kombai node push` uploads each one: png, jpg, jpeg, webp, gif, svg, mp4 or webm, up to 20 MB, at\n most 100 per design. Write each path in full, with spaces as `%20`; a path a script builds is not\n uploaded.\n- A file outside the repo, such as an image you generated: `kombai asset push <file> --canvas <id>`\n prints its url. Use that url.\n- Stock photos: use the links directions.md gives, with size params added. images.unsplash.com:\n `?auto=format&w=<px>&q=80&fit=crop`. images.pexels.com: `?auto=compress&cs=tinysrgb&w=<px>&q=80`.\n The bare link is the full-size original.\n- Icons: inline SVG from the library directions.md names.\n- `<img decoding="async" alt="\u2026">`. `loading="lazy"` is fine: the thumbnail loads every image first.\n- Video: `<video src="\u2026" poster="\u2026" autoplay muted loop playsinline preload="metadata">`. Always set a\n poster: it shows until the video plays. Drop autoplay and loop only for click-to-play, such as a\n walkthrough.\n- Every other URL is absolute and public https: relative paths do not resolve, and the thumbnail\n refuses localhost and private addresses.\n- Never invent an image URL.\n\n## Content\n\n- Real copy from the brief and the repo: real names, numbers and dates. No lorem ipsum. No text for the\n reviewer: no design notes, captions explaining the layout, or "click to see".\n- Plain section headings, as a product\'s UI would have them: "Plans", "Details", "Team", not "What it\n costs", "How it works" or "Who is on site this week".\n- One page or screen per design; a modal or drawer is its own design. For a component, design only\n it, on a plain background.\n- Give each meaningful element a `data-name` saying what it is ("pricing card", "hero headline"): the\n canvas editor shows it.\n- No `dark:` classes or `prefers-color-scheme` queries: they follow the viewer\'s theme, so the canvas and\n the thumbnail can differ. A dark version is its own design.\n\n## Patterns to avoid, unless asked\n\n- Drop shadows on cards; gradient-filled headline text.\n- The stock hero: headline, image, two buttons, badges.\n- Three icon-topped cards in a row; plain pricing, testimonial or two-row stat cards.\n- A footer of only links and a logo; a form or call-out as one big card.\n- Fade-in on appear and lift on hover as the only motion; buttons with the usual radius and hover.\n';
34498
+ }
34499
+ });
34500
+
34501
+ // src/skill/opening-codex.md
34502
+ var opening_codex_default;
34503
+ var init_opening_codex = __esm({
34504
+ "src/skill/opening-codex.md"() {
34505
+ opening_codex_default = "# Showing the canvas\n\nIn the Codex app, Kombai's view shows a canvas beside the chat. It is the only way to show one here: no\nbrowser, no in-app browser, no link.\n\n1. **Find the view.** Codex lists no MCP tool up front, so search even when you see none: in exec,\n `ALL_TOOLS.filter((t) => t.name.endsWith('canvas_app'))`.\n2. **Call `canvas_app` with the canvas id** right after `kombai canvas create`, before you write any design,\n or when you first use a canvas that isn't already open beside the chat. A request from the canvas, copied\n from its page or put in the message box by the view, comes from a canvas the user has open: don't call it\n for that one. Set `node` to a design id to focus one. Each call opens another view, and the view updates\n live as you push, so call it again only when the user asks to see the canvas again or says they closed it.\n3. **No canvas_app tool?** Then Kombai's view is not connected in this chat. Tell the user in one line that\n the canvas can't be shown here: the view comes with the Kombai plugin, so they can install or turn it on,\n or start a new chat if it is on. Don't show it any other way.\n4. **canvas_app answers an error?** Tell the user what it says in one line. Don't show the canvas any other\n way.\n\nMake changes with the commands, never through the view.\n\n**No links.** The commands print no canvas or design link here. The user watches every change in the view: end\nwith a short line on what you made or changed, naming designs by their labels, and don't ask them to open the\ncanvas. If the user asks for a link, tell them the view copies it: the canvas's Share button, or Copy link on a\ndesign's right-click menu. Never give the design's .html file. A user who wants the canvas in their own browser\nopens that copied link there; never open one yourself.\n\n**A new canvas is private.** Don't suggest the user send its link to anyone before sharing is on.\n\n**Never turn sharing on by yourself.** Run `kombai canvas share --on` only when the user asks for a link others can open, and tell them in the reply that anyone with the link can now view it, that teammates can edit it, and that the canvas's Share button copies it.\n";
34288
34506
  }
34289
34507
  });
34290
34508
 
@@ -34292,7 +34510,7 @@ var init_html = __esm({
34292
34510
  var opening_default;
34293
34511
  var init_opening = __esm({
34294
34512
  "src/skill/opening.md"() {
34295
- opening_default = "# Showing the canvas\n\nShow a canvas to the user once, when you create or first use it. The page updates live as you push, so\nnever open it again after a push. Pick the first of these that fits:\n\n1. **A `canvas_app` tool is listed** (the Kombai view): call `canvas_app` with the canvas id, and `node`\n set to a design id to focus one. It shows the canvas beside the chat. Call it once per canvas: each\n call opens another view. Make changes with the commands, never through the view.\n2. **You have a browser panel the user can see** (the one you sign in with, `kombai skill sign-in`):\n `kombai canvas url --canvas <id> --in-app` prints a signed-in link. Open it in your panel. It works once,\n within 10 minutes; for a later visit, run it again.\n3. **Otherwise**: `kombai canvas open --canvas <id>` opens the canvas in the user's browser, signed in.\n If it answers opened: false (no browser on this machine), give the user the link it printed instead.\n\nTo point the user at one design, give the `url` node start, node pull or node push printed for it, or\nadd ?node=<node> to the canvas link. Never the design's .html file, and never a link that holds a\n#ticket=; it signs in whoever opens it first.\n\n**Beside the chat, no links.** Once `canvas_app` shows the canvas, the user watches every change there.\nEnd with a short line on what you made or changed, naming designs by their labels. Put no canvas or\ndesign link in your replies, and don't ask the user to open the canvas. Give a link only when the user\nasks for one.\n\n**A new canvas is private.** When you give the user a link, don't suggest they send it to anyone before sharing it.\n\n**Never turn sharing on by yourself.** Run `kombai canvas share --on` only when the user asks for a link others can open, and tell them in the reply that anyone with the link can now view it and teammates can edit it.\n";
34513
+ opening_default = "# Showing the canvas\n\nShow a canvas to the user once, when you create or first use it. The page updates live as you push, so\nnever open it again after a push. Pick the first of these that fits:\n\n1. **A `canvas_app` tool is among your tools** (the Kombai view; the Codex app lists no MCP tool up front, so\n filter ALL_TOOLS for canvas_app there before you pick): call `canvas_app` with the canvas id, and `node`\n set to a design id to focus one. It shows the canvas beside the chat. Call it once per canvas: each call\n opens another view. Make changes with the commands, never through the view.\n2. **No `canvas_app`, and you have a browser panel the user can see** (the one you sign in with,\n `kombai skill sign-in`: the Claude desktop app's Browser pane, VS Code's Integrated Browser through\n `open_browser_page`): `kombai canvas url --canvas <id> --in-app` prints a signed-in link. Open it in your\n panel. It works once, within 10 minutes; for a later visit, run it again.\n3. **Otherwise**: `kombai canvas open --canvas <id>` opens the canvas in the user's browser, signed in.\n If it answers opened: false (no browser on this machine), give the user the link it printed instead.\n\nIn the Codex app use 1 alone: with no canvas_app there, tell the user Kombai's view isn't connected in this chat,\nand show no link.\n\nTo point the user at one design, give the `url` node start, node pull or node push printed for it, or\nadd ?node=<node> to the canvas link. Never the design's .html file, and never a link that holds a\n#ticket=; it signs in whoever opens it first.\n\n**Beside the chat, no links.** Once `canvas_app` shows the canvas, the user watches every change there.\nEnd with a short line on what you made or changed, naming designs by their labels. Put no canvas or\ndesign link in your replies, and don't ask the user to open the canvas. Give a link only when the user\nasks for one.\n\n**A new canvas is private.** When you give the user a link, don't suggest they send it to anyone before sharing it.\n\n**Never turn sharing on by yourself.** Run `kombai canvas share --on` only when the user asks for a link others can open, and tell them in the reply that anyone with the link can now view it and teammates can edit it.\n";
34296
34514
  }
34297
34515
  });
34298
34516
 
@@ -34300,7 +34518,7 @@ var init_opening = __esm({
34300
34518
  var overview_default;
34301
34519
  var init_overview = __esm({
34302
34520
  "src/skill/overview.md"() {
34303
- overview_default = '# Kombai design\n\nDesign UI on a hosted Kombai canvas; design systems need no canvas. `kombai <command> --help` gives its\nflags. Read each JSON result: next can be a command, a link or advice. Follow it after handling the error\nand any required user choice.\nSkill text and default help are plain text. Tell the user in one line before and after each step that\ntakes more than a few seconds.\n\n{{RUN}}\n\nRun `kombai` outside any sandbox from the first try: it needs network and writes ~/.kombai.\n\n{{APP}}\n\n## Choose the task\n\n- New design: follow New designs below.\n- Existing canvas or node (a link, "On my Kombai canvas" message, or a named canvas): read\n `kombai skill actions`, pull the target and follow that request. An edit needs no taste; variants\n seeking new ideas do. Neither needs a new canvas.\n- Design systems (.ds): read `kombai skill design-system`.\n- Shapes, pictures or layout: read `kombai skill drawings`.\n- Questions about Kombai itself (account, credits, data, setup): read `kombai skill faq`.\n\nAt the start of each request, run `kombai whoami`. Unless it prints an email with no claim, read\n`kombai skill sign-in` and follow it. Read it before any `kombai login`.\n\n## New designs\n\n1. Read `kombai skill brief` and the repo before writing a brief outside the repo. The topic says\n when a reference or reflow skips taste.\n2. When taste is needed (never for a guest), tell the user their `kombai credits` balance first,\n then run `kombai taste start --brief <file> --variants <1-4>`, one per design. A run takes minutes:\n do step 3 meanwhile, then `kombai taste wait <run>`, again while its status is running. Follow\n directions.md. On TASTE_NO_CREDITS, call plans_card if listed, else show next\'s plan link; stop.\n3. Create a canvas: `kombai canvas create --name "<what it is>"`. Reuse one only when the user points\n to it or this conversation made it; `kombai canvas list` finds it by name (this repo\'s carry its\n `checkoutProjectId` as `projectId`). Ask if the target is unclear. On DESIGN_ORG_REQUIRED, ask which listed org, save `kombai config org <id>`, then retry.\n Read `kombai skill opening` and show the canvas once when creating or first using it.\n It starts private; share only when asked.\n4. Before writing HTML, read `kombai skill html`: it says how to build in passes. For each design,\n `kombai node start --canvas <id> --label "<label>"` (`--parent <node>` for a variant), then write\n and push it as that topic says.\n\n## Check a finished design\n\nAfter a design\'s last push, run the complete screenshot fill its next names in the background. Then run\n`kombai screenshot wait --canvas <id> --node <node> --tiles` and inspect each image it prints.\nRun node lock, fix and push again, at most 3 rounds. On CLI_NO_BROWSER or CLI_LAUNCH_FAILED from fill,\nask before the roughly 100 MB download; then `kombai browser install --yes` and retry fill.\nIf wait reports CLI_NOTHING_RENDERING, run its suggested fill only if none is running; on\nCLI_SCREENSHOT_FAILED, inspect the failure reason before retrying.\n\n## Recover from errors\n\nExit 2 is not always a changed node.\nFor DESIGN_NODE_CHANGED on node push, merge the stored version at error.details.remote into your\nfile, then `kombai node push --canvas <id> --node <node> --merged`. Only to discard your edit, use\n`kombai node pull --canvas <id> --node <node> --discard`.\n\nRun commands that change a canvas\'s files (node start, node push, node pull, canvas pull, canvas push)\none at a time per canvas, and edit files only between them; screenshot fill and screenshot wait can run\nbeside them.\n\nExit codes: 0 done, 1 failed, 2 refused or conflict, 3 not signed in, 4 timed out. A wait timeout\ndoes not mean the work failed: follow its next; check a fill\'s result if no image arrives.\n';
34521
+ overview_default = '# Kombai design\n\nDesign UI on a hosted Kombai canvas; design systems need no canvas. `kombai <command> --help` gives its\nflags. Read each JSON result: next can be a command, a link or advice. Follow it after handling the error\nand any required user choice.\nSkill text and default help are plain text. Tell the user in one line before and after each step that\ntakes more than a few seconds.\n\n{{RUN}}\n\nRun `kombai` outside any sandbox from the first try: it needs network and writes ~/.kombai.\n\n{{APP}}\n\n## Choose the task\n\n- New design: follow New designs below.\n- Existing canvas or node (a link, "On my Kombai canvas" message, or a named canvas): read\n `kombai skill actions`, pull the target and follow that request. An edit needs no taste; variants\n seeking new ideas do. Neither needs a new canvas.\n- Design systems (.ds): read `kombai skill design-system`.\n- Shapes, pictures or layout: read `kombai skill drawings`.\n- Questions about Kombai itself (account, credits, data, setup): read `kombai skill faq`.\n\nAt the start of each request, run `kombai whoami`. Unless it prints an email with no claim, read\n`kombai skill sign-in` and follow it. Read it before any `kombai login`.\n\n## New designs\n\n1. Read `kombai skill brief` and the repo before writing a brief outside the repo. The topic says\n when a reference or reflow skips taste.\n2. When taste is needed (never for a guest), tell the user their `kombai credits` balance first,\n then run `kombai taste start --brief <file> --variants <1-4>`, one per design. A run takes minutes:\n do step 3 meanwhile, then `kombai taste wait <run>`, again while its status is running. Follow\n directions.md. On TASTE_NO_CREDITS, call plans_card if among your tools, else show next\'s plan link; stop.\n3. Create a canvas: `kombai canvas create --name "<what it is>"`. Reuse one only when the user points\n to it or this conversation made it; `kombai canvas list` finds it by name (this repo\'s carry its\n `checkoutProjectId` as `projectId`). Ask if the target is unclear. On DESIGN_ORG_REQUIRED, ask which listed org, save `kombai config org <id>`, then retry.\n Read `kombai skill opening` and show the canvas once when creating or first using it.\n It starts private; share only when asked.\n4. Before writing HTML, read `kombai skill html`: it says how to build in passes. For each design,\n `kombai node start --canvas <id> --label "<label>"` (`--parent <node>` for a variant), then write\n and push it as that topic says.\n\n## Check a finished design\n\nAfter a design\'s last push, run the complete screenshot fill its next names in the background. Then run\n`kombai screenshot wait --canvas <id> --node <node> --tiles` and inspect each image it prints.\nRun node lock, fix and push again, at most 3 rounds. On CLI_NO_BROWSER or CLI_LAUNCH_FAILED from fill,\nask before the roughly 100 MB download; then `kombai browser install --yes` and retry fill.\nIf wait reports CLI_NOTHING_RENDERING, run its suggested fill only if none is running; on\nCLI_SCREENSHOT_FAILED, inspect the failure reason before retrying.\n\n## Recover from errors\n\nExit 2 is not always a changed node.\nFor DESIGN_NODE_CHANGED on node push, merge the stored version at error.details.remote into your\nfile, then `kombai node push --canvas <id> --node <node> --merged`. Only to discard your edit, use\n`kombai node pull --canvas <id> --node <node> --discard`.\n\nRun commands that change a canvas\'s files (node start, node push, node pull, canvas pull, canvas push)\none at a time per canvas, and edit files only between them; screenshot fill and screenshot wait can run\nbeside them.\n\nExit codes: 0 done, 1 failed, 2 refused or conflict, 3 not signed in, 4 timed out. A wait timeout\ndoes not mean the work failed: follow its next; check a fill\'s result if no image arrives.\n';
34304
34522
  }
34305
34523
  });
34306
34524
 
@@ -34308,17 +34526,23 @@ var init_overview = __esm({
34308
34526
  var sign_in_default;
34309
34527
  var init_sign_in = __esm({
34310
34528
  "src/skill/sign-in.md"() {
34311
- sign_in_default = "# Signing in, or trying Kombai as a guest\n\nWhat `kombai whoami` printed decides. Where your tools list `sign_in_card`, it asks the sign-in questions below in\nyour place (read The sign-in card at the end first); you still ask the claim needs_org question yourself. The reasons\nbelow apply to any exit-3 CLI_NOT_SIGNED_IN, not just whoami's:\n\n- Exit 3 with details.reason none: ask once, \"Kombai works best signed in. Sign in now, or try it without an account?\"\n Sign in: see Signing in. Try it: run `kombai guest`, then work as a guest (below).\n- Exit 3 with reason expired or signed_out: the user has an account. Offer sign-in only, never guest mode. With\n claim pending in details, signing in also moves the guest canvas into the account.\n- Any other or missing reason: offer sign-in only.\n- Exit 0 with status guest: the user already chose. Work as a guest without asking again.\n- An email with claim needs_org: ask which listed organization gets the guest canvas, then run\n `kombai claim --org <id>`. With claim pending, the next command finishes it.\n\n## Signing in\n\nBefore any `kombai login`, check whether you have a browser panel the user can see. That decides the command; run\nit in the background:\n\n1. You have a browser panel the user can see (the Codex app's in-app browser, the Claude desktop app's Browser pane):\n run `kombai login --no-browser`, show the matchCode from its first line, and open the url from that line in your\n panel. The user signs in and approves there. With such a panel, never run `kombai login` without --no-browser.\n2. No such panel: run `kombai login` and show the matchCode from its first line. The user approves on the page it\n opens in their browser, or, if they see none, at the url from that line.\n\nNever type into, click on or approve that page yourself: the approval is the user's check that the match code is\ntheirs. If they'd rather use their own browser, give them that url, for them alone: whoever approves it signs this\nCLI into their account. When the signed-in line has claimed, the guest canvas is now in the account, same link. When\nit has claim needs_org, ask as above.\n\n## As a guest\n\n- The whoami at the start of each request matters most here: the user may have signed in since, in another chat or\n on a card. When it no longer says guest, drop everything below.\n- Skip taste: no brief and no `kombai taste start`. Go straight to `kombai canvas create`. A guest has one canvas: when\n canvas create answers DESIGN_GUEST_LIMIT with a canvasId in details, use that canvas.\n- Use no repo images (/api/local/images/\u2026): CSS, inline SVG or public https images instead.\n- The canvas link is the user's own. Open it for them; don't suggest sending it to anyone.\n- When whoami's expires is within 7 days, say once in this conversation that the guest canvas ends on that date and\n that signing in keeps it.\n- End each turn with one line: signing in unlocks taste directions, repo images, design systems and sharing.\n\n## Refusals\n\n- DESIGN_SIGNIN_REQUIRED or CLI_SIGNIN_REQUIRED: tell the user in one line what signing in unlocks, and sign in\n (Signing in) only if they agree.\n- DESIGN_GUEST_LIMIT on any other command (node start, node push, screenshot fill): the guest canvas is full. Say so\n in one line, and that signing in keeps the canvas and lifts the limit; sign in only if they agree. Don't retry or\n work around it, and keep the unpushed files: push them again after sign-in.\n- SIGNIN_GUEST_RATE from `kombai guest`: this network has made too many guests today. Say so in one line, and offer\n sign-in only (Signing in); don't run `kombai guest` again today.\n- SIGNIN_GUEST_EXPIRED as an error from a guest's own command: say the guest canvas expired, and ask again: sign in,\n or start fresh with `kombai guest`.\n- SIGNIN_GUEST_EXPIRED as a warning on a signed-in line (an email is printed): say in one line that the old guest\n canvas expired and is gone. Never offer `kombai guest`.\n- SIGNIN_GUEST_CLAIMED as an error from a guest's own command: the canvas moved into an account; signing in reaches\n it. As a warning on a signed-in line: nothing to do.\n\n## The sign-in card\n\nWhere your tools list `sign_in_card`, call it in place of the lines above, with the moment's reason, and end your\nturn; don't run or offer `kombai login` in text:\n\n- start: whoami exits 3, in place of asking whether to sign in or try it without an account. The user chooses on the\n card; when they say to carry on, run `kombai whoami` and go on as it says.\n- canvas_full: DESIGN_GUEST_LIMIT with no canvasId in details. second_canvas: with one (still use that canvas).\n- taste: taste refused or asked for. repo_images: CLI_SIGNIN_REQUIRED with images in details.\n- account: any other DESIGN_SIGNIN_REQUIRED or CLI_SIGNIN_REQUIRED.\n- ending: once, when whoami's expires is within 7 days. It is a reminder, not a refusal: don't end your turn after\n it; carry on with the request.\n\nIf the user then asks you in the chat to sign them in, do it as Signing in says.\nWithout `sign_in_card`, use the lines above.\n";
34529
+ sign_in_default = "# Signing in, or trying Kombai as a guest\n\nWhat `kombai whoami` printed decides. Where `sign_in_card` is among your tools (the Codex app lists it only in\nALL_TOOLS), it asks the sign-in questions below in your place (read The sign-in card at the end first); you still ask\nthe claim needs_org question yourself. The reasons below apply to any exit-3 CLI_NOT_SIGNED_IN, not just whoami's:\n\n- Exit 3 with details.reason none: ask once, \"Kombai works best signed in. Sign in now, or try it without an account?\"\n Sign in: see Signing in. Try it: run `kombai guest`, then work as a guest (below).\n- Exit 3 with reason expired or signed_out: the user has an account. Offer sign-in only, never guest mode. With\n claim pending in details, signing in also moves the guest canvas into the account.\n- Any other or missing reason: offer sign-in only.\n- Exit 0 with status guest: the user already chose. Work as a guest without asking again.\n- An email with claim needs_org: ask which listed organization gets the guest canvas, then run\n `kombai claim --org <id>`. With claim pending, the next command finishes it.\n\n## Signing in\n\nBefore any `kombai login`, check whether you have a browser panel the user can see. That decides the command; run\nit in the background:\n\n1. You have a browser panel the user can see (the Codex app's in-app browser, the Claude desktop app's Browser pane,\n VS Code's Integrated Browser through `open_browser_page`): run `kombai login --no-browser`, show the matchCode\n from its first line, and open the url from that line in your panel. The user signs in and approves there. With\n such a panel, never run `kombai login` without --no-browser.\n2. No such panel: run `kombai login` and show the matchCode from its first line. The user approves on the page it\n opens in their browser, or, if they see none, at the url from that line.\n\nNever type into, click on or approve that page yourself: the approval is the user's check that the match code is\ntheirs. If they'd rather use their own browser, give them that url, for them alone: whoever approves it signs this\nCLI into their account. When the signed-in line has claimed, the guest canvas is now in the account, same link. When\nit has claim needs_org, ask as above.\n\n## As a guest\n\n- The whoami at the start of each request matters most here: the user may have signed in since, in another chat or\n on a card. When it no longer says guest, drop everything below.\n- Skip taste: no brief and no `kombai taste start`. Go straight to `kombai canvas create`. A guest has one canvas: when\n canvas create answers DESIGN_GUEST_LIMIT with a canvasId in details, use that canvas.\n- Use no repo images (/api/local/images/\u2026): CSS, inline SVG or public https images instead.\n- The canvas is the user's own. Show it to them as `kombai skill opening` says; don't suggest sending its link to anyone.\n- When whoami's expires is within 7 days, say once in this conversation that the guest canvas ends on that date and\n that signing in keeps it.\n- End each turn with one line: signing in unlocks taste directions, repo images, design systems and sharing.\n\n## Refusals\n\n- DESIGN_SIGNIN_REQUIRED or CLI_SIGNIN_REQUIRED: tell the user in one line what signing in unlocks, and sign in\n (Signing in) only if they agree.\n- DESIGN_GUEST_LIMIT on any other command (node start, node push, screenshot fill): the guest canvas is full. Say so\n in one line, and that signing in keeps the canvas and lifts the limit; sign in only if they agree. Don't retry or\n work around it, and keep the unpushed files: push them again after sign-in.\n- SIGNIN_GUEST_RATE from `kombai guest`: this network has made too many guests today. Say so in one line, and offer\n sign-in only (Signing in); don't run `kombai guest` again today.\n- SIGNIN_GUEST_EXPIRED as an error from a guest's own command: say the guest canvas expired, and ask again: sign in,\n or start fresh with `kombai guest`.\n- SIGNIN_GUEST_EXPIRED as a warning on a signed-in line (an email is printed): say in one line that the old guest\n canvas expired and is gone. Never offer `kombai guest`.\n- SIGNIN_GUEST_CLAIMED as an error from a guest's own command: the canvas moved into an account; signing in reaches\n it. As a warning on a signed-in line: nothing to do.\n\n## The sign-in card\n\nWhere `sign_in_card` is among your tools, call it in place of the lines above, with the moment's reason, and end your\nturn; don't run or offer `kombai login` in text:\n\n- start: whoami exits 3, in place of asking whether to sign in or try it without an account. The user chooses on the\n card; when they say to carry on, run `kombai whoami` and go on as it says.\n- canvas_full: DESIGN_GUEST_LIMIT with no canvasId in details. second_canvas: with one (still use that canvas).\n- taste: taste refused or asked for. repo_images: CLI_SIGNIN_REQUIRED with images in details.\n- account: any other DESIGN_SIGNIN_REQUIRED or CLI_SIGNIN_REQUIRED.\n- ending: once, when whoami's expires is within 7 days. It is a reminder, not a refusal: don't end your turn after\n it; carry on with the request.\n\nIf the user then asks you in the chat to sign them in, do it as Signing in says.\nWithout `sign_in_card`, use the lines above.\n";
34312
34530
  }
34313
34531
  });
34314
34532
 
34315
34533
  // src/commands/skill.js
34316
- function fillSkillText(text, inClaudeDesktop) {
34317
- return text.replaceAll("{{RUN}}", () => RUN).replaceAll("{{APP}}\n\n", () => inClaudeDesktop ? `${claude_desktop_default.trimEnd()}
34534
+ function skillAppOf(ctx) {
34535
+ return ctx.codexDesktop ? "codex-desktop" : ctx.claudeDesktop ? "claude-desktop" : null;
34536
+ }
34537
+ function fillSkillText(text, app) {
34538
+ return text.replaceAll("{{RUN}}", () => RUN).replaceAll("{{APP}}\n\n", () => app ? `${APP_NOTES[app].trimEnd()}
34318
34539
 
34319
34540
  ` : "").trimEnd();
34320
34541
  }
34321
- var TOPICS, RUN, skill, PLAIN_TEXT;
34542
+ function topicText(topic, app) {
34543
+ return fillSkillText(topic === "opening" && app === "codex-desktop" ? opening_codex_default : TOPICS[topic], app);
34544
+ }
34545
+ var TOPICS, RUN, APP_NOTES, skill, PLAIN_TEXT;
34322
34546
  var init_skill = __esm({
34323
34547
  "src/commands/skill.js"() {
34324
34548
  "use strict";
@@ -34328,10 +34552,12 @@ var init_skill = __esm({
34328
34552
  init_actions();
34329
34553
  init_brief();
34330
34554
  init_claude_desktop();
34555
+ init_codex_desktop();
34331
34556
  init_design_system();
34332
34557
  init_drawings();
34333
34558
  init_faq();
34334
34559
  init_html();
34560
+ init_opening_codex();
34335
34561
  init_opening();
34336
34562
  init_overview();
34337
34563
  init_sign_in();
@@ -34348,6 +34574,7 @@ var init_skill = __esm({
34348
34574
  };
34349
34575
  RUN = `Commands here are written as \`kombai <command>\`. If \`kombai --version\` does not run, put
34350
34576
  \`${CLI_RUN}\` in place of \`kombai\` in every command, in full, never from a variable.`;
34577
+ APP_NOTES = { "claude-desktop": claude_desktop_default, "codex-desktop": codex_desktop_default };
34351
34578
  skill = {
34352
34579
  name: "skill",
34353
34580
  summary: "Print the skill's text, or one topic of it. Plain text: these are the agent's instructions.",
@@ -34361,10 +34588,11 @@ var init_skill = __esm({
34361
34588
  details: { topics: Object.keys(TOPICS) }
34362
34589
  });
34363
34590
  }
34364
- ctx.stdout.write(`${fillSkillText(TOPICS[
34591
+ ctx.stdout.write(`${topicText(
34365
34592
  /** @type {keyof typeof TOPICS} */
34366
- topic
34367
- ], ctx.claudeDesktop)}
34593
+ topic,
34594
+ skillAppOf(ctx)
34595
+ )}
34368
34596
  `);
34369
34597
  return { [PLAIN_TEXT]: true };
34370
34598
  }
@@ -34980,6 +35208,7 @@ var init_node = __esm({
34980
35208
  "use strict";
34981
35209
  init_define_KOMBAI_TELEMETRY();
34982
35210
  init_api();
35211
+ init_codex_app();
34983
35212
  init_canvasops();
34984
35213
  init_canvasdir();
34985
35214
  init_contract();
@@ -35147,7 +35376,7 @@ var init_node = __esm({
35147
35376
  version: read2.version,
35148
35377
  state: read2.state,
35149
35378
  file: workingFile(paths, nodeId, isDrawing ? "content" : "html"),
35150
- url: nodeLink(cc, nodeId),
35379
+ ...linkField(ctx, nodeLink(cc, nodeId)),
35151
35380
  expiresAt: read2.expiresAt ?? null
35152
35381
  };
35153
35382
  }
@@ -35236,7 +35465,7 @@ var init_node = __esm({
35236
35465
  version: read2.version,
35237
35466
  state: read2.state,
35238
35467
  file: info.file ? path21.join(paths.dir, info.file) : null,
35239
- url: nodeLink(cc, nodeId),
35468
+ ...linkField(ctx, nodeLink(cc, nodeId)),
35240
35469
  overrides: files.overrides ? workingFile(paths, nodeId, "overrides") : null,
35241
35470
  images: read2.images ?? [],
35242
35471
  screenshotState: read2.screenshotState ?? null,
@@ -35268,7 +35497,7 @@ var init_node = __esm({
35268
35497
  for (const nodeId of nodeIds) {
35269
35498
  try {
35270
35499
  const result = await pushOne(ctx, cc, projectId, nodeId, Boolean(flags.merged));
35271
- nodes.push({ ...result, url: nodeLink(cc, nodeId) });
35500
+ nodes.push({ ...result, ...linkField(ctx, nodeLink(cc, nodeId)) });
35272
35501
  if (result.status !== "unchanged") pushed.push(nodeId);
35273
35502
  } catch (error2) {
35274
35503
  if (!(error2 instanceof CliError)) ctx.telemetry.capture(error2, "node push");
@@ -36047,7 +36276,7 @@ var init_app_skills = __esm({
36047
36276
  });
36048
36277
 
36049
36278
  // src/lib/args.js
36050
- function parseArgv(argv, commands) {
36279
+ function parseArgv(argv, commands, listed = (command) => !command.hidden) {
36051
36280
  const pretty = argv.includes("--pretty");
36052
36281
  const json2 = argv.includes("--json");
36053
36282
  const tokens = argv.filter((token) => !GLOBAL_FLAGS.has(token));
@@ -36065,7 +36294,7 @@ function parseArgv(argv, commands) {
36065
36294
  const command = findCommand(words, commands);
36066
36295
  if (!command) {
36067
36296
  const asked = words.slice(0, 2).join(" ");
36068
- const group = commands.filter((c) => !c.hidden && c.name.startsWith(`${words[0]} `)).map((c) => c.name);
36297
+ const group = commands.filter((c) => listed(c) && c.name.startsWith(`${words[0]} `)).map((c) => c.name);
36069
36298
  if (help && group.length && words.length === 1)
36070
36299
  return { kind: "help", command: null, group: words[0], json: json2, pretty };
36071
36300
  throw new CliError(
@@ -36344,7 +36573,10 @@ function eventsOf(ctx, ran, scope, machine) {
36344
36573
  os: ctx.platform,
36345
36574
  arch: process.arch,
36346
36575
  nodeVersion: process.versions.node,
36347
- ci: Boolean(process.env.CI)
36576
+ ci: Boolean(process.env.CI),
36577
+ // Whether the CLI took this for an agent in the Codex desktop app (codex-app.js). Its marker is internal to
36578
+ // Codex, so a drop to none here is how a release that renamed it shows up.
36579
+ codexDesktop: ctx.codexDesktop
36348
36580
  }
36349
36581
  }
36350
36582
  ];
@@ -36489,6 +36721,7 @@ function createContext(overrides = {}) {
36489
36721
  telemetry: new Telemetry(process.env.DO_NOT_TRACK === "1" ? null : TELEMETRY_KEYS, postDetached),
36490
36722
  sandbox: sandboxOf(process.env),
36491
36723
  claudeDesktop: process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop",
36724
+ codexDesktop: inCodexDesktop(process.env),
36492
36725
  changeSent: false,
36493
36726
  appSkillDirs: appSkillDirsOf(os4.homedir(), process.env),
36494
36727
  ...overrides
@@ -36500,6 +36733,7 @@ var init_context = __esm({
36500
36733
  "use strict";
36501
36734
  init_define_KOMBAI_TELEMETRY();
36502
36735
  init_app_skills();
36736
+ init_codex_app();
36503
36737
  init_deadline();
36504
36738
  init_open();
36505
36739
  init_output();
@@ -36528,7 +36762,7 @@ async function run(argv, overrides = {}) {
36528
36762
  async function execute(ctx, argv, ran) {
36529
36763
  let running = null;
36530
36764
  try {
36531
- const parsed = parseArgv(argv, COMMANDS);
36765
+ const parsed = parseArgv(argv, COMMANDS, (c) => listedIn(ctx, c));
36532
36766
  ran.command = parsed.kind === "version" ? "--version" : parsed.command?.name ?? null;
36533
36767
  if (parsed.kind === "help") {
36534
36768
  ran.help = true;
@@ -36557,8 +36791,11 @@ async function execute(ctx, argv, ran) {
36557
36791
  return failure.exit;
36558
36792
  }
36559
36793
  }
36794
+ function listedIn(ctx, command) {
36795
+ return !command.hidden && !(ctx.codexDesktop && command.notInCodexDesktop);
36796
+ }
36560
36797
  function printHelp(ctx, command, group, json2) {
36561
- const listed = command ? [command] : COMMANDS.filter((c) => !c.hidden && (group === void 0 || c.name.startsWith(`${group} `)));
36798
+ const listed = command ? [command] : COMMANDS.filter((c) => listedIn(ctx, c) && (group === void 0 || c.name.startsWith(`${group} `)));
36562
36799
  if (json2) {
36563
36800
  const commands = listed.map((c) => ({
36564
36801
  usage: usageOf(c),
@@ -36622,7 +36859,7 @@ var init_cli = __esm({
36622
36859
  init_define_KOMBAI_TELEMETRY();
36623
36860
  var major = Number(process.versions.node.split(".")[0]);
36624
36861
  if (major < 20) {
36625
- process.stdout.write(
36862
+ process.stderr.write(
36626
36863
  `${JSON.stringify({ error: { code: "CLI_NODE_TOO_OLD", message: `kombai needs Node 20 or later; this is ${process.version}.` } })}
36627
36864
  `
36628
36865
  );