@divergeai/cli 0.1.22 → 0.1.24

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.
Files changed (3) hide show
  1. package/README.md +62 -6
  2. package/dist/diverge.mjs +1255 -806
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -13,6 +13,12 @@ diverge tools list --organization-id <id>
13
13
 
14
14
  Node 22 or later. Linux and macOS are supported; Windows is best-effort.
15
15
 
16
+ `diverge --help`, `diverge <command> --help` and `diverge <command> <verb>
17
+ --help` print the usage, and that usage is the CLI's command table: a
18
+ command, verb or option that does not exist is answered with the closest ones
19
+ it lists, by spelling or by what their description says (`diverge whoami` →
20
+ `diverge status`, `tools search` → `tools list --filter`), and exits 1.
21
+
16
22
  ## Sign in
17
23
 
18
24
  `diverge login` runs the browser sign-in (authorization code with PKCE on a
@@ -63,6 +69,23 @@ platform grants it only where your roles back the login's scopes.
63
69
  reach it when `DIVERGENT_API_URL` names it. Nothing on disk chooses the
64
70
  deployment.
65
71
 
72
+ ### Session token
73
+
74
+ A session started for one piece of work runs on the token handed to it, not
75
+ on a login. Set `DIVERGENT_TOKEN_FILE` to a file holding that bearer token:
76
+ every command reads the file again, so a supervisor replaces it for each
77
+ attempt, and the CLI never reads, refreshes or writes a login under
78
+ `$DIVERGE_HOME` and never falls back to one or to service credentials.
79
+
80
+ - The token decides the organization: commands act in the token's, and an
81
+ `--organization-id` or `DIVERGENT_ORG_ID` naming another is refused before
82
+ any request.
83
+ - `diverge token` prints the file's token, so `forge` and the agent overlays
84
+ run on it unchanged. `Acting as:` names the account the platform says the
85
+ token is for, marked as a session token, with the actor the token names.
86
+ - A missing, empty or unreadable file is an error naming the file.
87
+ - `login`, `logout`, `org` and `update` refuse: the session holds no login.
88
+
66
89
  ## Coding agents
67
90
 
68
91
  `diverge agents setup <agent>` writes the configuration one agent needs to use
@@ -73,7 +96,7 @@ the gateway, keeping everything else in the file:
73
96
  | `claude` | `~/.claude/settings.json` (or `./.claude/settings.local.json` with `--scope project`): the gateway base URL and `diverge token` as the key helper; `--project-id` adds the project header, `--model-discovery` lets Claude Code list the gateway's models |
74
97
  | `opencode` | `~/.config/opencode/opencode.json`: a `divergent-<surface>` provider reading `DIVERGENT_TOKEN` |
75
98
  | `codex` | `~/.codex/config.toml`: a `divergent` provider block with `diverge token` as its auth command; `--print` shows it instead |
76
- | `dsh` | `$DSH_HOME/divergent-<surface>.yml`: a patch overlay with the models the gateway serves and dsh's DeepSeek adapter, telemetry upload and vendor search turned off; the Divergent agent preset; and your skills in `$DSH_HOME/skills`, through which the agent reaches every platform tool, web search included, from dsh's shell with `diverge tools` |
99
+ | `dsh` | `$DSH_HOME/divergent-<surface>.yml`: a patch overlay with the models the gateway serves, each with the input, context window and output cap the gateway lists for it, dsh's DeepSeek adapter, telemetry upload and vendor search turned off, a shell command budget raised from dsh's 60 s to the CLI's own request ceiling so a platform tool call is never cut off before the platform answers, and Chrome DevTools MCP on port 9222; the Divergent agent preset; and your skills in `$DSH_HOME/skills`, through which the agent reaches every platform tool, web search included, from dsh's shell with `diverge tools` |
77
100
 
78
101
  `diverge agents run dsh` launches DeepSeek Harness on the overlay and keeps
79
102
  its token fresh in dsh's own credentials file until it exits. With nothing
@@ -81,6 +104,16 @@ else it starts dsh's web UI and prints the URL; `diverge agents run dsh --
81
104
  "<task>"` answers one task headless and exits; anything after `--` goes to
82
105
  dsh as given.
83
106
 
107
+ The session runs on its own token, not on your login. The CLI keeps
108
+ `$DSH_HOME/session-token` fresh beside the credentials file, and writes
109
+ `$DSH_HOME/bin/diverge`, first on dsh's PATH, which runs the CLI that started
110
+ the session on that token (`DIVERGENT_TOKEN_FILE`). Every `diverge` the agent
111
+ runs from dsh's shell therefore acts in the organization the session was
112
+ started for. It never reads, refreshes or rewrites your login from inside dsh's
113
+ sandbox, where your home is read-only, and it never reaches another `diverge`
114
+ the host has on PATH. `diverge org use` elsewhere does not move a running
115
+ session; start a new one to act in another organization.
116
+
84
117
  `diverge agents status` shows the organization, the scopes, and the models
85
118
  each surface serves. `diverge agents rotate` keeps a token file fresh
86
119
  (default `~/.divergent/token`, every 600 seconds; `--once` writes and exits)
@@ -118,13 +151,25 @@ diverge skills install # into ~/.claude/skills, ~/.codex/skills and $DSH_HOME
118
151
  diverge skills status # what each folder holds against the platform
119
152
  ```
120
153
 
154
+ Each SKILL.md is rendered from the skill's record on the platform on every
155
+ install, so what lands in the folder is the skill as it stands now.
156
+
121
157
  `agents setup claude|codex|dsh` and `agents run dsh` install them as well, so
122
158
  a harness the CLI set up has the skills from its first session. A refresh
123
159
  replaces the CLI's own folders, retires the ones the organization retired, and
124
160
  never touches a skill you authored beside them. The skills are the tool
125
161
  surface: an agent reaches every platform tool from its shell with `diverge
126
162
  tools`, which costs nothing until a tool is called, and the `diverge` skill
127
- shows it how, file-based arguments and batches included.
163
+ shows it how, arguments piped through stdin and batches included.
164
+
165
+ dsh also gets the browser. The overlay mounts Chrome DevTools MCP, attached
166
+ to a Chrome the person starts in debug mode (`--remote-debugging-port=9222`,
167
+ on a profile of its own), and the CLI's `drive-chrome` skill says how to use
168
+ it. This is the one MCP server the overlay mounts: platform tools stay in the
169
+ shell, but a browser session has to outlive one command, and dsh runs each
170
+ command in a fresh sandbox. Its tool definitions ride on every request
171
+ (about 5k tokens, cached after the first). Without a Chrome on the port the
172
+ server waits; the first tool call connects.
128
173
 
129
174
  ## Platform tools
130
175
 
@@ -139,7 +184,8 @@ diverge tools describe rbac_assign_role # one schema, on demand
139
184
  diverge tools call rbac_list_roles --args-json '{}'
140
185
  diverge tools call rbac_list_roles --json # exactly one JSON outcome on stdout, errors included
141
186
  diverge tools call inventory_lookup_stock --args-file args.json # or --args-json - to read stdin
142
- diverge tools run calls.json --wait # several calls from one file (- for stdin), one JSON line of outcome each
187
+ diverge tools set writes.json --summary "Coordinators follow their cargo" # several related writes, ONE decision
188
+ diverge tools run calls.json --wait # several independent calls from one file (- for stdin), one JSON line of outcome each
143
189
  ```
144
190
 
145
191
  Put arguments in a file or on stdin when a shell may touch them: Windows
@@ -148,10 +194,18 @@ JSON array of `{"tool": "...", "args": {...}}` (or one per line), runs them in
148
194
  order, and exits with the worst outcome: 1 failed, 4 rejected, 5 expired,
149
195
  3 pending, else 0.
150
196
 
197
+ When several writes serve one intent, raise them with `set` instead: the
198
+ same file format, one pending invocation for the lot, one card for the
199
+ person who decides it. Once approved the calls run in order and stop at the
200
+ first failure; `diverge tools invocation <id>` reads every call's outcome
201
+ (`succeeded`, `failed`, `not_run`) from `result.calls`. A set carries writes
202
+ only, with arguments frozen when it is raised.
203
+
151
204
  A write that needs a human is not refused: it is persisted as a pending
152
205
  invocation, decided in the platform's approval inbox, and read back here by
153
- id. Branch on the exit code, never on text; `call`, `run` and `invocation <id>`
154
- give the same code for the same status, with or without `--json`:
206
+ id. Branch on the exit code, never on text; `call`, `set`, `run` and
207
+ `invocation <id>` give the same code for the same status, with or without
208
+ `--json`:
155
209
 
156
210
  | code | meaning |
157
211
  | --- | --- |
@@ -164,7 +218,8 @@ give the same code for the same status, with or without `--json`:
164
218
 
165
219
  The CLI raises and reads; it never decides. `diverge tools bridge` serves the
166
220
  same catalog as a stdio MCP server for clients without a shell, with
167
- `divergent_invocation_status` for the read-back. `--tools <name,name>` publishes
221
+ `divergent_submit_set` to raise a set and `divergent_invocation_status` for
222
+ the read-back. `--tools <name,name>` publishes
168
223
  and accepts only those tools: the whole catalog is tens of thousands of tokens
169
224
  on every request, so a harness gets the tools it was given and nothing else.
170
225
 
@@ -206,6 +261,7 @@ non-interactive shells, under `CI`, and with `DIVERGE_NO_UPDATE_CHECK=1`.
206
261
  | `DIVERGE_HOME` | state directory, default `~/.diverge` |
207
262
  | `DIVERGENT_ORG_ID`, `DIVERGENT_PROJECT_ID` | tool scope when the flags are omitted; without either, the login's organization |
208
263
  | `DIVERGENT_CLIENT_ID`, `DIVERGENT_CLIENT_SECRET`, `DIVERGENT_USER_ID` | unattended tool execution with service credentials, delegated to that person |
264
+ | `DIVERGENT_TOKEN_FILE` | a file holding the token this session runs on, in place of any login (see Session token) |
209
265
  | `DSH_HOME` | where dsh keeps its files, default `~/.dsh` |
210
266
  | `DIVERGE_NO_UPDATE_CHECK` | set to skip the once-a-day check for a newer release |
211
267