mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 03:01:56 +00:00
Cleanup: unify HookMessage naming and simplify SessionContext
- Rename HookAppMessage to HookMessage, isHookAppMessage to isHookMessage - Remove entries array from SessionContext (use isHookMessage type guard instead) - HookMessage.content now accepts string directly (not just array) - Fix streamMessage type in AgentState (AppMessage, not Message) - Rename CustomMessageComponent to HookMessageComponent - Fix test hook to use pi.sendMessage
This commit is contained in:
parent
a2515cf43f
commit
204d27581b
13 changed files with 62 additions and 106 deletions
|
|
@ -9,15 +9,9 @@ import * as path from "node:path";
|
|||
import { fileURLToPath } from "node:url";
|
||||
import { createJiti } from "jiti";
|
||||
import { getAgentDir } from "../../config.js";
|
||||
import type { HookMessage } from "../messages.js";
|
||||
import { execCommand } from "./runner.js";
|
||||
import type {
|
||||
ExecOptions,
|
||||
HookAPI,
|
||||
HookFactory,
|
||||
HookMessage,
|
||||
HookMessageRenderer,
|
||||
RegisteredCommand,
|
||||
} from "./types.js";
|
||||
import type { ExecOptions, HookAPI, HookFactory, HookMessageRenderer, RegisteredCommand } from "./types.js";
|
||||
|
||||
// Create require function to resolve module paths at runtime
|
||||
const require = createRequire(import.meta.url);
|
||||
|
|
@ -56,7 +50,10 @@ type HandlerFn = (...args: unknown[]) => Promise<unknown>;
|
|||
/**
|
||||
* Send message handler type for pi.sendMessage().
|
||||
*/
|
||||
export type SendMessageHandler = <T = unknown>(message: HookMessage<T>, triggerTurn?: boolean) => void;
|
||||
export type SendMessageHandler = <T = unknown>(
|
||||
message: Pick<HookMessage<T>, "customType" | "content" | "display" | "details">,
|
||||
triggerTurn?: boolean,
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Append entry handler type for pi.appendEntry().
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue