Compare commits
6 Commits
fix/models
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0967bab53d | |||
| 559913466a | |||
| c5559b134d | |||
| 69d9c69358 | |||
| 96156cef27 | |||
| 5b2d33411e |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hermes-harness",
|
||||
"version": "0.1.0",
|
||||
"name": "@shazhou/hermes-harness",
|
||||
"version": "0.1.1",
|
||||
"description": "Hermes Agent CLI harness tools",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@ -3,7 +3,9 @@ import { homedir } from "os";
|
||||
import { join } from "path";
|
||||
import { parse, stringify } from "yaml";
|
||||
|
||||
const CONFIG_PATH = join(homedir(), ".hermes", "config.yaml");
|
||||
const HERMES_HOME = process.env.HERMES_HOME || join(homedir(), ".hermes");
|
||||
const CONFIG_PATH = join(HERMES_HOME, "config.yaml");
|
||||
const SOUL_PATH = join(HERMES_HOME, "SOUL.md");
|
||||
|
||||
interface Config {
|
||||
agent?: {
|
||||
@ -51,6 +53,30 @@ function getPreview(value: string | PersonalityDict): string {
|
||||
return value.description || (value.system_prompt || "").slice(0, 60) + "...";
|
||||
}
|
||||
|
||||
// --- SOUL.md management ---
|
||||
|
||||
function loadConventions(): string {
|
||||
try {
|
||||
const { execSync } = require("child_process");
|
||||
const result = execSync("cfg get HERMES_AGENT_CONVENTIONS", {
|
||||
encoding: "utf-8",
|
||||
timeout: 5000,
|
||||
stdio: ["pipe", "pipe", "pipe"],
|
||||
}).trim();
|
||||
return result || "";
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function writeSoulMd(personalityPrompt: string) {
|
||||
const conventions = loadConventions();
|
||||
const parts = [personalityPrompt];
|
||||
if (conventions) parts.push(conventions);
|
||||
const content = parts.filter(Boolean).join("\n\n");
|
||||
writeFileSync(SOUL_PATH, content + "\n", "utf-8");
|
||||
}
|
||||
|
||||
// --- Actions ---
|
||||
|
||||
function list() {
|
||||
@ -126,6 +152,7 @@ function switchLocal(name: string) {
|
||||
if (!config.agent) config.agent = {};
|
||||
config.agent.system_prompt = "";
|
||||
saveConfig(config);
|
||||
writeSoulMd("");
|
||||
console.log("Personality cleared.");
|
||||
return;
|
||||
}
|
||||
@ -140,7 +167,9 @@ function switchLocal(name: string) {
|
||||
if (!config.agent) config.agent = {};
|
||||
config.agent.system_prompt = prompt;
|
||||
saveConfig(config);
|
||||
writeSoulMd(prompt);
|
||||
console.log(`Switched to: ${name}`);
|
||||
console.log("SOUL.md updated.");
|
||||
}
|
||||
|
||||
async function switchTelegram(name: string) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user