Batch 21 (20261027-A-bos-redo-21) rebuilt 40 of the 53 rejected Bos-qiao environments: hidden assertions that ran inside the candidate's process now run in a trusted parent that reads observations from a low-UID worker; gold bytes are unchanged. 9 were excluded for scope (ROS2, oversize, security core), 3 are blocked because the source requires an exec bit the platform does not freeze, 1 lacks requests/bs4 in trace6. Batch 18 (20261026-C-hwe-codegen-18) adds its last 34 of 134 tasks; the first 100 landed in 2f32624d. Claude reviewed 74/74 USABLE against current digests, canonical families, no ID or source overlap with main, plain public docs. Only the new task directories are taken; the stale pre-batch-20 copies of concur-release-capsule and resource-temp-link on the batch 21 branch and both branches' progress notes stay as main has them. Difficulty is unmeasured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
98 lines
3.5 KiB
C++
98 lines
3.5 KiB
C++
#include "sequence.hpp"
|
|
#include <array>
|
|
#include <iomanip>
|
|
#include <iostream>
|
|
#include <locale>
|
|
#include <memory>
|
|
#include <sstream>
|
|
#include <string>
|
|
class Grouped : public std::numpunct<char> {
|
|
protected:
|
|
char do_thousands_sep() const override { return ','; }
|
|
std::string do_grouping() const override { return "\3"; }
|
|
};
|
|
std::string hex(const std::string& bytes) {
|
|
const char digits[] = "0123456789abcdef";
|
|
std::string output;
|
|
for (unsigned char byte : bytes) {
|
|
output.push_back(digits[byte >> 4]);
|
|
output.push_back(digits[byte & 15]);
|
|
}
|
|
return output;
|
|
}
|
|
std::string unhex(const std::string& text) {
|
|
std::string output;
|
|
if (text == "-") return output;
|
|
for (std::size_t index = 0; index + 1 < text.size(); index += 2) {
|
|
output.push_back(static_cast<char>(std::stoul(text.substr(index, 2), nullptr, 16)));
|
|
}
|
|
return output;
|
|
}
|
|
void state(const sequence::State& value) {
|
|
std::cout << "S " << value.next_ticket;
|
|
for (const auto& rows : value.banks) {
|
|
std::cout << ' ' << rows.size();
|
|
for (const auto& row : rows) std::cout << ' ' << row.key << ' ' << row.payload << ' ' << row.ticket;
|
|
}
|
|
std::cout << '\n';
|
|
}
|
|
int main() {
|
|
std::array<std::unique_ptr<sequence::Engine>, 2> engines;
|
|
for (auto& engine : engines) engine.reset(new sequence::Engine);
|
|
std::string line;
|
|
while (std::getline(std::cin, line)) {
|
|
std::istringstream input(line);
|
|
std::string mode, verb;
|
|
int slot = 0;
|
|
input >> mode >> slot;
|
|
if (mode == "N") {
|
|
engines[slot].reset(new sequence::Engine);
|
|
state(engines[slot]->inspect());
|
|
continue;
|
|
}
|
|
sequence::Engine& engine = *engines[slot];
|
|
if (mode == "C") {
|
|
std::string encoded;
|
|
input >> encoded;
|
|
std::istringstream source(unhex(encoded));
|
|
std::ostringstream output;
|
|
output.imbue(std::locale(std::locale::classic(), new Grouped));
|
|
output << std::hex << std::showbase << std::showpos;
|
|
output.width(19);
|
|
output.fill('@');
|
|
const int code = sequence::run_cli(engine, source, output);
|
|
const std::string bytes = output.str();
|
|
std::cout << "C " << code << ' ' << bytes.size() << ' ' << hex(bytes) << '\n';
|
|
state(engine.inspect());
|
|
continue;
|
|
}
|
|
if (mode == "V") {
|
|
auto copied = engine.inspect();
|
|
copied.next_ticket = -9;
|
|
for (auto& rows : copied.banks) rows.clear();
|
|
state(engine.inspect());
|
|
continue;
|
|
}
|
|
input >> verb;
|
|
std::array<std::int64_t, 4> a{};
|
|
for (auto& argument : a) input >> argument;
|
|
if (verb == "inspect") {
|
|
state(engine.inspect());
|
|
continue;
|
|
}
|
|
sequence::Reply reply;
|
|
if (verb == "reset") reply = engine.reset(a[0]);
|
|
else if (verb == "append") reply = engine.append(a[0], a[1], a[2]);
|
|
else if (verb == "order") reply = engine.order(a[0], a[1]);
|
|
else if (verb == "merge") reply = engine.merge(a[0], a[1], a[2], a[3]);
|
|
else if (verb == "item") reply = engine.item(a[0], a[1]);
|
|
else if (verb == "range") reply = engine.range(a[0], a[1], a[2]);
|
|
else reply = engine.locate(a[0], a[1]);
|
|
std::cout << reply.code << ' ' << reply.values.size();
|
|
for (auto value : reply.values) std::cout << ' ' << value;
|
|
std::cout << '\n';
|
|
state(engine.inspect());
|
|
}
|
|
return 0;
|
|
}
|