feat: upgrade investigation and presentation runtime
Generic Container CI/CD / test-build-publish (push) Successful in 1m6s
Agent CI/CD / build-test-publish-and-deploy (push) Successful in 1m7s

This commit is contained in:
2026-10-30 17:30:19 +08:00
parent 3b52a0ddab
commit 6336157ff4
104 changed files with 6541 additions and 961 deletions
+15
View File
@@ -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");
});
});