kenso 0.1.63 → 0.1.65
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/CHANGELOG.md +4 -0
- package/README.md +2 -0
- package/dist/kenso.js +449 -110
- package/dist/operations.json +1 -1
- package/docs/README.md +1 -0
- package/docs/crm.md +8 -0
- package/docs/reference.md +65 -9
- package/docs/sandbox.md +61 -0
- package/package.json +2 -2
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.
|
|
2424
|
+
VERSION = true ? "0.1.65" : "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:
|
|
3717
|
+
const { runId, command: command42, createdAt, status } = raw;
|
|
3718
3718
|
if (typeof runId !== "string" || !RUN_ID_PATTERN.test(runId)) return null;
|
|
3719
|
-
if (typeof
|
|
3719
|
+
if (typeof command42 !== "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:
|
|
3730
|
+
command: command42,
|
|
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(
|
|
3785
|
+
async function findIdentical(command42, 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 ===
|
|
3789
|
+
(run) => run.command === command42 && (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,
|
|
6942
|
-
const parts2 = ["kenso", ...
|
|
6941
|
+
function commandLine2(ctx, command42, args, extra = []) {
|
|
6942
|
+
const parts2 = ["kenso", ...command42.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\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| `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
|
|
|
@@ -7287,7 +7287,15 @@ var init_output_and_errors = __esm({
|
|
|
7287
7287
|
var README_default;
|
|
7288
7288
|
var init_README = __esm({
|
|
7289
7289
|
"docs/README.md"() {
|
|
7290
|
-
README_default = '# Kenso CLI\n\nThe Kenso CLI (`kenso`) is the command line for Kenso. It does bulk work in your Kenso workspace from files: add thousands of leads to a campaign, update or clean them up, import accounts and people, and build Studio templates. It is made for coding agents (Claude Code, Codex, Cursor) and the people who drive them: JSON on stdout, fixed exit codes, a dry run before every bulk write, and runs you can resume.\n\nEvery API operation a workspace member can call is also a command, such as `kenso campaigns list` or `kenso tags create`. So the CLI reaches what the Kenso MCP reaches, straight against `https://api.ken.so`.\n\n## Install\n\nOn macOS or Linux, with or without Node, run the [install script](https://ken.so/install.sh): fetch it with `curl -fsSL` and pipe it to `sh`. It installs a standalone build that brings its own Node.js, checks the download against the release\'s `SHA256SUMS`, puts the CLI in `~/.local/share/kenso` and links `~/.local/bin/kenso`. Run it again to update.\n\nWith Node 22 or newer, on any system, Windows included:\n\n```bash\nnpm i -g kenso\nkenso --version\n```\n\nTo run it once without installing, use `npx kenso --version`. On an older Node, kenso stops with one line that says so.\n\nEvery way to install:\n\n| Way | Systems | Needs |\n|---|---|---|\n| Install script, above | macOS, Linux (glibc) | Nothing |\n| npm, above | Any | Node 22 or newer |\n| Standalone build: unpack it and put its `bin` folder on your PATH | macOS, Linux, Windows | Nothing |\n\nThe standalone builds are at `https://downloads.ken.so/desktop/cli/<version>/`, one per system: `kenso-<version>-darwin-arm64.tar.gz`, `darwin-x64`, `linux-arm64`, `linux-x64` and `kenso-<version>-windows-x64.zip`, with their `SHA256SUMS`. `https://downloads.ken.so/desktop/cli/latest.yml` names the newest version. The builds come out nightly, so a command added that day reaches npm first.\n\n### Tab completion\n\nTab completes resources, actions and flags once you install the script for your shell. The script asks `kenso` for the candidates on each Tab, so it stays right as the CLI updates: install it once.\n\n```bash\n# zsh: add this line to ~/.zshrc\nsource <(kenso completion zsh)\n# bash: add this line to ~/.bashrc (on bash 3.2, the macOS default, use: eval "$(kenso completion bash)")\nsource <(kenso completion bash)\n# fish: save the script once\nkenso completion fish > ~/.config/fish/completions/kenso.fish\n```\n\n### Update notice\n\nWhen a newer version is out, `kenso` says so on stderr after the command\'s own output, at most once a week: `kenso 0.1.40 is out (you have 0.1.35): npm i -g kenso@latest`. It checks `registry.npmjs.org` at most once every 7 days and never delays a command by more than about a second. A standalone build checks `latest.yml` on `downloads.ken.so` instead and names its own update: the install script, or `brew upgrade kenso` when Homebrew installed it. It stays quiet when stderr is not a terminal, in CI (`CI` set) and under a coding agent. Set `KENSO_NO_UPDATE_NOTIFIER=1` to turn it off.\n\n## 60-second quickstart\n\n1. Create an API key in app.ken.so at Settings > Integrations > API keys.\n2. Save the key, pick a workspace, then plan and apply a CSV import:\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso workspace list --search acme\nkenso workspace use 1234\nkenso campaigns list --limit 5\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\n`workspace list` and `workspace use` are only needed when your key reaches more than one workspace.\n\nThe dry run reads the file, maps the columns, checks every row, asks Kenso for a credit estimate, and writes nothing. It prints the plan, with the exact apply command in `next`:\n\n```json\n{"run":"r_tdi5cdnx","dryRun":true,"command":"contacts import","rows":4,"valid":2,"invalid":2,"chunks":1,"chunkSize":1000,"campaignId":812,"mapping":{"Email":"email","First Name":"firstName","Last Name":"lastName","Company":"companyName","Pain Point":"customVariables.pain_point"},"customVariableKeys":["pain_point"],"estimate":{"kind":"leads","totalMillicredits":2000,"availableMillicredits":500000,"sufficient":true},"credits":{"needed":2,"available":500,"sufficient":true},"next":"kenso contacts import --campaign 812 --file leads.csv --yes","plan":"/home/you/.kenso/runs/r_tdi5cdnx/plan.json","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv"}\n```\n\nThe apply sends the rows and prints one summary. Every input row has one line in `results.csv`:\n\n```json\n{"run":"r_tdi5cdnx","rows":4,"ok":0,"created":1,"updated":0,"skipped":{"duplicate":1},"failed":0,"notFound":0,"invalid":2,"changed":1,"results":"/home/you/.kenso/runs/r_tdi5cdnx/results.csv","resultsNdjson":"/home/you/.kenso/runs/r_tdi5cdnx/results.ndjson","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv","resumed":false,"durationMs":1840,"campaignId":812,"notSendable":0}\n```\n\nThis run exits 5 because two rows were invalid: open `invalid.csv` to see why, fix those rows, and import them again. Running the same command again is safe: an email that is already in the campaign comes back `updated` or `skipped`, never as a second lead.\n\n## CLI or MCP\n\n- **Use the CLI for volume:** anything that starts from a file, anything over about 50 records, anything you may need to rerun or resume. Records never pass through the model\'s context: the agent passes a file path and reads a short summary.\n- **Use the MCP for conversation and single records:** look up a campaign, draft a reply, read a report. The MCP is at `https://mcp.ken.so/mcp`, signs in with OAuth and needs no install ([connection guide](https://ken.so/mcp)).\n- **Both use the same API and the same permissions.** `kenso mcp call` reaches MCP-only tools, such as skills, from the shell.\n\n## Docs\n\nEvery page is in the package and prints offline with `kenso docs <topic>`.\n\n| Page | Topic | What it covers |\n|---|---|---|\n| [Authentication](auth.md) | `auth` | API keys, browser login, profiles, workspaces, `doctor` |\n| [Leads](leads.md) | `leads` | Import, update, remove, pause, tag and export leads, with recipes |\n| [Batch runs](batch.md) | `batch` | Dry run and apply, run folders, results files, resume, rate limits, `--each` |\n| [Output and errors](output-and-errors.md) | `output-and-errors` | The output contract, error JSON, error codes, exit codes |\n| [CRM (beta)](crm.md) | `crm` | Accounts, people, opportunities and CRM sync |\n| [Studio (beta)](studio.md) | `studio` | Pull, push, validate, preview and fill templates |\n| [Agent work (beta)](work.md) | `work` | My agent: your own coding agent writes Kenso\'s AI work with `kenso work run`, or pull and submit |\n| [Webhooks](webhooks.md) | `webhooks` | Build a webhook handler locally: `kenso webhooks listen --forward-to`, `trigger`, the signature |\n| [Coding agents](agents.md) | `agents` | Claude Code, Codex, Cursor, the Agent Skill, environment variables, sandboxes |\n| Command reference | `reference` | Every command with its flags, generated from the CLI at build time: `kenso docs reference`, or `docs/reference.md` in the installed package |\n\n```bash\nkenso docs\nkenso docs leads\n```\n\nFor machine-readable help, run `kenso describe`: it prints every command, its flags and its body schema as JSON.\n';
|
|
7290
|
+
README_default = '# Kenso CLI\n\nThe Kenso CLI (`kenso`) is the command line for Kenso. It does bulk work in your Kenso workspace from files: add thousands of leads to a campaign, update or clean them up, import accounts and people, and build Studio templates. It is made for coding agents (Claude Code, Codex, Cursor) and the people who drive them: JSON on stdout, fixed exit codes, a dry run before every bulk write, and runs you can resume.\n\nEvery API operation a workspace member can call is also a command, such as `kenso campaigns list` or `kenso tags create`. So the CLI reaches what the Kenso MCP reaches, straight against `https://api.ken.so`.\n\n## Install\n\nOn macOS or Linux, with or without Node, run the [install script](https://ken.so/install.sh): fetch it with `curl -fsSL` and pipe it to `sh`. It installs a standalone build that brings its own Node.js, checks the download against the release\'s `SHA256SUMS`, puts the CLI in `~/.local/share/kenso` and links `~/.local/bin/kenso`. Run it again to update.\n\nWith Node 22 or newer, on any system, Windows included:\n\n```bash\nnpm i -g kenso\nkenso --version\n```\n\nTo run it once without installing, use `npx kenso --version`. On an older Node, kenso stops with one line that says so.\n\nEvery way to install:\n\n| Way | Systems | Needs |\n|---|---|---|\n| Install script, above | macOS, Linux (glibc) | Nothing |\n| npm, above | Any | Node 22 or newer |\n| Standalone build: unpack it and put its `bin` folder on your PATH | macOS, Linux, Windows | Nothing |\n\nThe standalone builds are at `https://downloads.ken.so/desktop/cli/<version>/`, one per system: `kenso-<version>-darwin-arm64.tar.gz`, `darwin-x64`, `linux-arm64`, `linux-x64` and `kenso-<version>-windows-x64.zip`, with their `SHA256SUMS`. `https://downloads.ken.so/desktop/cli/latest.yml` names the newest version. The builds come out nightly, so a command added that day reaches npm first.\n\n### Tab completion\n\nTab completes resources, actions and flags once you install the script for your shell. The script asks `kenso` for the candidates on each Tab, so it stays right as the CLI updates: install it once.\n\n```bash\n# zsh: add this line to ~/.zshrc\nsource <(kenso completion zsh)\n# bash: add this line to ~/.bashrc (on bash 3.2, the macOS default, use: eval "$(kenso completion bash)")\nsource <(kenso completion bash)\n# fish: save the script once\nkenso completion fish > ~/.config/fish/completions/kenso.fish\n```\n\n### Update notice\n\nWhen a newer version is out, `kenso` says so on stderr after the command\'s own output, at most once a week: `kenso 0.1.40 is out (you have 0.1.35): npm i -g kenso@latest`. It checks `registry.npmjs.org` at most once every 7 days and never delays a command by more than about a second. A standalone build checks `latest.yml` on `downloads.ken.so` instead and names its own update: the install script, or `brew upgrade kenso` when Homebrew installed it. It stays quiet when stderr is not a terminal, in CI (`CI` set) and under a coding agent. Set `KENSO_NO_UPDATE_NOTIFIER=1` to turn it off.\n\n## 60-second quickstart\n\n1. Create an API key in app.ken.so at Settings > Integrations > API keys.\n2. Save the key, pick a workspace, then plan and apply a CSV import:\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso workspace list --search acme\nkenso workspace use 1234\nkenso campaigns list --limit 5\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\n`workspace list` and `workspace use` are only needed when your key reaches more than one workspace.\n\nThe dry run reads the file, maps the columns, checks every row, asks Kenso for a credit estimate, and writes nothing. It prints the plan, with the exact apply command in `next`:\n\n```json\n{"run":"r_tdi5cdnx","dryRun":true,"command":"contacts import","rows":4,"valid":2,"invalid":2,"chunks":1,"chunkSize":1000,"campaignId":812,"mapping":{"Email":"email","First Name":"firstName","Last Name":"lastName","Company":"companyName","Pain Point":"customVariables.pain_point"},"customVariableKeys":["pain_point"],"estimate":{"kind":"leads","totalMillicredits":2000,"availableMillicredits":500000,"sufficient":true},"credits":{"needed":2,"available":500,"sufficient":true},"next":"kenso contacts import --campaign 812 --file leads.csv --yes","plan":"/home/you/.kenso/runs/r_tdi5cdnx/plan.json","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv"}\n```\n\nThe apply sends the rows and prints one summary. Every input row has one line in `results.csv`:\n\n```json\n{"run":"r_tdi5cdnx","rows":4,"ok":0,"created":1,"updated":0,"skipped":{"duplicate":1},"failed":0,"notFound":0,"invalid":2,"changed":1,"results":"/home/you/.kenso/runs/r_tdi5cdnx/results.csv","resultsNdjson":"/home/you/.kenso/runs/r_tdi5cdnx/results.ndjson","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv","resumed":false,"durationMs":1840,"campaignId":812,"notSendable":0}\n```\n\nThis run exits 5 because two rows were invalid: open `invalid.csv` to see why, fix those rows, and import them again. Running the same command again is safe: an email that is already in the campaign comes back `updated` or `skipped`, never as a second lead.\n\n## CLI or MCP\n\n- **Use the CLI for volume:** anything that starts from a file, anything over about 50 records, anything you may need to rerun or resume. Records never pass through the model\'s context: the agent passes a file path and reads a short summary.\n- **Use the MCP for conversation and single records:** look up a campaign, draft a reply, read a report. The MCP is at `https://mcp.ken.so/mcp`, signs in with OAuth and needs no install ([connection guide](https://ken.so/mcp)).\n- **Both use the same API and the same permissions.** `kenso mcp call` reaches MCP-only tools, such as skills, from the shell.\n\n## Docs\n\nEvery page is in the package and prints offline with `kenso docs <topic>`.\n\n| Page | Topic | What it covers |\n|---|---|---|\n| [Authentication](auth.md) | `auth` | API keys, browser login, profiles, workspaces, `doctor` |\n| [Leads](leads.md) | `leads` | Import, update, remove, pause, tag and export leads, with recipes |\n| [Batch runs](batch.md) | `batch` | Dry run and apply, run folders, results files, resume, rate limits, `--each` |\n| [Output and errors](output-and-errors.md) | `output-and-errors` | The output contract, error JSON, error codes, exit codes |\n| [CRM (beta)](crm.md) | `crm` | Accounts, people, opportunities and CRM sync |\n| [Studio (beta)](studio.md) | `studio` | Pull, push, validate, preview and fill templates |\n| [Agent work (beta)](work.md) | `work` | My agent: your own coding agent writes Kenso\'s AI work with `kenso work run`, or pull and submit |\n| [Webhooks](webhooks.md) | `webhooks` | Build a webhook handler locally: `kenso webhooks listen --forward-to`, `trigger`, the signature |\n| [Developer sandbox](sandbox.md) | `sandbox` | `kenso sandbox`: a workspace of your own where sends are simulated, its test key, the reserved test leads |\n| [Coding agents](agents.md) | `agents` | Claude Code, Codex, Cursor, the Agent Skill, environment variables, sandboxes |\n| Command reference | `reference` | Every command with its flags, generated from the CLI at build time: `kenso docs reference`, or `docs/reference.md` in the installed package |\n\n```bash\nkenso docs\nkenso docs leads\n```\n\nFor machine-readable help, run `kenso describe`: it prints every command, its flags and its body schema as JSON.\n';
|
|
7291
|
+
}
|
|
7292
|
+
});
|
|
7293
|
+
|
|
7294
|
+
// docs/sandbox.md
|
|
7295
|
+
var sandbox_default;
|
|
7296
|
+
var init_sandbox = __esm({
|
|
7297
|
+
"docs/sandbox.md"() {
|
|
7298
|
+
sandbox_default = '# Developer sandbox\n\nA developer sandbox is a Kenso workspace of your own for building and testing an integration. It starts with example campaigns, contacts, inboxes and conversation threads, and everything in it is simulated: sends, orders and charges never reach a provider. Nothing leaves Kenso. Campaigns still plan and send in the sandbox, your webhook endpoints still receive its events, and a few reserved test addresses answer like real leads would.\n\nYou work in it with a test key: `kenso_test_` and 49 letters and digits. A test key works only in its sandbox, and only on `Ken-Version: 1.1` routes, which is what `kenso` sends: every other workspace answers 404, and a request without that version, or to a route that has no 1.1 form, answers 403. You have one sandbox at most.\n\nThis is not the cloud sandbox a coding agent runs in (`kenso work run`, see `kenso docs agents`).\n\nSandboxes are in beta: the commands work in workspaces where Kenso has turned them on.\n\n## Commands\n\nThe sandbox commands run with your live key, in your current workspace. Run with a test key, they stop before sending anything.\n\n| Command | What it does |\n|---|---|\n| `sandbox create` | Creates your sandbox and its first test key, and saves the key as the profile `sandbox` |\n| `sandbox list` | Lists your sandbox |\n| `sandbox reset [sandboxId]` | Deletes everything in the sandbox and seeds it again. Test keys and webhook endpoints stay |\n| `sandbox key [sandboxId]` | Creates another test key (5 active at most) and saves it as the profile `sandbox` |\n| `sandbox delete [sandboxId]` | Deletes the sandbox and revokes its test keys, then removes the profile `sandbox` |\n\nWithout an id, `reset`, `key` and `delete` use your one sandbox. `delete` asks first on a terminal; in a script or an agent it needs `--yes`, and `--dry-run` prints the request it would send.\n\n## Quick start\n\n```bash\nkenso sandbox create\n```\n\nIt prints the sandbox and its test key once, as JSON:\n\n```json\n{"sandboxId":20417,"name":"Sandbox (you@acme.com)","status":"ready","seed":{"campaigns":2,"contacts":25,"inboxes":2,"threads":4},"testKey":{"id":"apk_...","prefix":"kenso_test_AbCdE","secret":"kenso_test_...","expiresAt":"2027-02-13T18:00:00Z"},"profile":"sandbox"}\n```\n\nThe key is saved as the profile `sandbox`, and your active profile stays the live one. Add `--profile sandbox` to run any command in the sandbox:\n\n```bash\nkenso campaigns list --profile sandbox\nkenso auth status --profile sandbox\n```\n\n`KENSO_API_KEY` and `KENSO_WORKSPACE_ID` win over every profile, `--profile sandbox` included: while either is set, a command does not use the test key and its sandbox. Unset them, or set `KENSO_API_KEY=<the test key> KENSO_WORKSPACE_ID=<sandboxId>` to work in the sandbox. `sandbox create` and `sandbox key` warn when they are set, and `auth status` when they override the profile.\n\n`auth status` says `"keyKind":"test"` and names the sandbox. A test key expires after 90 days: `kenso sandbox key` makes a new one and saves it over the old one in the profile. To start over, `kenso sandbox reset`. When you are done, `kenso sandbox delete --yes`.\n\nYour code can use the same key without the CLI: send it as `Authorization: Bearer <key>` and the sandbox id as `X-Ken-Workspace-Id`.\n\n## Reserved test leads\n\nAdd a lead with one of these addresses to a sandbox campaign and launch it. After its simulated send, the lead gets that outcome. A `+label` before the `@` is ignored, so `replied-interested+signup@test.ken.so` works too.\n\n| Address | Outcome in a sandbox |\n|---|---|\n| `replied-interested@test.ken.so` | A reply classified Interested |\n| `bounced@test.ken.so` | A hard bounce |\n| `ooo@test.ken.so` | An out-of-office auto reply |\n| `unsubscribed@test.ken.so` | An unsubscribe |\n\nAny other address gets a simulated send and nothing after it.\n';
|
|
7291
7299
|
}
|
|
7292
7300
|
});
|
|
7293
7301
|
|
|
@@ -7340,6 +7348,7 @@ var init_embedded = __esm({
|
|
|
7340
7348
|
init_leads();
|
|
7341
7349
|
init_output_and_errors();
|
|
7342
7350
|
init_README();
|
|
7351
|
+
init_sandbox();
|
|
7343
7352
|
init_studio();
|
|
7344
7353
|
init_webhooks();
|
|
7345
7354
|
init_work();
|
|
@@ -7354,6 +7363,7 @@ var init_embedded = __esm({
|
|
|
7354
7363
|
"studio.md": studio_default,
|
|
7355
7364
|
"work.md": work_default,
|
|
7356
7365
|
"webhooks.md": webhooks_default,
|
|
7366
|
+
"sandbox.md": sandbox_default,
|
|
7357
7367
|
"agents.md": agents_default
|
|
7358
7368
|
};
|
|
7359
7369
|
SKILL = SKILL_default;
|
|
@@ -7391,6 +7401,7 @@ var init_content = __esm({
|
|
|
7391
7401
|
{ topic: "studio", file: "studio.md", title: "Studio (beta)", description: "Pull, push, validate, preview and fill templates" },
|
|
7392
7402
|
{ topic: "work", file: "work.md", title: "Agent work (beta)", description: "My agent: your own coding agent writes Kenso AI work with kenso work run, or pull and submit" },
|
|
7393
7403
|
{ topic: "webhooks", file: "webhooks.md", title: "Webhooks", description: "Build a webhook handler locally: kenso webhooks listen --forward-to, trigger, the signature" },
|
|
7404
|
+
{ topic: "sandbox", file: "sandbox.md", title: "Developer sandbox", description: "kenso sandbox: a workspace of your own where sends are simulated, its test key, the reserved test leads" },
|
|
7394
7405
|
{ topic: "agents", file: "agents.md", title: "Coding agents", description: "kenso agent setup for Claude Code, Codex, Cursor, Gemini CLI and OpenCode, the Agent Skill, environment variables, sandboxes" },
|
|
7395
7406
|
{ topic: "reference", file: "reference.md", title: "Command reference", description: "Every command with its flags, generated from the CLI at build time" }
|
|
7396
7407
|
];
|
|
@@ -8154,11 +8165,15 @@ var init_api3 = __esm({
|
|
|
8154
8165
|
});
|
|
8155
8166
|
|
|
8156
8167
|
// src/core/api-key.ts
|
|
8157
|
-
|
|
8168
|
+
function isTestKey(key) {
|
|
8169
|
+
return key?.startsWith(TEST_KEY_PREFIX) === true;
|
|
8170
|
+
}
|
|
8171
|
+
var API_KEY_PATTERN, TEST_KEY_PREFIX;
|
|
8158
8172
|
var init_api_key = __esm({
|
|
8159
8173
|
"src/core/api-key.ts"() {
|
|
8160
8174
|
"use strict";
|
|
8161
8175
|
API_KEY_PATTERN = /^(?:kenso_(?:live|test)_[A-Za-z0-9]{49}|ken_[A-Za-z0-9_-]{43})$/;
|
|
8176
|
+
TEST_KEY_PREFIX = "kenso_test_";
|
|
8162
8177
|
}
|
|
8163
8178
|
});
|
|
8164
8179
|
|
|
@@ -8385,8 +8400,8 @@ var init_browser_login = __esm({
|
|
|
8385
8400
|
defaultDeps = {
|
|
8386
8401
|
sleep: (ms, signal) => delay2(ms, void 0, signal ? { signal } : void 0),
|
|
8387
8402
|
now: () => Date.now(),
|
|
8388
|
-
spawn: (
|
|
8389
|
-
const child = nodeSpawn(
|
|
8403
|
+
spawn: (command42, args) => {
|
|
8404
|
+
const child = nodeSpawn(command42, args, { detached: true, stdio: "ignore" });
|
|
8390
8405
|
child.on("error", () => {
|
|
8391
8406
|
});
|
|
8392
8407
|
child.unref();
|
|
@@ -8431,7 +8446,7 @@ function invalidKey(message) {
|
|
|
8431
8446
|
message,
|
|
8432
8447
|
exitCode: ExitCode.Usage,
|
|
8433
8448
|
field: "stdin",
|
|
8434
|
-
hint: "A Kenso API key is kenso_live_ followed by 49 letters and digits (a key made before the change is ken_ followed by 43 letters, digits, _ or -). Create one at Settings > Integrations > API keys in app.ken.so.",
|
|
8449
|
+
hint: "A Kenso API key is kenso_live_ followed by 49 letters and digits (a sandbox test key starts kenso_test_ instead; a key made before the change is ken_ followed by 43 letters, digits, _ or -). Create one at Settings > Integrations > API keys in app.ken.so.",
|
|
8435
8450
|
next: PIPE_EXAMPLE
|
|
8436
8451
|
});
|
|
8437
8452
|
}
|
|
@@ -8627,6 +8642,8 @@ var EXPIRY_WARNING_DAYS, DAY_MS, command7, status_default;
|
|
|
8627
8642
|
var init_status = __esm({
|
|
8628
8643
|
"src/commands/auth/status.ts"() {
|
|
8629
8644
|
"use strict";
|
|
8645
|
+
init_api_key();
|
|
8646
|
+
init_config();
|
|
8630
8647
|
init_errors();
|
|
8631
8648
|
init_exit_codes();
|
|
8632
8649
|
init_http();
|
|
@@ -8636,7 +8653,7 @@ var init_status = __esm({
|
|
|
8636
8653
|
resource: "auth",
|
|
8637
8654
|
action: "status",
|
|
8638
8655
|
summary: "Show the key's user, workspace and expiry",
|
|
8639
|
-
description: `Reads GET /v1/me for the email and workspaces, and GET /v1/api-keys for the key's expiry. Warns on stderr when the key expires within ${EXPIRY_WARNING_DAYS} days.`,
|
|
8656
|
+
description: `Reads GET /v1/me for the email and workspaces, and GET /v1/api-keys for the key's expiry. Warns on stderr when the key expires within ${EXPIRY_WARNING_DAYS} days. A sandbox test key (kenso_test_) adds keyKind "test" and the sandbox it works in.`,
|
|
8640
8657
|
flags: {},
|
|
8641
8658
|
examples: ["kenso auth status", "kenso auth status --profile client-a"],
|
|
8642
8659
|
operationIds: ["me.get", "api-keys.list"],
|
|
@@ -8651,6 +8668,18 @@ var init_status = __esm({
|
|
|
8651
8668
|
activeWorkspace = { id: activeId, name: match?.name ?? null };
|
|
8652
8669
|
if (!match) ctx.output.warn(`The active workspace ${activeId} is not one of this key's workspaces.`);
|
|
8653
8670
|
}
|
|
8671
|
+
const saved = readConfig(ctx.env).profiles[ctx.auth.profileName] ?? {};
|
|
8672
|
+
const envOverrides = [];
|
|
8673
|
+
if (ctx.auth.source === "env" && saved.apiKey && saved.apiKey !== ctx.auth.apiKey) envOverrides.push("KENSO_API_KEY");
|
|
8674
|
+
if (!ctx.flags.workspace?.trim() && ctx.env.KENSO_WORKSPACE_ID?.trim() && saved.workspaceId && saved.workspaceId !== activeId) {
|
|
8675
|
+
envOverrides.push("KENSO_WORKSPACE_ID");
|
|
8676
|
+
}
|
|
8677
|
+
if (envOverrides.length > 0) {
|
|
8678
|
+
const both = envOverrides.length > 1;
|
|
8679
|
+
ctx.output.warn(
|
|
8680
|
+
`${envOverrides.join(" and ")} ${both ? "are set and win" : "is set and wins"} over the profile "${ctx.auth.profileName}". Unset ${both ? "them" : "it"} to use what the profile saved.`
|
|
8681
|
+
);
|
|
8682
|
+
}
|
|
8654
8683
|
const memberIds = workspaces.map((w) => String(w.id));
|
|
8655
8684
|
const keysWorkspace = activeId && memberIds.includes(activeId) ? activeId : memberIds[0];
|
|
8656
8685
|
let keyExpiresAt = null;
|
|
@@ -8689,7 +8718,10 @@ var init_status = __esm({
|
|
|
8689
8718
|
activeWorkspace,
|
|
8690
8719
|
keyExpiresAt,
|
|
8691
8720
|
keySource: ctx.auth.source,
|
|
8692
|
-
profile: ctx.auth.profileName
|
|
8721
|
+
profile: ctx.auth.profileName,
|
|
8722
|
+
// A test key reaches only the sandbox it was made for, which kenso sandbox create saved as the workspace.
|
|
8723
|
+
...isTestKey(apiKey) ? { keyKind: "test", sandboxId: activeId ?? null } : {},
|
|
8724
|
+
...envOverrides.length > 0 ? { envOverrides } : {}
|
|
8693
8725
|
});
|
|
8694
8726
|
return ExitCode.Ok;
|
|
8695
8727
|
}
|
|
@@ -8834,9 +8866,9 @@ function stringFlag2(flags, name) {
|
|
|
8834
8866
|
const text3 = value.trim();
|
|
8835
8867
|
return text3 === "" ? void 0 : text3;
|
|
8836
8868
|
}
|
|
8837
|
-
function requireFlag(flags, name,
|
|
8869
|
+
function requireFlag(flags, name, command42, hint) {
|
|
8838
8870
|
const value = stringFlag2(flags, name);
|
|
8839
|
-
if (value === void 0) throw usageError(`--${name} is required for ${
|
|
8871
|
+
if (value === void 0) throw usageError(`--${name} is required for ${command42}.`, { field: name, next: `${command42} --help`, ...hint ? { hint } : {} });
|
|
8840
8872
|
return value;
|
|
8841
8873
|
}
|
|
8842
8874
|
function positiveId(value) {
|
|
@@ -8845,8 +8877,8 @@ function positiveId(value) {
|
|
|
8845
8877
|
const id = Number(text3);
|
|
8846
8878
|
return Number.isSafeInteger(id) && id > 0 ? id : void 0;
|
|
8847
8879
|
}
|
|
8848
|
-
function idFlag(flags, name,
|
|
8849
|
-
const raw = requireFlag(flags, name,
|
|
8880
|
+
function idFlag(flags, name, command42) {
|
|
8881
|
+
const raw = requireFlag(flags, name, command42);
|
|
8850
8882
|
const id = positiveId(raw);
|
|
8851
8883
|
if (id === void 0) throw usageError(`--${name} must be a positive whole number (got "${raw}").`, { field: name });
|
|
8852
8884
|
return id;
|
|
@@ -8866,8 +8898,8 @@ function isDryRun(ctx) {
|
|
|
8866
8898
|
function shellQuote4(value) {
|
|
8867
8899
|
return /^[A-Za-z0-9_\-.,:/@=+%]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
|
|
8868
8900
|
}
|
|
8869
|
-
function sameCommand2(
|
|
8870
|
-
const parts2 = [
|
|
8901
|
+
function sameCommand2(command42, flags, ctx, extra = []) {
|
|
8902
|
+
const parts2 = [command42];
|
|
8871
8903
|
for (const [name, value] of Object.entries(flags)) {
|
|
8872
8904
|
if (value === void 0 || value === false) continue;
|
|
8873
8905
|
if (value === true) parts2.push(`--${name}`);
|
|
@@ -10004,12 +10036,12 @@ import { join as join11 } from "node:path";
|
|
|
10004
10036
|
function whereDir(env) {
|
|
10005
10037
|
return join11(runsRoot(env), WHERE_DIR);
|
|
10006
10038
|
}
|
|
10007
|
-
async function unfinishedWhereIds(ctx,
|
|
10039
|
+
async function unfinishedWhereIds(ctx, command42, args) {
|
|
10008
10040
|
const dir = whereDir(ctx.env);
|
|
10009
10041
|
const identity = argsIdentity(args);
|
|
10010
10042
|
const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
|
|
10011
10043
|
for (const run of await listRuns(ctx.env)) {
|
|
10012
|
-
if (run.command !==
|
|
10044
|
+
if (run.command !== command42 || run.status === "done" || run.status === "planned") continue;
|
|
10013
10045
|
if ((run.workspaceId || void 0) !== (workspaceId || void 0) || argsIdentity(run.args) !== identity) continue;
|
|
10014
10046
|
if (run.inputPath?.startsWith(`${dir}/`) && existsSync5(run.inputPath)) return run.inputPath;
|
|
10015
10047
|
}
|
|
@@ -10155,14 +10187,14 @@ async function idsFromRun(ctx, runId) {
|
|
|
10155
10187
|
return { ...idItems(ids2), source: "run" };
|
|
10156
10188
|
}
|
|
10157
10189
|
async function collectIds(ctx, flags, kind, dryRun2) {
|
|
10158
|
-
const
|
|
10190
|
+
const command42 = `kenso contacts ${kind}`;
|
|
10159
10191
|
const ids2 = stringFlag2(flags, "ids");
|
|
10160
10192
|
const where = kind === "restore" ? void 0 : stringFlag2(flags, "where");
|
|
10161
10193
|
const run = kind === "restore" ? stringFlag2(flags, "run") : void 0;
|
|
10162
10194
|
const given = [ids2, where, run].filter((v) => v !== void 0).length;
|
|
10163
10195
|
if (given !== 1) {
|
|
10164
10196
|
const choices = kind === "restore" ? "--ids <file|-> or --run <runId>" : "--ids <file|-> or --where '<json>'";
|
|
10165
|
-
throw usageError(`${
|
|
10197
|
+
throw usageError(`${command42} needs exactly one of ${choices}.`, { field: "ids", next: `${command42} --help` });
|
|
10166
10198
|
}
|
|
10167
10199
|
if (ids2 !== void 0) return idsFromFile(ctx, ids2);
|
|
10168
10200
|
if (where !== void 0) return idsFromWhere(ctx, kind, flags, where, dryRun2);
|
|
@@ -11531,12 +11563,317 @@ var init_runs2 = __esm({
|
|
|
11531
11563
|
}
|
|
11532
11564
|
});
|
|
11533
11565
|
|
|
11534
|
-
// src/commands/
|
|
11566
|
+
// src/commands/sandbox/shared.ts
|
|
11567
|
+
function requireLiveKey(ctx) {
|
|
11568
|
+
if (!isTestKey(ctx.auth.apiKey)) return;
|
|
11569
|
+
throw new KensoError({
|
|
11570
|
+
code: "live_key_required",
|
|
11571
|
+
message: "Sandbox commands need your live key. Run them without --profile sandbox.",
|
|
11572
|
+
exitCode: ExitCode.Auth
|
|
11573
|
+
});
|
|
11574
|
+
}
|
|
11575
|
+
function hasDetailCode(err, code) {
|
|
11576
|
+
const details = err.details?.error?.details;
|
|
11577
|
+
return Array.isArray(details) && details.some((d) => d?.code === code);
|
|
11578
|
+
}
|
|
11579
|
+
async function sandboxIdOf(ctx, given) {
|
|
11580
|
+
if (given !== void 0) {
|
|
11581
|
+
const id = given.trim();
|
|
11582
|
+
if (!/^[1-9]\d*$/.test(id)) {
|
|
11583
|
+
throw usageError(`"${given}" is not a sandbox id: ids are positive whole numbers.`, { field: "sandboxId", next: "kenso sandbox list" });
|
|
11584
|
+
}
|
|
11585
|
+
return id;
|
|
11586
|
+
}
|
|
11587
|
+
const res = await ctx.client.request({ method: "GET", path: "/v1/sandboxes", signal: ctx.signal });
|
|
11588
|
+
const ids2 = (Array.isArray(res.body?.data) ? res.body.data : []).map((s) => String(s.id));
|
|
11589
|
+
if (ids2.length === 0) {
|
|
11590
|
+
throw new KensoError({
|
|
11591
|
+
code: "no_sandbox",
|
|
11592
|
+
message: "You have no sandbox.",
|
|
11593
|
+
exitCode: ExitCode.NotFound,
|
|
11594
|
+
hint: 'Run "kenso sandbox create" first.',
|
|
11595
|
+
next: "kenso sandbox create"
|
|
11596
|
+
});
|
|
11597
|
+
}
|
|
11598
|
+
if (ids2.length > 1) throw usageError(`You have ${ids2.length} sandboxes: name one.`, { field: "sandboxId", next: "kenso sandbox list" });
|
|
11599
|
+
return ids2[0];
|
|
11600
|
+
}
|
|
11601
|
+
function saveTestKey(ctx, sandboxId, key) {
|
|
11602
|
+
try {
|
|
11603
|
+
const profiles = readConfig(ctx.env).profiles;
|
|
11604
|
+
const held = profiles[SANDBOX_PROFILE]?.apiKey;
|
|
11605
|
+
if (held !== void 0 && !isTestKey(held)) {
|
|
11606
|
+
ctx.output.warn(`The profile "${SANDBOX_PROFILE}" holds a live key, so it was left unchanged. Copy the secret now: it is shown once.`);
|
|
11607
|
+
return;
|
|
11608
|
+
}
|
|
11609
|
+
const current = profiles[ctx.auth.profileName] ?? {};
|
|
11610
|
+
writeProfile(
|
|
11611
|
+
SANDBOX_PROFILE,
|
|
11612
|
+
{
|
|
11613
|
+
apiKey: key.secret,
|
|
11614
|
+
workspaceId: sandboxId,
|
|
11615
|
+
// The API the sandbox was made on, saved as login saves it: only when it is not the default.
|
|
11616
|
+
apiUrl: ctx.auth.apiUrl !== DEFAULT_API_URL ? ctx.auth.apiUrl : void 0,
|
|
11617
|
+
email: current.email,
|
|
11618
|
+
keyId: key.id
|
|
11619
|
+
},
|
|
11620
|
+
{ env: ctx.env }
|
|
11621
|
+
);
|
|
11622
|
+
} catch (err) {
|
|
11623
|
+
ctx.output.warn(`Could not save the sandbox profile: ${err instanceof Error ? err.message : String(err)}. Copy the secret now: it is shown once.`);
|
|
11624
|
+
return;
|
|
11625
|
+
}
|
|
11626
|
+
ctx.output.info(`Saved as profile "${SANDBOX_PROFILE}". Run commands against it with --profile ${SANDBOX_PROFILE}. The key is shown once.`);
|
|
11627
|
+
const set = [ctx.auth.source === "env" ? "KENSO_API_KEY" : "", ctx.env.KENSO_WORKSPACE_ID?.trim() ? "KENSO_WORKSPACE_ID" : ""].filter((name) => name !== "");
|
|
11628
|
+
if (set.length > 0) {
|
|
11629
|
+
const both = set.length > 1;
|
|
11630
|
+
ctx.output.warn(
|
|
11631
|
+
`${set.join(" and ")} ${both ? "are set and win" : "is set and wins"} over the saved profile, so --profile ${SANDBOX_PROFILE} will not use the test key and its sandbox. To work in the sandbox, set KENSO_API_KEY=<the test key> KENSO_WORKSPACE_ID=${sandboxId}, or unset ${both ? "them" : "it"}.`
|
|
11632
|
+
);
|
|
11633
|
+
}
|
|
11634
|
+
}
|
|
11635
|
+
function keyOutput(key) {
|
|
11636
|
+
return { id: key.id, prefix: key.prefix, secret: key.secret, expiresAt: key.expiresAt ?? null };
|
|
11637
|
+
}
|
|
11638
|
+
var SANDBOX_PROFILE, SANDBOX_GATES, SANDBOX_ID_POSITIONAL;
|
|
11639
|
+
var init_shared = __esm({
|
|
11640
|
+
"src/commands/sandbox/shared.ts"() {
|
|
11641
|
+
"use strict";
|
|
11642
|
+
init_api_key();
|
|
11643
|
+
init_config();
|
|
11644
|
+
init_errors();
|
|
11645
|
+
init_exit_codes();
|
|
11646
|
+
SANDBOX_PROFILE = "sandbox";
|
|
11647
|
+
SANDBOX_GATES = { all: ["developer_sandboxes"] };
|
|
11648
|
+
SANDBOX_ID_POSITIONAL = { name: "sandboxId", description: "The sandbox id (default: your one sandbox)" };
|
|
11649
|
+
}
|
|
11650
|
+
});
|
|
11651
|
+
|
|
11652
|
+
// src/commands/sandbox/create.ts
|
|
11653
|
+
var create_exports = {};
|
|
11654
|
+
__export(create_exports, {
|
|
11655
|
+
default: () => create_default
|
|
11656
|
+
});
|
|
11657
|
+
var command23, create_default;
|
|
11658
|
+
var init_create = __esm({
|
|
11659
|
+
"src/commands/sandbox/create.ts"() {
|
|
11660
|
+
"use strict";
|
|
11661
|
+
init_errors();
|
|
11662
|
+
init_exit_codes();
|
|
11663
|
+
init_http();
|
|
11664
|
+
init_shared();
|
|
11665
|
+
command23 = {
|
|
11666
|
+
resource: "sandbox",
|
|
11667
|
+
action: "create",
|
|
11668
|
+
summary: "Create your developer sandbox and save its test key as the sandbox profile",
|
|
11669
|
+
description: `Calls POST /v1/sandboxes with your live key. Kenso creates a sandbox workspace of your own, seeds it with campaigns, contacts, inboxes and threads, and returns a test key (kenso_test_...) that works only there. The key is saved as the profile "${SANDBOX_PROFILE}" and the active profile stays as it is: add --profile ${SANDBOX_PROFILE} to run a command in the sandbox. In a sandbox, sends are simulated: nothing leaves Kenso.`,
|
|
11670
|
+
flags: {},
|
|
11671
|
+
examples: ["kenso sandbox create", "kenso campaigns list --profile sandbox"],
|
|
11672
|
+
beta: { featureGates: SANDBOX_GATES },
|
|
11673
|
+
operationIds: ["sandboxes.create"],
|
|
11674
|
+
async run(ctx) {
|
|
11675
|
+
requireLiveKey(ctx);
|
|
11676
|
+
let body;
|
|
11677
|
+
try {
|
|
11678
|
+
body = (await ctx.client.request({ method: "POST", path: "/v1/sandboxes", signal: ctx.signal })).body;
|
|
11679
|
+
} catch (err) {
|
|
11680
|
+
if (err instanceof KensoError && err.httpStatus === 409 && hasDetailCode(err, "sandbox_exists")) {
|
|
11681
|
+
throw new KensoError({
|
|
11682
|
+
code: err.code,
|
|
11683
|
+
message: err.message,
|
|
11684
|
+
exitCode: err.exitCode,
|
|
11685
|
+
httpStatus: err.httpStatus,
|
|
11686
|
+
hint: 'You already have a sandbox. Run "kenso sandbox list", or "kenso sandbox key" for a new test key.',
|
|
11687
|
+
next: "kenso sandbox key",
|
|
11688
|
+
requestId: err.requestId
|
|
11689
|
+
});
|
|
11690
|
+
}
|
|
11691
|
+
throw err;
|
|
11692
|
+
}
|
|
11693
|
+
const sandbox = unwrap(body) ?? {};
|
|
11694
|
+
const testKey = sandbox.testKey ?? {};
|
|
11695
|
+
saveTestKey(ctx, String(sandbox.id), testKey);
|
|
11696
|
+
ctx.output.object({
|
|
11697
|
+
sandboxId: sandbox.id ?? null,
|
|
11698
|
+
name: sandbox.name ?? null,
|
|
11699
|
+
status: sandbox.status ?? null,
|
|
11700
|
+
seed: sandbox.seed ?? null,
|
|
11701
|
+
testKey: keyOutput(testKey),
|
|
11702
|
+
profile: SANDBOX_PROFILE
|
|
11703
|
+
});
|
|
11704
|
+
return ExitCode.Ok;
|
|
11705
|
+
}
|
|
11706
|
+
};
|
|
11707
|
+
create_default = command23;
|
|
11708
|
+
}
|
|
11709
|
+
});
|
|
11710
|
+
|
|
11711
|
+
// src/commands/sandbox/delete.ts
|
|
11712
|
+
var delete_exports = {};
|
|
11713
|
+
__export(delete_exports, {
|
|
11714
|
+
default: () => delete_default
|
|
11715
|
+
});
|
|
11716
|
+
var command24, delete_default;
|
|
11717
|
+
var init_delete = __esm({
|
|
11718
|
+
"src/commands/sandbox/delete.ts"() {
|
|
11719
|
+
"use strict";
|
|
11720
|
+
init_config();
|
|
11721
|
+
init_confirm();
|
|
11722
|
+
init_exit_codes();
|
|
11723
|
+
init_shared();
|
|
11724
|
+
command24 = {
|
|
11725
|
+
resource: "sandbox",
|
|
11726
|
+
action: "delete",
|
|
11727
|
+
summary: "Delete your sandbox and its test keys",
|
|
11728
|
+
description: `Calls DELETE /v1/sandboxes/{sandboxId} with your live key: the sandbox's data is gone for good and its test keys are revoked. Then removes the profile "${SANDBOX_PROFILE}" when it holds this sandbox. Without an id it deletes your one sandbox. It asks first on a terminal; anywhere else it needs --yes.`,
|
|
11729
|
+
flags: {},
|
|
11730
|
+
positionals: [SANDBOX_ID_POSITIONAL],
|
|
11731
|
+
examples: ["kenso sandbox delete --dry-run", "kenso sandbox delete 20417 --yes"],
|
|
11732
|
+
beta: { featureGates: SANDBOX_GATES },
|
|
11733
|
+
operationIds: ["sandboxes.list", "sandboxes.delete"],
|
|
11734
|
+
dryRun: true,
|
|
11735
|
+
async run(ctx, { positionals }) {
|
|
11736
|
+
requireLiveKey(ctx);
|
|
11737
|
+
const id = await sandboxIdOf(ctx, positionals[0]);
|
|
11738
|
+
const path = `/v1/sandboxes/${id}`;
|
|
11739
|
+
if (ctx.flags.dryRun) {
|
|
11740
|
+
ctx.output.object({ dryRun: true, request: { method: "DELETE", path } });
|
|
11741
|
+
return ExitCode.Ok;
|
|
11742
|
+
}
|
|
11743
|
+
await confirmDestructive(ctx, `kenso sandbox delete deletes sandbox ${id} and everything in it`, `kenso sandbox delete ${id} --yes`);
|
|
11744
|
+
await ctx.client.request({ method: "DELETE", path, signal: ctx.signal });
|
|
11745
|
+
const profileRemoved = readConfig(ctx.env).profiles[SANDBOX_PROFILE]?.workspaceId === id;
|
|
11746
|
+
if (profileRemoved) removeProfile(SANDBOX_PROFILE, ctx.env);
|
|
11747
|
+
ctx.output.object({ sandboxId: Number(id), deleted: true, profileRemoved });
|
|
11748
|
+
return ExitCode.Ok;
|
|
11749
|
+
}
|
|
11750
|
+
};
|
|
11751
|
+
delete_default = command24;
|
|
11752
|
+
}
|
|
11753
|
+
});
|
|
11754
|
+
|
|
11755
|
+
// src/commands/sandbox/key.ts
|
|
11756
|
+
var key_exports = {};
|
|
11757
|
+
__export(key_exports, {
|
|
11758
|
+
default: () => key_default
|
|
11759
|
+
});
|
|
11760
|
+
var command25, key_default;
|
|
11761
|
+
var init_key = __esm({
|
|
11762
|
+
"src/commands/sandbox/key.ts"() {
|
|
11763
|
+
"use strict";
|
|
11764
|
+
init_exit_codes();
|
|
11765
|
+
init_http();
|
|
11766
|
+
init_shared();
|
|
11767
|
+
command25 = {
|
|
11768
|
+
resource: "sandbox",
|
|
11769
|
+
action: "key",
|
|
11770
|
+
summary: "Create a new test key for your sandbox and save it as the sandbox profile",
|
|
11771
|
+
description: `Calls POST /v1/sandboxes/{sandboxId}/test-keys with your live key and saves the new key as the profile "${SANDBOX_PROFILE}" (the active profile stays as it is). A sandbox has 5 active test keys at most. Without an id it uses your one sandbox.`,
|
|
11772
|
+
flags: {},
|
|
11773
|
+
positionals: [SANDBOX_ID_POSITIONAL],
|
|
11774
|
+
examples: ["kenso sandbox key", "kenso sandbox key 20417"],
|
|
11775
|
+
beta: { featureGates: SANDBOX_GATES },
|
|
11776
|
+
operationIds: ["sandboxes.list", "sandboxes.create-test-key"],
|
|
11777
|
+
async run(ctx, { positionals }) {
|
|
11778
|
+
requireLiveKey(ctx);
|
|
11779
|
+
const id = await sandboxIdOf(ctx, positionals[0]);
|
|
11780
|
+
const res = await ctx.client.request({ method: "POST", path: `/v1/sandboxes/${id}/test-keys`, signal: ctx.signal });
|
|
11781
|
+
const key = unwrap(res.body) ?? {};
|
|
11782
|
+
saveTestKey(ctx, id, key);
|
|
11783
|
+
ctx.output.object(keyOutput(key));
|
|
11784
|
+
return ExitCode.Ok;
|
|
11785
|
+
}
|
|
11786
|
+
};
|
|
11787
|
+
key_default = command25;
|
|
11788
|
+
}
|
|
11789
|
+
});
|
|
11790
|
+
|
|
11791
|
+
// src/commands/sandbox/list.ts
|
|
11792
|
+
var list_exports2 = {};
|
|
11793
|
+
__export(list_exports2, {
|
|
11794
|
+
default: () => list_default2
|
|
11795
|
+
});
|
|
11796
|
+
var command26, list_default2;
|
|
11797
|
+
var init_list2 = __esm({
|
|
11798
|
+
"src/commands/sandbox/list.ts"() {
|
|
11799
|
+
"use strict";
|
|
11800
|
+
init_exit_codes();
|
|
11801
|
+
init_shared();
|
|
11802
|
+
command26 = {
|
|
11803
|
+
resource: "sandbox",
|
|
11804
|
+
action: "list",
|
|
11805
|
+
summary: "List your developer sandbox",
|
|
11806
|
+
description: "Calls GET /v1/sandboxes with your live key. You have one sandbox at most, so this prints one row or none.",
|
|
11807
|
+
flags: {},
|
|
11808
|
+
examples: ["kenso sandbox list"],
|
|
11809
|
+
beta: { featureGates: SANDBOX_GATES },
|
|
11810
|
+
operationIds: ["sandboxes.list"],
|
|
11811
|
+
async run(ctx) {
|
|
11812
|
+
requireLiveKey(ctx);
|
|
11813
|
+
const res = await ctx.client.request({ method: "GET", path: "/v1/sandboxes", signal: ctx.signal });
|
|
11814
|
+
await ctx.output.list(Array.isArray(res.body?.data) ? res.body.data : []);
|
|
11815
|
+
return ExitCode.Ok;
|
|
11816
|
+
}
|
|
11817
|
+
};
|
|
11818
|
+
list_default2 = command26;
|
|
11819
|
+
}
|
|
11820
|
+
});
|
|
11821
|
+
|
|
11822
|
+
// src/commands/sandbox/reset.ts
|
|
11823
|
+
var reset_exports = {};
|
|
11824
|
+
__export(reset_exports, {
|
|
11825
|
+
default: () => reset_default
|
|
11826
|
+
});
|
|
11827
|
+
var command27, reset_default;
|
|
11828
|
+
var init_reset = __esm({
|
|
11829
|
+
"src/commands/sandbox/reset.ts"() {
|
|
11830
|
+
"use strict";
|
|
11831
|
+
init_exit_codes();
|
|
11832
|
+
init_http();
|
|
11833
|
+
init_shared();
|
|
11834
|
+
command27 = {
|
|
11835
|
+
resource: "sandbox",
|
|
11836
|
+
action: "reset",
|
|
11837
|
+
summary: "Reset your sandbox to its seed data",
|
|
11838
|
+
description: "Calls POST /v1/sandboxes/{sandboxId}/reset with your live key: everything in the sandbox is deleted and seeded again. Its test keys and webhook endpoints stay. Without an id it resets your one sandbox.",
|
|
11839
|
+
flags: {},
|
|
11840
|
+
positionals: [SANDBOX_ID_POSITIONAL],
|
|
11841
|
+
examples: ["kenso sandbox reset", "kenso sandbox reset 20417"],
|
|
11842
|
+
beta: { featureGates: SANDBOX_GATES },
|
|
11843
|
+
operationIds: ["sandboxes.list", "sandboxes.reset"],
|
|
11844
|
+
async run(ctx, { positionals }) {
|
|
11845
|
+
requireLiveKey(ctx);
|
|
11846
|
+
const id = await sandboxIdOf(ctx, positionals[0]);
|
|
11847
|
+
const res = await ctx.client.request({ method: "POST", path: `/v1/sandboxes/${id}/reset`, signal: ctx.signal });
|
|
11848
|
+
ctx.output.object(unwrap(res.body));
|
|
11849
|
+
return ExitCode.Ok;
|
|
11850
|
+
}
|
|
11851
|
+
};
|
|
11852
|
+
reset_default = command27;
|
|
11853
|
+
}
|
|
11854
|
+
});
|
|
11855
|
+
|
|
11856
|
+
// src/commands/sandbox/index.ts
|
|
11535
11857
|
var actions15;
|
|
11858
|
+
var init_sandbox2 = __esm({
|
|
11859
|
+
"src/commands/sandbox/index.ts"() {
|
|
11860
|
+
"use strict";
|
|
11861
|
+
actions15 = {
|
|
11862
|
+
create: () => Promise.resolve().then(() => (init_create(), create_exports)).then((m) => m.default),
|
|
11863
|
+
delete: () => Promise.resolve().then(() => (init_delete(), delete_exports)).then((m) => m.default),
|
|
11864
|
+
key: () => Promise.resolve().then(() => (init_key(), key_exports)).then((m) => m.default),
|
|
11865
|
+
list: () => Promise.resolve().then(() => (init_list2(), list_exports2)).then((m) => m.default),
|
|
11866
|
+
reset: () => Promise.resolve().then(() => (init_reset(), reset_exports)).then((m) => m.default)
|
|
11867
|
+
};
|
|
11868
|
+
}
|
|
11869
|
+
});
|
|
11870
|
+
|
|
11871
|
+
// src/commands/skill/index.ts
|
|
11872
|
+
var actions16;
|
|
11536
11873
|
var init_skill = __esm({
|
|
11537
11874
|
"src/commands/skill/index.ts"() {
|
|
11538
11875
|
"use strict";
|
|
11539
|
-
|
|
11876
|
+
actions16 = {
|
|
11540
11877
|
install: () => Promise.resolve().then(() => (init_install(), install_exports)).then((m) => m.default)
|
|
11541
11878
|
};
|
|
11542
11879
|
}
|
|
@@ -11772,7 +12109,7 @@ __export(pull_exports, {
|
|
|
11772
12109
|
});
|
|
11773
12110
|
import { mkdir, writeFile as writeFile4 } from "node:fs/promises";
|
|
11774
12111
|
import { dirname as dirname2, resolve as resolve11 } from "node:path";
|
|
11775
|
-
var
|
|
12112
|
+
var command28, pull_default;
|
|
11776
12113
|
var init_pull = __esm({
|
|
11777
12114
|
"src/commands/studio/pull.ts"() {
|
|
11778
12115
|
"use strict";
|
|
@@ -11782,7 +12119,7 @@ var init_pull = __esm({
|
|
|
11782
12119
|
init_common2();
|
|
11783
12120
|
init_folder();
|
|
11784
12121
|
init_transfer();
|
|
11785
|
-
|
|
12122
|
+
command28 = {
|
|
11786
12123
|
resource: "studio",
|
|
11787
12124
|
action: "pull",
|
|
11788
12125
|
summary: "Write a template version's files to a folder",
|
|
@@ -11829,7 +12166,7 @@ var init_pull = __esm({
|
|
|
11829
12166
|
return ExitCode.Ok;
|
|
11830
12167
|
}
|
|
11831
12168
|
};
|
|
11832
|
-
pull_default =
|
|
12169
|
+
pull_default = command28;
|
|
11833
12170
|
}
|
|
11834
12171
|
});
|
|
11835
12172
|
|
|
@@ -11862,7 +12199,7 @@ var push_exports = {};
|
|
|
11862
12199
|
__export(push_exports, {
|
|
11863
12200
|
default: () => push_default
|
|
11864
12201
|
});
|
|
11865
|
-
var BUILT_BY, DEFAULT_MESSAGE,
|
|
12202
|
+
var BUILT_BY, DEFAULT_MESSAGE, command29, push_default;
|
|
11866
12203
|
var init_push = __esm({
|
|
11867
12204
|
"src/commands/studio/push.ts"() {
|
|
11868
12205
|
"use strict";
|
|
@@ -11874,7 +12211,7 @@ var init_push = __esm({
|
|
|
11874
12211
|
init_read();
|
|
11875
12212
|
BUILT_BY = "customer_agent";
|
|
11876
12213
|
DEFAULT_MESSAGE = "Pushed with the Kenso CLI";
|
|
11877
|
-
|
|
12214
|
+
command29 = {
|
|
11878
12215
|
resource: "studio",
|
|
11879
12216
|
action: "push",
|
|
11880
12217
|
summary: "Save a folder's files to a template's draft and print the validation",
|
|
@@ -11966,7 +12303,7 @@ var init_push = __esm({
|
|
|
11966
12303
|
);
|
|
11967
12304
|
}
|
|
11968
12305
|
};
|
|
11969
|
-
push_default =
|
|
12306
|
+
push_default = command29;
|
|
11970
12307
|
}
|
|
11971
12308
|
});
|
|
11972
12309
|
|
|
@@ -11975,7 +12312,7 @@ var validate_exports = {};
|
|
|
11975
12312
|
__export(validate_exports, {
|
|
11976
12313
|
default: () => validate_default
|
|
11977
12314
|
});
|
|
11978
|
-
var
|
|
12315
|
+
var command30, validate_default;
|
|
11979
12316
|
var init_validate = __esm({
|
|
11980
12317
|
"src/commands/studio/validate.ts"() {
|
|
11981
12318
|
"use strict";
|
|
@@ -11984,7 +12321,7 @@ var init_validate = __esm({
|
|
|
11984
12321
|
init_columns();
|
|
11985
12322
|
init_common2();
|
|
11986
12323
|
init_read();
|
|
11987
|
-
|
|
12324
|
+
command30 = {
|
|
11988
12325
|
resource: "studio",
|
|
11989
12326
|
action: "validate",
|
|
11990
12327
|
summary: "Validate a folder's files against a template without saving them",
|
|
@@ -12013,7 +12350,7 @@ var init_validate = __esm({
|
|
|
12013
12350
|
throw validationFailed(validation, "The files have validation errors", commandLine2(ctx, "studio validate", args));
|
|
12014
12351
|
}
|
|
12015
12352
|
};
|
|
12016
|
-
validate_default =
|
|
12353
|
+
validate_default = command30;
|
|
12017
12354
|
}
|
|
12018
12355
|
});
|
|
12019
12356
|
|
|
@@ -12062,7 +12399,7 @@ function accountIds(value) {
|
|
|
12062
12399
|
}
|
|
12063
12400
|
return ids2.map(Number);
|
|
12064
12401
|
}
|
|
12065
|
-
var SHOWN,
|
|
12402
|
+
var SHOWN, command31, preview_default;
|
|
12066
12403
|
var init_preview = __esm({
|
|
12067
12404
|
"src/commands/studio/preview.ts"() {
|
|
12068
12405
|
"use strict";
|
|
@@ -12074,7 +12411,7 @@ var init_preview = __esm({
|
|
|
12074
12411
|
init_common2();
|
|
12075
12412
|
init_folder();
|
|
12076
12413
|
SHOWN = 5;
|
|
12077
|
-
|
|
12414
|
+
command31 = {
|
|
12078
12415
|
resource: "studio",
|
|
12079
12416
|
action: "preview",
|
|
12080
12417
|
summary: "Render a saved version for up to 3 accounts; for local edits, studio push them to the draft first",
|
|
@@ -12123,7 +12460,7 @@ var init_preview = __esm({
|
|
|
12123
12460
|
return ExitCode.Ok;
|
|
12124
12461
|
}
|
|
12125
12462
|
};
|
|
12126
|
-
preview_default =
|
|
12463
|
+
preview_default = command31;
|
|
12127
12464
|
}
|
|
12128
12465
|
});
|
|
12129
12466
|
|
|
@@ -12324,7 +12661,7 @@ function estimateOutput(templateId, target, estimate2) {
|
|
|
12324
12661
|
...target.campaignId !== void 0 ? { estimateNote: "An upper bound: it counts one page per lead, and a campaign run builds one page per company." } : {}
|
|
12325
12662
|
};
|
|
12326
12663
|
}
|
|
12327
|
-
var COMMAND6, sha2562,
|
|
12664
|
+
var COMMAND6, sha2562, command32, fill_default;
|
|
12328
12665
|
var init_fill = __esm({
|
|
12329
12666
|
"src/commands/studio/fill.ts"() {
|
|
12330
12667
|
"use strict";
|
|
@@ -12340,7 +12677,7 @@ var init_fill = __esm({
|
|
|
12340
12677
|
init_fill_runs();
|
|
12341
12678
|
COMMAND6 = "studio fill";
|
|
12342
12679
|
sha2562 = (data) => createHash8("sha256").update(data).digest("hex");
|
|
12343
|
-
|
|
12680
|
+
command32 = {
|
|
12344
12681
|
resource: "studio",
|
|
12345
12682
|
action: "fill",
|
|
12346
12683
|
summary: "Fill a template on many accounts or campaign leads (estimate first)",
|
|
@@ -12400,16 +12737,16 @@ var init_fill = __esm({
|
|
|
12400
12737
|
return outcome.exitCode;
|
|
12401
12738
|
}
|
|
12402
12739
|
};
|
|
12403
|
-
fill_default =
|
|
12740
|
+
fill_default = command32;
|
|
12404
12741
|
}
|
|
12405
12742
|
});
|
|
12406
12743
|
|
|
12407
12744
|
// src/commands/studio/index.ts
|
|
12408
|
-
var
|
|
12745
|
+
var actions17;
|
|
12409
12746
|
var init_studio2 = __esm({
|
|
12410
12747
|
"src/commands/studio/index.ts"() {
|
|
12411
12748
|
"use strict";
|
|
12412
|
-
|
|
12749
|
+
actions17 = {
|
|
12413
12750
|
pull: () => Promise.resolve().then(() => (init_pull(), pull_exports)).then((m) => m.default),
|
|
12414
12751
|
push: () => Promise.resolve().then(() => (init_push(), push_exports)).then((m) => m.default),
|
|
12415
12752
|
validate: () => Promise.resolve().then(() => (init_validate(), validate_exports)).then((m) => m.default),
|
|
@@ -12551,7 +12888,7 @@ function readBody(req) {
|
|
|
12551
12888
|
function reply(res, status, body) {
|
|
12552
12889
|
res.writeHead(status, { "content-type": "application/json" }).end(JSON.stringify(body));
|
|
12553
12890
|
}
|
|
12554
|
-
var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES,
|
|
12891
|
+
var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command33, listen_default;
|
|
12555
12892
|
var init_listen = __esm({
|
|
12556
12893
|
"src/commands/webhooks/listen.ts"() {
|
|
12557
12894
|
"use strict";
|
|
@@ -12562,7 +12899,7 @@ var init_listen = __esm({
|
|
|
12562
12899
|
MIN_POLL_MS = 1e3;
|
|
12563
12900
|
MAX_POLL_MS = 6e4;
|
|
12564
12901
|
MAX_TRIGGER_BYTES = 1e6;
|
|
12565
|
-
|
|
12902
|
+
command33 = {
|
|
12566
12903
|
resource: "webhooks",
|
|
12567
12904
|
action: "listen",
|
|
12568
12905
|
summary: "Stream the workspace's events and forward them, signed, to a local handler",
|
|
@@ -12668,7 +13005,7 @@ var init_listen = __esm({
|
|
|
12668
13005
|
return ExitCode.Ok;
|
|
12669
13006
|
}
|
|
12670
13007
|
};
|
|
12671
|
-
listen_default =
|
|
13008
|
+
listen_default = command33;
|
|
12672
13009
|
}
|
|
12673
13010
|
});
|
|
12674
13011
|
|
|
@@ -12687,7 +13024,7 @@ function notRunning() {
|
|
|
12687
13024
|
next: LISTEN_NEXT
|
|
12688
13025
|
});
|
|
12689
13026
|
}
|
|
12690
|
-
var LISTEN_NEXT,
|
|
13027
|
+
var LISTEN_NEXT, command34, trigger_default;
|
|
12691
13028
|
var init_trigger = __esm({
|
|
12692
13029
|
"src/commands/webhooks/trigger.ts"() {
|
|
12693
13030
|
"use strict";
|
|
@@ -12696,7 +13033,7 @@ var init_trigger = __esm({
|
|
|
12696
13033
|
init_http();
|
|
12697
13034
|
init_local();
|
|
12698
13035
|
LISTEN_NEXT = "kenso webhooks listen --forward-to http://localhost:3000/hook";
|
|
12699
|
-
|
|
13036
|
+
command34 = {
|
|
12700
13037
|
resource: "webhooks",
|
|
12701
13038
|
action: "trigger",
|
|
12702
13039
|
summary: "Send a sample event of one type through the running kenso webhooks listen",
|
|
@@ -12753,16 +13090,16 @@ var init_trigger = __esm({
|
|
|
12753
13090
|
return ExitCode.Ok;
|
|
12754
13091
|
}
|
|
12755
13092
|
};
|
|
12756
|
-
trigger_default =
|
|
13093
|
+
trigger_default = command34;
|
|
12757
13094
|
}
|
|
12758
13095
|
});
|
|
12759
13096
|
|
|
12760
13097
|
// src/commands/webhooks/index.ts
|
|
12761
|
-
var
|
|
13098
|
+
var actions18;
|
|
12762
13099
|
var init_webhooks2 = __esm({
|
|
12763
13100
|
"src/commands/webhooks/index.ts"() {
|
|
12764
13101
|
"use strict";
|
|
12765
|
-
|
|
13102
|
+
actions18 = {
|
|
12766
13103
|
listen: () => Promise.resolve().then(() => (init_listen(), listen_exports)).then((m) => m.default),
|
|
12767
13104
|
trigger: () => Promise.resolve().then(() => (init_trigger(), trigger_exports)).then((m) => m.default)
|
|
12768
13105
|
};
|
|
@@ -12957,14 +13294,14 @@ var status_exports2 = {};
|
|
|
12957
13294
|
__export(status_exports2, {
|
|
12958
13295
|
default: () => status_default2
|
|
12959
13296
|
});
|
|
12960
|
-
var
|
|
13297
|
+
var command35, status_default2;
|
|
12961
13298
|
var init_status2 = __esm({
|
|
12962
13299
|
"src/commands/work/status.ts"() {
|
|
12963
13300
|
"use strict";
|
|
12964
13301
|
init_exit_codes();
|
|
12965
13302
|
init_http();
|
|
12966
13303
|
init_common3();
|
|
12967
|
-
|
|
13304
|
+
command35 = {
|
|
12968
13305
|
resource: "work",
|
|
12969
13306
|
action: "status",
|
|
12970
13307
|
summary: "Show the Kenso AI work waiting for your own agent, per kind",
|
|
@@ -12998,7 +13335,7 @@ var init_status2 = __esm({
|
|
|
12998
13335
|
return ExitCode.Ok;
|
|
12999
13336
|
}
|
|
13000
13337
|
};
|
|
13001
|
-
status_default2 =
|
|
13338
|
+
status_default2 = command35;
|
|
13002
13339
|
}
|
|
13003
13340
|
});
|
|
13004
13341
|
|
|
@@ -13130,9 +13467,9 @@ var init_files = __esm({
|
|
|
13130
13467
|
import { execFile, spawnSync as spawnSync2 } from "node:child_process";
|
|
13131
13468
|
import { readFileSync as readFileSync12 } from "node:fs";
|
|
13132
13469
|
import { isAbsolute as isAbsolute2 } from "node:path";
|
|
13133
|
-
function sudoArgs(user,
|
|
13470
|
+
function sudoArgs(user, command42, args, keep = [], set = {}) {
|
|
13134
13471
|
const assignments = Object.entries(set).map(([name, value]) => `${name}=${value}`);
|
|
13135
|
-
return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--",
|
|
13472
|
+
return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command42, ...args];
|
|
13136
13473
|
}
|
|
13137
13474
|
function agentKensoEnv(opts) {
|
|
13138
13475
|
return {
|
|
@@ -13142,12 +13479,12 @@ function agentKensoEnv(opts) {
|
|
|
13142
13479
|
AI_AGENT: opts.agentName
|
|
13143
13480
|
};
|
|
13144
13481
|
}
|
|
13145
|
-
function sudoExec(user,
|
|
13482
|
+
function sudoExec(user, command42, args, opts = {}) {
|
|
13146
13483
|
const [sudo = "/usr/bin/sudo", ...lead] = user.sudo;
|
|
13147
13484
|
return new Promise((resolve16) => {
|
|
13148
13485
|
execFile(
|
|
13149
13486
|
sudo,
|
|
13150
|
-
[...lead, ...sudoArgs(user.name,
|
|
13487
|
+
[...lead, ...sudoArgs(user.name, command42, args)],
|
|
13151
13488
|
{ env: { PATH: SUDO_PATH }, cwd: "/", timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS, maxBuffer: opts.maxBuffer ?? 1024 * 1024, encoding: "utf8", windowsHide: true, shell: false },
|
|
13152
13489
|
(err, stdout, stderr) => {
|
|
13153
13490
|
const code = err ? err.code : 0;
|
|
@@ -13257,9 +13594,9 @@ var init_folder2 = __esm({
|
|
|
13257
13594
|
init_redact();
|
|
13258
13595
|
init_agent_user();
|
|
13259
13596
|
WorkRunFolder = class {
|
|
13260
|
-
constructor(ctx,
|
|
13597
|
+
constructor(ctx, command42, args, outDir, shared = false) {
|
|
13261
13598
|
this.ctx = ctx;
|
|
13262
|
-
this.command =
|
|
13599
|
+
this.command = command42;
|
|
13263
13600
|
this.args = args;
|
|
13264
13601
|
this.outDir = outDir;
|
|
13265
13602
|
this.shared = shared;
|
|
@@ -13374,7 +13711,7 @@ var pull_exports2 = {};
|
|
|
13374
13711
|
__export(pull_exports2, {
|
|
13375
13712
|
default: () => pull_default2
|
|
13376
13713
|
});
|
|
13377
|
-
var MAX_FILES,
|
|
13714
|
+
var MAX_FILES, command36, pull_default2;
|
|
13378
13715
|
var init_pull2 = __esm({
|
|
13379
13716
|
"src/commands/work/pull.ts"() {
|
|
13380
13717
|
"use strict";
|
|
@@ -13383,7 +13720,7 @@ var init_pull2 = __esm({
|
|
|
13383
13720
|
init_common3();
|
|
13384
13721
|
init_folder2();
|
|
13385
13722
|
MAX_FILES = 100;
|
|
13386
|
-
|
|
13723
|
+
command36 = {
|
|
13387
13724
|
resource: "work",
|
|
13388
13725
|
action: "pull",
|
|
13389
13726
|
summary: "Claim waiting work into local work files, to answer by hand",
|
|
@@ -13461,7 +13798,7 @@ var init_pull2 = __esm({
|
|
|
13461
13798
|
return interrupted6 ? ExitCode.Interrupted : ExitCode.Ok;
|
|
13462
13799
|
}
|
|
13463
13800
|
};
|
|
13464
|
-
pull_default2 =
|
|
13801
|
+
pull_default2 = command36;
|
|
13465
13802
|
}
|
|
13466
13803
|
});
|
|
13467
13804
|
|
|
@@ -13603,7 +13940,7 @@ __export(submit_exports, {
|
|
|
13603
13940
|
default: () => submit_default
|
|
13604
13941
|
});
|
|
13605
13942
|
import { resolve as resolve14 } from "node:path";
|
|
13606
|
-
var
|
|
13943
|
+
var command37, submit_default;
|
|
13607
13944
|
var init_submit = __esm({
|
|
13608
13945
|
"src/commands/work/submit.ts"() {
|
|
13609
13946
|
"use strict";
|
|
@@ -13612,7 +13949,7 @@ var init_submit = __esm({
|
|
|
13612
13949
|
init_files();
|
|
13613
13950
|
init_answers();
|
|
13614
13951
|
init_common3();
|
|
13615
|
-
|
|
13952
|
+
command37 = {
|
|
13616
13953
|
resource: "work",
|
|
13617
13954
|
action: "submit",
|
|
13618
13955
|
summary: "Send answers files to Kenso and write each one's results",
|
|
@@ -13644,7 +13981,7 @@ var init_submit = __esm({
|
|
|
13644
13981
|
return totals.rejected > 0 ? ExitCode.Partial : ExitCode.Ok;
|
|
13645
13982
|
}
|
|
13646
13983
|
};
|
|
13647
|
-
submit_default =
|
|
13984
|
+
submit_default = command37;
|
|
13648
13985
|
}
|
|
13649
13986
|
});
|
|
13650
13987
|
|
|
@@ -13665,7 +14002,7 @@ function claimIdOf(arg) {
|
|
|
13665
14002
|
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..." });
|
|
13666
14003
|
return arg;
|
|
13667
14004
|
}
|
|
13668
|
-
var CLAIM_ID,
|
|
14005
|
+
var CLAIM_ID, command38, release_default;
|
|
13669
14006
|
var init_release = __esm({
|
|
13670
14007
|
"src/commands/work/release.ts"() {
|
|
13671
14008
|
"use strict";
|
|
@@ -13674,7 +14011,7 @@ var init_release = __esm({
|
|
|
13674
14011
|
init_files();
|
|
13675
14012
|
init_common3();
|
|
13676
14013
|
CLAIM_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
13677
|
-
|
|
14014
|
+
command38 = {
|
|
13678
14015
|
resource: "work",
|
|
13679
14016
|
action: "release",
|
|
13680
14017
|
summary: "Give claimed work back to the queue now",
|
|
@@ -13693,7 +14030,7 @@ var init_release = __esm({
|
|
|
13693
14030
|
return ExitCode.Ok;
|
|
13694
14031
|
}
|
|
13695
14032
|
};
|
|
13696
|
-
release_default =
|
|
14033
|
+
release_default = command38;
|
|
13697
14034
|
}
|
|
13698
14035
|
});
|
|
13699
14036
|
|
|
@@ -14032,12 +14369,12 @@ function plain(text3) {
|
|
|
14032
14369
|
return text3.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
|
|
14033
14370
|
}
|
|
14034
14371
|
function runStatus(bin, args, env, adapter, runAs) {
|
|
14035
|
-
const
|
|
14372
|
+
const command42 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
|
|
14036
14373
|
const commandArgs2 = runAs ? [...runAs.sudo.slice(1), ...sudoArgs(runAs.name, bin, args)] : args;
|
|
14037
14374
|
const options = runAs ? { env: { PATH: SUDO_PATH }, cwd: "/" } : { env: childEnv(env, adapter) };
|
|
14038
14375
|
return new Promise((resolve16) => {
|
|
14039
14376
|
execFile2(
|
|
14040
|
-
|
|
14377
|
+
command42,
|
|
14041
14378
|
commandArgs2,
|
|
14042
14379
|
{ ...options, timeout: STATUS_TIMEOUT_MS, maxBuffer: 1024 * 1024, windowsHide: true, shell: false },
|
|
14043
14380
|
(err, stdout, stderr) => {
|
|
@@ -15119,7 +15456,7 @@ var run_exports = {};
|
|
|
15119
15456
|
__export(run_exports, {
|
|
15120
15457
|
default: () => run_default
|
|
15121
15458
|
});
|
|
15122
|
-
var FAILURES_IN_A_ROW,
|
|
15459
|
+
var FAILURES_IN_A_ROW, command39, run_default;
|
|
15123
15460
|
var init_run = __esm({
|
|
15124
15461
|
"src/commands/work/run.ts"() {
|
|
15125
15462
|
"use strict";
|
|
@@ -15140,7 +15477,7 @@ var init_run = __esm({
|
|
|
15140
15477
|
init_folder2();
|
|
15141
15478
|
init_stop();
|
|
15142
15479
|
FAILURES_IN_A_ROW = 3;
|
|
15143
|
-
|
|
15480
|
+
command39 = {
|
|
15144
15481
|
resource: "work",
|
|
15145
15482
|
action: "run",
|
|
15146
15483
|
summary: "Run your own coding agent on the waiting work until the queue is empty",
|
|
@@ -15465,16 +15802,16 @@ var init_run = __esm({
|
|
|
15465
15802
|
return exitCodeFor(reason, totals.rejected > 0 || jobsFailed > 0);
|
|
15466
15803
|
}
|
|
15467
15804
|
};
|
|
15468
|
-
run_default =
|
|
15805
|
+
run_default = command39;
|
|
15469
15806
|
}
|
|
15470
15807
|
});
|
|
15471
15808
|
|
|
15472
15809
|
// src/commands/work/index.ts
|
|
15473
|
-
var
|
|
15810
|
+
var actions19;
|
|
15474
15811
|
var init_work2 = __esm({
|
|
15475
15812
|
"src/commands/work/index.ts"() {
|
|
15476
15813
|
"use strict";
|
|
15477
|
-
|
|
15814
|
+
actions19 = {
|
|
15478
15815
|
status: () => Promise.resolve().then(() => (init_status2(), status_exports2)).then((m) => m.default),
|
|
15479
15816
|
pull: () => Promise.resolve().then(() => (init_pull2(), pull_exports2)).then((m) => m.default),
|
|
15480
15817
|
submit: () => Promise.resolve().then(() => (init_submit(), submit_exports)).then((m) => m.default),
|
|
@@ -15485,9 +15822,9 @@ var init_work2 = __esm({
|
|
|
15485
15822
|
});
|
|
15486
15823
|
|
|
15487
15824
|
// src/commands/workspace/list.ts
|
|
15488
|
-
var
|
|
15489
|
-
__export(
|
|
15490
|
-
default: () =>
|
|
15825
|
+
var list_exports3 = {};
|
|
15826
|
+
__export(list_exports3, {
|
|
15827
|
+
default: () => list_default3
|
|
15491
15828
|
});
|
|
15492
15829
|
function parseLimit(value) {
|
|
15493
15830
|
if (value === void 0) return void 0;
|
|
@@ -15498,14 +15835,14 @@ function parseLimit(value) {
|
|
|
15498
15835
|
}
|
|
15499
15836
|
return limit;
|
|
15500
15837
|
}
|
|
15501
|
-
var MAX_LIMIT,
|
|
15502
|
-
var
|
|
15838
|
+
var MAX_LIMIT, command40, list_default3;
|
|
15839
|
+
var init_list3 = __esm({
|
|
15503
15840
|
"src/commands/workspace/list.ts"() {
|
|
15504
15841
|
"use strict";
|
|
15505
15842
|
init_errors();
|
|
15506
15843
|
init_exit_codes();
|
|
15507
15844
|
MAX_LIMIT = 200;
|
|
15508
|
-
|
|
15845
|
+
command40 = {
|
|
15509
15846
|
resource: "workspace",
|
|
15510
15847
|
action: "list",
|
|
15511
15848
|
summary: "List the workspaces your key can use",
|
|
@@ -15533,7 +15870,7 @@ var init_list2 = __esm({
|
|
|
15533
15870
|
return ExitCode.Ok;
|
|
15534
15871
|
}
|
|
15535
15872
|
};
|
|
15536
|
-
|
|
15873
|
+
list_default3 = command40;
|
|
15537
15874
|
}
|
|
15538
15875
|
});
|
|
15539
15876
|
|
|
@@ -15542,7 +15879,7 @@ var use_exports = {};
|
|
|
15542
15879
|
__export(use_exports, {
|
|
15543
15880
|
default: () => use_default
|
|
15544
15881
|
});
|
|
15545
|
-
var
|
|
15882
|
+
var command41, use_default;
|
|
15546
15883
|
var init_use = __esm({
|
|
15547
15884
|
"src/commands/workspace/use.ts"() {
|
|
15548
15885
|
"use strict";
|
|
@@ -15550,7 +15887,7 @@ var init_use = __esm({
|
|
|
15550
15887
|
init_errors();
|
|
15551
15888
|
init_exit_codes();
|
|
15552
15889
|
init_http();
|
|
15553
|
-
|
|
15890
|
+
command41 = {
|
|
15554
15891
|
resource: "workspace",
|
|
15555
15892
|
action: "use",
|
|
15556
15893
|
summary: "Set the profile's default workspace",
|
|
@@ -15607,17 +15944,17 @@ var init_use = __esm({
|
|
|
15607
15944
|
return ExitCode.Ok;
|
|
15608
15945
|
}
|
|
15609
15946
|
};
|
|
15610
|
-
use_default =
|
|
15947
|
+
use_default = command41;
|
|
15611
15948
|
}
|
|
15612
15949
|
});
|
|
15613
15950
|
|
|
15614
15951
|
// src/commands/workspace/index.ts
|
|
15615
|
-
var
|
|
15952
|
+
var actions20;
|
|
15616
15953
|
var init_workspace = __esm({
|
|
15617
15954
|
"src/commands/workspace/index.ts"() {
|
|
15618
15955
|
"use strict";
|
|
15619
|
-
|
|
15620
|
-
list: () => Promise.resolve().then(() => (
|
|
15956
|
+
actions20 = {
|
|
15957
|
+
list: () => Promise.resolve().then(() => (init_list3(), list_exports3)).then((m) => m.default),
|
|
15621
15958
|
use: () => Promise.resolve().then(() => (init_use(), use_exports)).then((m) => m.default)
|
|
15622
15959
|
};
|
|
15623
15960
|
}
|
|
@@ -15650,6 +15987,7 @@ var init_registry = __esm({
|
|
|
15650
15987
|
init_opportunities();
|
|
15651
15988
|
init_people();
|
|
15652
15989
|
init_runs2();
|
|
15990
|
+
init_sandbox2();
|
|
15653
15991
|
init_skill();
|
|
15654
15992
|
init_studio2();
|
|
15655
15993
|
init_webhooks2();
|
|
@@ -15672,12 +16010,13 @@ var init_registry = __esm({
|
|
|
15672
16010
|
opportunities: actions12,
|
|
15673
16011
|
people: actions13,
|
|
15674
16012
|
runs: actions14,
|
|
15675
|
-
|
|
15676
|
-
|
|
15677
|
-
|
|
16013
|
+
sandbox: actions15,
|
|
16014
|
+
skill: actions16,
|
|
16015
|
+
studio: actions17,
|
|
16016
|
+
webhooks: actions18,
|
|
15678
16017
|
whoami: topLevel("whoami", actions4.status, "kenso auth status"),
|
|
15679
|
-
work:
|
|
15680
|
-
workspace:
|
|
16018
|
+
work: actions19,
|
|
16019
|
+
workspace: actions20
|
|
15681
16020
|
};
|
|
15682
16021
|
resourceAliases = { leads: "contacts" };
|
|
15683
16022
|
}
|
|
@@ -15814,8 +16153,8 @@ async function renderTopHelp(opts) {
|
|
|
15814
16153
|
names.push(withPositionals(spec, spec.action));
|
|
15815
16154
|
groups.set(hint, names);
|
|
15816
16155
|
}
|
|
15817
|
-
const
|
|
15818
|
-
if (
|
|
16156
|
+
const actions22 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
|
|
16157
|
+
if (actions22.length > 0) rows.push([resource, actions22.join(", ")]);
|
|
15819
16158
|
}
|
|
15820
16159
|
const at = 4 + Math.min(22, Math.max(0, ...rows.map(([left]) => left.length)));
|
|
15821
16160
|
lines.push(
|
|
@@ -15828,7 +16167,7 @@ async function renderTopHelp(opts) {
|
|
|
15828
16167
|
const [area = "", action = ""] = name.split(" ");
|
|
15829
16168
|
byArea.set(area, [...byArea.get(area) ?? [], action]);
|
|
15830
16169
|
}
|
|
15831
|
-
const named = [...byArea.entries()].map(([area,
|
|
16170
|
+
const named = [...byArea.entries()].map(([area, actions22]) => `${area} ${actions22.join("|")}`);
|
|
15832
16171
|
lines.push(wrap(`Beta, hidden here but they run (the server decides): ${named.join(", ")}.`, " "));
|
|
15833
16172
|
}
|
|
15834
16173
|
const generated = await listGenerated({ features: opts.allCommands ? [] : getFeatures, env: opts.env });
|
|
@@ -15836,13 +16175,13 @@ async function renderTopHelp(opts) {
|
|
|
15836
16175
|
if (visible.length > 0) {
|
|
15837
16176
|
const byResource = /* @__PURE__ */ new Map();
|
|
15838
16177
|
for (const g of visible) {
|
|
15839
|
-
const
|
|
15840
|
-
|
|
15841
|
-
byResource.set(g.resource,
|
|
16178
|
+
const actions22 = byResource.get(g.resource) ?? [];
|
|
16179
|
+
actions22.push(`${g.action}${g.beta ? " (beta)" : ""}`);
|
|
16180
|
+
byResource.set(g.resource, actions22);
|
|
15842
16181
|
}
|
|
15843
16182
|
const sorted2 = [...byResource.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
15844
16183
|
if (opts.allCommands) {
|
|
15845
|
-
const generatedRows = sorted2.map(([resource,
|
|
16184
|
+
const generatedRows = sorted2.map(([resource, actions22]) => [resource, actions22.sort().join(", ")]);
|
|
15846
16185
|
lines.push("", "API resources (kenso <resource> <action>):", columns(generatedRows));
|
|
15847
16186
|
} else {
|
|
15848
16187
|
const names = new Set(sorted2.map(([resource]) => resource));
|
|
@@ -16158,8 +16497,8 @@ function startUpdateNotice(argv, opts = {}) {
|
|
|
16158
16497
|
if (!found) return;
|
|
16159
16498
|
writeCheck(file, { checkedAt: new Date(now).toISOString(), latest: found });
|
|
16160
16499
|
if (isNewer(found, version)) {
|
|
16161
|
-
const
|
|
16162
|
-
stderr.write(`kenso ${found} is out (you have ${version}): ${
|
|
16500
|
+
const command42 = updateCommand(install, opts.platform ?? process.platform);
|
|
16501
|
+
stderr.write(`kenso ${found} is out (you have ${version}): ${command42}
|
|
16163
16502
|
Turn this off with KENSO_NO_UPDATE_NOTIFIER=1.
|
|
16164
16503
|
`);
|
|
16165
16504
|
}
|
|
@@ -16201,7 +16540,7 @@ function resources() {
|
|
|
16201
16540
|
const names = Object.entries(handWritten).filter(([, area]) => Object.keys(area).length > 0).map(([resource]) => resource);
|
|
16202
16541
|
return sorted([...names, ...Object.keys(resourceAliases), ...loadManifest().operations.map((op) => op.resource)]);
|
|
16203
16542
|
}
|
|
16204
|
-
function
|
|
16543
|
+
function actions21(resource) {
|
|
16205
16544
|
const own = Object.keys(handWritten[resource] ?? {}).filter((action) => action !== "");
|
|
16206
16545
|
return sorted([...own, ...loadManifest().operations.filter((op) => op.resource === resource).map((op) => op.action)]);
|
|
16207
16546
|
}
|
|
@@ -16266,7 +16605,7 @@ async function completions(words, globals) {
|
|
|
16266
16605
|
return flagsOf2(spec, globals, positionals.length === 0);
|
|
16267
16606
|
}
|
|
16268
16607
|
if (positionals.length === 0) return resources();
|
|
16269
|
-
if (!spec) return positionals.length === 1 ?
|
|
16608
|
+
if (!spec) return positionals.length === 1 ? actions21(resourceAliases[positionals[0]] ?? positionals[0]) : [];
|
|
16270
16609
|
const given = positionals.length - commandWords;
|
|
16271
16610
|
const declared = spec.positionals ?? [];
|
|
16272
16611
|
if (given < declared.length || declared.at(-1)?.variadic === true) {
|
|
@@ -16360,9 +16699,9 @@ function normalizeBooleans(argv, names, strict) {
|
|
|
16360
16699
|
async function knownCommands() {
|
|
16361
16700
|
const commands = /* @__PURE__ */ new Set();
|
|
16362
16701
|
for (const [resource, area] of Object.entries(handWritten)) {
|
|
16363
|
-
const
|
|
16364
|
-
if (
|
|
16365
|
-
for (const action of
|
|
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);
|
|
16366
16705
|
}
|
|
16367
16706
|
for (const g of await listGenerated({ features: [] })) {
|
|
16368
16707
|
commands.add(g.resource);
|