Add tool permission sandbox and audit stream
- Tool interface declares required permissions via requires field - scoped-context builds a least-privileged ToolContext per call - ToolAuditLogger appends each tool invocation to a Garnet stream - Operations CLI gains tool-audit:list and tool-audit:show commands - All onboarding and moderation tools annotated with explicit requires
This commit is contained in:
1 parent
21df14cd00
commit
d011a2829c
15 files changed
+625
-3
No files matched your search
@@ -4,6 +4,8 @@ import {
|
||||
formatReviewList,
|
||||
formatReviewShow,
|
||||
formatReviewStats,
|
||||
formatToolAuditList,
|
||||
formatToolAuditShow,
|
||||
} from "./cli.js";
|
||||
|
||||
describe("operations review CLI formatters", () => {
|
||||
@@ -81,4 +83,25 @@ describe("operations review CLI formatters", () => {
|
||||
}),
|
||||
).toContain("low-confidence\ttotal=3\tpending=1\tresolved=2");
|
||||
});
|
||||
|
||||
it("formats tool audit rows", () => {
|
||||
const entry = {
|
||||
argsHash: "abc123",
|
||||
calledAt: "2026-05-18T00:00:00.000Z",
|
||||
chatroomId: "room-1",
|
||||
durationMs: 12,
|
||||
id: "1-0",
|
||||
ok: true,
|
||||
resultSummary: "{\"ok\":true}",
|
||||
skill: "onboarding",
|
||||
toolName: "validate-nickname",
|
||||
type: "tool-call" as const,
|
||||
userId: "user-1",
|
||||
};
|
||||
|
||||
expect(formatToolAuditList([entry])).toContain(
|
||||
"1-0\t2026-05-18T00:00:00.000Z\tonboarding\tvalidate-nickname\tyes\t12",
|
||||
);
|
||||
expect(formatToolAuditShow(entry)).toContain("argsHash: abc123");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user