agent-relay-server 0.22.0 → 0.24.0
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/public/index.html +548 -387
- package/runner/src/adapter.ts +13 -0
- package/src/connectors.ts +37 -1
- package/src/lifecycle-manager.ts +1 -0
- package/src/managed-policy.ts +1 -0
- package/src/mcp.ts +9 -5
- package/src/memory-broker-base.ts +161 -0
- package/src/memory-command-broker.ts +10 -119
- package/src/memory-http-broker.ts +11 -141
- package/src/routes.ts +11 -8
package/src/routes.ts
CHANGED
|
@@ -139,6 +139,7 @@ import { createToken, deleteTokenProfile, getToken, getTokenProfile, listTokenPr
|
|
|
139
139
|
import {
|
|
140
140
|
getConnector,
|
|
141
141
|
listConnectors,
|
|
142
|
+
markConnectorUnreachable,
|
|
142
143
|
readConnectorConfig,
|
|
143
144
|
registerConnectorManifest,
|
|
144
145
|
runConnectorAction,
|
|
@@ -2197,7 +2198,7 @@ function restartSpawnParamsForAgent(
|
|
|
2197
2198
|
const policy = policyName ? getSpawnPolicy(policyName) : null;
|
|
2198
2199
|
const requestedBy = opts.resumeId ? "dashboard-resume" : "dashboard-restart";
|
|
2199
2200
|
if (policy) {
|
|
2200
|
-
const params = { ...
|
|
2201
|
+
const params = { ...buildManagedSpawnParams(policy.value, requestId, { createdBy: "managed-agent" }), agentId: agent.id, requestedBy };
|
|
2201
2202
|
return opts.resumeId ? withClaudeResumeParams(params, opts.resumeId, agent.id) : params;
|
|
2202
2203
|
}
|
|
2203
2204
|
|
|
@@ -4811,11 +4812,6 @@ function policyStatusPayload(policy: SpawnPolicy) {
|
|
|
4811
4812
|
};
|
|
4812
4813
|
}
|
|
4813
4814
|
|
|
4814
|
-
function managedSpawnParams(policy: SpawnPolicy, requestId: string): Record<string, unknown> {
|
|
4815
|
-
return buildManagedSpawnParams(policy, requestId, { createdBy: "managed-agent" });
|
|
4816
|
-
}
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
4815
|
function requirePolicyAndOrchestrator(name: string): { policy: SpawnPolicy; orch: NonNullable<ReturnType<typeof getOrchestrator>> } | Response {
|
|
4820
4816
|
const entry = getSpawnPolicy(name);
|
|
4821
4817
|
if (!entry) return error("spawn policy not found", 404);
|
|
@@ -4861,7 +4857,7 @@ function enqueuePolicyStart(policy: SpawnPolicy, reason: string): Command | Resp
|
|
|
4861
4857
|
target: orch.agentId,
|
|
4862
4858
|
correlationId: requestId,
|
|
4863
4859
|
params: {
|
|
4864
|
-
...
|
|
4860
|
+
...buildManagedSpawnParams(policy, requestId, { createdBy: "managed-agent" }),
|
|
4865
4861
|
reason,
|
|
4866
4862
|
orchestratorId: orch.id,
|
|
4867
4863
|
},
|
|
@@ -4875,7 +4871,7 @@ function enqueuePolicyStop(policy: SpawnPolicy, action: "shutdown" | "restart",
|
|
|
4875
4871
|
if (!orch) return error("orchestrator not found", 404);
|
|
4876
4872
|
const state = getManagedAgentState(policy.name);
|
|
4877
4873
|
const restartRequestId = action === "restart" ? spawnRequestId() : undefined;
|
|
4878
|
-
const restartSpawn = restartRequestId ?
|
|
4874
|
+
const restartSpawn = restartRequestId ? buildManagedSpawnParams(policy, restartRequestId, { createdBy: "managed-agent" }) : undefined;
|
|
4879
4875
|
const nextState = upsertManagedAgentState({
|
|
4880
4876
|
policyName: policy.name,
|
|
4881
4877
|
status: "stopping",
|
|
@@ -5784,6 +5780,13 @@ const postConnectorCall: Handler = async (req, params) => {
|
|
|
5784
5780
|
headers: { "content-type": res.headers.get("content-type") || "application/json" },
|
|
5785
5781
|
});
|
|
5786
5782
|
} catch (e) {
|
|
5783
|
+
// A connection error (refused/reset/DNS) means the advertised endpoint is
|
|
5784
|
+
// genuinely down — reconcile the stale running:true so the dashboard stops
|
|
5785
|
+
// claiming the connector is healthy. A timeout (AbortError) may just be a
|
|
5786
|
+
// slow daemon, so leave its state alone.
|
|
5787
|
+
if ((e as Error).name !== "AbortError") {
|
|
5788
|
+
markConnectorUnreachable(params.id!, `endpoint unreachable: ${(e as Error).message}`);
|
|
5789
|
+
}
|
|
5787
5790
|
return error(`failed to reach connector: ${(e as Error).message}`, 502);
|
|
5788
5791
|
}
|
|
5789
5792
|
};
|