@lobu/gateway 3.0.9 → 3.0.13
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/api/platform.d.ts.map +1 -1
- package/dist/api/platform.js +7 -26
- package/dist/api/platform.js.map +1 -1
- package/dist/auth/mcp/proxy.d.ts +14 -0
- package/dist/auth/mcp/proxy.d.ts.map +1 -1
- package/dist/auth/mcp/proxy.js +149 -13
- package/dist/auth/mcp/proxy.js.map +1 -1
- package/dist/cli/gateway.d.ts.map +1 -1
- package/dist/cli/gateway.js +29 -0
- package/dist/cli/gateway.js.map +1 -1
- package/dist/connections/chat-instance-manager.d.ts.map +1 -1
- package/dist/connections/chat-instance-manager.js +2 -1
- package/dist/connections/chat-instance-manager.js.map +1 -1
- package/dist/connections/interaction-bridge.d.ts +9 -2
- package/dist/connections/interaction-bridge.d.ts.map +1 -1
- package/dist/connections/interaction-bridge.js +121 -261
- package/dist/connections/interaction-bridge.js.map +1 -1
- package/dist/gateway/index.js +1 -1
- package/dist/gateway/index.js.map +1 -1
- package/dist/interactions.d.ts +9 -43
- package/dist/interactions.d.ts.map +1 -1
- package/dist/interactions.js +10 -52
- package/dist/interactions.js.map +1 -1
- package/dist/routes/public/agent.d.ts +4 -0
- package/dist/routes/public/agent.d.ts.map +1 -1
- package/dist/routes/public/agent.js +21 -0
- package/dist/routes/public/agent.js.map +1 -1
- package/dist/services/core-services.d.ts.map +1 -1
- package/dist/services/core-services.js +4 -0
- package/dist/services/core-services.js.map +1 -1
- package/package.json +9 -9
- package/src/__tests__/agent-config-routes.test.ts +0 -254
- package/src/__tests__/agent-history-routes.test.ts +0 -72
- package/src/__tests__/agent-routes.test.ts +0 -68
- package/src/__tests__/agent-schedules-routes.test.ts +0 -59
- package/src/__tests__/agent-settings-store.test.ts +0 -323
- package/src/__tests__/bedrock-model-catalog.test.ts +0 -40
- package/src/__tests__/bedrock-openai-service.test.ts +0 -157
- package/src/__tests__/bedrock-provider-module.test.ts +0 -56
- package/src/__tests__/chat-instance-manager-slack.test.ts +0 -204
- package/src/__tests__/chat-response-bridge.test.ts +0 -131
- package/src/__tests__/config-memory-plugins.test.ts +0 -92
- package/src/__tests__/config-request-store.test.ts +0 -127
- package/src/__tests__/connection-routes.test.ts +0 -144
- package/src/__tests__/core-services-store-selection.test.ts +0 -92
- package/src/__tests__/docker-deployment.test.ts +0 -1211
- package/src/__tests__/embedded-deployment.test.ts +0 -342
- package/src/__tests__/grant-store.test.ts +0 -148
- package/src/__tests__/http-proxy.test.ts +0 -281
- package/src/__tests__/instruction-service.test.ts +0 -37
- package/src/__tests__/link-buttons.test.ts +0 -112
- package/src/__tests__/lobu.test.ts +0 -32
- package/src/__tests__/mcp-config-service.test.ts +0 -347
- package/src/__tests__/mcp-proxy.test.ts +0 -694
- package/src/__tests__/message-handler-bridge.test.ts +0 -17
- package/src/__tests__/model-selection.test.ts +0 -172
- package/src/__tests__/oauth-templates.test.ts +0 -39
- package/src/__tests__/platform-adapter-slack-send.test.ts +0 -114
- package/src/__tests__/platform-helpers-model-resolution.test.ts +0 -253
- package/src/__tests__/provider-inheritance.test.ts +0 -212
- package/src/__tests__/routes/cli-auth.test.ts +0 -337
- package/src/__tests__/routes/interactions.test.ts +0 -121
- package/src/__tests__/secret-proxy.test.ts +0 -85
- package/src/__tests__/session-manager.test.ts +0 -572
- package/src/__tests__/setup.ts +0 -133
- package/src/__tests__/skill-and-mcp-registry.test.ts +0 -203
- package/src/__tests__/slack-routes.test.ts +0 -161
- package/src/__tests__/system-config-resolver.test.ts +0 -75
- package/src/__tests__/system-message-limiter.test.ts +0 -89
- package/src/__tests__/system-skills-service.test.ts +0 -362
- package/src/__tests__/transcription-service.test.ts +0 -222
- package/src/__tests__/utils/rate-limiter.test.ts +0 -102
- package/src/__tests__/worker-connection-manager.test.ts +0 -497
- package/src/__tests__/worker-job-router.test.ts +0 -722
- package/src/api/index.ts +0 -1
- package/src/api/platform.ts +0 -292
- package/src/api/response-renderer.ts +0 -157
- package/src/auth/agent-metadata-store.ts +0 -168
- package/src/auth/api-auth-middleware.ts +0 -69
- package/src/auth/api-key-provider-module.ts +0 -213
- package/src/auth/base-provider-module.ts +0 -201
- package/src/auth/bedrock/provider-module.ts +0 -110
- package/src/auth/chatgpt/chatgpt-oauth-module.ts +0 -185
- package/src/auth/chatgpt/device-code-client.ts +0 -218
- package/src/auth/chatgpt/index.ts +0 -1
- package/src/auth/claude/oauth-module.ts +0 -280
- package/src/auth/cli/token-service.ts +0 -249
- package/src/auth/external/client.ts +0 -560
- package/src/auth/external/device-code-client.ts +0 -235
- package/src/auth/mcp/config-service.ts +0 -420
- package/src/auth/mcp/proxy.ts +0 -1086
- package/src/auth/mcp/string-substitution.ts +0 -17
- package/src/auth/mcp/tool-cache.ts +0 -90
- package/src/auth/oauth/base-client.ts +0 -267
- package/src/auth/oauth/client.ts +0 -153
- package/src/auth/oauth/credentials.ts +0 -7
- package/src/auth/oauth/providers.ts +0 -69
- package/src/auth/oauth/state-store.ts +0 -150
- package/src/auth/oauth-templates.ts +0 -179
- package/src/auth/provider-catalog.ts +0 -220
- package/src/auth/provider-model-options.ts +0 -41
- package/src/auth/settings/agent-settings-store.ts +0 -565
- package/src/auth/settings/auth-profiles-manager.ts +0 -216
- package/src/auth/settings/index.ts +0 -12
- package/src/auth/settings/model-preference-store.ts +0 -52
- package/src/auth/settings/model-selection.ts +0 -135
- package/src/auth/settings/resolved-settings-view.ts +0 -298
- package/src/auth/settings/template-utils.ts +0 -44
- package/src/auth/settings/token-service.ts +0 -88
- package/src/auth/system-env-store.ts +0 -98
- package/src/auth/user-agents-store.ts +0 -68
- package/src/channels/binding-service.ts +0 -214
- package/src/channels/index.ts +0 -4
- package/src/cli/gateway.ts +0 -1312
- package/src/cli/index.ts +0 -74
- package/src/commands/built-in-commands.ts +0 -80
- package/src/commands/command-dispatcher.ts +0 -94
- package/src/commands/command-reply-adapters.ts +0 -27
- package/src/config/file-loader.ts +0 -618
- package/src/config/index.ts +0 -588
- package/src/config/network-allowlist.ts +0 -71
- package/src/connections/chat-instance-manager.ts +0 -1284
- package/src/connections/chat-response-bridge.ts +0 -618
- package/src/connections/index.ts +0 -7
- package/src/connections/interaction-bridge.ts +0 -831
- package/src/connections/message-handler-bridge.ts +0 -440
- package/src/connections/platform-auth-methods.ts +0 -15
- package/src/connections/types.ts +0 -84
- package/src/gateway/connection-manager.ts +0 -291
- package/src/gateway/index.ts +0 -698
- package/src/gateway/job-router.ts +0 -201
- package/src/gateway-main.ts +0 -200
- package/src/index.ts +0 -41
- package/src/infrastructure/queue/index.ts +0 -12
- package/src/infrastructure/queue/queue-producer.ts +0 -148
- package/src/infrastructure/queue/redis-queue.ts +0 -361
- package/src/infrastructure/queue/types.ts +0 -133
- package/src/infrastructure/redis/system-message-limiter.ts +0 -94
- package/src/interactions/config-request-store.ts +0 -198
- package/src/interactions.ts +0 -363
- package/src/lobu.ts +0 -311
- package/src/metrics/prometheus.ts +0 -159
- package/src/modules/module-system.ts +0 -179
- package/src/orchestration/base-deployment-manager.ts +0 -900
- package/src/orchestration/deployment-utils.ts +0 -98
- package/src/orchestration/impl/docker-deployment.ts +0 -620
- package/src/orchestration/impl/embedded-deployment.ts +0 -268
- package/src/orchestration/impl/index.ts +0 -8
- package/src/orchestration/impl/k8s/deployment.ts +0 -1061
- package/src/orchestration/impl/k8s/helpers.ts +0 -610
- package/src/orchestration/impl/k8s/index.ts +0 -1
- package/src/orchestration/index.ts +0 -333
- package/src/orchestration/message-consumer.ts +0 -584
- package/src/orchestration/scheduled-wakeup.ts +0 -704
- package/src/permissions/approval-policy.ts +0 -36
- package/src/permissions/grant-store.ts +0 -219
- package/src/platform/file-handler.ts +0 -66
- package/src/platform/link-buttons.ts +0 -57
- package/src/platform/renderer-utils.ts +0 -44
- package/src/platform/response-renderer.ts +0 -84
- package/src/platform/unified-thread-consumer.ts +0 -194
- package/src/platform.ts +0 -318
- package/src/proxy/http-proxy.ts +0 -752
- package/src/proxy/proxy-manager.ts +0 -81
- package/src/proxy/secret-proxy.ts +0 -402
- package/src/proxy/token-refresh-job.ts +0 -143
- package/src/routes/internal/audio.ts +0 -141
- package/src/routes/internal/device-auth.ts +0 -652
- package/src/routes/internal/files.ts +0 -226
- package/src/routes/internal/history.ts +0 -69
- package/src/routes/internal/images.ts +0 -127
- package/src/routes/internal/interactions.ts +0 -84
- package/src/routes/internal/middleware.ts +0 -23
- package/src/routes/internal/schedule.ts +0 -226
- package/src/routes/internal/types.ts +0 -22
- package/src/routes/openapi-auto.ts +0 -239
- package/src/routes/public/agent-access.ts +0 -23
- package/src/routes/public/agent-config.ts +0 -675
- package/src/routes/public/agent-history.ts +0 -422
- package/src/routes/public/agent-schedules.ts +0 -296
- package/src/routes/public/agent.ts +0 -1086
- package/src/routes/public/agents.ts +0 -373
- package/src/routes/public/channels.ts +0 -191
- package/src/routes/public/cli-auth.ts +0 -896
- package/src/routes/public/connections.ts +0 -574
- package/src/routes/public/landing.ts +0 -16
- package/src/routes/public/oauth.ts +0 -147
- package/src/routes/public/settings-auth.ts +0 -104
- package/src/routes/public/slack.ts +0 -173
- package/src/routes/shared/agent-ownership.ts +0 -101
- package/src/routes/shared/token-verifier.ts +0 -34
- package/src/services/bedrock-model-catalog.ts +0 -217
- package/src/services/bedrock-openai-service.ts +0 -658
- package/src/services/core-services.ts +0 -1072
- package/src/services/image-generation-service.ts +0 -257
- package/src/services/instruction-service.ts +0 -318
- package/src/services/mcp-registry.ts +0 -94
- package/src/services/platform-helpers.ts +0 -287
- package/src/services/session-manager.ts +0 -262
- package/src/services/settings-resolver.ts +0 -74
- package/src/services/system-config-resolver.ts +0 -89
- package/src/services/system-skills-service.ts +0 -229
- package/src/services/transcription-service.ts +0 -684
- package/src/session.ts +0 -110
- package/src/spaces/index.ts +0 -1
- package/src/spaces/space-resolver.ts +0 -17
- package/src/stores/in-memory-agent-store.ts +0 -403
- package/src/stores/redis-agent-store.ts +0 -279
- package/src/utils/public-url.ts +0 -44
- package/src/utils/rate-limiter.ts +0 -94
- package/tsconfig.json +0 -33
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal Audio Routes
|
|
3
|
-
*
|
|
4
|
-
* Worker-facing endpoints for audio generation (TTS).
|
|
5
|
-
* Used by the GenerateAudio custom MCP tool.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { createLogger } from "@lobu/core";
|
|
9
|
-
import { Hono } from "hono";
|
|
10
|
-
import type { TranscriptionService } from "../../services/transcription-service";
|
|
11
|
-
import { authenticateWorker } from "./middleware";
|
|
12
|
-
import type { WorkerContext } from "./types";
|
|
13
|
-
|
|
14
|
-
const logger = createLogger("internal-audio-routes");
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Create internal audio routes (Hono)
|
|
18
|
-
*/
|
|
19
|
-
export function createAudioRoutes(
|
|
20
|
-
transcriptionService: TranscriptionService
|
|
21
|
-
): Hono<WorkerContext> {
|
|
22
|
-
const router = new Hono<WorkerContext>();
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Generate audio from text (TTS)
|
|
26
|
-
* POST /internal/audio/synthesize
|
|
27
|
-
*
|
|
28
|
-
* Body: {
|
|
29
|
-
* text: string (required) - Text to convert to speech
|
|
30
|
-
* voice?: string - Provider-specific voice ID
|
|
31
|
-
* speed?: number - Speech speed (0.5-2.0)
|
|
32
|
-
* }
|
|
33
|
-
*
|
|
34
|
-
* Response: Audio file (binary) with Content-Type header
|
|
35
|
-
*/
|
|
36
|
-
router.post("/internal/audio/synthesize", authenticateWorker, async (c) => {
|
|
37
|
-
try {
|
|
38
|
-
const worker = c.get("worker");
|
|
39
|
-
const { text, voice, speed } = await c.req.json();
|
|
40
|
-
|
|
41
|
-
if (!text || typeof text !== "string") {
|
|
42
|
-
return c.json({ error: "text is required and must be a string" }, 400);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (text.length > 4096) {
|
|
46
|
-
return c.json({ error: "text must be 4096 characters or less" }, 400);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const agentId = worker.agentId;
|
|
50
|
-
if (!agentId) {
|
|
51
|
-
return c.json({ error: "Missing agentId in worker context" }, 400);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
logger.info("Synthesizing audio", {
|
|
55
|
-
agentId,
|
|
56
|
-
textLength: text.length,
|
|
57
|
-
voice,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const result = await transcriptionService.synthesize(text, agentId, {
|
|
61
|
-
voice,
|
|
62
|
-
speed,
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
if ("error" in result) {
|
|
66
|
-
logger.warn("Audio synthesis failed", { error: result.error });
|
|
67
|
-
return c.json(
|
|
68
|
-
{
|
|
69
|
-
error: result.error,
|
|
70
|
-
availableProviders: result.availableProviders,
|
|
71
|
-
},
|
|
72
|
-
400
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Return audio as binary response
|
|
77
|
-
return new Response(result.audioBuffer, {
|
|
78
|
-
headers: {
|
|
79
|
-
"Content-Type": result.mimeType,
|
|
80
|
-
"Content-Length": result.audioBuffer.length.toString(),
|
|
81
|
-
"X-Audio-Provider": result.provider,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
} catch (error) {
|
|
85
|
-
logger.error("Audio synthesis error", { error });
|
|
86
|
-
return c.json(
|
|
87
|
-
{
|
|
88
|
-
error:
|
|
89
|
-
error instanceof Error
|
|
90
|
-
? error.message
|
|
91
|
-
: "Failed to synthesize audio",
|
|
92
|
-
},
|
|
93
|
-
500
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Check audio capabilities for current agent
|
|
100
|
-
* GET /internal/audio/capabilities
|
|
101
|
-
*
|
|
102
|
-
* Response: {
|
|
103
|
-
* available: boolean,
|
|
104
|
-
* provider?: string,
|
|
105
|
-
* features: { transcription: boolean, synthesis: boolean }
|
|
106
|
-
* }
|
|
107
|
-
*/
|
|
108
|
-
router.get("/internal/audio/capabilities", authenticateWorker, async (c) => {
|
|
109
|
-
try {
|
|
110
|
-
const worker = c.get("worker");
|
|
111
|
-
const agentId = worker.agentId;
|
|
112
|
-
|
|
113
|
-
if (!agentId) {
|
|
114
|
-
return c.json({ error: "Missing agentId in worker context" }, 400);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const config = await transcriptionService.getConfig(agentId);
|
|
118
|
-
|
|
119
|
-
if (!config) {
|
|
120
|
-
return c.json({
|
|
121
|
-
available: false,
|
|
122
|
-
features: { transcription: false, synthesis: false },
|
|
123
|
-
providers: transcriptionService.getProviderInfo(),
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return c.json({
|
|
128
|
-
available: true,
|
|
129
|
-
provider: config.provider,
|
|
130
|
-
features: { transcription: true, synthesis: true },
|
|
131
|
-
});
|
|
132
|
-
} catch (error) {
|
|
133
|
-
logger.error("Capabilities check error", { error });
|
|
134
|
-
return c.json({ error: "Failed to check capabilities" }, 500);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
logger.debug("Internal audio routes registered");
|
|
139
|
-
|
|
140
|
-
return router;
|
|
141
|
-
}
|