A lightweight application for coding-agent backends. OTK's Deno core composes reusable kit modules, serves the browser UI and distributes a small live session index. Opencode 1.x is the current backend; its native implementation converts content into OTK shapes and owns history/database queries.
The 0.1.0-beta.2 Linux release ships one executable and a systemd user unit. Connect it to an already-running opencode server on the same machine, under the same user. Tested with opencode 1.18.34, 1.18.35 and 1.19.3; intermediate versions have not each been tested. OTK does not start opencode.
Choose one AUR package:
| # | Package | Source |
|---|---|---|
| 1 | otk-bin |
Prebuilt release executable |
| 2 | otk |
Versioned source, compiled during installation |
| 3 | otk-git |
Latest Git source, compiled during installation |
For example, yay -S otk-bin. All three install /usr/bin/otk and
otk.service. Source builds need Deno; the installed executable does not.
Download the matching otk-0.1.0-beta.2-<arch>-linux.tar.zst and SHA256SUMS
from the
GitHub release.
Choose x86_64 or aarch64 on a glibc-based Linux system with systemd. Verify
and extract the download (x86_64 example):
sha256sum --check --ignore-missing SHA256SUMS
mkdir otk-release
tar -xf otk-0.1.0-beta.2-x86_64-linux.tar.zst -C otk-release
cd otk-release
sha256sum --check SHA256SUMS
sudo install -m755 otk /usr/bin/otk
sudo install -Dm644 otk.service /usr/lib/systemd/user/otk.serviceThe tarball also includes LICENSE, THIRD-PARTY-NOTICES.md, this README and
otk.toml.example. It needs no source checkout, separately installed Deno or
dependency downloads at runtime. To build from source, use the shared
compile recipe.
Create the private operator config (use $XDG_CONFIG_HOME/otk/otk.toml instead
if you set XDG_CONFIG_HOME):
install -dm700 ~/.config/otk
touch ~/.config/otk/otk.toml
chmod 600 ~/.config/otk/otk.tomlEnter your backend settings in ~/.config/otk/otk.toml:
[server]
host = "127.0.0.1"
port = 1502
[harness]
url = "http://127.0.0.1:4097"
username = "opencode"
password = "" # Set to your opencode server's Basic auth password, if enabled.Replace the URL and credentials with those of your existing server. An empty
password disables Basic auth; these are opencode credentials, separate from
OTK's browser login. OTK_HARNESS_URL, OTK_HARNESS_USERNAME and
OTK_HARNESS_PASSWORD override the same settings. If opencode uses a
non-default data directory, also set harness.db (or OTK_HARNESS_DB) to its
existing opencode.db; the default is $XDG_DATA_HOME/opencode/opencode.db,
falling back to ~/.local/share/opencode/opencode.db.
Keep OTK bound to localhost only. server.host = "127.0.0.1" is the shipped
default; its environment override is OTK_SERVER_HOST. Do not expose it to your
LAN or the Internet. The security report flags
WebSocket origin checks,
DNS rebinding,
TOTP guessing and
Basic credential forwarding.
The terminal branch checks Origin on every API WebSocket upgrade, addressing
finding 1's route-specific gap. The other findings remain open and unverified.
Loopback reduces exposure; it does not fix those findings.
Start OTK, then open http://127.0.0.1:1502/:
systemctl --user daemon-reload
systemctl --user enable --now otk.serviceOn first run, choose Password, enter a username and password, and select
Set up OTK. Setup signs this browser in; other browsers log in with those
credentials. Setup also offers None, which disables OTK login. Password
setup saves a PBKDF2 hash and a generated signing key in private auth.toml in
OTK's state directory. Usernames are case-insensitive. After login, the project
list and Sessions view show your opencode sessions. The index includes all
sessions; the recent-background priority horizon defaults to 30 days.
TOTP is configured in the operator file, not the setup form. After password
setup, add this to ~/.config/otk/otk.toml and restart OTK:
[auth]
type = "totp"
totpkey = "replace-with-a-private-random-text-key"The existing username, password hash and signing key remain in auth.toml.
Enroll the base32 encoding of the UTF-8 text in totpkey in your
authenticator (six digits, 30-second interval). There is no QR/enrollment
screen. At login, append the current six-digit code directly to your password,
with no space. The equivalent overrides are OTK_AUTH_TYPE and
OTK_AUTH_TOTPKEY.
Config layers, operator-file precedence and all keys are documented in
the defaults, also shipped as otk.toml.example.
OTK_CONFIG selects an explicit operator file. Unknown keys and invalid types
stop startup. Keep credential files private. The executable can also run in the
foreground as otk.
Stop the old OTK process normally before replacing it. For the packaged service,
run systemctl --user stop otk.service. Back up the entire OTK state directory
and operator config while OTK is stopped, including auth.toml, otk.db and
any remaining otk.db-wal/otk.db-shm as one consistent set. The default state
directory is ~/.local/state/otk/1502; honor your configured XDG/state path and
port. Do not copy only a live database file and leave its WAL behind.
Install beta.2 through your chosen channel, then run:
systemctl --user daemon-reload
systemctl --user restart otk.serviceReload browser tabs for protocol 17. User-data session references migrate
atomically to opcv1- ids, retaining task order, preferences/layout,
seen/finish marks and approval history. New receipt storage and a tasks index
are applied through feature migrations; there is no historical receipt backfill.
The digest backfills in the background, showing Digesting… alongside usable
metadata and live activity. New config leaves come from the complete defaults;
explicit operator/environment overrides win and neither operator nor auth files
are rewritten. Never delete otk.db, recreate tasks or edit ids by hand to
upgrade. Downgrade after id migration is unsupported; restore the consistent
pre-upgrade state/config backup together with beta.1 if you need to return to
it.
Before uninstalling, run systemctl --user disable --now otk.service. Removing
the executable and unit preserves your user config and state.
harness.type = "auto" now discovers the local opencode V2 service through
$XDG_STATE_HOME/opencode/service.json (or
~/.local/state/opencode/service.json). OTK never starts or owns that service.
A missing registration permits fallback to the configured V1 URL; a broken
registration or bad credentials does not. Explicit opencode-v1 keeps the
existing V1 adapter and URL/auth settings. Explicit opencode-v2-server
requires local service discovery, with no remote URL/password settings. The V2
client is pinned to 2.2.6; other 2.x versions warn. This branch's V2 foundation
is qualified separately from parity areas as they are added; see
packages/harness-opencode-v2-server/README.md.
The adapter/package is now opencode-v1 / @otk/harness-opencode-v1.
harness.type = "opencode1" remains a deprecated config alias and logs a
message asking you to use opencode-v1; OTK does not rewrite your operator
file. Environment overrides retain precedence.
Session IDs are now opcv1-<native id> throughout the API and browser, using
wire protocol 17. An older browser is rejected with a protocol mismatch and must
reload. Old bare-ID bookmarks show a compatibility notice; choose the session
again from Sessions or its task to obtain the canonical URL.
Before backend startup, existing otk.db task membership, seen/finish marks,
approval references/journal and saved project locations migrate together in one
transaction. A conflicting task membership stops startup with the database
unchanged. The upgrade is repeat-safe and preserves unrelated metadata; a
downgrade to beta.1 after this migration is unsupported. Back up your OTK state
before upgrading if you need to retain a beta.1 installation.
Session and turn summaries now come from a background worker's independent
digest.db beside otk.db. It contains rebuildable metadata, never transcripts
or tool bodies. Rows, the context meter and reply footers use the complete
index; only opening a usage breakdown reads the call ledger. Incomplete
reconciliation shows Digesting… and unreported usage stays unavailable
rather than zero. The [digest] defaults document batching, scheduling and
resource bounds.
The catalog includes sessions of every age. index.days is a background
digestion priority horizon, never a history filter. otk.db holds user state
and metadata-only action receipts; digest.db holds rebuildable derived
metadata. Neither is an archive of messages, prompt recall or attachment bytes.
Rebuilding a removed digest file preserves user state; deleting provider history
leaves no recoverable transcript, recall text or attachment data in OTK storage.
Agents, connected models, commands, skills, resources and files share complete
directory catalogs across session visits. Completion and agent cycling filter
locally; opening a picker does not refresh it. Explicit Refresh and native
invalidations replace complete values, retaining last-good values while
preparing or unavailable. Configuration follows what opencode reports until its
native instance reloads; OTK never forces disposal or watches configuration
files. Only demanded file discovery watches the project tree. Recall loads on
intent, reads provider data anew and resolves selected attachment bytes in
batches by their originating server. The complete defaults document
[catalogs], [attachments] and storage.busyms admission policy.
Transcripts open with the newest ten native messages and continue through opaque
provider cursors, ten at a time. Each page includes session metadata and the
latest visible prompt's agent/model/variant even when that prompt is outside the
page, preserving composer context and Undo. Content clocks align page snapshots
with live changes. Replay is bounded by [messages] configuration; a lost or
overflowed baseline shows “Refreshing messages…” and reacquires a provider page.
No transcript content is persisted in OTK's databases.
Actions and reads now use accepted, pending and correlated result events. A
disconnected browser resumes the same intent rather than repeating its effect;
elapsed liveness intervals report connection state, not a failed action. Durable
metadata receipts live in otk.db, without request bodies or credentials. Local
mutations commit atomically with their receipts; an unconfirmed native effect
remains pending for reconciliation instead of being sent again. Bootstrap
login/setup/discovery use receipt-authorized HTTP events before the
authenticated socket is available. The [requests], [connection] and
harness.requestms defaults describe admission, retention, liveness and native
read policy.
The request-event contract describes intent identity, native uncertain outcomes, receipt retention, backup/upgrade behavior and the source/compiled/browser qualification paths.
Metadata bootstrap completion does not restart an already-current transcript. Real native reconnect, instance disposal and revert-boundary changes carry an ordered invalidation version, so duplicate or delayed notices cannot discard a newer page or turn breakdown. Digest work yields execution while waiting for credit, I/O admission or locks and between bounded catalog chunks.
Message bodies are shared by server/session identity across selection, scope and
attention demand. The active task (including its helpers), or the ungrouped
project, warms each session's newest ten plus the next ten through a four-read
per-server browser queue. Recently left scopes keep their visited pages for five
minutes after interaction. An attention edge warms its scope for thirty seconds
without selecting or marking it seen. Cooling cancels body work and releases
bodies while preserving metadata, lights and unsent drafts. The [messages]
coolms, preloadms and concurrency leaves configure these thresholds; page
size and the ten-message reserve remain product contracts.
Live body changes now update indexed message/part/reply projections rather than regrouping acquired history. A usage breakdown requests only its complete turn, retains unreported categories as unknown, and releases its call/pricing state on close. Copy reply acquires missing steps through the same cursor owner before writing complete source to the clipboard.
Transcripts and Timeline render measured windows of acquired content, including segments inside long replies and lines inside large diffs. The ten-message reserve is fetched data, not hidden transcript DOM. Focus, selections and open surfaces pin their source identities; Select all in a focused transcript first materializes its acquired range. Timeline reveals acquire missing pages through the same resource before positioning and focusing the prompt. Collapsing a work log, reasoning or tool destroys its expensive body while retaining the explicit disclosure choice. Source-bearing highlight caches follow the transcript's warm lifetime and are released on cooling, even while another session uses the worker.
Helper cards borrow background-digested progress. Parent pages never wait for a
child history scan, and child activity never rereads parent messages. Progress
shows “Preparing progress…” or “Progress unavailable” until authoritative counts
are available; a ready empty helper reports zero. These rebuildable scalar
summaries upgrade only digest.db, preserving user data in otk.db.
Lost stream seeds now take one bounded HTTP checkpoint, not repeated reads per
delta. An HTTP body remains replacement-only and may be stale; “Refreshing
response…” stays beside its reply until a full native event or terminal
checkpoint supplies final authority. Failed checkpoints offer Retry response.
The [messages] recovery admission leaves bound concurrent reads and pending
identities without changing native request deadlines.
Deleting a native session retains its last metadata and task membership as a tombstone. Select its struck-through row to see details, copy its title, remove it from its task or close its view. An external deletion retains unsent browser input; normal navigation still asks before releasing unsaved editor/attention input. A reappearing native identity becomes live again under the same session ID. Enabled auto-approve policy is retired on deletion and is not restored.
| # | Area | Behavior |
|---|---|---|
| 1 | Opencode database | Opens the existing SQLite database read-only, including live WAL-backed history. It does not migrate or write opencode's DB/WAL. |
| 2 | Opencode API | Reads health, global events, session/status metadata and pending permissions/questions; opening a session reads its content and related resources. Startup does not wake idle projects' native instances. |
| 3 | Actions | Sends mutations only for actions you request, such as prompts, session creation, interrupts and permission/question replies. Auto-approve is off by default; explicitly enabling it authorizes ongoing Allow once replies for that session and its helpers, even with no browser open. |
| 4 | OTK state | Writes its own auth.toml and otk.db (preferences, inbox/task metadata and approval policy/journal) under $XDG_STATE_HOME/otk/1502 or ~/.local/state/otk/1502. The final component follows the configured port; state.path / OTK_STATE_PATH overrides it. |
| 5 | Project templates | Lists direct directory candidates and reads small Git marker files to exclude linked worktrees. No writes, Git commands or recursive repository walk. |
| # | Area | Missing or limited |
|---|---|---|
| 2 | M5 B: transcript | Whole-transcript copy/export. Existing selection Copy remains available. |
| 3 | M5 C: status dialogs | MCP, LSP, formatter, provider-connect and plugin management/status dialogs. |
| 4 | M5 D: stash | Prompt stash management. Unsent browser drafts are retained separately. |
| 5 | M5 E: changes | Full changes/diff viewer; inline tool diffs already render. |
| 6 | M5 F: navigation | Quick session switcher. Use the project's Sessions view. |
| 7 | Automatic recovery | No automatic continue, retry limits or fallback-provider recovery for provider errors. Permission auto-approve is a separate feature. |
| 8 | Stock opencode 1.18.x permission inventory | Observed on 1.18.34: a pending websearch request omitting optional livecrawl makes GET /permission return 400 (Expected JSON value, got undefined). An OTK adapter starting in that state can remain reconnecting without an index or pending-request inventory. Resolve the request in opencode; OTK cannot recover its missing identity from that response. This case has not been requalified on newer versions. |
| 9 | Security | Ten scanner findings, six medium and four low, remain open and unverified. Keep OTK bound to localhost. |
Click the terminal icon beside Attach to open a terminal box above the composer.
It shares the composer's width and takes up to two thirds of the screen height;
Expand uses the same dialog size as Edit prompt. Use + for another shell and
the tabs to switch. Hide terminal (or the composer icon) hides the box without
stopping shells; a tab's X terminates that terminal. Collapse returns an
expanded terminal to the dock without reconnecting it. Escape goes to the
terminal.
Terminals belong to the session's checkout directory, including a worktree, and are shared by sessions in that checkout. Each records the session that created it. Select output and choose Add to prompt in the header or context menu to insert a fenced text chip into the session being viewed, without the clipboard.
A foreground program is a running dependency: its owner's task (or ungrouped phantom tab) and project get an orange Running in terminal (N) light unless higher-priority attention applies. The session's own light is unchanged. An idle shell or exited program does not count; background jobs do not count while the shell remains foreground. Foreground names cannot distinguish a same-named nested shell from its original shell. Counts refresh about every two seconds, even with the terminal box hidden. Deleting or archiving the owner session does not stop its terminals; orphaned running terminals still count for the checkout.
Shells run as the OTK operating-system user, with that user's filesystem and
process permissions, not in a sandbox or behind an opencode permission prompt.
They inherit OTK's environment except OTK_* and service-notification variables
(OTK_TERMINAL=1 is added); other environment secrets may remain accessible.
With login disabled on a LAN address, anyone able to reach OTK from an allowed
origin can run commands as that user. Keep the listener on localhost and enable
login; Origin checks are not authentication or protection against DNS rebinding.
The bundled opencode-pty daemon keeps shells across a clean OTK restart if OTK
returns within 120 seconds. A crash or expired handoff ends them. On reload,
complete raw replay restores both normal and full-screen output; after the 2 MiB
raw buffer is exceeded, the checkpoint restores only the active screen, losing
the normal screen underneath a full-screen program. Width changes can also let
Bash redraw erase rows above a wrapped prompt. Observer resize reconciliation is
not fully qualified. Browser-reserved shortcuts still belong to the browser, and
the pinned renderer emits no ContextMenu key bytes.
The visible tab and three recently viewed tabs stay attached; older tabs detach without stopping their shells. Terminal lists refresh on local actions and reconnection, not through cross-browser live list synchronization. Box visibility is browser-memory state, not persisted. Linux glibc is the supported daemon target; this pilot qualifies x86_64, not aarch64, Windows, macOS or musl.
If needed, stop all owned terminal daemons with
systemctl --user stop 'otk-pty-*'; without systemd, stop the daemon PID
recorded in its service.json under OTK's state terminals/pty/ directory.
This stops all their shells and is an escape hatch, not routine cleanup.
The production Solid UI merges projects across connected servers into an inbox.
Each project has an always-visible roll-up light, unread name and visit clock;
the column collapses to a status-light rail that keeps Search in place above the
project lights. Activity restores inactive projects. Discovered projects follow
tracked projects: session-index directories have activity lights; template-only
directories have none. Their persisted disclosure keeps working, blocked and
unseen-finished projects visible even when collapsed. Templates default to
~/Projects/{project} and exclude linked Git worktrees. Viewing discovery does
not track it; creating a session or interacting with one does. Add servers and
path templates in Settings; Add project creates an initial session. The centre
provides ordered task tabs, always-visible active-session phantom tabs and a
single replaceable session preview. Pin, double-click or send in a phantom to
make a task. Tasks share one row equally down to 90px, then scroll sideways.
Wheel over the strip to scroll; edge triangles page with the last fully visible
tab becoming the first (mirrored going back). Selection and resizing keep the
active tab in view. Tasks follow attention priority, then newest activity. Task
breadcrumbs switch sessions and their helpers in one measured row with their own
More menu; the selected or editing chip stays in place. The meter shows reported
token usage and whole-session reported cost. The collapsible right panel hosts
feature-registered views; its collapsed rail keeps their icons available and
clicking an icon opens that view. Sessions shows the selected project's
task-grouped parent/child tree with status lights and title search. Switching
projects restores the last session and its task tab, including after reload;
missing or closed sessions fall back to the default project session. Click to
preview or double-click to make a task. Panel width (280–480px) and selected
view persist with its collapsed state per user. Close session in the context
menu or palette releases task membership and the view while keeping the session
in Sessions and the backend. Closing a helper returns to its parent. Working,
blocked and unseen-finished sessions retain a phantom tab until idle and seen,
with an explanation before closing. Open a session to stream its transcript,
send prompts, or press Esc twice to interrupt. Recently visited message bodies
remain warm until their scope cools. Web assets and fonts are bundled locally;
no dev server or CDN is used.
Text fields retain the browser's native context menu for spelling corrections and dictionary lookup, including ContextMenu and Shift+F10. Elsewhere right click opens OTK's menu; Shift + right click keeps the native menu. Selection Copy outside fields remains available in OTK's menu.
Right click a session tab, breadcrumb or Sessions row to Rename in place, Fork
session or Delete. Delete asks for a second press and stops active work first;
Close session keeps the backend session. Compact is available for the shown root
session and uses its next-prompt model. Hover or focus a prompt for Revert to
here and Copy, or a completed reply for Fork from here and Copy. Forks open
through the chosen reply with an empty composer; their files are shared with the
original. Revert rolls back files and conversation using opencode's native
semantics, without confirmation. The joined composer strip lists rolled-back
prompts and files and offers Restore before the next native commit; Compact also
commits the rollback. When the server provides prompt history, Revert stages
immediately and OTK prepares the retained earlier branch, exact
prompts/attachments and draft in bounded background pages. The next committing
action waits for the copy in this browser's localStorage. Unrevert stays
available after sending and opens that read-only earlier branch inside the
session, with prompt reuse and explicit Delete. It survives reloads in this
browser, not clearing browser data or changing origin. Native deleted messages
and files are not restored. Storage is about 5 MB per origin; a failed save
reports what was not saved and prevents the committing action, not reversible
Revert or Restore, without deleting older branches. A server without prompt
history still supports Revert and Send; the rollback strip warns before sending
that this earlier branch cannot be kept. Edited drafts are retained alongside
saved drafts with an explicit choice before replacement. Undo previous prompt
and Redo are in the palette and available as /undo and /redo; Undo can
interrupt active work. Recalled content never overwrites an edited draft.
Timeline in the right panel lists the loaded prompts chronologically: click to
scroll and focus a prompt, use the same Revert/Copy actions, or Load earlier
prompts to page the transcript.
Pending permissions for the open session and its descendants take over the composer. Allow once, confirm the displayed future grant patterns for Allow always, or reject with optional feedback. Child requests retain their originating title. Questions use the same composer area and an Answer action. Background permission notifications show the same exact command, file targets and requested scope as the approval takeover, before Allow once is used. Each session retains its unsent browser draft across takeovers, session/tab switches and history navigation. The browser title follows the selected project and session.
The composer's Auto-approve shield toggles server-owned permission replies for
that session and its helpers. It is off by default, persists in otk.db and
continues with no browser open; each request receives Allow once, not a
permanent backend grant. Its state is shown only in the composer footer. The
Activity panel records manual and automatic replies, their exact targets and
confirmed, failed or unconfirmed outcomes. The command palette and
Ctrl/Cmd+Shift+A expose the same session toggle. While linked, pending covered
requests show a quiet Auto-approving status instead of asking the browser for a
competing reply. Helpers inherit policy; only the parent session can enable it.
Deleting a session removes its saved policy.
Transcript prose, code, diffs and the rounded composer share a centred 46rem
lane. User messages are right-aligned bubbles without role labels. Expandable
work-log folds hold compact tool rows and thinking lines; file targets are
project-relative and a single edit's diff sits directly below its row. One
metadata line per reply shows reported agent/model/timing and charged turn
model-call count, tokens and cost. One timing owner computes recorded busy time
minus waits. Work-log headers show their own segment's working time, or plain
Work log when its clocks are unproven; reply footers retain the turn total, or
Time unknown with its recorded explanation. Hover or focus usage for an ordered
model-call table with tool labels, full prompt Context, New input,
output/reasoning/cache tokens, reported cost and call time. Context is New input
plus Cache read and Cache write; its Total sums every call's prompt. The Total
row retains model-priced category costs without counting Context twice in
charged tokens. Long-run detail keeps a compact overview visible above
internally scrolling calls, with pinned column headers and Total. Context bars
compare each prompt to the turn's peak; narrow windows scroll columns while
retaining call identity. Hover/focus detail replaces the native usage tooltip.
Every cost uses two decimals, with positive amounts below one cent shown as
<$0.01 and $0.00 reserved for actual zero. Exact amounts remain accessible
without a native tooltip. Display's Show cost toggle hides cost figures while
keeping tokens. Tool summaries expand to the existing renderers; file changes
start collapsed with their path and reported change counts in the header.
Display's Expand file changes by default toggle restores expanded defaults;
helper cards start expanded. Typed tool cards show bash output,
read/search/fetch/skill operations, file diffs and diagnostics, todos, read-only
questions and subagent progress. Click a task to open its child; the subagent
bar returns to the parent or cycles siblings. Child sessions are read-only. Code
highlighting runs in a shared Shiki worker with on-demand grammars; cooling
releases each session's source while other live content can retain the worker.
The Display menu persists preferences in the serving sidecar's otk.db and
updates other connected tabs. Reverted turns appear in the joined composer
strip.
Pasted or dropped images appear once as thumbnail attachment chips, separate from prompt text. Image-only prompts can be sent directly. Sent images render as transcript thumbnails; click one to open its original in the shared image dialog. Other files retain their file chips. Editing prompt text preserves independent image attachments until they are explicitly removed or sent.
| # | Setting | Environment variable | Shipped value |
|---|---|---|---|
| 1 | Listener | OTK_SERVER_HOST, OTK_SERVER_PORT |
127.0.0.1, 1502 |
| 2 | Additional browser origins | OTK_SERVER_ORIGINS |
Empty list |
| 3 | Authentication | OTK_AUTH_TYPE |
First-run setup; none, password, totp |
| 4 | Credentials | OTK_AUTH_USERNAME, OTK_AUTH_PASSWORD |
Empty; setup stores PBKDF2 hash |
| 5 | JWT / TOTP keys | OTK_AUTH_SECRETKEY, OTK_AUTH_TOTPKEY |
Empty; setup generates JWT key |
| 6 | State directory | OTK_STATE_PATH |
$XDG_STATE_HOME/otk/<port> or ~/.local/state/otk/<port> |
| 7 | Harness URL | OTK_HARNESS_URL |
http://127.0.0.1:4097 |
| 8 | Harness Basic auth | OTK_HARNESS_USERNAME, OTK_HARNESS_PASSWORD |
opencode, empty password |
| 9 | Harness database | OTK_HARNESS_DB |
$XDG_DATA_HOME/opencode/opencode.db or ~/.local/share/opencode/opencode.db |
| 10 | Heartbeat timeout / reconnect ceiling | OTK_HARNESS_HEARTBEATTIMEOUT, OTK_HARNESS_RECONNECTMAX |
25 / 30 seconds |
| 11 | Recent-background priority horizon | OTK_INDEX_DAYS |
30 days; older sessions remain indexed |
API endpoints live under /api/; everything else is static UI. Authentication
uses server-set HttpOnly cookies. Browser mutations and WebSocket upgrades have
Origin checks, with known security gaps.
Cross-sidecar browser access requires that browser's origin in the remote
sidecar's server.origins. TLS termination belongs to the operator's reverse
proxy.
The conventional port for a second sidecar is 31502 (set
OTK_SERVER_PORT=31502). The sidecar binds exactly its configured port and
exits with an error if it is occupied; it never switches to a fallback port.
WebSocket clients reply {t:"pong"} to the sidecar's {t:"ping"} JSON
heartbeat every 20 seconds. Connections close after 60 seconds without an
incoming response or other valid client frame. This is an application-level
heartbeat, not a WebSocket control-frame ping.
Development builds, tests and experiments run only inside otk-tests-a,
otk-tests-b and otk-tests-c on ark.home, as tester in
/home/tester/otk, with disk-backed TMPDIR=/home/tester/otk/tmp. If a guest
is unavailable, stop rather than fall back to either host. Ark transport
revalidates the receipt/domain/QGA/DMI/pin, delivers exact dirty source and
copies reports. It never builds, tests or launches browsers on Ark. The test
provider is scripted and uses no real model credentials.
| # | Developer intent | Ark transport | Guest work |
|---|---|---|---|
| 1 | Normal commit check | python3 scripts/test-matrix.py --lane commit --base HEAD |
A normally; shared changes fan out to A/B/C; dirty paths and smoke included |
| 2 | One browser area | python3 scripts/test-vm.py otk-tests-a run -- deno task test:e2e --project=oc-1.18.34 --grep @composer --retries=0 |
Fresh context and owned project; actual native outcomes |
| 3 | Provider integration | python3 scripts/test-vm.py otk-tests-b run -- deno task test:integration |
1.18.35; Deno file-parallel |
| 4 | Theme/style change | python3 scripts/test-vm.py otk-tests-a run -- deno task test:themes --project=themes |
One ordered state sweep |
| 5 | Heavy data/heap | python3 scripts/test-vm.py otk-tests-c run -- deno task test:scale --project=scale-1.19.3 |
Isolated scale, measurements and structural assertions |
| 6 | Milestone/release | python3 scripts/test-matrix.py --lane full --guests otk-tests-a,otk-tests-b,otk-tests-c |
All tiers/versions; scale and upgrades; themes once |
| 7 | Trace investigation | python3 scripts/test-vm.py otk-tests-a run -- npm --prefix tests/browser exec -- playwright show-trace TRACE_PATH |
Actual retained trace path; browser remains in guest |
See testing for selection, sharding, retry and quarantine
contracts. Prepare the exact delivered tree with test:prepare before focused
browser/integration commands.
The session digest qualification documents the real-version scale generator, serving-isolate and browser budgets, and its isolated guest execution route.
License: LGPL-3.0-only.
OTK composes seven reusable Deno workspace libraries and one root application.
@otk/protocol provides dependency-free wire
contracts and helpers; @otk/content converts
markdown and patches and owns streaming reply buffers.
@otk/harness provides harness-neutral core and
optional capabilities;
@otk/harness-opencode-v1 owns the
stock native adapter and read-only history. Consumers use public bare imports
through each package's mod.ts. @otk/store
provides feature-contributed persistence migrations. Root main.ts,
application.ts and the application core compose these
libraries, the selected backend, registered RPC features and web assets. HTTP
routes remain reflective application files; core is not another reusable
server/app package. @otk/client supplies
framework-free networking, RPC, observable session/index state, history and
navigation. Solid bindings stay at the browser UI boundary.
@otk/ui provides Solid components, consumer-owned
tool/part/prompt/dock registrations, component styles and the client bindings.
The web application selects its modules in web/src/features.ts.
The browser application selects public notification channels and injects live focus, viewed root, host preferences and command/RPC callbacks. Background root completion, errors and family input edges use one replaceable note per sidecar and root; each connection's first index snapshot is silent. Settings saves in-page messages and favicon attention badges on by default, browser OS notifications and sound off. OS opt-in requests actual browser permission; blocked/unavailable status remains visible and in-page fallback continues. Notification actions share guarded session navigation and background-family permission commands, preserving draft and URL/state ownership. No service worker or Web Push is required.
| # | Entry or area | Responsibility |
|---|---|---|
| 1 | main.ts, defaults/otk.toml |
Layered operator/auth-state config, selected native backend and content buffers, bundled asset path, process signal lifetime |
| 2 | application.ts |
Backend-neutral shipped composition: public store migrations/services and feature-owned core RPC registrations |
| 3 | core/ |
Config/auth, reflective HTTP adapters, WS/RPC transport, session index and backend-neutral service lifetime |
| 4 | web/index.html, web/src/main.tsx, web/src/features.ts |
Browser bootstrap, fonts/provider and public UI feature selection |
| 5 | packages/ui/shell/, packages/ui/state/shell.ts, web/src/ui/App.tsx |
Reusable shell binds framework-free client resource, session-action, input-guard and navigation owners and renders chrome; web composes the public entry and API address |
| 6 | tests/ |
Application units, integration/e2e, shared fixtures, architectural boundaries and standalone reuse consumers |
| 7 | packages/*/tests/ |
Library-owned units; application support stays at root |
Application fixtures use the same composition as production: subprocesses launch
main.ts; external-backend fixtures call startApplication. Config, wire names
and sidecar browser terminology remain compatible. Core routes stay in
core/http/routes/; Pathfinder discovers named handler exports and middleware
without a generated mirror or handwritten route table. Registry machinery
imports no concrete features. Libraries never import the application;
cross-package source imports use only their public @otk/<library> entry.
For an alternate backend, implement the public @otk/harness contract and
supply it to startApplication; optional RPCs follow the capabilities actually
supplied. For a smaller custom application, use startCore with selected
feature-owned registrations, as illustrated in the core documentation. Reuse of
a library does not require the OTK application. The browser bundler maps bare
kit names to the declared public entries; UI resources resolve from pinned
library exports.
Before terminal tests on a clean checkout, fetch the pinned daemon with
deno task pty:fetch x86_64-unknown-linux-gnu (use aarch64-unknown-linux-gnu
on ARM64). This is also required by the terminal binary-extraction unit test.
deno task test:unit runs remaining app units and extracted package units;
deno task test:integration and deno task test:e2e run app-level checks.
deno task test:arch enforces extracted package boundaries and
deno task test:reuse runs standalone public API consumers. The final kit sweep
adds deno check packages/<library>/mod.ts and
deno publish --dry-run --allow-dirty --config packages/<library>/deno.json for
all seven actual libraries. The root application is not a separate @otk/app,
@otk/server or @otk/sidecar publication target.