Generic Compression
Strict v1 text compression behind the bundle client.
Purpose
compress.v1 is the backward-compatible generic text-in, summary-out service. The platform owns
the model, prompt, billing, and analytics; bundle code supplies only the text to compact.
Use compress.v2 for typed game-agent, catalyst-agent, or chat-thread
memory that needs explicit retention policy metadata.
Request shape
The creator-facing CompressV1Args shape is exactly { text: string }. The trusted bundle client
adds the current beneficiary user ids and workflow-run identity before invoking the host service:
export async function callCompression(
gameCtx: GameContext,
args: CompressV1Args,
callId: string,
beneficiaryUserIds: readonly string[],
workflowRunId: string
): Promise<CompressV1Result> {
const wireArgs = {
text: args.text,
beneficiaryUserIds,
workflowRunId
};
const invoke = await gameCtx.apiInvoke("compress.v1", wireArgs, {
idempotencyKey: callId
});
if (!invoke.ok) throw new Error(`compress.v1 invoke failed: ${invoke.error}`);
return requireCompressV1Result(invoke.result);
}The client never spreads creator input into the trusted beneficiary or workflow identity fields.
Result
requireCompressV1Result validates the host envelope exactly. Successful calls return compressed
text and measurement metadata. Host failures include an opaque system card and retry disposition;
workflow code receives only the executor's branded failure capability.