From 270cd00129551647e7c764a13836e03e0b2dc4e2 Mon Sep 17 00:00:00 2001 From: t Date: Thu, 18 Jun 2026 14:15:55 -0600 Subject: preserve signature origins across compactions --- libpanto-go/panto.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libpanto-go/panto.go') diff --git a/libpanto-go/panto.go b/libpanto-go/panto.go index 95e0cbd..5bfc5d8 100644 --- a/libpanto-go/panto.go +++ b/libpanto-go/panto.go @@ -621,6 +621,25 @@ func (b *MessageBuilder) AddSystem(text string, mode SystemMode) error { return nil } +// SetIdentity attaches the wire identity (provider style/baseURL/model + +// reasoning) that produced this message. This is the per-message source of +// truth for replaying thinking signatures and is preserved through compaction, +// so a kept-verbatim turn is not re-stamped with the compaction model. Prefer +// this over per-block origins on AddThinking when rebuilding a conversation for +// resumption: set it from PersistentMessage's APIStyle/BaseURL/Model and the +// thinking signatures replay correctly without copying the identity onto every +// thinking block. +func (b *MessageBuilder) SetIdentity(style APIStyle, baseURL, model string, reasoning ReasoningEffort) error { + cb := C.CString(baseURL) + defer C.free(unsafe.Pointer(cb)) + cm := C.CString(model) + defer C.free(unsafe.Pointer(cm)) + if C.panto_message_builder_set_identity(b.ptr, C.PantoAPIStyle(style), cb, cm, C.PantoReasoningEffort(reasoning)) != C.PANTO_OK { + return lastError() + } + return nil +} + // Destroy frees an uncommitted builder. Safe to call after AddMessage (no-op). func (b *MessageBuilder) Destroy() { if b != nil && b.ptr != nil { -- cgit v1.3