@cloudflare/think@0.10.0
Minor Changes
-
#1770
718634fThanks @threepointone! - Add a runtime CLI:think studioandthink state.think studio [agent] [instance]launches Think Studio — a bundled local web app that connects (over WebSocket) to any running Think instance, local dev server or deployed Worker. Studio provides streaming chat (with tool calls and inline approve/reject forneedsApprovaltools) plus a read-only inspector showing the agent's identity, connection status, live state, recent history, and a turn/recovery status badge. The CLI serves the prebuilt SPA from a tinynode:httpstatic server and opens the browser (--port,--no-open); the browser talks to the agent directly.think state <agent> [instance]prints the agent's identity, live state, and a recent history snapshot (--json,--limit).Both commands share connection flags (
--url,--host,--protocol,--token,--query,--route-prefix,--root), resolve friendly agent ids from the local manifest, and send the token as a query parameter (WebSocket upgrades can't set headers). Chatting in Studio drives a real, persisted turn against the live Durable Object.The Think Vite plugin also registers an
sdev-server shortcut (alongside Vite's built-inr/u/o/c/q) that launches Studio against the runningpnpm devserver. Disable it withstudioShortcut: false. -
#1770
718634fThanks @threepointone! - AddaddMessages()for writing to the transcript without starting a model turn.addMessages(messages, options?)appends (or upserts, via{ mode: "upsert" }) into the Session tree without running inference or entering the turn queue, so it is safe to call from inside a toolexecute. Array entries are appended linearly into one path; appends are idempotent by message id;parentIdcontrols the attach point (latest committed leaf by default,nullfor root, and an unknown id fails fast). This is distinct fromsaveMessages()(which runs a turn) and fromAIChatAgent'spersistMessages()(which replaces/reconciles a flat array). Fixes the Think docs that previously pointed to a nonexistentpersistMessages()on Think.
Patch Changes
-
#1767
f03dee6Thanks @threepointone! - Reduce Think Durable Object SQLite reads during normal wakes and text-only turns.Think now avoids automatic media-eviction scans until hydration has been windowed or an oversized appended message has been observed. The shared resumable stream buffer also avoids per-wake metadata-column introspection by creating new tables with the current columns and lazily migrating legacy tables only when a stream write needs it.
-
Updated dependencies [
718634f]:- create-think@0.1.0