kenso 0.1.43 → 0.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/kenso.js CHANGED
@@ -2413,7 +2413,7 @@ var VERSION;
2413
2413
  var init_version = __esm({
2414
2414
  "src/core/version.ts"() {
2415
2415
  "use strict";
2416
- VERSION = true ? "0.1.43" : "0.0.0-dev";
2416
+ VERSION = true ? "0.1.44" : "0.0.0-dev";
2417
2417
  }
2418
2418
  });
2419
2419
 
@@ -7109,7 +7109,7 @@ var init_accounts = __esm({
7109
7109
  var agents_default;
7110
7110
  var init_agents = __esm({
7111
7111
  "docs/agents.md"() {
7112
- agents_default = '# Coding agents\n\nThe CLI is built to be driven by a coding agent: Claude Code, Codex, Cursor, Gemini CLI or anything else that runs shell commands. An agent learns it from the Agent Skill, `kenso --help` and `kenso describe`, and never needs these web pages.\n\n## Set up an agent in three steps\n\n1. Install the CLI where the agent runs: `npm i -g kenso` (Node 22 or newer). Without a global install, `npx -y kenso@latest <command>` runs any command.\n2. Give it a key. Either set `KENSO_API_KEY` (and `KENSO_WORKSPACE_ID` when the key reaches several workspaces) in the agent\'s environment, or log in once on that machine:\n\n```bash\nkenso auth login\nkenso workspace use 1234\n```\n\n3. Install the Agent Skill and connect the Kenso MCP server in one step, then check everything:\n\n```bash\nkenso agent setup\nkenso agent setup -y\nkenso doctor\n```\n\nTo hand the whole setup to an agent, give it https://ken.so/get-started.md: it runs these steps and stops only where a person has to act.\n\n## kenso agent setup\n\n`kenso agent setup` installs the `kenso-cli` skill (as `kenso skill install` does) and registers the Kenso MCP server, `https://mcp.ken.so/mcp`, with each coding agent:\n\n| Agent | `--client` | MCP server added with |\n|---|---|---|\n| Claude Code | `claude-code` | `claude mcp add --scope user --transport http kenso https://mcp.ken.so/mcp` |\n| Codex | `codex` | `codex mcp add kenso --url https://mcp.ken.so/mcp` |\n| Cursor | `cursor` | a `kenso` entry in `~/.cursor/mcp.json` |\n| Gemini CLI | `gemini` | `gemini mcp add --scope user --transport http kenso https://mcp.ken.so/mcp` |\n| OpenCode | `opencode` | a `kenso` entry in `~/.config/opencode/opencode.json` |\n\n```bash\nkenso agent setup --client claude-code -y\nkenso agent setup --client all -y\nkenso agent setup --status --json\n```\n\n- Without `--client`, it sets up the agent that runs it, else every agent found on the machine (its command on `PATH` or its config folder present).\n- Without `-y` it prints the plan and changes nothing; the plan\'s `next` applies it. `--status` reports, for every agent, whether the skill is `installed`, `missing` or `different` and whether the MCP server is `registered`, `missing`, in `conflict` or `unknown` (a config file it cannot read as JSON), and changes nothing. `--json` prints JSON on a terminal too.\n- An MCP entry with the Kenso URL under another name (such as `ken-ai` from the plugin) counts as registered, and nothing is added. A `kenso` entry pointing at another URL is left alone (`conflict`). A config file that is not plain JSON (it has comments) is left alone (`skipped`), and so is an agent whose command is not on `PATH`: their `next` is the command or edit to make by hand.\n- A different `SKILL.md` in the way stops the run before any change (exit 7) until you add `--force`.\n- It exits 1 when any agent was not fully set up. The MCP server signs in with your Kenso account in the browser the first time the agent uses it; each agent\'s `next` says how (in Claude Code, `/mcp`).\n\n## An AGENTS.md section for your repo\n\nPaste this into the `AGENTS.md` (or `CLAUDE.md`) of a repo whose agents work in Kenso:\n\n```markdown\n## Kenso\n\n- Kenso is our outbound platform. One record or a question: use the Kenso MCP server (https://mcp.ken.so/mcp). A file or more than about 50 records: use the `kenso` CLI.\n- Setup: `npm i -g kenso`, `kenso auth login` (a person approves in the browser), `kenso agent setup -y`, `kenso doctor`.\n- Every write runs first with `--dry-run`; apply with the plan\'s `next`. Never put an API key in a flag, a file or the chat: use `KENSO_API_KEY`.\n- Code that calls the API: send `Authorization: Bearer $KENSO_API_KEY`, `Ken-Version` and `X-Ken-Workspace-Id`. Reference: https://ken.so/docs.md; the kenso-api skill: https://ken.so/.well-known/skills/index.json.\n```\n\n## The Agent Skill\n\n`kenso skill install` writes the skill `kenso-cli` (one `SKILL.md`) where each agent looks for skills:\n\n| Agent | `--client` | Folder |\n|---|---|---|\n| Claude Code | `claude-code` | `~/.claude/skills/kenso-cli/` |\n| Codex | `codex` | `~/.agents/skills/kenso-cli/` |\n| Cursor | `cursor` | `~/.cursor/skills/kenso-cli/` |\n| Gemini CLI | `gemini` | `~/.gemini/skills/kenso-cli/` |\n| OpenCode | `opencode` | `~/.config/opencode/skills/kenso-cli/` |\n\nClaude Code\'s folder follows `CLAUDE_CONFIG_DIR` when that is set. Without `--client`, it installs for the agent that runs it when that is Claude Code, Codex or Cursor (detected from the environment, see below), else for all five. It prints what it wrote:\n\n```json\n{"installed":[{"client":"claude-code","path":"/home/you/.claude/skills/kenso-cli/SKILL.md","status":"created"}]}\n```\n\n```bash\nkenso skill install --client claude-code\nkenso skill install --client all\nkenso skill install --dir .claude/skills/kenso-cli\nkenso skill install --force\n```\n\n- `--dir` writes the skill into that folder instead, for example a project\'s own skills folder. Name the folder `kenso-cli`, as agents expect the folder to match the skill name.\n- A different `SKILL.md` already in a target folder is replaced only with `--force`; without it the command exits 7, writes nothing, and its `next` adds `--force`. The same file is left alone (`"status":"unchanged"`).\n- `--dry-run` writes nothing and exits 0. It prints each target\'s status (`replaced` marks a different file there) and a `next` that applies it, with `--force` when a file would be replaced.\n- Cursor also reads `~/.claude/skills/` and `~/.agents/skills/` (Gemini CLI and OpenCode read `~/.agents/skills/` too), so after a default install for all of them an agent may list `kenso-cli` more than once. To avoid that, install with `--client cursor` only, or remove the copies you do not need.\n\nThe skill also ships in the Kenso plugin for Claude Code (`Ken-Technology/ken-ai-plugin`), so `npx skills add Ken-Technology/ken-ai-plugin` installs it along with the MCP skills. The plugin\'s copy is this file byte for byte. To read it without installing, open `skill/kenso-cli/SKILL.md` in the package.\n\n## Rules the skill teaches\n\n- **Data is on stdout, as JSON when piped.** Progress, warnings and errors are on stderr. Parse stdout; read stderr when the exit code is not 0.\n- **Plan, then apply.** Run a write with `--dry-run`, read the plan, then run the exact command in its `next` (the same command with `--yes`). A command with no dry run refuses `--dry-run` with `usage_error` and does nothing.\n- **Pass files, not rows.** Never paste a CSV into the conversation. Write the file, pass its path with `--file`, and read the summary.\n- **Read failures only.** If the summary\'s `failed`, `notFound` and `invalid` are 0, the work is done. Otherwise read just the problem rows from `results.csv` or `invalid.csv`.\n- **Follow `next`.** Every error with a known fix carries the exact command to run.\n- **Branch on the exit code:** 0 ok, 2 fix the command, 3 fix the key, 5 some rows failed, 6 wait or raise a limit, 130 resume.\n- **Look things up, do not guess.** `kenso describe <resource> <action>` prints any command\'s flags and body schema as JSON.\n\n## The token-saving pattern\n\nAdding 5,000 leads through the MCP sends every lead through the model, hundreds of thousands of tokens. Through the CLI it is two commands and two short JSON objects:\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\nThen, only if the summary shows failures:\n\n```bash\ngrep -E \'^[0-9]+,(failed|not_found|invalid),\' ~/.kenso/runs/r_tdi5cdnx/results.csv | head -50\n```\n\n## Environment variables\n\n| Variable | What it does |\n|---|---|\n| `KENSO_API_KEY` | The API key. Wins over any saved profile |\n| `KENSO_WORKSPACE_ID` | The workspace for every command. `--workspace` wins over it |\n| `KENSO_PROFILE` | The saved profile to use. `--profile` wins over it |\n| `KENSO_API_URL` | The API, default `https://api.ken.so` |\n| `KENSO_CONFIG_DIR` | Where the config file and cache live, default `~/.kenso` |\n| `KENSO_RUNS_DIR` | Where run folders live, default `<config dir>/runs` |\n| `KENSO_MCP_URL` | The MCP for `kenso mcp`, default `https://mcp.ken.so/mcp` |\n\n## Cloud sandboxes\n\nCloud agents (Claude Code on the web, Codex cloud, Cursor background agents and similar) often run with a network allowlist. Allow:\n\n- `api.ken.so`: every command\n- `mcp.ken.so`: only `kenso mcp tools` and `kenso mcp call`\n- `registry.npmjs.org`: to install the CLI with npm\n\nStore the key as the platform\'s secret and expose it as `KENSO_API_KEY`. Run `kenso doctor` as the first command: it checks Node, the config, that the API is reachable and that the key works, and exits 0 when all four pass.\n\n```bash\nkenso doctor\n```\n\nPoint the run folders at the workspace if the home folder does not persist between sessions: `KENSO_RUNS_DIR=./.kenso-runs`. Keep that folder out of git.\n\n## How Kenso knows an agent ran a command\n\nThe CLI checks these environment variables, in this order: `CLAUDECODE` and `CLAUDE_CODE_ENTRYPOINT` (Claude Code), `CODEX_SANDBOX` and `CODEX_THREAD_ID` (Codex), `CURSOR_AGENT` (Cursor), `GEMINI_CLI` (Gemini CLI), `OPENCODE` (OpenCode), then `AI_AGENT`, a free-form name any other agent can set. When one is set:\n\n- every request carries `X-Ken-Client: Kenso CLI via <agent>`, and writes carry `X-Ken-Actor: agent`, so Kenso shows the change as made by you through that agent;\n- help ends with a short "For agents" block;\n- browser login never opens a browser itself: it prints the link for you to open.\n\n`kenso doctor` shows the agent it detected.\n\n## MCP-only tools\n\nA few Kenso MCP tools have no API route, such as the skills Kenso\'s own agents use. Reach them from the shell with the same key:\n\n```bash\nkenso mcp tools\nkenso mcp call list_skills\nkenso mcp call load_skill --args \'{"name":"create-campaign"}\'\nkenso mcp call contacts_read --operation list --args \'{"limit":5}\'\n```\n\n`mcp call` prints the tool\'s structured result, else its text parsed as JSON, else the text. A tool error exits 1 with `mcp_tool_error`.\n';
7112
+ agents_default = '# Coding agents\n\nThe CLI is built to be driven by a coding agent: Claude Code, Codex, Cursor, Gemini CLI or anything else that runs shell commands. An agent learns it from the Agent Skill, `kenso --help` and `kenso describe`, and never needs these web pages.\n\n## Set up an agent in three steps\n\n1. Install the CLI where the agent runs: `npm i -g kenso` (Node 22 or newer). Without a global install, `npx -y kenso@latest <command>` runs any command.\n2. Give it a key. Either set `KENSO_API_KEY` (and `KENSO_WORKSPACE_ID` when the key reaches several workspaces) in the agent\'s environment, or log in once on that machine:\n\n```bash\nkenso auth login\nkenso workspace use 1234\n```\n\n3. Install the Agent Skill and connect the Kenso MCP server in one step, then check everything:\n\n```bash\nkenso agent setup\nkenso agent setup -y\nkenso doctor\n```\n\nTo hand the whole setup to an agent, give it [ken.so/get-started.md](https://ken.so/get-started.md): it runs these steps and stops only where a person has to act.\n\n## kenso agent setup\n\n`kenso agent setup` installs the `kenso-cli` skill (as `kenso skill install` does) and registers the Kenso MCP server, `https://mcp.ken.so/mcp`, with each coding agent:\n\n| Agent | `--client` | MCP server added with |\n|---|---|---|\n| Claude Code | `claude-code` | `claude mcp add --scope user --transport http kenso https://mcp.ken.so/mcp` |\n| Codex | `codex` | `codex mcp add kenso --url https://mcp.ken.so/mcp` |\n| Cursor | `cursor` | a `kenso` entry in `~/.cursor/mcp.json` |\n| Gemini CLI | `gemini` | `gemini mcp add --scope user --transport http kenso https://mcp.ken.so/mcp` |\n| OpenCode | `opencode` | a `kenso` entry in `~/.config/opencode/opencode.json` |\n\n```bash\nkenso agent setup --client claude-code -y\nkenso agent setup --client all -y\nkenso agent setup --status --json\n```\n\n- Without `--client`, it sets up the agent that runs it, else every agent found on the machine (its command on `PATH` or its config folder present).\n- Without `-y` it prints the plan and changes nothing; the plan\'s `next` applies it. `--status` reports, for every agent, whether the skill is `installed`, `missing` or `different` and whether the MCP server is `registered`, `missing`, in `conflict` or `unknown` (a config file it cannot read as JSON), and changes nothing. `--json` prints JSON on a terminal too.\n- An MCP entry with the Kenso URL under another name (such as `ken-ai` from the plugin) counts as registered, and nothing is added. A `kenso` entry pointing at another URL is left alone (`conflict`). A config file that is not plain JSON (it has comments) is left alone (`skipped`), and so is an agent whose command is not on `PATH`: their `next` is the command or edit to make by hand.\n- A different `SKILL.md` in the way stops the run before any change (exit 7) until you add `--force`.\n- It exits 1 when any agent was not fully set up. The MCP server signs in with your Kenso account in the browser the first time the agent uses it; each agent\'s `next` says how (in Claude Code, `/mcp`).\n\n## An AGENTS.md section for your repo\n\nPaste this into the `AGENTS.md` (or `CLAUDE.md`) of a repo whose agents work in Kenso:\n\n```markdown\n## Kenso\n\n- Kenso is our outbound platform. One record or a question: use the Kenso MCP server (https://mcp.ken.so/mcp). A file or more than about 50 records: use the `kenso` CLI.\n- Setup: `npm i -g kenso`, `kenso auth login` (a person approves in the browser), `kenso agent setup -y`, `kenso doctor`.\n- Every write runs first with `--dry-run`; apply with the plan\'s `next`. Never put an API key in a flag, a file or the chat: use `KENSO_API_KEY`.\n- Code that calls the API: send `Authorization: Bearer $KENSO_API_KEY`, `Ken-Version` and `X-Ken-Workspace-Id`. Reference: ken.so/docs.md; the kenso-api skill is listed at ken.so/.well-known/skills/index.json.\n```\n\n## The Agent Skill\n\n`kenso skill install` writes the skill `kenso-cli` (one `SKILL.md`) where each agent looks for skills:\n\n| Agent | `--client` | Folder |\n|---|---|---|\n| Claude Code | `claude-code` | `~/.claude/skills/kenso-cli/` |\n| Codex | `codex` | `~/.agents/skills/kenso-cli/` |\n| Cursor | `cursor` | `~/.cursor/skills/kenso-cli/` |\n| Gemini CLI | `gemini` | `~/.gemini/skills/kenso-cli/` |\n| OpenCode | `opencode` | `~/.config/opencode/skills/kenso-cli/` |\n\nClaude Code\'s folder follows `CLAUDE_CONFIG_DIR` when that is set. Without `--client`, it installs for the agent that runs it when that is Claude Code, Codex or Cursor (detected from the environment, see below), else for all five. It prints what it wrote:\n\n```json\n{"installed":[{"client":"claude-code","path":"/home/you/.claude/skills/kenso-cli/SKILL.md","status":"created"}]}\n```\n\n```bash\nkenso skill install --client claude-code\nkenso skill install --client all\nkenso skill install --dir .claude/skills/kenso-cli\nkenso skill install --force\n```\n\n- `--dir` writes the skill into that folder instead, for example a project\'s own skills folder. Name the folder `kenso-cli`, as agents expect the folder to match the skill name.\n- A different `SKILL.md` already in a target folder is replaced only with `--force`; without it the command exits 7, writes nothing, and its `next` adds `--force`. The same file is left alone (`"status":"unchanged"`).\n- `--dry-run` writes nothing and exits 0. It prints each target\'s status (`replaced` marks a different file there) and a `next` that applies it, with `--force` when a file would be replaced.\n- Cursor also reads `~/.claude/skills/` and `~/.agents/skills/` (Gemini CLI and OpenCode read `~/.agents/skills/` too), so after a default install for all of them an agent may list `kenso-cli` more than once. To avoid that, install with `--client cursor` only, or remove the copies you do not need.\n\nThe skill also ships in the Kenso plugin for Claude Code (`Ken-Technology/ken-ai-plugin`), so `npx skills add Ken-Technology/ken-ai-plugin` installs it along with the MCP skills. The plugin\'s copy is this file byte for byte. To read it without installing, open `skill/kenso-cli/SKILL.md` in the package.\n\n## Rules the skill teaches\n\n- **Data is on stdout, as JSON when piped.** Progress, warnings and errors are on stderr. Parse stdout; read stderr when the exit code is not 0.\n- **Plan, then apply.** Run a write with `--dry-run`, read the plan, then run the exact command in its `next` (the same command with `--yes`). A command with no dry run refuses `--dry-run` with `usage_error` and does nothing.\n- **Pass files, not rows.** Never paste a CSV into the conversation. Write the file, pass its path with `--file`, and read the summary.\n- **Read failures only.** If the summary\'s `failed`, `notFound` and `invalid` are 0, the work is done. Otherwise read just the problem rows from `results.csv` or `invalid.csv`.\n- **Follow `next`.** Every error with a known fix carries the exact command to run.\n- **Branch on the exit code:** 0 ok, 2 fix the command, 3 fix the key, 5 some rows failed, 6 wait or raise a limit, 130 resume.\n- **Look things up, do not guess.** `kenso describe <resource> <action>` prints any command\'s flags and body schema as JSON.\n\n## The token-saving pattern\n\nAdding 5,000 leads through the MCP sends every lead through the model, hundreds of thousands of tokens. Through the CLI it is two commands and two short JSON objects:\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\nThen, only if the summary shows failures:\n\n```bash\ngrep -E \'^[0-9]+,(failed|not_found|invalid),\' ~/.kenso/runs/r_tdi5cdnx/results.csv | head -50\n```\n\n## Environment variables\n\n| Variable | What it does |\n|---|---|\n| `KENSO_API_KEY` | The API key. Wins over any saved profile |\n| `KENSO_WORKSPACE_ID` | The workspace for every command. `--workspace` wins over it |\n| `KENSO_PROFILE` | The saved profile to use. `--profile` wins over it |\n| `KENSO_API_URL` | The API, default `https://api.ken.so` |\n| `KENSO_CONFIG_DIR` | Where the config file and cache live, default `~/.kenso` |\n| `KENSO_RUNS_DIR` | Where run folders live, default `<config dir>/runs` |\n| `KENSO_MCP_URL` | The MCP for `kenso mcp`, default `https://mcp.ken.so/mcp` |\n\n## Cloud sandboxes\n\nCloud agents (Claude Code on the web, Codex cloud, Cursor background agents and similar) often run with a network allowlist. Allow:\n\n- `api.ken.so`: every command\n- `mcp.ken.so`: only `kenso mcp tools` and `kenso mcp call`\n- `registry.npmjs.org`: to install the CLI with npm\n\nStore the key as the platform\'s secret and expose it as `KENSO_API_KEY`. Run `kenso doctor` as the first command: it checks Node, the config, that the API is reachable and that the key works, and exits 0 when all four pass.\n\n```bash\nkenso doctor\n```\n\nPoint the run folders at the workspace if the home folder does not persist between sessions: `KENSO_RUNS_DIR=./.kenso-runs`. Keep that folder out of git.\n\n## How Kenso knows an agent ran a command\n\nThe CLI checks these environment variables, in this order: `CLAUDECODE` and `CLAUDE_CODE_ENTRYPOINT` (Claude Code), `CODEX_SANDBOX` and `CODEX_THREAD_ID` (Codex), `CURSOR_AGENT` (Cursor), `GEMINI_CLI` (Gemini CLI), `OPENCODE` (OpenCode), then `AI_AGENT`, a free-form name any other agent can set. When one is set:\n\n- every request carries `X-Ken-Client: Kenso CLI via <agent>`, and writes carry `X-Ken-Actor: agent`, so Kenso shows the change as made by you through that agent;\n- help ends with a short "For agents" block;\n- browser login never opens a browser itself: it prints the link for you to open.\n\n`kenso doctor` shows the agent it detected.\n\n## MCP-only tools\n\nA few Kenso MCP tools have no API route, such as the skills Kenso\'s own agents use. Reach them from the shell with the same key:\n\n```bash\nkenso mcp tools\nkenso mcp call list_skills\nkenso mcp call load_skill --args \'{"name":"create-campaign"}\'\nkenso mcp call contacts_read --operation list --args \'{"limit":5}\'\n```\n\n`mcp call` prints the tool\'s structured result, else its text parsed as JSON, else the text. A tool error exits 1 with `mcp_tool_error`.\n';
7113
7113
  }
7114
7114
  });
7115
7115