kenso 0.1.57 → 0.1.58

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.57" : "0.0.0-dev";
2424
+ VERSION = true ? "0.1.58" : "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: command36, createdAt, status } = raw;
3717
+ const { runId, command: command37, createdAt, status } = raw;
3718
3718
  if (typeof runId !== "string" || !RUN_ID_PATTERN.test(runId)) return null;
3719
- if (typeof command36 !== "string" || typeof createdAt !== "string") return null;
3719
+ if (typeof command37 !== "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: command36,
3730
+ command: command37,
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(command36, args, inputSha256, env, workspaceId, anyWorkspace = false) {
3785
+ async function findIdentical(command37, 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 === command36 && (run.inputSha256 || void 0) === (inputSha256 || void 0) && (anyWorkspace || (run.workspaceId || void 0) === (workspaceId || void 0)) && argsIdentity(run.args) === identity
3789
+ (run) => run.command === command37 && (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, command36, args, extra = []) {
6942
- const parts2 = ["kenso", ...command36.split(" "), ...(args.positionals ?? []).map(shellQuote3)];
6941
+ function commandLine2(ctx, command37, args, extra = []) {
6942
+ const parts2 = ["kenso", ...command37.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| `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\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## 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) 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';
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\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## 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) 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
 
@@ -8385,8 +8385,8 @@ var init_browser_login = __esm({
8385
8385
  defaultDeps = {
8386
8386
  sleep: (ms, signal) => delay2(ms, void 0, signal ? { signal } : void 0),
8387
8387
  now: () => Date.now(),
8388
- spawn: (command36, args) => {
8389
- const child = nodeSpawn(command36, args, { detached: true, stdio: "ignore" });
8388
+ spawn: (command37, args) => {
8389
+ const child = nodeSpawn(command37, args, { detached: true, stdio: "ignore" });
8390
8390
  child.on("error", () => {
8391
8391
  });
8392
8392
  child.unref();
@@ -8810,9 +8810,9 @@ function stringFlag2(flags, name) {
8810
8810
  const text3 = value.trim();
8811
8811
  return text3 === "" ? void 0 : text3;
8812
8812
  }
8813
- function requireFlag(flags, name, command36, hint) {
8813
+ function requireFlag(flags, name, command37, hint) {
8814
8814
  const value = stringFlag2(flags, name);
8815
- if (value === void 0) throw usageError(`--${name} is required for ${command36}.`, { field: name, next: `${command36} --help`, ...hint ? { hint } : {} });
8815
+ if (value === void 0) throw usageError(`--${name} is required for ${command37}.`, { field: name, next: `${command37} --help`, ...hint ? { hint } : {} });
8816
8816
  return value;
8817
8817
  }
8818
8818
  function positiveId(value) {
@@ -8821,8 +8821,8 @@ function positiveId(value) {
8821
8821
  const id = Number(text3);
8822
8822
  return Number.isSafeInteger(id) && id > 0 ? id : void 0;
8823
8823
  }
8824
- function idFlag(flags, name, command36) {
8825
- const raw = requireFlag(flags, name, command36);
8824
+ function idFlag(flags, name, command37) {
8825
+ const raw = requireFlag(flags, name, command37);
8826
8826
  const id = positiveId(raw);
8827
8827
  if (id === void 0) throw usageError(`--${name} must be a positive whole number (got "${raw}").`, { field: name });
8828
8828
  return id;
@@ -8842,8 +8842,8 @@ function isDryRun(ctx) {
8842
8842
  function shellQuote4(value) {
8843
8843
  return /^[A-Za-z0-9_\-.,:/@=+%]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
8844
8844
  }
8845
- function sameCommand2(command36, flags, ctx, extra = []) {
8846
- const parts2 = [command36];
8845
+ function sameCommand2(command37, flags, ctx, extra = []) {
8846
+ const parts2 = [command37];
8847
8847
  for (const [name, value] of Object.entries(flags)) {
8848
8848
  if (value === void 0 || value === false) continue;
8849
8849
  if (value === true) parts2.push(`--${name}`);
@@ -9980,12 +9980,12 @@ import { join as join11 } from "node:path";
9980
9980
  function whereDir(env) {
9981
9981
  return join11(runsRoot(env), WHERE_DIR);
9982
9982
  }
9983
- async function unfinishedWhereIds(ctx, command36, args) {
9983
+ async function unfinishedWhereIds(ctx, command37, args) {
9984
9984
  const dir = whereDir(ctx.env);
9985
9985
  const identity = argsIdentity(args);
9986
9986
  const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
9987
9987
  for (const run of await listRuns(ctx.env)) {
9988
- if (run.command !== command36 || run.status === "done" || run.status === "planned") continue;
9988
+ if (run.command !== command37 || run.status === "done" || run.status === "planned") continue;
9989
9989
  if ((run.workspaceId || void 0) !== (workspaceId || void 0) || argsIdentity(run.args) !== identity) continue;
9990
9990
  if (run.inputPath?.startsWith(`${dir}/`) && existsSync5(run.inputPath)) return run.inputPath;
9991
9991
  }
@@ -10131,14 +10131,14 @@ async function idsFromRun(ctx, runId) {
10131
10131
  return { ...idItems(ids2), source: "run" };
10132
10132
  }
10133
10133
  async function collectIds(ctx, flags, kind, dryRun2) {
10134
- const command36 = `kenso contacts ${kind}`;
10134
+ const command37 = `kenso contacts ${kind}`;
10135
10135
  const ids2 = stringFlag2(flags, "ids");
10136
10136
  const where = kind === "restore" ? void 0 : stringFlag2(flags, "where");
10137
10137
  const run = kind === "restore" ? stringFlag2(flags, "run") : void 0;
10138
10138
  const given = [ids2, where, run].filter((v) => v !== void 0).length;
10139
10139
  if (given !== 1) {
10140
10140
  const choices = kind === "restore" ? "--ids <file|-> or --run <runId>" : "--ids <file|-> or --where '<json>'";
10141
- throw usageError(`${command36} needs exactly one of ${choices}.`, { field: "ids", next: `${command36} --help` });
10141
+ throw usageError(`${command37} needs exactly one of ${choices}.`, { field: "ids", next: `${command37} --help` });
10142
10142
  }
10143
10143
  if (ids2 !== void 0) return idsFromFile(ctx, ids2);
10144
10144
  if (where !== void 0) return idsFromWhere(ctx, kind, flags, where, dryRun2);
@@ -11049,6 +11049,57 @@ var init_mcp = __esm({
11049
11049
  }
11050
11050
  });
11051
11051
 
11052
+ // src/commands/opportunities/stage-history.ts
11053
+ var stage_history_exports = {};
11054
+ __export(stage_history_exports, {
11055
+ default: () => stage_history_default
11056
+ });
11057
+ var command18, stage_history_default;
11058
+ var init_stage_history = __esm({
11059
+ "src/commands/opportunities/stage-history.ts"() {
11060
+ "use strict";
11061
+ init_errors();
11062
+ init_exit_codes();
11063
+ init_http();
11064
+ command18 = {
11065
+ resource: "opportunities",
11066
+ action: "stage-history",
11067
+ summary: "Show a deal's stage history: each stage, when, who moved it and how long it sat there",
11068
+ description: "Reads GET /v1/opportunities/{opportunityId}/stage-history and prints it: the stage now, isComplete and entries, oldest first. Each entry has kind (created, stage_changed, won, lost), fromStage, stage, stageLabel, enteredAt, leftAt, durationSeconds, actorKind, actorMemberId and, on a move Ken's stage judge made, reason. With the deal_stage_rules flag on, each entry also says who changed it (changedBy: member, agent, api_key, workflow, stage_judge, crm_sync or ken_automation, with 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.",
11069
+ flags: {},
11070
+ positionals: [{ name: "opportunityId", required: true, description: "The deal (opportunity) id" }],
11071
+ examples: ["kenso opportunities stage-history 77", "kenso opportunities stage-history 77 --query 'entries[].{stage: stage, changedBy: changedBy}'"],
11072
+ beta: { featureGates: { all: ["opportunities"] } },
11073
+ operationIds: ["opportunities.get-stage-history"],
11074
+ async run(ctx, { positionals }) {
11075
+ const text3 = (positionals[0] ?? "").trim();
11076
+ const id = /^\d+$/.test(text3) ? Number(text3) : Number.NaN;
11077
+ if (!Number.isSafeInteger(id) || id < 1) {
11078
+ throw usageError(`opportunityId must be a positive whole number (got "${text3}").`, {
11079
+ field: "opportunityId",
11080
+ next: "kenso opportunities stage-history <opportunityId>"
11081
+ });
11082
+ }
11083
+ const res = await ctx.client.request({ method: "GET", path: `/v1/opportunities/${id}/stage-history`, signal: ctx.signal });
11084
+ ctx.output.object(unwrap(res.body));
11085
+ return ExitCode.Ok;
11086
+ }
11087
+ };
11088
+ stage_history_default = command18;
11089
+ }
11090
+ });
11091
+
11092
+ // src/commands/opportunities/index.ts
11093
+ var actions12;
11094
+ var init_opportunities = __esm({
11095
+ "src/commands/opportunities/index.ts"() {
11096
+ "use strict";
11097
+ actions12 = {
11098
+ "stage-history": () => Promise.resolve().then(() => (init_stage_history(), stage_history_exports)).then((m) => m.default)
11099
+ };
11100
+ }
11101
+ });
11102
+
11052
11103
  // src/commands/people/import.ts
11053
11104
  var import_exports3 = {};
11054
11105
  __export(import_exports3, {
@@ -11120,7 +11171,7 @@ function summarize3(results) {
11120
11171
  }
11121
11172
  return { matched, addedToAccounts, emailFindsQueued };
11122
11173
  }
11123
- var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command18, import_default3;
11174
+ var COMMAND5, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command19, import_default3;
11124
11175
  var init_import3 = __esm({
11125
11176
  "src/commands/people/import.ts"() {
11126
11177
  "use strict";
@@ -11152,7 +11203,7 @@ var init_import3 = __esm({
11152
11203
  };
11153
11204
  PERSON_FIELDS = ["email", "fullName", "firstName", "lastName", "linkedinUrl", "title"];
11154
11205
  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.";
11155
- command18 = {
11206
+ command19 = {
11156
11207
  resource: "people",
11157
11208
  action: "import",
11158
11209
  summary: "Create or match people from a CSV or JSONL file, optionally onto accounts",
@@ -11217,16 +11268,16 @@ var init_import3 = __esm({
11217
11268
  return outcome.exitCode;
11218
11269
  }
11219
11270
  };
11220
- import_default3 = command18;
11271
+ import_default3 = command19;
11221
11272
  }
11222
11273
  });
11223
11274
 
11224
11275
  // src/commands/people/index.ts
11225
- var actions12;
11276
+ var actions13;
11226
11277
  var init_people = __esm({
11227
11278
  "src/commands/people/index.ts"() {
11228
11279
  "use strict";
11229
- actions12 = {
11280
+ actions13 = {
11230
11281
  import: () => Promise.resolve().then(() => (init_import3(), import_exports3)).then((m) => m.default)
11231
11282
  };
11232
11283
  }
@@ -11237,14 +11288,14 @@ var list_exports = {};
11237
11288
  __export(list_exports, {
11238
11289
  default: () => list_default
11239
11290
  });
11240
- var command19, list_default;
11291
+ var command20, list_default;
11241
11292
  var init_list = __esm({
11242
11293
  "src/commands/runs/list.ts"() {
11243
11294
  "use strict";
11244
11295
  init_runs();
11245
11296
  init_errors();
11246
11297
  init_exit_codes();
11247
- command19 = {
11298
+ command20 = {
11248
11299
  resource: "runs",
11249
11300
  action: "list",
11250
11301
  summary: "List batch runs, newest first (finds an interrupted run)",
@@ -11265,7 +11316,7 @@ var init_list = __esm({
11265
11316
  return ExitCode.Ok;
11266
11317
  }
11267
11318
  };
11268
- list_default = command19;
11319
+ list_default = command20;
11269
11320
  }
11270
11321
  });
11271
11322
 
@@ -11276,7 +11327,7 @@ __export(show_exports, {
11276
11327
  });
11277
11328
  import { existsSync as existsSync6, readFileSync as readFileSync9 } from "node:fs";
11278
11329
  import { join as join12 } from "node:path";
11279
- var FILES, command20, show_default;
11330
+ var FILES, command21, show_default;
11280
11331
  var init_show = __esm({
11281
11332
  "src/commands/runs/show.ts"() {
11282
11333
  "use strict";
@@ -11291,7 +11342,7 @@ var init_show = __esm({
11291
11342
  ["plan", "plan.json"],
11292
11343
  ["summary", "summary.json"]
11293
11344
  ];
11294
- command20 = {
11345
+ command21 = {
11295
11346
  resource: "runs",
11296
11347
  action: "show",
11297
11348
  summary: "Show one batch run and its files",
@@ -11318,7 +11369,7 @@ var init_show = __esm({
11318
11369
  return ExitCode.Ok;
11319
11370
  }
11320
11371
  };
11321
- show_default = command20;
11372
+ show_default = command21;
11322
11373
  }
11323
11374
  });
11324
11375
 
@@ -11377,14 +11428,14 @@ function resumeArgv(run, globals = {}) {
11377
11428
  async function sha256(path) {
11378
11429
  return createHash5("sha256").update(await readFile9(path)).digest("hex");
11379
11430
  }
11380
- var SKIPPED_KEYS, command21, resume_default;
11431
+ var SKIPPED_KEYS, command22, resume_default;
11381
11432
  var init_resume = __esm({
11382
11433
  "src/commands/runs/resume.ts"() {
11383
11434
  "use strict";
11384
11435
  init_runs();
11385
11436
  init_errors();
11386
11437
  SKIPPED_KEYS = /* @__PURE__ */ new Set(["positionals", "yes", "dryRun", "dry-run", "help", "version"]);
11387
- command21 = {
11438
+ command22 = {
11388
11439
  resource: "runs",
11389
11440
  action: "resume",
11390
11441
  summary: "Continue an interrupted batch run (its command with --yes, no dry run)",
@@ -11439,16 +11490,16 @@ var init_resume = __esm({
11439
11490
  }
11440
11491
  }
11441
11492
  };
11442
- resume_default = command21;
11493
+ resume_default = command22;
11443
11494
  }
11444
11495
  });
11445
11496
 
11446
11497
  // src/commands/runs/index.ts
11447
- var actions13;
11498
+ var actions14;
11448
11499
  var init_runs2 = __esm({
11449
11500
  "src/commands/runs/index.ts"() {
11450
11501
  "use strict";
11451
- actions13 = {
11502
+ actions14 = {
11452
11503
  list: () => Promise.resolve().then(() => (init_list(), list_exports)).then((m) => m.default),
11453
11504
  show: () => Promise.resolve().then(() => (init_show(), show_exports)).then((m) => m.default),
11454
11505
  resume: () => Promise.resolve().then(() => (init_resume(), resume_exports)).then((m) => m.default)
@@ -11457,11 +11508,11 @@ var init_runs2 = __esm({
11457
11508
  });
11458
11509
 
11459
11510
  // src/commands/skill/index.ts
11460
- var actions14;
11511
+ var actions15;
11461
11512
  var init_skill = __esm({
11462
11513
  "src/commands/skill/index.ts"() {
11463
11514
  "use strict";
11464
- actions14 = {
11515
+ actions15 = {
11465
11516
  install: () => Promise.resolve().then(() => (init_install(), install_exports)).then((m) => m.default)
11466
11517
  };
11467
11518
  }
@@ -11697,7 +11748,7 @@ __export(pull_exports, {
11697
11748
  });
11698
11749
  import { mkdir, writeFile as writeFile4 } from "node:fs/promises";
11699
11750
  import { dirname as dirname2, resolve as resolve11 } from "node:path";
11700
- var command22, pull_default;
11751
+ var command23, pull_default;
11701
11752
  var init_pull = __esm({
11702
11753
  "src/commands/studio/pull.ts"() {
11703
11754
  "use strict";
@@ -11707,7 +11758,7 @@ var init_pull = __esm({
11707
11758
  init_common2();
11708
11759
  init_folder();
11709
11760
  init_transfer();
11710
- command22 = {
11761
+ command23 = {
11711
11762
  resource: "studio",
11712
11763
  action: "pull",
11713
11764
  summary: "Write a template version's files to a folder",
@@ -11754,7 +11805,7 @@ var init_pull = __esm({
11754
11805
  return ExitCode.Ok;
11755
11806
  }
11756
11807
  };
11757
- pull_default = command22;
11808
+ pull_default = command23;
11758
11809
  }
11759
11810
  });
11760
11811
 
@@ -11787,7 +11838,7 @@ var push_exports = {};
11787
11838
  __export(push_exports, {
11788
11839
  default: () => push_default
11789
11840
  });
11790
- var BUILT_BY, DEFAULT_MESSAGE, command23, push_default;
11841
+ var BUILT_BY, DEFAULT_MESSAGE, command24, push_default;
11791
11842
  var init_push = __esm({
11792
11843
  "src/commands/studio/push.ts"() {
11793
11844
  "use strict";
@@ -11799,7 +11850,7 @@ var init_push = __esm({
11799
11850
  init_read();
11800
11851
  BUILT_BY = "customer_agent";
11801
11852
  DEFAULT_MESSAGE = "Pushed with the Kenso CLI";
11802
- command23 = {
11853
+ command24 = {
11803
11854
  resource: "studio",
11804
11855
  action: "push",
11805
11856
  summary: "Save a folder's files to a template's draft and print the validation",
@@ -11891,7 +11942,7 @@ var init_push = __esm({
11891
11942
  );
11892
11943
  }
11893
11944
  };
11894
- push_default = command23;
11945
+ push_default = command24;
11895
11946
  }
11896
11947
  });
11897
11948
 
@@ -11900,7 +11951,7 @@ var validate_exports = {};
11900
11951
  __export(validate_exports, {
11901
11952
  default: () => validate_default
11902
11953
  });
11903
- var command24, validate_default;
11954
+ var command25, validate_default;
11904
11955
  var init_validate = __esm({
11905
11956
  "src/commands/studio/validate.ts"() {
11906
11957
  "use strict";
@@ -11909,7 +11960,7 @@ var init_validate = __esm({
11909
11960
  init_columns();
11910
11961
  init_common2();
11911
11962
  init_read();
11912
- command24 = {
11963
+ command25 = {
11913
11964
  resource: "studio",
11914
11965
  action: "validate",
11915
11966
  summary: "Validate a folder's files against a template without saving them",
@@ -11938,7 +11989,7 @@ var init_validate = __esm({
11938
11989
  throw validationFailed(validation, "The files have validation errors", commandLine2(ctx, "studio validate", args));
11939
11990
  }
11940
11991
  };
11941
- validate_default = command24;
11992
+ validate_default = command25;
11942
11993
  }
11943
11994
  });
11944
11995
 
@@ -11987,7 +12038,7 @@ function accountIds(value) {
11987
12038
  }
11988
12039
  return ids2.map(Number);
11989
12040
  }
11990
- var SHOWN, command25, preview_default;
12041
+ var SHOWN, command26, preview_default;
11991
12042
  var init_preview = __esm({
11992
12043
  "src/commands/studio/preview.ts"() {
11993
12044
  "use strict";
@@ -11999,7 +12050,7 @@ var init_preview = __esm({
11999
12050
  init_common2();
12000
12051
  init_folder();
12001
12052
  SHOWN = 5;
12002
- command25 = {
12053
+ command26 = {
12003
12054
  resource: "studio",
12004
12055
  action: "preview",
12005
12056
  summary: "Render a saved version for up to 3 accounts; for local edits, studio push them to the draft first",
@@ -12048,7 +12099,7 @@ var init_preview = __esm({
12048
12099
  return ExitCode.Ok;
12049
12100
  }
12050
12101
  };
12051
- preview_default = command25;
12102
+ preview_default = command26;
12052
12103
  }
12053
12104
  });
12054
12105
 
@@ -12249,7 +12300,7 @@ function estimateOutput(templateId, target, estimate2) {
12249
12300
  ...target.campaignId !== void 0 ? { estimateNote: "An upper bound: it counts one page per lead, and a campaign run builds one page per company." } : {}
12250
12301
  };
12251
12302
  }
12252
- var COMMAND6, sha2562, command26, fill_default;
12303
+ var COMMAND6, sha2562, command27, fill_default;
12253
12304
  var init_fill = __esm({
12254
12305
  "src/commands/studio/fill.ts"() {
12255
12306
  "use strict";
@@ -12265,7 +12316,7 @@ var init_fill = __esm({
12265
12316
  init_fill_runs();
12266
12317
  COMMAND6 = "studio fill";
12267
12318
  sha2562 = (data) => createHash8("sha256").update(data).digest("hex");
12268
- command26 = {
12319
+ command27 = {
12269
12320
  resource: "studio",
12270
12321
  action: "fill",
12271
12322
  summary: "Fill a template on many accounts or campaign leads (estimate first)",
@@ -12325,16 +12376,16 @@ var init_fill = __esm({
12325
12376
  return outcome.exitCode;
12326
12377
  }
12327
12378
  };
12328
- fill_default = command26;
12379
+ fill_default = command27;
12329
12380
  }
12330
12381
  });
12331
12382
 
12332
12383
  // src/commands/studio/index.ts
12333
- var actions15;
12384
+ var actions16;
12334
12385
  var init_studio2 = __esm({
12335
12386
  "src/commands/studio/index.ts"() {
12336
12387
  "use strict";
12337
- actions15 = {
12388
+ actions16 = {
12338
12389
  pull: () => Promise.resolve().then(() => (init_pull(), pull_exports)).then((m) => m.default),
12339
12390
  push: () => Promise.resolve().then(() => (init_push(), push_exports)).then((m) => m.default),
12340
12391
  validate: () => Promise.resolve().then(() => (init_validate(), validate_exports)).then((m) => m.default),
@@ -12476,7 +12527,7 @@ function readBody(req) {
12476
12527
  function reply(res, status, body) {
12477
12528
  res.writeHead(status, { "content-type": "application/json" }).end(JSON.stringify(body));
12478
12529
  }
12479
- var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command27, listen_default;
12530
+ var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command28, listen_default;
12480
12531
  var init_listen = __esm({
12481
12532
  "src/commands/webhooks/listen.ts"() {
12482
12533
  "use strict";
@@ -12487,7 +12538,7 @@ var init_listen = __esm({
12487
12538
  MIN_POLL_MS = 1e3;
12488
12539
  MAX_POLL_MS = 6e4;
12489
12540
  MAX_TRIGGER_BYTES = 1e6;
12490
- command27 = {
12541
+ command28 = {
12491
12542
  resource: "webhooks",
12492
12543
  action: "listen",
12493
12544
  summary: "Stream the workspace's events and forward them, signed, to a local handler",
@@ -12593,7 +12644,7 @@ var init_listen = __esm({
12593
12644
  return ExitCode.Ok;
12594
12645
  }
12595
12646
  };
12596
- listen_default = command27;
12647
+ listen_default = command28;
12597
12648
  }
12598
12649
  });
12599
12650
 
@@ -12612,7 +12663,7 @@ function notRunning() {
12612
12663
  next: LISTEN_NEXT
12613
12664
  });
12614
12665
  }
12615
- var LISTEN_NEXT, command28, trigger_default;
12666
+ var LISTEN_NEXT, command29, trigger_default;
12616
12667
  var init_trigger = __esm({
12617
12668
  "src/commands/webhooks/trigger.ts"() {
12618
12669
  "use strict";
@@ -12621,7 +12672,7 @@ var init_trigger = __esm({
12621
12672
  init_http();
12622
12673
  init_local();
12623
12674
  LISTEN_NEXT = "kenso webhooks listen --forward-to http://localhost:3000/hook";
12624
- command28 = {
12675
+ command29 = {
12625
12676
  resource: "webhooks",
12626
12677
  action: "trigger",
12627
12678
  summary: "Send a sample event of one type through the running kenso webhooks listen",
@@ -12678,16 +12729,16 @@ var init_trigger = __esm({
12678
12729
  return ExitCode.Ok;
12679
12730
  }
12680
12731
  };
12681
- trigger_default = command28;
12732
+ trigger_default = command29;
12682
12733
  }
12683
12734
  });
12684
12735
 
12685
12736
  // src/commands/webhooks/index.ts
12686
- var actions16;
12737
+ var actions17;
12687
12738
  var init_webhooks2 = __esm({
12688
12739
  "src/commands/webhooks/index.ts"() {
12689
12740
  "use strict";
12690
- actions16 = {
12741
+ actions17 = {
12691
12742
  listen: () => Promise.resolve().then(() => (init_listen(), listen_exports)).then((m) => m.default),
12692
12743
  trigger: () => Promise.resolve().then(() => (init_trigger(), trigger_exports)).then((m) => m.default)
12693
12744
  };
@@ -12874,14 +12925,14 @@ var status_exports2 = {};
12874
12925
  __export(status_exports2, {
12875
12926
  default: () => status_default2
12876
12927
  });
12877
- var command29, status_default2;
12928
+ var command30, status_default2;
12878
12929
  var init_status2 = __esm({
12879
12930
  "src/commands/work/status.ts"() {
12880
12931
  "use strict";
12881
12932
  init_exit_codes();
12882
12933
  init_http();
12883
12934
  init_common3();
12884
- command29 = {
12935
+ command30 = {
12885
12936
  resource: "work",
12886
12937
  action: "status",
12887
12938
  summary: "Show the Kenso AI work waiting for your own agent, per kind",
@@ -12914,7 +12965,7 @@ var init_status2 = __esm({
12914
12965
  return ExitCode.Ok;
12915
12966
  }
12916
12967
  };
12917
- status_default2 = command29;
12968
+ status_default2 = command30;
12918
12969
  }
12919
12970
  });
12920
12971
 
@@ -13046,9 +13097,9 @@ var init_files = __esm({
13046
13097
  import { execFile, spawnSync as spawnSync2 } from "node:child_process";
13047
13098
  import { readFileSync as readFileSync12 } from "node:fs";
13048
13099
  import { isAbsolute as isAbsolute2 } from "node:path";
13049
- function sudoArgs(user, command36, args, keep = [], set = {}) {
13100
+ function sudoArgs(user, command37, args, keep = [], set = {}) {
13050
13101
  const assignments = Object.entries(set).map(([name, value]) => `${name}=${value}`);
13051
- return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command36, ...args];
13102
+ return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command37, ...args];
13052
13103
  }
13053
13104
  function agentKensoEnv(opts) {
13054
13105
  return {
@@ -13058,12 +13109,12 @@ function agentKensoEnv(opts) {
13058
13109
  AI_AGENT: opts.agentName
13059
13110
  };
13060
13111
  }
13061
- function sudoExec(user, command36, args, opts = {}) {
13112
+ function sudoExec(user, command37, args, opts = {}) {
13062
13113
  const [sudo = "/usr/bin/sudo", ...lead] = user.sudo;
13063
13114
  return new Promise((resolve16) => {
13064
13115
  execFile(
13065
13116
  sudo,
13066
- [...lead, ...sudoArgs(user.name, command36, args)],
13117
+ [...lead, ...sudoArgs(user.name, command37, args)],
13067
13118
  { env: { PATH: SUDO_PATH }, cwd: "/", timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS, maxBuffer: opts.maxBuffer ?? 1024 * 1024, encoding: "utf8", windowsHide: true, shell: false },
13068
13119
  (err, stdout, stderr) => {
13069
13120
  const code = err ? err.code : 0;
@@ -13173,9 +13224,9 @@ var init_folder2 = __esm({
13173
13224
  init_redact();
13174
13225
  init_agent_user();
13175
13226
  WorkRunFolder = class {
13176
- constructor(ctx, command36, args, outDir, shared = false) {
13227
+ constructor(ctx, command37, args, outDir, shared = false) {
13177
13228
  this.ctx = ctx;
13178
- this.command = command36;
13229
+ this.command = command37;
13179
13230
  this.args = args;
13180
13231
  this.outDir = outDir;
13181
13232
  this.shared = shared;
@@ -13290,7 +13341,7 @@ var pull_exports2 = {};
13290
13341
  __export(pull_exports2, {
13291
13342
  default: () => pull_default2
13292
13343
  });
13293
- var MAX_FILES, command30, pull_default2;
13344
+ var MAX_FILES, command31, pull_default2;
13294
13345
  var init_pull2 = __esm({
13295
13346
  "src/commands/work/pull.ts"() {
13296
13347
  "use strict";
@@ -13299,7 +13350,7 @@ var init_pull2 = __esm({
13299
13350
  init_common3();
13300
13351
  init_folder2();
13301
13352
  MAX_FILES = 100;
13302
- command30 = {
13353
+ command31 = {
13303
13354
  resource: "work",
13304
13355
  action: "pull",
13305
13356
  summary: "Claim waiting work into local work files, to answer by hand",
@@ -13375,7 +13426,7 @@ var init_pull2 = __esm({
13375
13426
  return interrupted6 ? ExitCode.Interrupted : ExitCode.Ok;
13376
13427
  }
13377
13428
  };
13378
- pull_default2 = command30;
13429
+ pull_default2 = command31;
13379
13430
  }
13380
13431
  });
13381
13432
 
@@ -13517,7 +13568,7 @@ __export(submit_exports, {
13517
13568
  default: () => submit_default
13518
13569
  });
13519
13570
  import { resolve as resolve14 } from "node:path";
13520
- var command31, submit_default;
13571
+ var command32, submit_default;
13521
13572
  var init_submit = __esm({
13522
13573
  "src/commands/work/submit.ts"() {
13523
13574
  "use strict";
@@ -13526,7 +13577,7 @@ var init_submit = __esm({
13526
13577
  init_files();
13527
13578
  init_answers();
13528
13579
  init_common3();
13529
- command31 = {
13580
+ command32 = {
13530
13581
  resource: "work",
13531
13582
  action: "submit",
13532
13583
  summary: "Send answers files to Kenso and write each one's results",
@@ -13558,7 +13609,7 @@ var init_submit = __esm({
13558
13609
  return totals.rejected > 0 ? ExitCode.Partial : ExitCode.Ok;
13559
13610
  }
13560
13611
  };
13561
- submit_default = command31;
13612
+ submit_default = command32;
13562
13613
  }
13563
13614
  });
13564
13615
 
@@ -13579,7 +13630,7 @@ function claimIdOf(arg) {
13579
13630
  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..." });
13580
13631
  return arg;
13581
13632
  }
13582
- var CLAIM_ID, command32, release_default;
13633
+ var CLAIM_ID, command33, release_default;
13583
13634
  var init_release = __esm({
13584
13635
  "src/commands/work/release.ts"() {
13585
13636
  "use strict";
@@ -13588,7 +13639,7 @@ var init_release = __esm({
13588
13639
  init_files();
13589
13640
  init_common3();
13590
13641
  CLAIM_ID = /^[A-Za-z0-9_-]{1,64}$/;
13591
- command32 = {
13642
+ command33 = {
13592
13643
  resource: "work",
13593
13644
  action: "release",
13594
13645
  summary: "Give claimed work back to the queue now",
@@ -13607,7 +13658,7 @@ var init_release = __esm({
13607
13658
  return ExitCode.Ok;
13608
13659
  }
13609
13660
  };
13610
- release_default = command32;
13661
+ release_default = command33;
13611
13662
  }
13612
13663
  });
13613
13664
 
@@ -13946,12 +13997,12 @@ function plain(text3) {
13946
13997
  return text3.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
13947
13998
  }
13948
13999
  function runStatus(bin, args, env, adapter, runAs) {
13949
- const command36 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
14000
+ const command37 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
13950
14001
  const commandArgs2 = runAs ? [...runAs.sudo.slice(1), ...sudoArgs(runAs.name, bin, args)] : args;
13951
14002
  const options = runAs ? { env: { PATH: SUDO_PATH }, cwd: "/" } : { env: childEnv(env, adapter) };
13952
14003
  return new Promise((resolve16) => {
13953
14004
  execFile2(
13954
- command36,
14005
+ command37,
13955
14006
  commandArgs2,
13956
14007
  { ...options, timeout: STATUS_TIMEOUT_MS, maxBuffer: 1024 * 1024, windowsHide: true, shell: false },
13957
14008
  (err, stdout, stderr) => {
@@ -15033,7 +15084,7 @@ var run_exports = {};
15033
15084
  __export(run_exports, {
15034
15085
  default: () => run_default
15035
15086
  });
15036
- var FAILURES_IN_A_ROW, command33, run_default;
15087
+ var FAILURES_IN_A_ROW, command34, run_default;
15037
15088
  var init_run = __esm({
15038
15089
  "src/commands/work/run.ts"() {
15039
15090
  "use strict";
@@ -15054,7 +15105,7 @@ var init_run = __esm({
15054
15105
  init_folder2();
15055
15106
  init_stop();
15056
15107
  FAILURES_IN_A_ROW = 3;
15057
- command33 = {
15108
+ command34 = {
15058
15109
  resource: "work",
15059
15110
  action: "run",
15060
15111
  summary: "Run your own coding agent on the waiting work until the queue is empty",
@@ -15377,16 +15428,16 @@ var init_run = __esm({
15377
15428
  return exitCodeFor(reason, totals.rejected > 0 || jobsFailed > 0);
15378
15429
  }
15379
15430
  };
15380
- run_default = command33;
15431
+ run_default = command34;
15381
15432
  }
15382
15433
  });
15383
15434
 
15384
15435
  // src/commands/work/index.ts
15385
- var actions17;
15436
+ var actions18;
15386
15437
  var init_work2 = __esm({
15387
15438
  "src/commands/work/index.ts"() {
15388
15439
  "use strict";
15389
- actions17 = {
15440
+ actions18 = {
15390
15441
  status: () => Promise.resolve().then(() => (init_status2(), status_exports2)).then((m) => m.default),
15391
15442
  pull: () => Promise.resolve().then(() => (init_pull2(), pull_exports2)).then((m) => m.default),
15392
15443
  submit: () => Promise.resolve().then(() => (init_submit(), submit_exports)).then((m) => m.default),
@@ -15410,14 +15461,14 @@ function parseLimit(value) {
15410
15461
  }
15411
15462
  return limit;
15412
15463
  }
15413
- var MAX_LIMIT, command34, list_default2;
15464
+ var MAX_LIMIT, command35, list_default2;
15414
15465
  var init_list2 = __esm({
15415
15466
  "src/commands/workspace/list.ts"() {
15416
15467
  "use strict";
15417
15468
  init_errors();
15418
15469
  init_exit_codes();
15419
15470
  MAX_LIMIT = 200;
15420
- command34 = {
15471
+ command35 = {
15421
15472
  resource: "workspace",
15422
15473
  action: "list",
15423
15474
  summary: "List the workspaces your key can use",
@@ -15445,7 +15496,7 @@ var init_list2 = __esm({
15445
15496
  return ExitCode.Ok;
15446
15497
  }
15447
15498
  };
15448
- list_default2 = command34;
15499
+ list_default2 = command35;
15449
15500
  }
15450
15501
  });
15451
15502
 
@@ -15454,7 +15505,7 @@ var use_exports = {};
15454
15505
  __export(use_exports, {
15455
15506
  default: () => use_default
15456
15507
  });
15457
- var command35, use_default;
15508
+ var command36, use_default;
15458
15509
  var init_use = __esm({
15459
15510
  "src/commands/workspace/use.ts"() {
15460
15511
  "use strict";
@@ -15462,7 +15513,7 @@ var init_use = __esm({
15462
15513
  init_errors();
15463
15514
  init_exit_codes();
15464
15515
  init_http();
15465
- command35 = {
15516
+ command36 = {
15466
15517
  resource: "workspace",
15467
15518
  action: "use",
15468
15519
  summary: "Set the profile's default workspace",
@@ -15519,16 +15570,16 @@ var init_use = __esm({
15519
15570
  return ExitCode.Ok;
15520
15571
  }
15521
15572
  };
15522
- use_default = command35;
15573
+ use_default = command36;
15523
15574
  }
15524
15575
  });
15525
15576
 
15526
15577
  // src/commands/workspace/index.ts
15527
- var actions18;
15578
+ var actions19;
15528
15579
  var init_workspace = __esm({
15529
15580
  "src/commands/workspace/index.ts"() {
15530
15581
  "use strict";
15531
- actions18 = {
15582
+ actions19 = {
15532
15583
  list: () => Promise.resolve().then(() => (init_list2(), list_exports2)).then((m) => m.default),
15533
15584
  use: () => Promise.resolve().then(() => (init_use(), use_exports)).then((m) => m.default)
15534
15585
  };
@@ -15559,6 +15610,7 @@ var init_registry = __esm({
15559
15610
  init_doctor();
15560
15611
  init_jobs2();
15561
15612
  init_mcp();
15613
+ init_opportunities();
15562
15614
  init_people();
15563
15615
  init_runs2();
15564
15616
  init_skill();
@@ -15580,14 +15632,15 @@ var init_registry = __esm({
15580
15632
  login: topLevel("login", actions4.login, "kenso auth login"),
15581
15633
  logout: topLevel("logout", actions4.logout, "kenso auth logout"),
15582
15634
  mcp: actions11,
15583
- people: actions12,
15584
- runs: actions13,
15585
- skill: actions14,
15586
- studio: actions15,
15587
- webhooks: actions16,
15635
+ opportunities: actions12,
15636
+ people: actions13,
15637
+ runs: actions14,
15638
+ skill: actions15,
15639
+ studio: actions16,
15640
+ webhooks: actions17,
15588
15641
  whoami: topLevel("whoami", actions4.status, "kenso auth status"),
15589
- work: actions17,
15590
- workspace: actions18
15642
+ work: actions18,
15643
+ workspace: actions19
15591
15644
  };
15592
15645
  resourceAliases = { leads: "contacts" };
15593
15646
  }
@@ -15724,8 +15777,8 @@ async function renderTopHelp(opts) {
15724
15777
  names.push(withPositionals(spec, spec.action));
15725
15778
  groups.set(hint, names);
15726
15779
  }
15727
- const actions20 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
15728
- if (actions20.length > 0) rows.push([resource, actions20.join(", ")]);
15780
+ const actions21 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
15781
+ if (actions21.length > 0) rows.push([resource, actions21.join(", ")]);
15729
15782
  }
15730
15783
  const at = 4 + Math.min(22, Math.max(0, ...rows.map(([left]) => left.length)));
15731
15784
  lines.push(
@@ -15738,7 +15791,7 @@ async function renderTopHelp(opts) {
15738
15791
  const [area = "", action = ""] = name.split(" ");
15739
15792
  byArea.set(area, [...byArea.get(area) ?? [], action]);
15740
15793
  }
15741
- const named = [...byArea.entries()].map(([area, actions20]) => `${area} ${actions20.join("|")}`);
15794
+ const named = [...byArea.entries()].map(([area, actions21]) => `${area} ${actions21.join("|")}`);
15742
15795
  lines.push(wrap(`Beta, hidden here but they run (the server decides): ${named.join(", ")}.`, " "));
15743
15796
  }
15744
15797
  const generated = await listGenerated({ features: opts.allCommands ? [] : getFeatures, env: opts.env });
@@ -15746,13 +15799,13 @@ async function renderTopHelp(opts) {
15746
15799
  if (visible.length > 0) {
15747
15800
  const byResource = /* @__PURE__ */ new Map();
15748
15801
  for (const g of visible) {
15749
- const actions20 = byResource.get(g.resource) ?? [];
15750
- actions20.push(`${g.action}${g.beta ? " (beta)" : ""}`);
15751
- byResource.set(g.resource, actions20);
15802
+ const actions21 = byResource.get(g.resource) ?? [];
15803
+ actions21.push(`${g.action}${g.beta ? " (beta)" : ""}`);
15804
+ byResource.set(g.resource, actions21);
15752
15805
  }
15753
15806
  const sorted2 = [...byResource.entries()].sort(([a], [b]) => a.localeCompare(b));
15754
15807
  if (opts.allCommands) {
15755
- const generatedRows = sorted2.map(([resource, actions20]) => [resource, actions20.sort().join(", ")]);
15808
+ const generatedRows = sorted2.map(([resource, actions21]) => [resource, actions21.sort().join(", ")]);
15756
15809
  lines.push("", "API resources (kenso <resource> <action>):", columns(generatedRows));
15757
15810
  } else {
15758
15811
  const names = new Set(sorted2.map(([resource]) => resource));
@@ -16068,8 +16121,8 @@ function startUpdateNotice(argv, opts = {}) {
16068
16121
  if (!found) return;
16069
16122
  writeCheck(file, { checkedAt: new Date(now).toISOString(), latest: found });
16070
16123
  if (isNewer(found, version)) {
16071
- const command36 = updateCommand(install, opts.platform ?? process.platform);
16072
- stderr.write(`kenso ${found} is out (you have ${version}): ${command36}
16124
+ const command37 = updateCommand(install, opts.platform ?? process.platform);
16125
+ stderr.write(`kenso ${found} is out (you have ${version}): ${command37}
16073
16126
  Turn this off with KENSO_NO_UPDATE_NOTIFIER=1.
16074
16127
  `);
16075
16128
  }
@@ -16111,7 +16164,7 @@ function resources() {
16111
16164
  const names = Object.entries(handWritten).filter(([, area]) => Object.keys(area).length > 0).map(([resource]) => resource);
16112
16165
  return sorted([...names, ...Object.keys(resourceAliases), ...loadManifest().operations.map((op) => op.resource)]);
16113
16166
  }
16114
- function actions19(resource) {
16167
+ function actions20(resource) {
16115
16168
  const own = Object.keys(handWritten[resource] ?? {}).filter((action) => action !== "");
16116
16169
  return sorted([...own, ...loadManifest().operations.filter((op) => op.resource === resource).map((op) => op.action)]);
16117
16170
  }
@@ -16176,7 +16229,7 @@ async function completions(words, globals) {
16176
16229
  return flagsOf2(spec, globals, positionals.length === 0);
16177
16230
  }
16178
16231
  if (positionals.length === 0) return resources();
16179
- if (!spec) return positionals.length === 1 ? actions19(resourceAliases[positionals[0]] ?? positionals[0]) : [];
16232
+ if (!spec) return positionals.length === 1 ? actions20(resourceAliases[positionals[0]] ?? positionals[0]) : [];
16180
16233
  const given = positionals.length - commandWords;
16181
16234
  const declared = spec.positionals ?? [];
16182
16235
  if (given < declared.length || declared.at(-1)?.variadic === true) {
@@ -16270,9 +16323,9 @@ function normalizeBooleans(argv, names, strict) {
16270
16323
  async function knownCommands() {
16271
16324
  const commands = /* @__PURE__ */ new Set();
16272
16325
  for (const [resource, area] of Object.entries(handWritten)) {
16273
- const actions20 = Object.keys(area);
16274
- if (actions20.length > 0) commands.add(resource);
16275
- for (const action of actions20) commands.add(action ? `${resource} ${action}` : resource);
16326
+ const actions21 = Object.keys(area);
16327
+ if (actions21.length > 0) commands.add(resource);
16328
+ for (const action of actions21) commands.add(action ? `${resource} ${action}` : resource);
16276
16329
  }
16277
16330
  for (const g of await listGenerated({ features: [] })) {
16278
16331
  commands.add(g.resource);