@fenixforce/kernel 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/execution-result.d.ts +27 -0
- package/dist/agent-loop.d.ts +55 -0
- package/dist/api/dashboard.d.ts +260 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/middleware.d.ts +46 -0
- package/dist/api/openai-compat.d.ts +163 -0
- package/dist/api/server.d.ts +44 -0
- package/dist/api/streaming.d.ts +15 -0
- package/dist/api/webhook-triggers.d.ts +139 -0
- package/dist/billing/cost-meter.d.ts +123 -0
- package/dist/billing/index.d.ts +2 -0
- package/dist/boot.d.ts +109 -0
- package/dist/channels/discord.d.ts +99 -0
- package/dist/channels/email.d.ts +88 -0
- package/dist/channels/http-api.d.ts +155 -0
- package/dist/channels/index.d.ts +20 -0
- package/dist/channels/mcp-channel.d.ts +75 -0
- package/dist/channels/mobile-hil.d.ts +88 -0
- package/dist/channels/openai-compat.d.ts +42 -0
- package/dist/channels/registry.d.ts +80 -0
- package/dist/channels/signal.d.ts +75 -0
- package/dist/channels/slack.d.ts +115 -0
- package/dist/channels/teams.d.ts +106 -0
- package/dist/channels/telegram.d.ts +164 -0
- package/dist/channels/types.d.ts +71 -0
- package/dist/channels/whatsapp.d.ts +83 -0
- package/dist/checkpoint.d.ts +77 -0
- package/dist/config/canary.d.ts +74 -0
- package/dist/config/constitution.d.ts +57 -0
- package/dist/config/defaults.d.ts +17 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/loader.d.ts +11 -0
- package/dist/config/provider-config.d.ts +29 -0
- package/dist/config/schema.d.ts +118 -0
- package/dist/config/steering-rules.d.ts +28 -0
- package/dist/content/chunker.d.ts +42 -0
- package/dist/content/entity-extractor.d.ts +58 -0
- package/dist/content/index.d.ts +8 -0
- package/dist/content/ocr.d.ts +79 -0
- package/dist/content/pipeline.d.ts +153 -0
- package/dist/context-overflow.d.ts +19 -0
- package/dist/editions/mobile.d.ts +12 -0
- package/dist/editions/pro.d.ts +12 -0
- package/dist/editions/voices.d.ts +14 -0
- package/dist/events/block-manager.d.ts +37 -0
- package/dist/events/bus.d.ts +39 -0
- package/dist/events/index.d.ts +8 -0
- package/dist/events/session-manager.d.ts +59 -0
- package/dist/events/stream-adapter.d.ts +24 -0
- package/dist/events/types.d.ts +465 -0
- package/dist/events/websocket.d.ts +34 -0
- package/dist/extensions/defaults/05-session-repair.d.ts +6 -0
- package/dist/extensions/defaults/10-logging.d.ts +6 -0
- package/dist/extensions/defaults/15-loop-guard.d.ts +6 -0
- package/dist/extensions/defaults/20-cost-tracking.d.ts +7 -0
- package/dist/extensions/defaults/25-ssrf-protection.d.ts +6 -0
- package/dist/extensions/defaults/30-rate-limiting.d.ts +6 -0
- package/dist/extensions/defaults/35-shell-bleed.d.ts +6 -0
- package/dist/extensions/defaults/40-observation-capture.d.ts +7 -0
- package/dist/extensions/defaults/45-context-survival.d.ts +6 -0
- package/dist/extensions/defaults/50-context-budget.d.ts +6 -0
- package/dist/extensions/defaults/55-steering-rules.d.ts +7 -0
- package/dist/extensions/defaults/60-quality-gates.d.ts +7 -0
- package/dist/extensions/defaults/65-job-dispatch.d.ts +24 -0
- package/dist/extensions/defaults/70-skill-loader.d.ts +18 -0
- package/dist/extensions/hooks.d.ts +74 -0
- package/dist/extensions/index.d.ts +21 -0
- package/dist/extensions/intervention.d.ts +59 -0
- package/dist/extensions/manager.d.ts +63 -0
- package/dist/extensions/runner.d.ts +63 -0
- package/dist/hooks/hook-manager.d.ts +39 -0
- package/dist/hooks/hook-types.d.ts +60 -0
- package/dist/identity/assembler.d.ts +45 -0
- package/dist/identity/ccc-adapter.d.ts +33 -0
- package/dist/identity/index.d.ts +6 -0
- package/dist/identity/persona-parser.d.ts +24 -0
- package/dist/identity/soul-parser.d.ts +23 -0
- package/dist/identity/user-populator.d.ts +20 -0
- package/dist/index.d.ts +227 -0
- package/dist/index.js +579 -0
- package/dist/interrupt.d.ts +84 -0
- package/dist/job-queue.d.ts +69 -0
- package/dist/jobs/index.d.ts +12 -0
- package/dist/jobs/memory-queue.d.ts +23 -0
- package/dist/jobs/planned-tasks.d.ts +121 -0
- package/dist/jobs/queue.d.ts +79 -0
- package/dist/jobs/router.d.ts +23 -0
- package/dist/jobs/synthesize-memories.d.ts +26 -0
- package/dist/jobs/types.d.ts +47 -0
- package/dist/jobs/worker-pool.d.ts +25 -0
- package/dist/jobs/worker.d.ts +40 -0
- package/dist/loop/autonomous-controller.d.ts +91 -0
- package/dist/loop/backpressure.d.ts +64 -0
- package/dist/loop/fresh-context.d.ts +48 -0
- package/dist/loop/prd-importer.d.ts +134 -0
- package/dist/loop/stop-controller.d.ts +31 -0
- package/dist/loop-guard.d.ts +32 -0
- package/dist/mcp/tool-executor.d.ts +57 -0
- package/dist/memory/brain-artifacts.d.ts +25 -0
- package/dist/memory/dual-search.d.ts +67 -0
- package/dist/memory/episodic.d.ts +45 -0
- package/dist/memory/index.d.ts +27 -0
- package/dist/memory/knowledge-graph.d.ts +89 -0
- package/dist/memory/markdown-store.d.ts +64 -0
- package/dist/memory/metadata-filter.d.ts +29 -0
- package/dist/memory/mid-conversation-saves.d.ts +17 -0
- package/dist/memory/note-parser.d.ts +34 -0
- package/dist/memory/observation-store.d.ts +36 -0
- package/dist/memory/observation-thresholds.d.ts +26 -0
- package/dist/memory/progressive-search.d.ts +25 -0
- package/dist/memory/synthesis.d.ts +36 -0
- package/dist/memory/tree-index.d.ts +104 -0
- package/dist/memory/write-gate.d.ts +63 -0
- package/dist/mission-control.d.ts +34 -0
- package/dist/pre-classifier-widgets.d.ts +40 -0
- package/dist/pre-classifier.d.ts +19 -0
- package/dist/prompt/context-budget.d.ts +68 -0
- package/dist/prompt/index.d.ts +3 -0
- package/dist/prompt/system-prompt.d.ts +32 -0
- package/dist/prompt/templates.d.ts +11 -0
- package/dist/providers/anthropic.d.ts +24 -0
- package/dist/providers/auto-detect.d.ts +16 -0
- package/dist/providers/auto-discover.d.ts +28 -0
- package/dist/providers/bedrock.d.ts +38 -0
- package/dist/providers/cache-strategy.d.ts +58 -0
- package/dist/providers/circuit-breaker.d.ts +33 -0
- package/dist/providers/cost-meter.d.ts +74 -0
- package/dist/providers/cost-tracking.d.ts +36 -0
- package/dist/providers/google.d.ts +35 -0
- package/dist/providers/index.d.ts +32 -0
- package/dist/providers/interface.d.ts +98 -0
- package/dist/providers/json-repair.d.ts +10 -0
- package/dist/providers/key-rotation.d.ts +36 -0
- package/dist/providers/manager.d.ts +64 -0
- package/dist/providers/model-registry.d.ts +50 -0
- package/dist/providers/openai-compatible.d.ts +26 -0
- package/dist/providers/optimization-modes.d.ts +38 -0
- package/dist/providers/provider-manager.d.ts +71 -0
- package/dist/providers/runtime-crud.d.ts +68 -0
- package/dist/providers/sidecar-lifecycle.d.ts +40 -0
- package/dist/providers/stream-wrapper.d.ts +21 -0
- package/dist/providers/structured-verify.d.ts +31 -0
- package/dist/providers/versioning.d.ts +18 -0
- package/dist/quality-gates.d.ts +10 -0
- package/dist/scheduler/engine.d.ts +95 -0
- package/dist/scheduler/index.d.ts +4 -0
- package/dist/scheduler/webhook-handler.d.ts +37 -0
- package/dist/sdk/agent.d.ts +22 -0
- package/dist/sdk/cli.d.ts +2 -0
- package/dist/sdk/client.d.ts +19 -0
- package/dist/sdk/index.d.ts +24 -0
- package/dist/sdk/jobs.d.ts +25 -0
- package/dist/sdk/memory.d.ts +18 -0
- package/dist/sdk/types.d.ts +69 -0
- package/dist/security/approval-gates.d.ts +166 -0
- package/dist/security/content-wrapper.d.ts +38 -0
- package/dist/security/guard-rails.d.ts +6 -0
- package/dist/security/index.d.ts +21 -0
- package/dist/security/instruction-hierarchy.d.ts +109 -0
- package/dist/security/pii-tokenizer.d.ts +30 -0
- package/dist/security/reputation.d.ts +53 -0
- package/dist/security/secret-store.d.ts +41 -0
- package/dist/security/security-engine.d.ts +53 -0
- package/dist/security/shell-bleed.d.ts +15 -0
- package/dist/security/ssrf.d.ts +12 -0
- package/dist/security/taint-tracker.d.ts +63 -0
- package/dist/security/tool-access-control.d.ts +114 -0
- package/dist/session-compaction.d.ts +20 -0
- package/dist/session-orient.d.ts +22 -0
- package/dist/session-repair.d.ts +6 -0
- package/dist/storage/index.d.ts +24 -0
- package/dist/storage/interface.d.ts +245 -0
- package/dist/storage/postgres.d.ts +6 -0
- package/dist/storage/sqlite.d.ts +2 -0
- package/dist/streaming/reasoning.d.ts +67 -0
- package/dist/task-tracker.d.ts +26 -0
- package/dist/testing/action-cache.d.ts +39 -0
- package/dist/testing/incident-eval.d.ts +49 -0
- package/dist/testing/workflow-evals.d.ts +73 -0
- package/dist/tools/access-control.d.ts +60 -0
- package/dist/tools/browser-engine.d.ts +73 -0
- package/dist/tools/builtins/jobs-router.d.ts +7 -0
- package/dist/tools/builtins/tasks-router.d.ts +25 -0
- package/dist/tools/index.d.ts +20 -0
- package/dist/tools/map-reduce.d.ts +64 -0
- package/dist/tools/registry.d.ts +39 -0
- package/dist/tools/router.d.ts +30 -0
- package/dist/tools/routers/browser-router.d.ts +12 -0
- package/dist/tools/routers/code-router.d.ts +34 -0
- package/dist/tools/routers/file-router.d.ts +35 -0
- package/dist/tools/routers/memory-router.d.ts +21 -0
- package/dist/tools/routers/schedule-router.d.ts +31 -0
- package/dist/tools/routers/search-backends.d.ts +47 -0
- package/dist/tools/routers/task-router.d.ts +32 -0
- package/dist/tools/routers/web-router.d.ts +36 -0
- package/dist/tools/skill-discovery.d.ts +32 -0
- package/dist/tools/skill-loader.d.ts +76 -0
- package/dist/tools/skill-types.d.ts +21 -0
- package/dist/voice/audio-intelligence.d.ts +42 -0
- package/dist/voice/barge-in.d.ts +51 -0
- package/dist/voice/index.d.ts +22 -0
- package/dist/voice/marker-parser.d.ts +31 -0
- package/dist/voice/sidecar-manager.d.ts +68 -0
- package/dist/voice/speaker-focus.d.ts +41 -0
- package/dist/voice/speaker-voiceprint.d.ts +47 -0
- package/dist/voice/speech-intent.d.ts +51 -0
- package/dist/voice/speechmatics-stt.d.ts +77 -0
- package/dist/voice/speechmatics-tts.d.ts +39 -0
- package/dist/voice/stt-provider.d.ts +40 -0
- package/dist/voice/transcript.d.ts +19 -0
- package/dist/voice/turn-detection.d.ts +53 -0
- package/dist/wrapup.d.ts +15 -0
- package/package.json +39 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP API — Hono-based server exposing the full Fenix API surface.
|
|
3
|
+
*
|
|
4
|
+
* Routes:
|
|
5
|
+
* - POST /api/v1/messages — send message, SSE response
|
|
6
|
+
* - GET /api/v1/conversations — list conversations
|
|
7
|
+
* - POST /api/v1/conversations — create conversation
|
|
8
|
+
* - DELETE /api/v1/conversations/:id — delete conversation
|
|
9
|
+
* - GET /api/v1/memory/search — search memory
|
|
10
|
+
* - GET /api/v1/memory/profile — get user profile
|
|
11
|
+
* - GET /api/v1/memory/graph — query knowledge graph
|
|
12
|
+
* - GET /api/v1/jobs — list jobs
|
|
13
|
+
* - POST /api/v1/jobs — submit job
|
|
14
|
+
* - DELETE /api/v1/jobs/:id — cancel job
|
|
15
|
+
* - POST /api/v1/webhooks/:id — webhook callback
|
|
16
|
+
* - POST /api/v1/approvals/:id — approval response
|
|
17
|
+
* - GET /api/v1/tasks — list tasks
|
|
18
|
+
* - GET /api/v1/traces — get traces
|
|
19
|
+
* - GET /api/v1/costs — get cost summary
|
|
20
|
+
* - GET /api/v1/health — health check
|
|
21
|
+
* - GET /api/v1/config — workspace config
|
|
22
|
+
* - GET /api/v1/sessions/:id/reconnect — replay missed events (SSE)
|
|
23
|
+
*
|
|
24
|
+
* WebSocket channels: /ws/events, /ws/workspace
|
|
25
|
+
*/
|
|
26
|
+
import type { AgentEvent } from "../events/types.js";
|
|
27
|
+
import type { EventBus } from "../events/bus.js";
|
|
28
|
+
import type { SessionManager } from "../events/session-manager.js";
|
|
29
|
+
interface HonoContext {
|
|
30
|
+
req: {
|
|
31
|
+
param(name: string): string;
|
|
32
|
+
query(name: string): string | undefined;
|
|
33
|
+
json<T = unknown>(): Promise<T>;
|
|
34
|
+
header(name: string): string | undefined;
|
|
35
|
+
};
|
|
36
|
+
json(data: unknown, status?: number): Response;
|
|
37
|
+
text(data: string, status?: number): Response;
|
|
38
|
+
header(name: string, value: string): void;
|
|
39
|
+
body(data: ReadableStream | string | null, status?: number): Response;
|
|
40
|
+
get(key: string): unknown;
|
|
41
|
+
set(key: string, value: unknown): void;
|
|
42
|
+
}
|
|
43
|
+
interface HonoApp {
|
|
44
|
+
get(path: string, ...handlers: Array<(c: HonoContext) => Response | Promise<Response>>): void;
|
|
45
|
+
post(path: string, ...handlers: Array<(c: HonoContext) => Response | Promise<Response>>): void;
|
|
46
|
+
delete(path: string, ...handlers: Array<(c: HonoContext) => Response | Promise<Response>>): void;
|
|
47
|
+
use(path: string, ...handlers: Array<(c: HonoContext, next: () => Promise<void>) => Response | Promise<Response | void>>): void;
|
|
48
|
+
}
|
|
49
|
+
export interface MessageInput {
|
|
50
|
+
userId: string;
|
|
51
|
+
conversationId?: string;
|
|
52
|
+
content: string;
|
|
53
|
+
channel?: string;
|
|
54
|
+
attachments?: Array<{
|
|
55
|
+
type: string;
|
|
56
|
+
url?: string;
|
|
57
|
+
base64?: string;
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
export interface APIHandlers {
|
|
61
|
+
/** Send a message and receive streaming agent events */
|
|
62
|
+
sendMessage(input: MessageInput): AsyncIterable<AgentEvent>;
|
|
63
|
+
/** Conversations */
|
|
64
|
+
listConversations(userId: string, limit?: number, offset?: number): Promise<unknown[]>;
|
|
65
|
+
createConversation(userId: string, title?: string, channel?: string): Promise<unknown>;
|
|
66
|
+
deleteConversation(id: string): Promise<void>;
|
|
67
|
+
/** Memory */
|
|
68
|
+
searchMemory(userId: string, query: string, limit?: number): Promise<unknown[]>;
|
|
69
|
+
getProfile(userId: string): Promise<unknown>;
|
|
70
|
+
queryGraph(userId: string, entity: string): Promise<unknown>;
|
|
71
|
+
/** Jobs */
|
|
72
|
+
listJobs(status?: string, type?: string): Promise<unknown[]>;
|
|
73
|
+
submitJob(type: string, payload: unknown, priority?: string): Promise<unknown>;
|
|
74
|
+
cancelJob(id: string): Promise<void>;
|
|
75
|
+
/** Webhooks */
|
|
76
|
+
handleWebhook(id: string, payload: unknown): Promise<unknown>;
|
|
77
|
+
/** Approvals */
|
|
78
|
+
respondApproval(id: string, approved: boolean, reason?: string): Promise<unknown>;
|
|
79
|
+
/** Tasks, traces, costs */
|
|
80
|
+
listTasks(status?: string): Promise<unknown[]>;
|
|
81
|
+
getTraces(sessionId?: string, limit?: number): Promise<unknown[]>;
|
|
82
|
+
getCosts(userId?: string, period?: string): Promise<unknown>;
|
|
83
|
+
/** Config */
|
|
84
|
+
getConfig(): Promise<unknown>;
|
|
85
|
+
}
|
|
86
|
+
export interface HTTPAPIConfig {
|
|
87
|
+
handlers: APIHandlers;
|
|
88
|
+
bus: EventBus;
|
|
89
|
+
sessionManager: SessionManager;
|
|
90
|
+
/**
|
|
91
|
+
* Enable stateless mode. When true, POST /api/v1/stateless/chat
|
|
92
|
+
* accepts full history + state from the client and returns updated
|
|
93
|
+
* state. No server-side session storage. Enables serverless/Lambda.
|
|
94
|
+
*/
|
|
95
|
+
stateless?: boolean;
|
|
96
|
+
}
|
|
97
|
+
export interface StatelessRequest {
|
|
98
|
+
/** Full conversation history. */
|
|
99
|
+
messages: Array<{
|
|
100
|
+
role: string;
|
|
101
|
+
content: string;
|
|
102
|
+
}>;
|
|
103
|
+
/** Client-side state to restore. */
|
|
104
|
+
state?: Record<string, unknown>;
|
|
105
|
+
/** User identifier. */
|
|
106
|
+
userId: string;
|
|
107
|
+
/** Optional model override. */
|
|
108
|
+
model?: string;
|
|
109
|
+
}
|
|
110
|
+
export interface StatelessResponse {
|
|
111
|
+
/** Updated conversation with assistant reply appended. */
|
|
112
|
+
messages: Array<{
|
|
113
|
+
role: string;
|
|
114
|
+
content: string;
|
|
115
|
+
}>;
|
|
116
|
+
/** Updated state for the client to persist. */
|
|
117
|
+
state: Record<string, unknown>;
|
|
118
|
+
/** Events generated during processing. */
|
|
119
|
+
events: unknown[];
|
|
120
|
+
/** Token usage. */
|
|
121
|
+
usage: {
|
|
122
|
+
inputTokens: number;
|
|
123
|
+
outputTokens: number;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Register all API routes on a Hono app instance.
|
|
128
|
+
*
|
|
129
|
+
* Usage:
|
|
130
|
+
* ```ts
|
|
131
|
+
* import { Hono } from "hono";
|
|
132
|
+
* const app = new Hono();
|
|
133
|
+
* registerAPIRoutes(app, { handlers, bus, sessionManager });
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare function registerAPIRoutes(app: HonoApp, config: HTTPAPIConfig): void;
|
|
137
|
+
export interface WSUpgradeContext {
|
|
138
|
+
sessionId: string;
|
|
139
|
+
channel: "events" | "workspace";
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Handle WebSocket upgrade for /ws/events and /ws/workspace.
|
|
143
|
+
*
|
|
144
|
+
* This is a helper for Bun's native WebSocket or Hono's ws adapter.
|
|
145
|
+
* The consumer is responsible for the actual upgrade; this function
|
|
146
|
+
* wires the event bus to the socket.
|
|
147
|
+
*/
|
|
148
|
+
export declare function wireWebSocket(ws: {
|
|
149
|
+
send(data: string): void;
|
|
150
|
+
close(): void;
|
|
151
|
+
}, context: WSUpgradeContext, config: {
|
|
152
|
+
bus: EventBus;
|
|
153
|
+
sessionManager: SessionManager;
|
|
154
|
+
}): () => void;
|
|
155
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { createTelegramChannelAdapter, splitMessage, statusIcon, formatElapsed } from "./telegram.js";
|
|
2
|
+
export type { STTProvider, TTSProvider, AdapterMode, ModeIndicator, TelegramAdapterConfig, TelegramChannelAdapter, MessageEnvelope, MessageHandler, Attachment, TaskInfo, JobInfo, PendingApproval, InlineKeyboardMarkup, InlineKeyboardButton, TelegramUpdate, TelegramMessage, TelegramUser, TelegramChat, TelegramCallbackQuery, TelegramPhotoSize, TelegramDocument, TelegramVoice, } from "./telegram.js";
|
|
3
|
+
export { registerAPIRoutes, wireWebSocket, type APIHandlers, type HTTPAPIConfig } from "./http-api.js";
|
|
4
|
+
export { registerOpenAIRoutes, type OpenAICompatRouteConfig } from "./openai-compat.js";
|
|
5
|
+
export { createWhatsAppAdapter } from "./whatsapp.js";
|
|
6
|
+
export type { WhatsAppConfig, WhatsAppChannelAdapter, WAInboundMessage, WhatsAppAdapterEvent, WhatsAppEventHandler } from "./whatsapp.js";
|
|
7
|
+
export { createDiscordAdapter } from "./discord.js";
|
|
8
|
+
export type { DiscordConfig, DiscordChannelAdapter, DiscordMessage, DiscordInteraction, DiscordAttachment } from "./discord.js";
|
|
9
|
+
export { createSlackAdapter } from "./slack.js";
|
|
10
|
+
export type { SlackConfig, SlackChannelAdapter, SlackEventPayload, SlackEvent, SlackSlashCommand, SlackInteraction } from "./slack.js";
|
|
11
|
+
export { createSignalAdapter } from "./signal.js";
|
|
12
|
+
export type { SignalConfig, SignalChannelAdapter, SignalInboundMessage, SignalAttachmentInfo } from "./signal.js";
|
|
13
|
+
export { createEmailAdapter } from "./email.js";
|
|
14
|
+
export type { EmailConfig, EmailChannelAdapter, InboundEmail, OutboundEmail, EmailAttachment } from "./email.js";
|
|
15
|
+
export { createTeamsAdapter } from "./teams.js";
|
|
16
|
+
export type { TeamsConfig, TeamsChannelAdapter, TeamsActivity, TeamsActivityResponse, ConversationReference, PendingTeamsApproval } from "./teams.js";
|
|
17
|
+
export { createMcpChannelAdapter } from "./mcp-channel.js";
|
|
18
|
+
export type { McpChannelConfig, McpChannelAdapter, McpAgentStatus, McpMemoryResult, McpResource, JsonRpcRequest, JsonRpcResponse } from "./mcp-channel.js";
|
|
19
|
+
export { createChannelRegistry } from "./registry.js";
|
|
20
|
+
export type { ChannelRegistry, ChannelRegistryConfig, ChannelStatus, ChannelAccessConfig, ChannelRegistryEvent, RegisteredChannel } from "./registry.js";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Channel Adapter
|
|
3
|
+
*
|
|
4
|
+
* Exposes the Fenix agent as an MCP (Model Context Protocol) server so that
|
|
5
|
+
* MCP clients (Claude Desktop, Cursor, Windsurf, other agents) can interact
|
|
6
|
+
* with it as a tool provider.
|
|
7
|
+
*
|
|
8
|
+
* Transports:
|
|
9
|
+
* - "stdio" → for local integrations (client spawns Fenix as subprocess)
|
|
10
|
+
* - "sse" → for remote integrations over HTTP (Server-Sent Events)
|
|
11
|
+
*/
|
|
12
|
+
import type { MessageHandler } from "./types.js";
|
|
13
|
+
export interface McpChannelConfig {
|
|
14
|
+
transport: "stdio" | "sse";
|
|
15
|
+
/** SSE mode port. Default: 3100 */
|
|
16
|
+
port?: number;
|
|
17
|
+
/** SSE mode path. Default: "/mcp" */
|
|
18
|
+
path?: string;
|
|
19
|
+
/** Simple bearer token validation. */
|
|
20
|
+
apiKey?: string;
|
|
21
|
+
/** Message handler (injected by kernel). */
|
|
22
|
+
onMessage: MessageHandler;
|
|
23
|
+
/** Agent status callback. */
|
|
24
|
+
getStatus?: () => McpAgentStatus;
|
|
25
|
+
/** Memory search callback. */
|
|
26
|
+
memorySearch?: (query: string, limit?: number) => Promise<McpMemoryResult[]>;
|
|
27
|
+
/** Resources exposed to MCP clients. */
|
|
28
|
+
resources?: McpResource[];
|
|
29
|
+
/** Override for testing — inject a request handler. */
|
|
30
|
+
handleJsonRpc?: (request: JsonRpcRequest) => Promise<JsonRpcResponse>;
|
|
31
|
+
}
|
|
32
|
+
export interface McpAgentStatus {
|
|
33
|
+
state: "idle" | "busy" | "error";
|
|
34
|
+
activeConversations: number;
|
|
35
|
+
uptime: number;
|
|
36
|
+
version?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface McpMemoryResult {
|
|
39
|
+
content: string;
|
|
40
|
+
similarity: number;
|
|
41
|
+
metadata?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
export interface McpResource {
|
|
44
|
+
uri: string;
|
|
45
|
+
name: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
mimeType?: string;
|
|
48
|
+
content: string | (() => string | Promise<string>);
|
|
49
|
+
}
|
|
50
|
+
export interface JsonRpcRequest {
|
|
51
|
+
jsonrpc: "2.0";
|
|
52
|
+
id: string | number;
|
|
53
|
+
method: string;
|
|
54
|
+
params?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
export interface JsonRpcResponse {
|
|
57
|
+
jsonrpc: "2.0";
|
|
58
|
+
id: string | number;
|
|
59
|
+
result?: unknown;
|
|
60
|
+
error?: {
|
|
61
|
+
code: number;
|
|
62
|
+
message: string;
|
|
63
|
+
data?: unknown;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface McpChannelAdapter {
|
|
67
|
+
start(): Promise<void>;
|
|
68
|
+
stop(): Promise<void>;
|
|
69
|
+
/** Process a JSON-RPC request and return a response. */
|
|
70
|
+
handleRequest(request: JsonRpcRequest): Promise<JsonRpcResponse>;
|
|
71
|
+
readonly isRunning: boolean;
|
|
72
|
+
readonly transport: "stdio" | "sse";
|
|
73
|
+
readonly sessionCount: number;
|
|
74
|
+
}
|
|
75
|
+
export declare function createMcpChannelAdapter(config: McpChannelConfig): McpChannelAdapter;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export interface HILQuestion {
|
|
2
|
+
id: string;
|
|
3
|
+
agentInstanceId: string;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
question: string;
|
|
6
|
+
context?: string;
|
|
7
|
+
timeout: number;
|
|
8
|
+
createdAt: number;
|
|
9
|
+
}
|
|
10
|
+
export interface HILAnswer {
|
|
11
|
+
questionId: string;
|
|
12
|
+
answer: string;
|
|
13
|
+
answeredAt: number;
|
|
14
|
+
}
|
|
15
|
+
export type HILStatus = "pending" | "answered" | "timeout";
|
|
16
|
+
export interface HILRecord {
|
|
17
|
+
question: HILQuestion;
|
|
18
|
+
answer?: HILAnswer;
|
|
19
|
+
status: HILStatus;
|
|
20
|
+
}
|
|
21
|
+
export type HILEventType = "hil:question" | "hil:answered" | "hil:timeout";
|
|
22
|
+
export interface HILEvent {
|
|
23
|
+
type: HILEventType;
|
|
24
|
+
questionId: string;
|
|
25
|
+
sessionId: string;
|
|
26
|
+
agentInstanceId: string;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
}
|
|
29
|
+
export type HILEventHandler = (event: HILEvent) => void;
|
|
30
|
+
/** Push notification sender interface. */
|
|
31
|
+
export interface PushNotificationSender {
|
|
32
|
+
send(payload: PushNotificationPayload): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export interface PushNotificationPayload {
|
|
35
|
+
title: string;
|
|
36
|
+
body: string;
|
|
37
|
+
data: {
|
|
38
|
+
type: "hil:question";
|
|
39
|
+
agentInstanceId: string;
|
|
40
|
+
sessionId: string;
|
|
41
|
+
questionId: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Storage for pending HIL questions. */
|
|
45
|
+
export interface HILStore {
|
|
46
|
+
save(record: HILRecord): Promise<void>;
|
|
47
|
+
get(questionId: string): Promise<HILRecord | null>;
|
|
48
|
+
update(questionId: string, answer: HILAnswer): Promise<void>;
|
|
49
|
+
listPending(sessionId: string): Promise<HILRecord[]>;
|
|
50
|
+
}
|
|
51
|
+
export interface MobileHILConfig {
|
|
52
|
+
pushSender: PushNotificationSender;
|
|
53
|
+
store: HILStore;
|
|
54
|
+
/** Default timeout in seconds. */
|
|
55
|
+
defaultTimeout?: number;
|
|
56
|
+
}
|
|
57
|
+
export declare class MobileHILChannel {
|
|
58
|
+
private config;
|
|
59
|
+
private waiters;
|
|
60
|
+
private handlers;
|
|
61
|
+
constructor(config: MobileHILConfig);
|
|
62
|
+
/**
|
|
63
|
+
* Ask the user a question. Sends push notification, pauses
|
|
64
|
+
* execution until answer or timeout.
|
|
65
|
+
*/
|
|
66
|
+
ask(agentInstanceId: string, sessionId: string, question: string, opts?: {
|
|
67
|
+
timeout?: number;
|
|
68
|
+
context?: string;
|
|
69
|
+
}): Promise<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Submit an answer to a pending question.
|
|
72
|
+
* Called when the user responds via mobile app.
|
|
73
|
+
*/
|
|
74
|
+
answer(questionId: string, answerText: string): Promise<void>;
|
|
75
|
+
/** Subscribe to HIL events. */
|
|
76
|
+
on(handler: HILEventHandler): () => void;
|
|
77
|
+
/** Clean up all pending waiters. */
|
|
78
|
+
dispose(): void;
|
|
79
|
+
private emit;
|
|
80
|
+
}
|
|
81
|
+
export declare class HILTimeoutError extends Error {
|
|
82
|
+
readonly questionId: string;
|
|
83
|
+
readonly timeoutSeconds: number;
|
|
84
|
+
constructor(questionId: string, timeoutSeconds: number);
|
|
85
|
+
}
|
|
86
|
+
export declare function createInMemoryHILStore(): HILStore;
|
|
87
|
+
/** Reset ID counter for tests. */
|
|
88
|
+
export declare function _resetHILIds(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI-Compatible Channel — registers POST /v1/chat/completions on
|
|
3
|
+
* the HTTP API so that any app using the OpenAI SDK can drop in Fenix
|
|
4
|
+
* as a replacement.
|
|
5
|
+
*
|
|
6
|
+
* Delegates to the core handler in ../api/openai-compat.ts and adds
|
|
7
|
+
* route-level middleware (auth, CORS, content-type negotiation).
|
|
8
|
+
*/
|
|
9
|
+
import { type OpenAICompatConfig, type OpenAICompatHandler } from "../api/openai-compat.js";
|
|
10
|
+
interface HonoContext {
|
|
11
|
+
req: {
|
|
12
|
+
param(name: string): string;
|
|
13
|
+
query(name: string): string | undefined;
|
|
14
|
+
json<T = unknown>(): Promise<T>;
|
|
15
|
+
header(name: string): string | undefined;
|
|
16
|
+
};
|
|
17
|
+
json(data: unknown, status?: number): Response;
|
|
18
|
+
text(data: string, status?: number): Response;
|
|
19
|
+
header(name: string, value: string): void;
|
|
20
|
+
body(data: ReadableStream | string | null, status?: number): Response;
|
|
21
|
+
}
|
|
22
|
+
interface HonoApp {
|
|
23
|
+
post(path: string, ...handlers: Array<(c: HonoContext) => Response | Promise<Response>>): void;
|
|
24
|
+
get(path: string, ...handlers: Array<(c: HonoContext) => Response | Promise<Response>>): void;
|
|
25
|
+
}
|
|
26
|
+
export interface OpenAICompatRouteConfig extends OpenAICompatConfig {
|
|
27
|
+
/** Optional bearer token for auth. If set, requests must include
|
|
28
|
+
* `Authorization: Bearer <token>`. */
|
|
29
|
+
bearerToken?: string;
|
|
30
|
+
/** Base path prefix. Default: "" (mounts at /v1/chat/completions). */
|
|
31
|
+
basePath?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Register OpenAI-compatible routes on a Hono app:
|
|
35
|
+
* POST /v1/chat/completions — chat completion (streaming + non-streaming)
|
|
36
|
+
* GET /v1/models — list available models
|
|
37
|
+
*
|
|
38
|
+
* Returns the handler for event subscription.
|
|
39
|
+
*/
|
|
40
|
+
export declare function registerOpenAIRoutes(app: HonoApp, config: OpenAICompatRouteConfig): OpenAICompatHandler;
|
|
41
|
+
export { createOpenAICompatHandler, validateRequest, _resetCompletionIds, } from "../api/openai-compat.js";
|
|
42
|
+
export type { ChatRole, ChatMessage, ChatCompletionRequest, ChatCompletionChoice, CompletionUsage, ChatCompletionResponse, ChatCompletionChunkDelta, ChatCompletionChunkChoice, ChatCompletionChunk, AgentCompletionResult, AgentCompletionFn, AgentStreamFn, CompatEventType, CompatEvent, CompatEventListener, ValidationError, OpenAICompatConfig, OpenAICompatHandler, } from "../api/openai-compat.js";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel Registry
|
|
3
|
+
*
|
|
4
|
+
* Unified channel management: registration, lifecycle, access control,
|
|
5
|
+
* per-channel identity overrides, and health monitoring.
|
|
6
|
+
*/
|
|
7
|
+
import type { ChannelAdapter } from "./types.js";
|
|
8
|
+
export interface ChannelStatus {
|
|
9
|
+
name: string;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
connected: boolean;
|
|
12
|
+
messageCount: number;
|
|
13
|
+
lastMessageAt?: Date;
|
|
14
|
+
allowList?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface ChannelAccessConfig {
|
|
17
|
+
channelName: string;
|
|
18
|
+
/** User identifiers permitted on this channel. Empty = allow all. */
|
|
19
|
+
allowFrom: string[];
|
|
20
|
+
/** Explicit block list (takes precedence over allowFrom). */
|
|
21
|
+
denyFrom?: string[];
|
|
22
|
+
requireConsent?: boolean;
|
|
23
|
+
rateLimitPerMinute?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ChannelRegistryConfig {
|
|
26
|
+
/** Per-channel access rules. */
|
|
27
|
+
accessRules?: ChannelAccessConfig[];
|
|
28
|
+
/** Base path for identity override files. */
|
|
29
|
+
identityOverridePath?: string;
|
|
30
|
+
/** Event emitter callback. */
|
|
31
|
+
onEvent?: (event: ChannelRegistryEvent) => void;
|
|
32
|
+
/** Override for testing — load identity override from channel name. */
|
|
33
|
+
loadOverride?: (channelName: string) => Promise<string | null>;
|
|
34
|
+
/** Rejection message for denied users. Null = silent drop. */
|
|
35
|
+
rejectionMessage?: string | null;
|
|
36
|
+
}
|
|
37
|
+
export type ChannelRegistryEvent = {
|
|
38
|
+
type: "channel:connected";
|
|
39
|
+
channel: string;
|
|
40
|
+
} | {
|
|
41
|
+
type: "channel:disconnected";
|
|
42
|
+
channel: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: "channel:error";
|
|
45
|
+
channel: string;
|
|
46
|
+
error: string;
|
|
47
|
+
} | {
|
|
48
|
+
type: "channel:message";
|
|
49
|
+
channel: string;
|
|
50
|
+
userId: string;
|
|
51
|
+
} | {
|
|
52
|
+
type: "channel:denied";
|
|
53
|
+
channel: string;
|
|
54
|
+
userId: string;
|
|
55
|
+
reason: string;
|
|
56
|
+
};
|
|
57
|
+
export interface RegisteredChannel {
|
|
58
|
+
name: string;
|
|
59
|
+
adapter: ChannelAdapter;
|
|
60
|
+
enabled: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface ChannelRegistry {
|
|
63
|
+
register(name: string, adapter: ChannelAdapter): void;
|
|
64
|
+
unregister(name: string): void;
|
|
65
|
+
start(channelName: string): Promise<void>;
|
|
66
|
+
stop(channelName: string): Promise<void>;
|
|
67
|
+
startAll(): Promise<void>;
|
|
68
|
+
stopAll(): Promise<void>;
|
|
69
|
+
list(): ChannelStatus[];
|
|
70
|
+
getAdapter(name: string): ChannelAdapter | undefined;
|
|
71
|
+
/** Check whether a user is allowed on a channel. */
|
|
72
|
+
isAllowed(channelName: string, userId: string): boolean;
|
|
73
|
+
/** Load identity override for a channel (null if none). */
|
|
74
|
+
getIdentityOverride(channelName: string): Promise<string | null>;
|
|
75
|
+
/** Get message stats for a channel. */
|
|
76
|
+
getStats(channelName: string): ChannelStatus | undefined;
|
|
77
|
+
/** Record an inbound message (for stats tracking). */
|
|
78
|
+
recordMessage(channelName: string, userId: string): void;
|
|
79
|
+
}
|
|
80
|
+
export declare function createChannelRegistry(config?: ChannelRegistryConfig): ChannelRegistry;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signal Channel Adapter
|
|
3
|
+
*
|
|
4
|
+
* Privacy-focused channel adapter communicating with signal-cli daemon
|
|
5
|
+
* over JSON-RPC (Unix socket or stdin/stdout). GPL boundary is maintained
|
|
6
|
+
* via IPC — no GPL code is linked into Fenix.
|
|
7
|
+
*
|
|
8
|
+
* Two backends:
|
|
9
|
+
* - "signal-cli" → spawns or connects to signal-cli daemon
|
|
10
|
+
* - "signald" → connects to signald JSON-RPC over Unix socket
|
|
11
|
+
*/
|
|
12
|
+
import type { MessageHandler } from "./types.js";
|
|
13
|
+
import type { STTProvider, TTSProvider } from "./telegram.js";
|
|
14
|
+
export interface SignalConfig {
|
|
15
|
+
mode: "signal-cli" | "signald";
|
|
16
|
+
/** Registered Signal phone number (e.g. "+15551234567"). */
|
|
17
|
+
phoneNumber: string;
|
|
18
|
+
onMessage: MessageHandler;
|
|
19
|
+
/** Path to signal-cli binary (signal-cli mode). */
|
|
20
|
+
signalCliPath?: string;
|
|
21
|
+
/** Unix socket path (signald mode). Default: /var/run/signald/signald.sock */
|
|
22
|
+
socketPath?: string;
|
|
23
|
+
/** Phone number allow-list. Empty = allow all. */
|
|
24
|
+
allowedNumbers?: string[];
|
|
25
|
+
stt?: STTProvider;
|
|
26
|
+
tts?: TTSProvider;
|
|
27
|
+
/** Override for testing — inject a mock RPC transport. */
|
|
28
|
+
rpcSend?: (method: string, params: Record<string, unknown>) => Promise<unknown>;
|
|
29
|
+
/** Override for testing — inject inbound messages. */
|
|
30
|
+
onRpcMessage?: (handler: (msg: SignalInboundMessage) => void) => void;
|
|
31
|
+
}
|
|
32
|
+
/** Inbound message from signal-cli JSON-RPC. */
|
|
33
|
+
export interface SignalInboundMessage {
|
|
34
|
+
envelope: {
|
|
35
|
+
source: string;
|
|
36
|
+
sourceName?: string;
|
|
37
|
+
sourceDevice?: number;
|
|
38
|
+
timestamp: number;
|
|
39
|
+
dataMessage?: {
|
|
40
|
+
message?: string;
|
|
41
|
+
attachments?: SignalAttachmentInfo[];
|
|
42
|
+
groupInfo?: {
|
|
43
|
+
groupId: string;
|
|
44
|
+
groupName?: string;
|
|
45
|
+
};
|
|
46
|
+
expiresInSeconds?: number;
|
|
47
|
+
reaction?: {
|
|
48
|
+
emoji: string;
|
|
49
|
+
targetTimestamp: number;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
receiptMessage?: {
|
|
53
|
+
type: string;
|
|
54
|
+
timestamps: number[];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface SignalAttachmentInfo {
|
|
59
|
+
contentType: string;
|
|
60
|
+
filename?: string;
|
|
61
|
+
id: string;
|
|
62
|
+
size?: number;
|
|
63
|
+
/** Local file path where signal-cli stored the downloaded attachment. */
|
|
64
|
+
storedFilename?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface SignalChannelAdapter {
|
|
67
|
+
start(): Promise<void>;
|
|
68
|
+
stop(): Promise<void>;
|
|
69
|
+
sendMessage(conversationId: string, text: string): Promise<void>;
|
|
70
|
+
/** Process an inbound signal-cli JSON-RPC message (for testing). */
|
|
71
|
+
handleInbound(message: SignalInboundMessage): Promise<void>;
|
|
72
|
+
readonly isRunning: boolean;
|
|
73
|
+
readonly mode: "signal-cli" | "signald";
|
|
74
|
+
}
|
|
75
|
+
export declare function createSignalAdapter(config: SignalConfig): SignalChannelAdapter;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack Channel Adapter
|
|
3
|
+
*
|
|
4
|
+
* Two connection modes:
|
|
5
|
+
* - Socket Mode → real-time messaging via WebSocket (no public URL required)
|
|
6
|
+
* - HTTP Mode → webhook-based with signature verification
|
|
7
|
+
*
|
|
8
|
+
* Supports threaded conversations, Block Kit rich formatting,
|
|
9
|
+
* slash commands, file uploads, App Home tab, and user identity mapping.
|
|
10
|
+
*/
|
|
11
|
+
import type { MessageHandler } from "./types.js";
|
|
12
|
+
import type { STTProvider, TTSProvider, TaskInfo, JobInfo } from "./telegram.js";
|
|
13
|
+
export interface SlackConfig {
|
|
14
|
+
/** Bot user OAuth token (xoxb-...) */
|
|
15
|
+
botToken: string;
|
|
16
|
+
/** App-level token for Socket Mode (xapp-...) */
|
|
17
|
+
appToken: string;
|
|
18
|
+
/** Signing secret for HTTP mode webhook verification. */
|
|
19
|
+
signingSecret?: string;
|
|
20
|
+
/** "socket" for self-hosted, "http" for cloud. Default: "socket". */
|
|
21
|
+
mode: "socket" | "http";
|
|
22
|
+
onMessage: MessageHandler;
|
|
23
|
+
onReset?: (conversationId: string) => Promise<string>;
|
|
24
|
+
onTasks?: (conversationId: string) => Promise<TaskInfo[]>;
|
|
25
|
+
onJobs?: (conversationId: string) => Promise<JobInfo[]>;
|
|
26
|
+
/** Restrict to specific channels. */
|
|
27
|
+
allowedChannelIds?: string[];
|
|
28
|
+
/** Map Slack user IDs to Fenix user IDs. */
|
|
29
|
+
userIdMap?: Record<string, string>;
|
|
30
|
+
stt?: STTProvider;
|
|
31
|
+
tts?: TTSProvider;
|
|
32
|
+
/** Override fetch for testing. */
|
|
33
|
+
fetchFn?: typeof globalThis.fetch;
|
|
34
|
+
}
|
|
35
|
+
/** Slack event wrapper. */
|
|
36
|
+
export interface SlackEventPayload {
|
|
37
|
+
type: string;
|
|
38
|
+
challenge?: string;
|
|
39
|
+
token?: string;
|
|
40
|
+
event?: SlackEvent;
|
|
41
|
+
team_id?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface SlackEvent {
|
|
44
|
+
type: string;
|
|
45
|
+
subtype?: string;
|
|
46
|
+
channel: string;
|
|
47
|
+
user?: string;
|
|
48
|
+
text?: string;
|
|
49
|
+
ts: string;
|
|
50
|
+
thread_ts?: string;
|
|
51
|
+
files?: SlackFile[];
|
|
52
|
+
bot_id?: string;
|
|
53
|
+
channel_type?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface SlackFile {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
mimetype: string;
|
|
59
|
+
url_private: string;
|
|
60
|
+
size: number;
|
|
61
|
+
}
|
|
62
|
+
export interface SlackInteraction {
|
|
63
|
+
type: string;
|
|
64
|
+
trigger_id: string;
|
|
65
|
+
user: {
|
|
66
|
+
id: string;
|
|
67
|
+
username: string;
|
|
68
|
+
};
|
|
69
|
+
channel?: {
|
|
70
|
+
id: string;
|
|
71
|
+
};
|
|
72
|
+
actions?: Array<{
|
|
73
|
+
action_id: string;
|
|
74
|
+
value?: string;
|
|
75
|
+
block_id?: string;
|
|
76
|
+
}>;
|
|
77
|
+
message?: {
|
|
78
|
+
ts: string;
|
|
79
|
+
channel?: string;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface SlackSlashCommand {
|
|
83
|
+
command: string;
|
|
84
|
+
text: string;
|
|
85
|
+
user_id: string;
|
|
86
|
+
user_name: string;
|
|
87
|
+
channel_id: string;
|
|
88
|
+
channel_name: string;
|
|
89
|
+
trigger_id: string;
|
|
90
|
+
response_url: string;
|
|
91
|
+
}
|
|
92
|
+
export interface PendingSlackApproval {
|
|
93
|
+
id: string;
|
|
94
|
+
channelId: string;
|
|
95
|
+
threadTs: string;
|
|
96
|
+
resolve: (choice: string) => void;
|
|
97
|
+
}
|
|
98
|
+
export interface SlackChannelAdapter {
|
|
99
|
+
start(): Promise<void>;
|
|
100
|
+
stop(): Promise<void>;
|
|
101
|
+
sendMessage(conversationId: string, text: string): Promise<void>;
|
|
102
|
+
/** Process inbound Slack event. */
|
|
103
|
+
handleEvent(payload: SlackEventPayload): Promise<{
|
|
104
|
+
challenge?: string;
|
|
105
|
+
}>;
|
|
106
|
+
/** Process slash command. */
|
|
107
|
+
handleSlashCommand(command: SlackSlashCommand): Promise<string>;
|
|
108
|
+
/** Process block action (interactive buttons). */
|
|
109
|
+
handleInteraction(interaction: SlackInteraction): Promise<void>;
|
|
110
|
+
/** Verify webhook request signature. */
|
|
111
|
+
verifySignature(timestamp: string, body: string, signature: string): boolean;
|
|
112
|
+
readonly isRunning: boolean;
|
|
113
|
+
readonly mode: "socket" | "http";
|
|
114
|
+
}
|
|
115
|
+
export declare function createSlackAdapter(config: SlackConfig): SlackChannelAdapter;
|