mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-17 04:50:52 +00:00
* feat(capabilities): add shared agent capability layer for MCP and CLI Introduce a registry-driven capability foundation so terminal, SFTP, vault, and port-forward tools can be extended from one policy and surface definition. Wire mcpServerBridge permission checks and the Skills CLI RPC client through the shared layer without changing existing AI runtime behavior. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(capabilities): restore SFTP cancel gating and home RPC timeout Match legacy mcpServerBridge behavior by blocking SFTP write RPCs after chat cancel and treating sftp/home as a long-running operation for timeout budget calculation. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
"use strict";
|
|
|
|
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
|
|
const { createRegistryDispatcher } = require("./dispatch.cjs");
|
|
const { CAPABILITY_SURFACES } = require("./constants.cjs");
|
|
|
|
test("createRegistryDispatcher routes implemented capabilities to handlers", async () => {
|
|
const calls = [];
|
|
const dispatch = createRegistryDispatcher({
|
|
surface: CAPABILITY_SURFACES.BUILTIN,
|
|
handlers: {
|
|
"meta.status": async (params) => ({ ok: true, params }),
|
|
},
|
|
fallback: async (method) => ({ ok: false, error: `unknown:${method}` }),
|
|
});
|
|
|
|
const result = await dispatch("netcatty/getStatus", { chatSessionId: "chat-1" });
|
|
assert.equal(result.ok, true);
|
|
assert.equal(result.params.chatSessionId, "chat-1");
|
|
assert.equal(calls.length, 0);
|
|
});
|
|
|
|
test("createRegistryDispatcher returns not-implemented for planned capabilities", async () => {
|
|
const dispatch = createRegistryDispatcher({
|
|
surface: CAPABILITY_SURFACES.GLOBAL,
|
|
handlers: {},
|
|
fallback: async (method) => ({ ok: false, error: `unknown:${method}` }),
|
|
});
|
|
|
|
const result = await dispatch("vault/host/notes/get", { hostId: "host-1" });
|
|
assert.equal(result.ok, false);
|
|
assert.equal(result.code, "CAPABILITY_NOT_IMPLEMENTED");
|
|
});
|
|
|
|
test("createRegistryDispatcher falls back for unknown rpc methods", async () => {
|
|
const dispatch = createRegistryDispatcher({
|
|
surface: CAPABILITY_SURFACES.BUILTIN,
|
|
handlers: {},
|
|
fallback: async (method) => ({ ok: false, error: `unknown:${method}` }),
|
|
});
|
|
|
|
const result = await dispatch("auth/verify", { token: "abc" });
|
|
assert.equal(result.error, "unknown:auth/verify");
|
|
});
|