terminal_run in the display's manual mode types the command without Enter and opens no card;
the call waits for the person and answers ran, dismissed, left or unknown. lembas terminal
settings reads, sets and forgets; the display and lembas complete use what holds in their
directory. lembas complete: --cwd may be left out, --debug says each decision.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A header, the conversation, one row per tool call and cards; input is what the terminal
writes to the pane. The terminal profile of tools (no bash, no file tool), two modes, a typed
command waited for by the pane's status record, context that continues, one conversation per
window, the terminal's two models. The TUI in a split pane keeps working for contract 1.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Spec first. The CLI is the engine behind a LLeMbas terminal: a display-only surface
(lembas terminal) in place of the TUI in a split pane, which stays for a terminal
written for contract 1. Offered: terminal client only.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- lembas_state is empty until the TUI's prompt box takes what is typed, and
while a menu, panel or subagent's view is in front of it: the first `idle`
means a typed line reaches the box.
- /terminal-context is in no menu (found only in a LLeMbas terminal); a test
drives the real Root with the terminal's one write — the command line,
Enter, the question as a bracketed paste, Enter.
- `lembas sessions --json`: the recent sessions as one array.
- Spec: those three, and that a terminal decides by terminal_contract and
capabilities, not by the version number.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A session whose prefix was kept before the terminal tools existed, or in a
LLeMbas terminal, listed them when carried on outside one. The headless
approval offers a typed command once only; the state publisher is started once.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The CLI's side of harness spec 3.12.0, for a terminal emulator with LLeMbas
built in. Without LLEMBAS_TTY nothing here applies.
- src/terminal/env.ts: the terminal's environment; `lembas --version --json`.
- src/terminal/uservars.ts, tui.ts: the TUI's state as user vars (OSC 1337
SetUserVar), on start and on change, emptied on every way out.
- src/terminal/context.ts, session.ts, command.ts: the context file — read
once, removed, checked — as one <terminal> block on the person's next
message; `--terminal-context` for the TUI and `lembas run`,
`/terminal-context` in the TUI; a chip in the transcript.
- src/tool/terminal.ts, src/terminal/pane.ts: terminal_run and terminal_read
through the terminal's own program, as an argument list.
- src/permission/evaluate.ts: a typed command is judged as bash would judge
it, then asked every time outside auto mode, never always.
- src/terminal/complete.ts: `lembas complete --shell`.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The contract between a terminal emulator with LLeMbas built in and the CLI,
written into the spec before the implementation that follows it:
- acp.md, "A terminal as the client": recognising the terminal by its
environment (LLEMBAS_TTY, LLEMBAS_TTY_PANE, LLEMBAS_TTY_EXECUTABLE), the
session's state as user vars, the terminal context file, the tools
terminal_run and terminal_read, `lembas complete --shell`, and what
`lembas --version --json` says.
- context.md §12: the <terminal> block of a message.
- permission/rules.md §4: a command typed into the person's terminal is
judged as bash would judge it, then asked every time outside auto mode.
- tools/terminal_run.json, tools/terminal_read.json (requires: terminal,
offered: main); loop.json `terminal`; conformance/terminal.json.
The CLI's alone: a server offers none of it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The display pane is a column of the root now: it stands at the right over the
terminal's full height, beside the prompt and the status bar, from 80 columns
(layout.ts decides both columns' widths from the terminal's width alone). Below
that it is no longer silently absent: the status bar names the key, and alt+d
puts the display in the transcript's place and back.
An images tab shows what view_image viewed, what show showed and what was
attached, drawn by OpenTUI's own image renderable (kitty graphics where the
terminal is found to support them, sixel, else blocks); `images: auto|on|off`.
The transcript has two views over the same items: full, and compact, where a
round of tool calls is one line and a failure or a refusal always has its own.
`transcript: auto|full|compact`, alt+t, /transcript.
The pane gets a session header, a tab bar that fits its width, clickable tabs
and rows of known width; the status bar has a short form for a narrow column,
and the welcome box's hints and the prompt's placeholder no longer wrap inside
a phrase.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
New `connection.md` and `connection.json`: the address rule, discovery and its
outcomes, identity (`llembas-<product>/<version>`), versions judged both ways,
a refused token, the link's handshake, close codes and liveness, the one
reconnect schedule, state between programs as codes, and the table of
conditions, codes and sentences. Conformance: `address` (47 cases), `version`
(31), `errors` (81), answered by `src/lembas/connection.ts`.
`acp.md`: a failed turn is reported in the prompt's answer
(`_meta.lembas.error`); `_lembas/complete` as the code reads it (`sessionId`,
`open`, `context`, `too_large`); the link's close code 4409 for a device
replaced by a newer link of itself, and `linked` only once `initialize` is
answered; `clientInfo`, and the answer to a client that says a higher protocol.
Two points are written as open, not as rules: which address a client stores,
and `min_clients` in discovery.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A client offering fs.readTextFile without fs.writeTextFile left the agent
unable to change any file it had read through the editor: with no write
to ask, every edit was answered "refused the write".
Spec (3.11.0, acp.md Unsaved text; conformance editor.json kind buffer,
2 cases more: 51): with such a client the device writes the disk. For a
file the session read through the client it asks for the text once more:
equal to the disk's, nothing is unsaved and the disk is written; different,
the call is refused with a sentence asking for the file to be saved in the
editor first.
Tests: both branches against a client that only reads, and a client that
writes (buffer and disk before it answers) taking two edits and a new file.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
After an independent review of the spec 3.11.0 work.
- acp/files.ts: a write judged its path, waited for the base hash, then
opened and renamed by name - a move in between could swap a link in and
send the write out of remote.roots. Changes now run one at a time for
every link of the process, a path is judged again after each wait and
must be the same place, the part file is proved to lie in the target's
own directory before the rename, and hashes and reads go through an open
descriptor. A part file is never removed by a name that may lead
elsewhere. Copy, delete and the listing of names for a search no longer
block; uploads are capped in all; a listing is cut before its entries
are looked at; names are kept for four folders; part files are hidden,
journalled and swept at start.
- remote.files_that_run_code (off by default; lembas remote
files-that-run-code on|off): off, _lembas/fs write, mkdir, move, copy
and delete refuse git's own directory, a project's agent configuration
and the user's start-up files with the reason runs_code. Said in the
limits.
- tool/buffers.ts: a file read through the editor is never read or written
from the disk behind it; previews record nothing; a write the client
never answered is not repeated. The client's fs capabilities are read on
stdio only.
- Rewrites are tracked from the start, capped at four, stopped with the
client; the id is read one way. show's handle is an open descriptor.
- A typed message beginning like the editor's block is shown; a closing
tag in a diagnostic or a selection cannot end the block.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Device files:
- Changes run one at a time on a device, and a method that waits for
anything between judging a path and acting on it judges the path again:
it goes on only when the path is still allowed and still the same place
(conformance device_files.json, kind again). What is read is read through
the file that was judged, held open.
- Files that run code - git's own directory, a project's agent
configuration, the user's start-up files (loop.json files.runs_code) -
are read, and changed only where the device's new setting
remote.files_that_run_code is on. Off by default, global config only,
said as limits.files_that_run_code in the hello and initialize; refused
with the reason runs_code and a sentence naming the setting.
- An upload is capped in all; part files are never listed or found and are
swept by the next process; nothing of what a link that leads out points
to is said; large work does not stop the device answering.
An editor as the client:
- ACP's fs capabilities are honoured on serve --stdio only.
- Text the session read from the editor is never replaced from the disk: a
client that does not give it again, or refuses the write, refuses the
call; a write nobody confirmed is not repeated on the disk. Only the
read tool and a write that ran count as reading (kind buffer).
- Rewrites: at most editor.rewrite.concurrent_max at once, all stopped with
their client, a cancel taken at any time.
- The editor block: a closing tag inside a selection or a diagnostic cannot
end it; a typed message that begins like the block is shown as typed.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The CLI's side of harness spec 3.11.0, on serve --stdio and on the link.
- acp/editor.ts: _lembas/complete (one HTTP request with the login the
agent holds, the window trimmed, a newer request closes the older one's
connection and that one is answered as cancelled), _lembas/edit (one
model request with no tools; the stream cleaned of a fence around the
whole answer and given the selection's ending; deltas; cancel),
_lembas/models, _lembas/editor/settings, the editor block of a prompt,
and ACP diff items.
- acp/files.ts: _lembas/fs/list, stat, read, write, mkdir, move, copy,
delete, search. A path is judged where it really is, symlinks followed
first; outside remote.roots, the CLI's own directories and protected
paths are refused, and so is a folder that holds them; read-only where
the device allows plan mode only. A write is checked against the hash
the client last saw, twice for an upload in parts, and put in place
whole. A delete goes to the system's trash or is refused until the
client says permanent.
- tool/buffers.ts: read, write, edit, multiedit and apply_patch take a
file's text from the client's editor and write through it where the
client offers ACP's fs methods; any failure there is the disk. The call
is judged before any of it, as before. An overwrite of text that changed
in the editor since it was read is refused.
- A tool's preview gives each file's text before and after beside the
unified diff; a client that said editor: true gets them as diff items on
the approval card and on every finished edit. The texts are kept only
for such a client.
- tool/show.ts: to a client that said media: true a file that is not text
is handed over by a handle (_lembas/show/read), good while the request
is open and for that file as it was; a table, an SVG and a notebook are
named. On stdio the request also says where the file is.
- The hardline, the modes and the rules are untouched; tool/replace.ts is
untouched.
Tests: tests/acp-editor.test.ts (19), tests/acp-files.test.ts (13), and
the conformance areas editor, device_files and show.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- The HTTP API: /v1/lembas/* answers errors in OpenAI's shape
({ error: { message, type, code } }); the device passes message on
unchanged. 404 with a sentence is a model that is not the account's, a
bare 404 a server before 3.11.0; 429 and 400 said. _lembas/complete's
reasons gain unknown_model, busy and invalid; /v1/models carries no
autocomplete flag, what a model may be picked for is read from allowed.
- Device files: a folder that holds the CLI's own files or a protected path
is not deleted, moved or copied whole (conformance device_files.json,
4 cases more: 35).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The harness spec for the editor round, written before the implementation.
Three capabilities, one prompt text, one tool's description; no new tool,
and nothing about permissions or the hardline changes.
acp.md, "An editor as the client" (capability editor; a client says
clientCapabilities._meta.lembas.editor: true):
- _lembas/complete: prefix and suffix in, the insertion out, through the
server's POST /v1/lembas/complete. No session, nothing read per request;
a newer request cancels the older, which is answered
{ text: "", cancelled: true }; _lembas/complete/cancel by the client's
own id in the params.
- _lembas/edit: a selection and an instruction in, the replacement out. One
model request with no tools (prompts/tasks/rewrite.md), streamed as
_lembas/edit/delta, _lembas/edit/cancel. Nothing is written.
- _meta.lembas.editor on session/prompt: the file in front, the cursor, the
selection, diagnostics and open files, said to the model as one <editor>
block after the person's text.
- ACP fs/read_text_file and fs/write_text_file, where the client offers
them: the file tools read its buffers and write through them; any failure
falls back to the disk; permissions are judged exactly as before.
- Edits as ACP diff items on session/request_permission and on a finished
edit's tool_call_update, for a client that said editor: true.
- _lembas/models and _lembas/editor/settings (GET/PUT /v1/lembas/editor).
acp.md, "Device files" (capability fs, on the link only): _lembas/fs/list,
stat, read, write, mkdir, move, copy, delete, search inside remote.roots.
Symlinks followed before a path is judged; never the CLI's own files or a
protected path; read-only where the device allows plan mode only; a write
checked against the hash the client last saw; a delete goes to the trash
or is refused until the client says permanent.
acp.md, _lembas/show (capability media): to a client that said media: true
the show tool hands over a file that is not text by a handle the client
fetches with _lembas/show/read while the request is open. The kind sent is
a hint from the name; the client decides from the bytes.
The HTTP API gains POST /v1/lembas/complete and GET/PUT /v1/lembas/editor.
loop.json: editor, files. Conformance: editor.json (39), device_files.json
(31), show.json (18) - skipped here until their runners exist.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Spec (3.10.0, unreleased; part of capability harness_turns), acp.md
_lembas/steer:
- A session/prompt whose turnId is the messageId of a steered message the
device still knows does not run. It is answered at once, stopReason
"end_turn", with _meta.lembas.steered: "taken" (the model has been given
it), "carried" (it waits for the next turn's first step) or "waiting" (it
is in the running turn's queue). A client that lost the link and cannot
tell what became of a message can send it again safely. An id handed back
as unsent is the client's again and runs. The ids of the last 200 messages
taken in are kept with the session, across a restart.
- A prompt's turn that ends with no link up carries its too-late steers to
the next turn's first step, as a turn the harness started does: unsent in
an answer nobody reads was a message lost. With a client there, unsent as
before.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A prompt can wait behind a turn its client did not start, and ACP's cancel
names no turn: a client stopping a reply whose prompt still waited stopped
whatever ran instead, and its own prompt ran later with nobody following.
Spec (3.10.0, unreleased; part of capability harness_turns): an optional
_meta.lembas.turnId on session/cancel. Running: stopped. Queued: taken out
of the queue, its session/prompt answered stopReason "cancelled" at once (a
scheduled one with scheduled.status "cancelled"), the running turn not
touched, the id still known. Neither: nothing. Without the id: the running
turn, as before. Sent as a request, the cancel is answered
{ cancelled: "running" | "queued" | "none" }. conformance/cancel.json, 7
cases (acp/turns.ts cancelOf).
Device: acp/agent.ts (a prompt that waits can be withdrawn), and for a
session a terminal runs acp/share.ts (hub/cancel as a request with the
turn; a web prompt not yet started there is withdrawn, and nothing is sent
when its place comes). A terminal of a build without that request is not
told to stop whatever runs.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Seven findings of a review of the wake-turn work, each with a test that
failed before (tests/acp-outstanding.test.ts).
1. A session whose subagents work, or whose background command runs, with no
turn running was idle to the service: an update restarted it under them
and a terminal opening the session stopped them, so no report came. It is
occupied now (acp/agent.ts occupied, keeps; hub.busy): no restart, no
close of the link, and a terminal is refused in words that name what runs
— also while no link is up, when nothing judged it at all.
2. A scheduled run that used a team answered with the reply that ended the
main agent's first turn, and the real answer came in a turn report_write
was not offered in. The run's turn now waits for its subagents and takes
their reports in (engine awaitReports, EngineOptions.hold): one turn, the
answer and the report from its last reply.
3. Stop while a turn waited for a model slot lost the note that started it
(and a person's own message, and whatever waited to go in with it): the
message is in the conversation now, under the turn's id.
4. A steer a harness turn never took in, with no client listening, stayed in
memory: lost by a restart, and in queue mode handed back with a later
prompt. It is kept with the session (CARRIED_META) and taken in at the
next turn's first step in every mode, said with its id.
5. A wake refused for an interactive-only model left the main agent marked
working, holding its slot, and dropped the report: the session is idle
again and the note is kept for the next message.
6. Stop on a scheduled run stops its subagents, as does any other end of the
run's turn with subagents out. In a chat Stop stops the turn and no
subagent, as the terminal's Esc does: pinned by a test, not changed.
7. The task end that carries unsent is said before the inbox event that
empties the queue.
Notes left after a Stop are kept with the session too (engine.keepNote), so
a restart does not lose them. AcpAgent.holding, anyBusy and drop had no
caller left and are gone.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Amended before any release carried 3.10.0, after a review of the implementation.
No capability, field or method is added.
- acp.md, Scheduled work: a scheduled turn does not end while a subagent it
started is still out. The turn stays open (waiting_for_subagents), each
report comes into the same turn, the answer's text and report are from the
last reply. Background commands are not waited for. Stop on a scheduled
turn, and any other end with subagents still out, stops them.
- acp.md, A session that still has work out: with no turn running, a working
or waiting subagent, a report about to wake the main agent, or a background
command makes the session not idle for the device: the link is not closed
for a change of limits, a service does not start again for an update, and
a terminal that opens the session is refused in words.
- acp.md, session/cancel and A turn the harness starts: Stop stops the turn
and no subagent; a turn stopped while it waited for a slot is in the
history like any stopped turn; undelivered notes are kept with the session.
A steer nobody could be handed is kept with the session and taken in at the
next turn's first step, never also handed back; the task end that carries
unsent comes before the inbox event that empties the queue. A wake that may
not start a turn leaves the session idle and the note kept.
- reports.md §2: the run is the schedule's turn, whole.
- conformance/outstanding.json (8 cases) and its runner,
src/session/outstanding.ts.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
In a session the service holds, "a turn runs" was `prompting`, which only a
session/prompt sets. A turn the harness started (a job's note waking the
session) therefore read as idle: status said not busy and named no turn, a
steer was refused, compact and rewind were let through, the session could be
let go of and the link closed under it, and a prompt that arrived meanwhile
ran into the engine, failed with "busy" and left the turn log saying the
wrong turn had finished.
The link's agent now follows every `task` event: a turn no prompt of the
client's began is kept in the session's turn log (as a terminal's turns are)
and holds the prompt queue until its end. `working()` is the one question
status, steer, compact, rewind and letting go ask. A message steered into
such a turn and not taken in goes back as `unsent` on its `task` end.
`_lembas/session/history` marks the note's user turn `machine`.
tests/acp-wake-turn.test.ts: status during the turn, the history, a steer
joining it, Stop, a prompt waiting behind it, and two notes in a row — as two
turns in order, and as one turn when the second arrives while the first runs.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A note that wakes an idle session (a finished job, a subagent's or a team's
report) already had an id of its own on its task and prompt events. The spec
did not say what a client may ask about such a turn. acp.md now does, in a
section of its own and on each method:
- capability `harness_turns`;
- status: busy, the turn named, then lastTurnId;
- steer: accepted; what the turn ended before taking in comes back as
`unsent` on its `task` end event;
- cancel stops it; a prompt waits behind it; compact and rewind are refused;
- history: its user turn carries `machine`, its turnId and the whole note;
- the order of its events, that turns never overlap, and what two notes in a
row are;
- the client never sends such a row to the device as a prompt.
conformance/reattach.json (9 cases) is the client's decision for a row after a
restart, for a person's turn and for the harness's; the CLI keeps that rule in
acp/turns.ts for the cases, as it keeps the client's model rule.
blocks/team_lead.md, one bullet more: a report starts the main agent's next
turn by itself; it answers the person then, unasked, and never tells the
person to ask again.
Clarified, not changed: on a machine turn's prompt event, `text` is the line a
transcript shows, not the whole note.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
From an independent review of the round. Spec and CLI together.
- A scheduled prompt for a session open in a terminal is judged, then
refused (data.reason terminal) instead of being passed to the terminal as
a person's turn on the terminal's model.
- A schedule's session keeps its model with it: opened from the store again
— or in a terminal — it is on the model it had, and stays a schedule's
session there (nothing in it becomes the directory's model).
- On a refused scheduled turn nothing about the session is changed; a
command's interactive-only model in one is the same -32602 with its
reason. In a schedule's session a turn a job wakes, and a subagent started
with no person's turn running, are still scheduled work.
- A rerouted title or summary is counted under the model that was asked and
that model is named; a model that cannot take a summary (window too
small, no tools) is nowhere to go.
- A borrowed model is given back with returnModel, so a command whose model
is the session's own leaves nothing borrowed. What is remembered goes
through records(), the rule the conformance cases test; a change of model
inside a turn the harness started is not remembered.
- models.json: a directory's time is refreshed as it is used; a write stats
nothing, and gone directories are dropped apart from any turn.
- lembas run with no terminal says the way forward, in the refusal and in
--help.
- Permission rules: a rule written again (the same permission and pattern,
later) sets the earlier one aside, as a narrower one does. Cases pin it.
- Conformance and the examples use made-up model names.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Spec 3.9.0, interactive.md §1 and §3: when a subagent's model is
interactive-only, the summary of its conversation is asked of that model's
twin, else of a default that is not interactive-only, else it is skipped —
said once, to the session the subagent works for — and the subagent goes on.
Before, only the session's own compaction went elsewhere.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Harness spec 3.9.0 (interactive.md), the CLI's side.
- interactive_only is read from /v1/models; /model says which models are
for interactive use only.
- A session's title and its compaction, asked for or automatic, are not
asked of an interactive-only model: they go to its twin, else to the
global model or the server's default when that is not interactive-only;
with none the title is left, automatic compaction is skipped and said
once, and a compaction asked for is refused in the spec's words.
- Scheduled work never uses one: a scheduled session/new or session/prompt
is refused with the sentence and data.reason interactive_only before
anything is sent, a scheduled turn cannot switch to one or start a
subagent on one, and a scheduled session opened with no model skips one
the directory remembers. lembas run with no terminal at all is the same.
- A person's turns, and the subagents of their session, are untouched.
Also the type of LOOP.interactive, which the spec commit left too narrow
for the JSON it reads.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Still 3.9.0, unreleased. A model served through a connection its provider
sells for a person's own turns only says interactive_only: true.
- interactive.md: what is interactive and what is not; scheduled work never
runs on such a model (a schedule may not name one, a run fails with the
sentence, a device refuses the scheduled turn itself and its subagents, a
one-shot run with no terminal ends at once); a session's background calls
— its title, its compaction — go to the model's twin, else to a default
that is not interactive-only, else are skipped or refused in words.
- models/schema.json: interactive_only. loop.json: interactive (the field,
the reason, the two sentences, what each background call does).
- acp.md: the field on /v1/models, data.reason interactive_only, the run's
model.
- conformance: interactive.json (twin, background, scheduled); three cases
in last_model.json.
The rules as functions, for the cases; the CLI's wiring follows.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
How a schedule opened its session (its notify-when among it) lived in the
agent's memory only. After a restart of the service a continuing schedule's
session came back from the store without it, and its next run was told to
file a report with a tool it had not been given. It is kept in the session's
meta now, where the mark that a schedule opened it already was.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>