harness/core
The harness’s own core — path resolution, guard state, and the web-search seam’s vocabulary.
⚠ Schemas are NOT declared here. Every TypeBox schema in this repo lives in @enso/core,
so that a shape is either declared there or does not exist. Re-exporting them from here
would defeat that: a consumer could import GuardPolicy from two places and neither
import would look wrong.
Import schemas from @enso/core directly. Import path helpers from here.
⚠ THE LIST IS WHAT THE EXTENSIONS IMPORT, AND NOTHING ELSE (#263). It used to be the
modules’ full public surface, which is a different claim and an unfalsifiable one: 17 names
were exported here and imported nowhere, and they sat in fallow-baseline.json — a
suppression whose own note said it was waiting on #173’s zone rule, which shipped without
taking it. A barrel entry nothing imports is not an inventory, it is a name a reader must
check before concluding that removing something is safe.
So the surface is derived from consumption and test/harness-barrel-gate.test.ts holds
the two directions: a name here that no extension imports is red, and an extension
importing a name that is not here does not compile. Internal helpers keep living in their
modules — shell-segments.ts and web-search/anthropic-wire.ts are imported by their
siblings and by their own tests, which is what “internal” means. Adding one back here is
adding a consumer, and the gate asks for it.
Session incident
Section titled “Session incident”sessionIncidentPolicy()
Section titled “sessionIncidentPolicy()”sessionIncidentPolicy(
home,project):object
Defined in: packages/harness/core/session-config.ts:227
The incident policy (#466) a session runs under: the USER’s config.json, and over it — once the
project is trusted — its approved .enso/config.json’s security.incidents, which can only
TIGHTEN it (#753, tightenIncidentPolicy; a loosening key is ignored, and the session told so by
sessionEnsoConfig). Synchronous, where the guard needs it (session_start, before any call is
decided), so no trust question is asked here: project says what was decided. undefined — no
session started yet — is the user’s alone. ⚠ Unreadable fails CLOSED, as every consumer of these
files does: halting on, and problem says why.
Parameters
Section titled “Parameters”string
project
Section titled “project”{ cwd: string; trusted: boolean; } | undefined
Returns
Section titled “Returns”object
policy
Section titled “policy”
readonlypolicy:EnsoIncidentPolicy
problem?
Section titled “problem?”
readonlyoptionalproblem?:string
Command judge
Section titled “Command judge”userJudgeConfig()
Section titled “userJudgeConfig()”userJudgeConfig(
home): {backend:"off"|"jev";problem?:string; } | {backend:"local";local: {baseUrl:string;model:string; }; }
Defined in: packages/harness/core/session-config.ts:253
The command judge’s backend (#469) from the USER’s config.json alone: security.judge is
user-only, so a project cannot switch a judge on, or off, for the user. Absent
is off. ⚠ Unreadable fails CLOSED, which for the judge means OFF — nothing is sent anywhere —
and problem says why; so does local without the router and model it needs (#532).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”{ backend: "off" | "jev"; problem?: string; } | { backend: "local"; local: { baseUrl: string; model: string; }; }
Web search
Section titled “Web search”WebSearchProviderError
Section titled “WebSearchProviderError”Defined in: packages/harness/core/web-search/vocabulary.ts:79
Thrown by provider runs on failure.
requestDispatched says whether the HTTP request left the process — an honest “may have
billed” bit (whether a failed request billed is the provider’s accounting, not knowable
here), surfaced when the fallback re-searches.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WebSearchProviderError(
providerId,message,options):WebSearchProviderError
Defined in: packages/harness/core/web-search/vocabulary.ts:83
Parameters
Section titled “Parameters”providerId
Section titled “providerId”message
Section titled “message”string
options
Section titled “options”requestDispatched
Section titled “requestDispatched”boolean
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”providerId
Section titled “providerId”
readonlyproviderId:WebSearchProviderId
Defined in: packages/harness/core/web-search/vocabulary.ts:80
requestDispatched
Section titled “requestDispatched”
readonlyrequestDispatched:boolean
Defined in: packages/harness/core/web-search/vocabulary.ts:81
DeepseekSearchRequest
Section titled “DeepseekSearchRequest”Defined in: packages/harness/core/web-search/providers/deepseek.ts:37
Properties
Section titled “Properties”apiKey
Section titled “apiKey”apiKey:
string|undefined
Defined in: packages/harness/core/web-search/providers/deepseek.ts:40
The key read at the composition root — never from config, never logged.
fetchUrl
Section titled “fetchUrl”fetchUrl:
FetchUrl
Defined in: packages/harness/core/web-search/providers/deepseek.ts:41
onProgress?
Section titled “onProgress?”
optionalonProgress?: (text) =>void
Defined in: packages/harness/core/web-search/providers/deepseek.ts:43
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
query:
string
Defined in: packages/harness/core/web-search/providers/deepseek.ts:38
signal
Section titled “signal”signal:
AbortSignal|undefined
Defined in: packages/harness/core/web-search/providers/deepseek.ts:42
FetchUrlInit
Section titled “FetchUrlInit”Defined in: packages/harness/core/web-search/vocabulary.ts:100
The init the fetch seam takes — a fetch init narrowed to what a provider run actually
sets.
Named (not inline) so a fake in a test and the composition root’s real fetch wrapper can
both annotate the parameter instead of leaning on inference.
Properties
Section titled “Properties”
optionalbody?:string
Defined in: packages/harness/core/web-search/vocabulary.ts:104
headers?
Section titled “headers?”
optionalheaders?:Record<string,string>
Defined in: packages/harness/core/web-search/vocabulary.ts:103
method?
Section titled “method?”
optionalmethod?:string
Defined in: packages/harness/core/web-search/vocabulary.ts:101
redirect?
Section titled “redirect?”
optionalredirect?:"manual"
Defined in: packages/harness/core/web-search/vocabulary.ts:102
signal?
Section titled “signal?”
optionalsignal?:AbortSignal
Defined in: packages/harness/core/web-search/vocabulary.ts:105
ModelSearchRequest
Section titled “ModelSearchRequest”Defined in: packages/harness/core/web-search/vocabulary.ts:153
What a MODEL-ROUTED provider run receives (anthropic / google / openai).
Properties
Section titled “Properties”claudeCodeVersion?
Section titled “claudeCodeVersion?”
optionalclaudeCodeVersion?:string
Defined in: packages/harness/core/web-search/vocabulary.ts:165
The Claude Code version to claim on a Claude login (claudeCode.version, #925); undefined
claims the version pi’s conversations send. Read by the anthropic provider only.
fetchUrl
Section titled “fetchUrl”fetchUrl:
FetchUrl
Defined in: packages/harness/core/web-search/vocabulary.ts:157
model:
SearchModel
Defined in: packages/harness/core/web-search/vocabulary.ts:155
onProgress?
Section titled “onProgress?”
optionalonProgress?: (text) =>void
Defined in: packages/harness/core/web-search/vocabulary.ts:160
Streaming progress for the UI; carries the accumulated answer text so far.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
query:
string
Defined in: packages/harness/core/web-search/vocabulary.ts:154
resolveAuth
Section titled “resolveAuth”resolveAuth: (
model) =>Promise<ResolvedProviderAuth>
Defined in: packages/harness/core/web-search/vocabulary.ts:156
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<ResolvedProviderAuth>
signal
Section titled “signal”signal:
AbortSignal|undefined
Defined in: packages/harness/core/web-search/vocabulary.ts:158
SearchModel
Section titled “SearchModel”Defined in: packages/harness/core/web-search/vocabulary.ts:136
The model the conversation runs on, as the PROVIDER SEAM sees it (L6 closed, #162): the seven fields the providers read, declared here as ours.
The runtime’s own model record is converted once, at the extension
(extensions/web-search/index.ts#searchModelOf), and nothing under harness/core imports
the runtime’s type for it any more. A provider that needs an eighth field adds it here, where
the seam is, not by reaching for the vendor’s.
Properties
Section titled “Properties”api:
string
Defined in: packages/harness/core/web-search/vocabulary.ts:139
The wire API the model speaks — anthropic-messages, openai-responses, … — which routes the search.
baseUrl
Section titled “baseUrl”baseUrl:
string
Defined in: packages/harness/core/web-search/vocabulary.ts:142
headers?
Section titled “headers?”
optionalheaders?:Record<string,string>
Defined in: packages/harness/core/web-search/vocabulary.ts:145
id:
string
Defined in: packages/harness/core/web-search/vocabulary.ts:137
maxTokens
Section titled “maxTokens”maxTokens:
number
Defined in: packages/harness/core/web-search/vocabulary.ts:144
provider
Section titled “provider”provider:
string
Defined in: packages/harness/core/web-search/vocabulary.ts:141
The provider’s id, which names the environment key that may authenticate it.
reasoning
Section titled “reasoning”reasoning:
boolean
Defined in: packages/harness/core/web-search/vocabulary.ts:143
TavilySearchRequest
Section titled “TavilySearchRequest”Defined in: packages/harness/core/web-search/providers/tavily.ts:24
Properties
Section titled “Properties”apiKey
Section titled “apiKey”apiKey:
string
Defined in: packages/harness/core/web-search/providers/tavily.ts:26
excludeDomains?
Section titled “excludeDomains?”
optionalexcludeDomains?: readonlystring[]
Defined in: packages/harness/core/web-search/providers/tavily.ts:28
fetchUrl
Section titled “fetchUrl”fetchUrl:
FetchUrl
Defined in: packages/harness/core/web-search/providers/tavily.ts:29
includeDomains?
Section titled “includeDomains?”
optionalincludeDomains?: readonlystring[]
Defined in: packages/harness/core/web-search/providers/tavily.ts:27
query:
string
Defined in: packages/harness/core/web-search/providers/tavily.ts:25
signal
Section titled “signal”signal:
AbortSignal|undefined
Defined in: packages/harness/core/web-search/providers/tavily.ts:30
ResolvedProviderAuth
Section titled “ResolvedProviderAuth”ResolvedProviderAuth = {
apiKey?:string;baseUrl?:string;headers?:Record<string,string>;ok:true; } | {error:string;ok:false; }
Defined in: packages/harness/core/web-search/vocabulary.ts:121
Auth for one model-routed request, as pi’s model registry resolves it (plus the
provider-env fallback — see auth.ts).
WebSearchOutcome
Section titled “WebSearchOutcome”WebSearchOutcome = {
answerText?:string;kind:"searched";providerId:WebSearchProviderId;snippets?:WebSearchSnippet[];sources:WebSource[]; } | {answerText:string;kind:"ungrounded";providerId:WebSearchProviderId; }
Defined in: packages/harness/core/web-search/vocabulary.ts:53
What one provider run produced — the ACCURATE outcome union (#63, Daniel’s requirement).
⚠ searched vs ungrounded is keyed on evidence that a native search actually ran (a
server_tool_use block on the Anthropic wire; each provider names its own signal), NEVER on
source count: a real search can return zero results, and an ungrounded answer citing a
hallucinated URL would read as grounded. Upstream’s grounded = sources.length > 0 had
exactly that defect.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ answerText?: string; kind: "searched"; providerId: WebSearchProviderId; snippets?: WebSearchSnippet[]; sources: WebSource[]; }
answerText?
Section titled “answerText?”
optionalanswerText?:string
The provider-synthesized answer, citation-marked. Absent for retrieval backends (Tavily).
kind:
"searched"
providerId
Section titled “providerId”providerId:
WebSearchProviderId
snippets?
Section titled “snippets?”
optionalsnippets?:WebSearchSnippet[]
Retrieval results with snippets — the Tavily shape; model-native backends leave it absent.
sources
Section titled “sources”sources:
WebSource[]
Type Literal
Section titled “Type Literal”{ answerText: string; kind: "ungrounded"; providerId: WebSearchProviderId; }
answerText
Section titled “answerText”answerText:
string
kind:
"ungrounded"
The model answered WITHOUT searching — its own knowledge, not the live web.
providerId
Section titled “providerId”providerId:
WebSearchProviderId
WebSearchProviderId
Section titled “WebSearchProviderId”WebSearchProviderId =
"anthropic"|"google"|"openai"|"deepseek"|"tavily"
Defined in: packages/harness/core/web-search/vocabulary.ts:18
Every backend that can answer a web_search call.
DEEPSEEK_API_KEY_VARIABLE
Section titled “DEEPSEEK_API_KEY_VARIABLE”
constDEEPSEEK_API_KEY_VARIABLE:"DEEPSEEK_API_KEY"='DEEPSEEK_API_KEY'
Defined in: packages/harness/core/web-search/providers/deepseek.ts:30
The env var holding the key — the SAME name pi-ai’s own provider-env map uses.
resolveModelAuth()
Section titled “resolveModelAuth()”resolveModelAuth(
authSource,model,readProviderEnvironmentKey):Promise<ResolvedProviderAuth>
Defined in: packages/harness/core/web-search/auth.ts:64
readProviderEnvironmentKey is a SEAM: it defaults to pi-ai’s
getEnvApiKey, which reads the launching process environment — injectable so the
fallback’s POSITIVE path is testable without a test ever touching process.env.
Parameters
Section titled “Parameters”authSource
Section titled “authSource”ModelAuthSource
readProviderEnvironmentKey
Section titled “readProviderEnvironmentKey”(provider) => string | undefined
Returns
Section titled “Returns”Promise<ResolvedProviderAuth>
routedProviderIdForModel()
Section titled “routedProviderIdForModel()”routedProviderIdForModel(
model):"anthropic"|"google"|"openai"|undefined
Defined in: packages/harness/core/web-search/vocabulary.ts:177
Which model-routed provider serves a model, by its API kind.
undefined means no native search path exists for it — selection falls through to the
fallback chain. (pi registers DeepSeek models as openai-completions, so they land here as
undefined too: the DeepSeek backend is config-pinned, never model-routed — #63.)
Parameters
Section titled “Parameters”Returns
Section titled “Returns”"anthropic" | "google" | "openai" | undefined
runAnthropicProviderSearch()
Section titled “runAnthropicProviderSearch()”runAnthropicProviderSearch(
request):Promise<WebSearchOutcome>
Defined in: packages/harness/core/web-search/providers/anthropic.ts:114
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Promise<WebSearchOutcome>
runDeepseekProviderSearch()
Section titled “runDeepseekProviderSearch()”runDeepseekProviderSearch(
request):Promise<WebSearchOutcome>
Defined in: packages/harness/core/web-search/providers/deepseek.ts:47
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Promise<WebSearchOutcome>
runGoogleProviderSearch()
Section titled “runGoogleProviderSearch()”runGoogleProviderSearch(
request):Promise<WebSearchOutcome>
Defined in: packages/harness/core/web-search/providers/google.ts:101
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Promise<WebSearchOutcome>
runOpenAiProviderSearch()
Section titled “runOpenAiProviderSearch()”runOpenAiProviderSearch(
request):Promise<WebSearchOutcome>
Defined in: packages/harness/core/web-search/providers/openai.ts:175
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Promise<WebSearchOutcome>
runTavilyProviderSearch()
Section titled “runTavilyProviderSearch()”runTavilyProviderSearch(
request):Promise<WebSearchOutcome>
Defined in: packages/harness/core/web-search/providers/tavily.ts:34
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Promise<WebSearchOutcome>
Web fetch policy
Section titled “Web fetch policy”isFetchableContentType()
Section titled “isFetchableContentType()”isFetchableContentType(
contentTypeHeader):boolean
Defined in: packages/harness/core/web-fetch-policy.ts:95
True for response bodies worth returning as text.
An ABSENT Content-Type header is refused — web_fetch is a docs-reader, and “the server did not say” fails closed.
Parameters
Section titled “Parameters”contentTypeHeader
Section titled “contentTypeHeader”string | null
Returns
Section titled “Returns”boolean
isHostAllowed()
Section titled “isHostAllowed()”isHostAllowed(
hostname,allowedHosts):boolean
Defined in: packages/harness/core/web-fetch-policy.ts:73
Exact, case-insensitive hostname match.
No wildcards and no subdomain inheritance, deliberately: one allowlist entry is one
reviewable grant, and api.example.com is a different grant from example.com. Ports are
not part of the match — the protocol gate already confines the scheme, and a host grant is a
host grant on any port.
Parameters
Section titled “Parameters”hostname
Section titled “hostname”string
allowedHosts
Section titled “allowedHosts”readonly string[]
Returns
Section titled “Returns”boolean
isHtmlContentType()
Section titled “isHtmlContentType()”isHtmlContentType(
contentTypeHeader):boolean
Defined in: packages/harness/core/web-fetch-policy.ts:109
True for an HTML page, which web_fetch returns as its readable text (#927); every other fetchable type is returned as it came.
Parameters
Section titled “Parameters”contentTypeHeader
Section titled “contentTypeHeader”string | null
Returns
Section titled “Returns”boolean
parseWebFetchUrl()
Section titled “parseWebFetchUrl()”parseWebFetchUrl(
rawUrl):WebFetchUrlDecision
Defined in: packages/harness/core/web-fetch-policy.ts:41
Parse and gate a raw URL string. Refusal reasons are written for the model to read.
Parameters
Section titled “Parameters”rawUrl
Section titled “rawUrl”string
Returns
Section titled “Returns”WebFetchUrlDecision
readableTextOfHtml()
Section titled “readableTextOfHtml()”readableTextOfHtml(
html,pageUrl):string
Defined in: packages/harness/core/html-text.ts:738
The readable text of an HTML page: headings, paragraphs, lists, links as text <url> (relative
targets resolved against pageUrl), code and tables, in a markdown-like form — and nothing the
page hides or that is not its content (see the module header for the list).
Parameters
Section titled “Parameters”string
pageUrl
Section titled “pageUrl”URL
Returns
Section titled “Returns”string
Guards
Section titled “Guards”GuardProject
Section titled “GuardProject”Defined in: packages/harness/core/guard-session.ts:245
The session’s project as the incident policy reads it (#753): its directory, and whether it is trusted.
Properties
Section titled “Properties”
readonlycwd:string
Defined in: packages/harness/core/guard-session.ts:246
trusted
Section titled “trusted”
readonlytrusted:boolean
Defined in: packages/harness/core/guard-session.ts:247
GuardSession
Section titled “GuardSession”Defined in: packages/harness/core/guard-session.ts:306
One thread’s guard: what a runtime’s hooks call, in the order the runtime raises them.
Methods
Section titled “Methods”permissionDecision()
Section titled “permissionDecision()”permissionDecision(
raw):void
Defined in: packages/harness/core/guard-session.ts:311
A permission engine’s decision, as its channel carried it (#496).
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”void
start()
Section titled “start()”start(
facts):void
Defined in: packages/harness/core/guard-session.ts:307
Parameters
Section titled “Parameters”GuardStart
Returns
Section titled “Returns”void
toolCall()
Section titled “toolCall()”toolCall(
call):GuardCallOutcome
Defined in: packages/harness/core/guard-session.ts:308
Parameters
Section titled “Parameters”GuardToolCall
Returns
Section titled “Returns”GuardCallOutcome
toolResult()
Section titled “toolResult()”toolResult(
result):void
Defined in: packages/harness/core/guard-session.ts:309
Parameters
Section titled “Parameters”result
Section titled “result”GuardToolResult
Returns
Section titled “Returns”void
createGuardSession()
Section titled “createGuardSession()”createGuardSession(
runtime,dependencies):GuardSession
Defined in: packages/harness/core/guard-session.ts:339
Parameters
Section titled “Parameters”runtime
Section titled “runtime”GuardRuntime
dependencies
Section titled “dependencies”GuardSessionDependencies
Returns
Section titled “Returns”guarded-tool-call A tool call through the guard: one verdict, first block wins, always a record
Before any tool runs, the runtime raises tool_call and every extension’s handler answers in
load order; the first { block: true, reason } ends the call, and nothing after it can
un-block. Our guard is one handler with an ordered decide inside it: the fail-closed floor
and an incident’s suspension (standingDenial), the shell denies, the write gates, then every
other path-bearing tool as a reader. The bash analyzer is a library under that handler, not a
participant of its own, so the count stays at two (#4, #9). Every answer is a log record. A
refused call reaches the browser as a result flagged isError (the runtime’s shape for any
failure) and beside it the guard’s own custom entry naming the call and the rule, which is what
the page draws a refusal from, live and on resume (#387).
- docs/seams/guards.md the guards seam: the policy, the dependencies, decide’s order and the L5 crossing
- packages/harness/core/network-egress.ts the network bar, and what it does not cover (its header)
- docs/glossary.md the words: guard, verdict, policy, rule, participant, arbiter, boundary vs bar (Permission)
Invariant
Section titled “Invariant”guarded-tool-call/one-verdict The verdict is a denial with its reason, or nothing.
decide returns a GuardDenial or undefined, and the glue hands its runtime its own shape back:
every refusal is { block: true, reason }, every pass is undefined. Refusing is final:
handlers are additive and the runtime returns on the first block, whatever loads after (the
file header). HostedThread.probeToolCall pins this through the runtime’s own hook runner,
with the real load order and participants: the guards’ refusal with its reason, and first
block wins, so a later extension cannot un-block and its own block stands.
Guard predicates
Section titled “Guard predicates”ShellAnalyzerDenial
Section titled “ShellAnalyzerDenial”Defined in: packages/harness/core/guard-denials.ts:205
The bash analyzer’s refusal of a command (#9), in the guard’s words: the rule it is recorded under and the reason the model reads. The glue that wires a library under the guard produces it, applying that library’s own contract (the pi glue’s analyzer reads a throw as a deny), so the policy here never names the library.
Properties
Section titled “Properties”reason
Section titled “reason”
readonlyreason:string
Defined in: packages/harness/core/guard-denials.ts:207
readonlyrule:"policy-mismatch"|"cc-safety-net"|"network-egress"|"environment-dump"|"secret-path"|"write-confinement"|"protected-internals"|"persistence-write"|"secret-write"|"stale-write"|"read-before-write"|"secret-read"|"incident-suspension"|"protected-records"
Defined in: packages/harness/core/guard-denials.ts:206
inputRecordOf()
Section titled “inputRecordOf()”inputRecordOf(
input):Record<string,unknown>
Defined in: packages/harness/core/guard-denials.ts:72
The tool’s arguments as a plain record, whatever actually arrived. A runtime’s contract says
input is an object, but a guard hook must never throw (a throwing pi hook wedges print mode;
in-process it yields a session with the guard half-set-up — see the pi glue’s header), so a
missing or non-object input reads as “no arguments” rather than as a TypeError.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Record<string, unknown>
Project trust
Section titled “Project trust”SessionConfigContext
Section titled “SessionConfigContext”Defined in: packages/harness/core/session-config.ts:67
The session’s context, as pi hands it to session_start.
Methods
Section titled “Methods”isProjectTrusted()
Section titled “isProjectTrusted()”isProjectTrusted():
boolean
Defined in: packages/harness/core/session-config.ts:76
pi’s answer for this session: whether the project’s own scope is loaded.
Returns
Section titled “Returns”boolean
Properties
Section titled “Properties”
readonlycwd:string
Defined in: packages/harness/core/session-config.ts:69
readonlyhasUI:boolean
Defined in: packages/harness/core/session-config.ts:70
readonlyhome:string
Defined in: packages/harness/core/session-config.ts:68
hostOwnsTrust
Section titled “hostOwnsTrust”
readonlyhostOwnsTrust:boolean
Defined in: packages/harness/core/session-config.ts:82
The web host decides trust (#502): it asks before a run, applies the answer to pi and reloads,
so here the project’s config follows isProjectTrusted() and nothing is asked twice. The
terminal has no host: there the question below is Enso’s own, as pi’s covers only .pi/.
projectTrust
Section titled “projectTrust”
readonlyprojectTrust:ProjectTrustRuntime
Defined in: packages/harness/core/session-config.ts:84
pi’s store and settings classes (#509), which the terminal’s question reads and writes.
readonlyui:object
Defined in: packages/harness/core/session-config.ts:71
notify()
Section titled “notify()”notify(
message,type?):void
Parameters
Section titled “Parameters”message
Section titled “message”string
"info" | "warning" | "error"
Returns
Section titled “Returns”void
select()
Section titled “select()”select(
title,options):Promise<string|undefined>
Parameters
Section titled “Parameters”string
options
Section titled “options”string[]
Returns
Section titled “Returns”Promise<string | undefined>
SessionEnsoConfig
Section titled “SessionEnsoConfig”Defined in: packages/harness/core/session-config.ts:49
What a session’s tools read their policy from.
Properties
Section titled “Properties”
readonlypath:string
Defined in: packages/harness/core/session-config.ts:53
The file a human changes to change this session’s policy: the project’s, when it was read.
result
Section titled “result”
readonlyresult:EnsoConfigParseResult
Defined in: packages/harness/core/session-config.ts:51
The merged config, or why it could not be read — a caller fails CLOSED on unreadable.
sources
Section titled “sources”
readonlysources: readonlystring[]
Defined in: packages/harness/core/session-config.ts:59
The config files this resolution read, user first; empty when none exists (#435). Recorded here, where the reading happens: the resolution is cached per session, so a probe at record time would name files the cached result never saw.
decidedProjectTrust()
Section titled “decidedProjectTrust()”decidedProjectTrust(
context):boolean|undefined
Defined in: packages/harness/core/session-config.ts:278
The trust already decided for the session’s project, without asking: the web host’s answer when
it owns trust (#502), else pi’s saved decision for the cwd or its nearest ancestor, else
defaultProjectTrust — undefined when that is ask, the question sessionEnsoConfig asks. What
the guard reads at session_start (#753), which cannot wait on a question: a project trusted only
for one terminal session is untrusted there, so its tightening waits for a saved decision.
Parameters
Section titled “Parameters”context
Section titled “context”Pick<SessionConfigContext, "home" | "cwd" | "hostOwnsTrust" | "isProjectTrusted" | "projectTrust">
Returns
Section titled “Returns”boolean | undefined
sessionConfigEnvironment()
Section titled “sessionConfigEnvironment()”sessionConfigEnvironment(
environment,projectTrust):Pick<SessionConfigContext,"home"|"hostOwnsTrust"|"projectTrust">
Defined in: packages/harness/core/session-config.ts:94
The context’s process-wide parts: the user’s ENSO_HOME and whether the web host owns project
trust (it sets ENSO_PROJECT_TRUST_BY_HOST before its first session), read from
environment; and pi’s trust classes, which the calling extension imports and passes in (#509).
Parameters
Section titled “Parameters”environment
Section titled “environment”Readonly<Record<string, string | undefined>>
projectTrust
Section titled “projectTrust”ProjectTrustRuntime
Returns
Section titled “Returns”Pick<SessionConfigContext, "home" | "hostOwnsTrust" | "projectTrust">
sessionEnsoConfig()
Section titled “sessionEnsoConfig()”sessionEnsoConfig(
session,context):Promise<SessionEnsoConfig>
Defined in: packages/harness/core/session-config.ts:117
The session’s config, resolved once per session (the context’s sessionManager) and trust
answer: under the web host a Trust reloads the session, and the trusted resolution is a new one.
Parameters
Section titled “Parameters”session
Section titled “session”object
context
Section titled “context”Returns
Section titled “Returns”Promise<SessionEnsoConfig>
Deadlines
Section titled “Deadlines”runUnderDeadline()
Section titled “runUnderDeadline()”runUnderDeadline<
T>(callerSignal,deadline,run):Promise<T>
Defined in: packages/harness/core/deadline.ts:17
Run work under a deadline AND the caller’s abort signal, as one signal (#174; the shape
web_fetch and web_search each carried).
Two things every copy had to get right:
- A signal that is ALREADY aborted never fires its event (
addEventListeneris not retroactive), so anexecute()entered post-abort would run to the deadline — the guard aborts first. - A budget already spent aborts BEFORE the work starts: a 0 ms timer would let fast work answer first, and a fallback must not start what the deadline already forbade.
The deadline’s reason is the caller’s — it names the tool and the budget in the refusal.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”callerSignal
Section titled “callerSignal”AbortSignal | undefined
deadline
Section titled “deadline”reason
Section titled “reason”() => Error
The error the work sees when the deadline, not the caller, ended it.
remainingMs
Section titled “remainingMs”number
Milliseconds left; zero or less aborts before run.
(signal) => Promise<T>
Returns
Section titled “Returns”Promise<T>
