@litfamily/lithermes 1.0.0 → 1.0.2
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/README.md +2 -2
- package/README_Ko-KR.md +2 -2
- package/assets/lithermes-plugin/__init__.py +135 -15
- package/assets/lithermes-plugin/auto_update.py +18 -0
- package/assets/lithermes-plugin/core.py +4 -3
- package/assets/lithermes-plugin/diagnostics.py +1 -0
- package/assets/lithermes-plugin/payload-version.json +32 -32
- package/assets/lithermes-plugin/plugin.yaml +26 -2
- package/assets/lithermes-plugin/rules/frontmatter.py +1 -1
- package/assets/lithermes-plugin/skills/debugging/SKILL.md +1 -1
- package/assets/lithermes-plugin/skills/debugging/references/runtimes/native-binary.md +4 -4
- package/assets/lithermes-plugin/skills/debugging/references/runtimes/node.md +20 -20
- package/assets/lithermes-plugin/skills/debugging/references/runtimes/python.md +1 -1
- package/assets/lithermes-plugin/skills/debugging/references/tools/pwntools.md +2 -2
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/_canonical-corpus/corpus/designpowers/vendor/skills/design-md/reference.md +1 -1
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/_canonical-corpus/manifest.json +4 -4
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/complete-contract.md +2 -2
- package/assets/lithermes-plugin/skills/lit-code/SKILL.md +1 -1
- package/assets/lithermes-plugin/skills/lit-code/references/python/README.md +1 -1
- package/assets/lithermes-plugin/skills/lit-code/references/python/one-liners.md +5 -5
- package/assets/lithermes-plugin/skills/lit-code/references/rust/clap-stack.md +1 -1
- package/assets/lithermes-plugin/skills/lit-code/references/rust/libraries.md +1 -1
- package/assets/lithermes-plugin/skills/lit-code/scripts/go/new-project.py +1 -1
- package/assets/lithermes-plugin/skills/lit-code/scripts/python/new-project.py +1 -1
- package/assets/lithermes-plugin/skills/lit-code/scripts/python/new-script.py +2 -2
- package/assets/lithermes-plugin/skills/lit-code/scripts/rust/new-project.py +1 -1
- package/assets/lithermes-plugin/skills/lit-code/scripts/typescript/new-project.ts +1 -1
- package/assets/lithermes-plugin/skills/lit-korean/SKILL.md +1 -1
- package/assets/lithermes-plugin/skills/lit-scientific-visualization/ORIGIN.json +2 -2
- package/assets/lithermes-plugin/skills/litresearch/SKILL.md +2 -1
- package/assets/lithermes-plugin/skills/lsp-setup/references/julia/README.md +1 -1
- package/assets/lithermes-plugin/skills/visual-qa/references/complete-contract.md +2 -2
- package/assets/lithermes-plugin/vendor/scientific-visualization/evals/evals.json +1 -1
- package/package.json +1 -1
- package/readme-assets/badge-version.svg +1 -1
- package/src/lib/canonicalCorpus.js +2 -2
- package/src/lib/check.js +37 -4
- package/src/lib/hermesDiscovery.js +29 -8
- package/src/lib/install.js +10 -2
- package/src/lib/modelConfigBoundary.js +9 -0
- package/src/lib/patch.js +32 -0
package/src/lib/install.js
CHANGED
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
} = require("./config");
|
|
15
15
|
const { copyTree, removeEmptyDirs, sha256, writeFileAtomic } = require("./files");
|
|
16
16
|
const { assertStateParent, assertPluginParent, defaultHermesHome, defaultHermesRepo, detectHermesRuntimeRepo, detectHermesVersion, ensureHermesHome, inspectHermesHostCapabilities, LitHermesError } = require("./hermesDiscovery");
|
|
17
|
+
const { NOT_PROBED_HOST_VERSION } = require("./modelConfigBoundary");
|
|
17
18
|
const { patchInstalledHermes, rollbackPatches } = require("./patch");
|
|
18
19
|
const {
|
|
19
20
|
formatManagedRoute,
|
|
@@ -333,7 +334,7 @@ function installLitHermes(flags = {}) {
|
|
|
333
334
|
const modelPlan = planModelConfig(beforeConfig, {
|
|
334
335
|
...routeOptions(flags),
|
|
335
336
|
hostCapabilities: inspectHermesHostCapabilities(capabilityRepo),
|
|
336
|
-
hostVersion: dryRun ?
|
|
337
|
+
hostVersion: dryRun ? NOT_PROBED_HOST_VERSION : detectHermesVersion(),
|
|
337
338
|
reconfigure: Boolean(flags["reconfigure-model"]),
|
|
338
339
|
});
|
|
339
340
|
if (modelPlan.action === "stop") {
|
|
@@ -459,6 +460,7 @@ function installLitHermes(flags = {}) {
|
|
|
459
460
|
checkState();
|
|
460
461
|
const manifest = {
|
|
461
462
|
version: packageVersion,
|
|
463
|
+
distribution: "npm",
|
|
462
464
|
installedAt: new Date().toISOString(),
|
|
463
465
|
pluginPath: dest,
|
|
464
466
|
configPath: path.join(hermesHome, "config.yaml"),
|
|
@@ -499,7 +501,13 @@ function installLitHermes(flags = {}) {
|
|
|
499
501
|
] : []),
|
|
500
502
|
...capabilityLines({ capabilities: effectiveCapabilities }),
|
|
501
503
|
];
|
|
502
|
-
if (patchResult)
|
|
504
|
+
if (patchResult) {
|
|
505
|
+
lines.push(
|
|
506
|
+
patchResult.native
|
|
507
|
+
? "patches: native PluginContext.inject_message dispatch (no source patch)"
|
|
508
|
+
: `patches: ${patchResult.changed.length ? patchResult.changed.join(", ") : "none needed"}`,
|
|
509
|
+
);
|
|
510
|
+
}
|
|
503
511
|
if (patchWarning) lines.push(`patches: skipped (${patchWarning})`);
|
|
504
512
|
const credentialWarning = modelPlan.request && effectiveModelAction === "write"
|
|
505
513
|
? missingCredentialWarning(modelPlan.request, process.env)
|
|
@@ -12,6 +12,10 @@ const VERIFIED_HOST_VERSION_TEXT = [...VERIFIED_HOST_VERSIONS].join(", ");
|
|
|
12
12
|
// Below this the managed schema did not exist, so forward compatibility must not become
|
|
13
13
|
// backward acceptance.
|
|
14
14
|
const MINIMUM_HOST_VERSION = "0.17.0";
|
|
15
|
+
// Sentinel `hostVersion` for a dry-run, which deliberately never executes the Hermes
|
|
16
|
+
// binary. Distinguishes "never probed" from a real host whose banner came back empty or
|
|
17
|
+
// malformed, which must still be reported as unsupported.
|
|
18
|
+
const NOT_PROBED_HOST_VERSION = "__lithermes_dry_run_not_probed__";
|
|
15
19
|
const CONFIG_VERSION = 30;
|
|
16
20
|
const CREDENTIAL_KEY = /(^|[_-])(api[_-]?key|client[_-]?secret|auth[_-]?token|(?:aws[_-]?)?access[_-]?key(?:[_-]?id)?|(?:ssh[_-]?)?private[_-]?key|token|password|passphrase|secret|credential|authorization)([_-]|$)/i;
|
|
17
21
|
const MAP_PATHS = ["model", "agent", "delegation", "compression"];
|
|
@@ -111,6 +115,7 @@ function compareVersions(left, right) {
|
|
|
111
115
|
* this matrix has seen it.
|
|
112
116
|
*/
|
|
113
117
|
function classifyHostVersion(raw) {
|
|
118
|
+
if (raw === NOT_PROBED_HOST_VERSION) return { version: "", status: "not-probed" };
|
|
114
119
|
const version = exactHostVersion(raw);
|
|
115
120
|
// A release is exactly major.minor.patch. Four-part builds such as 0.19.0.1 are not a
|
|
116
121
|
// published release line and were rejected before this gate accepted unseen versions.
|
|
@@ -121,6 +126,9 @@ function classifyHostVersion(raw) {
|
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
function hostVersionError(classified) {
|
|
129
|
+
if (classified.status === "not-probed") {
|
|
130
|
+
return "Hermes host version not probed (dry-run); re-run without --dry-run to detect the host and its capabilities";
|
|
131
|
+
}
|
|
124
132
|
if (classified.status === "malformed") {
|
|
125
133
|
return `unsupported Hermes host version; expected a release banner at or above ${MINIMUM_HOST_VERSION} (verified: ${VERIFIED_HOST_VERSION_TEXT})`;
|
|
126
134
|
}
|
|
@@ -197,6 +205,7 @@ function parseBoundary(text, options = {}) {
|
|
|
197
205
|
|
|
198
206
|
module.exports = {
|
|
199
207
|
MINIMUM_HOST_VERSION,
|
|
208
|
+
NOT_PROBED_HOST_VERSION,
|
|
200
209
|
OPENAI_PROVIDER,
|
|
201
210
|
RESPONSES_MODE,
|
|
202
211
|
classifyHostVersion,
|
package/src/lib/patch.js
CHANGED
|
@@ -7,6 +7,15 @@ function patchManifestPath(hermesHome) {
|
|
|
7
7
|
return path.join(hermesHome, "lithermes", "patch-manifest.json");
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
function nativePluginInjectionAvailable(repo) {
|
|
11
|
+
const file = path.join(repo, "hermes_cli", "plugins.py");
|
|
12
|
+
if (!fs.existsSync(file)) return false;
|
|
13
|
+
const source = fs.readFileSync(file, "utf8");
|
|
14
|
+
return source.includes("def inject_message(")
|
|
15
|
+
&& source.includes("session_key")
|
|
16
|
+
&& source.includes("allow_gateway_injection");
|
|
17
|
+
}
|
|
18
|
+
|
|
10
19
|
function patchTarget(repo, relative, marker, additions) {
|
|
11
20
|
const file = path.join(repo, relative);
|
|
12
21
|
if (!fs.existsSync(file)) {
|
|
@@ -95,6 +104,28 @@ function patchInstalledHermes({ hermesHome, hermesRepo }) {
|
|
|
95
104
|
if (!hermesRepo || !fs.existsSync(hermesRepo)) {
|
|
96
105
|
throw new LitHermesError("Cannot patch Hermes because --hermes-repo was not found. Pass --hermes-repo PATH or run doctor first.", 8);
|
|
97
106
|
}
|
|
107
|
+
if (nativePluginInjectionAvailable(hermesRepo)) {
|
|
108
|
+
fs.mkdirSync(path.dirname(patchManifestPath(hermesHome)), { recursive: true });
|
|
109
|
+
writeFileAtomic(
|
|
110
|
+
patchManifestPath(hermesHome),
|
|
111
|
+
JSON.stringify({
|
|
112
|
+
patchedAt: new Date().toISOString(),
|
|
113
|
+
nativeDispatch: {
|
|
114
|
+
cli: true,
|
|
115
|
+
gateway: true,
|
|
116
|
+
reason: "Hermes PluginContext.inject_message is available",
|
|
117
|
+
},
|
|
118
|
+
records: [],
|
|
119
|
+
}, null, 2),
|
|
120
|
+
"utf8",
|
|
121
|
+
);
|
|
122
|
+
return {
|
|
123
|
+
changed: [],
|
|
124
|
+
records: [],
|
|
125
|
+
native: true,
|
|
126
|
+
reason: "Hermes PluginContext.inject_message is available",
|
|
127
|
+
};
|
|
128
|
+
}
|
|
98
129
|
const changed = [];
|
|
99
130
|
const records = [];
|
|
100
131
|
const cli = patchCliPayloadDispatch(hermesRepo);
|
|
@@ -146,6 +177,7 @@ function rollbackPatches({ hermesHome }) {
|
|
|
146
177
|
}
|
|
147
178
|
|
|
148
179
|
module.exports = {
|
|
180
|
+
nativePluginInjectionAvailable,
|
|
149
181
|
patchCliPayloadDispatch,
|
|
150
182
|
patchInstalledHermes,
|
|
151
183
|
patchManifestPath,
|