fix(plugins): re-export probe symbols + declare plugin deps in dashboard

- Hermes / OpenClaw plugin index.ts now re-export `probeHermesBinary` /
  `probeOpenClawBinary` and their status types so the dashboard's
  `runtime-provider-probes.ts` façade can import them via the public
  package entry instead of deep paths.
- Dashboard `package.json` adds `@fusion-plugin-examples/hermes-runtime`,
  `…/openclaw-runtime`, `…/paperclip-runtime` as workspace deps so
  pnpm symlinks them into `packages/dashboard/node_modules/`. Without
  these, the new probe imports failed with "Cannot find module" during
  `pnpm typecheck`.

This clears 6 of the 9 outstanding typecheck errors. The remaining 3 are
in the in-flight Hermes plugin rewrite (runtime-adapter still imports
from a deleted `./pi-module.js`; the new `index.ts` calls a factory
with the wrong arg type) and should be resolved by the same change set
that landed the rewrite.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fusion
2026-04-27 20:22:18 -07:00
committed by gsxdsm
parent 5159cc2a68
commit 6e65786bc5
82 changed files with 8481 additions and 2833 deletions

View File

@@ -1,57 +1,84 @@
/**
* Hermes Runtime Adapter — drives the local `hermes` CLI as a subprocess.
*
* Each call to `promptWithFallback` invokes `hermes chat -q ... -Q --source tool`
* and captures the resulting `session_id:` line. Subsequent calls on the same
* session pass `--resume <id>` to continue the conversation.
*/
import { invokeHermesCli, resolveCliSettings } from "./cli-spawn.js";
import type { HermesCliSettings } from "./cli-spawn.js";
import type {
AgentRuntime,
AgentRuntimeOptions,
AgentSession,
AgentSessionResult,
HermesModelConfig,
HermesStreamSession,
} from "./types.js";
import { createStreamSession, describeStreamModel, streamPrompt } from "./pi-module.js";
export class HermesRuntimeAdapter implements AgentRuntime {
readonly id = "hermes";
readonly name = "Hermes Runtime";
constructor(
private readonly config: HermesModelConfig = {
provider: "anthropic",
modelId: "claude-sonnet-4-5",
},
) {}
private readonly settings: HermesCliSettings;
constructor(settings?: Record<string, unknown> | HermesCliSettings) {
this.settings = resolveCliSettings(
settings as Record<string, unknown> | undefined,
);
}
async createSession(options: AgentRuntimeOptions): Promise<AgentSessionResult> {
const session = createStreamSession({
provider: this.config.provider,
modelId: this.config.modelId,
apiKey: this.config.apiKey,
thinkingLevel: this.config.thinkingLevel,
const session: HermesStreamSession = {
model: undefined,
systemPrompt: options.systemPrompt,
messages: [],
apiKey: undefined,
thinkingLevel: undefined,
sessionId: "",
lastModelDescription: this.describeFromSettings(),
callbacks: {
onText: options.onText,
onThinking: options.onThinking,
onToolStart: options.onToolStart,
onToolEnd: options.onToolEnd,
},
});
return {
session,
sessionFile: undefined,
dispose: () => undefined,
};
return { session, sessionFile: undefined };
}
async promptWithFallback(session: AgentSession, prompt: string, _options?: unknown): Promise<void> {
const userMessage = { role: "user", content: prompt };
session.messages.push(userMessage);
await streamPrompt(session, userMessage as any);
async promptWithFallback(
session: AgentSession,
prompt: string,
_options?: unknown,
): Promise<void> {
const resumeId = session.sessionId || undefined;
const result = await invokeHermesCli(prompt, this.settings, resumeId);
session.sessionId = result.sessionId;
session.lastModelDescription = this.describeFromSettings();
if (result.body) {
session.callbacks.onText?.(result.body);
}
}
describeModel(session: AgentSession): string {
return describeStreamModel(session);
return session.lastModelDescription || this.describeFromSettings();
}
async dispose(session: AgentSession): Promise<void> {
if (typeof session.dispose === "function") {
session.dispose();
}
async dispose(_session: AgentSession): Promise<void> {
// No persistent resources to release — the hermes CLI process exits per turn.
}
private describeFromSettings(): string {
const provider = this.settings.provider;
const model = this.settings.model;
if (provider && model) return `hermes/${provider}/${model}`;
if (model) return `hermes/${model}`;
if (provider) return `hermes/${provider}`;
return "hermes";
}
}