@volter/supercode-harness-sdk
v0.3.115
Published
TypeScript client for Volter Harness's harness.v1 session and runtime service
Readme
Volter Harness SDK
This Node client requires Node 26.8.1 or later. It launches supercode harness serve and exposes
the versioned persisted-session, local inventory, transfer, and live-runtime
primitives. The original low-level request methods remain available; managed
objects add cleanup, aborts, typed async iteration, and sequence-gap recovery.
Command timing (Node hosts)
The slow-log module's withStepScope(fn) isolates an asynchronous unit's noted
steps. takeSteps() reads that unit's counters; stepsWithin() retains the
separate process-wide interval view. Completed scopes clear their maps, and
later callbacks use unscoped counters. recordSlow defaults to slow-only;
includeFast: true adds real call receipts with unrounded elapsed_ms and a
subsecond flag. Board show/list/comment/create use these receipts and keep
request steps separate from overlapping process activity. Source boundaries
leave runtime isolation and complete caller timing unqualified.
Work history (Node hosts)
./work-ledger exports the shared recorder and bounded retained reader;
./work-regressions exports the same detector used by the optional health pack.
See the work guide and the published declarations
for exact fields. Register one fixed role and native served scope before work,
allow-list fixed operations, then bracket actual work with startWork or
measureWork. closeWorkLedger() joins the final checkpoint and returns logging
status; owners retain their operational cleanup errors separately.
The Node client's ledger counting composes with custom onRequestTiming
observers. Browser/core imports remain filesystem-free. Do not use request text,
paths, URLs, session IDs or credentials as operation names or units. The recorder
hashes a supplied native scope; only that digest is retained. Elapsed time includes
waiting and overlap and is not CPU time.
Built-in model and provider inventory
The ./model-catalog subpath returns the built-in alias table without reading
credentials, user configuration or a vendor endpoint:
import { builtInModels, builtInProviders } from '@volter/supercode-harness-sdk/model-catalog';
const models = builtInModels();
const providers = builtInProviders();Both functions return fresh arrays and rows. Models retain canonical alias
order. Providers retain first-seen prefix order and alias order within each
group; model_count counts aliases, including aliases sharing the same slug.
These are built-in names, not a vendor availability report or resolved user
overrides. supercode model list|ls and supercode provider list|ls render the
same values, with --json for JSON. The canonical asset is
sdk/interchange/model-aliases.json; scripts/model-aliases.mjs generates the retained native
runtime/config/picker/doctor constant. The hook updates that projection when
the asset changes. Original records
retain their source and native scope. Product observations are recorded
separately by source; routing now uses the shared Node owner while native
config/tool/runtime consumers retain their separate boundary.
Configuration editor schema
The ./config-schema subpath owns the canonical published editor schema.
configurationSchema() returns a fresh value and configurationSchemaText()
returns its UTF-8 JSON text, including the trailing newline. The npm command
supercode config schema prints that text; --write projects it to
docs/schema/supercode-config.schema.json under the caller's current directory.
It preserves the schema URL, key types, descriptions, capability names and
additional-property policy. Config parsing, strict validation, layering and
locking retain their separate native boundary. Schema/parser equality must be
maintained when those fields change. Original records
retain their source and native scope; product observations are recorded
separately by source. This API does not resolve or validate a user's config.
Bounded session search
discover({ query: 'release' }) keeps its metadata-only search semantics. Opt in
to searching the native opening/latest message candidates as well:
const page = await client.discover({
query: 'release', search_previews: true, limit: 50,
workspace: process.cwd(),
});
// page.receipt.searched_previews === true; total_matched covers all matches.
// Keep the same query and pass page.next_cursor to read the next page.The same operation is available directly, without the fleet tool:
supercode discover --query release --search-previews --limit 50 --pageSearch is case-insensitive and combines metadata with the existing native
preview readers before pagination. It requires nonblank text and a positive
limit when supplied. Returned matches include topic and latest candidates,
even without include_topic_candidates. It does not search full histories,
images, or product-specific title overrides. Available candidates depend on
the native format: opening candidates currently cover Claude/Codex; latest
candidates use each format's existing reader. Codex's first history topic is
reused; later history entries are not searched.
The existing readers retain at most eight candidates per edge, capped at 4096
characters each; JSONL uses 512 KiB edges and an up-to-4 MiB latest fallback.
Workspace, profile, family and time filters run first. Exact counting still
requires checking previews across the eligible inventory on every page;
limit bounds returned rows, not total I/O. Memory holds the descriptor inventory,
Codex's first-topic map, the returned page, and one row's preview enrichment at
a time—not every session's enriched history. Narrow the query's inventory when
possible; this is an explicit one-shot operation, not a background search index.
Retained sessions.index.subscribe rejects search_previews: it must not
rescan the inventory on each live update. Use discover instead. The SDK also
requires the service's searched_previews: true receipt, rejecting older
services that would silently ignore the option. Ordinary metadata discovery
and live subscriptions keep their locator, filter and revision contracts.
Machine-owned session index
Discovery and index subscriptions require a compatible machine daemon. The
front door advertises its routing contract as
session_index: { version: 1, owner: 'machine' } during the native capabilities
handshake, without opening the daemon. It verifies the daemon's index capability
when a moved method is issued, and refuses an absent or older owner then.
Retained catalog, transcript and runtime methods can start without that owner.
Local stdio supercode harness serve
coordinates that socket and the separately retained native service: it preserves
the caller's selected homes and cwd, and opens the native child only for its
remaining doors. Discovery metadata and index windows come from the TypeScript
owner; a native child restart does not recreate the owner or its index-only
connections.
subscribeSessionIndex and resizeSessionIndex return change_cursor with their
revision, initial rows and failed sources. An answer reads the messages of at most
128 of its rows; a larger window's remaining rows are the index's own, and their
messages follow as updated changes. A subscription answers from the rows the index already holds, as a
discovery does: reconciling names each harness whose source is still being walked, and the
rows that walk adds follow as changes. include_latest_candidates: false asks for
rows with no latest messages, so no session file is opened. A subscribe request
that times out or is aborted is closed on the machine by its request
(sessions.index.unsubscribe with request). sessionIndexChanges(query, after, limit)
reads bounded durable metadata changes; a reset includes a metadata snapshot and
its replacement cursor. These source changes are distinct from the current
window's added/updated/removed notifications. sessionIndexDiagnostics(query)
reports sources, watches, refused reads and I/O counters. EOF, unsubscribe or a
lost operator grant releases the connection's windows. Discovery's optional
activity_error names an unavailable reading from the separately retained activity
service; absent activity never implies an idle or persisted session.
The Teams index contract describes the owner and its explicit foreign-store limits. Private Mac/Windows observations cover small-home discovery, shared windows and append events; all-format, large-home and Windows native-forwarding qualification remain open.
Transports
The package root spawns supercode harness serve as a Node child process.
The client core is transport-agnostic: import it from
@volter/supercode-harness-sdk/core and supply any object that
implements HarnessTransport (start, write, close, running) over a
process you own. A browser host running Volter Harness as a WebAssembly Linux
program in a Worker supplies one over that program's stdio; the core imports
nothing from Node.
The Node transport decodes UTF-8 across chunk boundaries, coalesces small
fragments in 64-K code-unit groups and joins a complete line at its newline.
It refuses decoded lines beyond Node's existing MAX_STRING_LENGTH with
transport_frame_too_large before the complete join. This is a representability
boundary, not a process memory ceiling: accepted replies and parsed graphs still
allocate completely. Source allocation scope
leaves framing, compatibility and memory/timing qualification open.
Node hosts may set ClientOptions.maxFrameBytes to a positive safe integer.
The reader counts UTF-8 wire bytes before decoding or retaining each fragment,
excluding LF and including CR. A frame exceeding the limit fails the receive
stream with transport_frame_too_large, limit_bytes and observed_bytes;
accepted frames stay complete. The normal Teams connector sets 256 MiB on
each of its two capture child-process clients. Other SDK hosts keep the
preceding default when the option is omitted; custom transports own their
policy. The byte limit does not bound parsed graphs, caller objects, native
processes or total connector memory. Refusal drains the owned pipe, retains
unconfirmed native-request records and starts no backend replacement or
native cleanup. Compatibility and boundary behavior remain unqualified.
Before parsing a reply's graph, the core can recognize a complete JSON object whose numeric id has no pending request. It validates the whole frame without materializing its result or error. Pending ownership records for timed-out opens still receive their replies. Duplicate root ids retain the parser's last-value semantics; notifications, malformed or inconclusive frames use the ordinary parser. The recognizer keeps a bounded nesting stack and small root-name/id scratch values; deeper or unusual id spellings fall back without rejecting the frame. This avoids only the graph for recognized unmatched replies: accepted line strings and pending replies still allocate completely. Grammar, cleanup, timing and memory behavior remain unqualified.
A terminal receive failure rejects pending RPCs and future writes, and emits
transportReadError plus transportError. The optional transport onReadError
hook falls back to onWriteError for older hosts. Session followers and managed
runtime iterators retain already queued complete events before surfacing the
failure. runtime.lastTransportReadError also records a failure that raced its
open reply. Local sdk.transport_read diagnostics have raw:null and
terminal:false; they are not native events. The failure leaves runtime.closed
false and establishes no native close, exit or detach. The reader drains further
stdout without retaining it; it does not kill or restart the backend. Previously
admitted outbound writes retain their existing lifecycle. Explicit teardown and
the preceding startup-failure teardown contract remain.
Receive/write failure, backend exit and local close retain compact records for
abandoned native opens and pending cleanup confirmations. They establish no
native absence and initiate no additional cleanup request during bulk rejection.
nativeRequestCleanupPending exposes their request, method and original
transport generation; a known cleanup target is included when available.
Already admitted open records still count toward capacity after a restart.
A readable late reply uses the existing original-generation cleanup policy.
Outbound lines are still serialized immediately. Small frames use stdin directly
while it is writable; larger or queued frames use exclusive private temporary
files and one 64 KiB transfer buffer, waiting for each pipe callback. No frame is
truncated or replayed. At most 64 staged frames may await completed transfer and
verified removal, including the active frame. Further staged writes refuse with
REQUEST_STAGE_CAPACITY before creating another file; admitted frames remain
queued in order. Capacity refusal does not poison the writer.
Staging failures include REQUEST_STAGE_UNAVAILABLE and the retained private
directory. Any staging or transfer failure poisons that writer. Uncertain
descriptor close retains exact descriptor/path/phase records for the staging
writer and active transfer reader; no descriptor close or failed stage is
retried. Close reports abandoned/uncertain stages after closing its owned
process. These stages never supply native action receipts or resume authority.
The count bound covers selected queue metadata; original graphs, complete JSON
strings, other pending RPCs, individual paths and staged disk bytes have no total
size bound. Runtime, filesystem, wire ordering and timing remain unqualified.
import { SupercodeHarnessClient } from '@volter/supercode-harness-sdk/core';
const client = new SupercodeHarnessClient({ transport: myTransport });import { SupercodeHarnessClient } from '@volter/supercode-harness-sdk';
const client = new SupercodeHarnessClient();
const { harnesses } = await client.listHarnesses({ workspace: process.cwd() });
const { next_cursor, sessions } = await client.discover({
limit: 50,
query: 'release',
workspace: process.cwd(),
});
// Discovery returns independently resumable root conversations by default.
// Tree/import tooling can opt into native child rollouts such as Codex subagents:
const completeTree = await client.discover({ include_child_sessions: true });
const mirror = client.session(sessions[0].locator);
const { session, window } = await mirror.loadWindow({
inline_media: 'metadata',
message_tail: 200,
});
const controller = new AbortController();
for await (const event of mirror.follow({
signal: controller.signal,
view: {
tailMessages: 500,
maxMessageChars: 16_000,
includeSubagents: false,
displayHistory: true,
},
})) {
// initial/full snapshots, append events, unsequenced `runtime_state`
// lifecycle events, and recoverable watch errors
console.log(event);
}
const runtime = await client.startManagedRuntime({
harness: 'codex',
cwd: process.cwd(),
policy: 'default', // also used when omitted; keeps the harness's approval policy
});
// Open the same live runtime in a terminal without exposing its bearer token.
const { launch } = await runtime.terminalInstructions();
runtime.on('event', (event) => console.log(event.type, event.raw));
await runtime.sendInput('Explain this screenshot.', {
imageUrls: ['data:image/png;base64,...'],
});Runtime launches honor the executable and arguments supplied in launch. Without an explicit
launch, the Codex adapter uses an absolute SUPERCODE_CODEX_BIN when configured, or codex
from PATH. Omitted policy uses default; policy: 'yolo' explicitly requests approval bypass.
Native Claude Code start/resume accepts permission_mode: 'default' to select
Manual explicitly, rather than inheriting its launch/configuration default:
const manual = await client.startManagedRuntime({
harness: 'claude-code', cwd: process.cwd(), permission_mode: 'default',
});
// On resume, carry the conversation's native choice again:
// await client.resumeManagedRuntime({ harness: 'claude-code', runtime_id, permission_mode: 'default' });startRuntime, resumeRuntime and the deprecated persisted-resume attachRuntime
require the requested mode in runtimeCapabilities().permission_modes before
opening a connection. Older services omit that field and refuse through these
helpers; a raw request() remains the caller's protocol escape hatch. The native
service refuses a mode for another harness, ACP, live-process attachment or
policy: 'yolo'. A supplied launch with its own permission flag, approval bypass
or end-of-options marker conflicts and refuses. Accepted modes ride the retained
Claude launch prefix, including automatic process reopen. Native allow/deny and
managed rules still apply. Omitted mode preserves the old launch/configuration
behavior. Codex's existing approval_policy still rides thread/start and
thread/resume, independently of its sandbox.
Native Codex start/resume also accepts permission_profile (the stock thread
door's permissions name) and config_overrides (its per-thread config map).
The named profile is mutually exclusive with sandbox. Overrides are passed
to the native request, never written into the person's config.toml.
startRuntime, resumeRuntime, managed helpers and persisted attachRuntime
require each supplied field in runtimeCapabilities().codex_thread_options
before opening a connection; an older service refuses with
CODEX_THREAD_OPTIONS_UNSUPPORTED. This advertisement describes the service's
forwarding implementation. The installed Codex must support the chosen native
configuration; Codex 0.162.1's generated protocol includes both native fields.
Other backends, ACP, live-process attachment and policy: 'yolo' refuse these
options. An explicit mcp_servers list can accompany unrelated overrides;
declaring MCP servers in both fields refuses before launch.
Omitting both fields retains the existing native launch/configuration behavior.
This door alone grants no network access and does not qualify an editor's
loopback policy (source record).
Hosts that provide their own terminal or tmux transport can start a new native interactive session without duplicating harness command-line knowledge:
import { createNativeInteractiveStart } from '@volter/supercode-harness-sdk';
const { initialInput, launch } = createNativeInteractiveStart({
harness: 'codex',
cwd: process.cwd(),
prompt: 'Inspect the current build and explain any failures.',
policy: 'default',
});
const session = await terminalHost.launch(launch); // spawn(program, arguments), never a shell command string
await terminalHost.sendInput(session.id, initialInput);The persistent TUI starts before the initial prompt is submitted through its owned PTY, so prompt
text never appears in argv or a process listing. Native interactive start currently covers Claude
Code and Codex; unsupported harnesses fail explicitly. The older createNativeStartLaunch() helper
remains available for hosts that intentionally use a positional prompt.
A discovered session that is running right now carries live_status and
delivery, the door a message reaches it by (runtime, native, hook or
stored). Claude Code publishes busy/idle; current Codex versions may not
keep a rollout file open while the TUI is active. A local terminal embedder
can pair Volter Harness with the retired package/native-host.js to retain an
unresolved candidate privately and resolve its exact durable ID plus idle proof
only when the user explicitly requests a handoff:
const outcome = await client.messageSession(sessions[0].locator, 'rebase onto main, please');
if (outcome.delivered_to_bus) console.log('handed to', outcome.target.session_id);
else if (outcome.refusal) console.log('refused:', outcome.refusal.reason, outcome.refusal.message);
else console.log('waiting:', outcome.message_id);
const advisory = outcome.inbound_controls?.advisories[0];
if (advisory) {
console.warn(advisory.message);
// Only after an explicit user decision:
await client.configureHarness(
'claude-code',
[advisory.recommendation.change],
outcome.inbound_controls.revision,
);
}With { asUser: true }, pane input accepted by the terminal queue reports
delivered_to_bus: false, delivery.how: 'waiting' and its retained message ID
until a delivery confirmation exists. This is accepted input waiting for its
native door; repeating it as a new message can submit it twice. A confirmed pane
delivery reports how: 'typed'; a hosted runtime reports started or steered.
A refusal (not_live, identity_mismatch, delivery_failed, too_long,
invalid_sender) is a normal result, not a thrown error. delivered_to_bus
is deliberately the strongest claim available: the text reached the receiving
session's inbox, that session's own inbound-message controls decide whether it
is read, and it shows up in the mirror through the followed transcript — often
seconds later — rather than as a turn you own. Delivery spawns a one-shot
headless Claude restricted to the two documented cross-session tools; Volter Harness
does not write the receiver's Unix socket, whose wire frame is undocumented.
harnessSettings('claude-code') provides the same user-level preflight report
without sending. Managed, project, or command-line policy may still override
the user setting for a particular target process. Choosing accept trusts
messages from the user's other Claude Code sessions; the receiving session's
ordinary tool and permission controls still apply.
For agent-addressed mail, delivered_to_bus confirms durable filing.
delivery.handoff_confirmed separately confirms native handoff to an intended waking recipient,
with no failed or held recipient. A stopped, queued, CC-only or unanswered outcome is false.
Use that boolean for dispatch status; delivery.how is display text and may change.
Neither field proves a model response. Older daemons that omit the boolean provide an unknown
handoff outcome; callers must not infer success from their display text.
Authentication remains native to each coding harness. A desktop or local-web host can request a redacted report and then execute the returned plan in its own visible terminal:
const report = await client.harnessAuthenticationMethods('codex');
const plan = await client.beginHarnessAuthentication('codex', {
environment: localBrowserAvailable ? 'local_browser' : 'headless',
cwd: workspace,
});
await terminalHost.run(plan.launch);
const verified = await client.verifyHarnessAuthentication('codex');The browser-capable plan lets the native CLI open its own sign-in page. Codex's headless plan uses its documented device-code flow. No plan contains a token, and the service never owns the native sign-in process.
Discovery covers Claude Code, Codex, Gemini CLI, Grok, OpenCode, Pi, and
Volter Harness's native store. query is case-insensitive across harness, id,
title, workspace, and model; next_cursor is opaque and may be supplied as
cursor on the next call. workspace matches sessions recorded in exactly that
folder; add workspace_subtree: true to match the folder and every folder under
it (Teams sync rules use this). loadWindow bounds message history and can replace
inline data URLs with media_reference metadata. message_tail cannot be
combined with message_offset or message_limit. Every bounded result also
returns a full-session summary, so first/last message and completion state do
not change merely because older message bodies were omitted from the window.
For Hermes, session.ended_at and session.end_reason expose its recorded session
end, including terminal Kanban workers without channel bindings. A missing end
is unknown; summary.end_of_turn alone does not establish session or task completion.
The window's older_items/newer_items count omitted normalized conversation
and tool entries, allowing a renderer to disclose truncation exactly.
For native Claude JSONL with include_subagents: false, explicit loadWindow
requests use a read-only index and the existing graph/record decoders. Counts,
summaries, tool ordering and media policy are unchanged. It still scans the
source; retained memory is record metadata plus native residue, the largest
decoded assistant group, and requested/summary payloads—not the whole transcript.
Other formats and recursive requests retain their existing loaders.
Claude followers outside display_history can normalize simple appended
message records without re-decoding old payloads. They compare every prior byte
against the retained verbatim source; tools, chunk extensions, branches,
rewrites, partial records and child-tree changes use the canonical loader.
This reduces repeated decode work, not retained full-history memory or all
prefix I/O. The existing event, recovery and polling contracts are unchanged.
Managed runtime iterators end when the native transport closes or when the
parent client is closed. Terminal transport errors arrive through the common
event stream (and the non-special runtimeError event); native EOF is a
typed closed event. A closed managed runtime rejects further input.
A request timeout or AbortSignal rejects the caller promptly; it does not cancel
other admitted requests. The client admits at most 256 pending RPC replies in
total, including ordinary requests and compact abandoned open/close replies.
Ordinary work stops admission once 192 replies are pending; the remaining 64
slots are reserved for native close and unsubscribe requests. A further request
rejects with SupercodeRpcError.code === 'REQUEST_CAPACITY'
before a new handler, timer or wire frame is created. Requests with disabled
timeouts count too; capacity never evicts their pending answers. Replies or
ordinary timeout/abort release their own slot. Retained abandoned ownership
replies keep theirs. The separate runtime/subscription admission bounds still
apply. This counts handlers, not caller parameters, returned graphs or total
process memory; no automatic retry or cancellation of another request occurs.
Transport teardown retains its exact owner through the original close attempt.
The Node transport waits for its spawned child and request writer before
releasing the generation; unexpected exit and concurrent close share that
attempt. A failed close remains retained without another teardown attempt.
The client then refuses start() with TRANSPORT_CLEANUP_UNCONFIRMED, retaining
the original failure as cause. The readonly transportCleanupPending getter
returns its generation and a compact diagnostic, while repeated close()
returns the original failure. A false running value during closure describes
availability; it does not confirm process or native-runtime reclamation.
These transport results never release uncertain native connection/subscription
receipts or confer permission to close an external process.
A runtime-open timeout or abort does not cancel
a native launch already executing in the service. For startRuntime,
resumeRuntime, the deprecated persisted-resume attachRuntime, and
attachExistingRuntime (including their managed variants), the SDK retains an
abandoned request and closes its exact returned connection if a successful reply
arrives later. Closing an observer connection uses its native close semantics;
it does not grant ownership of the observed process. A runtime already delivered
to the caller stays caller-owned.
At most 64 runtime opens and late connections awaiting confirmed closure may
remain unresolved in total, including abandoned opens.
Further opens reject with SupercodeRpcError.code === 'RUNTIME_OPEN_CAPACITY'
until native replies resolve them; this is not a limit on live sessions.
Receipts are never evicted to make room for more opens. The read-only
runtimeCleanupPending getter returns fresh compact records containing
connection, open_method, and transport_generation. Only closed: true
from that connection's original transport releases its record. Failed, false,
malformed or timed-out close answers retain it and emit runtimeCleanupError
with (error, { connection }) during automatic cleanup. Hosts should surface
that failure rather than claim the runtime was reclaimed. A close still awaiting
its native reply rejects a duplicate with RUNTIME_CLOSE_PENDING, including
after timeout/abort; its eventual confirmed reply can still release the record.
After a native refusal/error, hosts can explicitly retry closeRuntime through
the same transport. A transport exit/close clears pending RPCs, but retains known
late connections. Cleanup never restarts a dead service, and closing a retained
connection through a later transport refuses with
RUNTIME_CLEANUP_TRANSPORT_MISMATCH. Unknown opens without a returned connection
cannot be recovered after transport loss. Cleanup is not a guarantee when the
service cannot acknowledge it, and this does not retroactively recover connections
abandoned by an older SDK. The bound counts records; individual connection strings
and other live handles remain outside it.
The same late-reply ownership rule applies to transcript follows, activity
subscriptions, and index subscriptions: an abandoned open is unsubscribed when
its receipt arrives. Unresolved opens and all returned subscriptions share 64
admissions (separate from runtime opens); further opens reject
with SUBSCRIPTION_OPEN_CAPACITY. The readonly subscriptionCleanupPending
getter returns fresh copies of subscription, open_method, cleanup_method
and transport_generation for late abandoned opens and attempted removals.
Delivered subscriptions retain the same compact owner record before their caller
resolves. Dropping a caller reference does not release admission. Only the
original transport's boolean removed reply confirms a returned record's removal: true confirms removal, false confirms absence.
An original-transport index event with closed: true also releases its exact
reader, before delivering the complete event to the caller. A plain transport
exit supplies no such confirmation.
Malformed, failed or timed-out replies retain it. An abandoned unsubscribe keeps
one compact pending answer; duplicate removal refuses with
SUBSCRIPTION_REMOVAL_PENDING. Hosts may retry after a native refusal/error.
Transport exit/close retains known returned records; a later transport refuses
their removal with SUBSCRIPTION_CLEANUP_TRANSPORT_MISMATCH; an unavailable
original transport refuses with SUBSCRIPTION_CLEANUP_TRANSPORT_UNAVAILABLE.
A name matching multiple retained owners refuses with
SUBSCRIPTION_IDENTITY_AMBIGUOUS. Retained cleanup never starts a replacement
transport. Failed late cleanup emits
subscriptionCleanupError(error, { subscription }); index-open cancellation by
its numeric request id uses { request }. Unknown opens with no returned handle
and process-restart recovery remain unqualified. The bound counts records rather
than individual strings or event/result graphs.
ManagedRuntime.close() is single-flight and records success only after the
close RPC succeeds or a terminal runtime event confirms shutdown. A cancelled
or failed close remains retryable; mutations are refused while a close is in
flight. Event iterators detach their listeners on abort, return, or runtime
termination, including when no subsequent event arrives.
Startup has a deadline covering transport startup and the capability handshake.
Closing during startup rejects its waiter, and retry waits for transport teardown.
Events are scoped to the transport generation: a departing process cannot feed
messages into or disconnect its replacement. Pre-aborted requests do not start
a service. Custom transports must ensure close() also cancels any pending
resource creation in their start() implementation.
For an ACP agent, pass a stable harness id, protocol: 'acp', and a launch
command. OpenCode can join a running TUI/server only when that process was
started on a known URL; pass it as base_url. Persisted continuation is
resumeRuntime; attachExistingRuntime is reserved for a genuine live
endpoint attach and reports unsupported capability honestly.
listHarnesses() is passive by default. It checks bounded native auth status (where supported)
without opening a conversation. Each row includes the native authentication report;
unknown status and local credential evidence are not authenticated. Session counts are also opt-in because
some users have thousands of transcripts: pass { include_sessions: true } or
use supercode harnesses list --sessions. { probe: 'handshake' } opens an
empty protocol session, observes its transport through startup stabilization,
and closes it without submitting a model prompt or spending model tokens. A successful
handshake changes transport readiness only, never authentication.
load() and follow() are read-only, so they report the same fidelity +
residue pair on the session itself and default to viewing at semantic
fidelity: a Claude Code transcript that has been compacted or resumed across
files routinely contains a live record whose parentUuid was pruned, and a
mirror needs to render it, not refuse it. The stitched-together view names
every dangling uuid in session.residue and reports
session.fidelity === 'semantic' — never continue from one. Pass
{ fidelity: 'byte_lossless' } to get the strict refusal instead; every
continuation/transfer method below is lossless-only and has no view mode.
Frontends should also pass view: it bounds the trailing message window and
each individual text field, avoids eagerly attaching Claude Code's child
transcript tree, and keeps human-visible Codex history across model-context
compaction. Omitting view preserves the complete legacy read contract.
Import/export/translate/branch/handoff methods return typed artifacts with an
explicit fidelity classification and named residue. Same-format
line-oriented exports replay captured native bytes; logical stores such as
OpenCode SQLite are classified separately and carry a recovery member. Claude
Code subagent and Grok bundle files appear in files; cross-format exports
preserve the portable conversation but cannot
claim that target schemas retain every source-native record. Structured
launches are argument arrays, never shell-quoted command strings. A handoff
artifact names its actual wire format, which can differ from
the destination harness. Grok has no import command: its handoff artifact is
Grok's own transcript, materializeSession writes the store entry, and the id it
returns replaces {materialized_session_id} in the structured launch.
branchSession() and handoffSession() require their separate caller-owned
TypeScript admission markers. A cut must identify one recorded user message
by claude_uuid; it keeps preceding messages and their linked child sessions.
Branch returns artifact:null when no target is supplied. Handoff assigns a
fresh target identity and returns instructions without invoking a vendor or
writing its continuation store. Its artifact construction can populate the
same source residue cache as translation.
reduceSession() is the rate-limit-rescue primitive. It strictly loads the
source, creates a bounded view with the core reversible reduction engine, and
writes the complete sidecar, reduction log, and working view to Volter Harness's
session store. The service reloads those files, verifies every pointer, and
byte-exactly inverts the view before returning a ReductionReceipt and target
bootstrap prompt. A small or non-lossless source is refused; no optimistic
fallback is returned.
Native agent configuration (Node hosts)
@volter/supercode-harness-sdk/configuration exports
createAgentConfigurationHost({ sources }). Each trusted source supplies a key,
harness, optional native home, display/scope labels and an explicit writable
capability. Browser requests supply only the source key, one { key, value }
change and the revision returned by inspect(source); they cannot choose paths
or executables. configure(source, change, expectedRevision) rereads the native
value before returning saved: true. value: null removes the override.
The initial adapters expose Hermes model/provider via hermes config set/unset
and Claude Code model/cross-session inbound policy via its native settings JSON.
Hermes needs a CLI version supporting those commands. Credentials are never read
or projected. Other harnesses return an explicit unavailable report. This is a
general capability contract; it does not claim all native preferences are editable.
The existing harnessSettings RPC remains the contextual interoperability API.
These are user-home settings, not per-conversation effective values. Environment, managed policy, workspace and launch overrides can take precedence; existing sessions are not restarted. Revisions reject observed stale edits and writes through this host are serialized by native path. Hermes owns its write operation: there is no cross-process compare-and-swap guarantee against a simultaneous native CLI editor. Native refusals and failed rereads are errors, never success receipts.
createAgentProfileHost (Node /configuration) composes the existing native
profile inventory/create doors with a host-owned subject-to-profile binding.
Its reports use the same AgentConfigurationPanel as native settings. Hermes
profiles are supported; other harnesses explicitly report unavailable activation.
The host supplies fixed source keys and optional new-profile names. The browser
selects discovered names or explicitly creates a separate profile; creation does
not clone credentials, install aliases, or alter the native active profile.
resolve(source) returns SDK constructor options, discovery homes and an opaque
configuration-home identity. Pass those options to the resident's own
SupercodeHarnessClient for both start and resume. Default returns no overrides.
A selected profile that disappears fails closed. configuration(source) returns
the existing native settings host for that home (null for the shared default).
The embedding host must serialize binding changes with runtime startup, reject
switches during active turns and retain separate resume records per identity.
Profiles scope credentials, configuration and storage; this is not a claim of
per-session model overrides or isolation from inherited provider environment.
For resource inspection, construct a client with the resolution's clientOptions,
pass it through scopeAgentResourceClient(client, resolution), and pass
resolution.sourceOptions into the shared source-inventory host. Hermes native
inventories enumerate sibling profiles: this adapter keeps skills under the
activated home's skill root and selects that home's default memory store.
These are trusted host options, not browser-supplied filesystem paths.
MCP doors
@volter/supercode-harness-sdk/mcp-doors is where each harness accepts an MCP server,
transcribed from its inventory row, and a writer per door:
| Harness | Door | What mountMcpServer writes |
|---|---|---|
| claude-code | flag | <home>/mcp-<name>.json, .mcp.json-shaped; the launch takes --mcp-config <file> |
| codex | toml | [mcp_servers.<name>] in <home>/config.toml (home is $CODEX_HOME), idempotently |
| opencode | json | mcp.<name> in <home>/opencode.json |
| pi | none | nothing: pi ships no MCP client |
| hermes, openclaw, any other | acp | nothing; returns the mcpServers entry for session/new |
import { mountMcpServer } from '@volter/supercode-harness-sdk/mcp-doors';
const mount = mountMcpServer({ harness: 'codex', name: 'retake', command: 'supercode-retake', args: ['mcp'], home: process.env.CODEX_HOME });
// mount.door === 'toml'; mount.path names the file writtenWith url (and optional headers) instead of command, the harness connects to a streamable-HTTP
server already running and spawns nothing: Claude Code's file names it {type: "http", url}, Codex's
block url = …, OpenCode's entry {type: "remote", url}. The acp door carries stdio servers only
and refuses a URL.
The per-door pieces (writeMcpConfigFile, serverToml, upsertTomlBlock, opencodeEntry,
acpEntry, …) are exported for a caller that mounts several servers through one door.
Native management host adapters
The ./management Node entry exports createAgentSetupHost for declared native
Hermes setup/configuration/messaging/pairing/memory commands. The embedding host
supplies trusted profile resolution and a structured Terminal launcher returning
{ wait, cancel, close }. Reports contain operation/status, not command paths or
environment. Tool exit never substitutes for runtime or authentication verification.
readAgentMemoryDocument and writeAgentMemoryDocument operate on documents from
a trusted scoped native inventory. Supported regular UTF-8 Markdown files are
bounded to 1 MiB; edits require a SHA-256 revision and verify native readback.
These wrap the harness's file representation, not a new memory service.
createAgentProfileHost.remove deletes a selected non-default native Hermes
profile after revision checking and resets the binding. Hosts must protect any
other application bindings before allowing deletion.
Host credentials
The Node-only /credentials export resolves explicit environment bindings from
{env: NAME}, {dotenv: NAME} (a caller-supplied native-home map),
{vault: {connection, mount, path, field, version, scope}}, or
{file: {path, name, format: 'literal-env-v1'}} on macOS. The file source requires
an explicit normalized absolute path and custodian-attested immutable atomic
publication on a native local filesystem. It bounds literal ASCII content,
rejects unsupported metadata/grammar, groups one read per selected path, and
publishes only after close. Readiness checks access without reading or parsing
contents. See the file contract
for provisioning limits; no custody read or installed release is implied. Consumers may select a
saved host profile name instead of inline bindings. The Node client's
credentials and dotenv options resolve these before spawning; browsers use
/core and their own host transport, never this resolver. /vault owns optional
OpenBao/Vault connections. Both CLI entrypoints are packaged here, independently
of Teams. The vault guide covers profile setup,
arbitrary-program launch, connection lifetime and Volter ID sign-in. The hosted person role serves each
identity's own KV records; optional scope: "personal" makes those references
portable across machines. Vault leases stay in memory and refresh through the
shared identity SDK.
Nothing loads every saved profile or grants credentials through remote RPC.
Managed start, resume and attach accept optional local partTypeStore in their
options. It implements synchronous get, set, delete and clear, owns one
stream's complete OpenCode part-type dictionary, and is cleared when that SDK
stream finishes. client.supportsRuntimeEventStorage identifies support; the
default remains a Map. A storage failure returns the full raw event as native
with normalization_error.code equal to runtime_event_state_unavailable, so a
consumer sees why its normalized type is unknown. Cleanup failures are emitted
through runtimeError and fail waiting event iterators; that SDK diagnostic has
no raw native event. The store is local state and grants no native authority.
Configured model routing
@volter/supercode-harness-sdk/model-routing re-exports the shared interchange
routing owner. It resolves supplied aliases/scopes, rules/effort/budgets/tiers,
model filters, small/fallback models and family prompts without issuing a
provider request or writing config. The existing model-catalog entrypoint
shares that same asset owner. The package declares its interchange dependency
and Node 22.15 floor; this source change alone does not qualify a registry
installation or allocate new publication versions.
Current Windows/Mac records
retain raw order/integer semantics and native/runtime/installed limits.
The ./claude-compatibility subpath owns complete global/project compatibility projection; SDK authentication/inventory calls require their distinct caller-owned admission markers. Current source record qualifies compilation and leaves runtime recordings pending.
The Node-only ./agent-runtime subpath exports the direct Agent, ToolRegistry,
ToolContext and SidecarWriter owners. Agent.create accepts a complete resolved
runtime configuration; withProvider and withParts accept caller-owned provider
or tool handles. Conversation methods are exclusive; concurrent input uses the
separate steering handle. Close the Agent (or use its async disposer) to cancel
its active operation and dispose its own process scopes and transferred writers.
Shared provider handles carry their own closeable reference. Custom callbacks
must stop their external effects when their AbortSignal is cancelled.
The same subpath exports AgentRuntimeHost, runRuntimeStdio, runRuntimeHttp, runRuntimeWebSocket
and RuntimeHttpCredential. AgentRuntimeHost.create(agent) consumes the Agent
facade and becomes its sole submission/disposal owner. It supplies bounded history,
sequenced frontend snapshots, live attachments, cancellation and steering. Frontend
approval requests require an explicit enableFrontendRequests: true opt-in.
runRuntimeStdio trusts its parent process; runRuntimeHttp requires explicit
credentials and binds loopback by default. HTTP clients share the existing controller
lease policy, can narrow their grants, and use client-bound frontend credentials
from the loopback bootstrap door. Revocation waits for those streams to close.
Close the listener to detach its sockets; close the host separately to dispose the
Agent. These transport paths are coded and remain unoperated until final recordings.
The WebSocket listener exposes /frontend/v2, accepts bearer headers and applies
the same client/controller policy. It retains 16MiB frame and 64MiB message bounds;
the ws codec is pinned to the existing locked version.
This port source composes host process effects directly. Win64 uses a private
Node supervisor with the built-in experimental FFI and a kill-on-close Job Object;
Linux uses a disposable broker with ABI-v1 Landlock writes and, when selected,
a user/network namespace created before Node starts. The public caller receives
no automatic FFI permission grant. Linux network isolation also needs the system
unshare utility; failure to read a capability stays an error. Physical Windows,
Linux, provider, continuation, installed-set and real-used-home qualification are
pending the arc's final recordings. Existing client/core transports are separate
from this Node-only entry.
Selected supercode programs
@volter/supercode-harness-sdk/supercode-program exports supercodeProgram,
supercodeInvocation, spawnSupercode and spawnSupercodeSync. The shared
owner retains the selected executable plus every leading script argument for
Node entries and known Windows command shims. Callers append their own literal
argv; the spawn helpers require shell:false and return the actual child.
Existing callers retain pipes, signals, receipts and lifecycle ownership.
These program words provide no caller/control authority or build attestation.
The ownership decision
names the migrated consumers and remaining native-retirement work.
The default process transport also composes its selected program through
supercode-program after resolving the child environment. Known Node entry
prefixes stay literal; the existing transport generation/writer/exit/cleanup
owners remain unchanged. Orchestrator and Workplace child consumers use the
same owner. Source-bound orchestrators select their exact Node front door and
refuse legacy native declarations until explicitly re-pinned. This source
boundary does not establish runtime or installed-set qualification.
