kenso 0.1.65 → 0.1.67

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.67" : "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: command44, 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 command44 !== "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: command44,
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(command44, 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 === command44 && (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, command44, args, extra = []) {
6942
+ const parts2 = ["kenso", ...command44.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| `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: (command44, args) => {
8404
+ const child = nodeSpawn(command44, args, { detached: true, stdio: "ignore" });
8405
8405
  child.on("error", () => {
8406
8406
  });
8407
8407
  child.unref();
@@ -8743,13 +8743,54 @@ 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/index.ts
8777
+ var actions5;
8778
+ var init_capture = __esm({
8779
+ "src/commands/capture/index.ts"() {
8780
+ "use strict";
8781
+ actions5 = {
8782
+ status: () => Promise.resolve().then(() => (init_status2(), status_exports2)).then((m) => m.default)
8783
+ };
8784
+ }
8785
+ });
8786
+
8746
8787
  // src/commands/completion/completion.ts
8747
8788
  var completion_exports = {};
8748
8789
  __export(completion_exports, {
8749
8790
  SCRIPTS: () => SCRIPTS,
8750
8791
  default: () => completion_default
8751
8792
  });
8752
- var ZSH, BASH, FISH, SCRIPTS, command8, completion_default;
8793
+ var ZSH, BASH, FISH, SCRIPTS, command9, completion_default;
8753
8794
  var init_completion = __esm({
8754
8795
  "src/commands/completion/completion.ts"() {
8755
8796
  "use strict";
@@ -8813,7 +8854,7 @@ end
8813
8854
  complete -c kenso -f -a '(__kenso_complete)'
8814
8855
  `;
8815
8856
  SCRIPTS = { bash: BASH, zsh: ZSH, fish: FISH };
8816
- command8 = {
8857
+ command9 = {
8817
8858
  resource: "completion",
8818
8859
  action: "",
8819
8860
  summary: "Print the tab-completion script for bash, zsh or fish",
@@ -8841,16 +8882,16 @@ complete -c kenso -f -a '(__kenso_complete)'
8841
8882
  return ExitCode.Ok;
8842
8883
  }
8843
8884
  };
8844
- completion_default = command8;
8885
+ completion_default = command9;
8845
8886
  }
8846
8887
  });
8847
8888
 
8848
8889
  // src/commands/completion/index.ts
8849
- var actions5;
8890
+ var actions6;
8850
8891
  var init_completion2 = __esm({
8851
8892
  "src/commands/completion/index.ts"() {
8852
8893
  "use strict";
8853
- actions5 = {
8894
+ actions6 = {
8854
8895
  "": () => Promise.resolve().then(() => (init_completion(), completion_exports)).then((m) => m.default)
8855
8896
  };
8856
8897
  }
@@ -8866,9 +8907,9 @@ function stringFlag2(flags, name) {
8866
8907
  const text3 = value.trim();
8867
8908
  return text3 === "" ? void 0 : text3;
8868
8909
  }
8869
- function requireFlag(flags, name, command42, hint) {
8910
+ function requireFlag(flags, name, command44, hint) {
8870
8911
  const value = stringFlag2(flags, name);
8871
- if (value === void 0) throw usageError(`--${name} is required for ${command42}.`, { field: name, next: `${command42} --help`, ...hint ? { hint } : {} });
8912
+ if (value === void 0) throw usageError(`--${name} is required for ${command44}.`, { field: name, next: `${command44} --help`, ...hint ? { hint } : {} });
8872
8913
  return value;
8873
8914
  }
8874
8915
  function positiveId(value) {
@@ -8877,8 +8918,8 @@ function positiveId(value) {
8877
8918
  const id = Number(text3);
8878
8919
  return Number.isSafeInteger(id) && id > 0 ? id : void 0;
8879
8920
  }
8880
- function idFlag(flags, name, command42) {
8881
- const raw = requireFlag(flags, name, command42);
8921
+ function idFlag(flags, name, command44) {
8922
+ const raw = requireFlag(flags, name, command44);
8882
8923
  const id = positiveId(raw);
8883
8924
  if (id === void 0) throw usageError(`--${name} must be a positive whole number (got "${raw}").`, { field: name });
8884
8925
  return id;
@@ -8898,8 +8939,8 @@ function isDryRun(ctx) {
8898
8939
  function shellQuote4(value) {
8899
8940
  return /^[A-Za-z0-9_\-.,:/@=+%]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
8900
8941
  }
8901
- function sameCommand2(command42, flags, ctx, extra = []) {
8902
- const parts2 = [command42];
8942
+ function sameCommand2(command44, flags, ctx, extra = []) {
8943
+ const parts2 = [command44];
8903
8944
  for (const [name, value] of Object.entries(flags)) {
8904
8945
  if (value === void 0 || value === false) continue;
8905
8946
  if (value === true) parts2.push(`--${name}`);
@@ -9499,7 +9540,7 @@ function parseDuration(text3) {
9499
9540
  const ms = Number(match[1]) * (UNIT_MS[(match[2] || "s").toLowerCase()] ?? 1e3);
9500
9541
  return Number.isFinite(ms) ? Math.round(ms) : void 0;
9501
9542
  }
9502
- var UNIT_MS, command9, wait_default;
9543
+ var UNIT_MS, command10, wait_default;
9503
9544
  var init_wait = __esm({
9504
9545
  "src/commands/jobs/wait.ts"() {
9505
9546
  "use strict";
@@ -9507,7 +9548,7 @@ var init_wait = __esm({
9507
9548
  init_errors();
9508
9549
  init_exit_codes();
9509
9550
  UNIT_MS = { s: 1e3, m: 6e4, h: 36e5 };
9510
- command9 = {
9551
+ command10 = {
9511
9552
  resource: "jobs",
9512
9553
  action: "wait",
9513
9554
  summary: "Wait for a background job and print it",
@@ -9546,7 +9587,7 @@ var init_wait = __esm({
9546
9587
  });
9547
9588
  }
9548
9589
  };
9549
- wait_default = command9;
9590
+ wait_default = command10;
9550
9591
  }
9551
9592
  });
9552
9593
 
@@ -9728,7 +9769,7 @@ function summarize2(campaignId) {
9728
9769
  notSendable: results.filter((r) => (r.status === "created" || r.status === "updated") && r.sendable === false).length
9729
9770
  });
9730
9771
  }
9731
- var COMMAND2, CHUNK_SIZE2, LINKEDIN_ONLY_CHANNELS, TEMPLATE_HEADER, command10, import_default2;
9772
+ var COMMAND2, CHUNK_SIZE2, LINKEDIN_ONLY_CHANNELS, TEMPLATE_HEADER, command11, import_default2;
9732
9773
  var init_import2 = __esm({
9733
9774
  "src/commands/contacts/import.ts"() {
9734
9775
  "use strict";
@@ -9747,7 +9788,7 @@ var init_import2 = __esm({
9747
9788
  CHUNK_SIZE2 = 1e3;
9748
9789
  LINKEDIN_ONLY_CHANNELS = /* @__PURE__ */ new Set(["linkedin", "linkedin_only"]);
9749
9790
  TEMPLATE_HEADER = `${CONTACT_FIELDS.join(",")},<your custom columns>`;
9750
- command10 = {
9791
+ command11 = {
9751
9792
  resource: "contacts",
9752
9793
  action: "import",
9753
9794
  summary: "Add leads from a CSV or JSONL file to a campaign",
@@ -9836,7 +9877,7 @@ var init_import2 = __esm({
9836
9877
  return outcome.exitCode;
9837
9878
  }
9838
9879
  };
9839
- import_default2 = command10;
9880
+ import_default2 = command11;
9840
9881
  }
9841
9882
  });
9842
9883
 
@@ -9940,7 +9981,7 @@ async function sendUpdateChunk(chunk, ctx) {
9940
9981
  });
9941
9982
  return { results: mapUpdateAnswer(chunk, res.body), rateLimitRemaining: rateLimitRemaining3(res.headers) };
9942
9983
  }
9943
- var COMMAND3, CHUNK_SIZE3, PAGE_SIZE, command11, update_default;
9984
+ var COMMAND3, CHUNK_SIZE3, PAGE_SIZE, command12, update_default;
9944
9985
  var init_update = __esm({
9945
9986
  "src/commands/contacts/update.ts"() {
9946
9987
  "use strict";
@@ -9954,7 +9995,7 @@ var init_update = __esm({
9954
9995
  COMMAND3 = "kenso contacts update";
9955
9996
  CHUNK_SIZE3 = 1e3;
9956
9997
  PAGE_SIZE = 200;
9957
- command11 = {
9998
+ command12 = {
9958
9999
  resource: "contacts",
9959
10000
  action: "update",
9960
10001
  summary: "Edit leads from a CSV or JSONL file, by id or email (also one lead)",
@@ -10025,7 +10066,7 @@ var init_update = __esm({
10025
10066
  return outcome.exitCode;
10026
10067
  }
10027
10068
  };
10028
- update_default = command11;
10069
+ update_default = command12;
10029
10070
  }
10030
10071
  });
10031
10072
 
@@ -10036,12 +10077,12 @@ import { join as join11 } from "node:path";
10036
10077
  function whereDir(env) {
10037
10078
  return join11(runsRoot(env), WHERE_DIR);
10038
10079
  }
10039
- async function unfinishedWhereIds(ctx, command42, args) {
10080
+ async function unfinishedWhereIds(ctx, command44, args) {
10040
10081
  const dir = whereDir(ctx.env);
10041
10082
  const identity = argsIdentity(args);
10042
10083
  const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
10043
10084
  for (const run of await listRuns(ctx.env)) {
10044
- if (run.command !== command42 || run.status === "done" || run.status === "planned") continue;
10085
+ if (run.command !== command44 || run.status === "done" || run.status === "planned") continue;
10045
10086
  if ((run.workspaceId || void 0) !== (workspaceId || void 0) || argsIdentity(run.args) !== identity) continue;
10046
10087
  if (run.inputPath?.startsWith(`${dir}/`) && existsSync5(run.inputPath)) return run.inputPath;
10047
10088
  }
@@ -10187,14 +10228,14 @@ async function idsFromRun(ctx, runId) {
10187
10228
  return { ...idItems(ids2), source: "run" };
10188
10229
  }
10189
10230
  async function collectIds(ctx, flags, kind, dryRun2) {
10190
- const command42 = `kenso contacts ${kind}`;
10231
+ const command44 = `kenso contacts ${kind}`;
10191
10232
  const ids2 = stringFlag2(flags, "ids");
10192
10233
  const where = kind === "restore" ? void 0 : stringFlag2(flags, "where");
10193
10234
  const run = kind === "restore" ? stringFlag2(flags, "run") : void 0;
10194
10235
  const given = [ids2, where, run].filter((v) => v !== void 0).length;
10195
10236
  if (given !== 1) {
10196
10237
  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` });
10238
+ throw usageError(`${command44} needs exactly one of ${choices}.`, { field: "ids", next: `${command44} --help` });
10198
10239
  }
10199
10240
  if (ids2 !== void 0) return idsFromFile(ctx, ids2);
10200
10241
  if (where !== void 0) return idsFromWhere(ctx, kind, flags, where, dryRun2);
@@ -10496,7 +10537,7 @@ async function download(ctx, job, exportId, out) {
10496
10537
  }
10497
10538
  return { rows: countRows(body), path };
10498
10539
  }
10499
- var COMMAND4, JOB_TYPE, DEFAULT_TIMEOUT2, CONTENT_PATH, command12, export_default;
10540
+ var COMMAND4, JOB_TYPE, DEFAULT_TIMEOUT2, CONTENT_PATH, command13, export_default;
10500
10541
  var init_export = __esm({
10501
10542
  "src/commands/contacts/export.ts"() {
10502
10543
  "use strict";
@@ -10511,7 +10552,7 @@ var init_export = __esm({
10511
10552
  JOB_TYPE = "contact_export";
10512
10553
  DEFAULT_TIMEOUT2 = "30m";
10513
10554
  CONTENT_PATH = /\/v1\/contact-exports\/([0-9]+)\/content/;
10514
- command12 = {
10555
+ command13 = {
10515
10556
  resource: "contacts",
10516
10557
  action: "export",
10517
10558
  summary: "Export a campaign's contacts to CSV (a segment: contact-exports create)",
@@ -10569,16 +10610,16 @@ var init_export = __esm({
10569
10610
  return ExitCode.Ok;
10570
10611
  }
10571
10612
  };
10572
- export_default = command12;
10613
+ export_default = command13;
10573
10614
  }
10574
10615
  });
10575
10616
 
10576
10617
  // src/commands/contacts/index.ts
10577
- var actions6;
10618
+ var actions7;
10578
10619
  var init_contacts = __esm({
10579
10620
  "src/commands/contacts/index.ts"() {
10580
10621
  "use strict";
10581
- actions6 = {
10622
+ actions7 = {
10582
10623
  import: () => Promise.resolve().then(() => (init_import2(), import_exports2)).then((m) => m.default),
10583
10624
  update: () => Promise.resolve().then(() => (init_update(), update_exports)).then((m) => m.default),
10584
10625
  remove: () => Promise.resolve().then(() => (init_bulk_ids(), bulk_ids_exports)).then((m) => m.remove),
@@ -10693,7 +10734,7 @@ function unknown(words) {
10693
10734
  next: "kenso describe"
10694
10735
  });
10695
10736
  }
10696
- var command13, describe_default;
10737
+ var command14, describe_default;
10697
10738
  var init_describe = __esm({
10698
10739
  "src/commands/describe/describe.ts"() {
10699
10740
  "use strict";
@@ -10706,7 +10747,7 @@ var init_describe = __esm({
10706
10747
  init_manifest();
10707
10748
  init_help();
10708
10749
  init_registry();
10709
- command13 = {
10750
+ command14 = {
10710
10751
  resource: "describe",
10711
10752
  action: "",
10712
10753
  summary: "The command map as JSON: commands, flags, body schemas",
@@ -10747,16 +10788,16 @@ var init_describe = __esm({
10747
10788
  return ExitCode.Ok;
10748
10789
  }
10749
10790
  };
10750
- describe_default = command13;
10791
+ describe_default = command14;
10751
10792
  }
10752
10793
  });
10753
10794
 
10754
10795
  // src/commands/describe/index.ts
10755
- var actions7;
10796
+ var actions8;
10756
10797
  var init_describe2 = __esm({
10757
10798
  "src/commands/describe/index.ts"() {
10758
10799
  "use strict";
10759
- actions7 = {
10800
+ actions8 = {
10760
10801
  "": () => Promise.resolve().then(() => (init_describe(), describe_exports)).then((m) => m.default)
10761
10802
  };
10762
10803
  }
@@ -10771,7 +10812,7 @@ function findTopic(input) {
10771
10812
  const name = input.trim().toLowerCase().replace(/\.md$/, "");
10772
10813
  return TOPICS.find((t) => t.topic === name);
10773
10814
  }
10774
- var NAMES, command14, docs_default;
10815
+ var NAMES, command15, docs_default;
10775
10816
  var init_docs = __esm({
10776
10817
  "src/commands/docs/docs.ts"() {
10777
10818
  "use strict";
@@ -10779,7 +10820,7 @@ var init_docs = __esm({
10779
10820
  init_exit_codes();
10780
10821
  init_content();
10781
10822
  NAMES = TOPICS.map((t) => t.topic).join(", ");
10782
- command14 = {
10823
+ command15 = {
10783
10824
  resource: "docs",
10784
10825
  action: "",
10785
10826
  summary: "Offline docs: the topic list, or one topic",
@@ -10820,16 +10861,16 @@ var init_docs = __esm({
10820
10861
  return ExitCode.Ok;
10821
10862
  }
10822
10863
  };
10823
- docs_default = command14;
10864
+ docs_default = command15;
10824
10865
  }
10825
10866
  });
10826
10867
 
10827
10868
  // src/commands/docs/index.ts
10828
- var actions8;
10869
+ var actions9;
10829
10870
  var init_docs2 = __esm({
10830
10871
  "src/commands/docs/index.ts"() {
10831
10872
  "use strict";
10832
- actions8 = {
10873
+ actions9 = {
10833
10874
  "": () => Promise.resolve().then(() => (init_docs(), docs_exports)).then((m) => m.default)
10834
10875
  };
10835
10876
  }
@@ -10858,7 +10899,7 @@ function configCheck(env) {
10858
10899
  const octal = mode.toString(8).padStart(4, "0");
10859
10900
  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
10901
  }
10861
- var MIN_NODE_MAJOR, command15, actions9;
10902
+ var MIN_NODE_MAJOR, command16, actions10;
10862
10903
  var init_doctor = __esm({
10863
10904
  "src/commands/doctor/index.ts"() {
10864
10905
  "use strict";
@@ -10867,7 +10908,7 @@ var init_doctor = __esm({
10867
10908
  init_exit_codes();
10868
10909
  init_http();
10869
10910
  MIN_NODE_MAJOR = 22;
10870
- command15 = {
10911
+ command16 = {
10871
10912
  resource: "doctor",
10872
10913
  action: "",
10873
10914
  summary: "Check Node, the config, the API and the key",
@@ -10931,23 +10972,187 @@ var init_doctor = __esm({
10931
10972
  return keyFailed ? ExitCode.Auth : ExitCode.Error;
10932
10973
  }
10933
10974
  };
10934
- actions9 = {
10935
- "": async () => command15
10975
+ actions10 = {
10976
+ "": async () => command16
10936
10977
  };
10937
10978
  }
10938
10979
  });
10939
10980
 
10940
10981
  // src/commands/jobs/index.ts
10941
- var actions10;
10982
+ var actions11;
10942
10983
  var init_jobs2 = __esm({
10943
10984
  "src/commands/jobs/index.ts"() {
10944
10985
  "use strict";
10945
- actions10 = {
10986
+ actions11 = {
10946
10987
  wait: () => Promise.resolve().then(() => (init_wait(), wait_exports)).then((m) => m.default)
10947
10988
  };
10948
10989
  }
10949
10990
  });
10950
10991
 
10992
+ // src/commands/logs/tail.ts
10993
+ var tail_exports = {};
10994
+ __export(tail_exports, {
10995
+ default: () => tail_default
10996
+ });
10997
+ import { setTimeout as delay5 } from "node:timers/promises";
10998
+ function duration(text3) {
10999
+ const days = /^(\d+(?:\.\d+)?)\s*d$/i.exec(text3.trim());
11000
+ return days ? Math.round(Number(days[1]) * 864e5) : parseDuration(text3);
11001
+ }
11002
+ function nonEmpty2(flags, name) {
11003
+ const value = flags[name];
11004
+ if (value === void 0) return void 0;
11005
+ if (typeof value !== "string" || value.trim() === "") throw usageError(`--${name} needs a value.`, { field: name });
11006
+ return value.trim();
11007
+ }
11008
+ function survivable(err) {
11009
+ if (!(err instanceof KensoError)) return false;
11010
+ const fatal = [ExitCode.Auth, ExitCode.Usage, ExitCode.NotFound];
11011
+ return !fatal.includes(err.exitCode);
11012
+ }
11013
+ function readable(row) {
11014
+ const at = new Date(row.occurredAt);
11015
+ const time = `${pad(at.getHours())}:${pad(at.getMinutes())}:${pad(at.getSeconds())}`;
11016
+ const parts2 = [time, `[${row.status}]`, row.method, row.pathTemplate, row.errorCode, `${row.durationMs}ms`, row.apiKeyId, row.requestId];
11017
+ return parts2.filter((p) => p !== void 0 && p !== "").join(" ");
11018
+ }
11019
+ var MIN_INTERVAL_MS, MAX_INTERVAL_MS, MAX_SINCE_MS, OVERLAP_MS, MAX_PAGES, RATE_LIMITED_WAIT_MS, isOwnPoll, pad, command17, tail_default;
11020
+ var init_tail = __esm({
11021
+ "src/commands/logs/tail.ts"() {
11022
+ "use strict";
11023
+ init_errors();
11024
+ init_exit_codes();
11025
+ init_http();
11026
+ init_wait();
11027
+ MIN_INTERVAL_MS = 1e3;
11028
+ MAX_INTERVAL_MS = 6e4;
11029
+ MAX_SINCE_MS = 30 * 864e5;
11030
+ OVERLAP_MS = 6e4;
11031
+ MAX_PAGES = 10;
11032
+ RATE_LIMITED_WAIT_MS = 3e4;
11033
+ isOwnPoll = (row) => row.method === "GET" && row.pathTemplate === "/v1/api-requests" && row.userAgent?.startsWith("kenso-cli/") === true;
11034
+ pad = (n) => String(n).padStart(2, "0");
11035
+ command17 = {
11036
+ resource: "logs",
11037
+ action: "tail",
11038
+ summary: "Stream your workspace's new API request log rows",
11039
+ brief: "--status, --key",
11040
+ 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.",
11041
+ flags: {
11042
+ status: { type: "string", description: "Only these statuses: codes or classes, comma-separated (429,5xx)" },
11043
+ key: { type: "string", description: "Only these API key ids (apk_...), comma-separated" },
11044
+ since: { type: "string", description: "Start this far back instead of from now: 90s, 10m, 1h or 7d (at most 30d)" },
11045
+ interval: { type: "string", default: "2s", description: "Time between polls: 1s to 60s (default 2s)" }
11046
+ },
11047
+ examples: ["kenso logs tail", "kenso logs tail --status 4xx,5xx --since 10m", "kenso logs tail --key apk_3f9c -o json"],
11048
+ helpFooter: ["Stop with Ctrl-C. Rows can print up to a minute out of order across polls."],
11049
+ operationIds: ["api-requests.list"],
11050
+ dryRun: true,
11051
+ async run(ctx, { flags }) {
11052
+ const intervalText = typeof flags.interval === "string" ? flags.interval : "2s";
11053
+ const intervalMs = duration(intervalText);
11054
+ if (intervalMs === void 0 || intervalMs < MIN_INTERVAL_MS || intervalMs > MAX_INTERVAL_MS) {
11055
+ throw usageError(`--interval "${intervalText}" is not between 1s and 60s.`, { field: "interval", hint: "Use 1s to 60s, for example 5s." });
11056
+ }
11057
+ const sinceText = nonEmpty2(flags, "since");
11058
+ const sinceMs = sinceText === void 0 ? 0 : duration(sinceText);
11059
+ if (sinceMs === void 0 || sinceMs > MAX_SINCE_MS) {
11060
+ throw usageError(`--since "${sinceText}" is not a duration of at most 30d.`, { field: "since", hint: "Use 90s, 10m, 1h or 7d." });
11061
+ }
11062
+ const status = nonEmpty2(flags, "status");
11063
+ const apiKeyId = nonEmpty2(flags, "key");
11064
+ const floor = Date.now() - sinceMs;
11065
+ const query = (after, cursor2) => ({ occurredAfter: new Date(after).toISOString(), limit: 200, status, apiKeyId, cursor: cursor2 });
11066
+ if (ctx.flags.dryRun) {
11067
+ ctx.output.object({ dryRun: true, request: { method: "GET", path: "/v1/api-requests", query: query(floor, void 0) }, intervalMs });
11068
+ return ExitCode.Ok;
11069
+ }
11070
+ const asJson = !ctx.output.stdoutIsTTY || ctx.flags.output === "json" || ctx.flags.output === "ndjson";
11071
+ const printed = /* @__PURE__ */ new Map();
11072
+ let newest;
11073
+ const fetchPage = async (after, cursor2) => {
11074
+ const res = await ctx.client.request({ method: "GET", path: "/v1/api-requests", query: query(after, cursor2) });
11075
+ const body = res.body;
11076
+ const rows = unwrap(res.body);
11077
+ const next = body?.pagination?.hasMore === true ? body.pagination.nextCursor : void 0;
11078
+ return { rows: Array.isArray(rows) ? rows : [], nextCursor: next || void 0 };
11079
+ };
11080
+ const pollOnce = async () => {
11081
+ const after = newest === void 0 ? floor : Math.max(floor, newest - OVERLAP_MS);
11082
+ const fresh = [];
11083
+ const seenCursors = /* @__PURE__ */ new Set();
11084
+ let cursor2;
11085
+ let pages = 0;
11086
+ do {
11087
+ let page;
11088
+ try {
11089
+ page = await fetchPage(after, cursor2);
11090
+ } catch (err) {
11091
+ if (pages === 0 || ctx.signal.aborted) throw err;
11092
+ ctx.output.warn(`A later page failed (${err.message}); older rows in this window were skipped.`);
11093
+ break;
11094
+ }
11095
+ pages++;
11096
+ const unseen = page.rows.filter((r) => !printed.has(r.id));
11097
+ fresh.push(...unseen);
11098
+ cursor2 = page.nextCursor && !seenCursors.has(page.nextCursor) ? page.nextCursor : void 0;
11099
+ if (cursor2) seenCursors.add(cursor2);
11100
+ if (page.rows.length > 0 && unseen.length === 0) break;
11101
+ if (cursor2 && pages >= MAX_PAGES) {
11102
+ ctx.output.warn(`Showing the newest ${pages * 200} rows; older rows were skipped. Use "kenso api-requests list" for history.`);
11103
+ break;
11104
+ }
11105
+ } while (cursor2 && !ctx.signal.aborted);
11106
+ fresh.sort((a, b) => Date.parse(a.occurredAt) - Date.parse(b.occurredAt) || a.id - b.id);
11107
+ for (const row of fresh) {
11108
+ if (printed.has(row.id)) continue;
11109
+ const at = Date.parse(row.occurredAt);
11110
+ printed.set(row.id, at);
11111
+ if (newest === void 0 || at > newest) newest = at;
11112
+ if (isOwnPoll(row)) continue;
11113
+ ctx.output.writeRaw(`${asJson ? JSON.stringify(row) : readable(row)}
11114
+ `);
11115
+ }
11116
+ if (newest !== void 0) {
11117
+ for (const [id, at] of printed) if (at < newest - OVERLAP_MS) printed.delete(id);
11118
+ }
11119
+ };
11120
+ let first = true;
11121
+ let backoffMs = intervalMs;
11122
+ while (!ctx.signal.aborted) {
11123
+ try {
11124
+ await pollOnce();
11125
+ first = false;
11126
+ backoffMs = intervalMs;
11127
+ } catch (err) {
11128
+ if (ctx.signal.aborted) break;
11129
+ if (first && err instanceof KensoError && err.httpStatus === 404 && err.field === void 0) {
11130
+ throw new KensoError({ code: "not_found", message: "Request logs are not on for this workspace yet.", exitCode: ExitCode.NotFound, httpStatus: 404 });
11131
+ }
11132
+ if (!survivable(err)) throw err;
11133
+ backoffMs = err instanceof KensoError && err.exitCode === ExitCode.RateLimited ? Math.max(intervalMs, RATE_LIMITED_WAIT_MS) : intervalMs;
11134
+ ctx.output.warn(`Polling failed (${err.message}); trying again in ${backoffMs / 1e3} s.`);
11135
+ }
11136
+ await delay5(backoffMs, void 0, { signal: ctx.signal }).catch(() => void 0);
11137
+ }
11138
+ return ExitCode.Ok;
11139
+ }
11140
+ };
11141
+ tail_default = command17;
11142
+ }
11143
+ });
11144
+
11145
+ // src/commands/logs/index.ts
11146
+ var actions12;
11147
+ var init_logs = __esm({
11148
+ "src/commands/logs/index.ts"() {
11149
+ "use strict";
11150
+ actions12 = {
11151
+ tail: () => Promise.resolve().then(() => (init_tail(), tail_exports)).then((m) => m.default)
11152
+ };
11153
+ }
11154
+ });
11155
+
10951
11156
  // src/commands/mcp/connect.ts
10952
11157
  function mcpUrl(ctx) {
10953
11158
  return ctx.env.KENSO_MCP_URL?.trim() || DEFAULT_MCP_URL;
@@ -10998,7 +11203,7 @@ function isRecord6(value) {
10998
11203
  function textOf(result) {
10999
11204
  return (result.content ?? []).filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text).join("\n");
11000
11205
  }
11001
- var command16, call_default;
11206
+ var command18, call_default;
11002
11207
  var init_call = __esm({
11003
11208
  "src/commands/mcp/call.ts"() {
11004
11209
  "use strict";
@@ -11006,7 +11211,7 @@ var init_call = __esm({
11006
11211
  init_exit_codes();
11007
11212
  init_input();
11008
11213
  init_connect();
11009
- command16 = {
11214
+ command18 = {
11010
11215
  resource: "mcp",
11011
11216
  action: "call",
11012
11217
  summary: "Call a hosted Kenso MCP tool, such as list_skills",
@@ -11059,7 +11264,7 @@ var init_call = __esm({
11059
11264
  return ExitCode.Ok;
11060
11265
  }
11061
11266
  };
11062
- call_default = command16;
11267
+ call_default = command18;
11063
11268
  }
11064
11269
  });
11065
11270
 
@@ -11068,13 +11273,13 @@ var tools_exports = {};
11068
11273
  __export(tools_exports, {
11069
11274
  default: () => tools_default
11070
11275
  });
11071
- var command17, tools_default;
11276
+ var command19, tools_default;
11072
11277
  var init_tools = __esm({
11073
11278
  "src/commands/mcp/tools.ts"() {
11074
11279
  "use strict";
11075
11280
  init_exit_codes();
11076
11281
  init_connect();
11077
- command17 = {
11282
+ command19 = {
11078
11283
  resource: "mcp",
11079
11284
  action: "tools",
11080
11285
  summary: "List the hosted Kenso MCP's tools",
@@ -11089,16 +11294,16 @@ var init_tools = __esm({
11089
11294
  return ExitCode.Ok;
11090
11295
  }
11091
11296
  };
11092
- tools_default = command17;
11297
+ tools_default = command19;
11093
11298
  }
11094
11299
  });
11095
11300
 
11096
11301
  // src/commands/mcp/index.ts
11097
- var actions11;
11302
+ var actions13;
11098
11303
  var init_mcp = __esm({
11099
11304
  "src/commands/mcp/index.ts"() {
11100
11305
  "use strict";
11101
- actions11 = {
11306
+ actions13 = {
11102
11307
  call: () => Promise.resolve().then(() => (init_call(), call_exports)).then((m) => m.default),
11103
11308
  tools: () => Promise.resolve().then(() => (init_tools(), tools_exports)).then((m) => m.default)
11104
11309
  };
@@ -11110,14 +11315,14 @@ var stage_history_exports = {};
11110
11315
  __export(stage_history_exports, {
11111
11316
  default: () => stage_history_default
11112
11317
  });
11113
- var command18, stage_history_default;
11318
+ var command20, stage_history_default;
11114
11319
  var init_stage_history = __esm({
11115
11320
  "src/commands/opportunities/stage-history.ts"() {
11116
11321
  "use strict";
11117
11322
  init_errors();
11118
11323
  init_exit_codes();
11119
11324
  init_http();
11120
- command18 = {
11325
+ command20 = {
11121
11326
  resource: "opportunities",
11122
11327
  action: "stage-history",
11123
11328
  summary: "Show a deal's stage history: each stage, when, who moved it and how long it sat there",
@@ -11141,16 +11346,16 @@ var init_stage_history = __esm({
11141
11346
  return ExitCode.Ok;
11142
11347
  }
11143
11348
  };
11144
- stage_history_default = command18;
11349
+ stage_history_default = command20;
11145
11350
  }
11146
11351
  });
11147
11352
 
11148
11353
  // src/commands/opportunities/index.ts
11149
- var actions12;
11354
+ var actions14;
11150
11355
  var init_opportunities = __esm({
11151
11356
  "src/commands/opportunities/index.ts"() {
11152
11357
  "use strict";
11153
- actions12 = {
11358
+ actions14 = {
11154
11359
  "stage-history": () => Promise.resolve().then(() => (init_stage_history(), stage_history_exports)).then((m) => m.default)
11155
11360
  };
11156
11361
  }
@@ -11227,7 +11432,7 @@ function summarize3(results) {
11227
11432
  }
11228
11433
  return { matched, addedToAccounts, emailFindsQueued };
11229
11434
  }
11230
- var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command19, import_default3;
11435
+ var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command21, import_default3;
11231
11436
  var init_import3 = __esm({
11232
11437
  "src/commands/people/import.ts"() {
11233
11438
  "use strict";
@@ -11259,7 +11464,7 @@ var init_import3 = __esm({
11259
11464
  };
11260
11465
  PERSON_FIELDS = ["email", "fullName", "firstName", "lastName", "linkedinUrl", "title"];
11261
11466
  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 = {
11467
+ command21 = {
11263
11468
  resource: "people",
11264
11469
  action: "import",
11265
11470
  summary: "Create or match people from a CSV or JSONL file, optionally onto accounts",
@@ -11324,16 +11529,16 @@ var init_import3 = __esm({
11324
11529
  return outcome.exitCode;
11325
11530
  }
11326
11531
  };
11327
- import_default3 = command19;
11532
+ import_default3 = command21;
11328
11533
  }
11329
11534
  });
11330
11535
 
11331
11536
  // src/commands/people/index.ts
11332
- var actions13;
11537
+ var actions15;
11333
11538
  var init_people = __esm({
11334
11539
  "src/commands/people/index.ts"() {
11335
11540
  "use strict";
11336
- actions13 = {
11541
+ actions15 = {
11337
11542
  import: () => Promise.resolve().then(() => (init_import3(), import_exports3)).then((m) => m.default)
11338
11543
  };
11339
11544
  }
@@ -11344,14 +11549,14 @@ var list_exports = {};
11344
11549
  __export(list_exports, {
11345
11550
  default: () => list_default
11346
11551
  });
11347
- var command20, list_default;
11552
+ var command22, list_default;
11348
11553
  var init_list = __esm({
11349
11554
  "src/commands/runs/list.ts"() {
11350
11555
  "use strict";
11351
11556
  init_runs();
11352
11557
  init_errors();
11353
11558
  init_exit_codes();
11354
- command20 = {
11559
+ command22 = {
11355
11560
  resource: "runs",
11356
11561
  action: "list",
11357
11562
  summary: "List batch runs, newest first (finds an interrupted run)",
@@ -11372,7 +11577,7 @@ var init_list = __esm({
11372
11577
  return ExitCode.Ok;
11373
11578
  }
11374
11579
  };
11375
- list_default = command20;
11580
+ list_default = command22;
11376
11581
  }
11377
11582
  });
11378
11583
 
@@ -11383,7 +11588,7 @@ __export(show_exports, {
11383
11588
  });
11384
11589
  import { existsSync as existsSync6, readFileSync as readFileSync9 } from "node:fs";
11385
11590
  import { join as join12 } from "node:path";
11386
- var FILES, command21, show_default;
11591
+ var FILES, command23, show_default;
11387
11592
  var init_show = __esm({
11388
11593
  "src/commands/runs/show.ts"() {
11389
11594
  "use strict";
@@ -11398,7 +11603,7 @@ var init_show = __esm({
11398
11603
  ["plan", "plan.json"],
11399
11604
  ["summary", "summary.json"]
11400
11605
  ];
11401
- command21 = {
11606
+ command23 = {
11402
11607
  resource: "runs",
11403
11608
  action: "show",
11404
11609
  summary: "Show one batch run and its files",
@@ -11425,7 +11630,7 @@ var init_show = __esm({
11425
11630
  return ExitCode.Ok;
11426
11631
  }
11427
11632
  };
11428
- show_default = command21;
11633
+ show_default = command23;
11429
11634
  }
11430
11635
  });
11431
11636
 
@@ -11484,14 +11689,14 @@ function resumeArgv(run, globals = {}) {
11484
11689
  async function sha256(path) {
11485
11690
  return createHash5("sha256").update(await readFile9(path)).digest("hex");
11486
11691
  }
11487
- var SKIPPED_KEYS, command22, resume_default;
11692
+ var SKIPPED_KEYS, command24, resume_default;
11488
11693
  var init_resume = __esm({
11489
11694
  "src/commands/runs/resume.ts"() {
11490
11695
  "use strict";
11491
11696
  init_runs();
11492
11697
  init_errors();
11493
11698
  SKIPPED_KEYS = /* @__PURE__ */ new Set(["positionals", "yes", "dryRun", "dry-run", "help", "version"]);
11494
- command22 = {
11699
+ command24 = {
11495
11700
  resource: "runs",
11496
11701
  action: "resume",
11497
11702
  summary: "Continue an interrupted batch run (its command with --yes, no dry run)",
@@ -11546,16 +11751,16 @@ var init_resume = __esm({
11546
11751
  }
11547
11752
  }
11548
11753
  };
11549
- resume_default = command22;
11754
+ resume_default = command24;
11550
11755
  }
11551
11756
  });
11552
11757
 
11553
11758
  // src/commands/runs/index.ts
11554
- var actions14;
11759
+ var actions16;
11555
11760
  var init_runs2 = __esm({
11556
11761
  "src/commands/runs/index.ts"() {
11557
11762
  "use strict";
11558
- actions14 = {
11763
+ actions16 = {
11559
11764
  list: () => Promise.resolve().then(() => (init_list(), list_exports)).then((m) => m.default),
11560
11765
  show: () => Promise.resolve().then(() => (init_show(), show_exports)).then((m) => m.default),
11561
11766
  resume: () => Promise.resolve().then(() => (init_resume(), resume_exports)).then((m) => m.default)
@@ -11654,7 +11859,7 @@ var create_exports = {};
11654
11859
  __export(create_exports, {
11655
11860
  default: () => create_default
11656
11861
  });
11657
- var command23, create_default;
11862
+ var command25, create_default;
11658
11863
  var init_create = __esm({
11659
11864
  "src/commands/sandbox/create.ts"() {
11660
11865
  "use strict";
@@ -11662,7 +11867,7 @@ var init_create = __esm({
11662
11867
  init_exit_codes();
11663
11868
  init_http();
11664
11869
  init_shared();
11665
- command23 = {
11870
+ command25 = {
11666
11871
  resource: "sandbox",
11667
11872
  action: "create",
11668
11873
  summary: "Create your developer sandbox and save its test key as the sandbox profile",
@@ -11704,7 +11909,7 @@ var init_create = __esm({
11704
11909
  return ExitCode.Ok;
11705
11910
  }
11706
11911
  };
11707
- create_default = command23;
11912
+ create_default = command25;
11708
11913
  }
11709
11914
  });
11710
11915
 
@@ -11713,7 +11918,7 @@ var delete_exports = {};
11713
11918
  __export(delete_exports, {
11714
11919
  default: () => delete_default
11715
11920
  });
11716
- var command24, delete_default;
11921
+ var command26, delete_default;
11717
11922
  var init_delete = __esm({
11718
11923
  "src/commands/sandbox/delete.ts"() {
11719
11924
  "use strict";
@@ -11721,7 +11926,7 @@ var init_delete = __esm({
11721
11926
  init_confirm();
11722
11927
  init_exit_codes();
11723
11928
  init_shared();
11724
- command24 = {
11929
+ command26 = {
11725
11930
  resource: "sandbox",
11726
11931
  action: "delete",
11727
11932
  summary: "Delete your sandbox and its test keys",
@@ -11748,7 +11953,7 @@ var init_delete = __esm({
11748
11953
  return ExitCode.Ok;
11749
11954
  }
11750
11955
  };
11751
- delete_default = command24;
11956
+ delete_default = command26;
11752
11957
  }
11753
11958
  });
11754
11959
 
@@ -11757,14 +11962,14 @@ var key_exports = {};
11757
11962
  __export(key_exports, {
11758
11963
  default: () => key_default
11759
11964
  });
11760
- var command25, key_default;
11965
+ var command27, key_default;
11761
11966
  var init_key = __esm({
11762
11967
  "src/commands/sandbox/key.ts"() {
11763
11968
  "use strict";
11764
11969
  init_exit_codes();
11765
11970
  init_http();
11766
11971
  init_shared();
11767
- command25 = {
11972
+ command27 = {
11768
11973
  resource: "sandbox",
11769
11974
  action: "key",
11770
11975
  summary: "Create a new test key for your sandbox and save it as the sandbox profile",
@@ -11784,7 +11989,7 @@ var init_key = __esm({
11784
11989
  return ExitCode.Ok;
11785
11990
  }
11786
11991
  };
11787
- key_default = command25;
11992
+ key_default = command27;
11788
11993
  }
11789
11994
  });
11790
11995
 
@@ -11793,13 +11998,13 @@ var list_exports2 = {};
11793
11998
  __export(list_exports2, {
11794
11999
  default: () => list_default2
11795
12000
  });
11796
- var command26, list_default2;
12001
+ var command28, list_default2;
11797
12002
  var init_list2 = __esm({
11798
12003
  "src/commands/sandbox/list.ts"() {
11799
12004
  "use strict";
11800
12005
  init_exit_codes();
11801
12006
  init_shared();
11802
- command26 = {
12007
+ command28 = {
11803
12008
  resource: "sandbox",
11804
12009
  action: "list",
11805
12010
  summary: "List your developer sandbox",
@@ -11815,7 +12020,7 @@ var init_list2 = __esm({
11815
12020
  return ExitCode.Ok;
11816
12021
  }
11817
12022
  };
11818
- list_default2 = command26;
12023
+ list_default2 = command28;
11819
12024
  }
11820
12025
  });
11821
12026
 
@@ -11824,14 +12029,14 @@ var reset_exports = {};
11824
12029
  __export(reset_exports, {
11825
12030
  default: () => reset_default
11826
12031
  });
11827
- var command27, reset_default;
12032
+ var command29, reset_default;
11828
12033
  var init_reset = __esm({
11829
12034
  "src/commands/sandbox/reset.ts"() {
11830
12035
  "use strict";
11831
12036
  init_exit_codes();
11832
12037
  init_http();
11833
12038
  init_shared();
11834
- command27 = {
12039
+ command29 = {
11835
12040
  resource: "sandbox",
11836
12041
  action: "reset",
11837
12042
  summary: "Reset your sandbox to its seed data",
@@ -11849,16 +12054,16 @@ var init_reset = __esm({
11849
12054
  return ExitCode.Ok;
11850
12055
  }
11851
12056
  };
11852
- reset_default = command27;
12057
+ reset_default = command29;
11853
12058
  }
11854
12059
  });
11855
12060
 
11856
12061
  // src/commands/sandbox/index.ts
11857
- var actions15;
12062
+ var actions17;
11858
12063
  var init_sandbox2 = __esm({
11859
12064
  "src/commands/sandbox/index.ts"() {
11860
12065
  "use strict";
11861
- actions15 = {
12066
+ actions17 = {
11862
12067
  create: () => Promise.resolve().then(() => (init_create(), create_exports)).then((m) => m.default),
11863
12068
  delete: () => Promise.resolve().then(() => (init_delete(), delete_exports)).then((m) => m.default),
11864
12069
  key: () => Promise.resolve().then(() => (init_key(), key_exports)).then((m) => m.default),
@@ -11869,11 +12074,11 @@ var init_sandbox2 = __esm({
11869
12074
  });
11870
12075
 
11871
12076
  // src/commands/skill/index.ts
11872
- var actions16;
12077
+ var actions18;
11873
12078
  var init_skill = __esm({
11874
12079
  "src/commands/skill/index.ts"() {
11875
12080
  "use strict";
11876
- actions16 = {
12081
+ actions18 = {
11877
12082
  install: () => Promise.resolve().then(() => (init_install(), install_exports)).then((m) => m.default)
11878
12083
  };
11879
12084
  }
@@ -12109,7 +12314,7 @@ __export(pull_exports, {
12109
12314
  });
12110
12315
  import { mkdir, writeFile as writeFile4 } from "node:fs/promises";
12111
12316
  import { dirname as dirname2, resolve as resolve11 } from "node:path";
12112
- var command28, pull_default;
12317
+ var command30, pull_default;
12113
12318
  var init_pull = __esm({
12114
12319
  "src/commands/studio/pull.ts"() {
12115
12320
  "use strict";
@@ -12119,7 +12324,7 @@ var init_pull = __esm({
12119
12324
  init_common2();
12120
12325
  init_folder();
12121
12326
  init_transfer();
12122
- command28 = {
12327
+ command30 = {
12123
12328
  resource: "studio",
12124
12329
  action: "pull",
12125
12330
  summary: "Write a template version's files to a folder",
@@ -12166,7 +12371,7 @@ var init_pull = __esm({
12166
12371
  return ExitCode.Ok;
12167
12372
  }
12168
12373
  };
12169
- pull_default = command28;
12374
+ pull_default = command30;
12170
12375
  }
12171
12376
  });
12172
12377
 
@@ -12199,7 +12404,7 @@ var push_exports = {};
12199
12404
  __export(push_exports, {
12200
12405
  default: () => push_default
12201
12406
  });
12202
- var BUILT_BY, DEFAULT_MESSAGE, command29, push_default;
12407
+ var BUILT_BY, DEFAULT_MESSAGE, command31, push_default;
12203
12408
  var init_push = __esm({
12204
12409
  "src/commands/studio/push.ts"() {
12205
12410
  "use strict";
@@ -12211,7 +12416,7 @@ var init_push = __esm({
12211
12416
  init_read();
12212
12417
  BUILT_BY = "customer_agent";
12213
12418
  DEFAULT_MESSAGE = "Pushed with the Kenso CLI";
12214
- command29 = {
12419
+ command31 = {
12215
12420
  resource: "studio",
12216
12421
  action: "push",
12217
12422
  summary: "Save a folder's files to a template's draft and print the validation",
@@ -12303,7 +12508,7 @@ var init_push = __esm({
12303
12508
  );
12304
12509
  }
12305
12510
  };
12306
- push_default = command29;
12511
+ push_default = command31;
12307
12512
  }
12308
12513
  });
12309
12514
 
@@ -12312,7 +12517,7 @@ var validate_exports = {};
12312
12517
  __export(validate_exports, {
12313
12518
  default: () => validate_default
12314
12519
  });
12315
- var command30, validate_default;
12520
+ var command32, validate_default;
12316
12521
  var init_validate = __esm({
12317
12522
  "src/commands/studio/validate.ts"() {
12318
12523
  "use strict";
@@ -12321,7 +12526,7 @@ var init_validate = __esm({
12321
12526
  init_columns();
12322
12527
  init_common2();
12323
12528
  init_read();
12324
- command30 = {
12529
+ command32 = {
12325
12530
  resource: "studio",
12326
12531
  action: "validate",
12327
12532
  summary: "Validate a folder's files against a template without saving them",
@@ -12350,7 +12555,7 @@ var init_validate = __esm({
12350
12555
  throw validationFailed(validation, "The files have validation errors", commandLine2(ctx, "studio validate", args));
12351
12556
  }
12352
12557
  };
12353
- validate_default = command30;
12558
+ validate_default = command32;
12354
12559
  }
12355
12560
  });
12356
12561
 
@@ -12399,7 +12604,7 @@ function accountIds(value) {
12399
12604
  }
12400
12605
  return ids2.map(Number);
12401
12606
  }
12402
- var SHOWN, command31, preview_default;
12607
+ var SHOWN, command33, preview_default;
12403
12608
  var init_preview = __esm({
12404
12609
  "src/commands/studio/preview.ts"() {
12405
12610
  "use strict";
@@ -12411,7 +12616,7 @@ var init_preview = __esm({
12411
12616
  init_common2();
12412
12617
  init_folder();
12413
12618
  SHOWN = 5;
12414
- command31 = {
12619
+ command33 = {
12415
12620
  resource: "studio",
12416
12621
  action: "preview",
12417
12622
  summary: "Render a saved version for up to 3 accounts; for local edits, studio push them to the draft first",
@@ -12460,12 +12665,12 @@ var init_preview = __esm({
12460
12665
  return ExitCode.Ok;
12461
12666
  }
12462
12667
  };
12463
- preview_default = command31;
12668
+ preview_default = command33;
12464
12669
  }
12465
12670
  });
12466
12671
 
12467
12672
  // src/commands/studio/fill-runs.ts
12468
- import { setTimeout as delay5 } from "node:timers/promises";
12673
+ import { setTimeout as delay6 } from "node:timers/promises";
12469
12674
  async function estimateFill(ctx, templateId, count) {
12470
12675
  const parts2 = [];
12471
12676
  for (let left = count; left > 0; left -= RUN_SIZE) {
@@ -12497,7 +12702,7 @@ async function estimateFill(ctx, templateId, count) {
12497
12702
  async function waitForRun(client, runId, opts) {
12498
12703
  const sleep = opts.sleep ?? (async (ms) => {
12499
12704
  try {
12500
- await delay5(ms, void 0, { signal: opts.signal });
12705
+ await delay6(ms, void 0, { signal: opts.signal });
12501
12706
  } catch (err) {
12502
12707
  if (opts.signal.aborted) throw new KensoError({ code: "interrupted", message: "Interrupted.", exitCode: ExitCode.Interrupted });
12503
12708
  throw err;
@@ -12661,7 +12866,7 @@ function estimateOutput(templateId, target, estimate2) {
12661
12866
  ...target.campaignId !== void 0 ? { estimateNote: "An upper bound: it counts one page per lead, and a campaign run builds one page per company." } : {}
12662
12867
  };
12663
12868
  }
12664
- var COMMAND6, sha2562, command32, fill_default;
12869
+ var COMMAND6, sha2562, command34, fill_default;
12665
12870
  var init_fill = __esm({
12666
12871
  "src/commands/studio/fill.ts"() {
12667
12872
  "use strict";
@@ -12677,7 +12882,7 @@ var init_fill = __esm({
12677
12882
  init_fill_runs();
12678
12883
  COMMAND6 = "studio fill";
12679
12884
  sha2562 = (data) => createHash8("sha256").update(data).digest("hex");
12680
- command32 = {
12885
+ command34 = {
12681
12886
  resource: "studio",
12682
12887
  action: "fill",
12683
12888
  summary: "Fill a template on many accounts or campaign leads (estimate first)",
@@ -12737,16 +12942,16 @@ var init_fill = __esm({
12737
12942
  return outcome.exitCode;
12738
12943
  }
12739
12944
  };
12740
- fill_default = command32;
12945
+ fill_default = command34;
12741
12946
  }
12742
12947
  });
12743
12948
 
12744
12949
  // src/commands/studio/index.ts
12745
- var actions17;
12950
+ var actions19;
12746
12951
  var init_studio2 = __esm({
12747
12952
  "src/commands/studio/index.ts"() {
12748
12953
  "use strict";
12749
- actions17 = {
12954
+ actions19 = {
12750
12955
  pull: () => Promise.resolve().then(() => (init_pull(), pull_exports)).then((m) => m.default),
12751
12956
  push: () => Promise.resolve().then(() => (init_push(), push_exports)).then((m) => m.default),
12752
12957
  validate: () => Promise.resolve().then(() => (init_validate(), validate_exports)).then((m) => m.default),
@@ -12852,7 +13057,7 @@ __export(listen_exports, {
12852
13057
  liveBody: () => liveBody
12853
13058
  });
12854
13059
  import { randomBytes as randomBytes3 } from "node:crypto";
12855
- import { setTimeout as delay6 } from "node:timers/promises";
13060
+ import { setTimeout as delay7 } from "node:timers/promises";
12856
13061
  function eventTypes(value) {
12857
13062
  const list2 = Array.isArray(value) ? value : typeof value === "string" ? [value] : [];
12858
13063
  return list2.flatMap((item) => item.split(",")).map((item) => item.trim()).filter((item) => item !== "");
@@ -12863,7 +13068,7 @@ function liveBody(event, workspaceId) {
12863
13068
  const envelope = { eventType: event.name ?? "", eventId: event.eventId ?? "", timestamp: event.timestamp ?? "", ...clientId };
12864
13069
  return { ...envelope, ...data, ...envelope };
12865
13070
  }
12866
- function survivable(err) {
13071
+ function survivable2(err) {
12867
13072
  if (!(err instanceof KensoError)) return false;
12868
13073
  const fatal = [ExitCode.Auth, ExitCode.Usage, ExitCode.NotFound];
12869
13074
  return !fatal.includes(err.exitCode);
@@ -12888,7 +13093,7 @@ function readBody(req) {
12888
13093
  function reply(res, status, body) {
12889
13094
  res.writeHead(status, { "content-type": "application/json" }).end(JSON.stringify(body));
12890
13095
  }
12891
- var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command33, listen_default;
13096
+ var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command35, listen_default;
12892
13097
  var init_listen = __esm({
12893
13098
  "src/commands/webhooks/listen.ts"() {
12894
13099
  "use strict";
@@ -12899,7 +13104,7 @@ var init_listen = __esm({
12899
13104
  MIN_POLL_MS = 1e3;
12900
13105
  MAX_POLL_MS = 6e4;
12901
13106
  MAX_TRIGGER_BYTES = 1e6;
12902
- command33 = {
13107
+ command35 = {
12903
13108
  resource: "webhooks",
12904
13109
  action: "listen",
12905
13110
  summary: "Stream the workspace's events and forward them, signed, to a local handler",
@@ -12952,7 +13157,7 @@ var init_listen = __esm({
12952
13157
  if (err instanceof KensoError && err.httpStatus === 404 && err.field === void 0) {
12953
13158
  live = false;
12954
13159
  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)) {
13160
+ } else if (!ctx.signal.aborted && survivable2(err)) {
12956
13161
  ctx.output.warn(`Polling failed (${err.message}); trying again.`);
12957
13162
  } else {
12958
13163
  throw err;
@@ -12988,11 +13193,11 @@ var init_listen = __esm({
12988
13193
  cursor2 = page.cursor ?? cursor2;
12989
13194
  waitMs = page.hasMore ? 0 : Math.min(MAX_POLL_MS, Math.max(MIN_POLL_MS, page.nextPollMs ?? MAX_POLL_MS));
12990
13195
  } catch (err) {
12991
- if (ctx.signal.aborted || !survivable(err)) throw err;
13196
+ if (ctx.signal.aborted || !survivable2(err)) throw err;
12992
13197
  ctx.output.warn(`Polling failed (${err.message}); trying again in ${MAX_POLL_MS / 1e3} s.`);
12993
13198
  }
12994
13199
  }
12995
- await delay6(waitMs, void 0, { signal: ctx.signal }).catch(() => void 0);
13200
+ await delay7(waitMs, void 0, { signal: ctx.signal }).catch(() => void 0);
12996
13201
  }
12997
13202
  } catch (err) {
12998
13203
  if (!ctx.signal.aborted) throw err;
@@ -13005,7 +13210,7 @@ var init_listen = __esm({
13005
13210
  return ExitCode.Ok;
13006
13211
  }
13007
13212
  };
13008
- listen_default = command33;
13213
+ listen_default = command35;
13009
13214
  }
13010
13215
  });
13011
13216
 
@@ -13024,7 +13229,7 @@ function notRunning() {
13024
13229
  next: LISTEN_NEXT
13025
13230
  });
13026
13231
  }
13027
- var LISTEN_NEXT, command34, trigger_default;
13232
+ var LISTEN_NEXT, command36, trigger_default;
13028
13233
  var init_trigger = __esm({
13029
13234
  "src/commands/webhooks/trigger.ts"() {
13030
13235
  "use strict";
@@ -13033,7 +13238,7 @@ var init_trigger = __esm({
13033
13238
  init_http();
13034
13239
  init_local();
13035
13240
  LISTEN_NEXT = "kenso webhooks listen --forward-to http://localhost:3000/hook";
13036
- command34 = {
13241
+ command36 = {
13037
13242
  resource: "webhooks",
13038
13243
  action: "trigger",
13039
13244
  summary: "Send a sample event of one type through the running kenso webhooks listen",
@@ -13090,16 +13295,16 @@ var init_trigger = __esm({
13090
13295
  return ExitCode.Ok;
13091
13296
  }
13092
13297
  };
13093
- trigger_default = command34;
13298
+ trigger_default = command36;
13094
13299
  }
13095
13300
  });
13096
13301
 
13097
13302
  // src/commands/webhooks/index.ts
13098
- var actions18;
13303
+ var actions20;
13099
13304
  var init_webhooks2 = __esm({
13100
13305
  "src/commands/webhooks/index.ts"() {
13101
13306
  "use strict";
13102
- actions18 = {
13307
+ actions20 = {
13103
13308
  listen: () => Promise.resolve().then(() => (init_listen(), listen_exports)).then((m) => m.default),
13104
13309
  trigger: () => Promise.resolve().then(() => (init_trigger(), trigger_exports)).then((m) => m.default)
13105
13310
  };
@@ -13109,14 +13314,14 @@ var init_webhooks2 = __esm({
13109
13314
  // src/commands/work/common.ts
13110
13315
  import { randomUUID as randomUUID2 } from "node:crypto";
13111
13316
  import { join as join16 } from "node:path";
13112
- import { setTimeout as delay7 } from "node:timers/promises";
13317
+ import { setTimeout as delay8 } from "node:timers/promises";
13113
13318
  function unavailable(err) {
13114
13319
  return err instanceof KensoError && (err.code === "network_error" || err.httpStatus === 502 || err.httpStatus === 503 || err.httpStatus === 504);
13115
13320
  }
13116
13321
  async function pause2(ms, signal) {
13117
13322
  if (signal.aborted) return false;
13118
13323
  try {
13119
- await delay7(ms, void 0, { signal });
13324
+ await delay8(ms, void 0, { signal });
13120
13325
  return true;
13121
13326
  } catch {
13122
13327
  return false;
@@ -13290,18 +13495,18 @@ var init_common3 = __esm({
13290
13495
  });
13291
13496
 
13292
13497
  // src/commands/work/status.ts
13293
- var status_exports2 = {};
13294
- __export(status_exports2, {
13295
- default: () => status_default2
13498
+ var status_exports3 = {};
13499
+ __export(status_exports3, {
13500
+ default: () => status_default3
13296
13501
  });
13297
- var command35, status_default2;
13298
- var init_status2 = __esm({
13502
+ var command37, status_default3;
13503
+ var init_status3 = __esm({
13299
13504
  "src/commands/work/status.ts"() {
13300
13505
  "use strict";
13301
13506
  init_exit_codes();
13302
13507
  init_http();
13303
13508
  init_common3();
13304
- command35 = {
13509
+ command37 = {
13305
13510
  resource: "work",
13306
13511
  action: "status",
13307
13512
  summary: "Show the Kenso AI work waiting for your own agent, per kind",
@@ -13335,7 +13540,7 @@ var init_status2 = __esm({
13335
13540
  return ExitCode.Ok;
13336
13541
  }
13337
13542
  };
13338
- status_default2 = command35;
13543
+ status_default3 = command37;
13339
13544
  }
13340
13545
  });
13341
13546
 
@@ -13467,9 +13672,9 @@ var init_files = __esm({
13467
13672
  import { execFile, spawnSync as spawnSync2 } from "node:child_process";
13468
13673
  import { readFileSync as readFileSync12 } from "node:fs";
13469
13674
  import { isAbsolute as isAbsolute2 } from "node:path";
13470
- function sudoArgs(user, command42, args, keep = [], set = {}) {
13675
+ function sudoArgs(user, command44, args, keep = [], set = {}) {
13471
13676
  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];
13677
+ return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command44, ...args];
13473
13678
  }
13474
13679
  function agentKensoEnv(opts) {
13475
13680
  return {
@@ -13479,12 +13684,12 @@ function agentKensoEnv(opts) {
13479
13684
  AI_AGENT: opts.agentName
13480
13685
  };
13481
13686
  }
13482
- function sudoExec(user, command42, args, opts = {}) {
13687
+ function sudoExec(user, command44, args, opts = {}) {
13483
13688
  const [sudo = "/usr/bin/sudo", ...lead] = user.sudo;
13484
13689
  return new Promise((resolve16) => {
13485
13690
  execFile(
13486
13691
  sudo,
13487
- [...lead, ...sudoArgs(user.name, command42, args)],
13692
+ [...lead, ...sudoArgs(user.name, command44, args)],
13488
13693
  { env: { PATH: SUDO_PATH }, cwd: "/", timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS, maxBuffer: opts.maxBuffer ?? 1024 * 1024, encoding: "utf8", windowsHide: true, shell: false },
13489
13694
  (err, stdout, stderr) => {
13490
13695
  const code = err ? err.code : 0;
@@ -13594,9 +13799,9 @@ var init_folder2 = __esm({
13594
13799
  init_redact();
13595
13800
  init_agent_user();
13596
13801
  WorkRunFolder = class {
13597
- constructor(ctx, command42, args, outDir, shared = false) {
13802
+ constructor(ctx, command44, args, outDir, shared = false) {
13598
13803
  this.ctx = ctx;
13599
- this.command = command42;
13804
+ this.command = command44;
13600
13805
  this.args = args;
13601
13806
  this.outDir = outDir;
13602
13807
  this.shared = shared;
@@ -13711,7 +13916,7 @@ var pull_exports2 = {};
13711
13916
  __export(pull_exports2, {
13712
13917
  default: () => pull_default2
13713
13918
  });
13714
- var MAX_FILES, command36, pull_default2;
13919
+ var MAX_FILES, command38, pull_default2;
13715
13920
  var init_pull2 = __esm({
13716
13921
  "src/commands/work/pull.ts"() {
13717
13922
  "use strict";
@@ -13720,7 +13925,7 @@ var init_pull2 = __esm({
13720
13925
  init_common3();
13721
13926
  init_folder2();
13722
13927
  MAX_FILES = 100;
13723
- command36 = {
13928
+ command38 = {
13724
13929
  resource: "work",
13725
13930
  action: "pull",
13726
13931
  summary: "Claim waiting work into local work files, to answer by hand",
@@ -13798,7 +14003,7 @@ var init_pull2 = __esm({
13798
14003
  return interrupted6 ? ExitCode.Interrupted : ExitCode.Ok;
13799
14004
  }
13800
14005
  };
13801
- pull_default2 = command36;
14006
+ pull_default2 = command38;
13802
14007
  }
13803
14008
  });
13804
14009
 
@@ -13940,7 +14145,7 @@ __export(submit_exports, {
13940
14145
  default: () => submit_default
13941
14146
  });
13942
14147
  import { resolve as resolve14 } from "node:path";
13943
- var command37, submit_default;
14148
+ var command39, submit_default;
13944
14149
  var init_submit = __esm({
13945
14150
  "src/commands/work/submit.ts"() {
13946
14151
  "use strict";
@@ -13949,7 +14154,7 @@ var init_submit = __esm({
13949
14154
  init_files();
13950
14155
  init_answers();
13951
14156
  init_common3();
13952
- command37 = {
14157
+ command39 = {
13953
14158
  resource: "work",
13954
14159
  action: "submit",
13955
14160
  summary: "Send answers files to Kenso and write each one's results",
@@ -13981,7 +14186,7 @@ var init_submit = __esm({
13981
14186
  return totals.rejected > 0 ? ExitCode.Partial : ExitCode.Ok;
13982
14187
  }
13983
14188
  };
13984
- submit_default = command37;
14189
+ submit_default = command39;
13985
14190
  }
13986
14191
  });
13987
14192
 
@@ -14002,7 +14207,7 @@ function claimIdOf(arg) {
14002
14207
  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
14208
  return arg;
14004
14209
  }
14005
- var CLAIM_ID, command38, release_default;
14210
+ var CLAIM_ID, command40, release_default;
14006
14211
  var init_release = __esm({
14007
14212
  "src/commands/work/release.ts"() {
14008
14213
  "use strict";
@@ -14011,7 +14216,7 @@ var init_release = __esm({
14011
14216
  init_files();
14012
14217
  init_common3();
14013
14218
  CLAIM_ID = /^[A-Za-z0-9_-]{1,64}$/;
14014
- command38 = {
14219
+ command40 = {
14015
14220
  resource: "work",
14016
14221
  action: "release",
14017
14222
  summary: "Give claimed work back to the queue now",
@@ -14030,7 +14235,7 @@ var init_release = __esm({
14030
14235
  return ExitCode.Ok;
14031
14236
  }
14032
14237
  };
14033
- release_default = command38;
14238
+ release_default = command40;
14034
14239
  }
14035
14240
  });
14036
14241
 
@@ -14039,7 +14244,7 @@ import { spawn as nodeSpawn2 } from "node:child_process";
14039
14244
  import { rmSync as rmSync3, statSync as statSync2 } from "node:fs";
14040
14245
  import { access, constants as constants2 } from "node:fs/promises";
14041
14246
  import { delimiter as delimiter2, join as join20 } from "node:path";
14042
- import { setTimeout as delay8 } from "node:timers/promises";
14247
+ import { setTimeout as delay9 } from "node:timers/promises";
14043
14248
  function childEnv(parent, adapter, extra) {
14044
14249
  const scrub = new Set(adapter.scrubEnv.map((name) => name.toUpperCase()));
14045
14250
  const env = {};
@@ -14132,7 +14337,7 @@ async function groupGone(pid, runAs) {
14132
14337
  while (Date.now() < deadline) {
14133
14338
  if (runAs) {
14134
14339
  if (!await sudoKill(runAs, "SIGKILL", pid)) return;
14135
- await delay8(100);
14340
+ await delay9(100);
14136
14341
  continue;
14137
14342
  }
14138
14343
  try {
@@ -14140,7 +14345,7 @@ async function groupGone(pid, runAs) {
14140
14345
  } catch {
14141
14346
  return;
14142
14347
  }
14143
- await delay8(25);
14348
+ await delay9(25);
14144
14349
  }
14145
14350
  }
14146
14351
  function runChild(spawnFn, bin, built, job, env, signal, runAs) {
@@ -14369,12 +14574,12 @@ function plain(text3) {
14369
14574
  return text3.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
14370
14575
  }
14371
14576
  function runStatus(bin, args, env, adapter, runAs) {
14372
- const command42 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
14577
+ const command44 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
14373
14578
  const commandArgs2 = runAs ? [...runAs.sudo.slice(1), ...sudoArgs(runAs.name, bin, args)] : args;
14374
14579
  const options = runAs ? { env: { PATH: SUDO_PATH }, cwd: "/" } : { env: childEnv(env, adapter) };
14375
14580
  return new Promise((resolve16) => {
14376
14581
  execFile2(
14377
- command42,
14582
+ command44,
14378
14583
  commandArgs2,
14379
14584
  { ...options, timeout: STATUS_TIMEOUT_MS, maxBuffer: 1024 * 1024, windowsHide: true, shell: false },
14380
14585
  (err, stdout, stderr) => {
@@ -15456,7 +15661,7 @@ var run_exports = {};
15456
15661
  __export(run_exports, {
15457
15662
  default: () => run_default
15458
15663
  });
15459
- var FAILURES_IN_A_ROW, command39, run_default;
15664
+ var FAILURES_IN_A_ROW, command41, run_default;
15460
15665
  var init_run = __esm({
15461
15666
  "src/commands/work/run.ts"() {
15462
15667
  "use strict";
@@ -15477,7 +15682,7 @@ var init_run = __esm({
15477
15682
  init_folder2();
15478
15683
  init_stop();
15479
15684
  FAILURES_IN_A_ROW = 3;
15480
- command39 = {
15685
+ command41 = {
15481
15686
  resource: "work",
15482
15687
  action: "run",
15483
15688
  summary: "Run your own coding agent on the waiting work until the queue is empty",
@@ -15802,17 +16007,17 @@ var init_run = __esm({
15802
16007
  return exitCodeFor(reason, totals.rejected > 0 || jobsFailed > 0);
15803
16008
  }
15804
16009
  };
15805
- run_default = command39;
16010
+ run_default = command41;
15806
16011
  }
15807
16012
  });
15808
16013
 
15809
16014
  // src/commands/work/index.ts
15810
- var actions19;
16015
+ var actions21;
15811
16016
  var init_work2 = __esm({
15812
16017
  "src/commands/work/index.ts"() {
15813
16018
  "use strict";
15814
- actions19 = {
15815
- status: () => Promise.resolve().then(() => (init_status2(), status_exports2)).then((m) => m.default),
16019
+ actions21 = {
16020
+ status: () => Promise.resolve().then(() => (init_status3(), status_exports3)).then((m) => m.default),
15816
16021
  pull: () => Promise.resolve().then(() => (init_pull2(), pull_exports2)).then((m) => m.default),
15817
16022
  submit: () => Promise.resolve().then(() => (init_submit(), submit_exports)).then((m) => m.default),
15818
16023
  release: () => Promise.resolve().then(() => (init_release(), release_exports)).then((m) => m.default),
@@ -15835,14 +16040,14 @@ function parseLimit(value) {
15835
16040
  }
15836
16041
  return limit;
15837
16042
  }
15838
- var MAX_LIMIT, command40, list_default3;
16043
+ var MAX_LIMIT, command42, list_default3;
15839
16044
  var init_list3 = __esm({
15840
16045
  "src/commands/workspace/list.ts"() {
15841
16046
  "use strict";
15842
16047
  init_errors();
15843
16048
  init_exit_codes();
15844
16049
  MAX_LIMIT = 200;
15845
- command40 = {
16050
+ command42 = {
15846
16051
  resource: "workspace",
15847
16052
  action: "list",
15848
16053
  summary: "List the workspaces your key can use",
@@ -15870,7 +16075,7 @@ var init_list3 = __esm({
15870
16075
  return ExitCode.Ok;
15871
16076
  }
15872
16077
  };
15873
- list_default3 = command40;
16078
+ list_default3 = command42;
15874
16079
  }
15875
16080
  });
15876
16081
 
@@ -15879,7 +16084,7 @@ var use_exports = {};
15879
16084
  __export(use_exports, {
15880
16085
  default: () => use_default
15881
16086
  });
15882
- var command41, use_default;
16087
+ var command43, use_default;
15883
16088
  var init_use = __esm({
15884
16089
  "src/commands/workspace/use.ts"() {
15885
16090
  "use strict";
@@ -15887,7 +16092,7 @@ var init_use = __esm({
15887
16092
  init_errors();
15888
16093
  init_exit_codes();
15889
16094
  init_http();
15890
- command41 = {
16095
+ command43 = {
15891
16096
  resource: "workspace",
15892
16097
  action: "use",
15893
16098
  summary: "Set the profile's default workspace",
@@ -15944,16 +16149,16 @@ var init_use = __esm({
15944
16149
  return ExitCode.Ok;
15945
16150
  }
15946
16151
  };
15947
- use_default = command41;
16152
+ use_default = command43;
15948
16153
  }
15949
16154
  });
15950
16155
 
15951
16156
  // src/commands/workspace/index.ts
15952
- var actions20;
16157
+ var actions22;
15953
16158
  var init_workspace = __esm({
15954
16159
  "src/commands/workspace/index.ts"() {
15955
16160
  "use strict";
15956
- actions20 = {
16161
+ actions22 = {
15957
16162
  list: () => Promise.resolve().then(() => (init_list3(), list_exports3)).then((m) => m.default),
15958
16163
  use: () => Promise.resolve().then(() => (init_use(), use_exports)).then((m) => m.default)
15959
16164
  };
@@ -15977,12 +16182,14 @@ var init_registry = __esm({
15977
16182
  init_agent2();
15978
16183
  init_api3();
15979
16184
  init_auth2();
16185
+ init_capture();
15980
16186
  init_completion2();
15981
16187
  init_contacts();
15982
16188
  init_describe2();
15983
16189
  init_docs2();
15984
16190
  init_doctor();
15985
16191
  init_jobs2();
16192
+ init_logs();
15986
16193
  init_mcp();
15987
16194
  init_opportunities();
15988
16195
  init_people();
@@ -15998,25 +16205,27 @@ var init_registry = __esm({
15998
16205
  agent: actions2,
15999
16206
  api: actions3,
16000
16207
  auth: actions4,
16001
- completion: actions5,
16002
- contacts: actions6,
16003
- describe: actions7,
16004
- docs: actions8,
16005
- doctor: actions9,
16006
- jobs: actions10,
16208
+ capture: actions5,
16209
+ completion: actions6,
16210
+ contacts: actions7,
16211
+ describe: actions8,
16212
+ docs: actions9,
16213
+ doctor: actions10,
16214
+ jobs: actions11,
16007
16215
  login: topLevel("login", actions4.login, "kenso auth login"),
16008
16216
  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,
16217
+ logs: actions12,
16218
+ mcp: actions13,
16219
+ opportunities: actions14,
16220
+ people: actions15,
16221
+ runs: actions16,
16222
+ sandbox: actions17,
16223
+ skill: actions18,
16224
+ studio: actions19,
16225
+ webhooks: actions20,
16017
16226
  whoami: topLevel("whoami", actions4.status, "kenso auth status"),
16018
- work: actions19,
16019
- workspace: actions20
16227
+ work: actions21,
16228
+ workspace: actions22
16020
16229
  };
16021
16230
  resourceAliases = { leads: "contacts" };
16022
16231
  }
@@ -16153,8 +16362,8 @@ async function renderTopHelp(opts) {
16153
16362
  names.push(withPositionals(spec, spec.action));
16154
16363
  groups.set(hint, names);
16155
16364
  }
16156
- const actions22 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
16157
- if (actions22.length > 0) rows.push([resource, actions22.join(", ")]);
16365
+ const actions24 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
16366
+ if (actions24.length > 0) rows.push([resource, actions24.join(", ")]);
16158
16367
  }
16159
16368
  const at = 4 + Math.min(22, Math.max(0, ...rows.map(([left]) => left.length)));
16160
16369
  lines.push(
@@ -16167,7 +16376,7 @@ async function renderTopHelp(opts) {
16167
16376
  const [area = "", action = ""] = name.split(" ");
16168
16377
  byArea.set(area, [...byArea.get(area) ?? [], action]);
16169
16378
  }
16170
- const named = [...byArea.entries()].map(([area, actions22]) => `${area} ${actions22.join("|")}`);
16379
+ const named = [...byArea.entries()].map(([area, actions24]) => `${area} ${actions24.join("|")}`);
16171
16380
  lines.push(wrap(`Beta, hidden here but they run (the server decides): ${named.join(", ")}.`, " "));
16172
16381
  }
16173
16382
  const generated = await listGenerated({ features: opts.allCommands ? [] : getFeatures, env: opts.env });
@@ -16175,13 +16384,13 @@ async function renderTopHelp(opts) {
16175
16384
  if (visible.length > 0) {
16176
16385
  const byResource = /* @__PURE__ */ new Map();
16177
16386
  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);
16387
+ const actions24 = byResource.get(g.resource) ?? [];
16388
+ actions24.push(`${g.action}${g.beta ? " (beta)" : ""}`);
16389
+ byResource.set(g.resource, actions24);
16181
16390
  }
16182
16391
  const sorted2 = [...byResource.entries()].sort(([a], [b]) => a.localeCompare(b));
16183
16392
  if (opts.allCommands) {
16184
- const generatedRows = sorted2.map(([resource, actions22]) => [resource, actions22.sort().join(", ")]);
16393
+ const generatedRows = sorted2.map(([resource, actions24]) => [resource, actions24.sort().join(", ")]);
16185
16394
  lines.push("", "API resources (kenso <resource> <action>):", columns(generatedRows));
16186
16395
  } else {
16187
16396
  const names = new Set(sorted2.map(([resource]) => resource));
@@ -16497,8 +16706,8 @@ function startUpdateNotice(argv, opts = {}) {
16497
16706
  if (!found) return;
16498
16707
  writeCheck(file, { checkedAt: new Date(now).toISOString(), latest: found });
16499
16708
  if (isNewer(found, version)) {
16500
- const command42 = updateCommand(install, opts.platform ?? process.platform);
16501
- stderr.write(`kenso ${found} is out (you have ${version}): ${command42}
16709
+ const command44 = updateCommand(install, opts.platform ?? process.platform);
16710
+ stderr.write(`kenso ${found} is out (you have ${version}): ${command44}
16502
16711
  Turn this off with KENSO_NO_UPDATE_NOTIFIER=1.
16503
16712
  `);
16504
16713
  }
@@ -16540,7 +16749,7 @@ function resources() {
16540
16749
  const names = Object.entries(handWritten).filter(([, area]) => Object.keys(area).length > 0).map(([resource]) => resource);
16541
16750
  return sorted([...names, ...Object.keys(resourceAliases), ...loadManifest().operations.map((op) => op.resource)]);
16542
16751
  }
16543
- function actions21(resource) {
16752
+ function actions23(resource) {
16544
16753
  const own = Object.keys(handWritten[resource] ?? {}).filter((action) => action !== "");
16545
16754
  return sorted([...own, ...loadManifest().operations.filter((op) => op.resource === resource).map((op) => op.action)]);
16546
16755
  }
@@ -16605,7 +16814,7 @@ async function completions(words, globals) {
16605
16814
  return flagsOf2(spec, globals, positionals.length === 0);
16606
16815
  }
16607
16816
  if (positionals.length === 0) return resources();
16608
- if (!spec) return positionals.length === 1 ? actions21(resourceAliases[positionals[0]] ?? positionals[0]) : [];
16817
+ if (!spec) return positionals.length === 1 ? actions23(resourceAliases[positionals[0]] ?? positionals[0]) : [];
16609
16818
  const given = positionals.length - commandWords;
16610
16819
  const declared = spec.positionals ?? [];
16611
16820
  if (given < declared.length || declared.at(-1)?.variadic === true) {
@@ -16699,9 +16908,9 @@ function normalizeBooleans(argv, names, strict) {
16699
16908
  async function knownCommands() {
16700
16909
  const commands = /* @__PURE__ */ new Set();
16701
16910
  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);
16911
+ const actions24 = Object.keys(area);
16912
+ if (actions24.length > 0) commands.add(resource);
16913
+ for (const action of actions24) commands.add(action ? `${resource} ${action}` : resource);
16705
16914
  }
16706
16915
  for (const g of await listGenerated({ features: [] })) {
16707
16916
  commands.add(g.resource);