kenso 0.1.140 → 0.1.141

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/kenso.js CHANGED
@@ -2485,7 +2485,7 @@ var VERSION;
2485
2485
  var init_version = __esm({
2486
2486
  "src/core/version.ts"() {
2487
2487
  "use strict";
2488
- VERSION = true ? "0.1.140" : "0.0.0-dev";
2488
+ VERSION = true ? "0.1.141" : "0.0.0-dev";
2489
2489
  }
2490
2490
  });
2491
2491
 
@@ -4334,9 +4334,9 @@ async function readRun(dir3) {
4334
4334
  return null;
4335
4335
  }
4336
4336
  if (!raw) return null;
4337
- const { runId, command: command70, createdAt, status } = raw;
4337
+ const { runId, command: command71, createdAt, status } = raw;
4338
4338
  if (typeof runId !== "string" || !RUN_ID_PATTERN.test(runId)) return null;
4339
- if (typeof command70 !== "string" || typeof createdAt !== "string") return null;
4339
+ if (typeof command71 !== "string" || typeof createdAt !== "string") return null;
4340
4340
  if (typeof status !== "string" || !STATUSES.includes(status)) return null;
4341
4341
  let chunksDone = chunkList(raw.chunksDone) ?? [];
4342
4342
  try {
@@ -4347,7 +4347,7 @@ async function readRun(dir3) {
4347
4347
  const record3 = {
4348
4348
  ...raw,
4349
4349
  runId,
4350
- command: command70,
4350
+ command: command71,
4351
4351
  args: asRecord3(raw.args) ?? {},
4352
4352
  createdAt,
4353
4353
  status,
@@ -4407,11 +4407,11 @@ async function loadRun(runId, env = process.env) {
4407
4407
  }
4408
4408
  return run;
4409
4409
  }
4410
- async function findIdentical(command70, args, inputSha256, env, workspaceId, anyWorkspace = false) {
4410
+ async function findIdentical(command71, args, inputSha256, env, workspaceId, anyWorkspace = false) {
4411
4411
  const identity = argsIdentity(args);
4412
4412
  const runs = await listRuns(env);
4413
4413
  return runs.filter(
4414
- (run) => run.command === command70 && (run.inputSha256 || void 0) === (inputSha256 || void 0) && (anyWorkspace || (run.workspaceId || void 0) === (workspaceId || void 0)) && argsIdentity(run.args) === identity
4414
+ (run) => run.command === command71 && (run.inputSha256 || void 0) === (inputSha256 || void 0) && (anyWorkspace || (run.workspaceId || void 0) === (workspaceId || void 0)) && argsIdentity(run.args) === identity
4415
4415
  );
4416
4416
  }
4417
4417
  function isOtherLiveProcess(pid) {
@@ -7805,7 +7805,7 @@ function priceLine(line, cards) {
7805
7805
  if (line.pricing === "varies") return `${line.action}: price depends on the work; --dry-run prints the estimate where the command has one`;
7806
7806
  const priced = [];
7807
7807
  for (const card of cards) {
7808
- const item = card.items.find((candidate) => candidate.action === line.action && (candidate.pricing ?? "fixed") === "fixed");
7808
+ const item = card.items.find((candidate2) => candidate2.action === line.action && (candidate2.pricing ?? "fixed") === "fixed");
7809
7809
  if (item) priced.push({ card, item });
7810
7810
  }
7811
7811
  if (priced.length === 0) return `${line.action}: charged, not on the rate card (${RATE_CARD_COMMAND})`;
@@ -7916,8 +7916,8 @@ function idValue(value, field) {
7916
7916
  function shellQuote3(arg) {
7917
7917
  return /^[A-Za-z0-9_./:=@%+,-]+$/.test(arg) ? arg : `'${arg.replace(/'/g, `'\\''`)}'`;
7918
7918
  }
7919
- function commandLine2(ctx, command70, args, extra = []) {
7920
- const parts2 = ["kenso", ...command70.split(" "), ...(args.positionals ?? []).map(shellQuote3)];
7919
+ function commandLine2(ctx, command71, args, extra = []) {
7920
+ const parts2 = ["kenso", ...command71.split(" "), ...(args.positionals ?? []).map(shellQuote3)];
7921
7921
  for (const [name, value] of Object.entries(args.flags)) {
7922
7922
  if (value === void 0 || value === false) continue;
7923
7923
  if (value === true) parts2.push(`--${name}`);
@@ -8214,9 +8214,9 @@ function stringFlag2(flags, name) {
8214
8214
  const text4 = value.trim();
8215
8215
  return text4 === "" ? void 0 : text4;
8216
8216
  }
8217
- function requireFlag(flags, name, command70, hint) {
8217
+ function requireFlag(flags, name, command71, hint) {
8218
8218
  const value = stringFlag2(flags, name);
8219
- if (value === void 0) throw usageError(`--${name} is required for ${command70}.`, { field: name, next: `${command70} --help`, ...hint ? { hint } : {} });
8219
+ if (value === void 0) throw usageError(`--${name} is required for ${command71}.`, { field: name, next: `${command71} --help`, ...hint ? { hint } : {} });
8220
8220
  return value;
8221
8221
  }
8222
8222
  function positiveId(value) {
@@ -8225,8 +8225,8 @@ function positiveId(value) {
8225
8225
  const id = Number(text4);
8226
8226
  return Number.isSafeInteger(id) && id > 0 ? id : void 0;
8227
8227
  }
8228
- function idFlag(flags, name, command70) {
8229
- const raw = requireFlag(flags, name, command70);
8228
+ function idFlag(flags, name, command71) {
8229
+ const raw = requireFlag(flags, name, command71);
8230
8230
  const id = positiveId(raw);
8231
8231
  if (id === void 0) throw usageError(`--${name} must be a positive whole number (got "${raw}").`, { field: name });
8232
8232
  return id;
@@ -8246,8 +8246,8 @@ function isDryRun(ctx) {
8246
8246
  function shellQuote4(value) {
8247
8247
  return /^[A-Za-z0-9_\-.,:/@=+%]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
8248
8248
  }
8249
- function sameCommand2(command70, flags, ctx, extra = []) {
8250
- const parts2 = [command70];
8249
+ function sameCommand2(command71, flags, ctx, extra = []) {
8250
+ const parts2 = [command71];
8251
8251
  for (const [name, value] of Object.entries(flags)) {
8252
8252
  if (value === void 0 || value === false) continue;
8253
8253
  if (value === true) parts2.push(`--${name}`);
@@ -8479,12 +8479,12 @@ function filterBody(flags) {
8479
8479
  }
8480
8480
  return parsed2;
8481
8481
  }
8482
- function targetBody(flags, target2, command70) {
8482
+ function targetBody(flags, target2, command71) {
8483
8483
  const ids2 = idList(flags, "ids");
8484
8484
  const filter = filterBody(flags);
8485
8485
  const everything = flags.all === true;
8486
8486
  if (ids2 !== void 0 === (filter !== void 0 || everything)) {
8487
- throw usageError(`Name the ${target2.plural} one way: --ids, --filter, or --all for every ${target2.noun} in the workspace.`, { field: "ids", next: `${command70} --help` });
8487
+ throw usageError(`Name the ${target2.plural} one way: --ids, --filter, or --all for every ${target2.noun} in the workspace.`, { field: "ids", next: `${command71} --help` });
8488
8488
  }
8489
8489
  const exclude = idList(flags, "exclude-ids");
8490
8490
  if (exclude !== void 0 && ids2 !== void 0) throw usageError("--exclude-ids goes with --filter or --all.", { field: "exclude-ids" });
@@ -8505,14 +8505,14 @@ function tagSet(flags) {
8505
8505
  return set2;
8506
8506
  }
8507
8507
  function requestBody(flags, target2, dryRun2) {
8508
- const command70 = `kenso ${target2.resource} bulk-update`;
8508
+ const command71 = `kenso ${target2.resource} bulk-update`;
8509
8509
  const pairs = Array.isArray(flags.set) ? flags.set : typeof flags.set === "string" ? [flags.set] : [];
8510
8510
  const tags = target2.tags ? tagSet(flags) : {};
8511
8511
  if (pairs.length === 0 && Object.keys(tags).length === 0) {
8512
- throw usageError(`--set${target2.tags ? " or --add-tag" : ""} is required for ${command70}.`, { field: "set", hint: "For example --set stage=engaged.", next: `${command70} --help` });
8512
+ throw usageError(`--set${target2.tags ? " or --add-tag" : ""} is required for ${command71}.`, { field: "set", hint: "For example --set stage=engaged.", next: `${command71} --help` });
8513
8513
  }
8514
8514
  return {
8515
- ...targetBody(flags, target2, command70),
8515
+ ...targetBody(flags, target2, command71),
8516
8516
  set: { ...parseSet(pairs, target2.aliases, target2.textFields), ...tags },
8517
8517
  ...dryRun2 ? { dryRun: true } : {},
8518
8518
  ...flags["overwrite-pinned"] === true ? { overwritePinned: true } : {}
@@ -8578,7 +8578,7 @@ function bulkUpdateCommand(target2) {
8578
8578
  };
8579
8579
  }
8580
8580
  function bulkDeleteCommand(target2) {
8581
- const command70 = `kenso ${target2.resource} bulk-delete`;
8581
+ const command71 = `kenso ${target2.resource} bulk-delete`;
8582
8582
  return {
8583
8583
  resource: target2.resource,
8584
8584
  action: "bulk-delete",
@@ -8598,7 +8598,7 @@ function bulkDeleteCommand(target2) {
8598
8598
  beta: { featureGates: { all: target2.featureGates } },
8599
8599
  operationIds: [`${target2.resource}.bulk-delete`, "changes.get"],
8600
8600
  dryRun: true,
8601
- run: (ctx, { flags }) => runChange(ctx, flags, `/v1/${target2.resource}/bulk-delete`, (dryRun2) => ({ ...targetBody(flags, target2, command70), dryRun: dryRun2 }))
8601
+ run: (ctx, { flags }) => runChange(ctx, flags, `/v1/${target2.resource}/bulk-delete`, (dryRun2) => ({ ...targetBody(flags, target2, command71), dryRun: dryRun2 }))
8602
8602
  };
8603
8603
  }
8604
8604
  async function runChange(ctx, flags, path, body2) {
@@ -10342,8 +10342,8 @@ var init_browser_login = __esm({
10342
10342
  defaultDeps = {
10343
10343
  sleep: (ms, signal) => delay5(ms, void 0, signal ? { signal } : void 0),
10344
10344
  now: () => Date.now(),
10345
- spawn: (command70, args) => {
10346
- const child = nodeSpawn(command70, args, { detached: true, stdio: "ignore" });
10345
+ spawn: (command71, args) => {
10346
+ const child = nodeSpawn(command71, args, { detached: true, stdio: "ignore" });
10347
10347
  child.on("error", () => {
10348
10348
  });
10349
10349
  child.unref();
@@ -11656,8 +11656,8 @@ var init_run = __esm({
11656
11656
  defaultDeps2 = {
11657
11657
  sleep: (ms, signal) => delay6(ms, void 0, signal ? { signal } : void 0),
11658
11658
  now: () => Date.now(),
11659
- spawn: (command70, args) => {
11660
- const child = nodeSpawn2(command70, args, { detached: true, stdio: "ignore" });
11659
+ spawn: (command71, args) => {
11660
+ const child = nodeSpawn2(command71, args, { detached: true, stdio: "ignore" });
11661
11661
  child.on("error", () => {
11662
11662
  });
11663
11663
  child.unref();
@@ -11680,8 +11680,8 @@ var init_connect3 = __esm({
11680
11680
  "use strict";
11681
11681
  KIND_NAMES = ["inbox", "calendar", "video", "crm", "hubspot-knowledge", "github", "migration", "linkedin", "whatsapp", "facebook", "instagram"];
11682
11682
  load = (name) => async () => {
11683
- const [{ KINDS: KINDS2 }, { connectCommand: connectCommand2 }] = await Promise.all([Promise.resolve().then(() => (init_kinds(), kinds_exports)), Promise.resolve().then(() => (init_run(), run_exports))]);
11684
- const kind = KINDS2.find((k) => k.name === name);
11683
+ const [{ KINDS: KINDS3 }, { connectCommand: connectCommand2 }] = await Promise.all([Promise.resolve().then(() => (init_kinds(), kinds_exports)), Promise.resolve().then(() => (init_run(), run_exports))]);
11684
+ const kind = KINDS3.find((k) => k.name === name);
11685
11685
  if (!kind) throw new Error(`no connect kind ${name}`);
11686
11686
  return connectCommand2(kind);
11687
11687
  };
@@ -12669,12 +12669,12 @@ import { join as join14 } from "node:path";
12669
12669
  function whereDir(env) {
12670
12670
  return join14(runsRoot(env), WHERE_DIR);
12671
12671
  }
12672
- async function unfinishedWhereIds(ctx, command70, args) {
12672
+ async function unfinishedWhereIds(ctx, command71, args) {
12673
12673
  const dir3 = whereDir(ctx.env);
12674
12674
  const identity = argsIdentity(args);
12675
12675
  const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
12676
12676
  for (const run of await listRuns(ctx.env)) {
12677
- if (run.command !== command70 || run.status === "done" || run.status === "planned") continue;
12677
+ if (run.command !== command71 || run.status === "done" || run.status === "planned") continue;
12678
12678
  if ((run.workspaceId || void 0) !== (workspaceId || void 0) || argsIdentity(run.args) !== identity) continue;
12679
12679
  if (run.inputPath?.startsWith(`${dir3}/`) && existsSync6(run.inputPath)) return run.inputPath;
12680
12680
  }
@@ -12820,14 +12820,14 @@ async function idsFromRun(ctx, runId) {
12820
12820
  return { ...idItems(ids2), source: "run" };
12821
12821
  }
12822
12822
  async function collectIds(ctx, flags, kind, dryRun2) {
12823
- const command70 = `kenso contacts ${kind}`;
12823
+ const command71 = `kenso contacts ${kind}`;
12824
12824
  const ids2 = stringFlag2(flags, "ids");
12825
12825
  const where = kind === "restore" ? void 0 : stringFlag2(flags, "where");
12826
12826
  const run = kind === "restore" ? stringFlag2(flags, "run") : void 0;
12827
12827
  const given = [ids2, where, run].filter((v) => v !== void 0).length;
12828
12828
  if (given !== 1) {
12829
12829
  const choices = kind === "restore" ? "--ids <file|-> or --run <runId>" : "--ids <file|-> or --where '<json>'";
12830
- throw usageError(`${command70} needs exactly one of ${choices}.`, { field: "ids", next: `${command70} --help` });
12830
+ throw usageError(`${command71} needs exactly one of ${choices}.`, { field: "ids", next: `${command71} --help` });
12831
12831
  }
12832
12832
  if (ids2 !== void 0) return idsFromFile(ctx, ids2);
12833
12833
  if (where !== void 0) return idsFromWhere(ctx, kind, flags, where, dryRun2);
@@ -13439,10 +13439,10 @@ function detailOf(entry, cards) {
13439
13439
  }
13440
13440
  return out;
13441
13441
  }
13442
- function unknown(words) {
13442
+ function unknown(words2) {
13443
13443
  return new KensoError({
13444
13444
  code: "unknown_command",
13445
- message: `Unknown command "kenso ${words.join(" ")}".`,
13445
+ message: `Unknown command "kenso ${words2.join(" ")}".`,
13446
13446
  exitCode: ExitCode.Usage,
13447
13447
  hint: "Run kenso describe to list the commands.",
13448
13448
  next: "kenso describe"
@@ -13521,12 +13521,299 @@ var init_describe2 = __esm({
13521
13521
  }
13522
13522
  });
13523
13523
 
13524
+ // scripts/discover-synonyms.ts
13525
+ function stem(word) {
13526
+ if (word.length > 4 && word.endsWith("ies")) return `${word.slice(0, -3)}y`;
13527
+ if (word.length > 3 && word.endsWith("s") && !word.endsWith("ss")) return word.slice(0, -1);
13528
+ return word;
13529
+ }
13530
+ function words(text4) {
13531
+ return text4.replace(/linkedin/gi, "linkedin").replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter((word) => word.length > 1 && !STOP_WORDS.has(word)).map(stem);
13532
+ }
13533
+ function termsOf(...texts) {
13534
+ const out = /* @__PURE__ */ new Set();
13535
+ for (const text4 of texts) {
13536
+ for (const word of words(text4 ?? "")) {
13537
+ out.add(word);
13538
+ for (const other of FOLDED.get(word) ?? []) out.add(other);
13539
+ }
13540
+ }
13541
+ return [...out];
13542
+ }
13543
+ var SYNONYMS, STOP_WORDS, FOLDED;
13544
+ var init_discover_synonyms = __esm({
13545
+ "scripts/discover-synonyms.ts"() {
13546
+ "use strict";
13547
+ SYNONYMS = [
13548
+ ["lead", "contact"],
13549
+ ["prospect", "contact"],
13550
+ ["company", "account"],
13551
+ ["organization", "account"],
13552
+ ["people", "person"],
13553
+ ["delete", "remove"],
13554
+ ["email", "mail"],
13555
+ ["inbox", "mailbox"],
13556
+ ["sequence", "cadence"],
13557
+ ["step", "node"],
13558
+ ["log", "trace"],
13559
+ ["run", "execution"],
13560
+ ["pause", "stop"],
13561
+ ["resume", "unpause"],
13562
+ ["launch", "start"],
13563
+ ["reply", "response"],
13564
+ ["reply", "answer"],
13565
+ ["find", "search"],
13566
+ ["search", "lookup"],
13567
+ ["enrich", "enrichment"],
13568
+ ["verify", "validate"],
13569
+ ["check", "validate"],
13570
+ ["export", "download"],
13571
+ ["import", "upload"],
13572
+ ["csv", "file"],
13573
+ ["credit", "cost"],
13574
+ ["price", "cost"],
13575
+ ["spend", "charge"],
13576
+ ["balance", "credit"],
13577
+ ["domain", "website"],
13578
+ ["website", "site"],
13579
+ ["url", "link"],
13580
+ ["job", "hiring"],
13581
+ ["funding", "raise"],
13582
+ ["signal", "trigger"],
13583
+ ["workflow", "automation"],
13584
+ ["tag", "label"],
13585
+ ["segment", "audience"],
13586
+ ["meeting", "call"],
13587
+ ["deal", "opportunity"],
13588
+ ["phone", "mobile"],
13589
+ ["key", "token"],
13590
+ ["login", "auth"],
13591
+ ["workspace", "client"],
13592
+ ["schedule", "cron"],
13593
+ ["bounce", "deliverability"]
13594
+ ];
13595
+ STOP_WORDS = /* @__PURE__ */ new Set([
13596
+ "a",
13597
+ "an",
13598
+ "the",
13599
+ "of",
13600
+ "to",
13601
+ "for",
13602
+ "in",
13603
+ "on",
13604
+ "and",
13605
+ "or",
13606
+ "with",
13607
+ "by",
13608
+ "from",
13609
+ "my",
13610
+ "me",
13611
+ "our",
13612
+ "your",
13613
+ "their",
13614
+ "its",
13615
+ "is",
13616
+ "are",
13617
+ "be",
13618
+ "it",
13619
+ "as",
13620
+ "at",
13621
+ "this",
13622
+ "that",
13623
+ "these",
13624
+ "those",
13625
+ "each",
13626
+ "every",
13627
+ "all",
13628
+ "any",
13629
+ "into",
13630
+ "how",
13631
+ "what",
13632
+ "which",
13633
+ "who",
13634
+ "do",
13635
+ "can",
13636
+ "we",
13637
+ "you"
13638
+ ]);
13639
+ FOLDED = /* @__PURE__ */ new Map();
13640
+ for (const [a, b] of SYNONYMS) {
13641
+ const [x, y] = [stem(a), stem(b)];
13642
+ FOLDED.set(x, [...FOLDED.get(x) ?? [], y]);
13643
+ FOLDED.set(y, [...FOLDED.get(y) ?? [], x]);
13644
+ }
13645
+ }
13646
+ });
13647
+
13648
+ // src/commands/discover/discover.ts
13649
+ var discover_exports = {};
13650
+ __export(discover_exports, {
13651
+ default: () => discover_default
13652
+ });
13653
+ function candidate(entry, costNote) {
13654
+ return { entry, strong: new Set(termsOf(entry.id, entry.summary)), terms: new Set(entry.terms), costNote };
13655
+ }
13656
+ function specEntry(spec) {
13657
+ if (spec.brief?.startsWith("same as ")) return void 0;
13658
+ const id = commandName(spec).slice("kenso ".length);
13659
+ const credits2 = spec.cost ?? [];
13660
+ const actions39 = credits2.map((c) => c.action);
13661
+ return {
13662
+ kind: "command",
13663
+ id,
13664
+ summary: spec.summary,
13665
+ terms: termsOf(id, spec.summary, spec.description, spec.doc?.when, Object.keys(spec.flags).join(" "), actions39.join(" ")),
13666
+ effect: spec.effect,
13667
+ ...credits2.length > 0 ? { costActions: actions39, credits: credits2 } : {},
13668
+ ...spec.beta ? { beta: true } : {},
13669
+ describe: `kenso describe ${id}`
13670
+ };
13671
+ }
13672
+ function handWrittenTakes(id) {
13673
+ const [resource = "", action = ""] = id.split(" ");
13674
+ const area = handWritten[resource];
13675
+ return area !== void 0 && (area[action] !== void 0 || area[""] !== void 0);
13676
+ }
13677
+ function skillFallback(entry) {
13678
+ return entry.bundled ? "kenso docs agents" : `kenso mcp call load_skill --args '{"name":"${entry.id}"}'`;
13679
+ }
13680
+ async function candidates() {
13681
+ const out = [];
13682
+ for (const area of Object.values(handWritten)) {
13683
+ for (const load2 of Object.values(area)) {
13684
+ const spec = await load2();
13685
+ const entry = specEntry(spec);
13686
+ if (entry) out.push(candidate(entry, spec.cost ? void 0 : spec.doc?.cost));
13687
+ }
13688
+ }
13689
+ const hasSkillShow = handWritten.skill?.show !== void 0;
13690
+ for (const entry of readDataFile(INDEX_FILE2)?.entries ?? []) {
13691
+ if (entry.kind === "command" && handWrittenTakes(entry.id)) continue;
13692
+ out.push(candidate(entry.kind === "skill" && !hasSkillShow ? { ...entry, describe: skillFallback(entry) } : entry));
13693
+ }
13694
+ for (const topic of TOPICS) {
13695
+ const summary = `${topic.title} - ${topic.description}`;
13696
+ out.push(candidate({ kind: "doc", id: topic.topic, summary, terms: termsOf(topic.topic, summary), describe: `kenso docs ${topic.topic}` }));
13697
+ }
13698
+ return out;
13699
+ }
13700
+ function score(c, tokens) {
13701
+ let points = 0;
13702
+ let matched = 0;
13703
+ for (const token of new Set(tokens)) {
13704
+ const weight = c.strong.has(token) ? 2 : c.terms.has(token) ? 1 : 0;
13705
+ points += weight;
13706
+ if (weight > 0) matched++;
13707
+ }
13708
+ return { points, matched };
13709
+ }
13710
+ function rank(all, query, kind) {
13711
+ const arrow = query.indexOf("->");
13712
+ const have = words(arrow < 0 ? query : query.slice(0, arrow));
13713
+ const need = arrow < 0 ? [] : words(query.slice(arrow + 2));
13714
+ const out = [];
13715
+ for (const c of all) {
13716
+ if (kind !== void 0 && c.entry.kind !== kind) continue;
13717
+ const a = score(c, have);
13718
+ const b = score(c, need);
13719
+ if (a.points + b.points === 0) continue;
13720
+ out.push({ candidate: c, both: arrow < 0 || a.points > 0 && b.points > 0, matched: a.matched + b.matched, points: a.points + b.points });
13721
+ }
13722
+ return out.sort(
13723
+ (x, y) => Number(y.both) - Number(x.both) || y.matched - x.matched || y.points - x.points || x.candidate.terms.size - y.candidate.terms.size || x.candidate.entry.id.localeCompare(y.candidate.entry.id)
13724
+ );
13725
+ }
13726
+ function parseKind(value) {
13727
+ if (value === void 0) return void 0;
13728
+ if (!KINDS2.includes(value)) {
13729
+ throw usageError(`--kind must be one of ${KINDS2.join(", ")}.`, { field: "kind", next: "kenso discover --help" });
13730
+ }
13731
+ return value;
13732
+ }
13733
+ function parseLimit(value) {
13734
+ if (value === void 0) return DEFAULT_LIMIT;
13735
+ if (!/^\d+$/.test(value) || Number(value) < 1) {
13736
+ throw usageError("--limit must be a whole number of 1 or more.", { field: "limit", next: "kenso discover --help" });
13737
+ }
13738
+ return Number(value);
13739
+ }
13740
+ var INDEX_FILE2, KINDS2, DEFAULT_LIMIT, MAX_LIMIT, command25, discover_default;
13741
+ var init_discover = __esm({
13742
+ "src/commands/discover/discover.ts"() {
13743
+ "use strict";
13744
+ init_discover_synonyms();
13745
+ init_errors();
13746
+ init_exit_codes();
13747
+ init_rate_card();
13748
+ init_data();
13749
+ init_content();
13750
+ init_help();
13751
+ init_registry();
13752
+ INDEX_FILE2 = "discover.json";
13753
+ KINDS2 = ["command", "step", "doc", "skill"];
13754
+ DEFAULT_LIMIT = 5;
13755
+ MAX_LIMIT = 10;
13756
+ command25 = {
13757
+ resource: "discover",
13758
+ action: "",
13759
+ summary: "Find the command, docs topic, skill or workflow step for a request, offline",
13760
+ description: `Each argument is one request in plain words, or "<have> -> <need>" (hits that match both sides rank first). Searches this CLI's commands, its docs topics, the Kenso skills and the workflow step and trigger types, with no sign-in and no network. Prints one object per request (NDJSON when piped, one row per hit at a terminal): its hits, each with kind, id, summary, effect, cost (in credits, from the cached or bundled rate card) and describe, the command that tells you more.`,
13761
+ flags: {
13762
+ kind: { type: "string", description: "Only hits of one kind: command, step, doc or skill" },
13763
+ limit: { type: "string", description: "Hits per request, 1 to 10 (5 when not given)" }
13764
+ },
13765
+ positionals: [{ name: "query", required: true, variadic: true, description: 'A request in plain words, or "<have> -> <need>"' }],
13766
+ examples: ['kenso discover "linkedin url -> email"', 'kenso discover "pause a campaign" "run logs"', 'kenso discover "qualify accounts" --kind step'],
13767
+ effect: "read",
13768
+ doc: {
13769
+ when: "You know what you want done but not which command, docs topic, skill or workflow step does it.",
13770
+ next: "Run the hit's describe command, then the command itself, with --dry-run when it changes anything."
13771
+ },
13772
+ async run(ctx, { flags, positionals }) {
13773
+ const kind = parseKind(typeof flags.kind === "string" ? flags.kind : void 0);
13774
+ const asked = parseLimit(typeof flags.limit === "string" ? flags.limit : void 0);
13775
+ const limit = Math.min(asked, MAX_LIMIT);
13776
+ if (asked > MAX_LIMIT) ctx.output.info(`--limit is capped at ${MAX_LIMIT} (asked for ${asked}).`);
13777
+ const all = await candidates();
13778
+ const ranked = positionals.map((query) => ({ query, list: rank(all, query, kind) }));
13779
+ const priced = ranked.some((r) => r.list.slice(0, limit).some((x) => (x.candidate.entry.credits?.length ?? 0) > 0));
13780
+ const cards = priced ? await loadRateCards(ctx, { live: false }) : [];
13781
+ const results = ranked.map(({ query, list: list2 }) => ({
13782
+ query,
13783
+ hits: list2.slice(0, limit).map(({ candidate: c }) => ({
13784
+ kind: c.entry.kind,
13785
+ id: c.entry.id,
13786
+ summary: c.entry.summary,
13787
+ effect: c.entry.effect ?? null,
13788
+ cost: c.entry.credits?.length ? c.entry.credits.map((line) => priceLine(line, cards)).join("; ") : c.costNote ?? null,
13789
+ describe: c.entry.describe
13790
+ })),
13791
+ more: Math.max(0, list2.length - limit)
13792
+ }));
13793
+ if (ctx.output.stdoutIsTTY && ctx.flags.output === void 0 && ctx.flags.query === void 0) {
13794
+ const rows = results.flatMap((r) => r.hits.map((h) => ({ query: r.query, kind: h.kind, id: h.id, effect: h.effect, cost: h.cost, describe: h.describe })));
13795
+ if (rows.length > 0) await ctx.output.list(rows);
13796
+ } else if (results.length === 1) {
13797
+ ctx.output.object(results[0]);
13798
+ } else {
13799
+ await ctx.output.list(results);
13800
+ }
13801
+ if (results.some((r) => r.hits.length === 0)) ctx.output.info("No match. Try other words, or kenso describe for the full command map.");
13802
+ return ExitCode.Ok;
13803
+ }
13804
+ };
13805
+ discover_default = command25;
13806
+ }
13807
+ });
13808
+
13524
13809
  // src/commands/discover/index.ts
13525
13810
  var actions12;
13526
- var init_discover = __esm({
13811
+ var init_discover2 = __esm({
13527
13812
  "src/commands/discover/index.ts"() {
13528
13813
  "use strict";
13529
- actions12 = {};
13814
+ actions12 = {
13815
+ "": () => Promise.resolve().then(() => (init_discover(), discover_exports)).then((m) => m.default)
13816
+ };
13530
13817
  }
13531
13818
  });
13532
13819
 
@@ -13539,7 +13826,7 @@ function findTopic(input) {
13539
13826
  const name = input.trim().toLowerCase().replace(/\.md$/, "");
13540
13827
  return TOPICS.find((t) => t.topic === name);
13541
13828
  }
13542
- var NAMES, command25, docs_default;
13829
+ var NAMES, command26, docs_default;
13543
13830
  var init_docs = __esm({
13544
13831
  "src/commands/docs/docs.ts"() {
13545
13832
  "use strict";
@@ -13547,7 +13834,7 @@ var init_docs = __esm({
13547
13834
  init_exit_codes();
13548
13835
  init_content();
13549
13836
  NAMES = TOPICS.map((t) => t.topic).join(", ");
13550
- command25 = {
13837
+ command26 = {
13551
13838
  resource: "docs",
13552
13839
  action: "",
13553
13840
  summary: "Offline docs: the topic list, or one topic",
@@ -13589,7 +13876,7 @@ var init_docs = __esm({
13589
13876
  return ExitCode.Ok;
13590
13877
  }
13591
13878
  };
13592
- docs_default = command25;
13879
+ docs_default = command26;
13593
13880
  }
13594
13881
  });
13595
13882
 
@@ -13627,7 +13914,7 @@ function configCheck(env) {
13627
13914
  const octal = mode.toString(8).padStart(4, "0");
13628
13915
  return mode === 384 ? { name: "config_permissions", ok: true, detail: `${file} is ${octal}` } : { name: "config_permissions", ok: false, detail: `${file} is ${octal}: run chmod 600 ${file}` };
13629
13916
  }
13630
- var MIN_NODE_MAJOR, command26, actions14;
13917
+ var MIN_NODE_MAJOR, command27, actions14;
13631
13918
  var init_doctor = __esm({
13632
13919
  "src/commands/doctor/index.ts"() {
13633
13920
  "use strict";
@@ -13636,7 +13923,7 @@ var init_doctor = __esm({
13636
13923
  init_exit_codes();
13637
13924
  init_http();
13638
13925
  MIN_NODE_MAJOR = 22;
13639
- command26 = {
13926
+ command27 = {
13640
13927
  resource: "doctor",
13641
13928
  action: "",
13642
13929
  summary: "Check Node, the config, the API and the key",
@@ -13702,7 +13989,7 @@ var init_doctor = __esm({
13702
13989
  }
13703
13990
  };
13704
13991
  actions14 = {
13705
- "": async () => command26
13992
+ "": async () => command27
13706
13993
  };
13707
13994
  }
13708
13995
  });
@@ -13783,7 +14070,7 @@ async function viewBody(ctx, id, object) {
13783
14070
  if (typeof view.sort === "string" && view.sort.trim() !== "") body2.sort = view.sort;
13784
14071
  return body2;
13785
14072
  }
13786
- var OBJECTS, VIEW_EXPORTS, command27, export_default2;
14073
+ var OBJECTS, VIEW_EXPORTS, command28, export_default2;
13787
14074
  var init_export2 = __esm({
13788
14075
  "src/commands/export/export.ts"() {
13789
14076
  "use strict";
@@ -13799,7 +14086,7 @@ var init_export2 = __esm({
13799
14086
  opportunities: { resource: "opportunities", noun: "deals", viewObject: "opportunity" }
13800
14087
  };
13801
14088
  VIEW_EXPORTS = { account: "accounts", person: "people", opportunity: "deals" };
13802
- command27 = {
14089
+ command28 = {
13803
14090
  resource: "export",
13804
14091
  action: "",
13805
14092
  summary: "Export accounts, people or deals as CSV: everything, a saved view, or what the filters match",
@@ -13875,7 +14162,7 @@ var init_export2 = __esm({
13875
14162
  return ExitCode.Ok;
13876
14163
  }
13877
14164
  };
13878
- export_default2 = command27;
14165
+ export_default2 = command28;
13879
14166
  }
13880
14167
  });
13881
14168
 
@@ -13979,7 +14266,7 @@ async function waitUntilFinished(ctx, id, timeoutMs2) {
13979
14266
  await delay8(POLL_MS2, void 0, { signal: ctx.signal });
13980
14267
  }
13981
14268
  }
13982
- var OBJECTS2, DEFAULT_TIMEOUT3, POLL_MS2, FINISHED, command28, import_default3;
14269
+ var OBJECTS2, DEFAULT_TIMEOUT3, POLL_MS2, FINISHED, command29, import_default3;
13983
14270
  var init_import3 = __esm({
13984
14271
  "src/commands/import/import.ts"() {
13985
14272
  "use strict";
@@ -13992,7 +14279,7 @@ var init_import3 = __esm({
13992
14279
  DEFAULT_TIMEOUT3 = "30m";
13993
14280
  POLL_MS2 = 2e3;
13994
14281
  FINISHED = /* @__PURE__ */ new Set(["done", "failed"]);
13995
- command28 = {
14282
+ command29 = {
13996
14283
  resource: "import",
13997
14284
  action: "",
13998
14285
  summary: "Import accounts, people or deals from a CSV file: Kenso proposes the mapping, you approve, it runs in the background",
@@ -14099,7 +14386,7 @@ var init_import3 = __esm({
14099
14386
  return finished.status === "done" ? ExitCode.Ok : ExitCode.Error;
14100
14387
  }
14101
14388
  };
14102
- import_default3 = command28;
14389
+ import_default3 = command29;
14103
14390
  }
14104
14391
  });
14105
14392
 
@@ -14308,7 +14595,7 @@ function readable(row) {
14308
14595
  const parts2 = [time, `[${row.status}]`, row.method, row.pathTemplate, row.errorCode, `${row.durationMs}ms`, row.apiKeyId, row.requestId];
14309
14596
  return parts2.filter((p) => p !== void 0 && p !== "").join(" ");
14310
14597
  }
14311
- var MIN_INTERVAL_MS, MAX_INTERVAL_MS, MAX_SINCE_MS, OVERLAP_MS, MAX_PAGES, RATE_LIMITED_WAIT_MS, isOwnPoll, pad, command29, tail_default;
14598
+ var MIN_INTERVAL_MS, MAX_INTERVAL_MS, MAX_SINCE_MS, OVERLAP_MS, MAX_PAGES, RATE_LIMITED_WAIT_MS, isOwnPoll, pad, command30, tail_default;
14312
14599
  var init_tail = __esm({
14313
14600
  "src/commands/logs/tail.ts"() {
14314
14601
  "use strict";
@@ -14324,7 +14611,7 @@ var init_tail = __esm({
14324
14611
  RATE_LIMITED_WAIT_MS = 3e4;
14325
14612
  isOwnPoll = (row) => row.method === "GET" && row.pathTemplate === "/v1/api-requests" && row.userAgent?.startsWith("kenso-cli/") === true;
14326
14613
  pad = (n) => String(n).padStart(2, "0");
14327
- command29 = {
14614
+ command30 = {
14328
14615
  resource: "logs",
14329
14616
  action: "tail",
14330
14617
  summary: "Stream your workspace's new API request log rows",
@@ -14431,7 +14718,7 @@ var init_tail = __esm({
14431
14718
  return ExitCode.Ok;
14432
14719
  }
14433
14720
  };
14434
- tail_default = command29;
14721
+ tail_default = command30;
14435
14722
  }
14436
14723
  });
14437
14724
 
@@ -14496,7 +14783,7 @@ function isRecord9(value) {
14496
14783
  function textOf(result) {
14497
14784
  return (result.content ?? []).filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text).join("\n");
14498
14785
  }
14499
- var command30, call_default;
14786
+ var command31, call_default;
14500
14787
  var init_call = __esm({
14501
14788
  "src/commands/mcp/call.ts"() {
14502
14789
  "use strict";
@@ -14504,7 +14791,7 @@ var init_call = __esm({
14504
14791
  init_exit_codes();
14505
14792
  init_input();
14506
14793
  init_connect4();
14507
- command30 = {
14794
+ command31 = {
14508
14795
  resource: "mcp",
14509
14796
  action: "call",
14510
14797
  summary: "Call a hosted Kenso MCP tool, such as list_skills",
@@ -14560,7 +14847,7 @@ var init_call = __esm({
14560
14847
  return ExitCode.Ok;
14561
14848
  }
14562
14849
  };
14563
- call_default = command30;
14850
+ call_default = command31;
14564
14851
  }
14565
14852
  });
14566
14853
 
@@ -14569,13 +14856,13 @@ var tools_exports = {};
14569
14856
  __export(tools_exports, {
14570
14857
  default: () => tools_default
14571
14858
  });
14572
- var command31, tools_default;
14859
+ var command32, tools_default;
14573
14860
  var init_tools = __esm({
14574
14861
  "src/commands/mcp/tools.ts"() {
14575
14862
  "use strict";
14576
14863
  init_exit_codes();
14577
14864
  init_connect4();
14578
- command31 = {
14865
+ command32 = {
14579
14866
  resource: "mcp",
14580
14867
  action: "tools",
14581
14868
  summary: "List the hosted Kenso MCP's tools",
@@ -14591,7 +14878,7 @@ var init_tools = __esm({
14591
14878
  return ExitCode.Ok;
14592
14879
  }
14593
14880
  };
14594
- tools_default = command31;
14881
+ tools_default = command32;
14595
14882
  }
14596
14883
  });
14597
14884
 
@@ -14644,14 +14931,14 @@ var list_exports = {};
14644
14931
  __export(list_exports, {
14645
14932
  default: () => list_default
14646
14933
  });
14647
- var command32, list_default;
14934
+ var command33, list_default;
14648
14935
  var init_list = __esm({
14649
14936
  "src/commands/notes/list.ts"() {
14650
14937
  "use strict";
14651
14938
  init_errors();
14652
14939
  init_exit_codes();
14653
14940
  init_target();
14654
- command32 = {
14941
+ command33 = {
14655
14942
  resource: "notes",
14656
14943
  action: "list",
14657
14944
  summary: "List the notes on an account, a person or a deal, or every comment under one note",
@@ -14685,7 +14972,7 @@ var init_list = __esm({
14685
14972
  return ExitCode.Ok;
14686
14973
  }
14687
14974
  };
14688
- list_default = command32;
14975
+ list_default = command33;
14689
14976
  }
14690
14977
  });
14691
14978
 
@@ -14700,7 +14987,7 @@ async function bodyText(ctx, value, next) {
14700
14987
  if (text4.trim() === "") throw usageError("--body cannot be empty: the note's text, in markdown (--body - reads stdin).", { field: "body", next });
14701
14988
  return text4;
14702
14989
  }
14703
- var command33, add_default;
14990
+ var command34, add_default;
14704
14991
  var init_add = __esm({
14705
14992
  "src/commands/notes/add.ts"() {
14706
14993
  "use strict";
@@ -14710,7 +14997,7 @@ var init_add = __esm({
14710
14997
  init_http();
14711
14998
  init_input();
14712
14999
  init_target();
14713
- command33 = {
15000
+ command34 = {
14714
15001
  resource: "notes",
14715
15002
  action: "add",
14716
15003
  summary: "Write a note on an account, a person or a deal, or a comment under a note",
@@ -14744,7 +15031,7 @@ var init_add = __esm({
14744
15031
  return ExitCode.Ok;
14745
15032
  }
14746
15033
  };
14747
- add_default = command33;
15034
+ add_default = command34;
14748
15035
  }
14749
15036
  });
14750
15037
 
@@ -14753,7 +15040,7 @@ var edit_exports = {};
14753
15040
  __export(edit_exports, {
14754
15041
  default: () => edit_default
14755
15042
  });
14756
- var command34, edit_default;
15043
+ var command35, edit_default;
14757
15044
  var init_edit = __esm({
14758
15045
  "src/commands/notes/edit.ts"() {
14759
15046
  "use strict";
@@ -14763,7 +15050,7 @@ var init_edit = __esm({
14763
15050
  init_http();
14764
15051
  init_add();
14765
15052
  init_target();
14766
- command34 = {
15053
+ command35 = {
14767
15054
  resource: "notes",
14768
15055
  action: "edit",
14769
15056
  summary: "Change a note's text, or pin or unpin it",
@@ -14794,7 +15081,7 @@ var init_edit = __esm({
14794
15081
  return ExitCode.Ok;
14795
15082
  }
14796
15083
  };
14797
- edit_default = command34;
15084
+ edit_default = command35;
14798
15085
  }
14799
15086
  });
14800
15087
 
@@ -14803,7 +15090,7 @@ var delete_exports = {};
14803
15090
  __export(delete_exports, {
14804
15091
  default: () => delete_default
14805
15092
  });
14806
- var command35, delete_default;
15093
+ var command36, delete_default;
14807
15094
  var init_delete = __esm({
14808
15095
  "src/commands/notes/delete.ts"() {
14809
15096
  "use strict";
@@ -14811,7 +15098,7 @@ var init_delete = __esm({
14811
15098
  init_dry_run();
14812
15099
  init_exit_codes();
14813
15100
  init_target();
14814
- command35 = {
15101
+ command36 = {
14815
15102
  resource: "notes",
14816
15103
  action: "delete",
14817
15104
  summary: "Delete a note or a comment (its author or a workspace admin)",
@@ -14833,7 +15120,7 @@ var init_delete = __esm({
14833
15120
  return ExitCode.Ok;
14834
15121
  }
14835
15122
  };
14836
- delete_default = command35;
15123
+ delete_default = command36;
14837
15124
  }
14838
15125
  });
14839
15126
 
@@ -14869,7 +15156,7 @@ async function categoryOf(ctx, stage) {
14869
15156
  throw err;
14870
15157
  }
14871
15158
  }
14872
- var KEY, ID, command36, move_default;
15159
+ var KEY, ID, command37, move_default;
14873
15160
  var init_move = __esm({
14874
15161
  "src/commands/opportunities/move.ts"() {
14875
15162
  "use strict";
@@ -14879,7 +15166,7 @@ var init_move = __esm({
14879
15166
  init_http();
14880
15167
  KEY = /^[a-z][a-z0-9_]{0,62}$/;
14881
15168
  ID = /^[1-9]\d*$/;
14882
- command36 = {
15169
+ command37 = {
14883
15170
  resource: "opportunities",
14884
15171
  action: "move",
14885
15172
  summary: "Move a deal to a stage or another pipeline, with its won or lost reason",
@@ -14948,7 +15235,7 @@ var init_move = __esm({
14948
15235
  return ExitCode.Ok;
14949
15236
  }
14950
15237
  };
14951
- move_default = command36;
15238
+ move_default = command37;
14952
15239
  }
14953
15240
  });
14954
15241
 
@@ -14957,14 +15244,14 @@ var stage_history_exports = {};
14957
15244
  __export(stage_history_exports, {
14958
15245
  default: () => stage_history_default
14959
15246
  });
14960
- var command37, stage_history_default;
15247
+ var command38, stage_history_default;
14961
15248
  var init_stage_history = __esm({
14962
15249
  "src/commands/opportunities/stage-history.ts"() {
14963
15250
  "use strict";
14964
15251
  init_errors();
14965
15252
  init_exit_codes();
14966
15253
  init_http();
14967
- command37 = {
15254
+ command38 = {
14968
15255
  resource: "opportunities",
14969
15256
  action: "stage-history",
14970
15257
  summary: "Show a deal's stage history: each stage, when, who moved it and how long it sat there",
@@ -14989,7 +15276,7 @@ var init_stage_history = __esm({
14989
15276
  return ExitCode.Ok;
14990
15277
  }
14991
15278
  };
14992
- stage_history_default = command37;
15279
+ stage_history_default = command38;
14993
15280
  }
14994
15281
  });
14995
15282
 
@@ -15129,7 +15416,7 @@ function summarize3(results) {
15129
15416
  }
15130
15417
  return { matched, addedToAccounts, emailFindsQueued };
15131
15418
  }
15132
- var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command38, import_default4;
15419
+ var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command39, import_default4;
15133
15420
  var init_import5 = __esm({
15134
15421
  "src/commands/people/import.ts"() {
15135
15422
  "use strict";
@@ -15161,7 +15448,7 @@ var init_import5 = __esm({
15161
15448
  };
15162
15449
  PERSON_FIELDS = ["email", "fullName", "firstName", "lastName", "linkedinUrl", "title"];
15163
15450
  ACCOUNT_NOT_FOUND = "No account in this workspace has that domain. The person was saved without an account: add the account (kenso accounts import) and run the same command again.";
15164
- command38 = {
15451
+ command39 = {
15165
15452
  resource: "people",
15166
15453
  action: "import",
15167
15454
  summary: "Create or match people from a CSV or JSONL file, optionally onto accounts",
@@ -15228,7 +15515,7 @@ var init_import5 = __esm({
15228
15515
  return outcome.exitCode;
15229
15516
  }
15230
15517
  };
15231
- import_default4 = command38;
15518
+ import_default4 = command39;
15232
15519
  }
15233
15520
  });
15234
15521
 
@@ -15289,7 +15576,7 @@ var merge_exports2 = {};
15289
15576
  __export(merge_exports2, {
15290
15577
  default: () => merge_default2
15291
15578
  });
15292
- var command39, merge_default2;
15579
+ var command40, merge_default2;
15293
15580
  var init_merge2 = __esm({
15294
15581
  "src/commands/people/merge.ts"() {
15295
15582
  "use strict";
@@ -15298,7 +15585,7 @@ var init_merge2 = __esm({
15298
15585
  init_exit_codes();
15299
15586
  init_http();
15300
15587
  init_common();
15301
- command39 = {
15588
+ command40 = {
15302
15589
  resource: "people",
15303
15590
  action: "merge",
15304
15591
  summary: "Merge a person into the one you keep. --dry-run shows what would move and writes nothing",
@@ -15345,7 +15632,7 @@ var init_merge2 = __esm({
15345
15632
  return ExitCode.Ok;
15346
15633
  }
15347
15634
  };
15348
- merge_default2 = command39;
15635
+ merge_default2 = command40;
15349
15636
  }
15350
15637
  });
15351
15638
 
@@ -15383,7 +15670,7 @@ function rule(stage) {
15383
15670
  isDefault: stage.isDefaultRequiredFields
15384
15671
  };
15385
15672
  }
15386
- var ID2, command40, stage_rules_default;
15673
+ var ID2, command41, stage_rules_default;
15387
15674
  var init_stage_rules = __esm({
15388
15675
  "src/commands/pipelines/stage-rules.ts"() {
15389
15676
  "use strict";
@@ -15392,7 +15679,7 @@ var init_stage_rules = __esm({
15392
15679
  init_exit_codes();
15393
15680
  init_http();
15394
15681
  ID2 = /^[1-9]\d*$/;
15395
- command40 = {
15682
+ command41 = {
15396
15683
  resource: "pipelines",
15397
15684
  action: "stage-rules",
15398
15685
  summary: "List or set the fields a deal should have in each stage",
@@ -15466,7 +15753,7 @@ var init_stage_rules = __esm({
15466
15753
  return ExitCode.Ok;
15467
15754
  }
15468
15755
  };
15469
- stage_rules_default = command40;
15756
+ stage_rules_default = command41;
15470
15757
  }
15471
15758
  });
15472
15759
 
@@ -15486,7 +15773,7 @@ var run_exports2 = {};
15486
15773
  __export(run_exports2, {
15487
15774
  default: () => run_default
15488
15775
  });
15489
- var REPORTS, command41, run_default;
15776
+ var REPORTS, command42, run_default;
15490
15777
  var init_run2 = __esm({
15491
15778
  "src/commands/reports/run.ts"() {
15492
15779
  "use strict";
@@ -15494,7 +15781,7 @@ var init_run2 = __esm({
15494
15781
  init_exit_codes();
15495
15782
  init_http();
15496
15783
  REPORTS = ["pipeline_by_stage", "won_by_month", "stage_conversion", "time_in_stage", "won_by_source_campaign", "activity_by_member"];
15497
- command41 = {
15784
+ command42 = {
15498
15785
  resource: "reports",
15499
15786
  action: "run",
15500
15787
  summary: "Run a stock pipeline report and print its table",
@@ -15566,7 +15853,7 @@ var init_run2 = __esm({
15566
15853
  return ExitCode.Ok;
15567
15854
  }
15568
15855
  };
15569
- run_default = command41;
15856
+ run_default = command42;
15570
15857
  }
15571
15858
  });
15572
15859
 
@@ -15575,14 +15862,14 @@ var summary_exports = {};
15575
15862
  __export(summary_exports, {
15576
15863
  default: () => summary_default
15577
15864
  });
15578
- var command42, summary_default;
15865
+ var command43, summary_default;
15579
15866
  var init_summary = __esm({
15580
15867
  "src/commands/reports/summary.ts"() {
15581
15868
  "use strict";
15582
15869
  init_errors();
15583
15870
  init_exit_codes();
15584
15871
  init_http();
15585
- command42 = {
15872
+ command43 = {
15586
15873
  resource: "reports",
15587
15874
  action: "summary",
15588
15875
  summary: "Read where the period stands and what needs you",
@@ -15644,7 +15931,7 @@ var init_summary = __esm({
15644
15931
  return ExitCode.Ok;
15645
15932
  }
15646
15933
  };
15647
- summary_default = command42;
15934
+ summary_default = command43;
15648
15935
  }
15649
15936
  });
15650
15937
 
@@ -15665,14 +15952,14 @@ var list_exports2 = {};
15665
15952
  __export(list_exports2, {
15666
15953
  default: () => list_default2
15667
15954
  });
15668
- var command43, list_default2;
15955
+ var command44, list_default2;
15669
15956
  var init_list2 = __esm({
15670
15957
  "src/commands/runs/list.ts"() {
15671
15958
  "use strict";
15672
15959
  init_runs();
15673
15960
  init_errors();
15674
15961
  init_exit_codes();
15675
- command43 = {
15962
+ command44 = {
15676
15963
  resource: "runs",
15677
15964
  action: "list",
15678
15965
  summary: "List batch runs, newest first (finds an interrupted run)",
@@ -15694,7 +15981,7 @@ var init_list2 = __esm({
15694
15981
  return ExitCode.Ok;
15695
15982
  }
15696
15983
  };
15697
- list_default2 = command43;
15984
+ list_default2 = command44;
15698
15985
  }
15699
15986
  });
15700
15987
 
@@ -15705,7 +15992,7 @@ __export(show_exports2, {
15705
15992
  });
15706
15993
  import { existsSync as existsSync7, readFileSync as readFileSync11 } from "node:fs";
15707
15994
  import { join as join15 } from "node:path";
15708
- var FILES, command44, show_default2;
15995
+ var FILES, command45, show_default2;
15709
15996
  var init_show2 = __esm({
15710
15997
  "src/commands/runs/show.ts"() {
15711
15998
  "use strict";
@@ -15720,7 +16007,7 @@ var init_show2 = __esm({
15720
16007
  ["plan", "plan.json"],
15721
16008
  ["summary", "summary.json"]
15722
16009
  ];
15723
- command44 = {
16010
+ command45 = {
15724
16011
  resource: "runs",
15725
16012
  action: "show",
15726
16013
  summary: "Show one batch run and its files",
@@ -15748,7 +16035,7 @@ var init_show2 = __esm({
15748
16035
  return ExitCode.Ok;
15749
16036
  }
15750
16037
  };
15751
- show_default2 = command44;
16038
+ show_default2 = command45;
15752
16039
  }
15753
16040
  });
15754
16041
 
@@ -15765,8 +16052,8 @@ import { resolve as resolve10 } from "node:path";
15765
16052
  function kebab(key) {
15766
16053
  return key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
15767
16054
  }
15768
- function commandWords(command70) {
15769
- return command70.trim().split(/\s+/).filter((t) => t !== "");
16055
+ function commandWords(command71) {
16056
+ return command71.trim().split(/\s+/).filter((t) => t !== "");
15770
16057
  }
15771
16058
  function flagValue(value) {
15772
16059
  return typeof value === "string" ? value : typeof value === "object" ? JSON.stringify(value) : String(value);
@@ -15811,19 +16098,19 @@ async function sha256(path) {
15811
16098
  return createHash5("sha256").update(await readFile9(path)).digest("hex");
15812
16099
  }
15813
16100
  async function refuseUnlessBatch(run, next) {
15814
- const words = commandWords(run.command);
15815
- const name = words.join(" ");
15816
- if (words[0] === "work") {
16101
+ const words2 = commandWords(run.command);
16102
+ const name = words2.join(" ");
16103
+ if (words2[0] === "work") {
15817
16104
  throw usageError(`Run ${run.runId} is a kenso ${name} run, which cannot be resumed: its claims were released or expire on their own.`, {
15818
16105
  hint: name === "work pull" ? `Answer its work files in ${run.dir}, then send them with kenso work submit. New work: run kenso work pull again.` : "Run kenso work run again: it takes the work that waits now.",
15819
16106
  next: "kenso work status"
15820
16107
  });
15821
16108
  }
15822
- const [resourceWord = "", action = ""] = words;
16109
+ const [resourceWord = "", action = ""] = words2;
15823
16110
  const resource = resourceAliases[resourceWord] ?? resourceWord;
15824
16111
  const area = Object.hasOwn(handWritten, resource) ? handWritten[resource] : {};
15825
16112
  let spec = null;
15826
- if (words.length === 2 && !Object.hasOwn(area, "")) {
16113
+ if (words2.length === 2 && !Object.hasOwn(area, "")) {
15827
16114
  const loader = Object.hasOwn(area, action) ? area[action] : void 0;
15828
16115
  spec = loader ? await loader() : await resolveGenerated(resource, action);
15829
16116
  }
@@ -15839,7 +16126,7 @@ async function refuseUnlessBatch(run, next) {
15839
16126
  throw usageError(`Run ${run.runId} names flags kenso ${name} does not take (--${undeclared.join(", --")}), so it is not replayed.`, { next });
15840
16127
  }
15841
16128
  }
15842
- var SKIPPED_KEYS, command45, resume_default;
16129
+ var SKIPPED_KEYS, command46, resume_default;
15843
16130
  var init_resume = __esm({
15844
16131
  "src/commands/runs/resume.ts"() {
15845
16132
  "use strict";
@@ -15848,7 +16135,7 @@ var init_resume = __esm({
15848
16135
  init_generated_hook();
15849
16136
  init_registry();
15850
16137
  SKIPPED_KEYS = /* @__PURE__ */ new Set(["positionals", "yes", "dryRun", "dry-run", "help", "version"]);
15851
- command45 = {
16138
+ command46 = {
15852
16139
  resource: "runs",
15853
16140
  action: "resume",
15854
16141
  summary: "Continue an interrupted batch run (its command with --yes, no dry run)",
@@ -15899,7 +16186,7 @@ var init_resume = __esm({
15899
16186
  }
15900
16187
  }
15901
16188
  };
15902
- resume_default = command45;
16189
+ resume_default = command46;
15903
16190
  }
15904
16191
  });
15905
16192
 
@@ -16007,7 +16294,7 @@ var create_exports = {};
16007
16294
  __export(create_exports, {
16008
16295
  default: () => create_default
16009
16296
  });
16010
- var command46, create_default;
16297
+ var command47, create_default;
16011
16298
  var init_create = __esm({
16012
16299
  "src/commands/sandbox/create.ts"() {
16013
16300
  "use strict";
@@ -16015,7 +16302,7 @@ var init_create = __esm({
16015
16302
  init_exit_codes();
16016
16303
  init_http();
16017
16304
  init_shared();
16018
- command46 = {
16305
+ command47 = {
16019
16306
  resource: "sandbox",
16020
16307
  action: "create",
16021
16308
  summary: "Create your developer sandbox and save its test key as the sandbox profile",
@@ -16058,7 +16345,7 @@ var init_create = __esm({
16058
16345
  return ExitCode.Ok;
16059
16346
  }
16060
16347
  };
16061
- create_default = command46;
16348
+ create_default = command47;
16062
16349
  }
16063
16350
  });
16064
16351
 
@@ -16067,7 +16354,7 @@ var delete_exports2 = {};
16067
16354
  __export(delete_exports2, {
16068
16355
  default: () => delete_default2
16069
16356
  });
16070
- var command47, delete_default2;
16357
+ var command48, delete_default2;
16071
16358
  var init_delete2 = __esm({
16072
16359
  "src/commands/sandbox/delete.ts"() {
16073
16360
  "use strict";
@@ -16075,7 +16362,7 @@ var init_delete2 = __esm({
16075
16362
  init_confirm();
16076
16363
  init_exit_codes();
16077
16364
  init_shared();
16078
- command47 = {
16365
+ command48 = {
16079
16366
  resource: "sandbox",
16080
16367
  action: "delete",
16081
16368
  summary: "Delete your sandbox and its test keys",
@@ -16103,7 +16390,7 @@ var init_delete2 = __esm({
16103
16390
  return ExitCode.Ok;
16104
16391
  }
16105
16392
  };
16106
- delete_default2 = command47;
16393
+ delete_default2 = command48;
16107
16394
  }
16108
16395
  });
16109
16396
 
@@ -16112,14 +16399,14 @@ var key_exports = {};
16112
16399
  __export(key_exports, {
16113
16400
  default: () => key_default
16114
16401
  });
16115
- var command48, key_default;
16402
+ var command49, key_default;
16116
16403
  var init_key = __esm({
16117
16404
  "src/commands/sandbox/key.ts"() {
16118
16405
  "use strict";
16119
16406
  init_exit_codes();
16120
16407
  init_http();
16121
16408
  init_shared();
16122
- command48 = {
16409
+ command49 = {
16123
16410
  resource: "sandbox",
16124
16411
  action: "key",
16125
16412
  summary: "Create a new test key for your sandbox and save it as the sandbox profile",
@@ -16140,7 +16427,7 @@ var init_key = __esm({
16140
16427
  return ExitCode.Ok;
16141
16428
  }
16142
16429
  };
16143
- key_default = command48;
16430
+ key_default = command49;
16144
16431
  }
16145
16432
  });
16146
16433
 
@@ -16149,13 +16436,13 @@ var list_exports3 = {};
16149
16436
  __export(list_exports3, {
16150
16437
  default: () => list_default3
16151
16438
  });
16152
- var command49, list_default3;
16439
+ var command50, list_default3;
16153
16440
  var init_list3 = __esm({
16154
16441
  "src/commands/sandbox/list.ts"() {
16155
16442
  "use strict";
16156
16443
  init_exit_codes();
16157
16444
  init_shared();
16158
- command49 = {
16445
+ command50 = {
16159
16446
  resource: "sandbox",
16160
16447
  action: "list",
16161
16448
  summary: "List your developer sandbox",
@@ -16172,7 +16459,7 @@ var init_list3 = __esm({
16172
16459
  return ExitCode.Ok;
16173
16460
  }
16174
16461
  };
16175
- list_default3 = command49;
16462
+ list_default3 = command50;
16176
16463
  }
16177
16464
  });
16178
16465
 
@@ -16181,14 +16468,14 @@ var reset_exports = {};
16181
16468
  __export(reset_exports, {
16182
16469
  default: () => reset_default
16183
16470
  });
16184
- var command50, reset_default;
16471
+ var command51, reset_default;
16185
16472
  var init_reset = __esm({
16186
16473
  "src/commands/sandbox/reset.ts"() {
16187
16474
  "use strict";
16188
16475
  init_exit_codes();
16189
16476
  init_http();
16190
16477
  init_shared();
16191
- command50 = {
16478
+ command51 = {
16192
16479
  resource: "sandbox",
16193
16480
  action: "reset",
16194
16481
  summary: "Reset your sandbox to its seed data",
@@ -16207,7 +16494,7 @@ var init_reset = __esm({
16207
16494
  return ExitCode.Ok;
16208
16495
  }
16209
16496
  };
16210
- reset_default = command50;
16497
+ reset_default = command51;
16211
16498
  }
16212
16499
  });
16213
16500
 
@@ -16572,7 +16859,7 @@ __export(pull_exports, {
16572
16859
  });
16573
16860
  import { mkdir, readFile as readFile11, writeFile as writeFile5 } from "node:fs/promises";
16574
16861
  import { dirname as dirname2, join as join17, resolve as resolve12 } from "node:path";
16575
- var command51, pull_default;
16862
+ var command52, pull_default;
16576
16863
  var init_pull = __esm({
16577
16864
  "src/commands/studio/pull.ts"() {
16578
16865
  "use strict";
@@ -16583,7 +16870,7 @@ var init_pull = __esm({
16583
16870
  init_common3();
16584
16871
  init_folder();
16585
16872
  init_transfer2();
16586
- command51 = {
16873
+ command52 = {
16587
16874
  resource: "studio",
16588
16875
  action: "pull",
16589
16876
  summary: "Write a template version's files to a folder",
@@ -16665,7 +16952,7 @@ var init_pull = __esm({
16665
16952
  return ExitCode.Ok;
16666
16953
  }
16667
16954
  };
16668
- pull_default = command51;
16955
+ pull_default = command52;
16669
16956
  }
16670
16957
  });
16671
16958
 
@@ -16706,7 +16993,7 @@ __export(push_exports, {
16706
16993
  default: () => push_default
16707
16994
  });
16708
16995
  import { resolve as resolve13 } from "node:path";
16709
- var BUILT_BY, DEFAULT_MESSAGE, command52, push_default;
16996
+ var BUILT_BY, DEFAULT_MESSAGE, command53, push_default;
16710
16997
  var init_push = __esm({
16711
16998
  "src/commands/studio/push.ts"() {
16712
16999
  "use strict";
@@ -16720,7 +17007,7 @@ var init_push = __esm({
16720
17007
  init_transfer2();
16721
17008
  BUILT_BY = "customer_agent";
16722
17009
  DEFAULT_MESSAGE = "Pushed with the Kenso CLI";
16723
- command52 = {
17010
+ command53 = {
16724
17011
  resource: "studio",
16725
17012
  action: "push",
16726
17013
  summary: "Save a folder's files to a template's draft and print the validation",
@@ -16815,7 +17102,7 @@ var init_push = __esm({
16815
17102
  );
16816
17103
  }
16817
17104
  };
16818
- push_default = command52;
17105
+ push_default = command53;
16819
17106
  }
16820
17107
  });
16821
17108
 
@@ -16824,7 +17111,7 @@ var validate_exports = {};
16824
17111
  __export(validate_exports, {
16825
17112
  default: () => validate_default
16826
17113
  });
16827
- var command53, validate_default;
17114
+ var command54, validate_default;
16828
17115
  var init_validate = __esm({
16829
17116
  "src/commands/studio/validate.ts"() {
16830
17117
  "use strict";
@@ -16833,7 +17120,7 @@ var init_validate = __esm({
16833
17120
  init_columns();
16834
17121
  init_common3();
16835
17122
  init_read();
16836
- command53 = {
17123
+ command54 = {
16837
17124
  resource: "studio",
16838
17125
  action: "validate",
16839
17126
  summary: "Validate a folder's files against a template without saving them",
@@ -16863,7 +17150,7 @@ var init_validate = __esm({
16863
17150
  throw validationFailed(validation, "The files have validation errors", commandLine2(ctx, "studio validate", args));
16864
17151
  }
16865
17152
  };
16866
- validate_default = command53;
17153
+ validate_default = command54;
16867
17154
  }
16868
17155
  });
16869
17156
 
@@ -16912,7 +17199,7 @@ function accountIds(value) {
16912
17199
  }
16913
17200
  return ids2.map(Number);
16914
17201
  }
16915
- var SHOWN2, command54, preview_default;
17202
+ var SHOWN2, command55, preview_default;
16916
17203
  var init_preview = __esm({
16917
17204
  "src/commands/studio/preview.ts"() {
16918
17205
  "use strict";
@@ -16924,7 +17211,7 @@ var init_preview = __esm({
16924
17211
  init_common3();
16925
17212
  init_folder();
16926
17213
  SHOWN2 = 5;
16927
- command54 = {
17214
+ command55 = {
16928
17215
  resource: "studio",
16929
17216
  action: "preview",
16930
17217
  summary: "Render a saved version for up to 3 accounts; for local edits, studio push them to the draft first",
@@ -16974,7 +17261,7 @@ var init_preview = __esm({
16974
17261
  return ExitCode.Ok;
16975
17262
  }
16976
17263
  };
16977
- preview_default = command54;
17264
+ preview_default = command55;
16978
17265
  }
16979
17266
  });
16980
17267
 
@@ -17175,7 +17462,7 @@ function estimateOutput(templateId, target2, estimate) {
17175
17462
  ...target2.campaignId !== void 0 ? { estimateNote: "An upper bound: it counts one page per lead, and a campaign run builds one page per company." } : {}
17176
17463
  };
17177
17464
  }
17178
- var COMMAND6, sha2563, command55, fill_default;
17465
+ var COMMAND6, sha2563, command56, fill_default;
17179
17466
  var init_fill = __esm({
17180
17467
  "src/commands/studio/fill.ts"() {
17181
17468
  "use strict";
@@ -17191,7 +17478,7 @@ var init_fill = __esm({
17191
17478
  init_fill_runs();
17192
17479
  COMMAND6 = "studio fill";
17193
17480
  sha2563 = (data) => createHash9("sha256").update(data).digest("hex");
17194
- command55 = {
17481
+ command56 = {
17195
17482
  resource: "studio",
17196
17483
  action: "fill",
17197
17484
  summary: "Fill a template on many accounts or campaign leads (estimate first)",
@@ -17253,7 +17540,7 @@ var init_fill = __esm({
17253
17540
  return outcome.exitCode;
17254
17541
  }
17255
17542
  };
17256
- fill_default = command55;
17543
+ fill_default = command56;
17257
17544
  }
17258
17545
  });
17259
17546
 
@@ -17360,7 +17647,7 @@ var add_exports2 = {};
17360
17647
  __export(add_exports2, {
17361
17648
  default: () => add_default2
17362
17649
  });
17363
- var NEXT, command56, add_default2;
17650
+ var NEXT, command57, add_default2;
17364
17651
  var init_add2 = __esm({
17365
17652
  "src/commands/tasks/add.ts"() {
17366
17653
  "use strict";
@@ -17370,7 +17657,7 @@ var init_add2 = __esm({
17370
17657
  init_http();
17371
17658
  init_shared2();
17372
17659
  NEXT = 'kenso tasks add "Send the deck" --due tomorrow --account 812';
17373
- command56 = {
17660
+ command57 = {
17374
17661
  resource: "tasks",
17375
17662
  action: "add",
17376
17663
  summary: "Add a task: a title, an optional due day and time, assignee and the account, person or deal it is about",
@@ -17408,7 +17695,7 @@ var init_add2 = __esm({
17408
17695
  return ExitCode.Ok;
17409
17696
  }
17410
17697
  };
17411
- add_default2 = command56;
17698
+ add_default2 = command57;
17412
17699
  }
17413
17700
  });
17414
17701
 
@@ -17445,7 +17732,7 @@ function stoppedAt(error, id, finished, status) {
17445
17732
  details: error.details
17446
17733
  });
17447
17734
  }
17448
- var command57, done_default;
17735
+ var command58, done_default;
17449
17736
  var init_done = __esm({
17450
17737
  "src/commands/tasks/done.ts"() {
17451
17738
  "use strict";
@@ -17454,7 +17741,7 @@ var init_done = __esm({
17454
17741
  init_exit_codes();
17455
17742
  init_http();
17456
17743
  init_shared2();
17457
- command57 = {
17744
+ command58 = {
17458
17745
  resource: "tasks",
17459
17746
  action: "done",
17460
17747
  summary: "Complete one or more tasks (--undo reopens them)",
@@ -17488,7 +17775,7 @@ var init_done = __esm({
17488
17775
  return ExitCode.Ok;
17489
17776
  }
17490
17777
  };
17491
- done_default = command57;
17778
+ done_default = command58;
17492
17779
  }
17493
17780
  });
17494
17781
 
@@ -17497,7 +17784,7 @@ var assign_exports = {};
17497
17784
  __export(assign_exports, {
17498
17785
  default: () => assign_default
17499
17786
  });
17500
- var NEXT2, command58, assign_default;
17787
+ var NEXT2, command59, assign_default;
17501
17788
  var init_assign = __esm({
17502
17789
  "src/commands/tasks/assign.ts"() {
17503
17790
  "use strict";
@@ -17506,7 +17793,7 @@ var init_assign = __esm({
17506
17793
  init_done();
17507
17794
  init_shared2();
17508
17795
  NEXT2 = "kenso tasks assign <taskId> <me|memberId|email>";
17509
- command58 = {
17796
+ command59 = {
17510
17797
  resource: "tasks",
17511
17798
  action: "assign",
17512
17799
  summary: "Give a task to a member",
@@ -17530,7 +17817,7 @@ var init_assign = __esm({
17530
17817
  return ExitCode.Ok;
17531
17818
  }
17532
17819
  };
17533
- assign_default = command58;
17820
+ assign_default = command59;
17534
17821
  }
17535
17822
  });
17536
17823
 
@@ -17539,14 +17826,14 @@ var queue_exports = {};
17539
17826
  __export(queue_exports, {
17540
17827
  default: () => queue_default
17541
17828
  });
17542
- var SCOPES, command59, queue_default;
17829
+ var SCOPES, command60, queue_default;
17543
17830
  var init_queue = __esm({
17544
17831
  "src/commands/tasks/queue.ts"() {
17545
17832
  "use strict";
17546
17833
  init_errors();
17547
17834
  init_exit_codes();
17548
17835
  SCOPES = ["mine", "assigned_by_me", "everyone"];
17549
- command59 = {
17836
+ command60 = {
17550
17837
  resource: "tasks",
17551
17838
  action: "queue",
17552
17839
  summary: "Your open work by due day: tasks, touches, call tasks, reply reminders and Ken follow-ups",
@@ -17568,7 +17855,7 @@ var init_queue = __esm({
17568
17855
  return ExitCode.Ok;
17569
17856
  }
17570
17857
  };
17571
- queue_default = command59;
17858
+ queue_default = command60;
17572
17859
  }
17573
17860
  });
17574
17861
 
@@ -17806,7 +18093,7 @@ function readBody(req) {
17806
18093
  function reply(res, status, body2) {
17807
18094
  res.writeHead(status, { "content-type": "application/json" }).end(JSON.stringify(body2));
17808
18095
  }
17809
- var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command60, listen_default;
18096
+ var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command61, listen_default;
17810
18097
  var init_listen = __esm({
17811
18098
  "src/commands/webhooks/listen.ts"() {
17812
18099
  "use strict";
@@ -17817,7 +18104,7 @@ var init_listen = __esm({
17817
18104
  MIN_POLL_MS = 1e3;
17818
18105
  MAX_POLL_MS = 6e4;
17819
18106
  MAX_TRIGGER_BYTES = 1e6;
17820
- command60 = {
18107
+ command61 = {
17821
18108
  resource: "webhooks",
17822
18109
  action: "listen",
17823
18110
  summary: "Stream the workspace's events and forward them, signed, to a local handler",
@@ -17924,7 +18211,7 @@ var init_listen = __esm({
17924
18211
  return ExitCode.Ok;
17925
18212
  }
17926
18213
  };
17927
- listen_default = command60;
18214
+ listen_default = command61;
17928
18215
  }
17929
18216
  });
17930
18217
 
@@ -17943,7 +18230,7 @@ function notRunning() {
17943
18230
  next: LISTEN_NEXT
17944
18231
  });
17945
18232
  }
17946
- var LISTEN_NEXT, command61, trigger_default;
18233
+ var LISTEN_NEXT, command62, trigger_default;
17947
18234
  var init_trigger = __esm({
17948
18235
  "src/commands/webhooks/trigger.ts"() {
17949
18236
  "use strict";
@@ -17952,7 +18239,7 @@ var init_trigger = __esm({
17952
18239
  init_http();
17953
18240
  init_local();
17954
18241
  LISTEN_NEXT = "kenso webhooks listen --forward-to http://localhost:3000/hook";
17955
- command61 = {
18242
+ command62 = {
17956
18243
  resource: "webhooks",
17957
18244
  action: "trigger",
17958
18245
  summary: "Send a sample event of one type through the running kenso webhooks listen",
@@ -18010,7 +18297,7 @@ var init_trigger = __esm({
18010
18297
  return ExitCode.Ok;
18011
18298
  }
18012
18299
  };
18013
- trigger_default = command61;
18300
+ trigger_default = command62;
18014
18301
  }
18015
18302
  });
18016
18303
 
@@ -18031,14 +18318,14 @@ var status_exports3 = {};
18031
18318
  __export(status_exports3, {
18032
18319
  default: () => status_default3
18033
18320
  });
18034
- var command62, status_default3;
18321
+ var command63, status_default3;
18035
18322
  var init_status3 = __esm({
18036
18323
  "src/commands/work/status.ts"() {
18037
18324
  "use strict";
18038
18325
  init_exit_codes();
18039
18326
  init_http();
18040
18327
  init_common2();
18041
- command62 = {
18328
+ command63 = {
18042
18329
  resource: "work",
18043
18330
  action: "status",
18044
18331
  summary: "Show the Kenso AI work waiting for your own agent, per kind",
@@ -18073,7 +18360,7 @@ var init_status3 = __esm({
18073
18360
  return ExitCode.Ok;
18074
18361
  }
18075
18362
  };
18076
- status_default3 = command62;
18363
+ status_default3 = command63;
18077
18364
  }
18078
18365
  });
18079
18366
 
@@ -18205,9 +18492,9 @@ var init_files = __esm({
18205
18492
  import { execFile, spawnSync as spawnSync2 } from "node:child_process";
18206
18493
  import { readFileSync as readFileSync14 } from "node:fs";
18207
18494
  import { isAbsolute as isAbsolute2 } from "node:path";
18208
- function sudoArgs(user, command70, args, keep = [], set2 = {}) {
18495
+ function sudoArgs(user, command71, args, keep = [], set2 = {}) {
18209
18496
  const assignments = Object.entries(set2).map(([name, value]) => `${name}=${value}`);
18210
- return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command70, ...args];
18497
+ return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command71, ...args];
18211
18498
  }
18212
18499
  function agentKensoEnv(opts) {
18213
18500
  return {
@@ -18217,12 +18504,12 @@ function agentKensoEnv(opts) {
18217
18504
  AI_AGENT: opts.agentName
18218
18505
  };
18219
18506
  }
18220
- function sudoExec(user, command70, args, opts = {}) {
18507
+ function sudoExec(user, command71, args, opts = {}) {
18221
18508
  const [sudo = "/usr/bin/sudo", ...lead] = user.sudo;
18222
18509
  return new Promise((resolve18) => {
18223
18510
  execFile(
18224
18511
  sudo,
18225
- [...lead, ...sudoArgs(user.name, command70, args)],
18512
+ [...lead, ...sudoArgs(user.name, command71, args)],
18226
18513
  { env: { PATH: SUDO_PATH }, cwd: "/", timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS, maxBuffer: opts.maxBuffer ?? 1024 * 1024, encoding: "utf8", windowsHide: true, shell: false },
18227
18514
  (err, stdout, stderr) => {
18228
18515
  const code = err ? err.code : 0;
@@ -18332,9 +18619,9 @@ var init_folder2 = __esm({
18332
18619
  init_redact();
18333
18620
  init_agent_user();
18334
18621
  WorkRunFolder = class {
18335
- constructor(ctx, command70, args, outDir, shared = false) {
18622
+ constructor(ctx, command71, args, outDir, shared = false) {
18336
18623
  this.ctx = ctx;
18337
- this.command = command70;
18624
+ this.command = command71;
18338
18625
  this.args = args;
18339
18626
  this.outDir = outDir;
18340
18627
  this.shared = shared;
@@ -18449,7 +18736,7 @@ var pull_exports2 = {};
18449
18736
  __export(pull_exports2, {
18450
18737
  default: () => pull_default2
18451
18738
  });
18452
- var MAX_FILES, command63, pull_default2;
18739
+ var MAX_FILES, command64, pull_default2;
18453
18740
  var init_pull2 = __esm({
18454
18741
  "src/commands/work/pull.ts"() {
18455
18742
  "use strict";
@@ -18458,7 +18745,7 @@ var init_pull2 = __esm({
18458
18745
  init_common2();
18459
18746
  init_folder2();
18460
18747
  MAX_FILES = 100;
18461
- command63 = {
18748
+ command64 = {
18462
18749
  resource: "work",
18463
18750
  action: "pull",
18464
18751
  summary: "Claim waiting work into local work files, to answer by hand",
@@ -18537,7 +18824,7 @@ var init_pull2 = __esm({
18537
18824
  return interrupted7 ? ExitCode.Interrupted : ExitCode.Ok;
18538
18825
  }
18539
18826
  };
18540
- pull_default2 = command63;
18827
+ pull_default2 = command64;
18541
18828
  }
18542
18829
  });
18543
18830
 
@@ -18679,7 +18966,7 @@ __export(submit_exports, {
18679
18966
  default: () => submit_default
18680
18967
  });
18681
18968
  import { resolve as resolve16 } from "node:path";
18682
- var command64, submit_default;
18969
+ var command65, submit_default;
18683
18970
  var init_submit = __esm({
18684
18971
  "src/commands/work/submit.ts"() {
18685
18972
  "use strict";
@@ -18688,7 +18975,7 @@ var init_submit = __esm({
18688
18975
  init_files();
18689
18976
  init_answers();
18690
18977
  init_common2();
18691
- command64 = {
18978
+ command65 = {
18692
18979
  resource: "work",
18693
18980
  action: "submit",
18694
18981
  summary: "Send answers files to Kenso and write each one's results",
@@ -18721,7 +19008,7 @@ var init_submit = __esm({
18721
19008
  return totals.rejected > 0 ? ExitCode.Partial : ExitCode.Ok;
18722
19009
  }
18723
19010
  };
18724
- submit_default = command64;
19011
+ submit_default = command65;
18725
19012
  }
18726
19013
  });
18727
19014
 
@@ -18742,7 +19029,7 @@ function claimIdOf(arg) {
18742
19029
  if (!CLAIM_ID.test(arg)) throw usageError(`"${arg}" is neither a claim id nor a work file.`, { field: "claim", hint: "Claim ids look like awc_8fK2..." });
18743
19030
  return arg;
18744
19031
  }
18745
- var CLAIM_ID, command65, release_default;
19032
+ var CLAIM_ID, command66, release_default;
18746
19033
  var init_release = __esm({
18747
19034
  "src/commands/work/release.ts"() {
18748
19035
  "use strict";
@@ -18751,7 +19038,7 @@ var init_release = __esm({
18751
19038
  init_files();
18752
19039
  init_common2();
18753
19040
  CLAIM_ID = /^[A-Za-z0-9_-]{1,64}$/;
18754
- command65 = {
19041
+ command66 = {
18755
19042
  resource: "work",
18756
19043
  action: "release",
18757
19044
  summary: "Give claimed work back to the queue now",
@@ -18771,7 +19058,7 @@ var init_release = __esm({
18771
19058
  return ExitCode.Ok;
18772
19059
  }
18773
19060
  };
18774
- release_default = command65;
19061
+ release_default = command66;
18775
19062
  }
18776
19063
  });
18777
19064
 
@@ -18816,8 +19103,8 @@ async function resolveBinary(adapter, env, override2) {
18816
19103
  }
18817
19104
  for (const dir3 of pathDirs(env)) {
18818
19105
  for (const ext of extensions) {
18819
- const candidate = join23(dir3, name + ext);
18820
- if (await isExecutableFile(candidate)) return candidate;
19106
+ const candidate2 = join23(dir3, name + ext);
19107
+ if (await isExecutableFile(candidate2)) return candidate2;
18821
19108
  }
18822
19109
  }
18823
19110
  }
@@ -19110,12 +19397,12 @@ function plain(text4) {
19110
19397
  return text4.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
19111
19398
  }
19112
19399
  function runStatus(bin, args, env, adapter, runAs) {
19113
- const command70 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
19400
+ const command71 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
19114
19401
  const commandArgs2 = runAs ? [...runAs.sudo.slice(1), ...sudoArgs(runAs.name, bin, args)] : args;
19115
19402
  const options = runAs ? { env: { PATH: SUDO_PATH }, cwd: "/" } : { env: childEnv(env, adapter) };
19116
19403
  return new Promise((resolve18) => {
19117
19404
  execFile2(
19118
- command70,
19405
+ command71,
19119
19406
  commandArgs2,
19120
19407
  { ...options, timeout: STATUS_TIMEOUT_MS, maxBuffer: 1024 * 1024, windowsHide: true, shell: false },
19121
19408
  (err, stdout, stderr) => {
@@ -20197,7 +20484,7 @@ var run_exports3 = {};
20197
20484
  __export(run_exports3, {
20198
20485
  default: () => run_default2
20199
20486
  });
20200
- var FAILURES_IN_A_ROW, command66, run_default2;
20487
+ var FAILURES_IN_A_ROW, command67, run_default2;
20201
20488
  var init_run3 = __esm({
20202
20489
  "src/commands/work/run.ts"() {
20203
20490
  "use strict";
@@ -20218,7 +20505,7 @@ var init_run3 = __esm({
20218
20505
  init_folder2();
20219
20506
  init_stop();
20220
20507
  FAILURES_IN_A_ROW = 3;
20221
- command66 = {
20508
+ command67 = {
20222
20509
  resource: "work",
20223
20510
  action: "run",
20224
20511
  summary: "Run your own coding agent on the waiting work until the queue is empty",
@@ -20544,7 +20831,7 @@ var init_run3 = __esm({
20544
20831
  return exitCodeFor(reason, totals.rejected > 0 || jobsFailed > 0);
20545
20832
  }
20546
20833
  };
20547
- run_default2 = command66;
20834
+ run_default2 = command67;
20548
20835
  }
20549
20836
  });
20550
20837
 
@@ -20622,7 +20909,7 @@ function rewrap(err, overrides2) {
20622
20909
  details: err.details
20623
20910
  });
20624
20911
  }
20625
- var TEMPLATES, APP_NEXT_STEP, NOT_AVAILABLE, command67, keys_default;
20912
+ var TEMPLATES, APP_NEXT_STEP, NOT_AVAILABLE, command68, keys_default;
20626
20913
  var init_keys = __esm({
20627
20914
  "src/commands/workspace/keys.ts"() {
20628
20915
  "use strict";
@@ -20632,7 +20919,7 @@ var init_keys = __esm({
20632
20919
  TEMPLATES = ["admin", "editor", "viewer"];
20633
20920
  APP_NEXT_STEP = "A workspace admin can create it in the app: Settings > API keys > Workspace keys";
20634
20921
  NOT_AVAILABLE = "Workspace keys are not available for this workspace yet.";
20635
- command67 = {
20922
+ command68 = {
20636
20923
  resource: "workspace",
20637
20924
  action: "keys",
20638
20925
  summary: "Create an API key the workspace owns",
@@ -20694,7 +20981,7 @@ var init_keys = __esm({
20694
20981
  return ExitCode.Ok;
20695
20982
  }
20696
20983
  };
20697
- keys_default = command67;
20984
+ keys_default = command68;
20698
20985
  }
20699
20986
  });
20700
20987
 
@@ -20703,23 +20990,23 @@ var list_exports4 = {};
20703
20990
  __export(list_exports4, {
20704
20991
  default: () => list_default4
20705
20992
  });
20706
- function parseLimit(value) {
20993
+ function parseLimit2(value) {
20707
20994
  if (value === void 0) return void 0;
20708
20995
  const text4 = String(value).trim();
20709
20996
  const limit = Number(text4);
20710
- if (!/^\d+$/.test(text4) || limit < 1 || limit > MAX_LIMIT) {
20711
- throw usageError(`--limit must be a whole number from 1 to ${MAX_LIMIT}.`, { field: "limit" });
20997
+ if (!/^\d+$/.test(text4) || limit < 1 || limit > MAX_LIMIT2) {
20998
+ throw usageError(`--limit must be a whole number from 1 to ${MAX_LIMIT2}.`, { field: "limit" });
20712
20999
  }
20713
21000
  return limit;
20714
21001
  }
20715
- var MAX_LIMIT, command68, list_default4;
21002
+ var MAX_LIMIT2, command69, list_default4;
20716
21003
  var init_list4 = __esm({
20717
21004
  "src/commands/workspace/list.ts"() {
20718
21005
  "use strict";
20719
21006
  init_errors();
20720
21007
  init_exit_codes();
20721
- MAX_LIMIT = 200;
20722
- command68 = {
21008
+ MAX_LIMIT2 = 200;
21009
+ command69 = {
20723
21010
  resource: "workspace",
20724
21011
  action: "list",
20725
21012
  summary: "List the workspaces your key can use",
@@ -20727,17 +21014,17 @@ var init_list4 = __esm({
20727
21014
  description: "Calls GET /v1/workspaces. Kenso staff are members of many workspaces, so filter by name with --search. Without --all it prints one page and says on stderr when there are more.",
20728
21015
  flags: {
20729
21016
  search: { type: "string", description: "Only workspaces whose name matches this text", aliases: ["q"] },
20730
- limit: { type: "string", description: `Page size, 1 to ${MAX_LIMIT} (default 50)` },
21017
+ limit: { type: "string", description: `Page size, 1 to ${MAX_LIMIT2} (default 50)` },
20731
21018
  all: { type: "boolean", description: "Follow every page" }
20732
21019
  },
20733
21020
  examples: ["kenso workspace list --search acme", "kenso workspace list --all --output ids"],
20734
21021
  operationIds: ["workspaces.list"],
20735
21022
  async run(ctx, { flags }) {
20736
21023
  const q = typeof flags.search === "string" && flags.search.trim() !== "" ? flags.search.trim() : void 0;
20737
- const limit = parseLimit(flags.limit);
21024
+ const limit = parseLimit2(flags.limit);
20738
21025
  const req = { method: "GET", path: "/v1/workspaces", query: { q }, noWorkspace: true, signal: ctx.signal };
20739
21026
  if (flags.all === true) {
20740
- await ctx.output.list(ctx.client.paginate(req, { pageSize: limit ?? MAX_LIMIT }));
21027
+ await ctx.output.list(ctx.client.paginate(req, { pageSize: limit ?? MAX_LIMIT2 }));
20741
21028
  return ExitCode.Ok;
20742
21029
  }
20743
21030
  const res = await ctx.client.request({ ...req, query: { q, limit } });
@@ -20748,7 +21035,7 @@ var init_list4 = __esm({
20748
21035
  return ExitCode.Ok;
20749
21036
  }
20750
21037
  };
20751
- list_default4 = command68;
21038
+ list_default4 = command69;
20752
21039
  }
20753
21040
  });
20754
21041
 
@@ -20757,7 +21044,7 @@ var use_exports = {};
20757
21044
  __export(use_exports, {
20758
21045
  default: () => use_default
20759
21046
  });
20760
- var command69, use_default;
21047
+ var command70, use_default;
20761
21048
  var init_use = __esm({
20762
21049
  "src/commands/workspace/use.ts"() {
20763
21050
  "use strict";
@@ -20765,7 +21052,7 @@ var init_use = __esm({
20765
21052
  init_errors();
20766
21053
  init_exit_codes();
20767
21054
  init_http();
20768
- command69 = {
21055
+ command70 = {
20769
21056
  resource: "workspace",
20770
21057
  action: "use",
20771
21058
  summary: "Set the profile's default workspace",
@@ -20823,7 +21110,7 @@ var init_use = __esm({
20823
21110
  return ExitCode.Ok;
20824
21111
  }
20825
21112
  };
20826
- use_default = command69;
21113
+ use_default = command70;
20827
21114
  }
20828
21115
  });
20829
21116
 
@@ -20864,7 +21151,7 @@ var init_registry = __esm({
20864
21151
  init_credits();
20865
21152
  init_dashboards();
20866
21153
  init_describe2();
20867
- init_discover();
21154
+ init_discover2();
20868
21155
  init_docs2();
20869
21156
  init_doctor();
20870
21157
  init_export3();
@@ -21278,13 +21565,13 @@ function distance(a, b) {
21278
21565
  }
21279
21566
  return previous[b.length];
21280
21567
  }
21281
- function closest(typed, candidates) {
21568
+ function closest(typed, candidates2) {
21282
21569
  let best;
21283
21570
  let bestDistance = Number.POSITIVE_INFINITY;
21284
- for (const candidate of candidates) {
21285
- const d = distance(typed, candidate);
21571
+ for (const candidate2 of candidates2) {
21572
+ const d = distance(typed, candidate2);
21286
21573
  if (d < bestDistance) {
21287
- best = candidate;
21574
+ best = candidate2;
21288
21575
  bestDistance = d;
21289
21576
  }
21290
21577
  }
@@ -21503,8 +21790,8 @@ function startUpdateNotice(argv, opts = {}) {
21503
21790
  if (!found) return;
21504
21791
  writeCheck(file, { checkedAt: new Date(now).toISOString(), latest: found });
21505
21792
  if (isNewer(found, version)) {
21506
- const command70 = updateCommand(install, opts.platform ?? process.platform);
21507
- stderr.write(`kenso ${found} is out (you have ${version}): ${command70}
21793
+ const command71 = updateCommand(install, opts.platform ?? process.platform);
21794
+ stderr.write(`kenso ${found} is out (you have ${version}): ${command71}
21508
21795
  Turn this off with KENSO_NO_UPDATE_NOTIFIER=1.
21509
21796
  `);
21510
21797
  }
@@ -21565,15 +21852,15 @@ function flagsOf2(spec, globals, commandless) {
21565
21852
  const global = Object.keys(globals).filter((name) => commandless || name !== "version" && (name !== "dry-run" || spec?.dryRun === true));
21566
21853
  return sorted([...Object.keys(spec?.flags ?? {}), ...global].map((name) => `--${name}`));
21567
21854
  }
21568
- async function completions(words, globals) {
21569
- const current = words.at(-1) ?? "";
21855
+ async function completions(words2, globals) {
21856
+ const current = words2.at(-1) ?? "";
21570
21857
  const positionals = [];
21571
21858
  let spec;
21572
21859
  let commandWords2 = 0;
21573
21860
  let valueFor;
21574
21861
  let afterDashes = false;
21575
21862
  let help = false;
21576
- for (const word of words.slice(0, -1)) {
21863
+ for (const word of words2.slice(0, -1)) {
21577
21864
  if (valueFor !== void 0) {
21578
21865
  valueFor = void 0;
21579
21866
  continue;
@@ -21619,14 +21906,14 @@ async function completions(words, globals) {
21619
21906
  }
21620
21907
  return flagsOf2(spec, globals, false);
21621
21908
  }
21622
- async function printCompletions(words, globals, stdout) {
21623
- let candidates;
21909
+ async function printCompletions(words2, globals, stdout) {
21910
+ let candidates2;
21624
21911
  try {
21625
- candidates = await completions(words, globals);
21912
+ candidates2 = await completions(words2, globals);
21626
21913
  } catch {
21627
- candidates = [];
21914
+ candidates2 = [];
21628
21915
  }
21629
- if (candidates.length > 0) stdout.write(`${candidates.join("\n")}
21916
+ if (candidates2.length > 0) stdout.write(`${candidates2.join("\n")}
21630
21917
  `);
21631
21918
  return ExitCode.Ok;
21632
21919
  }