把 github.com/Autumn-27/norma v0.4.3(commit 320ae32)的源码复制到 third_party/norma,并用 go.mod 的 replace 指向本地副本。上游删除仓库或 改写 tag 都不再影响本仓库构建。 - 已验证 GOPROXY=off 下可完整编译并打出发行包 - go.sum 中该模块的两条校验记录随之删除(本地 replace 不需要哈希) - 升级方法与授权注意事项见 third_party/README.md
20 lines
537 B
Go
20 lines
537 B
Go
package transcript
|
|
|
|
import "context"
|
|
|
|
type ctxKey int
|
|
|
|
const sessionIDKey ctxKey = 0
|
|
|
|
// WithSessionID carries the active session id on the context so subagents can
|
|
// write their sidechain under the parent session's directory.
|
|
func WithSessionID(ctx context.Context, sessionID string) context.Context {
|
|
return context.WithValue(ctx, sessionIDKey, sessionID)
|
|
}
|
|
|
|
// SessionIDFrom returns the session id carried on ctx, or "" if none.
|
|
func SessionIDFrom(ctx context.Context) string {
|
|
v, _ := ctx.Value(sessionIDKey).(string)
|
|
return v
|
|
}
|