letagents 0.8.1 → 0.10.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/dist/mcp/local-state.js +94 -11
- package/dist/mcp/room-id.js +3 -0
- package/dist/mcp/server.js +814 -79
- package/dist/shared/agent-identity.js +104 -0
- package/package.json +2 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const STRUCTURED_AGENT_LABEL_SEPARATOR = " | ";
|
|
2
|
+
const IDE_LABELS = new Map([
|
|
3
|
+
["agent", "Agent"],
|
|
4
|
+
["antigravity", "Antigravity"],
|
|
5
|
+
["claude", "Claude"],
|
|
6
|
+
["codex", "Codex"],
|
|
7
|
+
["orchestrator", "Orchestrator"],
|
|
8
|
+
]);
|
|
9
|
+
function normalizeWhitespace(value) {
|
|
10
|
+
return value.trim().replace(/\s+/g, " ");
|
|
11
|
+
}
|
|
12
|
+
function normalizeIdeLabel(value) {
|
|
13
|
+
const normalized = normalizeWhitespace(String(value ?? ""))
|
|
14
|
+
.toLowerCase()
|
|
15
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
16
|
+
.replace(/^-+|-+$/g, "");
|
|
17
|
+
if (!normalized) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return IDE_LABELS.get(normalized) ?? toTitleCaseCodename(normalized);
|
|
21
|
+
}
|
|
22
|
+
export function toTitleCaseCodename(value) {
|
|
23
|
+
const normalized = normalizeWhitespace(value);
|
|
24
|
+
if (!normalized) {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
return normalized
|
|
28
|
+
.split(/[-\s]+/)
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase())
|
|
31
|
+
.join(" ");
|
|
32
|
+
}
|
|
33
|
+
export function formatOwnerAttribution(ownerLabel) {
|
|
34
|
+
const trimmed = normalizeWhitespace(ownerLabel) || "Owner";
|
|
35
|
+
return /s$/i.test(trimmed) ? `${trimmed}' agent` : `${trimmed}'s agent`;
|
|
36
|
+
}
|
|
37
|
+
export function inferAgentIdeLabel(value) {
|
|
38
|
+
const normalized = normalizeWhitespace(String(value ?? "")).toLowerCase();
|
|
39
|
+
if (!normalized) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
if (normalized === "codex" || normalized.startsWith("codex-")) {
|
|
43
|
+
return "Codex";
|
|
44
|
+
}
|
|
45
|
+
if (normalized === "antigravity" || normalized.startsWith("antigravity-")) {
|
|
46
|
+
return "Antigravity";
|
|
47
|
+
}
|
|
48
|
+
if (normalized === "claude" || normalized.startsWith("claude-")) {
|
|
49
|
+
return "Claude";
|
|
50
|
+
}
|
|
51
|
+
if (normalized === "orchestrator" || normalized.startsWith("orchestrator-")) {
|
|
52
|
+
return "Orchestrator";
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
export function buildAgentActorLabel(input) {
|
|
57
|
+
const displayName = normalizeWhitespace(input.display_name) || "Agent";
|
|
58
|
+
const ownerAttribution = formatOwnerAttribution(input.owner_label);
|
|
59
|
+
const ideLabel = normalizeIdeLabel(input.ide_label) ?? "Agent";
|
|
60
|
+
return [displayName, ownerAttribution, ideLabel].join(STRUCTURED_AGENT_LABEL_SEPARATOR);
|
|
61
|
+
}
|
|
62
|
+
export function parseAgentActorLabel(value) {
|
|
63
|
+
const raw = normalizeWhitespace(String(value ?? ""));
|
|
64
|
+
if (!raw) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const structuredParts = raw
|
|
68
|
+
.split(STRUCTURED_AGENT_LABEL_SEPARATOR)
|
|
69
|
+
.map((part) => normalizeWhitespace(part))
|
|
70
|
+
.filter(Boolean);
|
|
71
|
+
if (structuredParts.length === 3 &&
|
|
72
|
+
/agent$/i.test(structuredParts[1]) &&
|
|
73
|
+
normalizeIdeLabel(structuredParts[2])) {
|
|
74
|
+
return {
|
|
75
|
+
raw,
|
|
76
|
+
display_name: structuredParts[0],
|
|
77
|
+
owner_attribution: structuredParts[1],
|
|
78
|
+
ide_label: normalizeIdeLabel(structuredParts[2]),
|
|
79
|
+
structured: true,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const legacyMatch = raw.match(/^(.*?)\s*\(([^)]+agent)\)$/i);
|
|
83
|
+
if (legacyMatch) {
|
|
84
|
+
const displayName = normalizeWhitespace(legacyMatch[1] ?? "") || raw;
|
|
85
|
+
const ownerAttribution = normalizeWhitespace(legacyMatch[2] ?? "") || null;
|
|
86
|
+
return {
|
|
87
|
+
raw,
|
|
88
|
+
display_name: displayName,
|
|
89
|
+
owner_attribution: ownerAttribution,
|
|
90
|
+
ide_label: inferAgentIdeLabel(displayName),
|
|
91
|
+
structured: false,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
raw,
|
|
96
|
+
display_name: raw,
|
|
97
|
+
owner_attribution: null,
|
|
98
|
+
ide_label: inferAgentIdeLabel(raw),
|
|
99
|
+
structured: false,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function getAgentPrimaryLabel(value) {
|
|
103
|
+
return parseAgentActorLabel(value)?.display_name ?? normalizeWhitespace(String(value ?? ""));
|
|
104
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "letagents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Let Agents Chat — MCP server for AI agent communication",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/mcp/server.js",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/mcp/**",
|
|
12
|
+
"dist/shared/**",
|
|
12
13
|
"README.md"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|