feat(api): expose REST-only agent routes
This commit is contained in:
+17
-15
@@ -18,6 +18,7 @@ import {
|
||||
ResultReferenceStore,
|
||||
} from "./results/store.js";
|
||||
import { buildChatRouter } from "./routes/chat.js";
|
||||
import { buildAgentPublicRouter } from "./routes/publicApi.js";
|
||||
import { opencodeRuntime } from "./runtime/opencode.js";
|
||||
import {
|
||||
getRuntimeSessionContext,
|
||||
@@ -113,7 +114,6 @@ app.post("/internal/tools/tjwater-cli-call", async (req, res) => {
|
||||
server: config.TJWATER_API_BASE_URL,
|
||||
access_token: context.accessToken,
|
||||
project_id: context.projectId,
|
||||
network: context.network,
|
||||
});
|
||||
|
||||
const cliArgs = ["--auth-stdin", ...command.split(/\s+/).filter(Boolean)];
|
||||
@@ -402,7 +402,7 @@ app.post("/internal/tools/web-search", async (req, res) => {
|
||||
|
||||
try {
|
||||
const response = await callBackendJson(
|
||||
"/api/v1/web-search",
|
||||
"/api/v1/web-searches",
|
||||
context,
|
||||
payload,
|
||||
);
|
||||
@@ -445,7 +445,7 @@ app.post("/internal/tools/geocode", async (req, res) => {
|
||||
|
||||
try {
|
||||
const response = await callBackendJson(
|
||||
"/api/v1/tianditu/geocode",
|
||||
"/api/v1/geocoding-requests",
|
||||
context,
|
||||
{ keyword },
|
||||
);
|
||||
@@ -462,19 +462,21 @@ app.post("/internal/tools/geocode", async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
const chatRouter = buildChatRouter(
|
||||
sessionBridge,
|
||||
opencodeRuntime,
|
||||
sessionMetadataStore,
|
||||
sessionUiStateStore,
|
||||
memoryStore,
|
||||
sessionTranscriptStore,
|
||||
learningOrchestrator,
|
||||
resultReferenceResolver,
|
||||
);
|
||||
const authenticatedChatRouter = express.Router();
|
||||
authenticatedChatRouter.use(requireAgentAuth, chatRouter);
|
||||
app.use(
|
||||
"/api/v1/agent/chat",
|
||||
requireAgentAuth,
|
||||
buildChatRouter(
|
||||
sessionBridge,
|
||||
opencodeRuntime,
|
||||
sessionMetadataStore,
|
||||
sessionUiStateStore,
|
||||
memoryStore,
|
||||
sessionTranscriptStore,
|
||||
learningOrchestrator,
|
||||
resultReferenceResolver,
|
||||
),
|
||||
"/api/v1/agent",
|
||||
buildAgentPublicRouter(authenticatedChatRouter),
|
||||
);
|
||||
|
||||
const bootstrap = async () => {
|
||||
|
||||
Reference in New Issue
Block a user