- Replace Hermes pi module integration with pi-ai session streaming and updated runtime adapter contracts - Remove legacy engine guard scaffolding and add hermes-stream-client coverage for streaming behavior - Rewrite plugin and engine e2e tests to align with the new runtime flow and regenerate dist artifacts - Update Hermes runtime README and package metadata to document pi-ai execution expectations
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import { createStreamSession, describeStreamModel, streamPrompt } from "./pi-module.js";
|
|
export class HermesRuntimeAdapter {
|
|
config;
|
|
id = "hermes";
|
|
name = "Hermes Runtime";
|
|
constructor(config = {
|
|
provider: "anthropic",
|
|
modelId: "claude-sonnet-4-5",
|
|
}) {
|
|
this.config = config;
|
|
}
|
|
async createSession(options) {
|
|
const session = createStreamSession({
|
|
provider: this.config.provider,
|
|
modelId: this.config.modelId,
|
|
apiKey: this.config.apiKey,
|
|
thinkingLevel: this.config.thinkingLevel,
|
|
systemPrompt: options.systemPrompt,
|
|
callbacks: {
|
|
onText: options.onText,
|
|
onThinking: options.onThinking,
|
|
onToolStart: options.onToolStart,
|
|
onToolEnd: options.onToolEnd,
|
|
},
|
|
});
|
|
return {
|
|
session,
|
|
sessionFile: undefined,
|
|
};
|
|
}
|
|
async promptWithFallback(session, prompt, _options) {
|
|
const userMessage = { role: "user", content: prompt };
|
|
session.messages.push(userMessage);
|
|
await streamPrompt(session, userMessage);
|
|
}
|
|
describeModel(session) {
|
|
return describeStreamModel(session);
|
|
}
|
|
async dispose(session) {
|
|
if (typeof session.dispose === "function") {
|
|
session.dispose();
|
|
}
|
|
}
|
|
}
|
|
//# sourceMappingURL=runtime-adapter.js.map
|