const std = @import("std");const gateway_schema = @import("gateway_schema.zig");const mcp_runtime = @import("../mcp/mcp_runtime.zig");const permissions = @import("../permissions/permissions.zig");const tool_dispatch = @import("tool_dispatch.zig");const tool_set_contract = @import("tool_set.zig");const types = @import("../shared/types.zig"); const Allocator = std.mem.Allocator; pub const Options = struct { permission_mode: types.PermissionMode = .auto, permission_rules: types.PermissionRuleSet = .{}, mcp_runtime: ?*mcp_runtime.McpRuntime = null, subagent_available: bool = false,}; const BuildKind = enum { full, read_only }; const TestInput = struct {}; fn testInputDeinit(ptr: *anyopaque, alloc: Allocator) void { alloc.destroy(@as(*TestInput, @ptrCast(@alignCast(ptr))));} fn decodeTestInput(ctx: tool_dispatch.DispatchContext, _: []const u8) tool_dispatch.DispatchError!tool_dispatch.DecodeResult { const input = try ctx.allocator.create(TestInput); input.* = .{}; return .{ .input = .{ .ptr = input, .deinit_fn = testInputDeinit } };} fn callTestTool(ctx: tool_dispatch.DispatchContext, _: tool_dispatch.ToolInput) tool_dispatch.DispatchError!tool_dispatch.ToolResult { return .{ .success = try ctx.allocator.dupe(u8, "test tool result") };} fn testToolReadsOnly(_: tool_dispatch.ToolInput) bool { return true;} fn testToolIsIrreversible(_: tool_dispatch.ToolInput) bool { return false;} const test_tool_seed = tool_dispatch.Tool{ .name = "test_tool", .description = "Test registered tool.", .gateway_schema = .{ .name = "test_tool", .description = "Test registered tool.", }, .decode = decodeTestInput, .call = callTestTool, .reads_only_fn = testToolReadsOnly, .irreversible_fn = testToolIsIrreversible,}; const test_read_file = blk: { var spec = test_tool_seed; spec.name = "read_file"; spec.description = "Test file read. When to use: exercise registered read projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "read_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, }, .required = &.{"path"}, }, }; spec.executor_kind = .read_file; spec.activity_kind = .read; spec.requires_approval = false; spec.action_label = "Reading"; spec.completed_action_label = "Read"; spec.label_arg_kind = .path; spec.label_arg_default = "file"; spec.permission_target_kind = .path_existing; break :blk spec;}; const test_file_info = blk: { var spec = test_read_file; spec.name = "file_info"; spec.description = "Test file metadata. When to use: exercise registered metadata projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "file_info", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, }, .required = &.{"path"}, }, }; spec.executor_kind = .file_info; spec.activity_kind = .read; spec.requires_approval = false; spec.action_label = "Inspecting"; spec.completed_action_label = "Inspected"; spec.label_arg_kind = .path; spec.label_arg_default = "path"; spec.permission_target_kind = .path_existing; break :blk spec;}; const test_open_file = blk: { var spec = test_read_file; spec.name = "open_file"; spec.description = "Test file open. When to use: exercise registered launcher projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "open_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, }, .required = &.{"path"}, }, }; spec.executor_kind = .open_file; spec.activity_kind = .open; spec.requires_approval = true; spec.action_label = "Opening"; spec.completed_action_label = "Opened"; spec.label_arg_kind = .path; spec.label_arg_default = "file"; spec.permission_target_kind = .path_existing; break :blk spec;}; const test_memory = blk: { var spec = test_read_file; spec.name = "memory"; spec.description = "Test durable memory. When to use: exercise registered memory projection. When NOT to use: assert product-specific persistence behavior."; spec.gateway_schema = .{ .name = "memory", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "action", .json_type = .string, .enum_values = &.{ "save", "list", "clear" } }, .{ .name = "fact", .json_type = .string }, }, .required = &.{"action"}, }, }; spec.executor_kind = .memory; spec.activity_kind = .write; spec.requires_approval = false; spec.action_label = "Remembering"; spec.completed_action_label = "Remembered"; spec.label_arg_kind = .action; spec.label_arg_default = "memory"; spec.permission_target_kind = .none; break :blk spec;}; const test_semantic_search = blk: { var spec = test_read_file; spec.name = "semantic_search"; spec.description = "Test lexical search. When to use: exercise registered search projection. When NOT to use: assert product-specific search behavior."; spec.gateway_schema = .{ .name = "semantic_search", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "query", .json_type = .string }, .{ .name = "path", .json_type = .string }, }, .required = &.{"query"}, }, }; spec.executor_kind = .semantic_search; spec.activity_kind = .read; spec.requires_approval = false; spec.action_label = "Searching"; spec.completed_action_label = "Searched"; spec.label_arg_kind = .query; spec.label_arg_default = "query"; spec.permission_target_kind = .path_optional_existing; break :blk spec;}; const test_write_file = blk: { var spec = test_read_file; spec.name = "write_file"; spec.description = "Test file write. When to use: exercise registered mutation projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "write_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, .{ .name = "content", .json_type = .string }, }, .required = &.{ "path", "content" }, }, }; spec.executor_kind = .write_file; spec.activity_kind = .write; spec.requires_approval = true; spec.action_label = "Writing"; spec.completed_action_label = "Wrote"; spec.label_arg_kind = .path; spec.label_arg_default = "file"; spec.permission_target_kind = .path_create_parent; break :blk spec;}; const test_edit_file = blk: { var spec = test_read_file; spec.name = "edit_file"; spec.description = "Test file editing. When to use: exercise registered edit projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "edit_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, .{ .name = "old_string", .json_type = .string }, .{ .name = "new_string", .json_type = .string }, }, .required = &.{ "path", "old_string", "new_string" }, }, }; spec.executor_kind = .edit_file; spec.activity_kind = .edit; spec.requires_approval = true; spec.action_label = "Editing"; spec.completed_action_label = "Edited"; spec.label_arg_kind = .path; spec.label_arg_default = "file"; spec.permission_target_kind = .path_existing_parent; break :blk spec;}; const test_delete_file = blk: { var spec = test_read_file; spec.name = "delete_file"; spec.description = "Test file deletion. When to use: exercise registered delete projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "delete_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, }, .required = &.{"path"}, }, }; spec.executor_kind = .delete_file; spec.activity_kind = .write; spec.requires_approval = true; spec.action_label = "Deleting"; spec.completed_action_label = "Deleted"; spec.label_arg_kind = .path; spec.label_arg_default = "file"; spec.permission_target_kind = .path_existing; break :blk spec;}; const test_rename_file = blk: { var spec = test_read_file; spec.name = "rename_file"; spec.description = "Test file rename. When to use: exercise registered rename projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "rename_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "old_path", .json_type = .string }, .{ .name = "new_path", .json_type = .string }, }, .required = &.{ "old_path", "new_path" }, }, }; spec.executor_kind = .rename_file; spec.activity_kind = .write; spec.requires_approval = true; spec.action_label = "Renaming"; spec.completed_action_label = "Renamed"; spec.label_arg_kind = .old_path; spec.label_arg_default = "file"; spec.permission_target_kind = .none; break :blk spec;}; const test_copy_file = blk: { var spec = test_read_file; spec.name = "copy_file"; spec.description = "Test file copying. When to use: exercise registered copy projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "copy_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "source", .json_type = .string }, .{ .name = "destination", .json_type = .string }, }, .required = &.{ "source", "destination" }, }, }; spec.executor_kind = .copy_file; spec.activity_kind = .write; spec.requires_approval = true; spec.action_label = "Copying"; spec.completed_action_label = "Copied"; spec.label_arg_kind = .source; spec.label_arg_default = "file"; spec.permission_target_kind = .none; break :blk spec;}; const test_create_folder = blk: { var spec = test_read_file; spec.name = "create_folder"; spec.description = "Test folder creation. When to use: exercise registered creation projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "create_folder", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, }, .required = &.{"path"}, }, }; spec.executor_kind = .create_folder; spec.activity_kind = .write; spec.requires_approval = true; spec.action_label = "Creating"; spec.completed_action_label = "Created"; spec.label_arg_kind = .path; spec.label_arg_default = "folder"; spec.permission_target_kind = .path_create_parent; break :blk spec;}; const test_list_files = blk: { var spec = test_read_file; spec.name = "list_files"; spec.description = "Test directory listing. When to use: exercise registered list projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "list_files", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, } }, }; spec.executor_kind = .list_files; spec.activity_kind = .list; spec.requires_approval = false; spec.action_label = "Listing"; spec.completed_action_label = "Listed"; spec.label_arg_kind = .path; spec.label_arg_default = "."; spec.permission_target_kind = .path_optional_existing; break :blk spec;}; const test_glob_files = blk: { var spec = test_list_files; spec.name = "glob_files"; spec.description = "Test filename matching. When to use: exercise registered search projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "glob_files", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "pattern", .json_type = .string }, .{ .name = "path", .json_type = .string }, }, .required = &.{"pattern"}, }, }; spec.executor_kind = .glob_files; spec.action_label = "Matching"; spec.completed_action_label = "Matched"; spec.label_arg_kind = .pattern; spec.label_arg_default = "pattern"; break :blk spec;}; const test_grep_files = blk: { var spec = test_read_file; spec.name = "grep_files"; spec.description = "Test text search. When to use: exercise registered search projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "grep_files", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "pattern", .json_type = .string }, }, .required = &.{"pattern"}, }, }; spec.executor_kind = .grep_files; spec.activity_kind = .read; spec.requires_approval = false; spec.action_label = "Searching"; spec.completed_action_label = "Searched"; spec.label_arg_kind = .pattern; spec.label_arg_default = "pattern"; spec.permission_target_kind = .path_optional_existing; break :blk spec;}; fn writeTestWebSearchProviderAdvertisement( _: Allocator, writer: *std.Io.Writer,) tool_dispatch.GatewayAdvertisementError!void { try writer.writeAll("{\"type\":\"provider\",\"id\":\"gateway.perplexity_search\",\"name\":\"perplexity_search\",\"args\":{}}");} const test_web_fetch = blk: { var spec = test_read_file; spec.name = "web_fetch"; spec.gateway_schema = .{ .name = "web_fetch", .description = spec.description, }; spec.executor_kind = .web_fetch; spec.label_arg_kind = .url; spec.label_arg_default = "url"; spec.permission_target_kind = .none; break :blk spec;}; const test_web_search_base = blk: { var spec = test_web_fetch; spec.name = "web_search"; spec.description = "Test web search guidance."; spec.gateway_schema = .{ .name = "web_search", .description = spec.description, }; spec.executor_kind = .web_search; spec.label_arg_kind = .query; spec.label_arg_default = "web"; break :blk spec;}; const test_web_search = blk: { var spec = test_web_search_base; spec.write_gateway_advertisement_fn = writeTestWebSearchProviderAdvertisement; spec.provider_executed = true; break :blk spec;}; const test_terminal = blk: { var spec = test_read_file; spec.name = "terminal"; spec.description = "Test terminal. When to use: exercise registered terminal projection. When NOT to use: assert product-specific terminal behavior."; spec.gateway_schema = .{ .name = "terminal", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "action", .json_type = .string, .enum_values = &.{"exec"} }, .{ .name = "command", .json_type = .string }, }, .required = &.{ "action", "command" }, .additional_properties = false, }, }; spec.executor_kind = .terminal; spec.activity_kind = .command; spec.requires_approval = true; spec.action_label = "Using terminal"; spec.completed_action_label = "Used terminal"; spec.label_arg_kind = .action; spec.label_arg_default = "session"; spec.permission_target_kind = .none; break :blk spec;}; const test_skill = blk: { var spec = test_read_file; spec.name = "skill"; spec.description = "Test skill. When to use: exercise registered skill projection. When NOT to use: assert product-specific skill loading."; spec.gateway_schema = .{ .name = "skill", .description = spec.description, }; spec.executor_kind = .skill; spec.activity_kind = .read; spec.requires_approval = false; spec.action_label = "Loading skill"; spec.completed_action_label = "Loaded skill"; spec.label_arg_kind = .name; spec.label_arg_default = "skill"; spec.permission_target_kind = .none; break :blk spec;}; const test_install_skill = blk: { var spec = test_skill; spec.name = "install_skill"; spec.description = "Test install skill. When to use: exercise registered write-tool projection. When NOT to use: assert product-specific installation behavior.";Lines 1–500 of 1411. Load more
const std = @import("std"); const gateway_schema = @import("gateway_schema.zig"); const mcp_runtime = @import("../mcp/mcp_runtime.zig"); const permissions = @import("../permissions/permissions.zig"); const tool_dispatch = @import("tool_dispatch.zig"); const tool_set_contract = @import("tool_set.zig"); const types = @import("../shared/types.zig"); const Allocator = std.mem.Allocator; pub const Options = struct { permission_mode: types.PermissionMode = .auto, permission_rules: types.PermissionRuleSet = .{}, mcp_runtime: ?*mcp_runtime.McpRuntime = null, subagent_available: bool = false, }; const BuildKind = enum { full, read_only }; const TestInput = struct {}; fn testInputDeinit(ptr: *anyopaque, alloc: Allocator) void { alloc.destroy(@as(*TestInput, @ptrCast(@alignCast(ptr)))); } fn decodeTestInput(ctx: tool_dispatch.DispatchContext, _: []const u8) tool_dispatch.DispatchError!tool_dispatch.DecodeResult { const input = try ctx.allocator.create(TestInput); input.* = .{}; return .{ .input = .{ .ptr = input, .deinit_fn = testInputDeinit } }; } fn callTestTool(ctx: tool_dispatch.DispatchContext, _: tool_dispatch.ToolInput) tool_dispatch.DispatchError!tool_dispatch.ToolResult { return .{ .success = try ctx.allocator.dupe(u8, "test tool result") }; } fn testToolReadsOnly(_: tool_dispatch.ToolInput) bool { return true; } fn testToolIsIrreversible(_: tool_dispatch.ToolInput) bool { return false; } const test_tool_seed = tool_dispatch.Tool{ .name = "test_tool", .description = "Test registered tool.", .gateway_schema = .{ .name = "test_tool", .description = "Test registered tool.", }, .decode = decodeTestInput, .call = callTestTool, .reads_only_fn = testToolReadsOnly, .irreversible_fn = testToolIsIrreversible, }; const test_read_file = blk: { var spec = test_tool_seed; spec.name = "read_file"; spec.description = "Test file read. When to use: exercise registered read projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "read_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, }, .required = &.{"path"}, }, }; spec.executor_kind = .read_file; spec.activity_kind = .read; spec.requires_approval = false; spec.action_label = "Reading"; spec.completed_action_label = "Read"; spec.label_arg_kind = .path; spec.label_arg_default = "file"; spec.permission_target_kind = .path_existing; break :blk spec; }; const test_file_info = blk: { var spec = test_read_file; spec.name = "file_info"; spec.description = "Test file metadata. When to use: exercise registered metadata projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "file_info", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, }, .required = &.{"path"}, }, }; spec.executor_kind = .file_info; spec.activity_kind = .read; spec.requires_approval = false; spec.action_label = "Inspecting"; spec.completed_action_label = "Inspected"; spec.label_arg_kind = .path; spec.label_arg_default = "path"; spec.permission_target_kind = .path_existing; break :blk spec; }; const test_open_file = blk: { var spec = test_read_file; spec.name = "open_file"; spec.description = "Test file open. When to use: exercise registered launcher projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "open_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, }, .required = &.{"path"}, }, }; spec.executor_kind = .open_file; spec.activity_kind = .open; spec.requires_approval = true; spec.action_label = "Opening"; spec.completed_action_label = "Opened"; spec.label_arg_kind = .path; spec.label_arg_default = "file"; spec.permission_target_kind = .path_existing; break :blk spec; }; const test_memory = blk: { var spec = test_read_file; spec.name = "memory"; spec.description = "Test durable memory. When to use: exercise registered memory projection. When NOT to use: assert product-specific persistence behavior."; spec.gateway_schema = .{ .name = "memory", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "action", .json_type = .string, .enum_values = &.{ "save", "list", "clear" } }, .{ .name = "fact", .json_type = .string }, }, .required = &.{"action"}, }, }; spec.executor_kind = .memory; spec.activity_kind = .write; spec.requires_approval = false; spec.action_label = "Remembering"; spec.completed_action_label = "Remembered"; spec.label_arg_kind = .action; spec.label_arg_default = "memory"; spec.permission_target_kind = .none; break :blk spec; }; const test_semantic_search = blk: { var spec = test_read_file; spec.name = "semantic_search"; spec.description = "Test lexical search. When to use: exercise registered search projection. When NOT to use: assert product-specific search behavior."; spec.gateway_schema = .{ .name = "semantic_search", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "query", .json_type = .string }, .{ .name = "path", .json_type = .string }, }, .required = &.{"query"}, }, }; spec.executor_kind = .semantic_search; spec.activity_kind = .read; spec.requires_approval = false; spec.action_label = "Searching"; spec.completed_action_label = "Searched"; spec.label_arg_kind = .query; spec.label_arg_default = "query"; spec.permission_target_kind = .path_optional_existing; break :blk spec; }; const test_write_file = blk: { var spec = test_read_file; spec.name = "write_file"; spec.description = "Test file write. When to use: exercise registered mutation projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "write_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, .{ .name = "content", .json_type = .string }, }, .required = &.{ "path", "content" }, }, }; spec.executor_kind = .write_file; spec.activity_kind = .write; spec.requires_approval = true; spec.action_label = "Writing"; spec.completed_action_label = "Wrote"; spec.label_arg_kind = .path; spec.label_arg_default = "file"; spec.permission_target_kind = .path_create_parent; break :blk spec; }; const test_edit_file = blk: { var spec = test_read_file; spec.name = "edit_file"; spec.description = "Test file editing. When to use: exercise registered edit projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "edit_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, .{ .name = "old_string", .json_type = .string }, .{ .name = "new_string", .json_type = .string }, }, .required = &.{ "path", "old_string", "new_string" }, }, }; spec.executor_kind = .edit_file; spec.activity_kind = .edit; spec.requires_approval = true; spec.action_label = "Editing"; spec.completed_action_label = "Edited"; spec.label_arg_kind = .path; spec.label_arg_default = "file"; spec.permission_target_kind = .path_existing_parent; break :blk spec; }; const test_delete_file = blk: { var spec = test_read_file; spec.name = "delete_file"; spec.description = "Test file deletion. When to use: exercise registered delete projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "delete_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, }, .required = &.{"path"}, }, }; spec.executor_kind = .delete_file; spec.activity_kind = .write; spec.requires_approval = true; spec.action_label = "Deleting"; spec.completed_action_label = "Deleted"; spec.label_arg_kind = .path; spec.label_arg_default = "file"; spec.permission_target_kind = .path_existing; break :blk spec; }; const test_rename_file = blk: { var spec = test_read_file; spec.name = "rename_file"; spec.description = "Test file rename. When to use: exercise registered rename projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "rename_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "old_path", .json_type = .string }, .{ .name = "new_path", .json_type = .string }, }, .required = &.{ "old_path", "new_path" }, }, }; spec.executor_kind = .rename_file; spec.activity_kind = .write; spec.requires_approval = true; spec.action_label = "Renaming"; spec.completed_action_label = "Renamed"; spec.label_arg_kind = .old_path; spec.label_arg_default = "file"; spec.permission_target_kind = .none; break :blk spec; }; const test_copy_file = blk: { var spec = test_read_file; spec.name = "copy_file"; spec.description = "Test file copying. When to use: exercise registered copy projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "copy_file", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "source", .json_type = .string }, .{ .name = "destination", .json_type = .string }, }, .required = &.{ "source", "destination" }, }, }; spec.executor_kind = .copy_file; spec.activity_kind = .write; spec.requires_approval = true; spec.action_label = "Copying"; spec.completed_action_label = "Copied"; spec.label_arg_kind = .source; spec.label_arg_default = "file"; spec.permission_target_kind = .none; break :blk spec; }; const test_create_folder = blk: { var spec = test_read_file; spec.name = "create_folder"; spec.description = "Test folder creation. When to use: exercise registered creation projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "create_folder", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, }, .required = &.{"path"}, }, }; spec.executor_kind = .create_folder; spec.activity_kind = .write; spec.requires_approval = true; spec.action_label = "Creating"; spec.completed_action_label = "Created"; spec.label_arg_kind = .path; spec.label_arg_default = "folder"; spec.permission_target_kind = .path_create_parent; break :blk spec; }; const test_list_files = blk: { var spec = test_read_file; spec.name = "list_files"; spec.description = "Test directory listing. When to use: exercise registered list projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "list_files", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "path", .json_type = .string }, } }, }; spec.executor_kind = .list_files; spec.activity_kind = .list; spec.requires_approval = false; spec.action_label = "Listing"; spec.completed_action_label = "Listed"; spec.label_arg_kind = .path; spec.label_arg_default = "."; spec.permission_target_kind = .path_optional_existing; break :blk spec; }; const test_glob_files = blk: { var spec = test_list_files; spec.name = "glob_files"; spec.description = "Test filename matching. When to use: exercise registered search projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "glob_files", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "pattern", .json_type = .string }, .{ .name = "path", .json_type = .string }, }, .required = &.{"pattern"}, }, }; spec.executor_kind = .glob_files; spec.action_label = "Matching"; spec.completed_action_label = "Matched"; spec.label_arg_kind = .pattern; spec.label_arg_default = "pattern"; break :blk spec; }; const test_grep_files = blk: { var spec = test_read_file; spec.name = "grep_files"; spec.description = "Test text search. When to use: exercise registered search projection. When NOT to use: assert product-specific filesystem behavior."; spec.gateway_schema = .{ .name = "grep_files", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "pattern", .json_type = .string }, }, .required = &.{"pattern"}, }, }; spec.executor_kind = .grep_files; spec.activity_kind = .read; spec.requires_approval = false; spec.action_label = "Searching"; spec.completed_action_label = "Searched"; spec.label_arg_kind = .pattern; spec.label_arg_default = "pattern"; spec.permission_target_kind = .path_optional_existing; break :blk spec; }; fn writeTestWebSearchProviderAdvertisement( _: Allocator, writer: *std.Io.Writer, ) tool_dispatch.GatewayAdvertisementError!void { try writer.writeAll("{\"type\":\"provider\",\"id\":\"gateway.perplexity_search\",\"name\":\"perplexity_search\",\"args\":{}}"); } const test_web_fetch = blk: { var spec = test_read_file; spec.name = "web_fetch"; spec.gateway_schema = .{ .name = "web_fetch", .description = spec.description, }; spec.executor_kind = .web_fetch; spec.label_arg_kind = .url; spec.label_arg_default = "url"; spec.permission_target_kind = .none; break :blk spec; }; const test_web_search_base = blk: { var spec = test_web_fetch; spec.name = "web_search"; spec.description = "Test web search guidance."; spec.gateway_schema = .{ .name = "web_search", .description = spec.description, }; spec.executor_kind = .web_search; spec.label_arg_kind = .query; spec.label_arg_default = "web"; break :blk spec; }; const test_web_search = blk: { var spec = test_web_search_base; spec.write_gateway_advertisement_fn = writeTestWebSearchProviderAdvertisement; spec.provider_executed = true; break :blk spec; }; const test_terminal = blk: { var spec = test_read_file; spec.name = "terminal"; spec.description = "Test terminal. When to use: exercise registered terminal projection. When NOT to use: assert product-specific terminal behavior."; spec.gateway_schema = .{ .name = "terminal", .description = spec.description, .input_schema = .{ .properties = &.{ .{ .name = "action", .json_type = .string, .enum_values = &.{"exec"} }, .{ .name = "command", .json_type = .string }, }, .required = &.{ "action", "command" }, .additional_properties = false, }, }; spec.executor_kind = .terminal; spec.activity_kind = .command; spec.requires_approval = true; spec.action_label = "Using terminal"; spec.completed_action_label = "Used terminal"; spec.label_arg_kind = .action; spec.label_arg_default = "session"; spec.permission_target_kind = .none; break :blk spec; }; const test_skill = blk: { var spec = test_read_file; spec.name = "skill"; spec.description = "Test skill. When to use: exercise registered skill projection. When NOT to use: assert product-specific skill loading."; spec.gateway_schema = .{ .name = "skill", .description = spec.description, }; spec.executor_kind = .skill; spec.activity_kind = .read; spec.requires_approval = false; spec.action_label = "Loading skill"; spec.completed_action_label = "Loaded skill"; spec.label_arg_kind = .name; spec.label_arg_default = "skill"; spec.permission_target_kind = .none; break :blk spec; }; const test_install_skill = blk: { var spec = test_skill; spec.name = "install_skill"; spec.description = "Test install skill. When to use: exercise registered write-tool projection. When NOT to use: assert product-specific installation behavior.";