mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-27 19:35:13 +01:00
chore: update MCP access branch onto master (PAP-10797)
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
8bb16a93db
commit
e9cb8e2b28
37 files changed
+6939
-329
No files matched your search
@@ -3,6 +3,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import type { TranscriptEntry } from "../../adapters";
|
||||
import type { ToolRunDecision } from "@paperclipai/shared";
|
||||
import { ThemeProvider } from "../../context/ThemeContext";
|
||||
import { RunTranscriptView, normalizeTranscript } from "./RunTranscriptView";
|
||||
|
||||
@@ -111,6 +112,103 @@ describe("RunTranscriptView", () => {
|
||||
expect(html).not.toContain("result");
|
||||
});
|
||||
|
||||
it("links tool rows to pending governed action decisions", () => {
|
||||
const invocationId = "11111111-1111-4111-8111-111111111111";
|
||||
const actionRequestId = "22222222-2222-4222-8222-222222222222";
|
||||
const decision: ToolRunDecision = {
|
||||
invocation: {
|
||||
id: invocationId,
|
||||
companyId: "company-1",
|
||||
idempotencyKey: null,
|
||||
actorType: "agent",
|
||||
actorId: "agent-1",
|
||||
agentId: "agent-1",
|
||||
issueId: "issue-1",
|
||||
runId: "run-1",
|
||||
applicationId: null,
|
||||
connectionId: null,
|
||||
catalogEntryId: null,
|
||||
toolName: "send_email",
|
||||
argumentsHash: "hash-1",
|
||||
argumentsSummary: { summary: "{\"to\":\"redacted\"}" },
|
||||
policyDecision: "require_approval",
|
||||
matchedPolicyIds: [],
|
||||
approvalState: "pending",
|
||||
status: "awaiting_approval",
|
||||
upstreamRequestId: null,
|
||||
resultHash: null,
|
||||
resultSummary: null,
|
||||
resultSizeBytes: null,
|
||||
resultArtifactId: null,
|
||||
errorCode: null,
|
||||
errorMessage: null,
|
||||
startedAt: null,
|
||||
completedAt: null,
|
||||
createdAt: new Date("2026-03-12T00:00:00.000Z"),
|
||||
updatedAt: new Date("2026-03-12T00:00:00.000Z"),
|
||||
},
|
||||
actionRequest: {
|
||||
id: actionRequestId,
|
||||
companyId: "company-1",
|
||||
invocationId,
|
||||
issueId: "issue-1",
|
||||
interactionId: "33333333-3333-4333-8333-333333333333",
|
||||
approvalId: null,
|
||||
status: "pending",
|
||||
canonicalArgumentsHash: "hash-1",
|
||||
canonicalArgumentsSummary: { summary: "{\"to\":\"redacted\"}" },
|
||||
signedArguments: null,
|
||||
previewMarkdown: "Tool: `send_email`",
|
||||
requestedByAgentId: "agent-1",
|
||||
requestedByUserId: null,
|
||||
resolvedByAgentId: null,
|
||||
resolvedByUserId: null,
|
||||
decidedByAgentId: null,
|
||||
decidedByUserId: null,
|
||||
decidedAt: null,
|
||||
expiresAt: null,
|
||||
resolvedAt: null,
|
||||
createdAt: new Date("2026-03-12T00:00:00.000Z"),
|
||||
updatedAt: new Date("2026-03-12T00:00:00.000Z"),
|
||||
},
|
||||
auditEvents: [],
|
||||
latestAuditEvent: null,
|
||||
decision: "require_approval",
|
||||
outcome: "pending",
|
||||
reasonCode: "requires_approval_policy",
|
||||
denialReason: null,
|
||||
pendingAction: {
|
||||
actionRequestId,
|
||||
issueId: "issue-1",
|
||||
interactionId: "33333333-3333-4333-8333-333333333333",
|
||||
approvalId: null,
|
||||
status: "pending",
|
||||
previewMarkdown: "Tool: `send_email`",
|
||||
},
|
||||
};
|
||||
|
||||
const html = renderToStaticMarkup(
|
||||
<ThemeProvider>
|
||||
<RunTranscriptView
|
||||
density="compact"
|
||||
entries={[
|
||||
{
|
||||
kind: "tool_call",
|
||||
ts: "2026-03-12T00:00:00.000Z",
|
||||
name: "send_email",
|
||||
invocationId,
|
||||
input: { to: "redacted@example.com" },
|
||||
},
|
||||
]}
|
||||
toolDecisions={[decision]}
|
||||
/>
|
||||
</ThemeProvider>,
|
||||
);
|
||||
|
||||
expect(html).toContain("Needs approval");
|
||||
expect(html).toContain(`Action request ${actionRequestId.slice(0, 8)}`);
|
||||
});
|
||||
|
||||
it("windows large raw transcripts instead of rendering every entry at once", () => {
|
||||
const entries: TranscriptEntry[] = Array.from({ length: 500 }, (_, index) => ({
|
||||
kind: "stdout",
|
||||
|
||||
Reference in new issue
Block a user