kenso 0.1.155 → 0.1.156
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/discover.json +1 -1
- package/dist/kenso.js +15 -4
- package/dist/operations.index.json +1 -1
- package/dist/operations.json +1 -1
- package/docs/README.md +1 -0
- package/docs/reference.md +1 -1
- package/docs/workflows.md +209 -0
- package/package.json +2 -2
package/docs/README.md
CHANGED
|
@@ -101,6 +101,7 @@ Every page is in the package and prints offline with `kenso docs <topic>`.
|
|
|
101
101
|
| [Output and errors](output-and-errors.md) | `output-and-errors` | The output contract, error JSON, error codes, exit codes, live streams |
|
|
102
102
|
| [CRM (beta)](crm.md) | `crm` | Accounts, people, opportunities and CRM sync |
|
|
103
103
|
| [Studio (beta)](studio.md) | `studio` | Pull, push, validate, preview and fill templates |
|
|
104
|
+
| [Workflows (beta)](workflows.md) | `workflows` | Keep a workflow as a file: `kenso.json`, init, pull, check, push, test, publish, and run it on ids or a CSV with a credit cap |
|
|
104
105
|
| [Agent work (beta)](work.md) | `work` | My agent: your own coding agent writes Kenso's AI work with `kenso work run`, or pull and submit |
|
|
105
106
|
| [Webhooks](webhooks.md) | `webhooks` | Build a webhook handler locally: `kenso webhooks listen --forward-to`, `trigger`, the signature |
|
|
106
107
|
| [Developer sandbox](sandbox.md) | `sandbox` | `kenso sandbox`: a workspace of your own where sends are simulated, its test key, the reserved test leads |
|
package/docs/reference.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Kenso CLI command reference
|
|
2
2
|
|
|
3
|
-
Generated from kenso 0.1.
|
|
3
|
+
Generated from kenso 0.1.156 (API contracts 38afd069fb69) by `scripts/build-reference.ts`. Do not edit it: `pnpm build` writes it again.
|
|
4
4
|
|
|
5
5
|
1930 commands, one entry each: summary, API route, feature gate and flag names. Beta commands work only on workspaces with their feature flag; `kenso describe` hides the ones yours cannot use. Every command also takes the global flags below. A command's notes, flag descriptions, body schema and examples: `kenso <resource> <action> --help`, or `kenso describe <resource> <action>` as JSON.
|
|
6
6
|
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Workflows (beta)
|
|
2
|
+
|
|
3
|
+
A workflow is automation in Kenso: one trigger, a list of steps and limits. With the CLI you keep a workflow as a JSON file in your folder or repo: write it, check it, push it to the draft, test the draft, publish the version you tested, and run it on records with a credit cap and a results file.
|
|
4
|
+
|
|
5
|
+
The commands are beta: they show where your workspace has the `workflows` feature. Help hides them until your workspace has it; `kenso --help --all-commands` shows them. `kenso workflows test` and `kenso workflows run` also need `workflows_runtime`. Without it `test` stops with `runtime_off` (exit 4), "Workflows cannot run in this workspace yet.", with no retry, and a run that `kenso workflows run` starts stays `queued`, which `--wait` reports at its timeout.
|
|
6
|
+
|
|
7
|
+
| Command | What it does |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `workflows init [name]` | Write a new workflow file, blank or from a template, and a `kenso.json` |
|
|
10
|
+
| `workflows pull <workflowId>` | Write a saved workflow's definition to a file and bind the file |
|
|
11
|
+
| `workflows check <file>` | Validate the file and estimate one record; saves nothing |
|
|
12
|
+
| `workflows push <file>` | Create the workflow or save the file to its draft; with `--publish`, publish it |
|
|
13
|
+
| `workflows test <file>` | Run the saved draft once on one record |
|
|
14
|
+
| `workflows diff <file>` | Compare the file with the published version or the draft |
|
|
15
|
+
| `workflows schema` | Print a JSON Schema for workflow files, for editors |
|
|
16
|
+
| `workflows run <file or id>` | Run the published workflow on ids or a CSV, estimate first |
|
|
17
|
+
| `workflow-runs logs <runId>` | One row per step of a run: status, credits, error |
|
|
18
|
+
|
|
19
|
+
The other workflow commands are generated from the API, one per route: `kenso workflows publish`, `unpublish`, `get` and `list`, `kenso workflow-versions`, `kenso workflow-runs list`, `get`, `cancel`, `restart`, `retry` and `replay`, `kenso workflow-templates` and `kenso workflow-step-types`. `kenso <command> --help` shows their flags.
|
|
20
|
+
|
|
21
|
+
## The file
|
|
22
|
+
|
|
23
|
+
A workflow file is one JSON object in the `kenWorkflow: "1"` format, named `<name>.workflow.json`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"kenWorkflow": "1",
|
|
28
|
+
"name": "Qualify accounts",
|
|
29
|
+
"description": "Scores each account against a simple ICP.",
|
|
30
|
+
"trigger": { "type": "trigger.manual@1", "with": { "recordType": "account" } },
|
|
31
|
+
"steps": [
|
|
32
|
+
{ "id": "qualify", "type": "ai.qualify@1", "with": { "criteria": "B2B SaaS, 50+ people", "tier": "cheap" } }
|
|
33
|
+
],
|
|
34
|
+
"limits": { "creditsPerMonth": 100, "creditsPerRun": 5, "runsPerDay": 50, "atLimit": "ask" }
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The format (trigger, steps, references, formulas, limits) is the `workflows` skill's `references/definition-format.md`. `kenso workflows schema` prints a JSON Schema (draft 2020-12) of the file with each step type's inputs, for an editor, offline; the server's validate stays the authority. `kenso workflow-step-types get` prints one step type's inputs and an example.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
kenso workflows schema --out workflow.schema.json
|
|
42
|
+
kenso workflow-step-types get --type ai.qualify@1
|
|
43
|
+
kenso mcp call load_skill --args '{"name":"workflows","reference":"references/definition-format.md"}'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## kenso.json
|
|
47
|
+
|
|
48
|
+
`kenso.json` binds workflow files to workflow ids and pins the folder's workspace. `init`, `pull` and `push` write it; you rarely edit it by hand.
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"workspaceId": "3047",
|
|
53
|
+
"profile": "client-a",
|
|
54
|
+
"workflows": { "workflows/qualify.workflow.json": 412 }
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- All three keys are optional. `workspaceId` is a string of digits. `profile` is a profile name. `workflows` maps a path relative to `kenso.json` (forward slashes) to a workflow id. One file holds one workflow and one workflow is bound to one file: binding a second is `already_bound` (exit 7). Other keys are kept when the CLI rewrites the file.
|
|
59
|
+
- The CLI looks for it from the current folder up to the first folder that holds `.git`; for a command given a file, from that file's folder.
|
|
60
|
+
- The workspace is `--workspace`, else `KENSO_WORKSPACE_ID`, else `kenso.json`, else the profile's. The profile is `--profile`, else `KENSO_PROFILE`, else `kenso.json`, else the active profile. `kenso.json` never changes the API URL or the key.
|
|
61
|
+
- A file command run in another workspace than the one `kenso.json` names stops with `workspace_mismatch` (exit 2): its workflow ids belong to that workspace.
|
|
62
|
+
- It never holds a key or an API URL. A file with `apiKey`, `key`, `token`, a value starting with `kenso_`, or `apiUrl` is `folder_file_invalid` (exit 2), "kenso.json never holds a key or an API URL: remove <name>.", and nothing reads it. Invalid JSON, or a key of the wrong type, is the same error with the path and the key.
|
|
63
|
+
- `kenso whoami` and `kenso auth status` print `workspaceSource` (`flag`, `env`, `folder`, `profile` or `none`) and, for `folder`, `folderFile`.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
kenso whoami -o json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## The first run
|
|
70
|
+
|
|
71
|
+
From a template to records:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
kenso workflow-templates list
|
|
75
|
+
kenso workflows init qualify --template <templateKey>
|
|
76
|
+
kenso workflows push qualify.workflow.json
|
|
77
|
+
kenso workflows check qualify.workflow.json --mode publish
|
|
78
|
+
kenso workflows test qualify.workflow.json --record account:<accountId>
|
|
79
|
+
kenso workflows push qualify.workflow.json --publish --expected-hash <definitionHash>
|
|
80
|
+
kenso workflows run qualify.workflow.json --ids ids.txt --dry-run
|
|
81
|
+
kenso workflows run qualify.workflow.json --ids ids.txt --max-credits 10 --yes
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Fill the template's `<fill in: ...>` placeholders and set `limits` in the file before the first push. `check --mode publish` names everything publish would refuse, with a `fix` for each issue.
|
|
85
|
+
|
|
86
|
+
## The commands
|
|
87
|
+
|
|
88
|
+
### init
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
kenso workflows init qualify --template <templateKey> --dir workflows
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Writes `<name>.workflow.json`: the template's definition with `--template`, else a blank definition with `trigger.manual@1` and no steps. Writes `kenso.json` with the resolved workspace when no folder file is found. It never replaces a file (`file_exists`, exit 7), sends no request without `--template`, and creates nothing in Kenso. Prints `{file, template, folderFile, folderFileCreated, workspaceId}`.
|
|
95
|
+
|
|
96
|
+
### pull
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
kenso workflows pull 412 --out qualify.workflow.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Writes the draft's definition (else the published one; `--published` takes the published one) to `--out` or `<slug of the name>.workflow.json`, with 2-space indents and a final newline, and binds the file in `kenso.json`. An existing file is replaced only when `kenso.json` binds it to this workflow (else `file_exists`, exit 7). When the workflow is bound to another file already, the new file is an unbound copy. Prints `{file, workflowId, draftVersion, draftHash, publishedHash, status}`.
|
|
103
|
+
|
|
104
|
+
### check
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
kenso workflows check qualify.workflow.json --mode publish
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Sends the file as the definition to validate (saving nothing) and to the estimate for one record. Prints `{valid, issues, perRecord, draftHash, inSync, next}`: each issue has `path`, `code`, `message`, `fix` and `severity`; `perRecord` is `{expectedCredits, maxCredits}`; `draftHash` is the saved draft's hash, and `inSync` says whether the file equals that draft. Exit 0 when valid, 5 when not. `--mode draft` (the default) checks structure, schemas, references and formulas; `--mode publish` also checks limits, secrets and connected apps. An unbound file is `workflow_not_bound` (exit 2), "check needs a workflow id: a draft runs nothing and costs nothing.", with `next: kenso workflows push <file>`.
|
|
111
|
+
|
|
112
|
+
### push
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
kenso workflows push qualify.workflow.json --note "Raise the size floor"
|
|
116
|
+
kenso workflows push qualify.workflow.json --dry-run
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
An unbound file creates the workflow and binds the file. A bound file is saved to the draft when it differs from it, on top of the draft version just read; an identical file saves nothing. Prints `{workflowId, saved, draftVersion, draftHash, published, status, next}`. `--dry-run` prints `wouldSend`: which of create, update and publish it would send. `--publish` publishes after the save, and `--expected-hash` goes with it (see The hash rule).
|
|
120
|
+
|
|
121
|
+
### test
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
kenso workflows test qualify.workflow.json --record account:<accountId> --wait 50
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Runs the saved draft once on one record: `--record <type:id>` (`person:812`; the types are `account`, `person`, `lead` and `place`), else the newest record of the trigger's type. `--wait` is the seconds the API waits for the run, 0 to 50 (50 by default). AI and data steps run for real and are charged; sends and CRM writes are simulated. A file that differs from the draft is refused (`draft_out_of_sync`, exit 7, `next: kenso workflows push <file>`). Prints `{testPassed, timedOut, definitionHash, publishPassRecorded, run: {id, status, creditsCharged}, hint, next}`; after a pass, `next` is the publish command with `--expected-hash <definitionHash>`. Exit 1 when the test did not pass.
|
|
128
|
+
|
|
129
|
+
### diff
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
kenso workflows diff qualify.workflow.json --against draft
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Compares the file with the published version (the default; the draft when nothing is published) or with the draft. Prints `{against, same, nameChanged, triggerChanged, limitsChanged, stepsAdded, stepsRemoved, stepsChanged}` with step ids. Exit 0 either way.
|
|
136
|
+
|
|
137
|
+
### schema
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
kenso workflows schema --out workflow.schema.json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Prints, or writes to `--out`, the JSON Schema of a workflow file. It needs no sign-in and no network, and `--out` replaces only a schema it wrote.
|
|
144
|
+
|
|
145
|
+
## The hash rule
|
|
146
|
+
|
|
147
|
+
`definitionHash` is computed by the server for a saved draft and leaves `plain` out; the CLI never computes one. When the CLI compares a file with a saved definition, it compares them as JSON with keys sorted at every level: whitespace and key order never count.
|
|
148
|
+
|
|
149
|
+
- Publish needs a passed test on the draft's hash. Without one the CLI stops with `test_required` (exit 7), "Publish needs a passed test on this exact draft.", and `next: kenso workflows test <file>`.
|
|
150
|
+
- `--expected-hash <hash>` makes push compare the draft's hash after the save with the value. A mismatch is `hash_mismatch` (exit 7), "The draft's hash is <actual>, not <expected>.", and nothing is published; the saved draft stays. Pass the hash `kenso workflows test` printed.
|
|
151
|
+
- Under a coding agent, `--publish` without `--expected-hash` is refused (`usage_error`, "an agent publishes only the version it tested: pass --expected-hash"). A person at a terminal may publish without it.
|
|
152
|
+
- **The gap.** The publish route takes no hash, so a save that lands between the CLI's hash check and the publish call can be published. The server's `version_conflict` on a concurrent save and its rule that publish needs a passed test bound it.
|
|
153
|
+
- A save that meets a newer draft is `version_conflict` (exit 7), "Someone saved this workflow since you read it.", with `next: kenso workflows diff <file> --against draft`.
|
|
154
|
+
- A definition the server refuses on save or publish is `invalid_definition` (exit 5) with its issues (`path`, `code`, `message`); on a publish, `next` is `kenso workflows check <file> --mode publish`, which adds a `fix` to each.
|
|
155
|
+
|
|
156
|
+
## Run on records
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
kenso accounts list --limit 50 -o ids > ids.txt
|
|
160
|
+
kenso workflows run qualify.workflow.json --ids ids.txt --dry-run
|
|
161
|
+
kenso workflows run qualify.workflow.json --ids ids.txt --max-credits 10 --wait --out results.csv --yes
|
|
162
|
+
kenso workflows run 412 --file people.csv --record-type person --dry-run
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
- **Target.** A number is a workflow id. A file must be bound in `kenso.json` and equal to the published version, else `unpublished_changes` (exit 7), "This file differs from the published version.", with `next` naming the push that publishes it (with `--expected-hash` when the saved draft holds the file). A workflow that is not live is `invalid_state` (exit 7) with `next: kenso workflows publish --workflow-id <id>`. Nothing publishes by itself.
|
|
166
|
+
- **Record type** is the trigger's (`trigger.manual@1` takes its `with.recordType`); `--record-type` (`account`, `person`, `lead` or `place`) overrides it. A trigger that names no record type needs the flag (`not_runnable_on_records`, exit 2).
|
|
167
|
+
- **Input.** `--ids` is one id per line (`-` reads stdin). `--file` is a CSV: with an `id` column, those ids; without one and with record type `person`, each row is matched or created as a person in chunks of 200, with the columns `kenso people import` accepts and no email finding. Any other record type without an `id` column is `ids_required` (exit 2), which names `kenso contacts import` or `kenso accounts import`. Duplicated ids run once. A saved list runs through a workflow whose trigger is `trigger.saved_list@1` or `trigger.csv@1`; `--list` is not a flag.
|
|
168
|
+
- **Dry run.** `--dry-run`, and a run without `--yes`, estimate per chunk of up to 1,000 records, start nothing, and print `{dryRun, workflowId, records, recordType, credits: {needed, available, sufficient}, perRecord, expectedCredits, cap, next}`. `needed` is the estimate's maximum. A CSV without ids is estimated on its row count and creates no person.
|
|
169
|
+
- **Confirmation.** Without `--yes`, a person at a terminal is asked once with the plan on screen. Under a coding agent the command prints the plan and stops, with `next` naming the same command with `--yes`.
|
|
170
|
+
- **`--max-credits <n>`** is enforced by the CLI; the server is sent no cap. The ceiling per record is the definition's `limits.creditsPerRun` when set (`cap.kind: "hard"`), else the estimate's maximum per record (`cap.kind: "estimate"`). The CLI starts the first `floor(n / ceiling)` records and reports the rest as `not_started` with reason `over --max-credits`. The plan and the summary print `cap: {maxCredits, kind, perRecord, willStart, notStarted}`. A cap below one record's ceiling starts nothing: `cap_too_low` (exit 6), with `next` naming the smallest cap that starts one record. A workspace out of credits starts nothing either (`out_of_credits`, exit 6).
|
|
171
|
+
- **`--wait`** follows each started run, up to 8 reads at a time, until it leaves `queued`, `running` and `waiting`, or `--timeout` (90s, 10m, 1h; default 30m) passes. A run still `waiting` at the timeout is reported as `waiting`. `--timeout` goes with `--wait`.
|
|
172
|
+
- **`--out <results.csv>`** (needs `--wait`) writes one row per input record when the batch ends: `row, id, status, runId, runStatus, creditsCharged, missReason, error`, then one column per step id holding that step's output as compact JSON. The path is checked before the first request: its folder must exist, and an existing file is refused (`file_exists`, exit 7) unless it is this run's own.
|
|
173
|
+
- **Summary.** One JSON object with `records`, `started`, `deduplicated`, `notStarted`, `succeeded`, `failed`, `waiting`, `missed` (reason to count), `creditsCharged` (`"pending"` without `--wait` or while runs are open), `cap`, `resultsCsv`, `appUrl` (the workflow's page in the app) and `next`, and the same counts on one stderr line. With `--wait`, a run that failed makes `next` its `kenso workflow-runs logs <runId>`.
|
|
174
|
+
|
|
175
|
+
## The run folder
|
|
176
|
+
|
|
177
|
+
Each applied run writes a run folder (`~/.kenso/runs/<id>`) that records every chunk's response, as every batch command does: see [Batch runs](batch.md). `kenso runs resume <runId>` never resends a chunk it has an answer for. A chunk that was sent and has no recorded answer is not resent either: resume stops with `chunk_outcome_unknown` (exit 5), the chunk's first and last row, and `next: kenso workflow-runs list --workflow-id <id> --created-after <chunk start time>`, so you can see what started.
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
kenso runs resume <runId>
|
|
181
|
+
kenso workflow-runs list --workflow-id 412 --created-after 2026-11-21T10:00:00Z
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Read a run
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
kenso workflow-runs logs <runId>
|
|
188
|
+
kenso workflow-runs logs <runId> --step qualify --full
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
One row per step run in start order: `{nodeId, stepType, status, attempt, startedAt, endedAt, ms, credits, error}`, NDJSON when piped. `--step` keeps one node; `--full` adds each step's `input`, `output` and `attempts`. A header line on stderr gives the run's status, workflow, record and the credits it charged, and `needs attention: <reason>` when one is set. A failed run ends with `next: kenso workflow-runs retry --run-id <id> --dry-run`.
|
|
192
|
+
|
|
193
|
+
## Step outputs are kept 7 days
|
|
194
|
+
|
|
195
|
+
A succeeded run's step outputs are dropped 7 days after it finishes, unless the workflow keeps success details. `--out` writes them when the batch ends, so run with `--wait --out` when you need the results later.
|
|
196
|
+
|
|
197
|
+
## Exit codes
|
|
198
|
+
|
|
199
|
+
| Exit | When |
|
|
200
|
+
|---|---|
|
|
201
|
+
| 0 | Done. For `run`, every record started and, with `--wait`, none failed |
|
|
202
|
+
| 1 | `test`: the test did not pass |
|
|
203
|
+
| 2 | Usage: `workflow_not_bound`, `folder_file_invalid`, `workspace_mismatch`, `not_runnable_on_records`, `ids_required`, or `--publish` without `--expected-hash` under a coding agent |
|
|
204
|
+
| 4 | `test`: `runtime_off`, the workspace cannot run workflows yet |
|
|
205
|
+
| 5 | `check` found the file not valid, the server refused a definition (`invalid_definition`), `run` has records that failed, were not found or were not started, or resume met `chunk_outcome_unknown` |
|
|
206
|
+
| 6 | `run`: the cap started nothing (`cap_too_low`), or the workspace is out of credits |
|
|
207
|
+
| 7 | A conflict: `file_exists`, `already_bound`, `draft_out_of_sync`, `hash_mismatch`, `test_required`, `version_conflict`, `unpublished_changes`, `invalid_state`, or an existing `--out` file |
|
|
208
|
+
|
|
209
|
+
Every error is one JSON line on stderr with `code`, `message`, `hint` and `next`: see [Output and errors](output-and-errors.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kenso",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.156",
|
|
4
4
|
"description": "The Kenso CLI: bulk lead, CRM and Studio work for people and coding agents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"typescript-eslint": "8.71.1",
|
|
50
50
|
"vitest": "5.0.3"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "2f9ccc8e1f6072e1048feef818009e5e910c1f22"
|
|
53
53
|
}
|