mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-12 09:24:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
545bba1783 | ||
|
|
2d83553e3c |
No files matched your search
@@ -22,9 +22,39 @@
|
||||
WriteRegStr SHCTX "Software\Classes\Directory\Background\shell\Netcatty" "MUIVerb" "Open in Netcatty"
|
||||
WriteRegStr SHCTX "Software\Classes\Directory\Background\shell\Netcatty" "Icon" "$INSTDIR\${APP_EXECUTABLE_FILENAME},0"
|
||||
WriteRegStr SHCTX "Software\Classes\Directory\Background\shell\Netcatty\command" "" '"$INSTDIR\${APP_EXECUTABLE_FILENAME}" -- --open-terminal-path="%V."'
|
||||
|
||||
; #4204: Windows Default Apps requires Capabilities/RegisteredApplications
|
||||
; to list URL handlers; Electron's bare scheme keys are not sufficient.
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.SSH" "" "URL:ssh Protocol"
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.SSH" "URL Protocol" ""
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.SSH\DefaultIcon" "" '"$INSTDIR\${APP_EXECUTABLE_FILENAME}",0'
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.SSH\shell\open\command" "" '"$INSTDIR\${APP_EXECUTABLE_FILENAME}" "%1"'
|
||||
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.Telnet" "" "URL:telnet Protocol"
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.Telnet" "URL Protocol" ""
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.Telnet\DefaultIcon" "" '"$INSTDIR\${APP_EXECUTABLE_FILENAME}",0'
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.Telnet\shell\open\command" "" '"$INSTDIR\${APP_EXECUTABLE_FILENAME}" "%1"'
|
||||
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.JMS" "" "URL:jms Protocol"
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.JMS" "URL Protocol" ""
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.JMS\DefaultIcon" "" '"$INSTDIR\${APP_EXECUTABLE_FILENAME}",0'
|
||||
WriteRegStr SHCTX "Software\Classes\Netcatty.JMS\shell\open\command" "" '"$INSTDIR\${APP_EXECUTABLE_FILENAME}" "%1"'
|
||||
|
||||
WriteRegStr SHCTX "Software\Netcatty\Capabilities" "ApplicationName" "Netcatty"
|
||||
WriteRegStr SHCTX "Software\Netcatty\Capabilities" "ApplicationDescription" "Open SSH, Telnet and JMS links in Netcatty."
|
||||
WriteRegStr SHCTX "Software\Netcatty\Capabilities" "ApplicationIcon" '"$INSTDIR\${APP_EXECUTABLE_FILENAME}",0'
|
||||
WriteRegStr SHCTX "Software\Netcatty\Capabilities\URLAssociations" "ssh" "Netcatty.SSH"
|
||||
WriteRegStr SHCTX "Software\Netcatty\Capabilities\URLAssociations" "telnet" "Netcatty.Telnet"
|
||||
WriteRegStr SHCTX "Software\Netcatty\Capabilities\URLAssociations" "jms" "Netcatty.JMS"
|
||||
WriteRegStr SHCTX "Software\RegisteredApplications" "Netcatty" "Software\Netcatty\Capabilities"
|
||||
!macroend
|
||||
|
||||
!macro customUnInstall
|
||||
DeleteRegKey SHCTX "Software\Classes\Directory\shell\Netcatty"
|
||||
DeleteRegKey SHCTX "Software\Classes\Directory\Background\shell\Netcatty"
|
||||
DeleteRegKey SHCTX "Software\Classes\Netcatty.SSH"
|
||||
DeleteRegKey SHCTX "Software\Classes\Netcatty.Telnet"
|
||||
DeleteRegKey SHCTX "Software\Classes\Netcatty.JMS"
|
||||
DeleteRegKey SHCTX "Software\Netcatty\Capabilities"
|
||||
DeleteRegValue SHCTX "Software\RegisteredApplications" "Netcatty"
|
||||
!macroend
|
||||
@@ -24,21 +24,6 @@ const UI_DISALLOWED_TOOLS = ["AskUserQuestion"];
|
||||
const MCP_MODE_TOOLS = [];
|
||||
const SKILLS_MODE_TOOLS = ["Bash"];
|
||||
|
||||
// Deduped built-in catalog from @tencent-ai/agent-sdk 0.3.258 cli/product.json.
|
||||
const CODEBUDDY_BUILTIN_TOOLS = [
|
||||
"Agent", "Bash", "PowerShell", "Glob", "Grep", "Read", "Edit", "Write",
|
||||
"NotebookEdit", "WebFetch", "ListMcpResources", "ReadMcpResource", "WaitForMcpServers",
|
||||
"TaskCreate", "TaskGet", "TaskUpdate", "TaskList", "WebSearch", "EnterPlanMode",
|
||||
"ExitPlanMode", "KillShell", "TaskStop", "TaskOutput", "SlashCommand", "Skill",
|
||||
"SkillManage", "AskUserQuestion", "AskUserForStructuredInput", "LSP", "StructuredOutput",
|
||||
"ToolSearch", "DeferExecuteTool", "ImageGen", "ImageEdit", "VideoGen", "Artifact",
|
||||
"ArtifactControl", "ComputerUse", "TeamCreate", "TeamDelete", "SendMessage",
|
||||
"SendUserMessage", "EnterWorktree", "LeaveWorktree", "CronCreate", "CronDelete",
|
||||
"CronList", "DelegateTool", "WeChatReply", "WeComReply", "PushNotification",
|
||||
"ReportFindings", "Workflow", "Monitor", "REPL", "A2AGetAgentCard", "A2ASendMessage",
|
||||
"A2AGetTask", "A2ACancelTask",
|
||||
];
|
||||
|
||||
const CODEBUDDY_IMAGE_MEDIA_TYPES = new Set(["image/jpeg", "image/png", "image/gif", "image/webp"]);
|
||||
|
||||
function isCodebuddyImageAttachment(attachment) {
|
||||
@@ -276,19 +261,18 @@ function buildCodebuddyQueryOptions({
|
||||
allowDangerouslySkipPermissions: true,
|
||||
extraArgs: { "dangerously-skip-permissions": null },
|
||||
mcpServers: toSdkMcpServers(injectedMcpServers),
|
||||
// Block built-ins explicitly in mcp mode: tools: [] becomes --tools "",
|
||||
// which also hides injected MCP tools in CodeBuddy CLI v2.183.0.
|
||||
// Leave allowedTools unset: an empty auto-approval list prevents MCP tool
|
||||
// calls from running under bypassPermissions.
|
||||
disallowedTools: builtinTools.length > 0
|
||||
? [...UI_DISALLOWED_TOOLS]
|
||||
: [...new Set([...UI_DISALLOWED_TOOLS, ...CODEBUDDY_BUILTIN_TOOLS])],
|
||||
tools: builtinTools,
|
||||
// `tools` is the built-in tool whitelist. In mcp mode it is [], so CodeBuddy
|
||||
// built-ins stay disabled while injected Netcatty MCP tools remain visible.
|
||||
// Do not mirror that empty list into allowedTools: the SDK treats
|
||||
// allowedTools as an auto-approval list, and allowedTools: [] prevents MCP
|
||||
// tool calls from running under bypassPermissions.
|
||||
disallowedTools: [...UI_DISALLOWED_TOOLS],
|
||||
// Keep the SDK isolated from user/project settings so local hooks, plugins,
|
||||
// or extra MCP servers cannot expand Netcatty's controlled tool boundary.
|
||||
settingSources: [],
|
||||
env,
|
||||
};
|
||||
if (builtinTools.length > 0) options.tools = builtinTools;
|
||||
const selection = splitCodebuddyModelSelection(model);
|
||||
if (selection.model) options.model = selection.model;
|
||||
if (abortController) options.abortController = abortController;
|
||||
|
||||
@@ -59,51 +59,15 @@ test("buildCodebuddyQueryOptions wires SDK options in isolated mode", () => {
|
||||
assert.equal(opts.pathToCodebuddyCode, "/opt/codebuddy/bin/codebuddy");
|
||||
assert.equal(opts.abortController, ac);
|
||||
assert.equal(opts.resume, "sess-1");
|
||||
assert.ok(!("tools" in opts));
|
||||
assert.deepEqual(opts.tools, []);
|
||||
// allowedTools must stay unset in mcp mode: tools:[] disables built-ins, while
|
||||
// allowedTools:[] would prevent injected Netcatty MCP tools from running.
|
||||
assert.ok(!("allowedTools" in opts));
|
||||
assert.ok(opts.disallowedTools.includes("Bash"));
|
||||
assert.ok(opts.disallowedTools.includes("AskUserQuestion"));
|
||||
assert.equal(opts.mcpServers["netcatty-remote-hosts"].type, "stdio");
|
||||
assert.deepEqual(opts.mcpServers["netcatty-remote-hosts"].env, { NETCATTY_MCP_PORT: "1" });
|
||||
});
|
||||
|
||||
test("mcp and default mode block built-ins while preserving injected MCP servers", () => {
|
||||
for (const toolIntegrationMode of ["mcp", undefined]) {
|
||||
const opts = buildCodebuddyQueryOptions({
|
||||
toolIntegrationMode,
|
||||
injectedMcpServers: [{ name: "netcatty", command: "/abs/electron" }],
|
||||
});
|
||||
assert.ok(!("tools" in opts));
|
||||
assert.ok(!("allowedTools" in opts));
|
||||
assert.equal(opts.permissionMode, "bypassPermissions");
|
||||
for (const name of ["Bash", "PowerShell", "Read", "Edit", "Write", "Agent", "Skill", "AskUserQuestion"]) {
|
||||
assert.ok(opts.disallowedTools.includes(name), `${name} must stay disabled`);
|
||||
}
|
||||
assert.equal(opts.mcpServers.netcatty.command, "/abs/electron");
|
||||
}
|
||||
});
|
||||
|
||||
test("mcp mode omits --tools under the SDK serialization rule", () => {
|
||||
for (const toolIntegrationMode of ["mcp", undefined]) {
|
||||
const opts = buildCodebuddyQueryOptions({ toolIntegrationMode });
|
||||
const args = [];
|
||||
// @tencent-ai/agent-sdk lib/transport/process-transport.js
|
||||
if (opts.tools !== undefined) {
|
||||
args.push("--tools", opts.tools.join(","));
|
||||
}
|
||||
assert.deepEqual(args, []);
|
||||
}
|
||||
});
|
||||
|
||||
test("skills mode keeps the Bash whitelist and UI exclusions", () => {
|
||||
const opts = buildCodebuddyQueryOptions({ toolIntegrationMode: "skills" });
|
||||
assert.deepEqual(opts.tools, ["Bash"]);
|
||||
assert.deepEqual(opts.disallowedTools, ["AskUserQuestion"]);
|
||||
assert.ok(!opts.disallowedTools.includes("Bash"));
|
||||
assert.ok(!("allowedTools" in opts));
|
||||
});
|
||||
|
||||
test("built-in tools are mode-aware", () => {
|
||||
assert.deepEqual(codebuddyBuiltinTools("mcp"), []);
|
||||
assert.deepEqual(codebuddyBuiltinTools(undefined), []);
|
||||
|
||||
Reference in new issue
Block a user