源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
package runtimeprep
|
||||
|
||||
import "strings"
|
||||
|
||||
// Consume a complete multiline TOML assignment so replacing one session
|
||||
// setting cannot leave continuation lines from the previous value behind.
|
||||
func codexConfigAssignmentEndLine(lines []string, startIndex int) int {
|
||||
if startIndex < 0 || startIndex >= len(lines) {
|
||||
return startIndex
|
||||
}
|
||||
_, value, ok := strings.Cut(lines[startIndex], "=")
|
||||
if !ok {
|
||||
return startIndex
|
||||
}
|
||||
trimmedValue := strings.TrimSpace(value)
|
||||
for _, delimiter := range []string{`"""`, `'''`} {
|
||||
if !strings.HasPrefix(trimmedValue, delimiter) {
|
||||
continue
|
||||
}
|
||||
if strings.Contains(strings.TrimPrefix(trimmedValue, delimiter), delimiter) {
|
||||
return startIndex
|
||||
}
|
||||
for index := startIndex + 1; index < len(lines); index++ {
|
||||
if strings.Contains(lines[index], delimiter) {
|
||||
return index
|
||||
}
|
||||
}
|
||||
return startIndex
|
||||
}
|
||||
depth := tomlSquareBracketDelta(value) + tomlCurlyBracketDelta(value)
|
||||
if depth <= 0 {
|
||||
return startIndex
|
||||
}
|
||||
for index := startIndex + 1; index < len(lines); index++ {
|
||||
depth += tomlSquareBracketDelta(lines[index]) + tomlCurlyBracketDelta(lines[index])
|
||||
if depth <= 0 {
|
||||
return index
|
||||
}
|
||||
}
|
||||
return startIndex
|
||||
}
|
||||
|
||||
func tomlCurlyBracketDelta(line string) int {
|
||||
return tomlBracketDelta(line, '{', '}')
|
||||
}
|
||||
|
||||
func tomlSquareBracketDelta(line string) int {
|
||||
return tomlBracketDelta(line, '[', ']')
|
||||
}
|
||||
|
||||
func tomlBracketDelta(line string, open rune, close rune) int {
|
||||
depth := 0
|
||||
escaped := false
|
||||
quote := rune(0)
|
||||
for _, char := range line {
|
||||
switch quote {
|
||||
case '"':
|
||||
if escaped {
|
||||
escaped = false
|
||||
continue
|
||||
}
|
||||
if char == '\\' {
|
||||
escaped = true
|
||||
continue
|
||||
}
|
||||
if char == '"' {
|
||||
quote = 0
|
||||
}
|
||||
continue
|
||||
case '\'':
|
||||
if char == '\'' {
|
||||
quote = 0
|
||||
}
|
||||
continue
|
||||
}
|
||||
switch char {
|
||||
case '#':
|
||||
return depth
|
||||
case '"', '\'':
|
||||
quote = char
|
||||
case open:
|
||||
depth++
|
||||
case close:
|
||||
depth--
|
||||
}
|
||||
}
|
||||
return depth
|
||||
}
|
||||
Reference in New Issue
Block a user