Documentation
¶
Overview ¶
Package runtimecontext supplies an optional, process-scoped request context.
Index ¶
Constants ¶
const ( HeaderName = requestmeta.DingTalkExtHeader PayloadVersion = runtimepayload.PayloadVersion Environment = "online" )
const MaxAgentJSONBytes = 256 * 1024
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentSnapshot ¶
type AgentSnapshot struct {
State State `json:"state"`
ErrorCode int32 `json:"error_code"`
ErrorCategory string `json:"error_category,omitempty"`
AgentID int64 `json:"agent_id"`
OS string `json:"os,omitempty"`
ExecutionMode string `json:"execution_mode,omitempty"`
// contains filtered or unexported fields
}
AgentSnapshot is a process-scoped value, separate from the existing agentcode. The SDK object stays private; JSON returns a defensive copy for telemetry only.
func AgentSnapshotForTest ¶
func AgentSnapshotForTest(raw []byte, code int32) AgentSnapshot
AgentSnapshotForTest supplies a parsed SDK object to cross-package tests.
func ResolveAgent ¶
func ResolveAgent() AgentSnapshot
ResolveAgent collects full_info=0 in the original CLI process once. Timeout publishes a final snapshot; a late native result is released and discarded.
func (AgentSnapshot) GoString ¶
func (a AgentSnapshot) GoString() string
func (AgentSnapshot) JSON ¶
func (a AgentSnapshot) JSON() json.RawMessage
func (AgentSnapshot) String ¶
func (a AgentSnapshot) String() string
type Result ¶
type Result struct {
State State `json:"state"`
PayloadVersion string `json:"payload_version"`
Environment string `json:"environment"`
Elapsed time.Duration `json:"-"`
ErrorCategory string `json:"error_category,omitempty"`
// contains filtered or unexported fields
}
Result is the immutable process result. Sensitive values stay private and cannot be serialized or formatted accidentally.
func ReadyResultForTest ¶
ReadyResultForTest constructs a ready result for cross-package tests. Production code must obtain Result values from Resolve.
func Resolve ¶
func Resolve() Result
Resolve initializes and returns the process-scoped context. It never retries: every caller observes the same immutable outcome.
func ResultWithAgentForTest ¶
ResultWithAgentForTest exercises request assembly without loading the SDK.
func (Result) AttachToURL ¶
AttachToURL attaches the private runtime value to a login authorization URL. The URL may be opened in a browser or shown as a manual login link. Callers must never send it to diagnostic logs or persist it as application state.
func (Result) DiagnosticDetail ¶
DiagnosticDetail returns redacted, stable diagnostic fields.
func (Result) HeaderValue ¶
HeaderValue composes independent UMID and Agent results into a bounded header. Missing or failed Agent collection is represented by the integer agent_id=0.