mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 20:09:33 +01:00
Give managed agents persistent cryptographic identities (#15352)
Give agents persistent Ed25519 identities encrypted with the existing instance master key. Create keys transactionally for new agents and lazily before supported managed runs, expose public identities in the API and agent UI, and protect private material during runtime delivery and output persistence. Preserve identities in recovery backups while giving imported and development-cloned agents fresh keys. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
d9f600043f
commit
a590ab769d
73 files changed
+2014
-63
No files matched your search
@@ -307,6 +307,16 @@ describe("nativeRunEventsToTranscript", () => {
|
||||
expect(transcript.filter((entry) => entry.kind === "run_terminal")).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("preserves buffered output tails when a native turn ends", () => {
|
||||
const transcript = nativeRunEventsToTranscript([
|
||||
event(1, "item.delta", { itemId: "reasoning-1", kind: "reasoning", text: "Thinking" }),
|
||||
event(2, "turn.completed", { status: "completed", outputTails: [
|
||||
{ itemId: "reasoning-1", payload: { kind: "reasoning", text: "-" } },
|
||||
] }),
|
||||
]);
|
||||
expect(transcript.filter(entry => entry.kind === "thinking").map(entry => "text" in entry ? entry.text : "").join("")).toBe("Thinking-");
|
||||
});
|
||||
|
||||
it("projects provider-neutral messages, tools, usage, and the final reply", () => {
|
||||
const transcript = nativeRunEventsToTranscript([
|
||||
event(6, "run.result.proposed", runResult("Done safely.")),
|
||||
|
||||
@@ -612,6 +612,24 @@ export function nativeRunEventsToTranscript(events: readonly HeartbeatRunEvent[]
|
||||
if (seenSourceEventIds.has(sourceEventId)) return false;
|
||||
seenSourceEventIds.add(sourceEventId);
|
||||
return true;
|
||||
}).flatMap((event) => {
|
||||
const envelope = record(event.payload?.prpEvent);
|
||||
const payload = record(envelope?.payload);
|
||||
if (!envelope || envelope.eventType !== event.eventType
|
||||
|| !/^(item|turn|session)\.(completed|failed|cancelled|interrupted|closed)$/.test(event.eventType)
|
||||
|| !Array.isArray(payload?.outputTails)) return [event];
|
||||
// Redaction can hold a possible key prefix until the item/turn ends.
|
||||
// Project its settled tail as display-only deltas before the terminal.
|
||||
const tails = payload.outputTails.flatMap((value, index): HeartbeatRunEvent[] => {
|
||||
const tail = record(value);
|
||||
const tailPayload = record(tail?.payload);
|
||||
if (!tailPayload || typeof tailPayload.text !== "string") return [];
|
||||
return [{ ...event, eventType: "item.delta", payload: { prpEvent: {
|
||||
...envelope, eventType: "item.delta", itemId: tail?.itemId,
|
||||
sourceEventId: `${envelope.sourceEventId}:output-tail:${index}`, payload: tailPayload,
|
||||
} } }];
|
||||
});
|
||||
return [...tails, event];
|
||||
});
|
||||
const hasAcceptedResult = orderedEvents.some(
|
||||
(event) => event.eventType === "run.result.accepted",
|
||||
|
||||
Reference in new issue
Block a user