Skip to main content

Module engine

Module engine 

Source
Expand description

The contract of a harness in process (INT-9, docs/PLUGINS.md §4.5 and §4.6): what the core and the plugin of a harness say to each other. The core launches the harness itself, from the description the plugin gives (engine/launch), after it checked it (the fence of private projects, read-only, the token of Escouade’s server never among the arguments, the files written in the agent’s own folder only). What the harness says comes to the plugin in batches of raw lines (agent/frames), which it translates into normalized items and effects (Item) that the core applies to the agent. What the plugin has to write to the harness comes back in its answers (writes), and the core writes it on the harness’s input. The PTY of a terminal view never goes through the plugin: only its launch (terminal/launch) and its hooks (terminal/hook), both ways.

Every type tolerates what it does not know: a field added later is left aside, an item of an unknown op is Item::Unknown, which the core ignores.

Modules§

method
The methods of the contract, all called by the core.

Structs§

AcpDecl
How an ACP agent is driven (ACP v1: JSON-RPC 2.0, one message a line on its input and output).
AgentRef
AnswerPermission
AnswerQuestion
Asked
The answer of a call whose end is the harness’s to tell (agent/interrupt, agent/setModel, agent/control…): writes go to its input, and Item::Answer under ask brings what it said. An answer without ask is over as it is.
Attach
An agent given to the plugin: what it cannot know by itself, given again after each restart and each change.
CapsDecl
What it can do; what is left out, it cannot.
Close
Compact
Compacted
EngineProcess::compact’s answer: it is over; false, it runs as a turn the harness ends itself.
Control
Diff
A write a permission would make: its file, before (None for a file added) and after.
EnvVar
A variable of a launch.
FileToWrite
A file the core writes before the launch, in the agent’s own folder.
Frames
A batch of what the harness wrote: each line as it read it, never read again by the core.
Gone
method::PROGRAM_GONE: how it ended, and what it said last on its error output.
Grant
Escouade’s MCP server given to the agent. The plugin may put the token in a variable or a file of the agent’s own, never among the arguments: the core refuses such a launch.
HarnessDecl
A harness as a manifest declares it (contributes.harnesses[]): all the core needs without starting the plugin (the welcome screen, the menus, the accounts, the memory).
Hook
One of its hooks, and what the core has to answer it: the hook goes both ways (what Escouade adds for the model, a call it refuses).
HookAnswer
What a hook made: items for the agent, and the hook’s answer as its harness reads it (None: nothing).
HookReply
What the core answers a hook, which the plugin puts in its harness’s form.
InstallDecl
Its installers.
Interrupt
What agent/interrupt is told (a plugin may read it as an AgentRef).
Items
What a batch made. The answer to any call that answers Writes may be this instead: its items applied, in their order (a message that starts a program again: Item::Relaunch, then its Item::Write).
Launch
The description of a launch (engine/launch, terminal/launch): never its program, which the core found itself (locate), and runs in its Job object, under WSL when need be.
LaunchParams
What engine/launch is told.
Locate
MemoryDecl
ModeDecl
A mode of Escouade a harness takes (default, plan, acceptEdits, bypassPermissions), and what it means there, as the menu says it. Written as its id alone, or { "id", "meaning" }.
ModelDecl
ModelTurn
What a model cost in the turn that ends (Item::Result).
OneShotLaunch
How the core runs it: the arguments, the variables, and what goes on its input.
OneShotOutput
OneShotParams
What engine/oneShot is told: one question, no session, no settings of the user’s, no MCP server.
OneShotText
Open
What agent/open is told: the agent’s session, on the shared process of its agent/attach.
Opened
What agent/open found.
Pushed
method::ITEMS.
RemoteLink
method::REMOTE: its session linked (name on the vendor’s site, kept when it ends if keep, joining the session reattach), or unlinked.
SendMessage
SetValue
SharedLaunch
How a process shared by agents starts and is shared. It runs in a folder of its own, none of the agents’: a worktree removed would find it held. It lives from its first agent to its last, in the core’s Job object.
SharedRef
The shared process an agent is on: enough for a plugin that started again to find it.
Task
One of its background tasks.
TerminalParams
What terminal/launch is told: the agent’s interface in a terminal, its hooks pointed at Escouade.
TestedDecl
TurnUsage
The tokens and cost of a turn.
Usage
The quota its process read (usage::parse_windows reads its windows); null when none.
UsageAsked
The answer of agent/readUsage when the quota is to be asked of the harness: writes go to its input, and Item::Usage brings what it said.
Writes
What the plugin writes to the harness, line by line.

Enums§

Item
A normalized item or an effect, which the core applies to the agent: the same as the conversation’s (user, text, thinking, tool, question, permission, turn, notice) and the effects (Effects of agent.rs).
StartAt
Where a conversation starts from.
Text
A text in the languages of the app: one for all, or by language ({ "fr": "…", "en": "…" }, English when the language is missing).

Constants§

BATCH_BYTES
How many bytes of lines a batch of agent/frames carries at most. A batch is what was read while the last one was with the plugin: none waits for more lines, a lone line goes at once.

Functions§

hunks_of
The hunks of a unified diff, as Claude Code’s structuredPatch has them.