Removes holder, table, approval, ready, onestatus, pullkey, checks, group_merge, the effects, the forge reads, the teller's and the view's reads, kvOperator, kvPulls, delivery_merge_again and their tests. deliveries, show, groups and stalled answer the records as kept (stalled: a record open past a day, and an act owed unanswered past 15 minutes, read from the record's acts); the switch reads the old section deliveries and says approval-carried for each unperformed merges key. The manifest drops pulls, asks, reads, the forge, teller and view consumes and invokes, and the events group and merged. Builds: design 47 G §172, §431, §592, §593, §613, A-24, A-35 (G-3, G-9, G-16, G-17, G-20) Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
)
|
|
|
|
// --- over the runtime -----------------------------------------------------------------------------------
|
|
|
|
// asking is how a tool is asked: stdio.Ask, or a test's.
|
|
type asking func(key string, body any) (json.RawMessage, error)
|
|
|
|
// answerOf reads a verb's answer whatever wraps it: the controller's {output, ok, answer}, a text the
|
|
// runtime handed over, or the protocol's content list.
|
|
func answerOf(raw json.RawMessage) (json.RawMessage, string, bool) {
|
|
var s string
|
|
if json.Unmarshal(raw, &s) == nil {
|
|
return answerOf(json.RawMessage(s))
|
|
}
|
|
var m map[string]json.RawMessage
|
|
if json.Unmarshal(raw, &m) != nil {
|
|
return raw, string(raw), true
|
|
}
|
|
if content, has := m["content"]; has {
|
|
var items []struct {
|
|
Text string `json:"text"`
|
|
}
|
|
var e struct {
|
|
IsError bool `json:"isError"`
|
|
}
|
|
_ = json.Unmarshal(raw, &e)
|
|
if json.Unmarshal(content, &items) == nil && len(items) > 0 {
|
|
inner, out, ok := answerOf(json.RawMessage(items[0].Text))
|
|
return inner, out, ok && !e.IsError
|
|
}
|
|
}
|
|
var v struct {
|
|
Output string `json:"output"`
|
|
OK *bool `json:"ok"`
|
|
Answer json.RawMessage `json:"answer"`
|
|
}
|
|
if json.Unmarshal(raw, &v) == nil && v.OK != nil {
|
|
return v.Answer, v.Output, *v.OK
|
|
}
|
|
return raw, string(raw), true
|
|
}
|
|
|
|
func lastLine(s string) string {
|
|
lines := strings.Split(strings.TrimSpace(s), "\n")
|
|
return strings.TrimSpace(lines[len(lines)-1])
|
|
}
|