openhermes 1.5.6 → 1.13.1
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/LICENSE +21 -0
- package/README.md +217 -111
- package/autorecall.mjs +2 -12
- package/bootstrap.mjs +160 -8
- package/curator.mjs +1 -5
- package/harness/commands/checkpoint.md +68 -0
- package/harness/commands/eval.md +89 -0
- package/harness/commands/go-build.md +87 -0
- package/harness/commands/go-review.md +71 -0
- package/harness/commands/harness-audit.md +90 -0
- package/harness/commands/learn.md +2 -2
- package/harness/commands/loop-start.md +38 -0
- package/harness/commands/loop-status.md +30 -0
- package/harness/commands/memory-search.md +2 -2
- package/harness/commands/model-route.md +32 -0
- package/harness/commands/ohc.md +13 -0
- package/harness/commands/orchestrate.md +88 -0
- package/harness/commands/quality-gate.md +35 -0
- package/harness/commands/refactor-clean.md +102 -0
- package/harness/commands/rust-build.md +78 -0
- package/harness/commands/rust-review.md +65 -0
- package/harness/commands/setup-pm.md +65 -0
- package/harness/commands/skill-create.md +99 -0
- package/harness/commands/test-coverage.md +80 -0
- package/harness/commands/update-codemaps.md +81 -0
- package/harness/commands/update-docs.md +67 -0
- package/harness/commands/verify.md +68 -0
- package/harness/instructions/CONVENTIONS.md +206 -0
- package/harness/instructions/RUNTIME.md +8 -1
- package/harness/prompts/build-cpp.md +84 -0
- package/harness/prompts/build-error-resolver.md +2 -1
- package/harness/prompts/build-go.md +326 -0
- package/harness/prompts/build-java.md +126 -0
- package/harness/prompts/build-kotlin.md +123 -0
- package/harness/prompts/build-rust.md +94 -0
- package/harness/prompts/code-reviewer.md +2 -1
- package/harness/prompts/doc-updater.md +193 -0
- package/harness/prompts/docs-lookup.md +60 -0
- package/harness/prompts/explore.md +1 -0
- package/harness/prompts/harness-optimizer.md +30 -0
- package/harness/prompts/loop-operator.md +42 -0
- package/harness/prompts/planner.md +3 -2
- package/harness/prompts/refactor-cleaner.md +242 -0
- package/harness/prompts/review-cpp.md +68 -0
- package/harness/prompts/review-database.md +248 -0
- package/harness/prompts/review-go.md +244 -0
- package/harness/prompts/review-java.md +100 -0
- package/harness/prompts/review-kotlin.md +130 -0
- package/harness/prompts/review-python.md +88 -0
- package/harness/prompts/review-rust.md +64 -0
- package/harness/prompts/security-reviewer.md +3 -2
- package/harness/prompts/tdd-guide.md +214 -0
- package/harness/rules/delegation.md +28 -22
- package/harness/rules/memory-management.md +4 -4
- package/harness/rules/retrieval.md +5 -5
- package/harness/rules/runtime-guards.md +1 -1
- package/harness/rules/session-start.md +4 -4
- package/harness/rules/skills-management.md +2 -2
- package/harness/rules/state-drift.md +1 -1
- package/harness/rules/verification.md +4 -4
- package/harness/scripts/sync-commands.mjs +259 -0
- package/harness/skills/coding-standards/SKILL.md +1 -1
- package/index.mjs +25 -4
- package/lib/hardening.mjs +11 -1
- package/lib/memory-tools-plugin.mjs +84 -71
- package/lib/ohc/config.mjs +30 -0
- package/lib/ohc/pruner.mjs +239 -0
- package/lib/ohc/reaper.mjs +61 -0
- package/lib/ohc/state.mjs +32 -0
- package/lib/ohc/updater.mjs +110 -0
- package/package.json +6 -2
- package/skill-builder.mjs +2 -6
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import fs from "node:fs"
|
|
2
|
+
import path from "node:path"
|
|
3
|
+
import os from "node:os"
|
|
4
|
+
|
|
5
|
+
const CONFIG_PATH = path.join(os.homedir(), ".config", "opencode", "opencode.json")
|
|
6
|
+
const CACHE_ROOT = path.join(os.homedir(), ".cache", "opencode", "packages")
|
|
7
|
+
|
|
8
|
+
function detectInstallMethod() {
|
|
9
|
+
let raw = {}
|
|
10
|
+
try {
|
|
11
|
+
raw = JSON.parse(fs.readFileSync(CONFIG_PATH, "utf8"))
|
|
12
|
+
} catch {
|
|
13
|
+
return { method: "unknown", entry: null, reason: `cannot read ${CONFIG_PATH}` }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const plugins = Array.isArray(raw.plugin) ? raw.plugin : []
|
|
17
|
+
for (const p of plugins) {
|
|
18
|
+
const entry = typeof p === "string" ? p : (Array.isArray(p) && typeof p[0] === "string" ? p[0] : "")
|
|
19
|
+
if (!entry.startsWith("openhermes")) continue
|
|
20
|
+
|
|
21
|
+
if (entry.includes("@git+https://") || entry.includes("@git+ssh://")) {
|
|
22
|
+
const repoUrl = entry.replace(/^openhermes@/, "")
|
|
23
|
+
return { method: "git", entry, repoUrl }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (entry === "openhermes") {
|
|
27
|
+
return { method: "npm", entry }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return { method: "other", entry, reason: `unrecognized format: ${entry}` }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return { method: "unknown", entry: null, reason: "openhermes not found in plugin config" }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function findCacheDirs() {
|
|
37
|
+
const results = []
|
|
38
|
+
if (!fs.existsSync(CACHE_ROOT)) return results
|
|
39
|
+
try {
|
|
40
|
+
for (const e of fs.readdirSync(CACHE_ROOT)) {
|
|
41
|
+
const full = path.join(CACHE_ROOT, e)
|
|
42
|
+
if (e.startsWith("openhermes") && fs.statSync(full).isDirectory()) {
|
|
43
|
+
results.push({ name: e, path: full })
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} catch {}
|
|
47
|
+
return results
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function handleUpdateMe(ctx, input, output) {
|
|
51
|
+
const info = detectInstallMethod()
|
|
52
|
+
|
|
53
|
+
if (info.method === "unknown") {
|
|
54
|
+
output.parts.length = 0
|
|
55
|
+
output.parts.push({
|
|
56
|
+
type: "text",
|
|
57
|
+
text: `[Update-Me] Could not detect installation method.\n${info.reason}\n\nEnsure 'openhermes' is in your opencode.json plugin list:\n https://github.com/nathwn12/openhermes#setup`,
|
|
58
|
+
})
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const cacheDirs = findCacheDirs()
|
|
63
|
+
|
|
64
|
+
if (cacheDirs.length === 0) {
|
|
65
|
+
output.parts.length = 0
|
|
66
|
+
output.parts.push({
|
|
67
|
+
type: "text",
|
|
68
|
+
text: `[Update-Me] No cached version found. Already at the latest (method: ${info.method}). Restart OpenCode if you suspect a stale install.`,
|
|
69
|
+
})
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const deleted = []
|
|
74
|
+
const failed = []
|
|
75
|
+
for (const dir of cacheDirs) {
|
|
76
|
+
try {
|
|
77
|
+
fs.rmSync(dir.path, { recursive: true, force: true })
|
|
78
|
+
deleted.push(dir.name)
|
|
79
|
+
} catch (e) {
|
|
80
|
+
failed.push({ name: dir.name, error: e.message })
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
output.parts.length = 0
|
|
85
|
+
let msg = `[Update-Me] OpenHermes update (${info.method})\n`
|
|
86
|
+
|
|
87
|
+
if (deleted.length > 0) {
|
|
88
|
+
msg += `\nCleared:\n`
|
|
89
|
+
for (const d of deleted) msg += ` ✓ ${d}\n`
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (failed.length > 0) {
|
|
93
|
+
msg += `\n⚠ Could not remove (file may be locked):\n`
|
|
94
|
+
for (const f of failed) msg += ` ✗ ${f.name} — ${f.error}\n`
|
|
95
|
+
msg += `Try deleting manually:\n ${CACHE_ROOT}\n`
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
msg += `\nRestart OpenCode to load the latest OpenHermes from ${info.method === "git" ? "git HEAD" : "npm registry"}.`
|
|
99
|
+
|
|
100
|
+
output.parts.push({ type: "text", text: msg })
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function UpdaterPlugin(ctx) {
|
|
104
|
+
return {
|
|
105
|
+
"command.execute.before": async (input, output) => {
|
|
106
|
+
if (input.command !== "update-me") return
|
|
107
|
+
await handleUpdateMe(ctx, input, output)
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openhermes",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"description": "OpenHermes plugin suite for OpenCode — autonomous checkpointing, native memory tools, subagent routing, slash commands, and skill-candidate detection.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,11 @@
|
|
|
26
26
|
"harness/"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"test": "node --test"
|
|
29
|
+
"test": "node --test",
|
|
30
|
+
"commands:audit": "node harness/scripts/sync-commands.mjs --audit",
|
|
31
|
+
"commands:generate": "node harness/scripts/sync-commands.mjs --generate",
|
|
32
|
+
"commands:sync": "node harness/scripts/sync-commands.mjs --sync",
|
|
33
|
+
"commands:full": "node harness/scripts/sync-commands.mjs"
|
|
30
34
|
},
|
|
31
35
|
"keywords": [
|
|
32
36
|
"opencode",
|
package/skill-builder.mjs
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import path from "node:path"
|
|
2
2
|
import fs from "node:fs"
|
|
3
3
|
import os from "node:os"
|
|
4
|
-
import { atomicWriteJson, fingerprintEnvironment,
|
|
4
|
+
import { atomicWriteJson, fingerprintEnvironment, readJson, sanitizeRecord } from "./lib/hardening.mjs"
|
|
5
5
|
import { getConfigRoot, getDataRoot, getMemoryRoot } from "./lib/paths.mjs"
|
|
6
6
|
|
|
7
|
-
function readJson(fp, fallback) {
|
|
8
|
-
try { return JSON.parse(fs.readFileSync(fp, "utf8")) } catch { return fallback }
|
|
9
|
-
}
|
|
10
|
-
|
|
11
7
|
function buildEnvironmentFingerprint(root, directory, project) {
|
|
12
8
|
return fingerprintEnvironment({
|
|
13
9
|
cwd: directory,
|
|
@@ -94,7 +90,7 @@ export const SkillBuilderPlugin = async ({ project, directory }) => {
|
|
|
94
90
|
})
|
|
95
91
|
atomicWriteJson(path.join(dir, "index.json"), index)
|
|
96
92
|
|
|
97
|
-
} catch (err) {}
|
|
93
|
+
} catch (err) { process.stderr.write(`[skill-builder] backlog write error: ${err?.message || err}\n`) }
|
|
98
94
|
}
|
|
99
95
|
sessionStats = { toolCalls: 0, subagents: 0, startTime: Date.now() }
|
|
100
96
|
}
|