@claw-link/gateway-host 0.2.2 → 0.2.3

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 CHANGED
@@ -61,6 +61,17 @@ Change the Claude model by editing `.claude/settings.json` (e.g. `"model": "opus
61
61
  For Codex/Cursor, set the model via their CLI (`args_template` in the config, or the
62
62
  tool's own settings).
63
63
 
64
+ **Permissions by scope** — each job carries a scope, and the Claude adapter runs with
65
+ matching permissions automatically:
66
+
67
+ | Trigger | Scope | Claude permissions |
68
+ |---------|-------|--------------------|
69
+ | Admin **Setup via Chat** / apply skill | `configure` | `--permission-mode acceptEdits` — may write workspace files (GUARDRAILS/SOUL/BOOTSTRAP/TOOLS/AGENTS) |
70
+ | Customer chat + discovery | `customer` | `--disallowedTools "Write Edit MultiEdit NotebookEdit Bash"` — **read-only**, cannot edit config or run shell |
71
+
72
+ So an agent's files are editable from the admin panel but never from customer/discovery
73
+ chat. (Operator `args_template` overrides this for advanced setups.)
74
+
64
75
  ## Commands
65
76
 
66
77
  After install the `clhost` command is available (aliases: `gateway-host`, `claw-host`):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claw-link/gateway-host",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "ClawLink Host Gateway — a secure, outbound-only worker that bridges a local agent CLI (OpenClaw, Hermes, Claude, Codex, Cursor) to your ClawLink agents. No inbound ports; authenticated per-agent by a Host Token.",
5
5
  "homepage": "https://claw-link.co",
6
6
  "bin": {
@@ -16,4 +16,11 @@ module.exports = makeCliAdapter({
16
16
  '--verbose',
17
17
  ...(resumeId ? ['--resume', resumeId] : []),
18
18
  ],
19
+ // Admin "configure" turns may write workspace files (auto-accept edits, no shell
20
+ // prompt); customer/discovery turns are strictly read-only (no Write/Edit/Bash) so
21
+ // they can never modify the agent's config or hang on a permission prompt.
22
+ permissions: (scope) =>
23
+ (scope === 'configure' || scope === 'sub_configure')
24
+ ? ['--permission-mode', 'acceptEdits']
25
+ : ['--disallowedTools', 'Write Edit MultiEdit NotebookEdit Bash'],
19
26
  });
@@ -76,9 +76,14 @@ function makeCliAdapter(cfg) {
76
76
  // spawn never fails with ENOENT (coding workspaces are validated at setup).
77
77
  try { fs.mkdirSync(agent.work_dir, { recursive: true }); } catch { /* ignore */ }
78
78
 
79
+ // Scope-based permissions: admin "configure" turns may write workspace files
80
+ // (GUARDRAILS/SOUL/etc.); customer/discovery turns are read-only and cannot
81
+ // edit or run shell. Operator args_template overrides take full control.
82
+ const scope = job.scope || 'customer';
83
+ const permArgs = (!Array.isArray(agent.args_template) && cfg.permissions) ? cfg.permissions(scope) : [];
79
84
  const argvFor = (rid) => Array.isArray(agent.args_template)
80
85
  ? buildArgv(agent.args_template, { prompt: fullPrompt, sessionId: rid || '', systemPrompt })
81
- : cfg.defaultArgs(fullPrompt, rid, cfg.promptViaStdin);
86
+ : [...cfg.defaultArgs(fullPrompt, rid, cfg.promptViaStdin), ...permArgs];
82
87
 
83
88
  let emittedAny = false;
84
89
  const runOnce = async function* (rid) {