Files
Administrator 14893e62a5 feat: Geutebruck GeViScope/GeViSoft Action Mapping System - MVP
This MVP release provides a complete full-stack solution for managing action mappings
in Geutebruck's GeViScope and GeViSoft video surveillance systems.

## Features

### Flutter Web Application (Port 8081)
- Modern, responsive UI for managing action mappings
- Action picker dialog with full parameter configuration
- Support for both GSC (GeViScope) and G-Core server actions
- Consistent UI for input and output actions with edit/delete capabilities
- Real-time action mapping creation, editing, and deletion
- Server categorization (GSC: prefix for GeViScope, G-Core: prefix for G-Core servers)

### FastAPI REST Backend (Port 8000)
- RESTful API for action mapping CRUD operations
- Action template service with comprehensive action catalog (247 actions)
- Server management (G-Core and GeViScope servers)
- Configuration tree reading and writing
- JWT authentication with role-based access control
- PostgreSQL database integration

### C# SDK Bridge (gRPC, Port 50051)
- Native integration with GeViSoft SDK (GeViProcAPINET_4_0.dll)
- Action mapping creation with correct binary format
- Support for GSC and G-Core action types
- Proper Camera parameter inclusion in action strings (fixes CrossSwitch bug)
- Action ID lookup table with server-specific action IDs
- Configuration reading/writing via SetupClient

## Bug Fixes
- **CrossSwitch Bug**: GSC and G-Core actions now correctly display camera/PTZ head parameters in GeViSet
- Action strings now include Camera parameter: `@ PanLeft (Comment: "", Camera: 101028)`
- Proper filter flags and VideoInput=0 for action mappings
- Correct action ID assignment (4198 for GSC, 9294 for G-Core PanLeft)

## Technical Stack
- **Frontend**: Flutter Web, Dart, Dio HTTP client
- **Backend**: Python FastAPI, PostgreSQL, Redis
- **SDK Bridge**: C# .NET 8.0, gRPC, GeViSoft SDK
- **Authentication**: JWT tokens
- **Configuration**: GeViSoft .set files (binary format)

## Credentials
- GeViSoft/GeViScope: username=sysadmin, password=masterkey
- Default admin: username=admin, password=admin123

## Deployment
All services run on localhost:
- Flutter Web: http://localhost:8081
- FastAPI: http://localhost:8000
- SDK Bridge gRPC: localhost:50051
- GeViServer: localhost (default port)

Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 18:10:54 +01:00

199 lines
6.7 KiB
JavaScript

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var server_exports = {};
__export(server_exports, {
connect: () => connect,
createServer: () => createServer,
firstRootPath: () => firstRootPath,
start: () => start,
wrapInProcess: () => wrapInProcess
});
module.exports = __toCommonJS(server_exports);
var import_url = require("url");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var mcpBundle = __toESM(require("./bundle"));
var import_http = require("./http");
var import_inProcessTransport = require("./inProcessTransport");
const serverDebug = (0, import_utilsBundle.debug)("pw:mcp:server");
const serverDebugResponse = (0, import_utilsBundle.debug)("pw:mcp:server:response");
async function connect(factory, transport, runHeartbeat) {
const server = createServer(factory.name, factory.version, factory.create(), runHeartbeat);
await server.connect(transport);
}
async function wrapInProcess(backend) {
const server = createServer("Internal", "0.0.0", backend, false);
return new import_inProcessTransport.InProcessTransport(server);
}
function createServer(name, version, backend, runHeartbeat) {
const server = new mcpBundle.Server({ name, version }, {
capabilities: {
tools: {}
}
});
server.setRequestHandler(mcpBundle.ListToolsRequestSchema, async () => {
serverDebug("listTools");
const tools = await backend.listTools();
return { tools };
});
let initializePromise;
server.setRequestHandler(mcpBundle.CallToolRequestSchema, async (request, extra) => {
serverDebug("callTool", request);
const progressToken = request.params._meta?.progressToken;
let progressCounter = 0;
const progress = progressToken ? (params) => {
extra.sendNotification({
method: "notifications/progress",
params: {
progressToken,
progress: params.progress ?? ++progressCounter,
total: params.total,
message: params.message
}
}).catch(serverDebug);
} : () => {
};
try {
if (!initializePromise)
initializePromise = initializeServer(server, backend, runHeartbeat);
await initializePromise;
const toolResult = await backend.callTool(request.params.name, request.params.arguments || {}, progress);
const mergedResult = mergeTextParts(toolResult);
serverDebugResponse("callResult", mergedResult);
return mergedResult;
} catch (error) {
return {
content: [{ type: "text", text: "### Result\n" + String(error) }],
isError: true
};
}
});
addServerListener(server, "close", () => backend.serverClosed?.(server));
return server;
}
const initializeServer = async (server, backend, runHeartbeat) => {
const capabilities = server.getClientCapabilities();
let clientRoots = [];
if (capabilities?.roots) {
const { roots } = await server.listRoots().catch((e) => {
serverDebug(e);
return { roots: [] };
});
clientRoots = roots;
}
const clientInfo = {
name: server.getClientVersion()?.name ?? "unknown",
version: server.getClientVersion()?.version ?? "unknown",
roots: clientRoots,
timestamp: Date.now()
};
await backend.initialize?.(clientInfo);
if (runHeartbeat)
startHeartbeat(server);
};
const startHeartbeat = (server) => {
const beat = () => {
Promise.race([
server.ping(),
new Promise((_, reject) => setTimeout(() => reject(new Error("ping timeout")), 5e3))
]).then(() => {
setTimeout(beat, 3e3);
}).catch(() => {
void server.close();
});
};
beat();
};
function addServerListener(server, event, listener) {
const oldListener = server[`on${event}`];
server[`on${event}`] = () => {
oldListener?.();
listener();
};
}
async function start(serverBackendFactory, options) {
if (options.port === void 0) {
await connect(serverBackendFactory, new mcpBundle.StdioServerTransport(), false);
return;
}
const httpServer = await (0, import_http.startHttpServer)(options);
const url = await (0, import_http.installHttpTransport)(httpServer, serverBackendFactory, false, options.allowedHosts);
const mcpConfig = { mcpServers: {} };
mcpConfig.mcpServers[serverBackendFactory.nameInConfig] = {
url: `${url}/mcp`
};
const message = [
`Listening on ${url}`,
"Put this in your client config:",
JSON.stringify(mcpConfig, void 0, 2),
"For legacy SSE transport support, you can use the /sse endpoint instead."
].join("\n");
console.error(message);
}
function firstRootPath(clientInfo) {
if (clientInfo.roots.length === 0)
return void 0;
const firstRootUri = clientInfo.roots[0]?.uri;
const url = firstRootUri ? new URL(firstRootUri) : void 0;
try {
return url ? (0, import_url.fileURLToPath)(url) : void 0;
} catch (error) {
serverDebug(error);
return void 0;
}
}
function mergeTextParts(result) {
const content = [];
const testParts = [];
for (const part of result.content) {
if (part.type === "text") {
testParts.push(part.text);
continue;
}
if (testParts.length > 0) {
content.push({ type: "text", text: testParts.join("\n") });
testParts.length = 0;
}
content.push(part);
}
if (testParts.length > 0)
content.push({ type: "text", text: testParts.join("\n") });
return {
...result,
content
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
connect,
createServer,
firstRootPath,
start,
wrapInProcess
});