Skip to content

ThinkWatch Core 0.75.0

Choose a tag to compare

@github-actions github-actions released this 16 Oct 11:42
· 50 commits to main since this release

This release gives plugins a set of helpers for common edits and lets a hook change the object it receives without returning it. It also makes the dangerous-command check and placeholder restoring look at every choice of an answer, not only the first.

Upgrade notes

  • The control-plane protocol version stays at 48; ThinkWatch Lite releases that include 0.74.0 connect to 0.75.0 and the other way round.
  • The request store's schema and the configuration are unchanged; nothing is cleared.
  • Plugins: a hook that changes the request (onRequest) or the tool call (onToolCall) it receives and returns nothing now applies those changes. They used to be dropped unless the hook returned the object.
  • The two built-in plugins are rewritten with the helpers and behave as before. Copies whose code was not edited are updated.
  • For crates that embed the gateway: tw_plugin::Reply::on_text and on_text_end take the text block's lane, and the sandbox guest ABI is tw_abi_2. The public API of tw_guard is unchanged.

Plugin helpers. Plugins have a global tw:

  • tw.appendSystem(req, text) adds a line to the end of the system prompt unless it is already there.
  • tw.texts(req, fn) passes each piece of editable text (system prompt, message text, tool results) to fn and replaces it with what fn returns.
  • tw.toolCalls(req, fn) passes each earlier tool call in the conversation to fn; tw.mapStrings(value, fn) copies a value with every string mapped.
  • tw.replace(text, rules) applies [find, replacement] rules in one left-to-right pass: strings match literally, regular expressions match globally, the rule listed first wins at a position, replaced text is not scanned again, and placeholders are never matched or split.
  • tw.streamReplace(rules) returns onReplyText and onReplyTextEnd for stream mode. The streamed result equals tw.replace on the whole block; it holds back only what could still become a match (with regular expressions, the last 256 characters by default).
  • tw.lines and tw.pairs read multi-line settings.

The helpers are plain JavaScript in the sandbox snapshot, with no new host imports; their results are checked like any other plugin result.

Every choice of an answer is checked. In a streamed Chat Completions answer the dangerous-command check read only the first element of choices in each frame, and Gemini answers only their first candidate. An upstream could get a tool call past the check by placing it in a second choice, or by spreading its arguments across two choices. Every choice and candidate is now checked, and streamed Chat arguments are assembled both by choice index and by position in the frame, matching both ways clients read them. Placeholders in a streamed answer with several choices are restored per choice.

Reply plugins

  • A stream-mode plugin that cut a placeholder in two left the placeholder text in the answer instead of the original value. The unfinished half is now held and restored together with the next piece.
  • A stream-mode plugin that failed and was skipped could lose the text it was holding (when it failed in onReplyTextEnd) or release it out of order (when it failed in another text block). Both are fixed.
  • Answers with several choices (n greater than 1, candidateCount greater than 1) mixed the choices' text and tool calls in plugins, and only the first choice of a whole answer went through them. Each choice is now kept apart, and every choice goes through the plugins.
  • A stream-mode plugin that holds text back without changing it is no longer recorded as having changed the text; the run record compares each block as a whole.

Dependencies: wasmtime 49.0.3 and rustls 0.23.46 (RustSec advisories).

Downloads

Platform Binary Archive for server installation
Linux, x86_64 twcore-x86_64-unknown-linux-gnu twcore-x86_64-unknown-linux-gnu.tar.gz
Linux, aarch64 twcore-aarch64-unknown-linux-gnu twcore-aarch64-unknown-linux-gnu.tar.gz
macOS, Apple silicon twcore-aarch64-apple-darwin —
Windows, x64 twcore-x86_64-pc-windows-msvc.exe —
Windows, ARM64 twcore-aarch64-pc-windows-msvc.exe —

Each file is published with a .sha256 file beside it. A Linux archive contains twcore, the systemd unit twcore.service and LICENSE. ThinkWatch Lite includes its own copy of twcore; the files here are for running core separately, such as on a server.

Server installation

On Linux (x86_64 or aarch64), the install script sets up twcore as a systemd service. This installs 0.75.0:

curl -fsSL https://raw.githubusercontent.com/ThinkWatchProject/ThinkWatch-Core/main/scripts/install.sh | sudo sh -s -- --version 0.75.0

An installation made with the script switches to 0.75.0 with:

sudo twcore upgrade --version 0.75.0 --restart

Configuration, the remote control port and connecting ThinkWatch Lite are described in docs/server.md.

Verifying a download

A .sha256 file holds the SHA-256 of the file followed by its name. With both files in the current directory, on Linux:

sha256sum -c twcore-x86_64-unknown-linux-gnu.tar.gz.sha256

On macOS:

shasum -a 256 -c twcore-aarch64-apple-darwin.sha256

On Windows, in PowerShell, the following prints True when the binary matches:

(Get-FileHash .\twcore-x86_64-pc-windows-msvc.exe).Hash -eq (Get-Content .\twcore-x86_64-pc-windows-msvc.exe.sha256).Split()[0]

The install script and twcore upgrade check the SHA-256 themselves.

What's Changed

  • Bump wasmtime to 49.0.3 and rustls to 0.23.46 (RustSec advisories) by @fylorn in #339
  • Restore a placeholder a stream-mode reply plugin splits in two by @fylorn in #340
  • Reply plugins: keep each choice of an n > 1 answer apart by @fylorn in #342
  • Guard: inspect and restore every choice of an n > 1 answer by @fylorn in #343
  • v0.75.0: plugin helpers (tw), in-place edits that count, per-block streaming by @fylorn in #341

Full Changelog: v0.74.0...v0.75.0