diff --git a/apps/vs-code/README.md b/apps/vs-code/README.md index 0509738b..f5d2739c 100644 --- a/apps/vs-code/README.md +++ b/apps/vs-code/README.md @@ -432,3 +432,49 @@ The API also supports feature collection management: See `workspace/tests/debrief_api.py` for complete API documentation and examples. +## MCP Server Debugging + +The extension includes an **MCP (Model Context Protocol) server** that provides programmatic access to Debrief functionality. This is useful for AI assistants and external tools that need to interact with the extension. + +### MCP Server Details + +- **URL**: `http://localhost:60123/mcp` +- **Transport**: HTTP Stream (stateless) +- **Port**: 60123 (same as WebSocket API) + +### Using the MCP Inspector + +The official MCP Inspector provides a web-based UI for testing and debugging the MCP server: + +```bash +# Connect to the running MCP server +npx @modelcontextprotocol/inspector http://localhost:60123/mcp +``` + +**Prerequisites:** +1. The VS Code extension must be running (F5 or Extension Development Host) +2. The MCP server starts automatically when the extension activates + +**What you can do with the Inspector:** +- Browse available MCP tools and resources +- Test tool invocations with custom parameters +- View real-time request/response messages +- Debug MCP protocol communication +- Inspect server capabilities and metadata + +**Note**: The MCP Inspector is a separate debugging tool, not part of the extension itself. It connects to the already-running MCP server exposed by the extension. + +### MCP vs WebSocket API + +The extension provides **two complementary APIs**: + +| Feature | MCP Server | WebSocket API | +|---------|-----------|---------------| +| **Purpose** | AI assistant integration | Python script integration | +| **Protocol** | Model Context Protocol | Custom JSON-RPC | +| **URL** | `http://localhost:60123/mcp` | `ws://localhost:60123` | +| **Use Cases** | Claude, GPT, other AI tools | Debrief Python scripts | +| **Debugging** | MCP Inspector | Direct WebSocket clients | + +Both APIs run on the same port (60123) but serve different use cases. + diff --git a/apps/vs-code/workspace/large-sample.plot copy.json b/apps/vs-code/workspace/large-sample.plot copy.json index abb8b623..6e790106 100644 --- a/apps/vs-code/workspace/large-sample.plot copy.json +++ b/apps/vs-code/workspace/large-sample.plot copy.json @@ -19968,7 +19968,7 @@ "type": "Feature", "properties": { "dataType": "buoyfield", - "marker-color": "#FF0", + "marker_color": "#FF0", "name": "Z12344", "shortName": "12344", "visible": true, @@ -21065,7 +21065,7 @@ "properties": { "name": "SONO 1-2", "dataType": "reference-point", - "marker-color": "#00FF00", + "marker_color": "#00FF00", "visible": true, "time": "2024-11-14T21:10:00.000Z" }, @@ -21083,7 +21083,7 @@ "properties": { "name": "NEW SONO", "dataType": "reference-point", - "marker-color": "#0000FF", + "marker_color": "#0000FF", "visible": true }, "geometry": { @@ -21100,7 +21100,7 @@ "properties": { "name": "POINT D-1", "dataType": "reference-point", - "marker-color": "#FFFF00", + "marker_color": "#FFFF00", "visible": true }, "geometry": { diff --git a/libs/shared-types/.gitignore b/libs/shared-types/.gitignore index 2236944a..75741276 100644 --- a/libs/shared-types/.gitignore +++ b/libs/shared-types/.gitignore @@ -5,6 +5,11 @@ dist/ # Generated TypeScript types (preserve validators and index.ts) src/types/ +# Generated Zod schemas (copied from derived/zod/) +# Keep index.ts files as they are manually curated +src/zod/**/*.ts +!src/zod/**/index.ts + # Note: python-src/debrief/types/ now contains source files and should be committed # Copied schema files (generated from source) diff --git a/libs/shared-types/src/zod/features/annotation.ts b/libs/shared-types/src/zod/features/annotation.ts deleted file mode 100644 index 660ec15f..00000000 --- a/libs/shared-types/src/zod/features/annotation.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "bbox": z.union([z.array(z.any()).min(4).max(4), z.array(z.any()).min(6).max(6), z.null()]).default(null), "type": z.literal("Feature"), "geometry": z.union([z.any(), z.any(), z.any(), z.any(), z.any(), z.any(), z.null()]), "properties": z.union([z.any(), z.null()]), "id": z.union([z.number().int(), z.string(), z.null()]).default(null) }).strict().describe("A GeoJSON Feature representing an annotation with any geometry type.") diff --git a/libs/shared-types/src/zod/features/backdrop.ts b/libs/shared-types/src/zod/features/backdrop.ts deleted file mode 100644 index d231afd5..00000000 --- a/libs/shared-types/src/zod/features/backdrop.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "bbox": z.union([z.array(z.any()).min(4).max(4), z.array(z.any()).min(6).max(6), z.null()]).default(null), "type": z.literal("Feature"), "geometry": z.union([z.any(), z.null()]), "properties": z.union([z.any(), z.null()]), "id": z.union([z.number().int(), z.string(), z.null()]).default(null) }).strict().describe("A GeoJSON Feature representing a backdrop tile layer configuration.\n\nNote: Uses MultiPoint with empty coordinates as it's not a geographic feature to render.") diff --git a/libs/shared-types/src/zod/features/buoyfield.ts b/libs/shared-types/src/zod/features/buoyfield.ts deleted file mode 100644 index 742b29f6..00000000 --- a/libs/shared-types/src/zod/features/buoyfield.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "bbox": z.union([z.array(z.any()).min(4).max(4), z.array(z.any()).min(6).max(6), z.null()]).default(null), "type": z.literal("Feature"), "geometry": z.union([z.any(), z.null()]), "properties": z.union([z.any(), z.null()]), "id": z.union([z.number().int(), z.string(), z.null()]).default(null) }).strict().describe("A GeoJSON Feature representing a buoyfield with MultiPoint geometry.") diff --git a/libs/shared-types/src/zod/features/debrief_feature_collection.ts b/libs/shared-types/src/zod/features/debrief_feature_collection.ts deleted file mode 100644 index 09135854..00000000 --- a/libs/shared-types/src/zod/features/debrief_feature_collection.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { z } from "zod" - -export default z.object({ "type": z.literal("FeatureCollection").default("FeatureCollection"), "features": z.array(z.any().superRefine((x, ctx) => { - const schemas = [z.any(), z.any(), z.any(), z.union([z.any(), z.any(), z.any()]), z.any(), z.any()]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x), - ), - [], - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: "invalid_union", - unionErrors: errors, - message: "Invalid input: Should pass single schema", - }); - } - })).describe("Array of Debrief features"), "bbox": z.union([z.array(z.number()).min(4).max(6), z.null()]).describe("Bounding box of the feature collection").default(null), "properties": z.union([z.any(), z.null()]).default(null) }).strict().describe("A GeoJSON FeatureCollection containing mixed feature types for maritime analysis.") diff --git a/libs/shared-types/src/zod/features/metadata_selection.ts b/libs/shared-types/src/zod/features/metadata_selection.ts deleted file mode 100644 index 3651979c..00000000 --- a/libs/shared-types/src/zod/features/metadata_selection.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "bbox": z.union([z.array(z.any()).min(4).max(4), z.array(z.any()).min(6).max(6), z.null()]).default(null), "type": z.literal("Feature"), "geometry": z.union([z.any(), z.null()]), "properties": z.union([z.any(), z.null()]), "id": z.union([z.number().int(), z.string(), z.null()]).default(null) }).strict().describe("A GeoJSON Feature representing selection state metadata.") diff --git a/libs/shared-types/src/zod/features/metadata_time.ts b/libs/shared-types/src/zod/features/metadata_time.ts deleted file mode 100644 index 435f2084..00000000 --- a/libs/shared-types/src/zod/features/metadata_time.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "bbox": z.union([z.array(z.any()).min(4).max(4), z.array(z.any()).min(6).max(6), z.null()]).default(null), "type": z.literal("Feature"), "geometry": z.union([z.any(), z.null()]), "properties": z.union([z.any(), z.null()]), "id": z.union([z.number().int(), z.string(), z.null()]).default(null) }).strict().describe("A GeoJSON Feature representing time state metadata.") diff --git a/libs/shared-types/src/zod/features/metadata_viewport.ts b/libs/shared-types/src/zod/features/metadata_viewport.ts deleted file mode 100644 index 6a4e46ac..00000000 --- a/libs/shared-types/src/zod/features/metadata_viewport.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "bbox": z.union([z.array(z.any()).min(4).max(4), z.array(z.any()).min(6).max(6), z.null()]).default(null), "type": z.literal("Feature"), "geometry": z.union([z.any(), z.null()]), "properties": z.union([z.any(), z.null()]), "id": z.union([z.number().int(), z.string(), z.null()]).default(null) }).strict().describe("A GeoJSON Feature representing viewport bounds stored as polygon geometry.") diff --git a/libs/shared-types/src/zod/features/point.ts b/libs/shared-types/src/zod/features/point.ts deleted file mode 100644 index 25100ded..00000000 --- a/libs/shared-types/src/zod/features/point.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "bbox": z.union([z.array(z.any()).min(4).max(4), z.array(z.any()).min(6).max(6), z.null()]).default(null), "type": z.literal("Feature"), "geometry": z.union([z.any(), z.null()]), "properties": z.union([z.any(), z.null()]), "id": z.union([z.number().int(), z.string(), z.null()]).default(null) }).strict().describe("A GeoJSON Feature representing a point with time properties.") diff --git a/libs/shared-types/src/zod/features/track.ts b/libs/shared-types/src/zod/features/track.ts deleted file mode 100644 index f88c43b3..00000000 --- a/libs/shared-types/src/zod/features/track.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "bbox": z.union([z.array(z.any()).min(4).max(4), z.array(z.any()).min(6).max(6), z.null()]).default(null), "type": z.literal("Feature"), "geometry": z.union([z.any(), z.any()]).describe("Track geometry must be LineString or MultiLineString"), "properties": z.union([z.any(), z.null()]), "id": z.union([z.number().int(), z.string(), z.null()]).default(null) }).strict().describe("A GeoJSON Feature representing a track with LineString or MultiLineString geometry.") diff --git a/libs/shared-types/src/zod/states/current_state.ts b/libs/shared-types/src/zod/states/current_state.ts deleted file mode 100644 index 4a5f0237..00000000 --- a/libs/shared-types/src/zod/states/current_state.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "editorId": z.string().describe("Unique identifier for the editor"), "filename": z.string().describe("Filename of the document being edited"), "editorState": z.any().describe("Complete editor state containing all sub-states"), "historyCount": z.number().int().gte(0).describe("History count for this editor") }).strict().describe("Complete current state information for a Debrief editor including metadata.") diff --git a/libs/shared-types/src/zod/states/editor_state.ts b/libs/shared-types/src/zod/states/editor_state.ts deleted file mode 100644 index 670ee4ba..00000000 --- a/libs/shared-types/src/zod/states/editor_state.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "featureCollection": z.union([z.any(), z.null()]).describe("The GeoJSON FeatureCollection data").default(null), "timeState": z.union([z.any(), z.null()]).describe("Current time position state").default(null), "viewportState": z.union([z.any(), z.null()]).describe("Current map viewport bounds state").default(null), "selectionState": z.union([z.any(), z.null()]).describe("Current feature selection state").default(null) }).strict().describe("Aggregated state for a Debrief editor instance containing all sub-state types.") diff --git a/libs/shared-types/src/zod/states/selection_state.ts b/libs/shared-types/src/zod/states/selection_state.ts deleted file mode 100644 index 5ba9f90e..00000000 --- a/libs/shared-types/src/zod/states/selection_state.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "selectedIds": z.array(z.union([z.string(), z.number().int()])).describe("Array of selected feature IDs") }).describe("State representing the currently selected features in a Debrief editor.") diff --git a/libs/shared-types/src/zod/states/time_state.ts b/libs/shared-types/src/zod/states/time_state.ts deleted file mode 100644 index 239a21e9..00000000 --- a/libs/shared-types/src/zod/states/time_state.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "current": z.string().datetime({ offset: true }).describe("Current time position as ISO 8601 date-time string"), "start": z.string().datetime({ offset: true }).describe("Start time of the overall time range as ISO 8601 date-time string"), "end": z.string().datetime({ offset: true }).describe("End time of the overall time range as ISO 8601 date-time string") }).describe("State representing the current time position in a Debrief editor.") diff --git a/libs/shared-types/src/zod/states/viewport_state.ts b/libs/shared-types/src/zod/states/viewport_state.ts deleted file mode 100644 index 62fc96b5..00000000 --- a/libs/shared-types/src/zod/states/viewport_state.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "bounds": z.array(z.number()).min(4).max(4).describe("Map bounds as [west, south, east, north] in decimal degrees") }).describe("State representing the current map viewport bounds in a Debrief editor.") diff --git a/libs/shared-types/src/zod/tools/add_features_command.ts b/libs/shared-types/src/zod/tools/add_features_command.ts deleted file mode 100644 index e7c2a18b..00000000 --- a/libs/shared-types/src/zod/tools/add_features_command.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { z } from "zod" - -export default z.object({ "command": z.literal("addFeatures").default("addFeatures"), "payload": z.array(z.any().superRefine((x, ctx) => { - const schemas = [z.any(), z.any(), z.any(), z.union([z.any(), z.any(), z.any()]), z.any(), z.any()]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x), - ), - [], - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: "invalid_union", - unionErrors: errors, - message: "Invalid input: Should pass single schema", - }); - } - })).describe("Array of Debrief features to add to the map") }).strict().describe("Command to add Debrief features to the map.") diff --git a/libs/shared-types/src/zod/tools/constrained_feature.ts b/libs/shared-types/src/zod/tools/constrained_feature.ts deleted file mode 100644 index 3be2323e..00000000 --- a/libs/shared-types/src/zod/tools/constrained_feature.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "allowedGeometryTypes": z.union([z.array(z.any()), z.null()]).describe("Allowed GeoJSON geometry types").default(null), "allowedDataTypes": z.union([z.array(z.any()), z.null()]).describe("Allowed feature.properties.dataType values").default(null), "feature": z.union([z.any(), z.any(), z.any()]).describe("The constrained feature") }).strict().describe("A DebriefFeature with constraints on geometry type and/or dataType.") diff --git a/libs/shared-types/src/zod/tools/delete_features_command.ts b/libs/shared-types/src/zod/tools/delete_features_command.ts deleted file mode 100644 index 2231ae51..00000000 --- a/libs/shared-types/src/zod/tools/delete_features_command.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "command": z.literal("deleteFeatures").default("deleteFeatures"), "payload": z.array(z.string()).describe("Array of feature IDs to delete from the map") }).strict().describe("Command to delete features from the map.") diff --git a/libs/shared-types/src/zod/tools/git_author.ts b/libs/shared-types/src/zod/tools/git_author.ts deleted file mode 100644 index 71272bf4..00000000 --- a/libs/shared-types/src/zod/tools/git_author.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "name": z.string().describe("Author's full name"), "email": z.string().describe("Author's email address") }).strict().describe("Git commit author information.") diff --git a/libs/shared-types/src/zod/tools/git_history.ts b/libs/shared-types/src/zod/tools/git_history.ts deleted file mode 100644 index be407aa9..00000000 --- a/libs/shared-types/src/zod/tools/git_history.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "commits": z.array(z.any()).describe("List of git commits in chronological order").optional() }).strict().describe("Collection of git commits for a tool.") diff --git a/libs/shared-types/src/zod/tools/git_history_entry.ts b/libs/shared-types/src/zod/tools/git_history_entry.ts deleted file mode 100644 index a7a79897..00000000 --- a/libs/shared-types/src/zod/tools/git_history_entry.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "hash": z.string().describe("Git commit hash"), "author": z.union([z.any(), z.string()]).describe("Commit author information (object or string for backward compatibility)"), "date": z.string().describe("Commit date in ISO format"), "message": z.string().describe("Commit message") }).strict().describe("A single git commit entry in tool development history.") diff --git a/libs/shared-types/src/zod/tools/global_tool_index.ts b/libs/shared-types/src/zod/tools/global_tool_index.ts deleted file mode 100644 index c122cab5..00000000 --- a/libs/shared-types/src/zod/tools/global_tool_index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "root": z.array(z.union([z.any(), z.any()])).describe("Root level nodes - can contain tools and/or categories"), "version": z.string().describe("Version identifier for the tool collection"), "description": z.string().describe("Description of the tool collection"), "packageInfo": z.union([z.any(), z.null()]).describe("Optional package build metadata").default(null) }).strict().describe("Global index for all tools in a package with hierarchical structure.") diff --git a/libs/shared-types/src/zod/tools/json_schema.ts b/libs/shared-types/src/zod/tools/json_schema.ts deleted file mode 100644 index bda182ad..00000000 --- a/libs/shared-types/src/zod/tools/json_schema.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "type": z.union([z.any(), z.null()]).default(null), "properties": z.union([z.record(z.any()), z.null()]).default(null), "required": z.union([z.array(z.string()), z.null()]).default(null), "additionalProperties": z.union([z.boolean(), z.any(), z.null()]).default(null), "description": z.union([z.string(), z.null()]).default(null) }).catchall(z.any()).describe("A JSON Schema object for defining data structure constraints.") diff --git a/libs/shared-types/src/zod/tools/log_message_command.ts b/libs/shared-types/src/zod/tools/log_message_command.ts deleted file mode 100644 index 1768339f..00000000 --- a/libs/shared-types/src/zod/tools/log_message_command.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "command": z.literal("logMessage").default("logMessage"), "payload": z.union([z.string(), z.any()]).describe("Log message string or structured log payload") }).strict().describe("Command to log a message.") diff --git a/libs/shared-types/src/zod/tools/log_message_payload.ts b/libs/shared-types/src/zod/tools/log_message_payload.ts deleted file mode 100644 index cf8e2cbd..00000000 --- a/libs/shared-types/src/zod/tools/log_message_payload.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "message": z.string().describe("Log message content"), "level": z.any().describe("Log level").default("info"), "timestamp": z.union([z.string(), z.null()]).describe("Optional timestamp").default(null) }).strict().describe("Structured payload for logMessage command.") diff --git a/libs/shared-types/src/zod/tools/package_info.ts b/libs/shared-types/src/zod/tools/package_info.ts deleted file mode 100644 index 11c9e4ff..00000000 --- a/libs/shared-types/src/zod/tools/package_info.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "buildDate": z.string().describe("ISO timestamp when the package was built"), "commit": z.string().describe("Git commit hash used for the build"), "author": z.string().describe("Author of the package build") }).strict().describe("Package build and metadata information.") diff --git a/libs/shared-types/src/zod/tools/sample_input_data.ts b/libs/shared-types/src/zod/tools/sample_input_data.ts deleted file mode 100644 index fb49a5c5..00000000 --- a/libs/shared-types/src/zod/tools/sample_input_data.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "name": z.string().describe("Display name for the sample input"), "file": z.string().describe("Filename of the sample input"), "data": z.record(z.any()).describe("The actual sample input data") }).strict().describe("Sample input data for tool testing.") diff --git a/libs/shared-types/src/zod/tools/sample_input_reference.ts b/libs/shared-types/src/zod/tools/sample_input_reference.ts deleted file mode 100644 index b7131a9b..00000000 --- a/libs/shared-types/src/zod/tools/sample_input_reference.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "path": z.string().describe("Relative path to the file within the tool package"), "description": z.string().describe("Human-readable description of the file's purpose"), "type": z.enum(["python","html","json"]).describe("File type classification"), "name": z.string().describe("Display name for the sample input") }).strict().describe("Reference to a sample input file with additional metadata.") diff --git a/libs/shared-types/src/zod/tools/set_feature_collection_command.ts b/libs/shared-types/src/zod/tools/set_feature_collection_command.ts deleted file mode 100644 index 551b934d..00000000 --- a/libs/shared-types/src/zod/tools/set_feature_collection_command.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "command": z.literal("setFeatureCollection").default("setFeatureCollection"), "payload": z.any().describe("Complete Debrief FeatureCollection to replace current features") }).strict().describe("Command to replace the entire feature collection.") diff --git a/libs/shared-types/src/zod/tools/set_selection_command.ts b/libs/shared-types/src/zod/tools/set_selection_command.ts deleted file mode 100644 index bf72b8ee..00000000 --- a/libs/shared-types/src/zod/tools/set_selection_command.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "command": z.literal("setSelection").default("setSelection"), "payload": z.any().describe("Selection state to set") }).strict().describe("Command to update feature selection.") diff --git a/libs/shared-types/src/zod/tools/set_viewport_command.ts b/libs/shared-types/src/zod/tools/set_viewport_command.ts deleted file mode 100644 index 5ca36bcd..00000000 --- a/libs/shared-types/src/zod/tools/set_viewport_command.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "command": z.literal("setViewport").default("setViewport"), "payload": z.any().describe("Viewport state to set") }).strict().describe("Command to update the map viewport.") diff --git a/libs/shared-types/src/zod/tools/show_data_command.ts b/libs/shared-types/src/zod/tools/show_data_command.ts deleted file mode 100644 index 63b9b329..00000000 --- a/libs/shared-types/src/zod/tools/show_data_command.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "command": z.literal("showData").default("showData"), "payload": z.union([z.any(), z.record(z.any())]).describe("Structured data object or raw data to display") }).strict().describe("Command to display structured data to the user.") diff --git a/libs/shared-types/src/zod/tools/show_image_command.ts b/libs/shared-types/src/zod/tools/show_image_command.ts deleted file mode 100644 index 78952ce0..00000000 --- a/libs/shared-types/src/zod/tools/show_image_command.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "command": z.literal("showImage").default("showImage"), "payload": z.any().describe("Image data and metadata") }).strict().describe("Command to display an image to the user.") diff --git a/libs/shared-types/src/zod/tools/show_text_command.ts b/libs/shared-types/src/zod/tools/show_text_command.ts deleted file mode 100644 index ce8db2f6..00000000 --- a/libs/shared-types/src/zod/tools/show_text_command.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "command": z.literal("showText").default("showText"), "payload": z.string().describe("Text message to display to the user") }).strict().describe("Command to display text to the user.") diff --git a/libs/shared-types/src/zod/tools/tool.ts b/libs/shared-types/src/zod/tools/tool.ts deleted file mode 100644 index d966d6d7..00000000 --- a/libs/shared-types/src/zod/tools/tool.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "type": z.literal("tool").default("tool"), "name": z.string().describe("The unique identifier/name of the tool"), "description": z.string().describe("Human-readable description of what the tool does"), "inputSchema": z.any().describe("JSON Schema defining the expected input parameters"), "outputSchema": z.union([z.any(), z.null()]).describe("Optional JSON Schema defining the expected output format").default(null), "tool_url": z.union([z.string(), z.null()]).describe("Optional URL for SPA navigation to tool details").default(null), "module_path": z.union([z.string(), z.null()]).describe("Python module path for lazy loading (e.g., 'tools.text.word_count.execute')").default(null), "function_name": z.union([z.string(), z.null()]).describe("Function name within the module for execution").default(null) }).strict().describe("A tool definition with input/output schemas for maritime analysis.") diff --git a/libs/shared-types/src/zod/tools/tool_call_request.ts b/libs/shared-types/src/zod/tools/tool_call_request.ts deleted file mode 100644 index 9f861c78..00000000 --- a/libs/shared-types/src/zod/tools/tool_call_request.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "name": z.string().describe("The name of the tool to call"), "arguments": z.array(z.any()).describe("Tool arguments as an array of named parameters") }).strict().describe("Request model for tool call endpoint matching current Pydantic implementation.") diff --git a/libs/shared-types/src/zod/tools/tool_call_response.ts b/libs/shared-types/src/zod/tools/tool_call_response.ts deleted file mode 100644 index b5e3cd01..00000000 --- a/libs/shared-types/src/zod/tools/tool_call_response.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "result": z.any().describe("A command that triggers state changes in Debrief"), "isError": z.boolean().describe("Optional flag indicating if the result represents an error condition").default(false) }).strict().describe("Response format for tool execution results containing Debrief commands.") diff --git a/libs/shared-types/src/zod/tools/tool_file_reference.ts b/libs/shared-types/src/zod/tools/tool_file_reference.ts deleted file mode 100644 index 49426a6a..00000000 --- a/libs/shared-types/src/zod/tools/tool_file_reference.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "path": z.string().describe("Relative path to the file within the tool package"), "description": z.string().describe("Human-readable description of the file's purpose"), "type": z.enum(["python","html","json"]).describe("File type classification") }).strict().describe("Reference to a file within a tool's directory structure.") diff --git a/libs/shared-types/src/zod/tools/tool_files_collection.ts b/libs/shared-types/src/zod/tools/tool_files_collection.ts deleted file mode 100644 index 0f79d814..00000000 --- a/libs/shared-types/src/zod/tools/tool_files_collection.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "execute": z.any().describe("Main tool implementation file"), "source_code": z.any().describe("Pretty-printed source code file"), "git_history": z.any().describe("Git commit history file"), "inputs": z.array(z.any()).describe("Sample input files for testing the tool").optional(), "schemas": z.array(z.any()).describe("Generated schema documents associated with this tool").optional() }).describe("Collection of files within a tool's directory structure.") diff --git a/libs/shared-types/src/zod/tools/tool_index.ts b/libs/shared-types/src/zod/tools/tool_index.ts deleted file mode 100644 index 56d756c0..00000000 --- a/libs/shared-types/src/zod/tools/tool_index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "tool_name": z.string().describe("The name of the tool"), "description": z.string().describe("Human-readable description of what the tool does"), "files": z.any().describe("Files associated with this tool"), "stats": z.any().describe("Statistics about this tool") }).strict().describe("Index data for an individual tool (replaces packager.py:358-399 dictionary structure).") diff --git a/libs/shared-types/src/zod/tools/tool_list_response.ts b/libs/shared-types/src/zod/tools/tool_list_response.ts deleted file mode 100644 index d3132eb5..00000000 --- a/libs/shared-types/src/zod/tools/tool_list_response.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "tools": z.array(z.any()).describe("Array of available tools"), "version": z.union([z.string(), z.null()]).describe("Optional version identifier for the tool collection").default(null), "description": z.union([z.string(), z.null()]).describe("Optional description of the tool collection").default(null) }).strict().describe("Response format for listing available tools.") diff --git a/libs/shared-types/src/zod/tools/tool_metadata.ts b/libs/shared-types/src/zod/tools/tool_metadata.ts deleted file mode 100644 index e07d5e79..00000000 --- a/libs/shared-types/src/zod/tools/tool_metadata.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "name": z.string().describe("The unique identifier/name of the tool"), "description": z.string().describe("Human-readable description of what the tool does"), "parameters": z.record(z.any()).describe("Typed parameter schema for the tool"), "return_type": z.string().describe("Return type annotation as string"), "module_path": z.string().describe("Path to the tool's module file"), "tool_dir": z.string().describe("Directory containing the tool"), "sample_inputs": z.array(z.any()).describe("Sample input data for testing").optional(), "source_code": z.union([z.string(), z.null()]).describe("Tool's source code").default(null), "git_history": z.array(z.any()).describe("Git commit history for this tool").optional() }).strict().describe("Enhanced ToolMetadata class with typed parameters, sample_inputs, git_history.") diff --git a/libs/shared-types/src/zod/tools/tool_stats.ts b/libs/shared-types/src/zod/tools/tool_stats.ts deleted file mode 100644 index 9435f4c6..00000000 --- a/libs/shared-types/src/zod/tools/tool_stats.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from "zod" - -export default z.object({ "sample_inputs_count": z.number().int().gte(0).describe("Number of sample input files available for this tool").default(0), "git_commits_count": z.number().int().gte(0).describe("Number of git commits in this tool's development history").default(0), "source_code_length": z.number().int().gte(0).describe("Length of the tool's source code in characters").default(0) }).strict().describe("Statistics about a tool's development and usage.") diff --git a/libs/shared-types/src/zod/tools/update_features_command.ts b/libs/shared-types/src/zod/tools/update_features_command.ts deleted file mode 100644 index 2a37a1bf..00000000 --- a/libs/shared-types/src/zod/tools/update_features_command.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { z } from "zod" - -export default z.object({ "command": z.literal("updateFeatures").default("updateFeatures"), "payload": z.array(z.any().superRefine((x, ctx) => { - const schemas = [z.any(), z.any(), z.any(), z.union([z.any(), z.any(), z.any()]), z.any(), z.any()]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x), - ), - [], - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: "invalid_union", - unionErrors: errors, - message: "Invalid input: Should pass single schema", - }); - } - })).describe("Array of Debrief features with updated properties") }).strict().describe("Command to update existing Debrief features on the map.") diff --git a/libs/tool-vault-packager/tools/feature-management/toggle_first_feature_color/execute.py b/libs/tool-vault-packager/tools/feature-management/toggle_first_feature_color/execute.py index 12527fa7..d703a72c 100644 --- a/libs/tool-vault-packager/tools/feature-management/toggle_first_feature_color/execute.py +++ b/libs/tool-vault-packager/tools/feature-management/toggle_first_feature_color/execute.py @@ -88,11 +88,11 @@ def toggle_first_feature_color(params: ToggleFirstFeatureColorParameters) -> Deb # Define color property based on feature type and CSS color codes if data_type == "reference-point": - color_property = "marker-color" + color_property = "marker_color" red_color = "#FF0000" blue_color = "#0000FF" elif data_type == "buoyfield": - color_property = "marker-color" + color_property = "marker_color" red_color = "#FF0000" blue_color = "#0000FF" elif data_type == "track": diff --git a/libs/web-components/.storybook/public/large-sample.plot.json b/libs/web-components/.storybook/public/large-sample.plot.json index 2be83e7e..4a5ec3e6 100644 --- a/libs/web-components/.storybook/public/large-sample.plot.json +++ b/libs/web-components/.storybook/public/large-sample.plot.json @@ -19968,7 +19968,7 @@ "type": "Feature", "properties": { "dataType": "buoyfield", - "marker-color": "#FF0", + "marker_color": "#FF0", "name": "Z12344", "shortName": "12344", "visible": true, @@ -21065,7 +21065,7 @@ "properties": { "name": "SONO 1-2", "dataType": "reference-point", - "marker-color": "#00FF00", + "marker_color": "#00FF00", "visible": true, "time": "2024-11-14T21:10:00.000Z" }, @@ -21083,7 +21083,7 @@ "properties": { "name": "NEW SONO", "dataType": "reference-point", - "marker-color": "#0000FF", + "marker_color": "#0000FF", "visible": true }, "geometry": { @@ -21100,7 +21100,7 @@ "properties": { "name": "POINT D-1", "dataType": "reference-point", - "marker-color": "#FFFF00", + "marker_color": "#FFFF00", "visible": true }, "geometry": { diff --git a/libs/web-components/src/MapComponent/MapComponent.stories.tsx b/libs/web-components/src/MapComponent/MapComponent.stories.tsx index 64b9f5ca..a4fa15a9 100644 --- a/libs/web-components/src/MapComponent/MapComponent.stories.tsx +++ b/libs/web-components/src/MapComponent/MapComponent.stories.tsx @@ -33,7 +33,7 @@ const sampleGeoJSON: GeoJSONFeatureCollection = { }, properties: { name: 'Regular Point', - 'marker-color': '#ff0000' + 'marker_color': '#ff0000' } }, { @@ -46,7 +46,7 @@ const sampleGeoJSON: GeoJSONFeatureCollection = { properties: { name: 'Buoy Marker', type: 'buoyfield', - 'marker-color': '#00ff00' + 'marker_color': '#00ff00' } }, { @@ -96,7 +96,7 @@ const sampleGeoJSON: GeoJSONFeatureCollection = { }, properties: { name: 'Hidden Point (not rendered)', - 'marker-color': '#888888', + 'marker_color': '#888888', visible: false } }, @@ -130,7 +130,7 @@ const sampleGeoJSON: GeoJSONFeatureCollection = { properties: { name: 'Navigation Buoy', type: 'buoyfield', - 'marker-color': '#ffff00' + 'marker_color': '#ffff00' } } ] @@ -217,7 +217,7 @@ export const BuoyfieldsAndTracks: Story = { properties: { name: 'Green Buoy', type: 'buoyfield', - 'marker-color': '#00cc00' + 'marker_color': '#00cc00' } }, { @@ -230,7 +230,7 @@ export const BuoyfieldsAndTracks: Story = { properties: { name: 'Red Buoy', type: 'buoyfield', - 'marker-color': '#cc0000' + 'marker_color': '#cc0000' } } ] @@ -324,7 +324,7 @@ export const VisibilityFiltering: Story = { }, properties: { name: 'Visible Point', - 'marker-color': '#00ff00', + 'marker_color': '#00ff00', visible: true } }, @@ -337,7 +337,7 @@ export const VisibilityFiltering: Story = { }, properties: { name: 'Hidden Point (not shown)', - 'marker-color': '#ff0000', + 'marker_color': '#ff0000', visible: false } }, @@ -350,7 +350,7 @@ export const VisibilityFiltering: Story = { }, properties: { name: 'Default Visible (no visible property)', - 'marker-color': '#0066ff' + 'marker_color': '#0066ff' } }, { diff --git a/libs/web-components/src/MapComponent/MapComponent.test.tsx b/libs/web-components/src/MapComponent/MapComponent.test.tsx index aa596062..ec8cf32b 100644 --- a/libs/web-components/src/MapComponent/MapComponent.test.tsx +++ b/libs/web-components/src/MapComponent/MapComponent.test.tsx @@ -67,7 +67,7 @@ const sampleGeoJSON: GeoJSONFeatureCollection = { }, properties: { name: 'Test Point', - 'marker-color': '#ff0000' + 'marker_color': '#ff0000' } }, { @@ -80,7 +80,7 @@ const sampleGeoJSON: GeoJSONFeatureCollection = { properties: { name: 'Test Buoy', type: 'buoyfield', - 'marker-color': '#00ff00' + 'marker_color': '#00ff00' } }, { @@ -118,7 +118,7 @@ const sampleGeoJSON: GeoJSONFeatureCollection = { }, properties: { name: 'Hidden Point', - 'marker-color': '#888888', + 'marker_color': '#888888', visible: false } } @@ -168,7 +168,7 @@ describe('MapComponent', () => { // More detailed testing would require inspecting internal state or using React Testing Library queries }); - it('handles features with marker-color properties', () => { + it('handles features with marker_color properties', () => { const pointFeatureData = { type: 'FeatureCollection' as const, features: [{ @@ -179,7 +179,7 @@ describe('MapComponent', () => { coordinates: [-0.09, 51.505] }, properties: { - 'marker-color': '#ff0000' + 'marker_color': '#ff0000' } }] }; @@ -200,7 +200,7 @@ describe('MapComponent', () => { }, properties: { type: 'buoyfield', - 'marker-color': '#00ff00' + 'marker_color': '#00ff00' } }] };