Skip to main content

Module request_id

Module request_id 

Source
Expand description

Request ID generator for outbound control_request frames.

Shape: forge_<counter>_<hex8> (e.g. forge_42_3a9f2b0e). The forge_ prefix lets stream-json logs distinguish forge-sdk-originated requests from CLI-originated ones at a glance. The CLI treats request IDs as opaque - it only echoes them back in the matching control_response - so the prefix has no wire-protocol effect.

Re-exports§

use std::sync::atomic::AtomicBool; 🔒
use std::sync::atomic::AtomicU64; 🔒
use std::sync::atomic::Ordering; 🔒

Constants§

HANDOFF_PROMPT_PREFIX
The prefix next_handoff_prompt_id mints under, shared so a reader matching the procedure row and the mint cannot drift apart.

Statics§

COUNTER 🔒

Functions§

mint 🔒
The mint itself: <prefix>_<counter>_<hex8>, with the counter-derived suffix standing in when the entropy source is unreachable.
next
Generate a new opaque request id in the shape forge_<counter>_<hex8>. The 8-hex (4 bytes) suffix is random. Falls back to counter bytes if getrandom fails - surfaces a one-shot tracing::warn! so a sandboxed runtime where the entropy source is unreachable (chroot without /dev/urandom, seccomp filter, etc.) is visible to log readers without breaking ID generation.
next_forged_prompt_id
Generate a new prompt id for a prompt forge’s own machinery dispatches: a chase nudge, a browser warning, a kick, an auto-continue.
next_handoff_prompt_id
Generate a prompt id for the handoff’s procedure turn: the judgment prompt forge itself writes, which asks the handing-over session to run the handoff skill.
next_prompt_id
Generate a new prompt id in the shape forge_prompt_<counter>_<hex8>.