@agentxv2/gateway 0.1.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.
Files changed (175) hide show
  1. package/.env.example +53 -0
  2. package/db/migrations/001_init.sql +117 -0
  3. package/db/migrations/002_agents.sql +20 -0
  4. package/db/migrations/003_a2a_results.sql +23 -0
  5. package/deploy/.env.deploy.example +23 -0
  6. package/deploy/add_swap_build.py +45 -0
  7. package/deploy/build_and_deploy.py +110 -0
  8. package/deploy/build_deploy_a2a.py +190 -0
  9. package/deploy/build_no_lint.py +52 -0
  10. package/deploy/build_on_fe.py +86 -0
  11. package/deploy/build_on_gw.py +98 -0
  12. package/deploy/build_prod.py +54 -0
  13. package/deploy/check_bal.py +31 -0
  14. package/deploy/check_code.py +47 -0
  15. package/deploy/check_deploy.sh +20 -0
  16. package/deploy/check_docs.py +16 -0
  17. package/deploy/check_frontend.py +42 -0
  18. package/deploy/check_frontend2.py +35 -0
  19. package/deploy/check_pks.py +34 -0
  20. package/deploy/check_status.py +32 -0
  21. package/deploy/check_v2.py +8 -0
  22. package/deploy/clean_install.py +28 -0
  23. package/deploy/deploy_a2a.py +58 -0
  24. package/deploy/deploy_a2a.sh +33 -0
  25. package/deploy/deploy_a2a_bg.sh +40 -0
  26. package/deploy/deploy_a2a_v2.py +151 -0
  27. package/deploy/deploy_a2a_v2.sh +36 -0
  28. package/deploy/deploy_bin.py +64 -0
  29. package/deploy/deploy_config.py +34 -0
  30. package/deploy/deploy_final.py +42 -0
  31. package/deploy/deploy_frontend.py +108 -0
  32. package/deploy/deploy_mcp.py +108 -0
  33. package/deploy/deploy_now.py +49 -0
  34. package/deploy/deploy_push_all.py +128 -0
  35. package/deploy/deploy_script.py +64 -0
  36. package/deploy/deploy_sep_a2a.sh +18 -0
  37. package/deploy/dev_mode.py +51 -0
  38. package/deploy/diag.py +12 -0
  39. package/deploy/diff_test.py +22 -0
  40. package/deploy/final_check.py +33 -0
  41. package/deploy/final_deploy.py +50 -0
  42. package/deploy/final_fix.py +54 -0
  43. package/deploy/final_push.py +114 -0
  44. package/deploy/find_frontend.py +38 -0
  45. package/deploy/fix_a2a.py +43 -0
  46. package/deploy/fix_and_build.py +77 -0
  47. package/deploy/fix_and_verify.py +56 -0
  48. package/deploy/fix_build.py +51 -0
  49. package/deploy/forge_deploy.py +67 -0
  50. package/deploy/full_push.py +101 -0
  51. package/deploy/full_push2.py +106 -0
  52. package/deploy/go_prod.py +59 -0
  53. package/deploy/gw_deploy.py +133 -0
  54. package/deploy/gw_final.py +206 -0
  55. package/deploy/gw_restart.py +28 -0
  56. package/deploy/gw_status.py +18 -0
  57. package/deploy/inline_build.py +99 -0
  58. package/deploy/one_shot.py +84 -0
  59. package/deploy/ox_deploy.py +32 -0
  60. package/deploy/pg_setup.py +36 -0
  61. package/deploy/prod_deploy.py +126 -0
  62. package/deploy/prod_final.py +140 -0
  63. package/deploy/prod_go.py +61 -0
  64. package/deploy/prod_one_shot.py +139 -0
  65. package/deploy/prod_setup.sh +62 -0
  66. package/deploy/prod_v2.py +91 -0
  67. package/deploy/prod_v3.py +103 -0
  68. package/deploy/push_docs.py +93 -0
  69. package/deploy/push_mcp.py +66 -0
  70. package/deploy/push_mcp_doc.py +28 -0
  71. package/deploy/push_v063.py +80 -0
  72. package/deploy/push_v2.py +71 -0
  73. package/deploy/qcheck.py +13 -0
  74. package/deploy/qcheck2.py +18 -0
  75. package/deploy/quick_check.py +8 -0
  76. package/deploy/rebuild.py +47 -0
  77. package/deploy/rebuild_frontend.py +44 -0
  78. package/deploy/restart.py +28 -0
  79. package/deploy/restore_frontend.py +42 -0
  80. package/deploy/restore_frontend2.py +41 -0
  81. package/deploy/restore_gateway.py +34 -0
  82. package/deploy/restore_quick.py +33 -0
  83. package/deploy/run_bash.py +19 -0
  84. package/deploy/run_sep.py +20 -0
  85. package/deploy/sdk_upgrade.py +50 -0
  86. package/deploy/server_prepare.py +41 -0
  87. package/deploy/server_setup.py +41 -0
  88. package/deploy/ssh_check.py +14 -0
  89. package/deploy/ssh_push.py +24 -0
  90. package/deploy/start_deploy.py +35 -0
  91. package/deploy/start_frontend.py +12 -0
  92. package/deploy/start_v2.py +29 -0
  93. package/deploy/stat.py +18 -0
  94. package/deploy/tail_log.py +11 -0
  95. package/deploy/update_env.py +32 -0
  96. package/deploy/upload_and_start.py +107 -0
  97. package/deploy/verify_a2a.py +13 -0
  98. package/deploy/verify_mcp.py +37 -0
  99. package/deploy/verify_sdk.py +21 -0
  100. package/dist/config.d.ts +26 -0
  101. package/dist/config.js +41 -0
  102. package/dist/config.js.map +1 -0
  103. package/dist/index.d.ts +1 -0
  104. package/dist/index.js +149 -0
  105. package/dist/index.js.map +1 -0
  106. package/dist/lib/crypto.d.ts +2 -0
  107. package/dist/lib/crypto.js +43 -0
  108. package/dist/lib/crypto.js.map +1 -0
  109. package/dist/lib/db.d.ts +3 -0
  110. package/dist/lib/db.js +26 -0
  111. package/dist/lib/db.js.map +1 -0
  112. package/dist/lib/ethers-utils.d.ts +60 -0
  113. package/dist/lib/ethers-utils.js +186 -0
  114. package/dist/lib/ethers-utils.js.map +1 -0
  115. package/dist/middleware/adminAuth.d.ts +2 -0
  116. package/dist/middleware/adminAuth.js +31 -0
  117. package/dist/middleware/adminAuth.js.map +1 -0
  118. package/dist/middleware/auth.d.ts +22 -0
  119. package/dist/middleware/auth.js +192 -0
  120. package/dist/middleware/auth.js.map +1 -0
  121. package/dist/middleware/error-handler.d.ts +36 -0
  122. package/dist/middleware/error-handler.js +100 -0
  123. package/dist/middleware/error-handler.js.map +1 -0
  124. package/dist/middleware/rate-limiter.d.ts +5 -0
  125. package/dist/middleware/rate-limiter.js +107 -0
  126. package/dist/middleware/rate-limiter.js.map +1 -0
  127. package/dist/routes/a2a.d.ts +2 -0
  128. package/dist/routes/a2a.js +84 -0
  129. package/dist/routes/a2a.js.map +1 -0
  130. package/dist/routes/admin.d.ts +2 -0
  131. package/dist/routes/admin.js +180 -0
  132. package/dist/routes/admin.js.map +1 -0
  133. package/dist/routes/agents.d.ts +2 -0
  134. package/dist/routes/agents.js +43 -0
  135. package/dist/routes/agents.js.map +1 -0
  136. package/dist/routes/chat.d.ts +2 -0
  137. package/dist/routes/chat.js +183 -0
  138. package/dist/routes/chat.js.map +1 -0
  139. package/dist/routes/history.d.ts +2 -0
  140. package/dist/routes/history.js +92 -0
  141. package/dist/routes/history.js.map +1 -0
  142. package/dist/routes/mcp.d.ts +13 -0
  143. package/dist/routes/mcp.js +513 -0
  144. package/dist/routes/mcp.js.map +1 -0
  145. package/dist/routes/tenant.d.ts +2 -0
  146. package/dist/routes/tenant.js +154 -0
  147. package/dist/routes/tenant.js.map +1 -0
  148. package/dist/services/a2a-worker.d.ts +7 -0
  149. package/dist/services/a2a-worker.js +406 -0
  150. package/dist/services/a2a-worker.js.map +1 -0
  151. package/dist/services/agent-indexer.d.ts +4 -0
  152. package/dist/services/agent-indexer.js +124 -0
  153. package/dist/services/agent-indexer.js.map +1 -0
  154. package/e2e_wallet.js +175 -0
  155. package/ecosystem.config.js +17 -0
  156. package/package.json +33 -0
  157. package/src/config.ts +47 -0
  158. package/src/index.ts +143 -0
  159. package/src/lib/crypto.ts +44 -0
  160. package/src/lib/db.ts +25 -0
  161. package/src/lib/ethers-utils.ts +229 -0
  162. package/src/middleware/adminAuth.ts +34 -0
  163. package/src/middleware/auth.ts +244 -0
  164. package/src/middleware/error-handler.ts +109 -0
  165. package/src/middleware/rate-limiter.ts +115 -0
  166. package/src/routes/a2a.ts +97 -0
  167. package/src/routes/admin.ts +219 -0
  168. package/src/routes/agents.ts +52 -0
  169. package/src/routes/chat.ts +219 -0
  170. package/src/routes/history.ts +114 -0
  171. package/src/routes/mcp.ts +567 -0
  172. package/src/routes/tenant.ts +196 -0
  173. package/src/services/a2a-worker.ts +486 -0
  174. package/src/services/agent-indexer.ts +127 -0
  175. package/tsconfig.json +18 -0
@@ -0,0 +1,93 @@
1
+ import paramiko, base64, tarfile, os
2
+
3
+ HOST = '43.156.78.59'
4
+ PWD = 'Asdf1234!'
5
+
6
+ # Create tar of key docs + changed source files
7
+ root = r'c:\Users\apply\Downloads\code\agentx\extracted\Agentx'
8
+ tar_path = r'c:\Users\apply\Downloads\code\agentx_docs_push.tar.gz'
9
+
10
+ files_to_push = [
11
+ 'README.md',
12
+ 'INTEGRATION.md',
13
+ 'DEPLOYMENT.md',
14
+ 'MCP_SETUP.md',
15
+ 'memory/AGENTX_PROGRESS.md',
16
+ 'sdk/README.md',
17
+ 'sdk/package.json',
18
+ 'sdk/src/config/config.ts',
19
+ 'frontend/next.config.js',
20
+ 'frontend/.env.production',
21
+ 'frontend/app/a2a/page.tsx',
22
+ 'frontend/app/user/chat/[agentId]/page.tsx',
23
+ 'contracts/src/erc8004-extensions/A2AProtocolRegistry.sol',
24
+ ]
25
+
26
+ print("Creating tar...")
27
+ with tarfile.open(tar_path, 'w:gz') as tar:
28
+ for f in files_to_push:
29
+ full = os.path.join(root, f)
30
+ if os.path.exists(full):
31
+ tar.add(full, arcname=f)
32
+ print(f" + {f}")
33
+ else:
34
+ print(f" MISSING: {f}")
35
+
36
+ size_kb = os.path.getsize(tar_path) // 1024
37
+ print(f"\n{size_kb} KB")
38
+
39
+ # Upload
40
+ print("\nUploading...")
41
+ t = paramiko.Transport((HOST, 22))
42
+ t.connect(username='ubuntu', password=PWD)
43
+ s = paramiko.SFTPClient.from_transport(t)
44
+ s.put(tar_path, '/tmp/agentx_push.tar.gz')
45
+ s.close()
46
+ t.close()
47
+
48
+ # Push script
49
+ push_script = '''#!/bin/bash
50
+ set -e
51
+ cd /home/ubuntu/agentx-platform
52
+ # Extract updated files
53
+ tar xzf /tmp/agentx_push.tar.gz
54
+ echo "Files extracted"
55
+
56
+ # Check git
57
+ cd /home/ubuntu/workspace/agentx 2>/dev/null || cd /home/ubuntu/agentx-platform
58
+ if [ -d .git ]; then
59
+ git add -A
60
+ git diff --cached --stat
61
+ git commit -m "docs: update to v0.6.2 — production 164 server, A2A v2 dual-chain, MCP setup guide" 2>&1 || echo "No changes to commit"
62
+ git push origin main 2>&1 || echo "Push failed, check remote"
63
+ echo "PUSH_DONE"
64
+ else
65
+ echo "NO_GIT_REPO"
66
+ fi
67
+ '''
68
+
69
+ b64 = base64.b64encode(push_script.encode()).decode()
70
+ c = paramiko.SSHClient()
71
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
72
+ c.connect(HOST, username='ubuntu', password=PWD, timeout=15)
73
+
74
+ # First list git repos
75
+ stdin, stdout, stderr = c.exec_command("find /home/ubuntu -name '.git' -type d 2>/dev/null | head -10")
76
+ print("Git repos:", stdout.read().decode().strip())
77
+
78
+ # Also check what's in workspace
79
+ stdin, stdout, stderr = c.exec_command("ls /home/ubuntu/ 2>/dev/null")
80
+ print("Home:", stdout.read().decode().strip())
81
+
82
+ # Execute push
83
+ stdin, stdout, stderr = c.exec_command(
84
+ f"echo '{b64}' | base64 -d > /tmp/push.sh && chmod +x /tmp/push.sh && bash /tmp/push.sh 2>&1"
85
+ )
86
+ out = stdout.read().decode()
87
+ err = stderr.read().decode()
88
+ print("\n=== Push Result ===")
89
+ print(out)
90
+ if err:
91
+ print("ERR:", err[-500:])
92
+
93
+ c.close()
@@ -0,0 +1,66 @@
1
+ import paramiko, base64
2
+
3
+ HOST = '43.156.78.59'
4
+ PWD = 'Asdf1234!'
5
+
6
+ # Read files
7
+ with open(r'c:\Users\apply\Downloads\code\agentx\extracted\Agentx\gateway\src\routes\mcp.ts', 'r', encoding='utf-8') as f:
8
+ mcp = f.read()
9
+ with open(r'c:\Users\apply\Downloads\code\agentx\extracted\Agentx\gateway\src\index.ts', 'r', encoding='utf-8') as f:
10
+ index = f.read()
11
+ with open(r'c:\Users\apply\Downloads\code\agentx\extracted\Agentx\gateway\src\config.ts', 'r', encoding='utf-8') as f:
12
+ cfg = f.read()
13
+
14
+ b1 = base64.b64encode(mcp.encode()).decode()
15
+ b2 = base64.b64encode(index.encode()).decode()
16
+ b3 = base64.b64encode(cfg.encode()).decode()
17
+
18
+ push = f'''#!/bin/bash
19
+ set -e
20
+ cd /tmp
21
+ rm -rf agentx-mcp-push
22
+ git clone git@github.com:sftgroup/Agentx.git agentx-mcp-push
23
+ cd agentx-mcp-push
24
+ echo '{b1}' | base64 -d > gateway/src/routes/mcp.ts
25
+ echo '{b2}' | base64 -d > gateway/src/index.ts
26
+ echo '{b3}' | base64 -d > gateway/src/config.ts
27
+ git add -A
28
+ git diff --cached --stat
29
+ git commit -m "feat: Gateway MCP server — standard JSON-RPC 2.0 Model Context Protocol endpoint
30
+
31
+ POST /mcp — standard MCP JSON-RPC 2.0 endpoint
32
+ - tools/list → 29 AgentX platform tools
33
+ - tools/call → execute read tools (on-chain via ethers), write tools return tx payload
34
+ - initialize / notifications/initialized → MCP lifecycle handshake
35
+
36
+ Compatible with: Claude Desktop, Cursor, any MCP client
37
+ Claude Desktop config:
38
+ {{ \"mcpServers\": {{ \"agentx\": {{ \"url\": \"http://43.156.225.164:3090/mcp\" }} }} }}
39
+
40
+ Contract addresses configurable via .env (RPC_URL, IDENTITY_REGISTRY, etc.)
41
+ " 2>&1
42
+
43
+ git push origin main 2>&1
44
+ echo "PUSH_OK"
45
+
46
+ git tag -a v0.6.4 -m "v0.6.4 — Gateway MCP Server (standard JSON-RPC 2.0)
47
+ - POST /mcp endpoint with 29 platform tools
48
+ - tools/list + tools/call + initialize
49
+ - On-chain read via ethers.JsonRpcProvider
50
+ - Compatible with Claude Desktop, Cursor, any MCP client
51
+ " 2>&1
52
+
53
+ git push origin v0.6.4 2>&1
54
+ echo "TAG_OK"
55
+ '''
56
+
57
+ pb = base64.b64encode(push.encode()).decode()
58
+ c = paramiko.SSHClient()
59
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
60
+ c.connect(HOST, username='ubuntu', password=PWD, timeout=30)
61
+
62
+ stdin, stdout, stderr = c.exec_command(f"echo '{pb}' | base64 -d | bash 2>&1")
63
+ print(stdout.read().decode())
64
+ err = stderr.read().decode()
65
+ if err: print("E:", err[-500:])
66
+ c.close()
@@ -0,0 +1,28 @@
1
+ import paramiko, base64
2
+
3
+ with open(r'c:\Users\apply\Downloads\code\agentx\extracted\Agentx\MCP_SETUP.md', 'r', encoding='utf-8') as f:
4
+ mcp_doc = f.read()
5
+
6
+ b1 = base64.b64encode(mcp_doc.encode()).decode()
7
+
8
+ push = f'''#!/bin/bash
9
+ set -e
10
+ cd /tmp
11
+ rm -rf agentx-mcp-doc
12
+ git clone git@github.com:sftgroup/Agentx.git agentx-mcp-doc
13
+ cd agentx-mcp-doc
14
+ echo '{b1}' | base64 -d > MCP_SETUP.md
15
+ git add MCP_SETUP.md
16
+ git diff --cached --stat
17
+ git commit -m "docs: MCP_SETUP rewrite — AgentX platform MCP Server usage for Claude Desktop, Cursor, any MCP client" 2>&1
18
+ git push origin main 2>&1
19
+ echo "PUSH_OK"
20
+ '''
21
+
22
+ pb = base64.b64encode(push.encode()).decode()
23
+ c = paramiko.SSHClient()
24
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
25
+ c.connect('43.156.78.59', username='ubuntu', password='Asdf1234!', timeout=30)
26
+ stdin, stdout, stderr = c.exec_command(f"echo '{pb}' | base64 -d | bash 2>&1")
27
+ print(stdout.read().decode())
28
+ c.close()
@@ -0,0 +1,80 @@
1
+ import paramiko, base64
2
+
3
+ HOST = '43.156.78.59'
4
+ PWD = 'Asdf1234!'
5
+
6
+ push_script = '''#!/bin/bash
7
+ set -e
8
+ cd /tmp
9
+ rm -rf agentx-release
10
+ git clone git@github.com:sftgroup/Agentx.git agentx-release
11
+
12
+ # Create platform-tools.ts from embedded content
13
+ cd agentx-release
14
+ '''
15
+ # Read the platform-tools file and embed it
16
+ with open(r'c:\Users\apply\Downloads\code\agentx\extracted\Agentx\sdk\src\agent-loop\platform-tools.ts', 'r', encoding='utf-8') as f:
17
+ platform_tools_content = f.read()
18
+
19
+ # Read the updated index.ts
20
+ with open(r'c:\Users\apply\Downloads\code\agentx\extracted\Agentx\sdk\src\agent-loop\index.ts', 'r', encoding='utf-8') as f:
21
+ agent_loop_index = f.read()
22
+
23
+ # Read package.json
24
+ with open(r'c:\Users\apply\Downloads\code\agentx\extracted\Agentx\sdk\package.json', 'r', encoding='utf-8') as f:
25
+ pkg_json = f.read()
26
+
27
+ import base64 as b64
28
+ b1 = b64.b64encode(platform_tools_content.encode()).decode()
29
+ b2 = b64.b64encode(agent_loop_index.encode()).decode()
30
+ b3 = b64.b64encode(pkg_json.encode()).decode()
31
+
32
+ push_script += f'''
33
+ echo '{b1}' | base64 -d > sdk/src/agent-loop/platform-tools.ts
34
+ echo '{b2}' | base64 -d > sdk/src/agent-loop/index.ts
35
+ echo '{b3}' | base64 -d > sdk/package.json
36
+
37
+ git add -A
38
+ git diff --cached --stat
39
+ git commit -m "feat: platform-tools — Agent directly calls AgentX contracts via LLM tools
40
+
41
+ Exposes ALL 7 AgentX platform modules as OpenAI function-calling tools:
42
+ - IdentityRegistry (register/get/list/exists/count)
43
+ - SubscriptionManager (plan/check/subscribe/cancel/release/fee)
44
+ - A2AProtocol (create/get/complete task, card, user tasks)
45
+ - ReputationRegistry (rate/get/reviews)
46
+ - ConfigurationRegistry (get/list/set)
47
+ - MultiEndpointRegistry (list/active/best-mcp)
48
+ - Gateway API (chat/tenant/usage/keys/models)
49
+
50
+ Functions: buildPlatformTools(), executePlatformTool(), wrapPlatformToolsAsSkills()
51
+ Usage: mix platform tools with agent skills in AgentLoop for full platform access.
52
+ " 2>&1
53
+
54
+ git push origin main 2>&1
55
+ echo "PUSH_OK"
56
+
57
+ git tag -a v0.6.3 -m "v0.6.3 — Platform Tools: Agent LLM-callable contract wrappers
58
+ - 7 modules as 28 built-in OpenAI function-calling tools
59
+ - buildPlatformTools() / executePlatformTool() / wrapPlatformToolsAsSkills()
60
+ - AgentLoop can now directly register agents, manage subscriptions, create A2A tasks,
61
+ rate agents, configure settings, and interact with Gateway — all via LLM function calling
62
+ " 2>&1
63
+
64
+ git push origin v0.6.3 2>&1
65
+ echo "TAG_OK"
66
+ '''
67
+
68
+ push_b64 = b64.b64encode(push_script.encode()).decode()
69
+ c = paramiko.SSHClient()
70
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
71
+ c.connect(HOST, username='ubuntu', password=PWD, timeout=30)
72
+
73
+ stdin, stdout, stderr = c.exec_command(
74
+ f"echo '{push_b64}' | base64 -d | bash 2>&1"
75
+ )
76
+ out = stdout.read().decode()
77
+ err = stderr.read().decode()
78
+ print(out)
79
+ if err: print("E:", err[-500:])
80
+ c.close()
@@ -0,0 +1,71 @@
1
+ import paramiko, base64, tarfile, os
2
+
3
+ HOST = '43.156.78.59'
4
+ PWD = 'Asdf1234!'
5
+
6
+ root = r'c:\Users\apply\Downloads\code\agentx\extracted\Agentx'
7
+ tar_path = r'c:\Users\apply\Downloads\code\agentx_docs_push.tar.gz'
8
+
9
+ # Create tar of all files to push
10
+ files_to_push = [
11
+ 'README.md',
12
+ 'INTEGRATION.md',
13
+ 'DEPLOYMENT.md',
14
+ 'MCP_SETUP.md',
15
+ 'memory/AGENTX_PROGRESS.md',
16
+ 'sdk/README.md',
17
+ 'sdk/package.json',
18
+ 'sdk/src/config/config.ts',
19
+ 'frontend/next.config.js',
20
+ 'frontend/.env.production',
21
+ 'frontend/app/a2a/page.tsx',
22
+ 'frontend/app/user/chat/[agentId]/page.tsx',
23
+ 'contracts/src/erc8004-extensions/A2AProtocolRegistry.sol',
24
+ ]
25
+
26
+ print("Creating tar...")
27
+ with tarfile.open(tar_path, 'w:gz') as tar:
28
+ for f in files_to_push:
29
+ full = os.path.join(root, f)
30
+ if os.path.exists(full):
31
+ tar.add(full, arcname=f)
32
+ print(f" + {f}")
33
+
34
+ print(f"\n{os.path.getsize(tar_path)//1024} KB. Uploading...")
35
+
36
+ t = paramiko.Transport((HOST, 22))
37
+ t.connect(username='ubuntu', password=PWD)
38
+ s = paramiko.SFTPClient.from_transport(t)
39
+ s.put(tar_path, '/tmp/agentx_push.tar.gz')
40
+ s.close()
41
+ t.close()
42
+
43
+ # Clone fresh, overwrite with our files, push
44
+ push_script = r'''#!/bin/bash
45
+ set -e
46
+ cd /tmp
47
+ rm -rf agentx-push
48
+ git clone https://github.com/sftgroup/Agentx.git agentx-push 2>&1 | tail -3
49
+ cd agentx-push
50
+ tar xzf /tmp/agentx_push.tar.gz --overwrite
51
+ git add -A
52
+ git diff --cached --stat
53
+ git commit -m "docs: v0.6.2 — production 164 full-stack, A2A v2 dual-chain, MCP setup, deployment guide" 2>&1
54
+ git push origin main 2>&1
55
+ echo "PUSH_SUCCESS"
56
+ '''
57
+
58
+ b64 = base64.b64encode(push_script.encode()).decode()
59
+ c = paramiko.SSHClient()
60
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
61
+ c.connect(HOST, username='ubuntu', password=PWD, timeout=30)
62
+
63
+ stdin, stdout, stderr = c.exec_command(
64
+ f"echo '{b64}' | base64 -d > /tmp/base_push.sh && chmod +x /tmp/base_push.sh && bash /tmp/base_push.sh 2>&1"
65
+ )
66
+ out = stdout.read().decode()
67
+ err = stderr.read().decode()
68
+ print("\n=== Push Result ===")
69
+ print(out)
70
+ if err: print("E:", err[-500:])
71
+ c.close()
@@ -0,0 +1,13 @@
1
+ import paramiko
2
+ c = paramiko.SSHClient()
3
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
4
+ c.connect('43.156.225.164', username='ubuntu', password='Asdf1234!', timeout=10)
5
+
6
+ stdin, stdout, stderr = c.exec_command(
7
+ "tail -10 /tmp/agentx-deploy.log 2>/dev/null; "
8
+ "echo '===PORT==='; ss -tlnp | grep 3000 || echo NONE; "
9
+ "echo '===BUILD==='; ls /home/ubuntu/agentx-platform/.next/BUILD_ID 2>/dev/null || echo NO_BUILD_ID; "
10
+ "echo '===PROC==='; ps aux | grep -E 'next|npm' | grep -v grep | head -3"
11
+ )
12
+ print(stdout.read().decode())
13
+ c.close()
@@ -0,0 +1,18 @@
1
+ import paramiko
2
+
3
+ c = paramiko.SSHClient()
4
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
5
+ c.connect('43.156.225.164', username='ubuntu', password='Asdf1234!', timeout=10)
6
+
7
+ stdin, stdout, stderr = c.exec_command(
8
+ "ss -tlnp 2>/dev/null | grep -E '3000|3090|5432'"
9
+ )
10
+ print("PORTS:", stdout.read().decode().strip())
11
+
12
+ stdin, stdout, stderr = c.exec_command("curl -s http://localhost:3090/api/v1/health 2>&1")
13
+ print("GW HEALTH:", stdout.read().decode().strip())
14
+
15
+ stdin, stdout, stderr = c.exec_command("curl -sI http://localhost:3000/ 2>&1 | head -2")
16
+ print("FE HTTP:", stdout.read().decode().strip())
17
+
18
+ c.close()
@@ -0,0 +1,8 @@
1
+ import paramiko
2
+ c = paramiko.SSHClient()
3
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
4
+ c.connect('43.156.225.164', username='ubuntu', password='Asdf1234!', timeout=10)
5
+
6
+ stdin, stdout, stderr = c.exec_command("tail -15 /tmp/agentx-deploy.log 2>/dev/null; echo '---PROCESS---'; ps aux | grep -E 'next|npm|node' | grep -v grep | head -5")
7
+ print(stdout.read().decode())
8
+ c.close()
@@ -0,0 +1,47 @@
1
+ import paramiko
2
+ import base64, time
3
+
4
+ c = paramiko.SSHClient()
5
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
6
+ c.connect('43.156.78.59', username='ubuntu', password='Asdf1234!', timeout=30)
7
+
8
+ # Verify env
9
+ stdin, stdout, stderr = c.exec_command("grep A2A /home/ubuntu/agentx-platform/.env.production")
10
+ print("ENV:", stdout.read().decode().strip())
11
+
12
+ # Clean previous
13
+ stdin, stdout, stderr = c.exec_command("fuser -k 8080/tcp 2>/dev/null; pkill -f 'next' 2>/dev/null; pkill -f 'next build' 2>/dev/null; sleep 2; echo cleaned")
14
+ print(stdout.read().decode().strip())
15
+
16
+ # Build (env-only change, should be fast incremental)
17
+ print("\n=== Building... ===")
18
+ stdin, stdout, stderr = c.exec_command(
19
+ "cd /home/ubuntu/agentx-platform && NODE_OPTIONS='--max-old-space-size=1536' npx next build 2>&1 | tail -15",
20
+ timeout=600
21
+ )
22
+ out = stdout.read().decode()
23
+ err = stderr.read().decode()
24
+ ec = stdout.channel.recv_exit_status()
25
+ print(out)
26
+ if err: print("ERR:", err[-200:])
27
+ print(f"Exit: {ec}")
28
+
29
+ if ec != 0:
30
+ print("FAILED")
31
+ c.close()
32
+ exit(1)
33
+
34
+ # Start
35
+ print("\n=== Starting ===")
36
+ stdin, stdout, stderr = c.exec_command(
37
+ "cd /home/ubuntu/agentx-platform && nohup npx next start -p 8080 > /tmp/fe-final2.log 2>&1 &",
38
+ timeout=5
39
+ )
40
+ time.sleep(5)
41
+ stdin, stdout, stderr = c.exec_command("ss -tlnp | grep 8080")
42
+ print("PORT:", stdout.read().decode().strip())
43
+ stdin, stdout, stderr = c.exec_command("tail -2 /tmp/fe-final2.log")
44
+ print("LOG:", stdout.read().decode().strip())
45
+
46
+ c.close()
47
+ print("\nDONE")
@@ -0,0 +1,44 @@
1
+ import paramiko
2
+
3
+ host = '43.156.78.59'
4
+ user = 'ubuntu'
5
+ password = 'Asdf1234!'
6
+
7
+ client = paramiko.SSHClient()
8
+ client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
9
+ client.connect(host, username=user, password=password, timeout=15)
10
+
11
+ def run(cmd):
12
+ print(f"> {cmd}")
13
+ stdin, stdout, stderr = client.exec_command(cmd)
14
+ out = stdout.read().decode()
15
+ err = stderr.read().decode()
16
+ stdout.channel.recv_exit_status()
17
+ if out: print(out[-800:] if len(out) > 800 else out)
18
+ if err: print("ERR:", err[-300:] if len(err) > 300 else err)
19
+ return out
20
+
21
+ # Full install with devDependencies for TailwindCSS etc
22
+ print("=== Full npm install (with devDeps) ===")
23
+ run("cd ~/agentx-platform && npm install 2>&1 | tail -5")
24
+
25
+ # Build
26
+ print("\n=== Building ===")
27
+ run("cd ~/agentx-platform && npx next build 2>&1 | tail -30")
28
+
29
+ # Kill old server and restart
30
+ print("\n=== Restarting ===")
31
+ run("pkill -f 'next-server' 2>/dev/null || true")
32
+ run("sleep 2")
33
+ run("cd ~/agentx-platform && nohup npx next start -p 8080 > /tmp/next.log 2>&1 &")
34
+
35
+ import time
36
+ time.sleep(5)
37
+
38
+ run("curl -s -o /dev/null -w 'HTTP %{http_code}\n' http://localhost:8080/")
39
+
40
+ # Check next.log for any errors
41
+ print("\n=== Next startup log ===")
42
+ run("tail -20 /tmp/next.log 2>/dev/null")
43
+
44
+ client.close()
@@ -0,0 +1,28 @@
1
+ import paramiko, time
2
+
3
+ c = paramiko.SSHClient()
4
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
5
+ c.connect('43.156.78.59', username='ubuntu', password='Asdf1234!', timeout=15)
6
+
7
+ # Kill old
8
+ stdin, stdout, stderr = c.exec_command("fuser -k 8080/tcp 2>/dev/null; pkill -f 'next start' 2>/dev/null; sleep 2; echo cleaned")
9
+ print(stdout.read().decode().strip())
10
+
11
+ # Start
12
+ print("Starting...")
13
+ stdin, stdout, stderr = c.exec_command(
14
+ "cd /home/ubuntu/agentx-platform && nohup npx next start -p 8080 > /tmp/fe-final2.log 2>&1 &",
15
+ timeout=5
16
+ )
17
+ time.sleep(5)
18
+
19
+ # Verify
20
+ stdin, stdout, stderr = c.exec_command("ss -tlnp | grep 8080")
21
+ print("PORT:", stdout.read().decode().strip())
22
+ stdin, stdout, stderr = c.exec_command("tail -2 /tmp/fe-final2.log")
23
+ print("LOG:", stdout.read().decode().strip())
24
+ stdin, stdout, stderr = c.exec_command("curl -sI http://localhost:8080/ 2>&1 | head -3")
25
+ print("HTTP:", stdout.read().decode().strip())
26
+
27
+ c.close()
28
+ print("\n✅ Done")
@@ -0,0 +1,42 @@
1
+ import paramiko
2
+
3
+ host = '43.156.78.59'
4
+ user = 'ubuntu'
5
+ password = 'Asdf1234!'
6
+
7
+ client = paramiko.SSHClient()
8
+ client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
9
+ client.connect(host, username=user, password=password, timeout=15)
10
+
11
+ def run(cmd):
12
+ print(f"> {cmd}")
13
+ stdin, stdout, stderr = client.exec_command(cmd)
14
+ out = stdout.read().decode()
15
+ err = stderr.read().decode()
16
+ stdout.channel.recv_exit_status()
17
+ if out: print(out)
18
+ if err: print("ERR:", err[-300:] if len(err) > 300 else err)
19
+ return out
20
+
21
+ # Kill ALL stuck processes
22
+ print("=== Force killing ===")
23
+ run("pkill -9 -f 'next' 2>/dev/null || true")
24
+ run("pkill -9 -f 'node' 2>/dev/null; sleep 2; echo done")
25
+
26
+ # Check if .next exists from old build
27
+ print("\n=== Checking old build ===")
28
+ run("ls -la ~/agentx-platform/.next/ 2>/dev/null | head -10")
29
+
30
+ # Restart with old build
31
+ print("\n=== Restarting production server ===")
32
+ run("cd ~/agentx-platform && nohup node node_modules/.bin/next start -p 8080 > /tmp/next-prod.log 2>&1 &")
33
+
34
+ import time
35
+ time.sleep(5)
36
+
37
+ run("ss -tlnp | grep 8080")
38
+ run("curl -s -o /dev/null -w 'HTTP %{http_code}\n' http://localhost:8080/")
39
+ run("tail -5 /tmp/next-prod.log 2>/dev/null")
40
+
41
+ client.close()
42
+ print("\nDone - old build restored")
@@ -0,0 +1,41 @@
1
+ import paramiko
2
+ import time
3
+
4
+ host_f = '43.156.78.59'
5
+ user = 'ubuntu'
6
+ password = 'Asdf1234!'
7
+
8
+ c = paramiko.SSHClient()
9
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
10
+ c.connect(host_f, username=user, password=password, timeout=10)
11
+
12
+ def run(cmd):
13
+ print(f"> {cmd}")
14
+ stdin, stdout, stderr = c.exec_command(cmd)
15
+ out = stdout.read().decode()
16
+ err = stderr.read().decode()
17
+ ec = stdout.channel.recv_exit_status()
18
+ if out: print(out[-500:])
19
+ if err: print("ERR:", err[-300:])
20
+ return ec
21
+
22
+ # Kill anything still on 8080
23
+ run("fuser -k 8080/tcp 2>/dev/null; echo 'port freed'")
24
+ time.sleep(1)
25
+
26
+ # Start next dev (compiles on demand, uses existing node_modules)
27
+ print("\n=== Starting next dev ===")
28
+ run("cd ~/agentx-platform && NODE_OPTIONS='--max-old-space-size=512' nohup npx next dev -p 8080 -H 0.0.0.0 > /tmp/dev-8080.log 2>&1 &")
29
+ print("Waiting for Next.js to compile...")
30
+ time.sleep(15)
31
+
32
+ # Check status
33
+ run("ss -tlnp | grep 8080")
34
+ print("\n=== Startup log ===")
35
+ run("tail -15 /tmp/dev-8080.log 2>/dev/null")
36
+
37
+ # Try accessing
38
+ print("\n=== HTTP check ===")
39
+ run("curl -s -o /dev/null -w 'HTTP %{http_code}\n' http://localhost:8080/ 2>&1")
40
+
41
+ c.close()
@@ -0,0 +1,34 @@
1
+ import paramiko
2
+ import time
3
+
4
+ host_g = '101.33.109.117'
5
+ user = 'ubuntu'
6
+ password = 'Asdf1234!'
7
+
8
+ c = paramiko.SSHClient()
9
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
10
+ c.connect(host_g, username=user, password=password, timeout=10)
11
+
12
+ def run(cmd):
13
+ print(f"> {cmd}")
14
+ stdin, stdout, stderr = c.exec_command(cmd)
15
+ out = stdout.read().decode()
16
+ err = stderr.read().decode()
17
+ ec = stdout.channel.recv_exit_status()
18
+ if out: print(out)
19
+ if err: print("ERR:", err[:200])
20
+ return ec
21
+
22
+ # Check and restart PM2 daemon if needed
23
+ print("=== Gateway Status ===")
24
+ print("1. Checking if PM2 daemon is alive...")
25
+ ec = run("pm2 ping 2>&1")
26
+ if ec != 0:
27
+ print("PM2 daemon is dead, restarting...")
28
+ run("pm2 resurrect 2>/dev/null || true")
29
+ time.sleep(2)
30
+
31
+ run("pm2 list 2>&1")
32
+ run("curl -s http://localhost:3090/api/v1/health")
33
+
34
+ c.close()
@@ -0,0 +1,33 @@
1
+ import paramiko
2
+ import time
3
+
4
+ host_f = '43.156.78.59'
5
+ c = paramiko.SSHClient()
6
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
7
+ c.connect(host_f, username='ubuntu', password='Asdf1234!', timeout=10)
8
+
9
+ def run(cmd):
10
+ print(f"> {cmd}")
11
+ stdin, stdout, stderr = c.exec_command(cmd)
12
+ out = stdout.read().decode()
13
+ err = stderr.read().decode()
14
+ stdout.channel.recv_exit_status()
15
+ if out: print(out[-600:])
16
+ if err: print("ERR:", err[-300:])
17
+
18
+ # Kill everything
19
+ run("fuser -k 8080/tcp 2>/dev/null; pkill -f 'next' 2>/dev/null; sleep 2; echo done")
20
+
21
+ # Check if old .next build has the compiled chat page
22
+ print("\n=== Checking old build ===")
23
+ run("find ~/agentx-platform/.next -name '*chat*' -o -name '*agentId*' 2>/dev/null | head -10")
24
+ run("ls ~/agentx-platform/.next/server/app/user/chat/ 2>/dev/null")
25
+
26
+ # Check if we can just start the old build
27
+ print("\n=== Attempting to start old build ===")
28
+ run("cd ~/agentx-platform && nohup npx next start -p 8080 > /tmp/ns.log 2>&1 &")
29
+ time.sleep(4)
30
+ run("ss -tlnp | grep 8080")
31
+ run("cat /tmp/ns.log 2>/dev/null | head -10")
32
+
33
+ c.close()
@@ -0,0 +1,19 @@
1
+ import paramiko
2
+
3
+ transport = paramiko.Transport(('43.156.78.59', 22))
4
+ transport.connect(username='ubuntu', password='Asdf1234!')
5
+ sftp = paramiko.SFTPClient.from_transport(transport)
6
+ sftp.put(r'c:\Users\apply\Downloads\code\agentx\extracted\Agentx\gateway\deploy\deploy_a2a.sh', '/tmp/deploy_a2a.sh')
7
+ sftp.close()
8
+ transport.close()
9
+
10
+ c = paramiko.SSHClient()
11
+ c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
12
+ c.connect('43.156.78.59', username='ubuntu', password='Asdf1234!', timeout=30)
13
+ stdin, stdout, stderr = c.exec_command('chmod +x /tmp/deploy_a2a.sh && bash /tmp/deploy_a2a.sh 2>&1', timeout=600)
14
+ out = stdout.read().decode()
15
+ err = stderr.read().decode()
16
+ ec = stdout.channel.recv_exit_status()
17
+ print(out[-2000:])
18
+ if err: print("STDERR:", err[-500:])
19
+ c.close()