kenso 0.1.161 → 0.1.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kenso.js +29 -16
- package/dist/operations.index.json +1 -1
- package/dist/operations.json +1 -1
- package/docs/output-and-errors.md +1 -1
- package/docs/reference.md +1 -1
- package/docs/studio.md +2 -2
- package/package.json +2 -2
package/dist/kenso.js
CHANGED
|
@@ -3422,7 +3422,7 @@ var VERSION;
|
|
|
3422
3422
|
var init_version = __esm({
|
|
3423
3423
|
"src/core/version.ts"() {
|
|
3424
3424
|
"use strict";
|
|
3425
|
-
VERSION = true ? "0.1.
|
|
3425
|
+
VERSION = true ? "0.1.163" : "0.0.0-dev";
|
|
3426
3426
|
}
|
|
3427
3427
|
});
|
|
3428
3428
|
|
|
@@ -9903,7 +9903,7 @@ var init_leads = __esm({
|
|
|
9903
9903
|
var output_and_errors_default;
|
|
9904
9904
|
var init_output_and_errors = __esm({
|
|
9905
9905
|
"docs/output-and-errors.md"() {
|
|
9906
|
-
output_and_errors_default = '# Output and errors\n\nEvery command follows one contract, so a script or an agent can parse any of them the same way.\n\n## stdout and stderr\n\n- **stdout carries data only.** Progress, warnings, notices and errors go to stderr.\n- No colors, spinners or pagers. On a terminal you get readable tables; in a pipe you get JSON.\n- A batch command (an import, update, remove, tag or `--each` write) takes `--yes`; without it, the command plans or refuses.\n- A command that deletes, archives, removes or merges, such as `kenso tags delete --tag-id 7`, `kenso campaigns archive`, `kenso people merge` or `kenso api DELETE /v1/tags/7`, needs `--yes` too. Without it, a person at a terminal is asked to confirm; anywhere else (a pipe, a script, CI, a coding agent) it sends nothing and fails with `confirmation_required`, whose `next` is the same command with `--yes`.\n- Any other single write, such as `kenso tags create`, `kenso notes add` or a write through `kenso api` or `kenso mcp call`, sends at once: add `--dry-run` to print the request first (it sends nothing), then run the command without it. A command that reads before it writes (`kenso layouts set --header` reads the layout it edits) still reads with `--dry-run`, and prints the write it would send. A POST that changes nothing, such as `kenso accounts search` or `kenso reports query`, is a read like a GET.\n- A command with no dry run, such as `kenso contacts export`, `kenso auth logout` or `kenso workspace use`, refuses `--dry-run` with `usage_error` (exit 2) and does nothing. Its help ends with `No --dry-run`, or with `Read-only.` when the command only reads, and `kenso describe <resource> <action>` shows `"dryRun": false`. Every command that only reads, generated ones included, says `Read-only.` there.\n- A dry run of a command that can charge credits adds `credits`: `{"needed": n, "available": n, "sufficient": true}`, in credits. A batch command prices the whole file; a single API command adds `cost`, its price lines from your rate card. No output shows a currency amount.\n\n## Formats\n\n| What the command returns | stdout is a terminal | stdout is a pipe or file |\n|---|---|---|\n| One object | key-value lines | compact JSON on one line |\n| A list | a table (first 8 scalar fields, cells cut at 60 characters) | NDJSON: one JSON object per line |\n| A batch run | key-value lines | one JSON summary object |\n| No content (HTTP 204, such as a delete) | key-value lines: `ok`, `status`, `request` | `{"ok":true,"status":204,"request":{"method":"DELETE","path":"/v1/tasks/7"}}` |\n\n`-o` or `--output` picks the format: `json`, `ndjson`, `table`, `ids` or `csv`. `--json` is the same as `-o json`.\n\n- `-o json` on a list prints one JSON array. On a terminal, `-o json` pretty-prints an object.\n- `-o ids` prints one id per line, ready for `--ids -`. Items without an `id` are skipped with one warning.\n- `-o csv` prints a header row, then one row per item (RFC 4180, `\\n` line ends). The columns are the `--fields` names in the order you give them; without `--fields`, the top-level keys of the first 100 rows, in the order they first appear. A nested field is `a.b`, an object or array in a cell is its compact JSON, and `null` or a missing key is an empty cell. With `--all` the header is fixed from the first 100 rows, and a later row\'s other keys are dropped with one line on stderr naming them. A single object prints as a two-line CSV. Values are written as they are: nothing is cut, and line breaks stay inside the quotes.\n\n```bash\nkenso campaigns list --limit 3\nkenso campaigns list --limit 3 -o json\nkenso campaigns list --limit 3 -o csv --fields id,name,status\nkenso contacts list --campaign-id 812 --all -o ids\n```\n\n## Shape the output\n\n- `--fields a,b.c` keeps only those fields (dots reach into nested objects).\n- `--query <JMESPath>` filters or reshapes in-process, so you need no `jq`. On a list it sees the whole list. There is no `--jq`: `--query` takes JMESPath, not jq syntax.\n- Neither applies to a batch summary, which always prints in full.\n- `threads list`, `contacts list` and `contacts search` print a short set of fields per row, in every format: a thread\'s id, channel, sender, subject, interest, read state, newest message time and preview, a contact\'s id, name, email, title, company and email validity, and a few more (the command\'s `--help` names them all). `--full` prints every field (`--full -o json` for a script that reads them all), `--fields` picks your own, and `--query` sees every field.\n- A thread list\'s `preview` is a one-line preview by default: the first 280 characters of the newest message\'s text (the API\'s `bodyFormat=snippet`), in every format. `--full`, or `--fields` that names `preview` or `htmlBody`, prints the whole message text, and `kenso threads list-messages --thread-id <id>` reads every message of a thread whole.\n- A contact list asks the API for only the fields it prints (the API\'s `fields`), so a page downloads what it shows. A thread list printed with `-o ids`, or with `--fields` that names neither `preview` nor `htmlBody`, asks for no message bodies (`bodyFormat=none`). `--full` and `--query` ask for every field, and `--param-fields` or `--body-format` sent by hand wins.\n\n```bash\nkenso campaigns list --fields id,name,status\nkenso campaigns list --all --query "[?status==\'active\'].id"\nkenso me get --query "length(features)"\nkenso threads list --folder inbox --fields id,subject,preview\nkenso threads list --folder inbox --full\n```\n\n## Lists and pages\n\nA list command prints one page. When there are more, it prints the command for the next page on stderr, for example `next: kenso tags list --limit 1 --cursor MQ`. `--all` follows every page and streams the items. `--limit` sets the page size and `--cursor` starts at a cursor.\n\n`accounts search`, `contacts search` and `people search` page the same way: one page with the `next:` command, or every page with `--all`. A search that asks for counts (`countBy` in `--data`) prints the whole answer instead: `data`, `pagination` and `counts`. Counts cover every match whatever the page, so ask for them on one page (`--limit 1`): `--all` with `countBy` is a usage error.\n\n```bash\nkenso tags list --limit 50\nkenso tags list --all\n```\n\n## Files: uploads and downloads\n\nA command whose API action takes a multipart upload takes `--file <path>`: the CLI reads the file and sends it in the form, with a content type from its extension (a `.png` goes as `image/png`), and the other flags as form fields. `--file <field>=<path>` names the form field, for a form with more than one file. An upload that also takes JSON, such as a logo from a URL instead of a file, sends JSON when you leave `--file` out.\n\nA command whose API action answers with a file (a CSV, an image, a ZIP) takes `--out <path>`: it saves the answer byte for byte (mode 0600) and prints `out`, `bytes` and `contentType`, so the file never passes through an agent\'s context. Without `--out`, a CSV prints as it came, and a binary file goes to stdout only when stdout is a pipe or a file: on a terminal it fails with `binary_output`, whose `next` adds `--out`.\n\n`kenso api` takes both, for any route: `--file` (repeat it for more files) sends multipart with the keys of a `--data` object as form fields, and `--out` saves any answer.\n\n```bash\nkenso saved-lists create-upload --saved-list-id 12 --file people.csv\nkenso workspaces replace-logo --workspace-id 42 --file ./logo.png\nkenso workspaces replace-logo --workspace-id 42 --source-url https://example.com/logo.png\nkenso attachments get-content --attachment-id att_123 --out ./invoice.pdf\nkenso api POST /v1/campaigns/812/email-sequence/images --file ./hero.png\nkenso api GET /v1/knowledge/exports/77/content --out knowledge.zip\n```\n\n## Live streams\n\n`kenso sync events` and `kenso onboarding-builds events` follow a live stream of server-sent events. They print one JSON line per event as it arrives, on a terminal too, with the event\'s name, its id when it has one, and its data:\n\n```json\n{"event":"hello","data":{"buildId":"obd_2x","status":"building","stage":"read","lastEventId":0}}\n{"event":"stage","id":"41","data":{"stage":"plan"}}\n{"event":"done","id":"42","data":{}}\n```\n\nA stream has no time limit while events arrive. The server ends each connection after 15 minutes with a `bye` event; the command then connects again at once, and after a dropped connection or 60 s without even a keepalive, after a second. A connection that brought nothing but `hello` and `bye` (a server that is restarting) backs off 1, 2, 4 ... 30 s. Once events carry an id (`onboarding-builds events`), it sends the last whole event\'s id as `Last-Event-ID`, so no event is lost or printed twice. A refusal (401, 403, 404) ends it at once; eight failed or empty connects in a row end it with the last error.\n\nIt runs until Ctrl-C (exit 130; every line printed is whole), or until one of these:\n\n| Flag | Ends the command |\n|---|---|\n| `--until <event>` | After the first event with that name; several names are comma-separated: `--until done,error` |\n| `--max-events <n>` | After n events, `hello` and `bye` included |\n| `--once` | When the server closes the connection, instead of connecting again |\n\n```bash\nkenso onboarding-builds events --build-id obd_2x --until done,error\nkenso sync events --max-events 2 # hello, then the first poke\n```\n\n`--output`, `--fields` and `--query` do not apply to a stream. `--last-event-id` starts an onboarding build stream after that id.\n\n## Errors\n\nWhen stderr is not a terminal, an error is one JSON line on stderr:\n\n```json\n{"error":{"code":"unknown_flag","message":"Unknown flag --fiel for kenso contacts import.","field":"fiel","hint":"did you mean --file?","next":"kenso contacts import --help"}}\n```\n\n| Key | Always there | Meaning |\n|---|---|---|\n| `code` | yes | A stable snake_case code to branch on |\n| `message` | yes | One sentence for a person |\n| `field` | no | The flag or input field at fault |\n| `hint` | no | What to change |\n| `next` | no | The exact command to run next, such as `kenso auth login`, `kenso workspace list --search <name>` or the same command with `--yes` |\n| `httpStatus` | no | The API\'s HTTP status, when the API answered |\n| `requestId` | no | The API\'s request id: quote it when you contact Kenso support |\n\nOn a terminal the same error prints as text: `Error: <message>`, then `field:`, `hint:`, `next:` and `requestId:` lines. The key never appears in an error.\n\n### How API errors map\n\nThe CLI looks at the HTTP status first, then at the API\'s own `error.code`, which wins when present.\n\n| HTTP status | Default code | Exit |\n|---|---|---|\n| 400, 422 | `validation_failed` | 2 |\n| 401 | `unauthorized` (`next`: `kenso auth login`) | 3 |\n| 403 | `forbidden`: the key\'s user or role cannot do this in this workspace | 3 |\n| 404 | `not_found` | 4 |\n| 409 | `conflict` | 7 |\n| 429 | `rate_limited`, after the CLI waited and retried | 6 |\n| 5xx | `server_error`, after retries where they are safe | 8 |\n| anything else | `http_error` | 1 |\n\nTwo API codes change the exit code: `workspace_required` exits 2 with `"next":"kenso workspace list --search <name>"`, and `limit_reached` (the plan\'s or the campaign\'s lead limit) exits 6.\n\n### Errors from the CLI itself\n\n| Code | Exit | When |\n|---|---|---|\n| `usage_error` | 2 | A required flag or argument is missing, two flags conflict (`--yes` with `--dry-run`), or `--dry-run` on a command that has no dry run |\n| `read_only` | 2 | `--read-only` or `KENSO_READ_ONLY` is on and the command is not a read: nothing was sent. `next` (with `--read-only` only, on a command with a dry run) is the same command with `--dry-run`, which prints the plan and changes nothing |\n| `unknown_command` | 2 | No such command; `hint` suggests the closest one |\n| `unknown_flag`, `invalid_flag`, `invalid_flag_value`, `unexpected_argument` | 2 | A flag or argument the command does not take |\n| `invalid_query` | 2 | `--query` is not valid JMESPath |\n| `confirmation_required` | 2 | A delete, archive or remove ran without `--yes` where nobody can confirm: nothing was sent; `next` adds `--yes` |\n| `cancelled` | 2 | A person answered no to the confirmation: nothing was sent |\n| `file_unreadable` | 2 | An input file is missing, is a folder, cannot be opened, or cannot be parsed; the message names the line, such as `leads.csv line 3: a quote is not closed.` |\n| `config_invalid` | 2 | `~/.kenso/config.json` is not valid JSON: fix or delete it |\n| `folder_file_untrusted` | 2 | A workflow command would read or write a `kenso.json` that another user owns or anyone can write: kenso skips such a file and names it on stderr, and nothing was written or sent. Make it yours and writable only by you, or work in a folder only you can write |\n| `feature_not_enabled` | 2 | Every action of the resource is a beta command your workspace has not enabled |\n| `invalid_key_format`, `key_required` | 2 | `auth login --with-key` read something that is not a Kenso key, or stdin is a terminal instead of a pipe |\n| `invalid_workspace_id` | 2 | `kenso workspace use` got an id that is not a positive whole number |\n| `unknown_topic` | 2 | `kenso docs` got a topic it does not have; `hint` lists the topics |\n| `file_unwritable` | 2 or 1 | An output file cannot be written: `--out` on `contacts export`, `kenso api` or a download command (2), `skill install` (1) |\n| `binary_output` | 2 | The answer is a binary file and stdout is a terminal: nothing was printed; `next` saves it with `--out` |\n| `no_api_key` | 3 | No key in `KENSO_API_KEY` or the profile (`next`: `kenso auth login`) |\n| `browser_login_unavailable`, `access_denied`, `login_expired` | 3 | Browser login is off, was denied, or timed out |\n| `run_not_found` | 4 | `kenso runs show` or `resume` got an unknown run id |\n| `docs_not_found` | 4 | `kenso docs reference` before the reference was generated (a source checkout without `pnpm build`) |\n| `run_in_progress`, `already_filled` | 7 | Another process is working on the run (for `kenso workflows run`, a run on the same input), or `studio fill` already ran with this file and these flags |\n| `already_started` | 7 | `kenso workflows run`: an earlier run on the same input already sent starts, and this one would start records differently (another `--max-credits`), so it would start them twice. Nothing was sent: `not-started.txt` in that run\'s folder holds the ids it did not start, and `next` runs only those |\n| `local_changes` | 7 | `studio pull` would replace files that no earlier pull wrote or push sent, or that changed since; nothing was written, and `next` adds `--force` to replace them |\n| `job_timeout`, `job_failed`, `job_canceled` | 1 | `kenso jobs wait` (or a command that waits on a job) ran out of time, or the job failed or was canceled |\n| `mcp_tool_error` | 1 | `kenso mcp call`: the MCP tool answered with an error |\n| `unsafe_path` | 1 | `studio pull` refused a file path that is not a file of the Studio bundle layout (such as a dotfile, `opencode.json` or `CLAUDE.md`), would land outside `--dir`, or passes through a symbolic link, or a `samples/*.json` that does not hold a sample |\n| `network_error` | 8 | The API could not be reached after retries |\n| `upload_failed`, `download_failed` | 8 or 1 | A signed upload or download of a Studio file failed: 8 when storage was unreachable or answered 5xx, 1 on a 4xx (often an expired link: run the command again) |\n| `pull_incomplete` | 8 | `studio pull`: a file came back with neither text nor a download link |\n| `unexpected_response` | 1 or 8 | The API answered something the CLI could not read |\n| `unexpected_error` | 1 | A bug: run again with `--verbose` and report it |\n| `interrupted` | 130 | Ctrl-C |\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | OK, including a batch where every row succeeded or was skipped |\n| 1 | Unexpected error |\n| 2 | Usage or input error: a bad flag, a bad file, a validation error |\n| 3 | Auth: no key, an invalid, revoked or expired key, or HTTP 401 or 403 |\n| 4 | Not found |\n| 5 | Partial: the batch finished and some rows failed, were not found or were invalid. See `results.csv` |\n| 6 | Rate limited after retries, or a plan or campaign lead limit stopped the run (`limit_reached`) |\n| 7 | Conflict or invalid state (HTTP 409), a run another process holds (`run_in_progress`), or a workflow run that would start records twice (`already_started`) |\n| 8 | Server error after retries (5xx), or the API is unreachable |\n| 9 | Answer refused: a Kenso sandbox run stopped because an answer held a credential or something shaped like one |\n| 130 | Interrupted. A batch run can be resumed: see its `next` |\n\nSkipped rows (duplicates, blocklisted, already contacted) are not failures: a batch with only created, updated and skipped rows exits 0.\n\n## Flags\n\n- Command flags go after the command: `kenso contacts import --campaign 812`. Global flags can go anywhere.\n- A boolean flag takes `--flag`, `--no-flag`, `--flag=true` and `--flag=false`.\n- A flag that carries a secret (`--password`, `--api-key`, `--api-secret`, any `--\u2026-token` or `--\u2026-secret`) also takes `-` (read stdin), `@file` (read the file) or `env:NAME` (read that environment variable), so the value stays out of shell history: `printf \'%s\' "$FATHOM_KEY" | kenso fathom-connection connect --api-key -`. A value typed on the command line still works and prints one warning. A typed secret that itself starts with `@` is written `@@` (`--password @@Spring2026` sends `@Spring2026`); one that is exactly `-` or starts with `env:` has to come through `@file` or `env:NAME`. `-` refuses a terminal, an empty value is refused, and only one flag can read stdin. `--dry-run` shows a secret as `***`. With `--each`, the plan, its `next` and the run record keep `@file` or `env:NAME` as typed and `kenso runs resume` reads it again; a secret from stdin is refused there.\n- `--help` on any command prints its flags, arguments and examples. `kenso describe <resource> <action>` prints the same as JSON, with the body schema.\n\n## Effect, cost and read-only mode\n\nEvery command has an effect: `read` (changes nothing, charges nothing), `write` (changes workspace data, charges nothing the API contract declares, nothing leaves Kenso), `spend` (can charge credits), `send` (sends an email, a LinkedIn message, a call or an invitation, or starts or resumes sending) or `destructive` (deletes, archives, removes or merges). Command help prints `Effect: <effect>.` under the summary, and a command that charges adds a `Cost:` line in credits from your workspace\'s rate card.\n\n`kenso describe <resource> <action>` adds `effect` and `cost` to its JSON. `cost` is `null` for a command that does not charge, else `{"lines": [...], "rateCard": {"source": ..., "versions": [...]}}`: each line is the command\'s credit line with its `price` text, and `source` is `live`, `cache` or `bundled`. A command that charges something no rate-card row prices has `{"lines": [], "rateCard": null}`, with `text` saying what it charges when the command states it. `kenso describe` and `kenso describe <resource>` add `effect` to each row.\n\nA generated command that charges prints the same `cost` in its `--dry-run` plan, for the request it would send. A flag that turns off every charge says so: `kenso accounts create --skip-research --dry-run` prints `"cost": {"lines": [], "text": "not charged in credits (--skip-research: no research or committee run)", "rateCard": null}` and `"credits": {"needed": 0, "available": null, "sufficient": null}`, and reads nothing.\n\n`--read-only`, or `KENSO_READ_ONLY=1` in the environment, refuses every command whose effect is not `read` before it sends a request, with exit 2:\n\n```json\n{"error":{"code":"read_only","message":"kenso campaigns launch is a send command, and this session is read-only.","hint":"Read-only is on through --read-only: next prints the plan. Run the command again without --read-only to make the change.","next":"kenso --read-only campaigns launch --campaign-id 1 --dry-run"}}\n```\n\n`next` never makes the change: on a command with a dry run it is the same command with `--dry-run` and without `--yes`, which prints the plan. A command with no dry run gets no `next`, and its hint says to run it again without `--read-only`. A command with its own `--body-read-only` option (`kenso api-keys create`) gets no `next` either, and its hint names that option. When the variable turned read-only on, the hint reads `KENSO_READ_ONLY is set: unset it to run this command.` and there is no `next`, so an agent that runs `next` cannot loop. A POST that only reads, such as `kenso contacts search`, still runs; a GET that charges, such as `kenso search get-place`, is refused; a command with a dry run still prints its plan with `--dry-run`; `kenso api` has the effect of the route it calls, and on a route this CLI does not know only a `GET` runs.\n\n```bash\nKENSO_READ_ONLY=1 kenso contacts search --limit 1\nkenso --read-only describe email-finds create\n```\n\n## Beta commands\n\nCommands that need a workspace feature flag (CRM, Studio and others) are beta. Help and `kenso describe` hide the ones your workspace has not enabled and say how many they hid; `--all-commands` shows them. Calling a hidden command still works: Kenso decides. `kenso <resource>` on a resource whose every action is hidden answers `feature_not_enabled` (exit 2) and names the flags it needs.\n\n```bash\nkenso --help --all-commands\nkenso describe --all-commands\n```\n\n## What the CLI sends\n\nEvery API call carries `Authorization: Bearer <key>`, `Ken-Version: 1.1`, `X-Ken-Workspace-Id` (when a workspace is picked), `User-Agent: kenso-cli/<version> (node <version>; <platform>)` and `X-Ken-Client: Kenso CLI`. When a coding agent runs the CLI, `X-Ken-Client` names it (`Kenso CLI via Claude Code`) and writes carry `X-Ken-Actor: agent`, so Kenso\'s activity log shows who made a change.\n';
|
|
9906
|
+
output_and_errors_default = '# Output and errors\n\nEvery command follows one contract, so a script or an agent can parse any of them the same way.\n\n## stdout and stderr\n\n- **stdout carries data only.** Progress, warnings, notices and errors go to stderr.\n- No colors, spinners or pagers. On a terminal you get readable tables; in a pipe you get JSON.\n- A batch command (an import, update, remove, tag or `--each` write) takes `--yes`; without it, the command plans or refuses.\n- A command that deletes, archives, removes or merges, such as `kenso tags delete --tag-id 7`, `kenso campaigns archive`, `kenso people merge` or `kenso api DELETE /v1/tags/7`, needs `--yes` too. Without it, a person at a terminal is asked to confirm; anywhere else (a pipe, a script, CI, a coding agent) it sends nothing and fails with `confirmation_required`, whose `next` is the same command with `--yes`.\n- Any other single write, such as `kenso tags create`, `kenso notes add` or a write through `kenso api` or `kenso mcp call`, sends at once: add `--dry-run` to print the request first (it sends nothing), then run the command without it. A command that reads before it writes (`kenso layouts set --header` reads the layout it edits) still reads with `--dry-run`, and prints the write it would send. A POST that changes nothing, such as `kenso accounts search` or `kenso reports query`, is a read like a GET.\n- A command with no dry run, such as `kenso contacts export`, `kenso auth logout` or `kenso workspace use`, refuses `--dry-run` with `usage_error` (exit 2) and does nothing. Its help ends with `No --dry-run`, or with `Read-only.` when the command only reads, and `kenso describe <resource> <action>` shows `"dryRun": false`. Every command that only reads, generated ones included, says `Read-only.` there.\n- A dry run of a command that can charge credits adds `credits`: `{"needed": n, "available": n, "sufficient": true}`, in credits. A batch command prices the whole file; a single API command adds `cost`, its price lines from your rate card. No output shows a currency amount.\n\n## Formats\n\n| What the command returns | stdout is a terminal | stdout is a pipe or file |\n|---|---|---|\n| One object | key-value lines | compact JSON on one line |\n| A list | a table (first 8 scalar fields, cells cut at 60 characters) | NDJSON: one JSON object per line |\n| A batch run | key-value lines | one JSON summary object |\n| No content (HTTP 204, such as a delete) | key-value lines: `ok`, `status`, `request` | `{"ok":true,"status":204,"request":{"method":"DELETE","path":"/v1/tasks/7"}}` |\n\n`-o` or `--output` picks the format: `json`, `ndjson`, `table`, `ids` or `csv`. `--json` is the same as `-o json`.\n\n- `-o json` on a list prints one JSON array. On a terminal, `-o json` pretty-prints an object.\n- `-o ids` prints one id per line, ready for `--ids -`. Items without an `id` are skipped with one warning.\n- `-o csv` prints a header row, then one row per item (RFC 4180, `\\n` line ends). The columns are the `--fields` names in the order you give them; without `--fields`, the top-level keys of the first 100 rows, in the order they first appear. A nested field is `a.b`, an object or array in a cell is its compact JSON, and `null` or a missing key is an empty cell. With `--all` the header is fixed from the first 100 rows, and a later row\'s other keys are dropped with one line on stderr naming them. A single object prints as a two-line CSV. Values are written as they are: nothing is cut, and line breaks stay inside the quotes.\n\n```bash\nkenso campaigns list --limit 3\nkenso campaigns list --limit 3 -o json\nkenso campaigns list --limit 3 -o csv --fields id,name,status\nkenso contacts list --campaign-id 812 --all -o ids\n```\n\n## Shape the output\n\n- `--fields a,b.c` keeps only those fields (dots reach into nested objects).\n- `--query <JMESPath>` filters or reshapes in-process, so you need no `jq`. On a list it sees the whole list. There is no `--jq`: `--query` takes JMESPath, not jq syntax.\n- Neither applies to a batch summary, which always prints in full.\n- `threads list`, `contacts list` and `contacts search` print a short set of fields per row, in every format: a thread\'s id, channel, sender, subject, interest, read state, newest message time and preview, a contact\'s id, name, email, title, company and email validity, and a few more (the command\'s `--help` names them all). `--full` prints every field (`--full -o json` for a script that reads them all), `--fields` picks your own, and `--query` sees every field.\n- A thread list\'s `preview` is a one-line preview by default: the first 280 characters of the newest message\'s text (the API\'s `bodyFormat=snippet`), in every format. `--full`, or `--fields` that names `preview` or `htmlBody`, prints the whole message text, and `kenso threads list-messages --thread-id <id>` reads every message of a thread whole.\n- A contact list asks the API for only the fields it prints (the API\'s `fields`), so a page downloads what it shows. A thread list printed with `-o ids`, or with `--fields` that names neither `preview` nor `htmlBody`, asks for no message bodies (`bodyFormat=none`). `--full` and `--query` ask for every field, and `--param-fields` or `--body-format` sent by hand wins.\n\n```bash\nkenso campaigns list --fields id,name,status\nkenso campaigns list --all --query "[?status==\'active\'].id"\nkenso me get --query "length(features)"\nkenso threads list --folder inbox --fields id,subject,preview\nkenso threads list --folder inbox --full\n```\n\n## Lists and pages\n\nA list command prints one page. When there are more, it prints the command for the next page on stderr, for example `next: kenso tags list --limit 1 --cursor MQ`. `--all` follows every page and streams the items. `--limit` sets the page size and `--cursor` starts at a cursor.\n\n`accounts search`, `contacts search` and `people search` page the same way: one page with the `next:` command, or every page with `--all`. A search that asks for counts (`countBy` in `--data`) prints the whole answer instead: `data`, `pagination` and `counts`. Counts cover every match whatever the page, so ask for them on one page (`--limit 1`): `--all` with `countBy` is a usage error.\n\n```bash\nkenso tags list --limit 50\nkenso tags list --all\n```\n\n## Files: uploads and downloads\n\nA command whose API action takes a multipart upload takes `--file <path>`: the CLI reads the file and sends it in the form, with a content type from its extension (a `.png` goes as `image/png`), and the other flags as form fields. `--file <field>=<path>` names the form field, for a form with more than one file. An upload that also takes JSON, such as a logo from a URL instead of a file, sends JSON when you leave `--file` out.\n\nA command whose API action answers with a file (a CSV, an image, a ZIP) takes `--out <path>`: it saves the answer byte for byte (mode 0600) and prints `out`, `bytes` and `contentType`, so the file never passes through an agent\'s context. Without `--out`, a CSV prints as it came, and a binary file goes to stdout only when stdout is a pipe or a file: on a terminal it fails with `binary_output`, whose `next` adds `--out`.\n\n`kenso api` takes both, for any route: `--file` (repeat it for more files) sends multipart with the keys of a `--data` object as form fields, and `--out` saves any answer.\n\n```bash\nkenso saved-lists create-upload --saved-list-id 12 --file people.csv\nkenso workspaces replace-logo --workspace-id 42 --file ./logo.png\nkenso workspaces replace-logo --workspace-id 42 --source-url https://example.com/logo.png\nkenso attachments get-content --attachment-id att_123 --out ./invoice.pdf\nkenso api POST /v1/campaigns/812/email-sequence/images --file ./hero.png\nkenso api GET /v1/knowledge/exports/77/content --out knowledge.zip\n```\n\n## Live streams\n\n`kenso sync events` and `kenso onboarding-builds events` follow a live stream of server-sent events. They print one JSON line per event as it arrives, on a terminal too, with the event\'s name, its id when it has one, and its data:\n\n```json\n{"event":"hello","data":{"buildId":"obd_2x","status":"building","stage":"read","lastEventId":0}}\n{"event":"stage","id":"41","data":{"stage":"plan"}}\n{"event":"done","id":"42","data":{}}\n```\n\nA stream has no time limit while events arrive. The server ends each connection after 15 minutes with a `bye` event; the command then connects again at once, and after a dropped connection or 60 s without even a keepalive, after a second. A connection that brought nothing but `hello` and `bye` (a server that is restarting) backs off 1, 2, 4 ... 30 s. Once events carry an id (`onboarding-builds events`), it sends the last whole event\'s id as `Last-Event-ID`, so no event is lost or printed twice. A refusal (401, 403, 404) ends it at once; eight failed or empty connects in a row end it with the last error.\n\nIt runs until Ctrl-C (exit 130; every line printed is whole), or until one of these:\n\n| Flag | Ends the command |\n|---|---|\n| `--until <event>` | After the first event with that name; several names are comma-separated: `--until done,error` |\n| `--max-events <n>` | After n events, `hello` and `bye` included |\n| `--once` | When the server closes the connection, instead of connecting again |\n\n```bash\nkenso onboarding-builds events --build-id obd_2x --until done,error\nkenso sync events --max-events 2 # hello, then the first poke\n```\n\n`--output`, `--fields` and `--query` do not apply to a stream. `--last-event-id` starts an onboarding build stream after that id.\n\n## Errors\n\nWhen stderr is not a terminal, an error is one JSON line on stderr:\n\n```json\n{"error":{"code":"unknown_flag","message":"Unknown flag --fiel for kenso contacts import.","field":"fiel","hint":"did you mean --file?","next":"kenso contacts import --help"}}\n```\n\n| Key | Always there | Meaning |\n|---|---|---|\n| `code` | yes | A stable snake_case code to branch on |\n| `message` | yes | One sentence for a person |\n| `field` | no | The flag or input field at fault |\n| `hint` | no | What to change |\n| `next` | no | The exact command to run next, such as `kenso auth login`, `kenso workspace list --search <name>` or the same command with `--yes` |\n| `httpStatus` | no | The API\'s HTTP status, when the API answered |\n| `requestId` | no | The API\'s request id: quote it when you contact Kenso support |\n\nOn a terminal the same error prints as text: `Error: <message>`, then `field:`, `hint:`, `next:` and `requestId:` lines. The key never appears in an error.\n\n### How API errors map\n\nThe CLI looks at the HTTP status first, then at the API\'s own `error.code`, which wins when present.\n\n| HTTP status | Default code | Exit |\n|---|---|---|\n| 400, 422 | `validation_failed` | 2 |\n| 401 | `unauthorized` (`next`: `kenso auth login`) | 3 |\n| 403 | `forbidden`: the key\'s user or role cannot do this in this workspace | 3 |\n| 404 | `not_found` | 4 |\n| 409 | `conflict` | 7 |\n| 429 | `rate_limited`, after the CLI waited and retried | 6 |\n| 5xx | `server_error`, after retries where they are safe | 8 |\n| anything else | `http_error` | 1 |\n\nTwo API codes change the exit code: `workspace_required` exits 2 with `"next":"kenso workspace list --search <name>"`, and `limit_reached` (the plan\'s or the campaign\'s lead limit) exits 6.\n\n### Errors from the CLI itself\n\n| Code | Exit | When |\n|---|---|---|\n| `usage_error` | 2 | A required flag or argument is missing, two flags conflict (`--yes` with `--dry-run`), or `--dry-run` on a command that has no dry run |\n| `read_only` | 2 | `--read-only` or `KENSO_READ_ONLY` is on and the command is not a read: nothing was sent. `next` (with `--read-only` only, on a command with a dry run) is the same command with `--dry-run`, which prints the plan and changes nothing |\n| `unknown_command` | 2 | No such command; `hint` suggests the closest one |\n| `unknown_flag`, `invalid_flag`, `invalid_flag_value`, `unexpected_argument` | 2 | A flag or argument the command does not take |\n| `invalid_query` | 2 | `--query` is not valid JMESPath |\n| `confirmation_required` | 2 | A delete, archive or remove ran without `--yes` where nobody can confirm: nothing was sent; `next` adds `--yes` |\n| `cancelled` | 2 | A person answered no to the confirmation: nothing was sent |\n| `file_unreadable` | 2 | An input file is missing, is a folder, cannot be opened, or cannot be parsed; the message names the line, such as `leads.csv line 3: a quote is not closed.` |\n| `config_invalid` | 2 | `~/.kenso/config.json` is not valid JSON: fix or delete it |\n| `folder_file_untrusted` | 2 | A workflow command would read or write a `kenso.json` that another user owns or anyone can write: kenso skips such a file and names it on stderr, and nothing was written or sent. Make it yours and writable only by you, or work in a folder only you can write |\n| `feature_not_enabled` | 2 | Every action of the resource is a beta command your workspace has not enabled |\n| `invalid_key_format`, `key_required` | 2 | `auth login --with-key` read something that is not a Kenso key, or stdin is a terminal instead of a pipe |\n| `invalid_workspace_id` | 2 | `kenso workspace use` got an id that is not a positive whole number |\n| `unknown_topic` | 2 | `kenso docs` got a topic it does not have; `hint` lists the topics |\n| `file_unwritable` | 2 or 1 | An output file cannot be written: `--out` on `contacts export`, `kenso api` or a download command (2), `skill install` (1) |\n| `binary_output` | 2 | The answer is a binary file and stdout is a terminal: nothing was printed; `next` saves it with `--out` |\n| `no_api_key` | 3 | No key in `KENSO_API_KEY` or the profile (`next`: `kenso auth login`) |\n| `browser_login_unavailable`, `access_denied`, `login_expired` | 3 | Browser login is off, was denied, or timed out |\n| `run_not_found` | 4 | `kenso runs show` or `resume` got an unknown run id |\n| `docs_not_found` | 4 | `kenso docs reference` before the reference was generated (a source checkout without `pnpm build`) |\n| `run_in_progress`, `already_filled` | 7 | Another process is working on the run (for `kenso workflows run`, a run on the same input), or `studio fill` already ran with this file and these flags |\n| `already_started` | 7 | `kenso workflows run`: an earlier run on the same input already sent starts, and this one would start records differently (another `--max-credits`), so it would start them twice. Nothing was sent: `not-started.txt` in that run\'s folder holds the ids it did not start, and `next` runs only those |\n| `local_changes` | 7 | `studio pull` would replace files that no earlier pull wrote or push sent, or that changed since; nothing was written, and `next` adds `--force` to replace them |\n| `job_timeout`, `job_failed`, `job_canceled` | 1 | `kenso jobs wait` (or a command that waits on a job) ran out of time, or the job failed or was canceled |\n| `mcp_tool_error` | 1 | `kenso mcp call`: the MCP tool answered with an error |\n| `unsafe_path` | 1 | `studio pull` refused a file path that is not a file of the Studio bundle layout (such as a dotfile, `opencode.json` or `CLAUDE.md`), would land outside `--dir`, or passes through a symbolic link, or a `samples/*.json` that does not hold a sample, or a `.md` file that holds a tool\'s config line |\n| `network_error` | 8 | The API could not be reached after retries |\n| `upload_failed`, `download_failed` | 8 or 1 | A signed upload or download of a Studio file failed: 8 when storage was unreachable or answered 5xx, 1 on a 4xx (often an expired link: run the command again) |\n| `pull_incomplete` | 8 | `studio pull`: a file came back with neither text nor a download link |\n| `unexpected_response` | 1 or 8 | The API answered something the CLI could not read |\n| `unexpected_error` | 1 | A bug: run again with `--verbose` and report it |\n| `interrupted` | 130 | Ctrl-C |\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | OK, including a batch where every row succeeded or was skipped |\n| 1 | Unexpected error |\n| 2 | Usage or input error: a bad flag, a bad file, a validation error |\n| 3 | Auth: no key, an invalid, revoked or expired key, or HTTP 401 or 403 |\n| 4 | Not found |\n| 5 | Partial: the batch finished and some rows failed, were not found or were invalid. See `results.csv` |\n| 6 | Rate limited after retries, or a plan or campaign lead limit stopped the run (`limit_reached`) |\n| 7 | Conflict or invalid state (HTTP 409), a run another process holds (`run_in_progress`), or a workflow run that would start records twice (`already_started`) |\n| 8 | Server error after retries (5xx), or the API is unreachable |\n| 9 | Answer refused: a Kenso sandbox run stopped because an answer held a credential or something shaped like one |\n| 130 | Interrupted. A batch run can be resumed: see its `next` |\n\nSkipped rows (duplicates, blocklisted, already contacted) are not failures: a batch with only created, updated and skipped rows exits 0.\n\n## Flags\n\n- Command flags go after the command: `kenso contacts import --campaign 812`. Global flags can go anywhere.\n- A boolean flag takes `--flag`, `--no-flag`, `--flag=true` and `--flag=false`.\n- A flag that carries a secret (`--password`, `--api-key`, `--api-secret`, any `--\u2026-token` or `--\u2026-secret`) also takes `-` (read stdin), `@file` (read the file) or `env:NAME` (read that environment variable), so the value stays out of shell history: `printf \'%s\' "$FATHOM_KEY" | kenso fathom-connection connect --api-key -`. A value typed on the command line still works and prints one warning. A typed secret that itself starts with `@` is written `@@` (`--password @@Spring2026` sends `@Spring2026`); one that is exactly `-` or starts with `env:` has to come through `@file` or `env:NAME`. `-` refuses a terminal, an empty value is refused, and only one flag can read stdin. `--dry-run` shows a secret as `***`. With `--each`, the plan, its `next` and the run record keep `@file` or `env:NAME` as typed and `kenso runs resume` reads it again; a secret from stdin is refused there.\n- `--help` on any command prints its flags, arguments and examples. `kenso describe <resource> <action>` prints the same as JSON, with the body schema.\n\n## Effect, cost and read-only mode\n\nEvery command has an effect: `read` (changes nothing, charges nothing), `write` (changes workspace data, charges nothing the API contract declares, nothing leaves Kenso), `spend` (can charge credits), `send` (sends an email, a LinkedIn message, a call or an invitation, or starts or resumes sending) or `destructive` (deletes, archives, removes or merges). Command help prints `Effect: <effect>.` under the summary, and a command that charges adds a `Cost:` line in credits from your workspace\'s rate card.\n\n`kenso describe <resource> <action>` adds `effect` and `cost` to its JSON. `cost` is `null` for a command that does not charge, else `{"lines": [...], "rateCard": {"source": ..., "versions": [...]}}`: each line is the command\'s credit line with its `price` text, and `source` is `live`, `cache` or `bundled`. A command that charges something no rate-card row prices has `{"lines": [], "rateCard": null}`, with `text` saying what it charges when the command states it. `kenso describe` and `kenso describe <resource>` add `effect` to each row.\n\nA generated command that charges prints the same `cost` in its `--dry-run` plan, for the request it would send. A flag that turns off every charge says so: `kenso accounts create --skip-research --dry-run` prints `"cost": {"lines": [], "text": "not charged in credits (--skip-research: no research or committee run)", "rateCard": null}` and `"credits": {"needed": 0, "available": null, "sufficient": null}`, and reads nothing.\n\n`--read-only`, or `KENSO_READ_ONLY=1` in the environment, refuses every command whose effect is not `read` before it sends a request, with exit 2:\n\n```json\n{"error":{"code":"read_only","message":"kenso campaigns launch is a send command, and this session is read-only.","hint":"Read-only is on through --read-only: next prints the plan. Run the command again without --read-only to make the change.","next":"kenso --read-only campaigns launch --campaign-id 1 --dry-run"}}\n```\n\n`next` never makes the change: on a command with a dry run it is the same command with `--dry-run` and without `--yes`, which prints the plan. A command with no dry run gets no `next`, and its hint says to run it again without `--read-only`. A command with its own `--body-read-only` option (`kenso api-keys create`) gets no `next` either, and its hint names that option. When the variable turned read-only on, the hint reads `KENSO_READ_ONLY is set: unset it to run this command.` and there is no `next`, so an agent that runs `next` cannot loop. A POST that only reads, such as `kenso contacts search`, still runs; a GET that charges, such as `kenso search get-place`, is refused; a command with a dry run still prints its plan with `--dry-run`; `kenso api` has the effect of the route it calls, and on a route this CLI does not know only a `GET` runs.\n\n```bash\nKENSO_READ_ONLY=1 kenso contacts search --limit 1\nkenso --read-only describe email-finds create\n```\n\n## Beta commands\n\nCommands that need a workspace feature flag (CRM, Studio and others) are beta. Help and `kenso describe` hide the ones your workspace has not enabled and say how many they hid; `--all-commands` shows them. Calling a hidden command still works: Kenso decides. `kenso <resource>` on a resource whose every action is hidden answers `feature_not_enabled` (exit 2) and names the flags it needs.\n\n```bash\nkenso --help --all-commands\nkenso describe --all-commands\n```\n\n## What the CLI sends\n\nEvery API call carries `Authorization: Bearer <key>`, `Ken-Version: 1.1`, `X-Ken-Workspace-Id` (when a workspace is picked), `User-Agent: kenso-cli/<version> (node <version>; <platform>)` and `X-Ken-Client: Kenso CLI`. When a coding agent runs the CLI, `X-Ken-Client` names it (`Kenso CLI via Claude Code`) and writes carry `X-Ken-Actor: agent`, so Kenso\'s activity log shows who made a change.\n';
|
|
9907
9907
|
}
|
|
9908
9908
|
});
|
|
9909
9909
|
|
|
@@ -9927,7 +9927,7 @@ var init_sandbox = __esm({
|
|
|
9927
9927
|
var studio_default;
|
|
9928
9928
|
var init_studio = __esm({
|
|
9929
9929
|
"docs/studio.md"() {
|
|
9930
|
-
studio_default = "# Studio (beta)\n\nStudio templates are the pages, docs and other assets Kenso builds for each account or lead. The `kenso studio` commands let you edit a template as a folder of files on your machine, check it, preview it, and fill it for many accounts or leads at once. They are beta: they need the `studio` feature flag on your workspace. Help and `kenso describe` hide them until your workspace has it; `--all-commands` shows them.\n\n| Command | What it does |\n|---|---|\n| `studio pull <templateId> --dir <dir>` | Write a template version's files to a folder |\n| `studio push <templateId> --dir <dir>` | Save the folder's files to the template's draft and print the validation |\n| `studio validate <templateId> --dir <dir>` | Validate the folder against the template without saving |\n| `studio preview <templateId>` | Render a version for up to 3 accounts and print the preview links |\n| `studio fill <templateId>` | Fill the template for many accounts or campaign leads, estimate first |\n\nFind template ids with the generated commands:\n\n```bash\nkenso asset-templates list\n```\n\n## Edit a template locally\n\n```bash\nkenso studio pull 12 --dir ./my-template\nkenso studio validate 12 --dir ./my-template\nkenso studio push 12 --dir ./my-template\nkenso studio preview 12 --dir ./my-template --account-ids 501,502\nkenso studio push 12 --dir ./my-template --publish\n```\n\n### pull\n\n`pull` writes every file of the version under `--dir`: text files from the answer, binaries downloaded from signed links and checked against their SHA-256. It leaves other files in the folder alone. It checks every path before it writes anything, and refuses (`unsafe_path`) one that is not a file of the Studio bundle layout, one that would land outside `--dir`, and one that passes through a symbolic link. The layout is `studio.json`, `template.liquid`, `fallback.liquid`, `README.md`, `brief.md` and `ideas.md` at the top, images, fonts, pdf and csv files under `assets/`, and `.json` or `.csv` files directly in `samples/`, with names of letters, digits, `.`, `-` and `_` that neither start nor end with a dot and are not a Windows device name (`CON`, `NUL`, `COM1`). A sample is named in lowercase letters, digits, `-` and `_` (`samples/acme.json`), and never with a name a tool reads as its own config (`package.json`, `tsconfig.json`, `opencode.json`), so a tool started inside `samples/` finds none either. A sample `.json` is also judged by what it holds: one JSON object with only the top-level keys `account`, `person`, `sender`, `brand`, `link`, `data`, `role` and `roles`. Pull refuses any other (`unsafe_path`) before it writes anything, so no tool's configuration arrives under a sample name. So pull never writes a hidden file (`.claude/`, `.mcp.json`), a tool's config file (`opencode.json`, `package.json`) or a coding agent's `CLAUDE.md` or `AGENTS.md`, which editors and coding agents read as their own settings, whatever the server sends. Studio stores nothing outside the layout; when a version stored before that rule holds such a file, the API leaves it out and pull prints a warning that names it.\n\n`pull` replaces a file that is already there only when an earlier pull wrote it or a push sent it and nobody changed it since, or when it already holds the new content. `.kenso-pull.json` at the top of the folder records what pulls wrote and pushes sent; push skips it like any dotfile. So pull, edit, push and pull again works as before, and a teammate's change replaces the files you did not change since your last pull or push. A file you added or changed and did not push stops the pull before anything is written: `local_changes` (exit 7) lists them. Move them away or compare them with the template, or add `--force` to replace them with the template's version. The first pull into a folder that an older version of the CLI pulled into may ask for `--force` once, for files that changed in the template since.\n\n`--template-version` picks the version: `draft`, `latest` (the latest published) or a version id. The default is the draft, else the latest published version. (The flag is not `--version`: after a command, `--version` fails with `unknown_flag` and points at `--template-version`.)\n\n```bash\nkenso studio pull 12 --dir ./v3 --template-version 345\nkenso studio pull 12 --dir ./my-template --dry-run\n```\n\nIt prints `{templateId, versionId, files, dir}`, plus `replaced` when `--force` replaced files. `--dry-run` lists the paths, and as `conflicts` the files it would not replace without `--force`, and writes nothing.\n\n### push\n\n`push` reads the files of the bundle layout in `--dir` (see pull) and skips everything else, so a folder that also holds a coding agent's `CLAUDE.md`, a `package.json` or a `src/` folder still pushes. It prints a warning naming each skipped file or folder; dotfiles, dot folders and `node_modules` are skipped without one. A `samples/*.json` that is not one JSON object with only the keys `account`, `person`, `sender`, `brand`, `link`, `data`, `role` and `roles` is skipped with the same warning: the API refuses it (400 `content_mismatch`). `validate` reads the folder the same way.\n\n- A text file (valid UTF-8, no NUL byte, under 1 MB) goes inline.\n- Any other file is uploaded through a signed upload URL first, 4 at a time, up to 5 MB each. A larger file is refused before any call.\n- One push then saves the files into the draft and prints `{templateId, versionId, versionNumber, validation, changed, deleted}`.\n\nFiles that are in the draft but not in the folder stay, unless you pass `--delete-missing`. `--message` describes the change (default \"Pushed with the Kenso CLI\"). With `--publish`, the new version is published when validation passes, and the output adds `published`.\n\n```bash\nkenso studio push 12 --dir ./my-template --message \"New hero copy\"\nkenso studio push 12 --dir ./my-template --delete-missing --publish\nkenso studio push 12 --dir ./my-template --dry-run\n```\n\nWhen validation finds errors, the draft is still saved: the result prints, then the error `validation_failed` (exit 2) with the first problem as its `hint`. When publishing fails after a good push, the push result still prints and the error says which version was saved. `--dry-run` lists what would be sent and calls nothing.\n\n### validate\n\n`validate` reads the folder the same way and checks the files laid over the draft, as a push would, without saving them. Binaries are uploaded so they can be checked. `--delete-missing` validates exactly the folder's files. It prints the validation and exits 2 when there are errors.\n\n### preview\n\n`preview` renders a saved version, not your local files: the draft, else the latest published version, or `--version-id`. It takes up to a minute per account.\n\n```bash\nkenso studio preview 12\nkenso studio preview 12 --account-ids 501,502,503 --mode render\nkenso studio preview 12 --sample samples/acme.json\nkenso studio preview 12 --mode interact --interact @steps.json\n```\n\n- `--account-ids` takes up to 3 ids. Without it, Kenso picks the 3 most recently touched accounts, else the template's samples.\n- `--mode` is `render` (default) or `interact`. `--interact` takes the click, type and wait steps as JSON, `@file` or `-` (up to 20).\n- With `--dir`, the CLI compares your folder to the version it renders and warns on stderr when they differ, naming the push command to run first.\n\nThe output lists each preview's link, screenshots, console errors and link issues.\n\n## Fill a template for many accounts or leads\n\n`fill` creates pages for a list of accounts, or for the leads of a campaign. A fill is charged per page, so it always prices the work first.\n\n```bash\nkenso studio fill 12 --accounts accounts.txt\nkenso studio fill 12 --accounts accounts.csv --column accountId --yes --wait\nkenso studio fill 12 --campaign 345 --contacts leads.csv --yes\n```\n\n- **Ids** come from `--accounts <file>`, or from `--contacts <file>` with `--campaign <id>`; `-` reads stdin. A file holds one id per line, or a CSV or JSONL with an id column (`--column`, else `id`, else `contactId`). Repeated ids are filled once.\n- **Without `--yes`** (or with `--estimate`) it prints the estimate and the apply command, and creates nothing. For a campaign, the estimate counts one page per lead; Kenso builds one page per company, so it is an upper bound.\n- **With `--yes`** it creates one fill run per 500 ids, one after another.\n- **With `--wait`** it follows each run every 5 seconds until it completes, fails or is cancelled. Without it, follow a run with `kenso asset-runs get --run-id <id>`.\n\nThe summary lists `runs: [{runId, state, rows}]`, and `results.csv` has one line per id with its page id and state.\n\n**The same fill never runs twice.** Rebuilding a page charges again, so when you rerun a fill with the same file (the same bytes) and the same flags:\n\n- an unfinished fill continues where it stopped;\n- a finished fill where every id succeeded answers from that run and changes nothing;\n- anything else is refused with `already_filled` (exit 7). To retry only the ids that failed, take them from the earlier run's `results.csv` into a new file and fill that file.\n\nThe guard compares the file and the flags, not the ids: the same ids in another file, or in another order, are filled and charged again. Keep one ids file per fill, and check `kenso runs list` before you fill ids from a new file.\n\n## Other Studio commands\n\nEverything else (create a template, list versions, restore a version, datasets, publish) is a generated command under `asset-templates`, `asset-runs` and `asset-template-datasets`:\n\n```bash\nkenso asset-templates --help --all-commands\nkenso describe asset-templates\n```\n";
|
|
9930
|
+
studio_default = "# Studio (beta)\n\nStudio templates are the pages, docs and other assets Kenso builds for each account or lead. The `kenso studio` commands let you edit a template as a folder of files on your machine, check it, preview it, and fill it for many accounts or leads at once. They are beta: they need the `studio` feature flag on your workspace. Help and `kenso describe` hide them until your workspace has it; `--all-commands` shows them.\n\n| Command | What it does |\n|---|---|\n| `studio pull <templateId> --dir <dir>` | Write a template version's files to a folder |\n| `studio push <templateId> --dir <dir>` | Save the folder's files to the template's draft and print the validation |\n| `studio validate <templateId> --dir <dir>` | Validate the folder against the template without saving |\n| `studio preview <templateId>` | Render a version for up to 3 accounts and print the preview links |\n| `studio fill <templateId>` | Fill the template for many accounts or campaign leads, estimate first |\n\nFind template ids with the generated commands:\n\n```bash\nkenso asset-templates list\n```\n\n## Edit a template locally\n\n```bash\nkenso studio pull 12 --dir ./my-template\nkenso studio validate 12 --dir ./my-template\nkenso studio push 12 --dir ./my-template\nkenso studio preview 12 --dir ./my-template --account-ids 501,502\nkenso studio push 12 --dir ./my-template --publish\n```\n\n### pull\n\n`pull` writes every file of the version under `--dir`: text files from the answer, binaries downloaded from signed links and checked against their SHA-256. It leaves other files in the folder alone. It checks every path before it writes anything, and refuses (`unsafe_path`) one that is not a file of the Studio bundle layout, one that would land outside `--dir`, and one that passes through a symbolic link. The layout is `studio.json`, `template.liquid`, `fallback.liquid`, `README.md`, `brief.md` and `ideas.md` at the top, images, fonts, pdf and csv files under `assets/`, and `.json` or `.csv` files directly in `samples/`, with names of letters, digits, `.`, `-` and `_` that neither start nor end with a dot and are not a Windows device name (`CON`, `NUL`, `COM1`). A sample is named in lowercase letters, digits, `-` and `_` (`samples/acme.json`), and never with a name a tool reads as its own config (`package.json`, `tsconfig.json`, `opencode.json`), so a tool started inside `samples/` finds none either. A sample `.json` is also judged by what it holds: one JSON object with only the top-level keys `account`, `person`, `sender`, `brand`, `link`, `data`, `role` and `roles`. Pull refuses any other (`unsafe_path`) before it writes anything, so no tool's configuration arrives under a sample name. It refuses a `.md` file that holds the line `> see https://aka.ms/autorest` (in any case) the same way, since a code generator started in the folder reads such a file as its configuration. So pull never writes a hidden file (`.claude/`, `.mcp.json`), a tool's config file (`opencode.json`, `package.json`) or a coding agent's `CLAUDE.md` or `AGENTS.md`, which editors and coding agents read as their own settings, whatever the server sends. Studio stores nothing outside the layout; when a version stored before that rule holds such a file, the API leaves it out and pull prints a warning that names it.\n\n`pull` replaces a file that is already there only when an earlier pull wrote it or a push sent it and nobody changed it since, or when it already holds the new content. `.kenso-pull.json` at the top of the folder records what pulls wrote and pushes sent; push skips it like any dotfile. So pull, edit, push and pull again works as before, and a teammate's change replaces the files you did not change since your last pull or push. A file you added or changed and did not push stops the pull before anything is written: `local_changes` (exit 7) lists them. Move them away or compare them with the template, or add `--force` to replace them with the template's version. The first pull into a folder that an older version of the CLI pulled into may ask for `--force` once, for files that changed in the template since.\n\n`--template-version` picks the version: `draft`, `latest` (the latest published) or a version id. The default is the draft, else the latest published version. (The flag is not `--version`: after a command, `--version` fails with `unknown_flag` and points at `--template-version`.)\n\n```bash\nkenso studio pull 12 --dir ./v3 --template-version 345\nkenso studio pull 12 --dir ./my-template --dry-run\n```\n\nIt prints `{templateId, versionId, files, dir}`, plus `replaced` when `--force` replaced files. `--dry-run` lists the paths, and as `conflicts` the files it would not replace without `--force`, and writes nothing.\n\n### push\n\n`push` reads the files of the bundle layout in `--dir` (see pull) and skips everything else, so a folder that also holds a coding agent's `CLAUDE.md`, a `package.json` or a `src/` folder still pushes. It prints a warning naming each skipped file or folder; dotfiles, dot folders and `node_modules` are skipped without one. A `samples/*.json` that is not one JSON object with only the keys `account`, `person`, `sender`, `brand`, `link`, `data`, `role` and `roles` is skipped with the same warning, and so is a `.md` file that holds the line `> see https://aka.ms/autorest`: the API refuses both (400 `content_mismatch`). `validate` reads the folder the same way.\n\n- A text file (valid UTF-8, no NUL byte, under 1 MB) goes inline.\n- Any other file is uploaded through a signed upload URL first, 4 at a time, up to 5 MB each. A larger file is refused before any call.\n- One push then saves the files into the draft and prints `{templateId, versionId, versionNumber, validation, changed, deleted}`.\n\nFiles that are in the draft but not in the folder stay, unless you pass `--delete-missing`. `--message` describes the change (default \"Pushed with the Kenso CLI\"). With `--publish`, the new version is published when validation passes, and the output adds `published`.\n\n```bash\nkenso studio push 12 --dir ./my-template --message \"New hero copy\"\nkenso studio push 12 --dir ./my-template --delete-missing --publish\nkenso studio push 12 --dir ./my-template --dry-run\n```\n\nWhen validation finds errors, the draft is still saved: the result prints, then the error `validation_failed` (exit 2) with the first problem as its `hint`. When publishing fails after a good push, the push result still prints and the error says which version was saved. `--dry-run` lists what would be sent and calls nothing.\n\n### validate\n\n`validate` reads the folder the same way and checks the files laid over the draft, as a push would, without saving them. Binaries are uploaded so they can be checked. `--delete-missing` validates exactly the folder's files. It prints the validation and exits 2 when there are errors.\n\n### preview\n\n`preview` renders a saved version, not your local files: the draft, else the latest published version, or `--version-id`. It takes up to a minute per account.\n\n```bash\nkenso studio preview 12\nkenso studio preview 12 --account-ids 501,502,503 --mode render\nkenso studio preview 12 --sample samples/acme.json\nkenso studio preview 12 --mode interact --interact @steps.json\n```\n\n- `--account-ids` takes up to 3 ids. Without it, Kenso picks the 3 most recently touched accounts, else the template's samples.\n- `--mode` is `render` (default) or `interact`. `--interact` takes the click, type and wait steps as JSON, `@file` or `-` (up to 20).\n- With `--dir`, the CLI compares your folder to the version it renders and warns on stderr when they differ, naming the push command to run first.\n\nThe output lists each preview's link, screenshots, console errors and link issues.\n\n## Fill a template for many accounts or leads\n\n`fill` creates pages for a list of accounts, or for the leads of a campaign. A fill is charged per page, so it always prices the work first.\n\n```bash\nkenso studio fill 12 --accounts accounts.txt\nkenso studio fill 12 --accounts accounts.csv --column accountId --yes --wait\nkenso studio fill 12 --campaign 345 --contacts leads.csv --yes\n```\n\n- **Ids** come from `--accounts <file>`, or from `--contacts <file>` with `--campaign <id>`; `-` reads stdin. A file holds one id per line, or a CSV or JSONL with an id column (`--column`, else `id`, else `contactId`). Repeated ids are filled once.\n- **Without `--yes`** (or with `--estimate`) it prints the estimate and the apply command, and creates nothing. For a campaign, the estimate counts one page per lead; Kenso builds one page per company, so it is an upper bound.\n- **With `--yes`** it creates one fill run per 500 ids, one after another.\n- **With `--wait`** it follows each run every 5 seconds until it completes, fails or is cancelled. Without it, follow a run with `kenso asset-runs get --run-id <id>`.\n\nThe summary lists `runs: [{runId, state, rows}]`, and `results.csv` has one line per id with its page id and state.\n\n**The same fill never runs twice.** Rebuilding a page charges again, so when you rerun a fill with the same file (the same bytes) and the same flags:\n\n- an unfinished fill continues where it stopped;\n- a finished fill where every id succeeded answers from that run and changes nothing;\n- anything else is refused with `already_filled` (exit 7). To retry only the ids that failed, take them from the earlier run's `results.csv` into a new file and fill that file.\n\nThe guard compares the file and the flags, not the ids: the same ids in another file, or in another order, are filled and charged again. Keep one ids file per fill, and check `kenso runs list` before you fill ids from a new file.\n\n## Other Studio commands\n\nEverything else (create a template, list versions, restore a version, datasets, publish) is a generated command under `asset-templates`, `asset-runs` and `asset-template-datasets`:\n\n```bash\nkenso asset-templates --help --all-commands\nkenso describe asset-templates\n```\n";
|
|
9931
9931
|
}
|
|
9932
9932
|
});
|
|
9933
9933
|
|
|
@@ -13356,7 +13356,8 @@ __export(update_exports, {
|
|
|
13356
13356
|
async function emailIndex(ctx, campaignId) {
|
|
13357
13357
|
const index2 = /* @__PURE__ */ new Map();
|
|
13358
13358
|
let read2 = 0;
|
|
13359
|
-
|
|
13359
|
+
const query = { campaignId, fields: "id,email" };
|
|
13360
|
+
for await (const contact of ctx.client.paginate({ method: "GET", path: "/v1/contacts", query }, { pageSize: PAGE_SIZE })) {
|
|
13360
13361
|
read2++;
|
|
13361
13362
|
if (read2 % 2e3 === 0) ctx.output.progress(`read ${read2} contacts of campaign ${campaignId}`);
|
|
13362
13363
|
if (!isRecord5(contact)) continue;
|
|
@@ -18223,7 +18224,10 @@ function inBundleLayout(bundlePath) {
|
|
|
18223
18224
|
const name = segments[1];
|
|
18224
18225
|
return segments[0] === "samples" && segments.length === 2 && SAMPLE_NAME.test(name) && !TOOL_CONFIG_NAMES.has(name.toLowerCase());
|
|
18225
18226
|
}
|
|
18226
|
-
function
|
|
18227
|
+
function contentOk(bundlePath, content) {
|
|
18228
|
+
if (MARKDOWN.test(bundlePath)) {
|
|
18229
|
+
return !(typeof content === "string" ? content : content.toString("utf8")).toLowerCase().includes(TOOL_CONFIG_MARKER);
|
|
18230
|
+
}
|
|
18227
18231
|
if (!SAMPLE_JSON.test(bundlePath)) return true;
|
|
18228
18232
|
if (content.length > UPLOAD_MAX_BYTES) return false;
|
|
18229
18233
|
try {
|
|
@@ -18252,7 +18256,7 @@ async function readFolder(dir3, skipped = []) {
|
|
|
18252
18256
|
}
|
|
18253
18257
|
const bytes = await readFile10(abs);
|
|
18254
18258
|
const text4 = textOf2(bytes);
|
|
18255
|
-
if (!
|
|
18259
|
+
if (!contentOk(path, text4 ?? bytes)) {
|
|
18256
18260
|
skipped.push(path);
|
|
18257
18261
|
continue;
|
|
18258
18262
|
}
|
|
@@ -18304,11 +18308,14 @@ async function recordPullState(root3, entries2) {
|
|
|
18304
18308
|
await writeFile4(path, `${JSON.stringify({ files }, null, 2)}
|
|
18305
18309
|
`);
|
|
18306
18310
|
}
|
|
18307
|
-
function
|
|
18308
|
-
|
|
18309
|
-
if (
|
|
18310
|
-
|
|
18311
|
-
|
|
18311
|
+
function checkPulledContent(bundlePath, text4) {
|
|
18312
|
+
const markdown = MARKDOWN.test(bundlePath);
|
|
18313
|
+
if (!markdown && !SAMPLE_JSON.test(bundlePath)) return;
|
|
18314
|
+
if (typeof text4 === "string" && contentOk(bundlePath, Buffer.from(text4, "utf8"))) return;
|
|
18315
|
+
throw unsafePath(
|
|
18316
|
+
bundlePath,
|
|
18317
|
+
!markdown ? "it does not hold a Studio sample (one JSON object with only the keys account, person, sender, brand, link, data, role and roles)" : typeof text4 !== "string" ? "it came as a download link, and Kenso serves a .md file as text" : `it holds the line "${TOOL_CONFIG_MARKER}", which makes a code generator read it as its configuration and run the packages it names`
|
|
18318
|
+
);
|
|
18312
18319
|
}
|
|
18313
18320
|
function unsafePath(bundlePath, why) {
|
|
18314
18321
|
return new KensoError({
|
|
@@ -18339,7 +18346,7 @@ async function mapLimit(items, limit, fn) {
|
|
|
18339
18346
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
18340
18347
|
return out;
|
|
18341
18348
|
}
|
|
18342
|
-
var TEXT_MAX_BYTES, UPLOAD_MAX_BYTES, utf8, TOP_FILES, ASSET_TYPES, SAMPLE_NAME, TOOL_CONFIG_NAMES, SAMPLE_KEYS, SAMPLE_JSON, strictUtf8, NAME, WINDOWS_DEVICE, LAYOUT, PULL_STATE, sha2563, CONTENT_TYPES2;
|
|
18349
|
+
var TEXT_MAX_BYTES, UPLOAD_MAX_BYTES, utf8, TOP_FILES, ASSET_TYPES, SAMPLE_NAME, TOOL_CONFIG_NAMES, SAMPLE_KEYS, SAMPLE_JSON, MARKDOWN, TOOL_CONFIG_MARKER, strictUtf8, NAME, WINDOWS_DEVICE, LAYOUT, PULL_STATE, sha2563, CONTENT_TYPES2;
|
|
18343
18350
|
var init_folder2 = __esm({
|
|
18344
18351
|
"src/commands/studio/folder.ts"() {
|
|
18345
18352
|
"use strict";
|
|
@@ -18386,14 +18393,20 @@ var init_folder2 = __esm({
|
|
|
18386
18393
|
"dprint.json",
|
|
18387
18394
|
"cspell.json",
|
|
18388
18395
|
"pyrightconfig.json",
|
|
18389
|
-
"cypress.json"
|
|
18396
|
+
"cypress.json",
|
|
18397
|
+
// Tools whose top-level keys are names their author picks, so the key rule below cannot tell them from a sample (DEV-13932).
|
|
18398
|
+
"cookiecutter.json",
|
|
18399
|
+
"zappa_settings.json",
|
|
18400
|
+
"database.json"
|
|
18390
18401
|
]);
|
|
18391
18402
|
SAMPLE_KEYS = /* @__PURE__ */ new Set(["account", "person", "sender", "brand", "link", "data", "role", "roles"]);
|
|
18392
18403
|
SAMPLE_JSON = /^samples\/[^/]+\.json$/i;
|
|
18404
|
+
MARKDOWN = /\.md$/i;
|
|
18405
|
+
TOOL_CONFIG_MARKER = "> see https://aka.ms/autorest";
|
|
18393
18406
|
strictUtf8 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
18394
18407
|
NAME = /^[A-Za-z0-9_-](?:[A-Za-z0-9._-]*[A-Za-z0-9_-])?$/;
|
|
18395
18408
|
WINDOWS_DEVICE = /^(?:CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])(?:\.|$)/i;
|
|
18396
|
-
LAYOUT =
|
|
18409
|
+
LAYOUT = `studio.json, template.liquid, fallback.liquid, README.md, brief.md, ideas.md (never holding the line "${TOOL_CONFIG_MARKER}"), assets/ (images, fonts, pdf, csv) and samples/ (.json, .csv, named in lowercase like acme.json, never a tool's config name such as package.json; a .json there is one object with only the keys account, person, sender, brand, link, data, role and roles)`;
|
|
18397
18410
|
PULL_STATE = ".kenso-pull.json";
|
|
18398
18411
|
sha2563 = (bytes) => createHash7("sha256").update(bytes).digest("hex");
|
|
18399
18412
|
CONTENT_TYPES2 = {
|
|
@@ -18561,10 +18574,10 @@ var init_pull = __esm({
|
|
|
18561
18574
|
});
|
|
18562
18575
|
const pulled = unwrap(res.body) ?? {};
|
|
18563
18576
|
if (pulled.skipped?.length) {
|
|
18564
|
-
ctx.output.warn(`Kenso left out ${pulled.skipped.length} stored file${pulled.skipped.length === 1 ? "" : "s"} that a push would refuse now (outside the bundle layout,
|
|
18577
|
+
ctx.output.warn(`Kenso left out ${pulled.skipped.length} stored file${pulled.skipped.length === 1 ? "" : "s"} that a push would refuse now (outside the bundle layout, a sample .json that does not hold a sample, or a .md file with a tool's config line): ${pulled.skipped.join(", ")}.`);
|
|
18565
18578
|
}
|
|
18566
18579
|
const files = Object.entries(pulled.files ?? {}).map(([path, file]) => ({ path, file, target: safeJoin(dir3, path) }));
|
|
18567
|
-
for (const { path, file } of files)
|
|
18580
|
+
for (const { path, file } of files) checkPulledContent(path, file.text);
|
|
18568
18581
|
const missing2 = files.find(({ file }) => typeof file.text !== "string" && !file.downloadUrl);
|
|
18569
18582
|
if (missing2) {
|
|
18570
18583
|
throw new KensoError({ code: "pull_incomplete", message: `${missing2.path} came back with neither text nor a download link.`, exitCode: ExitCode.Server });
|