tom_core_agentic library

Generic, domain-free building blocks for agentic systems.

Everything exported here depends only on tom_basics (plus yaml for YamlConfigReader and path for PathScope) and is safe to reuse across the brain, the assistant, and any future agent runtime.

Classes

AgentProfile
A named persona that supplies the system prompt and per-send behaviour.
AgentProfileStore
Loads/saves the agent-profile set (List<AgentProfile>) as YAML.
AgentSendChunk
A streamed chunk of assistant answer text (in order).
AgentSendCompleted
Terminal success: the query produced a result message.
AgentSendConfig
The editor-assembled inputs to one query Options, minus the session id (which the engine supplies from SpecSessionStore).
AgentSendEngine
Streams a single prompt through the Agent SDK and keeps the per-spec session id refreshed.
AgentSendEvent
One step of an AgentSendEngine.send run.
AgentSendFailed
Terminal failure: a non-session error, or a stream with no result message.
AgentSendSessionRefreshed
Emitted when a session error caused the stored session id to be dropped and the prompt to be retried with a fresh session.
AgentSendStarted
Emitted once, first, when a send begins.
AgentSettings
Global agent settings: bridge target + the defaults a profile overlays.
AgentSettingsStore
Loads/saves the singleton AgentSettings as YAML.
AgentSidecarStore
A store keeping its state in one YAML sidecar file of a workspace, read and written through the workspace's TomFileSystem — on the local disk, in memory in a test, on the web.
AsyncShutdownCoordinator<S>
Watches trigger streams and runs an async teardown to completion before terminating the process.
BackpressureTracker
Per-stream credit ledger held by a stream producer.
BearerTokenAuthenticator<P extends Object>
Validates a bearer token and resolves it to a principal of type P.
BridgeChoice
The persisted choice: which host+port the editor last bound to.
BridgeChoiceStore
Persists the picked bridge server to a YAML sidecar so the binding is restored on the next launch.
BridgeConnectionService
Discovers live VS Code bridge servers.
BridgeServer
One responsive VS Code bridge: its port, the workspace its window has open, and how it relates to the editor (available / bound). Shown in the picker as port · workspace · status.
CapturedWirePrompt
The prompt a backend actually received, captured for an audit trail.
CategoryLog
A category-tagged facade over the global tomLog instance.
ChatMessage
A single message in a chat exchange.
ChatVariable
A single placeholder binding identified by its name.
ChatVariableStore
Loads/saves the custom chat-variable set (List<ChatVariable>) as YAML.
Deadline
A wall-clock expiry instant evaluated against an injectable clock.
EditorPlaceholderBindings
Resolves the editor's supported placeholder forms against a fixed set of bindings (e.g. chat variables) and the process environment.
HttpDate
Parser for the three date formats RFC 7231 § 7.1.1.1 permits in an HTTP-date header.
IsolateCancellationHandle
Per-request cancellation handle returned by IsolateCancellationRegistry.register.
IsolateCancellationRegistry
In-isolate registry of cancellation state per token.
IsolateCancellationToken
Opaque identifier for a cancellable request, sendable across an isolate boundary.
IsolateCancellationTokenAllocator
Host-side counter that hands out unique IsolateCancellationTokens.
IsolateExceptionRegistry
Host-side registry that turns the flat wire form of a worker-thrown exception (a type tag + message + sendable details map) back into a typed instance, so consumers catch the same type the worker threw instead of an untyped boundary wrapper.
IsolateRequestGuard
Bounds each request crossing an isolate boundary so it fails with a typed IsolateRequestFailure instead of hanging forever.
IsolateStreamCloseSignal
Per-stream close-signal block held by a stream producer.
LatencySummary
An immutable summary of a set of latency samples — count, min/max, p50, p95.
LlmCallReport
What one call cost and where it went.
LlmCapabilities
What a provider can do. A surface reads this before offering a feature, and hides what the provider cannot serve rather than failing when pressed.
LlmContextSummary
What a request's context was assembled from — never the context text.
LlmEvent
One thing an AI run, or the session it runs in, did.
LlmFailure
Why a call failed, classified by the provider.
LlmLiveTrailSession
One session's trail file: its text, and the records of the run in progress mapped onto it.
LlmLiveTrailText
One live-trail file's text, changed by the extension's writer operations.
LlmModelUsage
One model's share of a run's LlmUsage.
LlmNodeCandidate
One place the search looked at, and what was there.
LlmNodeHost
What a Node search needs from the machine it runs on.
LlmNodeResolution
The outcome of a Node search: the executable to run, or the account of where the search looked and what it found.
LlmNotice
Something that is neither model output nor a failure.
LlmOptions
How a request is run.
LlmProvider
One model backend.
LlmQuestTarget
Where a quest session writes: its quest folder, as an absolute path, and a medium rooted at it.
LlmRequest
One self-contained request.
LlmRetry
The far end announced it will retry a failed API call.
LlmRunAccount
What one run has reported about itself so far, and the terminal event it ends with.
LlmRunCompleted
The run completed, and report accounts for it.
LlmRunEnded
The run is over: LlmRunCompleted or LlmRunFailed. rounds is the far end's turn count when it reported one.
LlmRunError
The run failed: its failure kind and its sentence.
LlmRunFailed
The run failed, was cancelled or went silent, for the reason failure gives.
LlmRunStarted
A run began: what raised it, which provider serves it, and — when the provider knows them at the start — the model and its own call id.
LlmSessionClosed
A session's isolate ended; message says why when it reason is LlmSessionCloseReason.failed.
LlmSessionInfo
One session as the app knows it: its id, its name in the trail view, its kind and, for a quest session, the quest folder it is bound to.
LlmSessionOpened
A session's isolate started.
LlmSessionRegistry
The sessions of the app: the two built-ins and those the user created, and which session a gesture runs in.
LlmStall
The run was abandoned because nothing arrived for silence.
LlmSystemInit
The far end started: its model and the tools it offers. No credential and no working directory — what crossed the provider and nothing more.
LlmTextDelta
A piece of the answer, in order. The answer is the concatenation of a run's text deltas (llmAnswerText).
LlmThinkingDelta
A piece of the model's thinking.
LlmToolBinding
Tools a provider runs while the request is in flight: each call the model makes is dispatched here and its answer sent back.
LlmToolCall
The model called a tool. arguments is the call's JSON input.
LlmToolResult
What the tool call callId answered. fullLength is the length of the whole result; a writer that clips text reports it.
LlmTrailEntry
One entry of a folded trail.
LlmTrailFileWriter
Writes the sessions' trail files.
LlmTrailMedium
A folder the writer keeps files in: read and write a named text file.
LlmTrailNoticeEntry
A line between the blocks: a retry, a stall, a notice, an error, or a session opening or closing.
LlmTrailRecord
One trail entry: an event in the session sessionId, the run runId (absent for a session event), the sequence number within the session and the UTC time at it was recorded.
LlmTrailRunEntry
A run's header: when, over which transport, for which task, and what the user asked.
LlmTrails
The trails of every session, consolidated in the main isolate.
LlmTrailSummaryEntry
A run's last line: its outcome, how long it took, and what it cost.
LlmTrailTextEntry
The model's answer text, deltas joined.
LlmTrailThinkingEntry
The model's thinking, deltas joined.
LlmTrailToolEntry
A tool call and, once it arrived, its result.
LlmUnavailableProvider
A provider that is never available.
LlmUsage
What a run cost. Every field is optional: a far end reports what it has.
LlmUserPrompt
The instruction a run was given, and a summary of its context — the sections it drew on, its length, what it left out. Never the context text : a trail is a plaintext file a user may keep for days.
MapFieldReader
Type-safe accessors over a plain Map<Object?, Object?> whose values arrive from an untrusted boundary (decoded JSON, d4rt script input, hand-edited config).
ParsedToolCall
One tool call recovered from model text, normalised across dialects.
PathScope
A union of filesystem roots a path must stay within.
PlaceholderExpressions
Evaluates the ${{ … }} placeholder form against a binding scope.
PlaceholderResolver
Resolves placeholder scaffolds against a PlaceholderStack of bindings, the process environment, and an optional PlaceholderExpressions backing for the ${{ … }} form.
PlaceholderStack
A stack of binding frames implementing lexical, shadowing scope.
PlanStepOrdering
The outcome of topologically ordering a plan's steps.
ProcedureRerankWeights
The relative importance of each of the four re-rank factors.
PromptQueueStore
Loads/saves the editor prompt queue (List<QueuedPrompt>) as YAML.
PromptTemplate
A reusable prompt body identified by id.
PromptTemplateStore
Loads/saves the prompt-template set (List<PromptTemplate>) as YAML.
PromptTrailStore
Loads/saves the editor prompt trail (List<TrailPair>) as YAML.
QueuedFollowUpPrompt
A follow-up prompt sent after a queue item's main prompt is answered.
QueuedPrePrompt
A pre-prompt sent ahead of a queue item's main prompt.
QueuedPrompt
A prompt queued for dispatch, with optional pre-prompts, follow-ups, reminders, repeats and multi-transport routing.
QueueTemplate
A named, ordered set of prompt bodies identified by id.
QueueTemplateStore
Loads/saves the queue-template set (List<QueueTemplate>) as YAML.
ReconnectCoordinator
Runs the reconnect back-off: after each delay it rescans the bridge range and, the first time the bound port answers, classifies the result as the same or a different workspace; if the port never answers it resolves ReconnectResolution.stillGone.
ReconnectResult
The outcome of ReconnectCoordinator.reconnect.
ReminderTemplate
A reusable reminder body identified by id.
ReminderTemplateStore
Loads/saves the reminder-template set (List<ReminderTemplate>) as YAML.
ScheduledTime
A single scheduled slot. A bare time repeats daily; adding a date makes it a one-shot.
SpecSessionStore
The per-specification SDK session id, persisted to a YAML sidecar so the agent can resume the same Claude-Code conversation across sends and launches. Held out of the document: pass — it is transport state, not document content.
TimedRequest
A timed / repeating prompt entry.
TimedRequestStore
Loads/saves the timed-request set (List<TimedRequest>) as YAML.
TokenBucket
A keyed continuous-refill token bucket.
TokenBucketPolicy
Immutable configuration of a TokenBucket.
TokenBucketSnapshot
Immutable snapshot of one key's bucket state — the persistable form.
ToolCatalogue
Tools a model may propose calls to; the caller decides whether to run them. Contrast LlmToolBinding, whose calls the provider makes itself.
ToolDescriptor
A tool a model may be told about.
TrailPair
One request/answer pair from an SDK exchange, as shown in the trail.
TtlCache<K, V>
An absolute-TTL cache from K to V with lazy expiry sweeping and an optional least-recently-used size ceiling.
WirePrompt
The prompt a provider sends, in two channels.
YamlConfigReader
Type-safe accessors over a plain config map, plus an explicit ${NAME} environment-variable expander.

Enums

BearerAuthFailureReason
Categories of bearer-token authentication failure.
BridgeServerStatus
How a discovered server relates to the editor right now.
ChatRole
Who authored a chat message.
DeliberationVerdict
Which execution branch a prompt's surface text points to.
IsolateRequestFailureReason
Why a request crossing an isolate boundary could not complete.
LlmErrorKind
Why a transport call failed. Callers switch on this rather than on message text; the message is for the user and the diagnostics log, the kind is for control flow.
LlmNodeLookOutcome
What was found at one place.
LlmNodeSource
Where a candidate came from — the vocabulary of the report.
LlmRunOutcome
How a run ended.
LlmSessionCloseReason
Why a session's isolate ended.
LlmSessionKind
What kind of session a trail belongs to.
LlmSummaryTrailKind
Which file of the pair.
LlmToolStatus
Where a tool call is.
LlmTrailEntryKind
What an entry shows — the trail view's filter.
LlmTrailNoticeKind
What a notice entry reports.
QueuedPrePromptStatus
Status of a pre-prompt — the source uses a narrower set than the main queue item.
QueuedPromptStatus
Lifecycle of a queued prompt.
QueuedPromptType
What kind of queued prompt this is.
QueuedTransport
Which backend a queued prompt dispatches through. Items without an explicit transport resolve to QueuedTransport.copilot at dispatch.
ReconnectResolution
How a reconnect attempt resolved.
ScheduleMode
How a timed request fires: on a fixed interval or at scheduled times.
TimedRequestStatus
Lifecycle of a timed request entry.
ToolApprovalMode
Approval gate for write tool calls.

Mixins

CloseGuard
Tracks a closed flag and rejects use-after-close.

Extensions

PathScopeIo on PathScope
Filesystem-aware containment for PathScope, resolving symlinks so a link that points outside its root cannot slip past the lexical check.

Constants

approxCharsPerToken → const int
Approximate number of characters per token for the estimateTokens heuristic. The familiar "~4 characters per token" rule of thumb for English text; not exact and not a substitute for a real tokenizer.
bearerAuthRpcErrorCode → const int
JSON-RPC error code an MCP server returns when a BearerAuthFailure is raised during the initialize handshake.
bearerTokenMetaKey → const String
The JSON-RPC _meta key under which a client places the bearer token at initialize time when the server is configured with a BearerTokenAuthenticator.
bridgeScanMaxPort → const int
Highest CLI bridge port scanned (inclusive).
bridgeScanMinPort → const int
Lowest CLI bridge port scanned (inclusive).
defaultBridgeHost → const String
The host every bridge default in this package points at: IPv4 loopback.
defaultReconnectBackoff → const List<Duration>
The default reconnect back-off: retry after 10 s, 30 s, 60 s.
deliberationCues → const List<String>
The canonical deliberation cues, lower-case, in declaration order.
llmAgentPurpose → const String
The purpose of an agent run — a request that drives tools — which runs in llmChatSession; every other purpose runs in llmDefaultSession.
llmChatSession → const String
The built-in session an agent run runs in.
llmDefaultSession → const String
The built-in session ordinary requests run in.
llmLiveTrailCancelledMessage → const String
The words of a cancelled run, as the trail file writes them.
llmNotConfiguredReason → const String
What a build that wired no model at all says for itself — "not configured", never "could not be reached", which would accuse a backend nobody asked for.
llmRequiredNodeMajorVersion → const int
The lowest Node major version an agent server built on the Anthropic Agent SDK accepts. Declared once, so the discovery, a transport's probe and an installer compare against one number; a server's engines.node is kept in step with it.
llmReservedSessionIds → const Set<String>
Ids no user-created session may take: the two built-ins, and the name the Tom VS Code extension writes its own trail under.
llmSummaryTrailMaxEntries → const int
The extension's bound on a summary file's entries.
placeholderExpressionFailedCode → const String
Wire code for a ${{ … }} expression that threw or would not parse.
placeholderRecursionExceededCode → const String
Wire code for a placeholder expansion that did not converge inside the recursion cap.
placeholderUnresolvedCode → const String
Wire code for an unknown ${name} (or ${env:NAME}) under strict mode.
shutdownExitError → const int
Exit code when the teardown threw (EX_SOFTWARE, the conventional "internal software error" code). The process still exits — a failed drain must not hold it open — but the non-zero code surfaces the failure to a supervisor.
shutdownExitOk → const int
Exit code for a clean shutdown (the teardown completed without throwing).
systemClock → const DateTime Function()
The production wall-clock time source: DateTime.now.

Functions

blobFromColumn(Object? raw, {required String context}) → Uint8List
Normalises a dynamically-typed BLOB column read into a Uint8List, throwing a StateError tagged with context when raw is not a BLOB.
blobFromColumnOrNull(Object? raw) → Uint8List?
Normalises a dynamically-typed BLOB column read into a Uint8List, or returns null when raw is neither a Uint8List nor a List<int>.
buildUniqueById<T>(Iterable<T> items, String idOf(T item), {String itemLabel = 'item', String onDuplicate(String id)?}) → Map<String, T>
Builds an unmodifiable id → item map from items, using idOf to extract each item's id.
classifyDeliberationCue(String text) → DeliberationVerdict
Classifies text as DeliberationVerdict.thinking when it contains any of the deliberationCues (matched case-insensitively, on word boundaries), otherwise DeliberationVerdict.normal.
composeInterruptRetry(String prefix, String prompt) → String
Composes the auto-resend body for an interrupted prompt: the active profile's prefix followed by the original prompt.
connectAgentSdkClient({required String host, required int port}) → Future<AgentSdkClient>
The production AgentSdkClientFactory: opens a VSCodeBridgeClient socket and wraps it in the bridge-backed transport.
decodeAgentYaml(String yaml) → Map<String, dynamic>
Parses a YAML document yaml into a plain Map<String, dynamic>.
decodeAgentYamlEntries<T>(Object? node, T fromYaml(Map<String, dynamic>), {String? identity}) → List<T>?
Builds models from the YAML list node, skipping the elements it cannot build, or returns null when node is not a list at all.
decodeAgentYamlList<T>(Map<String, dynamic>? root, {required String key, required String identity, required T fromYaml(Map<String, dynamic>)}) → List<T>
Builds the models in the list under key of root, skipping the entries the file cannot supply.
decodeAgentYamlValue<T>(Map<String, dynamic>? root, {required String key, required T fromYaml(Map<String, dynamic>), required T orElse}) → T
Builds the single model under key of root, or orElse when the file cannot supply it. The singleton counterpart of decodeAgentYamlList — with nothing to skip to, an unusable value falls back rather than dropping out.
decodeJsonObject(String? json, {required String context}) → Map<String, Object?>
Decodes json into a Map<String, Object?>, throwing a StateError tagged with context when the payload is present but is not a JSON object.
deepPlainYaml(Object? node) → Object?
Recursively converts a parsed YAML tree (YamlMap / YamlList / scalar) into plain Dart collections. Map keys are coerced to String.
deepValueEquals(Object? a, Object? b) → bool
Deep equality for a value that may be a scalar or an arbitrarily nested List of scalars/lists.
deepValueHash(Object? v) → int
Hash companion to deepValueEquals.
encodeAgentYaml(Map<String, dynamic> data) → String
Serialises data to a YAML document string.
estimateTokens(String text) → int
A rough token-count estimate for text: ceil(length / approxCharsPerToken).
fnv1a32(String s) → int
FNV-1a 32-bit hash of s, computed over its UTF-16 code units.
formatException(Object exception, String message, {String? context}) → String
Formats an exception's toString as '<runtimeType>: <message>', or '<runtimeType>(<context>): <message>' when context is given.
isSimpleIdentifier(String name) → bool
Returns whether name is a bare Dart identifier.
listEquals<E>(List<E> a, List<E> b) → bool
Structural equality of two lists by length and positional value.
llmAnswerText(Stream<LlmEvent> run) → Stream<String>
The answer a run gives: the concatenation of its LlmTextDeltas, in order (complete is derived from run).
llmDiscoverNode({required LlmNodeHost host, String? nodePath, int floor = llmRequiredNodeMajorVersion}) → Future<LlmNodeResolution>
Finds a Node at or above floor through host, or accounts for why not.
llmErrorKindOf(LlmFailure failure) → LlmErrorKind?
The LlmErrorKind a failed run's LlmFailure.classCode names, when it names one.
llmIsSessionId(String id) → bool
Whether id is a well-formed session id.
llmLiveTrailFileName(String sessionId) → String
The file a session's trail is written to: live-trail.<session>.md.
llmLiveTrailRetryMessage(LlmRetry retry) → String
The words of a retry, as the trail file writes them.
llmLiveTrailStallMessage(LlmStall stall) → String
The words of a stall, as the trail file writes them.
llmLiveTrailTimestamp(DateTime at) → String
YYYYMMDD_HHMMSS in local time — the prompt header's stamp.
llmLiveTrailUsage(LlmUsage usage, DateTime at) → String
The extension's ### 📊 usage block for usage, recorded at at; empty when there is nothing to say.
llmNodeAt(String path) → LlmNodeResolver
A resolver for a path the caller vouches for — see LlmNodeResolution.explicit.
llmNodeExecutableName({required bool isWindows}) → String
The Node a search is for: node.exe on Windows, node elsewhere.
llmNodeSearchPlaces(LlmNodeHost host) → List<(String, LlmNodeSource)>
The places a discovery looks at, in order, before deduplication: every PATH entry, nvm's versions newest first, then the fixed locations.
llmParseNodeVersion(String answer) → ({int major, String version})?
v22.22.3, 22.22.3 or a line starting with either → the normalised version and its major; null for anything else.
llmReportOf(Stream<LlmEvent> run, {required String providerId}) → Future<LlmCallReport>
The report a run ends with.
llmRunPrelude(LlmRequest request, {required String providerId, String? modelId, String? callId}) → List<LlmEvent>
The two events every run opens with: what it is, and what it was asked.
llmSessionFor(String purpose) → String
The built-in session a request of purpose runs in: an agent run in chat, everything else in default.
llmSessionIdFor(String name, {Set<String> taken = const {}}) → String
A session id made from name: lower case, letters, digits and -, starting with a letter, at most 32 characters, and none of taken or the reserved ids — a number is appended where it would be.
llmSummaryTrailFileName(String quest, String sessionId, LlmSummaryTrailKind kind) → String
The file name of kind for session sessionId of the quest named quest: <q>.<session>.prompts.md or .answers.md.
llmSummaryTrailPrepend(String existing, {required LlmSummaryTrailKind kind, required String requestId, required DateTime at, required String body, int maxEntries = llmSummaryTrailMaxEntries}) → String
existing with a new kind entry for requestId at at prepended, the sequence one past the newest entry's, and the oldest entry dropped when the sequence passes maxEntries.
llmSummaryTrailTimestamp(DateTime at) → String
The ISO-8601 instant the extension writes: UTC, milliseconds, Z.
llmTrailEntries(Iterable<LlmTrailRecord> records) → List<LlmTrailEntry>
Folds records into entries, in the order their first record arrived.
loadYamlAsMap(String source, {YamlMapErrorFactory errorFactory = FormatException.new, String rootPath = 'root', int maxNodes = 1000000}) → Map<String, Object?>
Parses source as a single YAML document and returns it as a plain Map<String, Object?> — never a YamlMap, YamlList, or YamlScalar.
looksLikeToolCallAttempt(String text) → bool
Whether text looks like an attempt at a tool call.
mapEquals<K, V>(Map<K, V> a, Map<K, V> b) → bool
Structural equality of two maps by key set and per-key value.
nearestRankPercentile(List<int> sortedAsc, double q) → int
The nearest-rank percentile of sortedAsc (which MUST already be ascending) for a quantile q in [0, 1], over integer samples.
nextDayStart(DateTime t) → DateTime
The start of the day after t's calendar day, preserving t's zone.
orderPlanSteps(Map<String, Iterable<String>> dependencies) → PlanStepOrdering
Topologically orders the steps described by dependencies (Kahn's algorithm).
parseToolCallsFromText(String text, {Set<String>? knownToolNames}) → List<ParsedToolCall>
Parses every tool call text contains, across all known dialects.
percentileDuration(List<Duration> sorted, double q) → Duration
The nearest-rank percentile of sorted (which MUST already be ascending), for a quantile q in [0, 1].
permissionModeForApproval(ToolApprovalMode mode) → PermissionMode
The SDK permission mode a ToolApprovalMode asks for.
promptSha256(String body) → String
Hashes body and returns it in the sha256:<lowercase-hex> convention used as a content fingerprint across agentic trails.
recencyDecay({required int? ageMillis, required int halfLifeMillis}) → double
Maps the age of a candidate's last successful run to a recency score in [0, 1] via exponential half-life decay.
requireNonEmpty(String value, String name) → String
Returns value unchanged when it is non-empty; otherwise throws an ArgumentError naming name. Use in a constructor body or at an untrusted boundary to reject an empty required string with a uniform message.
scoreProcedureCandidate({required double embeddingSimilarity, required double requiresOverlap, required double successRate, required double recencyScore, ProcedureRerankWeights weights = ProcedureRerankWeights.balanced}) → double
Folds the four re-rank factors into one comparable score in [0, 1].
setEquals<E>(Set<E> a, Set<E> b) → bool
Structural equality of two sets by membership.
specSessionLooksLikeError(String message) → bool
True when message should be treated as an SDK session error under the editor rule: its text contains session, message, or msg (case-insensitive).
sqlPlaceholders(int count, {String separator = ','}) → String
Builds a comma-separated run of count bind placeholders for an IN (…) clause: sqlPlaceholders(3) ⇒ '?,?,?'.
sqlSafeIdentifier(String input, {int maxLength = 32}) → String
Lowercases input and replaces every character outside [a-z0-9_] with _, capping the result at maxLength characters.
startOfDay(DateTime t) → DateTime
The start-of-day instant for t, preserving t's zone.
textPreview(String text, {int limit = 512, String ellipsis = '…'}) → String
Returns text unchanged when it is at most limit characters, otherwise the first limit characters followed by ellipsis.
thinkingConfigFor(bool? enabled, {int? budgetTokens}) → ThinkingConfig?
The SDK thinking configuration a profile's thinking settings ask for, or null when enabled is unset and the SDK's own default should apply.
yamlEnum<T>(Map<String, dynamic> yaml, String key, T fromValue(String?)) → T?
Reads key as a string and maps it through fromValue, or null when key holds no string.
yamlStringList(Map<String, dynamic> yaml, String key) → List<String>?
Reads key as a list of strings, keeping the elements that are strings, or null when key does not hold a list.
yamlValue<T>(Map<String, dynamic> yaml, String key) → T?
Reads key from yaml when it holds a T, and null when it does not — whether the key is absent or present with the wrong type.

Typedefs

AgentSdkClientFactory = Future<AgentSdkClient> Function({required String host, required int port})
Builds (and connects) an AgentSdkClient over the VS Code bridge at host:port — the editor's transport seam.
BridgePortScanner = Future<Map<int, String>> Function({required String host, required int maxPort, required int minPort})
Scans the bridge port range and returns a port → workspace table.
IsolateExceptionFactory = Object Function(String message, Map<String, Object?> details)
Rebuilds a typed exception host-side from the flat wire form a worker packed: the original message and a sendable details map of the exception's structured fields.
LlmNodeResolver = Future<LlmNodeResolution> Function()
Produces the Node resolution a transport runs on, when it is asked for — so a selector can be built before the settings are read and a search can run on the probe rather than at construction.
LlmToolAnswer = ({bool isError, String text})
What a tool call answers the model: a result or a refusal, as text.
LlmTrailLog = void Function(String operation, Map<String, Object?> fields)
Records a write that failed: the operation, a path and the error's type. Never content.
MapFieldErrorFactory = Object Function(String message)
Builds the domain-specific exception a MapFieldReader throws when a typed field read fails.
ProcessTerminator = void Function(int code)
Terminates the process with code. Production passes dart:io's exit (wrapped to the plain void Function(int) shape); a test injects a recorder so the process survives the assertion.
ReconnectDelay = Future<void> Function(Duration duration)
Delays for duration before the next rescan. Injected so tests run the protocol instantly instead of waiting the real 10/30/60 s.
ScopedPath = ({String path, String root})
A root that admits a resolved path, paired with that resolved path.
ShutdownAction = Future<void> Function()
The async teardown an AsyncShutdownCoordinator runs on the first trigger. Returns when teardown is complete; may throw, in which case the process still terminates but with shutdownExitError.
YamlConfigErrorFactory = Object Function(String message)
Builds the domain-specific exception a YamlConfigReader throws when a typed access or ${ENV} expansion fails.
YamlMapErrorFactory = Object Function(String message)
Builds the domain-specific exception loadYamlAsMap throws when parsing or type-checking fails.

Exceptions / Errors

BearerAuthFailure
Raised when a bearer token cannot be accepted.
DeadlineExceeded
Raised by Deadline.throwIfExpired when the wall-clock budget has elapsed.
IsolateCancellationException
Thrown by the executor when a cancellable request is cancelled at (or after) a checkpoint. An isolate host typically re-raises this across the boundary as a generic boundary exception whose exceptionType is 'IsolateCancellationException', which the client translates back to this typed class for the caller.
IsolateRequestFailure
Typed failure raised in place of an indefinite hang when a guarded isolate request cannot complete.
LlmSessionBusyException
A request refused because its session already has a run. An app whose user starts runs refuses rather than queues: a queued run would start at a moment nobody chose, against a document that may have changed. A backend serving its own lanes may queue instead, and then never raises this.
LlmSessionException
A session operation that cannot be done, with the sentence the user is shown.
LlmTransportException
The single error type crossing the seam.
PlaceholderExpressionException
Raised when a ${{ … }} expression throws or fails to parse during evaluation against the expression backing, or when a ${{ … }} form is encountered by a resolver that has no expression backing (e.g. the synchronous config-layer path).
PlaceholderExpressionsUnsupportedError
Thrown when a template contains a ${{ … }} expression form, which the editor deliberately does not support.
PlaceholderRecursionException
Raised when recursive placeholder expansion does not terminate within the resolver's level cap (default 10).
PlaceholderUnresolvedException
Raised when an unknown ${name} / ${env:NAME} is encountered while the resolver runs in strict mode.