import io

p = r'C:\Users\decid\Documents\projects\spt-claude-code\adapter\claude-spt.toml'
s = io.open(p, encoding='utf-8').read()
NL = chr(10)


def sub(a, b, n=1):
    global s
    assert s.count(a) == n, 'anchor count %d for %r' % (s.count(a), a[:70])
    s = s.replace(a, b, n)


sub('version = "0.34.0"', 'version = "0.35.0"')
sub('min_spt_core_version = "0.64.0"', 'min_spt_core_version = "0.66.0"')

old = '''# So we hold: `tag_scan` stays the only parser, mid-turn dispatch keeps working, and compliance is
# declared in a follow-up release once spt-releases#238 (mid-turn IO frames) lands. Absent `[io]`
# compliance, core parsing nothing is exactly what makes that wait free.
#
# What DOES ship here is the other half of the funnel: the USER_INPUT payload at `state busy`
# (REQ-IO-USER-INPUT-PAYLOAD), so both ingest edges are published for IO consumers now and the
# compliance flip becomes a one-line change rather than a behavioural one.
#'''

new = '''# So we held: `tag_scan` stayed the only parser, mid-turn dispatch kept working, and compliance was
# to be declared in a follow-up release once spt-releases#238 (mid-turn IO frames) landed. Absent
# `[io]` compliance, core parsing nothing is exactly what made that wait free.
#
# 2026-08-29 — #238 LANDED in spt-core v0.66.0, and the hold is now spent rather than overruled: it
# named its own expiry and that expiry arrived. `spt api state busy <id> --payload-stdin --mid`
# publishes a MID-TURN AGENT_OUTPUT span, so the 12.5% is recoverable and the reason for holding is
# gone. The floor moves to 0.66.0 with this release for that flag.
#
# COMPLIANCE IS STILL NOT DECLARED HERE, and the sequencing is the point rather than caution. This
# release (v0.35.0) ships the spans and the disjointness fix they require with `[io]` ABSENT, so
# core still parses nothing of our ingest. The reason is that the exactly-once discipline the spans
# are subject to — "spt-core does not deduplicate and never will... Overlap is not refused; it is
# delivered twice" — has a cost that is NOT constant across the migration: with compliance off an
# overlap is a duplicated record, visible in `spt api io-events` and harmless; with it on, the same
# overlap is a duplicate MESSAGE DELIVERED TO A PEER, discovered by the recipient rather than by us.
# Shipping both at once would put the first field test of disjointness on the far side of the flip
# that makes a mistake externally visible. So: spans first, verified with core's own instrument,
# then the flip and the parser deletion together in the release after (REQ-HAZARD-IO-SPAN-OVERLAP).
#
# What ALSO ships here is the other half of the funnel: the USER_INPUT payload at `state busy`
# (REQ-IO-USER-INPUT-PAYLOAD), so both ingest edges are published for IO consumers now and the
# compliance flip becomes a one-line change rather than a behavioural one.
#'''

sub(old, new)
io.open(p, 'w', encoding='utf-8', newline=NL).write(s)
print('manifest: 0.35.0, floor 0.66.0, io comment amended')
