@@ -24,8 +24,6 @@ import (
2424)
2525
2626// ExecuteResultHook groups execution callbacks.
27- // Eid is only assigned for stdout/stderr on run command (pipe tail) and run-in-session (bash stdout pipe);
28- // other paths pass eid=0. Ids are allocated in runtime at pipe sync, not in HTTP/SSE writers.
2927type ExecuteResultHook struct {
3028 OnExecuteInit func (context string )
3129 OnExecuteResult func (result map [string ]any , count int )
@@ -48,20 +46,16 @@ type ExecuteCodeRequest struct {
4846 Gid * uint32 `json:"gid,omitempty"`
4947 Hooks ExecuteResultHook
5048
51- // eventSeq assigns monotonic eids (1-based) for stdout/stderr on run command and bash session only.
5249 eventSeq atomic.Uint64
5350}
5451
55- // nextStdoutStderrEventID returns the next eid for stdout/stderr lines. Used only from run command
56- // pipe tailers and bash session stdout; other callers should pass 0 into OnExecuteStdout/Stderr.
5752func (req * ExecuteCodeRequest ) nextStdoutStderrEventID () int64 {
5853 if req == nil {
5954 return 0
6055 }
6156 return int64 (req .eventSeq .Add (1 ))
6257}
6358
64- // wrapStdoutPipeHook wraps stdout delivery so eid is assigned when a line is flushed from the pipe tailer, not in SSE writes.
6559func (req * ExecuteCodeRequest ) wrapStdoutPipeHook () func (string ) {
6660 return func (text string ) {
6761 if text == "" || req .Hooks .OnExecuteStdout == nil {
@@ -72,7 +66,6 @@ func (req *ExecuteCodeRequest) wrapStdoutPipeHook() func(string) {
7266 }
7367}
7468
75- // wrapStderrPipeHook wraps stderr delivery so eid is assigned when a line is flushed from the pipe tailer, not in SSE writes.
7669func (req * ExecuteCodeRequest ) wrapStderrPipeHook () func (string ) {
7770 return func (text string ) {
7871 if text == "" || req .Hooks .OnExecuteStderr == nil {
0 commit comments