kenso 0.1.92 → 0.1.94

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
@@ -21,9 +21,9 @@ var __commonJS = (cb, mod) => function __require() {
21
21
  throw mod = 0, e;
22
22
  }
23
23
  };
24
- var __export = (target, all) => {
24
+ var __export = (target2, all) => {
25
25
  for (var name in all)
26
- __defProp(target, name, { get: all[name], enumerable: true });
26
+ __defProp(target2, name, { get: all[name], enumerable: true });
27
27
  };
28
28
  var __copyProps = (to, from, except, desc) => {
29
29
  if (from && typeof from === "object" || typeof from === "function") {
@@ -33,12 +33,12 @@ var __copyProps = (to, from, except, desc) => {
33
33
  }
34
34
  return to;
35
35
  };
36
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
36
+ var __toESM = (mod, isNodeMode, target2) => (target2 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
37
  // If the importer is in node compatibility mode or this is not an ESM
38
38
  // file that has been converted to a CommonJS file using a Babel-
39
39
  // compatible transform (i.e. "__esModule" has not been set), then set
40
40
  // "default" to the CommonJS "module.exports" for node compatibility.
41
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
41
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target2, "default", { value: mod, enumerable: true }) : target2,
42
42
  mod
43
43
  ));
44
44
 
@@ -2215,12 +2215,12 @@ function pickFields(value, paths) {
2215
2215
  for (const path of paths) {
2216
2216
  const { found, value: picked } = getPath(value, path);
2217
2217
  if (!found) continue;
2218
- let target = out;
2218
+ let target2 = out;
2219
2219
  for (const segment of path.slice(0, -1)) {
2220
- if (!isRecord(target[segment])) target[segment] = {};
2221
- target = target[segment];
2220
+ if (!isRecord(target2[segment])) target2[segment] = {};
2221
+ target2 = target2[segment];
2222
2222
  }
2223
- target[path[path.length - 1]] = picked;
2223
+ target2[path[path.length - 1]] = picked;
2224
2224
  }
2225
2225
  return out;
2226
2226
  }
@@ -2477,7 +2477,7 @@ var VERSION;
2477
2477
  var init_version = __esm({
2478
2478
  "src/core/version.ts"() {
2479
2479
  "use strict";
2480
- VERSION = true ? "0.1.92" : "0.0.0-dev";
2480
+ VERSION = true ? "0.1.94" : "0.0.0-dev";
2481
2481
  }
2482
2482
  });
2483
2483
 
@@ -4174,9 +4174,9 @@ async function readRunDir(dir) {
4174
4174
  return null;
4175
4175
  }
4176
4176
  if (!raw) return null;
4177
- const { runId, command: command60, createdAt, status } = raw;
4177
+ const { runId, command: command65, createdAt, status } = raw;
4178
4178
  if (typeof runId !== "string" || !RUN_ID_PATTERN.test(runId)) return null;
4179
- if (typeof command60 !== "string" || typeof createdAt !== "string") return null;
4179
+ if (typeof command65 !== "string" || typeof createdAt !== "string") return null;
4180
4180
  if (typeof status !== "string" || !STATUSES.includes(status)) return null;
4181
4181
  let chunksDone = chunkList(raw.chunksDone) ?? [];
4182
4182
  try {
@@ -4187,7 +4187,7 @@ async function readRunDir(dir) {
4187
4187
  const record = {
4188
4188
  ...raw,
4189
4189
  runId,
4190
- command: command60,
4190
+ command: command65,
4191
4191
  args: asRecord3(raw.args) ?? {},
4192
4192
  createdAt,
4193
4193
  status,
@@ -4242,11 +4242,11 @@ async function loadRun(runId, env = process.env) {
4242
4242
  }
4243
4243
  return run;
4244
4244
  }
4245
- async function findIdentical(command60, args, inputSha256, env, workspaceId, anyWorkspace = false) {
4245
+ async function findIdentical(command65, args, inputSha256, env, workspaceId, anyWorkspace = false) {
4246
4246
  const identity = argsIdentity(args);
4247
4247
  const runs = await listRuns(env);
4248
4248
  return runs.filter(
4249
- (run) => run.command === command60 && (run.inputSha256 || void 0) === (inputSha256 || void 0) && (anyWorkspace || (run.workspaceId || void 0) === (workspaceId || void 0)) && argsIdentity(run.args) === identity
4249
+ (run) => run.command === command65 && (run.inputSha256 || void 0) === (inputSha256 || void 0) && (anyWorkspace || (run.workspaceId || void 0) === (workspaceId || void 0)) && argsIdentity(run.args) === identity
4250
4250
  );
4251
4251
  }
4252
4252
  function isOtherLiveProcess(pid) {
@@ -4340,10 +4340,10 @@ async function alreadyDone(run, totalRows, started, ctx) {
4340
4340
  async function dryRun(spec, ctx, plan) {
4341
4341
  let runId;
4342
4342
  let dir;
4343
- const target = plan.finished ?? plan.resumable;
4344
- if (target) {
4345
- runId = target.runId;
4346
- dir = target.dir;
4343
+ const target2 = plan.finished ?? plan.resumable;
4344
+ if (target2) {
4345
+ runId = target2.runId;
4346
+ dir = target2.dir;
4347
4347
  } else {
4348
4348
  runId = newRunId();
4349
4349
  dir = await prepareRunDir(spec.outDir, runId, plan.identical, ctx);
@@ -7458,8 +7458,8 @@ function idValue(value, field) {
7458
7458
  function shellQuote3(arg) {
7459
7459
  return /^[A-Za-z0-9_./:=@%+,-]+$/.test(arg) ? arg : `'${arg.replace(/'/g, `'\\''`)}'`;
7460
7460
  }
7461
- function commandLine2(ctx, command60, args, extra = []) {
7462
- const parts2 = ["kenso", ...command60.split(" "), ...(args.positionals ?? []).map(shellQuote3)];
7461
+ function commandLine2(ctx, command65, args, extra = []) {
7462
+ const parts2 = ["kenso", ...command65.split(" "), ...(args.positionals ?? []).map(shellQuote3)];
7463
7463
  for (const [name, value] of Object.entries(args.flags)) {
7464
7464
  if (value === void 0 || value === false) continue;
7465
7465
  if (value === true) parts2.push(`--${name}`);
@@ -7791,7 +7791,7 @@ var init_connect = __esm({
7791
7791
  var crm_default;
7792
7792
  var init_crm = __esm({
7793
7793
  "docs/crm.md"() {
7794
- crm_default = '# CRM (beta)\n\nThe CRM commands work on Kenso\'s Accounts lane: accounts (companies), the people on them, and opportunities. They are beta: they need the `accounts` feature flag on your workspace (opportunities need `opportunities`, CRM sync needs `ingestion`). Help and `kenso describe` hide them until your workspace has the flag; `--all-commands` shows them.\n\n| Command | What it does |\n|---|---|\n| `accounts import` | Create accounts from a CSV or JSONL file. Research is charged per created account |\n| `people import` | Create or match people from a file, optionally onto accounts |\n| `accounts update --each`, `people update --each`, `opportunities update --each` | Edit many records from a file, one call per row |\n| `accounts write-research`, `people write-research` | Store research you gathered as a record\'s latest research, free. `--each` writes many |\n| `opportunities stage-history <id>` | A deal\'s stage history: each stage, when, who moved it and how long it sat there |\n| `deleted-accounts list`, `accounts restore <id>` | The accounts deleted in the last 30 days, and bringing one back |\n| `export <accounts\\|people\\|deals>` | The list as CSV: everything, a saved Accounts view, or what the filters match |\n| `capture status` | Your captured mailbox, its backfill progress and what teammates see of a captured email. Needs the `crm_capture` flag |\n| `capture connect` | Turn capture on for your own mailbox. `--private` starts it hidden from teammates; `--provider google` prints a sign-in link when no account is connected yet |\n| `capture private on\\|off` | Hide your captured email from teammates, or show it again. Email only: meetings stay visible. `--thread <id>` sets the switch for one thread |\n| `capture thread <threadId>` | One captured email thread: subject, people, time, Ken\'s summary, and each body you may open. The id is `capturedThread.id` on a timeline row |\n| `capture sync` | Read your captured mailbox now, instead of waiting for the next two-minute poll. Prints what the pass read, logged and created |\n| `capture disconnect` | Turn capture off and delete your stored email bodies. Asks first; `--yes` skips the question |\n| `capture teammates-see summary\\|full_email` | Workspace admin: what teammates see of captured email |\n| `pipelines stage-rules` | List or set the fields a deal should have in each stage |\n| `crm-connections`, `crm-imports`, `crm-sync-issues` | Read and run CRM sync. Connecting a CRM stays in the app |\n| `tasks add`, `tasks done`, `tasks assign`, `tasks queue` | Add a to-do for a member on an account, person or deal, complete it, hand it on, or read your open work (needs `tasks`) |\n\nImport accounts first, then people: `people import` never creates an account.\n\n## Import accounts\n\n```bash\nkenso accounts import --file accounts.csv\nkenso accounts import --file accounts.csv --yes\n```\n\n```csv\nname,domain,industry,employeeCount\nAcme,acme.io,Software,120\nGlobex,globex.com,Manufacturing,"1,200"\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `name` (or `company`, `companyName`, `accountName`), `domains` (several, split on `,` or `;`) or one `domain` (or `website`, `companyDomain`), `industry`, `employeeCount`, `hqLocation`, `linkedinUrl`, `stage`, `angle`, `whyNow`, `fitScore`, `fundingRound`, `cadenceDays`, `ownerMemberId`, `kenCompanyId`, `sendsFromInboxId`, `sendsFromLinkedInAccountId` and `source`.\n- **A domain is required.** A file with no domain column is a usage error, and a row without a domain is `invalid` (`domain_required`).\n- **The dry run prices the research.** It asks for a credit estimate per 1,000 accounts and puts the sum in the plan: `kind`, `accountCount`, `totalMillicredits`, `availableMillicredits` and `sufficient`.\n- **Rows go 100 per call** to `POST /v1/accounts/bulk-create`.\n\nEach row comes back `created` (`id` is the new account; its research is queued, `researchQueued`, or waits for credits, `researchWaitingCredits`), `skipped` with reason `domain_taken` (already an account; `id` is that account) or `failed` (`reason` is the API\'s code, `error` names the field; an item Kenso failed to save is sent once more first). Rerunning the same file is safe: accounts that exist come back `domain_taken`.\n\n## Import people\n\n```bash\nkenso people import --file people.csv\nkenso people import --file people.csv --find-emails --yes\nkenso people import --file people.jsonl --dry-run\n```\n\n```csv\nfullName,email,title,accountDomain,role\nAnn Lee,ann@acme.io,VP Sales,acme.io,champion\nBob Ray,,CTO,acme.io,\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `email`, `fullName` (or `name`), `firstName`, `lastName`, `title`, `linkedinUrl` (or `linkedin`, `profileUrl`), `accountDomain` (or `domain`, `website`, `companyDomain`), `accountId`, `role` and `priority`. Other columns are ignored with one warning.\n- **A person needs a name:** `fullName`, or `firstName`, `lastName` or both (the CLI joins them). A row with none of them is `invalid` (`name_required`).\n- **To put a person on an account,** give `accountDomain` or `accountId`. A row with both sends only `accountId`.\n- **`--find-emails`** queues an email find (charged in credits) for each person without an email.\n- **Rows go 200 per call** to `POST /v1/people/batch`.\n\nPeople already in the workspace are matched by email, then LinkedIn URL, so running the same file again creates nobody twice. A row comes back `created` (a new person), `updated` (an existing person added to the account), `skipped` with reason `already_on_account`, `matched` (no account asked) or `previously_removed`, or `failed`: `account_not_found` saves the person without an account (import the account, then rerun to place them), any other reason is the API\'s. The summary adds `matched`, `addedToAccounts` and `emailFindsQueued`.\n\n## List and search accounts\n\n`accounts list` and `accounts search` sort and page on the server, so they reach every account in the workspace, however many there are.\n\n```bash\nkenso accounts list --sort score:desc --limit 100 # one page; the output\'s next: line is the following one\nkenso accounts list --sort score:desc --limit 100 --all # every page, to the end\nkenso accounts search --search hiring --sort latestSignalAt:desc --data \'{"qFields": ["name", "latestSignal"]}\'\nkenso accounts search --limit 1 --data \'{"countBy": ["stage"]}\' # how many accounts sit in each stage\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}]}, "sort": "tier,-pipelineAmount"}\' --all\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "hqLocation", "operator": "contains", "values": ["Germany"]}]}}\' --all\n# tier 1 accounts with no meeting in 30 days: none since then, or none ever\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}, {"match": "any", "conditions": [{"field": "lastMeeting", "operator": "older_than_days", "values": ["30"]}, {"field": "lastMeeting", "operator": "is_empty"}]}]}}\' --all\n```\n\n- **`--sort`** takes up to 3 comma-separated keys, each `field` (ascending), `field:asc` or `field:desc`. The API\'s `-field` form needs the equals sign here, `--sort=-score`, because a value that starts with a dash reads as a flag. Fields: `createdAt`, `name`, `score`, `tier` (ascending is tier 1 first), `latestSignalAt`, `committee`, `pipelineAmount`, `nextTouchAt`, `lastTouchAt`. An account with no value for a key comes last in both directions. The default is `-createdAt`.\n- **`--limit`** is 1 to 1000 (default 50). `--cursor` takes the previous page\'s `nextCursor` with the same filters and sort; `--all` follows the cursors for you.\n- **`--search`** (also `--q`) matches the name or a domain.\n- **Lists and objects go in `--data`** on `search`, as the API takes them (`kenso describe accounts search`); a flag beside it sets or replaces one key:\n - `qFields` picks where the search text looks: `name`, `domain`, `latestSignal` (the latest signal\'s title).\n - `countBy` (`stage`, `stageGroup`) adds `counts` to the output: every value with the number of matching accounts that hold it, whatever the page. The output is then one object: `data`, `pagination` and `counts`.\n - `filters` and `where` narrow the accounts.\n\nAn account\'s timeline pages the same way. `kenso accounts activity 812` returns the newest 100 earlier rows and, when older ones exist, `data.nextCursor`. Pass it back as `--cursor` (with the same `--category`) for the rows before them, until a page comes without one.\n\n## Edit accounts, people and opportunities\n\nApart from `accounts bulk-update`, which sets one `accountType` on up to 500 accounts, there is no bulk edit route, so run the generated `update` command once per row with `--each`. Columns are the command\'s flags by API name or flag name, and the id column fills the route:\n\n```bash\nkenso accounts update --each accounts-edit.csv --dry-run # then the same with --yes\nkenso people update --each people-edit.csv --dry-run\nkenso opportunities update --each deals.csv --dry-run\n```\n\n```csv\naccountId,stage,ownerMemberId,overwritePinned\n501,engaged,42,true\n502,customer,42,true\n```\n\nA row that changes a field someone pinned in the app fails as a whole (`409 conflict`, `pinned_by_user`: nothing on that record changes, the other fields of the row included), unless the row sets `overwritePinned` to `true` (or you pass `--overwrite-pinned`, only with the person\'s OK). Every flag of an update command: `kenso accounts update --help`.\n\n## Search opportunities\n\n`kenso opportunities search` works as `accounts search` does: it takes `--search`, `--sort`, `--limit`, `--cursor`, `--all`, and its lists in `--data`.\n\n```bash\nkenso opportunities search --data \'{"filters": [{"field": "stageCategory", "operator": "is", "values": ["open"]}]}\' --all\nkenso opportunities search --data \'{"filters": [{"field": "ownerMemberId", "operator": "is", "values": ["none"]}, {"field": "closeDate", "operator": "is", "values": ["past_due", "next_30_days"]}]}\'\nkenso opportunities search --limit 1 --data \'{"countBy": ["stage", "ownerMemberId"]}\' # how many opportunities hold each value\n```\n\n- **`filters`** is a list of `{field, operator, values}`, all of which must hold. Fields: `stage` (a stage key), `stageCategory` (`open`, `won`, `lost`), `ownerMemberId`, `closeDate` (`past_due`, `next_30_days`, `later`, `none`) and `sourceCampaignId`. `operator` is `is` or `is_not`; the values of one condition are OR. `none` in `values` matches an opportunity with no owner, no source campaign or no close date.\n- **`countBy`** takes the same field names and adds `counts` to the output: per field, every value with the number of matching opportunities that hold it.\n- `--account-id` keeps the search to one account. `closeDate` counts days in the member\'s app time zone.\n\nOne person\'s deals, meetings and campaign contacts, as their person page lists them:\n\n```bash\nkenso opportunities list --person-id 9001 # the deals they are on, or are the primary person of\nkenso meetings list --person-id 9001 # the meetings they attend, among the ones you can see\nkenso contacts list --person-id 9001 # their contact in each campaign they are in\n```\n\n## Write research you gathered\n\n`accounts write-research` and `people write-research` store research you gathered outside Kenso as the record\'s latest research (`PUT /v1/accounts/{accountId}/research`, `PUT /v1/people/{personId}/research`). The Research tab shows it like a Ken run, with `trigger: agent` and `researchedAt` now. Nothing is charged, and no account or person field changes: set an account\'s own `fitScore`, `whyNow` or `angle` with `accounts update`. They need the `accounts_research` flag and accounts edit.\n\nThe body is the research block `accounts get --expand research` (or `people get-research`) returns, without its read-only fields: leave out `id`, `status`, `trigger`, `errorCode`, `researchedAt`, `isStale` and `appliedPrompt` (for a person also `mode`, `requestedAt`, `researchedMode`, `firecrawlCredits` and `webNote`), or the write fails with `unknown_field`. Pass it with `--data @file`:\n\n```bash\nkenso accounts write-research --account-id 501 --data @acme-dossier.json\nkenso people write-research --person-id 9001 --data @jane.json\n```\n\n```json\n{\n "tagline": { "text": "Payroll for EU contractors", "sourceUrls": ["https://acme.example"] },\n "description": { "text": "Acme runs payroll and compliance for companies hiring contractors in 30 EU countries.", "sourceUrls": ["https://acme.example"] },\n "links": { "website": "https://acme.example" },\n "whyNow": { "text": "Raised a $40M Series B in October", "sourceUrls": ["https://news.example/acme-b"], "date": "2026-10" },\n "fitScore": 82,\n "angle": "Lead with contractor onboarding time."\n}\n```\n\nMany records: one JSONL line per record, with the id next to the block\'s fields. Nested objects are sent as written. Use JSONL, not CSV: the block\'s fields are objects and lists, which a CSV cell cannot carry.\n\n```bash\nkenso accounts write-research --each dossiers.jsonl --dry-run # then the same with --yes\nkenso people write-research --each people-research.jsonl --yes --concurrency 8\n```\n\n```jsonl\n{"accountId": 501, "tagline": {"text": "Payroll for EU contractors"}, "links": {"website": "https://acme.example"}}\n{"accountId": 502, "description": {"text": "Cloud cost tooling for retailers."}, "links": {"website": "https://beta.example"}}\n```\n\nA row fails as a whole with the API\'s code: `validation_failed` (an unknown field is `unknown_field`, and `error.details` names every bad field), `research_in_progress` (`409`: Ken is researching that record now, write it again once the run ends; an account run waiting for credits counts too: it runs once the workspace has credits, and the write stays refused until that run ends) or `not_found`. Rerunning a file is safe: each write replaces the record\'s research shown.\n\n## CRM sync\n\nCRM sync has generated commands only: read connections, preview, start an import, and work through sync issues. Connect the CRM itself in the app.\n\n```bash\nkenso crm-connections list\nkenso crm-connections get --connection-id 7\nkenso crm-imports create --connection-id 7 --dry-run\nkenso crm-sync-issues list --connection-id 7 --all\n```\n\nRun `kenso crm-connections --help` (or add `--all-commands` when the actions are hidden) to see every action.\n\n## Pipelines\n\nA workspace with the `pipelines` flag on can run several deal pipelines, each with its own stages. These are generated commands (beta):\n\n```bash\nkenso pipelines list\nkenso pipelines list --query "[].{id: id, name: name, default: isDefault, stages: stages[].key}"\nkenso pipelines get --pipeline-id 5\n```\n\n`list` prints every pipeline in display order, archived ones included: `id`, `name`, `routingRule` (the one sentence Ken reads to decide whether a new deal belongs there), `isDefault`, `isArchived`, `position`, `opportunityCount`, `amountTotal` and `stages`, each stage as `kenso opportunity-stages list` prints it. A stage key is unique in the workspace, across pipelines, so a deal\'s `stage` names its pipeline and its `pipelineId` repeats it. The first read turns the workspace\'s stage list into its default pipeline, named Sales, with every deal in it. The same rows as the MCP\'s `pipelines(operation="list")`.\n\nShaping them needs the `workspace_settings` permission:\n\n```bash\nkenso pipelines create --name Renewals --routing-rule "The account is already a customer" --data \'{"stages": [{"label": "Up for renewal", "category": "open"}, {"label": "Won", "category": "won"}, {"label": "Lost", "category": "lost"}]}\'\nkenso pipelines update --pipeline-id 6 --name Expansion --position 0\nkenso pipelines update --pipeline-id 6 --data @stages.json\nkenso pipelines archive --pipeline-id 6\nkenso pipelines restore --pipeline-id 6\n```\n\n- **`create`** takes a unique `name`, the pipeline\'s `stages` in display order (at least one `open`, one `won` and one `lost`) and an optional `routingRule`: one sentence that says which deals belong there, which Ken reads to route a new deal that names no pipeline. Each stage gets a key from its label; a key another pipeline already uses gets the pipeline\'s name in front (`renewals_won`). A workspace has at most 10 pipelines.\n- **`update`** changes what you send. `stages` is the pipeline\'s whole stage list: read it with `pipelines get`, keep each stage\'s `key`, and add a new stage without one. A stage with live deals in it cannot be left out; archive it with `"isArchived": true` instead.\n- **`archive`** stops new deals from entering a pipeline and keeps the deals in it. The default pipeline cannot be archived, and nothing is deleted: `restore` brings a pipeline back.\n\n## Restore a deleted account\n\n```bash\nkenso deleted-accounts list\nkenso accounts restore 812\n```\n\nA deleted account can be restored for 30 days. `deleted-accounts list` shows each one with who deleted it, `expiresAt` (restore works until then) and what comes back: `personCount`, `opportunityCount` and `touchCount`. `accounts restore <id>` brings the account back with its domains, its people, its deals and its planned touches, which wait for approval again. A domain another account took since stays with that account and is listed in `domainsTaken`. A merged account is not listed and cannot be restored: a merge has no undo. Both commands are behind the `crm_import_export` feature flag (`404` while it is off).\n\n## Export accounts, people or deals\n\n```bash\nkenso export accounts --out accounts.csv\nkenso export accounts --view 12 --out tier-1.csv\nkenso export deals --filters \'[{"field":"stageCategory","operator":"is","values":["open"]}]\' > open-deals.csv\n```\n\nIt writes the CSV that `POST /v1/accounts/export`, `/v1/people/export` or `/v1/opportunities/export` returns, to stdout or to `--out` (then it prints the file and its row count). With no filter it exports every record. More than 50,000 rows is refused: narrow the filters. `--view <id>` exports a saved Accounts view (`kenso account-views list` shows the ids). `--filters`, `--where` (accounts), `--q` and `--sort` are the search operation\'s own fields, so a deals or people view exports with its filters and sort. The accounts and deals files start with `id` and import back as they are. Each export writes an audit-log entry and needs the export permission. Accounts and deals also need the `crm_import_export` flag while it is in beta.\n\n## A deal\'s stage history\n\n```bash\nkenso opportunities stage-history 77\nkenso opportunities stage-history 77 --query "entries[].{to: stageLabel, at: enteredAt, by: changedBy}"\n```\n\nIt prints `GET /v1/opportunities/{id}/stage-history` as it is, the same rows as the deal page and the MCP\'s `opportunities(operation="get-stage-history")`: the stage now, `isComplete` and `entries`, oldest first, each with `fromStage`, `stage`, `stageLabel`, `enteredAt`, `leftAt`, `durationSeconds`, `actorKind`, `actorMemberId` and Ken\'s `reason` on a move its stage judge made. With the `deal_stage_rules` flag on, each entry also has `changedBy` (`member`, `agent`, `api_key`, `workflow`, `stage_judge`, `crm_sync` or `ken_automation`), `crmProvider` on a CRM sync, and on a move `fromStageLabel` and `fromStageDurationSeconds`, how long the deal sat in the stage it left. `isComplete` false means Kenso has no record of part of the history.\n\n## Required fields per stage\n\n```bash\nkenso pipelines stage-rules\nkenso pipelines stage-rules proposal --require amount,closeDate,custom.tier\nkenso pipelines stage-rules proposal --none\nkenso pipelines stage-rules lost --default\n```\n\nWith the `deal_stage_rules` flag on, each stage can name the fields a deal should have in it. Without a stage the command prints every stage\'s `key`, `label`, `category`, `isArchived`, `requiredFields` and `isDefault`, plus `requirableFields`: `amount`, `closeDate`, `ownerMemberId`, `primaryPersonId`, `nextStep`, `lostReasonKey`, `wonReasonKey` and `custom.<key>` for each custom deal field. `--require` sets the stage\'s whole list, in order, at most 10. `--none` requires nothing, and `--default` goes back to the default: a lost stage asks for `lostReasonKey`, any other stage nothing. Setting a rule needs the `workspace_settings` permission. The same as the MCP\'s `opportunities(operation="stages-set-required-fields")`.\n\nA missing field never stops a move. The deal moves, and it is flagged Missing on the board, the list and the deal page until the field is filled. A rule also applies to deals already in the stage.\n\n```bash\nkenso opportunities update --opportunity-id 4401 --stage proposal\nkenso opportunities list --missing-fields\n```\n\nEvery deal then carries `missingFields` (`[{field, label}]`). A create, or an update that sends a stage, answers `warnings` beside the deal for each field the stage asks for that the deal leaves empty: each prints on stderr as `warning: <message>`, stdout stays the deal and the exit code stays 0. `--missing-fields` keeps only the deals flagged Missing (also `missingFields: true` on `kenso opportunities search`).\n\n## Tasks\n\nTasks are to-dos a member owes: a title, an optional due day or time, an assignee and at most one account, person or deal. They need the `tasks` flag. The app calls deals "Deals"; the CLI keeps `--deal` for an opportunity id.\n\n```bash\nkenso tasks add "Send the deck" --due tomorrow --account 812\nkenso tasks add "Call Ada back" --due friday --at 16:00 --person 501 --assignee ada@acme.com\nkenso tasks list --assignee me --due overdue,today\nkenso tasks queue --scope mine\nkenso tasks assign 7 me\nkenso tasks done 7 8 9\nkenso tasks done 7 --undo\n```\n\n- `tasks add` sends `POST /v1/tasks`. `--due` takes `today`, `tomorrow`, a weekday (the next one: `friday` or `fri`), a day (`2026-11-20`) or an ISO 8601 time; `--at HH:MM` puts a time on that day (today without `--due`). Day words and `--at` read this computer\'s clock and time zone (`TZ`); a time\'s day is read in the assignee\'s app time zone. `--assignee` takes `me`, a member id or an email; without it the task is yours.\n- `tasks done` completes each task it names, in order (`PATCH /v1/tasks/{id}` with `status: done`); `--undo` reopens them. `tasks assign` gives a task to `me`, a member id or a member\'s email; that member gets a `task_assigned` notification.\n- `tasks queue` is `task-queue list` under the name you would try: the Tasks screen\'s open work by due day, with `--scope mine|assigned_by_me|everyone`. It lists tasks, manual touches, call tasks, inbox threads with a reminder due (when you can view the Inbox) and Ken\'s follow-ups to you, each with the app path in `href` (null for a task, which opens in its panel).\n- `tasks list`, `get`, `update`, `delete`, `restore` and `task-queue list` are generated from the API: `kenso tasks --help` lists them.\n';
7794
+ crm_default = '# CRM (beta)\n\nThe CRM commands work on Kenso\'s Accounts lane: accounts (companies), the people on them, and opportunities. They are beta: they need the `accounts` feature flag on your workspace (opportunities need `opportunities`, CRM sync needs `ingestion`). Help and `kenso describe` hide them until your workspace has the flag; `--all-commands` shows them.\n\n| Command | What it does |\n|---|---|\n| `accounts import` | Create accounts from a CSV or JSONL file. Research is charged per created account |\n| `people import` | Create or match people from a file, optionally onto accounts |\n| `accounts update --each`, `people update --each`, `opportunities update --each` | Edit many records from a file, one call per row |\n| `accounts write-research`, `people write-research` | Store research you gathered as a record\'s latest research, free. `--each` writes many |\n| `opportunities move <id> --stage <key> [--reason <key>]` | Move a deal, with its won or lost reason; a field the stage asks for never stops it |\n| `opportunities stage-history <id>` | A deal\'s stage history: each stage, when, who moved it and how long it sat there |\n| `notes list`, `notes add`, `notes edit`, `notes delete` | Notes and comments on accounts, people and deals (needs `record_notes`) |\n| `deleted-accounts list`, `accounts restore <id>` | The accounts deleted in the last 30 days, and bringing one back |\n| `export <accounts\\|people\\|deals>` | The list as CSV: everything, a saved Accounts view, or what the filters match |\n| `capture status` | Your captured mailbox, its backfill progress and what teammates see of a captured email. Needs the `crm_capture` flag |\n| `capture connect` | Turn capture on for your own mailbox. `--private` starts it hidden from teammates; `--provider google` prints a sign-in link when no account is connected yet |\n| `capture private on\\|off` | Hide your captured email from teammates, or show it again. Email only: meetings stay visible. `--thread <id>` sets the switch for one thread |\n| `capture thread <threadId>` | One captured email thread: subject, people, time, Ken\'s summary, and each body you may open. The id is `capturedThread.id` on a timeline row |\n| `capture sync` | Read your captured mailbox now, instead of waiting for the next two-minute poll. Prints what the pass read, logged and created |\n| `capture disconnect` | Turn capture off and delete your stored email bodies. Asks first; `--yes` skips the question |\n| `capture teammates-see summary\\|full_email` | Workspace admin: what teammates see of captured email |\n| `pipelines stage-rules` | List or set the fields a deal should have in each stage |\n| `opportunity-reasons get`, `opportunity-reasons replace` | List or edit why deals are lost and won |\n| `crm-connections`, `crm-imports`, `crm-sync-issues` | Read and run CRM sync. Connecting a CRM stays in the app |\n| `tasks add`, `tasks done`, `tasks assign`, `tasks queue` | Add a to-do for a member on an account, person or deal, complete it, hand it on, or read your open work (needs `tasks`) |\n\nImport accounts first, then people: `people import` never creates an account.\n\n## Import accounts\n\n```bash\nkenso accounts import --file accounts.csv\nkenso accounts import --file accounts.csv --yes\n```\n\n```csv\nname,domain,industry,employeeCount\nAcme,acme.io,Software,120\nGlobex,globex.com,Manufacturing,"1,200"\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `name` (or `company`, `companyName`, `accountName`), `domains` (several, split on `,` or `;`) or one `domain` (or `website`, `companyDomain`), `industry`, `employeeCount`, `hqLocation`, `linkedinUrl`, `stage`, `angle`, `whyNow`, `fitScore`, `fundingRound`, `cadenceDays`, `ownerMemberId`, `kenCompanyId`, `sendsFromInboxId`, `sendsFromLinkedInAccountId` and `source`.\n- **A domain is required.** A file with no domain column is a usage error, and a row without a domain is `invalid` (`domain_required`).\n- **The dry run prices the research.** It asks for a credit estimate per 1,000 accounts and puts the sum in the plan: `kind`, `accountCount`, `totalMillicredits`, `availableMillicredits` and `sufficient`.\n- **Rows go 100 per call** to `POST /v1/accounts/bulk-create`.\n\nEach row comes back `created` (`id` is the new account; its research is queued, `researchQueued`, or waits for credits, `researchWaitingCredits`), `skipped` with reason `domain_taken` (already an account; `id` is that account) or `failed` (`reason` is the API\'s code, `error` names the field; an item Kenso failed to save is sent once more first). Rerunning the same file is safe: accounts that exist come back `domain_taken`.\n\n## Import people\n\n```bash\nkenso people import --file people.csv\nkenso people import --file people.csv --find-emails --yes\nkenso people import --file people.jsonl --dry-run\n```\n\n```csv\nfullName,email,title,accountDomain,role\nAnn Lee,ann@acme.io,VP Sales,acme.io,champion\nBob Ray,,CTO,acme.io,\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `email`, `fullName` (or `name`), `firstName`, `lastName`, `title`, `linkedinUrl` (or `linkedin`, `profileUrl`), `accountDomain` (or `domain`, `website`, `companyDomain`), `accountId`, `role` and `priority`. Other columns are ignored with one warning.\n- **A person needs a name:** `fullName`, or `firstName`, `lastName` or both (the CLI joins them). A row with none of them is `invalid` (`name_required`).\n- **To put a person on an account,** give `accountDomain` or `accountId`. A row with both sends only `accountId`.\n- **`--find-emails`** queues an email find (charged in credits) for each person without an email.\n- **Rows go 200 per call** to `POST /v1/people/batch`.\n\nPeople already in the workspace are matched by email, then LinkedIn URL, so running the same file again creates nobody twice. A row comes back `created` (a new person), `updated` (an existing person added to the account), `skipped` with reason `already_on_account`, `matched` (no account asked) or `previously_removed`, or `failed`: `account_not_found` saves the person without an account (import the account, then rerun to place them), any other reason is the API\'s. The summary adds `matched`, `addedToAccounts` and `emailFindsQueued`.\n\n## List and search accounts\n\n`accounts list` and `accounts search` sort and page on the server, so they reach every account in the workspace, however many there are.\n\n```bash\nkenso accounts list --sort score:desc --limit 100 # one page; the output\'s next: line is the following one\nkenso accounts list --sort score:desc --limit 100 --all # every page, to the end\nkenso accounts search --search hiring --sort latestSignalAt:desc --data \'{"qFields": ["name", "latestSignal"]}\'\nkenso accounts search --limit 1 --data \'{"countBy": ["stage"]}\' # how many accounts sit in each stage\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}]}, "sort": "tier,-pipelineAmount"}\' --all\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "hqLocation", "operator": "contains", "values": ["Germany"]}]}}\' --all\n# tier 1 accounts with no meeting in 30 days: none since then, or none ever\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}, {"match": "any", "conditions": [{"field": "lastMeeting", "operator": "older_than_days", "values": ["30"]}, {"field": "lastMeeting", "operator": "is_empty"}]}]}}\' --all\n```\n\n- **`--sort`** takes up to 3 comma-separated keys, each `field` (ascending), `field:asc` or `field:desc`. The API\'s `-field` form needs the equals sign here, `--sort=-score`, because a value that starts with a dash reads as a flag. Fields: `createdAt`, `name`, `score`, `tier` (ascending is tier 1 first), `latestSignalAt`, `committee`, `pipelineAmount`, `nextTouchAt`, `lastTouchAt`. An account with no value for a key comes last in both directions. The default is `-createdAt`.\n- **`--limit`** is 1 to 1000 (default 50). `--cursor` takes the previous page\'s `nextCursor` with the same filters and sort; `--all` follows the cursors for you.\n- **`--search`** (also `--q`) matches the name or a domain.\n- **Lists and objects go in `--data`** on `search`, as the API takes them (`kenso describe accounts search`); a flag beside it sets or replaces one key:\n - `qFields` picks where the search text looks: `name`, `domain`, `latestSignal` (the latest signal\'s title).\n - `countBy` (`stage`, `stageGroup`) adds `counts` to the output: every value with the number of matching accounts that hold it, whatever the page. The output is then one object: `data`, `pagination` and `counts`.\n - `filters` and `where` narrow the accounts.\n\nAn account\'s timeline pages the same way. `kenso accounts activity 812` returns the newest 100 earlier rows and, when older ones exist, `data.nextCursor`. Pass it back as `--cursor` (with the same `--category`) for the rows before them, until a page comes without one.\n\n## Edit accounts, people and opportunities\n\nApart from `accounts bulk-update`, which sets one `accountType` on up to 500 accounts, there is no bulk edit route, so run the generated `update` command once per row with `--each`. Columns are the command\'s flags by API name or flag name, and the id column fills the route:\n\n```bash\nkenso accounts update --each accounts-edit.csv --dry-run # then the same with --yes\nkenso people update --each people-edit.csv --dry-run\nkenso opportunities update --each deals.csv --dry-run\n```\n\n```csv\naccountId,stage,ownerMemberId,overwritePinned\n501,engaged,42,true\n502,customer,42,true\n```\n\nA row that changes a field someone pinned in the app fails as a whole (`409 conflict`, `pinned_by_user`: nothing on that record changes, the other fields of the row included), unless the row sets `overwritePinned` to `true` (or you pass `--overwrite-pinned`, only with the person\'s OK). Every flag of an update command: `kenso accounts update --help`.\n\n## Search opportunities\n\n`kenso opportunities search` works as `accounts search` does: it takes `--search`, `--sort`, `--limit`, `--cursor`, `--all`, and its lists in `--data`.\n\n```bash\nkenso opportunities search --data \'{"filters": [{"field": "stageCategory", "operator": "is", "values": ["open"]}]}\' --all\nkenso opportunities search --data \'{"filters": [{"field": "ownerMemberId", "operator": "is", "values": ["none"]}, {"field": "closeDate", "operator": "is", "values": ["past_due", "next_30_days"]}]}\'\nkenso opportunities search --limit 1 --data \'{"countBy": ["stage", "ownerMemberId"]}\' # how many opportunities hold each value\n```\n\n- **`filters`** is a list of `{field, operator, values}`, all of which must hold. Fields: `stage` (a stage key), `stageCategory` (`open`, `won`, `lost`), `ownerMemberId`, `closeDate` (`past_due`, `next_30_days`, `later`, `none`) and `sourceCampaignId`. `operator` is `is` or `is_not`; the values of one condition are OR. `none` in `values` matches an opportunity with no owner, no source campaign or no close date.\n- **`countBy`** takes the same field names and adds `counts` to the output: per field, every value with the number of matching opportunities that hold it.\n- `--account-id` keeps the search to one account. `closeDate` counts days in the member\'s app time zone.\n\nOne person\'s deals, meetings and campaign contacts, as their person page lists them:\n\n```bash\nkenso opportunities list --person-id 9001 # the deals they are on, or are the primary person of\nkenso meetings list --person-id 9001 # the meetings they attend, among the ones you can see\nkenso contacts list --person-id 9001 # their contact in each campaign they are in\n```\n\n## Write research you gathered\n\n`accounts write-research` and `people write-research` store research you gathered outside Kenso as the record\'s latest research (`PUT /v1/accounts/{accountId}/research`, `PUT /v1/people/{personId}/research`). The Research tab shows it like a Ken run, with `trigger: agent` and `researchedAt` now. Nothing is charged, and no account or person field changes: set an account\'s own `fitScore`, `whyNow` or `angle` with `accounts update`. They need the `accounts_research` flag and accounts edit.\n\nThe body is the research block `accounts get --expand research` (or `people get-research`) returns, without its read-only fields: leave out `id`, `status`, `trigger`, `errorCode`, `researchedAt`, `isStale` and `appliedPrompt` (for a person also `mode`, `requestedAt`, `researchedMode`, `firecrawlCredits` and `webNote`), or the write fails with `unknown_field`. Pass it with `--data @file`:\n\n```bash\nkenso accounts write-research --account-id 501 --data @acme-dossier.json\nkenso people write-research --person-id 9001 --data @jane.json\n```\n\n```json\n{\n "tagline": { "text": "Payroll for EU contractors", "sourceUrls": ["https://acme.example"] },\n "description": { "text": "Acme runs payroll and compliance for companies hiring contractors in 30 EU countries.", "sourceUrls": ["https://acme.example"] },\n "links": { "website": "https://acme.example" },\n "whyNow": { "text": "Raised a $40M Series B in October", "sourceUrls": ["https://news.example/acme-b"], "date": "2026-10" },\n "fitScore": 82,\n "angle": "Lead with contractor onboarding time."\n}\n```\n\nMany records: one JSONL line per record, with the id next to the block\'s fields. Nested objects are sent as written. Use JSONL, not CSV: the block\'s fields are objects and lists, which a CSV cell cannot carry.\n\n```bash\nkenso accounts write-research --each dossiers.jsonl --dry-run # then the same with --yes\nkenso people write-research --each people-research.jsonl --yes --concurrency 8\n```\n\n```jsonl\n{"accountId": 501, "tagline": {"text": "Payroll for EU contractors"}, "links": {"website": "https://acme.example"}}\n{"accountId": 502, "description": {"text": "Cloud cost tooling for retailers."}, "links": {"website": "https://beta.example"}}\n```\n\nA row fails as a whole with the API\'s code: `validation_failed` (an unknown field is `unknown_field`, and `error.details` names every bad field), `research_in_progress` (`409`: Ken is researching that record now, write it again once the run ends; an account run waiting for credits counts too: it runs once the workspace has credits, and the write stays refused until that run ends) or `not_found`. Rerunning a file is safe: each write replaces the record\'s research shown.\n\n## CRM sync\n\nCRM sync has generated commands only: read connections, preview, start an import, and work through sync issues. Connect the CRM itself in the app.\n\n```bash\nkenso crm-connections list\nkenso crm-connections get --connection-id 7\nkenso crm-imports create --connection-id 7 --dry-run\nkenso crm-sync-issues list --connection-id 7 --all\n```\n\nRun `kenso crm-connections --help` (or add `--all-commands` when the actions are hidden) to see every action.\n\n## Pipelines\n\nA workspace with the `pipelines` flag on can run several deal pipelines, each with its own stages. These are generated commands (beta):\n\n```bash\nkenso pipelines list\nkenso pipelines list --query "[].{id: id, name: name, default: isDefault, stages: stages[].key}"\nkenso pipelines get --pipeline-id 5\n```\n\n`list` prints every pipeline in display order, archived ones included: `id`, `name`, `routingRule` (the one sentence Ken reads to decide whether a new deal belongs there), `isDefault`, `isArchived`, `position`, `opportunityCount`, `amountTotal` and `stages`, each stage as `kenso opportunity-stages list` prints it. A stage key is unique in the workspace, across pipelines, so a deal\'s `stage` names its pipeline and its `pipelineId` repeats it. The first read turns the workspace\'s stage list into its default pipeline, named Sales, with every deal in it. The same rows as the MCP\'s `pipelines(operation="list")`.\n\nShaping them needs the `workspace_settings` permission:\n\n```bash\nkenso pipelines create --name Renewals --routing-rule "The account is already a customer" --data \'{"stages": [{"label": "Up for renewal", "category": "open"}, {"label": "Won", "category": "won"}, {"label": "Lost", "category": "lost"}]}\'\nkenso pipelines update --pipeline-id 6 --name Expansion --position 0\nkenso pipelines update --pipeline-id 6 --data @stages.json\nkenso pipelines archive --pipeline-id 6\nkenso pipelines restore --pipeline-id 6\n```\n\n- **`create`** takes a unique `name`, the pipeline\'s `stages` in display order (at least one `open`, one `won` and one `lost`) and an optional `routingRule`: one sentence that says which deals belong there, which Ken reads to route a new deal that names no pipeline. Each stage gets a key from its label; a key another pipeline already uses gets the pipeline\'s name in front (`renewals_won`). A workspace has at most 10 pipelines.\n- **`update`** changes what you send. `stages` is the pipeline\'s whole stage list: read it with `pipelines get`, keep each stage\'s `key`, and add a new stage without one. A stage with live deals in it cannot be left out; archive it with `"isArchived": true` instead.\n- **`archive`** stops new deals from entering a pipeline and keeps the deals in it. The default pipeline cannot be archived, and nothing is deleted: `restore` brings a pipeline back.\n\n## Restore a deleted account\n\n```bash\nkenso deleted-accounts list\nkenso accounts restore 812\n```\n\nA deleted account can be restored for 30 days. `deleted-accounts list` shows each one with who deleted it, `expiresAt` (restore works until then) and what comes back: `personCount`, `opportunityCount` and `touchCount`. `accounts restore <id>` brings the account back with its domains, its people, its deals and its planned touches, which wait for approval again. A domain another account took since stays with that account and is listed in `domainsTaken`. A merged account is not listed and cannot be restored: a merge has no undo. Both commands are behind the `crm_import_export` feature flag (`404` while it is off).\n\n## Export accounts, people or deals\n\n```bash\nkenso export accounts --out accounts.csv\nkenso export accounts --view 12 --out tier-1.csv\nkenso export deals --filters \'[{"field":"stageCategory","operator":"is","values":["open"]}]\' > open-deals.csv\n```\n\nIt writes the CSV that `POST /v1/accounts/export`, `/v1/people/export` or `/v1/opportunities/export` returns, to stdout or to `--out` (then it prints the file and its row count). With no filter it exports every record. More than 50,000 rows is refused: narrow the filters. `--view <id>` exports a saved Accounts view (`kenso account-views list` shows the ids). `--filters`, `--where` (accounts), `--q` and `--sort` are the search operation\'s own fields, so a deals or people view exports with its filters and sort. The accounts and deals files start with `id` and import back as they are. Each export writes an audit-log entry and needs the export permission. Accounts and deals also need the `crm_import_export` flag while it is in beta.\n\n## A deal\'s stage history\n\n```bash\nkenso opportunities stage-history 77\nkenso opportunities stage-history 77 --query "entries[].{to: stageLabel, at: enteredAt, by: changedBy}"\n```\n\nIt prints `GET /v1/opportunities/{id}/stage-history` as it is, the same rows as the deal page and the MCP\'s `opportunities(operation="get-stage-history")`: the stage now, `isComplete` and `entries`, oldest first, each with `fromStage`, `stage`, `stageLabel`, `enteredAt`, `leftAt`, `durationSeconds`, `actorKind`, `actorMemberId` and Ken\'s `reason` on a move its stage judge made. With the `deal_stage_rules` flag on, each entry also has `changedBy` (`member`, `agent`, `api_key`, `workflow`, `stage_judge`, `crm_sync` or `ken_automation`), `crmProvider` on a CRM sync, and on a move `fromStageLabel` and `fromStageDurationSeconds`, how long the deal sat in the stage it left. `isComplete` false means Kenso has no record of part of the history.\n\n## Notes on accounts, people and deals\n\nWith the `record_notes` feature on, everyone who can see a record reads its notes. Name the record with exactly one of `--account`, `--person` and `--deal`:\n\n```bash\nkenso notes list --account 5\nkenso notes add --account 5 --body \'Budget approved, @[Jane Doe](41) please send the DPA\'\nkenso notes add --parent 900 --body \'Sent it this morning\' # a comment under note 900\ncat call-notes.md | kenso notes add --deal 77 --body - # the body from stdin\nkenso notes edit 900 --body \'Budget approved for Q1\' # the author only\nkenso notes edit 900 --pin\nkenso notes delete 900 --yes # kenso notes restore 900 brings it back\n```\n\nThe body is markdown, up to 20,000 characters. Mention a teammate as `@[Name](memberId)`: they get a notification that opens the note. A note shows on the record\'s Notes tab and its Activity timeline, and Ken\'s account brief quotes the account\'s notes. The MCP\'s `notes` tool does the same. A note on an account needs the accounts plan feature; people and deals work on every plan.\n\n## Required fields per stage\n\n```bash\nkenso pipelines stage-rules\nkenso pipelines stage-rules proposal --require amount,closeDate,custom.tier\nkenso pipelines stage-rules proposal --none\nkenso pipelines stage-rules lost --default\n```\n\nWith the `deal_stage_rules` flag on, each stage can name the fields a deal should have in it. Without a stage the command prints every stage\'s `key`, `label`, `category`, `isArchived`, `requiredFields` and `isDefault`, plus `requirableFields`: `amount`, `closeDate`, `ownerMemberId`, `primaryPersonId`, `nextStep`, `lostReasonKey`, `wonReasonKey` and `custom.<key>` for each custom deal field. `--require` sets the stage\'s whole list, in order, at most 10. `--none` requires nothing, and `--default` goes back to the default: a lost stage asks for `lostReasonKey`, any other stage nothing. Setting a rule needs the `workspace_settings` permission. The same as the MCP\'s `opportunities(operation="stages-set-required-fields")`.\n\nA missing field never stops a move. The deal moves, and it is flagged Missing on the board, the list and the deal page until the field is filled. A rule also applies to deals already in the stage.\n\n```bash\nkenso opportunities update --opportunity-id 4401 --stage proposal\nkenso opportunities list --missing-fields\n```\n\nEvery deal then carries `missingFields` (`[{field, label}]`). A create, or an update that sends a stage, answers `warnings` beside the deal for each field the stage asks for that the deal leaves empty: each prints on stderr as `warning: <message>`, stdout stays the deal and the exit code stays 0. `--missing-fields` keeps only the deals flagged Missing (also `missingFields: true` on `kenso opportunities search`).\n\n## Won and lost reasons\n\n```bash\nkenso opportunity-reasons get\nkenso opportunity-reasons replace --kind lost --data \'{"reasons":[{"key":"no_budget","label":"No budget"},{"label":"Built it in-house"}]}\'\nkenso opportunities move 4401 --stage lost --reason built_it_in_house\n```\n\n`kenso opportunities move <id> --stage <key> [--reason <key>]` sends the reason as `lostReasonKey` for a lost stage or `wonReasonKey` for a won stage; an open stage takes none. Each field the new stage asks for that the deal leaves empty prints a warning on stderr, and the move still goes through.\n\nWith the `deal_stage_rules` flag on, each workspace edits why its deals are lost and won. `get` prints `lost` and `won`, each `{isDefault, reasons: [{key, label, isArchived}]}`. `replace` takes a kind\'s whole list in order, as `get` prints it: keep a reason by its `key`, leave `key` out for a new one, and set `isArchived` to archive a reason or bring one back. A reason left out is archived too: deals keep it, and no write can pick it again. At least one reason stays live and at most 30, and labels stay unique, archived ones included. A deal takes a live key in `lostReasonKey` (a lost stage) or `wonReasonKey` (a won stage). A move to Lost without a reason still goes through, with a warning and "Missing: Lost reason" on the deal. Editing the lists needs the `workspace_settings` permission. The same as the MCP\'s `pipelines(operation="reasons-get")` and `reasons-replace`.\n\n## Tasks\n\nTasks are to-dos a member owes: a title, an optional due day or time, an assignee and at most one account, person or deal. They need the `tasks` flag. The app calls deals "Deals"; the CLI keeps `--deal` for an opportunity id.\n\n```bash\nkenso tasks add "Send the deck" --due tomorrow --account 812\nkenso tasks add "Call Ada back" --due friday --at 16:00 --person 501 --assignee ada@acme.com\nkenso tasks list --assignee me --due overdue,today\nkenso tasks queue --scope mine\nkenso tasks assign 7 me\nkenso tasks done 7 8 9\nkenso tasks done 7 --undo\n```\n\n- `tasks add` sends `POST /v1/tasks`. `--due` takes `today`, `tomorrow`, a weekday (the next one: `friday` or `fri`), a day (`2026-11-20`) or an ISO 8601 time; `--at HH:MM` puts a time on that day (today without `--due`). Day words and `--at` read this computer\'s clock and time zone (`TZ`); a time\'s day is read in the assignee\'s app time zone. `--assignee` takes `me`, a member id or an email; without it the task is yours.\n- `tasks done` completes each task it names, in order (`PATCH /v1/tasks/{id}` with `status: done`); `--undo` reopens them. `tasks assign` gives a task to `me`, a member id or a member\'s email; that member gets a `task_assigned` notification.\n- `tasks queue` is `task-queue list` under the name you would try: the Tasks screen\'s open work by due day, with `--scope mine|assigned_by_me|everyone`. It lists tasks, manual touches, call tasks, inbox threads with a reminder due (when you can view the Inbox) and Ken\'s follow-ups to you, each with the app path in `href` (null for a task, which opens in its panel).\n- `tasks list`, `get`, `update`, `delete`, `restore` and `task-queue list` are generated from the API: `kenso tasks --help` lists them.\n';
7795
7795
  }
7796
7796
  });
7797
7797
 
@@ -8266,8 +8266,8 @@ var init_install = __esm({
8266
8266
  next
8267
8267
  });
8268
8268
  }
8269
- for (const target of targets) {
8270
- if (target.status !== "unchanged") write(target.path, text4);
8269
+ for (const target2 of targets) {
8270
+ if (target2.status !== "unchanged") write(target2.path, text4);
8271
8271
  }
8272
8272
  if (dir !== void 0 && basename2(resolve5(dir)) !== SKILL_NAME) {
8273
8273
  ctx.output.warn(`Agents expect the skill's folder to be named ${SKILL_NAME}, like the skill: ${resolve5(dir)} is not.`);
@@ -8983,8 +8983,8 @@ var init_browser_login = __esm({
8983
8983
  defaultDeps = {
8984
8984
  sleep: (ms, signal) => delay2(ms, void 0, signal ? { signal } : void 0),
8985
8985
  now: () => Date.now(),
8986
- spawn: (command60, args) => {
8987
- const child = nodeSpawn(command60, args, { detached: true, stdio: "ignore" });
8986
+ spawn: (command65, args) => {
8987
+ const child = nodeSpawn(command65, args, { detached: true, stdio: "ignore" });
8988
8988
  child.on("error", () => {
8989
8989
  });
8990
8990
  child.unref();
@@ -10248,8 +10248,8 @@ var init_run = __esm({
10248
10248
  defaultDeps2 = {
10249
10249
  sleep: (ms, signal) => delay3(ms, void 0, signal ? { signal } : void 0),
10250
10250
  now: () => Date.now(),
10251
- spawn: (command60, args) => {
10252
- const child = nodeSpawn2(command60, args, { detached: true, stdio: "ignore" });
10251
+ spawn: (command65, args) => {
10252
+ const child = nodeSpawn2(command65, args, { detached: true, stdio: "ignore" });
10253
10253
  child.on("error", () => {
10254
10254
  });
10255
10255
  child.unref();
@@ -10290,9 +10290,9 @@ function stringFlag2(flags, name) {
10290
10290
  const text4 = value.trim();
10291
10291
  return text4 === "" ? void 0 : text4;
10292
10292
  }
10293
- function requireFlag(flags, name, command60, hint) {
10293
+ function requireFlag(flags, name, command65, hint) {
10294
10294
  const value = stringFlag2(flags, name);
10295
- if (value === void 0) throw usageError(`--${name} is required for ${command60}.`, { field: name, next: `${command60} --help`, ...hint ? { hint } : {} });
10295
+ if (value === void 0) throw usageError(`--${name} is required for ${command65}.`, { field: name, next: `${command65} --help`, ...hint ? { hint } : {} });
10296
10296
  return value;
10297
10297
  }
10298
10298
  function positiveId(value) {
@@ -10301,8 +10301,8 @@ function positiveId(value) {
10301
10301
  const id = Number(text4);
10302
10302
  return Number.isSafeInteger(id) && id > 0 ? id : void 0;
10303
10303
  }
10304
- function idFlag(flags, name, command60) {
10305
- const raw = requireFlag(flags, name, command60);
10304
+ function idFlag(flags, name, command65) {
10305
+ const raw = requireFlag(flags, name, command65);
10306
10306
  const id = positiveId(raw);
10307
10307
  if (id === void 0) throw usageError(`--${name} must be a positive whole number (got "${raw}").`, { field: name });
10308
10308
  return id;
@@ -10322,8 +10322,8 @@ function isDryRun(ctx) {
10322
10322
  function shellQuote4(value) {
10323
10323
  return /^[A-Za-z0-9_\-.,:/@=+%]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
10324
10324
  }
10325
- function sameCommand2(command60, flags, ctx, extra = []) {
10326
- const parts2 = [command60];
10325
+ function sameCommand2(command65, flags, ctx, extra = []) {
10326
+ const parts2 = [command65];
10327
10327
  for (const [name, value] of Object.entries(flags)) {
10328
10328
  if (value === void 0 || value === false) continue;
10329
10329
  if (value === true) parts2.push(`--${name}`);
@@ -10516,16 +10516,16 @@ function parseMapOverrides(value) {
10516
10516
  });
10517
10517
  }
10518
10518
  const out = {};
10519
- for (const [column, target] of Object.entries(value)) {
10520
- if (target !== null && typeof target !== "string") {
10519
+ for (const [column, target2] of Object.entries(value)) {
10520
+ if (target2 !== null && typeof target2 !== "string") {
10521
10521
  throw usageError(`--map "${column}" must name a field, customVariables.<key>, or null.`, { field: "map" });
10522
10522
  }
10523
- out[column] = target;
10523
+ out[column] = target2;
10524
10524
  }
10525
10525
  return out;
10526
10526
  }
10527
- function targetName(target) {
10528
- return "field" in target ? target.field : `${CUSTOM_PREFIX}${target.customKey}`;
10527
+ function targetName(target2) {
10528
+ return "field" in target2 ? target2.field : `${CUSTOM_PREFIX}${target2.customKey}`;
10529
10529
  }
10530
10530
  function overrideTarget(column, value, mode) {
10531
10531
  const text4 = value.trim();
@@ -10569,13 +10569,13 @@ function buildMapping(headers, overrides, mode) {
10569
10569
  };
10570
10570
  for (const header of headers) {
10571
10571
  const override2 = overrideFor(header, overrides);
10572
- let target;
10572
+ let target2;
10573
10573
  if (override2.found) {
10574
10574
  if (override2.value === null) {
10575
10575
  drop(header, "mapped_to_null");
10576
10576
  continue;
10577
10577
  }
10578
- target = overrideTarget(header, override2.value, mode);
10578
+ target2 = overrideTarget(header, override2.value, mode);
10579
10579
  } else {
10580
10580
  const field = fieldOf(header);
10581
10581
  const custom = CUSTOM_HEADER.exec(header)?.[1];
@@ -10585,7 +10585,7 @@ function buildMapping(headers, overrides, mode) {
10585
10585
  drop(header, problem);
10586
10586
  continue;
10587
10587
  }
10588
- target = { customKey: normalizeVariableName(custom) };
10588
+ target2 = { customKey: normalizeVariableName(custom) };
10589
10589
  } else if (isBagHeader(header)) {
10590
10590
  drop(header, "not_an_object");
10591
10591
  continue;
@@ -10594,20 +10594,20 @@ function buildMapping(headers, overrides, mode) {
10594
10594
  drop(header, "not_updatable");
10595
10595
  continue;
10596
10596
  }
10597
- target = { field };
10597
+ target2 = { field };
10598
10598
  } else {
10599
10599
  const problem = customVariableKeyProblem(header);
10600
10600
  if (problem) {
10601
10601
  drop(header, problem);
10602
10602
  continue;
10603
10603
  }
10604
- target = { customKey: normalizeVariableName(header) };
10604
+ target2 = { customKey: normalizeVariableName(header) };
10605
10605
  }
10606
10606
  }
10607
- result.columns.push({ header, target });
10608
- result.mapping[header] = targetName(target);
10609
- if ("field" in target) result.fields.add(target.field);
10610
- else if (!result.customVariableKeys.includes(target.customKey)) result.customVariableKeys.push(target.customKey);
10607
+ result.columns.push({ header, target: target2 });
10608
+ result.mapping[header] = targetName(target2);
10609
+ if ("field" in target2) result.fields.add(target2.field);
10610
+ else if (!result.customVariableKeys.includes(target2.customKey)) result.customVariableKeys.push(target2.customKey);
10611
10611
  }
10612
10612
  return result;
10613
10613
  }
@@ -10621,15 +10621,15 @@ function readCell(value) {
10621
10621
  }
10622
10622
  function rowValues(row, mapping, mode) {
10623
10623
  const out = { fields: {}, customVariables: {} };
10624
- for (const { header, target } of mapping.columns) {
10624
+ for (const { header, target: target2 } of mapping.columns) {
10625
10625
  const cell2 = readCell(row[header]);
10626
10626
  if (cell2.kind === "blank") continue;
10627
10627
  const value = cell2.kind === "null" ? null : cell2.text;
10628
- if ("field" in target) {
10628
+ if ("field" in target2) {
10629
10629
  if (value === null && mode === "import") continue;
10630
- if (!Object.hasOwn(out.fields, target.field)) out.fields[target.field] = value;
10631
- } else if (!Object.hasOwn(out.customVariables, target.customKey)) {
10632
- out.customVariables[target.customKey] = value;
10630
+ if (!Object.hasOwn(out.fields, target2.field)) out.fields[target2.field] = value;
10631
+ } else if (!Object.hasOwn(out.customVariables, target2.customKey)) {
10632
+ out.customVariables[target2.customKey] = value;
10633
10633
  }
10634
10634
  }
10635
10635
  return out;
@@ -10986,10 +10986,10 @@ function columnMappings(mapping) {
10986
10986
  const sent = new Map(mapping.columns.map((column) => [column.header, column.target]));
10987
10987
  const out = [];
10988
10988
  for (const header of Object.keys(mapping.mapping)) {
10989
- const target = sent.get(header);
10990
- const csvTarget = target ? void 0 : csvTargetOf(header, mapping);
10991
- if (target && "field" in target) out.push({ csvColumn: header, targetField: TARGET_FIELDS[target.field] ?? target.field });
10992
- else if (target) out.push({ csvColumn: header, targetField: "custom_variable", customVariableName: target.customKey });
10989
+ const target2 = sent.get(header);
10990
+ const csvTarget = target2 ? void 0 : csvTargetOf(header, mapping);
10991
+ if (target2 && "field" in target2) out.push({ csvColumn: header, targetField: TARGET_FIELDS[target2.field] ?? target2.field });
10992
+ else if (target2) out.push({ csvColumn: header, targetField: "custom_variable", customVariableName: target2.customKey });
10993
10993
  else if (csvTarget) out.push({ csvColumn: header, targetField: csvTarget });
10994
10994
  }
10995
10995
  return out;
@@ -11460,12 +11460,12 @@ import { join as join11 } from "node:path";
11460
11460
  function whereDir(env) {
11461
11461
  return join11(runsRoot(env), WHERE_DIR);
11462
11462
  }
11463
- async function unfinishedWhereIds(ctx, command60, args) {
11463
+ async function unfinishedWhereIds(ctx, command65, args) {
11464
11464
  const dir = whereDir(ctx.env);
11465
11465
  const identity = argsIdentity(args);
11466
11466
  const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
11467
11467
  for (const run of await listRuns(ctx.env)) {
11468
- if (run.command !== command60 || run.status === "done" || run.status === "planned") continue;
11468
+ if (run.command !== command65 || run.status === "done" || run.status === "planned") continue;
11469
11469
  if ((run.workspaceId || void 0) !== (workspaceId || void 0) || argsIdentity(run.args) !== identity) continue;
11470
11470
  if (run.inputPath?.startsWith(`${dir}/`) && existsSync6(run.inputPath)) return run.inputPath;
11471
11471
  }
@@ -11611,14 +11611,14 @@ async function idsFromRun(ctx, runId) {
11611
11611
  return { ...idItems(ids2), source: "run" };
11612
11612
  }
11613
11613
  async function collectIds(ctx, flags, kind, dryRun2) {
11614
- const command60 = `kenso contacts ${kind}`;
11614
+ const command65 = `kenso contacts ${kind}`;
11615
11615
  const ids2 = stringFlag2(flags, "ids");
11616
11616
  const where = kind === "restore" ? void 0 : stringFlag2(flags, "where");
11617
11617
  const run = kind === "restore" ? stringFlag2(flags, "run") : void 0;
11618
11618
  const given = [ids2, where, run].filter((v) => v !== void 0).length;
11619
11619
  if (given !== 1) {
11620
11620
  const choices = kind === "restore" ? "--ids <file|-> or --run <runId>" : "--ids <file|-> or --where '<json>'";
11621
- throw usageError(`${command60} needs exactly one of ${choices}.`, { field: "ids", next: `${command60} --help` });
11621
+ throw usageError(`${command65} needs exactly one of ${choices}.`, { field: "ids", next: `${command65} --help` });
11622
11622
  }
11623
11623
  if (ids2 !== void 0) return idsFromFile(ctx, ids2);
11624
11624
  if (where !== void 0) return idsFromWhere(ctx, kind, flags, where, dryRun2);
@@ -12920,19 +12920,308 @@ var init_mcp = __esm({
12920
12920
  }
12921
12921
  });
12922
12922
 
12923
+ // src/commands/notes/target.ts
12924
+ function positiveId2(value, field, next) {
12925
+ const text4 = String(value ?? "").trim();
12926
+ const id = /^\d+$/.test(text4) ? Number(text4) : Number.NaN;
12927
+ if (!Number.isSafeInteger(id) || id < 1) {
12928
+ throw usageError(`${field} must be a positive whole number (got "${text4}").`, { field, next });
12929
+ }
12930
+ return id;
12931
+ }
12932
+ function target(flags, next, allowNone = false) {
12933
+ const given = ["account", "person", "deal"].filter((name2) => flags[name2] !== void 0);
12934
+ if (given.length === 0 && allowNone) return {};
12935
+ if (given.length !== 1) {
12936
+ throw usageError("Name the record with exactly one of --account, --person and --deal.", { field: "account", next });
12937
+ }
12938
+ const name = given[0];
12939
+ const key = name === "deal" ? "opportunityId" : `${name}Id`;
12940
+ return { [key]: positiveId2(flags[name], name, next) };
12941
+ }
12942
+ var targetFlags;
12943
+ var init_target = __esm({
12944
+ "src/commands/notes/target.ts"() {
12945
+ "use strict";
12946
+ init_errors();
12947
+ targetFlags = {
12948
+ account: { type: "string", description: "The account id", aliases: ["account-id"] },
12949
+ person: { type: "string", description: "The person id", aliases: ["person-id"] },
12950
+ deal: { type: "string", description: "The deal (opportunity) id", aliases: ["opportunity", "opportunity-id"] }
12951
+ };
12952
+ }
12953
+ });
12954
+
12955
+ // src/commands/notes/list.ts
12956
+ var list_exports = {};
12957
+ __export(list_exports, {
12958
+ default: () => list_default
12959
+ });
12960
+ var command28, list_default;
12961
+ var init_list = __esm({
12962
+ "src/commands/notes/list.ts"() {
12963
+ "use strict";
12964
+ init_exit_codes();
12965
+ init_target();
12966
+ command28 = {
12967
+ resource: "notes",
12968
+ action: "list",
12969
+ summary: "List the notes on an account, a person or a deal, pinned first, then newest",
12970
+ description: "Reads GET /v1/notes for the one record you name and follows every page. Each note has id, body (markdown, mentions as @[Name](memberId)), mentions, isPinned, createdBy, createdAt, editedAt, commentCount and its first 50 comments, oldest first. A record outside your workspace or account scope is not_found.",
12971
+ flags: targetFlags,
12972
+ examples: [
12973
+ "kenso notes list --account 5",
12974
+ "kenso notes list --deal 77 --query '[].{id: id, by: createdBy.name, body: body}'"
12975
+ ],
12976
+ beta: { featureGates: { all: ["record_notes"] } },
12977
+ operationIds: ["notes.list"],
12978
+ async run(ctx, { flags }) {
12979
+ const query = target(flags, "kenso notes list --account <accountId>");
12980
+ await ctx.output.list(ctx.client.paginate({ method: "GET", path: "/v1/notes", query, signal: ctx.signal }));
12981
+ return ExitCode.Ok;
12982
+ }
12983
+ };
12984
+ list_default = command28;
12985
+ }
12986
+ });
12987
+
12988
+ // src/commands/notes/add.ts
12989
+ var add_exports = {};
12990
+ __export(add_exports, {
12991
+ bodyText: () => bodyText,
12992
+ default: () => add_default
12993
+ });
12994
+ async function bodyText(ctx, value, next) {
12995
+ const text4 = value === "-" ? await readStream(ctx.stdin ?? process.stdin) : String(value ?? "");
12996
+ if (text4.trim() === "") throw usageError("--body cannot be empty: the note's text, in markdown (--body - reads stdin).", { field: "body", next });
12997
+ return text4;
12998
+ }
12999
+ var command29, add_default;
13000
+ var init_add = __esm({
13001
+ "src/commands/notes/add.ts"() {
13002
+ "use strict";
13003
+ init_errors();
13004
+ init_exit_codes();
13005
+ init_http();
13006
+ init_input();
13007
+ init_target();
13008
+ command29 = {
13009
+ resource: "notes",
13010
+ action: "add",
13011
+ summary: "Write a note on an account, a person or a deal, or a comment under a note",
13012
+ description: "Sends POST /v1/notes and prints the note. Name the record with one of --account, --person and --deal, or answer a note with --parent. The body is markdown, up to 20,000 characters; mention a teammate as @[Name](memberId) and they are notified. The note shows on the record's Notes tab and its Activity timeline. A note on an account needs the accounts plan feature.",
13013
+ flags: {
13014
+ ...targetFlags,
13015
+ parent: { type: "string", description: "The note to comment on (instead of a record flag)" },
13016
+ body: { type: "string", required: true, description: "The text, in markdown. - reads it from stdin" }
13017
+ },
13018
+ examples: [
13019
+ "kenso notes add --account 5 --body 'Budget approved, @[Jane Doe](41) please send the DPA'",
13020
+ "kenso notes add --parent 900 --body 'Sent it this morning'",
13021
+ "cat call-notes.md | kenso notes add --deal 77 --body -"
13022
+ ],
13023
+ beta: { featureGates: { all: ["record_notes"] } },
13024
+ operationIds: ["notes.create"],
13025
+ async run(ctx, { flags }) {
13026
+ const next = "kenso notes add --account <accountId> --body <text>";
13027
+ const record = target(flags, next, flags.parent !== void 0);
13028
+ if (flags.parent !== void 0 && Object.keys(record).length > 0) {
13029
+ throw usageError("A comment takes --parent alone: its note decides the record.", { field: "parent", next });
13030
+ }
13031
+ const parent = flags.parent === void 0 ? {} : { parentNoteId: positiveId2(flags.parent, "parent", next) };
13032
+ const body2 = await bodyText(ctx, flags.body, next);
13033
+ const res = await ctx.client.request({ method: "POST", path: "/v1/notes", body: { ...record, ...parent, body: body2 }, signal: ctx.signal });
13034
+ ctx.output.object(unwrap(res.body));
13035
+ return ExitCode.Ok;
13036
+ }
13037
+ };
13038
+ add_default = command29;
13039
+ }
13040
+ });
13041
+
13042
+ // src/commands/notes/edit.ts
13043
+ var edit_exports = {};
13044
+ __export(edit_exports, {
13045
+ default: () => edit_default
13046
+ });
13047
+ var command30, edit_default;
13048
+ var init_edit = __esm({
13049
+ "src/commands/notes/edit.ts"() {
13050
+ "use strict";
13051
+ init_errors();
13052
+ init_exit_codes();
13053
+ init_http();
13054
+ init_add();
13055
+ init_target();
13056
+ command30 = {
13057
+ resource: "notes",
13058
+ action: "edit",
13059
+ summary: "Change a note's text, or pin or unpin it",
13060
+ description: "Sends PATCH /v1/notes/{noteId} and prints the note. Only the note's author changes its text; anyone who can edit accounts pins or unpins a note (not a comment). Teammates a new text mentions for the first time are notified.",
13061
+ flags: {
13062
+ body: { type: "string", description: "The new text, in markdown. - reads it from stdin" },
13063
+ pin: { type: "boolean", description: "Pin the note to the top of the record's notes" },
13064
+ unpin: { type: "boolean", description: "Unpin the note" }
13065
+ },
13066
+ positionals: [{ name: "noteId", required: true, description: "The note or comment id" }],
13067
+ examples: ["kenso notes edit 900 --body 'Budget approved for Q1'", "kenso notes edit 900 --pin"],
13068
+ beta: { featureGates: { all: ["record_notes"] } },
13069
+ operationIds: ["notes.update"],
13070
+ async run(ctx, { flags, positionals }) {
13071
+ const next = "kenso notes edit <noteId> --body <text>";
13072
+ const id = positiveId2(positionals[0], "noteId", next);
13073
+ if (flags.pin === true && flags.unpin === true) throw usageError("Pass --pin or --unpin, not both.", { field: "pin", next });
13074
+ const patch = {};
13075
+ if (flags.body !== void 0) patch.body = await bodyText(ctx, flags.body, next);
13076
+ if (flags.pin === true || flags.unpin === true) patch.isPinned = flags.pin === true;
13077
+ if (Object.keys(patch).length === 0) throw usageError("Pass --body, --pin or --unpin.", { field: "body", next });
13078
+ const res = await ctx.client.request({ method: "PATCH", path: `/v1/notes/${id}`, body: patch, signal: ctx.signal });
13079
+ ctx.output.object(unwrap(res.body));
13080
+ return ExitCode.Ok;
13081
+ }
13082
+ };
13083
+ edit_default = command30;
13084
+ }
13085
+ });
13086
+
13087
+ // src/commands/notes/delete.ts
13088
+ var delete_exports = {};
13089
+ __export(delete_exports, {
13090
+ default: () => delete_default
13091
+ });
13092
+ var command31, delete_default;
13093
+ var init_delete = __esm({
13094
+ "src/commands/notes/delete.ts"() {
13095
+ "use strict";
13096
+ init_confirm();
13097
+ init_exit_codes();
13098
+ init_target();
13099
+ command31 = {
13100
+ resource: "notes",
13101
+ action: "delete",
13102
+ summary: "Delete a note or a comment (its author or a workspace admin)",
13103
+ description: "Sends DELETE /v1/notes/{noteId}. The note leaves the record's Notes tab and Activity timeline; `kenso notes restore <noteId>` brings it back. Needs --yes, or a yes at the prompt.",
13104
+ flags: {},
13105
+ positionals: [{ name: "noteId", required: true, description: "The note or comment id" }],
13106
+ examples: ["kenso notes delete 900 --yes"],
13107
+ beta: { featureGates: { all: ["record_notes"] } },
13108
+ operationIds: ["notes.delete"],
13109
+ async run(ctx, { positionals }) {
13110
+ const next = "kenso notes delete <noteId> --yes";
13111
+ const id = positiveId2(positionals[0], "noteId", next);
13112
+ await confirmDestructive(ctx, `This deletes note ${id}`, `kenso notes delete ${id} --yes`);
13113
+ await ctx.client.request({ method: "DELETE", path: `/v1/notes/${id}`, signal: ctx.signal });
13114
+ ctx.output.object({ id, deleted: true });
13115
+ return ExitCode.Ok;
13116
+ }
13117
+ };
13118
+ delete_default = command31;
13119
+ }
13120
+ });
13121
+
13122
+ // src/commands/notes/index.ts
13123
+ var actions17;
13124
+ var init_notes = __esm({
13125
+ "src/commands/notes/index.ts"() {
13126
+ "use strict";
13127
+ actions17 = {
13128
+ list: () => Promise.resolve().then(() => (init_list(), list_exports)).then((m) => m.default),
13129
+ add: () => Promise.resolve().then(() => (init_add(), add_exports)).then((m) => m.default),
13130
+ edit: () => Promise.resolve().then(() => (init_edit(), edit_exports)).then((m) => m.default),
13131
+ delete: () => Promise.resolve().then(() => (init_delete(), delete_exports)).then((m) => m.default)
13132
+ };
13133
+ }
13134
+ });
13135
+
13136
+ // src/commands/opportunities/move.ts
13137
+ var move_exports = {};
13138
+ __export(move_exports, {
13139
+ default: () => move_default
13140
+ });
13141
+ async function categoryOf(ctx, stage) {
13142
+ const stages = await ctx.client.request({ method: "GET", path: "/v1/opportunity-stages", signal: ctx.signal });
13143
+ const found = (unwrap(stages.body).items ?? []).find((s) => s.key === stage);
13144
+ if (found) return found.category;
13145
+ try {
13146
+ const pipelines = await ctx.client.request({ method: "GET", path: "/v1/pipelines", signal: ctx.signal });
13147
+ const all = (unwrap(pipelines.body).items ?? []).flatMap((p) => p.stages ?? []);
13148
+ return all.find((s) => s.key === stage)?.category;
13149
+ } catch (err) {
13150
+ if (err instanceof KensoError && (err.httpStatus === 403 || err.httpStatus === 404)) return void 0;
13151
+ throw err;
13152
+ }
13153
+ }
13154
+ var KEY, command32, move_default;
13155
+ var init_move = __esm({
13156
+ "src/commands/opportunities/move.ts"() {
13157
+ "use strict";
13158
+ init_errors();
13159
+ init_exit_codes();
13160
+ init_http();
13161
+ KEY = /^[a-z][a-z0-9_]{0,62}$/;
13162
+ command32 = {
13163
+ resource: "opportunities",
13164
+ action: "move",
13165
+ summary: "Move a deal to a stage, with its won or lost reason",
13166
+ description: "Sends PATCH /v1/opportunities/{opportunityId} with stage, and with --reason the reason key as wonReasonKey for a won stage or lostReasonKey for a lost stage (it reads GET /v1/opportunity-stages, and GET /v1/pipelines for a stage of another pipeline, to tell which; an open stage takes no reason). Reason keys come from kenso opportunity-reasons get. Prints the deal. A move never waits for a field the stage asks for: the deal moves, each missing field prints a warning on stderr, and the deal is flagged Missing until the field is filled (kenso opportunities list --missing-fields).",
13167
+ flags: {
13168
+ stage: { type: "string", description: "The stage key to move to (kenso opportunity-stages list lists them)" },
13169
+ reason: { type: "string", description: "A won or lost reason key (kenso opportunity-reasons get)" }
13170
+ },
13171
+ positionals: [{ name: "opportunityId", description: "The deal's id" }],
13172
+ examples: [
13173
+ "kenso opportunities move 4401 --stage proposal",
13174
+ "kenso opportunities move 4401 --stage lost --reason no_budget"
13175
+ ],
13176
+ beta: { featureGates: { all: ["opportunities"] } },
13177
+ operationIds: ["opportunities.update", "opportunity-stages.list", "pipelines.list"],
13178
+ async run(ctx, { flags, positionals }) {
13179
+ const id = (positionals[0] ?? "").trim();
13180
+ const stage = typeof flags.stage === "string" ? flags.stage.trim() : "";
13181
+ const reason = typeof flags.reason === "string" ? flags.reason.trim() : void 0;
13182
+ const next = "kenso opportunities move <opportunityId> --stage <key> [--reason <key>]";
13183
+ if (!/^[1-9]\d*$/.test(id)) throw usageError("Pass the deal's id: " + next, { field: "opportunityId", next });
13184
+ if (!KEY.test(stage)) throw usageError("Pass --stage with a stage key (kenso opportunity-stages list lists them).", { field: "stage", next });
13185
+ if (reason !== void 0 && !KEY.test(reason)) {
13186
+ throw usageError(`"${reason}" is not a reason key. Read the keys with kenso opportunity-reasons get.`, { field: "reason", next });
13187
+ }
13188
+ const body2 = { stage };
13189
+ if (reason !== void 0) {
13190
+ const category = await categoryOf(ctx, stage);
13191
+ if (category !== "won" && category !== "lost") {
13192
+ throw usageError(`Only a won or lost stage takes a reason; "${stage}" is ${category ? "an open stage" : "not a stage"}.`, {
13193
+ field: "reason",
13194
+ next
13195
+ });
13196
+ }
13197
+ body2[category === "won" ? "wonReasonKey" : "lostReasonKey"] = reason;
13198
+ }
13199
+ const res = await ctx.client.request({ method: "PATCH", path: `/v1/opportunities/${id}`, body: body2, signal: ctx.signal });
13200
+ const answer = res.body;
13201
+ for (const warning of answer?.warnings ?? []) {
13202
+ if (typeof warning?.message === "string") ctx.output.warn(warning.message);
13203
+ }
13204
+ ctx.output.object(unwrap(res.body));
13205
+ return ExitCode.Ok;
13206
+ }
13207
+ };
13208
+ move_default = command32;
13209
+ }
13210
+ });
13211
+
12923
13212
  // src/commands/opportunities/stage-history.ts
12924
13213
  var stage_history_exports = {};
12925
13214
  __export(stage_history_exports, {
12926
13215
  default: () => stage_history_default
12927
13216
  });
12928
- var command28, stage_history_default;
13217
+ var command33, stage_history_default;
12929
13218
  var init_stage_history = __esm({
12930
13219
  "src/commands/opportunities/stage-history.ts"() {
12931
13220
  "use strict";
12932
13221
  init_errors();
12933
13222
  init_exit_codes();
12934
13223
  init_http();
12935
- command28 = {
13224
+ command33 = {
12936
13225
  resource: "opportunities",
12937
13226
  action: "stage-history",
12938
13227
  summary: "Show a deal's stage history: each stage, when, who moved it and how long it sat there",
@@ -12956,16 +13245,17 @@ var init_stage_history = __esm({
12956
13245
  return ExitCode.Ok;
12957
13246
  }
12958
13247
  };
12959
- stage_history_default = command28;
13248
+ stage_history_default = command33;
12960
13249
  }
12961
13250
  });
12962
13251
 
12963
13252
  // src/commands/opportunities/index.ts
12964
- var actions17;
13253
+ var actions18;
12965
13254
  var init_opportunities = __esm({
12966
13255
  "src/commands/opportunities/index.ts"() {
12967
13256
  "use strict";
12968
- actions17 = {
13257
+ actions18 = {
13258
+ move: () => Promise.resolve().then(() => (init_move(), move_exports)).then((m) => m.default),
12969
13259
  "stage-history": () => Promise.resolve().then(() => (init_stage_history(), stage_history_exports)).then((m) => m.default)
12970
13260
  };
12971
13261
  }
@@ -13042,7 +13332,7 @@ function summarize3(results) {
13042
13332
  }
13043
13333
  return { matched, addedToAccounts, emailFindsQueued };
13044
13334
  }
13045
- var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command29, import_default3;
13335
+ var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command34, import_default3;
13046
13336
  var init_import3 = __esm({
13047
13337
  "src/commands/people/import.ts"() {
13048
13338
  "use strict";
@@ -13074,7 +13364,7 @@ var init_import3 = __esm({
13074
13364
  };
13075
13365
  PERSON_FIELDS = ["email", "fullName", "firstName", "lastName", "linkedinUrl", "title"];
13076
13366
  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.";
13077
- command29 = {
13367
+ command34 = {
13078
13368
  resource: "people",
13079
13369
  action: "import",
13080
13370
  summary: "Create or match people from a CSV or JSONL file, optionally onto accounts",
@@ -13139,16 +13429,16 @@ var init_import3 = __esm({
13139
13429
  return outcome.exitCode;
13140
13430
  }
13141
13431
  };
13142
- import_default3 = command29;
13432
+ import_default3 = command34;
13143
13433
  }
13144
13434
  });
13145
13435
 
13146
13436
  // src/commands/people/index.ts
13147
- var actions18;
13437
+ var actions19;
13148
13438
  var init_people = __esm({
13149
13439
  "src/commands/people/index.ts"() {
13150
13440
  "use strict";
13151
- actions18 = {
13441
+ actions19 = {
13152
13442
  import: () => Promise.resolve().then(() => (init_import3(), import_exports3)).then((m) => m.default)
13153
13443
  };
13154
13444
  }
@@ -13169,14 +13459,14 @@ function rule(stage) {
13169
13459
  isDefault: stage.isDefaultRequiredFields
13170
13460
  };
13171
13461
  }
13172
- var command30, stage_rules_default;
13462
+ var command35, stage_rules_default;
13173
13463
  var init_stage_rules = __esm({
13174
13464
  "src/commands/pipelines/stage-rules.ts"() {
13175
13465
  "use strict";
13176
13466
  init_errors();
13177
13467
  init_exit_codes();
13178
13468
  init_http();
13179
- command30 = {
13469
+ command35 = {
13180
13470
  resource: "pipelines",
13181
13471
  action: "stage-rules",
13182
13472
  summary: "List or set the fields a deal should have in each stage",
@@ -13229,16 +13519,16 @@ var init_stage_rules = __esm({
13229
13519
  return ExitCode.Ok;
13230
13520
  }
13231
13521
  };
13232
- stage_rules_default = command30;
13522
+ stage_rules_default = command35;
13233
13523
  }
13234
13524
  });
13235
13525
 
13236
13526
  // src/commands/pipelines/index.ts
13237
- var actions19;
13527
+ var actions20;
13238
13528
  var init_pipelines = __esm({
13239
13529
  "src/commands/pipelines/index.ts"() {
13240
13530
  "use strict";
13241
- actions19 = {
13531
+ actions20 = {
13242
13532
  "stage-rules": () => Promise.resolve().then(() => (init_stage_rules(), stage_rules_exports)).then((m) => m.default)
13243
13533
  };
13244
13534
  }
@@ -13249,7 +13539,7 @@ var run_exports2 = {};
13249
13539
  __export(run_exports2, {
13250
13540
  default: () => run_default
13251
13541
  });
13252
- var REPORTS, command31, run_default;
13542
+ var REPORTS, command36, run_default;
13253
13543
  var init_run2 = __esm({
13254
13544
  "src/commands/reports/run.ts"() {
13255
13545
  "use strict";
@@ -13257,7 +13547,7 @@ var init_run2 = __esm({
13257
13547
  init_exit_codes();
13258
13548
  init_http();
13259
13549
  REPORTS = ["pipeline_by_stage", "won_by_month", "stage_conversion", "time_in_stage", "won_by_source_campaign", "activity_by_member"];
13260
- command31 = {
13550
+ command36 = {
13261
13551
  resource: "reports",
13262
13552
  action: "run",
13263
13553
  summary: "Run a stock pipeline report and print its table",
@@ -13319,7 +13609,7 @@ var init_run2 = __esm({
13319
13609
  return ExitCode.Ok;
13320
13610
  }
13321
13611
  };
13322
- run_default = command31;
13612
+ run_default = command36;
13323
13613
  }
13324
13614
  });
13325
13615
 
@@ -13328,14 +13618,14 @@ var summary_exports = {};
13328
13618
  __export(summary_exports, {
13329
13619
  default: () => summary_default
13330
13620
  });
13331
- var command32, summary_default;
13621
+ var command37, summary_default;
13332
13622
  var init_summary = __esm({
13333
13623
  "src/commands/reports/summary.ts"() {
13334
13624
  "use strict";
13335
13625
  init_errors();
13336
13626
  init_exit_codes();
13337
13627
  init_http();
13338
- command32 = {
13628
+ command37 = {
13339
13629
  resource: "reports",
13340
13630
  action: "summary",
13341
13631
  summary: "Read where the period stands and what needs you",
@@ -13390,16 +13680,16 @@ var init_summary = __esm({
13390
13680
  return ExitCode.Ok;
13391
13681
  }
13392
13682
  };
13393
- summary_default = command32;
13683
+ summary_default = command37;
13394
13684
  }
13395
13685
  });
13396
13686
 
13397
13687
  // src/commands/reports/index.ts
13398
- var actions20;
13688
+ var actions21;
13399
13689
  var init_reports = __esm({
13400
13690
  "src/commands/reports/index.ts"() {
13401
13691
  "use strict";
13402
- actions20 = {
13692
+ actions21 = {
13403
13693
  run: () => Promise.resolve().then(() => (init_run2(), run_exports2)).then((m) => m.default),
13404
13694
  summary: () => Promise.resolve().then(() => (init_summary(), summary_exports)).then((m) => m.default)
13405
13695
  };
@@ -13407,18 +13697,18 @@ var init_reports = __esm({
13407
13697
  });
13408
13698
 
13409
13699
  // src/commands/runs/list.ts
13410
- var list_exports = {};
13411
- __export(list_exports, {
13412
- default: () => list_default
13700
+ var list_exports2 = {};
13701
+ __export(list_exports2, {
13702
+ default: () => list_default2
13413
13703
  });
13414
- var command33, list_default;
13415
- var init_list = __esm({
13704
+ var command38, list_default2;
13705
+ var init_list2 = __esm({
13416
13706
  "src/commands/runs/list.ts"() {
13417
13707
  "use strict";
13418
13708
  init_runs();
13419
13709
  init_errors();
13420
13710
  init_exit_codes();
13421
- command33 = {
13711
+ command38 = {
13422
13712
  resource: "runs",
13423
13713
  action: "list",
13424
13714
  summary: "List batch runs, newest first (finds an interrupted run)",
@@ -13439,7 +13729,7 @@ var init_list = __esm({
13439
13729
  return ExitCode.Ok;
13440
13730
  }
13441
13731
  };
13442
- list_default = command33;
13732
+ list_default2 = command38;
13443
13733
  }
13444
13734
  });
13445
13735
 
@@ -13450,7 +13740,7 @@ __export(show_exports2, {
13450
13740
  });
13451
13741
  import { existsSync as existsSync7, readFileSync as readFileSync9 } from "node:fs";
13452
13742
  import { join as join12 } from "node:path";
13453
- var FILES, command34, show_default2;
13743
+ var FILES, command39, show_default2;
13454
13744
  var init_show2 = __esm({
13455
13745
  "src/commands/runs/show.ts"() {
13456
13746
  "use strict";
@@ -13465,7 +13755,7 @@ var init_show2 = __esm({
13465
13755
  ["plan", "plan.json"],
13466
13756
  ["summary", "summary.json"]
13467
13757
  ];
13468
- command34 = {
13758
+ command39 = {
13469
13759
  resource: "runs",
13470
13760
  action: "show",
13471
13761
  summary: "Show one batch run and its files",
@@ -13492,7 +13782,7 @@ var init_show2 = __esm({
13492
13782
  return ExitCode.Ok;
13493
13783
  }
13494
13784
  };
13495
- show_default2 = command34;
13785
+ show_default2 = command39;
13496
13786
  }
13497
13787
  });
13498
13788
 
@@ -13551,14 +13841,14 @@ function resumeArgv(run, globals = {}) {
13551
13841
  async function sha256(path) {
13552
13842
  return createHash5("sha256").update(await readFile9(path)).digest("hex");
13553
13843
  }
13554
- var SKIPPED_KEYS, command35, resume_default;
13844
+ var SKIPPED_KEYS, command40, resume_default;
13555
13845
  var init_resume = __esm({
13556
13846
  "src/commands/runs/resume.ts"() {
13557
13847
  "use strict";
13558
13848
  init_runs();
13559
13849
  init_errors();
13560
13850
  SKIPPED_KEYS = /* @__PURE__ */ new Set(["positionals", "yes", "dryRun", "dry-run", "help", "version"]);
13561
- command35 = {
13851
+ command40 = {
13562
13852
  resource: "runs",
13563
13853
  action: "resume",
13564
13854
  summary: "Continue an interrupted batch run (its command with --yes, no dry run)",
@@ -13613,17 +13903,17 @@ var init_resume = __esm({
13613
13903
  }
13614
13904
  }
13615
13905
  };
13616
- resume_default = command35;
13906
+ resume_default = command40;
13617
13907
  }
13618
13908
  });
13619
13909
 
13620
13910
  // src/commands/runs/index.ts
13621
- var actions21;
13911
+ var actions22;
13622
13912
  var init_runs2 = __esm({
13623
13913
  "src/commands/runs/index.ts"() {
13624
13914
  "use strict";
13625
- actions21 = {
13626
- list: () => Promise.resolve().then(() => (init_list(), list_exports)).then((m) => m.default),
13915
+ actions22 = {
13916
+ list: () => Promise.resolve().then(() => (init_list2(), list_exports2)).then((m) => m.default),
13627
13917
  show: () => Promise.resolve().then(() => (init_show2(), show_exports2)).then((m) => m.default),
13628
13918
  resume: () => Promise.resolve().then(() => (init_resume(), resume_exports)).then((m) => m.default)
13629
13919
  };
@@ -13721,7 +14011,7 @@ var create_exports = {};
13721
14011
  __export(create_exports, {
13722
14012
  default: () => create_default
13723
14013
  });
13724
- var command36, create_default;
14014
+ var command41, create_default;
13725
14015
  var init_create = __esm({
13726
14016
  "src/commands/sandbox/create.ts"() {
13727
14017
  "use strict";
@@ -13729,7 +14019,7 @@ var init_create = __esm({
13729
14019
  init_exit_codes();
13730
14020
  init_http();
13731
14021
  init_shared();
13732
- command36 = {
14022
+ command41 = {
13733
14023
  resource: "sandbox",
13734
14024
  action: "create",
13735
14025
  summary: "Create your developer sandbox and save its test key as the sandbox profile",
@@ -13771,24 +14061,24 @@ var init_create = __esm({
13771
14061
  return ExitCode.Ok;
13772
14062
  }
13773
14063
  };
13774
- create_default = command36;
14064
+ create_default = command41;
13775
14065
  }
13776
14066
  });
13777
14067
 
13778
14068
  // src/commands/sandbox/delete.ts
13779
- var delete_exports = {};
13780
- __export(delete_exports, {
13781
- default: () => delete_default
14069
+ var delete_exports2 = {};
14070
+ __export(delete_exports2, {
14071
+ default: () => delete_default2
13782
14072
  });
13783
- var command37, delete_default;
13784
- var init_delete = __esm({
14073
+ var command42, delete_default2;
14074
+ var init_delete2 = __esm({
13785
14075
  "src/commands/sandbox/delete.ts"() {
13786
14076
  "use strict";
13787
14077
  init_config();
13788
14078
  init_confirm();
13789
14079
  init_exit_codes();
13790
14080
  init_shared();
13791
- command37 = {
14081
+ command42 = {
13792
14082
  resource: "sandbox",
13793
14083
  action: "delete",
13794
14084
  summary: "Delete your sandbox and its test keys",
@@ -13815,7 +14105,7 @@ var init_delete = __esm({
13815
14105
  return ExitCode.Ok;
13816
14106
  }
13817
14107
  };
13818
- delete_default = command37;
14108
+ delete_default2 = command42;
13819
14109
  }
13820
14110
  });
13821
14111
 
@@ -13824,14 +14114,14 @@ var key_exports = {};
13824
14114
  __export(key_exports, {
13825
14115
  default: () => key_default
13826
14116
  });
13827
- var command38, key_default;
14117
+ var command43, key_default;
13828
14118
  var init_key = __esm({
13829
14119
  "src/commands/sandbox/key.ts"() {
13830
14120
  "use strict";
13831
14121
  init_exit_codes();
13832
14122
  init_http();
13833
14123
  init_shared();
13834
- command38 = {
14124
+ command43 = {
13835
14125
  resource: "sandbox",
13836
14126
  action: "key",
13837
14127
  summary: "Create a new test key for your sandbox and save it as the sandbox profile",
@@ -13851,22 +14141,22 @@ var init_key = __esm({
13851
14141
  return ExitCode.Ok;
13852
14142
  }
13853
14143
  };
13854
- key_default = command38;
14144
+ key_default = command43;
13855
14145
  }
13856
14146
  });
13857
14147
 
13858
14148
  // src/commands/sandbox/list.ts
13859
- var list_exports2 = {};
13860
- __export(list_exports2, {
13861
- default: () => list_default2
14149
+ var list_exports3 = {};
14150
+ __export(list_exports3, {
14151
+ default: () => list_default3
13862
14152
  });
13863
- var command39, list_default2;
13864
- var init_list2 = __esm({
14153
+ var command44, list_default3;
14154
+ var init_list3 = __esm({
13865
14155
  "src/commands/sandbox/list.ts"() {
13866
14156
  "use strict";
13867
14157
  init_exit_codes();
13868
14158
  init_shared();
13869
- command39 = {
14159
+ command44 = {
13870
14160
  resource: "sandbox",
13871
14161
  action: "list",
13872
14162
  summary: "List your developer sandbox",
@@ -13882,7 +14172,7 @@ var init_list2 = __esm({
13882
14172
  return ExitCode.Ok;
13883
14173
  }
13884
14174
  };
13885
- list_default2 = command39;
14175
+ list_default3 = command44;
13886
14176
  }
13887
14177
  });
13888
14178
 
@@ -13891,14 +14181,14 @@ var reset_exports = {};
13891
14181
  __export(reset_exports, {
13892
14182
  default: () => reset_default
13893
14183
  });
13894
- var command40, reset_default;
14184
+ var command45, reset_default;
13895
14185
  var init_reset = __esm({
13896
14186
  "src/commands/sandbox/reset.ts"() {
13897
14187
  "use strict";
13898
14188
  init_exit_codes();
13899
14189
  init_http();
13900
14190
  init_shared();
13901
- command40 = {
14191
+ command45 = {
13902
14192
  resource: "sandbox",
13903
14193
  action: "reset",
13904
14194
  summary: "Reset your sandbox to its seed data",
@@ -13916,38 +14206,38 @@ var init_reset = __esm({
13916
14206
  return ExitCode.Ok;
13917
14207
  }
13918
14208
  };
13919
- reset_default = command40;
14209
+ reset_default = command45;
13920
14210
  }
13921
14211
  });
13922
14212
 
13923
14213
  // src/commands/sandbox/index.ts
13924
- var actions22;
14214
+ var actions23;
13925
14215
  var init_sandbox2 = __esm({
13926
14216
  "src/commands/sandbox/index.ts"() {
13927
14217
  "use strict";
13928
- actions22 = {
14218
+ actions23 = {
13929
14219
  create: () => Promise.resolve().then(() => (init_create(), create_exports)).then((m) => m.default),
13930
- delete: () => Promise.resolve().then(() => (init_delete(), delete_exports)).then((m) => m.default),
14220
+ delete: () => Promise.resolve().then(() => (init_delete2(), delete_exports2)).then((m) => m.default),
13931
14221
  key: () => Promise.resolve().then(() => (init_key(), key_exports)).then((m) => m.default),
13932
- list: () => Promise.resolve().then(() => (init_list2(), list_exports2)).then((m) => m.default),
14222
+ list: () => Promise.resolve().then(() => (init_list3(), list_exports3)).then((m) => m.default),
13933
14223
  reset: () => Promise.resolve().then(() => (init_reset(), reset_exports)).then((m) => m.default)
13934
14224
  };
13935
14225
  }
13936
14226
  });
13937
14227
 
13938
14228
  // src/commands/skill/index.ts
13939
- var actions23;
14229
+ var actions24;
13940
14230
  var init_skill = __esm({
13941
14231
  "src/commands/skill/index.ts"() {
13942
14232
  "use strict";
13943
- actions23 = {
14233
+ actions24 = {
13944
14234
  install: () => Promise.resolve().then(() => (init_install(), install_exports)).then((m) => m.default)
13945
14235
  };
13946
14236
  }
13947
14237
  });
13948
14238
 
13949
14239
  // src/commands/studio/common.ts
13950
- function positiveId2(value, field) {
14240
+ function positiveId3(value, field) {
13951
14241
  const text4 = (value ?? "").trim();
13952
14242
  const id = /^\d+$/.test(text4) ? Number(text4) : Number.NaN;
13953
14243
  if (!Number.isSafeInteger(id) || id < 1) throw usageError(`${field} must be a positive whole number (got "${text4}").`, { field });
@@ -14013,8 +14303,8 @@ async function readFolder(dir) {
14013
14303
  function safeJoin(root2, bundlePath) {
14014
14304
  const segments = bundlePath.split("/");
14015
14305
  const bad = bundlePath === "" || isAbsolute(bundlePath) || /^[A-Za-z]:/.test(bundlePath) || bundlePath.includes("\\") || bundlePath.includes("\0") || segments.some((s) => s === "" || s === "." || s === "..");
14016
- const target = resolve10(root2, ...segments);
14017
- if (bad || !target.startsWith(root2.endsWith(sep) ? root2 : root2 + sep)) {
14306
+ const target2 = resolve10(root2, ...segments);
14307
+ if (bad || !target2.startsWith(root2.endsWith(sep) ? root2 : root2 + sep)) {
14018
14308
  throw new KensoError({
14019
14309
  code: "unsafe_path",
14020
14310
  message: `Refusing to write "${bundlePath}": it is not a plain relative path inside ${root2}.`,
@@ -14022,7 +14312,7 @@ function safeJoin(root2, bundlePath) {
14022
14312
  hint: "The template holds a file path the CLI will not write. Nothing was written."
14023
14313
  });
14024
14314
  }
14025
- return target;
14315
+ return target2;
14026
14316
  }
14027
14317
  function contentTypeOf(path) {
14028
14318
  return CONTENT_TYPES2[extname5(path).toLowerCase()] ?? "application/octet-stream";
@@ -14115,13 +14405,13 @@ async function upload(ctx, templateId, file) {
14115
14405
  body: { path: file.path, contentType: contentTypeOf(file.path), bytes: file.bytes.length },
14116
14406
  signal: ctx.signal
14117
14407
  });
14118
- const target = unwrap(res.body);
14119
- if (!target?.uploadId || !target.url) {
14408
+ const target2 = unwrap(res.body);
14409
+ if (!target2?.uploadId || !target2.url) {
14120
14410
  throw new KensoError({ code: "upload_failed", message: `No upload URL came back for ${file.path}.`, exitCode: ExitCode.Server });
14121
14411
  }
14122
- const method = typeof target.method === "string" && target.method.trim() !== "" ? target.method.toUpperCase() : "PUT";
14123
- await presigned(target.url, { method, headers: target.headers ?? {}, body: new Uint8Array(file.bytes) }, `Uploading ${file.path}`, "upload_failed", ctx.signal);
14124
- return target.uploadId;
14412
+ const method = typeof target2.method === "string" && target2.method.trim() !== "" ? target2.method.toUpperCase() : "PUT";
14413
+ await presigned(target2.url, { method, headers: target2.headers ?? {}, body: new Uint8Array(file.bytes) }, `Uploading ${file.path}`, "upload_failed", ctx.signal);
14414
+ return target2.uploadId;
14125
14415
  }
14126
14416
  function refuseOversize(files) {
14127
14417
  const tooBig = files.filter((f) => f.text === void 0 && f.bytes.length > UPLOAD_MAX_BYTES);
@@ -14176,7 +14466,7 @@ __export(pull_exports, {
14176
14466
  });
14177
14467
  import { mkdir, writeFile as writeFile4 } from "node:fs/promises";
14178
14468
  import { dirname as dirname2, resolve as resolve11 } from "node:path";
14179
- var command41, pull_default;
14469
+ var command46, pull_default;
14180
14470
  var init_pull = __esm({
14181
14471
  "src/commands/studio/pull.ts"() {
14182
14472
  "use strict";
@@ -14186,7 +14476,7 @@ var init_pull = __esm({
14186
14476
  init_common2();
14187
14477
  init_folder();
14188
14478
  init_transfer2();
14189
- command41 = {
14479
+ command46 = {
14190
14480
  resource: "studio",
14191
14481
  action: "pull",
14192
14482
  summary: "Write a template version's files to a folder",
@@ -14201,7 +14491,7 @@ var init_pull = __esm({
14201
14491
  operationIds: ["asset-templates.pull"],
14202
14492
  dryRun: true,
14203
14493
  async run(ctx, { flags, positionals }) {
14204
- const templateId = positiveId2(positionals[0], "templateId");
14494
+ const templateId = positiveId3(positionals[0], "templateId");
14205
14495
  const version = typeof flags["template-version"] === "string" ? flags["template-version"].trim() : void 0;
14206
14496
  if (version !== void 0 && !/^(draft|latest|\d+)$/.test(version)) {
14207
14497
  throw usageError(`--template-version must be draft, latest or a version id (got "${version}").`, { field: "template-version" });
@@ -14224,16 +14514,16 @@ var init_pull = __esm({
14224
14514
  return ExitCode.Ok;
14225
14515
  }
14226
14516
  await mkdir(dir, { recursive: true });
14227
- await mapLimit(files, PARALLEL_TRANSFERS, async ({ path, file, target }) => {
14517
+ await mapLimit(files, PARALLEL_TRANSFERS, async ({ path, file, target: target2 }) => {
14228
14518
  const content = typeof file.text === "string" ? file.text : await download2(file.downloadUrl, path, file.sha256, ctx.signal);
14229
- await mkdir(dirname2(target), { recursive: true });
14230
- await writeFile4(target, content);
14519
+ await mkdir(dirname2(target2), { recursive: true });
14520
+ await writeFile4(target2, content);
14231
14521
  });
14232
14522
  ctx.output.object({ templateId, versionId: pulled.versionId, files: files.length, dir });
14233
14523
  return ExitCode.Ok;
14234
14524
  }
14235
14525
  };
14236
- pull_default = command41;
14526
+ pull_default = command46;
14237
14527
  }
14238
14528
  });
14239
14529
 
@@ -14266,7 +14556,7 @@ var push_exports = {};
14266
14556
  __export(push_exports, {
14267
14557
  default: () => push_default
14268
14558
  });
14269
- var BUILT_BY, DEFAULT_MESSAGE, command42, push_default;
14559
+ var BUILT_BY, DEFAULT_MESSAGE, command47, push_default;
14270
14560
  var init_push = __esm({
14271
14561
  "src/commands/studio/push.ts"() {
14272
14562
  "use strict";
@@ -14278,7 +14568,7 @@ var init_push = __esm({
14278
14568
  init_read();
14279
14569
  BUILT_BY = "customer_agent";
14280
14570
  DEFAULT_MESSAGE = "Pushed with the Kenso CLI";
14281
- command42 = {
14571
+ command47 = {
14282
14572
  resource: "studio",
14283
14573
  action: "push",
14284
14574
  summary: "Save a folder's files to a template's draft and print the validation",
@@ -14296,7 +14586,7 @@ var init_push = __esm({
14296
14586
  dryRun: true,
14297
14587
  async run(ctx, args) {
14298
14588
  const { flags, positionals } = args;
14299
- const templateId = positiveId2(positionals[0], "templateId");
14589
+ const templateId = positiveId3(positionals[0], "templateId");
14300
14590
  const message = typeof flags.message === "string" && flags.message.trim() !== "" ? flags.message : DEFAULT_MESSAGE;
14301
14591
  if (ctx.flags.dryRun) {
14302
14592
  const local = await readLocalTemplate(templateId, String(flags.dir));
@@ -14370,7 +14660,7 @@ var init_push = __esm({
14370
14660
  );
14371
14661
  }
14372
14662
  };
14373
- push_default = command42;
14663
+ push_default = command47;
14374
14664
  }
14375
14665
  });
14376
14666
 
@@ -14379,7 +14669,7 @@ var validate_exports = {};
14379
14669
  __export(validate_exports, {
14380
14670
  default: () => validate_default
14381
14671
  });
14382
- var command43, validate_default;
14672
+ var command48, validate_default;
14383
14673
  var init_validate = __esm({
14384
14674
  "src/commands/studio/validate.ts"() {
14385
14675
  "use strict";
@@ -14388,7 +14678,7 @@ var init_validate = __esm({
14388
14678
  init_columns();
14389
14679
  init_common2();
14390
14680
  init_read();
14391
- command43 = {
14681
+ command48 = {
14392
14682
  resource: "studio",
14393
14683
  action: "validate",
14394
14684
  summary: "Validate a folder's files against a template without saving them",
@@ -14403,7 +14693,7 @@ var init_validate = __esm({
14403
14693
  operationIds: ["asset-templates.create-upload-url", "asset-templates.validate"],
14404
14694
  async run(ctx, args) {
14405
14695
  const { flags, positionals } = args;
14406
- const templateId = positiveId2(positionals[0], "templateId");
14696
+ const templateId = positiveId3(positionals[0], "templateId");
14407
14697
  const files = await readTemplateFolder(ctx, templateId, String(flags.dir));
14408
14698
  const res = await ctx.client.request({
14409
14699
  method: "POST",
@@ -14417,7 +14707,7 @@ var init_validate = __esm({
14417
14707
  throw validationFailed(validation, "The files have validation errors", commandLine2(ctx, "studio validate", args));
14418
14708
  }
14419
14709
  };
14420
- validate_default = command43;
14710
+ validate_default = command48;
14421
14711
  }
14422
14712
  });
14423
14713
 
@@ -14466,7 +14756,7 @@ function accountIds(value) {
14466
14756
  }
14467
14757
  return ids2.map(Number);
14468
14758
  }
14469
- var SHOWN, command44, preview_default;
14759
+ var SHOWN, command49, preview_default;
14470
14760
  var init_preview = __esm({
14471
14761
  "src/commands/studio/preview.ts"() {
14472
14762
  "use strict";
@@ -14478,7 +14768,7 @@ var init_preview = __esm({
14478
14768
  init_common2();
14479
14769
  init_folder();
14480
14770
  SHOWN = 5;
14481
- command44 = {
14771
+ command49 = {
14482
14772
  resource: "studio",
14483
14773
  action: "preview",
14484
14774
  summary: "Render a saved version for up to 3 accounts; for local edits, studio push them to the draft first",
@@ -14498,9 +14788,9 @@ var init_preview = __esm({
14498
14788
  operationIds: ["asset-templates.preview", "asset-templates.pull"],
14499
14789
  async run(ctx, args) {
14500
14790
  const { flags, positionals } = args;
14501
- const templateId = positiveId2(positionals[0], "templateId");
14791
+ const templateId = positiveId3(positionals[0], "templateId");
14502
14792
  const versionText = stringFlag(flags["version-id"]);
14503
- const versionId = versionText !== void 0 ? positiveId2(versionText, "version-id") : void 0;
14793
+ const versionId = versionText !== void 0 ? positiveId3(versionText, "version-id") : void 0;
14504
14794
  const ids2 = accountIds(stringFlag(flags["account-ids"]));
14505
14795
  const interact = flags.interact !== void 0 ? await readDataArg(String(flags.interact), ctx.stdin) : void 0;
14506
14796
  if (interact !== void 0 && !Array.isArray(interact)) throw usageError("--interact must be a JSON array of steps.", { field: "interact" });
@@ -14527,7 +14817,7 @@ var init_preview = __esm({
14527
14817
  return ExitCode.Ok;
14528
14818
  }
14529
14819
  };
14530
- preview_default = command44;
14820
+ preview_default = command49;
14531
14821
  }
14532
14822
  });
14533
14823
 
@@ -14668,35 +14958,35 @@ async function readTarget(ctx, flags) {
14668
14958
  flag,
14669
14959
  items: [...firstRow].map(([id, row]) => ({ id, row })),
14670
14960
  duplicates: raw.length - firstRow.size,
14671
- ...campaign !== void 0 ? { campaignId: positiveId2(campaign, "campaign") } : {},
14961
+ ...campaign !== void 0 ? { campaignId: positiveId3(campaign, "campaign") } : {},
14672
14962
  input: source === "-" ? { path: "-", sha256: sha2562(raw.join("\n")) } : { path: resolve12(source), sha256: sha2562(await readFile11(resolve12(source))) }
14673
14963
  };
14674
14964
  }
14675
- async function refuseRefill(ctx, args, target) {
14965
+ async function refuseRefill(ctx, args, target2) {
14676
14966
  const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
14677
14967
  const sameFill = (a) => argsIdentity({ ...a, wait: void 0 });
14678
14968
  const earlier = (await listRuns(ctx.env)).find(
14679
- (run) => run.command === COMMAND6 && run.status !== "planned" && run.inputSha256 === target.input.sha256 && (run.workspaceId || void 0) === (workspaceId || void 0) && sameFill(run.args) === sameFill(args)
14969
+ (run) => run.command === COMMAND6 && run.status !== "planned" && run.inputSha256 === target2.input.sha256 && (run.workspaceId || void 0) === (workspaceId || void 0) && sameFill(run.args) === sameFill(args)
14680
14970
  );
14681
14971
  if (!earlier) return;
14682
14972
  const unfinished = earlier.status !== "done";
14683
- const succeeded = !unfinished && await allSucceeded(earlier, target.items.length);
14973
+ const succeeded = !unfinished && await allSucceeded(earlier, target2.items.length);
14684
14974
  if (argsIdentity(earlier.args) === argsIdentity(args) && (unfinished || succeeded)) return;
14685
- const ids2 = target.flag === "accounts" ? "accounts" : "leads";
14975
+ const ids2 = target2.flag === "accounts" ? "accounts" : "leads";
14686
14976
  throw new KensoError({
14687
14977
  code: "already_filled",
14688
14978
  exitCode: ExitCode.Conflict,
14689
14979
  message: unfinished ? `Run ${earlier.runId} is already filling these ${ids2} (${earlier.status}).` : `Run ${earlier.runId} already filled these ${ids2}.`,
14690
- hint: unfinished ? "Continue that run instead: a new fill would create every fill run again." : succeeded ? "Every page was filled. Filling again rebuilds and charges every page that is not building or live; to do that anyway, use kenso asset-runs create." : `Filling again rebuilds and charges every page that is not building or live. To retry only the failed ones, put the ${target.key} values of the failed rows in ${join14(earlier.dir, "results.csv")} in a file and fill that file.`,
14980
+ hint: unfinished ? "Continue that run instead: a new fill would create every fill run again." : succeeded ? "Every page was filled. Filling again rebuilds and charges every page that is not building or live; to do that anyway, use kenso asset-runs create." : `Filling again rebuilds and charges every page that is not building or live. To retry only the failed ones, put the ${target2.key} values of the failed rows in ${join14(earlier.dir, "results.csv")} in a file and fill that file.`,
14691
14981
  next: unfinished ? `kenso runs resume ${earlier.runId}` : `kenso runs show ${earlier.runId}`
14692
14982
  });
14693
14983
  }
14694
- async function fillChunk(ctx, templateId, target, wait3, chunk, chunkCtx) {
14984
+ async function fillChunk(ctx, templateId, target2, wait3, chunk, chunkCtx) {
14695
14985
  const ids2 = chunk.map((item) => item.id);
14696
- const body2 = target.campaignId !== void 0 ? { templateId, campaignId: target.campaignId, contactIds: ids2 } : { templateId, accountIds: ids2 };
14986
+ const body2 = target2.campaignId !== void 0 ? { templateId, campaignId: target2.campaignId, contactIds: ids2 } : { templateId, accountIds: ids2 };
14697
14987
  const res = await chunkCtx.client.request({ method: "POST", path: "/v1/asset-runs", body: body2, signal: chunkCtx.signal });
14698
14988
  let run = unwrap(res.body) ?? {};
14699
- ctx.output.info(`Run ${run.id} started for ${ids2.length} ${target.flag} (${run.state ?? "queued"}).`);
14989
+ ctx.output.info(`Run ${run.id} started for ${ids2.length} ${target2.flag} (${run.state ?? "queued"}).`);
14700
14990
  if (wait3 && run.id !== void 0) {
14701
14991
  const created = run;
14702
14992
  try {
@@ -14715,20 +15005,20 @@ async function fillChunk(ctx, templateId, target, wait3, chunk, chunkCtx) {
14715
15005
  }
14716
15006
  }
14717
15007
  }
14718
- return { results: runResults(chunk, run, target.key) };
15008
+ return { results: runResults(chunk, run, target2.key) };
14719
15009
  }
14720
- function estimateOutput(templateId, target, estimate2) {
15010
+ function estimateOutput(templateId, target2, estimate2) {
14721
15011
  return {
14722
15012
  templateId,
14723
- ...target.campaignId !== void 0 ? { campaignId: target.campaignId } : {},
14724
- [target.flag]: target.items.length,
14725
- ...target.duplicates > 0 ? { duplicates: target.duplicates } : {},
14726
- runs: Math.ceil(target.items.length / RUN_SIZE),
15013
+ ...target2.campaignId !== void 0 ? { campaignId: target2.campaignId } : {},
15014
+ [target2.flag]: target2.items.length,
15015
+ ...target2.duplicates > 0 ? { duplicates: target2.duplicates } : {},
15016
+ runs: Math.ceil(target2.items.length / RUN_SIZE),
14727
15017
  estimate: estimate2,
14728
- ...target.campaignId !== void 0 ? { estimateNote: "An upper bound: it counts one page per lead, and a campaign run builds one page per company." } : {}
15018
+ ...target2.campaignId !== void 0 ? { estimateNote: "An upper bound: it counts one page per lead, and a campaign run builds one page per company." } : {}
14729
15019
  };
14730
15020
  }
14731
- var COMMAND6, sha2562, command45, fill_default;
15021
+ var COMMAND6, sha2562, command50, fill_default;
14732
15022
  var init_fill = __esm({
14733
15023
  "src/commands/studio/fill.ts"() {
14734
15024
  "use strict";
@@ -14744,7 +15034,7 @@ var init_fill = __esm({
14744
15034
  init_fill_runs();
14745
15035
  COMMAND6 = "studio fill";
14746
15036
  sha2562 = (data) => createHash8("sha256").update(data).digest("hex");
14747
- command45 = {
15037
+ command50 = {
14748
15038
  resource: "studio",
14749
15039
  action: "fill",
14750
15040
  summary: "Fill a template on many accounts or campaign leads (estimate first)",
@@ -14769,15 +15059,15 @@ var init_fill = __esm({
14769
15059
  dryRun: true,
14770
15060
  async run(ctx, args) {
14771
15061
  const { flags, positionals } = args;
14772
- const templateId = positiveId2(positionals[0], "templateId");
15062
+ const templateId = positiveId3(positionals[0], "templateId");
14773
15063
  if (flags.estimate === true && ctx.flags.yes === true) throw usageError("Pick one of --estimate and --yes.", { field: "estimate" });
14774
- const target = await readTarget(ctx, flags);
15064
+ const target2 = await readTarget(ctx, flags);
14775
15065
  const batchArgs = { ...flags, positionals };
14776
- if (ctx.flags.yes === true) await refuseRefill(ctx, batchArgs, target);
14777
- const estimate2 = await estimateFill(ctx, templateId, target.items.length);
15066
+ if (ctx.flags.yes === true) await refuseRefill(ctx, batchArgs, target2);
15067
+ const estimate2 = await estimateFill(ctx, templateId, target2.items.length);
14778
15068
  if (ctx.flags.yes !== true) {
14779
15069
  const next = commandLine2(ctx, COMMAND6, { flags: { ...flags, estimate: void 0 }, positionals }, ["--yes"]);
14780
- ctx.output.object({ ...estimateOutput(templateId, target, estimate2), next });
15070
+ ctx.output.object({ ...estimateOutput(templateId, target2, estimate2), next });
14781
15071
  return ExitCode.Ok;
14782
15072
  }
14783
15073
  const wait3 = flags.wait === true;
@@ -14785,16 +15075,16 @@ var init_fill = __esm({
14785
15075
  {
14786
15076
  command: COMMAND6,
14787
15077
  args: batchArgs,
14788
- input: target.input,
14789
- items: target.items,
15078
+ input: target2.input,
15079
+ items: target2.items,
14790
15080
  rowOf: (item) => item.row,
14791
15081
  chunkSize: RUN_SIZE,
14792
15082
  concurrency: 1,
14793
- execChunk: (chunk, chunkCtx) => fillChunk(ctx, templateId, target, wait3, chunk, chunkCtx),
15083
+ execChunk: (chunk, chunkCtx) => fillChunk(ctx, templateId, target2, wait3, chunk, chunkCtx),
14794
15084
  summarize: (results) => ({
14795
15085
  templateId,
14796
- ...target.campaignId !== void 0 ? { campaignId: target.campaignId } : {},
14797
- ...target.duplicates > 0 ? { duplicates: target.duplicates } : {},
15086
+ ...target2.campaignId !== void 0 ? { campaignId: target2.campaignId } : {},
15087
+ ...target2.duplicates > 0 ? { duplicates: target2.duplicates } : {},
14798
15088
  estimatedMillicredits: estimate2.millicredits,
14799
15089
  runs: runsOf(results)
14800
15090
  })
@@ -14804,16 +15094,16 @@ var init_fill = __esm({
14804
15094
  return outcome.exitCode;
14805
15095
  }
14806
15096
  };
14807
- fill_default = command45;
15097
+ fill_default = command50;
14808
15098
  }
14809
15099
  });
14810
15100
 
14811
15101
  // src/commands/studio/index.ts
14812
- var actions24;
15102
+ var actions25;
14813
15103
  var init_studio2 = __esm({
14814
15104
  "src/commands/studio/index.ts"() {
14815
15105
  "use strict";
14816
- actions24 = {
15106
+ actions25 = {
14817
15107
  pull: () => Promise.resolve().then(() => (init_pull(), pull_exports)).then((m) => m.default),
14818
15108
  push: () => Promise.resolve().then(() => (init_push(), push_exports)).then((m) => m.default),
14819
15109
  validate: () => Promise.resolve().then(() => (init_validate(), validate_exports)).then((m) => m.default),
@@ -14824,7 +15114,7 @@ var init_studio2 = __esm({
14824
15114
  });
14825
15115
 
14826
15116
  // src/commands/tasks/shared.ts
14827
- function positiveId3(text4, field, next) {
15117
+ function positiveId4(text4, field, next) {
14828
15118
  const value = (text4 ?? "").trim();
14829
15119
  const id = /^\d+$/.test(value) ? Number(value) : Number.NaN;
14830
15120
  if (!Number.isSafeInteger(id) || id < 1) throw usageError(`${field} must be a positive whole number (got "${value}").`, { field, next });
@@ -14884,7 +15174,7 @@ async function memberId(ctx, text4, field, next) {
14884
15174
  next: "kenso members list"
14885
15175
  });
14886
15176
  }
14887
- return positiveId3(value, field, next);
15177
+ return positiveId4(value, field, next);
14888
15178
  }
14889
15179
  var WEEKDAYS, DUE_NEXT, startOfDay, addDays, ymd;
14890
15180
  var init_shared2 = __esm({
@@ -14902,12 +15192,12 @@ var init_shared2 = __esm({
14902
15192
  });
14903
15193
 
14904
15194
  // src/commands/tasks/add.ts
14905
- var add_exports = {};
14906
- __export(add_exports, {
14907
- default: () => add_default
15195
+ var add_exports2 = {};
15196
+ __export(add_exports2, {
15197
+ default: () => add_default2
14908
15198
  });
14909
- var NEXT, command46, add_default;
14910
- var init_add = __esm({
15199
+ var NEXT, command51, add_default2;
15200
+ var init_add2 = __esm({
14911
15201
  "src/commands/tasks/add.ts"() {
14912
15202
  "use strict";
14913
15203
  init_errors();
@@ -14915,7 +15205,7 @@ var init_add = __esm({
14915
15205
  init_http();
14916
15206
  init_shared2();
14917
15207
  NEXT = 'kenso tasks add "Send the deck" --due tomorrow --account 812';
14918
- command46 = {
15208
+ command51 = {
14919
15209
  resource: "tasks",
14920
15210
  action: "add",
14921
15211
  summary: "Add a task: a title, an optional due day and time, assignee and the account, person or deal it is about",
@@ -14942,15 +15232,15 @@ var init_add = __esm({
14942
15232
  if (typeof flags.notes === "string") body2.notes = flags.notes;
14943
15233
  Object.assign(body2, due(typeof flags.due === "string" ? flags.due : void 0, typeof flags.at === "string" ? flags.at : void 0));
14944
15234
  if (typeof flags.assignee === "string") body2.assigneeMemberId = await memberId(ctx, flags.assignee, "assignee", NEXT);
14945
- if (typeof flags.account === "string") body2.accountId = positiveId3(flags.account, "account", NEXT);
14946
- if (typeof flags.person === "string") body2.personId = positiveId3(flags.person, "person", NEXT);
14947
- if (typeof flags.deal === "string") body2.opportunityId = positiveId3(flags.deal, "deal", NEXT);
15235
+ if (typeof flags.account === "string") body2.accountId = positiveId4(flags.account, "account", NEXT);
15236
+ if (typeof flags.person === "string") body2.personId = positiveId4(flags.person, "person", NEXT);
15237
+ if (typeof flags.deal === "string") body2.opportunityId = positiveId4(flags.deal, "deal", NEXT);
14948
15238
  const res = await ctx.client.request({ method: "POST", path: "/v1/tasks", body: body2, signal: ctx.signal });
14949
15239
  ctx.output.object(unwrap(res.body));
14950
15240
  return ExitCode.Ok;
14951
15241
  }
14952
15242
  };
14953
- add_default = command46;
15243
+ add_default2 = command51;
14954
15244
  }
14955
15245
  });
14956
15246
 
@@ -14969,7 +15259,7 @@ async function patchTask(ctx, taskId, change) {
14969
15259
  return unwrap((await send2()).body);
14970
15260
  }
14971
15261
  }
14972
- var command47, done_default;
15262
+ var command52, done_default;
14973
15263
  var init_done = __esm({
14974
15264
  "src/commands/tasks/done.ts"() {
14975
15265
  "use strict";
@@ -14977,7 +15267,7 @@ var init_done = __esm({
14977
15267
  init_exit_codes();
14978
15268
  init_http();
14979
15269
  init_shared2();
14980
- command47 = {
15270
+ command52 = {
14981
15271
  resource: "tasks",
14982
15272
  action: "done",
14983
15273
  summary: "Complete one or more tasks (--undo reopens them)",
@@ -14988,7 +15278,7 @@ var init_done = __esm({
14988
15278
  beta: { featureGates: { all: ["tasks"] } },
14989
15279
  operationIds: ["tasks.update"],
14990
15280
  async run(ctx, { flags, positionals }) {
14991
- const ids2 = [...new Set(positionals.map((text4) => positiveId3(text4, "taskId", "kenso tasks done <taskId>...")))];
15281
+ const ids2 = [...new Set(positionals.map((text4) => positiveId4(text4, "taskId", "kenso tasks done <taskId>...")))];
14992
15282
  const change = { status: flags.undo === true ? "open" : "done" };
14993
15283
  if (ids2.length === 1) ctx.output.object(await patchTask(ctx, ids2[0], change));
14994
15284
  else
@@ -15000,7 +15290,7 @@ var init_done = __esm({
15000
15290
  return ExitCode.Ok;
15001
15291
  }
15002
15292
  };
15003
- done_default = command47;
15293
+ done_default = command52;
15004
15294
  }
15005
15295
  });
15006
15296
 
@@ -15009,7 +15299,7 @@ var assign_exports = {};
15009
15299
  __export(assign_exports, {
15010
15300
  default: () => assign_default
15011
15301
  });
15012
- var NEXT2, command48, assign_default;
15302
+ var NEXT2, command53, assign_default;
15013
15303
  var init_assign = __esm({
15014
15304
  "src/commands/tasks/assign.ts"() {
15015
15305
  "use strict";
@@ -15017,7 +15307,7 @@ var init_assign = __esm({
15017
15307
  init_done();
15018
15308
  init_shared2();
15019
15309
  NEXT2 = "kenso tasks assign <taskId> <me|memberId|email>";
15020
- command48 = {
15310
+ command53 = {
15021
15311
  resource: "tasks",
15022
15312
  action: "assign",
15023
15313
  summary: "Give a task to a member",
@@ -15031,13 +15321,13 @@ var init_assign = __esm({
15031
15321
  beta: { featureGates: { all: ["tasks"] } },
15032
15322
  operationIds: ["tasks.update", "me.get", "members.list"],
15033
15323
  async run(ctx, { positionals }) {
15034
- const taskId = positiveId3(positionals[0], "taskId", NEXT2);
15324
+ const taskId = positiveId4(positionals[0], "taskId", NEXT2);
15035
15325
  const assignee = await memberId(ctx, positionals[1] ?? "", "member", NEXT2);
15036
15326
  ctx.output.object(await patchTask(ctx, taskId, { assigneeMemberId: assignee }));
15037
15327
  return ExitCode.Ok;
15038
15328
  }
15039
15329
  };
15040
- assign_default = command48;
15330
+ assign_default = command53;
15041
15331
  }
15042
15332
  });
15043
15333
 
@@ -15046,14 +15336,14 @@ var queue_exports = {};
15046
15336
  __export(queue_exports, {
15047
15337
  default: () => queue_default
15048
15338
  });
15049
- var SCOPES, command49, queue_default;
15339
+ var SCOPES, command54, queue_default;
15050
15340
  var init_queue = __esm({
15051
15341
  "src/commands/tasks/queue.ts"() {
15052
15342
  "use strict";
15053
15343
  init_errors();
15054
15344
  init_exit_codes();
15055
15345
  SCOPES = ["mine", "assigned_by_me", "everyone"];
15056
- command49 = {
15346
+ command54 = {
15057
15347
  resource: "tasks",
15058
15348
  action: "queue",
15059
15349
  summary: "Your open work by due day: tasks, touches, call tasks, reply reminders and Ken follow-ups",
@@ -15074,17 +15364,17 @@ var init_queue = __esm({
15074
15364
  return ExitCode.Ok;
15075
15365
  }
15076
15366
  };
15077
- queue_default = command49;
15367
+ queue_default = command54;
15078
15368
  }
15079
15369
  });
15080
15370
 
15081
15371
  // src/commands/tasks/index.ts
15082
- var actions25;
15372
+ var actions26;
15083
15373
  var init_tasks = __esm({
15084
15374
  "src/commands/tasks/index.ts"() {
15085
15375
  "use strict";
15086
- actions25 = {
15087
- add: () => Promise.resolve().then(() => (init_add(), add_exports)).then((m) => m.default),
15376
+ actions26 = {
15377
+ add: () => Promise.resolve().then(() => (init_add2(), add_exports2)).then((m) => m.default),
15088
15378
  done: () => Promise.resolve().then(() => (init_done(), done_exports)).then((m) => m.default),
15089
15379
  assign: () => Promise.resolve().then(() => (init_assign(), assign_exports)).then((m) => m.default),
15090
15380
  queue: () => Promise.resolve().then(() => (init_queue(), queue_exports)).then((m) => m.default)
@@ -15224,7 +15514,7 @@ function readBody(req) {
15224
15514
  function reply(res, status, body2) {
15225
15515
  res.writeHead(status, { "content-type": "application/json" }).end(JSON.stringify(body2));
15226
15516
  }
15227
- var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command50, listen_default;
15517
+ var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command55, listen_default;
15228
15518
  var init_listen = __esm({
15229
15519
  "src/commands/webhooks/listen.ts"() {
15230
15520
  "use strict";
@@ -15235,7 +15525,7 @@ var init_listen = __esm({
15235
15525
  MIN_POLL_MS = 1e3;
15236
15526
  MAX_POLL_MS = 6e4;
15237
15527
  MAX_TRIGGER_BYTES = 1e6;
15238
- command50 = {
15528
+ command55 = {
15239
15529
  resource: "webhooks",
15240
15530
  action: "listen",
15241
15531
  summary: "Stream the workspace's events and forward them, signed, to a local handler",
@@ -15261,17 +15551,17 @@ var init_listen = __esm({
15261
15551
  `);
15262
15552
  return ExitCode.Ok;
15263
15553
  }
15264
- const target = typeof flags["forward-to"] === "string" ? forwardUrl(flags["forward-to"]) : void 0;
15554
+ const target2 = typeof flags["forward-to"] === "string" ? forwardUrl(flags["forward-to"]) : void 0;
15265
15555
  const types = eventTypes(flags.events);
15266
15556
  const workspaceId = ctx.auth.workspaceId;
15267
15557
  if (ctx.flags.dryRun) {
15268
- const next = ["kenso webhooks listen", target ? `--forward-to ${target}` : "", types.length > 0 ? `--events ${types.join(",")}` : ""];
15269
- ctx.output.object({ dryRun: true, forwardTo: target ?? null, events: types.length > 0 ? types : "all", secretFile: signingSecretPath(ctx.env), next: next.filter((p) => p).join(" ") });
15558
+ const next = ["kenso webhooks listen", target2 ? `--forward-to ${target2}` : "", types.length > 0 ? `--events ${types.join(",")}` : ""];
15559
+ ctx.output.object({ dryRun: true, forwardTo: target2 ?? null, events: types.length > 0 ? types : "all", secretFile: signingSecretPath(ctx.env), next: next.filter((p) => p).join(" ") });
15270
15560
  return ExitCode.Ok;
15271
15561
  }
15272
15562
  const counts2 = { events: 0, forwarded: 0, failed: 0 };
15273
15563
  const deliver = async (event) => {
15274
- const result = target ? await forward(target, event, secret, ctx.signal) : void 0;
15564
+ const result = target2 ? await forward(target2, event, secret, ctx.signal) : void 0;
15275
15565
  counts2.events++;
15276
15566
  if (result?.status !== void 0 && result.status < 300) counts2.forwarded++;
15277
15567
  else if (result) counts2.failed++;
@@ -15307,9 +15597,9 @@ var init_listen = __esm({
15307
15597
  });
15308
15598
  await new Promise((resolve16) => server.listen(0, "127.0.0.1", resolve16));
15309
15599
  const url = `http://127.0.0.1:${server.address().port}/events`;
15310
- writeListenerState(ctx.env, workspaceId, { pid: process.pid, url, token, forwardTo: target, startedAt: (/* @__PURE__ */ new Date()).toISOString() });
15600
+ writeListenerState(ctx.env, workspaceId, { pid: process.pid, url, token, forwardTo: target2, startedAt: (/* @__PURE__ */ new Date()).toISOString() });
15311
15601
  try {
15312
- ctx.output.info(`Ready. ${target ? `Forwarding events to ${target}.` : "Printing events (add --forward-to to send them to your handler)."}`);
15602
+ ctx.output.info(`Ready. ${target2 ? `Forwarding events to ${target2}.` : "Printing events (add --forward-to to send them to your handler)."}`);
15313
15603
  ctx.output.info(`Signing secret: ${secret} (the same on every run; kept in ${signingSecretPath(ctx.env)}).`);
15314
15604
  ctx.output.info(`Send a sample: kenso webhooks trigger reply.received. Stop with Ctrl-C.`);
15315
15605
  while (!ctx.signal.aborted) {
@@ -15341,7 +15631,7 @@ var init_listen = __esm({
15341
15631
  return ExitCode.Ok;
15342
15632
  }
15343
15633
  };
15344
- listen_default = command50;
15634
+ listen_default = command55;
15345
15635
  }
15346
15636
  });
15347
15637
 
@@ -15360,7 +15650,7 @@ function notRunning() {
15360
15650
  next: LISTEN_NEXT
15361
15651
  });
15362
15652
  }
15363
- var LISTEN_NEXT, command51, trigger_default;
15653
+ var LISTEN_NEXT, command56, trigger_default;
15364
15654
  var init_trigger = __esm({
15365
15655
  "src/commands/webhooks/trigger.ts"() {
15366
15656
  "use strict";
@@ -15369,7 +15659,7 @@ var init_trigger = __esm({
15369
15659
  init_http();
15370
15660
  init_local();
15371
15661
  LISTEN_NEXT = "kenso webhooks listen --forward-to http://localhost:3000/hook";
15372
- command51 = {
15662
+ command56 = {
15373
15663
  resource: "webhooks",
15374
15664
  action: "trigger",
15375
15665
  summary: "Send a sample event of one type through the running kenso webhooks listen",
@@ -15426,16 +15716,16 @@ var init_trigger = __esm({
15426
15716
  return ExitCode.Ok;
15427
15717
  }
15428
15718
  };
15429
- trigger_default = command51;
15719
+ trigger_default = command56;
15430
15720
  }
15431
15721
  });
15432
15722
 
15433
15723
  // src/commands/webhooks/index.ts
15434
- var actions26;
15724
+ var actions27;
15435
15725
  var init_webhooks2 = __esm({
15436
15726
  "src/commands/webhooks/index.ts"() {
15437
15727
  "use strict";
15438
- actions26 = {
15728
+ actions27 = {
15439
15729
  listen: () => Promise.resolve().then(() => (init_listen(), listen_exports)).then((m) => m.default),
15440
15730
  trigger: () => Promise.resolve().then(() => (init_trigger(), trigger_exports)).then((m) => m.default)
15441
15731
  };
@@ -15630,14 +15920,14 @@ var status_exports3 = {};
15630
15920
  __export(status_exports3, {
15631
15921
  default: () => status_default3
15632
15922
  });
15633
- var command52, status_default3;
15923
+ var command57, status_default3;
15634
15924
  var init_status3 = __esm({
15635
15925
  "src/commands/work/status.ts"() {
15636
15926
  "use strict";
15637
15927
  init_exit_codes();
15638
15928
  init_http();
15639
15929
  init_common3();
15640
- command52 = {
15930
+ command57 = {
15641
15931
  resource: "work",
15642
15932
  action: "status",
15643
15933
  summary: "Show the Kenso AI work waiting for your own agent, per kind",
@@ -15671,7 +15961,7 @@ var init_status3 = __esm({
15671
15961
  return ExitCode.Ok;
15672
15962
  }
15673
15963
  };
15674
- status_default3 = command52;
15964
+ status_default3 = command57;
15675
15965
  }
15676
15966
  });
15677
15967
 
@@ -15803,9 +16093,9 @@ var init_files = __esm({
15803
16093
  import { execFile, spawnSync as spawnSync2 } from "node:child_process";
15804
16094
  import { readFileSync as readFileSync12 } from "node:fs";
15805
16095
  import { isAbsolute as isAbsolute2 } from "node:path";
15806
- function sudoArgs(user, command60, args, keep = [], set = {}) {
16096
+ function sudoArgs(user, command65, args, keep = [], set = {}) {
15807
16097
  const assignments = Object.entries(set).map(([name, value]) => `${name}=${value}`);
15808
- return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command60, ...args];
16098
+ return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command65, ...args];
15809
16099
  }
15810
16100
  function agentKensoEnv(opts) {
15811
16101
  return {
@@ -15815,12 +16105,12 @@ function agentKensoEnv(opts) {
15815
16105
  AI_AGENT: opts.agentName
15816
16106
  };
15817
16107
  }
15818
- function sudoExec(user, command60, args, opts = {}) {
16108
+ function sudoExec(user, command65, args, opts = {}) {
15819
16109
  const [sudo = "/usr/bin/sudo", ...lead] = user.sudo;
15820
16110
  return new Promise((resolve16) => {
15821
16111
  execFile(
15822
16112
  sudo,
15823
- [...lead, ...sudoArgs(user.name, command60, args)],
16113
+ [...lead, ...sudoArgs(user.name, command65, args)],
15824
16114
  { env: { PATH: SUDO_PATH }, cwd: "/", timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS, maxBuffer: opts.maxBuffer ?? 1024 * 1024, encoding: "utf8", windowsHide: true, shell: false },
15825
16115
  (err, stdout, stderr) => {
15826
16116
  const code = err ? err.code : 0;
@@ -15930,9 +16220,9 @@ var init_folder2 = __esm({
15930
16220
  init_redact();
15931
16221
  init_agent_user();
15932
16222
  WorkRunFolder = class {
15933
- constructor(ctx, command60, args, outDir, shared = false) {
16223
+ constructor(ctx, command65, args, outDir, shared = false) {
15934
16224
  this.ctx = ctx;
15935
- this.command = command60;
16225
+ this.command = command65;
15936
16226
  this.args = args;
15937
16227
  this.outDir = outDir;
15938
16228
  this.shared = shared;
@@ -16047,7 +16337,7 @@ var pull_exports2 = {};
16047
16337
  __export(pull_exports2, {
16048
16338
  default: () => pull_default2
16049
16339
  });
16050
- var MAX_FILES, command53, pull_default2;
16340
+ var MAX_FILES, command58, pull_default2;
16051
16341
  var init_pull2 = __esm({
16052
16342
  "src/commands/work/pull.ts"() {
16053
16343
  "use strict";
@@ -16056,7 +16346,7 @@ var init_pull2 = __esm({
16056
16346
  init_common3();
16057
16347
  init_folder2();
16058
16348
  MAX_FILES = 100;
16059
- command53 = {
16349
+ command58 = {
16060
16350
  resource: "work",
16061
16351
  action: "pull",
16062
16352
  summary: "Claim waiting work into local work files, to answer by hand",
@@ -16134,7 +16424,7 @@ var init_pull2 = __esm({
16134
16424
  return interrupted7 ? ExitCode.Interrupted : ExitCode.Ok;
16135
16425
  }
16136
16426
  };
16137
- pull_default2 = command53;
16427
+ pull_default2 = command58;
16138
16428
  }
16139
16429
  });
16140
16430
 
@@ -16276,7 +16566,7 @@ __export(submit_exports, {
16276
16566
  default: () => submit_default
16277
16567
  });
16278
16568
  import { resolve as resolve14 } from "node:path";
16279
- var command54, submit_default;
16569
+ var command59, submit_default;
16280
16570
  var init_submit = __esm({
16281
16571
  "src/commands/work/submit.ts"() {
16282
16572
  "use strict";
@@ -16285,7 +16575,7 @@ var init_submit = __esm({
16285
16575
  init_files();
16286
16576
  init_answers();
16287
16577
  init_common3();
16288
- command54 = {
16578
+ command59 = {
16289
16579
  resource: "work",
16290
16580
  action: "submit",
16291
16581
  summary: "Send answers files to Kenso and write each one's results",
@@ -16317,7 +16607,7 @@ var init_submit = __esm({
16317
16607
  return totals.rejected > 0 ? ExitCode.Partial : ExitCode.Ok;
16318
16608
  }
16319
16609
  };
16320
- submit_default = command54;
16610
+ submit_default = command59;
16321
16611
  }
16322
16612
  });
16323
16613
 
@@ -16338,7 +16628,7 @@ function claimIdOf(arg) {
16338
16628
  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..." });
16339
16629
  return arg;
16340
16630
  }
16341
- var CLAIM_ID, command55, release_default;
16631
+ var CLAIM_ID, command60, release_default;
16342
16632
  var init_release = __esm({
16343
16633
  "src/commands/work/release.ts"() {
16344
16634
  "use strict";
@@ -16347,7 +16637,7 @@ var init_release = __esm({
16347
16637
  init_files();
16348
16638
  init_common3();
16349
16639
  CLAIM_ID = /^[A-Za-z0-9_-]{1,64}$/;
16350
- command55 = {
16640
+ command60 = {
16351
16641
  resource: "work",
16352
16642
  action: "release",
16353
16643
  summary: "Give claimed work back to the queue now",
@@ -16366,7 +16656,7 @@ var init_release = __esm({
16366
16656
  return ExitCode.Ok;
16367
16657
  }
16368
16658
  };
16369
- release_default = command55;
16659
+ release_default = command60;
16370
16660
  }
16371
16661
  });
16372
16662
 
@@ -16705,12 +16995,12 @@ function plain(text4) {
16705
16995
  return text4.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
16706
16996
  }
16707
16997
  function runStatus(bin, args, env, adapter, runAs) {
16708
- const command60 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
16998
+ const command65 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
16709
16999
  const commandArgs2 = runAs ? [...runAs.sudo.slice(1), ...sudoArgs(runAs.name, bin, args)] : args;
16710
17000
  const options = runAs ? { env: { PATH: SUDO_PATH }, cwd: "/" } : { env: childEnv(env, adapter) };
16711
17001
  return new Promise((resolve16) => {
16712
17002
  execFile2(
16713
- command60,
17003
+ command65,
16714
17004
  commandArgs2,
16715
17005
  { ...options, timeout: STATUS_TIMEOUT_MS, maxBuffer: 1024 * 1024, windowsHide: true, shell: false },
16716
17006
  (err, stdout, stderr) => {
@@ -17792,7 +18082,7 @@ var run_exports3 = {};
17792
18082
  __export(run_exports3, {
17793
18083
  default: () => run_default2
17794
18084
  });
17795
- var FAILURES_IN_A_ROW, command56, run_default2;
18085
+ var FAILURES_IN_A_ROW, command61, run_default2;
17796
18086
  var init_run3 = __esm({
17797
18087
  "src/commands/work/run.ts"() {
17798
18088
  "use strict";
@@ -17813,7 +18103,7 @@ var init_run3 = __esm({
17813
18103
  init_folder2();
17814
18104
  init_stop();
17815
18105
  FAILURES_IN_A_ROW = 3;
17816
- command56 = {
18106
+ command61 = {
17817
18107
  resource: "work",
17818
18108
  action: "run",
17819
18109
  summary: "Run your own coding agent on the waiting work until the queue is empty",
@@ -18138,16 +18428,16 @@ var init_run3 = __esm({
18138
18428
  return exitCodeFor(reason, totals.rejected > 0 || jobsFailed > 0);
18139
18429
  }
18140
18430
  };
18141
- run_default2 = command56;
18431
+ run_default2 = command61;
18142
18432
  }
18143
18433
  });
18144
18434
 
18145
18435
  // src/commands/work/index.ts
18146
- var actions27;
18436
+ var actions28;
18147
18437
  var init_work2 = __esm({
18148
18438
  "src/commands/work/index.ts"() {
18149
18439
  "use strict";
18150
- actions27 = {
18440
+ actions28 = {
18151
18441
  status: () => Promise.resolve().then(() => (init_status3(), status_exports3)).then((m) => m.default),
18152
18442
  pull: () => Promise.resolve().then(() => (init_pull2(), pull_exports2)).then((m) => m.default),
18153
18443
  submit: () => Promise.resolve().then(() => (init_submit(), submit_exports)).then((m) => m.default),
@@ -18178,7 +18468,7 @@ function rewrap(err, overrides) {
18178
18468
  details: err.details
18179
18469
  });
18180
18470
  }
18181
- var TEMPLATES, APP_NEXT_STEP, NOT_AVAILABLE, command57, keys_default;
18471
+ var TEMPLATES, APP_NEXT_STEP, NOT_AVAILABLE, command62, keys_default;
18182
18472
  var init_keys = __esm({
18183
18473
  "src/commands/workspace/keys.ts"() {
18184
18474
  "use strict";
@@ -18188,7 +18478,7 @@ var init_keys = __esm({
18188
18478
  TEMPLATES = ["admin", "editor", "viewer"];
18189
18479
  APP_NEXT_STEP = "A workspace admin can create it in the app: Settings > API keys > Workspace keys";
18190
18480
  NOT_AVAILABLE = "Workspace keys are not available for this workspace yet.";
18191
- command57 = {
18481
+ command62 = {
18192
18482
  resource: "workspace",
18193
18483
  action: "keys",
18194
18484
  summary: "Create an API key the workspace owns",
@@ -18249,14 +18539,14 @@ var init_keys = __esm({
18249
18539
  return ExitCode.Ok;
18250
18540
  }
18251
18541
  };
18252
- keys_default = command57;
18542
+ keys_default = command62;
18253
18543
  }
18254
18544
  });
18255
18545
 
18256
18546
  // src/commands/workspace/list.ts
18257
- var list_exports3 = {};
18258
- __export(list_exports3, {
18259
- default: () => list_default3
18547
+ var list_exports4 = {};
18548
+ __export(list_exports4, {
18549
+ default: () => list_default4
18260
18550
  });
18261
18551
  function parseLimit(value) {
18262
18552
  if (value === void 0) return void 0;
@@ -18267,14 +18557,14 @@ function parseLimit(value) {
18267
18557
  }
18268
18558
  return limit;
18269
18559
  }
18270
- var MAX_LIMIT, command58, list_default3;
18271
- var init_list3 = __esm({
18560
+ var MAX_LIMIT, command63, list_default4;
18561
+ var init_list4 = __esm({
18272
18562
  "src/commands/workspace/list.ts"() {
18273
18563
  "use strict";
18274
18564
  init_errors();
18275
18565
  init_exit_codes();
18276
18566
  MAX_LIMIT = 200;
18277
- command58 = {
18567
+ command63 = {
18278
18568
  resource: "workspace",
18279
18569
  action: "list",
18280
18570
  summary: "List the workspaces your key can use",
@@ -18302,7 +18592,7 @@ var init_list3 = __esm({
18302
18592
  return ExitCode.Ok;
18303
18593
  }
18304
18594
  };
18305
- list_default3 = command58;
18595
+ list_default4 = command63;
18306
18596
  }
18307
18597
  });
18308
18598
 
@@ -18311,7 +18601,7 @@ var use_exports = {};
18311
18601
  __export(use_exports, {
18312
18602
  default: () => use_default
18313
18603
  });
18314
- var command59, use_default;
18604
+ var command64, use_default;
18315
18605
  var init_use = __esm({
18316
18606
  "src/commands/workspace/use.ts"() {
18317
18607
  "use strict";
@@ -18319,7 +18609,7 @@ var init_use = __esm({
18319
18609
  init_errors();
18320
18610
  init_exit_codes();
18321
18611
  init_http();
18322
- command59 = {
18612
+ command64 = {
18323
18613
  resource: "workspace",
18324
18614
  action: "use",
18325
18615
  summary: "Set the profile's default workspace",
@@ -18376,18 +18666,18 @@ var init_use = __esm({
18376
18666
  return ExitCode.Ok;
18377
18667
  }
18378
18668
  };
18379
- use_default = command59;
18669
+ use_default = command64;
18380
18670
  }
18381
18671
  });
18382
18672
 
18383
18673
  // src/commands/workspace/index.ts
18384
- var actions28;
18674
+ var actions29;
18385
18675
  var init_workspace = __esm({
18386
18676
  "src/commands/workspace/index.ts"() {
18387
18677
  "use strict";
18388
- actions28 = {
18678
+ actions29 = {
18389
18679
  keys: () => Promise.resolve().then(() => (init_keys(), keys_exports)).then((m) => m.default),
18390
- list: () => Promise.resolve().then(() => (init_list3(), list_exports3)).then((m) => m.default),
18680
+ list: () => Promise.resolve().then(() => (init_list4(), list_exports4)).then((m) => m.default),
18391
18681
  use: () => Promise.resolve().then(() => (init_use(), use_exports)).then((m) => m.default)
18392
18682
  };
18393
18683
  }
@@ -18422,6 +18712,7 @@ var init_registry = __esm({
18422
18712
  init_jobs2();
18423
18713
  init_logs();
18424
18714
  init_mcp();
18715
+ init_notes();
18425
18716
  init_opportunities();
18426
18717
  init_people();
18427
18718
  init_pipelines();
@@ -18453,19 +18744,20 @@ var init_registry = __esm({
18453
18744
  logout: topLevel("logout", actions4.logout, "kenso auth logout"),
18454
18745
  logs: actions15,
18455
18746
  mcp: actions16,
18456
- opportunities: actions17,
18457
- people: actions18,
18458
- pipelines: actions19,
18459
- reports: actions20,
18460
- runs: actions21,
18461
- sandbox: actions22,
18462
- skill: actions23,
18463
- studio: actions24,
18464
- tasks: actions25,
18465
- webhooks: actions26,
18747
+ notes: actions17,
18748
+ opportunities: actions18,
18749
+ people: actions19,
18750
+ pipelines: actions20,
18751
+ reports: actions21,
18752
+ runs: actions22,
18753
+ sandbox: actions23,
18754
+ skill: actions24,
18755
+ studio: actions25,
18756
+ tasks: actions26,
18757
+ webhooks: actions27,
18466
18758
  whoami: topLevel("whoami", actions4.status, "kenso auth status"),
18467
- work: actions27,
18468
- workspace: actions28
18759
+ work: actions28,
18760
+ workspace: actions29
18469
18761
  };
18470
18762
  resourceAliases = { leads: "contacts" };
18471
18763
  }
@@ -18602,8 +18894,8 @@ async function renderTopHelp(opts) {
18602
18894
  names.push(withPositionals(spec, spec.action));
18603
18895
  groups.set(hint, names);
18604
18896
  }
18605
- const actions30 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
18606
- if (actions30.length > 0) rows.push([resource, actions30.join(", ")]);
18897
+ const actions31 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
18898
+ if (actions31.length > 0) rows.push([resource, actions31.join(", ")]);
18607
18899
  }
18608
18900
  const at = 4 + Math.min(22, Math.max(0, ...rows.map(([left]) => left.length)));
18609
18901
  lines.push(
@@ -18616,7 +18908,7 @@ async function renderTopHelp(opts) {
18616
18908
  const [area = "", action = ""] = name.split(" ");
18617
18909
  byArea.set(area, [...byArea.get(area) ?? [], action]);
18618
18910
  }
18619
- const named = [...byArea.entries()].map(([area, actions30]) => `${area} ${actions30.join("|")}`);
18911
+ const named = [...byArea.entries()].map(([area, actions31]) => `${area} ${actions31.join("|")}`);
18620
18912
  lines.push(wrap(`Beta, hidden here but they run (the server decides): ${named.join(", ")}.`, " "));
18621
18913
  }
18622
18914
  const generated = await listGenerated({ features: opts.allCommands ? [] : getFeatures, env: opts.env });
@@ -18624,13 +18916,13 @@ async function renderTopHelp(opts) {
18624
18916
  if (visible.length > 0) {
18625
18917
  const byResource = /* @__PURE__ */ new Map();
18626
18918
  for (const g of visible) {
18627
- const actions30 = byResource.get(g.resource) ?? [];
18628
- actions30.push(`${g.action}${g.beta ? " (beta)" : ""}`);
18629
- byResource.set(g.resource, actions30);
18919
+ const actions31 = byResource.get(g.resource) ?? [];
18920
+ actions31.push(`${g.action}${g.beta ? " (beta)" : ""}`);
18921
+ byResource.set(g.resource, actions31);
18630
18922
  }
18631
18923
  const sorted2 = [...byResource.entries()].sort(([a], [b]) => a.localeCompare(b));
18632
18924
  if (opts.allCommands) {
18633
- const generatedRows = sorted2.map(([resource, actions30]) => [resource, actions30.sort().join(", ")]);
18925
+ const generatedRows = sorted2.map(([resource, actions31]) => [resource, actions31.sort().join(", ")]);
18634
18926
  lines.push("", "API resources (kenso <resource> <action>):", columns(generatedRows));
18635
18927
  } else {
18636
18928
  const names = new Set(sorted2.map(([resource]) => resource));
@@ -18946,8 +19238,8 @@ function startUpdateNotice(argv, opts = {}) {
18946
19238
  if (!found) return;
18947
19239
  writeCheck(file, { checkedAt: new Date(now).toISOString(), latest: found });
18948
19240
  if (isNewer(found, version)) {
18949
- const command60 = updateCommand(install, opts.platform ?? process.platform);
18950
- stderr.write(`kenso ${found} is out (you have ${version}): ${command60}
19241
+ const command65 = updateCommand(install, opts.platform ?? process.platform);
19242
+ stderr.write(`kenso ${found} is out (you have ${version}): ${command65}
18951
19243
  Turn this off with KENSO_NO_UPDATE_NOTIFIER=1.
18952
19244
  `);
18953
19245
  }
@@ -18989,7 +19281,7 @@ function resources() {
18989
19281
  const names = Object.entries(handWritten).filter(([, area]) => Object.keys(area).length > 0).map(([resource]) => resource);
18990
19282
  return sorted([...names, ...Object.keys(resourceAliases), ...loadManifest().operations.map((op) => op.resource)]);
18991
19283
  }
18992
- function actions29(resource) {
19284
+ function actions30(resource) {
18993
19285
  const own = Object.keys(handWritten[resource] ?? {}).filter((action) => action !== "");
18994
19286
  return sorted([...own, ...loadManifest().operations.filter((op) => op.resource === resource).map((op) => op.action)]);
18995
19287
  }
@@ -19054,7 +19346,7 @@ async function completions(words, globals) {
19054
19346
  return flagsOf2(spec, globals, positionals.length === 0);
19055
19347
  }
19056
19348
  if (positionals.length === 0) return resources();
19057
- if (!spec) return positionals.length === 1 ? actions29(resourceAliases[positionals[0]] ?? positionals[0]) : [];
19349
+ if (!spec) return positionals.length === 1 ? actions30(resourceAliases[positionals[0]] ?? positionals[0]) : [];
19058
19350
  const given = positionals.length - commandWords;
19059
19351
  const declared = spec.positionals ?? [];
19060
19352
  if (given < declared.length || declared.at(-1)?.variadic === true) {
@@ -19148,9 +19440,9 @@ function normalizeBooleans(argv, names, strict) {
19148
19440
  async function knownCommands() {
19149
19441
  const commands = /* @__PURE__ */ new Set();
19150
19442
  for (const [resource, area] of Object.entries(handWritten)) {
19151
- const actions30 = Object.keys(area);
19152
- if (actions30.length > 0) commands.add(resource);
19153
- for (const action of actions30) commands.add(action ? `${resource} ${action}` : resource);
19443
+ const actions31 = Object.keys(area);
19444
+ if (actions31.length > 0) commands.add(resource);
19445
+ for (const action of actions31) commands.add(action ? `${resource} ${action}` : resource);
19154
19446
  }
19155
19447
  for (const g of await listGenerated({ features: [] })) {
19156
19448
  commands.add(g.resource);