feat: add AI Workspace bridge skills and version gate
This commit is contained in:
@@ -139,6 +139,9 @@ function attachAgent(socket, req) {
|
||||
pairingCode,
|
||||
machineName: cleanString(url.searchParams.get("machineName"), 120),
|
||||
host: "",
|
||||
agentVersion: "",
|
||||
protocolVersion: "",
|
||||
capabilities: [],
|
||||
runtimeStatus: "",
|
||||
runtimeError: "",
|
||||
runtimeCheckedAt: "",
|
||||
@@ -182,6 +185,9 @@ function handleAgentMessage(agent, raw) {
|
||||
if (message?.type === "hello") {
|
||||
agent.machineName = cleanString(message.machineName || agent.machineName, 120);
|
||||
agent.host = cleanString(message.host, 120);
|
||||
agent.agentVersion = cleanString(message.agentVersion, 80);
|
||||
agent.protocolVersion = cleanString(message.protocolVersion, 120);
|
||||
agent.capabilities = cleanStringList(message.capabilities, 80, 80);
|
||||
agent.runtimeStatus = cleanString(message.runtimeStatus, 40);
|
||||
agent.runtimeError = cleanString(message.runtimeError, 1000);
|
||||
agent.runtimeCheckedAt = cleanString(message.runtimeCheckedAt, 80);
|
||||
@@ -189,6 +195,8 @@ function handleAgentMessage(agent, raw) {
|
||||
kind: "hello",
|
||||
message: "Bridge agent hello received.",
|
||||
cwd: cleanString(message.cwd, 500),
|
||||
agentVersion: agent.agentVersion,
|
||||
protocolVersion: agent.protocolVersion,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -564,6 +572,9 @@ function publicAgent(agent) {
|
||||
pairingCode: agent.pairingCode,
|
||||
machineName: agent.machineName,
|
||||
host: agent.host,
|
||||
agentVersion: agent.agentVersion,
|
||||
protocolVersion: agent.protocolVersion,
|
||||
capabilities: agent.capabilities,
|
||||
runtimeStatus: agent.runtimeStatus,
|
||||
runtimeError: agent.runtimeError,
|
||||
runtimeCheckedAt: agent.runtimeCheckedAt,
|
||||
@@ -635,6 +646,20 @@ function cleanString(value, maxLength) {
|
||||
return String(value || "").trim().slice(0, maxLength);
|
||||
}
|
||||
|
||||
function cleanStringList(value, maxItems = 80, maxLength = 120) {
|
||||
const source = Array.isArray(value)
|
||||
? value
|
||||
: String(value || "").split(/[\n,;]+/);
|
||||
const out = [];
|
||||
for (const item of source) {
|
||||
const text = cleanString(item, maxLength);
|
||||
if (!text || out.includes(text)) continue;
|
||||
out.push(text);
|
||||
if (out.length >= maxItems) break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function sanitizeTimeoutMs(value, fallback) {
|
||||
const numeric = Number(value || fallback);
|
||||
if (!Number.isFinite(numeric)) return fallback;
|
||||
|
||||
Reference in New Issue
Block a user