mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-15 15:40:45 +00:00
fix(hooks): expose typed gateway startup context
This commit is contained in:
@@ -475,6 +475,9 @@ export type PluginHookSubagentEndedEvent = {
|
||||
|
||||
export type PluginHookGatewayContext = {
|
||||
port?: number;
|
||||
config?: OpenClawConfig;
|
||||
workspaceDir?: string;
|
||||
getCron?: () => PluginHookGatewayCronService | undefined;
|
||||
};
|
||||
|
||||
export type PluginHookGatewayStartEvent = {
|
||||
@@ -485,6 +488,55 @@ export type PluginHookGatewayStopEvent = {
|
||||
reason?: string;
|
||||
};
|
||||
|
||||
export type PluginHookGatewayCronJob = {
|
||||
id: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
enabled?: boolean;
|
||||
schedule?: {
|
||||
kind?: string;
|
||||
expr?: string;
|
||||
tz?: string;
|
||||
};
|
||||
sessionTarget?: string;
|
||||
wakeMode?: string;
|
||||
payload?: {
|
||||
kind?: string;
|
||||
text?: string;
|
||||
};
|
||||
createdAtMs?: number;
|
||||
};
|
||||
|
||||
export type PluginHookGatewayCronCreateInput = {
|
||||
name: string;
|
||||
description: string;
|
||||
enabled: boolean;
|
||||
schedule: {
|
||||
kind: string;
|
||||
expr: string;
|
||||
tz?: string;
|
||||
};
|
||||
sessionTarget: string;
|
||||
wakeMode: string;
|
||||
payload: {
|
||||
kind: string;
|
||||
text?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type PluginHookGatewayCronUpdateInput = Partial<PluginHookGatewayCronCreateInput>;
|
||||
|
||||
export type PluginHookGatewayCronRemoveResult = {
|
||||
removed?: boolean;
|
||||
};
|
||||
|
||||
export type PluginHookGatewayCronService = {
|
||||
list: (opts?: { includeDisabled?: boolean }) => Promise<PluginHookGatewayCronJob[]>;
|
||||
add: (input: PluginHookGatewayCronCreateInput) => Promise<unknown>;
|
||||
update: (id: string, patch: PluginHookGatewayCronUpdateInput) => Promise<unknown>;
|
||||
remove: (id: string) => Promise<PluginHookGatewayCronRemoveResult>;
|
||||
};
|
||||
|
||||
export type PluginInstallTargetType = "skill" | "plugin";
|
||||
export type PluginInstallRequestKind =
|
||||
| "skill-install"
|
||||
|
||||
@@ -31,7 +31,12 @@ async function expectGatewayHookCall(params: {
|
||||
}
|
||||
|
||||
describe("gateway hook runner methods", () => {
|
||||
const gatewayCtx = { port: 18789 };
|
||||
const gatewayCtx = {
|
||||
port: 18789,
|
||||
config: {} as never,
|
||||
workspaceDir: "/tmp/openclaw-workspace",
|
||||
getCron: () => undefined,
|
||||
};
|
||||
|
||||
it.each([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user