OpenPE exposes a per-project Uniform API for Human and Agent adapters, three scoped Agent tools, an authenticated local HTTP service and a narrow Electron bridge. The Uniform API is the application automation interface: discover its live catalog before invoking a command. HTTP and Electron interfaces provide bounded transport, persistence and native services; a capability ID is not an HTTP route or a method on window.openpe.
Registrations cover Core, host, built-in features and installed runtime plugin capabilities. A mounted project's catalog depends on plugin and lazy-view lifecycle; runtime discovery is authoritative for its available queries and commands. This reference covers the implemented interfaces in the architecture; task-level automatic layout, arbitrary FEM inputs, analytical-model execution, OpenSCAD import/execution and runtime Skill loading have no registered API.
GUI/Agent parity covers design, simulation and project-file operations through shared preparation and transactions:
| GUI work | Agent route | Shared boundary |
|---|---|---|
| Schematic symbol drawing, placement, Properties, wiring, connected pickup, copy/paste and removal | schematic.*, part.*, library.* |
Validated Core edit; original identities/connections retained, copies receive fresh identities |
| PCB footprint drawing, placement, routing, pickup, Properties, zones and board drawings | layout.* |
Shared geometry and undo, with footprint positioning rules |
| Model CAD and component model selection | modelCad.*, enclosure.exportStep, layout.model.* |
Exact host-prepared geometry/resource identities, then Core validation |
| Electrical, PCB and Model preview checks, severities and native board minima | schematic.erc, layout.drc, workbench.rules.*, layout.drc.settings |
Same applied settings and checks, with native minima edits in Core |
| Project component clearance and component placement rules | part.rules.get, part.rules, layout.drc.settings |
Shared component rule preparation, native settings and whole-project undo |
| Pad placement rules | pad.rules.get, pad.rules.list, pad.rules |
Shared rule validation, native PCB object IDs and whole-project undo |
| SPICE and Layout Thermal settings, probes, Run/Stop and supported result operations | simulation.*, thermal.*, part.spiceModel.*, part.sourceType |
Same mounted plugin handlers, saved-destination gates and automatic verified result restoration |
| Layout parasitic analysis and EMC review/report export | parasitics.*, emc.* |
Evidence from accepted board data and shared plugin validation |
| Native Source, Save/Save as, export and local history | workbench.sourceFile, source.*, project.save, project.export, workbench.export*Image, versions.* |
Same Source/revision gates, native grants and history restoration |
| New/open/example/close/Explorer and ordinary project text | project.new/open/openExample/close/reveal, project.examples, project.files.* |
Origin-bound workspace actions and existing file drafts/native pickers |
Model contents and logs remain unavailable to Agents, including explicit project-file reads/writes. Ordinary files are never added automatically to Agent context. Credentials, unrelated projects and arbitrary host paths remain outside these interfaces. Display settings and provider/plugin management are separate from this parity scope. Compatible runtimes for all four Workbench Agents use the same scoped tools. See Agent tools for provider transport limits.
- Uniform API contract
- Project and Source capabilities
- Schematic and component capabilities
- Layout capabilities
- Model CAD capabilities
- Rule-check queries
- Workbench and history capabilities
- Library capabilities
- Plugin lifecycle capabilities
- SPICE capabilities
- Layout Thermal capabilities
- Layout Parasitics capabilities
- EMC Analysis capabilities
- Agent tools
- Browser development preview transport
- Local HTTP service
- Electron bridge
- Component STEP models
- Examples
- Sources and maintenance
api/capabilities.ts exports createCapabilityHost() and the capability types. Workbench creates one host per project and supplies its Core revision getter. Callers receive JSON copies, not mutable Core objects or reusable native file handles/grants. Native model references can still contain path-like design metadata.
| Method | Result and behaviour |
|---|---|
register(definition) |
Returns an unregister function. Rejects duplicate/invalid IDs, invalid owner/level combinations and unsupported schemas. Unregister aborts requests owned by that registration. |
catalog() |
Returns CapabilityDescription[] with current availability. Equivalent discovery is query('capabilities.list'). |
query(id, input?, options?) |
Returns Promise<unknown> for a registered query after JSON, schema and availability checks. Omitted input becomes {}. |
execute(id, input?, options?) |
Returns Promise<unknown> for a registered command after revision, JSON, schema and availability checks. The handler performs domain/native checks. |
emit(type, data) |
Publishes a bounded JSON event. Type starts with a letter and uses letters, digits, ., _, :, -, up to 128 characters. |
subscribe(listener) |
Returns an unsubscribe function. Receives ordered event copies; observer errors cannot interrupt other observers or committed edits. |
observe(after = 0) |
Returns {cursor, events, truncated}. after must be a nonnegative safe integer. Truncation requires a fresh state query. |
suspend(reason) |
Makes commands unavailable and aborts active requests; query handlers retain their own availability gates. Used while closing a project. |
resume() |
Restores a suspended host after a failed/cancelled close. |
dispose() |
Revokes registrations, aborts requests and clears observers/events. |
type CapabilityOptions = {
signal?: AbortSignal;
actor?: 'human' | 'agent' | 'system'; // Defaults to human.
requestId?: string;
expectedRevision?: string;
resultDelivery?: Promise<boolean>; // Adapter acknowledgement for deferred lifecycle actions.
onAfterResult?: (completion: Promise<void>) => void; // Drain accepted lifecycle actions at normal EOF.
onProgress?: (data: JsonValue) => void; // Receive bounded progress for this Human invocation.
};
type CapabilityDescription = {
id: string;
kind: 'query' | 'command';
description: string;
inputSchema: Record<string, unknown> | boolean;
mutation: false | 'document' | 'session' | 'external';
review: 'none' | 'optional' | 'required';
revision: 'project' | 'independent';
owner: 'core' | 'host' | 'plugin' | 'api';
level?: 'object' | 'operation' | 'task';
plugin?: string;
available: boolean;
reason?: string;
};
type CapabilityEvent = {
seq: number;
time: string; // ISO timestamp.
type: string;
data: JsonValue;
};Registration additionally supplies handler(input, context), optional available() => true | false | string, and required owner and optional mutation/review/revision/level/plugin metadata. Handler context contains signal, actor, requestId, optional expectedRevision, emit and afterResult(action). A command may defer one workspace lifecycle action until its result is delivered; queries cannot defer actions. Omitted mutation/review/revision default to false/none/project; every registration must declare its owner explicitly. Only session commands may declare revision: 'independent'; unknown policies fail registration. Plugin ownership requires a nonblank plugin ID, and other owners cannot declare one. Queries cannot declare a truthy mutation.
owner identifies the implementing layer; level identifies a domain abstraction. Neither grants permission. mutation describes possible effects rather than promising that every call changes a document. A no-op can leave the revision/undo unchanged. The tables below use O for object-level, P for operation-level and — for no level. There are no task-level registrations. Commands that change designs, Source/ordinary-file drafts, applied rule severities or external files declare review: 'optional'. Presentation controls declare review: 'none'. The Agent adapter enforces Review and Auto.
The numeric schema subset includes positive finite multipleOf, using the document
validators' four-decimal quotient tolerance for binary division noise. PCB
property schemas in core/layout-property-schemas.json
are generated from the canonical definitions in scripts/build-format.mjs;
local nonrecursive references are expanded before registration. Complete Core
validation still checks object associations, aggregate limits and native geometry.
Inputs/results must be finite JSON. Defaults are 32 MiB per input/result, nesting depth at most 128, 64 KiB per event and 256 retained events. Host options can change maxDataBytes, maxEventBytes, eventLimit (clamped to 1–2,000), now and revision. Inputs use the bounded interpreted JSON Schema subset in api/capability-schema.ts; unsupported keywords fail registration. Results are checked as bounded JSON; there is no registered output-schema field.
The mounted host rejects a project-dependent command whose supplied expectedRevision differs from the current Core revision, checking again after synchronous availability and start observers before calling the handler. Core checks direct calls too; asynchronous library handlers recheck after loading. simulation.cancel declares revision: 'independent': Stop changes only the originating project's simulation session and ignores project revision hints, while retaining schema, review, availability, cancellation and close/disposal gates. Other commands retain the default project policy. Revisions are strings at this boundary, including changes to Source drafts and editing barriers. A revision does not version all presentation/plugin state. Actor metadata does not bypass review, Source gates, plugin lifecycle or native grants.
Successful invocation emits capability.started and then capability.completed; handler failure/cancellation emits capability.failed/capability.cancelled. These events contain {id, requestId, actor} and failure/cancellation adds a bounded message. Pre-handler validation failures can reject before started. Registration, unregistration, suspension and resumption emit their own events. Cancellation is cooperative: adapters must honour the supplied signal; it is not a rollback of completed external writes.
A Human caller may register onProgress for a single invocation. Its handler
can deliver bounded JSON through context.reportProgress while that call is
active. Progress stays with the caller and is omitted from observation and
Agent transport.
Unknown IDs, wrong query/command kind, invalid input, stale revisions, unavailable handlers and domain failures reject the promise with an Error. Cancellation commonly uses AbortError. There is no uniform typed error-code enumeration across all capabilities.
In tables, ? means optional, {} means no input fields, string[] means an array and unions use / to keep cells readable. Except where specified, schemas reject extra properties. Numbers are finite. Geometry uses millimetres, angles degrees and simulation time seconds. Callers should use the intended editor grid (1.27 mm in Schematic). Placement, Properties, wire and annotation handlers apply their shared domain snapping rules; do not assume every movement delta or explicit pivot is snapped by the API. The Layout host does not inject its displayed spacing into command arguments.
type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };
type Point = { x: number; y: number };
type RevisionResult = { revision: string };
type EditResult = RevisionResult & { selection?: string[] };
type NativeFiles = {
entry: string;
files: { name: string; source: string; encoding?: 'latin1' }[];
};
type CoreMetadata = {
revision: string;
editingBlocked: string | null;
sourceDraft: string | null;
sourceError: string;
canUndo: boolean;
canRedo: boolean;
undoDepth: number;
redoDepth: number;
};
type ProjectSnapshot = CoreMetadata & { project: CanonicalProject | null };Canonical component simulation records include optional modelSource: "basic" | "external" for the active model choice, optional passiveModel: "R" | "C" | "L" (native OpenPE.PassiveModel), optional sourceType: "DC" | "PULSE" | "SIN" (native OpenPE.SourceType) for the intrinsic voltage waveform, and optional initialVoltage (capacitors) and initialCurrent (inductors) string parameters. Properties and Agent field edits retain these through the existing part.properties command and native fields; no separate execution permission is added.
CanonicalProject means the validated private JSON query/snapshot representation defined by Format and lib/project-document.ts. A single-file query returns a canonical project containing that schematic. It is not a public on-disk design format. Native user projects remain KiCad file sets. project.source and source.get().source serialize this private representation; source.files supplies the actual native text files shown in Source.
Agent observations omit optional native backing from canonical projects and
historical Source; source.files excludes model/log bodies. Human GUI reads retain
complete native data. Agent result envelopes report sourcePending and
draftCharacters with sourceDraft:null and generic Source diagnostics, so invalid
aggregate drafts cannot expose private parser excerpts. Explicit native design
text remains available through source.files.
Agent project/Source replacements reject explicitly supplied model/log bodies and retain protected native files internally from accepted Core state when omitted. This preserves exact bytes without returning them or introducing placeholder data. Protected GUI Source drafts require review in the editor before Agent commands can apply/discard them or implicitly apply them through Save/view/export. Known history restoration and native resource pickers remain bounded host operations.
Core IDs are generally 1–200 characters; Core Point coordinates are bounded to ±100,000 mm. Specific operations can impose narrower bounds. Discover the full inputSchema for exact lengths, enums and nested limits.
Owner is core, except capabilities.list (api). Queries have mutation false. Commands in this section have no abstraction level; Source update/updateFile/discard mutate session, and the remaining commands declare document.
| ID | Kind | Input | Result and behaviour |
|---|---|---|---|
capabilities.list |
query | {ids?:string[],prefix?:string,kind?:'query'/'command',includeSchema?:boolean} |
Current matching descriptions, including discovery itself. includeSchema:false omits inputSchema; default/omitted input returns complete schemas. |
project.snapshot |
query | {} |
ProjectSnapshot. |
project.get |
query | {} |
CanonicalProject or null. |
project.source |
query | {} |
Canonical private JSON string. |
core.state |
query | {} |
CoreMetadata & {hasProject:boolean, sourcePending:boolean}. |
source.get |
query | {} |
{source:string, sourceDraft:string/null, sourceError:string}. |
source.files |
query | {} |
NativeFiles, including pending native file edits when present. |
history.get |
query | {} |
{canUndo, canRedo, undoDepth, redoDepth}. This is document undo, not Git. |
project.replace |
command | {source:string} |
ProjectSnapshot; validates and replaces the whole project as one undo edit. |
source.update |
command | {draft:string/null} |
Same result as source.get; updates the private aggregate draft without applying it. Prefer source.updateFile for native text editing. |
source.updateFile |
command | {name:string, source:string} |
NativeFiles; changes one loaded native file's draft. name comes from source.files, not a filesystem path. |
source.apply |
command | {} |
ProjectSnapshot; validates all pending files and commits once. Invalid drafts remain pending and the command rejects. |
source.discard |
command | {} |
Same result as source.get; clears all pending drafts/errors. |
history.undo |
command | {} |
boolean; undo one complete project edit. Host availability rejects when no undo is available. |
history.redo |
command | {} |
boolean; redo one complete project edit. |
Pending Source blocks non-Source document commands, undo/redo and version creation/restoration. Read queries remain usable except schematic.erc, layout.drc and layout.placement.preview, which require applied Source. File drafts survive file selection; applying them is atomic at the project transaction level. Opaque aggregate sourceDraft can contain a native-file envelope; do not assume it equals the currently selected file's text. Per-file text comes from source.files.
project.rename is a Core object command with input {name:string} and result
ProjectSnapshot. It trims and validates the GUI's 1–120 character single-line
display name and updates native project settings as one undo edit. Source,
revision and close barriers apply.
part.section is a Core object command with closed input
{schematicId,partId,section:'hardware'|'simulation'} and EditResult output.
It changes the component's native board-inclusion flag across its units, preserving
simulation participation, model fields and Footprint assignment. Setting simulation
removes linked PCB packages and retains copper in the same undo transaction;
Setting hardware enables native board inclusion; a component without a Footprint
still belongs to Virtual. The UI names are Real for hardware and Virtual for
simulation. Assigned components use normal package preparation.
Source, close,
revision and validation gates apply. Native section ownership
and view behavior are separate
from this document edit.
The following Core commands share canvas/Properties preparation. They return
EditResult; creation commands additionally return the created or retained ID
in selection. All require schematicId and share the normal revision, Source,
validation and undo gates.
| ID | Additional input | Behaviour |
|---|---|---|
schematic.label |
{id?,text?,position?,scope?:'global',shape?} |
Create a local/global label or update an existing label. Creation requires position, defaults text to NET and global shape to input; updates preserve omitted properties and UUID. Positions snap to 1.27 mm. Shape is input, output, bidirectional, tri_state or passive and requires a global label. Names must be nonblank and at most 4,096 characters. |
schematic.noConnect |
{position:Point} |
Place on an existing component pin; retain an existing marker without an undo edit. |
schematic.text.position |
{id,position:Point} |
Set a Reference/Value/Sim.Params field or annotation position through moveText. Component field IDs use field/<component UUID>/<field name>. |
schematic.simplify |
{} |
Apply the canvas menu's topology-preserving wire simplification once. |
Owner is core; editing commands declare mutation document. schematic.place and part.footprint are host-backed object commands documented under Library capabilities.
| ID | Kind / level | Input | Result and behaviour |
|---|---|---|---|
schematic.list |
query / — | {} |
{id,name,primary}[] with one project schematic and primary:true. |
schematic.get |
query / — | {schematicId:string} |
CanonicalProject for the current schematic. |
schematic.erc |
query / — | {schematicId:string,settings?:{severities?:SchematicRuleSeverities}} |
RuleCheckResult & {revision:string, schematicId:string}; checks the project schematic. See Rule-check queries. |
schematic.drafting |
query / — | {schematicId:string} |
Read-only SchematicDraftingReport with current revision, validated-sheet pin/body geometry and advisory label-linked physical islands. Pending Source is reported, never applied. |
schematic.operations |
command / P | {schematicId, operations:Operation[]} |
EditResult; 1–100 operations applied atomically. |
schematic.move |
command / O | {schematicId, ids:string[], delta:Point} |
EditResult; leaves unselected wires in place. |
schematic.drag |
command / P | {schematicId, ids:string[], delta:Point} |
EditResult; repositions components with attached wire rerouting and original pin connections in one undo transaction. Use for connected component movement. |
schematic.transform |
command / O | {schematicId, ids:string[], operation:'rotate'/'rotateReverse'/'mirrorX'/'mirrorY', pivot?:Point} |
EditResult; one transform transaction. |
schematic.pose |
command / P | {schematicId,ids:string[],anchor:Point,target:Point,operations:SchematicMoveOperation[],connected:boolean} |
EditResult; applies a complete canvas pickup pose in one undo transaction, including ordered rotations/mirrors and final translation. Connected mode reroutes attached networks; disconnected mode leaves unselected wires in place. |
schematic.delete |
command / P | {schematicId, ids:string[]} |
EditResult; shared deletion rules remove complete attached leads and orphan annotations while preserving surviving shared networks. |
schematic.duplicate |
command / O | {schematicId, ids:string[], delta?:Point} |
EditResult with newly created selection IDs; copies receive fresh UUIDs/references. Default delta is {x:10.16,y:10.16} mm. |
schematic.paste |
command / P | {schematicId,source:string,ids:string[],delta:Point} |
EditResult with fresh selection IDs; pastes retained objects/native annotations from a validated same-sheet snapshot without replacing current objects. Shares GUI clipboard preparation and reference allocation. |
schematic.wire |
command / P | {schematicId, points:Point[]} |
EditResult; commits all route legs and deliberate segment splits once. 2–30,000 points. |
schematic.wires |
command / P | {schematicId, routes:Point[][]} |
EditResult; 1–100 explicit polylines, each with at least two points, at most 30,000 points in total. Reuses ordered canvas wire preparation and commits once. |
schematic.annotation |
command / O | {schematicId, text:string, position:Point, id?:string} |
EditResult. Creates native plain text at a grid-snapped position. An existing plain-text UUID updates its text and retains its position. |
schematic.note.properties |
command / O | {schematicId, id, changes:NoteProperties} |
EditResult. Edits the selected native annotation, text box, rectangle or polyline through the same preparation as the Properties dock. |
part.properties |
command / O | {schematicId, partId, reference?:string, value?:string, fields?:FieldRow[], position?:Point, rotation?:number} |
EditResult; resolves stable ID, shares reference/value/fields across units and applies value-linked simulation rules. |
part.rules.get |
query / — | {fileId, partId} |
ComponentRuleState; reads inherited limits, local rules and eligible targets. |
part.rules |
command / O | {fileId, partId, rules:ComponentRule[]} |
EditResult; validates and replaces the component's placement rules in one undo edit. |
part.participation |
command / O | {schematicId, partId, included:boolean} |
EditResult; updates Include in SPICE simulation independently of plugin installation and physical connectivity. |
NoteProperties accepts a nonempty subset of the applicable fields below.
Use the retained note UUID from schematic.get. Omitted fields and the native
identity are preserved. Coordinates and dimensions are exact millimetres.
Plain annotation text must be nonblank. Text boxes accept an empty caption.
Text is limited to 4,096 characters in both cases.
| Native record | Fields |
|---|---|
text |
x, y, text, textSize |
text_box |
x, y, width, height, lineWidth, lineStyle, text, textSize |
rectangle or polyline |
x, y, width, height, lineWidth, lineStyle |
x and y are the note anchor or the minimum outline coordinates. Points
stay within ±100,000 mm. Outline width and height allow up to 200,000 mm,
with zero allowed only as an unchanged zero-span polyline axis. Text-box
dimensions are positive, limited to 100,000 mm and must accommodate their
native margins. lineWidth is 0–100 mm and textSize is greater than zero
and at most 1,000 mm. lineStyle is default, solid, dash, dot,
dash_dot or dash_dot_dot. A change set is applied or rejected as one
transaction.
type Operation =
| { type: 'setValue'; ref: string; value: string }
| {
type: 'addPart';
kind: 'R' | 'C' | 'L' | 'D' | 'NMOS' | 'GND' | 'Port';
x: number;
y: number;
value?: string;
}
| { type: 'removePart'; ref: string };
type FieldRow = { name: string; value: string; fresh?: boolean };
type SchematicMoveOperation = 'rotate' | 'rotateReverse' | 'mirrorX' | 'mirrorY';Selection-ID arrays are unique and bounded to 30,000. Operation component coordinates are bounded to ±1,000 mm and operation values to 200 characters. Properties accepts up to 200 field rows, with field names/values and text values bounded to 4,096 characters. Part participation does not add solver support. Geometry validates connectivity and preserves shared branches; an edit can fail even when it passes the input schema.
schematic.wires uses the same exact coordinates, deliberate splits and junction
rules as repeated schematic.wire gestures. Routes are processed in input order
on a private candidate; invalid input or final validation rejects the whole edit.
It does not choose component placement, insert bends or find routes. Supply every
planned bend and retain off-grid imported pin anchors. The batch shares revision,
Source, close, validation and whole-project undo gates with ordinary edits.
schematic.drafting reads the accepted schematic, including while native Source
is pending. Its result includes revision, sourcePending, editingBlocked,
units: 'mm', grid: 1.27, advisory: true, full counts, declared collection
limits and truncation notes. Bounded component entries contain identity, pose,
exact transformed pins, body bounds and Reference/Value annotation positions
with canonical field IDs accepted by schematic.text.position;
wires, labels and junctions carry stable IDs and geometry. labelLinks describes
ordinary named nets whose component pins occupy separate physical drawing
islands, with per-island pins, wire/label IDs and short single-pin stub evidence.
Physical grouping uses the same geometric joins as electrical grouping, before
label/power names link remote islands. Power notation and intentional remote
links are valid. These observations do not certify text clearance, readability,
ERC, SPICE or hardware correctness and never gate an otherwise supported edit.
Details omitted at the declared bounds remain explicitly truncated; counts do
not imply a complete detailed review. No native backing, resource bytes or host
paths are returned. lib/schematic-drafting.ts
owns the exact report type and current observation limits.
Discovery filters combine with AND. ids accepts 1–64 unique exact IDs. If any
requested ID is unregistered, the request fails and lists the missing IDs.
prefix matches literal ID prefixes. Availability is evaluated live in full and
compact results. Use includeSchema:false for a compact index, then use exact
returned IDs to fetch their full schemas before constructing arguments. If a
capability ID is unregistered, query the relevant prefix and choose a returned
ID. Omitted input retains full discovery. catalog() remains the complete
in-process method. The host enforces the same command authority with any filter.
Live Agent instructions reuse the discovered index and complete tool definitions within the current turn, batching schema requests for required IDs not yet known. Accepted edits, revision changes and an active simulation do not invalidate argument schemas. Refresh only for an unseen capability, explicit registration or plugin-lifecycle changes, or a host error reporting a missing, changed or unavailable capability; scope the refresh to affected IDs or a domain. This is provider guidance, not a cached catalog or permission: every invocation retains the host's live availability, schema, revision and lifecycle checks.
schematic.pose accepts up to 128 ordered operations around anchor, then translates
that anchor to target, through previewSchematicMove. schematic.paste.source is
the canonical JSON string from source.get().source or a JSON serialization of
project.get/schematic.get, bounded to 8 MB of UTF-8 and validated before use. The snapshot must contain the current
schematic ID; conflicting embedded definitions for copied symbols are rejected.
Copied old values and deleted objects remain available, while existing objects,
native annotations and unrelated live data are retained. Both commands use the
ordinary revision, pending Source and close barriers.
schematic.symbol.get is a Core query accepting {schematicId,partId} and returning
{schematicId,partId,name,referencePrefix,value,position,drawing:SymbolDrawing}.
It returns an independent editable drawing for a supported single-unit symbol;
it does not rewrite native data. Multi-unit/alternate bodies, unsupported
primitives and rounded rectangles reject explicitly without discarding their
native records.
schematic.symbol.draw is a Core object command accepting
{schematicId,name,drawing:SymbolDrawing,partId?,referencePrefix?,value?,position?}.
Omit partId to create a component; supply its current identity to edit it.
The result is EditResult with selection:[partId]. GUI and Agent use
prepareSymbolDrawing and the same revision, Source, close and whole-project
transaction gates. An identical drawing adds no undo edit.
type SymbolDrawingGraphic = (
| { type: 'rectangle'; start: Point; end: Point }
| { type: 'circle'; center: Point; radius: number }
| { type: 'polyline'; points: Point[] }
) & { fill?: 'none' | 'background' | 'outline'; width?: number };
type SymbolDrawingPin = Point & {
number: string;
name: string;
rotation: 0 | 90 | 180 | 270;
length: number;
type?:
| 'input'
| 'output'
| 'bidirectional'
| 'tri_state'
| 'passive'
| 'free'
| 'unspecified'
| 'power_in'
| 'power_out'
| 'open_collector'
| 'open_emitter'
| 'no_connect';
shape?:
| 'line'
| 'inverted'
| 'clock'
| 'inverted_clock'
| 'input_low'
| 'clock_low'
| 'output_low'
| 'edge_clock_high'
| 'non_logic';
hidden?: boolean;
};
type SymbolDrawing = { graphics: SymbolDrawingGraphic[]; pins: SymbolDrawingPin[] };Both arrays are complete replacements, each capped at 256 entries, with at least
one graphic or pin overall. Local millimetres use +X right and +Y down; positions
are within ±100,000 mm. Drawing coordinates, radii, strokes and pin lengths use
0.0001 mm precision. Pin rotation follows KiCad: 0° points right and 90° up.
Pin length is 0–100,000 mm. Pin numbers are unique printable nonblank strings of
1–64 characters, names at most 128. Circles have positive radius ≤100,000 mm;
rectangles need nonzero width/height; polylines have 2–128 points with distinct
geometry. Stroke width is 0–100 mm. Name is 1–80 printable characters without a
colon; referencePrefix matches #?[A-Za-z][A-Za-z0-9_]{0,15} and value is printable
text of at most 4,096 characters. New position defaults to {x:0,y:0} and uses the
schematic placement grid; omitted prefix/value default to U/name. New symbols
start excluded from simulation and have no assigned footprint.
Edits retain the component UUID, reference, fields, participation, assignment and
supported hidden native metadata. They create an instance-specific embedded
OpenPE:<name>_<UUID> symbol definition, leaving other instances and bundled
libraries unchanged. Pins retain native metadata by number. Wired/labelled/marked
terminal positions cannot move or disappear; disconnect them first. Existing pin
numbers cannot be removed while Sim.Pins, Sim.Device or Sim.Library is
nonblank. Normal project validation and primary-board synchronization still apply.
Owner is core; every command declares mutation document. Every Layout input includes a current boardId. The table shows its remaining fields. Queries do not alter the document or regenerate source fills.
type Layer = 'F.Cu' | 'In1.Cu' | 'In2.Cu' | 'B.Cu';
type BoardObject = {
kind: 'footprint' | 'track' | 'via' | 'graphic' | 'zone';
id: string;
};
type ViaSize = { diameter: number; drill: number };
type RouteLeg = { layer: Layer; points: Point[]; via?: ViaSize };| ID | Kind / level | Input in addition to boardId |
Result and behaviour |
|---|---|---|---|
layout.get |
query / — | {} |
{boardId,layers,thickness,counts:{packages,tracks,vias,zones,graphics,nets},project:CanonicalProject}. |
layout.drc |
query / — | {settings?:Partial<PCBDesignRuleConfig>} |
RuleCheckResult & {revision:string, boardId:string, settings:PCBDesignRuleConfig}; see Rule-check queries. |
layout.route.preview |
query / — | {netId, layer:Layer, width, clearance, start:Point, end:Point, mode?:'straight'/'45', posture?:boolean} |
{points:Point[],blocked:boolean,message:string}; bounded Walk Around planning. |
layout.move |
command / O | {selection:BoardObject[], delta:Point, footprintPlacement?:'free'} |
RevisionResult. |
layout.pose |
command / P | {selection:BoardObject[],anchor:Point,target:Point,operations:('rotate'/'rotateReverse'/'flip')[], footprintPlacement?:'free'} |
RevisionResult; one canvas pickup transaction with up to 128 ordered quarter-turn rotations/package flips, followed by anchor-to-target translation. Rotations use the shared group pivot; flips change only selected footprints and reflect their origins across the anchor's horizontal axis. |
layout.drag |
command / P | {selection:BoardObject[], delta:Point, clearance, pickup?:Point, mode?:'connected'/'corner', endpointTolerance?:number, posture?:boolean, obstacleMode?:'shove'/'walk-around', constrain?:boolean, previousDelta?:Point, footprintPlacement?:'free'} |
{revision,changedIds:string[],requestedDelta:Point,appliedDelta:Point,constrained:boolean,constraintReason?:string}. Connected mode accepts a footprint-only or track-only selection. Footprints carry attached track ends using Walk Around. Track-only drag defaults to Shove. Corner requires one track and pickup, with a default tolerance of 0.5 mm. Explicit constrain accepts a revalidated boundary and enables previousDelta. |
layout.rotate |
command / O | {selection:BoardObject[], degrees?:number, pivot?:Point/'selection'} |
RevisionResult; degrees defaults to 90. Use pivot:'selection' for the canvas selection center. |
layout.flip |
command / O | {selection:BoardObject[]} |
RevisionResult; flips selected physical packages. |
layout.delete |
command / O | {selection:BoardObject[]} |
RevisionResult; linked package deletion clears its schematic assignment in the same edit. |
layout.duplicate |
command / O | {selection:BoardObject[], delta:Point} |
{revision,selection:BoardObject[]}; copies get fresh UUIDs and mechanical package references. Assigned packages cannot be duplicated. |
layout.route |
command / P | {netId, width, clearance, legs:RouteLeg[]} |
{revision,trackIds:string[],viaIds:string[]}; shares the canvas route validation and preparation. |
layout.via |
command / O | {netId, position:Point, diameter, drill, clearance} |
{revision,viaId}; validates all-layer copper, holes and keepouts. |
layout.zone |
command / O | ZoneChanges |
{revision,zoneId}; creates or updates a typed zone. |
layout.fill |
command / P | {zoneId?:string,clearance?:number} |
RevisionResult; enables/fills the selected board zone, or all enabled zones when zoneId is absent, with minimum 0.0001–1,000 mm clearance (default 0.25); retains larger rules and saves rules/contours in one undo edit. |
layout.net |
command / O | {name:string} |
{revision,netId}; trimmed name must be nonempty and unique. Does not join schematic networks. |
layout.properties |
command / O | {thickness?:number, layers?:['F.Cu','B.Cu']/['F.Cu','In1.Cu','In2.Cu','B.Cu']} |
RevisionResult; validates the complete board. |
layout.track.properties |
command / O | {trackId, netId?:string, layer?:Layer, width?:number, locked?:boolean} |
RevisionResult; explicit locked:false unlocks before other copper edits. Canonical tracks store locked:true or omit it. |
type ZoneChanges = {
zoneId?: string;
netId?: string | null;
layer?: import('../lib/pcb').BoardLayer;
outline?: Point[];
holes?: Point[][] | null;
clearance?: number; // For rule areas, pour exclusion margin; defaults to 0 mm.
minThickness?: number;
thermalGap?: number;
thermalBridge?: number;
priority?: number | null; // Integer, 0–10,000.
padConnection?: 'yes' | 'no' | 'thru_hole_only' | null;
islandRemovalMode?: number | null; // Integer, 0–2.
fillEnabled?: boolean | null;
keepout?: {
tracks: boolean;
vias: boolean;
pads: boolean;
copperpour: boolean;
footprints: boolean;
} | null;
};Widths, thickness, via dimensions and zone minimum thickness use 0 < value ≤ 1,000 mm in these schemas. The via nested inside a RouteLeg has the narrower 0 < diameter/drill ≤ 20 mm schema. Routing/via clearance is 0.05–20 mm; zone clearance and thermal gap/bridge are 0–1,000 mm. Actual board and drill relationships receive domain validation too. Selection arrays are unique and at most 30,000 entries. A new zone requires outline, layer and an explicit netId (null for a keepout); zoneId updates must resolve an existing zone. Outline/hole rings have at least three points, with schema and complete-board geometry limits.
Routes contain 1–65 legs and at most 15,000 points in total. Each non-final leg must end at the next leg's start, change layer and supply a through via; the final leg cannot contain an unfinished via transition. Blocked routes/drags fail before committing. Copper, boundary and zone-rule edits automatically refresh already-filled enabled zones, including footprint-owned zones, in the same transaction. Unfilled/disabled zones remain unfilled unless explicitly filled. Fill failure rejects the complete edit without clearing accepted contours. Route validation and the separate read-only layout.drc query have bounded coverage; neither provides automatic routing, complete KiCad rule parity or manufacturing qualification. Saved fills require final review; Gerber export neither refills nor proves manufacturing readiness. See Layout.
layout.lock is a Core object command taking {boardId, targets:[{kind,id}], locked:boolean} and returning RevisionResult. Targets cover footprint, pad, track, via, graphic and zone; text/dimensions are graphics and rule areas are zones. It changes all requested locks in one transaction. Unlock a parent footprint before changing a pad lock, or unlock both together. Canonical locks store locked:true or omit it. GUI Properties uses the same preparation. Source, revision and close barriers apply.
Move, rotation, deletion and object-property replacements reject changes to locked objects before writes. Connected drag, corner drag and Shove keep locked neighbours fixed. Lock changes have whole-project undo and native persistence; changing only locks retains saved copper fills. Explicit unlocking may share one layout.track.properties transaction with a net, layer or width change. Native Source remains an explicit editing path.
layout.placement.preview is a Core query taking {boardId,footprintIds,spacing}.
It returns {poses:[{id,x,y,rotation}]} in board order, with an empty array when
no complete suggestion fits. Supply two to eight distinct footprint IDs and an
explicit Layout grid spacing of 0.1, 0.2, 0.25, 0.5 or 1 mm.
layout.placement.apply is a Core operation command with review optional. It
takes the original inputs and the nonempty poses array, then returns
{revision,poses} after one board edit. It rechecks the current board and
requires the recomputed poses to match every supplied coordinate and rotation
in order. Source and close barriers apply to both operations. The
Layout placement planner owns geometry and bounds.
layout.footprint.draw is a Core object command accepting
{boardId,name,drawing:FootprintDrawing,footprintId?,partId?,position?,reference?,value?}.
It returns {revision,boardId,footprintId,selection:[footprintId]}. Omit
footprintId to create an embedded package, or supply its current identity to
replace its local drawing. Optional partId links a new package to an unplaced
primary-sheet component. Existing packages cannot be reassigned by this command.
GUI and Agent share prepareFootprintDrawing, complete project validation and
one undo transaction, including required refresh of already-filled enabled zones.
// Pad and BoardLine are the canonical records in lib/pcb.ts.
type FootprintDrawing = {
pads: (Omit<Pad, 'id' | 'netId' | 'locked' | 'unconnected'> & { id?: string })[];
graphics: (Omit<BoardLine, 'id' | 'locked'> & { id?: string })[];
};Supply both complete arrays: at most 2,000 pads and 10,000 graphics. Their schemas
derive from the generated canonical pad/graphic definitions, rather than a second
property schema. layout.object supplies the existing footprint; omit pad
netId, locked, unconnected and graphic locked from the drawing. Runtime
discovery exposes all supported fabrication, text, layer and corner fields.
Pad types are smd, thru_hole and np_thru_hole. Shapes are rect, circle,
oval, roundrect and custom. Custom pad outlines use the Layout
limits, with customAnchor:'circle' for a circular
anchor. Pad dimensions and through-hole drills are 0.0001–1,000 mm, with a
0.000001 mm minimum for circular custom anchors. Circular pads and anchors
require equal dimensions, plated drills must fit
inside the copper, and SMD pads cannot have drills. Rounded pads require a
0–0.5 corner ratio.
Local coordinates use ±100,000 mm at 0.000001 mm precision; pad rotation is within
±360°. Graphics support lines, arcs, circles, polygons and text, using the same
canonical record fields as board graphics. Arcs require mid, polygons require
intermediate points, text requires text, and fill applies only to circles and
polygons. Footprint dimensions are rejected. Full project geometry and aggregate
limits also apply.
New names match [A-Za-z0-9][A-Za-z0-9_.-]{0,79} and create an OpenPE:<name>
embedded identity. Position defaults to {x:0,y:0}, rotation to zero and side to
front. An unlinked package defaults to an unused FP<number> reference and value
equal to its name; reference/value override these creation defaults. Linked
captions come from the schematic. Existing name, position, reference and value
remain unchanged by drawing replacement; their ordinary Properties commands
remain available.
Existing pad IDs preserve identity and nets; omit IDs for new pads/graphics. Without a pad ID, a unique existing pad number identifies the retained pad; repeated numbers require explicit existing IDs. IDs from another package reject. Edits preserve package pose, side, models, fabrication overrides, retained native metadata and unrelated route geometry. Connected pads cannot be removed, renumbered or converted to mechanical holes. Pads touching routed copper cannot move or change type/layer membership. Locks and bounded copper collision checks reject blocked changes; these checks do not establish complete KiCad DRC parity. An unchanged drawing adds no undo edit.
Canonical footprint records returned with layout.get can include referencePoints,
an array of {id,x,y,size,layer}. Coordinates are local to the footprint and
layer is F.Fab or B.Fab. These points follow their parent footprint and are
editable through native Source. Format defines the native limits.
Canonical pad layers retain KiCad's *.SilkS membership for both sides.
A retained native custom pad can have an empty primitives array while its
anchor provides the geometry. Format defines these records.
layout.region.fillet is a Core object command taking
{boardId,kind:'zone'|'graphic',id,radius} and returning RevisionResult.
It rounds every corner of one unlocked board zone/rule area or polygon graphic
through the same pure preparation as the GUI preview. Radius must be positive
and at most 1,000 mm. Only simple convex outer rings without collinear vertices
are supported; cutouts remain unchanged and must stay strictly inside the result.
The accepted native polygon has at most 10,000 vertices, six-decimal coordinates
and a maximum 0.01 mm deviation from circular fillets. Excessive radii, precision
collapse and geometry work over two million operations reject unchanged. Source,
revision, close and whole-project undo gates apply; previously filled enabled
zones refresh in the same accepted transaction.
layout.object is a read-only Core query taking {boardId,kind,id}, where kind
is footprint, pad, track, via, graphic or zone. It returns an independent
copy of that complete native board record. No host path permissions or private
project backing are included. Use it before editing to retain unrelated metadata.
Native placement zone records expose a read-only nativePlacement field
with sourceKind (sheetname, component_class or group) and sourceName.
layout.zone retains the field. Native format owns placement and
saved technical artwork coverage.
A track result for an imported copper arc also contains its native mid point.
Workbench track editing on these boards follows imported routing.
A Bézier graphic record has kind: "curve" with two control points in
points, between its native start and end coordinates. layout.graphic
uses that record shape and the same geometry edit limits
as Layout Properties.
A graphic selection or query ID also identifies native footprint text.
Its canonical keepUpright:false field preserves free rotation with the
package. The field applies only to footprint text.
Move and rotate preserve its parent and edit text geometry in its local frame.
Delete hides footprint fields and removes ordinary footprint text. Duplicate
skips fields and copies ordinary footprint text within its owner.
These Core object commands require boardId and return {revision}, with
layout.graphic additionally returning graphicId. Each uses one whole-project
transaction and the same Source/revision/close gates as GUI edits. Copper and
boundary edits refresh already-filled enabled zones; captions/model-only edits retain them.
| ID | Additional input | Behaviour |
|---|---|---|
layout.pad.properties |
{padId,changes} |
Shared setPCBPadProperties: position, rotation, size/shape, drill/offset/slot, rounded/chamfered corners, fabrication and thermal overrides. Identity, pin number, net, type and layers cannot change. Custom pads retain their outline and anchor shape, and size describes the anchor. Circles and circular anchors normalize diameter. Shape changes remove inapplicable corner overrides. |
layout.via.properties |
{viaId,changes} |
Existing via X/Y, net, diameter and drill, with complete Core geometry validation, matching numerical Properties edits. |
layout.footprint.properties |
{footprintId,changes} |
X/Y, rotation, side, board-only reference/value, complete model array and fabrication margins. Side changes share flipPCBFootprint, including local pads/artwork/models. Linked captions require part.properties; IDs, assignments, pad nets and geometry arrays cannot change here. |
layout.graphic |
{graphicId?,graphic} |
Create a board graphic or replace a board graphic or footprint text. graphic is the native record without id. Updates preserve the UUID and footprint owner. Footprint field identity and Reference/Value content are retained. |
layout.rectangle.resize |
{selection:BoardObject[],bounds:{minX,minY,maxX,maxY}} |
Shared canvas/Properties boundary resize for an Edge.Cuts rectangle or one zone, including its holes. Preserves object UUIDs and rejects nonrectangular outline selections or degenerate bounds. |
layout.rectangle.properties |
{selection:BoardObject[],width} |
Updates every native edge of a rectangular Edge.Cuts outline in one undo transaction through setPCBRectangleWidth; width is 0.0001–1,000 mm. One edge or the complete rectangle can identify the group; zones, nonrectangular selections and locked edges are rejected. |
Property changes omit keys to retain them; null clears optional pad/footprint
overrides (including the explicit models member). Pads accept copper clearance,
zone connection mode, thermal gap and spoke width. Footprints accept inherited
copper clearance and zone connection mode. Required
geometry cannot be cleared. Runtime discovery contains the exact generated
nested schemas, including model XYZ transforms, opacity and visibility, board
text effects and dimension formatting. Domain validation remains authoritative.
Imported via records can include their native layer span, treatment, tenting,
padstack and saved layer-connection settings. PCB pad records can contain
trapezoid geometry and native padstack, pruning and post-machining metadata.
Operations that depend on unsupported native geometry return the same Core
diagnostic from Agent commands and numerical Properties.
part.properties accepts rotation within ±360°, rounds it to four decimals and
normalizes it to [0°, 360°), using the same preparation as GUI numerical Properties.
Component X/Y use the 1.27 mm schematic grid.
layout.track.properties also accepts optional exact start/end points.
It shares setPCBTrackEndpoints; a locked track rejects endpoint edits unless
the same transaction explicitly includes locked:false. Endpoints retain native
precision independently of display grid. layout.zone accepts supported board
layers, nonnegative signed 32-bit priorities, island area thresholds in mm² and
zero thermal gap/bridge as native Properties do.
Its input shape is generated from canonical zone definitions, excluding identity,
lock and stored fills: outline rings have at most 10,000 points and at most 100
holes. Omitted fields retain their values; null clears optional overrides,
including padConnection:null to restore default thermal relief. netId:null
explicitly means unassigned and remains present. Updates share
preparePCBZoneProperties, retain absent defaults and refresh already-filled
enabled zones once in the accepted transaction.
modelCad.get, modelCad.add, modelCad.update, modelCad.remove,
modelCad.duplicate, modelCad.sketch.extrude and modelCad.boolean are Core-owned and require a current boardId. Commands
have mutation document, review optional and the same revision, pending
Source and close barriers as other document commands. The read query returns
validated document state while Source is pending. These operations retain the
PCB and schematic, and do not depend on simulation plugins.
| ID | Kind / level | Input | Result |
|---|---|---|---|
modelCad.get |
query / — | {boardId} |
{boardId,modelCad:ModelCAD/null} |
modelCad.add |
command / O | {boardId,object:ModelCadObject} |
{revision,boardId,modelCad,object}; rejects reused UUIDs. |
modelCad.update |
command / O | {boardId,object:ModelCadObject} |
Same shape as add; replaces an existing object, retaining its UUID. |
modelCad.remove |
command / O | {boardId,ids:string[]} |
{revision,boardId,modelCad}; all selected objects must exist. |
modelCad.duplicate |
command / P | {boardId,ids:string[],offset:{x,y,z}} |
{revision,boardId,modelCad,objects:ModelCadObject[]}; returns the new copies with fresh body UUIDs. |
modelCad.sketch.extrude |
command / P | {boardId,sketch:ModelCadSketchExtrusion} |
{revision,boardId,modelCad,object}; one prepared solid from ordered planar contours. |
modelCad.boolean |
command / P | {boardId,operation:'union'/'difference'/'intersection',targetId,toolId,resultId?:string} |
{revision,boardId,modelCad,object}; removes both operands and inserts the prepared result at the target's position, as one undo edit. |
GUI Boolean roles use ordered canvas body selection, without automatic operands. Face/edge/line picks remain typed presentation selection until explicit Use owning solids conversion. This command continues to accept two body IDs; it does not execute independent curve or surface Booleans.
type ModelCAD = { version: 1; objects: ModelCadObject[] }; // At most 64.
type ModelCadVector = { x: number; y: number; z: number };
type ModelCadProfile =
| { kind: 'rectangle' }
| { kind: 'circle' }
| { kind: 'polygon'; points: { x: number; y: number }[] };
type ModelCadShape = {
kind: 'box' | 'cylinder' | 'extrusion' | 'boolean';
size: ModelCadVector; // 0.5–1,000 mm; Boolean uses a conservative envelope.
profile?: ModelCadProfile; // Required only for extrusion.
edgeTreatment?: {
kind: 'chamfer' | 'fillet';
distanceMm: number; // 0.01–500 mm, with positive remaining height/area.
edges: string[]; // Exact semantic base-edge IDs.
};
boolean?: {
// Required only for Boolean.
operation: 'union' | 'difference' | 'intersection';
operands: [ModelCadOperand, ModelCadOperand];
};
};
type ModelCadOperand = { shape: ModelCadShape; position: ModelCadVector; rotation: ModelCadVector };
type ModelCadObject = {
id: string; // UUID; globally unique across the project.
name: string; // 1–80 characters, nonblank, no ASCII controls.
kind: ModelCadShape['kind'];
position: ModelCadVector; // Native axes, ±100,000 mm.
rotation: ModelCadVector; // ±360°, intrinsic XYZ: Rx * Ry * Rz.
size: ModelCadVector;
material: 'aluminium' | 'pmma' | 'plastic';
opacity: number; // 0.05–1.
color?: string; // RGB #RRGGBB; absence uses the selected material color.
profile?: ModelCadShape['profile'];
edgeTreatment?: ModelCadShape['edgeTreatment'];
boolean?: ModelCadShape['boolean'];
};Unmarked object fields remain required; extra keys are rejected. Boxes and cylinders use their current primitive fields. Rectangle profiles use X/Y dimensions; circle profiles and cylinders require equal X/Y diameters. Polygon profiles have 3–128 vertices within ±500 mm, implicit closure, positive area, no self-crossing/touching and centred bounds matching X/Y dimensions. Extrusion depth is Z.
Dedicated local-hole fields are unsupported, including empty holes arrays; native files containing them are rejected without rewriting. Openings use sketch contour Difference before extrusion. Edge treatment accepts 1–448 unique IDs: profile:top:N, profile:bottom:N or side:N. Indices address current base-profile segments. Circle profiles have only profile index 0 and no vertical seam. The host requires one exact matching base curve per ID; missing or ambiguous topology rejects the operation. Boolean bodies expose no editable edge catalogue.
Boolean operand trees omit IDs/material and contain at most 32 operations with Boolean nesting depth four below the root. Operands retain local XYZ poses; the declared centred envelope must conservatively contain the operation's result bound. The kernel constructs operands, not the envelope. The entire CAD JSON is at most 256,000 characters. Selection arrays contain 1–64 unique identities; duplicate offsets use ±100,000 mm per axis and final positions remain bounded. Emptying the model removes the native setting; an identical update adds no undo.
ModelCadSketchExtrusion requires {id,name,plane,origin,contours,distance,direction,material,opacity} with optional color. Plane is XY/XZ/YZ; origin uses native XYZ millimetres; direction is positive/negative/symmetric; distance is 0.5–1,000 mm. Each of 1–6 contours is {operation,profile,size:{x,y},position:{x,y},cornerTreatment?}, with local workplane coordinates, analytic ModelCadProfile, and union/difference/intersection. The first contour must use union. Optional cornerTreatment is {kind:'fillet'/'chamfer',distanceMm:0.01–500,corners:number[]} with 1–128 unique zero-based original rectangle/polygon vertex indices. Circles, reflex/collinear/missing vertices, adjacent overlap and treatments consuming the profile are rejected; the final host kernel also verifies topology. The treatment compiles to analytical side:N extrusion edges before Boolean composition. GUI corner edits use shared prepareModelCadSketchCorners; clearing a treatment omits it. Shared pure extrudeModelCadSketch compiles equal-depth analytic operands; planar Booleans distribute over extrusion, so one contour stores an extrusion and multiple contours store the same bounded immutable Boolean solid recipe. GUI and Agent use the same command, host proof, revision checks, native serialization and one undo transaction. Empty or invalid results cannot commit.
The synchronous Core validates recipes but requires exact host preparation for
new extrusion, Boolean or edge-treatment geometry. registerProjectCapabilities
previews the candidate, prepares pending shapes through the fixed kernel, then
rechecks revision/Source/close gates before one commit. Both human and Agent
transports use this wrapper. Source apply and project.replace share preflight;
direct Core commits cannot bypass the prepared-key gate. Unchanged top-level
pose, name, material, color or opacity can reuse current geometry. Native admission is
structural to preserve loaded records before lazy preview. No arbitrary CAD
scripts, imported/Boolean edge-topology editing, mechanical-strength checks or whole-assembly
simulation are exposed.
| ID | Kind / level | Input | Result |
|---|---|---|---|
pad.rules.get |
query / — | {padId} |
PadPlacementRuleState for the owning pad, with eligible target IDs and an editability reason when applicable. |
pad.rules.list |
query / — | {offset?:number,limit?:number} |
{boardId,total,offset,rules,nextOffset?} for the accepted PCB. Defaults to offset 0 and 50 entries, and accepts at most 100 entries per page. |
pad.rules |
command / O | {padId,rules:PadPlacementRule[]} |
EditResult. Replaces all rules owned by the pad in one undo edit. An empty list clears its rules. |
The owner and targets use native IDs from the current PCB. Use one record per
target and supply at least one directional field. Use minimumMm or
maximumMm for Euclidean gaps, and minimumRoutedMm or maximumRoutedMm
for the shortest routed distance. Supply at most one distance type per
direction. Numeric limits use 0–1,000 mm. A null value keeps the selected
direction and distance type as a qualitative placement preference for the
Agent. Numeric reciprocal pad-to-pad limits of the same distance type must
have a feasible interval. pad.rules uses the ordinary Source,
revision and close gates. Queries return the accepted data. Each list item
includes padId, padReference and targetReference alongside the rule,
with null labels for unavailable objects. The list exposes no file contents.
The per-owner query identifies each pad's parent footprint and native pad
number. An unnumbered pad has an empty number. The optional pad value
distinguishes duplicate numbers.
Pad placement rules
type PlacementDistances = {
minimumMm?: number | null;
maximumMm?: number | null;
minimumRoutedMm?: number | null;
maximumRoutedMm?: number | null;
};
type PadPlacementRule = PlacementDistances & {
targetId: string;
targetKind: 'pad' | 'footprint';
};
type PlacementPadTarget = {
id: string;
kind: 'pad';
reference: string;
parent: { id: string; reference: string };
number: string;
value?: string;
};
type PadPlacementRuleState = {
rules: PadPlacementRule[];
targets: (
| PlacementPadTarget
| { id: string; kind: 'footprint'; reference: string; value?: string }
)[];
editable: boolean;
unavailableReason?: string;
};schematic.erc and layout.drc are Core-owned queries with mutation false, review none and no abstraction level. The Schematic and Layout controls invoke the same capability handlers available to Agent openpe_query; both checks are independent of SPICE Simulation and Layout Thermal. Both schemas reject extra keys. schematicId and boardId are required current project identities, each 1–200 characters. ERC targets the project schematic. DRC targets its current PCB.
workbench.rules.get reads the applied {erc,drc} severity maps for the
mounted project. workbench.rules.configure accepts {erc?,drc?}, requires at
least one map and returns both applied maps. A supplied map replaces that kind's
overrides, including {} to restore built-in severities. Discovery enumerates
the rule IDs and the error, warning and ignore values. This host command
changes session state with optional review. An active originating workspace and
applied Source are required. An open dialog, confirmation or retained Rule
settings draft blocks the command so the GUI's draft stays available.
layout.drc.settings is a Core document command at object level with optional
review. It takes {boardId, thresholds, componentRuleBounds?} and returns
{revision, boardId, settings: PCBDesignRuleConfig, componentRuleBounds}.
thresholds is a partial record of the numeric fields below, each in the range
0–1,000 mm. Omitted threshold fields retain their values. A supplied
componentRuleBounds sets the project-wide minimum component clearance in
millimetres through clearanceMm. An empty object restores the 0 mm default.
The result always includes the effective componentRuleBounds.clearanceMm.
Core validates the clearance against the accepted Euclidean component rules and
commits changed values and board minima in one undo edit behind the Source and
close gates. An unchanged request retains the revision and undo history.
Changed copper-clearance, edge or hole minima refresh already-filled enabled
pours in that transaction, using the shared native fill rules.
Other board objects stay fixed; queries and check-only overrides never refill.
part.rules.get uses the stable schematic ID from schematic.list as fileId
and a current schematic component ID as partId. The query reads validated
project data even while Source is pending and reports editable:false with the
reason when edits are unavailable. part.rules takes the same IDs and replaces
the component's complete rule list. An empty list clears the local rules. The
owner and component targets are board-included components with assigned
footprints on the primary schematic. A component can target another component
or a pad already on the accepted PCB, including before the owner is placed.
The owner's own pads are unavailable. Obtain target IDs from the owner's
query. Returned pads use the placement target shape.
Their parent ID refers to the eligible schematic component when linked and to
the native footprint otherwise. Use targetKind: 'pad' in commands for these
targets. Supply one row per target and at least one direction per row, using
the shared distance fields. For Euclidean
component pairs, a null minimum inherits project clearance and a null
maximum keeps the direction without a numerical maximum. For any routed bound
or a Euclidean pad bound, null keeps a qualitative preference. The project
supports up to 1,000 rows.
Component placement rules
type ComponentRuleBounds = { clearanceMm?: number };
type ComponentRule = PlacementDistances & {
targetId: string;
} & ({ targetKind?: never } | { targetKind: 'pad' });
type ComponentRuleState = {
bounds: { clearanceMm: number };
rules: ComponentRule[];
targets: ({ id: string; reference: string; value: string } | PlacementPadTarget)[];
editable: boolean;
unavailableReason?: string;
};
type PCBDesignRuleConfig = {
clearance: number;
minTrackWidth: number;
minThroughHole: number;
minViaDiameter: number;
minAnnularRing: number;
copperToEdge: number;
copperToHole: number;
holeToHole: number;
minSilkClearance: number;
minTextHeight: number;
minTextThickness: number;
scopes: (
| 'dimensions'
| 'clearance'
| 'edge'
| 'holes'
| 'silkscreen'
| 'courtyards'
| 'keepouts'
| 'placement'
| 'connectivity'
)[];
useZoneClearance: boolean;
useKiCadClearance: boolean;
clearanceOverrides: { key: string; clearance: number; enabled?: boolean }[];
severities: Partial<Record<PCBDesignRuleId, 'error' | 'warning' | 'ignore'>>;
};
type RuleCheckIssue = {
id: string;
ruleId: string;
severity: 'error' | 'warning';
message: string;
objectIds: string[];
location?: Point;
};
type RuleCheckResult = {
kind: 'erc' | 'drc';
complete: boolean;
truncated: boolean;
checkedRules: string[];
issues: RuleCheckIssue[];
notes: string[];
};ERC and DRC use the applied Workbench severity maps when settings.severities
is omitted. An explicit map replaces the applied map for that check. Rules
absent from the effective map use built-in severities. Ignored rules are omitted
from checkedRules and their findings are suppressed, with complete:false.
Checks using the applied map reject if it changes while the check is running.
DRC settings are optional per-call overrides. Each supplied threshold is finite and within 0–1,000 mm. Supply at least one distinct supported scope when overriding scopes. A selected subset makes coverage partial. The result returns the full settings in canonical scope order. useZoneClearance enables saved-zone limits and useKiCadClearance enables the supported net-class and conditional limits. When clearance is in scope, clearanceSources lists zones, netClasses, rules and coverage notes. Each source has a key, label and original clearance. Rule rows also return their condition. Supply up to 512 distinct source keys in clearanceOverrides to replace limits. Set enabled:false to skip an individual source. Only keys present in the current source list affect the check. Omitted fields use the saved board minima and Layout DRC defaults, which also define source precedence and coverage. Query overrides affect only that check. Use layout.drc.settings to commit board minima. Issue IDs identify findings within the computed report. Rule IDs identify the rule, and object IDs refer to the checked document's objects. A location, when present, uses millimetres. Rerun after the returned string revision or applied rule settings change.
The two engines load by asynchronous import on demand. Core captures the immutable project and revision, then checks the cancellation signal, editing/close barrier, project identity, revision and pending Source again after loading, before running the synchronous bounded checks. Pending Source, a closing project, a missing target, cancellation or a superseded revision rejects the query instead of returning a report for older content. The host also aborts active requests on suspension, unregistration and disposal. These queries do not use a caller's expectedRevision as a command precondition; the returned revision identifies the checked state. CPU geometry work is bounded rather than interruptible mid-loop.
Checks neither apply Source nor commit an edit, advance Core revision, create undo, change selection or modify native files. Results and settings stay outside canonical project content, Source, recovery and Git history; the human adapter retains report/presentation state separately and marks old reports stale. Standard capability lifecycle events can be emitted, but a successful check emits no Core document-change event.
workbench.rules.model takes {boardId} and reads the exact current Model
preview's {boardId,state,errorCount,warningCount,truncated,issues}. State is
unopened, loading, ready or error. Counts are null before a result is
available. Up to 256 issue rows contain a fixed diagnostic code, severity
and an optional footprintId. Renderer messages, parser output, model contents
and native paths stay outside this result. This observation never opens Model.
workbench.rules.locateModel takes {boardId,footprintId} from a current ready
preview and returns the selected target. It uses the Rule row's focus and
selection path in an active Model view, respects selection and draft gates,
and opens Rule with the located component. Both require applied Source and a
live project.
ERC uses physical pin/wire/label/power topology, transformed embedded-library pin geometry and shared multi-unit physical pins. Simulation exclusion does not remove connections; incidental crossings do not join. It checks unconnected pins (including passive/unspecified pins, except free/no-connect pins and power markers), dangling wires/labels, no-connect placement/connections, conflicting references/net names, incompatible outputs and missing declared signal/power drivers. Output conflicts and connected no-connect findings default to Error. Conditional driver states are not simulated. Unknown pin types (erc.pin-type-unsupported) or inconsistent declarations for one physical pin (erc.pin-type-inconsistent) produce warning coverage findings with complete:false; ambiguous electrical types are not resolved by component order.
DRC checks supported pads, tracks, native via spans, copper graphics, holes, saved zone fills, closed Edge.Cuts, keepouts, selected silkscreen geometry, component clearance and local placement distances, and assigned-pad connectivity using the requested thresholds and applied project rules. It uses the stored fills. Unsupported geometry and ambiguous unassigned copper can make coverage partial. Design rules owns the detailed coverage, including the KiCad clearance subset and curve approximations.
Both reports cap issues at 1,000 and set truncated:true and complete:false when truncated. A DRC request on an admitted board returns a report with ordinary findings and any coverage limitations. Unsupported geometry skips the affected checks, preserves independent findings and reports the skipped coverage. checkedRules lists the enabled rule families that the checker can attempt for the current board. notes and coverage findings identify incomplete work. complete:true describes completion of the bounded checks, including reports that contain design errors. Design rules defines the coverage and limits.
pcb.courtyard-overlap links both footprint IDs and returns a position at their shared area. pcb.courtyard-malformed links the affected footprint and leaves the report incomplete. pcb.component-distance links the two footprints involved. pcb.pad-distance links the owning pad and target pad or footprint. DRC resolves linked footprint references from the primary schematic on the same checked revision.
Owner is host, level is absent. Document and external commands have optional review unless otherwise specified. Session commands use no review.
| ID | Kind / mutation | Input | Result and behaviour |
|---|---|---|---|
workbench.state |
query / false | {} |
Originating project's bounded WorkspaceContext; without a document returns ProjectSnapshot. |
project.datasheet.page |
query / false | {page:integer,image?:boolean} |
One complete pinned PDF page: {exampleId,projectId,bindings,document,page,pageCount,text,image?:{mimeType:'image/png',data,width,height}}. One-based page ≤ 1,000 and actual page count; image defaults to true. No URL/path/selectors. |
project.datasheet |
query / false | {} |
ProjectDatasheetContext for the current example controller, including reviewed parameter JSON and source locators. No paths, URLs or example selectors are accepted. |
workbench.view |
command / document | {view:'canvas'/'source'/'layout'/'3d'} |
{view}; GUI navigation validates/applies pending Source. Agent navigation has review none; leaving Source requires pending edits to be applied separately, while viewing Source retains drafts. UI names are Schematic, Source, Layout and Model. |
workbench.schematicSection |
command / session | {section:'hardware'/'simulation'/'all'} |
{section}; selects the active schematic's presentation section. Requires Schematic view with applied Source and no conflicting Properties draft or IME composition. Native data, dirty state and undo are unchanged. |
workbench.sourceFile |
command / session | {name:string} |
{name}; exact listed filename, 1–1,024 characters. Requires the originating Source editor to be active, retains pending drafts and rejects Agent selection of restricted model/log files. |
workbench.selection |
command / session | {ids:string[]} |
{ids}; selects visible schematic objects allowed by current selection filters. Unique IDs, at most 30,000. |
workbench.panel |
command / session | {panel:'parts'/'layers'/'history'/'settings'/null} |
{panel}. history opens Git without switching editor mode. layers enters Schematic and opens Visualization. The GUI validates pending Source first. Agent calls for either panel require applied Source. |
project.save |
command / external | {saveAs?:boolean} |
{status:'saved'/'cancelled'}; validates and uses the native dialog/live grant. Default saveAs is false. |
project.export |
command / external | {format:ProjectExportFormat} |
{status:'exported'/'cancelled'}. Applies Source, compiles the requested output, then opens its native picker. Preserves the native save destination and baseline. |
enclosure.exportStep |
command / external | {} |
{status:'exported',name:string} or {status:'cancelled'}; requires the originating active Model view, applied Source, CAD bodies, and the native bridge. Exports the current validated CAD solids through the STEP destination picker; saving is not required. |
versions.list |
query / false | {offset?:integer} |
HistoryPage; offset defaults to 0, range 0–100,000. |
versions.read |
query / false | {id:string} |
{source:string} for a validated reachable Git version. ID is 40–64 lowercase hexadecimal characters. |
versions.create |
command / external | {message:string} |
{id:string}; message length 1–2,000; pending Source and overlapping file operations block creation. |
versions.restore |
command / document | {id:string,file?:string} |
{id,revision}; restores a reachable version or one exact native filename from it in one undo edit. The complete candidate passes Source, revision, validation and cancellation gates. Save writes native files. |
project.examples |
query / false | {} |
Current {entries:[{id,title,description,section}],warnings} from the host, without paths/grants. |
project.new / project.open / project.close / project.reveal |
command / session (reveal: external) |
{} |
{status:'requested'}; shared new-project flow, native picker, unsaved-work close confirmation or Explorer action. |
project.openExample |
command / session | {id:string} |
{status:'requested'}; identity must come from project.examples; host re-resolves it before admission. |
simulation.show |
command / document | {} |
{visible:true} after enabled plugin settings/capabilities mount; review none; Agent navigation requires applied Source and the originating project to be active. |
simulation.hide |
command / session | {} |
{visible:false}; cancels active work and retains completed/stopped state. |
type ProjectExportFormat =
| 'netlist' // Primary schematic, KiCad intermediate XML
| 'dxf' // PCB outline, AutoCAD 2000 DXF
| 'gerber' // Full Gerber X2 and Excellon ZIP
| 'drill' // Excellon drill ZIP
| 'stencil' // Gerber paste and profile ZIP
| 'jlcpcb' // Gerber, drill, BOM and placement ZIP
| 'bom' // BOM CSV
| 'placement' // Placement CSV
| 'scad'; // Model CAD, OpenSCAD
type WorkspaceContext = {
version: 1;
capturedAt: string;
project: CanonicalProject;
source: { pending: boolean; draft: null; error: string; draftCharacters: number };
ui: Record<string, unknown>; // Includes revision, view, activeSchematicId and selection.
icDatasheet?: ProjectDatasheetContext;
simulation: SimulationContext | { status: 'disabled' | 'not-opened' };
};
type HistoryPage = {
version: string;
commits: { id: string; date: string; message: string }[];
more: boolean;
needsSave?: boolean;
};WorkspaceContext includes bounded layer/grid/viewport, Layout/Model presentation, visible controls/errors and resident simulation observations, scoped to its project. It does not contain credentials, model bytes or solver logs. View/context capture is not a separate editable design model. Full context contracts are in context/.
Layout's routing observation reports fixed obstacleMode: "walk-around",
angle: "45", clearance: 0.25 mm and useExistingTrackWidth: false, alongside
the configured width and current head. mouseDragTrackBehavior reports the fixed
connected mouse-track behavior; Layout exposes no corresponding selector.
Connected track dragging uses Shove and the fixed 0.25 mm routing clearance. These
observations grant no mutation capability.
Layout's priorityLayer reports an explicitly selected active board layer,
including noncopper layers, or null when the active layer follows layer.
layer retains the copper tool layer. layers reports the eye settings.
The Layout selection rules own the
effect of the active layer and non-active layer display mode on picking.
Layout's transient track-drag observation includes mode, exact pickup, corner endpointTolerance or connected posture, the requested delta, whether it is blocked or constrained, and the constrained appliedDelta when present. Connected and corner gestures can stop at a revalidated boundary between their last displayed valid displacement and the current cursor. These describe the current human preview. The registered layout.drag command uses the same connected/corner engine and exact pickup. It requires the exact requested pose by default; explicit constrain:true enables the same bounded boundary search and returns its applied displacement.
For connected footprint movement, send layout.drag a selection of {kind:"footprint", id} objects, a millimetre delta, and clearance. The checked path uses Walk Around and accepts obstacleMode:"walk-around" explicitly. Set footprintPlacement:"free" to use the GUI's direct reconnection and saved-fill preservation. Free drag requires a footprint-only selection and excludes corner, obstacle and constraint options. The result lists changed footprint IDs and rerouted track IDs, including any new elbow spans. layout.move and layout.pose accept the same option when the selection contains a footprint and retain saved fills, matching canvas Move. Layout owns the supported geometry and placement limits.
Layout's boardOutlineResize observation is null when idle, or contains up to four graphicIds, the active handle, preview bounds and blocked. These describe a human preview; only an accepted Core transaction changes native geometry. zoneResize provides the same bounded handle/bounds/blocked observation with a single zoneId for a board-zone preview.
For gestures with live fill previews, a renderer Worker calculates fill paths with the shared pure geometry preparation. Its bounded queue retains one basis, one in-flight request and the latest pending candidate. Layout displays the newest completed result and temporarily masks it against newer pointer geometry while another result is pending. Request/generation and Source/revision/visibility/cancellation gates discard inapplicable results. Worker previews and masks are excluded from capability results, native geometry and connectivity. Airwires use the fill-free candidate on the renderer thread while moving. Edits with automatic refresh calculate accepted fills independently in Core. Layout describes fill eligibility.
ProjectDatasheetContext is {version:1, projectId:string|null, exampleId:string|null, basis:'validated-project', status:'available'|'not-example'|'controller-mismatch', bindings:[{schematicId,partId,reference}], record:ICDatasheetRecord|null}. The full record follows the IC datasheet JSON contract, which also owns record selection and controller binding. Read queries use validated state while Source is pending; they do not interpret drafts or imply board operating points or model equivalence. The host rechecks revision/cancellation after lazy loading; submission capture additionally rechecks the active sheet. The service rejects forged or cross-project reference observations. source.files remains native-only; Source shows actual local PDFs as ordinary project files; OpenPE does not generate a separate datasheet JSON. Internal reviewed records are bundled from resources/example-catalog/ic-datasheets.json.
Git operations require the desktop bridge and a live destination grant. versions.restore shares the Git window’s single-file and complete-version restore, including exact Model CAD preparation, preservation of saved copper, and one whole-project undo edit. The optional file is an exact name from the reachable version’s native file set. Agent restores preserve protected model and log bytes. Save/export cancellation is a successful result with status cancelled, not proof of a write. Save/export/history accept no host paths.
Workspace requests return before dialogs/navigation finish, so {status:'requested'} does not claim a completed close/open. The live Agent adapter acknowledges only after a successful tool-result POST; local callers acknowledge automatically. afterResult dispatches on the next task after acknowledgement and retains the original cancellation authority until then. Failed delivery, Stop, changed revisions, inactive origins and disposed/suspended registrations prevent dispatch. Once started, native picker cancellation and close decisions follow the GUI flow. Opening another project never transfers the originating run's authority to it; subsequent tools remain scoped to the original project. New/open/close/Explorer requests require the active desktop editor and no conflicting file operation or confirmation.
onAfterResult receives only deferred actions whose results have been serialized.
Normal successful Agent completion drains these delivery/dispatch promises before
revoking the run; it never waits for arbitrary unresolved commands or solvers.
Stop/failure abort immediately. Dispatch, cancellation and failed delivery all
settle the deferred promise, preventing normal EOF from losing an accepted close.
Full PDF page access is read-only and uses the same validated controller binding,
with cancellation, close and revision checks after the host read. document is
the pinned record's datasheet identity. text is extracted page text, not a
connectivity interpretation. The host may fetch the verified vendor PDF on
demand; Datasheets owns source, worker and
resource limits. The tool transport delivers the validated PNG as native image
content and keeps image dimensions and MIME type in the text result. DeepSeek
uses its private attachment store when the selected model route accepts images.
If that route cannot receive the PNG, the result includes the metadata and a
fixed diagnostic. Other query results retain ordinary JSON delivery. A Workbench
turn without a capability bridge receives the reviewed parameter excerpt and
source locators in its initial prompt.
workbench.exportSchematicImage, workbench.exportLayoutImage and
workbench.exportModelImage are host commands with mutation external and
review optional. Each takes {} and uses the originating project's mounted
active drawing and the existing native PNG picker. They return
{status:'exported',name} or {status:'cancelled'}. Open the corresponding view
before calling the command. Closing or changing the drawing during preparation
blocks the picker. Drawing export owns
capture behaviour.
These host capabilities share useProjectDirectory drafts and existing native preview/write handlers. They use relative names from the granted directory listing, never arbitrary paths or native grant IDs.
| ID | Kind / mutation | Input | Result |
|---|---|---|---|
project.files.list |
query / false | {} |
Bounded filename/kind/byte/pending/access metadata; model/log entries remain metadata-only. |
project.files.read |
query / false | {name} |
Current text/preview metadata, pending state and opaque fileRevision. |
project.files.update |
command / session | {name,source,fileRevision} |
Stages the same ordinary text draft as GUI Source. |
project.files.save |
command / external | {name,fileRevision} |
{name,status:'saved',pending} through the existing per-file host writer. |
project.files.discard |
command / session | {name,fileRevision} |
{name,status:'discarded'} after discarding that ordinary-file draft. |
Mutations require a fresh read token and fully loaded editable text. Native files use source.*; binary/truncated previews stay read-only. Model/log formats and model/circuit/solver/log directories reject Agent content operations. Host credential/link/path restrictions still apply. The bounded observation cache rechecks origin, Core revision, destination, draft revision and cancellation. The writer checks disk bytes before replacement and retains a newer GUI edit if an earlier save completes. Pending native Source blocks ordinary-file mutations through these capabilities. Ordinary drafts participate in project Save/close while remaining outside Core, design undo, recovery and automatic Agent context. Agent project.save rejects while a protected ordinary draft is pending.
Owner is host. Queries have mutation false; placement/assignment are object-level commands with mutation document and optional review.
| ID | Kind | Input | Result and behaviour |
|---|---|---|---|
library.categories |
query | {kind:'symbols'/'footprints', source:'KiCad'/'NextPCB'/'JLCPCB'} |
{categories:[{id,name,children:Category[]}]}; KiCad namespaces or the NextPCB and JLCPCB category trees. |
library.search |
query | {kind:'symbols'/'footprints', query?:string, library?:string, category?:string, offset?:integer, includeAssetStatus?:boolean} |
{entries,total,libraries}; online and asset-status searches also return nextOffset (number or null). Asset status is for symbol searches: verified rows include footprintPreview:'unavailable'/'2d'/'2d-and-3d', omitted when unconfirmed. Libraries owns page bounds. Defaults: empty query/library/category, offset 0, no asset checks. Offset ≤999,999; query/library ≤200 characters; category ≤10 characters. |
library.detail |
query | {kind:'symbols'/'footprints', id:string} |
Validated KiCad, NextPCB or JLCPCB detail; symbols include symbol, units and optional package warning and footprintPreview. ID length 1–500. |
schematic.place |
command | {schematicId, libraryId, x, y, unit?:integer, rotation?:number, section?:'hardware'/'simulation'} |
{id,reference,revision}; unit defaults to 1, rotation to 0, requested section to hardware (Real). Unit 1–100, coordinates ±100,000 mm, rotation ±360°. A missing Footprint still places the component in Virtual. |
part.footprint |
command | {schematicId, partId, libraryId:string} |
RevisionResult; empty libraryId clears assignment and the linked package while retaining copper. |
Search entries include id, name, library, description, keywords and optional footprint information. Pass the original search result ID and kind to library.detail. Pass the original symbol ID as libraryId to schematic.place. An unknown bundled entry reports the requested kind and ID. Placement checks the target schematic before loading the symbol and reports the supported units if the requested unit is unavailable. Online catalog entries may also include manufacturer and package strings of at most 200 characters from the provider's corresponding fields. Footprint detail includes a footprint S-expression, pads:string[] and models:[{path,offset,scale,rotate}]. Online symbol detail can report footprintPreview as unavailable, 2d or 2d-and-3d. These values describe verified package conversion and the presence of a supported model reference. Model geometry is verified on demand. Temporary package-read failures can return a warning without a confirmed preview state. The authenticated routes accept catalog identities and cancel online requests on disconnect.
Library search and detail HTTP responses use Cache-Control: no-store. Recognized package codes such as query: '0603' and query: 'SOT-23' search package metadata directly. Prefix a query with package: to search for a different package label. With no category, a recognized NextPCB package search counts deduplicated matches in the bounded catalog sample. Other online totals count upstream rows before package and footprint filters. Pass nextOffset as the next request’s offset, even after an empty batch. A null cursor ends the scan. KiCad totals count actual matching entries. Libraries
schematic.place prepares and adopts supported online packages with the symbol in one edit, using the existing project library when available. Libraries owns asset preparation and persistence.
- KiCad filters use a namespace ID in
library. KiCad footprint searches cover official and pinned example entries and accept native footprint IDs and pinned STEP filenames. Bundled searches reject nonemptycategory. Results retain original IDs for detail, placement and model indices. Libraries - NextPCB uses
library:'NextPCB'with optionalqueryandcategoryfilters. Category IDs are canonical positive decimal strings from its tree. Empty filters use the verified suggestion category. A keyword without a category searches across the catalog. The host reads up to 50 raw rows per page. The footprint chooser requires an allowlisted native footprint URL, and symbol candidates can lack that URL. Detail validates standalone footprints independently of symbols. Detail IDs useNextPCB:<manufacturer_id>_<percent-encoded MPN>. NextPCB online catalog - JLCPCB uses
library:'JLCPCB'with optionalqueryandcategoryfilters. Category IDs are canonical positive decimal IDs from its tree. Empty filters browse the entire catalog. The host returns up to 100 catalog rows per page with a declared or verified package. Exact part-number queries can find rows without a package label. Parts already known to lack a convertible footprint are omitted. WithincludeAssetStatus, list results reuse cached verification from component detail. Detail verifies the exact EasyEDA CAD identity and validates footprint geometry independently of symbol artwork. Detail IDs useJLCPCB:C<digits>. Supported CAD detail includesattribution:{source:string,homepages:string[],notice:string}. JLCPCB online catalog
A symbol's package warning preserves its independently validated schematic geometry and linked Footprint field. Placement and assignment reject pending Source and stale asynchronous results. Core requires valid resolved symbol IDs, units and footprints before committing.
layout.place is a host object command taking
{boardId,partId,libraryId,position:Point,rotation?:number,side?:'front'/'back'}
and returning {id,revision}. It resolves the validated catalog footprint and
shares the Layout chooser's createPCBFootprint preparation and assignment
transaction for an unplaced primary-sheet component. NextPCB and JLCPCB adoption
first prepare portable package resources through the same bounded host path as GUI placement.
Rotation defaults to zero;
optional back-side placement flips that prepared footprint. Coordinates are
millimetres within ±100,000; rotation is within ±360°. Existing placements,
unsupported library geometry, pending Source, stale asynchronous results and
closing projects reject without committing.
Component resource selection is also host-backed and shares the GUI preparation helpers in lib/model-resource-preparation.ts:
| ID | Input | Result and shared behaviour |
|---|---|---|
layout.model.import |
{boardId,footprintId,index?} |
Native STEP picker; prepares a verified resource and appends/replaces one footprint model through layout.footprint.properties. Picker cancellation returns {status:'cancelled'}. |
layout.model.library |
{boardId,footprintId,index?,libraryId,modelIndex} |
Same append/replace transaction using a fixed library identity and model index. |
part.spiceModel.choose |
{schematicId,partId} |
Native library picker and the GUI library-selection transaction; returns declaration metadata and an opaque observation, or cancellation. |
part.spiceModel.inspect |
{schematicId,partId} |
Query the accepted project-relative library through its grant, returning declaration metadata and compatible mappings without model contents. |
part.spiceModel.bind |
{schematicId,partId,source:'basic',passiveModel?:'R'/'C'/'L'/null}, {schematicId,partId,source:'external'} or {schematicId,partId,source:'external',observationId,name,mapping?} |
Select an intrinsic model, clear a no-file passive override with null, select the retained external model, or bind an observed declaration. Ambiguous terminal roles require an explicit valid mapping. |
part.sourceType |
{schematicId,partId,type:'DC'/'PULSE'/'SIN'} |
Shared intrinsic-source conversion preserving levels/timing and linked native fields. |
These commands declare host ownership, object level and document mutation; inspection is a read-only host query. Successful STEP selection returns {status:'applied',revision,boardId,footprintId,index,models}. SPICE observations contain {status:'available',observationId,revision,path,models,issues,bindings} with declaration names/kinds/device/pins only. The cache holds at most eight observations and invalidates on Core changes; binding rechecks the exact component, revision, library and grant. Native selection, inspection and asynchronous library preparation recheck Source, close, active-origin and cancellation gates. SPICE resource controls require the enabled SPICE plugin. Retained inactive fields survive intrinsic/external switching. No capability accepts model bodies, executable paths or arbitrary library paths.
library.price takes {id,kind,source} with source:'lcsc'/'huaqiu' and
returns the same bounded USD quote as the chooser.
library.datasheet.page takes {id,kind,source,page} with
source:'huaqiu'/'jlcpcb' and a one-based page up to 10,000. It returns
{page,pageCount,image:{mimeType:'image/png',data,width,height}} or null
when the catalog has no supported PDF. Both are cancellable host queries using
the chooser readers. They accept a catalog identity of 1–500 characters and
kind:'symbols'/'footprints'. The Agent transport attaches the PDF raster as
image content and keeps base64 out of the text result. Catalog pages are external
reference material. Component datasheets
owns source and worker bounds.
api/plugins.ts defines version-1 manifests and command
contributions. Catalog entries can include runtime, projectDirectory, permissions, contributes
and an installed package sha256. Local commands register as plugin-owned
read-only queries under extension.<publisher>.<name>.<command>, with declared
input schemas. SDK and execution limits
window.openpe.installPlugin() takes no arguments. A trusted main-frame IPC
opens the native package picker and approval; it returns {id} or null and
never exposes source paths. It is absent from Agent capabilities. The internal
authenticated POST /api/runtime-plugins/run accepts exactly
{id,command,input,context,sha256} (12 MiB maximum), validates installed state,
hash, command/schema and project-read permission, and returns bounded JSON.
Closing the request, disabling/uninstalling or service shutdown cancels its
worker. No HTTP installation/upload endpoint exists.
Owner is host; level is absent. List is a query with mutation false; change is a command with mutation external and optional review.
| ID | Input | Result and behaviour |
|---|---|---|
workbench.plugins.list |
{refresh?:boolean} |
Confirmed WorkbenchPluginCatalog; shared cache lasts five minutes. |
workbench.plugins.change |
{action:PluginAction, id:WorkbenchPluginId} |
Updated WorkbenchPluginCatalog; reconciles lifecycle across mounted projects. |
provider.plugins.list |
{provider:'codex'/'claude', refresh?:boolean} |
Provider catalog with plugins, controlsVersion, browse, marketplaces, actions, warning and optional updatedAt. |
provider.plugins.change |
{provider:'codex'/'claude', action:PluginAction, id:string} |
{ok:true} after a supported provider action succeeds. |
type PluginAction = 'install' | 'uninstall' | 'enable' | 'disable';
type WorkbenchPluginId = string; // name@publisher from the confirmed catalog
type WorkbenchPluginCatalog = {
controlsVersion: 1;
plugins: {
id: string;
scope: string;
name: string;
marketplace: string;
description: string;
version: string;
installed: boolean;
origin: 'agent' | 'openpe' | 'unknown';
enabled: boolean | null;
managed: boolean;
icon?: string;
detail?: string;
category?: string;
author?: string;
capabilities?: string[];
}[];
browse: boolean;
actions: PluginAction[];
warning: string;
updatedAt: number;
};Bundled SPICE installation activates packaged resources. Provider management additionally checks CLI capabilities, qualified plugin identities and confirmed state; a syntactically valid capability input alone does not authorize an operation. These catalogs/lifecycles remain separate from project data and recovery. See Plugins.
pcbDesign.guide is a read-only query owned by plugin ai-pcb-layout@openpe, with no Core level or mutation. Input is {document?:string} with no extra keys. The enum is workflow (default), analysis-and-measurement, behavioral-evaluation, cad-and-tools, devices, electrical-layout, electrical-net-table, implementation-and-delivery, insulation-and-copper, regimes-and-standards, topologies.
The result is {document,source,revision,license,attribution,documents:string[],integration,text}. text is the unchanged pinned upstream document; integration bounds its use to currently advertised OpenPE tools and review gates. Each UTF-8 document is bounded to 64 KiB and SHA-256 verified. Availability follows confirmed plugin state, independently rechecked by the service. Disable/uninstall aborts outstanding reads and Agent turns containing injected guidance. No project, undo, native Source or recovery writes occur. See Plugins.
simulation.show/simulation.hide belong to the host. The following six resident capabilities belong to plugin, carry plugin: 'spice-simulation@openpe' and no abstraction level. They register as settings/waveform views mount; enabled lifecycle and current resident state gate use. Query the catalog again after simulation.show.
| ID | Kind / mutation | Input | Result and behaviour |
|---|---|---|---|
simulation.status |
query / false | {} |
SimulationContext. |
simulation.configure |
command / session | {config?:SimulationConfigChanges, drafts?:SimulationDrafts} |
Updated SimulationContext; configuration keys depend on the supported circuit. |
simulation.probes |
command / session | {target?:ProbeTarget/null, selected?:string[]} |
Updated SimulationContext; null clears the probe. Selected vectors are unique, up to 256. |
simulation.run |
command / document | {} |
SimulationContext after completion/explicit Stop; newly verified model references can enter the project in one undo edit. |
simulation.cancel |
command / session | {} |
{cancelled:boolean}; requests Stop and retains validated received samples as stopped partial results. |
simulation.presentation |
command / session | SimulationPresentationChanges |
Current WaveformPresentation. Requires resident waveform controls and applicable traces/results. |
Live Agents await simulation.run and reuse its returned state. They query the
already-discovered simulation.status only when current progress, errors,
probes or measurements are needed, including a human-started run. Instructions
discourage tight polling, duplicate pending runs and using capabilities.list
as a progress check, waiting loop or keepalive.
type SimulationConfigChanges = {
voltage?: number;
frequency?: number;
duty?: number;
stop?: number;
step?: number;
inputId?: string;
pwmId?: string;
outputId?: string;
switchId?: string;
currentId?: string;
};
type SimulationDrafts = {
voltage?: string;
frequency?: string;
duty?: string;
stop?: string;
step?: string;
};
type ProbeTarget = { kind: 'voltage' | 'current'; id: string; pin?: number };
type Axis = { min: number; max: number; step?: number };
type SimulationPresentationChanges = {
layout?: 'auto' | string; // String must match [1-3]x[1-4], e.g. 2x2.
linked?: boolean;
visibleCursors?: [boolean, boolean];
cursor?: { vector: string; which: 0 | 1; time: number };
view?: {
vector: string;
range?: 'full' | 'tail';
time?: Axis | null;
values?: Axis | null;
zoomMode?: boolean;
};
navigate?: { vector: string; direction: 'back' | 'forward' };
};
type WaveformPresentation = {
layout: string;
linked: boolean;
visibleCursors: [boolean, boolean];
traces: Record<
string,
{
time: Axis;
values: Axis;
cursors: [number, number | null];
}
>;
};Numeric config uses V, Hz, percent and seconds; stop and step accept any finite positive value. Text drafts use the UI card's displayed units and may be incomplete. Configure requires at least one nonempty config/drafts object, disallows the same numeric key in both, and is blocked while running. It preserves existing completed/stopped waveforms and their resultConfig until Run. Schema acceptance does not make an unsupported circuit parameter editable.
Presentation requires at least one property. view must include vector and at least one setting. Axis bounds must be finite/increasing and meaningful for actual samples; optional axis step is positive. Cursor time uses seconds and must be valid for the current result. view and navigate cannot be combined in one command. Vector/target identities are validated against the active sheet and current result.
SimulationContext contains circuitId, basis, settings/waveform visibility, status, displayed settings, config, optional resultConfig, errors, probe/selected vectors, presentation and optional result. Status is idle, detecting, unavailable, blocked, running, completed, stopped or failed. A result has status live, completed or partial, sample count, seconds-based time range and traces with units, native extrema/endpoints, reduced curves and optional visible-window/cursor/delta observations. These curves are not the full native waveform. Exact types and reduction are in context/agent-simulation-context.ts.
Run requires active visible Schematic settings, applied Source, supported inputs, enabled SPICE, verified models/solver and a saved desktop destination. Stop retains validated partial samples; automatic cancellation discards live previews. There is no solver runtime timeout. Load-only restore/settings/waveform behavior follows Simulation.
Host commands thermal.show and thermal.hide take {}. Show requires an enabled plugin, an active project with a PCB and applied Source, switches to Layout and waits for the resident capabilities. Hide cancels active work and retains a completed session result.
Seven resident capabilities belong to plugin: 'pcb-thermal@openpe'. All measurements describe board temperatures, not package junction temperature. Inputs use finite numbers and reject extra properties; discover the mounted schemas before calling them.
| Capability | Input | Result / effect |
|---|---|---|
thermal.status |
{} |
Bounded settings, heatInput, presentation, visibility, solver availability, run state, extrema, statistics, assumptions and selected node. Zero-based node indices share the result's 200,000-node limit. No full volume mesh. |
thermal.configure |
{config?:Partial<ThermalConfig>,heatInput?:'manual'/'spice'} |
Updates settings or heat-input mode in the visible panel with applied Source. heatSources replaces the complete list of {footprintId,powerW}. |
thermal.importSpice |
{} |
Load supported signed average V·I heat inputs from full-resolution native SPICE output over the final 20% of a matching completed transient for the PCB-linked primary schematic. Both plugins must be enabled and the project saved. Session mutation; no solver/download. |
thermal.run |
{} |
Refreshes verified completed electrical losses in SPICE heat-input mode, then performs a Gmsh/Elmer steady solve; requires active visible Layout, applied Source, verified resources and a saved desktop project. Archives the complete result; external mutation. |
thermal.cancel |
{} |
{cancelled:boolean}; aborts owned work and discards incomplete fields. |
thermal.probe |
{point:{x,y,z?}/null} |
Nearest actual solver node; omitted z uses the displayed front/back surface. Null clears it. |
thermal.presentation |
{surface?:'front'/'back',shown?:boolean,outlinesShown?:boolean,probing?:boolean} |
Returns the resulting full presentation. Requires a visible current field and applied Source. Docked Layout supplies the overlay, outlines and probe mode. Changing surfaces clears the probe. Hiding the overlay exits probe mode. |
thermal.exportImage |
{} |
Exports the current temperature map through the desktop image picker. External mutation with optional review. |
ThermalConfig is defined in plugins/layout-thermal/domain/thermal.ts: ambient °C, front/back/edge convection W/(m²·K), each copper-layer thickness mm, dielectric/copper conductivity W/(m·K), plating and mesh size mm, and per-footprint W into the PCB. Optional spiceSource:{config:TransientConfig,startS,endS,resultBasis} records host-verified imported sample provenance. Run and lookup revalidate it. Selecting Manual or supplying explicit heatSources without spiceSource clears provenance. Selecting SPICE requires enabled desktop SPICE Simulation and defers import until requested or Run. Materials, all imported heat into pads and equal dielectric gaps are explicit assumptions. thermal.changed events and optional workspace thermal context are bounded observations. The result's original settings remain available when current settings change. First opening a saved project's panel restores the latest matching verified field and its configuration through the load-only result route. Results and settings stay outside Core design state, undo, recovery and dirty state. See Layout Thermal for geometry, persistence, lifecycle and numerical verification.
parasitics.extractNetwork is a read-only query owned by plugin
layout-parasitics@openpe. Its closed input schema is
{boardId:string,netId:string,copperThicknessMm?:number,viaPlatingMm?:number,frequencyHz?:number}.
IDs are 1–200 characters. The net must be assigned on the identified current PCB.
Both thicknesses are in mm and accept finite values from 0.001 to 1 inclusive.
The defaults are 0.035 mm copper thickness and 0.025 mm via plating thickness.
frequencyHz accepts finite values from 0 to 1,000,000,000 inclusive and
defaults to 0 (DC).
The result is
{boardId,revision,netId,netName,copperThicknessMm,viaPlatingMm,frequencyHz,nodes,branches,islands,meshLayers,spice}.
Each node has {id,island,pad?,junction?}. A pad object has {id,reference,number}.
A junction has {x,y,layer} with the actual routed branch point in PCB
millimetres and its copper layer. A mesh fragment gets a junction record only
when it represents a single verified routed branch point.
island is a one-based copper island number or null for a node without branches.
Each branch has
{id,sourceId,kind,from,to,layers,lengthMm,resistanceOhm,selfPartialInductanceNh,inductanceNh}.
kind is zone for a planar mesh branch, track for an analytic track
interval or via for a barrel interval. sourceId is the native track or via
ID or null for a mesh branch. from and to reference the network nodes
in the order of the two copper layers. Values use the returned frequency in
Hz. selfPartialInductanceNh is the isolated segment self term.
inductanceNh is the modeled branch value, including its share of partial
mutual inductance within an analytic series run. Net display, SPICE and native
net import use inductanceNh. Each mesh layer has
{layer,pitchMm,zoneIds,trackIds} with nominal pitch and the native source
IDs used to build its shared copper geometry. zoneIds can be empty for a
layer meshed for copper overlap. Each island has
{id,subcircuit,ports}, where ports lists the external node IDs in SPICE
argument order. spice contains subcircuit definitions for the full extracted
graph, including internal copper nodes. A valid net with zero modeled
branches returns an empty spice string. revision is the numeric Core revision.
The query requires an installed and enabled plugin, applied Source and an open project. It reads the accepted PCB, including unsaved edits, and checks any supplied capability revision. The dock and scoped Agent tools use the same query. Browser development uses the bundled renderer capability and catalog. Copper R/L networks
parasitics.measure is a Layout Parasitics read-only query with the same
project, Source, plugin and revision gates as extraction. Its closed input
schema is {boardId:string,startId:string,endId:string,copperThicknessMm?:number,viaPlatingMm?:number,frequencyHz?:number}.
The endpoint IDs identify two distinct assigned pads or vias on the same PCB
net. IDs, thicknesses and frequency use the ranges above.
The result is
{boardId,revision,netId,netName,startLayer,endLayer,copperThicknessMm,viaPlatingMm,frequencyHz,equivalentResistanceOhm,shortestLengthMm,shortestResistanceOhm,routeSelfInductanceNh,spice}.
Equivalent resistance is the real part of the modeled two-terminal impedance
at the returned frequency. Route R sums the branch resistance along the
shortest path by length. routeSelfInductanceNh estimates the partial
inductance of the whole path, including mutual terms between its analytic
segments. spice is a string containing a two-port subcircuit whose series R
and L use the calculated shortest-route values. Comments identify the endpoint
pads or vias and record the evaluation frequency when it is positive. Layer descriptions are strings.
The numeric revision identifies the accepted PCB basis.
Two-terminal measurement
parasitics.importSchematic is a Layout Parasitics document command at the
operation level with optional review. It accepts exactly one of the closed
extraction and measurement input schemas above and shares their project,
Source, plugin and revision gates. It uses the accepted PCB to prepare a
dashed block for the reduced Net connections between pads and physical copper
junctions or the shortest Terminal route on the project schematic, then commits
once through ProjectCore. Net branchCount matches the dock’s Branches value.
Net portCount counts external pad ports. Terminal import returns
branchCount: 1 and portCount: 2.
The result is {schematicId,blockId,blockTitle,bounds,branchCount,portCount,frequencyHz,revision}.
schematicId identifies the existing schematic and blockId identifies the
native rectangle UUID. bounds is {x,y,width,height} in millimetres.
frequencyHz gives the evaluation frequency, and revision is the numeric
revision after the successful import.
Schematic import
Agent identities are shared by the renderer, recovery and generated service catalog from lib/agent-providers.ts. Local detection always returns all four entries; missing executables do not remove supported identities from Settings or the picker.
On Windows, Codex detection, model discovery and execution share CLI lookup. The npm installation in the standard per-user prefix takes precedence over the desktop process's inherited PATH. OpenPE launches its native Windows executable directly with the console hidden and owns its stdio and process lifecycle. If the npm installation is incomplete, lookup checks PATH and then the standard standalone installation directory.
Claude Code detection, model discovery and execution also share CLI lookup. On Windows, an npm launcher resolves only its fixed sibling node_modules/@anthropic-ai/claude-code/bin/claude.exe, which OpenPE launches directly without a shell. Lookup also checks the standard per-user npm prefix when it is absent from the desktop process's inherited PATH. Claude Code must support --bare for isolated model discovery.
DeepSeek Harness detection, model discovery and execution share the same launcher. On Windows, the npm launcher resolves its fixed sibling node_modules/@deepseek-ai/dsh/lib/bin.js and uses an external Node.js executable: a sibling node.exe, then absolute node.exe results from PATH discovery. Runtime discovery checks the sibling and at most eight PATH candidates within a shared ten-second budget, with each probe limited to five seconds. It requires Node.js 24.9.0 or newer and rejects Electron. Missing or unsupported runtimes fail detection with a diagnostic. OpenPE never substitutes its embedded Electron runtime for DeepSeek's Node.js host; the harness's native loader requires its supported runtime. Launches use argument arrays without a shell, and the harness retains responsibility for its configuration and authentication.
| ID | Display name | CLI | Runtime boundary |
|---|---|---|---|
codex |
Codex | codex |
Scoped live OpenPE tools through app-server. |
claude |
Claude Code | claude |
Scoped live OpenPE tools through the fixed stdio MCP helper. |
deepseek |
DeepSeek Harness | dsh |
Scoped live OpenPE tools through the guarded ACP adapter. |
pi |
Pi | pi |
Scoped live OpenPE tools through the restricted RPC adapter. |
installed reports detection of a local CLI; available reports whether the detected integration can run under OpenPE's restrictions. Authentication remains unknown.
DeepSeek ACP disables client filesystem and terminal capabilities, rejects permission requests and starts with an empty MCP server list. A private per-turn patch registers the three project tools through the native tool registry when the Workbench capability bridge is present. Before ACP startup, the patch verifies that the registry resolves each name to its registered definition and that an unknown tool is denied. When the harness creates the session, its scoped registry excludes built-in tool schemas outside the allowlist. The execution guard admits only the registered OpenPE definitions and the native ask_user_question tool when the separate question bridge is present. An incompatible tool-registration, scoping or guard interface fails the turn.
Pi uses a private no-session RPC process with built-in tools, discovered and configured extensions, skills, prompt templates, context files and MCP disabled. OpenPE copies its sole allowed extension, server/pi-tools.mjs, to a private temporary directory and removes it after the RPC session. The extension registers the three project tools for a bridged Workbench turn and openpe_ask_user for a turn with the separate question bridge. The CLI keeps --no-tools and receives a fixed --tools allowlist for turns with the extension. The extension checks the exact active tool set and blocks other tool calls. OpenPE requires the extension's RPC proof of that set before sending the prompt.
All four Workbench adapters expose the three OpenPE tools below when the turn has a capability bridge. The transports bind each request to its run, session, project and Origin. The per-project host applies the same discovery, validation, permissions and review rules for every adapter. The separate question tool remains available on turns with a question bridge.
External HTTP tool callbacks and DeepSeek/Pi question callbacks use direct, authenticated loopback requests. They validate the turn-specific URL and token, reject redirects and bound response bodies. Provider runtime proxy settings apply to provider requests and do not receive local bridge traffic.
| Tool | Arguments | Result |
|---|---|---|
openpe_query |
{name:string, input?:JsonValue} |
Target query's result. Start with name: 'capabilities.list'; query current design data as needed. |
openpe_execute |
{name:string, input?:JsonValue} |
Command result in Auto or for review:none; otherwise a pending command review in Review. A pending review is not a completed edit. |
openpe_observe |
{after?:integer} |
{cursor,events,truncated}; a bounded immediate read, not a background subscription. |
Tool envelopes accept only the listed fields and reject unknown keys, invalid names/cursors and nonfinite/oversized JSON before dispatch. Names match ^[a-zA-Z][a-zA-Z0-9_.:-]{0,127}$. Agent commands have no expectedRevision field or observation requirement; obsolete revision fields are unsupported. Auto execution and manual Apply use the current project state. Review checks the current command discovery metadata and availability before deciding whether confirmation is needed. Queries/observation and commands with review:none execute immediately. File/design changes require confirmation, including Source and ordinary-file drafts and external writes. Agent navigation cannot implicitly apply pending Source; use a separately reviewed source.apply. The transient review card displays the checked discovery description as plain text, separately from the command. The review-required result remains {status,reviewId,command}; display descriptions do not enter arguments or authorize execution. Reviews retain immutable arguments, with schema, availability, target, domain, Source and lifecycle validation at Apply. Workbench serializes Agent document mutations per project, including across conversations, while session/external operations and queries remain independent. Internal Core preparation/transaction guards still reject an operation whose own prepared data became invalid during execution. Prompt/tool guidance asks providers to await each project-changing command before preparing the next.
Bridge input/result budgets are 32 MiB minus 4,096 bytes of envelope headroom, with depth at most 64 and one million JSON nodes. Each turn allows four pending calls and 256 total calls. Query/observe delivery has a 60-second deadline; command execution does not impose that deadline on solver work. Each request carries a single-use response token; completion, disconnect, cancellation or project close revokes its live bridge. Switching to Auto does not execute existing reviews. Review limits and lifecycle details are in Core.
Next.js development serves a same-origin geometry and bundled-plugin proxy at /api/browser-preview/*. Its private host binds an ephemeral 127.0.0.1 port and accepts only the exact http://127.0.0.1:3000 renderer Origin, Sec-Fetch-Site: same-origin and X-OpenPE-Browser: preview. Foreign/missing origins, foreign hosts and preflights fail without CORS headers. Bootstrap, catalog and preview responses use Cache-Control: no-store; SPICE streams use the transient endpoint's no-cache policy.
| Route | Request | Result |
|---|---|---|
POST /api/browser-preview/session |
Empty JSON object, at most 1 KiB | {token:string}; a 64-hex process-local preview token, retained only in page memory. |
POST /api/browser-preview/cad |
{object:ModelCadObject}, at most 512 KiB, plus X-OpenPE-Token |
The existing {shapeKey,meshes} CAD result, using the same canonical validation, fixed kernel, cache and cancellation as desktop. |
Authenticated POST /api/browser-preview/footprint accepts exactly {id:string} and returns the existing bounded footprint detail. POST /api/browser-preview/model accepts exactly {id:string,index:number} and returns the existing {meshes,model} library preview. IDs are nonempty and at most 256 characters; model indices are integers 0–99, matching the desktop preview range. Both request bodies are limited to 1 KiB. Only fixed bundled example identities and official KiCad library IDs/model indices resolve resources. The browser library service reads prepared resources without downloads or cache writes; project paths, native grants, model imports and model-copy routes are unavailable. CAD and component previews share a serial STEP parse queue and one bounded parser pool. The token grants only the listed development endpoints. Disconnect aborts preparation. Expired tokens fail visibly and are reacquired on the next explicit retry; failed bootstrap remains retryable. The endpoints exist only in development; packaged static builds retain Electron IPC/service startup.
Authenticated POST /api/browser-preview/price uses the shared price request and result.
Authenticated POST /api/browser-preview/datasheet uses the
shared datasheet request and result.
Authenticated POST /api/browser-preview/plugin/<action> exposes nine fixed
actions. catalog, guide, spice-status, thermal-status and
provider-list require an empty JSON object. guide accepts the optional
document query. provider-list accepts the existing provider and refresh
query. change and provider-change use the existing bundled and provider
lifecycle schemas. These bodies are capped at 1 KiB. spice-run and
thermal-run accept the corresponding
desktop run schemas with fileId excluded and a 24 MiB body limit. They share
existing validation, cancellation, lifecycle gates and output formats. Solver
result publication, restoration, SPICE heat import, Agent chat and native file
grants are unavailable through this proxy.
The service listens on 127.0.0.1 with a dynamic port. window.openpe.connection() supplies the base address and per-process token to the renderer; lib/bridge.ts adds Content-Type: application/json and X-OpenPE-Token. The separate per-turn Agent bridge uses X-OpenPE-Agent-Token instead of the service token.
Hosts are restricted to 127.0.0.1/localhost. A supplied Origin must match the service base or configured development Origin. Preflight OPTIONS returns 204 before authentication. Except for the scoped Agent tool and question bridges noted below, /api/* rejects an invalid/missing service token with 401. Unmatched authenticated API requests return a JSON 404 before the static renderer fallback. Native file access still requires its own live grant after HTTP authentication.
The registered method/path pairs are listed below. Inputs listed in braces are JSON bodies unless the row specifies URL/query parameters.
| Method and path | Input | Success response and conditions |
|---|---|---|
GET /api/appearance |
None | Validated Appearance; defaults when absent. Malformed stored settings are preserved and reported. |
POST /api/appearance |
Appearance |
Validated/persisted Appearance; serial atomic settings write. |
GET /api/agents |
None | {id,installed,available,version?,path?,error?,auth:'unknown',supportsEffort?,supportsCapabilities?}[]; all four IDs, independent of installation. |
GET /api/models |
Query provider=codex/claude/deepseek/pi. DeepSeek accepts an optional model ID. |
{models:[{id,label,description?,...}],defaultModel?}, with textInput:false for Codex and Pi entries that cannot take text. DeepSeek returns the requested model's native effort options when model is supplied. Discovery cancels on disconnect and rejects unavailable runtime adapters. |
GET /api/plugins |
Query provider, optional refresh=true |
Provider plugin catalog and supported controls. Only these query keys are accepted. |
POST /api/plugins |
{provider,action:PluginAction,id} |
{ok:true}; qualified plugin@marketplace ID and CLI-supported operation required. One active plugin operation per provider. |
GET /api/workbench-plugins |
No query parameters | Built-in and installed local workbench catalog. Malformed lifecycle/package state fails closed. |
POST /api/datasheets/page |
{exampleId:string,page:integer,image?:boolean} |
Authenticated, origin-checked fixed reference catalog lookup. Returns the PDF-page result above without renderer-added projectId/bindings. Rejects unknown IDs, extra fields and out-of-range pages before I/O; accepts no URL/path. |
POST /api/workbench-plugins |
{id:WorkbenchPluginId,action:PluginAction} |
{ok:true} for confirmed catalog identities. Local installation requires native approval. The capability wrapper subsequently reloads the catalog. |
GET /api/pcb-design/guide |
Optional document query from the fixed guidance enum |
Verified PCB guidance result above; authenticated, origin-checked and plugin-gated. Rejects unknown selectors or extra parameters before file access. |
GET /api/libraries/:kind |
Path kind=symbols/footprints; query q?, library?, category?, id?, offset?, categories?, includeAssetStatus? |
categories=KiCad/NextPCB/JLCPCB returns {categories} and cannot combine with nondefault search/detail inputs. A nonempty id returns resolved detail; otherwise see the library search result. Only symbol searches accept includeAssetStatus=1. Nonempty category is a NextPCB or JLCPCB category ID. |
GET /api/library-model |
Query id, index? |
{meshes,model} for an existing model reference in a bundled official, pinned example or validated NextPCB or JLCPCB footprint. Index defaults to 0. |
GET /api/library-price |
Query id (1–500 characters), kind=symbols/footprints, source=lcsc/huaqiu |
{source, currency:'USD', checkedAt:number, offers:{sku:string, manufacturer:string|null, stock?:number, tiers:{quantity:number, unitPrice:number}[]}[]}. checkedAt is Unix time in milliseconds. An empty offers array means there is no matched USD offer in the bounded lookup. Authenticated development POST /api/browser-preview/price accepts the same fields as JSON (2 KiB maximum). Both routes are cancellable, return no-store responses and resolve the identity in the host. Component pricing owns source details. |
POST /api/library-datasheet |
{id,kind,source,page} (2 KiB). Catalog ID is 1–500 characters, kind is symbols or footprints, source is huaqiu or jlcpcb, and page is an integer from 1 to 10,000. |
{page,pageCount,image:{mimeType:'image/png',data,width,height}} with base64 image data, or null when the selected source has no supported PDF. The route is cancellable and returns no-store responses. Component datasheets defines source and worker limits. |
POST /api/library-package |
{id:string} |
Prepared NextPCB or JLCPCB footprint detail with projectAssets:true and verified portable model references. At most eight pending requests, serialized STEP imports; disconnect cancels. No project filesystem write or document edit. |
POST /api/model-cad/preview |
{object:ModelCadObject} |
{shapeKey:string,meshes}; validates one local shape, constructs analytical STEP with fixed bundled Gmsh/OpenCASCADE operations and tessellates it with the bundled STEP parser. Disconnect cancels; independent of simulation plugins. |
GET /api/state |
None | Stored recovery JSON or null; ordered with HTTP and Electron recovery writes. The workspace consumer validates current-format content. |
POST /api/state |
Validated WorkspaceState v2 |
{ok:true} after the shared recovery queue atomically writes the validated JSON. Not a design-file Save API. |
DELETE /api/state |
None | {ok:true} after the shared recovery queue atomically writes JSON null to the current recovery file. |
POST /api/chat |
ChatRequest |
Chat SSE stream. One request/session, at most four active sessions. |
POST /api/chat/continuation/close |
{sessionId,nativeSessionOwner,continuation} |
{ok:true}. Releases a matching idle native session for the authenticated originating Origin. |
POST /api/chat/steer |
{runId,sessionId,requestId,token,prompt} |
{ok:true} after native same-turn acknowledgment. Requires process authentication and the active input bridge's originating Origin/session/token; invalid, expired or unsupported input returns 409. |
GET /api/agent-settings / POST /api/agent-settings |
No body / exactly {followUpMode} (queue or steer) |
Read or atomically save shared Agent behavior in agent-settings-v1.json, outside recovery/design/provider configuration. Missing files default to Queue; malformed files are preserved with an error. |
POST /api/chat/answer |
{runId,sessionId,requestId,token,answers:Record<string,string[]>} |
{ok:true}; process authentication, originating Origin/session and a single-use question token. Invalid, duplicate or expired answers return 409. |
POST /api/agent-questions/:bridgeId |
{questions} |
{answers:Record<string,string[]>}; only the originating per-turn X-OpenPE-Agent-Token, never the process token. Normalizes against the originating provider, waits for explicit input and returns 422 on rejection/cancellation. |
POST /api/chat/tool-result |
{runId,sessionId,requestId,token,result} or the same identity fields with error instead of result |
{ok:true}; exactly one result/error, correct originating session/Origin and a single-use response token required. |
POST /api/agent-tools/:bridgeId |
{tool,arguments} |
{result}. Requires the active bridge's X-OpenPE-Agent-Token; the process token does not replace it. |
GET /api/thermal/status |
No parameters | Verified bundled Gmsh/Elmer availability and versions; service-owned thermal plugin gate precedes detection. |
POST /api/thermal/run |
{source,config:ThermalConfig,fileId?:string} |
{result:ThermalResult}; one active run, disconnect cancels. Desktop requires a saved grant and publishes complete artifacts before success. |
POST /api/thermal/spice-sources |
{source,fileId:string} |
{heatSources,spiceSource,losses,assumptions} from the latest matching saved SPICE settings and verified full-resolution native power summary over the final 20%. Requires both plugins; load-only, no solve/download. Watt sources use stable footprint IDs; losses supplies reference, W and compiler method. |
POST /api/thermal/result |
{source,fileId:string,config?:ThermalConfig} |
{result:ThermalResult,config:ThermalConfig} or {result:null}; load-only latest lookup matching complete PCB input, artifact hashes and verified runtime. |
GET /api/simulation/status |
None | {available:true,version} or {available:false,error}; plugin installed/enabled gate precedes detection. |
POST /api/simulation/ti-model-search |
{fileId:string,partNumber:string} |
{partNumber,models} from a live TI product lookup. Requires a live desktop grant and enabled SPICE. |
POST /api/simulation/ti-model |
{fileId:string,archive:string} |
{libraries:SpiceModelCatalog[]} from the selected current TI search result. Requires a live desktop grant and enabled SPICE. |
POST /api/simulation/result |
{source,config?:TransientConfig,fileId?:string} |
{result:SimulationResult,config:TransientConfig} or {result:null}; omitted config discovers the latest saved configuration; explicit config requires an exact match. Load-only. |
POST /api/simulation/transient |
{source,config:TransientConfig,fileId?:string}; optional Accept: text/event-stream |
JSON SimulationResult or simulation SSE; successful response can include simulationModels references. One active transient across the service. |
Library query lengths are q/library ≤ 200, id ≤ 500; offset is 1–6 decimal digits, default 0. Model index is 1–2 decimal digits. Model resolution accepts a catalog ID/index, never a URL; fixed official package/model resources can be downloaded according to Libraries. Workspace and appearance structures are defined by lib/workspace-state.ts and lib/appearance.ts.
For includeAssetStatus=1, Accept: application/x-ndjson selects a
request-scoped stream on the existing library search route. A nonempty page
starts with {type:'progress',completed:0,total} and emits a frame per
confirmed check. The total is the eligible page size, at most 16. The final
line is {type:'result',result} with the ordinary result, or
{type:'error',error,code?} after a stream starts. Disconnect cancels the
request. Other clients receive the ordinary JSON response.
GET /api/layout-preferences reads the application-wide Layout preferences,
defaulting to {placementSuggestions:false} when the file is absent. It reports
and preserves malformed stored data. POST /api/layout-preferences accepts
exactly {placementSuggestions:boolean} and returns the validated record after
a serial atomic write. These authenticated routes are independent of project
and appearance records.
Appearance.leftButtonDrag is drag-any, drag-selected or select, shared by
Schematic and Layout. Saved appearance settings require all current fields; incomplete records and retired values are rejected. It controls pointer selection only and grants no design mutation.
Appearance.modelGridSpacing accepts 0.5, 1, 2, 5 or 10 mm, independently of
gridSpacing and layoutGridSpacing; saved settings must include it. All three drawing views share schematicLayers.grid visibility.
Model spacing defaults to 5 mm and controls ground and sketch workplane lines,
independently of CAD snapping.
Workspace UI observations include modelGridSpacing alongside the other grid settings.
Workspace recovery accepts the current workspace and per-project envelopes,
bundled Home identities and syntactically valid opaque local example identities.
It retains stable project IDs, complete project Source, required dirty state and
native Source drafts, filenames, conversations, active project/conversation IDs
and shared Agent preferences. The model preference map requires one key for each
of the four supported Agents. The required effort value stores the active Agent's
generic preference. Optional agentEfforts stores supported effort values for
inactive Codex, Claude Code and Pi entries. Optional deepseekReasoning:{model,value}
retains one explicit native choice for that exact model. Each non-null Source
draft is limited to 8,000,000 UTF-8 bytes, separately from the 96 MiB workspace
envelope.
Validation requires every mandatory field and rejects unknown workspace or per-project fields before writes. Grants, destinations, ordinary-file drafts, appearance and simulation results stay outside recovery. Example identities must be explicit and supported. Conversations must use the current record format. Existing malformed recovery remains on disk and fails validation.
JSON request limits are 8 MiB by default, with route-specific limits: state 96 MiB, TI model search and selection 2 KiB each, simulation result/transient and thermal run/result/spice-sources 24 MiB, chat 32 MiB, chat/tool-result 40 MiB, chat/steer and agent-settings 128 KiB, agent-tools 32 MiB, agent-questions 256 KiB and model-cad/preview 512 KiB. These parser limits do not replace the narrower domain/tool bounds.
CAD preview accepts only the object field, never script, path or executable
input. It returns a canonical ordered geometry JSON key excluding top-level
identity/pose/material and local meshes; it has no document mutation authority.
Geometry preparation uses a 60-second bound and verifies a complete regular STEP
artifact at most 30,000,000 bytes. The service permits two active preparations,
checks at most 64 returned meshes/six million numeric values and retains a
retryable 16-entry/64 MiB cache. Core host adapters admit a matching key only for
the exact validated candidate and recheck revision before publication.
TI model search accepts an opaque desktop file grant and an exact TI product number of 2–40 characters. The service reads at most 2 MiB of the fixed English TI product page with a 15-second deadline and no redirects. It returns the uppercase partNumber and up to 48 models of shape {archive,title,encryption,modelId?}. A missing product returns an empty list. The archive filename identifies the displayed revision. encryption is encrypted, unencrypted or unknown, classified from TI titles, known archive evidence and current service observations. modelId is present only for a matching pinned archive. Search returns metadata without fetching model archives.
TI package inspection accepts a live desktop grant and an uppercase archive code from that project’s latest successful search, retained for ten minutes. Search and inspection share one request per project. Both recheck the grant, destination and plugin state and cancel on disconnect, plugin disable/uninstall or service shutdown. Known encrypted results fail before any archive fetch with OPENPE_TI_MODEL_ENCRYPTED. When inspection finds encryption and no usable library, it returns the same code and records that status in the bounded service cache for subsequent searches. The reviewed store verifies pinned archives. Other results allow up to 8 MiB of official ZIP data, 1,024 directory entries, 8 MiB of examined library bytes, 2 MiB per library, 16 accepted libraries and 256 returned declarations. The download has a 30-second deadline and keeps redirects on the fixed TI host. The route returns only project-relative paths, declarations and bounded issues. It caches verified extracted library bytes privately and writes no native files. Agent tools and browser previews cannot invoke these routes.
SPICE saved-result lookup accepts current private project Source and an opaque file ID, with an optional complete TransientConfig. Omitted config reads the latest record's validated settings, recompiles the current source and verifies the current bundled solver, offline model bytes and full execution/cache identity before returning {result,config}. An absent record or nonmatching identity returns {result:null} without a config; an absent record does not require solver detection. Explicit config uses the same exact matching path as Run and never adopts different saved settings. Without a granted saved destination, lookup has no desktop record.
Completed manifests require the complete run configuration separately from native design data. Missing or invalid settings fail validation. Lookup never executes the stored deck, downloads models, writes or migrates saved records, or edits a document. Cancellation returns 409 with Simulation result lookup cancelled. while the response remains open; a disconnected response receives no further body. UI settings edits, explicit Run, Source/project/visibility changes and plugin removal cancel or supersede pending restores.
SPICE manifests require complete transient settings, identityVersion: 2 and the actual executable's solverSha256; installation paths and timestamps are excluded from that identity. Ordered vectors/units remain execution inputs, while returned labels and probe targets are rebound to the current compiled circuit. Both explicit Run and automatic lookup require the current complete identity. Other identity versions, installation-path identities and settings reconstructed from execution decks are unsupported.
Saved results use openpe-spice-v2 / openpe-thermal-v2 manifests, with project bound to the native basename and direct schematic-spice/<stem>.* / layout-thermal/<stem>.* artifacts. SPICE files entries are {name,file}; Layout Thermal entries also include size and sha256. Physical names prefix the logical artifact basename with the native stem; execution keys use logical input identities. Store instances share a per-directory queue, publish individual files with the manifest last and roll back failed writes through private sibling *-backups folders. Unknown sidecars and conflicting/damaged files remain protected; this is not filesystem-wide crash atomicity. Retired nested records are ignored without loading or migration. See SPICE persistence and Layout Thermal records.
Layout Thermal requests accept private validated project Source, settings and an opaque file ID, never meshes, scripts, paths, executables or URLs. Layout Thermal lookup revalidates saved configuration against the current PCB and compares the complete prepared model. SPICE-derived configurations also require matching verified electrical samples and watts through the shared read-only SPICE completed-result port. Only compiler-declared dissipative paths are averaged; reactive energy, sources and unmodelled losses are excluded. An optional caller configuration must also match. Lookup never solves, downloads or edits design data. Electron resolves the opaque file ID and rechecks it before publication/removal. Completed artifacts are direct layout-thermal/<stem>.* files; no records enter native Source, undo or recovery. Thermal lookup cancellation returns 409 with Thermal result lookup cancelled. while the response remains open. The thermal plugin gate applies before lookup, compilation or resource verification. SPICE is independently gated; disabling it cancels coupled thermal work while manual thermal runs remain independent.
Confirmed unavailable library previews return HTTP 422 with {error:string,code:"OPENPE_LIBRARY_ASSET_UNAVAILABLE"} from desktop library detail/model reads or browser library previews. Errors generally return {error:string}; some SPICE errors also include code, including OPENPE_SPICE_CONVERGENCE. Common statuses are 400 for rejected input, 401 for expired authentication, 403 for Origin/plugin restrictions, 409 for conflicts/stale tool replies, 429 for chat concurrency, 422 for library/simulation/Agent-tool failures, 502 for provider/model-discovery failures and 503 for unavailable plugin state/shutdown. Stored-data and unhandled errors can return 500. After SSE starts, failures use events rather than a new HTTP error body.
type ChatRequest = {
provider: 'codex' | 'claude' | 'deepseek' | 'pi';
prompt: string; // Nonblank, at most 16,000 characters.
context: unknown; // Required. Native continuation requires a nonempty id of at most 128 characters.
history?: unknown[]; // Complete eligible conversation in order for a full submission.
nativeSessionOwner?: string; // UUID of the mounted Workbench conversation.
continuation?: string; // Single-use 64-character hexadecimal credential; requires nativeSessionOwner.
effort?: 'none' | 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'ultra';
deepseekReasoningEffort?: string; // DeepSeek only. Requires an explicit model.
model?: string; // Validated provider model identifier.
sessionId: string; // Required; [a-zA-Z0-9-]{1,80}.
capabilities?: boolean;
requestTitle?: boolean; // Ask the same CLI response for a suggested conversation title.
annotations?: AgentAnnotation[];
};Chat requests reject unknown top-level fields. At submission the client combines the current accepted project snapshot with the sheet fingerprint and live observations in WorkspaceContext. Core owns snapshot preparation. AgentAnnotation is the bounded immutable screenshot/selection structure in lib/agent-annotations.ts; up to four annotations are accepted per message. ACP images require the session's advertised image support; unsupported attachments fail visibly. DeepSeek model discovery reads the bounded, grouped ACP session catalog. Model IDs are opaque ACP select values with a 512-code-unit bound and no control characters. OpenPE preserves them through recovery and chat admission, rechecks membership in the new session and verifies the applied choice in the returned configuration before submitting a prompt. Provider credentials, arbitrary executable paths and shell commands are not request fields.
Exactly one of history and continuation is required. A full submission includes the entire eligible history in order. The 32 MiB HTTP body and 1,048,576-character assembled text limits apply before model execution. A continuation submits only the current message, explicit attachments and bounded project context. The Workbench transcript stays complete while the original runtime manages and compacts the context it has already received.
Workbench offers native continuation when the runtime proves that continuation and automatic compaction are available and enabled. A successful qualifying turn returns an opaque continuation scoped to the Origin, mounted owner, conversation, project or submitted schematic identity, provider, model, reasoning effort and capability availability. The credential is single-use and renewed on each successful qualifying turn. The service retains at most eight idle native sessions for up to 30 minutes each. Native provider session identifiers stay in the service. Every admitted turn issues its own capability, question and steering credentials. A full submission replaces the prior idle session for that owner. The renderer releases idle sessions on unmount or Workbench suspension. Renderer replacement, mode changes, plugin changes and service shutdown invalidate retained state. Desktop quit waits for pending native session disposal. A failed or stopped turn cannot issue a continuation. Raw KiCad keeps its separate one-shot transport.
Codex requires a supported stable 0.x app-server from 0.170.0, a confirmed ephemeral thread and a reported positive model context window. Claude Code requires 2.1.332 or later and an enabled native auto-compaction state, checked each turn. It keeps the runtime in memory and rotates the scoped MCP connection between turns. Pi requires private session-file support and an enabled automatic-compaction state from RPC. DeepSeek Harness requires ACP session resume and proof of enabled compaction for the exact isolated session. Pi and DeepSeek reopen the private session with a fresh scoped child per turn. These checks do not change provider settings on disk.
An unavailable or mismatched continuation returns HTTP 409 with code: 'OPENPE_AGENT_CONTINUATION_UNAVAILABLE' before model execution. Workbench then makes one full submission. Once a resumed turn is admitted, any runtime failure is shown as that turn's failure.
DeepSeek catalog entries use deepseekReasoning: {currentValue, options:[{value,label,description?}]} for a model whose ACP reasoning_effort select has been read. null means the model advertises no such option. Omission means its options have yet to be loaded. The option list has at most 64 distinct values and includes currentValue. Labels and descriptions are bounded to 100 and 300 code units. The initial catalog reads the default model's options. An exact-model query reads one selected model's configuration in an isolated discovery session without sending a prompt or replacing the catalog default. The desktop shares each successful lookup within the current catalog. An explicit deepseekReasoningEffort value is an opaque string of up to 128 code units without control characters. An advertised empty string requests Provider default. OpenPE checks the selected model's options again in the turn's ACP session and verifies the model and strength in the returned session/set_config_option state when a change is needed. Omitting the field uses the session's native setting.
Model attachments use target: 'object' and can include a solid element. Its ID is the native Model CAD object UUID. The snapshot records its name, shape, position, rotation, size, material, opacity and any colour override. Its board fingerprint and Model view fingerprint retain their existing meanings. The solid properties describe the capture time. Query current Model state before editing a captured solid.
The host derives the controller reference from the validated project. PDF pages are loaded by explicit page queries. Datasheets owns the reference and page limits.
Reasoning effort values are native provider settings, defined once in
lib/agent-providers.ts and generated for the service.
Chat admission rejects values outside the selected provider's protocol: Codex
accepts none/minimal/low/medium/high/xhigh/max/ultra, Claude accepts
low/medium/high/xhigh/max, and Pi accepts off/minimal/low/medium/high/xhigh/max.
DeepSeek uses the separate native selection field. none and off are distinct values,
never translated aliases. These sets bound the protocols; each model can support
fewer values. Model discovery returns efforts?: ReasoningEffort[] per model;
an empty array means no effort control, while an omitted field means its support
is unknown. A selected model with unknown effort support uses the native setting. The composer sends the exact resolved model ID, including a selected catalog default, and queued messages retain that ID. On switching to a provider without a remembered choice, Codex and Claude Code start at medium and Pi starts at high. The composer resolves that preference against the selected model as defined in Design, and the submitted native value reaches the provider unchanged.
Codex discovery paginates the installed app-server catalog with
includeHidden:true and uses the returned native model IDs. It retains the
recognized values from supportedReasoningEfforts without excluding models
that omit effort metadata or offer only unrecognized values. When the effective
configuration reports no model, Codex's isDefault recommendation supplies
the default for the picker. A Chat request without effort leaves the native
Codex setting in effect. Claude discovery
uses a bounded, initialization-only --bare control session with empty tools
and MCP configuration and no session persistence, so hooks, plugins and prompts
cannot run. It uses the returned resolvedModel, or an already concrete native value when that optional field is absent, as each selectable ID and label. Default and unresolved aliases are omitted. IDs retain provider prefixes and context-window suffixes. Duplicate IDs share one entry only when their effort metadata agrees; malformed resolutions, conflicting efforts and catalogs with no concrete models fail visibly. The picker has no implicit Claude default, and submission passes the selected concrete ID unchanged through --model. Discovery reads only public model metadata and supported effort levels. This catalog does not establish authentication,
account entitlements, configured alias overrides or managed-policy limits.
Pi derives native levels from each model's reasoning and thinkingLevelMap,
including explicit xhigh/max mappings and disabled levels; non-reasoning
models expose only off. Codex and Pi verify requested effort against the initialized session. Pi also verifies the selected provider-qualified model ID against session state and reports that same identity in runtime events.
Claude receives an explicit effort through both --effort and the spawned
child's CLAUDE_CODE_EFFORT_LEVEL, without changing the parent environment or
provider configuration. Its model-only agent-info does not claim an effective
effort that the CLI has not reported.
The provider prompt uses the validated workspace. With scoped tools, the initial overview includes sheet identities and counts, active view and selection, selected component identities and values, Source status, PCB and Model counts, analysis status and reviewed datasheet identity. Read the smallest current query for the task, including core.state for revisions, schematic.get for a sheet, layout.get or modelCad.get for geometry, and workbench.state for current presentation and analysis. Its optional ui.schematicSection is hardware, simulation or all for the active schematic's emphasis mode; it does not narrow canonical sheet queries or solver input. A Workbench prompt without a capability bridge retains the bounded active-sheet components, simulation fields, pin definitions and geometry-derived connections, selected-object geometry, view-specific PCB/Model summaries, reduced analysis observations and reviewed controller parameters. Connection pin tuples are [reference,pinNumber]. Bounded collections report total, items and optional truncated:true at 256 entries, with selections taking priority. The layout attachment context carries the board ID, linked sheet ID and fingerprint. Project navigation lists, duplicate design summaries, native and Source draft text, artwork, copper geometry and preservation metadata stay outside these prompt projections.
The accepted PCB's pad placement overview includes up to 32 rules, prioritizes
the current Layout selection and identifies truncated collections. Prompt labels
are bounded to 96 characters. The Agent refreshes rules with pad.rules.list
when planning or changing pad placement through live tools.
When requestTitle is true, the existing restricted provider prompt asks for one openpe_session fenced JSON block containing only {title:string} in the same response, using the compact topic-label guidance in Design. The renderer accepts one complete block with at most 512 payload characters and a valid single-line title of at most 60 characters, only after successful completion, then compacts the automatic name to at most 24 Unicode characters before adoption. It hides this reserved metadata during streaming and Markdown loading, preserves raw reply text and excludes metadata from history replay. Missing, malformed or duplicate blocks leave the current provisional title unchanged. No extra CLI process, new tool or naming permission is introduced. Adoption is bound to the originating session/message and cannot overwrite an existing name, including a manual rename made while the turn runs. Accepted names use the existing session name recovery field.
Codex app-server input and dynamic-tool item notifications may echo the full submitted images or tool result. The host bounds each raw JSONL record at 33,554,432 UTF-16 code units. Above the ordinary 2,000,000-code-unit event limit, it discards those item echoes and projects the successful turn-start reply and turn-completed notification to their consumed fields before applying the ordinary limit. These echoes never enter Chat SSE. Assistant output and tool or approval requests keep their own existing bounds and permission checks.
Pi RPC can echo input, aggregate transcripts and capability calls or results. Bridged DeepSeek ACP sessions can echo capability arguments and results in tool notifications. Both adapters bound raw records and strip the recognized echoes before Chat SSE. Assistant output and events used by OpenPE retain their ordinary limits.
DeepSeek ACP reports fixed diagnostics for failures during startup, session creation, model selection and response. Recognized connection, authentication, quota and rate-limit failures retain their category. Native diagnostic text and provider response bodies stay outside the chat stream.
Pi's assistant error events are provisional until the native agent_settled
event. When Pi starts an automatic retry within the same RPC session, OpenPE
reports the retry and removes the abandoned attempt's text from the stream,
retaining earlier assistant output. Failed settlement reports the final Pi
failure category and retains the last attempt's partial reply. RPC rejections
and failed settlements use fixed diagnostics for recognized connection,
authentication, quota and rate-limit errors. Native error text and stderr stay
outside the chat stream. OpenPE sends one prompt per turn and uses Pi's own
retry settings.
Chat frames use data: <JSON>\n\n, with comment heartbeats every 15 seconds. The public event union in lib/chat-stream.ts includes:
type |
Payload fields |
|---|---|
status |
stage?, text |
input-ready |
runId, sessionId, token; active same-turn text steering is available. |
input-accepted |
requestId, sessionId, prompt; native acknowledgment, emitted before subsequent streamed text/completion. |
text |
text |
text-delta |
delta |
text-replace |
text |
error |
text |
timing |
timings |
agent-info |
model?, reasoningEffort? |
process |
id, text, append?; provider-supplied progress, separate from final response text. |
question-request |
runId, sessionId, requestId, token, questions:AgentQuestion[]. |
question-closed |
requestId, sessionId; invalidates an unanswered native request. |
capability-request |
runId, sessionId, requestId, token, tool, arguments |
done |
outcome?: 'completed'/'failed'/'cancelled', continuation? for a qualifying completed Workbench turn |
User questions use the shared AgentQuestion shape in lib/chat-stream.ts: {id,header,question,detail?,options:{label,description}[],multiSelect}. Codex enables features.default_mode_request_user_input only in the ephemeral thread configuration, leaving user configuration unchanged. Its item/tool/requestUserInput answers preserve question IDs and native {answers:{[id]:{answers:string[]}}}. Claude runs bidirectional stream-JSON with only AskUserQuestion enabled as a built-in tool; its can_use_tool control response passes the original questions plus answers keyed by question text. Every other control permission request is denied. DeepSeek uses its native userQuestions seam and canonical selected/custom answer items. Pi uses openpe_ask_user from the fixed extension. These transports grant no document, file, shell or arbitrary network authority.
Each run permits 32 question batches, four pending batches, 1–4 questions per batch and at most eight options per question. Questions have at most 4,000 characters, detail 16,000, headings 100, option labels 200 and descriptions 2,000; each explicit answer has at most 16,000 characters. All questions require an answer; single-select permits one answer and multi-select at most nine unique values including custom text. Secret and permission-intent requests are rejected. No selection is submitted automatically; waiting for the user has no response deadline. Question tokens bind run/session/Origin and are revoked after one accepted response, native cancellation, Stop, disconnect or completion. Pending questions and progress are transient mounted conversation presentation, excluded from recovery, history replay, design and undo. A continued runtime retains the answers delivered to its native session according to its context management.
Runnable Agent turns have no OpenPE wall-clock or inactivity deadline after initialization, including silent model work, streaming, tool execution and user questions. Stop, disconnect, project/plugin lifecycle cancellation and provider failures still end the originating run. Codex/Claude startup and Pi state initialization are bounded to 30 seconds; their timer is cleared before model work proceeds. ACP initialization/session/configuration requests retain individual 30-second deadlines; session/prompt has no deadline. Model discovery, query/observe delivery, steering acknowledgment and owned-child cleanup retain their separate bounds. Windows cleanup runs absolute %SystemRoot%\System32\taskkill.exe /t and throws when SystemRoot is missing or not absolute. A taskkill failure falls back to signaling the owned child handle if exit has yet to be observed. Node delivers direct process errors through the child process error handler. POSIX cleanup spawns that process in its own group and signals the group with kill(-pid). These limits do not grant a runtime override field in Chat requests.
The current runners primarily emit incremental/replacement text; decoders also support text. A capability-request response goes to /api/chat/tool-result, not to a new document host. Closing the request cancels its originating provider stream and scoped capability bridge.
Steering is text-only, nonblank and bounded to 16,000 characters, with at most 32 distinct request IDs per run. Request IDs match [a-zA-Z0-9-]{1,80}. The input bridge rejects extra fields, foreign Origin/session/token, reused IDs with changed text and inactive runs. Identical retries share the original delivery/result and emit one acceptance. The token never grants project tools or native permissions. Codex uses turn/steer with the exact threadId and expectedTurnId; it never starts a replacement turn. Native errors reject only the steering request, while the original response can continue. Explicit native rejection returns code:'OPENPE_STEER_REJECTED', allowing a new identity on a later explicit retry. A 15-second acknowledgment deadline reports uncertain delivery without automatic reinjection; uncertain retries retain their original identity and late acknowledgments may still arrive before the turn ends. A failed queued steering attempt pauses the queue until explicit resumption. Completion, cancellation and disconnect revoke the bridge. Other current adapters do not register same-turn input; their follow-ups use the renderer's normal queued Chat requests. The renderer captures fresh context at queue dispatch; queued entries and tokens never enter recovery. Browser-only Agent settings use openpe.agent-settings.v1; desktop settings use the authenticated service independently of workspace recovery.
HTTP simulation source is a validated private project snapshot string. It is not a renderer-supplied SPICE deck, executable, filename or filesystem path. fileId is an opaque desktop grant; desktop runs require a saved native destination.
type TransientConfig = {
inputId: string;
pwmId: string;
outputId: string;
switchId: string;
currentId: string;
voltage: number;
frequency: number;
duty: number;
stop: number;
step: number; // Seconds, finite and positive.
};
type ModelReference = { id: string; sha256: string; file: string };
type SimulationResult = {
version: string;
time: number[];
traces: {
label: string;
unit: 'V' | 'A';
vector: string;
targets?: ProbeTarget[];
dissipation?: {
positivePin: string;
negativePin: string;
positiveNode: string;
negativeNode: string;
method: 'resistor' | 'diode' | 'switch' | 'mosfet';
}; // Compiler-owned dissipative path; never accepted as a request override.
values: number[];
}[];
log: string;
dissipation?: {
startS: number;
endS: number;
sampleCount: number;
powers: { vector: string; powerW: number }[];
};
};The optional completed-result dissipation summary integrates signed V·I over every full-resolution solver output row before display reduction, over the final 20% of the requested duration. Its exact interval, original row count and ordered current vectors must match the current deck. Layout Thermal import requires this verified summary and rejects negative dissipative averages; live, partial and display-only results without this summary cannot supply heat. Heat-summary version and vector/node metadata participate in completed-run cache identity. See SPICE Simulation for excluded losses and the distinct approximate EMC Flyback model.
With Accept: text/event-stream, transient events are:
type |
Payload |
|---|---|
started |
No additional fields. |
retry |
No additional fields. Discard the failed attempt preview; the next sample offset restarts at zero. |
samples |
{offset:number,time:number[],values:number[][]}; values are trace-major and offsets are contiguous. |
result |
{result: SimulationResult & {simulationModels?: ModelReference[]}}; references follow the allowlisted model contract. |
error |
{message:string,code?:string}. |
Native output is read every 200 ms. Display reduction retains actual trace extrema/endpoints within 200,000 samples and 1.1 million values. Frames are bounded to 64 MiB and backpressure waits for drain up to five seconds. These are transport/display limits, not solver runtime deadlines. No HTTP cancel route exists: disconnect aborts the request. Explicit user Stop uses the Uniform API's simulation.cancel, whose adapter retains the validated partial display state.
This desktop-only path is active after setRawKiCadMode(true). The native picker accepts 1–8 explicitly selected regular .kicad_pro, .kicad_sch and .kicad_pcb files with distinct basenames and at most 2 MiB of UTF-8 text in total. It rejects links, unreadable files, NUL bytes and invalid UTF-8 without replacing a previous selection. It returns null on cancellation. The service retains the exact text, including BOM, whitespace and line endings. It holds one selection in memory and never sends local paths to the provider.
POST /api/raw-kicad/chat is authenticated with X-OpenPE-Token. It accepts {selection, provider, prompt, history, model?, effort?, deepseekReasoningEffort?} with the same provider/model selectors as ordinary chat. selection is the current picker ID. prompt is nonblank and at most 16,000 characters. history holds every completed user/reply pair, in order, as {role:'user'|'assistant', text} entries. The complete history may occupy up to 128 KiB of encoded JSON and the full request body up to 256 KiB. An oversized request fails before provider execution. One turn may run at a time. SSE emits text-delta, text-replace, question-request, question-closed, error and done. Disconnect, mode exit and frame replacement cancel the turn.
The host frames the original text with filenames and byte lengths. The mode admits Agent/model discovery and the shared question routes, with workbench HTTP routes and native operations blocked. Normal chat cannot enable raw mode through its request body. The question bridge uses the selection ID as its session ID and a fresh run ID and token for each turn. A valid answer goes to the originating provider. A disconnected provider question request closes its card. Raw chat has no capability or steering bridge. DeepSeek's guard admits only the native question tool, and Pi's extension registers only openpe_ask_user. See the mode lifecycle.
electron/preload.cjs exposes the required methods below on window.openpe, plus readonly titleBarOverlay:boolean and titleBarInset:boolean. Both are true or false from the desktop bridge: the overlay caption is shown on Windows and macOS, and titleBarInset is true only for the macOS traffic-light inset. Renderer and Electron use the same current bridge contract without host feature flags or method fallbacks. Browser presentation has no native bridge. The renderer-facing types are in lib/bridge.ts. IPC handlers in electron/main.cjs and its adapters validate the originating main frame. Calls return promises except the event-subscription method.
| Method | Input | Result and behaviour |
|---|---|---|
connection() |
None | {base,token}; authenticated service connection. |
writeWorkspaceRecovery(content) |
Serialized WorkspaceState v2 string, or null to clear |
void after validated, queued atomic recovery persistence. |
open(onProgress?) |
Optional project opening progress callback | Native file picker; {source,name,native:true,openId}, an already-open {fileId}, or cancellation null. |
acceptOpen(openId) |
The numeric request ID returned by open() or openRecent() |
Creates an opaque grant only for the matching verified pending open; stale or missing request IDs fail; returns fileId:string. |
newFile() |
None | fileId:string for a new project without a native destination. |
openDefaultExample(key) |
Bundled or discovered opaque example key | {id,source,fileId,filename,warning?} from the original native example directory, retaining actual filenames. |
releaseFile(fileId) |
Opaque grant ID | void; releases only that grant. |
revealFile(fileId) |
Opaque grant ID | {status:'revealed'/'needs-save'}. |
projectDirectory(fileId) |
Opaque live project grant ID | {entries:[{name,kind:'directory'/'file',id?,bytes?}],truncated:boolean}; relative names, empty folders and opaque file-observation IDs. |
chooseSpiceModel(fileId, currentLibrary?) |
Opaque live project grant ID and optional current library path for native-dialog display | {path:string, models:SpiceModelDeclaration[], issues:string[]} or cancellation null; selects one local model library and returns bounded declaration metadata, never model bodies or execution permission. Direct project models/ paths stay relative; other selected paths are absolute. |
inspectSpiceModel(fileId, library) |
Opaque live project grant ID and project-relative SPICE library reference | {path,models,issues} from a fresh bounded project-directory observation, or null for an absolute external reference or an unsaved project without a prepared TI library. Returns metadata only. |
projectFilePreview(options) |
{fileId,id} from that grant's latest directory listing |
{source,bytes,binary,truncated,readOnly,encoding?:'latin1',pdf?:true}; bounded text, PDF marker or binary metadata. |
projectFileWrite(options) |
{fileId,id,source,expectedSource,encoding?:'latin1'} |
Updated ProjectFilePreview after an atomic ordinary-text write; checks original bytes, encoding, grant and frame. Native files use Core Source editing. |
projectFilePdf(options) |
{fileId,id} |
{base64,bytes} for a verified local PDF up to 32 MiB, read through the same current grant and opaque observation. |
setDirty(value) |
boolean |
void; native close protection, not a design mutation. |
onCloseRequested(callback) |
Callback | Unsubscribe function for native openpe:close-requested events. |
resolveClose(allow) |
boolean |
void; answers an already-pending native close request. |
save(options) |
{fileId,source,name,saveAs?:boolean} |
{name,path,localExample?} or cancellation null. |
historyList(options) |
{fileId,offset?:number} |
HistoryPage. |
historyRead(options) |
{fileId,id} |
Validated complete private snapshot string. |
historyCreate(options) |
{fileId,source,message} |
{id:string}. |
exportProject(options) |
{source,name,format:ProjectExportFormat} |
{name,format:ProjectExportFormat} or cancellation null. |
exportImage(options) |
{dataUrl,width,height,name} |
{name} or cancellation null. |
exportEnclosure(options) |
{source} validated complete private snapshot |
{name} or cancellation null; native STEP picker. |
openLibraryHomepage(site) invokes openpe:open-library-homepage and resolves with
void after dispatch to the system browser. The trusted main frame supplies
jlceda or easyeda to open the corresponding fixed official HTTPS homepage.
The handler accepts only these IDs and rejects direct URL arguments.
updateStatus() invokes openpe:update-status and reads the current desktop
update snapshot. It returns {version, phase, progress?, error?} or null
when the host has no eligible update. Phases are available, downloading,
ready and restarting. Download progress is an integer percentage. A failed
download returns to available. A staged download returns to ready when
restart is deferred or a native handoff can be retried. Errors use fixed copy.
onUpdateChanged(callback) subscribes to openpe:update-changed with the same
snapshot shape and returns an unsubscribe function. startUpdate() invokes
openpe:start-update to download the selected update and request a reviewed
restart, or to request restart again with a verified staged download. Both
requests take no arguments and require the trusted main frame. Replacing the
originating renderer during a download defers restart. The native close
notification carries the optional reason update when restarting. Desktop
update state is shared across workspace views. See the
startup check and release selection.
setRawKiCadMode(value: boolean) invokes openpe:set-raw-kicad-mode for the trusted main frame. chooseRawKiCadFiles() invokes openpe:choose-raw-kicad-files while the mode is active and returns { id, names } or null. A caller cannot supply paths or file contents. Raw KiCad transport owns selection and turn limits.
open() invokes openpe:open with no arguments. Its native picker accepts one
KiCad project or PCB file through the native reader. A standalone
PCB receives a live source grant and chooses its project destination on first
Save.
listExamples() invokes openpe:list-examples with no path arguments and returns {entries:[{id,title,description,section}],warnings:string[]}. Sections identify the logical resource roots, project or examples. The host scans the roots independently. Local IDs are local- followed by a 64-character lowercase SHA-256 digest. Listing creates no grants or histories. openDefaultExample resolves local keys against a fresh scan. Unknown, removed and linked entries cannot grant access. Home refreshes on activation and window focus. Source and packaged root mapping
listRecent() invokes openpe:list-recent without arguments and returns
{initialized:boolean,entries:[{id,title,description,pinned:boolean}],warnings:string[]} with pinned entries first, then newest-first native history, at most 32 entries total. Pinned native entries retain pin order; the default EMC shortcut is first while pinned.
For native history, title is the native filename and description its display-only absolute path. The fixed emc-flyback-demo shortcut uses the catalog title and its host-resolved absolute native path, and opens through openDefaultExample. Pin/Unpin preserves the displayed address. The shortcut remains alongside real history while pinned, without duplicating its native location. initialized reports whether the native-use index exists; entries always contain the complete visible list.
The optional open(onProgress) callback receives {stage,name} notifications
from openpe:open-progress. The host sends reading after selection when it
starts reading the native files and validating when parsing the read bundle
into a project. The display name is a bounded basename, with the resolved
entry filename used during validation. The event is sent to the initiating
trusted main frame with the matching per-call request ID. Preload removes
the callback when that call settles. An existing editor can activate directly
without those stages. The validated pending-open response still governs
acceptOpen and native access.
openRecent(id) invokes openpe:open-recent with a recent:<64 lowercase hex>
host-derived ID and returns the same validated source or existing fileId shape
as open(). New opens use acceptOpen(openId) bound to their exact staged request; existing destinations activate their
editor. The host rechecks the existing grant after recording Recent; if close
released it during that write, opening continues with native reading and staged
acceptance. The renderer cannot submit paths. Host resolution precedes the ordinary
bounded native reader, including link and unsupported-content rejection; missing
files stay listed and fail visibly on open. Trusted-main-frame checks surround
asynchronous calls. onRecentChanged(callback) subscribes to the payload-free
openpe:recent-changed notification and returns an unsubscribe function.
electron/recent-projects.cjs stores {version:1,files:string[]} at the fixed
app-data recent-projects.json path: at most 32 unique absolute native entry
paths, each at most 4,096 characters, and a 1 MiB read bound. Windows paths
deduplicate case-insensitively. Accepted opens, selected examples and successful
Save/Save as move their entry to the front; cancellation, rejected reads and
example preparation never add entries. No grants or document content persist
in this index, and listing grants no file access. Writes are serialized and
atomically replace the index; malformed/linked data is preserved with a
retryable error. Index-write failures surface on listing without failing an
already-completed native open/save. Only an absent index returns initialized:false.
The separate app-data recent-pins.json stores exactly {version:1,files:string[],defaultPinned:boolean} with the same path, uniqueness, link and read bounds. An absent pins file means no pinned native locations and the EMC shortcut pinned. At most 32 pins, including the shortcut, are accepted. Pins survive native history churn; accepted opens retain pinned native locations within the history bound. Unsupported pin data is preserved and fails visibly without migration. These indexes are separate
from workspace recovery, Core/undo, Agent context and project dirty state.
pinRecent(id,pinned) invokes openpe:pin-recent with a listed native ID or the fixed default:emc-flyback-demo selector and an exact boolean. Native paths are host-resolved; renderer paths are rejected. It atomically writes pin preferences and emits openpe:recent-changed. Unpinning a native entry first retains it at the front of ordinary history, then publishes the preference; the two files are individually atomic, not crash-atomic together. Unpinning the default removes its shortcut; an accepted native opening remains ordinary history. Re-pinning that native location restores the shortcut. No grant, design data, recovery or dirty state changes.
removeRecent(id) invokes openpe:remove-recent and atomically removes one
listed unpinned native ID. Pinned entries reject removal until unpinned. Removal touches only the private index, never
native files, grants, open editors or Git history. Errors preserve the list;
success emits openpe:recent-changed.
previewRecent(id) invokes openpe:preview-recent with a listed Recent ID and
returns its validated primary Circuit for read-only schematic thumbnails.
The host resolves the ID and uses the ordinary bounded native reader without
allocating a grant or staging an open. It rechecks the entry and trusted frame
after reading, limits the serialized circuit to 8 MB, coalesces concurrent reads
by ID and serializes at most 32 pending preview IDs. It never updates Recent,
Core, native bytes, models, fills or history. Visible Home cards load lazily,
retain only their current thumbnail and refresh on Home/list activation; hidden
or replaced card responses cannot publish. Missing/unsupported files show a
per-card preview error without blocking other cards or opening actions.
openDefaultExample(key) starts shared runtime preparation on its first request, including clean recovery, and rechecks the originating main frame before opening the selected example. Home does not request an example preflight.
Inputs never let a renderer choose an arbitrary filesystem path. Returned save paths are display results, not reusable permissions; project export returns only its filename and format. Grants live in Electron memory, remain out of documents/recovery and are revoked on main-document replacement. Save as protects other live project destinations. Native/project writes retain their existing validation, asset preparation and sibling-rollback requirements in Format.
inspectSpiceModel(fileId, library) uses openpe:inspect-spice-model to inspect a traversal-free project-relative SPICE reference through a live grant. It returns {path,models,issues}, or null when an unsaved project has no prepared TI library or the path is absolute. A private bounded directory listing supplies an opaque observation to the shared directory reader; hidden/private files, links, missing files, expired grants, changed files, unsupported extensions and files over 2 MiB fail. A hash-matching TI import can be inspected from its private cache until it is saved. Frame and location checks surround the read. It uses the same declaration scanner, returns no model bodies, follows no includes and changes no binding. Both native inspection paths and the TI selection route share the declaration scanner in plugins/spice-simulation/host/spice-model-declarations.cjs. Properties invokes it only while active with SPICE available, rejects stale revision/origin results and retains the accepted binding on failure. Absolute references require the native picker.
chooseSpiceModel uses openpe:choose-spice-model through plugins/spice-simulation/electron/spice-model-picker.cjs. The host checks the main frame and live project grant before and after the picker and bounded file inspection, permits one picker at a time and rejects links, nonregular files, changed bytes and paths over 4,096 characters. The optional current-library path only sets the native dialog location: an absolute local library or a traversal-free project-relative library is accepted within the same 4,096-character and extension bounds. Relative hints require a saved project location; unsaved projects ignore them. No hint authorizes inspection, follows includes or grants file access; inspection outside the project directory requires an explicit native selection. No other renderer dialog options are accepted. The selected .lib/.mod/.cir/.sp/.spice file is at most 2 MiB; an ASCII declaration scanner permits opaque vendor 8-bit comment/body text, rejects binary controls and scans at most 256 unambiguous top-level declarations with 64 ports each and returns only device entries. Exact pinned TI file hashes select reviewed public controller names generated from the canonical TI/reference records. Other files expose unreferenced declarations; subcircuit and primitive instance references hide helper dependencies, respecting local model/subcircuit scope and ignoring control blocks. A declaration cycle without an independent entry returns an empty model list. Unreferenced declarations in unreviewed files have no guaranteed physical classification. SpiceModelDeclaration is {name:string, kind:"model"|"subcircuit", device?:string, pins:string[]}; names/ports are bounded to 128 ASCII characters. Identical definitions deduplicate; conflicting same-name definitions are skipped with bounded issues, and a file with no unambiguous definitions fails. The host never follows includes, reads another file, returns model bodies, copies the file or executes its directives. The renderer applies validated declarations through ordinary Properties transactions with revision/Source/project/plugin guards. Model catalogs do not enter design/recovery/history; only the selected external binding and active source are retained. Runtime compilation and pinned hash checks remain independent.
Directory browsing uses openpe:project-directory and
openpe:project-file-preview, openpe:project-file-write and
openpe:project-file-pdf through electron/project-directory.cjs. They
check the originating main frame and grant before/after asynchronous work.
Listings include regular project folders/files, exclude hidden/private entries,
keys and links, and are bounded to 4,096 entries and twelve nested levels. File
reads accept only opaque IDs from the latest listing, recheck parent/file
identity and read at most 1 MiB. Replaced/closed grants and main-frame navigation
invalidate observations. Binary files return metadata; truncated text is explicit.
Ordinary text saves compare the expected original bytes, retain encoding and
replace atomically after rechecking the grant and main frame. PDFs are loaded
only when selected and displayed through a local Blob URL, released on hide or
selection change. Source keeps eight preview buffers. project.files.* provides
explicit access. Directory files stay outside native Source, recovery and automatic Agent context;
source.files continues to return Core's validated native set only.
writeWorkspaceRecovery uses the fixed openpe:workspace-recovery-write channel
and the host-owned recovery filename; it exposes no read or path selection.
electron/workspace-recovery.cjs checks the
trusted main frame before forwarding to the service's shared recovery store in
server/workspace-storage.mjs. Strings must
contain a complete valid workspace within the 96 MiB UTF-8 envelope; encoded
JSON null is invalid, while the argument null clears recovery. Full project
Source, draft, session and workspace validation precedes compact JSON storage.
HTTP GET/POST/DELETE and IPC writes use one ordered queue; a failed write leaves
later attempts retryable. DesktopWorkspace writes through the required native
recovery bridge. IPC failures propagate to recovery/quit error
handling, and close waits for the same write acknowledgement.
Native Git history pages contain 50 entries. The host accepts an integer offset from 0 to 1,000,000, 40-character lowercase hexadecimal commit IDs and single-line creation messages of 1–240 characters. Capability schemas apply first: versions.list narrows offset to 0–100,000, while versions.create admits messages up to 2,000 characters that the host then limits to 240. Snapshot payloads are bounded to 8,000,000 bytes. Reachability/current validation still apply to reads. Version history owns the Git execution bounds.
Project export uses openpe:export with {source:string,name:string,format:ProjectExportFormat} and returns {name:string,format:ProjectExportFormat} or null. The source must be a complete validated snapshot and the name is bounded to 200 characters. Unknown fields and unsupported formats fail before the picker. The host checks the originating main frame after the picker, protects open project sources, rejects linked destinations and rechecks before atomic replacement. Export creates no project grant or baseline. Format IDs · Design exchange · Manufacturing export
Image export accepts a verified PNG data URL, at most 48,000,000 characters, with integer dimensions from 1 to 4,096 pixels. It opens a native picker and does not change project dirty state or destination grants.
Model STEP export retains the exportEnclosure bridge method and enclosure.exportStep capability as current protocol identifiers. It accepts at most 8,000,000 bytes of validated source containing CAD bodies. The host reuses the preview kernel's fixed OpenCASCADE construction with verified packaged Gmsh, a 60-second geometry bound and completed-artifact validation, then opens the native STEP/STP picker and writes atomically to that selection. Renderer input supplies no path, executable or script. Overlapping independent bodies remain separate unless explicitly combined. STEP contains analytical profiles, selected-edge treatments and Boolean cutouts with their XYZ poses, excluding PCB/package shapes and material/color/opacity properties. Export is independent of Layout Thermal plugin state and does not run a solve, edit the project or grant a native project destination.
These examples run inside an adapter that already holds the originating project's CapabilityHost. They do not create a second document host or bypass Agent review.
const catalog = await host.query('capabilities.list');
const snapshot = (await host.query('project.snapshot')) as ProjectSnapshot;
// schematicId and partId come from this project's current query results.
const result = await host.execute(
'part.properties',
{ schematicId, partId, value: '10k' },
{ actor: 'human', expectedRevision: snapshot.revision },
);const files = (await host.query('source.files')) as NativeFiles;
const selected = files.files.find((file) => file.name === selectedNativeName);
if (!selected) throw new Error('Select a loaded native file.');
const before = (await host.query('project.snapshot')) as ProjectSnapshot;
await host.execute(
'source.updateFile',
{
name: selected.name,
source: editedNativeText,
},
{ expectedRevision: before.revision },
);
// Draft changes also advance the revision. Read it again before Apply.
const pending = (await host.query('project.snapshot')) as ProjectSnapshot;
await host.execute('source.apply', {}, { expectedRevision: pending.revision });Invoke openpe_execute against the current project state; no revision argument is accepted. Use schematic.drag to reposition a component and retain its wired connections; schematic.move leaves unselected wires in place. Deltas are millimetres. Placeholder IDs below must be replaced with the queried project identities.
{
"name": "schematic.drag",
"input": {
"schematicId": "<schematic-id>",
"ids": ["<part-id>"],
"delta": { "x": 1.27, "y": 0 }
}
}await host.execute('simulation.show');
const catalogAfterMount = await host.query('capabilities.list');
// Confirm simulation.configure/run are registered and currently available.
await host.execute('simulation.configure', {
config: { stop: 0.01, step: 0.0000002 },
});
// Invoke Run against the current project state after configuration.emc.inspectLayout and emc.reviewLayout are read-only queries owned by
emc-analysis@openpe, registered per project through
plugins/emc-analysis/renderer/capabilities.ts. They require confirmed plugin
availability, an accepted PCB and clear Source/close barriers. Explicit expected
revisions must match. Results carry the numeric checked revision.
emc.inspectLayout accepts {netIds:string[],segmentBudgetMm:number} with 1–32
unique current board net IDs and a positive bounded segment budget. It reads only
the accepted PCB, returning boardId, revision, completeness:"partial", the
budget, per-net track lengths/counts, via/pad/zone counts, missing-fill evidence,
over-budget segments with IDs/layers/endpoints, exact evidence counts and
truncation flags, plus notVerified coverage notes. It never refills copper or
infers return paths or EMC compliance. GUI and Agent call the same pure
domain function. Unknown fields and invalid/nonfinite budgets fail. Locating a
reported object uses a bounded Layout camera/selection port for tracks, vias,
footprints and pads, with current-board,
Source/close, visibility, selection-filter and draft gates; it adds no capability
or mutation authority. EMC Analysis owns coverage, bounds and reference use.
emc.reviewLayout accepts exact {nets,limits,decoupling,edgeConnectorIds}.
nets contains up to 32 unique {netId,role,referenceNetId?,referenceLayer?}
records; role is fast, switching, sensitive or supply. Reference net and
layer are explicit current native identities. limits requires
maxTrackLengthMm, maxVias, minEdgeClearanceMm, minNetSeparationMm,
maxReferenceViaDistanceMm, maxDecouplingDistanceMm and
maxConnectorEdgeDistanceMm. Distances are finite positive mm; via count is a
bounded nonnegative integer. decoupling holds up to 32 explicit
{targetPadId,capacitorFootprintId,referenceNetId} assignments;
edgeConnectorIds holds up to 32 unique current footprint IDs. At least one
intent is required. Missing roles are not inferred. Unknown fields, stale IDs,
invalid relationships and work bounds reject without changing data.
The result is {boardId,revision,result}. The pure result contains
completeness:"partial", exact input, findings, checks, summary,
truncated and notes. Findings retain original check/category identities,
warning/information/not-verified severity, geometric/limited/missing confidence,
textual evidence/remediation, exact net/object IDs and optional location,
measurement/limit quantities. Checks retain checked/not-verified/not-applicable
coverage. At most 500 findings return; summary counts include omitted findings.
No regulatory pass, field solve or implicit document edit is provided.
emc.exportReport is a plugin command with external mutation and optional
review. It requires the active project and takes
{review:EmcReviewInput,manualReviews,exceptions,format:'html'/'json'}. It
evaluates the explicit intent against the accepted PCB, validates the manual
evidence and downloads the requested format under a fixed filename.
manualReviews contains each of the eight discovered checklist IDs once as
{checkId,status:'unreviewed'/'reviewed'/'needs-work',notes}, with up to 2,000
characters per note. Each {findingId,reason} exception names a retained finding
from the computed result and supplies 1–1,000 characters. The result is
{exported:true,name,boardId,revision}. The GUI supplies the intent from its
checked report and requires that checked revision to remain current. Report
downloads share the bounded version-1 openpe-emc-review serializer and leave
native design and undo intact. EMC reports
Update this reference when registered IDs, schemas, metadata, results, routes, bridge methods or lifecycle gates change. Runtime capabilities.list remains authoritative for an individual mounted project's schema and availability. Architecture diagram nodes describe responsibilities; callable interfaces use the exact registered IDs. No /api/capabilities route is registered. Keep Core, Architecture and the relevant subsystem contract aligned with the implementation.
window.openpe.chooseComponentModel(fileId) invokes openpe:choose-component-model. It requires a live project grant and trusted main frame, including for unsaved projects. It selects one local .step/.stp file, validates at most 32 MiB without links or changed bytes, and tessellates before returning {path:string} or null on cancellation. Frame and location checks surround asynchronous work. The path is a portable content-addressed ${KIPRJMOD}/models/<SHA-256>.step reference. Shared Properties commits the assignment through Core after revision, selection and activation checks.
Authenticated POST /api/component-model accepts {source:string,fileId?:string,index:number} with exactly one selector. footprintId:string selects an existing PCB instance. libraryId:string (at most 500 characters) selects an exact downloaded NextPCB or JLCPCB footprint in the project's native library. The service parses the current project and resolves the requested model index. Project-relative reads use the granted location or the approved content-addressed cache. A live unsaved grant also permits exact hash-verified bundled portable references for a PCB instance. Bounded official library references use the library service. Invalid or revoked grants and changed locations fail project-relative reads. The STEP worker pool returns bounded {meshes:MeshData[]} geometry and disconnect aborts preview. Local relative reads reject traversal, hidden paths, links and changed or oversized bytes. Absolute native references require reselection through the picker.
Authenticated POST /api/component-model/library accepts {id:string,index:number} from the current library chooser. It resolves only the existing bounded footprint/model catalog, parses the verified STEP bytes and stages an immutable portable component model, returning {path:string}. No document edit occurs until Core accepts the assignment.
Authenticated POST /api/library-package accepts a NextPCB or JLCPCB ID. The ID suffix
is at most 150 characters so its .kicad_mod filename fits the native 160-character
segment limit. It loads the validated native footprint and stages each supported
STEP in the component model store and changes only the native model path to the
returned content-addressed project reference. The result is footprint detail
with projectAssets:true; offset, scale, rotation, visibility and opacity are
retained. An EasyEDA STEP response of HTTP 403 or 404 omits only that model from
the prepared package. The renderer shares this preparation across package synchronization,
Properties and GUI/Agent placement. Core adds the package's .kicad_mod and
fp-lib-table in the same accepted edit. Save/Save as publishes native sidecars
and STEP bytes through existing granted writers. Prepared metadata is no grant
and cannot choose paths, model bodies or URLs. Libraries
owns NextPCB asset matching and limits. JLCPCB
owns EasyEDA package conversion and attribution.