feat(ai-profiles): add plugin profile SDK and Cline demo (#342)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
52
scripts/check-agent-process-limits.mjs
Normal file
52
scripts/check-agent-process-limits.mjs
Normal file
@ -0,0 +1,52 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { validatePluginManifest } from "../dist/index.js";
|
||||
|
||||
function valid(args, env) {
|
||||
return validatePluginManifest({
|
||||
ideaPluginManifestVersion: 1, id: "test.limits", displayName: "Limits", version: "1.0.0",
|
||||
main: "dist/index.js", trustLevel: "full", contributes: { agentAdapters: [{
|
||||
id: "adapter", displayName: "Adapter", protocol: "idea-agent-session", protocolVersion: 1,
|
||||
command: "bin/adapter", args, env,
|
||||
configSchema: { type: "object", properties: {}, additionalProperties: false },
|
||||
}] },
|
||||
}).success;
|
||||
}
|
||||
const environment = (count, value) => Object.fromEntries(Array.from({ length: count }, (_, i) => [`FIELD_${i}`, value]));
|
||||
|
||||
test("argv count 128 inclusive", () => {
|
||||
assert.equal(valid(Array(128).fill("x"), {}), true);
|
||||
assert.equal(valid(Array(129).fill("x"), {}), false);
|
||||
});
|
||||
test("argv token 4096 UTF8 bytes inclusive", () => {
|
||||
assert.equal(valid(["é".repeat(2048)], {}), true);
|
||||
assert.equal(valid(["é".repeat(2048) + "a"], {}), false);
|
||||
});
|
||||
test("argv aggregate includes terminators", () => {
|
||||
const args = Array(8).fill("x".repeat(4095));
|
||||
assert.equal(valid(args, {}), true);
|
||||
args[0] += "x";
|
||||
assert.equal(valid(args, {}), false);
|
||||
});
|
||||
test("environment count 64 inclusive", () => {
|
||||
assert.equal(valid([], environment(64, "x")), true);
|
||||
assert.equal(valid([], environment(65, "x")), false);
|
||||
});
|
||||
test("environment name 128 bytes inclusive", () => {
|
||||
assert.equal(valid([], { ["A".repeat(128)]: "x" }), true);
|
||||
assert.equal(valid([], { ["A".repeat(129)]: "x" }), false);
|
||||
});
|
||||
test("environment value 4096 UTF8 bytes inclusive", () => {
|
||||
assert.equal(valid([], { FIELD: "é".repeat(2048) }), true);
|
||||
assert.equal(valid([], { FIELD: "é".repeat(2048) + "a" }), false);
|
||||
});
|
||||
test("environment aggregate includes equals and terminators", () => {
|
||||
const env = environment(8, "x".repeat(4087));
|
||||
assert.equal(valid([], env), true);
|
||||
env.FIELD_0 += "x";
|
||||
assert.equal(valid([], env), false);
|
||||
});
|
||||
test("NUL cannot be truncated in argv or env", () => {
|
||||
assert.equal(valid(["x\0y"], {}), false);
|
||||
assert.equal(valid([], { FIELD: "x\0y" }), false);
|
||||
});
|
||||
Reference in New Issue
Block a user