@lobehub/cli 0.0.16 → 0.0.17
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/index.js +63 -0
- package/man/man1/lh.1 +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -207142,6 +207142,68 @@ async function runCommand$1({ command, cwd, description, env: extraEnv, run_in_b
|
|
|
207142
207142
|
}
|
|
207143
207143
|
}
|
|
207144
207144
|
|
|
207145
|
+
//#endregion
|
|
207146
|
+
//#region src/tools/getAgentProfile.ts
|
|
207147
|
+
const IDENTITY_FILES$1 = ["IDENTITY.md", "SOUL.md"];
|
|
207148
|
+
/**
|
|
207149
|
+
* Try to extract a description from the workspace identity file.
|
|
207150
|
+
* Looks for Creature / Vibe / Description fields in IDENTITY.md or SOUL.md.
|
|
207151
|
+
*/
|
|
207152
|
+
function readDescriptionFromWorkspace(workspacePath) {
|
|
207153
|
+
for (const filename of IDENTITY_FILES$1) {
|
|
207154
|
+
const filePath = path.join(workspacePath, filename);
|
|
207155
|
+
if (!fs.existsSync(filePath)) continue;
|
|
207156
|
+
const match = fs.readFileSync(filePath, "utf8").match(/\*{0,2}(?:Creature|Vibe|Description):?\*{0,2}\s*(.+)/i);
|
|
207157
|
+
if (!match) continue;
|
|
207158
|
+
const value = match[1].trim();
|
|
207159
|
+
if (/^[_*((].*[))*_]$|^(?:tbd|todo|n\/?a|none|待定|未定)$/i.test(value)) continue;
|
|
207160
|
+
return value;
|
|
207161
|
+
}
|
|
207162
|
+
}
|
|
207163
|
+
function getOpenClawProfile(agentId) {
|
|
207164
|
+
let output;
|
|
207165
|
+
try {
|
|
207166
|
+
output = execFileSync("openclaw", [
|
|
207167
|
+
"agents",
|
|
207168
|
+
"list",
|
|
207169
|
+
"--json"
|
|
207170
|
+
], {
|
|
207171
|
+
encoding: "utf8",
|
|
207172
|
+
timeout: 5e3
|
|
207173
|
+
});
|
|
207174
|
+
} catch {
|
|
207175
|
+
return {};
|
|
207176
|
+
}
|
|
207177
|
+
let agents;
|
|
207178
|
+
try {
|
|
207179
|
+
agents = JSON.parse(output);
|
|
207180
|
+
} catch {
|
|
207181
|
+
return {};
|
|
207182
|
+
}
|
|
207183
|
+
const agent = agentId ? agents.find((a) => a.id === agentId) : agents.find((a) => a.isDefault) ?? agents[0];
|
|
207184
|
+
if (!agent) return {};
|
|
207185
|
+
const title = agent.identityName || void 0;
|
|
207186
|
+
return {
|
|
207187
|
+
avatar: agent.identityEmoji || "🦞",
|
|
207188
|
+
description: agent.workspace ? readDescriptionFromWorkspace(agent.workspace) : void 0,
|
|
207189
|
+
title
|
|
207190
|
+
};
|
|
207191
|
+
}
|
|
207192
|
+
/**
|
|
207193
|
+
* Fetch the agent profile (title, avatar, description) from the platform
|
|
207194
|
+
* installed on this device. Dispatched by the server via `device.getAgentProfile`.
|
|
207195
|
+
*
|
|
207196
|
+
* - openclaw: `openclaw agents list --json` for name + emoji, workspace
|
|
207197
|
+
* IDENTITY.md for description fallback
|
|
207198
|
+
* - hermes: not yet implemented — returns empty profile
|
|
207199
|
+
*/
|
|
207200
|
+
async function getAgentProfile(params) {
|
|
207201
|
+
const { platform, agentId } = params;
|
|
207202
|
+
if (platform === "openclaw") return getOpenClawProfile(agentId);
|
|
207203
|
+
if (platform === "hermes") return {};
|
|
207204
|
+
return {};
|
|
207205
|
+
}
|
|
207206
|
+
|
|
207145
207207
|
//#endregion
|
|
207146
207208
|
//#region src/tools/shell.ts
|
|
207147
207209
|
const processManager = new ShellProcessManager();
|
|
@@ -207166,6 +207228,7 @@ async function killCommand(params) {
|
|
|
207166
207228
|
const methodMap = {
|
|
207167
207229
|
cancelHeteroTask,
|
|
207168
207230
|
checkPlatformCapability,
|
|
207231
|
+
getAgentProfile,
|
|
207169
207232
|
editFile: editLocalFile,
|
|
207170
207233
|
getCommandOutput,
|
|
207171
207234
|
globFiles: globLocalFiles,
|
package/man/man1/lh.1
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.\" Code generated by `npm run man:generate`; DO NOT EDIT.
|
|
2
2
|
.\" Manual command details come from the Commander command tree.
|
|
3
|
-
.TH LH 1 "" "@lobehub/cli 0.0.
|
|
3
|
+
.TH LH 1 "" "@lobehub/cli 0.0.17" "User Commands"
|
|
4
4
|
.SH NAME
|
|
5
5
|
lh \- LobeHub CLI \- manage and connect to LobeHub services
|
|
6
6
|
.SH SYNOPSIS
|