kenso 0.1.49 → 0.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/dist/kenso.js +23 -11
- package/dist/operations.json +1 -1
- package/docs/auth.md +2 -2
- package/docs/reference.md +29 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -20,6 +20,7 @@ What changed in the kenso CLI, newest first, by the day it changed. A new versio
|
|
|
20
20
|
- kenso webhooks listen and trigger for local handler development
|
|
21
21
|
- agent setup declares its --dry-run plan, as every command now must
|
|
22
22
|
- kenso agent setup installs the skill and registers the Kenso MCP server in one step
|
|
23
|
+
- accept kenso_live_ keys and redact them
|
|
23
24
|
- refuse --dry-run where a command has none, preview api and mcp call
|
|
24
25
|
|
|
25
26
|
## 2026-11-13
|
package/dist/kenso.js
CHANGED
|
@@ -94,13 +94,14 @@ var init_exit_codes = __esm({
|
|
|
94
94
|
|
|
95
95
|
// src/core/redact.ts
|
|
96
96
|
function redact(text3) {
|
|
97
|
-
return text3.replace(KEY_PATTERN, "ken_***").replace(RUN_TOKEN_PATTERN, "krt_***").replace(BEARER_PATTERN, "$1***").replace(AUTH_HEADER_PATTERN, "$1***");
|
|
97
|
+
return text3.replace(KEY_PATTERN, "ken_***").replace(KENSO_KEY_PATTERN, "$1***").replace(RUN_TOKEN_PATTERN, "krt_***").replace(BEARER_PATTERN, "$1***").replace(AUTH_HEADER_PATTERN, "$1***");
|
|
98
98
|
}
|
|
99
|
-
var KEY_PATTERN, RUN_TOKEN_PATTERN, BEARER_PATTERN, AUTH_HEADER_PATTERN;
|
|
99
|
+
var KEY_PATTERN, KENSO_KEY_PATTERN, RUN_TOKEN_PATTERN, BEARER_PATTERN, AUTH_HEADER_PATTERN;
|
|
100
100
|
var init_redact = __esm({
|
|
101
101
|
"src/core/redact.ts"() {
|
|
102
102
|
"use strict";
|
|
103
103
|
KEY_PATTERN = /ken_[A-Za-z0-9_-]{43,}/g;
|
|
104
|
+
KENSO_KEY_PATTERN = /(kenso_(?:live|test)_)[A-Za-z0-9]{49,}/g;
|
|
104
105
|
RUN_TOKEN_PATTERN = /krt_[A-Za-z0-9_-]{43,}/g;
|
|
105
106
|
BEARER_PATTERN = /\b(Bearer\s+)[^\s"',;]+/gi;
|
|
106
107
|
AUTH_HEADER_PATTERN = /\b(Authorization["']?\s*[:=]\s*["']?(?!Bearer\b)[A-Za-z]+\s+)[^\s"',;]+/gi;
|
|
@@ -2420,7 +2421,7 @@ var VERSION;
|
|
|
2420
2421
|
var init_version = __esm({
|
|
2421
2422
|
"src/core/version.ts"() {
|
|
2422
2423
|
"use strict";
|
|
2423
|
-
VERSION = true ? "0.1.
|
|
2424
|
+
VERSION = true ? "0.1.50" : "0.0.0-dev";
|
|
2424
2425
|
}
|
|
2425
2426
|
});
|
|
2426
2427
|
|
|
@@ -7215,7 +7216,7 @@ var init_agents = __esm({
|
|
|
7215
7216
|
var auth_default;
|
|
7216
7217
|
var init_auth = __esm({
|
|
7217
7218
|
"docs/auth.md"() {
|
|
7218
|
-
auth_default = '# Authentication\n\nThe CLI calls the Kenso API with a Kenso API key (`ken_` plus 43 characters). It sends the key as `Authorization: Bearer <key>` and never prints it, logs it or puts it in an error.\n\n`kenso login`, `kenso logout` and `kenso whoami` are the same commands as `kenso auth login`, `kenso auth logout` and `kenso auth status`.\n\n## Log in with an API key\n\n1. In app.ken.so, go to Settings > Integrations > API keys and create a key.\n2. Pipe it to `kenso auth login --with-key`. The key is read from stdin, never from a flag, so it stays out of your shell history and process list.\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso auth login --with-key --profile client-a --workspace 1234 < key.txt\n```\n\nThe CLI checks the key with `GET /v1/me`, then saves it to `~/.kenso/config.json` (file mode 0600, folder mode 0700). It prints:\n\n```json\n{"profile":"default","email":"you@acme.io","workspaceId":"1234","workspaceCount":1}\n```\n\nWhen the key reaches several workspaces and you did not pass `--workspace`, no workspace is saved and the output carries `"next":"kenso workspace list --search <name>"`. A key in the wrong format exits 2 (`invalid_key_format`). A key Kenso rejects exits 3.\n\n## Browser login\n\n```bash\nkenso auth login\nkenso auth login --no-browser --device-name "build box"\n```\n\nBrowser login is available to every workspace. The CLI prints a link and a code on stderr. You open the link, sign in to app.ken.so, check that the code matches the one in your terminal, pick the workspace to start in and approve. The CLI then saves a new API key to the profile and prints:\n\n```json\n{"profile":"default","email":"you@acme.io","workspaceId":"1234","keyExpiresAt":"2027-02-02T06:26:59Z"}\n```\n\nThe key is the same kind you create in the app. It is named `Kenso CLI - <device name>` (`--device-name`, else `kenso-cli on <hostname>`), lasts 90 days, and shows in your API key list at Settings > Integrations > API keys, where you can revoke it. The CLI opens the browser itself only when no coding agent is detected and the machine has a display. An agent prints the link and asks you to open it. The login expires after 10 minutes (`login_expired`, exit 3), and a denied login exits 3 with `access_denied`. If the API answers that browser login is off (`browser_login_unavailable`, exit 3, `"next":"kenso auth login --with-key"`), log in with an API key as above.\n\n## CI, scripts and agents: use the environment\n\nYou do not need to log in on a machine that has the key in its environment:\n\n```bash\nexport KENSO_API_KEY=
|
|
7219
|
+
auth_default = '# Authentication\n\nThe CLI calls the Kenso API with a Kenso API key (`kenso_live_` plus 49 characters, or an older key: `ken_` plus 43 characters). It sends the key as `Authorization: Bearer <key>` and never prints it, logs it or puts it in an error.\n\n`kenso login`, `kenso logout` and `kenso whoami` are the same commands as `kenso auth login`, `kenso auth logout` and `kenso auth status`.\n\n## Log in with an API key\n\n1. In app.ken.so, go to Settings > Integrations > API keys and create a key.\n2. Pipe it to `kenso auth login --with-key`. The key is read from stdin, never from a flag, so it stays out of your shell history and process list.\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso auth login --with-key --profile client-a --workspace 1234 < key.txt\n```\n\nThe CLI checks the key with `GET /v1/me`, then saves it to `~/.kenso/config.json` (file mode 0600, folder mode 0700). It prints:\n\n```json\n{"profile":"default","email":"you@acme.io","workspaceId":"1234","workspaceCount":1}\n```\n\nWhen the key reaches several workspaces and you did not pass `--workspace`, no workspace is saved and the output carries `"next":"kenso workspace list --search <name>"`. A key in the wrong format exits 2 (`invalid_key_format`). A key Kenso rejects exits 3.\n\n## Browser login\n\n```bash\nkenso auth login\nkenso auth login --no-browser --device-name "build box"\n```\n\nBrowser login is available to every workspace. The CLI prints a link and a code on stderr. You open the link, sign in to app.ken.so, check that the code matches the one in your terminal, pick the workspace to start in and approve. The CLI then saves a new API key to the profile and prints:\n\n```json\n{"profile":"default","email":"you@acme.io","workspaceId":"1234","keyExpiresAt":"2027-02-02T06:26:59Z"}\n```\n\nThe key is the same kind you create in the app. It is named `Kenso CLI - <device name>` (`--device-name`, else `kenso-cli on <hostname>`), lasts 90 days, and shows in your API key list at Settings > Integrations > API keys, where you can revoke it. The CLI opens the browser itself only when no coding agent is detected and the machine has a display. An agent prints the link and asks you to open it. The login expires after 10 minutes (`login_expired`, exit 3), and a denied login exits 3 with `access_denied`. If the API answers that browser login is off (`browser_login_unavailable`, exit 3, `"next":"kenso auth login --with-key"`), log in with an API key as above.\n\n## CI, scripts and agents: use the environment\n\nYou do not need to log in on a machine that has the key in its environment:\n\n```bash\nexport KENSO_API_KEY=kenso_live_...\nexport KENSO_WORKSPACE_ID=1234\nkenso auth status\n```\n\n`KENSO_API_KEY` wins over any saved profile. Store it as a secret in your CI or agent platform, never in a file in the repo.\n\n## Workspaces\n\nA key reaches every workspace its user belongs to. Each command runs in one workspace, picked in this order:\n\n1. `--workspace <id>` on the command\n2. `KENSO_WORKSPACE_ID`\n3. the workspace saved in the profile (`kenso workspace use`)\n\n```bash\nkenso workspace list --search acme\nkenso workspace use 1234\nkenso campaigns list --workspace 5678\n```\n\n`workspace list` prints one page and says on stderr when there are more: add `--all` for every page. A command that needs a workspace when none is picked fails with `workspace_required` (exit 2) and `"next":"kenso workspace list --search <name>"`.\n\n## Profiles\n\nA profile holds a key, a workspace, an optional API URL and the email. Use one per client or per key:\n\n```bash\nkenso auth login --with-key --profile client-a < client-a-key.txt\nkenso campaigns list --profile client-a\nKENSO_PROFILE=client-a kenso auth status\n```\n\nThe profile is `--profile`, else `KENSO_PROFILE`, else the active one (the last one you logged in to).\n\n## Check the setup\n\n```bash\nkenso auth status\nkenso doctor\n```\n\n`auth status` prints who the key belongs to and when it expires, and warns on stderr when that is within 14 days:\n\n```json\n{"email":"you@acme.io","workspaceCount":3,"activeWorkspace":{"id":"1234","name":"Acme"},"keyExpiresAt":"2027-01-31T00:00:00Z","keySource":"profile","profile":"default"}\n```\n\n`doctor` prints the version, Node, the config folder, the profile, the key source, the API URL, the workspace and the detected agent, then four checks: `node_version`, `config_permissions`, `api_reachable` and `key_valid`. It exits 0 when every check passes, 3 when the key is missing or rejected, else 1.\n\n## Log out\n\n```bash\nkenso auth logout\nkenso auth logout --profile client-a\nkenso auth logout --keep-key\n```\n\nThis removes the profile and its key from this machine. When browser login made the key, logout revokes it first, so it stops working everywhere; `--keep-key` leaves it valid. If the revoke fails (no network, or the key was already revoked), logout warns and still removes the profile. A key you saved with `--with-key` was made by you in the app, so logout leaves it valid: revoke it at Settings > Integrations > API keys. The output adds `revoked: true` or `false`.\n\n## Where things live\n\n| What | Default | Override |\n|---|---|---|\n| Config file with profiles and keys | `~/.kenso/config.json` | `KENSO_CONFIG_DIR` |\n| Run folders | `~/.kenso/runs/` | `KENSO_RUNS_DIR` |\n| Cached workspace features (1 hour) | `~/.kenso/cache/` | follows `KENSO_CONFIG_DIR` |\n| Last update check (once every 7 days) | `~/.kenso/update-check.json` | follows `KENSO_CONFIG_DIR`; `KENSO_NO_UPDATE_NOTIFIER=1` turns the check off |\n| API | `https://api.ken.so` | `KENSO_API_URL` |\n| MCP (for `kenso mcp`) | `https://mcp.ken.so/mcp` | `KENSO_MCP_URL` |\n\n`--verbose` prints each request line to stderr with the key redacted.\n';
|
|
7219
7220
|
}
|
|
7220
7221
|
});
|
|
7221
7222
|
|
|
@@ -8121,6 +8122,15 @@ var init_api3 = __esm({
|
|
|
8121
8122
|
}
|
|
8122
8123
|
});
|
|
8123
8124
|
|
|
8125
|
+
// src/core/api-key.ts
|
|
8126
|
+
var API_KEY_PATTERN;
|
|
8127
|
+
var init_api_key = __esm({
|
|
8128
|
+
"src/core/api-key.ts"() {
|
|
8129
|
+
"use strict";
|
|
8130
|
+
API_KEY_PATTERN = /^(?:kenso_(?:live|test)_[A-Za-z0-9]{49}|ken_[A-Za-z0-9_-]{43})$/;
|
|
8131
|
+
}
|
|
8132
|
+
});
|
|
8133
|
+
|
|
8124
8134
|
// src/commands/auth/browser-login.ts
|
|
8125
8135
|
import { spawn as nodeSpawn } from "node:child_process";
|
|
8126
8136
|
import { hostname as osHostname } from "node:os";
|
|
@@ -8367,21 +8377,21 @@ function invalidKey(message) {
|
|
|
8367
8377
|
message,
|
|
8368
8378
|
exitCode: ExitCode.Usage,
|
|
8369
8379
|
field: "stdin",
|
|
8370
|
-
hint: "A Kenso API key is ken_ followed by 43 letters, digits, _ or
|
|
8380
|
+
hint: "A Kenso API key is kenso_live_ followed by 49 letters and digits (a key made before the change is ken_ followed by 43 letters, digits, _ or -). Create one at Settings > Integrations > API keys in app.ken.so.",
|
|
8371
8381
|
next: PIPE_EXAMPLE
|
|
8372
8382
|
});
|
|
8373
8383
|
}
|
|
8374
|
-
var
|
|
8384
|
+
var MAX_KEY_INPUT_BYTES, PIPE_EXAMPLE, command5, login_default;
|
|
8375
8385
|
var init_login = __esm({
|
|
8376
8386
|
"src/commands/auth/login.ts"() {
|
|
8377
8387
|
"use strict";
|
|
8388
|
+
init_api_key();
|
|
8378
8389
|
init_config();
|
|
8379
8390
|
init_errors();
|
|
8380
8391
|
init_exit_codes();
|
|
8381
8392
|
init_http();
|
|
8382
8393
|
init_input();
|
|
8383
8394
|
init_browser_login();
|
|
8384
|
-
KEY_PATTERN2 = /^ken_[A-Za-z0-9_-]{43}$/;
|
|
8385
8395
|
MAX_KEY_INPUT_BYTES = 4096;
|
|
8386
8396
|
PIPE_EXAMPLE = `printf '%s' "$KENSO_API_KEY" | kenso auth login --with-key`;
|
|
8387
8397
|
command5 = {
|
|
@@ -8426,7 +8436,7 @@ var init_login = __esm({
|
|
|
8426
8436
|
}
|
|
8427
8437
|
const key = (text3.trim().split(/\r?\n/)[0] ?? "").trim();
|
|
8428
8438
|
if (key === "") throw invalidKey("stdin was empty: pipe the API key in.");
|
|
8429
|
-
if (!
|
|
8439
|
+
if (!API_KEY_PATTERN.test(key)) throw invalidKey("stdin does not hold a Kenso API key.");
|
|
8430
8440
|
let body;
|
|
8431
8441
|
try {
|
|
8432
8442
|
const res = await ctx.client.request({
|
|
@@ -14381,6 +14391,8 @@ var init_scan = __esm({
|
|
|
14381
14391
|
/\bAKIA[0-9A-Z]{16}\b/,
|
|
14382
14392
|
// AWS access key
|
|
14383
14393
|
/\bken_[A-Za-z0-9_-]{43,}/,
|
|
14394
|
+
// Kenso API key (legacy)
|
|
14395
|
+
/\bkenso_(?:live|test)_[A-Za-z0-9]{49,}/,
|
|
14384
14396
|
// Kenso API key
|
|
14385
14397
|
/\bapk_[A-Za-z0-9_-]{16,}/,
|
|
14386
14398
|
// Kenso API key id
|
|
@@ -14905,7 +14917,7 @@ async function fetchAgentKey(ctx, headers) {
|
|
|
14905
14917
|
throw agentKeyFailed(`Kenso did not give this run its agent key (${status}), so the run stopped before any work was claimed.`);
|
|
14906
14918
|
}
|
|
14907
14919
|
const data = unwrap(body);
|
|
14908
|
-
if (!isRecord7(data) || typeof data.apiKey !== "string" || !
|
|
14920
|
+
if (!isRecord7(data) || typeof data.apiKey !== "string" || !API_KEY_PATTERN.test(data.apiKey)) {
|
|
14909
14921
|
throw agentKeyFailed("Kenso's answer held no agent key, so the run stopped before any work was claimed.");
|
|
14910
14922
|
}
|
|
14911
14923
|
return { apiKey: data.apiKey, expiresAt: typeof data.expiresAt === "string" ? data.expiresAt : "" };
|
|
@@ -14917,10 +14929,11 @@ async function prepareAgentTools(ctx, headers, scanner, agentName2) {
|
|
|
14917
14929
|
const agentEnv = agentKensoEnv({ apiKey: key?.apiKey, apiUrl: ctx.auth.apiUrl, workspaceId: ctx.auth.workspaceId ?? "", agentName: agentName2 });
|
|
14918
14930
|
return { agentEnv, guide: agentGuide({ kensoKey: key !== void 0 }) };
|
|
14919
14931
|
}
|
|
14920
|
-
var BOX_FLAGS, RUN_TOKEN, MAX_TOKEN_INPUT_BYTES
|
|
14932
|
+
var BOX_FLAGS, RUN_TOKEN, MAX_TOKEN_INPUT_BYTES;
|
|
14921
14933
|
var init_box = __esm({
|
|
14922
14934
|
"src/commands/work/box.ts"() {
|
|
14923
14935
|
"use strict";
|
|
14936
|
+
init_api_key();
|
|
14924
14937
|
init_errors();
|
|
14925
14938
|
init_exit_codes();
|
|
14926
14939
|
init_http();
|
|
@@ -14947,7 +14960,6 @@ var init_box = __esm({
|
|
|
14947
14960
|
};
|
|
14948
14961
|
RUN_TOKEN = /^krt_[A-Za-z0-9_-]{43}$/;
|
|
14949
14962
|
MAX_TOKEN_INPUT_BYTES = 4096;
|
|
14950
|
-
AGENT_KEY = /^ken_[A-Za-z0-9_-]{43}$/;
|
|
14951
14963
|
}
|
|
14952
14964
|
});
|
|
14953
14965
|
|