Files
Netcatty/electron/capabilities/scope.test.cjs
T
陈大猫 61a2473a7c feat(capabilities): shared agent capability layer for MCP and CLI (#1616)
* 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>
2026-06-24 13:13:57 +08:00

20 lines
557 B
JavaScript

"use strict";
const test = require("node:test");
const assert = require("node:assert/strict");
const { validateSessionInList, intersectSessionIds } = require("./scope.cjs");
test("validateSessionInList rejects unknown sessions", () => {
const result = validateSessionInList("sess-2", ["sess-1"]);
assert.equal(result.ok, false);
assert.equal(result.code, "SESSION_NOT_IN_SCOPE");
});
test("intersectSessionIds narrows explicit scope", () => {
assert.deepEqual(
intersectSessionIds(["a", "b", "c"], ["b", "c", "d"]),
["b", "c"],
);
});