tinker-agent 1.0.39 → 1.0.40

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/agents.rb CHANGED
@@ -153,7 +153,7 @@ If blocked (e.g., missing tools, auth errors, ambiguous requirements):
153
153
  },
154
154
  'reviewer' => {
155
155
  name: 'tinker-autonomous-reviewer',
156
- skills: ['review-workflow', 'memory', 'proposal-reviewer'],
156
+ skills: ['reviewer-workflow', 'memory', 'proposal-reviewer'],
157
157
  banner: <<~BANNER
158
158
  You are the **TINKER REVIEWER** agent operating in **FULLY AUTONOMOUS MODE**.
159
159
 
@@ -4,11 +4,13 @@
4
4
  set -e
5
5
 
6
6
  AGENT_TYPE="${AGENT_TYPE:-worker}"
7
+ AGENT_ID="${AGENT_ID:-}"
7
8
  STATUS_FILE="/tmp/agent-bridge-status"
8
9
 
9
10
  # Check if we're already inside tmux
10
11
  if [ -n "$TMUX" ]; then
11
12
  export STATUS_FILE
13
+ export AGENT_ID
12
14
  exec agent-bridge
13
15
  fi
14
16
 
@@ -48,7 +50,7 @@ tmux set-option -t "$SESSION" remain-on-exit off
48
50
  tmux set-option -t "$SESSION" mouse on
49
51
 
50
52
  # Run agent-bridge in tmux session
51
- tmux send-keys -t "$SESSION" "export AGENT_TYPE='$AGENT_TYPE' && export INSIDE_TMUX=1 && agent-bridge" C-m
53
+ tmux send-keys -t "$SESSION" "export AGENT_TYPE='$AGENT_TYPE' && export AGENT_ID='$AGENT_ID' && export INSIDE_TMUX=1 && agent-bridge" C-m
52
54
 
53
55
  # Attach or wait
54
56
  if [ -t 0 ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinker-agent",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "Tinker Agent Runner",
5
5
  "bin": {
6
6
  "tinker-agent": "./run-tinker-agent.rb"
package/setup-agent.rb CHANGED
@@ -68,6 +68,53 @@ def check_env!
68
68
  end
69
69
  end
70
70
 
71
+ def fetch_agent_id!
72
+ rails_api_url = ENV["RAILS_API_URL"]
73
+ rails_api_key = ENV["RAILS_API_KEY"]
74
+
75
+ unless rails_api_url && !rails_api_url.empty? && rails_api_key && !rails_api_key.empty?
76
+ puts "❌ RAILS_API_URL or RAILS_API_KEY not set"
77
+ puts " Agent ID is required for the bridge to connect"
78
+ exit 1
79
+ end
80
+
81
+ # Fetch agent ID from Rails API using api_key
82
+ uri = URI("#{rails_api_url}/whoami")
83
+ http = Net::HTTP.new(uri.host, uri.port)
84
+ http.use_ssl = uri.scheme == "https"
85
+
86
+ request = Net::HTTP::Get.new(uri)
87
+ request["X-API-Key"] = rails_api_key
88
+ request["Accept"] = "application/json"
89
+
90
+ begin
91
+ puts "🔍 Fetching agent ID from #{rails_api_url}/whoami..."
92
+ response = http.request(request)
93
+
94
+ if response.is_a?(Net::HTTPSuccess)
95
+ data = JSON.parse(response.body)
96
+ agent_id = data["agent_id"] || data["id"]
97
+
98
+ if agent_id && !agent_id.to_s.empty?
99
+ ENV["AGENT_ID"] = agent_id.to_s
100
+ puts "✅ Agent ID fetched: #{agent_id}"
101
+ else
102
+ puts "❌ Could not find agent_id in API response"
103
+ puts " Response: #{response.body}"
104
+ exit 1
105
+ end
106
+ else
107
+ puts "❌ Failed to fetch agent ID: #{response.code} #{response.message}"
108
+ puts " Response: #{response.body}"
109
+ exit 1
110
+ end
111
+ rescue => e
112
+ puts "❌ Error fetching agent ID: #{e.message}"
113
+ puts " #{e.class}: #{e.backtrace.first}"
114
+ exit 1
115
+ end
116
+ end
117
+
71
118
  def setup_mcp_config!
72
119
  # MCP config is project-specific and should be provided by the Dockerfile
73
120
  # or mounted at runtime. This script only checks if it exists.
@@ -421,8 +468,13 @@ def run_agent!(bin_dir)
421
468
  puts " Press Ctrl+B then D to detach from tmux"
422
469
  puts ""
423
470
 
471
+ # Build environment variables to pass to agent-bridge-tmux
472
+ # We need to explicitly export AGENT_ID if it was fetched
473
+ env_vars = {}
474
+ env_vars["AGENT_ID"] = ENV["AGENT_ID"] if ENV["AGENT_ID"]
475
+
424
476
  # Run agent-bridge-tmux which handles tmux session and status bar
425
- exec("#{bin_dir}/agent-bridge-tmux")
477
+ exec(env_vars, "#{bin_dir}/agent-bridge-tmux")
426
478
  end
427
479
 
428
480
  # Main
@@ -431,6 +483,7 @@ puts "====================="
431
483
  puts ""
432
484
 
433
485
  check_env!
486
+ fetch_agent_id!
434
487
  setup_mcp_config!
435
488
  setup_claude_config!
436
489
  setup_system_prompt!