kenso 0.1.65 → 0.1.69

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
@@ -2421,7 +2421,7 @@ var VERSION;
2421
2421
  var init_version = __esm({
2422
2422
  "src/core/version.ts"() {
2423
2423
  "use strict";
2424
- VERSION = true ? "0.1.65" : "0.0.0-dev";
2424
+ VERSION = true ? "0.1.69" : "0.0.0-dev";
2425
2425
  }
2426
2426
  });
2427
2427
 
@@ -3714,9 +3714,9 @@ async function readRunDir(dir) {
3714
3714
  return null;
3715
3715
  }
3716
3716
  if (!raw) return null;
3717
- const { runId, command: command42, createdAt, status } = raw;
3717
+ const { runId, command: command48, createdAt, status } = raw;
3718
3718
  if (typeof runId !== "string" || !RUN_ID_PATTERN.test(runId)) return null;
3719
- if (typeof command42 !== "string" || typeof createdAt !== "string") return null;
3719
+ if (typeof command48 !== "string" || typeof createdAt !== "string") return null;
3720
3720
  if (typeof status !== "string" || !STATUSES.includes(status)) return null;
3721
3721
  let chunksDone = chunkList(raw.chunksDone) ?? [];
3722
3722
  try {
@@ -3727,7 +3727,7 @@ async function readRunDir(dir) {
3727
3727
  const record = {
3728
3728
  ...raw,
3729
3729
  runId,
3730
- command: command42,
3730
+ command: command48,
3731
3731
  args: asRecord3(raw.args) ?? {},
3732
3732
  createdAt,
3733
3733
  status,
@@ -3782,11 +3782,11 @@ async function loadRun(runId, env = process.env) {
3782
3782
  }
3783
3783
  return run;
3784
3784
  }
3785
- async function findIdentical(command42, args, inputSha256, env, workspaceId, anyWorkspace = false) {
3785
+ async function findIdentical(command48, args, inputSha256, env, workspaceId, anyWorkspace = false) {
3786
3786
  const identity = argsIdentity(args);
3787
3787
  const runs = await listRuns(env);
3788
3788
  return runs.filter(
3789
- (run) => run.command === command42 && (run.inputSha256 || void 0) === (inputSha256 || void 0) && (anyWorkspace || (run.workspaceId || void 0) === (workspaceId || void 0)) && argsIdentity(run.args) === identity
3789
+ (run) => run.command === command48 && (run.inputSha256 || void 0) === (inputSha256 || void 0) && (anyWorkspace || (run.workspaceId || void 0) === (workspaceId || void 0)) && argsIdentity(run.args) === identity
3790
3790
  );
3791
3791
  }
3792
3792
  function isOtherLiveProcess(pid) {
@@ -6938,8 +6938,8 @@ function idValue(value, field) {
6938
6938
  function shellQuote3(arg) {
6939
6939
  return /^[A-Za-z0-9_./:=@%+,-]+$/.test(arg) ? arg : `'${arg.replace(/'/g, `'\\''`)}'`;
6940
6940
  }
6941
- function commandLine2(ctx, command42, args, extra = []) {
6942
- const parts2 = ["kenso", ...command42.split(" "), ...(args.positionals ?? []).map(shellQuote3)];
6941
+ function commandLine2(ctx, command48, args, extra = []) {
6942
+ const parts2 = ["kenso", ...command48.split(" "), ...(args.positionals ?? []).map(shellQuote3)];
6943
6943
  for (const [name, value] of Object.entries(args.flags)) {
6944
6944
  if (value === void 0 || value === false) continue;
6945
6945
  if (value === true) parts2.push(`--${name}`);
@@ -7263,7 +7263,7 @@ var init_batch = __esm({
7263
7263
  var crm_default;
7264
7264
  var init_crm = __esm({
7265
7265
  "docs/crm.md"() {
7266
- 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| `crm-connections`, `crm-imports`, `crm-sync-issues` | Read and run CRM sync. Connecting a CRM stays in the app |\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\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## 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';
7266
+ 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| `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 |\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| `crm-connections`, `crm-imports`, `crm-sync-issues` | Read and run CRM sync. Connecting a CRM stays in the app |\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\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## 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';
7267
7267
  }
7268
7268
  });
7269
7269
 
@@ -7311,7 +7311,7 @@ var init_studio = __esm({
7311
7311
  var webhooks_default;
7312
7312
  var init_webhooks = __esm({
7313
7313
  "docs/webhooks.md"() {
7314
- webhooks_default = '# Webhooks: listen and trigger\n\nBuild and test a webhook handler on your own machine, with no public tunnel and no webhook endpoint in Kenso. `kenso webhooks listen` streams your workspace\'s events, prints each one as JSON and forwards it to your handler, signed the way Kenso signs its deliveries. `kenso webhooks trigger` sends a sample event through the running listener.\n\n| Command | What it does |\n|---|---|\n| `webhooks listen --forward-to <url>` | Streams events, prints one JSON line each, and POSTs each to your handler |\n| `webhooks listen --print-secret` | Prints the local signing secret and exits |\n| `webhooks trigger <event-type>` | Sends that type\'s sample through the running listener |\n\n## Quick start\n\nIn one terminal:\n\n```bash\nkenso webhooks listen --forward-to http://localhost:3000/hook\n```\n\nIt prints its signing secret on stderr:\n\n```\nReady. Forwarding events to http://localhost:3000/hook.\nSigning secret: whsec_... (the same on every run; kept in ~/.kenso/webhooks/signing-secret).\n```\n\nPut that secret in your handler\'s config (for example `KENSO_WEBHOOK_SECRET`). In another terminal:\n\n```bash\nkenso webhooks trigger reply.received\n```\n\nThe listener prints the event and your handler receives it. `kenso webhook-event-types list` lists every type with its sample body.\n\n## What your handler receives\n\nEach forward is a `POST` with a JSON body shaped like a webhook delivery (no envelope, `eventType` at the top) and the headers a Kenso delivery carries. How full the body is depends on where the event came from:\n\n- **A trigger** sends the type\'s full sample body, the same shape a webhook endpoint receives in production.\n- **A live event** is sparse. The event log keeps only part of each delivery, so the body has `eventType`, `eventId`, `timestamp` and `clientId`, plus the ids, statuses and `links` at their delivery paths (`contact.id`, `campaign.id`, `reply.classification`, ...). Names, emails, reply text and the other fields are not there: read them with the API, or build that part of the handler against a trigger\'s sample.\n\nThe headers:\n\n| Header | Value |\n|---|---|\n| `svix-id` | The event\'s id. Dedupe on it |\n| `svix-timestamp` | Unix seconds of the send |\n| `svix-signature` | `v1,` and the base64 HMAC-SHA256 of `{svix-id}.{svix-timestamp}.{body}`, keyed by the secret |\n| `content-type` | `application/json` |\n\nSo the verification code you write for production works unchanged: the Svix libraries (`svix` for Node, Python, Go and others) and the check in the Webhooks section of the Kenso API docs accept these deliveries. Only the secret differs. The listener\'s secret is local: it is made on your machine the first time you run `listen`, stays the same on every run, and is never a real endpoint\'s secret. In production, use your endpoint\'s secret from `kenso webhook-endpoints get-signing-secret --webhook-endpoint-id <webhookEndpointId>`.\n\nFor scripts, take the secret without starting a listener:\n\n```bash\nexport KENSO_WEBHOOK_SECRET=$(kenso webhooks listen --print-secret)\n```\n\n## Output\n\nstdout gets one JSON line per event, for `jq` or an agent:\n\n```json\n{"eventId":"0b6f...","type":"reply.received","timestamp":"2026-11-15T10:00:00Z","source":"live","forward":{"url":"http://localhost:3000/hook","status":200,"ms":12},"data":{"eventType":"reply.received","...":"..."}}\n```\n\n- `source` is `live` for a real event and `trigger` for a sample.\n- `forward` is what your handler answered: `status`, or `error` (`ECONNREFUSED` when nothing listens there). It is absent without `--forward-to`.\n- `data` is the body your handler received (or would receive, without `--forward-to`).\n\nThe ready line, the secret and the summary at Ctrl-C go to stderr.\n\n## Live events\n\n`listen` reads the workspace\'s event log (`GET /v1/event-occurrences`), so it receives the types with `mcp: true` in `kenso webhook-event-types list` that your seat can see. It polls the log, so a real event arrives within about 30 s; a trigger arrives at once. `--events reply.received,meeting.booked` (or `--events` repeated) narrows the types.\n\nThe event log is not on for every workspace yet. Where it is off, `listen` says so in a warning and still forwards everything you trigger, so you can build the handler first.\n\n## Triggers\n\n`trigger` takes the type\'s sample from `GET /v1/webhook-event-types`, gives it a new `eventId` (`evt_test_...`) and the current `timestamp`, and hands it to the listener for this workspace, which prints and forwards it like a live event. It sends nothing to Kenso\'s event log, to your webhook endpoints or to anyone else. It exits 1 with `forward_failed` when your handler did not answer 2xx, and with `listener_not_running` when no listener runs for the workspace.\n\nTo send a sample to a real, deployed endpoint instead, use `kenso webhook-endpoints test --webhook-endpoint-id <webhookEndpointId> --event-type reply.received`.\n\n## Stopping\n\nCtrl-C stops the listener. `listen` creates no webhook endpoint, no event subscription and no tunnel, so there is nothing to delete in Kenso. Its polls do keep the workspace\'s event log recording: the log stops on its own 7 days after the last poll. A poll that fails (a network error, a 5xx) prints a warning and is tried again a minute later; a bad key or a refused request ends the listener. It removes its local state file (the address `trigger` uses) on the way out.\n';
7314
+ webhooks_default = '# Webhooks: listen and trigger\n\nBuild and test a webhook handler on your own machine, with no public tunnel and no webhook endpoint in Kenso. `kenso webhooks listen` streams your workspace\'s events, prints each one as JSON and forwards it to your handler, signed the way Kenso signs its deliveries. `kenso webhooks trigger` sends a sample event through the running listener.\n\n| Command | What it does |\n|---|---|\n| `webhooks listen --forward-to <url>` | Streams events, prints one JSON line each, and POSTs each to your handler |\n| `webhooks listen --print-secret` | Prints the local signing secret and exits |\n| `webhooks trigger <event-type>` | Sends that type\'s sample through the running listener |\n\n## Quick start\n\nIn one terminal:\n\n```bash\nkenso webhooks listen --forward-to http://localhost:3000/hook\n```\n\nIt prints its signing secret on stderr:\n\n```\nReady. Forwarding events to http://localhost:3000/hook.\nSigning secret: whsec_... (the same on every run; kept in ~/.kenso/webhooks/signing-secret).\n```\n\nPut that secret in your handler\'s config (for example `KENSO_WEBHOOK_SECRET`). In another terminal:\n\n```bash\nkenso webhooks trigger reply.received\n```\n\nThe listener prints the event and your handler receives it. `kenso webhook-event-types list` lists every type with its sample body.\n\n## What your handler receives\n\nEach forward is a `POST` with a JSON body shaped like a webhook delivery (no envelope, `eventType` at the top) and the headers a Kenso delivery carries. How full the body is depends on where the event came from:\n\n- **A trigger** sends the type\'s full sample body, the same shape a webhook endpoint receives in production.\n- **A live event** is sparse. The event log keeps only part of each delivery, so the body has `eventType`, `eventId`, `timestamp` and `clientId`, plus the ids, statuses and `links` at their delivery paths (`contact.id`, `campaign.id`, `reply.classification`, ...). Names, emails, reply text and the other fields are not there: read them with the API, or build that part of the handler against a trigger\'s sample.\n\nThe headers:\n\n| Header | Value |\n|---|---|\n| `svix-id` | The event\'s id. Dedupe on it |\n| `svix-timestamp` | Unix seconds of the send |\n| `svix-signature` | `v1,` and the base64 HMAC-SHA256 of `{svix-id}.{svix-timestamp}.{body}`, keyed by the secret |\n| `content-type` | `application/json` |\n\nSo the verification code you write for production works unchanged: the Svix libraries (`svix` for Node, Python, Go and others) and the check in the Webhooks section of the Kenso API docs accept these deliveries. Only the secret differs. The listener\'s secret is local: it is made on your machine the first time you run `listen`, stays the same on every run, and is never a real endpoint\'s secret. In production, use your endpoint\'s secret from `kenso webhook-endpoints get-signing-secret --webhook-endpoint-id <webhookEndpointId>`.\n\nFor scripts, take the secret without starting a listener:\n\n```bash\nexport KENSO_WEBHOOK_SECRET=$(kenso webhooks listen --print-secret)\n```\n\n## Output\n\nstdout gets one JSON line per event, for `jq` or an agent:\n\n```json\n{"eventId":"0b6f...","type":"reply.received","timestamp":"2026-11-15T10:00:00Z","source":"live","forward":{"url":"http://localhost:3000/hook","status":200,"ms":12},"data":{"eventType":"reply.received","...":"..."}}\n```\n\n- `source` is `live` for a real event and `trigger` for a sample.\n- `forward` is what your handler answered: `status`, or `error` (`ECONNREFUSED` when nothing listens there). It is absent without `--forward-to`.\n- `data` is the body your handler received (or would receive, without `--forward-to`).\n\nThe ready line, the secret and the summary at Ctrl-C go to stderr.\n\n## Live events\n\n`listen` reads the workspace\'s event log (`GET /v1/event-occurrences`), so it receives the types with `mcp: true` in `kenso webhook-event-types list` that your seat can see. It polls the log, so a real event arrives within about 30 s; a trigger arrives at once. `--events reply.received,meeting.booked` (or `--events` repeated) narrows the types.\n\nThe event log is not on for every workspace yet. Where it is off, `listen` says so in a warning and still forwards everything you trigger, so you can build the handler first.\n\n## Triggers\n\n`trigger` takes the type\'s sample from `GET /v1/webhook-event-types`, gives it a new `eventId` (`evt_test_...`) and the current `timestamp`, and hands it to the listener for this workspace, which prints and forwards it like a live event. It sends nothing to Kenso\'s event log, to your webhook endpoints or to anyone else. It exits 1 with `forward_failed` when your handler did not answer 2xx, and with `listener_not_running` when no listener runs for the workspace.\n\nTo send a sample to a real, deployed endpoint instead, use `kenso webhook-endpoints test --webhook-endpoint-id <webhookEndpointId> --event-type reply.received`.\n\n## Stopping\n\nCtrl-C stops the listener. `listen` creates no webhook endpoint, no event subscription and no tunnel, so there is nothing to delete in Kenso. Its polls do keep the workspace\'s event log recording: the log stops on its own 7 days after the last poll. A poll that fails (a network error, a 5xx) prints a warning and is tried again a minute later; a bad key or a refused request ends the listener. It removes its local state file (the address `trigger` uses) on the way out.\n\n## Related: your API request logs\n\n`kenso logs tail` follows the same polling pattern for your API calls: it prints each request made with a Kenso API key as it is logged, so you see a failed call as it happens.\n\n```bash\nkenso logs tail --status 4xx,5xx --since 10m\nkenso logs tail --key apk_3f9c -o json\n```\n\nOn a terminal each row is one line: time, `[status]`, method, path template, error code, duration, key id, request id. Piped, or with `-o json`, each row is one JSON object per line. A row is logged after its request finishes, so a slow request can print up to a minute out of order. Where request logs are not on for the workspace yet, it exits 4 with `Request logs are not on for this workspace yet.`\n';
7315
7315
  }
7316
7316
  });
7317
7317
 
@@ -7327,7 +7327,7 @@ var init_work = __esm({
7327
7327
  var SKILL_default;
7328
7328
  var init_SKILL = __esm({
7329
7329
  "skill/kenso-cli/SKILL.md"() {
7330
- SKILL_default = '---\nname: kenso-cli\ndescription: The Kenso CLI (kenso) for work from a file (of any size, even a few ids) or over about 50 records - import, update, remove (delete), pause, tag or export leads, import CRM accounts and people, edit Studio templates as local files and fill them, run an API operation per file row, resume an interrupted run, write the Kenso AI work a workspace gave to its own coding agent (My agent, with kenso work run, or work pull and submit with subagents), sign in with a key from a variable (pipe it to kenso auth login --with-key, no check first). For records listed in the message (under about 50), one record or a question, use the Kenso MCP.\n---\n\n1. Every write runs first with `--dry-run`; apply with the plan\'s `next` (a delete, archive or remove applies with `--yes`). `--yes` at once only to continue an interrupted run or apply what the person confirmed. A command with no dry run refuses `--dry-run` (exit 2, nothing ran): read its `--help`, then run it without.\n2. Many rows: one command on the file as it is (`--file`, `--ids`, `--each`). Run kenso only: no python, awk or shell tests, not even on a file or variable.\n3. Any output\'s `next` is the command to run; errors are JSON on stderr. `--force` only with the person\'s OK.\n4. Ids are flags: `--campaign-id 812` (or `--campaign 812`, the same flag). `--workspace <id>`; by name `kenso workspace list --search acme`. `--json` is `-o json`; `--query` takes JMESPath (there is no `--jq`). Other commands: `kenso --help`; `kenso api <METHOD> <path>` only when none fits.\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run # skips leads already in; --map \'{"Pain": "customVariables.pain_point", "Notes": null}\'; over 200 MB --server-import\nkenso contacts update --file edits.csv --match id --dry-run # also one lead; or --match email --campaign 812\nkenso contacts remove --ids ids.txt --dry-run # also pause, resume, restore; over 1,000: --confirm <count>\nkenso contacts remove --where \'{"campaignIds": [812], "filters": [{"conditions": {"field": "ContactCompany.Name", "operator": 2, "value": "acme"}}]}\' --dry-run # also pause, resume; 2 = contains; no search first\nkenso contacts tag --tag 31 --ids ids.txt --dry-run # tag, restore: --ids only, so first kenso contacts list --campaign-id 812 --all -o ids > ids.txt\nkenso contact-imports create --source campaign --source-campaign-id 10601 --campaign-id 812 --dry-run # copy another campaign\'s leads in\nkenso contacts export --campaign 812 --out leads.csv # a segment: kenso contact-exports create --segment-id 55\nkenso runs resume <runId> # an interrupted run; terminal lost: kenso runs list finds it. A changed file is a new run\nkenso accounts import --file accounts.csv --dry-run # companies; a file of people: kenso people import --file people.csv\nkenso studio push 12 --dir ./tpl # to preview local edits push first (draft; live needs --publish), then studio preview 12\nkenso studio fill 12 --accounts ids.txt --dry-run # or --campaign 10546 --contacts leads.csv\nkenso opportunities update --each rows.csv --dry-run # any API command on a file of rows (CSV or JSONL; keys fill flags and body). One record: kenso campaigns update --campaign-id 812 --name Q4 --dry-run\nkenso mcp call list_skills # only to list Ken\'s skills\n```\n\nCharges: `accounts import` per new account, `studio fill` per page (again for ids from another file): show the estimate. `pinned_by_user`: with the person\'s OK, rerun with `--overwrite-pinned`. Workflows: `kenso workflows brief` first; secrets only as `{{secrets.NAME}}`. Key: `KENSO_API_KEY`, or pipe a variable, no check: `printf \'%s\' "$KEY" | kenso auth login --with-key`; never in a flag, output or file.\n\n## Work (beta): My agent\n\nA workspace can set a kind of Kenso AI work (personalization, qualification, segmentation, rewriting, meeting brief, call brief, workflow prompt) to My agent in Settings > AI work: then it waits for the person\'s own coding agent, at 0 Kenso AI credits. The `kenso work` commands take no `--dry-run`. Never read the items\' text into the chat: the files carry it.\n\n```bash\nkenso work status # what waits, per kind\nkenso work run --agent claude # does it all: claims, runs headless agents, submits; stops when the queue is empty. Other agents need --allow-unconfined; exit 6 = the plan\'s usage limit\nkenso work pull --files 4 --per-file 10 # by hand: prints the work file paths, never the items\nkenso work submit <dir>/*.answers.json # pull\'s next; exit 5 = some answers rejected (see each <claimId>.results.json)\nkenso work release <claimId> # give back work you will not finish\n```\n\nBy hand in a chat: run `kenso work pull`, then give each work file to its own subagent with only its path ("Read this work file and write its answers file as its rules say"), then run pull\'s `next`. More: `kenso docs work`.\n\n## Setup\n\n`kenso` missing: `curl -fsSL https://ken.so/install.sh | sh` (macOS or Linux, no Node needed) or `npm i -g kenso` (Node 22 or newer), or run a command as `npx -y kenso@latest <command>`. Then `kenso auth login` (the person approves in the browser) and `kenso doctor`. `kenso agent setup -y` installs this skill and the Kenso MCP server (`https://mcp.ken.so/mcp`) for the agent; the person signs in to the MCP once in the agent.\n\n## No Kenso account yet\n\nThe CLI signs in with a Kenso API key. If the user has no Kenso account, send them to https://app.ken.so/get-started to create one, then create a key in Kenso at Settings > Integrations > API keys.\n';
7330
+ SKILL_default = '---\nname: kenso-cli\ndescription: The Kenso CLI (kenso) for work from a file (of any size, even a few ids) or over about 50 records - import, update, remove (delete), pause, tag or export leads, import CRM accounts and people, edit Studio templates as local files and fill them, run an API operation per file row, resume an interrupted run, write the Kenso AI work a workspace gave to its own coding agent (My agent, with kenso work run, or work pull and submit with subagents), sign in with a key from a variable (pipe it to kenso auth login --with-key, no check first). For records listed in the message (under about 50), one record or a question, use the Kenso MCP.\n---\n\n1. Every write runs first with `--dry-run`; apply with the plan\'s `next` (a delete, archive or remove applies with `--yes`). `--yes` at once only to continue an interrupted run or apply what the person confirmed. A command with no dry run refuses `--dry-run` (exit 2, nothing ran): read its `--help`, then run it without.\n2. Many rows: one command on the file as it is (`--file`, `--ids`, `--each`). Run kenso only: no python, awk or shell tests, not even on a file or variable.\n3. Any output\'s `next` is the command to run; errors are JSON on stderr. `--force` only with the person\'s OK.\n4. Ids are flags: `--campaign-id 812` (or `--campaign 812`, the same flag). `--workspace <id>`; by name `kenso workspace list --search acme`. `--json` is `-o json`; `--query` takes JMESPath (there is no `--jq`). Other commands: `kenso --help`; `kenso api <METHOD> <path>` only when none fits.\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run # skips leads already in; --map \'{"Pain": "customVariables.pain_point", "Notes": null}\'; over 200 MB --server-import\nkenso contacts update --file edits.csv --match id --dry-run # also one lead; or --match email --campaign 812\nkenso contacts remove --ids ids.txt --dry-run # also pause, resume, restore; over 1,000: --confirm <count>\nkenso contacts remove --where \'{"campaignIds": [812], "filters": [{"conditions": {"field": "ContactCompany.Name", "operator": 2, "value": "acme"}}]}\' --dry-run # also pause, resume; 2 = contains; no search first\nkenso contacts tag --tag 31 --ids ids.txt --dry-run # tag, restore: --ids only, so first kenso contacts list --campaign-id 812 --all -o ids > ids.txt\nkenso contact-imports create --source campaign --source-campaign-id 10601 --campaign-id 812 --dry-run # copy another campaign\'s leads in\nkenso contacts export --campaign 812 --out leads.csv # a segment: kenso contact-exports create --segment-id 55\nkenso runs resume <runId> # an interrupted run; terminal lost: kenso runs list finds it. A changed file is a new run\nkenso accounts import --file accounts.csv --dry-run # companies; a file of people: kenso people import --file people.csv\nkenso studio push 12 --dir ./tpl # to preview local edits push first (draft; live needs --publish), then studio preview 12\nkenso studio fill 12 --accounts ids.txt --dry-run # or --campaign 10546 --contacts leads.csv\nkenso opportunities update --each rows.csv --dry-run # any API command on a file of rows (CSV or JSONL; keys fill flags and body). One record: kenso campaigns update --campaign-id 812 --name Q4 --dry-run\nkenso mcp call list_skills # only to list Ken\'s skills\nkenso logs tail --status 4xx,5xx --since 10m # stream the workspace\'s failed API calls, one line each; Ctrl-C stops (exit 4 = not on for the workspace yet)\n```\n\nCharges: `accounts import` per new account, `studio fill` per page (again for ids from another file): show the estimate. `pinned_by_user`: with the person\'s OK, rerun with `--overwrite-pinned`. Workflows: `kenso workflows brief` first; secrets only as `{{secrets.NAME}}`. Key: `KENSO_API_KEY`, or pipe a variable, no check: `printf \'%s\' "$KEY" | kenso auth login --with-key`; never in a flag, output or file.\n\n## Work (beta): My agent\n\nA workspace can set a kind of Kenso AI work (personalization, qualification, segmentation, rewriting, meeting brief, call brief, workflow prompt) to My agent in Settings > AI work: then it waits for the person\'s own coding agent, at 0 Kenso AI credits. The `kenso work` commands take no `--dry-run`. Never read the items\' text into the chat: the files carry it.\n\n```bash\nkenso work status # what waits, per kind\nkenso work run --agent claude # does it all: claims, runs headless agents, submits; stops when the queue is empty. Other agents need --allow-unconfined; exit 6 = the plan\'s usage limit\nkenso work pull --files 4 --per-file 10 # by hand: prints the work file paths, never the items\nkenso work submit <dir>/*.answers.json # pull\'s next; exit 5 = some answers rejected (see each <claimId>.results.json)\nkenso work release <claimId> # give back work you will not finish\n```\n\nBy hand in a chat: run `kenso work pull`, then give each work file to its own subagent with only its path ("Read this work file and write its answers file as its rules say"), then run pull\'s `next`. More: `kenso docs work`.\n\n## Setup\n\n`kenso` missing: `curl -fsSL https://ken.so/install.sh | sh` (macOS or Linux, no Node needed) or `npm i -g kenso` (Node 22 or newer), or run a command as `npx -y kenso@latest <command>`. Then `kenso auth login` (the person approves in the browser) and `kenso doctor`. `kenso agent setup -y` installs this skill and the Kenso MCP server (`https://mcp.ken.so/mcp`) for the agent; the person signs in to the MCP once in the agent.\n\n## No Kenso account yet\n\nThe CLI signs in with a Kenso API key. If the user has no Kenso account, send them to https://app.ken.so/get-started to create one, then create a key in Kenso at Settings > Integrations > API keys.\n';
7331
7331
  }
7332
7332
  });
7333
7333
 
@@ -8400,8 +8400,8 @@ var init_browser_login = __esm({
8400
8400
  defaultDeps = {
8401
8401
  sleep: (ms, signal) => delay2(ms, void 0, signal ? { signal } : void 0),
8402
8402
  now: () => Date.now(),
8403
- spawn: (command42, args) => {
8404
- const child = nodeSpawn(command42, args, { detached: true, stdio: "ignore" });
8403
+ spawn: (command48, args) => {
8404
+ const child = nodeSpawn(command48, args, { detached: true, stdio: "ignore" });
8405
8405
  child.on("error", () => {
8406
8406
  });
8407
8407
  child.unref();
@@ -8743,13 +8743,232 @@ var init_auth2 = __esm({
8743
8743
  }
8744
8744
  });
8745
8745
 
8746
+ // src/commands/capture/status.ts
8747
+ var status_exports2 = {};
8748
+ __export(status_exports2, {
8749
+ default: () => status_default2
8750
+ });
8751
+ var command8, status_default2;
8752
+ var init_status2 = __esm({
8753
+ "src/commands/capture/status.ts"() {
8754
+ "use strict";
8755
+ init_exit_codes();
8756
+ init_http();
8757
+ command8 = {
8758
+ resource: "capture",
8759
+ action: "status",
8760
+ summary: "Show your captured mailbox, its backfill progress and what teammates see of a captured email",
8761
+ description: "Reads GET /v1/capture and prints it. mailbox is your own captured mailbox, or null when capture is not on for you: provider (google, microsoft), email, status (catching_up while the 90-day backfill runs, active, reconnect_needed, failed), failureReason, isPrivate (teammates see none of its email; meetings stay visible), connectedAt, lastSyncedAt and backfill (from, coveredFrom, isDone, messagesRead, messagesLogged). connection is the Google or Microsoft account you connected in Kenso with email access, or null: connect one in the app first. teammatesSee is summary (teammates read subject, people, time and Ken's summary; only the mailbox owner opens the body) or full_email. A workspace admin also gets members: every member's mailbox status, never mail. Needs an API key bound to a member (kenso auth login creates one).",
8762
+ flags: {},
8763
+ examples: ["kenso capture status", "kenso capture status --query 'mailbox.{status: status, read: backfill.messagesRead, logged: backfill.messagesLogged}'"],
8764
+ beta: { featureGates: { all: ["crm_capture"] } },
8765
+ operationIds: ["capture.get"],
8766
+ async run(ctx) {
8767
+ const res = await ctx.client.request({ method: "GET", path: "/v1/capture", signal: ctx.signal });
8768
+ ctx.output.object(unwrap(res.body));
8769
+ return ExitCode.Ok;
8770
+ }
8771
+ };
8772
+ status_default2 = command8;
8773
+ }
8774
+ });
8775
+
8776
+ // src/commands/capture/connect.ts
8777
+ var connect_exports = {};
8778
+ __export(connect_exports, {
8779
+ default: () => connect_default
8780
+ });
8781
+ var PROVIDERS, command9, connect_default;
8782
+ var init_connect = __esm({
8783
+ "src/commands/capture/connect.ts"() {
8784
+ "use strict";
8785
+ init_errors();
8786
+ init_exit_codes();
8787
+ init_http();
8788
+ PROVIDERS = ["google", "microsoft"];
8789
+ command9 = {
8790
+ resource: "capture",
8791
+ action: "connect",
8792
+ summary: "Turn capture on for your own mailbox",
8793
+ description: "Sends PUT /v1/capture/mailbox. Kenso then logs your email with people in Kenso on the person, the account and its open deals, starting with the newest mail and going back 90 days; kenso capture status shows the progress. Running it again changes nothing. It uses the Google or Microsoft account you connected in Kenso with email access. With none, the answer is mailbox_not_connected: run it with --provider to get a sign-in link (POST /v1/calendar-accounts/connect-sessions), open the link, sign in, then run kenso capture connect again. other_mailbox_connected means your captured mailbox needs its sign-in again and the account connected now is another one: sign in to the captured mailbox again, or run kenso capture disconnect and then connect.",
8794
+ flags: {
8795
+ private: { type: "boolean", description: "Start with the Private switch on: teammates see none of this mailbox's email" },
8796
+ provider: { type: "string", description: "google or microsoft: when no account is connected yet, print the sign-in link for one" }
8797
+ },
8798
+ examples: ["kenso capture connect", "kenso capture connect --private", "kenso capture connect --provider google"],
8799
+ beta: { featureGates: { all: ["crm_capture"] } },
8800
+ operationIds: ["capture-mailbox.connect", "calendar-accounts.create-connect-session"],
8801
+ async run(ctx, { flags }) {
8802
+ const provider = typeof flags.provider === "string" ? flags.provider : void 0;
8803
+ if (provider !== void 0 && !PROVIDERS.includes(provider)) {
8804
+ throw usageError("--provider is google or microsoft.", { field: "provider" });
8805
+ }
8806
+ try {
8807
+ const res = await ctx.client.request({
8808
+ method: "PUT",
8809
+ path: "/v1/capture/mailbox",
8810
+ body: flags.private === true ? { isPrivate: true } : {},
8811
+ signal: ctx.signal
8812
+ });
8813
+ ctx.output.object(unwrap(res.body));
8814
+ return ExitCode.Ok;
8815
+ } catch (err) {
8816
+ if (!(err instanceof KensoError) || err.code !== "mailbox_not_connected") throw err;
8817
+ if (provider === void 0) {
8818
+ throw new KensoError({
8819
+ code: err.code,
8820
+ message: "No Google or Microsoft account with email access is connected for you in Kenso.",
8821
+ exitCode: err.exitCode,
8822
+ httpStatus: err.httpStatus,
8823
+ requestId: err.requestId,
8824
+ hint: "Get a sign-in link with --provider google or --provider microsoft, open it, then run kenso capture connect again.",
8825
+ next: "kenso capture connect --provider google"
8826
+ });
8827
+ }
8828
+ const session = await ctx.client.request({
8829
+ method: "POST",
8830
+ path: "/v1/calendar-accounts/connect-sessions",
8831
+ body: { provider, access: "calendar_and_email" },
8832
+ signal: ctx.signal
8833
+ });
8834
+ ctx.output.object({ status: "sign_in_needed", ...unwrap(session.body), next: "kenso capture connect" });
8835
+ return ExitCode.Ok;
8836
+ }
8837
+ }
8838
+ };
8839
+ connect_default = command9;
8840
+ }
8841
+ });
8842
+
8843
+ // src/commands/capture/private.ts
8844
+ var private_exports = {};
8845
+ __export(private_exports, {
8846
+ default: () => private_default
8847
+ });
8848
+ var command10, private_default;
8849
+ var init_private = __esm({
8850
+ "src/commands/capture/private.ts"() {
8851
+ "use strict";
8852
+ init_errors();
8853
+ init_exit_codes();
8854
+ init_http();
8855
+ command10 = {
8856
+ resource: "capture",
8857
+ action: "private",
8858
+ summary: "Hide your captured email from teammates, or show it again",
8859
+ description: "Sends PATCH /v1/capture/mailbox with isPrivate. on hides your captured email from teammates, mail already captured included: a teammate sees no trace of a thread only your mailbox holds, and a private mailbox creates no people or accounts. A message a teammate's own mailbox also holds stays visible through theirs. off shows your email again as the workspace setting allows. Email only: meetings stay visible, and Ken still reads the mailbox for you.",
8860
+ flags: {},
8861
+ positionals: [{ name: "state", required: true, description: "on or off" }],
8862
+ examples: ["kenso capture private on", "kenso capture private off"],
8863
+ beta: { featureGates: { all: ["crm_capture"] } },
8864
+ operationIds: ["capture-mailbox.update"],
8865
+ async run(ctx, { positionals }) {
8866
+ const state = positionals[0];
8867
+ if (state !== "on" && state !== "off") throw usageError("Say on or off: kenso capture private on.", { field: "state" });
8868
+ const res = await ctx.client.request({
8869
+ method: "PATCH",
8870
+ path: "/v1/capture/mailbox",
8871
+ body: { isPrivate: state === "on" },
8872
+ signal: ctx.signal
8873
+ });
8874
+ ctx.output.object(unwrap(res.body));
8875
+ return ExitCode.Ok;
8876
+ }
8877
+ };
8878
+ private_default = command10;
8879
+ }
8880
+ });
8881
+
8882
+ // src/commands/capture/disconnect.ts
8883
+ var disconnect_exports = {};
8884
+ __export(disconnect_exports, {
8885
+ default: () => disconnect_default
8886
+ });
8887
+ var command11, disconnect_default;
8888
+ var init_disconnect = __esm({
8889
+ "src/commands/capture/disconnect.ts"() {
8890
+ "use strict";
8891
+ init_confirm();
8892
+ init_exit_codes();
8893
+ command11 = {
8894
+ resource: "capture",
8895
+ action: "disconnect",
8896
+ summary: "Turn capture off for your own mailbox and delete its stored email bodies",
8897
+ description: "Sends DELETE /v1/capture/mailbox. Sync stops and Kenso deletes the stored body of every email only your mailbox holds. Subject, people, time and Ken's summary stay on the records. Your Google or Microsoft account stays connected for calendar and scheduling. Deleted bodies do not come back, so it asks first: add --yes to run it without the question.",
8898
+ flags: {},
8899
+ examples: ["kenso capture disconnect --yes"],
8900
+ beta: { featureGates: { all: ["crm_capture"] } },
8901
+ operationIds: ["capture-mailbox.disconnect"],
8902
+ async run(ctx) {
8903
+ await confirmDestructive(ctx, "This turns capture off and deletes your stored email bodies", "kenso capture disconnect --yes");
8904
+ await ctx.client.request({ method: "DELETE", path: "/v1/capture/mailbox", signal: ctx.signal });
8905
+ ctx.output.object({ disconnected: true });
8906
+ return ExitCode.Ok;
8907
+ }
8908
+ };
8909
+ disconnect_default = command11;
8910
+ }
8911
+ });
8912
+
8913
+ // src/commands/capture/teammates-see.ts
8914
+ var teammates_see_exports = {};
8915
+ __export(teammates_see_exports, {
8916
+ default: () => teammates_see_default
8917
+ });
8918
+ var VALUES, command12, teammates_see_default;
8919
+ var init_teammates_see = __esm({
8920
+ "src/commands/capture/teammates-see.ts"() {
8921
+ "use strict";
8922
+ init_errors();
8923
+ init_exit_codes();
8924
+ init_http();
8925
+ VALUES = ["summary", "full_email"];
8926
+ command12 = {
8927
+ resource: "capture",
8928
+ action: "teammates-see",
8929
+ summary: "Pick what teammates see of captured email: the summary, or the full email (workspace admin)",
8930
+ description: "Sends PATCH /v1/capture with teammatesSee. summary (the default): teammates read subject, people, time and Ken's summary, and only the mailbox owner opens the body. full_email: every member can open a captured body. It applies to every read from then on, mail already captured included. A member's Private switch still hides their email either way. Only a workspace admin can change it.",
8931
+ flags: {},
8932
+ positionals: [{ name: "value", required: true, description: "summary or full_email" }],
8933
+ examples: ["kenso capture teammates-see summary", "kenso capture teammates-see full_email"],
8934
+ beta: { featureGates: { all: ["crm_capture"] } },
8935
+ operationIds: ["capture.update"],
8936
+ async run(ctx, { positionals }) {
8937
+ const value = positionals[0];
8938
+ if (value === void 0 || !VALUES.includes(value)) {
8939
+ throw usageError("Say summary or full_email: kenso capture teammates-see summary.", { field: "value" });
8940
+ }
8941
+ const res = await ctx.client.request({ method: "PATCH", path: "/v1/capture", body: { teammatesSee: value }, signal: ctx.signal });
8942
+ ctx.output.object(unwrap(res.body));
8943
+ return ExitCode.Ok;
8944
+ }
8945
+ };
8946
+ teammates_see_default = command12;
8947
+ }
8948
+ });
8949
+
8950
+ // src/commands/capture/index.ts
8951
+ var actions5;
8952
+ var init_capture = __esm({
8953
+ "src/commands/capture/index.ts"() {
8954
+ "use strict";
8955
+ actions5 = {
8956
+ status: () => Promise.resolve().then(() => (init_status2(), status_exports2)).then((m) => m.default),
8957
+ connect: () => Promise.resolve().then(() => (init_connect(), connect_exports)).then((m) => m.default),
8958
+ private: () => Promise.resolve().then(() => (init_private(), private_exports)).then((m) => m.default),
8959
+ disconnect: () => Promise.resolve().then(() => (init_disconnect(), disconnect_exports)).then((m) => m.default),
8960
+ "teammates-see": () => Promise.resolve().then(() => (init_teammates_see(), teammates_see_exports)).then((m) => m.default)
8961
+ };
8962
+ }
8963
+ });
8964
+
8746
8965
  // src/commands/completion/completion.ts
8747
8966
  var completion_exports = {};
8748
8967
  __export(completion_exports, {
8749
8968
  SCRIPTS: () => SCRIPTS,
8750
8969
  default: () => completion_default
8751
8970
  });
8752
- var ZSH, BASH, FISH, SCRIPTS, command8, completion_default;
8971
+ var ZSH, BASH, FISH, SCRIPTS, command13, completion_default;
8753
8972
  var init_completion = __esm({
8754
8973
  "src/commands/completion/completion.ts"() {
8755
8974
  "use strict";
@@ -8813,7 +9032,7 @@ end
8813
9032
  complete -c kenso -f -a '(__kenso_complete)'
8814
9033
  `;
8815
9034
  SCRIPTS = { bash: BASH, zsh: ZSH, fish: FISH };
8816
- command8 = {
9035
+ command13 = {
8817
9036
  resource: "completion",
8818
9037
  action: "",
8819
9038
  summary: "Print the tab-completion script for bash, zsh or fish",
@@ -8841,16 +9060,16 @@ complete -c kenso -f -a '(__kenso_complete)'
8841
9060
  return ExitCode.Ok;
8842
9061
  }
8843
9062
  };
8844
- completion_default = command8;
9063
+ completion_default = command13;
8845
9064
  }
8846
9065
  });
8847
9066
 
8848
9067
  // src/commands/completion/index.ts
8849
- var actions5;
9068
+ var actions6;
8850
9069
  var init_completion2 = __esm({
8851
9070
  "src/commands/completion/index.ts"() {
8852
9071
  "use strict";
8853
- actions5 = {
9072
+ actions6 = {
8854
9073
  "": () => Promise.resolve().then(() => (init_completion(), completion_exports)).then((m) => m.default)
8855
9074
  };
8856
9075
  }
@@ -8866,9 +9085,9 @@ function stringFlag2(flags, name) {
8866
9085
  const text3 = value.trim();
8867
9086
  return text3 === "" ? void 0 : text3;
8868
9087
  }
8869
- function requireFlag(flags, name, command42, hint) {
9088
+ function requireFlag(flags, name, command48, hint) {
8870
9089
  const value = stringFlag2(flags, name);
8871
- if (value === void 0) throw usageError(`--${name} is required for ${command42}.`, { field: name, next: `${command42} --help`, ...hint ? { hint } : {} });
9090
+ if (value === void 0) throw usageError(`--${name} is required for ${command48}.`, { field: name, next: `${command48} --help`, ...hint ? { hint } : {} });
8872
9091
  return value;
8873
9092
  }
8874
9093
  function positiveId(value) {
@@ -8877,8 +9096,8 @@ function positiveId(value) {
8877
9096
  const id = Number(text3);
8878
9097
  return Number.isSafeInteger(id) && id > 0 ? id : void 0;
8879
9098
  }
8880
- function idFlag(flags, name, command42) {
8881
- const raw = requireFlag(flags, name, command42);
9099
+ function idFlag(flags, name, command48) {
9100
+ const raw = requireFlag(flags, name, command48);
8882
9101
  const id = positiveId(raw);
8883
9102
  if (id === void 0) throw usageError(`--${name} must be a positive whole number (got "${raw}").`, { field: name });
8884
9103
  return id;
@@ -8898,8 +9117,8 @@ function isDryRun(ctx) {
8898
9117
  function shellQuote4(value) {
8899
9118
  return /^[A-Za-z0-9_\-.,:/@=+%]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
8900
9119
  }
8901
- function sameCommand2(command42, flags, ctx, extra = []) {
8902
- const parts2 = [command42];
9120
+ function sameCommand2(command48, flags, ctx, extra = []) {
9121
+ const parts2 = [command48];
8903
9122
  for (const [name, value] of Object.entries(flags)) {
8904
9123
  if (value === void 0 || value === false) continue;
8905
9124
  if (value === true) parts2.push(`--${name}`);
@@ -9499,7 +9718,7 @@ function parseDuration(text3) {
9499
9718
  const ms = Number(match[1]) * (UNIT_MS[(match[2] || "s").toLowerCase()] ?? 1e3);
9500
9719
  return Number.isFinite(ms) ? Math.round(ms) : void 0;
9501
9720
  }
9502
- var UNIT_MS, command9, wait_default;
9721
+ var UNIT_MS, command14, wait_default;
9503
9722
  var init_wait = __esm({
9504
9723
  "src/commands/jobs/wait.ts"() {
9505
9724
  "use strict";
@@ -9507,7 +9726,7 @@ var init_wait = __esm({
9507
9726
  init_errors();
9508
9727
  init_exit_codes();
9509
9728
  UNIT_MS = { s: 1e3, m: 6e4, h: 36e5 };
9510
- command9 = {
9729
+ command14 = {
9511
9730
  resource: "jobs",
9512
9731
  action: "wait",
9513
9732
  summary: "Wait for a background job and print it",
@@ -9546,7 +9765,7 @@ var init_wait = __esm({
9546
9765
  });
9547
9766
  }
9548
9767
  };
9549
- wait_default = command9;
9768
+ wait_default = command14;
9550
9769
  }
9551
9770
  });
9552
9771
 
@@ -9728,7 +9947,7 @@ function summarize2(campaignId) {
9728
9947
  notSendable: results.filter((r) => (r.status === "created" || r.status === "updated") && r.sendable === false).length
9729
9948
  });
9730
9949
  }
9731
- var COMMAND2, CHUNK_SIZE2, LINKEDIN_ONLY_CHANNELS, TEMPLATE_HEADER, command10, import_default2;
9950
+ var COMMAND2, CHUNK_SIZE2, LINKEDIN_ONLY_CHANNELS, TEMPLATE_HEADER, command15, import_default2;
9732
9951
  var init_import2 = __esm({
9733
9952
  "src/commands/contacts/import.ts"() {
9734
9953
  "use strict";
@@ -9747,7 +9966,7 @@ var init_import2 = __esm({
9747
9966
  CHUNK_SIZE2 = 1e3;
9748
9967
  LINKEDIN_ONLY_CHANNELS = /* @__PURE__ */ new Set(["linkedin", "linkedin_only"]);
9749
9968
  TEMPLATE_HEADER = `${CONTACT_FIELDS.join(",")},<your custom columns>`;
9750
- command10 = {
9969
+ command15 = {
9751
9970
  resource: "contacts",
9752
9971
  action: "import",
9753
9972
  summary: "Add leads from a CSV or JSONL file to a campaign",
@@ -9836,7 +10055,7 @@ var init_import2 = __esm({
9836
10055
  return outcome.exitCode;
9837
10056
  }
9838
10057
  };
9839
- import_default2 = command10;
10058
+ import_default2 = command15;
9840
10059
  }
9841
10060
  });
9842
10061
 
@@ -9940,7 +10159,7 @@ async function sendUpdateChunk(chunk, ctx) {
9940
10159
  });
9941
10160
  return { results: mapUpdateAnswer(chunk, res.body), rateLimitRemaining: rateLimitRemaining3(res.headers) };
9942
10161
  }
9943
- var COMMAND3, CHUNK_SIZE3, PAGE_SIZE, command11, update_default;
10162
+ var COMMAND3, CHUNK_SIZE3, PAGE_SIZE, command16, update_default;
9944
10163
  var init_update = __esm({
9945
10164
  "src/commands/contacts/update.ts"() {
9946
10165
  "use strict";
@@ -9954,7 +10173,7 @@ var init_update = __esm({
9954
10173
  COMMAND3 = "kenso contacts update";
9955
10174
  CHUNK_SIZE3 = 1e3;
9956
10175
  PAGE_SIZE = 200;
9957
- command11 = {
10176
+ command16 = {
9958
10177
  resource: "contacts",
9959
10178
  action: "update",
9960
10179
  summary: "Edit leads from a CSV or JSONL file, by id or email (also one lead)",
@@ -10025,7 +10244,7 @@ var init_update = __esm({
10025
10244
  return outcome.exitCode;
10026
10245
  }
10027
10246
  };
10028
- update_default = command11;
10247
+ update_default = command16;
10029
10248
  }
10030
10249
  });
10031
10250
 
@@ -10036,12 +10255,12 @@ import { join as join11 } from "node:path";
10036
10255
  function whereDir(env) {
10037
10256
  return join11(runsRoot(env), WHERE_DIR);
10038
10257
  }
10039
- async function unfinishedWhereIds(ctx, command42, args) {
10258
+ async function unfinishedWhereIds(ctx, command48, args) {
10040
10259
  const dir = whereDir(ctx.env);
10041
10260
  const identity = argsIdentity(args);
10042
10261
  const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
10043
10262
  for (const run of await listRuns(ctx.env)) {
10044
- if (run.command !== command42 || run.status === "done" || run.status === "planned") continue;
10263
+ if (run.command !== command48 || run.status === "done" || run.status === "planned") continue;
10045
10264
  if ((run.workspaceId || void 0) !== (workspaceId || void 0) || argsIdentity(run.args) !== identity) continue;
10046
10265
  if (run.inputPath?.startsWith(`${dir}/`) && existsSync5(run.inputPath)) return run.inputPath;
10047
10266
  }
@@ -10187,14 +10406,14 @@ async function idsFromRun(ctx, runId) {
10187
10406
  return { ...idItems(ids2), source: "run" };
10188
10407
  }
10189
10408
  async function collectIds(ctx, flags, kind, dryRun2) {
10190
- const command42 = `kenso contacts ${kind}`;
10409
+ const command48 = `kenso contacts ${kind}`;
10191
10410
  const ids2 = stringFlag2(flags, "ids");
10192
10411
  const where = kind === "restore" ? void 0 : stringFlag2(flags, "where");
10193
10412
  const run = kind === "restore" ? stringFlag2(flags, "run") : void 0;
10194
10413
  const given = [ids2, where, run].filter((v) => v !== void 0).length;
10195
10414
  if (given !== 1) {
10196
10415
  const choices = kind === "restore" ? "--ids <file|-> or --run <runId>" : "--ids <file|-> or --where '<json>'";
10197
- throw usageError(`${command42} needs exactly one of ${choices}.`, { field: "ids", next: `${command42} --help` });
10416
+ throw usageError(`${command48} needs exactly one of ${choices}.`, { field: "ids", next: `${command48} --help` });
10198
10417
  }
10199
10418
  if (ids2 !== void 0) return idsFromFile(ctx, ids2);
10200
10419
  if (where !== void 0) return idsFromWhere(ctx, kind, flags, where, dryRun2);
@@ -10496,7 +10715,7 @@ async function download(ctx, job, exportId, out) {
10496
10715
  }
10497
10716
  return { rows: countRows(body), path };
10498
10717
  }
10499
- var COMMAND4, JOB_TYPE, DEFAULT_TIMEOUT2, CONTENT_PATH, command12, export_default;
10718
+ var COMMAND4, JOB_TYPE, DEFAULT_TIMEOUT2, CONTENT_PATH, command17, export_default;
10500
10719
  var init_export = __esm({
10501
10720
  "src/commands/contacts/export.ts"() {
10502
10721
  "use strict";
@@ -10511,7 +10730,7 @@ var init_export = __esm({
10511
10730
  JOB_TYPE = "contact_export";
10512
10731
  DEFAULT_TIMEOUT2 = "30m";
10513
10732
  CONTENT_PATH = /\/v1\/contact-exports\/([0-9]+)\/content/;
10514
- command12 = {
10733
+ command17 = {
10515
10734
  resource: "contacts",
10516
10735
  action: "export",
10517
10736
  summary: "Export a campaign's contacts to CSV (a segment: contact-exports create)",
@@ -10569,16 +10788,16 @@ var init_export = __esm({
10569
10788
  return ExitCode.Ok;
10570
10789
  }
10571
10790
  };
10572
- export_default = command12;
10791
+ export_default = command17;
10573
10792
  }
10574
10793
  });
10575
10794
 
10576
10795
  // src/commands/contacts/index.ts
10577
- var actions6;
10796
+ var actions7;
10578
10797
  var init_contacts = __esm({
10579
10798
  "src/commands/contacts/index.ts"() {
10580
10799
  "use strict";
10581
- actions6 = {
10800
+ actions7 = {
10582
10801
  import: () => Promise.resolve().then(() => (init_import2(), import_exports2)).then((m) => m.default),
10583
10802
  update: () => Promise.resolve().then(() => (init_update(), update_exports)).then((m) => m.default),
10584
10803
  remove: () => Promise.resolve().then(() => (init_bulk_ids(), bulk_ids_exports)).then((m) => m.remove),
@@ -10693,7 +10912,7 @@ function unknown(words) {
10693
10912
  next: "kenso describe"
10694
10913
  });
10695
10914
  }
10696
- var command13, describe_default;
10915
+ var command18, describe_default;
10697
10916
  var init_describe = __esm({
10698
10917
  "src/commands/describe/describe.ts"() {
10699
10918
  "use strict";
@@ -10706,7 +10925,7 @@ var init_describe = __esm({
10706
10925
  init_manifest();
10707
10926
  init_help();
10708
10927
  init_registry();
10709
- command13 = {
10928
+ command18 = {
10710
10929
  resource: "describe",
10711
10930
  action: "",
10712
10931
  summary: "The command map as JSON: commands, flags, body schemas",
@@ -10747,16 +10966,16 @@ var init_describe = __esm({
10747
10966
  return ExitCode.Ok;
10748
10967
  }
10749
10968
  };
10750
- describe_default = command13;
10969
+ describe_default = command18;
10751
10970
  }
10752
10971
  });
10753
10972
 
10754
10973
  // src/commands/describe/index.ts
10755
- var actions7;
10974
+ var actions8;
10756
10975
  var init_describe2 = __esm({
10757
10976
  "src/commands/describe/index.ts"() {
10758
10977
  "use strict";
10759
- actions7 = {
10978
+ actions8 = {
10760
10979
  "": () => Promise.resolve().then(() => (init_describe(), describe_exports)).then((m) => m.default)
10761
10980
  };
10762
10981
  }
@@ -10771,7 +10990,7 @@ function findTopic(input) {
10771
10990
  const name = input.trim().toLowerCase().replace(/\.md$/, "");
10772
10991
  return TOPICS.find((t) => t.topic === name);
10773
10992
  }
10774
- var NAMES, command14, docs_default;
10993
+ var NAMES, command19, docs_default;
10775
10994
  var init_docs = __esm({
10776
10995
  "src/commands/docs/docs.ts"() {
10777
10996
  "use strict";
@@ -10779,7 +10998,7 @@ var init_docs = __esm({
10779
10998
  init_exit_codes();
10780
10999
  init_content();
10781
11000
  NAMES = TOPICS.map((t) => t.topic).join(", ");
10782
- command14 = {
11001
+ command19 = {
10783
11002
  resource: "docs",
10784
11003
  action: "",
10785
11004
  summary: "Offline docs: the topic list, or one topic",
@@ -10820,16 +11039,16 @@ var init_docs = __esm({
10820
11039
  return ExitCode.Ok;
10821
11040
  }
10822
11041
  };
10823
- docs_default = command14;
11042
+ docs_default = command19;
10824
11043
  }
10825
11044
  });
10826
11045
 
10827
11046
  // src/commands/docs/index.ts
10828
- var actions8;
11047
+ var actions9;
10829
11048
  var init_docs2 = __esm({
10830
11049
  "src/commands/docs/index.ts"() {
10831
11050
  "use strict";
10832
- actions8 = {
11051
+ actions9 = {
10833
11052
  "": () => Promise.resolve().then(() => (init_docs(), docs_exports)).then((m) => m.default)
10834
11053
  };
10835
11054
  }
@@ -10858,7 +11077,7 @@ function configCheck(env) {
10858
11077
  const octal = mode.toString(8).padStart(4, "0");
10859
11078
  return mode === 384 ? { name: "config_permissions", ok: true, detail: `${file} is ${octal}` } : { name: "config_permissions", ok: false, detail: `${file} is ${octal}: run chmod 600 ${file}` };
10860
11079
  }
10861
- var MIN_NODE_MAJOR, command15, actions9;
11080
+ var MIN_NODE_MAJOR, command20, actions10;
10862
11081
  var init_doctor = __esm({
10863
11082
  "src/commands/doctor/index.ts"() {
10864
11083
  "use strict";
@@ -10867,7 +11086,7 @@ var init_doctor = __esm({
10867
11086
  init_exit_codes();
10868
11087
  init_http();
10869
11088
  MIN_NODE_MAJOR = 22;
10870
- command15 = {
11089
+ command20 = {
10871
11090
  resource: "doctor",
10872
11091
  action: "",
10873
11092
  summary: "Check Node, the config, the API and the key",
@@ -10931,23 +11150,187 @@ var init_doctor = __esm({
10931
11150
  return keyFailed ? ExitCode.Auth : ExitCode.Error;
10932
11151
  }
10933
11152
  };
10934
- actions9 = {
10935
- "": async () => command15
11153
+ actions10 = {
11154
+ "": async () => command20
10936
11155
  };
10937
11156
  }
10938
11157
  });
10939
11158
 
10940
11159
  // src/commands/jobs/index.ts
10941
- var actions10;
11160
+ var actions11;
10942
11161
  var init_jobs2 = __esm({
10943
11162
  "src/commands/jobs/index.ts"() {
10944
11163
  "use strict";
10945
- actions10 = {
11164
+ actions11 = {
10946
11165
  wait: () => Promise.resolve().then(() => (init_wait(), wait_exports)).then((m) => m.default)
10947
11166
  };
10948
11167
  }
10949
11168
  });
10950
11169
 
11170
+ // src/commands/logs/tail.ts
11171
+ var tail_exports = {};
11172
+ __export(tail_exports, {
11173
+ default: () => tail_default
11174
+ });
11175
+ import { setTimeout as delay5 } from "node:timers/promises";
11176
+ function duration(text3) {
11177
+ const days = /^(\d+(?:\.\d+)?)\s*d$/i.exec(text3.trim());
11178
+ return days ? Math.round(Number(days[1]) * 864e5) : parseDuration(text3);
11179
+ }
11180
+ function nonEmpty2(flags, name) {
11181
+ const value = flags[name];
11182
+ if (value === void 0) return void 0;
11183
+ if (typeof value !== "string" || value.trim() === "") throw usageError(`--${name} needs a value.`, { field: name });
11184
+ return value.trim();
11185
+ }
11186
+ function survivable(err) {
11187
+ if (!(err instanceof KensoError)) return false;
11188
+ const fatal = [ExitCode.Auth, ExitCode.Usage, ExitCode.NotFound];
11189
+ return !fatal.includes(err.exitCode);
11190
+ }
11191
+ function readable(row) {
11192
+ const at = new Date(row.occurredAt);
11193
+ const time = `${pad(at.getHours())}:${pad(at.getMinutes())}:${pad(at.getSeconds())}`;
11194
+ const parts2 = [time, `[${row.status}]`, row.method, row.pathTemplate, row.errorCode, `${row.durationMs}ms`, row.apiKeyId, row.requestId];
11195
+ return parts2.filter((p) => p !== void 0 && p !== "").join(" ");
11196
+ }
11197
+ var MIN_INTERVAL_MS, MAX_INTERVAL_MS, MAX_SINCE_MS, OVERLAP_MS, MAX_PAGES, RATE_LIMITED_WAIT_MS, isOwnPoll, pad, command21, tail_default;
11198
+ var init_tail = __esm({
11199
+ "src/commands/logs/tail.ts"() {
11200
+ "use strict";
11201
+ init_errors();
11202
+ init_exit_codes();
11203
+ init_http();
11204
+ init_wait();
11205
+ MIN_INTERVAL_MS = 1e3;
11206
+ MAX_INTERVAL_MS = 6e4;
11207
+ MAX_SINCE_MS = 30 * 864e5;
11208
+ OVERLAP_MS = 6e4;
11209
+ MAX_PAGES = 10;
11210
+ RATE_LIMITED_WAIT_MS = 3e4;
11211
+ isOwnPoll = (row) => row.method === "GET" && row.pathTemplate === "/v1/api-requests" && row.userAgent?.startsWith("kenso-cli/") === true;
11212
+ pad = (n) => String(n).padStart(2, "0");
11213
+ command21 = {
11214
+ resource: "logs",
11215
+ action: "tail",
11216
+ summary: "Stream your workspace's new API request log rows",
11217
+ brief: "--status, --key",
11218
+ description: "Polls GET /v1/api-requests and prints each new row as it is logged, oldest first within a poll: one line per request on a terminal (time, [status], method, path template, error code, duration, API key id, request id), one JSON object per line when piped or with -o json or -o ndjson. It starts from now; --since 10m starts earlier. A row is logged after its request finishes, so each poll looks 60 s back and a slow request can print up to a minute out of order.",
11219
+ flags: {
11220
+ status: { type: "string", description: "Only these statuses: codes or classes, comma-separated (429,5xx)" },
11221
+ key: { type: "string", description: "Only these API key ids (apk_...), comma-separated" },
11222
+ since: { type: "string", description: "Start this far back instead of from now: 90s, 10m, 1h or 7d (at most 30d)" },
11223
+ interval: { type: "string", default: "2s", description: "Time between polls: 1s to 60s (default 2s)" }
11224
+ },
11225
+ examples: ["kenso logs tail", "kenso logs tail --status 4xx,5xx --since 10m", "kenso logs tail --key apk_3f9c -o json"],
11226
+ helpFooter: ["Stop with Ctrl-C. Rows can print up to a minute out of order across polls."],
11227
+ operationIds: ["api-requests.list"],
11228
+ dryRun: true,
11229
+ async run(ctx, { flags }) {
11230
+ const intervalText = typeof flags.interval === "string" ? flags.interval : "2s";
11231
+ const intervalMs = duration(intervalText);
11232
+ if (intervalMs === void 0 || intervalMs < MIN_INTERVAL_MS || intervalMs > MAX_INTERVAL_MS) {
11233
+ throw usageError(`--interval "${intervalText}" is not between 1s and 60s.`, { field: "interval", hint: "Use 1s to 60s, for example 5s." });
11234
+ }
11235
+ const sinceText = nonEmpty2(flags, "since");
11236
+ const sinceMs = sinceText === void 0 ? 0 : duration(sinceText);
11237
+ if (sinceMs === void 0 || sinceMs > MAX_SINCE_MS) {
11238
+ throw usageError(`--since "${sinceText}" is not a duration of at most 30d.`, { field: "since", hint: "Use 90s, 10m, 1h or 7d." });
11239
+ }
11240
+ const status = nonEmpty2(flags, "status");
11241
+ const apiKeyId = nonEmpty2(flags, "key");
11242
+ const floor = Date.now() - sinceMs;
11243
+ const query = (after, cursor2) => ({ occurredAfter: new Date(after).toISOString(), limit: 200, status, apiKeyId, cursor: cursor2 });
11244
+ if (ctx.flags.dryRun) {
11245
+ ctx.output.object({ dryRun: true, request: { method: "GET", path: "/v1/api-requests", query: query(floor, void 0) }, intervalMs });
11246
+ return ExitCode.Ok;
11247
+ }
11248
+ const asJson = !ctx.output.stdoutIsTTY || ctx.flags.output === "json" || ctx.flags.output === "ndjson";
11249
+ const printed = /* @__PURE__ */ new Map();
11250
+ let newest;
11251
+ const fetchPage = async (after, cursor2) => {
11252
+ const res = await ctx.client.request({ method: "GET", path: "/v1/api-requests", query: query(after, cursor2) });
11253
+ const body = res.body;
11254
+ const rows = unwrap(res.body);
11255
+ const next = body?.pagination?.hasMore === true ? body.pagination.nextCursor : void 0;
11256
+ return { rows: Array.isArray(rows) ? rows : [], nextCursor: next || void 0 };
11257
+ };
11258
+ const pollOnce = async () => {
11259
+ const after = newest === void 0 ? floor : Math.max(floor, newest - OVERLAP_MS);
11260
+ const fresh = [];
11261
+ const seenCursors = /* @__PURE__ */ new Set();
11262
+ let cursor2;
11263
+ let pages = 0;
11264
+ do {
11265
+ let page;
11266
+ try {
11267
+ page = await fetchPage(after, cursor2);
11268
+ } catch (err) {
11269
+ if (pages === 0 || ctx.signal.aborted) throw err;
11270
+ ctx.output.warn(`A later page failed (${err.message}); older rows in this window were skipped.`);
11271
+ break;
11272
+ }
11273
+ pages++;
11274
+ const unseen = page.rows.filter((r) => !printed.has(r.id));
11275
+ fresh.push(...unseen);
11276
+ cursor2 = page.nextCursor && !seenCursors.has(page.nextCursor) ? page.nextCursor : void 0;
11277
+ if (cursor2) seenCursors.add(cursor2);
11278
+ if (page.rows.length > 0 && unseen.length === 0) break;
11279
+ if (cursor2 && pages >= MAX_PAGES) {
11280
+ ctx.output.warn(`Showing the newest ${pages * 200} rows; older rows were skipped. Use "kenso api-requests list" for history.`);
11281
+ break;
11282
+ }
11283
+ } while (cursor2 && !ctx.signal.aborted);
11284
+ fresh.sort((a, b) => Date.parse(a.occurredAt) - Date.parse(b.occurredAt) || a.id - b.id);
11285
+ for (const row of fresh) {
11286
+ if (printed.has(row.id)) continue;
11287
+ const at = Date.parse(row.occurredAt);
11288
+ printed.set(row.id, at);
11289
+ if (newest === void 0 || at > newest) newest = at;
11290
+ if (isOwnPoll(row)) continue;
11291
+ ctx.output.writeRaw(`${asJson ? JSON.stringify(row) : readable(row)}
11292
+ `);
11293
+ }
11294
+ if (newest !== void 0) {
11295
+ for (const [id, at] of printed) if (at < newest - OVERLAP_MS) printed.delete(id);
11296
+ }
11297
+ };
11298
+ let first = true;
11299
+ let backoffMs = intervalMs;
11300
+ while (!ctx.signal.aborted) {
11301
+ try {
11302
+ await pollOnce();
11303
+ first = false;
11304
+ backoffMs = intervalMs;
11305
+ } catch (err) {
11306
+ if (ctx.signal.aborted) break;
11307
+ if (first && err instanceof KensoError && err.httpStatus === 404 && err.field === void 0) {
11308
+ throw new KensoError({ code: "not_found", message: "Request logs are not on for this workspace yet.", exitCode: ExitCode.NotFound, httpStatus: 404 });
11309
+ }
11310
+ if (!survivable(err)) throw err;
11311
+ backoffMs = err instanceof KensoError && err.exitCode === ExitCode.RateLimited ? Math.max(intervalMs, RATE_LIMITED_WAIT_MS) : intervalMs;
11312
+ ctx.output.warn(`Polling failed (${err.message}); trying again in ${backoffMs / 1e3} s.`);
11313
+ }
11314
+ await delay5(backoffMs, void 0, { signal: ctx.signal }).catch(() => void 0);
11315
+ }
11316
+ return ExitCode.Ok;
11317
+ }
11318
+ };
11319
+ tail_default = command21;
11320
+ }
11321
+ });
11322
+
11323
+ // src/commands/logs/index.ts
11324
+ var actions12;
11325
+ var init_logs = __esm({
11326
+ "src/commands/logs/index.ts"() {
11327
+ "use strict";
11328
+ actions12 = {
11329
+ tail: () => Promise.resolve().then(() => (init_tail(), tail_exports)).then((m) => m.default)
11330
+ };
11331
+ }
11332
+ });
11333
+
10951
11334
  // src/commands/mcp/connect.ts
10952
11335
  function mcpUrl(ctx) {
10953
11336
  return ctx.env.KENSO_MCP_URL?.trim() || DEFAULT_MCP_URL;
@@ -10978,7 +11361,7 @@ function writeRaw(ctx, text3) {
10978
11361
  ctx.output.writeRaw(text3.endsWith("\n") ? text3 : `${text3}
10979
11362
  `);
10980
11363
  }
10981
- var init_connect = __esm({
11364
+ var init_connect2 = __esm({
10982
11365
  "src/commands/mcp/connect.ts"() {
10983
11366
  "use strict";
10984
11367
  init_errors();
@@ -10998,15 +11381,15 @@ function isRecord6(value) {
10998
11381
  function textOf(result) {
10999
11382
  return (result.content ?? []).filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text).join("\n");
11000
11383
  }
11001
- var command16, call_default;
11384
+ var command22, call_default;
11002
11385
  var init_call = __esm({
11003
11386
  "src/commands/mcp/call.ts"() {
11004
11387
  "use strict";
11005
11388
  init_errors();
11006
11389
  init_exit_codes();
11007
11390
  init_input();
11008
- init_connect();
11009
- command16 = {
11391
+ init_connect2();
11392
+ command22 = {
11010
11393
  resource: "mcp",
11011
11394
  action: "call",
11012
11395
  summary: "Call a hosted Kenso MCP tool, such as list_skills",
@@ -11059,7 +11442,7 @@ var init_call = __esm({
11059
11442
  return ExitCode.Ok;
11060
11443
  }
11061
11444
  };
11062
- call_default = command16;
11445
+ call_default = command22;
11063
11446
  }
11064
11447
  });
11065
11448
 
@@ -11068,13 +11451,13 @@ var tools_exports = {};
11068
11451
  __export(tools_exports, {
11069
11452
  default: () => tools_default
11070
11453
  });
11071
- var command17, tools_default;
11454
+ var command23, tools_default;
11072
11455
  var init_tools = __esm({
11073
11456
  "src/commands/mcp/tools.ts"() {
11074
11457
  "use strict";
11075
11458
  init_exit_codes();
11076
- init_connect();
11077
- command17 = {
11459
+ init_connect2();
11460
+ command23 = {
11078
11461
  resource: "mcp",
11079
11462
  action: "tools",
11080
11463
  summary: "List the hosted Kenso MCP's tools",
@@ -11089,16 +11472,16 @@ var init_tools = __esm({
11089
11472
  return ExitCode.Ok;
11090
11473
  }
11091
11474
  };
11092
- tools_default = command17;
11475
+ tools_default = command23;
11093
11476
  }
11094
11477
  });
11095
11478
 
11096
11479
  // src/commands/mcp/index.ts
11097
- var actions11;
11480
+ var actions13;
11098
11481
  var init_mcp = __esm({
11099
11482
  "src/commands/mcp/index.ts"() {
11100
11483
  "use strict";
11101
- actions11 = {
11484
+ actions13 = {
11102
11485
  call: () => Promise.resolve().then(() => (init_call(), call_exports)).then((m) => m.default),
11103
11486
  tools: () => Promise.resolve().then(() => (init_tools(), tools_exports)).then((m) => m.default)
11104
11487
  };
@@ -11110,14 +11493,14 @@ var stage_history_exports = {};
11110
11493
  __export(stage_history_exports, {
11111
11494
  default: () => stage_history_default
11112
11495
  });
11113
- var command18, stage_history_default;
11496
+ var command24, stage_history_default;
11114
11497
  var init_stage_history = __esm({
11115
11498
  "src/commands/opportunities/stage-history.ts"() {
11116
11499
  "use strict";
11117
11500
  init_errors();
11118
11501
  init_exit_codes();
11119
11502
  init_http();
11120
- command18 = {
11503
+ command24 = {
11121
11504
  resource: "opportunities",
11122
11505
  action: "stage-history",
11123
11506
  summary: "Show a deal's stage history: each stage, when, who moved it and how long it sat there",
@@ -11141,16 +11524,16 @@ var init_stage_history = __esm({
11141
11524
  return ExitCode.Ok;
11142
11525
  }
11143
11526
  };
11144
- stage_history_default = command18;
11527
+ stage_history_default = command24;
11145
11528
  }
11146
11529
  });
11147
11530
 
11148
11531
  // src/commands/opportunities/index.ts
11149
- var actions12;
11532
+ var actions14;
11150
11533
  var init_opportunities = __esm({
11151
11534
  "src/commands/opportunities/index.ts"() {
11152
11535
  "use strict";
11153
- actions12 = {
11536
+ actions14 = {
11154
11537
  "stage-history": () => Promise.resolve().then(() => (init_stage_history(), stage_history_exports)).then((m) => m.default)
11155
11538
  };
11156
11539
  }
@@ -11227,7 +11610,7 @@ function summarize3(results) {
11227
11610
  }
11228
11611
  return { matched, addedToAccounts, emailFindsQueued };
11229
11612
  }
11230
- var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command19, import_default3;
11613
+ var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command25, import_default3;
11231
11614
  var init_import3 = __esm({
11232
11615
  "src/commands/people/import.ts"() {
11233
11616
  "use strict";
@@ -11259,7 +11642,7 @@ var init_import3 = __esm({
11259
11642
  };
11260
11643
  PERSON_FIELDS = ["email", "fullName", "firstName", "lastName", "linkedinUrl", "title"];
11261
11644
  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.";
11262
- command19 = {
11645
+ command25 = {
11263
11646
  resource: "people",
11264
11647
  action: "import",
11265
11648
  summary: "Create or match people from a CSV or JSONL file, optionally onto accounts",
@@ -11324,16 +11707,16 @@ var init_import3 = __esm({
11324
11707
  return outcome.exitCode;
11325
11708
  }
11326
11709
  };
11327
- import_default3 = command19;
11710
+ import_default3 = command25;
11328
11711
  }
11329
11712
  });
11330
11713
 
11331
11714
  // src/commands/people/index.ts
11332
- var actions13;
11715
+ var actions15;
11333
11716
  var init_people = __esm({
11334
11717
  "src/commands/people/index.ts"() {
11335
11718
  "use strict";
11336
- actions13 = {
11719
+ actions15 = {
11337
11720
  import: () => Promise.resolve().then(() => (init_import3(), import_exports3)).then((m) => m.default)
11338
11721
  };
11339
11722
  }
@@ -11344,14 +11727,14 @@ var list_exports = {};
11344
11727
  __export(list_exports, {
11345
11728
  default: () => list_default
11346
11729
  });
11347
- var command20, list_default;
11730
+ var command26, list_default;
11348
11731
  var init_list = __esm({
11349
11732
  "src/commands/runs/list.ts"() {
11350
11733
  "use strict";
11351
11734
  init_runs();
11352
11735
  init_errors();
11353
11736
  init_exit_codes();
11354
- command20 = {
11737
+ command26 = {
11355
11738
  resource: "runs",
11356
11739
  action: "list",
11357
11740
  summary: "List batch runs, newest first (finds an interrupted run)",
@@ -11372,7 +11755,7 @@ var init_list = __esm({
11372
11755
  return ExitCode.Ok;
11373
11756
  }
11374
11757
  };
11375
- list_default = command20;
11758
+ list_default = command26;
11376
11759
  }
11377
11760
  });
11378
11761
 
@@ -11383,7 +11766,7 @@ __export(show_exports, {
11383
11766
  });
11384
11767
  import { existsSync as existsSync6, readFileSync as readFileSync9 } from "node:fs";
11385
11768
  import { join as join12 } from "node:path";
11386
- var FILES, command21, show_default;
11769
+ var FILES, command27, show_default;
11387
11770
  var init_show = __esm({
11388
11771
  "src/commands/runs/show.ts"() {
11389
11772
  "use strict";
@@ -11398,7 +11781,7 @@ var init_show = __esm({
11398
11781
  ["plan", "plan.json"],
11399
11782
  ["summary", "summary.json"]
11400
11783
  ];
11401
- command21 = {
11784
+ command27 = {
11402
11785
  resource: "runs",
11403
11786
  action: "show",
11404
11787
  summary: "Show one batch run and its files",
@@ -11425,7 +11808,7 @@ var init_show = __esm({
11425
11808
  return ExitCode.Ok;
11426
11809
  }
11427
11810
  };
11428
- show_default = command21;
11811
+ show_default = command27;
11429
11812
  }
11430
11813
  });
11431
11814
 
@@ -11484,14 +11867,14 @@ function resumeArgv(run, globals = {}) {
11484
11867
  async function sha256(path) {
11485
11868
  return createHash5("sha256").update(await readFile9(path)).digest("hex");
11486
11869
  }
11487
- var SKIPPED_KEYS, command22, resume_default;
11870
+ var SKIPPED_KEYS, command28, resume_default;
11488
11871
  var init_resume = __esm({
11489
11872
  "src/commands/runs/resume.ts"() {
11490
11873
  "use strict";
11491
11874
  init_runs();
11492
11875
  init_errors();
11493
11876
  SKIPPED_KEYS = /* @__PURE__ */ new Set(["positionals", "yes", "dryRun", "dry-run", "help", "version"]);
11494
- command22 = {
11877
+ command28 = {
11495
11878
  resource: "runs",
11496
11879
  action: "resume",
11497
11880
  summary: "Continue an interrupted batch run (its command with --yes, no dry run)",
@@ -11546,16 +11929,16 @@ var init_resume = __esm({
11546
11929
  }
11547
11930
  }
11548
11931
  };
11549
- resume_default = command22;
11932
+ resume_default = command28;
11550
11933
  }
11551
11934
  });
11552
11935
 
11553
11936
  // src/commands/runs/index.ts
11554
- var actions14;
11937
+ var actions16;
11555
11938
  var init_runs2 = __esm({
11556
11939
  "src/commands/runs/index.ts"() {
11557
11940
  "use strict";
11558
- actions14 = {
11941
+ actions16 = {
11559
11942
  list: () => Promise.resolve().then(() => (init_list(), list_exports)).then((m) => m.default),
11560
11943
  show: () => Promise.resolve().then(() => (init_show(), show_exports)).then((m) => m.default),
11561
11944
  resume: () => Promise.resolve().then(() => (init_resume(), resume_exports)).then((m) => m.default)
@@ -11654,7 +12037,7 @@ var create_exports = {};
11654
12037
  __export(create_exports, {
11655
12038
  default: () => create_default
11656
12039
  });
11657
- var command23, create_default;
12040
+ var command29, create_default;
11658
12041
  var init_create = __esm({
11659
12042
  "src/commands/sandbox/create.ts"() {
11660
12043
  "use strict";
@@ -11662,7 +12045,7 @@ var init_create = __esm({
11662
12045
  init_exit_codes();
11663
12046
  init_http();
11664
12047
  init_shared();
11665
- command23 = {
12048
+ command29 = {
11666
12049
  resource: "sandbox",
11667
12050
  action: "create",
11668
12051
  summary: "Create your developer sandbox and save its test key as the sandbox profile",
@@ -11704,7 +12087,7 @@ var init_create = __esm({
11704
12087
  return ExitCode.Ok;
11705
12088
  }
11706
12089
  };
11707
- create_default = command23;
12090
+ create_default = command29;
11708
12091
  }
11709
12092
  });
11710
12093
 
@@ -11713,7 +12096,7 @@ var delete_exports = {};
11713
12096
  __export(delete_exports, {
11714
12097
  default: () => delete_default
11715
12098
  });
11716
- var command24, delete_default;
12099
+ var command30, delete_default;
11717
12100
  var init_delete = __esm({
11718
12101
  "src/commands/sandbox/delete.ts"() {
11719
12102
  "use strict";
@@ -11721,7 +12104,7 @@ var init_delete = __esm({
11721
12104
  init_confirm();
11722
12105
  init_exit_codes();
11723
12106
  init_shared();
11724
- command24 = {
12107
+ command30 = {
11725
12108
  resource: "sandbox",
11726
12109
  action: "delete",
11727
12110
  summary: "Delete your sandbox and its test keys",
@@ -11748,7 +12131,7 @@ var init_delete = __esm({
11748
12131
  return ExitCode.Ok;
11749
12132
  }
11750
12133
  };
11751
- delete_default = command24;
12134
+ delete_default = command30;
11752
12135
  }
11753
12136
  });
11754
12137
 
@@ -11757,14 +12140,14 @@ var key_exports = {};
11757
12140
  __export(key_exports, {
11758
12141
  default: () => key_default
11759
12142
  });
11760
- var command25, key_default;
12143
+ var command31, key_default;
11761
12144
  var init_key = __esm({
11762
12145
  "src/commands/sandbox/key.ts"() {
11763
12146
  "use strict";
11764
12147
  init_exit_codes();
11765
12148
  init_http();
11766
12149
  init_shared();
11767
- command25 = {
12150
+ command31 = {
11768
12151
  resource: "sandbox",
11769
12152
  action: "key",
11770
12153
  summary: "Create a new test key for your sandbox and save it as the sandbox profile",
@@ -11784,7 +12167,7 @@ var init_key = __esm({
11784
12167
  return ExitCode.Ok;
11785
12168
  }
11786
12169
  };
11787
- key_default = command25;
12170
+ key_default = command31;
11788
12171
  }
11789
12172
  });
11790
12173
 
@@ -11793,13 +12176,13 @@ var list_exports2 = {};
11793
12176
  __export(list_exports2, {
11794
12177
  default: () => list_default2
11795
12178
  });
11796
- var command26, list_default2;
12179
+ var command32, list_default2;
11797
12180
  var init_list2 = __esm({
11798
12181
  "src/commands/sandbox/list.ts"() {
11799
12182
  "use strict";
11800
12183
  init_exit_codes();
11801
12184
  init_shared();
11802
- command26 = {
12185
+ command32 = {
11803
12186
  resource: "sandbox",
11804
12187
  action: "list",
11805
12188
  summary: "List your developer sandbox",
@@ -11815,7 +12198,7 @@ var init_list2 = __esm({
11815
12198
  return ExitCode.Ok;
11816
12199
  }
11817
12200
  };
11818
- list_default2 = command26;
12201
+ list_default2 = command32;
11819
12202
  }
11820
12203
  });
11821
12204
 
@@ -11824,14 +12207,14 @@ var reset_exports = {};
11824
12207
  __export(reset_exports, {
11825
12208
  default: () => reset_default
11826
12209
  });
11827
- var command27, reset_default;
12210
+ var command33, reset_default;
11828
12211
  var init_reset = __esm({
11829
12212
  "src/commands/sandbox/reset.ts"() {
11830
12213
  "use strict";
11831
12214
  init_exit_codes();
11832
12215
  init_http();
11833
12216
  init_shared();
11834
- command27 = {
12217
+ command33 = {
11835
12218
  resource: "sandbox",
11836
12219
  action: "reset",
11837
12220
  summary: "Reset your sandbox to its seed data",
@@ -11849,16 +12232,16 @@ var init_reset = __esm({
11849
12232
  return ExitCode.Ok;
11850
12233
  }
11851
12234
  };
11852
- reset_default = command27;
12235
+ reset_default = command33;
11853
12236
  }
11854
12237
  });
11855
12238
 
11856
12239
  // src/commands/sandbox/index.ts
11857
- var actions15;
12240
+ var actions17;
11858
12241
  var init_sandbox2 = __esm({
11859
12242
  "src/commands/sandbox/index.ts"() {
11860
12243
  "use strict";
11861
- actions15 = {
12244
+ actions17 = {
11862
12245
  create: () => Promise.resolve().then(() => (init_create(), create_exports)).then((m) => m.default),
11863
12246
  delete: () => Promise.resolve().then(() => (init_delete(), delete_exports)).then((m) => m.default),
11864
12247
  key: () => Promise.resolve().then(() => (init_key(), key_exports)).then((m) => m.default),
@@ -11869,11 +12252,11 @@ var init_sandbox2 = __esm({
11869
12252
  });
11870
12253
 
11871
12254
  // src/commands/skill/index.ts
11872
- var actions16;
12255
+ var actions18;
11873
12256
  var init_skill = __esm({
11874
12257
  "src/commands/skill/index.ts"() {
11875
12258
  "use strict";
11876
- actions16 = {
12259
+ actions18 = {
11877
12260
  install: () => Promise.resolve().then(() => (init_install(), install_exports)).then((m) => m.default)
11878
12261
  };
11879
12262
  }
@@ -12109,7 +12492,7 @@ __export(pull_exports, {
12109
12492
  });
12110
12493
  import { mkdir, writeFile as writeFile4 } from "node:fs/promises";
12111
12494
  import { dirname as dirname2, resolve as resolve11 } from "node:path";
12112
- var command28, pull_default;
12495
+ var command34, pull_default;
12113
12496
  var init_pull = __esm({
12114
12497
  "src/commands/studio/pull.ts"() {
12115
12498
  "use strict";
@@ -12119,7 +12502,7 @@ var init_pull = __esm({
12119
12502
  init_common2();
12120
12503
  init_folder();
12121
12504
  init_transfer();
12122
- command28 = {
12505
+ command34 = {
12123
12506
  resource: "studio",
12124
12507
  action: "pull",
12125
12508
  summary: "Write a template version's files to a folder",
@@ -12166,7 +12549,7 @@ var init_pull = __esm({
12166
12549
  return ExitCode.Ok;
12167
12550
  }
12168
12551
  };
12169
- pull_default = command28;
12552
+ pull_default = command34;
12170
12553
  }
12171
12554
  });
12172
12555
 
@@ -12199,7 +12582,7 @@ var push_exports = {};
12199
12582
  __export(push_exports, {
12200
12583
  default: () => push_default
12201
12584
  });
12202
- var BUILT_BY, DEFAULT_MESSAGE, command29, push_default;
12585
+ var BUILT_BY, DEFAULT_MESSAGE, command35, push_default;
12203
12586
  var init_push = __esm({
12204
12587
  "src/commands/studio/push.ts"() {
12205
12588
  "use strict";
@@ -12211,7 +12594,7 @@ var init_push = __esm({
12211
12594
  init_read();
12212
12595
  BUILT_BY = "customer_agent";
12213
12596
  DEFAULT_MESSAGE = "Pushed with the Kenso CLI";
12214
- command29 = {
12597
+ command35 = {
12215
12598
  resource: "studio",
12216
12599
  action: "push",
12217
12600
  summary: "Save a folder's files to a template's draft and print the validation",
@@ -12303,7 +12686,7 @@ var init_push = __esm({
12303
12686
  );
12304
12687
  }
12305
12688
  };
12306
- push_default = command29;
12689
+ push_default = command35;
12307
12690
  }
12308
12691
  });
12309
12692
 
@@ -12312,7 +12695,7 @@ var validate_exports = {};
12312
12695
  __export(validate_exports, {
12313
12696
  default: () => validate_default
12314
12697
  });
12315
- var command30, validate_default;
12698
+ var command36, validate_default;
12316
12699
  var init_validate = __esm({
12317
12700
  "src/commands/studio/validate.ts"() {
12318
12701
  "use strict";
@@ -12321,7 +12704,7 @@ var init_validate = __esm({
12321
12704
  init_columns();
12322
12705
  init_common2();
12323
12706
  init_read();
12324
- command30 = {
12707
+ command36 = {
12325
12708
  resource: "studio",
12326
12709
  action: "validate",
12327
12710
  summary: "Validate a folder's files against a template without saving them",
@@ -12350,7 +12733,7 @@ var init_validate = __esm({
12350
12733
  throw validationFailed(validation, "The files have validation errors", commandLine2(ctx, "studio validate", args));
12351
12734
  }
12352
12735
  };
12353
- validate_default = command30;
12736
+ validate_default = command36;
12354
12737
  }
12355
12738
  });
12356
12739
 
@@ -12399,7 +12782,7 @@ function accountIds(value) {
12399
12782
  }
12400
12783
  return ids2.map(Number);
12401
12784
  }
12402
- var SHOWN, command31, preview_default;
12785
+ var SHOWN, command37, preview_default;
12403
12786
  var init_preview = __esm({
12404
12787
  "src/commands/studio/preview.ts"() {
12405
12788
  "use strict";
@@ -12411,7 +12794,7 @@ var init_preview = __esm({
12411
12794
  init_common2();
12412
12795
  init_folder();
12413
12796
  SHOWN = 5;
12414
- command31 = {
12797
+ command37 = {
12415
12798
  resource: "studio",
12416
12799
  action: "preview",
12417
12800
  summary: "Render a saved version for up to 3 accounts; for local edits, studio push them to the draft first",
@@ -12460,12 +12843,12 @@ var init_preview = __esm({
12460
12843
  return ExitCode.Ok;
12461
12844
  }
12462
12845
  };
12463
- preview_default = command31;
12846
+ preview_default = command37;
12464
12847
  }
12465
12848
  });
12466
12849
 
12467
12850
  // src/commands/studio/fill-runs.ts
12468
- import { setTimeout as delay5 } from "node:timers/promises";
12851
+ import { setTimeout as delay6 } from "node:timers/promises";
12469
12852
  async function estimateFill(ctx, templateId, count) {
12470
12853
  const parts2 = [];
12471
12854
  for (let left = count; left > 0; left -= RUN_SIZE) {
@@ -12497,7 +12880,7 @@ async function estimateFill(ctx, templateId, count) {
12497
12880
  async function waitForRun(client, runId, opts) {
12498
12881
  const sleep = opts.sleep ?? (async (ms) => {
12499
12882
  try {
12500
- await delay5(ms, void 0, { signal: opts.signal });
12883
+ await delay6(ms, void 0, { signal: opts.signal });
12501
12884
  } catch (err) {
12502
12885
  if (opts.signal.aborted) throw new KensoError({ code: "interrupted", message: "Interrupted.", exitCode: ExitCode.Interrupted });
12503
12886
  throw err;
@@ -12661,7 +13044,7 @@ function estimateOutput(templateId, target, estimate2) {
12661
13044
  ...target.campaignId !== void 0 ? { estimateNote: "An upper bound: it counts one page per lead, and a campaign run builds one page per company." } : {}
12662
13045
  };
12663
13046
  }
12664
- var COMMAND6, sha2562, command32, fill_default;
13047
+ var COMMAND6, sha2562, command38, fill_default;
12665
13048
  var init_fill = __esm({
12666
13049
  "src/commands/studio/fill.ts"() {
12667
13050
  "use strict";
@@ -12677,7 +13060,7 @@ var init_fill = __esm({
12677
13060
  init_fill_runs();
12678
13061
  COMMAND6 = "studio fill";
12679
13062
  sha2562 = (data) => createHash8("sha256").update(data).digest("hex");
12680
- command32 = {
13063
+ command38 = {
12681
13064
  resource: "studio",
12682
13065
  action: "fill",
12683
13066
  summary: "Fill a template on many accounts or campaign leads (estimate first)",
@@ -12737,16 +13120,16 @@ var init_fill = __esm({
12737
13120
  return outcome.exitCode;
12738
13121
  }
12739
13122
  };
12740
- fill_default = command32;
13123
+ fill_default = command38;
12741
13124
  }
12742
13125
  });
12743
13126
 
12744
13127
  // src/commands/studio/index.ts
12745
- var actions17;
13128
+ var actions19;
12746
13129
  var init_studio2 = __esm({
12747
13130
  "src/commands/studio/index.ts"() {
12748
13131
  "use strict";
12749
- actions17 = {
13132
+ actions19 = {
12750
13133
  pull: () => Promise.resolve().then(() => (init_pull(), pull_exports)).then((m) => m.default),
12751
13134
  push: () => Promise.resolve().then(() => (init_push(), push_exports)).then((m) => m.default),
12752
13135
  validate: () => Promise.resolve().then(() => (init_validate(), validate_exports)).then((m) => m.default),
@@ -12852,7 +13235,7 @@ __export(listen_exports, {
12852
13235
  liveBody: () => liveBody
12853
13236
  });
12854
13237
  import { randomBytes as randomBytes3 } from "node:crypto";
12855
- import { setTimeout as delay6 } from "node:timers/promises";
13238
+ import { setTimeout as delay7 } from "node:timers/promises";
12856
13239
  function eventTypes(value) {
12857
13240
  const list2 = Array.isArray(value) ? value : typeof value === "string" ? [value] : [];
12858
13241
  return list2.flatMap((item) => item.split(",")).map((item) => item.trim()).filter((item) => item !== "");
@@ -12863,7 +13246,7 @@ function liveBody(event, workspaceId) {
12863
13246
  const envelope = { eventType: event.name ?? "", eventId: event.eventId ?? "", timestamp: event.timestamp ?? "", ...clientId };
12864
13247
  return { ...envelope, ...data, ...envelope };
12865
13248
  }
12866
- function survivable(err) {
13249
+ function survivable2(err) {
12867
13250
  if (!(err instanceof KensoError)) return false;
12868
13251
  const fatal = [ExitCode.Auth, ExitCode.Usage, ExitCode.NotFound];
12869
13252
  return !fatal.includes(err.exitCode);
@@ -12888,7 +13271,7 @@ function readBody(req) {
12888
13271
  function reply(res, status, body) {
12889
13272
  res.writeHead(status, { "content-type": "application/json" }).end(JSON.stringify(body));
12890
13273
  }
12891
- var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command33, listen_default;
13274
+ var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command39, listen_default;
12892
13275
  var init_listen = __esm({
12893
13276
  "src/commands/webhooks/listen.ts"() {
12894
13277
  "use strict";
@@ -12899,7 +13282,7 @@ var init_listen = __esm({
12899
13282
  MIN_POLL_MS = 1e3;
12900
13283
  MAX_POLL_MS = 6e4;
12901
13284
  MAX_TRIGGER_BYTES = 1e6;
12902
- command33 = {
13285
+ command39 = {
12903
13286
  resource: "webhooks",
12904
13287
  action: "listen",
12905
13288
  summary: "Stream the workspace's events and forward them, signed, to a local handler",
@@ -12952,7 +13335,7 @@ var init_listen = __esm({
12952
13335
  if (err instanceof KensoError && err.httpStatus === 404 && err.field === void 0) {
12953
13336
  live = false;
12954
13337
  ctx.output.warn(`Live events are not on for this workspace (${err.message}). Samples from kenso webhooks trigger still come through.`);
12955
- } else if (!ctx.signal.aborted && survivable(err)) {
13338
+ } else if (!ctx.signal.aborted && survivable2(err)) {
12956
13339
  ctx.output.warn(`Polling failed (${err.message}); trying again.`);
12957
13340
  } else {
12958
13341
  throw err;
@@ -12988,11 +13371,11 @@ var init_listen = __esm({
12988
13371
  cursor2 = page.cursor ?? cursor2;
12989
13372
  waitMs = page.hasMore ? 0 : Math.min(MAX_POLL_MS, Math.max(MIN_POLL_MS, page.nextPollMs ?? MAX_POLL_MS));
12990
13373
  } catch (err) {
12991
- if (ctx.signal.aborted || !survivable(err)) throw err;
13374
+ if (ctx.signal.aborted || !survivable2(err)) throw err;
12992
13375
  ctx.output.warn(`Polling failed (${err.message}); trying again in ${MAX_POLL_MS / 1e3} s.`);
12993
13376
  }
12994
13377
  }
12995
- await delay6(waitMs, void 0, { signal: ctx.signal }).catch(() => void 0);
13378
+ await delay7(waitMs, void 0, { signal: ctx.signal }).catch(() => void 0);
12996
13379
  }
12997
13380
  } catch (err) {
12998
13381
  if (!ctx.signal.aborted) throw err;
@@ -13005,7 +13388,7 @@ var init_listen = __esm({
13005
13388
  return ExitCode.Ok;
13006
13389
  }
13007
13390
  };
13008
- listen_default = command33;
13391
+ listen_default = command39;
13009
13392
  }
13010
13393
  });
13011
13394
 
@@ -13024,7 +13407,7 @@ function notRunning() {
13024
13407
  next: LISTEN_NEXT
13025
13408
  });
13026
13409
  }
13027
- var LISTEN_NEXT, command34, trigger_default;
13410
+ var LISTEN_NEXT, command40, trigger_default;
13028
13411
  var init_trigger = __esm({
13029
13412
  "src/commands/webhooks/trigger.ts"() {
13030
13413
  "use strict";
@@ -13033,7 +13416,7 @@ var init_trigger = __esm({
13033
13416
  init_http();
13034
13417
  init_local();
13035
13418
  LISTEN_NEXT = "kenso webhooks listen --forward-to http://localhost:3000/hook";
13036
- command34 = {
13419
+ command40 = {
13037
13420
  resource: "webhooks",
13038
13421
  action: "trigger",
13039
13422
  summary: "Send a sample event of one type through the running kenso webhooks listen",
@@ -13090,16 +13473,16 @@ var init_trigger = __esm({
13090
13473
  return ExitCode.Ok;
13091
13474
  }
13092
13475
  };
13093
- trigger_default = command34;
13476
+ trigger_default = command40;
13094
13477
  }
13095
13478
  });
13096
13479
 
13097
13480
  // src/commands/webhooks/index.ts
13098
- var actions18;
13481
+ var actions20;
13099
13482
  var init_webhooks2 = __esm({
13100
13483
  "src/commands/webhooks/index.ts"() {
13101
13484
  "use strict";
13102
- actions18 = {
13485
+ actions20 = {
13103
13486
  listen: () => Promise.resolve().then(() => (init_listen(), listen_exports)).then((m) => m.default),
13104
13487
  trigger: () => Promise.resolve().then(() => (init_trigger(), trigger_exports)).then((m) => m.default)
13105
13488
  };
@@ -13109,14 +13492,14 @@ var init_webhooks2 = __esm({
13109
13492
  // src/commands/work/common.ts
13110
13493
  import { randomUUID as randomUUID2 } from "node:crypto";
13111
13494
  import { join as join16 } from "node:path";
13112
- import { setTimeout as delay7 } from "node:timers/promises";
13495
+ import { setTimeout as delay8 } from "node:timers/promises";
13113
13496
  function unavailable(err) {
13114
13497
  return err instanceof KensoError && (err.code === "network_error" || err.httpStatus === 502 || err.httpStatus === 503 || err.httpStatus === 504);
13115
13498
  }
13116
13499
  async function pause2(ms, signal) {
13117
13500
  if (signal.aborted) return false;
13118
13501
  try {
13119
- await delay7(ms, void 0, { signal });
13502
+ await delay8(ms, void 0, { signal });
13120
13503
  return true;
13121
13504
  } catch {
13122
13505
  return false;
@@ -13290,18 +13673,18 @@ var init_common3 = __esm({
13290
13673
  });
13291
13674
 
13292
13675
  // src/commands/work/status.ts
13293
- var status_exports2 = {};
13294
- __export(status_exports2, {
13295
- default: () => status_default2
13676
+ var status_exports3 = {};
13677
+ __export(status_exports3, {
13678
+ default: () => status_default3
13296
13679
  });
13297
- var command35, status_default2;
13298
- var init_status2 = __esm({
13680
+ var command41, status_default3;
13681
+ var init_status3 = __esm({
13299
13682
  "src/commands/work/status.ts"() {
13300
13683
  "use strict";
13301
13684
  init_exit_codes();
13302
13685
  init_http();
13303
13686
  init_common3();
13304
- command35 = {
13687
+ command41 = {
13305
13688
  resource: "work",
13306
13689
  action: "status",
13307
13690
  summary: "Show the Kenso AI work waiting for your own agent, per kind",
@@ -13335,7 +13718,7 @@ var init_status2 = __esm({
13335
13718
  return ExitCode.Ok;
13336
13719
  }
13337
13720
  };
13338
- status_default2 = command35;
13721
+ status_default3 = command41;
13339
13722
  }
13340
13723
  });
13341
13724
 
@@ -13467,9 +13850,9 @@ var init_files = __esm({
13467
13850
  import { execFile, spawnSync as spawnSync2 } from "node:child_process";
13468
13851
  import { readFileSync as readFileSync12 } from "node:fs";
13469
13852
  import { isAbsolute as isAbsolute2 } from "node:path";
13470
- function sudoArgs(user, command42, args, keep = [], set = {}) {
13853
+ function sudoArgs(user, command48, args, keep = [], set = {}) {
13471
13854
  const assignments = Object.entries(set).map(([name, value]) => `${name}=${value}`);
13472
- return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command42, ...args];
13855
+ return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command48, ...args];
13473
13856
  }
13474
13857
  function agentKensoEnv(opts) {
13475
13858
  return {
@@ -13479,12 +13862,12 @@ function agentKensoEnv(opts) {
13479
13862
  AI_AGENT: opts.agentName
13480
13863
  };
13481
13864
  }
13482
- function sudoExec(user, command42, args, opts = {}) {
13865
+ function sudoExec(user, command48, args, opts = {}) {
13483
13866
  const [sudo = "/usr/bin/sudo", ...lead] = user.sudo;
13484
13867
  return new Promise((resolve16) => {
13485
13868
  execFile(
13486
13869
  sudo,
13487
- [...lead, ...sudoArgs(user.name, command42, args)],
13870
+ [...lead, ...sudoArgs(user.name, command48, args)],
13488
13871
  { env: { PATH: SUDO_PATH }, cwd: "/", timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS, maxBuffer: opts.maxBuffer ?? 1024 * 1024, encoding: "utf8", windowsHide: true, shell: false },
13489
13872
  (err, stdout, stderr) => {
13490
13873
  const code = err ? err.code : 0;
@@ -13594,9 +13977,9 @@ var init_folder2 = __esm({
13594
13977
  init_redact();
13595
13978
  init_agent_user();
13596
13979
  WorkRunFolder = class {
13597
- constructor(ctx, command42, args, outDir, shared = false) {
13980
+ constructor(ctx, command48, args, outDir, shared = false) {
13598
13981
  this.ctx = ctx;
13599
- this.command = command42;
13982
+ this.command = command48;
13600
13983
  this.args = args;
13601
13984
  this.outDir = outDir;
13602
13985
  this.shared = shared;
@@ -13711,7 +14094,7 @@ var pull_exports2 = {};
13711
14094
  __export(pull_exports2, {
13712
14095
  default: () => pull_default2
13713
14096
  });
13714
- var MAX_FILES, command36, pull_default2;
14097
+ var MAX_FILES, command42, pull_default2;
13715
14098
  var init_pull2 = __esm({
13716
14099
  "src/commands/work/pull.ts"() {
13717
14100
  "use strict";
@@ -13720,7 +14103,7 @@ var init_pull2 = __esm({
13720
14103
  init_common3();
13721
14104
  init_folder2();
13722
14105
  MAX_FILES = 100;
13723
- command36 = {
14106
+ command42 = {
13724
14107
  resource: "work",
13725
14108
  action: "pull",
13726
14109
  summary: "Claim waiting work into local work files, to answer by hand",
@@ -13798,7 +14181,7 @@ var init_pull2 = __esm({
13798
14181
  return interrupted6 ? ExitCode.Interrupted : ExitCode.Ok;
13799
14182
  }
13800
14183
  };
13801
- pull_default2 = command36;
14184
+ pull_default2 = command42;
13802
14185
  }
13803
14186
  });
13804
14187
 
@@ -13940,7 +14323,7 @@ __export(submit_exports, {
13940
14323
  default: () => submit_default
13941
14324
  });
13942
14325
  import { resolve as resolve14 } from "node:path";
13943
- var command37, submit_default;
14326
+ var command43, submit_default;
13944
14327
  var init_submit = __esm({
13945
14328
  "src/commands/work/submit.ts"() {
13946
14329
  "use strict";
@@ -13949,7 +14332,7 @@ var init_submit = __esm({
13949
14332
  init_files();
13950
14333
  init_answers();
13951
14334
  init_common3();
13952
- command37 = {
14335
+ command43 = {
13953
14336
  resource: "work",
13954
14337
  action: "submit",
13955
14338
  summary: "Send answers files to Kenso and write each one's results",
@@ -13981,7 +14364,7 @@ var init_submit = __esm({
13981
14364
  return totals.rejected > 0 ? ExitCode.Partial : ExitCode.Ok;
13982
14365
  }
13983
14366
  };
13984
- submit_default = command37;
14367
+ submit_default = command43;
13985
14368
  }
13986
14369
  });
13987
14370
 
@@ -14002,7 +14385,7 @@ function claimIdOf(arg) {
14002
14385
  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..." });
14003
14386
  return arg;
14004
14387
  }
14005
- var CLAIM_ID, command38, release_default;
14388
+ var CLAIM_ID, command44, release_default;
14006
14389
  var init_release = __esm({
14007
14390
  "src/commands/work/release.ts"() {
14008
14391
  "use strict";
@@ -14011,7 +14394,7 @@ var init_release = __esm({
14011
14394
  init_files();
14012
14395
  init_common3();
14013
14396
  CLAIM_ID = /^[A-Za-z0-9_-]{1,64}$/;
14014
- command38 = {
14397
+ command44 = {
14015
14398
  resource: "work",
14016
14399
  action: "release",
14017
14400
  summary: "Give claimed work back to the queue now",
@@ -14030,7 +14413,7 @@ var init_release = __esm({
14030
14413
  return ExitCode.Ok;
14031
14414
  }
14032
14415
  };
14033
- release_default = command38;
14416
+ release_default = command44;
14034
14417
  }
14035
14418
  });
14036
14419
 
@@ -14039,7 +14422,7 @@ import { spawn as nodeSpawn2 } from "node:child_process";
14039
14422
  import { rmSync as rmSync3, statSync as statSync2 } from "node:fs";
14040
14423
  import { access, constants as constants2 } from "node:fs/promises";
14041
14424
  import { delimiter as delimiter2, join as join20 } from "node:path";
14042
- import { setTimeout as delay8 } from "node:timers/promises";
14425
+ import { setTimeout as delay9 } from "node:timers/promises";
14043
14426
  function childEnv(parent, adapter, extra) {
14044
14427
  const scrub = new Set(adapter.scrubEnv.map((name) => name.toUpperCase()));
14045
14428
  const env = {};
@@ -14132,7 +14515,7 @@ async function groupGone(pid, runAs) {
14132
14515
  while (Date.now() < deadline) {
14133
14516
  if (runAs) {
14134
14517
  if (!await sudoKill(runAs, "SIGKILL", pid)) return;
14135
- await delay8(100);
14518
+ await delay9(100);
14136
14519
  continue;
14137
14520
  }
14138
14521
  try {
@@ -14140,7 +14523,7 @@ async function groupGone(pid, runAs) {
14140
14523
  } catch {
14141
14524
  return;
14142
14525
  }
14143
- await delay8(25);
14526
+ await delay9(25);
14144
14527
  }
14145
14528
  }
14146
14529
  function runChild(spawnFn, bin, built, job, env, signal, runAs) {
@@ -14369,12 +14752,12 @@ function plain(text3) {
14369
14752
  return text3.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
14370
14753
  }
14371
14754
  function runStatus(bin, args, env, adapter, runAs) {
14372
- const command42 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
14755
+ const command48 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
14373
14756
  const commandArgs2 = runAs ? [...runAs.sudo.slice(1), ...sudoArgs(runAs.name, bin, args)] : args;
14374
14757
  const options = runAs ? { env: { PATH: SUDO_PATH }, cwd: "/" } : { env: childEnv(env, adapter) };
14375
14758
  return new Promise((resolve16) => {
14376
14759
  execFile2(
14377
- command42,
14760
+ command48,
14378
14761
  commandArgs2,
14379
14762
  { ...options, timeout: STATUS_TIMEOUT_MS, maxBuffer: 1024 * 1024, windowsHide: true, shell: false },
14380
14763
  (err, stdout, stderr) => {
@@ -15456,7 +15839,7 @@ var run_exports = {};
15456
15839
  __export(run_exports, {
15457
15840
  default: () => run_default
15458
15841
  });
15459
- var FAILURES_IN_A_ROW, command39, run_default;
15842
+ var FAILURES_IN_A_ROW, command45, run_default;
15460
15843
  var init_run = __esm({
15461
15844
  "src/commands/work/run.ts"() {
15462
15845
  "use strict";
@@ -15477,7 +15860,7 @@ var init_run = __esm({
15477
15860
  init_folder2();
15478
15861
  init_stop();
15479
15862
  FAILURES_IN_A_ROW = 3;
15480
- command39 = {
15863
+ command45 = {
15481
15864
  resource: "work",
15482
15865
  action: "run",
15483
15866
  summary: "Run your own coding agent on the waiting work until the queue is empty",
@@ -15802,17 +16185,17 @@ var init_run = __esm({
15802
16185
  return exitCodeFor(reason, totals.rejected > 0 || jobsFailed > 0);
15803
16186
  }
15804
16187
  };
15805
- run_default = command39;
16188
+ run_default = command45;
15806
16189
  }
15807
16190
  });
15808
16191
 
15809
16192
  // src/commands/work/index.ts
15810
- var actions19;
16193
+ var actions21;
15811
16194
  var init_work2 = __esm({
15812
16195
  "src/commands/work/index.ts"() {
15813
16196
  "use strict";
15814
- actions19 = {
15815
- status: () => Promise.resolve().then(() => (init_status2(), status_exports2)).then((m) => m.default),
16197
+ actions21 = {
16198
+ status: () => Promise.resolve().then(() => (init_status3(), status_exports3)).then((m) => m.default),
15816
16199
  pull: () => Promise.resolve().then(() => (init_pull2(), pull_exports2)).then((m) => m.default),
15817
16200
  submit: () => Promise.resolve().then(() => (init_submit(), submit_exports)).then((m) => m.default),
15818
16201
  release: () => Promise.resolve().then(() => (init_release(), release_exports)).then((m) => m.default),
@@ -15835,14 +16218,14 @@ function parseLimit(value) {
15835
16218
  }
15836
16219
  return limit;
15837
16220
  }
15838
- var MAX_LIMIT, command40, list_default3;
16221
+ var MAX_LIMIT, command46, list_default3;
15839
16222
  var init_list3 = __esm({
15840
16223
  "src/commands/workspace/list.ts"() {
15841
16224
  "use strict";
15842
16225
  init_errors();
15843
16226
  init_exit_codes();
15844
16227
  MAX_LIMIT = 200;
15845
- command40 = {
16228
+ command46 = {
15846
16229
  resource: "workspace",
15847
16230
  action: "list",
15848
16231
  summary: "List the workspaces your key can use",
@@ -15870,7 +16253,7 @@ var init_list3 = __esm({
15870
16253
  return ExitCode.Ok;
15871
16254
  }
15872
16255
  };
15873
- list_default3 = command40;
16256
+ list_default3 = command46;
15874
16257
  }
15875
16258
  });
15876
16259
 
@@ -15879,7 +16262,7 @@ var use_exports = {};
15879
16262
  __export(use_exports, {
15880
16263
  default: () => use_default
15881
16264
  });
15882
- var command41, use_default;
16265
+ var command47, use_default;
15883
16266
  var init_use = __esm({
15884
16267
  "src/commands/workspace/use.ts"() {
15885
16268
  "use strict";
@@ -15887,7 +16270,7 @@ var init_use = __esm({
15887
16270
  init_errors();
15888
16271
  init_exit_codes();
15889
16272
  init_http();
15890
- command41 = {
16273
+ command47 = {
15891
16274
  resource: "workspace",
15892
16275
  action: "use",
15893
16276
  summary: "Set the profile's default workspace",
@@ -15944,16 +16327,16 @@ var init_use = __esm({
15944
16327
  return ExitCode.Ok;
15945
16328
  }
15946
16329
  };
15947
- use_default = command41;
16330
+ use_default = command47;
15948
16331
  }
15949
16332
  });
15950
16333
 
15951
16334
  // src/commands/workspace/index.ts
15952
- var actions20;
16335
+ var actions22;
15953
16336
  var init_workspace = __esm({
15954
16337
  "src/commands/workspace/index.ts"() {
15955
16338
  "use strict";
15956
- actions20 = {
16339
+ actions22 = {
15957
16340
  list: () => Promise.resolve().then(() => (init_list3(), list_exports3)).then((m) => m.default),
15958
16341
  use: () => Promise.resolve().then(() => (init_use(), use_exports)).then((m) => m.default)
15959
16342
  };
@@ -15977,12 +16360,14 @@ var init_registry = __esm({
15977
16360
  init_agent2();
15978
16361
  init_api3();
15979
16362
  init_auth2();
16363
+ init_capture();
15980
16364
  init_completion2();
15981
16365
  init_contacts();
15982
16366
  init_describe2();
15983
16367
  init_docs2();
15984
16368
  init_doctor();
15985
16369
  init_jobs2();
16370
+ init_logs();
15986
16371
  init_mcp();
15987
16372
  init_opportunities();
15988
16373
  init_people();
@@ -15998,25 +16383,27 @@ var init_registry = __esm({
15998
16383
  agent: actions2,
15999
16384
  api: actions3,
16000
16385
  auth: actions4,
16001
- completion: actions5,
16002
- contacts: actions6,
16003
- describe: actions7,
16004
- docs: actions8,
16005
- doctor: actions9,
16006
- jobs: actions10,
16386
+ capture: actions5,
16387
+ completion: actions6,
16388
+ contacts: actions7,
16389
+ describe: actions8,
16390
+ docs: actions9,
16391
+ doctor: actions10,
16392
+ jobs: actions11,
16007
16393
  login: topLevel("login", actions4.login, "kenso auth login"),
16008
16394
  logout: topLevel("logout", actions4.logout, "kenso auth logout"),
16009
- mcp: actions11,
16010
- opportunities: actions12,
16011
- people: actions13,
16012
- runs: actions14,
16013
- sandbox: actions15,
16014
- skill: actions16,
16015
- studio: actions17,
16016
- webhooks: actions18,
16395
+ logs: actions12,
16396
+ mcp: actions13,
16397
+ opportunities: actions14,
16398
+ people: actions15,
16399
+ runs: actions16,
16400
+ sandbox: actions17,
16401
+ skill: actions18,
16402
+ studio: actions19,
16403
+ webhooks: actions20,
16017
16404
  whoami: topLevel("whoami", actions4.status, "kenso auth status"),
16018
- work: actions19,
16019
- workspace: actions20
16405
+ work: actions21,
16406
+ workspace: actions22
16020
16407
  };
16021
16408
  resourceAliases = { leads: "contacts" };
16022
16409
  }
@@ -16153,8 +16540,8 @@ async function renderTopHelp(opts) {
16153
16540
  names.push(withPositionals(spec, spec.action));
16154
16541
  groups.set(hint, names);
16155
16542
  }
16156
- const actions22 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
16157
- if (actions22.length > 0) rows.push([resource, actions22.join(", ")]);
16543
+ const actions24 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
16544
+ if (actions24.length > 0) rows.push([resource, actions24.join(", ")]);
16158
16545
  }
16159
16546
  const at = 4 + Math.min(22, Math.max(0, ...rows.map(([left]) => left.length)));
16160
16547
  lines.push(
@@ -16167,7 +16554,7 @@ async function renderTopHelp(opts) {
16167
16554
  const [area = "", action = ""] = name.split(" ");
16168
16555
  byArea.set(area, [...byArea.get(area) ?? [], action]);
16169
16556
  }
16170
- const named = [...byArea.entries()].map(([area, actions22]) => `${area} ${actions22.join("|")}`);
16557
+ const named = [...byArea.entries()].map(([area, actions24]) => `${area} ${actions24.join("|")}`);
16171
16558
  lines.push(wrap(`Beta, hidden here but they run (the server decides): ${named.join(", ")}.`, " "));
16172
16559
  }
16173
16560
  const generated = await listGenerated({ features: opts.allCommands ? [] : getFeatures, env: opts.env });
@@ -16175,13 +16562,13 @@ async function renderTopHelp(opts) {
16175
16562
  if (visible.length > 0) {
16176
16563
  const byResource = /* @__PURE__ */ new Map();
16177
16564
  for (const g of visible) {
16178
- const actions22 = byResource.get(g.resource) ?? [];
16179
- actions22.push(`${g.action}${g.beta ? " (beta)" : ""}`);
16180
- byResource.set(g.resource, actions22);
16565
+ const actions24 = byResource.get(g.resource) ?? [];
16566
+ actions24.push(`${g.action}${g.beta ? " (beta)" : ""}`);
16567
+ byResource.set(g.resource, actions24);
16181
16568
  }
16182
16569
  const sorted2 = [...byResource.entries()].sort(([a], [b]) => a.localeCompare(b));
16183
16570
  if (opts.allCommands) {
16184
- const generatedRows = sorted2.map(([resource, actions22]) => [resource, actions22.sort().join(", ")]);
16571
+ const generatedRows = sorted2.map(([resource, actions24]) => [resource, actions24.sort().join(", ")]);
16185
16572
  lines.push("", "API resources (kenso <resource> <action>):", columns(generatedRows));
16186
16573
  } else {
16187
16574
  const names = new Set(sorted2.map(([resource]) => resource));
@@ -16497,8 +16884,8 @@ function startUpdateNotice(argv, opts = {}) {
16497
16884
  if (!found) return;
16498
16885
  writeCheck(file, { checkedAt: new Date(now).toISOString(), latest: found });
16499
16886
  if (isNewer(found, version)) {
16500
- const command42 = updateCommand(install, opts.platform ?? process.platform);
16501
- stderr.write(`kenso ${found} is out (you have ${version}): ${command42}
16887
+ const command48 = updateCommand(install, opts.platform ?? process.platform);
16888
+ stderr.write(`kenso ${found} is out (you have ${version}): ${command48}
16502
16889
  Turn this off with KENSO_NO_UPDATE_NOTIFIER=1.
16503
16890
  `);
16504
16891
  }
@@ -16540,7 +16927,7 @@ function resources() {
16540
16927
  const names = Object.entries(handWritten).filter(([, area]) => Object.keys(area).length > 0).map(([resource]) => resource);
16541
16928
  return sorted([...names, ...Object.keys(resourceAliases), ...loadManifest().operations.map((op) => op.resource)]);
16542
16929
  }
16543
- function actions21(resource) {
16930
+ function actions23(resource) {
16544
16931
  const own = Object.keys(handWritten[resource] ?? {}).filter((action) => action !== "");
16545
16932
  return sorted([...own, ...loadManifest().operations.filter((op) => op.resource === resource).map((op) => op.action)]);
16546
16933
  }
@@ -16605,7 +16992,7 @@ async function completions(words, globals) {
16605
16992
  return flagsOf2(spec, globals, positionals.length === 0);
16606
16993
  }
16607
16994
  if (positionals.length === 0) return resources();
16608
- if (!spec) return positionals.length === 1 ? actions21(resourceAliases[positionals[0]] ?? positionals[0]) : [];
16995
+ if (!spec) return positionals.length === 1 ? actions23(resourceAliases[positionals[0]] ?? positionals[0]) : [];
16609
16996
  const given = positionals.length - commandWords;
16610
16997
  const declared = spec.positionals ?? [];
16611
16998
  if (given < declared.length || declared.at(-1)?.variadic === true) {
@@ -16699,9 +17086,9 @@ function normalizeBooleans(argv, names, strict) {
16699
17086
  async function knownCommands() {
16700
17087
  const commands = /* @__PURE__ */ new Set();
16701
17088
  for (const [resource, area] of Object.entries(handWritten)) {
16702
- const actions22 = Object.keys(area);
16703
- if (actions22.length > 0) commands.add(resource);
16704
- for (const action of actions22) commands.add(action ? `${resource} ${action}` : resource);
17089
+ const actions24 = Object.keys(area);
17090
+ if (actions24.length > 0) commands.add(resource);
17091
+ for (const action of actions24) commands.add(action ? `${resource} ${action}` : resource);
16705
17092
  }
16706
17093
  for (const g of await listGenerated({ features: [] })) {
16707
17094
  commands.add(g.resource);