@clagentic/console 1.2.0-beta.1 → 1.2.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/lib/agents.js +47 -0
- package/lib/daemon.js +22 -34
- package/lib/project-memory.js +2 -3
- package/lib/public/emoji-data.json +1 -1
- package/lib/public/modules/app-skills-install.js +1 -5
- package/lib/public/modules/emoji-picker.js +1 -0
- package/lib/public/modules/mention.js +1 -1
- package/lib/relay-agent-claims.js +85 -35
- package/lib/sdk-bridge.js +12 -0
- package/package.json +1 -1
package/lib/agents.js
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
//
|
|
27
27
|
// This implementation lives only on our fork; we are not pushing it upstream.
|
|
28
28
|
|
|
29
|
+
var fs = require("fs");
|
|
29
30
|
var path = require("path");
|
|
30
31
|
var os = require("os");
|
|
31
32
|
|
|
@@ -79,6 +80,51 @@ function slugifyAgentName(name) {
|
|
|
79
80
|
.slice(0, 64);
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
// lr-4c90 — Read the tools list for a named agent directly from its on-disk
|
|
84
|
+
// frontmatter. The SDK AgentInfo surface (supportedAgents()) does not expose
|
|
85
|
+
// the tools field — only name, description, and model are returned. Reading
|
|
86
|
+
// the file directly is the only synchronous path for belt-and-suspenders
|
|
87
|
+
// enforcement in the query setup path.
|
|
88
|
+
//
|
|
89
|
+
// agentName: the agent identity string (e.g. "agentic-director").
|
|
90
|
+
// Returns: string[] of tool names if the tools field is a valid JSON array,
|
|
91
|
+
// null if the file is absent, the frontmatter is missing, or the
|
|
92
|
+
// tools field cannot be parsed.
|
|
93
|
+
//
|
|
94
|
+
// Failures are silent (logged at debug level) — callers treat null as "no
|
|
95
|
+
// restriction from this source" and fall through to whatever the SDK applies
|
|
96
|
+
// via claudeOpts.agent.
|
|
97
|
+
function readAgentToolsFromFile(agentName) {
|
|
98
|
+
if (!agentName || typeof agentName !== "string") return null;
|
|
99
|
+
var slug = slugifyAgentName(agentName);
|
|
100
|
+
if (!slug) return null;
|
|
101
|
+
var filePath = path.join(AGENTS_SOURCE_DIR, slug + ".md");
|
|
102
|
+
var raw;
|
|
103
|
+
try {
|
|
104
|
+
raw = fs.readFileSync(filePath, "utf8");
|
|
105
|
+
} catch (e) {
|
|
106
|
+
// File not found is expected for agents with no on-disk definition.
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
var parsed = parseFrontmatter(raw);
|
|
110
|
+
if (!parsed || !parsed.meta) return null;
|
|
111
|
+
var toolsVal = parsed.meta.tools;
|
|
112
|
+
if (!toolsVal || typeof toolsVal !== "string") return null;
|
|
113
|
+
var trimmed = toolsVal.trim();
|
|
114
|
+
if (trimmed.charAt(0) !== "[") return null; // not a JSON array — skip
|
|
115
|
+
try {
|
|
116
|
+
var arr = JSON.parse(trimmed);
|
|
117
|
+
if (!Array.isArray(arr)) return null;
|
|
118
|
+
var result = [];
|
|
119
|
+
for (var i = 0; i < arr.length; i++) {
|
|
120
|
+
if (typeof arr[i] === "string" && arr[i]) result.push(arr[i]);
|
|
121
|
+
}
|
|
122
|
+
return result.length > 0 ? result : null;
|
|
123
|
+
} catch (e) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
82
128
|
// --- SDK-backed discovery cache ---
|
|
83
129
|
|
|
84
130
|
// Module-level cache. Populated by refresh(); read by getAll().
|
|
@@ -182,6 +228,7 @@ module.exports = {
|
|
|
182
228
|
PLUGINS_CACHE_DIR: PLUGINS_CACHE_DIR,
|
|
183
229
|
parseFrontmatter: parseFrontmatter,
|
|
184
230
|
slugifyAgentName: slugifyAgentName,
|
|
231
|
+
readAgentToolsFromFile: readAgentToolsFromFile,
|
|
185
232
|
// New SDK-backed surface:
|
|
186
233
|
refresh: refresh,
|
|
187
234
|
getAll: getAll,
|
package/lib/daemon.js
CHANGED
|
@@ -1320,44 +1320,32 @@ var ipc = createIPCServer(socketPath(), function (msg) {
|
|
|
1320
1320
|
return { ok: true };
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
|
-
// Production:
|
|
1324
|
-
|
|
1323
|
+
// Production: install to global npm, then shut down so the process manager
|
|
1324
|
+
// (systemd / clagentic-daemon.sh) restarts from the updated global install.
|
|
1325
|
+
// This is the only reliable path — npx installs to a cache location that the
|
|
1326
|
+
// restart wrapper does not consult, so npx-spawned daemons get replaced by the
|
|
1327
|
+
// old global version on the next supervised restart.
|
|
1328
|
+
var { execFileSync: execFileUpd } = require("child_process");
|
|
1325
1329
|
var updTag = config.updateChannel === "beta" ? "beta" : "latest";
|
|
1326
|
-
var
|
|
1330
|
+
var updOk = false;
|
|
1327
1331
|
try {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
updDaemonScript = path.resolve(updDaemonScript);
|
|
1337
|
-
console.log("[daemon] Resolved updated daemon:", updDaemonScript);
|
|
1332
|
+
console.log("[daemon] Installing @clagentic/console@" + updTag + " globally...");
|
|
1333
|
+
execFileUpd("npm", ["install", "-g", "@clagentic/console@" + updTag], {
|
|
1334
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1335
|
+
timeout: 120000,
|
|
1336
|
+
encoding: "utf8",
|
|
1337
|
+
});
|
|
1338
|
+
console.log("[daemon] Global install complete. Shutting down for supervised restart.");
|
|
1339
|
+
updOk = true;
|
|
1338
1340
|
} catch (updErr) {
|
|
1339
|
-
console.log("[daemon]
|
|
1340
|
-
|
|
1341
|
-
|
|
1341
|
+
console.log("[daemon] Global install failed:", updErr.message);
|
|
1342
|
+
relay.broadcastAll({ type: "update_failed", error: updErr.message });
|
|
1343
|
+
return { ok: false, error: updErr.message };
|
|
1344
|
+
}
|
|
1345
|
+
if (updOk) {
|
|
1346
|
+
updateHandoff = true;
|
|
1347
|
+
setTimeout(function () { gracefulShutdown(); }, 100);
|
|
1342
1348
|
}
|
|
1343
|
-
// Spawn new daemon process — it will retry if port is still in use
|
|
1344
|
-
var { logPath: updLogPath, configPath: updConfigPath } = require("./config");
|
|
1345
|
-
var updLogFd = fs.openSync(updLogPath(), "a");
|
|
1346
|
-
var updChild = spawnUpd(process.execPath, [updDaemonScript], {
|
|
1347
|
-
detached: true,
|
|
1348
|
-
windowsHide: true,
|
|
1349
|
-
stdio: ["ignore", updLogFd, updLogFd],
|
|
1350
|
-
env: Object.assign({}, process.env, {
|
|
1351
|
-
CLAGENTIC_CONFIG: updConfigPath(),
|
|
1352
|
-
}),
|
|
1353
|
-
});
|
|
1354
|
-
updChild.unref();
|
|
1355
|
-
fs.closeSync(updLogFd);
|
|
1356
|
-
config.pid = updChild.pid;
|
|
1357
|
-
saveConfig(config);
|
|
1358
|
-
console.log("[daemon] Spawned new daemon (PID " + updChild.pid + "), shutting down...");
|
|
1359
|
-
updateHandoff = true;
|
|
1360
|
-
setTimeout(function () { gracefulShutdown(); }, 100);
|
|
1361
1349
|
return { ok: true };
|
|
1362
1350
|
}
|
|
1363
1351
|
|
package/lib/project-memory.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Memory engine stub — memory was
|
|
3
|
-
*
|
|
4
|
-
* project.js interface so existing call sites compile cleanly.
|
|
2
|
+
* Memory engine stub — memory was part of the Mates feature (removed lr-316f).
|
|
3
|
+
* This stub satisfies the project.js interface so existing call sites compile cleanly.
|
|
5
4
|
*
|
|
6
5
|
* handleMemoryList / handleMemorySearch / handleMemoryDelete are
|
|
7
6
|
* kept as no-ops; the WS message types (memory_list etc.) still
|