kenso 0.1.151 → 0.1.152
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 +34 -9
- 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
|
@@ -3389,7 +3389,7 @@ var VERSION;
|
|
|
3389
3389
|
var init_version = __esm({
|
|
3390
3390
|
"src/core/version.ts"() {
|
|
3391
3391
|
"use strict";
|
|
3392
|
-
VERSION = true ? "0.1.
|
|
3392
|
+
VERSION = true ? "0.1.152" : "0.0.0-dev";
|
|
3393
3393
|
}
|
|
3394
3394
|
});
|
|
3395
3395
|
|
|
@@ -9765,7 +9765,7 @@ var init_leads = __esm({
|
|
|
9765
9765
|
var output_and_errors_default;
|
|
9766
9766
|
var init_output_and_errors = __esm({
|
|
9767
9767
|
"docs/output-and-errors.md"() {
|
|
9768
|
-
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\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` or `ids`. `--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\n```bash\nkenso campaigns list --limit 3\nkenso campaigns list --limit 3 -o json\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| `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, or `studio fill` already ran with this file and these flags |\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 |\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), or a run another process holds |\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\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';
|
|
9768
|
+
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\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` or `ids`. `--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\n```bash\nkenso campaigns list --limit 3\nkenso campaigns list --limit 3 -o json\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| `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, or `studio fill` already ran with this file and these flags |\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), or a run another process holds |\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\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';
|
|
9769
9769
|
}
|
|
9770
9770
|
});
|
|
9771
9771
|
|
|
@@ -9789,7 +9789,7 @@ var init_sandbox = __esm({
|
|
|
9789
9789
|
var studio_default;
|
|
9790
9790
|
var init_studio = __esm({
|
|
9791
9791
|
"docs/studio.md"() {
|
|
9792
|
-
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. 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. `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";
|
|
9792
|
+
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";
|
|
9793
9793
|
}
|
|
9794
9794
|
});
|
|
9795
9795
|
|
|
@@ -18099,6 +18099,16 @@ function inBundleLayout(bundlePath) {
|
|
|
18099
18099
|
const name = segments[1];
|
|
18100
18100
|
return segments[0] === "samples" && segments.length === 2 && SAMPLE_NAME.test(name) && !TOOL_CONFIG_NAMES.has(name.toLowerCase());
|
|
18101
18101
|
}
|
|
18102
|
+
function sampleContentOk(bundlePath, content) {
|
|
18103
|
+
if (!SAMPLE_JSON.test(bundlePath)) return true;
|
|
18104
|
+
if (content.length > UPLOAD_MAX_BYTES) return false;
|
|
18105
|
+
try {
|
|
18106
|
+
const value = JSON.parse(typeof content === "string" ? content : strictUtf8.decode(content));
|
|
18107
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).every((key) => SAMPLE_KEYS.has(key));
|
|
18108
|
+
} catch {
|
|
18109
|
+
return false;
|
|
18110
|
+
}
|
|
18111
|
+
}
|
|
18102
18112
|
async function readFolder(dir3, skipped = []) {
|
|
18103
18113
|
const root2 = await existingDir(dir3);
|
|
18104
18114
|
const files = [];
|
|
@@ -18117,7 +18127,12 @@ async function readFolder(dir3, skipped = []) {
|
|
|
18117
18127
|
continue;
|
|
18118
18128
|
}
|
|
18119
18129
|
const bytes = await readFile10(abs);
|
|
18120
|
-
|
|
18130
|
+
const text4 = textOf2(bytes);
|
|
18131
|
+
if (!sampleContentOk(path, text4 ?? bytes)) {
|
|
18132
|
+
skipped.push(path);
|
|
18133
|
+
continue;
|
|
18134
|
+
}
|
|
18135
|
+
files.push({ path, bytes, text: text4 });
|
|
18121
18136
|
}
|
|
18122
18137
|
}
|
|
18123
18138
|
};
|
|
@@ -18165,6 +18180,12 @@ async function recordPullState(root2, entries2) {
|
|
|
18165
18180
|
await writeFile4(path, `${JSON.stringify({ files }, null, 2)}
|
|
18166
18181
|
`);
|
|
18167
18182
|
}
|
|
18183
|
+
function checkPulledSample(bundlePath, text4) {
|
|
18184
|
+
if (!SAMPLE_JSON.test(bundlePath)) return;
|
|
18185
|
+
if (typeof text4 !== "string" || !sampleContentOk(bundlePath, Buffer.from(text4, "utf8"))) {
|
|
18186
|
+
throw unsafePath(bundlePath, "it does not hold a Studio sample (one JSON object with only the keys account, person, sender, brand, link, data, role and roles)");
|
|
18187
|
+
}
|
|
18188
|
+
}
|
|
18168
18189
|
function unsafePath(bundlePath, why) {
|
|
18169
18190
|
return new KensoError({
|
|
18170
18191
|
code: "unsafe_path",
|
|
@@ -18194,7 +18215,7 @@ async function mapLimit(items, limit, fn) {
|
|
|
18194
18215
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
18195
18216
|
return out;
|
|
18196
18217
|
}
|
|
18197
|
-
var TEXT_MAX_BYTES, UPLOAD_MAX_BYTES, utf8, TOP_FILES, ASSET_TYPES, SAMPLE_NAME, TOOL_CONFIG_NAMES, NAME, WINDOWS_DEVICE, LAYOUT, PULL_STATE, sha2563, CONTENT_TYPES2;
|
|
18218
|
+
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;
|
|
18198
18219
|
var init_folder2 = __esm({
|
|
18199
18220
|
"src/commands/studio/folder.ts"() {
|
|
18200
18221
|
"use strict";
|
|
@@ -18243,9 +18264,12 @@ var init_folder2 = __esm({
|
|
|
18243
18264
|
"pyrightconfig.json",
|
|
18244
18265
|
"cypress.json"
|
|
18245
18266
|
]);
|
|
18267
|
+
SAMPLE_KEYS = /* @__PURE__ */ new Set(["account", "person", "sender", "brand", "link", "data", "role", "roles"]);
|
|
18268
|
+
SAMPLE_JSON = /^samples\/[^/]+\.json$/i;
|
|
18269
|
+
strictUtf8 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
18246
18270
|
NAME = /^[A-Za-z0-9_-](?:[A-Za-z0-9._-]*[A-Za-z0-9_-])?$/;
|
|
18247
18271
|
WINDOWS_DEVICE = /^(?:CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])(?:\.|$)/i;
|
|
18248
|
-
LAYOUT = "studio.json, template.liquid, fallback.liquid, README.md, brief.md, ideas.md, 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)";
|
|
18272
|
+
LAYOUT = "studio.json, template.liquid, fallback.liquid, README.md, brief.md, ideas.md, 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)";
|
|
18249
18273
|
PULL_STATE = ".kenso-pull.json";
|
|
18250
18274
|
sha2563 = (bytes) => createHash7("sha256").update(bytes).digest("hex");
|
|
18251
18275
|
CONTENT_TYPES2 = {
|
|
@@ -18386,7 +18410,7 @@ var init_pull = __esm({
|
|
|
18386
18410
|
action: "pull",
|
|
18387
18411
|
summary: "Write a template version's files to a folder",
|
|
18388
18412
|
effect: "read",
|
|
18389
|
-
description: `Reads GET /v1/asset-templates/{templateId}/pull and writes every file under --dir: text files from the answer, binaries downloaded from their signed links. It replaces an existing file only when an earlier pull wrote it or a push sent it and it has not changed since (${PULL_STATE} in the folder records both), or with --force; other files in the folder are left alone. Every path is checked before anything is written: one that is not a file of the Studio bundle layout (studio.json, template.liquid, fallback.liquid, README.md, brief.md, ideas.md, assets/, samples/), would land outside --dir, or passes through a symbolic link is refused. --template-version picks the version: draft, latest (published) or a version id; the default is the draft, else the latest published version. --dry-run lists the paths, and the files it would not replace, without writing or downloading anything.`,
|
|
18413
|
+
description: `Reads GET /v1/asset-templates/{templateId}/pull and writes every file under --dir: text files from the answer, binaries downloaded from their signed links. It replaces an existing file only when an earlier pull wrote it or a push sent it and it has not changed since (${PULL_STATE} in the folder records both), or with --force; other files in the folder are left alone. Every path is checked before anything is written: one that is not a file of the Studio bundle layout (studio.json, template.liquid, fallback.liquid, README.md, brief.md, ideas.md, assets/, samples/), would land outside --dir, or passes through a symbolic link is refused, and so is a samples/ .json that is not one object with only the keys account, person, sender, brand, link, data, role and roles. --template-version picks the version: draft, latest (published) or a version id; the default is the draft, else the latest published version. --dry-run lists the paths, and the files it would not replace, without writing or downloading anything.`,
|
|
18390
18414
|
flags: {
|
|
18391
18415
|
dir: { type: "string", required: true, description: "The folder to write the files to (created when missing)" },
|
|
18392
18416
|
"template-version": { type: "string", description: "draft, latest or a version id (default: the draft, else the latest published)" },
|
|
@@ -18413,9 +18437,10 @@ var init_pull = __esm({
|
|
|
18413
18437
|
});
|
|
18414
18438
|
const pulled = unwrap(res.body) ?? {};
|
|
18415
18439
|
if (pulled.skipped?.length) {
|
|
18416
|
-
ctx.output.warn(`Kenso left out ${pulled.skipped.length} stored file${pulled.skipped.length === 1 ? "" : "s"} outside the bundle layout: ${pulled.skipped.join(", ")}.`);
|
|
18440
|
+
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, or a sample .json that does not hold a sample): ${pulled.skipped.join(", ")}.`);
|
|
18417
18441
|
}
|
|
18418
18442
|
const files = Object.entries(pulled.files ?? {}).map(([path, file]) => ({ path, file, target: safeJoin(dir3, path) }));
|
|
18443
|
+
for (const { path, file } of files) checkPulledSample(path, file.text);
|
|
18419
18444
|
const missing2 = files.find(({ file }) => typeof file.text !== "string" && !file.downloadUrl);
|
|
18420
18445
|
if (missing2) {
|
|
18421
18446
|
throw new KensoError({ code: "pull_incomplete", message: `${missing2.path} came back with neither text nor a download link.`, exitCode: ExitCode.Server });
|
|
@@ -18523,7 +18548,7 @@ var init_push = __esm({
|
|
|
18523
18548
|
action: "push",
|
|
18524
18549
|
summary: "Save a folder's files to a template's draft and print the validation",
|
|
18525
18550
|
effect: "write",
|
|
18526
|
-
description: "Reads the files of the Studio bundle layout in --dir: studio.json, template.liquid, fallback.liquid, README.md, brief.md, ideas.md, assets/ (images, fonts, pdf, csv) and samples/ (.json, .csv, named in lowercase, never a tool's config name such as package.json). Anything else is skipped, with a note for each file or folder that is not a dotfile or node_modules. Text files (valid UTF-8, no NUL byte, under 1 MB) go inline; every other file is uploaded through a signed upload URL first, 4 at a time, up to 5 MB each. Then one push saves them into the draft and prints the validation result. Files not in the folder stay in the draft unless --delete-missing. With --publish, the new version is published when validation passes. Exit 2 when validation finds errors (the draft is still saved). --dry-run only lists the files a push would send; kenso studio validate checks them without saving.",
|
|
18551
|
+
description: "Reads the files of the Studio bundle layout in --dir: studio.json, template.liquid, fallback.liquid, README.md, brief.md, ideas.md, assets/ (images, fonts, pdf, csv) and samples/ (.json, .csv, named in lowercase, 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). Anything else is skipped, with a note for each file or folder that is not a dotfile or node_modules. Text files (valid UTF-8, no NUL byte, under 1 MB) go inline; every other file is uploaded through a signed upload URL first, 4 at a time, up to 5 MB each. Then one push saves them into the draft and prints the validation result. Files not in the folder stay in the draft unless --delete-missing. With --publish, the new version is published when validation passes. Exit 2 when validation finds errors (the draft is still saved). --dry-run only lists the files a push would send; kenso studio validate checks them without saving.",
|
|
18527
18552
|
flags: {
|
|
18528
18553
|
dir: { type: "string", required: true, description: "The template folder" },
|
|
18529
18554
|
"delete-missing": { type: "boolean", description: "Make the draft hold exactly the folder's files" },
|