@flame0510/project-aether 1.1.14 → 1.1.15
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/app/api/agents/route.ts +16 -12
- package/package.json +1 -1
package/app/api/agents/route.ts
CHANGED
|
@@ -60,7 +60,6 @@ export async function GET(request: NextRequest): Promise<NextResponse> {
|
|
|
60
60
|
portBindings = inspect.HostConfig?.PortBindings || null;
|
|
61
61
|
|
|
62
62
|
// Read auth token — always prefer the shared agents-token.json (user-managed)
|
|
63
|
-
const cName = (c.Names?.[0] || '').replace(/^\//, '');
|
|
64
63
|
try {
|
|
65
64
|
const tokenRaw = fs.readFileSync(
|
|
66
65
|
AGENTS_TOKEN_FILE,
|
|
@@ -74,18 +73,23 @@ export async function GET(request: NextRequest): Promise<NextResponse> {
|
|
|
74
73
|
// agents-token.json unavailable
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
// Fallback
|
|
76
|
+
// Fallback when the shared file is missing: the container's own token,
|
|
77
|
+
// taken from the inspect data already fetched above.
|
|
78
|
+
//
|
|
79
|
+
// This used to `docker exec … grep OPENCLAW_GATEWAY_TOKEN /root/….env`
|
|
80
|
+
// — a path containing a literal U+2026 ellipsis, so not a path at all.
|
|
81
|
+
// Correcting the character wouldn't have helped: agent containers have
|
|
82
|
+
// no .env file, and no file under /root/ holds that variable (verified
|
|
83
|
+
// across the production fleet). The token exists only in the container
|
|
84
|
+
// environment, which is right here in Config.Env. So the fallback spawned
|
|
85
|
+
// a blocking process per agent to read a file that cannot exist, failed
|
|
86
|
+
// silently, and left every "Open" button without its token — while the
|
|
87
|
+
// value sat in memory, already fetched.
|
|
78
88
|
if (!authToken) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{ timeout: 5000, encoding: 'utf-8' }
|
|
84
|
-
).toString().trim();
|
|
85
|
-
if (token && token !== 'undefined') authToken = token;
|
|
86
|
-
} catch {
|
|
87
|
-
// token unavailable for this container
|
|
88
|
-
}
|
|
89
|
+
const fromEnv = ((inspect.Config?.Env || []) as string[])
|
|
90
|
+
.find((e) => e.startsWith('OPENCLAW_GATEWAY_TOKEN='));
|
|
91
|
+
const token = fromEnv?.slice('OPENCLAW_GATEWAY_TOKEN='.length).trim();
|
|
92
|
+
if (token && token !== 'undefined') authToken = token;
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
// The host port mapped to the agent's Control UI (container port 3000).
|