tinker-agent 1.0.30 → 1.0.32
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/bin/install-agent.sh +0 -10
- package/package.json +1 -1
- package/setup-agent.rb +13 -5
package/bin/install-agent.sh
CHANGED
|
@@ -78,16 +78,6 @@ sudo chown -R ${AGENT_USER}:${GROUP_NAME} ${AGENT_HOME} || echo "⚠️ Failed t
|
|
|
78
78
|
# This ensures the agent can write CLAUDE.md and .mcp.json
|
|
79
79
|
sudo chown ${AGENT_USER}:${GROUP_NAME} $(pwd) || echo "⚠️ Failed to chown project root"
|
|
80
80
|
|
|
81
|
-
# Set GitHub App Key Path if not set
|
|
82
|
-
if [ -z "\$GITHUB_APP_PRIVATE_KEY_PATH" ]; then
|
|
83
|
-
export GITHUB_APP_PRIVATE_KEY_PATH="${AGENT_HOME}/.github-app-privkey.pem"
|
|
84
|
-
else
|
|
85
|
-
# If it was set to /home/claude/... but we are /home/node, fix it
|
|
86
|
-
if [[ "\$GITHUB_APP_PRIVATE_KEY_PATH" == *"/home/claude/"* ]] && [ "${AGENT_HOME}" != "/home/claude" ]; then
|
|
87
|
-
export GITHUB_APP_PRIVATE_KEY_PATH="${AGENT_HOME}/.github-app-privkey.pem"
|
|
88
|
-
fi
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
81
|
# Execute command as agent user
|
|
92
82
|
exec sudo -E -u ${AGENT_USER} env "HOME=${AGENT_HOME}" "\$@"
|
|
93
83
|
EOF
|
package/package.json
CHANGED
package/setup-agent.rb
CHANGED
|
@@ -213,7 +213,15 @@ end
|
|
|
213
213
|
def setup_github_auth!
|
|
214
214
|
app_id = ENV["GITHUB_APP_ID"] || ENV["GITHUB_APP_CLIENT_ID"]
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
# Check for private key in typical locations
|
|
217
|
+
# 1. In the home directory (copied by entrypoint)
|
|
218
|
+
# 2. In /tmp (mounted by docker)
|
|
219
|
+
private_key_path = [
|
|
220
|
+
File.expand_path("~/.github-app-privkey.pem"),
|
|
221
|
+
"/tmp/github-app-privkey.pem"
|
|
222
|
+
].find { |path| File.exist?(path) }
|
|
223
|
+
|
|
224
|
+
if app_id && ENV["GITHUB_APP_INSTALLATION_ID"] && private_key_path
|
|
217
225
|
puts "🔐 Configuring GitHub App authentication..."
|
|
218
226
|
|
|
219
227
|
# Create helper script
|
|
@@ -270,15 +278,15 @@ def setup_github_auth!
|
|
|
270
278
|
def read_cached_token(cache_file)
|
|
271
279
|
return nil unless File.exist?(cache_file)
|
|
272
280
|
cache = JSON.parse(File.read(cache_file))
|
|
273
|
-
|
|
274
|
-
return cache['token'] if expires_at > Time.now + 300
|
|
281
|
+
return if cache['token'].nil? || cache['expires_at'].nil?
|
|
282
|
+
return cache['token'] if Time.parse(cache['expires_at']) > Time.now + 300
|
|
275
283
|
nil
|
|
276
284
|
rescue
|
|
277
285
|
end
|
|
278
286
|
|
|
279
287
|
app_id = ENV['GITHUB_APP_CLIENT_ID'] || ENV['GITHUB_APP_ID']
|
|
280
288
|
installation_id = ENV['GITHUB_APP_INSTALLATION_ID']
|
|
281
|
-
key_path =
|
|
289
|
+
key_path = "#{private_key_path}"
|
|
282
290
|
|
|
283
291
|
puts find_or_create_cached_token(app_id, installation_id, key_path)
|
|
284
292
|
RUBY
|
|
@@ -425,4 +433,4 @@ setup_skills!
|
|
|
425
433
|
setup_github_auth!
|
|
426
434
|
setup_git_config!
|
|
427
435
|
bin_dir = download_agent_bridge!
|
|
428
|
-
run_agent!(bin_dir)
|
|
436
|
+
run_agent!(bin_dir)
|