@bridge4dev/runner 0.11.0
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/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/adapters/claude.d.ts +19 -0
- package/dist/adapters/claude.js +631 -0
- package/dist/adapters/codex-home.d.ts +61 -0
- package/dist/adapters/codex-home.js +234 -0
- package/dist/adapters/codex-protocol.d.ts +59 -0
- package/dist/adapters/codex-protocol.js +204 -0
- package/dist/adapters/codex.d.ts +61 -0
- package/dist/adapters/codex.js +1406 -0
- package/dist/adapters/types.d.ts +183 -0
- package/dist/adapters/types.js +5 -0
- package/dist/async-queue.d.ts +11 -0
- package/dist/async-queue.js +50 -0
- package/dist/attachments.d.ts +72 -0
- package/dist/attachments.js +149 -0
- package/dist/auth-relay.d.ts +57 -0
- package/dist/auth-relay.js +289 -0
- package/dist/config.d.ts +96 -0
- package/dist/config.js +73 -0
- package/dist/fsview.d.ts +20 -0
- package/dist/fsview.js +122 -0
- package/dist/git.d.ts +54 -0
- package/dist/git.js +168 -0
- package/dist/gitops.d.ts +136 -0
- package/dist/gitops.js +596 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +352 -0
- package/dist/journal.d.ts +118 -0
- package/dist/journal.js +300 -0
- package/dist/log.d.ts +7 -0
- package/dist/log.js +19 -0
- package/dist/paths.d.ts +7 -0
- package/dist/paths.js +33 -0
- package/dist/policy.d.ts +17 -0
- package/dist/policy.js +272 -0
- package/dist/protocol.d.ts +754 -0
- package/dist/protocol.js +154 -0
- package/dist/self-update.d.ts +75 -0
- package/dist/self-update.js +221 -0
- package/dist/status-file.d.ts +14 -0
- package/dist/status-file.js +29 -0
- package/dist/supervisor.d.ts +216 -0
- package/dist/supervisor.js +1648 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/dist/ws-client.d.ts +30 -0
- package/dist/ws-client.js +171 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TrizAI Lab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# @bridge4dev/runner
|
|
2
|
+
|
|
3
|
+
The DevBridge dev runner. It connects one of **your own** machines to
|
|
4
|
+
[DevBridge](https://bridge4.dev) and runs coding-agent sessions on it — Claude Code or
|
|
5
|
+
Codex — against a checkout that never leaves that machine.
|
|
6
|
+
|
|
7
|
+
DevBridge gets no SSH access and no credentials for your server: the runner connects
|
|
8
|
+
**outwards** over WSS and holds the only copy of its own token.
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
|
|
12
|
+
- Node.js ≥ 20
|
|
13
|
+
- git
|
|
14
|
+
- at least one agent CLI already installed and signed in on the machine:
|
|
15
|
+
[Claude Code](https://claude.com/claude-code) or [Codex](https://developers.openai.com/codex/cli)
|
|
16
|
+
- a DevBridge account with a pairing code (dashboard → **Development** → _Connect server_)
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g @bridge4dev/runner
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then pair the machine with the code from the dashboard and install it as a service:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
devbridge-runner pair DBR-XXXXXXXX
|
|
28
|
+
devbridge-runner install-service
|
|
29
|
+
devbridge-runner status # exit code 0 = connected
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`install-service` writes a **systemd user unit** (`CPUQuota=80%`, `MemoryMax=2G`) and starts
|
|
33
|
+
it. If you would rather run it in the foreground, or under your own supervisor, use
|
|
34
|
+
`devbridge-runner daemon`.
|
|
35
|
+
|
|
36
|
+
> Installing globally may print `ERESOLVE` warnings about `zod`: the Claude Agent SDK asks
|
|
37
|
+
> for zod 4 as a peer while the runner uses zod 3. The install succeeds — npm nests its own
|
|
38
|
+
> copy — and nothing is broken. Add `--loglevel=error` if the noise bothers you.
|
|
39
|
+
|
|
40
|
+
## Commands
|
|
41
|
+
|
|
42
|
+
| Command | What it does |
|
|
43
|
+
| ----------------------------------------------- | ----------------------------------------------- |
|
|
44
|
+
| `pair <DBR-code> [--api <url>] [--name <name>]` | Claim a pairing code and store the runner token |
|
|
45
|
+
| `install-service` | Install + start the systemd user service |
|
|
46
|
+
| `daemon` | Run in the foreground |
|
|
47
|
+
| `status` | Connection status; exit code 0 when connected |
|
|
48
|
+
| `set-token <dbr_token>` | Store a token rotated from the dashboard |
|
|
49
|
+
|
|
50
|
+
## What it does on your machine
|
|
51
|
+
|
|
52
|
+
- Creates a **git worktree and a branch per session**, so an agent never works in your
|
|
53
|
+
working copy and never touches your current branch.
|
|
54
|
+
- Enforces a local policy layer the dashboard **cannot** raise: an allow/deny list for
|
|
55
|
+
commands, secret masking in everything it streams, and its own ceiling on how many
|
|
56
|
+
sessions may run at once. Anything the server asks for is bounded by what this config
|
|
57
|
+
permits.
|
|
58
|
+
- Streams the session journal with sequence numbers and acknowledgements, so a restart of
|
|
59
|
+
either side resumes instead of losing work.
|
|
60
|
+
- Never uploads your source. Diffs and file views are requested per file, and files
|
|
61
|
+
matching the secret denylist are refused.
|
|
62
|
+
|
|
63
|
+
## Files it owns
|
|
64
|
+
|
|
65
|
+
| Path | Contents |
|
|
66
|
+
| ---------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
67
|
+
| `~/.config/devbridge-runner/config.toml` | API URL, server id, **runner token** (mode 0600 — this file _is_ the secret store) |
|
|
68
|
+
| `~/.local/state/devbridge-runner/` | Session journals and `status.json` |
|
|
69
|
+
|
|
70
|
+
Both honour `XDG_CONFIG_HOME` / `XDG_STATE_HOME`.
|
|
71
|
+
|
|
72
|
+
## Updating
|
|
73
|
+
|
|
74
|
+
From the dashboard: the server card offers **Update runner** once a newer version is
|
|
75
|
+
available, and the runner replaces itself — smoke-testing the new build before it
|
|
76
|
+
restarts, and rolling back to the previous tarball if that test fails.
|
|
77
|
+
|
|
78
|
+
By hand:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm install -g @bridge4dev/runner && systemctl --user restart devbridge-runner
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
+
import { type AgentAdapter, type AgentSession, type SessionSpec } from './types.js';
|
|
3
|
+
export declare function truncate(text: string, limit?: number): string;
|
|
4
|
+
/**
|
|
5
|
+
* Flatten the AskUserQuestion payload into plain text + option labels.
|
|
6
|
+
* Shape: `{ questions: [{ question, header, options: [{ label, description }] }] }`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseAskUserQuestion(input: Record<string, unknown>): {
|
|
9
|
+
text: string;
|
|
10
|
+
options: string[];
|
|
11
|
+
} | null;
|
|
12
|
+
export declare function classifyRunError(message: string): string;
|
|
13
|
+
export declare class ClaudeAdapter implements AgentAdapter {
|
|
14
|
+
private readonly queryFn;
|
|
15
|
+
readonly id: "claude";
|
|
16
|
+
constructor(queryFn?: typeof query);
|
|
17
|
+
startSession(spec: SessionSpec): AgentSession;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=claude.d.ts.map
|