refactor: share hook provider types
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
|||||||
type HookMappingConfig,
|
type HookMappingConfig,
|
||||||
type HooksConfig,
|
type HooksConfig,
|
||||||
} from "../config/config.js";
|
} from "../config/config.js";
|
||||||
|
import type { HookMessageProvider } from "./hooks.js";
|
||||||
|
|
||||||
export type HookMappingResolved = {
|
export type HookMappingResolved = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -18,15 +19,7 @@ export type HookMappingResolved = {
|
|||||||
messageTemplate?: string;
|
messageTemplate?: string;
|
||||||
textTemplate?: string;
|
textTemplate?: string;
|
||||||
deliver?: boolean;
|
deliver?: boolean;
|
||||||
provider?:
|
provider?: HookMessageProvider;
|
||||||
| "last"
|
|
||||||
| "whatsapp"
|
|
||||||
| "telegram"
|
|
||||||
| "discord"
|
|
||||||
| "slack"
|
|
||||||
| "signal"
|
|
||||||
| "imessage"
|
|
||||||
| "msteams";
|
|
||||||
to?: string;
|
to?: string;
|
||||||
model?: string;
|
model?: string;
|
||||||
thinking?: string;
|
thinking?: string;
|
||||||
@@ -59,15 +52,7 @@ export type HookAction =
|
|||||||
wakeMode: "now" | "next-heartbeat";
|
wakeMode: "now" | "next-heartbeat";
|
||||||
sessionKey?: string;
|
sessionKey?: string;
|
||||||
deliver?: boolean;
|
deliver?: boolean;
|
||||||
provider?:
|
provider?: HookMessageProvider;
|
||||||
| "last"
|
|
||||||
| "whatsapp"
|
|
||||||
| "telegram"
|
|
||||||
| "discord"
|
|
||||||
| "slack"
|
|
||||||
| "signal"
|
|
||||||
| "imessage"
|
|
||||||
| "msteams";
|
|
||||||
to?: string;
|
to?: string;
|
||||||
model?: string;
|
model?: string;
|
||||||
thinking?: string;
|
thinking?: string;
|
||||||
@@ -105,14 +90,7 @@ type HookTransformResult = Partial<{
|
|||||||
name: string;
|
name: string;
|
||||||
sessionKey: string;
|
sessionKey: string;
|
||||||
deliver: boolean;
|
deliver: boolean;
|
||||||
provider:
|
provider: HookMessageProvider;
|
||||||
| "last"
|
|
||||||
| "whatsapp"
|
|
||||||
| "telegram"
|
|
||||||
| "discord"
|
|
||||||
| "slack"
|
|
||||||
| "signal"
|
|
||||||
| "imessage";
|
|
||||||
to: string;
|
to: string;
|
||||||
model: string;
|
model: string;
|
||||||
thinking: string;
|
thinking: string;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { handleControlUiHttpRequest } from "./control-ui.js";
|
|||||||
import {
|
import {
|
||||||
extractHookToken,
|
extractHookToken,
|
||||||
HOOK_PROVIDER_ERROR,
|
HOOK_PROVIDER_ERROR,
|
||||||
|
type HookMessageProvider,
|
||||||
type HooksConfigResolved,
|
type HooksConfigResolved,
|
||||||
normalizeAgentPayload,
|
normalizeAgentPayload,
|
||||||
normalizeHookHeaders,
|
normalizeHookHeaders,
|
||||||
@@ -35,15 +36,7 @@ type HookDispatchers = {
|
|||||||
wakeMode: "now" | "next-heartbeat";
|
wakeMode: "now" | "next-heartbeat";
|
||||||
sessionKey: string;
|
sessionKey: string;
|
||||||
deliver: boolean;
|
deliver: boolean;
|
||||||
provider:
|
provider: HookMessageProvider;
|
||||||
| "last"
|
|
||||||
| "whatsapp"
|
|
||||||
| "telegram"
|
|
||||||
| "discord"
|
|
||||||
| "slack"
|
|
||||||
| "signal"
|
|
||||||
| "imessage"
|
|
||||||
| "msteams";
|
|
||||||
to?: string;
|
to?: string;
|
||||||
model?: string;
|
model?: string;
|
||||||
thinking?: string;
|
thinking?: string;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ import {
|
|||||||
startGatewayConfigReloader,
|
startGatewayConfigReloader,
|
||||||
} from "./config-reload.js";
|
} from "./config-reload.js";
|
||||||
import { normalizeControlUiBasePath } from "./control-ui.js";
|
import { normalizeControlUiBasePath } from "./control-ui.js";
|
||||||
import { resolveHooksConfig } from "./hooks.js";
|
import { type HookMessageProvider, resolveHooksConfig } from "./hooks.js";
|
||||||
import {
|
import {
|
||||||
isLoopbackAddress,
|
isLoopbackAddress,
|
||||||
isLoopbackHost,
|
isLoopbackHost,
|
||||||
@@ -496,15 +496,7 @@ export async function startGatewayServer(
|
|||||||
wakeMode: "now" | "next-heartbeat";
|
wakeMode: "now" | "next-heartbeat";
|
||||||
sessionKey: string;
|
sessionKey: string;
|
||||||
deliver: boolean;
|
deliver: boolean;
|
||||||
provider:
|
provider: HookMessageProvider;
|
||||||
| "last"
|
|
||||||
| "whatsapp"
|
|
||||||
| "telegram"
|
|
||||||
| "discord"
|
|
||||||
| "slack"
|
|
||||||
| "signal"
|
|
||||||
| "imessage"
|
|
||||||
| "msteams";
|
|
||||||
to?: string;
|
to?: string;
|
||||||
model?: string;
|
model?: string;
|
||||||
thinking?: string;
|
thinking?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user