@divergeai/cli 0.1.23 → 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 +56 -6
  2. package/dist/diverge.mjs +1124 -766
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -69,6 +69,23 @@ platform grants it only where your roles back the login's scopes.
69
69
  reach it when `DIVERGENT_API_URL` names it. Nothing on disk chooses the
70
70
  deployment.
71
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
+
72
89
  ## Coding agents
73
90
 
74
91
  `diverge agents setup <agent>` writes the configuration one agent needs to use
@@ -79,7 +96,7 @@ the gateway, keeping everything else in the file:
79
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 |
80
97
  | `opencode` | `~/.config/opencode/opencode.json`: a `divergent-<surface>` provider reading `DIVERGENT_TOKEN` |
81
98
  | `codex` | `~/.codex/config.toml`: a `divergent` provider block with `diverge token` as its auth command; `--print` shows it instead |
82
- | `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` |
83
100
 
84
101
  `diverge agents run dsh` launches DeepSeek Harness on the overlay and keeps
85
102
  its token fresh in dsh's own credentials file until it exits. With nothing
@@ -87,6 +104,16 @@ else it starts dsh's web UI and prints the URL; `diverge agents run dsh --
87
104
  "<task>"` answers one task headless and exits; anything after `--` goes to
88
105
  dsh as given.
89
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
+
90
117
  `diverge agents status` shows the organization, the scopes, and the models
91
118
  each surface serves. `diverge agents rotate` keeps a token file fresh
92
119
  (default `~/.divergent/token`, every 600 seconds; `--once` writes and exits)
@@ -124,13 +151,25 @@ diverge skills install # into ~/.claude/skills, ~/.codex/skills and $DSH_HOME
124
151
  diverge skills status # what each folder holds against the platform
125
152
  ```
126
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
+
127
157
  `agents setup claude|codex|dsh` and `agents run dsh` install them as well, so
128
158
  a harness the CLI set up has the skills from its first session. A refresh
129
159
  replaces the CLI's own folders, retires the ones the organization retired, and
130
160
  never touches a skill you authored beside them. The skills are the tool
131
161
  surface: an agent reaches every platform tool from its shell with `diverge
132
162
  tools`, which costs nothing until a tool is called, and the `diverge` skill
133
- 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.
134
173
 
135
174
  ## Platform tools
136
175
 
@@ -145,7 +184,8 @@ diverge tools describe rbac_assign_role # one schema, on demand
145
184
  diverge tools call rbac_list_roles --args-json '{}'
146
185
  diverge tools call rbac_list_roles --json # exactly one JSON outcome on stdout, errors included
147
186
  diverge tools call inventory_lookup_stock --args-file args.json # or --args-json - to read stdin
148
- 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
149
189
  ```
150
190
 
151
191
  Put arguments in a file or on stdin when a shell may touch them: Windows
@@ -154,10 +194,18 @@ JSON array of `{"tool": "...", "args": {...}}` (or one per line), runs them in
154
194
  order, and exits with the worst outcome: 1 failed, 4 rejected, 5 expired,
155
195
  3 pending, else 0.
156
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
+
157
204
  A write that needs a human is not refused: it is persisted as a pending
158
205
  invocation, decided in the platform's approval inbox, and read back here by
159
- id. Branch on the exit code, never on text; `call`, `run` and `invocation <id>`
160
- 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`:
161
209
 
162
210
  | code | meaning |
163
211
  | --- | --- |
@@ -170,7 +218,8 @@ give the same code for the same status, with or without `--json`:
170
218
 
171
219
  The CLI raises and reads; it never decides. `diverge tools bridge` serves the
172
220
  same catalog as a stdio MCP server for clients without a shell, with
173
- `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
174
223
  and accepts only those tools: the whole catalog is tens of thousands of tokens
175
224
  on every request, so a harness gets the tools it was given and nothing else.
176
225
 
@@ -212,6 +261,7 @@ non-interactive shells, under `CI`, and with `DIVERGE_NO_UPDATE_CHECK=1`.
212
261
  | `DIVERGE_HOME` | state directory, default `~/.diverge` |
213
262
  | `DIVERGENT_ORG_ID`, `DIVERGENT_PROJECT_ID` | tool scope when the flags are omitted; without either, the login's organization |
214
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) |
215
265
  | `DSH_HOME` | where dsh keeps its files, default `~/.dsh` |
216
266
  | `DIVERGE_NO_UPDATE_CHECK` | set to skip the once-a-day check for a newer release |
217
267