@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
23 lines • 1.1 kB
JavaScript
import { randomUUID } from "node:crypto";
/** A refusal from the host rejects, so a model the session cannot use is never followed by the prompts. */
export async function applyAttachStartup(request, sessionId, startup) {
if (startup.model) {
// Only this session's model, as a local `--model` does; the device's saved default stays (senpi#6914 M1).
await request({ type: "set_model", sessionId, ...startup.model, scope: "session" });
}
if (startup.thinking) {
await request({ type: "set_thinking_level", sessionId, level: startup.thinking });
}
for (const prompt of startup.prompts) {
// A prompt sent while the session runs a turn waits behind it, like the next line typed at the editor.
await request({
type: "prompt",
sessionId,
message: prompt.text,
...(prompt.images && prompt.images.length > 0 ? { images: [...prompt.images] } : {}),
streamingBehavior: "followUp",
clientMessageId: randomUUID(),
});
}
}
//# sourceMappingURL=attach-startup.js.map