@geravant/sinain 1.6.9 → 1.7.1
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/package.json +1 -1
- package/sinain-agent/.env.example +6 -0
- package/sinain-agent/run.sh +22 -1
package/package.json
CHANGED
|
@@ -15,3 +15,9 @@ SINAIN_HEARTBEAT_INTERVAL=900 # seconds between heartbeat ticks (15 min)
|
|
|
15
15
|
|
|
16
16
|
# ── Workspace ──
|
|
17
17
|
SINAIN_WORKSPACE=~/.openclaw/workspace # knowledge files, curation scripts, playbook
|
|
18
|
+
|
|
19
|
+
# ── Tool permissions (Claude only) ──
|
|
20
|
+
# Tools auto-approved without prompting (space-separated).
|
|
21
|
+
# Default: auto-derived from MCP config server names (e.g. mcp__sinain).
|
|
22
|
+
# Format: mcp__<server> (all tools) | mcp__<server>__<tool> (specific) | Bash(pattern)
|
|
23
|
+
# SINAIN_ALLOWED_TOOLS=mcp__sinain mcp__github Bash(git *)
|
package/sinain-agent/run.sh
CHANGED
|
@@ -29,6 +29,21 @@ HEARTBEAT_INTERVAL="${SINAIN_HEARTBEAT_INTERVAL:-900}" # 15 minutes
|
|
|
29
29
|
AGENT="${SINAIN_AGENT:-claude}"
|
|
30
30
|
WORKSPACE="${SINAIN_WORKSPACE:-$HOME/.openclaw/workspace}"
|
|
31
31
|
|
|
32
|
+
# Build allowed tools list for Claude's --allowedTools flag.
|
|
33
|
+
# SINAIN_ALLOWED_TOOLS in .env overrides; otherwise auto-derive from MCP config.
|
|
34
|
+
if [ -n "${SINAIN_ALLOWED_TOOLS:-}" ]; then
|
|
35
|
+
ALLOWED_TOOLS="$SINAIN_ALLOWED_TOOLS"
|
|
36
|
+
elif [ -f "$MCP_CONFIG" ]; then
|
|
37
|
+
ALLOWED_TOOLS=$(python3 -c "
|
|
38
|
+
import json
|
|
39
|
+
with open('$MCP_CONFIG') as f:
|
|
40
|
+
cfg = json.load(f)
|
|
41
|
+
print(' '.join('mcp__' + s for s in cfg.get('mcpServers', {})))
|
|
42
|
+
" 2>/dev/null || echo "mcp__sinain")
|
|
43
|
+
else
|
|
44
|
+
ALLOWED_TOOLS="mcp__sinain"
|
|
45
|
+
fi
|
|
46
|
+
|
|
32
47
|
# --- Agent profiles ---
|
|
33
48
|
|
|
34
49
|
# Returns 0 if the selected agent supports MCP tools natively.
|
|
@@ -51,15 +66,20 @@ invoke_agent() {
|
|
|
51
66
|
claude)
|
|
52
67
|
claude --enable-auto-mode \
|
|
53
68
|
--mcp-config "$MCP_CONFIG" \
|
|
69
|
+
${ALLOWED_TOOLS:+--allowedTools $ALLOWED_TOOLS} \
|
|
54
70
|
--max-turns 5 --output-format text \
|
|
55
71
|
-p "$prompt"
|
|
56
72
|
;;
|
|
57
73
|
codex)
|
|
58
74
|
codex exec -s danger-full-access \
|
|
75
|
+
--dangerously-bypass-approvals-and-sandbox \
|
|
59
76
|
"$prompt"
|
|
60
77
|
;;
|
|
61
78
|
junie)
|
|
62
79
|
if $JUNIE_HAS_MCP; then
|
|
80
|
+
if [ ! -f "$HOME/.junie/allowlist.json" ]; then
|
|
81
|
+
echo " ⚠ Junie: no allowlist.json — MCP tools may prompt. Run junie --brave once to create it." >&2
|
|
82
|
+
fi
|
|
63
83
|
junie --output-format text \
|
|
64
84
|
--mcp-location "$JUNIE_MCP_DIR" \
|
|
65
85
|
--task "$prompt"
|
|
@@ -68,7 +88,7 @@ invoke_agent() {
|
|
|
68
88
|
fi
|
|
69
89
|
;;
|
|
70
90
|
goose)
|
|
71
|
-
goose run --text "$prompt" \
|
|
91
|
+
GOOSE_MODE=auto goose run --text "$prompt" \
|
|
72
92
|
--output-format text \
|
|
73
93
|
--max-turns 10
|
|
74
94
|
;;
|
|
@@ -169,6 +189,7 @@ fi
|
|
|
169
189
|
echo "sinain bare agent started"
|
|
170
190
|
echo " Agent: $AGENT ($AGENT_MODE)"
|
|
171
191
|
echo " Core: $CORE_URL"
|
|
192
|
+
echo " Allowed: ${ALLOWED_TOOLS:-<none>}"
|
|
172
193
|
echo " Poll: every ${POLL_INTERVAL}s"
|
|
173
194
|
echo " Heartbeat: every ${HEARTBEAT_INTERVAL}s"
|
|
174
195
|
echo " Press Ctrl+C to stop"
|