@divergeai/cli 0.1.23 → 0.1.25
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/README.md +83 -17
- package/dist/diverge.mjs +2164 -1217
- 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)
|
|
@@ -113,24 +140,52 @@ claude mcp add --scope user divergent -- diverge tools bridge --tools search_onl
|
|
|
113
140
|
## Skills
|
|
114
141
|
|
|
115
142
|
A skill is a procedure over the tools it names, in the Agent Skills format
|
|
116
|
-
every harness reads (`<
|
|
117
|
-
on the platform;
|
|
118
|
-
the
|
|
119
|
-
tools from
|
|
143
|
+
every harness reads (`<folder>/SKILL.md`). Each organization authors its
|
|
144
|
+
skills on the platform; the login gets, in every organization it can act
|
|
145
|
+
in, the ones whose every named tool the person can run, plus the CLI's own
|
|
146
|
+
`diverge` skill, which tells an agent how to reach the platform's tools from
|
|
147
|
+
a shell.
|
|
120
148
|
|
|
121
149
|
```bash
|
|
122
|
-
diverge skills list # what the platform serves you
|
|
150
|
+
diverge skills list # what the platform serves you, per organization
|
|
123
151
|
diverge skills install # into ~/.claude/skills, ~/.codex/skills and $DSH_HOME/skills
|
|
152
|
+
diverge skills refresh # the same, best effort and quiet: what sign-in and a session start run
|
|
124
153
|
diverge skills status # what each folder holds against the platform
|
|
125
154
|
```
|
|
126
155
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
156
|
+
The set is derived from the login, never chosen on the machine: who is
|
|
157
|
+
signed in, where they may act, and what they can run there. A skill's
|
|
158
|
+
identity is its organization and its name, so every organization's skills
|
|
159
|
+
sit side by side in one folder, each under the organization's prefix — its
|
|
160
|
+
short code, lowercased, or a slug of its name: `dvx-consultar-inventario`,
|
|
161
|
+
`red-team-triage-cloud-run`. Each SKILL.md is rendered from the skill's
|
|
162
|
+
record on every install, named after its folder, and opens with the
|
|
163
|
+
organization its tools run in, so an agent passes `--organization-id` on
|
|
164
|
+
every call instead of depending on the machine's default organization.
|
|
165
|
+
|
|
166
|
+
Nobody runs the install by hand after the first time: `diverge login`
|
|
167
|
+
installs, and a session start refreshes — `agents setup claude` writes a
|
|
168
|
+
SessionStart hook into Claude Code's user settings, a Divergent checkout
|
|
169
|
+
refreshes from its worktree setup for every harness, and `agents run dsh`
|
|
170
|
+
refreshes before dsh starts. A refresh is per organization: it
|
|
171
|
+
replaces that organization's folders, retires the ones it stopped serving,
|
|
172
|
+
and never touches another organization's or a skill you authored beside
|
|
173
|
+
them. A whole-login refresh also retires an organization the login no longer
|
|
174
|
+
lists; `--organization-id` refreshes one and leaves the rest. A session on a
|
|
175
|
+
token file (`DIVERGENT_TOKEN_FILE`) holds that token's one organization. The
|
|
176
|
+
skills are the tool surface: an agent reaches every platform tool from its
|
|
177
|
+
shell with `diverge tools`, which costs nothing until a tool is called, and
|
|
178
|
+
the `diverge` skill shows it how, arguments piped through stdin and batches
|
|
179
|
+
included.
|
|
180
|
+
|
|
181
|
+
dsh also gets the browser. The overlay mounts Chrome DevTools MCP, attached
|
|
182
|
+
to a Chrome the person starts in debug mode (`--remote-debugging-port=9222`,
|
|
183
|
+
on a profile of its own), and the CLI's `drive-chrome` skill says how to use
|
|
184
|
+
it. This is the one MCP server the overlay mounts: platform tools stay in the
|
|
185
|
+
shell, but a browser session has to outlive one command, and dsh runs each
|
|
186
|
+
command in a fresh sandbox. Its tool definitions ride on every request
|
|
187
|
+
(about 5k tokens, cached after the first). Without a Chrome on the port the
|
|
188
|
+
server waits; the first tool call connects.
|
|
134
189
|
|
|
135
190
|
## Platform tools
|
|
136
191
|
|
|
@@ -145,7 +200,8 @@ diverge tools describe rbac_assign_role # one schema, on demand
|
|
|
145
200
|
diverge tools call rbac_list_roles --args-json '{}'
|
|
146
201
|
diverge tools call rbac_list_roles --json # exactly one JSON outcome on stdout, errors included
|
|
147
202
|
diverge tools call inventory_lookup_stock --args-file args.json # or --args-json - to read stdin
|
|
148
|
-
diverge tools
|
|
203
|
+
diverge tools set writes.json --summary "Coordinators follow their cargo" # several related writes, ONE decision
|
|
204
|
+
diverge tools run calls.json --wait # several independent calls from one file (- for stdin), one JSON line of outcome each
|
|
149
205
|
```
|
|
150
206
|
|
|
151
207
|
Put arguments in a file or on stdin when a shell may touch them: Windows
|
|
@@ -154,10 +210,18 @@ JSON array of `{"tool": "...", "args": {...}}` (or one per line), runs them in
|
|
|
154
210
|
order, and exits with the worst outcome: 1 failed, 4 rejected, 5 expired,
|
|
155
211
|
3 pending, else 0.
|
|
156
212
|
|
|
213
|
+
When several writes serve one intent, raise them with `set` instead: the
|
|
214
|
+
same file format, one pending invocation for the lot, one card for the
|
|
215
|
+
person who decides it. Once approved the calls run in order and stop at the
|
|
216
|
+
first failure; `diverge tools invocation <id>` reads every call's outcome
|
|
217
|
+
(`succeeded`, `failed`, `not_run`) from `result.calls`. A set carries writes
|
|
218
|
+
only, with arguments frozen when it is raised.
|
|
219
|
+
|
|
157
220
|
A write that needs a human is not refused: it is persisted as a pending
|
|
158
221
|
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
|
|
160
|
-
give the same code for the same status, with or without
|
|
222
|
+
id. Branch on the exit code, never on text; `call`, `set`, `run` and
|
|
223
|
+
`invocation <id>` give the same code for the same status, with or without
|
|
224
|
+
`--json`:
|
|
161
225
|
|
|
162
226
|
| code | meaning |
|
|
163
227
|
| --- | --- |
|
|
@@ -170,7 +234,8 @@ give the same code for the same status, with or without `--json`:
|
|
|
170
234
|
|
|
171
235
|
The CLI raises and reads; it never decides. `diverge tools bridge` serves the
|
|
172
236
|
same catalog as a stdio MCP server for clients without a shell, with
|
|
173
|
-
`
|
|
237
|
+
`divergent_submit_set` to raise a set and `divergent_invocation_status` for
|
|
238
|
+
the read-back. `--tools <name,name>` publishes
|
|
174
239
|
and accepts only those tools: the whole catalog is tens of thousands of tokens
|
|
175
240
|
on every request, so a harness gets the tools it was given and nothing else.
|
|
176
241
|
|
|
@@ -212,6 +277,7 @@ non-interactive shells, under `CI`, and with `DIVERGE_NO_UPDATE_CHECK=1`.
|
|
|
212
277
|
| `DIVERGE_HOME` | state directory, default `~/.diverge` |
|
|
213
278
|
| `DIVERGENT_ORG_ID`, `DIVERGENT_PROJECT_ID` | tool scope when the flags are omitted; without either, the login's organization |
|
|
214
279
|
| `DIVERGENT_CLIENT_ID`, `DIVERGENT_CLIENT_SECRET`, `DIVERGENT_USER_ID` | unattended tool execution with service credentials, delegated to that person |
|
|
280
|
+
| `DIVERGENT_TOKEN_FILE` | a file holding the token this session runs on, in place of any login (see Session token) |
|
|
215
281
|
| `DSH_HOME` | where dsh keeps its files, default `~/.dsh` |
|
|
216
282
|
| `DIVERGE_NO_UPDATE_CHECK` | set to skip the once-a-day check for a newer release |
|
|
217
283
|
|