feat: upgrade investigation and presentation runtime
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { serviceOpencodeConfig } from "../../src/runtime/opencode2-config.js";
|
||||
import { TASK_READER_AGENT } from "../../src/runtime/task-agent-policy.js";
|
||||
|
||||
describe("OpenCode 2 permissions", () => {
|
||||
it("keeps one-shot recommendations separate from the business chat protocol and denies all tools", async () => {
|
||||
const config = serviceOpencodeConfig({});
|
||||
const generator = config.agents["prompt-suggestions"];
|
||||
expect(generator.system).toBe(await readFile(".opencode/agents/prompt-suggestions.md", "utf8"));
|
||||
expect(generator.system).not.toBe(config.agents.instruction.system);
|
||||
expect(generator.model).toBe(config.agents.instruction.model);
|
||||
expect(generator.permissions).toEqual([{ action: "*", resource: "*", effect: "deny" }]);
|
||||
});
|
||||
it("keeps protected paths denied, shell/edit gated and subagents disabled", async () => {
|
||||
const config = JSON.parse(await readFile("opencode.json", "utf8"));
|
||||
const rules = config.permissions as { action: string; resource: string; effect: string }[];
|
||||
@@ -10,6 +20,7 @@ describe("OpenCode 2 permissions", () => {
|
||||
expect(effect("external_directory", "*")).toBe("deny");
|
||||
expect(effect("subagent", "*")).toBe("deny");
|
||||
expect(effect("question", "*")).toBe("allow");
|
||||
expect(effect("ask_user", "*")).toBe("allow");
|
||||
expect(effect("todowrite", "*")).toBe("allow");
|
||||
for (const action of ["read", "edit"]) {
|
||||
for (const path of [".env", "*.env", "data/**", "**/logs/**"]) expect(effect(action, path)).toBe("deny");
|
||||
@@ -20,4 +31,8 @@ describe("OpenCode 2 permissions", () => {
|
||||
expect(config.permission).toBeUndefined();
|
||||
expect(config.experimental?.continue_loop_on_deny).toBeUndefined();
|
||||
});
|
||||
it("lets each parent subagent call provide the reader prompt", () => {
|
||||
const reader = serviceOpencodeConfig({}).agents[TASK_READER_AGENT];
|
||||
expect(reader).not.toHaveProperty("system");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user