kenso 0.1.84 → 0.1.86
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 +7 -0
- package/dist/kenso.js +352 -81
- package/dist/operations.json +1 -1
- package/docs/crm.md +20 -0
- package/docs/reference.md +64 -3
- package/package.json +2 -2
package/dist/kenso.js
CHANGED
|
@@ -2477,7 +2477,7 @@ var VERSION;
|
|
|
2477
2477
|
var init_version = __esm({
|
|
2478
2478
|
"src/core/version.ts"() {
|
|
2479
2479
|
"use strict";
|
|
2480
|
-
VERSION = true ? "0.1.
|
|
2480
|
+
VERSION = true ? "0.1.86" : "0.0.0-dev";
|
|
2481
2481
|
}
|
|
2482
2482
|
});
|
|
2483
2483
|
|
|
@@ -4174,9 +4174,9 @@ async function readRunDir(dir) {
|
|
|
4174
4174
|
return null;
|
|
4175
4175
|
}
|
|
4176
4176
|
if (!raw) return null;
|
|
4177
|
-
const { runId, command:
|
|
4177
|
+
const { runId, command: command57, createdAt, status } = raw;
|
|
4178
4178
|
if (typeof runId !== "string" || !RUN_ID_PATTERN.test(runId)) return null;
|
|
4179
|
-
if (typeof
|
|
4179
|
+
if (typeof command57 !== "string" || typeof createdAt !== "string") return null;
|
|
4180
4180
|
if (typeof status !== "string" || !STATUSES.includes(status)) return null;
|
|
4181
4181
|
let chunksDone = chunkList(raw.chunksDone) ?? [];
|
|
4182
4182
|
try {
|
|
@@ -4187,7 +4187,7 @@ async function readRunDir(dir) {
|
|
|
4187
4187
|
const record = {
|
|
4188
4188
|
...raw,
|
|
4189
4189
|
runId,
|
|
4190
|
-
command:
|
|
4190
|
+
command: command57,
|
|
4191
4191
|
args: asRecord3(raw.args) ?? {},
|
|
4192
4192
|
createdAt,
|
|
4193
4193
|
status,
|
|
@@ -4242,11 +4242,11 @@ async function loadRun(runId, env = process.env) {
|
|
|
4242
4242
|
}
|
|
4243
4243
|
return run;
|
|
4244
4244
|
}
|
|
4245
|
-
async function findIdentical(
|
|
4245
|
+
async function findIdentical(command57, args, inputSha256, env, workspaceId, anyWorkspace = false) {
|
|
4246
4246
|
const identity = argsIdentity(args);
|
|
4247
4247
|
const runs = await listRuns(env);
|
|
4248
4248
|
return runs.filter(
|
|
4249
|
-
(run) => run.command ===
|
|
4249
|
+
(run) => run.command === command57 && (run.inputSha256 || void 0) === (inputSha256 || void 0) && (anyWorkspace || (run.workspaceId || void 0) === (workspaceId || void 0)) && argsIdentity(run.args) === identity
|
|
4250
4250
|
);
|
|
4251
4251
|
}
|
|
4252
4252
|
function isOtherLiveProcess(pid) {
|
|
@@ -7451,8 +7451,8 @@ function idValue(value, field) {
|
|
|
7451
7451
|
function shellQuote3(arg) {
|
|
7452
7452
|
return /^[A-Za-z0-9_./:=@%+,-]+$/.test(arg) ? arg : `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
7453
7453
|
}
|
|
7454
|
-
function commandLine2(ctx,
|
|
7455
|
-
const parts2 = ["kenso", ...
|
|
7454
|
+
function commandLine2(ctx, command57, args, extra = []) {
|
|
7455
|
+
const parts2 = ["kenso", ...command57.split(" "), ...(args.positionals ?? []).map(shellQuote3)];
|
|
7456
7456
|
for (const [name, value] of Object.entries(args.flags)) {
|
|
7457
7457
|
if (value === void 0 || value === false) continue;
|
|
7458
7458
|
if (value === true) parts2.push(`--${name}`);
|
|
@@ -7784,7 +7784,7 @@ var init_connect = __esm({
|
|
|
7784
7784
|
var crm_default;
|
|
7785
7785
|
var init_crm = __esm({
|
|
7786
7786
|
"docs/crm.md"() {
|
|
7787
|
-
crm_default = '# CRM (beta)\n\nThe CRM commands work on Kenso\'s Accounts lane: accounts (companies), the people on them, and opportunities. They are beta: they need the `accounts` feature flag on your workspace (opportunities need `opportunities`, CRM sync needs `ingestion`). Help and `kenso describe` hide them until your workspace has the flag; `--all-commands` shows them.\n\n| Command | What it does |\n|---|---|\n| `accounts import` | Create accounts from a CSV or JSONL file. Research is charged per created account |\n| `people import` | Create or match people from a file, optionally onto accounts |\n| `accounts update --each`, `people update --each`, `opportunities update --each` | Edit many records from a file, one call per row |\n| `accounts write-research`, `people write-research` | Store research you gathered as a record\'s latest research, free. `--each` writes many |\n| `opportunities stage-history <id>` | A deal\'s stage history: each stage, when, who moved it and how long it sat there |\n| `deleted-accounts list`, `accounts restore <id>` | The accounts deleted in the last 30 days, and bringing one back |\n| `export <accounts\\|people\\|deals>` | The list as CSV: everything, a saved Accounts view, or what the filters match |\n| `capture status` | Your captured mailbox, its backfill progress and what teammates see of a captured email. Needs the `crm_capture` flag |\n| `capture connect` | Turn capture on for your own mailbox. `--private` starts it hidden from teammates; `--provider google` prints a sign-in link when no account is connected yet |\n| `capture private on\\|off` | Hide your captured email from teammates, or show it again. Email only: meetings stay visible |\n| `capture disconnect` | Turn capture off and delete your stored email bodies. Asks first; `--yes` skips the question |\n| `capture teammates-see summary\\|full_email` | Workspace admin: what teammates see of captured email |\n| `pipelines stage-rules` | List or set the fields a deal should have in each stage |\n| `crm-connections`, `crm-imports`, `crm-sync-issues` | Read and run CRM sync. Connecting a CRM stays in the app |\n\nImport accounts first, then people: `people import` never creates an account.\n\n## Import accounts\n\n```bash\nkenso accounts import --file accounts.csv\nkenso accounts import --file accounts.csv --yes\n```\n\n```csv\nname,domain,industry,employeeCount\nAcme,acme.io,Software,120\nGlobex,globex.com,Manufacturing,"1,200"\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `name` (or `company`, `companyName`, `accountName`), `domains` (several, split on `,` or `;`) or one `domain` (or `website`, `companyDomain`), `industry`, `employeeCount`, `hqLocation`, `linkedinUrl`, `stage`, `angle`, `whyNow`, `fitScore`, `fundingRound`, `cadenceDays`, `ownerMemberId`, `kenCompanyId`, `sendsFromInboxId`, `sendsFromLinkedInAccountId` and `source`.\n- **A domain is required.** A file with no domain column is a usage error, and a row without a domain is `invalid` (`domain_required`).\n- **The dry run prices the research.** It asks for a credit estimate per 1,000 accounts and puts the sum in the plan: `kind`, `accountCount`, `totalMillicredits`, `availableMillicredits` and `sufficient`.\n- **Rows go 100 per call** to `POST /v1/accounts/bulk-create`.\n\nEach row comes back `created` (`id` is the new account; its research is queued, `researchQueued`, or waits for credits, `researchWaitingCredits`), `skipped` with reason `domain_taken` (already an account; `id` is that account) or `failed` (`reason` is the API\'s code, `error` names the field; an item Kenso failed to save is sent once more first). Rerunning the same file is safe: accounts that exist come back `domain_taken`.\n\n## Import people\n\n```bash\nkenso people import --file people.csv\nkenso people import --file people.csv --find-emails --yes\nkenso people import --file people.jsonl --dry-run\n```\n\n```csv\nfullName,email,title,accountDomain,role\nAnn Lee,ann@acme.io,VP Sales,acme.io,champion\nBob Ray,,CTO,acme.io,\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `email`, `fullName` (or `name`), `firstName`, `lastName`, `title`, `linkedinUrl` (or `linkedin`, `profileUrl`), `accountDomain` (or `domain`, `website`, `companyDomain`), `accountId`, `role` and `priority`. Other columns are ignored with one warning.\n- **A person needs a name:** `fullName`, or `firstName`, `lastName` or both (the CLI joins them). A row with none of them is `invalid` (`name_required`).\n- **To put a person on an account,** give `accountDomain` or `accountId`. A row with both sends only `accountId`.\n- **`--find-emails`** queues an email find (charged in credits) for each person without an email.\n- **Rows go 200 per call** to `POST /v1/people/batch`.\n\nPeople already in the workspace are matched by email, then LinkedIn URL, so running the same file again creates nobody twice. A row comes back `created` (a new person), `updated` (an existing person added to the account), `skipped` with reason `already_on_account`, `matched` (no account asked) or `previously_removed`, or `failed`: `account_not_found` saves the person without an account (import the account, then rerun to place them), any other reason is the API\'s. The summary adds `matched`, `addedToAccounts` and `emailFindsQueued`.\n\n## List and search accounts\n\n`accounts list` and `accounts search` sort and page on the server, so they reach every account in the workspace, however many there are.\n\n```bash\nkenso accounts list --sort score:desc --limit 100 # one page; the output\'s next: line is the following one\nkenso accounts list --sort score:desc --limit 100 --all # every page, to the end\nkenso accounts search --search hiring --sort latestSignalAt:desc --data \'{"qFields": ["name", "latestSignal"]}\'\nkenso accounts search --limit 1 --data \'{"countBy": ["stage"]}\' # how many accounts sit in each stage\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}]}, "sort": "tier,-pipelineAmount"}\' --all\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "hqLocation", "operator": "contains", "values": ["Germany"]}]}}\' --all\n# tier 1 accounts with no meeting in 30 days: none since then, or none ever\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}, {"match": "any", "conditions": [{"field": "lastMeeting", "operator": "older_than_days", "values": ["30"]}, {"field": "lastMeeting", "operator": "is_empty"}]}]}}\' --all\n```\n\n- **`--sort`** takes up to 3 comma-separated keys, each `field` (ascending), `field:asc` or `field:desc`. The API\'s `-field` form needs the equals sign here, `--sort=-score`, because a value that starts with a dash reads as a flag. Fields: `createdAt`, `name`, `score`, `tier` (ascending is tier 1 first), `latestSignalAt`, `committee`, `pipelineAmount`, `nextTouchAt`, `lastTouchAt`. An account with no value for a key comes last in both directions. The default is `-createdAt`.\n- **`--limit`** is 1 to 1000 (default 50). `--cursor` takes the previous page\'s `nextCursor` with the same filters and sort; `--all` follows the cursors for you.\n- **`--search`** (also `--q`) matches the name or a domain.\n- **Lists and objects go in `--data`** on `search`, as the API takes them (`kenso describe accounts search`); a flag beside it sets or replaces one key:\n - `qFields` picks where the search text looks: `name`, `domain`, `latestSignal` (the latest signal\'s title).\n - `countBy` (`stage`, `stageGroup`) adds `counts` to the output: every value with the number of matching accounts that hold it, whatever the page. The output is then one object: `data`, `pagination` and `counts`.\n - `filters` and `where` narrow the accounts.\n\nAn account\'s timeline pages the same way. `kenso accounts activity 812` returns the newest 100 earlier rows and, when older ones exist, `data.nextCursor`. Pass it back as `--cursor` (with the same `--category`) for the rows before them, until a page comes without one.\n\n## Edit accounts, people and opportunities\n\nApart from `accounts bulk-update`, which sets one `accountType` on up to 500 accounts, there is no bulk edit route, so run the generated `update` command once per row with `--each`. Columns are the command\'s flags by API name or flag name, and the id column fills the route:\n\n```bash\nkenso accounts update --each accounts-edit.csv --dry-run # then the same with --yes\nkenso people update --each people-edit.csv --dry-run\nkenso opportunities update --each deals.csv --dry-run\n```\n\n```csv\naccountId,stage,ownerMemberId,overwritePinned\n501,engaged,42,true\n502,customer,42,true\n```\n\nA row that changes a field someone pinned in the app fails as a whole (`409 conflict`, `pinned_by_user`: nothing on that record changes, the other fields of the row included), unless the row sets `overwritePinned` to `true` (or you pass `--overwrite-pinned`, only with the person\'s OK). Every flag of an update command: `kenso accounts update --help`.\n\n## Search opportunities\n\n`kenso opportunities search` works as `accounts search` does: it takes `--search`, `--sort`, `--limit`, `--cursor`, `--all`, and its lists in `--data`.\n\n```bash\nkenso opportunities search --data \'{"filters": [{"field": "stageCategory", "operator": "is", "values": ["open"]}]}\' --all\nkenso opportunities search --data \'{"filters": [{"field": "ownerMemberId", "operator": "is", "values": ["none"]}, {"field": "closeDate", "operator": "is", "values": ["past_due", "next_30_days"]}]}\'\nkenso opportunities search --limit 1 --data \'{"countBy": ["stage", "ownerMemberId"]}\' # how many opportunities hold each value\n```\n\n- **`filters`** is a list of `{field, operator, values}`, all of which must hold. Fields: `stage` (a stage key), `stageCategory` (`open`, `won`, `lost`), `ownerMemberId`, `closeDate` (`past_due`, `next_30_days`, `later`, `none`) and `sourceCampaignId`. `operator` is `is` or `is_not`; the values of one condition are OR. `none` in `values` matches an opportunity with no owner, no source campaign or no close date.\n- **`countBy`** takes the same field names and adds `counts` to the output: per field, every value with the number of matching opportunities that hold it.\n- `--account-id` keeps the search to one account. `closeDate` counts days in the member\'s app time zone.\n\nOne person\'s deals, meetings and campaign contacts, as their person page lists them:\n\n```bash\nkenso opportunities list --person-id 9001 # the deals they are on, or are the primary person of\nkenso meetings list --person-id 9001 # the meetings they attend, among the ones you can see\nkenso contacts list --person-id 9001 # their contact in each campaign they are in\n```\n\n## Write research you gathered\n\n`accounts write-research` and `people write-research` store research you gathered outside Kenso as the record\'s latest research (`PUT /v1/accounts/{accountId}/research`, `PUT /v1/people/{personId}/research`). The Research tab shows it like a Ken run, with `trigger: agent` and `researchedAt` now. Nothing is charged, and no account or person field changes: set an account\'s own `fitScore`, `whyNow` or `angle` with `accounts update`. They need the `accounts_research` flag and accounts edit.\n\nThe body is the research block `accounts get --expand research` (or `people get-research`) returns, without its read-only fields: leave out `id`, `status`, `trigger`, `errorCode`, `researchedAt`, `isStale` and `appliedPrompt` (for a person also `mode`, `requestedAt`, `researchedMode`, `firecrawlCredits` and `webNote`), or the write fails with `unknown_field`. Pass it with `--data @file`:\n\n```bash\nkenso accounts write-research --account-id 501 --data @acme-dossier.json\nkenso people write-research --person-id 9001 --data @jane.json\n```\n\n```json\n{\n "tagline": { "text": "Payroll for EU contractors", "sourceUrls": ["https://acme.example"] },\n "description": { "text": "Acme runs payroll and compliance for companies hiring contractors in 30 EU countries.", "sourceUrls": ["https://acme.example"] },\n "links": { "website": "https://acme.example" },\n "whyNow": { "text": "Raised a $40M Series B in October", "sourceUrls": ["https://news.example/acme-b"], "date": "2026-10" },\n "fitScore": 82,\n "angle": "Lead with contractor onboarding time."\n}\n```\n\nMany records: one JSONL line per record, with the id next to the block\'s fields. Nested objects are sent as written. Use JSONL, not CSV: the block\'s fields are objects and lists, which a CSV cell cannot carry.\n\n```bash\nkenso accounts write-research --each dossiers.jsonl --dry-run # then the same with --yes\nkenso people write-research --each people-research.jsonl --yes --concurrency 8\n```\n\n```jsonl\n{"accountId": 501, "tagline": {"text": "Payroll for EU contractors"}, "links": {"website": "https://acme.example"}}\n{"accountId": 502, "description": {"text": "Cloud cost tooling for retailers."}, "links": {"website": "https://beta.example"}}\n```\n\nA row fails as a whole with the API\'s code: `validation_failed` (an unknown field is `unknown_field`, and `error.details` names every bad field), `research_in_progress` (`409`: Ken is researching that record now, write it again once the run ends; an account run waiting for credits counts too: it runs once the workspace has credits, and the write stays refused until that run ends) or `not_found`. Rerunning a file is safe: each write replaces the record\'s research shown.\n\n## CRM sync\n\nCRM sync has generated commands only: read connections, preview, start an import, and work through sync issues. Connect the CRM itself in the app.\n\n```bash\nkenso crm-connections list\nkenso crm-connections get --connection-id 7\nkenso crm-imports create --connection-id 7 --dry-run\nkenso crm-sync-issues list --connection-id 7 --all\n```\n\nRun `kenso crm-connections --help` (or add `--all-commands` when the actions are hidden) to see every action.\n\n## Pipelines\n\nA workspace with the `pipelines` flag on can run several deal pipelines, each with its own stages. These are generated commands (beta):\n\n```bash\nkenso pipelines list\nkenso pipelines list --query "[].{id: id, name: name, default: isDefault, stages: stages[].key}"\nkenso pipelines get --pipeline-id 5\n```\n\n`list` prints every pipeline in display order, archived ones included: `id`, `name`, `routingRule` (the one sentence Ken reads to decide whether a new deal belongs there), `isDefault`, `isArchived`, `position`, `opportunityCount`, `amountTotal` and `stages`, each stage as `kenso opportunity-stages list` prints it. A stage key is unique in the workspace, across pipelines, so a deal\'s `stage` names its pipeline and its `pipelineId` repeats it. The first read turns the workspace\'s stage list into its default pipeline, named Sales, with every deal in it. The same rows as the MCP\'s `pipelines(operation="list")`.\n\n## Restore a deleted account\n\n```bash\nkenso deleted-accounts list\nkenso accounts restore 812\n```\n\nA deleted account can be restored for 30 days. `deleted-accounts list` shows each one with who deleted it, `expiresAt` (restore works until then) and what comes back: `personCount`, `opportunityCount` and `touchCount`. `accounts restore <id>` brings the account back with its domains, its people, its deals and its planned touches, which wait for approval again. A domain another account took since stays with that account and is listed in `domainsTaken`. A merged account is not listed and cannot be restored: a merge has no undo. Both commands are behind the `crm_import_export` feature flag (`404` while it is off).\n\n## Export accounts, people or deals\n\n```bash\nkenso export accounts --out accounts.csv\nkenso export accounts --view 12 --out tier-1.csv\nkenso export deals --filters \'[{"field":"stageCategory","operator":"is","values":["open"]}]\' > open-deals.csv\n```\n\nIt writes the CSV that `POST /v1/accounts/export`, `/v1/people/export` or `/v1/opportunities/export` returns, to stdout or to `--out` (then it prints the file and its row count). With no filter it exports every record. More than 50,000 rows is refused: narrow the filters. `--view <id>` exports a saved Accounts view (`kenso account-views list` shows the ids). `--filters`, `--where` (accounts), `--q` and `--sort` are the search operation\'s own fields, so a deals or people view exports with its filters and sort. The accounts and deals files start with `id` and import back as they are. Each export writes an audit-log entry and needs the export permission. Accounts and deals also need the `crm_import_export` flag while it is in beta.\n\n## A deal\'s stage history\n\n```bash\nkenso opportunities stage-history 77\nkenso opportunities stage-history 77 --query "entries[].{to: stageLabel, at: enteredAt, by: changedBy}"\n```\n\nIt prints `GET /v1/opportunities/{id}/stage-history` as it is, the same rows as the deal page and the MCP\'s `opportunities(operation="get-stage-history")`: the stage now, `isComplete` and `entries`, oldest first, each with `fromStage`, `stage`, `stageLabel`, `enteredAt`, `leftAt`, `durationSeconds`, `actorKind`, `actorMemberId` and Ken\'s `reason` on a move its stage judge made. With the `deal_stage_rules` flag on, each entry also has `changedBy` (`member`, `agent`, `api_key`, `workflow`, `stage_judge`, `crm_sync` or `ken_automation`), `crmProvider` on a CRM sync, and on a move `fromStageLabel` and `fromStageDurationSeconds`, how long the deal sat in the stage it left. `isComplete` false means Kenso has no record of part of the history.\n\n## Required fields per stage\n\n```bash\nkenso pipelines stage-rules\nkenso pipelines stage-rules proposal --require amount,closeDate,custom.tier\nkenso pipelines stage-rules proposal --none\nkenso pipelines stage-rules lost --default\n```\n\nWith the `deal_stage_rules` flag on, each stage can name the fields a deal should have in it. Without a stage the command prints every stage\'s `key`, `label`, `category`, `isArchived`, `requiredFields` and `isDefault`, plus `requirableFields`: `amount`, `closeDate`, `ownerMemberId`, `primaryPersonId`, `nextStep`, `lostReasonKey`, `wonReasonKey` and `custom.<key>` for each custom deal field. `--require` sets the stage\'s whole list, in order, at most 10. `--none` requires nothing, and `--default` goes back to the default: a lost stage asks for `lostReasonKey`, any other stage nothing. Setting a rule needs the `workspace_settings` permission. The same as the MCP\'s `opportunities(operation="stages-set-required-fields")`.\n\nA missing field never stops a move. The deal moves, and it is flagged Missing on the board, the list and the deal page until the field is filled. A rule also applies to deals already in the stage.\n';
|
|
7787
|
+
crm_default = '# CRM (beta)\n\nThe CRM commands work on Kenso\'s Accounts lane: accounts (companies), the people on them, and opportunities. They are beta: they need the `accounts` feature flag on your workspace (opportunities need `opportunities`, CRM sync needs `ingestion`). Help and `kenso describe` hide them until your workspace has the flag; `--all-commands` shows them.\n\n| Command | What it does |\n|---|---|\n| `accounts import` | Create accounts from a CSV or JSONL file. Research is charged per created account |\n| `people import` | Create or match people from a file, optionally onto accounts |\n| `accounts update --each`, `people update --each`, `opportunities update --each` | Edit many records from a file, one call per row |\n| `accounts write-research`, `people write-research` | Store research you gathered as a record\'s latest research, free. `--each` writes many |\n| `opportunities stage-history <id>` | A deal\'s stage history: each stage, when, who moved it and how long it sat there |\n| `deleted-accounts list`, `accounts restore <id>` | The accounts deleted in the last 30 days, and bringing one back |\n| `export <accounts\\|people\\|deals>` | The list as CSV: everything, a saved Accounts view, or what the filters match |\n| `capture status` | Your captured mailbox, its backfill progress and what teammates see of a captured email. Needs the `crm_capture` flag |\n| `capture connect` | Turn capture on for your own mailbox. `--private` starts it hidden from teammates; `--provider google` prints a sign-in link when no account is connected yet |\n| `capture private on\\|off` | Hide your captured email from teammates, or show it again. Email only: meetings stay visible |\n| `capture disconnect` | Turn capture off and delete your stored email bodies. Asks first; `--yes` skips the question |\n| `capture teammates-see summary\\|full_email` | Workspace admin: what teammates see of captured email |\n| `pipelines stage-rules` | List or set the fields a deal should have in each stage |\n| `crm-connections`, `crm-imports`, `crm-sync-issues` | Read and run CRM sync. Connecting a CRM stays in the app |\n| `tasks add`, `tasks done`, `tasks assign`, `tasks queue` | Add a to-do for a member on an account, person or deal, complete it, hand it on, or read your open work (needs `tasks`) |\n\nImport accounts first, then people: `people import` never creates an account.\n\n## Import accounts\n\n```bash\nkenso accounts import --file accounts.csv\nkenso accounts import --file accounts.csv --yes\n```\n\n```csv\nname,domain,industry,employeeCount\nAcme,acme.io,Software,120\nGlobex,globex.com,Manufacturing,"1,200"\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `name` (or `company`, `companyName`, `accountName`), `domains` (several, split on `,` or `;`) or one `domain` (or `website`, `companyDomain`), `industry`, `employeeCount`, `hqLocation`, `linkedinUrl`, `stage`, `angle`, `whyNow`, `fitScore`, `fundingRound`, `cadenceDays`, `ownerMemberId`, `kenCompanyId`, `sendsFromInboxId`, `sendsFromLinkedInAccountId` and `source`.\n- **A domain is required.** A file with no domain column is a usage error, and a row without a domain is `invalid` (`domain_required`).\n- **The dry run prices the research.** It asks for a credit estimate per 1,000 accounts and puts the sum in the plan: `kind`, `accountCount`, `totalMillicredits`, `availableMillicredits` and `sufficient`.\n- **Rows go 100 per call** to `POST /v1/accounts/bulk-create`.\n\nEach row comes back `created` (`id` is the new account; its research is queued, `researchQueued`, or waits for credits, `researchWaitingCredits`), `skipped` with reason `domain_taken` (already an account; `id` is that account) or `failed` (`reason` is the API\'s code, `error` names the field; an item Kenso failed to save is sent once more first). Rerunning the same file is safe: accounts that exist come back `domain_taken`.\n\n## Import people\n\n```bash\nkenso people import --file people.csv\nkenso people import --file people.csv --find-emails --yes\nkenso people import --file people.jsonl --dry-run\n```\n\n```csv\nfullName,email,title,accountDomain,role\nAnn Lee,ann@acme.io,VP Sales,acme.io,champion\nBob Ray,,CTO,acme.io,\n```\n\n- **Columns** map by name, ignoring case, spaces and dashes: `email`, `fullName` (or `name`), `firstName`, `lastName`, `title`, `linkedinUrl` (or `linkedin`, `profileUrl`), `accountDomain` (or `domain`, `website`, `companyDomain`), `accountId`, `role` and `priority`. Other columns are ignored with one warning.\n- **A person needs a name:** `fullName`, or `firstName`, `lastName` or both (the CLI joins them). A row with none of them is `invalid` (`name_required`).\n- **To put a person on an account,** give `accountDomain` or `accountId`. A row with both sends only `accountId`.\n- **`--find-emails`** queues an email find (charged in credits) for each person without an email.\n- **Rows go 200 per call** to `POST /v1/people/batch`.\n\nPeople already in the workspace are matched by email, then LinkedIn URL, so running the same file again creates nobody twice. A row comes back `created` (a new person), `updated` (an existing person added to the account), `skipped` with reason `already_on_account`, `matched` (no account asked) or `previously_removed`, or `failed`: `account_not_found` saves the person without an account (import the account, then rerun to place them), any other reason is the API\'s. The summary adds `matched`, `addedToAccounts` and `emailFindsQueued`.\n\n## List and search accounts\n\n`accounts list` and `accounts search` sort and page on the server, so they reach every account in the workspace, however many there are.\n\n```bash\nkenso accounts list --sort score:desc --limit 100 # one page; the output\'s next: line is the following one\nkenso accounts list --sort score:desc --limit 100 --all # every page, to the end\nkenso accounts search --search hiring --sort latestSignalAt:desc --data \'{"qFields": ["name", "latestSignal"]}\'\nkenso accounts search --limit 1 --data \'{"countBy": ["stage"]}\' # how many accounts sit in each stage\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}]}, "sort": "tier,-pipelineAmount"}\' --all\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "hqLocation", "operator": "contains", "values": ["Germany"]}]}}\' --all\n# tier 1 accounts with no meeting in 30 days: none since then, or none ever\nkenso accounts search --data \'{"where": {"match": "all", "conditions": [{"field": "tier", "operator": "is", "values": ["1"]}, {"match": "any", "conditions": [{"field": "lastMeeting", "operator": "older_than_days", "values": ["30"]}, {"field": "lastMeeting", "operator": "is_empty"}]}]}}\' --all\n```\n\n- **`--sort`** takes up to 3 comma-separated keys, each `field` (ascending), `field:asc` or `field:desc`. The API\'s `-field` form needs the equals sign here, `--sort=-score`, because a value that starts with a dash reads as a flag. Fields: `createdAt`, `name`, `score`, `tier` (ascending is tier 1 first), `latestSignalAt`, `committee`, `pipelineAmount`, `nextTouchAt`, `lastTouchAt`. An account with no value for a key comes last in both directions. The default is `-createdAt`.\n- **`--limit`** is 1 to 1000 (default 50). `--cursor` takes the previous page\'s `nextCursor` with the same filters and sort; `--all` follows the cursors for you.\n- **`--search`** (also `--q`) matches the name or a domain.\n- **Lists and objects go in `--data`** on `search`, as the API takes them (`kenso describe accounts search`); a flag beside it sets or replaces one key:\n - `qFields` picks where the search text looks: `name`, `domain`, `latestSignal` (the latest signal\'s title).\n - `countBy` (`stage`, `stageGroup`) adds `counts` to the output: every value with the number of matching accounts that hold it, whatever the page. The output is then one object: `data`, `pagination` and `counts`.\n - `filters` and `where` narrow the accounts.\n\nAn account\'s timeline pages the same way. `kenso accounts activity 812` returns the newest 100 earlier rows and, when older ones exist, `data.nextCursor`. Pass it back as `--cursor` (with the same `--category`) for the rows before them, until a page comes without one.\n\n## Edit accounts, people and opportunities\n\nApart from `accounts bulk-update`, which sets one `accountType` on up to 500 accounts, there is no bulk edit route, so run the generated `update` command once per row with `--each`. Columns are the command\'s flags by API name or flag name, and the id column fills the route:\n\n```bash\nkenso accounts update --each accounts-edit.csv --dry-run # then the same with --yes\nkenso people update --each people-edit.csv --dry-run\nkenso opportunities update --each deals.csv --dry-run\n```\n\n```csv\naccountId,stage,ownerMemberId,overwritePinned\n501,engaged,42,true\n502,customer,42,true\n```\n\nA row that changes a field someone pinned in the app fails as a whole (`409 conflict`, `pinned_by_user`: nothing on that record changes, the other fields of the row included), unless the row sets `overwritePinned` to `true` (or you pass `--overwrite-pinned`, only with the person\'s OK). Every flag of an update command: `kenso accounts update --help`.\n\n## Search opportunities\n\n`kenso opportunities search` works as `accounts search` does: it takes `--search`, `--sort`, `--limit`, `--cursor`, `--all`, and its lists in `--data`.\n\n```bash\nkenso opportunities search --data \'{"filters": [{"field": "stageCategory", "operator": "is", "values": ["open"]}]}\' --all\nkenso opportunities search --data \'{"filters": [{"field": "ownerMemberId", "operator": "is", "values": ["none"]}, {"field": "closeDate", "operator": "is", "values": ["past_due", "next_30_days"]}]}\'\nkenso opportunities search --limit 1 --data \'{"countBy": ["stage", "ownerMemberId"]}\' # how many opportunities hold each value\n```\n\n- **`filters`** is a list of `{field, operator, values}`, all of which must hold. Fields: `stage` (a stage key), `stageCategory` (`open`, `won`, `lost`), `ownerMemberId`, `closeDate` (`past_due`, `next_30_days`, `later`, `none`) and `sourceCampaignId`. `operator` is `is` or `is_not`; the values of one condition are OR. `none` in `values` matches an opportunity with no owner, no source campaign or no close date.\n- **`countBy`** takes the same field names and adds `counts` to the output: per field, every value with the number of matching opportunities that hold it.\n- `--account-id` keeps the search to one account. `closeDate` counts days in the member\'s app time zone.\n\nOne person\'s deals, meetings and campaign contacts, as their person page lists them:\n\n```bash\nkenso opportunities list --person-id 9001 # the deals they are on, or are the primary person of\nkenso meetings list --person-id 9001 # the meetings they attend, among the ones you can see\nkenso contacts list --person-id 9001 # their contact in each campaign they are in\n```\n\n## Write research you gathered\n\n`accounts write-research` and `people write-research` store research you gathered outside Kenso as the record\'s latest research (`PUT /v1/accounts/{accountId}/research`, `PUT /v1/people/{personId}/research`). The Research tab shows it like a Ken run, with `trigger: agent` and `researchedAt` now. Nothing is charged, and no account or person field changes: set an account\'s own `fitScore`, `whyNow` or `angle` with `accounts update`. They need the `accounts_research` flag and accounts edit.\n\nThe body is the research block `accounts get --expand research` (or `people get-research`) returns, without its read-only fields: leave out `id`, `status`, `trigger`, `errorCode`, `researchedAt`, `isStale` and `appliedPrompt` (for a person also `mode`, `requestedAt`, `researchedMode`, `firecrawlCredits` and `webNote`), or the write fails with `unknown_field`. Pass it with `--data @file`:\n\n```bash\nkenso accounts write-research --account-id 501 --data @acme-dossier.json\nkenso people write-research --person-id 9001 --data @jane.json\n```\n\n```json\n{\n "tagline": { "text": "Payroll for EU contractors", "sourceUrls": ["https://acme.example"] },\n "description": { "text": "Acme runs payroll and compliance for companies hiring contractors in 30 EU countries.", "sourceUrls": ["https://acme.example"] },\n "links": { "website": "https://acme.example" },\n "whyNow": { "text": "Raised a $40M Series B in October", "sourceUrls": ["https://news.example/acme-b"], "date": "2026-10" },\n "fitScore": 82,\n "angle": "Lead with contractor onboarding time."\n}\n```\n\nMany records: one JSONL line per record, with the id next to the block\'s fields. Nested objects are sent as written. Use JSONL, not CSV: the block\'s fields are objects and lists, which a CSV cell cannot carry.\n\n```bash\nkenso accounts write-research --each dossiers.jsonl --dry-run # then the same with --yes\nkenso people write-research --each people-research.jsonl --yes --concurrency 8\n```\n\n```jsonl\n{"accountId": 501, "tagline": {"text": "Payroll for EU contractors"}, "links": {"website": "https://acme.example"}}\n{"accountId": 502, "description": {"text": "Cloud cost tooling for retailers."}, "links": {"website": "https://beta.example"}}\n```\n\nA row fails as a whole with the API\'s code: `validation_failed` (an unknown field is `unknown_field`, and `error.details` names every bad field), `research_in_progress` (`409`: Ken is researching that record now, write it again once the run ends; an account run waiting for credits counts too: it runs once the workspace has credits, and the write stays refused until that run ends) or `not_found`. Rerunning a file is safe: each write replaces the record\'s research shown.\n\n## CRM sync\n\nCRM sync has generated commands only: read connections, preview, start an import, and work through sync issues. Connect the CRM itself in the app.\n\n```bash\nkenso crm-connections list\nkenso crm-connections get --connection-id 7\nkenso crm-imports create --connection-id 7 --dry-run\nkenso crm-sync-issues list --connection-id 7 --all\n```\n\nRun `kenso crm-connections --help` (or add `--all-commands` when the actions are hidden) to see every action.\n\n## Pipelines\n\nA workspace with the `pipelines` flag on can run several deal pipelines, each with its own stages. These are generated commands (beta):\n\n```bash\nkenso pipelines list\nkenso pipelines list --query "[].{id: id, name: name, default: isDefault, stages: stages[].key}"\nkenso pipelines get --pipeline-id 5\n```\n\n`list` prints every pipeline in display order, archived ones included: `id`, `name`, `routingRule` (the one sentence Ken reads to decide whether a new deal belongs there), `isDefault`, `isArchived`, `position`, `opportunityCount`, `amountTotal` and `stages`, each stage as `kenso opportunity-stages list` prints it. A stage key is unique in the workspace, across pipelines, so a deal\'s `stage` names its pipeline and its `pipelineId` repeats it. The first read turns the workspace\'s stage list into its default pipeline, named Sales, with every deal in it. The same rows as the MCP\'s `pipelines(operation="list")`.\n\n## Restore a deleted account\n\n```bash\nkenso deleted-accounts list\nkenso accounts restore 812\n```\n\nA deleted account can be restored for 30 days. `deleted-accounts list` shows each one with who deleted it, `expiresAt` (restore works until then) and what comes back: `personCount`, `opportunityCount` and `touchCount`. `accounts restore <id>` brings the account back with its domains, its people, its deals and its planned touches, which wait for approval again. A domain another account took since stays with that account and is listed in `domainsTaken`. A merged account is not listed and cannot be restored: a merge has no undo. Both commands are behind the `crm_import_export` feature flag (`404` while it is off).\n\n## Export accounts, people or deals\n\n```bash\nkenso export accounts --out accounts.csv\nkenso export accounts --view 12 --out tier-1.csv\nkenso export deals --filters \'[{"field":"stageCategory","operator":"is","values":["open"]}]\' > open-deals.csv\n```\n\nIt writes the CSV that `POST /v1/accounts/export`, `/v1/people/export` or `/v1/opportunities/export` returns, to stdout or to `--out` (then it prints the file and its row count). With no filter it exports every record. More than 50,000 rows is refused: narrow the filters. `--view <id>` exports a saved Accounts view (`kenso account-views list` shows the ids). `--filters`, `--where` (accounts), `--q` and `--sort` are the search operation\'s own fields, so a deals or people view exports with its filters and sort. The accounts and deals files start with `id` and import back as they are. Each export writes an audit-log entry and needs the export permission. Accounts and deals also need the `crm_import_export` flag while it is in beta.\n\n## A deal\'s stage history\n\n```bash\nkenso opportunities stage-history 77\nkenso opportunities stage-history 77 --query "entries[].{to: stageLabel, at: enteredAt, by: changedBy}"\n```\n\nIt prints `GET /v1/opportunities/{id}/stage-history` as it is, the same rows as the deal page and the MCP\'s `opportunities(operation="get-stage-history")`: the stage now, `isComplete` and `entries`, oldest first, each with `fromStage`, `stage`, `stageLabel`, `enteredAt`, `leftAt`, `durationSeconds`, `actorKind`, `actorMemberId` and Ken\'s `reason` on a move its stage judge made. With the `deal_stage_rules` flag on, each entry also has `changedBy` (`member`, `agent`, `api_key`, `workflow`, `stage_judge`, `crm_sync` or `ken_automation`), `crmProvider` on a CRM sync, and on a move `fromStageLabel` and `fromStageDurationSeconds`, how long the deal sat in the stage it left. `isComplete` false means Kenso has no record of part of the history.\n\n## Required fields per stage\n\n```bash\nkenso pipelines stage-rules\nkenso pipelines stage-rules proposal --require amount,closeDate,custom.tier\nkenso pipelines stage-rules proposal --none\nkenso pipelines stage-rules lost --default\n```\n\nWith the `deal_stage_rules` flag on, each stage can name the fields a deal should have in it. Without a stage the command prints every stage\'s `key`, `label`, `category`, `isArchived`, `requiredFields` and `isDefault`, plus `requirableFields`: `amount`, `closeDate`, `ownerMemberId`, `primaryPersonId`, `nextStep`, `lostReasonKey`, `wonReasonKey` and `custom.<key>` for each custom deal field. `--require` sets the stage\'s whole list, in order, at most 10. `--none` requires nothing, and `--default` goes back to the default: a lost stage asks for `lostReasonKey`, any other stage nothing. Setting a rule needs the `workspace_settings` permission. The same as the MCP\'s `opportunities(operation="stages-set-required-fields")`.\n\nA missing field never stops a move. The deal moves, and it is flagged Missing on the board, the list and the deal page until the field is filled. A rule also applies to deals already in the stage.\n\n## Tasks\n\nTasks are to-dos a member owes: a title, an optional due day or time, an assignee and at most one account, person or deal. They need the `tasks` flag. The app calls deals "Deals"; the CLI keeps `--deal` for an opportunity id.\n\n```bash\nkenso tasks add "Send the deck" --due tomorrow --account 812\nkenso tasks add "Call Ada back" --due friday --at 16:00 --person 501 --assignee ada@acme.com\nkenso tasks list --assignee me --due overdue,today\nkenso tasks queue --scope mine\nkenso tasks assign 7 me\nkenso tasks done 7 8 9\nkenso tasks done 7 --undo\n```\n\n- `tasks add` sends `POST /v1/tasks`. `--due` takes `today`, `tomorrow`, a weekday (the next one: `friday` or `fri`), a day (`2026-11-20`) or an ISO 8601 time; `--at HH:MM` puts a time on that day (today without `--due`). Day words and `--at` read this computer\'s clock and time zone (`TZ`); a time\'s day is read in the assignee\'s app time zone. `--assignee` takes `me`, a member id or an email; without it the task is yours.\n- `tasks done` completes each task it names, in order (`PATCH /v1/tasks/{id}` with `status: done`); `--undo` reopens them. `tasks assign` gives a task to `me`, a member id or a member\'s email; that member gets a `task_assigned` notification.\n- `tasks queue` is `task-queue list` under the name you would try: the Tasks screen\'s open work by due day, with `--scope mine|assigned_by_me|everyone`. It lists tasks, manual touches, call tasks, inbox threads with a reminder due (when you can view the Inbox) and Ken\'s follow-ups to you, each with an app link in `href`.\n- `tasks list`, `get`, `update`, `delete`, `restore` and `task-queue list` are generated from the API: `kenso tasks --help` lists them.\n';
|
|
7788
7788
|
}
|
|
7789
7789
|
});
|
|
7790
7790
|
|
|
@@ -8976,8 +8976,8 @@ var init_browser_login = __esm({
|
|
|
8976
8976
|
defaultDeps = {
|
|
8977
8977
|
sleep: (ms, signal) => delay2(ms, void 0, signal ? { signal } : void 0),
|
|
8978
8978
|
now: () => Date.now(),
|
|
8979
|
-
spawn: (
|
|
8980
|
-
const child = nodeSpawn(
|
|
8979
|
+
spawn: (command57, args) => {
|
|
8980
|
+
const child = nodeSpawn(command57, args, { detached: true, stdio: "ignore" });
|
|
8981
8981
|
child.on("error", () => {
|
|
8982
8982
|
});
|
|
8983
8983
|
child.unref();
|
|
@@ -10166,8 +10166,8 @@ var init_run = __esm({
|
|
|
10166
10166
|
defaultDeps2 = {
|
|
10167
10167
|
sleep: (ms, signal) => delay3(ms, void 0, signal ? { signal } : void 0),
|
|
10168
10168
|
now: () => Date.now(),
|
|
10169
|
-
spawn: (
|
|
10170
|
-
const child = nodeSpawn2(
|
|
10169
|
+
spawn: (command57, args) => {
|
|
10170
|
+
const child = nodeSpawn2(command57, args, { detached: true, stdio: "ignore" });
|
|
10171
10171
|
child.on("error", () => {
|
|
10172
10172
|
});
|
|
10173
10173
|
child.unref();
|
|
@@ -10208,9 +10208,9 @@ function stringFlag2(flags, name) {
|
|
|
10208
10208
|
const text4 = value.trim();
|
|
10209
10209
|
return text4 === "" ? void 0 : text4;
|
|
10210
10210
|
}
|
|
10211
|
-
function requireFlag(flags, name,
|
|
10211
|
+
function requireFlag(flags, name, command57, hint) {
|
|
10212
10212
|
const value = stringFlag2(flags, name);
|
|
10213
|
-
if (value === void 0) throw usageError(`--${name} is required for ${
|
|
10213
|
+
if (value === void 0) throw usageError(`--${name} is required for ${command57}.`, { field: name, next: `${command57} --help`, ...hint ? { hint } : {} });
|
|
10214
10214
|
return value;
|
|
10215
10215
|
}
|
|
10216
10216
|
function positiveId(value) {
|
|
@@ -10219,8 +10219,8 @@ function positiveId(value) {
|
|
|
10219
10219
|
const id = Number(text4);
|
|
10220
10220
|
return Number.isSafeInteger(id) && id > 0 ? id : void 0;
|
|
10221
10221
|
}
|
|
10222
|
-
function idFlag(flags, name,
|
|
10223
|
-
const raw = requireFlag(flags, name,
|
|
10222
|
+
function idFlag(flags, name, command57) {
|
|
10223
|
+
const raw = requireFlag(flags, name, command57);
|
|
10224
10224
|
const id = positiveId(raw);
|
|
10225
10225
|
if (id === void 0) throw usageError(`--${name} must be a positive whole number (got "${raw}").`, { field: name });
|
|
10226
10226
|
return id;
|
|
@@ -10240,8 +10240,8 @@ function isDryRun(ctx) {
|
|
|
10240
10240
|
function shellQuote4(value) {
|
|
10241
10241
|
return /^[A-Za-z0-9_\-.,:/@=+%]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
|
|
10242
10242
|
}
|
|
10243
|
-
function sameCommand2(
|
|
10244
|
-
const parts2 = [
|
|
10243
|
+
function sameCommand2(command57, flags, ctx, extra = []) {
|
|
10244
|
+
const parts2 = [command57];
|
|
10245
10245
|
for (const [name, value] of Object.entries(flags)) {
|
|
10246
10246
|
if (value === void 0 || value === false) continue;
|
|
10247
10247
|
if (value === true) parts2.push(`--${name}`);
|
|
@@ -11378,12 +11378,12 @@ import { join as join11 } from "node:path";
|
|
|
11378
11378
|
function whereDir(env) {
|
|
11379
11379
|
return join11(runsRoot(env), WHERE_DIR);
|
|
11380
11380
|
}
|
|
11381
|
-
async function unfinishedWhereIds(ctx,
|
|
11381
|
+
async function unfinishedWhereIds(ctx, command57, args) {
|
|
11382
11382
|
const dir = whereDir(ctx.env);
|
|
11383
11383
|
const identity = argsIdentity(args);
|
|
11384
11384
|
const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
|
|
11385
11385
|
for (const run of await listRuns(ctx.env)) {
|
|
11386
|
-
if (run.command !==
|
|
11386
|
+
if (run.command !== command57 || run.status === "done" || run.status === "planned") continue;
|
|
11387
11387
|
if ((run.workspaceId || void 0) !== (workspaceId || void 0) || argsIdentity(run.args) !== identity) continue;
|
|
11388
11388
|
if (run.inputPath?.startsWith(`${dir}/`) && existsSync6(run.inputPath)) return run.inputPath;
|
|
11389
11389
|
}
|
|
@@ -11529,14 +11529,14 @@ async function idsFromRun(ctx, runId) {
|
|
|
11529
11529
|
return { ...idItems(ids2), source: "run" };
|
|
11530
11530
|
}
|
|
11531
11531
|
async function collectIds(ctx, flags, kind, dryRun2) {
|
|
11532
|
-
const
|
|
11532
|
+
const command57 = `kenso contacts ${kind}`;
|
|
11533
11533
|
const ids2 = stringFlag2(flags, "ids");
|
|
11534
11534
|
const where = kind === "restore" ? void 0 : stringFlag2(flags, "where");
|
|
11535
11535
|
const run = kind === "restore" ? stringFlag2(flags, "run") : void 0;
|
|
11536
11536
|
const given = [ids2, where, run].filter((v) => v !== void 0).length;
|
|
11537
11537
|
if (given !== 1) {
|
|
11538
11538
|
const choices = kind === "restore" ? "--ids <file|-> or --run <runId>" : "--ids <file|-> or --where '<json>'";
|
|
11539
|
-
throw usageError(`${
|
|
11539
|
+
throw usageError(`${command57} needs exactly one of ${choices}.`, { field: "ids", next: `${command57} --help` });
|
|
11540
11540
|
}
|
|
11541
11541
|
if (ids2 !== void 0) return idsFromFile(ctx, ids2);
|
|
11542
11542
|
if (where !== void 0) return idsFromWhere(ctx, kind, flags, where, dryRun2);
|
|
@@ -14741,6 +14741,275 @@ var init_studio2 = __esm({
|
|
|
14741
14741
|
}
|
|
14742
14742
|
});
|
|
14743
14743
|
|
|
14744
|
+
// src/commands/tasks/shared.ts
|
|
14745
|
+
function positiveId3(text4, field, next) {
|
|
14746
|
+
const value = (text4 ?? "").trim();
|
|
14747
|
+
const id = /^\d+$/.test(value) ? Number(value) : Number.NaN;
|
|
14748
|
+
if (!Number.isSafeInteger(id) || id < 1) throw usageError(`${field} must be a positive whole number (got "${value}").`, { field, next });
|
|
14749
|
+
return id;
|
|
14750
|
+
}
|
|
14751
|
+
function due(dueText, atText, now = /* @__PURE__ */ new Date()) {
|
|
14752
|
+
const text4 = (dueText ?? "").trim();
|
|
14753
|
+
if (/^\d{4}-\d{2}-\d{2}T/.test(text4)) {
|
|
14754
|
+
if (atText !== void 0) throw usageError("--at puts a time on a day: give --due a day, not a time.", { field: "at", next: DUE_NEXT });
|
|
14755
|
+
if (Number.isNaN(Date.parse(text4))) throw badDue(text4);
|
|
14756
|
+
return { dueAt: text4 };
|
|
14757
|
+
}
|
|
14758
|
+
if (dueText === void 0 && atText === void 0) return {};
|
|
14759
|
+
const day = dueText === void 0 ? startOfDay(now) : dayOf(text4.toLowerCase(), now);
|
|
14760
|
+
if (atText === void 0) return { dueDate: ymd(day) };
|
|
14761
|
+
const at = /^([01]?\d|2[0-3]):([0-5]\d)$/.exec(atText.trim());
|
|
14762
|
+
if (!at) throw usageError(`--at must be a time of day as HH:MM (got "${atText}").`, { field: "at", next: DUE_NEXT });
|
|
14763
|
+
return { dueAt: new Date(day.getFullYear(), day.getMonth(), day.getDate(), Number(at[1]), Number(at[2])).toISOString() };
|
|
14764
|
+
}
|
|
14765
|
+
function dayOf(text4, now) {
|
|
14766
|
+
const today = startOfDay(now);
|
|
14767
|
+
if (text4 === "today") return today;
|
|
14768
|
+
if (text4 === "tomorrow") return addDays(today, 1);
|
|
14769
|
+
const weekday = WEEKDAYS.findIndex((name) => name === text4 || name.slice(0, 3) === text4);
|
|
14770
|
+
if (weekday >= 0) return addDays(today, (weekday - today.getDay() + 6) % 7 + 1);
|
|
14771
|
+
const parts2 = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text4);
|
|
14772
|
+
if (parts2) {
|
|
14773
|
+
const day = new Date(Number(parts2[1]), Number(parts2[2]) - 1, Number(parts2[3]));
|
|
14774
|
+
if (ymd(day) === text4) return day;
|
|
14775
|
+
}
|
|
14776
|
+
throw badDue(text4);
|
|
14777
|
+
}
|
|
14778
|
+
function badDue(text4) {
|
|
14779
|
+
return usageError(`--due must be today, tomorrow, a weekday, a day (2026-11-20) or an ISO 8601 time (got "${text4}").`, {
|
|
14780
|
+
field: "due",
|
|
14781
|
+
next: DUE_NEXT
|
|
14782
|
+
});
|
|
14783
|
+
}
|
|
14784
|
+
async function memberId(ctx, text4, field, next) {
|
|
14785
|
+
const value = text4.trim();
|
|
14786
|
+
if (value.toLowerCase() === "me") {
|
|
14787
|
+
let me = unwrap((await ctx.client.request({ method: "GET", path: "/v1/me", signal: ctx.signal })).body);
|
|
14788
|
+
if (me && typeof me.id !== "number" && typeof me.data?.id === "number") me = me.data;
|
|
14789
|
+
if (typeof me?.id === "number") return me.id;
|
|
14790
|
+
throw usageError("This key belongs to no member: name a member id or email.", { field, next });
|
|
14791
|
+
}
|
|
14792
|
+
if (value.includes("@")) {
|
|
14793
|
+
const email = value.toLowerCase();
|
|
14794
|
+
for await (const member of ctx.client.paginate({ method: "GET", path: "/v1/members", signal: ctx.signal }, { pageSize: 200 })) {
|
|
14795
|
+
if (typeof member.email === "string" && member.email.toLowerCase() === email && typeof member.id === "number") return member.id;
|
|
14796
|
+
}
|
|
14797
|
+
throw new KensoError({
|
|
14798
|
+
code: "not_found",
|
|
14799
|
+
message: `No member of this workspace has the email ${value}.`,
|
|
14800
|
+
exitCode: ExitCode.NotFound,
|
|
14801
|
+
field,
|
|
14802
|
+
next: "kenso members list"
|
|
14803
|
+
});
|
|
14804
|
+
}
|
|
14805
|
+
return positiveId3(value, field, next);
|
|
14806
|
+
}
|
|
14807
|
+
var WEEKDAYS, DUE_NEXT, startOfDay, addDays, ymd;
|
|
14808
|
+
var init_shared2 = __esm({
|
|
14809
|
+
"src/commands/tasks/shared.ts"() {
|
|
14810
|
+
"use strict";
|
|
14811
|
+
init_errors();
|
|
14812
|
+
init_exit_codes();
|
|
14813
|
+
init_http();
|
|
14814
|
+
WEEKDAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
14815
|
+
DUE_NEXT = 'kenso tasks add "Send the deck" --due tomorrow --at 15:00';
|
|
14816
|
+
startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
14817
|
+
addDays = (d, days) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + days);
|
|
14818
|
+
ymd = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
14819
|
+
}
|
|
14820
|
+
});
|
|
14821
|
+
|
|
14822
|
+
// src/commands/tasks/add.ts
|
|
14823
|
+
var add_exports = {};
|
|
14824
|
+
__export(add_exports, {
|
|
14825
|
+
default: () => add_default
|
|
14826
|
+
});
|
|
14827
|
+
var NEXT, command44, add_default;
|
|
14828
|
+
var init_add = __esm({
|
|
14829
|
+
"src/commands/tasks/add.ts"() {
|
|
14830
|
+
"use strict";
|
|
14831
|
+
init_errors();
|
|
14832
|
+
init_exit_codes();
|
|
14833
|
+
init_http();
|
|
14834
|
+
init_shared2();
|
|
14835
|
+
NEXT = 'kenso tasks add "Send the deck" --due tomorrow --account 812';
|
|
14836
|
+
command44 = {
|
|
14837
|
+
resource: "tasks",
|
|
14838
|
+
action: "add",
|
|
14839
|
+
summary: "Add a task: a title, an optional due day and time, assignee and the account, person or deal it is about",
|
|
14840
|
+
description: "Sends POST /v1/tasks and prints the task. The words after add are the title (1-500 characters). --due takes today, tomorrow, a weekday (the next one: friday or fri), a day (2026-11-20) or an ISO 8601 time; --at HH:MM puts a time on that day (today without --due). Day words and --at read this computer's clock and time zone (TZ); a time's day is read in the assignee's app time zone. --assignee takes me, a member id or an email; without it the task is yours. Link at most one of --account, --person, --deal: a person's task also shows on their first account, a deal's on its account and primary person. Linking an account on a plan without Accounts is plan_required.",
|
|
14841
|
+
flags: {
|
|
14842
|
+
due: { type: "string", description: "Due day: today, tomorrow, a weekday, YYYY-MM-DD, or an ISO 8601 time" },
|
|
14843
|
+
at: { type: "string", description: "Due time on that day, HH:MM (today without --due)" },
|
|
14844
|
+
assignee: { type: "string", description: "The member it is for: me, a member id or an email; default you" },
|
|
14845
|
+
notes: { type: "string", description: "Notes (markdown)" },
|
|
14846
|
+
account: { type: "string", description: "Account id it is about" },
|
|
14847
|
+
person: { type: "string", description: "Person id it is about" },
|
|
14848
|
+
deal: { type: "string", description: "Deal (opportunity) id it is about" }
|
|
14849
|
+
},
|
|
14850
|
+
positionals: [{ name: "title", required: true, variadic: true, description: "The task, such as Send the deck to Maya" }],
|
|
14851
|
+
examples: [NEXT, 'kenso tasks add "Call Ada back" --due friday --at 16:00 --person 501 --assignee ada@acme.com'],
|
|
14852
|
+
beta: { featureGates: { all: ["tasks"] } },
|
|
14853
|
+
operationIds: ["tasks.create", "me.get", "members.list"],
|
|
14854
|
+
async run(ctx, { flags, positionals }) {
|
|
14855
|
+
const title = positionals.join(" ").trim();
|
|
14856
|
+
if (title === "") throw usageError("Give the task a title.", { field: "title", next: NEXT });
|
|
14857
|
+
const links = ["account", "person", "deal"].filter((name) => typeof flags[name] === "string");
|
|
14858
|
+
if (links.length > 1) throw usageError("Link the task to one record: --account, --person or --deal.", { field: links[1], next: NEXT });
|
|
14859
|
+
const body2 = { title };
|
|
14860
|
+
if (typeof flags.notes === "string") body2.notes = flags.notes;
|
|
14861
|
+
Object.assign(body2, due(typeof flags.due === "string" ? flags.due : void 0, typeof flags.at === "string" ? flags.at : void 0));
|
|
14862
|
+
if (typeof flags.assignee === "string") body2.assigneeMemberId = await memberId(ctx, flags.assignee, "assignee", NEXT);
|
|
14863
|
+
if (typeof flags.account === "string") body2.accountId = positiveId3(flags.account, "account", NEXT);
|
|
14864
|
+
if (typeof flags.person === "string") body2.personId = positiveId3(flags.person, "person", NEXT);
|
|
14865
|
+
if (typeof flags.deal === "string") body2.opportunityId = positiveId3(flags.deal, "deal", NEXT);
|
|
14866
|
+
const res = await ctx.client.request({ method: "POST", path: "/v1/tasks", body: body2, signal: ctx.signal });
|
|
14867
|
+
ctx.output.object(unwrap(res.body));
|
|
14868
|
+
return ExitCode.Ok;
|
|
14869
|
+
}
|
|
14870
|
+
};
|
|
14871
|
+
add_default = command44;
|
|
14872
|
+
}
|
|
14873
|
+
});
|
|
14874
|
+
|
|
14875
|
+
// src/commands/tasks/done.ts
|
|
14876
|
+
var done_exports = {};
|
|
14877
|
+
__export(done_exports, {
|
|
14878
|
+
default: () => done_default,
|
|
14879
|
+
patchTask: () => patchTask
|
|
14880
|
+
});
|
|
14881
|
+
async function patchTask(ctx, taskId, change) {
|
|
14882
|
+
const send2 = () => ctx.client.request({ method: "PATCH", path: `/v1/tasks/${taskId}`, body: change, signal: ctx.signal });
|
|
14883
|
+
try {
|
|
14884
|
+
return unwrap((await send2()).body);
|
|
14885
|
+
} catch (error) {
|
|
14886
|
+
if (!(error instanceof KensoError) || error.httpStatus !== 409) throw error;
|
|
14887
|
+
return unwrap((await send2()).body);
|
|
14888
|
+
}
|
|
14889
|
+
}
|
|
14890
|
+
var command45, done_default;
|
|
14891
|
+
var init_done = __esm({
|
|
14892
|
+
"src/commands/tasks/done.ts"() {
|
|
14893
|
+
"use strict";
|
|
14894
|
+
init_errors();
|
|
14895
|
+
init_exit_codes();
|
|
14896
|
+
init_http();
|
|
14897
|
+
init_shared2();
|
|
14898
|
+
command45 = {
|
|
14899
|
+
resource: "tasks",
|
|
14900
|
+
action: "done",
|
|
14901
|
+
summary: "Complete one or more tasks (--undo reopens them)",
|
|
14902
|
+
description: "Sends PATCH /v1/tasks/{taskId} with status done for each id, in order, and prints the task (one line per task for several): completedAt and completedByMemberId set, and task.completed written on the record's timeline. --undo sends status open, which reopens it. An error stops at that id; the ones before it are done.",
|
|
14903
|
+
flags: { undo: { type: "boolean", description: "Reopen the task instead" } },
|
|
14904
|
+
positionals: [{ name: "taskId", required: true, variadic: true, description: "One or more task ids" }],
|
|
14905
|
+
examples: ["kenso tasks done 7", "kenso tasks done 7 8 9", "kenso tasks done 7 --undo"],
|
|
14906
|
+
beta: { featureGates: { all: ["tasks"] } },
|
|
14907
|
+
operationIds: ["tasks.update"],
|
|
14908
|
+
async run(ctx, { flags, positionals }) {
|
|
14909
|
+
const ids2 = [...new Set(positionals.map((text4) => positiveId3(text4, "taskId", "kenso tasks done <taskId>...")))];
|
|
14910
|
+
const change = { status: flags.undo === true ? "open" : "done" };
|
|
14911
|
+
if (ids2.length === 1) ctx.output.object(await patchTask(ctx, ids2[0], change));
|
|
14912
|
+
else
|
|
14913
|
+
await ctx.output.list(
|
|
14914
|
+
(async function* () {
|
|
14915
|
+
for (const id of ids2) yield await patchTask(ctx, id, change);
|
|
14916
|
+
})()
|
|
14917
|
+
);
|
|
14918
|
+
return ExitCode.Ok;
|
|
14919
|
+
}
|
|
14920
|
+
};
|
|
14921
|
+
done_default = command45;
|
|
14922
|
+
}
|
|
14923
|
+
});
|
|
14924
|
+
|
|
14925
|
+
// src/commands/tasks/assign.ts
|
|
14926
|
+
var assign_exports = {};
|
|
14927
|
+
__export(assign_exports, {
|
|
14928
|
+
default: () => assign_default
|
|
14929
|
+
});
|
|
14930
|
+
var NEXT2, command46, assign_default;
|
|
14931
|
+
var init_assign = __esm({
|
|
14932
|
+
"src/commands/tasks/assign.ts"() {
|
|
14933
|
+
"use strict";
|
|
14934
|
+
init_exit_codes();
|
|
14935
|
+
init_done();
|
|
14936
|
+
init_shared2();
|
|
14937
|
+
NEXT2 = "kenso tasks assign <taskId> <me|memberId|email>";
|
|
14938
|
+
command46 = {
|
|
14939
|
+
resource: "tasks",
|
|
14940
|
+
action: "assign",
|
|
14941
|
+
summary: "Give a task to a member",
|
|
14942
|
+
description: "Sends PATCH /v1/tasks/{taskId} with assigneeMemberId and prints the task. The member is me, a member id or a member's email. They get a task_assigned notification unless they assigned it themselves. A member id outside the workspace is invalid_member.",
|
|
14943
|
+
flags: {},
|
|
14944
|
+
positionals: [
|
|
14945
|
+
{ name: "taskId", required: true, description: "The task id" },
|
|
14946
|
+
{ name: "member", required: true, description: "The member it is for: me, a member id or an email" }
|
|
14947
|
+
],
|
|
14948
|
+
examples: ["kenso tasks assign 7 42", "kenso tasks assign 7 me", "kenso tasks assign 7 ada@acme.com"],
|
|
14949
|
+
beta: { featureGates: { all: ["tasks"] } },
|
|
14950
|
+
operationIds: ["tasks.update", "me.get", "members.list"],
|
|
14951
|
+
async run(ctx, { positionals }) {
|
|
14952
|
+
const taskId = positiveId3(positionals[0], "taskId", NEXT2);
|
|
14953
|
+
const assignee = await memberId(ctx, positionals[1] ?? "", "member", NEXT2);
|
|
14954
|
+
ctx.output.object(await patchTask(ctx, taskId, { assigneeMemberId: assignee }));
|
|
14955
|
+
return ExitCode.Ok;
|
|
14956
|
+
}
|
|
14957
|
+
};
|
|
14958
|
+
assign_default = command46;
|
|
14959
|
+
}
|
|
14960
|
+
});
|
|
14961
|
+
|
|
14962
|
+
// src/commands/tasks/queue.ts
|
|
14963
|
+
var queue_exports = {};
|
|
14964
|
+
__export(queue_exports, {
|
|
14965
|
+
default: () => queue_default
|
|
14966
|
+
});
|
|
14967
|
+
var SCOPES, command47, queue_default;
|
|
14968
|
+
var init_queue = __esm({
|
|
14969
|
+
"src/commands/tasks/queue.ts"() {
|
|
14970
|
+
"use strict";
|
|
14971
|
+
init_errors();
|
|
14972
|
+
init_exit_codes();
|
|
14973
|
+
SCOPES = ["mine", "assigned_by_me", "everyone"];
|
|
14974
|
+
command47 = {
|
|
14975
|
+
resource: "tasks",
|
|
14976
|
+
action: "queue",
|
|
14977
|
+
summary: "Your open work by due day: tasks, touches, call tasks, reply reminders and Ken follow-ups",
|
|
14978
|
+
description: "Reads every page of GET /v1/task-queue, the rows of the app's Tasks screen and of kenso task-queue list, by due day, due time, then id. Each row has kind (task, touch, call_task, reply_reminder or ken_follow_up), id, title, dueDate, dueAt, dueBucket, overdue, record and href, the app path where it is worked (a task opens in its panel). --scope mine (default), assigned_by_me (tasks only) or everyone.",
|
|
14979
|
+
flags: {
|
|
14980
|
+
scope: { type: "string", description: "mine (default), assigned_by_me or everyone" },
|
|
14981
|
+
timezone: { type: "string", description: "IANA time zone for the due days when you have no app time zone" }
|
|
14982
|
+
},
|
|
14983
|
+
examples: ["kenso tasks queue", "kenso tasks queue --scope everyone -o table"],
|
|
14984
|
+
beta: { featureGates: { all: ["tasks"] } },
|
|
14985
|
+
operationIds: ["task-queue.list"],
|
|
14986
|
+
async run(ctx, { flags }) {
|
|
14987
|
+
const scope = typeof flags.scope === "string" ? flags.scope.trim() : void 0;
|
|
14988
|
+
if (scope !== void 0 && !SCOPES.includes(scope))
|
|
14989
|
+
throw usageError(`--scope must be mine, assigned_by_me or everyone (got "${scope}").`, { field: "scope", next: "kenso tasks queue --scope mine" });
|
|
14990
|
+
const query = { scope, timezone: typeof flags.timezone === "string" ? flags.timezone : void 0 };
|
|
14991
|
+
await ctx.output.list(ctx.client.paginate({ method: "GET", path: "/v1/task-queue", query, signal: ctx.signal }, { pageSize: 200 }));
|
|
14992
|
+
return ExitCode.Ok;
|
|
14993
|
+
}
|
|
14994
|
+
};
|
|
14995
|
+
queue_default = command47;
|
|
14996
|
+
}
|
|
14997
|
+
});
|
|
14998
|
+
|
|
14999
|
+
// src/commands/tasks/index.ts
|
|
15000
|
+
var actions25;
|
|
15001
|
+
var init_tasks = __esm({
|
|
15002
|
+
"src/commands/tasks/index.ts"() {
|
|
15003
|
+
"use strict";
|
|
15004
|
+
actions25 = {
|
|
15005
|
+
add: () => Promise.resolve().then(() => (init_add(), add_exports)).then((m) => m.default),
|
|
15006
|
+
done: () => Promise.resolve().then(() => (init_done(), done_exports)).then((m) => m.default),
|
|
15007
|
+
assign: () => Promise.resolve().then(() => (init_assign(), assign_exports)).then((m) => m.default),
|
|
15008
|
+
queue: () => Promise.resolve().then(() => (init_queue(), queue_exports)).then((m) => m.default)
|
|
15009
|
+
};
|
|
15010
|
+
}
|
|
15011
|
+
});
|
|
15012
|
+
|
|
14744
15013
|
// src/commands/webhooks/local.ts
|
|
14745
15014
|
import { createHmac, randomBytes as randomBytes2 } from "node:crypto";
|
|
14746
15015
|
import { mkdirSync as mkdirSync4, readFileSync as readFileSync10, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
@@ -14873,7 +15142,7 @@ function readBody(req) {
|
|
|
14873
15142
|
function reply(res, status, body2) {
|
|
14874
15143
|
res.writeHead(status, { "content-type": "application/json" }).end(JSON.stringify(body2));
|
|
14875
15144
|
}
|
|
14876
|
-
var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES,
|
|
15145
|
+
var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command48, listen_default;
|
|
14877
15146
|
var init_listen = __esm({
|
|
14878
15147
|
"src/commands/webhooks/listen.ts"() {
|
|
14879
15148
|
"use strict";
|
|
@@ -14884,7 +15153,7 @@ var init_listen = __esm({
|
|
|
14884
15153
|
MIN_POLL_MS = 1e3;
|
|
14885
15154
|
MAX_POLL_MS = 6e4;
|
|
14886
15155
|
MAX_TRIGGER_BYTES = 1e6;
|
|
14887
|
-
|
|
15156
|
+
command48 = {
|
|
14888
15157
|
resource: "webhooks",
|
|
14889
15158
|
action: "listen",
|
|
14890
15159
|
summary: "Stream the workspace's events and forward them, signed, to a local handler",
|
|
@@ -14990,7 +15259,7 @@ var init_listen = __esm({
|
|
|
14990
15259
|
return ExitCode.Ok;
|
|
14991
15260
|
}
|
|
14992
15261
|
};
|
|
14993
|
-
listen_default =
|
|
15262
|
+
listen_default = command48;
|
|
14994
15263
|
}
|
|
14995
15264
|
});
|
|
14996
15265
|
|
|
@@ -15009,7 +15278,7 @@ function notRunning() {
|
|
|
15009
15278
|
next: LISTEN_NEXT
|
|
15010
15279
|
});
|
|
15011
15280
|
}
|
|
15012
|
-
var LISTEN_NEXT,
|
|
15281
|
+
var LISTEN_NEXT, command49, trigger_default;
|
|
15013
15282
|
var init_trigger = __esm({
|
|
15014
15283
|
"src/commands/webhooks/trigger.ts"() {
|
|
15015
15284
|
"use strict";
|
|
@@ -15018,7 +15287,7 @@ var init_trigger = __esm({
|
|
|
15018
15287
|
init_http();
|
|
15019
15288
|
init_local();
|
|
15020
15289
|
LISTEN_NEXT = "kenso webhooks listen --forward-to http://localhost:3000/hook";
|
|
15021
|
-
|
|
15290
|
+
command49 = {
|
|
15022
15291
|
resource: "webhooks",
|
|
15023
15292
|
action: "trigger",
|
|
15024
15293
|
summary: "Send a sample event of one type through the running kenso webhooks listen",
|
|
@@ -15075,16 +15344,16 @@ var init_trigger = __esm({
|
|
|
15075
15344
|
return ExitCode.Ok;
|
|
15076
15345
|
}
|
|
15077
15346
|
};
|
|
15078
|
-
trigger_default =
|
|
15347
|
+
trigger_default = command49;
|
|
15079
15348
|
}
|
|
15080
15349
|
});
|
|
15081
15350
|
|
|
15082
15351
|
// src/commands/webhooks/index.ts
|
|
15083
|
-
var
|
|
15352
|
+
var actions26;
|
|
15084
15353
|
var init_webhooks2 = __esm({
|
|
15085
15354
|
"src/commands/webhooks/index.ts"() {
|
|
15086
15355
|
"use strict";
|
|
15087
|
-
|
|
15356
|
+
actions26 = {
|
|
15088
15357
|
listen: () => Promise.resolve().then(() => (init_listen(), listen_exports)).then((m) => m.default),
|
|
15089
15358
|
trigger: () => Promise.resolve().then(() => (init_trigger(), trigger_exports)).then((m) => m.default)
|
|
15090
15359
|
};
|
|
@@ -15279,14 +15548,14 @@ var status_exports3 = {};
|
|
|
15279
15548
|
__export(status_exports3, {
|
|
15280
15549
|
default: () => status_default3
|
|
15281
15550
|
});
|
|
15282
|
-
var
|
|
15551
|
+
var command50, status_default3;
|
|
15283
15552
|
var init_status3 = __esm({
|
|
15284
15553
|
"src/commands/work/status.ts"() {
|
|
15285
15554
|
"use strict";
|
|
15286
15555
|
init_exit_codes();
|
|
15287
15556
|
init_http();
|
|
15288
15557
|
init_common3();
|
|
15289
|
-
|
|
15558
|
+
command50 = {
|
|
15290
15559
|
resource: "work",
|
|
15291
15560
|
action: "status",
|
|
15292
15561
|
summary: "Show the Kenso AI work waiting for your own agent, per kind",
|
|
@@ -15320,7 +15589,7 @@ var init_status3 = __esm({
|
|
|
15320
15589
|
return ExitCode.Ok;
|
|
15321
15590
|
}
|
|
15322
15591
|
};
|
|
15323
|
-
status_default3 =
|
|
15592
|
+
status_default3 = command50;
|
|
15324
15593
|
}
|
|
15325
15594
|
});
|
|
15326
15595
|
|
|
@@ -15452,9 +15721,9 @@ var init_files = __esm({
|
|
|
15452
15721
|
import { execFile, spawnSync as spawnSync2 } from "node:child_process";
|
|
15453
15722
|
import { readFileSync as readFileSync12 } from "node:fs";
|
|
15454
15723
|
import { isAbsolute as isAbsolute2 } from "node:path";
|
|
15455
|
-
function sudoArgs(user,
|
|
15724
|
+
function sudoArgs(user, command57, args, keep = [], set = {}) {
|
|
15456
15725
|
const assignments = Object.entries(set).map(([name, value]) => `${name}=${value}`);
|
|
15457
|
-
return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--",
|
|
15726
|
+
return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command57, ...args];
|
|
15458
15727
|
}
|
|
15459
15728
|
function agentKensoEnv(opts) {
|
|
15460
15729
|
return {
|
|
@@ -15464,12 +15733,12 @@ function agentKensoEnv(opts) {
|
|
|
15464
15733
|
AI_AGENT: opts.agentName
|
|
15465
15734
|
};
|
|
15466
15735
|
}
|
|
15467
|
-
function sudoExec(user,
|
|
15736
|
+
function sudoExec(user, command57, args, opts = {}) {
|
|
15468
15737
|
const [sudo = "/usr/bin/sudo", ...lead] = user.sudo;
|
|
15469
15738
|
return new Promise((resolve16) => {
|
|
15470
15739
|
execFile(
|
|
15471
15740
|
sudo,
|
|
15472
|
-
[...lead, ...sudoArgs(user.name,
|
|
15741
|
+
[...lead, ...sudoArgs(user.name, command57, args)],
|
|
15473
15742
|
{ env: { PATH: SUDO_PATH }, cwd: "/", timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS, maxBuffer: opts.maxBuffer ?? 1024 * 1024, encoding: "utf8", windowsHide: true, shell: false },
|
|
15474
15743
|
(err, stdout, stderr) => {
|
|
15475
15744
|
const code = err ? err.code : 0;
|
|
@@ -15579,9 +15848,9 @@ var init_folder2 = __esm({
|
|
|
15579
15848
|
init_redact();
|
|
15580
15849
|
init_agent_user();
|
|
15581
15850
|
WorkRunFolder = class {
|
|
15582
|
-
constructor(ctx,
|
|
15851
|
+
constructor(ctx, command57, args, outDir, shared = false) {
|
|
15583
15852
|
this.ctx = ctx;
|
|
15584
|
-
this.command =
|
|
15853
|
+
this.command = command57;
|
|
15585
15854
|
this.args = args;
|
|
15586
15855
|
this.outDir = outDir;
|
|
15587
15856
|
this.shared = shared;
|
|
@@ -15696,7 +15965,7 @@ var pull_exports2 = {};
|
|
|
15696
15965
|
__export(pull_exports2, {
|
|
15697
15966
|
default: () => pull_default2
|
|
15698
15967
|
});
|
|
15699
|
-
var MAX_FILES,
|
|
15968
|
+
var MAX_FILES, command51, pull_default2;
|
|
15700
15969
|
var init_pull2 = __esm({
|
|
15701
15970
|
"src/commands/work/pull.ts"() {
|
|
15702
15971
|
"use strict";
|
|
@@ -15705,7 +15974,7 @@ var init_pull2 = __esm({
|
|
|
15705
15974
|
init_common3();
|
|
15706
15975
|
init_folder2();
|
|
15707
15976
|
MAX_FILES = 100;
|
|
15708
|
-
|
|
15977
|
+
command51 = {
|
|
15709
15978
|
resource: "work",
|
|
15710
15979
|
action: "pull",
|
|
15711
15980
|
summary: "Claim waiting work into local work files, to answer by hand",
|
|
@@ -15783,7 +16052,7 @@ var init_pull2 = __esm({
|
|
|
15783
16052
|
return interrupted7 ? ExitCode.Interrupted : ExitCode.Ok;
|
|
15784
16053
|
}
|
|
15785
16054
|
};
|
|
15786
|
-
pull_default2 =
|
|
16055
|
+
pull_default2 = command51;
|
|
15787
16056
|
}
|
|
15788
16057
|
});
|
|
15789
16058
|
|
|
@@ -15925,7 +16194,7 @@ __export(submit_exports, {
|
|
|
15925
16194
|
default: () => submit_default
|
|
15926
16195
|
});
|
|
15927
16196
|
import { resolve as resolve14 } from "node:path";
|
|
15928
|
-
var
|
|
16197
|
+
var command52, submit_default;
|
|
15929
16198
|
var init_submit = __esm({
|
|
15930
16199
|
"src/commands/work/submit.ts"() {
|
|
15931
16200
|
"use strict";
|
|
@@ -15934,7 +16203,7 @@ var init_submit = __esm({
|
|
|
15934
16203
|
init_files();
|
|
15935
16204
|
init_answers();
|
|
15936
16205
|
init_common3();
|
|
15937
|
-
|
|
16206
|
+
command52 = {
|
|
15938
16207
|
resource: "work",
|
|
15939
16208
|
action: "submit",
|
|
15940
16209
|
summary: "Send answers files to Kenso and write each one's results",
|
|
@@ -15966,7 +16235,7 @@ var init_submit = __esm({
|
|
|
15966
16235
|
return totals.rejected > 0 ? ExitCode.Partial : ExitCode.Ok;
|
|
15967
16236
|
}
|
|
15968
16237
|
};
|
|
15969
|
-
submit_default =
|
|
16238
|
+
submit_default = command52;
|
|
15970
16239
|
}
|
|
15971
16240
|
});
|
|
15972
16241
|
|
|
@@ -15987,7 +16256,7 @@ function claimIdOf(arg) {
|
|
|
15987
16256
|
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..." });
|
|
15988
16257
|
return arg;
|
|
15989
16258
|
}
|
|
15990
|
-
var CLAIM_ID,
|
|
16259
|
+
var CLAIM_ID, command53, release_default;
|
|
15991
16260
|
var init_release = __esm({
|
|
15992
16261
|
"src/commands/work/release.ts"() {
|
|
15993
16262
|
"use strict";
|
|
@@ -15996,7 +16265,7 @@ var init_release = __esm({
|
|
|
15996
16265
|
init_files();
|
|
15997
16266
|
init_common3();
|
|
15998
16267
|
CLAIM_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
15999
|
-
|
|
16268
|
+
command53 = {
|
|
16000
16269
|
resource: "work",
|
|
16001
16270
|
action: "release",
|
|
16002
16271
|
summary: "Give claimed work back to the queue now",
|
|
@@ -16015,7 +16284,7 @@ var init_release = __esm({
|
|
|
16015
16284
|
return ExitCode.Ok;
|
|
16016
16285
|
}
|
|
16017
16286
|
};
|
|
16018
|
-
release_default =
|
|
16287
|
+
release_default = command53;
|
|
16019
16288
|
}
|
|
16020
16289
|
});
|
|
16021
16290
|
|
|
@@ -16354,12 +16623,12 @@ function plain(text4) {
|
|
|
16354
16623
|
return text4.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
|
|
16355
16624
|
}
|
|
16356
16625
|
function runStatus(bin, args, env, adapter, runAs) {
|
|
16357
|
-
const
|
|
16626
|
+
const command57 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
|
|
16358
16627
|
const commandArgs2 = runAs ? [...runAs.sudo.slice(1), ...sudoArgs(runAs.name, bin, args)] : args;
|
|
16359
16628
|
const options = runAs ? { env: { PATH: SUDO_PATH }, cwd: "/" } : { env: childEnv(env, adapter) };
|
|
16360
16629
|
return new Promise((resolve16) => {
|
|
16361
16630
|
execFile2(
|
|
16362
|
-
|
|
16631
|
+
command57,
|
|
16363
16632
|
commandArgs2,
|
|
16364
16633
|
{ ...options, timeout: STATUS_TIMEOUT_MS, maxBuffer: 1024 * 1024, windowsHide: true, shell: false },
|
|
16365
16634
|
(err, stdout, stderr) => {
|
|
@@ -17441,7 +17710,7 @@ var run_exports3 = {};
|
|
|
17441
17710
|
__export(run_exports3, {
|
|
17442
17711
|
default: () => run_default2
|
|
17443
17712
|
});
|
|
17444
|
-
var FAILURES_IN_A_ROW,
|
|
17713
|
+
var FAILURES_IN_A_ROW, command54, run_default2;
|
|
17445
17714
|
var init_run3 = __esm({
|
|
17446
17715
|
"src/commands/work/run.ts"() {
|
|
17447
17716
|
"use strict";
|
|
@@ -17462,7 +17731,7 @@ var init_run3 = __esm({
|
|
|
17462
17731
|
init_folder2();
|
|
17463
17732
|
init_stop();
|
|
17464
17733
|
FAILURES_IN_A_ROW = 3;
|
|
17465
|
-
|
|
17734
|
+
command54 = {
|
|
17466
17735
|
resource: "work",
|
|
17467
17736
|
action: "run",
|
|
17468
17737
|
summary: "Run your own coding agent on the waiting work until the queue is empty",
|
|
@@ -17787,16 +18056,16 @@ var init_run3 = __esm({
|
|
|
17787
18056
|
return exitCodeFor(reason, totals.rejected > 0 || jobsFailed > 0);
|
|
17788
18057
|
}
|
|
17789
18058
|
};
|
|
17790
|
-
run_default2 =
|
|
18059
|
+
run_default2 = command54;
|
|
17791
18060
|
}
|
|
17792
18061
|
});
|
|
17793
18062
|
|
|
17794
18063
|
// src/commands/work/index.ts
|
|
17795
|
-
var
|
|
18064
|
+
var actions27;
|
|
17796
18065
|
var init_work2 = __esm({
|
|
17797
18066
|
"src/commands/work/index.ts"() {
|
|
17798
18067
|
"use strict";
|
|
17799
|
-
|
|
18068
|
+
actions27 = {
|
|
17800
18069
|
status: () => Promise.resolve().then(() => (init_status3(), status_exports3)).then((m) => m.default),
|
|
17801
18070
|
pull: () => Promise.resolve().then(() => (init_pull2(), pull_exports2)).then((m) => m.default),
|
|
17802
18071
|
submit: () => Promise.resolve().then(() => (init_submit(), submit_exports)).then((m) => m.default),
|
|
@@ -17820,14 +18089,14 @@ function parseLimit(value) {
|
|
|
17820
18089
|
}
|
|
17821
18090
|
return limit;
|
|
17822
18091
|
}
|
|
17823
|
-
var MAX_LIMIT,
|
|
18092
|
+
var MAX_LIMIT, command55, list_default3;
|
|
17824
18093
|
var init_list3 = __esm({
|
|
17825
18094
|
"src/commands/workspace/list.ts"() {
|
|
17826
18095
|
"use strict";
|
|
17827
18096
|
init_errors();
|
|
17828
18097
|
init_exit_codes();
|
|
17829
18098
|
MAX_LIMIT = 200;
|
|
17830
|
-
|
|
18099
|
+
command55 = {
|
|
17831
18100
|
resource: "workspace",
|
|
17832
18101
|
action: "list",
|
|
17833
18102
|
summary: "List the workspaces your key can use",
|
|
@@ -17855,7 +18124,7 @@ var init_list3 = __esm({
|
|
|
17855
18124
|
return ExitCode.Ok;
|
|
17856
18125
|
}
|
|
17857
18126
|
};
|
|
17858
|
-
list_default3 =
|
|
18127
|
+
list_default3 = command55;
|
|
17859
18128
|
}
|
|
17860
18129
|
});
|
|
17861
18130
|
|
|
@@ -17864,7 +18133,7 @@ var use_exports = {};
|
|
|
17864
18133
|
__export(use_exports, {
|
|
17865
18134
|
default: () => use_default
|
|
17866
18135
|
});
|
|
17867
|
-
var
|
|
18136
|
+
var command56, use_default;
|
|
17868
18137
|
var init_use = __esm({
|
|
17869
18138
|
"src/commands/workspace/use.ts"() {
|
|
17870
18139
|
"use strict";
|
|
@@ -17872,7 +18141,7 @@ var init_use = __esm({
|
|
|
17872
18141
|
init_errors();
|
|
17873
18142
|
init_exit_codes();
|
|
17874
18143
|
init_http();
|
|
17875
|
-
|
|
18144
|
+
command56 = {
|
|
17876
18145
|
resource: "workspace",
|
|
17877
18146
|
action: "use",
|
|
17878
18147
|
summary: "Set the profile's default workspace",
|
|
@@ -17929,16 +18198,16 @@ var init_use = __esm({
|
|
|
17929
18198
|
return ExitCode.Ok;
|
|
17930
18199
|
}
|
|
17931
18200
|
};
|
|
17932
|
-
use_default =
|
|
18201
|
+
use_default = command56;
|
|
17933
18202
|
}
|
|
17934
18203
|
});
|
|
17935
18204
|
|
|
17936
18205
|
// src/commands/workspace/index.ts
|
|
17937
|
-
var
|
|
18206
|
+
var actions28;
|
|
17938
18207
|
var init_workspace = __esm({
|
|
17939
18208
|
"src/commands/workspace/index.ts"() {
|
|
17940
18209
|
"use strict";
|
|
17941
|
-
|
|
18210
|
+
actions28 = {
|
|
17942
18211
|
list: () => Promise.resolve().then(() => (init_list3(), list_exports3)).then((m) => m.default),
|
|
17943
18212
|
use: () => Promise.resolve().then(() => (init_use(), use_exports)).then((m) => m.default)
|
|
17944
18213
|
};
|
|
@@ -17982,6 +18251,7 @@ var init_registry = __esm({
|
|
|
17982
18251
|
init_sandbox2();
|
|
17983
18252
|
init_skill();
|
|
17984
18253
|
init_studio2();
|
|
18254
|
+
init_tasks();
|
|
17985
18255
|
init_webhooks2();
|
|
17986
18256
|
init_work2();
|
|
17987
18257
|
init_workspace();
|
|
@@ -18012,10 +18282,11 @@ var init_registry = __esm({
|
|
|
18012
18282
|
sandbox: actions22,
|
|
18013
18283
|
skill: actions23,
|
|
18014
18284
|
studio: actions24,
|
|
18015
|
-
|
|
18285
|
+
tasks: actions25,
|
|
18286
|
+
webhooks: actions26,
|
|
18016
18287
|
whoami: topLevel("whoami", actions4.status, "kenso auth status"),
|
|
18017
|
-
work:
|
|
18018
|
-
workspace:
|
|
18288
|
+
work: actions27,
|
|
18289
|
+
workspace: actions28
|
|
18019
18290
|
};
|
|
18020
18291
|
resourceAliases = { leads: "contacts" };
|
|
18021
18292
|
}
|
|
@@ -18152,8 +18423,8 @@ async function renderTopHelp(opts) {
|
|
|
18152
18423
|
names.push(withPositionals(spec, spec.action));
|
|
18153
18424
|
groups.set(hint, names);
|
|
18154
18425
|
}
|
|
18155
|
-
const
|
|
18156
|
-
if (
|
|
18426
|
+
const actions30 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
|
|
18427
|
+
if (actions30.length > 0) rows.push([resource, actions30.join(", ")]);
|
|
18157
18428
|
}
|
|
18158
18429
|
const at = 4 + Math.min(22, Math.max(0, ...rows.map(([left]) => left.length)));
|
|
18159
18430
|
lines.push(
|
|
@@ -18166,7 +18437,7 @@ async function renderTopHelp(opts) {
|
|
|
18166
18437
|
const [area = "", action = ""] = name.split(" ");
|
|
18167
18438
|
byArea.set(area, [...byArea.get(area) ?? [], action]);
|
|
18168
18439
|
}
|
|
18169
|
-
const named = [...byArea.entries()].map(([area,
|
|
18440
|
+
const named = [...byArea.entries()].map(([area, actions30]) => `${area} ${actions30.join("|")}`);
|
|
18170
18441
|
lines.push(wrap(`Beta, hidden here but they run (the server decides): ${named.join(", ")}.`, " "));
|
|
18171
18442
|
}
|
|
18172
18443
|
const generated = await listGenerated({ features: opts.allCommands ? [] : getFeatures, env: opts.env });
|
|
@@ -18174,13 +18445,13 @@ async function renderTopHelp(opts) {
|
|
|
18174
18445
|
if (visible.length > 0) {
|
|
18175
18446
|
const byResource = /* @__PURE__ */ new Map();
|
|
18176
18447
|
for (const g of visible) {
|
|
18177
|
-
const
|
|
18178
|
-
|
|
18179
|
-
byResource.set(g.resource,
|
|
18448
|
+
const actions30 = byResource.get(g.resource) ?? [];
|
|
18449
|
+
actions30.push(`${g.action}${g.beta ? " (beta)" : ""}`);
|
|
18450
|
+
byResource.set(g.resource, actions30);
|
|
18180
18451
|
}
|
|
18181
18452
|
const sorted2 = [...byResource.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
18182
18453
|
if (opts.allCommands) {
|
|
18183
|
-
const generatedRows = sorted2.map(([resource,
|
|
18454
|
+
const generatedRows = sorted2.map(([resource, actions30]) => [resource, actions30.sort().join(", ")]);
|
|
18184
18455
|
lines.push("", "API resources (kenso <resource> <action>):", columns(generatedRows));
|
|
18185
18456
|
} else {
|
|
18186
18457
|
const names = new Set(sorted2.map(([resource]) => resource));
|
|
@@ -18496,8 +18767,8 @@ function startUpdateNotice(argv, opts = {}) {
|
|
|
18496
18767
|
if (!found) return;
|
|
18497
18768
|
writeCheck(file, { checkedAt: new Date(now).toISOString(), latest: found });
|
|
18498
18769
|
if (isNewer(found, version)) {
|
|
18499
|
-
const
|
|
18500
|
-
stderr.write(`kenso ${found} is out (you have ${version}): ${
|
|
18770
|
+
const command57 = updateCommand(install, opts.platform ?? process.platform);
|
|
18771
|
+
stderr.write(`kenso ${found} is out (you have ${version}): ${command57}
|
|
18501
18772
|
Turn this off with KENSO_NO_UPDATE_NOTIFIER=1.
|
|
18502
18773
|
`);
|
|
18503
18774
|
}
|
|
@@ -18539,7 +18810,7 @@ function resources() {
|
|
|
18539
18810
|
const names = Object.entries(handWritten).filter(([, area]) => Object.keys(area).length > 0).map(([resource]) => resource);
|
|
18540
18811
|
return sorted([...names, ...Object.keys(resourceAliases), ...loadManifest().operations.map((op) => op.resource)]);
|
|
18541
18812
|
}
|
|
18542
|
-
function
|
|
18813
|
+
function actions29(resource) {
|
|
18543
18814
|
const own = Object.keys(handWritten[resource] ?? {}).filter((action) => action !== "");
|
|
18544
18815
|
return sorted([...own, ...loadManifest().operations.filter((op) => op.resource === resource).map((op) => op.action)]);
|
|
18545
18816
|
}
|
|
@@ -18604,7 +18875,7 @@ async function completions(words, globals) {
|
|
|
18604
18875
|
return flagsOf2(spec, globals, positionals.length === 0);
|
|
18605
18876
|
}
|
|
18606
18877
|
if (positionals.length === 0) return resources();
|
|
18607
|
-
if (!spec) return positionals.length === 1 ?
|
|
18878
|
+
if (!spec) return positionals.length === 1 ? actions29(resourceAliases[positionals[0]] ?? positionals[0]) : [];
|
|
18608
18879
|
const given = positionals.length - commandWords;
|
|
18609
18880
|
const declared = spec.positionals ?? [];
|
|
18610
18881
|
if (given < declared.length || declared.at(-1)?.variadic === true) {
|
|
@@ -18698,9 +18969,9 @@ function normalizeBooleans(argv, names, strict) {
|
|
|
18698
18969
|
async function knownCommands() {
|
|
18699
18970
|
const commands = /* @__PURE__ */ new Set();
|
|
18700
18971
|
for (const [resource, area] of Object.entries(handWritten)) {
|
|
18701
|
-
const
|
|
18702
|
-
if (
|
|
18703
|
-
for (const action of
|
|
18972
|
+
const actions30 = Object.keys(area);
|
|
18973
|
+
if (actions30.length > 0) commands.add(resource);
|
|
18974
|
+
for (const action of actions30) commands.add(action ? `${resource} ${action}` : resource);
|
|
18704
18975
|
}
|
|
18705
18976
|
for (const g of await listGenerated({ features: [] })) {
|
|
18706
18977
|
commands.add(g.resource);
|