palaryn 0.1.0 → 0.3.2
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/README.md +243 -588
- package/dist/sdk/typescript/src/client.js +2 -2
- package/dist/sdk/typescript/src/client.js.map +1 -1
- package/dist/src/anomaly/detector.d.ts +7 -4
- package/dist/src/anomaly/detector.d.ts.map +1 -1
- package/dist/src/anomaly/detector.js +22 -12
- package/dist/src/anomaly/detector.js.map +1 -1
- package/dist/src/audit/logger.d.ts +10 -0
- package/dist/src/audit/logger.d.ts.map +1 -1
- package/dist/src/audit/logger.js +52 -38
- package/dist/src/audit/logger.js.map +1 -1
- package/dist/src/auth/routes.d.ts.map +1 -1
- package/dist/src/auth/routes.js +35 -0
- package/dist/src/auth/routes.js.map +1 -1
- package/dist/src/budget/manager.d.ts +5 -0
- package/dist/src/budget/manager.d.ts.map +1 -1
- package/dist/src/budget/manager.js +32 -0
- package/dist/src/budget/manager.js.map +1 -1
- package/dist/src/budget/model-pricing.d.ts +20 -0
- package/dist/src/budget/model-pricing.d.ts.map +1 -0
- package/dist/src/budget/model-pricing.js +107 -0
- package/dist/src/budget/model-pricing.js.map +1 -0
- package/dist/src/budget/usage-extractor.d.ts +3 -1
- package/dist/src/budget/usage-extractor.d.ts.map +1 -1
- package/dist/src/budget/usage-extractor.js +47 -3
- package/dist/src/budget/usage-extractor.js.map +1 -1
- package/dist/src/config/defaults.d.ts.map +1 -1
- package/dist/src/config/defaults.js +65 -13
- package/dist/src/config/defaults.js.map +1 -1
- package/dist/src/dlp/tool-patterns.d.ts +7 -0
- package/dist/src/dlp/tool-patterns.d.ts.map +1 -0
- package/dist/src/dlp/tool-patterns.js +34 -0
- package/dist/src/dlp/tool-patterns.js.map +1 -0
- package/dist/src/executor/filesystem-executor.d.ts +28 -0
- package/dist/src/executor/filesystem-executor.d.ts.map +1 -0
- package/dist/src/executor/filesystem-executor.js +192 -0
- package/dist/src/executor/filesystem-executor.js.map +1 -0
- package/dist/src/executor/http-executor.d.ts.map +1 -1
- package/dist/src/executor/http-executor.js +22 -2
- package/dist/src/executor/http-executor.js.map +1 -1
- package/dist/src/executor/index.d.ts +4 -0
- package/dist/src/executor/index.d.ts.map +1 -1
- package/dist/src/executor/index.js +9 -1
- package/dist/src/executor/index.js.map +1 -1
- package/dist/src/executor/shell-executor.d.ts +22 -0
- package/dist/src/executor/shell-executor.d.ts.map +1 -0
- package/dist/src/executor/shell-executor.js +119 -0
- package/dist/src/executor/shell-executor.js.map +1 -0
- package/dist/src/executor/sql-executor.d.ts +29 -0
- package/dist/src/executor/sql-executor.d.ts.map +1 -0
- package/dist/src/executor/sql-executor.js +114 -0
- package/dist/src/executor/sql-executor.js.map +1 -0
- package/dist/src/executor/websocket-executor.d.ts +26 -0
- package/dist/src/executor/websocket-executor.d.ts.map +1 -0
- package/dist/src/executor/websocket-executor.js +205 -0
- package/dist/src/executor/websocket-executor.js.map +1 -0
- package/dist/src/interceptor/index.d.ts +2 -0
- package/dist/src/interceptor/index.d.ts.map +1 -0
- package/dist/src/interceptor/index.js +6 -0
- package/dist/src/interceptor/index.js.map +1 -0
- package/dist/src/interceptor/provider-interceptor.d.ts +36 -0
- package/dist/src/interceptor/provider-interceptor.d.ts.map +1 -0
- package/dist/src/interceptor/provider-interceptor.js +302 -0
- package/dist/src/interceptor/provider-interceptor.js.map +1 -0
- package/dist/src/mcp/auth-verifier.d.ts.map +1 -1
- package/dist/src/mcp/auth-verifier.js +3 -2
- package/dist/src/mcp/auth-verifier.js.map +1 -1
- package/dist/src/mcp/bridge.d.ts +14 -10
- package/dist/src/mcp/bridge.d.ts.map +1 -1
- package/dist/src/mcp/bridge.js +51 -227
- package/dist/src/mcp/bridge.js.map +1 -1
- package/dist/src/mcp/http-transport.d.ts +2 -0
- package/dist/src/mcp/http-transport.d.ts.map +1 -1
- package/dist/src/mcp/http-transport.js +117 -66
- package/dist/src/mcp/http-transport.js.map +1 -1
- package/dist/src/mcp/internal-auth.d.ts +13 -0
- package/dist/src/mcp/internal-auth.d.ts.map +1 -0
- package/dist/src/mcp/internal-auth.js +12 -0
- package/dist/src/mcp/internal-auth.js.map +1 -0
- package/dist/src/mcp/tool-definitions.d.ts +41 -0
- package/dist/src/mcp/tool-definitions.d.ts.map +1 -0
- package/dist/src/mcp/tool-definitions.js +491 -0
- package/dist/src/mcp/tool-definitions.js.map +1 -0
- package/dist/src/middleware/auth.js.map +1 -1
- package/dist/src/middleware/session.js.map +1 -1
- package/dist/src/middleware/validate.d.ts +8 -0
- package/dist/src/middleware/validate.d.ts.map +1 -1
- package/dist/src/middleware/validate.js +45 -0
- package/dist/src/middleware/validate.js.map +1 -1
- package/dist/src/policy/engine.d.ts +4 -0
- package/dist/src/policy/engine.d.ts.map +1 -1
- package/dist/src/policy/engine.js +117 -0
- package/dist/src/policy/engine.js.map +1 -1
- package/dist/src/saas/routes.d.ts.map +1 -1
- package/dist/src/saas/routes.js +355 -22
- package/dist/src/saas/routes.js.map +1 -1
- package/dist/src/server/app.d.ts.map +1 -1
- package/dist/src/server/app.js +24 -3
- package/dist/src/server/app.js.map +1 -1
- package/dist/src/server/gateway.d.ts.map +1 -1
- package/dist/src/server/gateway.js +17 -0
- package/dist/src/server/gateway.js.map +1 -1
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/index.js +18 -0
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/storage/interfaces.d.ts +14 -3
- package/dist/src/storage/interfaces.d.ts.map +1 -1
- package/dist/src/storage/memory.d.ts +2 -0
- package/dist/src/storage/memory.d.ts.map +1 -1
- package/dist/src/storage/memory.js +6 -0
- package/dist/src/storage/memory.js.map +1 -1
- package/dist/src/storage/postgres.d.ts +5 -0
- package/dist/src/storage/postgres.d.ts.map +1 -1
- package/dist/src/storage/postgres.js +16 -0
- package/dist/src/storage/postgres.js.map +1 -1
- package/dist/src/storage/redis.d.ts +10 -0
- package/dist/src/storage/redis.d.ts.map +1 -1
- package/dist/src/storage/redis.js +65 -0
- package/dist/src/storage/redis.js.map +1 -1
- package/dist/src/types/budget.d.ts +4 -0
- package/dist/src/types/budget.d.ts.map +1 -1
- package/dist/src/types/config.d.ts +58 -0
- package/dist/src/types/config.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +1 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/policy.d.ts +11 -1
- package/dist/src/types/policy.d.ts.map +1 -1
- package/dist/src/types/tool-result.d.ts +11 -0
- package/dist/src/types/tool-result.d.ts.map +1 -1
- package/dist/tests/unit/app-routes.test.d.ts +2 -0
- package/dist/tests/unit/app-routes.test.d.ts.map +1 -0
- package/dist/tests/unit/app-routes.test.js +715 -0
- package/dist/tests/unit/app-routes.test.js.map +1 -0
- package/dist/tests/unit/audit-logger.test.js +105 -0
- package/dist/tests/unit/audit-logger.test.js.map +1 -1
- package/dist/tests/unit/auth-providers.test.d.ts +2 -0
- package/dist/tests/unit/auth-providers.test.d.ts.map +1 -0
- package/dist/tests/unit/auth-providers.test.js +279 -0
- package/dist/tests/unit/auth-providers.test.js.map +1 -0
- package/dist/tests/unit/auth-routes-extended.test.d.ts +2 -0
- package/dist/tests/unit/auth-routes-extended.test.d.ts.map +1 -0
- package/dist/tests/unit/auth-routes-extended.test.js +993 -0
- package/dist/tests/unit/auth-routes-extended.test.js.map +1 -0
- package/dist/tests/unit/auth-verifier.test.d.ts +2 -0
- package/dist/tests/unit/auth-verifier.test.d.ts.map +1 -0
- package/dist/tests/unit/auth-verifier.test.js +505 -0
- package/dist/tests/unit/auth-verifier.test.js.map +1 -0
- package/dist/tests/unit/billing-routes.test.d.ts +2 -0
- package/dist/tests/unit/billing-routes.test.d.ts.map +1 -0
- package/dist/tests/unit/billing-routes.test.js +432 -0
- package/dist/tests/unit/billing-routes.test.js.map +1 -0
- package/dist/tests/unit/config-defaults.test.d.ts +2 -0
- package/dist/tests/unit/config-defaults.test.d.ts.map +1 -0
- package/dist/tests/unit/config-defaults.test.js +119 -0
- package/dist/tests/unit/config-defaults.test.js.map +1 -0
- package/dist/tests/unit/defaults.test.js +0 -10
- package/dist/tests/unit/defaults.test.js.map +1 -1
- package/dist/tests/unit/filesystem-executor.test.d.ts +2 -0
- package/dist/tests/unit/filesystem-executor.test.d.ts.map +1 -0
- package/dist/tests/unit/filesystem-executor.test.js +280 -0
- package/dist/tests/unit/filesystem-executor.test.js.map +1 -0
- package/dist/tests/unit/gateway-branches.test.d.ts +2 -0
- package/dist/tests/unit/gateway-branches.test.d.ts.map +1 -0
- package/dist/tests/unit/gateway-branches.test.js +1039 -0
- package/dist/tests/unit/gateway-branches.test.js.map +1 -0
- package/dist/tests/unit/http-executor-branches.test.d.ts +2 -0
- package/dist/tests/unit/http-executor-branches.test.d.ts.map +1 -0
- package/dist/tests/unit/http-executor-branches.test.js +495 -0
- package/dist/tests/unit/http-executor-branches.test.js.map +1 -0
- package/dist/tests/unit/logger.test.d.ts +2 -0
- package/dist/tests/unit/logger.test.d.ts.map +1 -0
- package/dist/tests/unit/logger.test.js +97 -0
- package/dist/tests/unit/logger.test.js.map +1 -0
- package/dist/tests/unit/mcp-internal-auth.test.d.ts +2 -0
- package/dist/tests/unit/mcp-internal-auth.test.d.ts.map +1 -0
- package/dist/tests/unit/mcp-internal-auth.test.js +445 -0
- package/dist/tests/unit/mcp-internal-auth.test.js.map +1 -0
- package/dist/tests/unit/metrics.test.js +102 -0
- package/dist/tests/unit/metrics.test.js.map +1 -1
- package/dist/tests/unit/model-pricing.test.d.ts +2 -0
- package/dist/tests/unit/model-pricing.test.d.ts.map +1 -0
- package/dist/tests/unit/model-pricing.test.js +87 -0
- package/dist/tests/unit/model-pricing.test.js.map +1 -0
- package/dist/tests/unit/oauth-stores.test.d.ts +2 -0
- package/dist/tests/unit/oauth-stores.test.d.ts.map +1 -0
- package/dist/tests/unit/oauth-stores.test.js +260 -0
- package/dist/tests/unit/oauth-stores.test.js.map +1 -0
- package/dist/tests/unit/policy-engine.test.js +466 -0
- package/dist/tests/unit/policy-engine.test.js.map +1 -1
- package/dist/tests/unit/provider-interceptor.test.d.ts +2 -0
- package/dist/tests/unit/provider-interceptor.test.d.ts.map +1 -0
- package/dist/tests/unit/provider-interceptor.test.js +472 -0
- package/dist/tests/unit/provider-interceptor.test.js.map +1 -0
- package/dist/tests/unit/saas-routes-branches.test.d.ts +2 -0
- package/dist/tests/unit/saas-routes-branches.test.d.ts.map +1 -0
- package/dist/tests/unit/saas-routes-branches.test.js +2165 -0
- package/dist/tests/unit/saas-routes-branches.test.js.map +1 -0
- package/dist/tests/unit/saas-routes-crud.test.d.ts +2 -0
- package/dist/tests/unit/saas-routes-crud.test.d.ts.map +1 -0
- package/dist/tests/unit/saas-routes-crud.test.js +332 -0
- package/dist/tests/unit/saas-routes-crud.test.js.map +1 -0
- package/dist/tests/unit/saas-routes-data.test.d.ts +2 -0
- package/dist/tests/unit/saas-routes-data.test.d.ts.map +1 -0
- package/dist/tests/unit/saas-routes-data.test.js +405 -0
- package/dist/tests/unit/saas-routes-data.test.js.map +1 -0
- package/dist/tests/unit/saas-routes.test.js +3 -3
- package/dist/tests/unit/saas-routes.test.js.map +1 -1
- package/dist/tests/unit/shell-executor.test.d.ts +2 -0
- package/dist/tests/unit/shell-executor.test.d.ts.map +1 -0
- package/dist/tests/unit/shell-executor.test.js +145 -0
- package/dist/tests/unit/shell-executor.test.js.map +1 -0
- package/dist/tests/unit/sql-executor.test.d.ts +2 -0
- package/dist/tests/unit/sql-executor.test.d.ts.map +1 -0
- package/dist/tests/unit/sql-executor.test.js +177 -0
- package/dist/tests/unit/sql-executor.test.js.map +1 -0
- package/dist/tests/unit/stream-proxy.test.d.ts +2 -0
- package/dist/tests/unit/stream-proxy.test.d.ts.map +1 -0
- package/dist/tests/unit/stream-proxy.test.js +147 -0
- package/dist/tests/unit/stream-proxy.test.js.map +1 -0
- package/dist/tests/unit/tool-definitions.test.d.ts +2 -0
- package/dist/tests/unit/tool-definitions.test.d.ts.map +1 -0
- package/dist/tests/unit/tool-definitions.test.js +184 -0
- package/dist/tests/unit/tool-definitions.test.js.map +1 -0
- package/dist/tests/unit/usage-extractor.test.js +140 -0
- package/dist/tests/unit/usage-extractor.test.js.map +1 -1
- package/dist/tests/unit/webhook-handler.test.d.ts +2 -0
- package/dist/tests/unit/webhook-handler.test.d.ts.map +1 -0
- package/dist/tests/unit/webhook-handler.test.js +453 -0
- package/dist/tests/unit/webhook-handler.test.js.map +1 -0
- package/dist/tests/unit/webhook-routes.test.d.ts +2 -0
- package/dist/tests/unit/webhook-routes.test.d.ts.map +1 -0
- package/dist/tests/unit/webhook-routes.test.js +69 -0
- package/dist/tests/unit/webhook-routes.test.js.map +1 -0
- package/dist/tests/unit/websocket-executor.test.d.ts +2 -0
- package/dist/tests/unit/websocket-executor.test.d.ts.map +1 -0
- package/dist/tests/unit/websocket-executor.test.js +121 -0
- package/dist/tests/unit/websocket-executor.test.js.map +1 -0
- package/package.json +8 -2
- package/policy-packs/demo_fail.yaml +41 -0
- package/policy-packs/full_tools.yaml +136 -0
- package/src/admin/index.ts +1 -0
- package/src/admin/routes.ts +509 -0
- package/src/admin/templates.ts +572 -0
- package/src/anomaly/detector.ts +730 -0
- package/src/anomaly/index.ts +1 -0
- package/src/approval/manager.ts +569 -0
- package/src/approval/webhook.ts +133 -0
- package/src/audit/logger.ts +490 -0
- package/src/auth/index.ts +5 -0
- package/src/auth/password.ts +21 -0
- package/src/auth/pkce.ts +22 -0
- package/src/auth/providers.ts +208 -0
- package/src/auth/routes.ts +561 -0
- package/src/auth/session.ts +84 -0
- package/src/billing/index.ts +6 -0
- package/src/billing/plan-enforcer.ts +135 -0
- package/src/billing/routes.ts +229 -0
- package/src/billing/stripe-client.ts +58 -0
- package/src/billing/webhook-handler.ts +182 -0
- package/src/billing/webhook-routes.ts +28 -0
- package/src/budget/manager.ts +679 -0
- package/src/budget/model-pricing.ts +119 -0
- package/src/budget/usage-extractor.ts +214 -0
- package/src/cli.ts +91 -0
- package/src/config/defaults.ts +261 -0
- package/src/config/validate.ts +88 -0
- package/src/dlp/composite-scanner.ts +213 -0
- package/src/dlp/index.ts +9 -0
- package/src/dlp/interfaces.ts +34 -0
- package/src/dlp/patterns.ts +30 -0
- package/src/dlp/prompt-injection-backend.ts +181 -0
- package/src/dlp/prompt-injection-patterns.ts +302 -0
- package/src/dlp/regex-backend.ts +181 -0
- package/src/dlp/scanner.ts +502 -0
- package/src/dlp/text-normalizer.ts +225 -0
- package/src/dlp/tool-patterns.ts +35 -0
- package/src/dlp/trufflehog-backend.ts +190 -0
- package/src/executor/filesystem-executor.ts +196 -0
- package/src/executor/http-executor.ts +349 -0
- package/src/executor/index.ts +9 -0
- package/src/executor/interfaces.ts +11 -0
- package/src/executor/noop-executor.ts +23 -0
- package/src/executor/registry.ts +64 -0
- package/src/executor/shell-executor.ts +148 -0
- package/src/executor/slack-executor.ts +176 -0
- package/src/executor/sql-executor.ts +146 -0
- package/src/executor/websocket-executor.ts +211 -0
- package/src/index.ts +24 -0
- package/src/interceptor/index.ts +1 -0
- package/src/interceptor/provider-interceptor.ts +315 -0
- package/src/mcp/auth-verifier.ts +152 -0
- package/src/mcp/bridge.ts +703 -0
- package/src/mcp/http-transport.ts +698 -0
- package/src/mcp/index.ts +9 -0
- package/src/mcp/internal-auth.ts +14 -0
- package/src/mcp/oauth-pages.ts +139 -0
- package/src/mcp/oauth-postgres-stores.ts +278 -0
- package/src/mcp/oauth-provider.ts +536 -0
- package/src/mcp/oauth-stores.ts +202 -0
- package/src/mcp/server.ts +55 -0
- package/src/mcp/tool-definitions.ts +562 -0
- package/src/metrics/collector.ts +357 -0
- package/src/metrics/index.ts +1 -0
- package/src/middleware/auth.ts +814 -0
- package/src/middleware/session.ts +85 -0
- package/src/middleware/validate.ts +130 -0
- package/src/policy/engine.ts +815 -0
- package/src/policy/index.ts +2 -0
- package/src/policy/opa-engine.ts +829 -0
- package/src/proxy/forward-proxy.ts +649 -0
- package/src/proxy/index.ts +1 -0
- package/src/ratelimit/limiter.ts +196 -0
- package/src/replay/engine.ts +142 -0
- package/src/replay/index.ts +1 -0
- package/src/saas/index.ts +1 -0
- package/src/saas/routes.ts +2178 -0
- package/src/server/app.ts +985 -0
- package/src/server/errors.ts +49 -0
- package/src/server/gateway.ts +1130 -0
- package/src/server/index.ts +307 -0
- package/src/server/logger.ts +255 -0
- package/src/server/stream-proxy.ts +202 -0
- package/src/storage/file-persistence.ts +315 -0
- package/src/storage/index.ts +4 -0
- package/src/storage/interfaces.ts +287 -0
- package/src/storage/memory.ts +686 -0
- package/src/storage/postgres.ts +1831 -0
- package/src/storage/redis.ts +835 -0
- package/src/tracing/index.ts +1 -0
- package/src/tracing/provider.ts +100 -0
- package/src/trust/calculator.ts +141 -0
- package/src/trust/index.ts +7 -0
- package/src/types/budget.ts +36 -0
- package/src/types/config.ts +278 -0
- package/src/types/events.ts +41 -0
- package/src/types/express.d.ts +14 -0
- package/src/types/index.ts +7 -0
- package/src/types/policy.ts +83 -0
- package/src/types/stripe-config.ts +11 -0
- package/src/types/subscription.ts +59 -0
- package/src/types/tool-call.ts +47 -0
- package/src/types/tool-result.ts +82 -0
- package/src/types/user.ts +125 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { WebClient } from '@slack/web-api';
|
|
2
|
+
import { ToolCall } from '../types/tool-call';
|
|
3
|
+
import { ToolOutput } from '../types/tool-result';
|
|
4
|
+
import { ToolExecutor } from './interfaces';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Slack executor using the @slack/web-api WebClient.
|
|
8
|
+
* Handles tool calls with tool name `slack.*` (e.g., slack.post_message).
|
|
9
|
+
*/
|
|
10
|
+
export class SlackExecutor implements ToolExecutor {
|
|
11
|
+
private client: WebClient;
|
|
12
|
+
|
|
13
|
+
constructor(token: string) {
|
|
14
|
+
this.client = new WebClient(token);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async execute(toolCall: ToolCall): Promise<ToolOutput> {
|
|
18
|
+
const action = this.resolveAction(toolCall);
|
|
19
|
+
|
|
20
|
+
switch (action) {
|
|
21
|
+
case 'post_message':
|
|
22
|
+
return this.postMessage(toolCall);
|
|
23
|
+
case 'update_message':
|
|
24
|
+
return this.updateMessage(toolCall);
|
|
25
|
+
case 'add_reaction':
|
|
26
|
+
return this.addReaction(toolCall);
|
|
27
|
+
case 'list_channels':
|
|
28
|
+
return this.listChannels(toolCall);
|
|
29
|
+
case 'channel_history':
|
|
30
|
+
return this.channelHistory(toolCall);
|
|
31
|
+
case 'upload_file':
|
|
32
|
+
return this.uploadFile(toolCall);
|
|
33
|
+
default:
|
|
34
|
+
throw new Error(`Unsupported Slack action: ${action}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Resolve the Slack action from either `args.action` or the tool name suffix.
|
|
40
|
+
* e.g., tool name "slack.post_message" yields action "post_message".
|
|
41
|
+
*/
|
|
42
|
+
private resolveAction(toolCall: ToolCall): string {
|
|
43
|
+
if (toolCall.args.action && typeof toolCall.args.action === 'string') {
|
|
44
|
+
return toolCall.args.action;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const toolName = toolCall.tool.name;
|
|
48
|
+
const dotIndex = toolName.indexOf('.');
|
|
49
|
+
if (dotIndex !== -1) {
|
|
50
|
+
return toolName.substring(dotIndex + 1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
throw new Error(`Unsupported Slack action: ${toolName}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Post a message to a channel
|
|
57
|
+
private async postMessage(toolCall: ToolCall): Promise<ToolOutput> {
|
|
58
|
+
const { channel, text, blocks } = toolCall.args;
|
|
59
|
+
|
|
60
|
+
if (!channel || typeof channel !== 'string') {
|
|
61
|
+
throw new Error('Missing or invalid "channel" argument for slack.post_message');
|
|
62
|
+
}
|
|
63
|
+
if (!text || typeof text !== 'string') {
|
|
64
|
+
throw new Error('Missing or invalid "text" argument for slack.post_message');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const result = await this.client.chat.postMessage({
|
|
68
|
+
channel,
|
|
69
|
+
text,
|
|
70
|
+
...(blocks ? { blocks: blocks as unknown[] } : {}),
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return { http_status: 200, body: result, headers: {} };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Update an existing message
|
|
77
|
+
private async updateMessage(toolCall: ToolCall): Promise<ToolOutput> {
|
|
78
|
+
const { channel, ts, text, blocks } = toolCall.args;
|
|
79
|
+
|
|
80
|
+
if (!channel || typeof channel !== 'string') {
|
|
81
|
+
throw new Error('Missing or invalid "channel" argument for slack.update_message');
|
|
82
|
+
}
|
|
83
|
+
if (!ts || typeof ts !== 'string') {
|
|
84
|
+
throw new Error('Missing or invalid "ts" argument for slack.update_message');
|
|
85
|
+
}
|
|
86
|
+
if (!text || typeof text !== 'string') {
|
|
87
|
+
throw new Error('Missing or invalid "text" argument for slack.update_message');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const result = await this.client.chat.update({
|
|
91
|
+
channel,
|
|
92
|
+
ts,
|
|
93
|
+
text,
|
|
94
|
+
...(blocks ? { blocks: blocks as unknown[] } : {}),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
return { http_status: 200, body: result, headers: {} };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Add a reaction to a message
|
|
101
|
+
private async addReaction(toolCall: ToolCall): Promise<ToolOutput> {
|
|
102
|
+
const { channel, timestamp, name } = toolCall.args;
|
|
103
|
+
|
|
104
|
+
if (!channel || typeof channel !== 'string') {
|
|
105
|
+
throw new Error('Missing or invalid "channel" argument for slack.add_reaction');
|
|
106
|
+
}
|
|
107
|
+
if (!timestamp || typeof timestamp !== 'string') {
|
|
108
|
+
throw new Error('Missing or invalid "timestamp" argument for slack.add_reaction');
|
|
109
|
+
}
|
|
110
|
+
if (!name || typeof name !== 'string') {
|
|
111
|
+
throw new Error('Missing or invalid "name" argument for slack.add_reaction');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const result = await this.client.reactions.add({
|
|
115
|
+
channel,
|
|
116
|
+
timestamp,
|
|
117
|
+
name,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
return { http_status: 200, body: result, headers: {} };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// List channels
|
|
124
|
+
private async listChannels(toolCall: ToolCall): Promise<ToolOutput> {
|
|
125
|
+
const { types, limit } = toolCall.args;
|
|
126
|
+
|
|
127
|
+
const result = await this.client.conversations.list({
|
|
128
|
+
types: (types as string) || 'public_channel',
|
|
129
|
+
...(limit ? { limit: limit as number } : {}),
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
return { http_status: 200, body: result, headers: {} };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Get channel history
|
|
136
|
+
private async channelHistory(toolCall: ToolCall): Promise<ToolOutput> {
|
|
137
|
+
const { channel, limit, oldest, latest } = toolCall.args;
|
|
138
|
+
|
|
139
|
+
if (!channel || typeof channel !== 'string') {
|
|
140
|
+
throw new Error('Missing or invalid "channel" argument for slack.channel_history');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const result = await this.client.conversations.history({
|
|
144
|
+
channel,
|
|
145
|
+
...(limit ? { limit: limit as number } : {}),
|
|
146
|
+
...(oldest ? { oldest: oldest as string } : {}),
|
|
147
|
+
...(latest ? { latest: latest as string } : {}),
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
return { http_status: 200, body: result, headers: {} };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Upload a file
|
|
154
|
+
private async uploadFile(toolCall: ToolCall): Promise<ToolOutput> {
|
|
155
|
+
const { channels, content, filename, title } = toolCall.args;
|
|
156
|
+
|
|
157
|
+
if (!channels || typeof channels !== 'string') {
|
|
158
|
+
throw new Error('Missing or invalid "channels" argument for slack.upload_file');
|
|
159
|
+
}
|
|
160
|
+
if (!content || typeof content !== 'string') {
|
|
161
|
+
throw new Error('Missing or invalid "content" argument for slack.upload_file');
|
|
162
|
+
}
|
|
163
|
+
if (!filename || typeof filename !== 'string') {
|
|
164
|
+
throw new Error('Missing or invalid "filename" argument for slack.upload_file');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const result = await this.client.files.upload({
|
|
168
|
+
channels,
|
|
169
|
+
content,
|
|
170
|
+
filename,
|
|
171
|
+
...(title ? { title: title as string } : {}),
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
return { http_status: 200, body: result, headers: {} };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Pool } from 'pg';
|
|
2
|
+
import { ToolCall } from '../types/tool-call';
|
|
3
|
+
import { ToolOutput } from '../types/tool-result';
|
|
4
|
+
import { ToolExecutor } from './interfaces';
|
|
5
|
+
import { SQLExecutorConfig } from '../types/config';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* SQL executor for parameterized database queries.
|
|
9
|
+
* Handles tool calls with tool name `sql.*` (e.g., sql.query, sql.execute).
|
|
10
|
+
* Enforces read_only mode, table blocklists, and query timeouts.
|
|
11
|
+
*/
|
|
12
|
+
export class SQLExecutor implements ToolExecutor {
|
|
13
|
+
private pool: Pool;
|
|
14
|
+
private config: SQLExecutorConfig;
|
|
15
|
+
|
|
16
|
+
constructor(config: SQLExecutorConfig) {
|
|
17
|
+
this.config = config;
|
|
18
|
+
this.pool = new Pool({
|
|
19
|
+
connectionString: config.connection_string,
|
|
20
|
+
statement_timeout: config.timeout_ms,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async execute(toolCall: ToolCall): Promise<ToolOutput> {
|
|
25
|
+
const action = this.resolveAction(toolCall);
|
|
26
|
+
|
|
27
|
+
switch (action) {
|
|
28
|
+
case 'query':
|
|
29
|
+
return this.query(toolCall);
|
|
30
|
+
case 'execute':
|
|
31
|
+
return this.sqlExecute(toolCall);
|
|
32
|
+
default:
|
|
33
|
+
throw new Error(`Unsupported SQL action: ${action}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private resolveAction(toolCall: ToolCall): string {
|
|
38
|
+
if (toolCall.args.action && typeof toolCall.args.action === 'string') {
|
|
39
|
+
return toolCall.args.action;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const toolName = toolCall.tool.name;
|
|
43
|
+
const dotIndex = toolName.indexOf('.');
|
|
44
|
+
if (dotIndex !== -1) {
|
|
45
|
+
return toolName.substring(dotIndex + 1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
throw new Error(`Unsupported SQL action: ${toolName}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Check if the query references any blocked tables.
|
|
53
|
+
*/
|
|
54
|
+
private checkBlockedTables(query: string): void {
|
|
55
|
+
const blocked = this.config.blocked_tables;
|
|
56
|
+
if (!blocked || blocked.length === 0) return;
|
|
57
|
+
|
|
58
|
+
// Extract table names from common SQL patterns
|
|
59
|
+
const tablePatterns = [
|
|
60
|
+
/\bFROM\s+([a-zA-Z_][\w.]*)/gi,
|
|
61
|
+
/\bJOIN\s+([a-zA-Z_][\w.]*)/gi,
|
|
62
|
+
/\bINTO\s+([a-zA-Z_][\w.]*)/gi,
|
|
63
|
+
/\bUPDATE\s+([a-zA-Z_][\w.]*)/gi,
|
|
64
|
+
/\bTABLE\s+([a-zA-Z_][\w.]*)/gi,
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
const referencedTables = new Set<string>();
|
|
68
|
+
for (const pattern of tablePatterns) {
|
|
69
|
+
let match;
|
|
70
|
+
while ((match = pattern.exec(query)) !== null) {
|
|
71
|
+
referencedTables.add(match[1].toLowerCase());
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
for (const table of referencedTables) {
|
|
76
|
+
if (blocked.some(b => table === b.toLowerCase())) {
|
|
77
|
+
throw new Error(`Access to table "${table}" is blocked`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Check if a query is a read-only SELECT statement.
|
|
84
|
+
*/
|
|
85
|
+
private isReadOnly(query: string): boolean {
|
|
86
|
+
const trimmed = query.trim().toUpperCase();
|
|
87
|
+
// Allow SELECT, WITH ... SELECT, EXPLAIN
|
|
88
|
+
return /^(SELECT|WITH\s|EXPLAIN\s)/i.test(trimmed) &&
|
|
89
|
+
!/\b(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE|GRANT|REVOKE)\b/i.test(trimmed);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private async query(toolCall: ToolCall): Promise<ToolOutput> {
|
|
93
|
+
const { query, params } = toolCall.args;
|
|
94
|
+
|
|
95
|
+
if (!query || typeof query !== 'string') {
|
|
96
|
+
throw new Error('Missing or invalid "query" argument for sql.query');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!this.isReadOnly(query)) {
|
|
100
|
+
throw new Error('sql.query only allows read-only (SELECT) statements');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
this.checkBlockedTables(query);
|
|
104
|
+
|
|
105
|
+
const result = await this.pool.query(
|
|
106
|
+
query,
|
|
107
|
+
Array.isArray(params) ? params : undefined,
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const rows = result.rows.slice(0, this.config.max_rows);
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
body: rows,
|
|
114
|
+
rows_affected: result.rowCount ?? 0,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private async sqlExecute(toolCall: ToolCall): Promise<ToolOutput> {
|
|
119
|
+
const { query, params } = toolCall.args;
|
|
120
|
+
|
|
121
|
+
if (!query || typeof query !== 'string') {
|
|
122
|
+
throw new Error('Missing or invalid "query" argument for sql.execute');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (this.config.read_only) {
|
|
126
|
+
throw new Error('sql.execute is disabled: executor is in read_only mode');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
this.checkBlockedTables(query);
|
|
130
|
+
|
|
131
|
+
const result = await this.pool.query(
|
|
132
|
+
query,
|
|
133
|
+
Array.isArray(params) ? params : undefined,
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
body: result.rows?.slice(0, this.config.max_rows) ?? [],
|
|
138
|
+
rows_affected: result.rowCount ?? 0,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Close the connection pool. */
|
|
143
|
+
async close(): Promise<void> {
|
|
144
|
+
await this.pool.end();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import WebSocket from 'ws';
|
|
2
|
+
import * as crypto from 'crypto';
|
|
3
|
+
import { ToolCall } from '../types/tool-call';
|
|
4
|
+
import { ToolOutput } from '../types/tool-result';
|
|
5
|
+
import { ToolExecutor } from './interfaces';
|
|
6
|
+
import { WebSocketExecutorConfig } from '../types/config';
|
|
7
|
+
|
|
8
|
+
interface ManagedConnection {
|
|
9
|
+
ws: WebSocket;
|
|
10
|
+
url: string;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WebSocket executor for managed WebSocket connections.
|
|
16
|
+
* Handles tool calls with tool name `ws.*` (e.g., ws.connect, ws.send, ws.close).
|
|
17
|
+
* Manages a connection pool by connection_id with URL allowlisting.
|
|
18
|
+
*/
|
|
19
|
+
export class WebSocketExecutor implements ToolExecutor {
|
|
20
|
+
private config: WebSocketExecutorConfig;
|
|
21
|
+
private connections: Map<string, ManagedConnection> = new Map();
|
|
22
|
+
|
|
23
|
+
constructor(config: WebSocketExecutorConfig) {
|
|
24
|
+
this.config = config;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async execute(toolCall: ToolCall): Promise<ToolOutput> {
|
|
28
|
+
const action = this.resolveAction(toolCall);
|
|
29
|
+
|
|
30
|
+
switch (action) {
|
|
31
|
+
case 'connect':
|
|
32
|
+
return this.connect(toolCall);
|
|
33
|
+
case 'send':
|
|
34
|
+
return this.send(toolCall);
|
|
35
|
+
case 'close':
|
|
36
|
+
return this.wsClose(toolCall);
|
|
37
|
+
default:
|
|
38
|
+
throw new Error(`Unsupported WebSocket action: ${action}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private resolveAction(toolCall: ToolCall): string {
|
|
43
|
+
if (toolCall.args.action && typeof toolCall.args.action === 'string') {
|
|
44
|
+
return toolCall.args.action;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const toolName = toolCall.tool.name;
|
|
48
|
+
const dotIndex = toolName.indexOf('.');
|
|
49
|
+
if (dotIndex !== -1) {
|
|
50
|
+
return toolName.substring(dotIndex + 1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
throw new Error(`Unsupported WebSocket action: ${toolName}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Check if a URL matches any of the allowed URL patterns.
|
|
58
|
+
*/
|
|
59
|
+
private isUrlAllowed(url: string): boolean {
|
|
60
|
+
if (!this.config.allowed_urls || this.config.allowed_urls.length === 0) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
for (const pattern of this.config.allowed_urls) {
|
|
65
|
+
// Convert glob-like pattern to regex
|
|
66
|
+
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
|
67
|
+
const regex = new RegExp(`^${escaped}$`);
|
|
68
|
+
if (regex.test(url)) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private async connect(toolCall: ToolCall): Promise<ToolOutput> {
|
|
77
|
+
const { url, connection_id: providedId } = toolCall.args;
|
|
78
|
+
|
|
79
|
+
if (!url || typeof url !== 'string') {
|
|
80
|
+
throw new Error('Missing or invalid "url" argument for ws.connect');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (!this.isUrlAllowed(url)) {
|
|
84
|
+
throw new Error(`URL "${url}" is not in the allowed URLs list`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const connectionId = (typeof providedId === 'string' ? providedId : null)
|
|
88
|
+
|| crypto.randomUUID();
|
|
89
|
+
|
|
90
|
+
return new Promise<ToolOutput>((resolve, reject) => {
|
|
91
|
+
const timeout = setTimeout(() => {
|
|
92
|
+
ws.close();
|
|
93
|
+
reject(new Error(`WebSocket connection timeout after ${this.config.connect_timeout_ms}ms`));
|
|
94
|
+
}, this.config.connect_timeout_ms);
|
|
95
|
+
|
|
96
|
+
const ws = new WebSocket(url, {
|
|
97
|
+
maxPayload: this.config.max_message_size_bytes,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
ws.on('open', () => {
|
|
101
|
+
clearTimeout(timeout);
|
|
102
|
+
this.connections.set(connectionId, {
|
|
103
|
+
ws,
|
|
104
|
+
url,
|
|
105
|
+
createdAt: Date.now(),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
resolve({
|
|
109
|
+
body: { connected: true, connection_id: connectionId },
|
|
110
|
+
metadata: { url },
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
ws.on('error', (err: Error) => {
|
|
115
|
+
clearTimeout(timeout);
|
|
116
|
+
reject(new Error(`WebSocket connection failed: ${err.message}`));
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private async send(toolCall: ToolCall): Promise<ToolOutput> {
|
|
122
|
+
const { connection_id, message, wait_for_response } = toolCall.args;
|
|
123
|
+
|
|
124
|
+
if (!connection_id || typeof connection_id !== 'string') {
|
|
125
|
+
throw new Error('Missing or invalid "connection_id" argument for ws.send');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (message === undefined || message === null) {
|
|
129
|
+
throw new Error('Missing "message" argument for ws.send');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const conn = this.connections.get(connection_id);
|
|
133
|
+
if (!conn) {
|
|
134
|
+
throw new Error(`No connection found with id "${connection_id}"`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (conn.ws.readyState !== WebSocket.OPEN) {
|
|
138
|
+
this.connections.delete(connection_id);
|
|
139
|
+
throw new Error(`Connection "${connection_id}" is no longer open`);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const data = typeof message === 'string' ? message : JSON.stringify(message);
|
|
143
|
+
|
|
144
|
+
if (Buffer.byteLength(data) > this.config.max_message_size_bytes) {
|
|
145
|
+
throw new Error(`Message size exceeds max allowed ${this.config.max_message_size_bytes} bytes`);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return new Promise<ToolOutput>((resolve, reject) => {
|
|
149
|
+
if (wait_for_response) {
|
|
150
|
+
const responseTimeout = setTimeout(() => {
|
|
151
|
+
conn.ws.removeAllListeners('message');
|
|
152
|
+
resolve({
|
|
153
|
+
body: null,
|
|
154
|
+
metadata: { connection_id, timeout: true },
|
|
155
|
+
});
|
|
156
|
+
}, this.config.connect_timeout_ms);
|
|
157
|
+
|
|
158
|
+
conn.ws.once('message', (responseData: WebSocket.Data) => {
|
|
159
|
+
clearTimeout(responseTimeout);
|
|
160
|
+
resolve({
|
|
161
|
+
body: responseData.toString(),
|
|
162
|
+
metadata: { connection_id },
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
conn.ws.send(data, (err?: Error) => {
|
|
168
|
+
if (err) {
|
|
169
|
+
reject(new Error(`Failed to send message: ${err.message}`));
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (!wait_for_response) {
|
|
174
|
+
resolve({
|
|
175
|
+
body: { sent: true },
|
|
176
|
+
metadata: { connection_id },
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
private async wsClose(toolCall: ToolCall): Promise<ToolOutput> {
|
|
184
|
+
const { connection_id } = toolCall.args;
|
|
185
|
+
|
|
186
|
+
if (!connection_id || typeof connection_id !== 'string') {
|
|
187
|
+
throw new Error('Missing or invalid "connection_id" argument for ws.close');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const conn = this.connections.get(connection_id);
|
|
191
|
+
if (!conn) {
|
|
192
|
+
throw new Error(`No connection found with id "${connection_id}"`);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
conn.ws.close();
|
|
196
|
+
this.connections.delete(connection_id);
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
body: { closed: true },
|
|
200
|
+
metadata: { connection_id },
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Close all managed connections. */
|
|
205
|
+
async closeAll(): Promise<void> {
|
|
206
|
+
for (const [id, conn] of this.connections) {
|
|
207
|
+
conn.ws.close();
|
|
208
|
+
this.connections.delete(id);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { Gateway, PreExecuteResult } from './server/gateway';
|
|
2
|
+
export { createApp, HealthCheck, HealthCheckResult, CreateAppResult } from './server/app';
|
|
3
|
+
export { sendError, ErrorCode, ErrorResponse } from './server/errors';
|
|
4
|
+
export { PolicyEngine, OPAEngine } from './policy';
|
|
5
|
+
export { DLPScanner, DLPBackend, DLPDetection, RegexDLPBackend, TruffleHogBackend, CompositeDLPScanner } from './dlp';
|
|
6
|
+
export { BudgetManager, CostRecord } from './budget/manager';
|
|
7
|
+
export { UsageExtractor } from './budget/usage-extractor';
|
|
8
|
+
export { AuditLogger } from './audit/logger';
|
|
9
|
+
export { ToolExecutor, ExecutorRegistry, HttpExecutor, NoopExecutor, SlackExecutor } from './executor';
|
|
10
|
+
export { ApprovalManager } from './approval/manager';
|
|
11
|
+
export { ApprovalWebhook } from './approval/webhook';
|
|
12
|
+
export { RateLimiter } from './ratelimit/limiter';
|
|
13
|
+
export { GatewayMetrics } from './metrics';
|
|
14
|
+
export { GatewayTracer, TracingConfig } from './tracing';
|
|
15
|
+
export { DEFAULT_CONFIG } from './config/defaults';
|
|
16
|
+
export { validateConfig, ConfigIssue, ConfigValidationResult } from './config/validate';
|
|
17
|
+
export * from './storage';
|
|
18
|
+
export { MCPBridge, startMCPBridge } from './mcp';
|
|
19
|
+
export { createAdminRouter } from './admin';
|
|
20
|
+
export { parseProxyAuth, ProxyAuthResult } from './middleware/auth';
|
|
21
|
+
export { AnomalyDetector, AnomalyConfig, AnomalyAlert, AnomalyType } from './anomaly';
|
|
22
|
+
export { createForwardProxy, buildToolCallFromProxy, ForwardProxyServer } from './proxy';
|
|
23
|
+
export { SessionReplayEngine, ReplayComparison, ReplayResult } from './replay';
|
|
24
|
+
export * from './types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProviderInterceptor, ProviderToolBlock } from './provider-interceptor';
|