返回 DeepSeek-Reasonix
dto_intercept.go
根目录 / internal / extension / protocol / dto_intercept.go
1 package protocol
2
3 import "encoding/json"
4
5 // Intercept DTOs: the blocking hook call. The host waits up to
6 // TimeoutMillis; a late answer is an intercept_timeout error and the host
7 // proceeds with its default behavior.
8
9 // InterceptParams asks the extension to rule on one intercepted event. Seq
10 // is the host's monotonic intercept sequence for this session so both peers
11 // can detect drops and reordering. When Payload exceeds ExternalizeFieldBytes
12 // it travels as null and Externalized carries its content-ref descriptor.
13 type InterceptParams struct {
14 Event InterceptEvent `json:"event"`
15 Seq uint64 `json:"seq" validate:"min=1"`
16 Payload json.RawMessage `json:"payload" externalizable:"true"`
17 TimeoutMillis int `json:"timeoutMillis" validate:"min=0"`
18 Externalized []ExternalizedField `json:"externalized,omitempty"`
19 }
20
21 // InterceptResult is the extension's ruling. Replacement carries the new
22 // payload when Decision is "replace" and is absent otherwise; when the
23 // replacement exceeds ExternalizeFieldBytes it travels as null and
24 // Externalized carries its content-ref descriptor instead.
25 type InterceptResult struct {
26 Decision InterceptDecision `json:"decision"`
27 Reason string `json:"reason,omitempty"`
28 Replacement json.RawMessage `json:"replacement,omitempty" externalizable:"true"`
29 Externalized []ExternalizedField `json:"externalized,omitempty"`
30 }
31
31 lines GO