@kombai/cli 0.2.1 → 0.2.2

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
@@ -504,6 +504,9 @@ function pick(entry, fields) {
504
504
  function hasGuest(entry) {
505
505
  return typeof entry.guest === "string" && entry.guest !== "";
506
506
  }
507
+ function isMarkedClaimed(guest2) {
508
+ return typeof guest2?.guestClaimed === "string" && guest2.guestClaimed === guest2.guestId;
509
+ }
507
510
  async function writeCredential(home, env, credential) {
508
511
  await updateEntry(home, env, (entry) => {
509
512
  return {
@@ -588,7 +591,14 @@ var init_store = __esm({
588
591
  SIGN_IN_AGAIN = "that signs this machine out, so sign in again after.";
589
592
  NEW_MACHINE_ID = "the CLI then makes a new machine id.";
590
593
  KEY_FIELDS = Object.freeze(["key", "keyId", "userId", "email", "expires"]);
591
- GUEST_FIELDS = Object.freeze(["guest", "guestId", "canvasId", "guestExpires", "claimOrgs"]);
594
+ GUEST_FIELDS = Object.freeze([
595
+ "guest",
596
+ "guestId",
597
+ "canvasId",
598
+ "guestExpires",
599
+ "claimOrgs",
600
+ "guestClaimed"
601
+ ]);
592
602
  }
593
603
  });
594
604
 
@@ -1040,13 +1050,13 @@ var init_version = __esm({
1040
1050
  init_define_KOMBAI_TELEMETRY();
1041
1051
  init_codexKombaiEntry();
1042
1052
  init_place();
1043
- CLI_VERSION = true ? "0.2.1" : (
1053
+ CLI_VERSION = true ? "0.2.2" : (
1044
1054
  /** @type {{ version: string }} */
1045
1055
  JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version
1046
1056
  );
1047
- CLI_NPX_RUN = true ? "npx -y @kombai/cli@0.2.1" : `npx -y ${KOMBAI_CLI_PACKAGE}`;
1057
+ CLI_NPX_RUN = true ? "npx -y @kombai/cli@0.2.2" : `npx -y ${KOMBAI_CLI_PACKAGE}`;
1048
1058
  CLI_RUN = runLineOf(fileURLToPath(import.meta.url), CLI_VERSION, CLI_NPX_RUN);
1049
- CLI_PACKAGE = true ? "@kombai/cli@0.2.1" : KOMBAI_CLI_PACKAGE;
1059
+ CLI_PACKAGE = true ? "@kombai/cli@0.2.2" : KOMBAI_CLI_PACKAGE;
1050
1060
  CLI_OUTDATED_NEXT = "A newer Kombai CLI is out; update the Kombai plugin.";
1051
1061
  }
1052
1062
  });
@@ -3074,7 +3084,7 @@ function storageReason(text) {
3074
3084
  const match = /<Code>([^<]+)<\/Code>/.exec(text);
3075
3085
  return match ? match[1] : void 0;
3076
3086
  }
3077
- var CALL_LIMIT_MS, STORAGE_LIMIT_MS, LOST_ANSWER_BACKOFF_MS, MAX_RETRY_AFTER_TRIES, MAX_RETRY_AFTER_MS, PRIVATE_CANVAS, UNKNOWN_OUTCOME_STATUSES, GUEST_CLAIM_PATH, GUEST_CANVAS_PATH, GUEST_GONE_CODES, isGuestGone, LostAnswer, ApiClient, GUEST_ERRORS;
3087
+ var CALL_LIMIT_MS, STORAGE_LIMIT_MS, LOST_ANSWER_BACKOFF_MS, MAX_RETRY_AFTER_TRIES, MAX_RETRY_AFTER_MS, PRIVATE_CANVAS, UNKNOWN_OUTCOME_STATUSES, GUEST_CLAIM_PATH, GUEST_CANVAS_PATH, CliCapability, CLI_CAPS, GUEST_GONE_CODES, isGuestGone, LostAnswer, ApiClient, GUEST_ERRORS;
3078
3088
  var init_api = __esm({
3079
3089
  "src/lib/api.js"() {
3080
3090
  "use strict";
@@ -3093,6 +3103,14 @@ var init_api = __esm({
3093
3103
  UNKNOWN_OUTCOME_STATUSES = /* @__PURE__ */ new Set([500, 502, 504]);
3094
3104
  GUEST_CLAIM_PATH = "/design/guest-claim";
3095
3105
  GUEST_CANVAS_PATH = "/design/canvases/";
3106
+ CliCapability = Object.freeze({
3107
+ /**
3108
+ * A guest token the store calls claimed (SIGNIN_GUEST_CLAIMED) is kept and marked `guestClaimed`, so the next
3109
+ * login's claim repeats and names the canvas: the hosted page may then claim the guest canvas itself.
3110
+ */
3111
+ PageClaim: "page-claim"
3112
+ });
3113
+ CLI_CAPS = Object.values(CliCapability).join(",");
3096
3114
  GUEST_GONE_CODES = /* @__PURE__ */ new Set(["SIGNIN_GUEST_EXPIRED", "SIGNIN_GUEST_CLAIMED"]);
3097
3115
  isGuestGone = (code) => GUEST_GONE_CODES.has(code);
3098
3116
  LostAnswer = class extends CliError {
@@ -3144,6 +3162,7 @@ var init_api = __esm({
3144
3162
  const url2 = `${this.baseUrl}${path30}${queryString(options.query)}`;
3145
3163
  const headers = {
3146
3164
  "x-kombai-cli": this.ctx.version,
3165
+ "x-kombai-cli-caps": CLI_CAPS,
3147
3166
  "x-type": "agent",
3148
3167
  "x-session-id": this.ctx.sessionId
3149
3168
  };
@@ -3344,12 +3363,13 @@ async function openAnySession(ctx, options = {}) {
3344
3363
  ...guestHooks(ctx, env, guest2)
3345
3364
  });
3346
3365
  const session = { kind: "key", env, hosts, credential, guest: guest2, api: api2 };
3347
- if (guest2 && !guest2.claimOrgs && options.claim !== false) {
3366
+ if (guest2 && (!guest2.claimOrgs || isMarkedClaimed(guest2)) && options.claim !== false) {
3348
3367
  const outcome = await settleClaim(ctx, session, void 0, { retry: options.claimRetry ?? "safe" });
3349
3368
  if (outcome.status === "pending") ctx.warnings.add(CLAIM_PENDING);
3350
3369
  }
3351
3370
  return session;
3352
3371
  }
3372
+ if (isClaimedGuest(entry)) throw guestClaimedRefusal();
3353
3373
  if (!guest2 || holdsAccount(entry)) throw notSignedIn(`Not signed in to Kombai (${env}).`, notSignedInReason(entry));
3354
3374
  const api = new ApiClient({ ctx, baseUrl: hosts.api, key: null, deadline, ...guestHooks(ctx, env, guest2) });
3355
3375
  return { kind: "guest", env, hosts, credential: null, guest: guest2, api };
@@ -3357,9 +3377,14 @@ async function openAnySession(ctx, options = {}) {
3357
3377
  function isPureGuest(entry) {
3358
3378
  return hasGuest(entry) && !holdsAccount(entry);
3359
3379
  }
3380
+ function isClaimedGuest(entry) {
3381
+ return isPureGuest(entry) && isMarkedClaimed(entry);
3382
+ }
3360
3383
  async function refuseGuest(ctx) {
3361
3384
  const { env } = await currentEnv(ctx);
3362
- if (isPureGuest(await readEntry(ctx.home, env)))
3385
+ const entry = await readEntry(ctx.home, env);
3386
+ if (isClaimedGuest(entry)) throw guestClaimedRefusal();
3387
+ if (isPureGuest(entry))
3363
3388
  throw signInRequired("This needs a Kombai account, and this machine is a guest: sign in first.");
3364
3389
  }
3365
3390
  function guestHooks(ctx, env, guest2) {
@@ -3368,7 +3393,8 @@ function guestHooks(ctx, env, guest2) {
3368
3393
  let expires = guest2.guestExpires;
3369
3394
  return {
3370
3395
  guest: { token, canvasId: guest2.canvasId ?? null },
3371
- onGuestGone: () => forgetGuest(ctx.home, env, token),
3396
+ /** @param {import('./api.js').GuestGoneCode} code */
3397
+ onGuestGone: (code) => code === "SIGNIN_GUEST_CLAIMED" ? markGuestClaimed(ctx.home, env, token, guest2.guestId) : forgetGuest(ctx.home, env, token),
3372
3398
  /** @param {string} guestExpiresAt */
3373
3399
  onGuestExpires: async (guestExpiresAt) => {
3374
3400
  if (guestExpiresAt === expires) return;
@@ -3416,6 +3442,15 @@ async function forgetGuest(home, env, guest2) {
3416
3442
  for (const field of GUEST_FIELDS) delete record2[field];
3417
3443
  });
3418
3444
  }
3445
+ async function markGuestClaimed(home, env, guest2, guestId) {
3446
+ await writeGuest(home, env, { guestClaimed: guestId }, { ifGuest: guest2 });
3447
+ }
3448
+ function guestClaimedRefusal() {
3449
+ return notSignedIn(
3450
+ "This guest canvas moved into a Kombai account; sign in to reach it.",
3451
+ NotSignedInReason.GUEST_CLAIMED
3452
+ );
3453
+ }
3419
3454
  async function settleClaim(ctx, session, orgId, options = {}) {
3420
3455
  const guest2 = session.guest;
3421
3456
  if (!guest2) return { status: "none" };
@@ -3437,8 +3472,13 @@ async function settleClaim(ctx, session, orgId, options = {}) {
3437
3472
  } catch (error2) {
3438
3473
  if (!(error2 instanceof CliError)) throw error2;
3439
3474
  if (CLAIM_ENDED_CODES.has(error2.code)) {
3475
+ const claimedEarlier = isMarkedClaimed(guest2) && error2.code === "SIGNIN_GUEST_EXPIRED";
3476
+ if (claimedEarlier) error2.message = CLAIMED_EARLIER;
3440
3477
  await forgetGuest(ctx.home, env, guest2.guest);
3441
- ctx.warnings.add({ code: error2.code, message: CLAIM_ENDED_MESSAGES[error2.code] ?? error2.message });
3478
+ ctx.warnings.add({
3479
+ code: error2.code,
3480
+ message: claimedEarlier ? CLAIMED_EARLIER : CLAIM_ENDED_MESSAGES[error2.code] ?? error2.message
3481
+ });
3442
3482
  return settled({ status: "dropped", error: error2 });
3443
3483
  }
3444
3484
  if (error2.status === 401) throw error2;
@@ -3478,7 +3518,7 @@ function claimFields(outcome) {
3478
3518
  return {};
3479
3519
  }
3480
3520
  }
3481
- var NotSignedInReason, CLAIM_PENDING, CLAIM_ENDED_CODES, CLAIM_ENDED_MESSAGES, CLAIM_BAD_ORG_CODES;
3521
+ var NotSignedInReason, CLAIM_PENDING, CLAIM_ENDED_CODES, CLAIM_ENDED_MESSAGES, CLAIMED_EARLIER, CLAIM_BAD_ORG_CODES;
3482
3522
  var init_session = __esm({
3483
3523
  "src/lib/session.js"() {
3484
3524
  "use strict";
@@ -3493,7 +3533,9 @@ var init_session = __esm({
3493
3533
  /** A key is stored but has expired. */
3494
3534
  EXPIRED: "expired",
3495
3535
  /** The key was forgotten after the backend refused it. */
3496
- SIGNED_OUT: "signed_out"
3536
+ SIGNED_OUT: "signed_out",
3537
+ /** No account here, and the guest token held is marked claimed: its canvas moved into an account (guestClaimed). */
3538
+ GUEST_CLAIMED: "guest_claimed"
3497
3539
  });
3498
3540
  CLAIM_PENDING = Object.freeze({
3499
3541
  code: "CLI_CLAIM_PENDING",
@@ -3504,6 +3546,7 @@ var init_session = __esm({
3504
3546
  SIGNIN_GUEST_EXPIRED: "The guest canvas had expired, so there was nothing to move into your account.",
3505
3547
  SIGNIN_GUEST_CLAIMED: "The guest canvas was already moved into an account."
3506
3548
  };
3549
+ CLAIMED_EARLIER = "The guest canvas had already moved into an account.";
3507
3550
  CLAIM_BAD_ORG_CODES = /* @__PURE__ */ new Set(["DESIGN_FORBIDDEN", "DESIGN_BAD_REQUEST"]);
3508
3551
  }
3509
3552
  });
@@ -4949,7 +4992,7 @@ function heldLine(ctx, env, entry) {
4949
4992
  if (holdsAccount(entry)) {
4950
4993
  throw notSignedIn("This machine has signed in to Kombai before; sign in again.", notSignedInReason(entry));
4951
4994
  }
4952
- return hasGuest(entry) ? guestLine(entry, env) : null;
4995
+ return hasGuest(entry) && !isMarkedClaimed(entry) ? guestLine(entry, env) : null;
4953
4996
  }
4954
4997
  function whoamiLine(ctx, env, entry) {
4955
4998
  const credential = keyOf(entry);
@@ -4963,6 +5006,7 @@ function whoamiLine(ctx, env, entry) {
4963
5006
  throw error2;
4964
5007
  }
4965
5008
  if (!hasGuest(entry)) throw error2;
5009
+ if (isMarkedClaimed(entry)) throw guestClaimedRefusal();
4966
5010
  return {
4967
5011
  status: "guest",
4968
5012
  guestId: entry.guestId,
@@ -4973,9 +5017,10 @@ function whoamiLine(ctx, env, entry) {
4973
5017
  }
4974
5018
  function keyLine(credential, env, entry) {
4975
5019
  if (!hasGuest(entry)) return identity(credential, env);
5020
+ const needsOrg = entry.claimOrgs && !isMarkedClaimed(entry);
4976
5021
  return {
4977
5022
  ...identity(credential, env),
4978
- ...entry.claimOrgs ? { claim: "needs_org", orgs: entry.claimOrgs } : { claim: "pending" }
5023
+ ...needsOrg ? { claim: "needs_org", orgs: entry.claimOrgs } : { claim: "pending" }
4979
5024
  };
4980
5025
  }
4981
5026
  function guestLine(entry, env) {
@@ -5182,7 +5227,7 @@ var init_auth = __esm({
5182
5227
  }
5183
5228
  const token = parsed[0];
5184
5229
  const after = await updateEntry(ctx.home, env, (entry) => {
5185
- if (holdsAccount(entry) || hasGuest(entry)) return;
5230
+ if (holdsAccount(entry) || hasGuest(entry) && !isMarkedClaimed(entry)) return;
5186
5231
  const record2 = (
5187
5232
  /** @type {Record<string, unknown>} */
5188
5233
  entry
@@ -9710,7 +9755,7 @@ async function ticketedUrl(ctx, cc) {
9710
9755
  cc.canvasId
9711
9756
  );
9712
9757
  const { projectId } = await projectOf(ctx, cc, await readForLink(cc));
9713
- const guestOwns = cc.session.kind === "key" && cc.session.guest?.canvasId === canvasId;
9758
+ const guestOwns = cc.session.kind === "key" && cc.session.guest?.canvasId === canvasId && !isMarkedClaimed(cc.session.guest);
9714
9759
  const res = await cc.session.api.call({
9715
9760
  method: "POST",
9716
9761
  path: "/design/tickets",
@@ -10353,6 +10398,7 @@ var init_config = __esm({
10353
10398
  const credential = await readCredential(ctx.home, env);
10354
10399
  if (!credential) {
10355
10400
  const entry = await readEntry(ctx.home, env);
10401
+ if (isClaimedGuest(entry)) throw guestClaimedRefusal();
10356
10402
  if (isPureGuest(entry))
10357
10403
  throw signInRequired("The preference is kept per signed-in user, and this machine is a guest: sign in first.");
10358
10404
  throw notSignedIn("Sign in first: the preference is kept per signed-in user.", notSignedInReason(entry));
@@ -34564,7 +34610,8 @@ async function callCanvasApp(ctx, args) {
34564
34610
  }
34565
34611
  async function canBeGuest(ctx) {
34566
34612
  const { env } = await currentEnv(ctx);
34567
- return !holdsAccount(await readEntry(ctx.home, env));
34613
+ const entry = await readEntry(ctx.home, env);
34614
+ return !holdsAccount(entry) && !isClaimedGuest(entry);
34568
34615
  }
34569
34616
  async function guestCanvasItem(ctx, session) {
34570
34617
  const { guest: guest2 } = session;
@@ -34596,7 +34643,7 @@ async function guestCanvasItem(ctx, session) {
34596
34643
  }
34597
34644
  return (await list2(read2.projectId)).find((i) => i.id === canvasId) ?? null;
34598
34645
  } catch (error2) {
34599
- if (error2 instanceof CliError && isGuestGone(error2.code)) return null;
34646
+ if (error2 instanceof CliError && error2.code === "SIGNIN_GUEST_EXPIRED") return null;
34600
34647
  throw error2;
34601
34648
  }
34602
34649
  }
@@ -34616,6 +34663,9 @@ async function guestHome(ctx, session, ticketFor, hosted) {
34616
34663
  const { projectId } = await resolveCheckout(ctx.cwd, { platform: ctx.platform, home: ctx.home });
34617
34664
  return answer({ status: "guest_home", guestCanvas, hosted, ...minted ?? {}, project: projectId });
34618
34665
  } catch (error2) {
34666
+ if (error2 instanceof CliError && error2.code === "SIGNIN_GUEST_CLAIMED") {
34667
+ return answer({ status: "not_signed_in", error: { code: error2.code, message: error2.message }, hosted });
34668
+ }
34619
34669
  if (error2 instanceof CliError && isGuestGone(error2.code)) {
34620
34670
  return answer({ status: "guest_home", guestCanvas: null, hosted });
34621
34671
  }
@@ -34698,6 +34748,7 @@ function createSessionTool(ctx, { login: runner }) {
34698
34748
  }
34699
34749
  if (session.kind === "key" && session.guest && (!ref || ref.canvasId === await guestCanvasOf(ctx, session))) {
34700
34750
  const { guest: guest2 } = session;
34751
+ if (isMarkedClaimed(guest2)) return answer({ status: "claim_pending", ...ids, hosted: hosts.web });
34701
34752
  if (guest2.claimOrgs?.length) {
34702
34753
  return answer({ status: "needs_org", ...ids, orgs: guest2.claimOrgs, hosted: hosts.web });
34703
34754
  }
@@ -34752,6 +34803,7 @@ async function guestCanvasOf(ctx, session) {
34752
34803
  const guest2 = session.guest;
34753
34804
  if (!guest2) return null;
34754
34805
  if (guest2.canvasId) return guest2.canvasId;
34806
+ if (isMarkedClaimed(guest2)) return null;
34755
34807
  const { projectId } = await resolveCheckout(ctx.cwd, { platform: ctx.platform, home: ctx.home });
34756
34808
  const res = await session.api.call({
34757
34809
  method: "GET",
@@ -35486,7 +35538,7 @@ var init_cards = __esm({
35486
35538
  signInTool = (resourceUri) => ({
35487
35539
  name: SIGN_IN_CARD_TOOL,
35488
35540
  title: "Kombai",
35489
- description: "Show Kombai's sign-in card in this chat for a guest (kombai whoami printed status guest, or claim pending), or for a machine with neither a guest nor an account (reason start). Call it with the reason instead of offering kombai login in text: start when kombai whoami exits 3 (CLI_NOT_SIGNED_IN), in place of asking whether to sign in or try Kombai without an account; canvas_full for DESIGN_GUEST_LIMIT with no canvasId in details; second_canvas for DESIGN_GUEST_LIMIT with one (still use that canvas); taste when taste is refused or asked for; assets when AI image or video generation is refused or asked for; repo_images for CLI_SIGNIN_REQUIRED with images in details; account for any other CLI_SIGNIN_REQUIRED or DESIGN_SIGNIN_REQUIRED; ending once per conversation when whoami's expires is within 7 days. Then end your turn, except after ending, a reminder, where you carry on with the request. The user signs in from the card; never run kombai login for them unless they ask in the chat, and then sign in as `kombai skill sign-in` says: with a browser panel the user can see, `kombai login --no-browser`, its url opened in that panel. When they say they have signed in, run kombai whoami.",
35541
+ description: "Show Kombai's sign-in card in this chat for a guest (kombai whoami printed status guest, or claim pending), or for a machine with neither a guest nor an account (reason start). Call it with the reason instead of offering kombai login in text: start when kombai whoami exits 3 (CLI_NOT_SIGNED_IN; not for reason guest_claimed, which signs in at once as `kombai skill sign-in` says), in place of asking whether to sign in or try Kombai without an account; canvas_full for DESIGN_GUEST_LIMIT with no canvasId in details; second_canvas for DESIGN_GUEST_LIMIT with one (still use that canvas); taste when taste is refused or asked for; assets when AI image or video generation is refused or asked for; repo_images for CLI_SIGNIN_REQUIRED with images in details; account for any other CLI_SIGNIN_REQUIRED or DESIGN_SIGNIN_REQUIRED; ending once per conversation when whoami's expires is within 7 days. Then end your turn, except after ending, a reminder, where you carry on with the request. The user signs in from the card; never run kombai login for them unless they ask in the chat, or a command answered SIGNIN_GUEST_CLAIMED or reason guest_claimed \u2014 then sign in as `kombai skill sign-in` says: with a browser panel the user can see, `kombai login --no-browser`, its url opened in that panel. When they say they have signed in, run kombai whoami.",
35490
35542
  inputSchema: {
35491
35543
  type: "object",
35492
35544
  properties: { reason: { type: "string", enum: Object.values(SignInReason) } },
@@ -36575,7 +36627,7 @@ var init_overview = __esm({
36575
36627
  var sign_in_default;
36576
36628
  var init_sign_in = __esm({
36577
36629
  "src/skill/sign-in.md"() {
36578
- sign_in_default = "# Signing in, or trying Kombai as a guest\n\nWhat `kombai whoami` printed decides. Where `sign_in_card` is among your tools (the Codex app lists it only in\nALL_TOOLS), it asks the sign-in questions below in your place (read The sign-in card at the end first); you still ask\nthe claim needs_org question yourself. The reasons below apply to any exit-3 CLI_NOT_SIGNED_IN, not just whoami's:\n\n- Exit 3 with details.reason none: ask once, \"Kombai works best signed in. Sign in now, or try it without an account?\"\n Sign in: see Signing in. Try it: run `kombai guest`, then work as a guest (below).\n- Exit 3 with reason expired or signed_out: the user has an account. Offer sign-in only, never guest mode. With\n claim pending in details, signing in also moves the guest canvas into the account.\n- Any other or missing reason: offer sign-in only.\n- Exit 0 with status guest: the user already chose. Work as a guest without asking again.\n- An email with claim needs_org: ask which listed organization gets the guest canvas, then run\n `kombai claim --org <id>`. With claim pending, the next command finishes it.\n\n## Signing in\n\nBefore any `kombai login`, check whether you have a browser panel the user can see. That decides the command; run\nit in the background:\n\n1. You have a browser panel the user can see (the Codex app's in-app browser, the Claude desktop app's Browser pane,\n VS Code's Integrated Browser through `open_browser_page`): run `kombai login --no-browser`, show the matchCode\n from its first line, and open the url from that line in your panel. The user signs in and approves there. With\n such a panel, never run `kombai login` without --no-browser.\n2. No such panel: run `kombai login` and show the matchCode from its first line. The user approves on the page it\n opens in their browser, or, if they see none, at the url from that line.\n\nNever type into, click on or approve that page yourself: the approval is the user's check that the match code is\ntheirs. If they'd rather use their own browser, give them that url, for them alone: whoever approves it signs this\nCLI into their account. When the signed-in line has claimed, the guest canvas is now in the account, same link. When\nit has claim needs_org, ask as above.\n\n## As a guest\n\n- The whoami at the start of each request matters most here: the user may have signed in since, in another chat or\n on a card. When it no longer says guest, drop everything below.\n- Skip taste: no brief and no `kombai taste start`. Go straight to `kombai canvas create`. A guest has one canvas: when\n canvas create answers DESIGN_GUEST_LIMIT with a canvasId in details, use that canvas.\n- Use no repo images (/api/local/images/\u2026): CSS, inline SVG or public https images instead.\n- Make no AI-generated images or video (no `kombai asset generate`): public https images, CSS or SVG instead.\n- The canvas is the user's own. Show it to them as `kombai skill opening` says; don't suggest sending its link to anyone.\n- When whoami's expires is within 7 days, say once in this conversation that the guest canvas ends on that date and\n that signing in keeps it.\n- End each turn with one line saying what signing in unlocks:\n taste directions, AI images and video, repo images, design systems and sharing.\n\n## Refusals\n\n- DESIGN_SIGNIN_REQUIRED or CLI_SIGNIN_REQUIRED: tell the user in one line what signing in unlocks, and sign in\n (Signing in) only if they agree.\n- DESIGN_GUEST_LIMIT on any other command (node start, node push, screenshot fill): the guest canvas is full. Say so\n in one line, and that signing in keeps the canvas and lifts the limit; sign in only if they agree. Don't retry or\n work around it, and keep the unpushed files: push them again after sign-in.\n- SIGNIN_GUEST_RATE from `kombai guest`: this network has made too many guests today. Say so in one line, and offer\n sign-in only (Signing in); don't run `kombai guest` again today.\n- SIGNIN_GUEST_EXPIRED as an error from a guest's own command: say the guest canvas expired, and ask again: sign in,\n or start fresh with `kombai guest`.\n- SIGNIN_GUEST_EXPIRED as a warning on a signed-in line (an email is printed): say in one line that the old guest\n canvas expired and is gone. Never offer `kombai guest`.\n- SIGNIN_GUEST_CLAIMED as an error from a guest's own command: the canvas moved into an account; signing in reaches\n it. As a warning on a signed-in line: nothing to do.\n\n## The sign-in card\n\nWhere `sign_in_card` is among your tools, call it in place of the lines above, with the moment's reason, and end your\nturn; don't run or offer `kombai login` in text:\n\n- start: whoami exits 3, in place of asking whether to sign in or try it without an account. The user chooses on the\n card; when they say to carry on, run `kombai whoami` and go on as it says.\n- canvas_full: DESIGN_GUEST_LIMIT with no canvasId in details. second_canvas: with one (still use that canvas).\n- taste: taste refused or asked for. repo_images: CLI_SIGNIN_REQUIRED with images in details.\n- assets: `asset generate` or `asset wait` refused (CLI_SIGNIN_REQUIRED), or the user asks a guest for AI images\n or video.\n- account: any other DESIGN_SIGNIN_REQUIRED or CLI_SIGNIN_REQUIRED.\n- ending: once, when whoami's expires is within 7 days. It is a reminder, not a refusal: don't end your turn after\n it; carry on with the request.\n\nIf the user then asks you in the chat to sign them in, do it as Signing in says.\nWithout `sign_in_card`, use the lines above.\n";
36630
+ sign_in_default = "# Signing in, or trying Kombai as a guest\n\nWhat `kombai whoami` printed decides. Where `sign_in_card` is among your tools (the Codex app lists it only in\nALL_TOOLS), it asks the sign-in questions below in your place (read The sign-in card at the end first); you still ask\nthe claim needs_org question yourself, and reason guest_claimed signs in with no card. The reasons below apply to any\nexit-3 CLI_NOT_SIGNED_IN, not just whoami's:\n\n- Exit 3 with details.reason none: ask once, \"Kombai works best signed in. Sign in now, or try it without an account?\"\n Sign in: see Signing in. Try it: run `kombai guest`, then work as a guest (below).\n- Exit 3 with reason expired or signed_out: the user has an account. Offer sign-in only, never guest mode. With\n claim pending in details, signing in also moves the guest canvas into the account.\n- Exit 3 with reason guest_claimed: the user signed in on the canvas page, so the guest canvas is in their account\n now. Tell them so in one line and sign in now without asking (Signing in), even where `sign_in_card` is among your\n tools; show the match code. The signed-in line then has claimed. If that sign-in is not approved (it expires),\n ask once: sign in again, or start fresh with `kombai guest` (a new guest canvas; the old one stays in the account).\n- Any other or missing reason: offer sign-in only.\n- Exit 0 with status guest: the user already chose. Work as a guest without asking again.\n- An email with claim needs_org: ask which listed organization gets the guest canvas, then run\n `kombai claim --org <id>`. With claim pending, the next command finishes it.\n\n## Signing in\n\nBefore any `kombai login`, check whether you have a browser panel the user can see. That decides the command; run\nit in the background:\n\n1. You have a browser panel the user can see (the Codex app's in-app browser, the Claude desktop app's Browser pane,\n VS Code's Integrated Browser through `open_browser_page`): run `kombai login --no-browser`, show the matchCode\n from its first line, and open the url from that line in your panel. The user signs in and approves there. With\n such a panel, never run `kombai login` without --no-browser.\n2. No such panel: run `kombai login` and show the matchCode from its first line. The user approves on the page it\n opens in their browser, or, if they see none, at the url from that line.\n\nNever type into, click on or approve that page yourself: the approval is the user's check that the match code is\ntheirs. If they'd rather use their own browser, give them that url, for them alone: whoever approves it signs this\nCLI into their account. When the signed-in line has claimed, the guest canvas is now in the account, same link. When\nit has claim needs_org, ask as above.\n\n## As a guest\n\n- The whoami at the start of each request matters most here: the user may have signed in since, in another chat or\n on a card. When it no longer says guest, drop everything below.\n- Skip taste: no brief and no `kombai taste start`. Go straight to `kombai canvas create`. A guest has one canvas: when\n canvas create answers DESIGN_GUEST_LIMIT with a canvasId in details, use that canvas.\n- Use no repo images (/api/local/images/\u2026): CSS, inline SVG or public https images instead.\n- Make no AI-generated images or video (no `kombai asset generate`): public https images, CSS or SVG instead.\n- The canvas is the user's own. Show it to them as `kombai skill opening` says; don't suggest sending its link to anyone.\n- When whoami's expires is within 7 days, say once in this conversation that the guest canvas ends on that date and\n that signing in keeps it.\n- End each turn with one line saying what signing in unlocks:\n taste directions, AI images and video, repo images, design systems and sharing.\n\n## Refusals\n\n- DESIGN_SIGNIN_REQUIRED or CLI_SIGNIN_REQUIRED: tell the user in one line what signing in unlocks, and sign in\n (Signing in) only if they agree.\n- DESIGN_GUEST_LIMIT on any other command (node start, node push, screenshot fill): the guest canvas is full. Say so\n in one line, and that signing in keeps the canvas and lifts the limit; sign in only if they agree. Don't retry or\n work around it, and keep the unpushed files: push them again after sign-in.\n- SIGNIN_GUEST_RATE from `kombai guest`: this network has made too many guests today. Say so in one line, and offer\n sign-in only (Signing in); don't run `kombai guest` again today.\n- SIGNIN_GUEST_EXPIRED as an error from a guest's own command: say the guest canvas expired, and ask again: sign in,\n or start fresh with `kombai guest`.\n- SIGNIN_GUEST_EXPIRED as a warning on a signed-in line (an email is printed): say its message in one line (the old\n guest canvas expired and is gone, or had already moved into an account). Never offer `kombai guest`.\n- SIGNIN_GUEST_CLAIMED as an error from a guest's own command: the canvas moved into an account; do as the reason\n guest_claimed line says. As a warning on a signed-in line: nothing to do.\n- DESIGN_GUEST_CLAIMED as a warning on a signed-in line: another account has the guest canvas. Say so in one line\n and carry on in the signed-in account, on a new canvas.\n\n## The sign-in card\n\nWhere `sign_in_card` is among your tools, call it in place of the lines above (except reason guest_claimed, which\nsigns in at once), with the moment's reason, and end your\nturn; don't run or offer `kombai login` in text:\n\n- start: whoami exits 3 with any reason but guest_claimed, in place of asking whether to sign in or try it without\n an account. The user chooses on the card; when they say to carry on, run `kombai whoami` and go on as it says.\n- canvas_full: DESIGN_GUEST_LIMIT with no canvasId in details. second_canvas: with one (still use that canvas).\n- taste: taste refused or asked for. repo_images: CLI_SIGNIN_REQUIRED with images in details.\n- assets: `asset generate` or `asset wait` refused (CLI_SIGNIN_REQUIRED), or the user asks a guest for AI images\n or video.\n- account: any other DESIGN_SIGNIN_REQUIRED or CLI_SIGNIN_REQUIRED.\n- ending: once, when whoami's expires is within 7 days. It is a reminder, not a refusal: don't end your turn after\n it; carry on with the request.\n\nIf the user then asks you in the chat to sign them in, do it as Signing in says.\nWithout `sign_in_card`, use the lines above.\n";
36579
36631
  }
36580
36632
  });
36581
36633
 
package/dist/launch.mjs CHANGED
@@ -7,7 +7,7 @@ import { dirname, join } from 'node:path';
7
7
  import { fileURLToPath, pathToFileURL } from 'node:url';
8
8
 
9
9
  // The version that wrote this file: a published one, so its npx line always works. Filled in by the build.
10
- const WRITTEN_BY = '0.2.1';
10
+ const WRITTEN_BY = '0.2.2';
11
11
  const root = dirname(fileURLToPath(import.meta.url));
12
12
 
13
13
  // On stderr, as the CLI's own start-up errors are: under `kombai mcp` stdout carries MCP frames only.