Download src/plugin-sdk/test-helpers/agents/transcript-repair-runtime-contract.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 1.9 kB
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/plugin-sdk/test-helpers/agents/transcript-repair-runtime-contract.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/plugin-sdk/test-helpers/agents/transcript-repair-runtime-contract.ts
-
curl -L -o transcript-repair-runtime-contract.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/plugin-sdk/test-helpers/agents/transcript-repair-runtime-contract.ts
1.9 kB
| // Transcript repair runtime contract helpers build agent transcript repair fixtures. | |
| import type { AgentMessage } from "../../../agents/runtime/index.js"; | |
| export const QUEUED_USER_MESSAGE_MARKER = | |
| "[Queued user message from a previous active turn; preserved as context only. " + | |
| "Continue with the active prompt below.]"; | |
| export function textOrphanLeaf(text = "older active-turn message"): { content: string } { | |
| return { content: text }; | |
| } | |
| export function structuredOrphanLeaf(): { content: unknown[] } { | |
| return { | |
| content: [ | |
| { type: "text", text: "please inspect this" }, | |
| { type: "image_url", image_url: { url: "https://example.test/cat.png" } }, | |
| { type: "input_audio", audio_url: "https://example.test/cat.wav" }, | |
| ], | |
| }; | |
| } | |
| export function inlineDataUriOrphanLeaf(): { content: unknown[] } { | |
| return { | |
| content: [ | |
| { type: "text", text: "please inspect this inline image" }, | |
| { type: "image_url", image_url: { url: `data:image/png;base64,${"a".repeat(4096)}` } }, | |
| ], | |
| }; | |
| } | |
| export function mediaOnlyHistoryMessage(): AgentMessage { | |
| return { | |
| role: "user", | |
| content: [{ type: "image", data: "b".repeat(2048), mimeType: "image/png" }], | |
| timestamp: 1, | |
| } as AgentMessage; | |
| } | |
| export function structuredHistoryMessage(): AgentMessage { | |
| return { | |
| role: "user", | |
| content: [ | |
| { type: "text", text: "older structured context" }, | |
| { type: "image", data: "c".repeat(64), mimeType: "image/png" }, | |
| ], | |
| timestamp: 1, | |
| } as AgentMessage; | |
| } | |
| export function currentPromptHistoryMessage(prompt: string): AgentMessage { | |
| return { | |
| role: "user", | |
| content: [{ type: "text", text: prompt }], | |
| timestamp: 2, | |
| } as AgentMessage; | |
| } | |
| export function assistantHistoryMessage(text = "ack"): AgentMessage { | |
| return { | |
| role: "assistant", | |
| content: [{ type: "text", text }], | |
| timestamp: 2, | |
| } as AgentMessage; | |
| } | |