@manta-eu/horns-server
Reference for @manta-eu/horns-server 0.2.3, generated from its published types.
pnpm add @manta-eu/horns-server@0.2.3
Entry points
@manta-eu/horns-server, on this page@manta-eu/horns-server/csp@manta-eu/horns-server/session@manta-eu/horns-server/shared@manta-eu/horns-server/studio-agent@manta-eu/horns-server/studio-agent-class@manta-eu/horns-server/studio-model@manta-eu/horns-server/studio-worker@manta-eu/horns-server/typecheck@manta-eu/horns-server/worker
Classes
WriteRefusedError
Extends
Error
Constructors
Constructor
new WriteRefusedError(
message):WriteRefusedError
Parameters
message
string
Returns
Overrides
Error.constructor
Properties
cause?
optionalcause?:unknown
Inherited from
Error.cause
message
message:
string
Inherited from
Error.message
name
name:
string
Inherited from
Error.name
stack?
optionalstack?:string
Inherited from
Error.stack
Type Aliases
DevSessionEnv
DevSessionEnv =
object
Properties
DEV_AGENTS_COOKIE?
optionalDEV_AGENTS_COOKIE?:string
HORNS_SESSION_COOKIE_PREFIX?
optionalHORNS_SESSION_COOKIE_PREFIX?:string
A host that signs people in itself names its own session cookies here. Defaults to Horns’ own.
HORNS_SESSION_SOURCE?
optionalHORNS_SESSION_SOURCE?:string
upstream when the host is the upstream itself: the session is its own sign-in cookies, read as they are.
HornRoutesDeps
HornRoutesDeps =
object
Properties
libraryLookup?
optionallibraryLookup?:RevisionLookup
The realm library’s revisions, for checking a Horn’s pins. Absent until the library is readable.
now?
optionalnow?: () =>Date
Returns
Date
HornRoutesEnv
HornRoutesEnv =
DevSessionEnv&object
Type Declaration
ASSETS
ASSETS:
AssetFetcher
MANTA_AGENTS_URL?
optionalMANTA_AGENTS_URL?:string
SPARQL_UPDATE_PSK?
optionalSPARQL_UPDATE_PSK?:string
UPSTREAM?
optionalUPSTREAM?:UpstreamFetcher
VITE_KEYCLOAK_REALM?
optionalVITE_KEYCLOAK_REALM?:string
StudioConversationEnv
StudioConversationEnv =
DevSessionEnv&object
Type Declaration
MANTA_AGENTS_URL?
optionalMANTA_AGENTS_URL?:string
VITE_KEYCLOAK_REALM?
optionalVITE_KEYCLOAK_REALM?:string
StudioRoutesDeps
StudioRoutesDeps<
Env> =object
Type Parameters
Env
Env extends StudioRoutesEnv
Properties
componentApi?
optionalcomponentApi?:ComponentApiLookup
The surfaced components’ declarations, read at build time. Absent, read_component_api is not offered.
criticModel?
optionalcriticModel?: (env,context) =>StudioModelChoice
The critic’s model, which can look at a picture. Absent, the critic reads the card as text instead.
Parameters
env
Env
context
datastoreId
string
feature
string
Returns
model?
optionalmodel?: (env,context) =>StudioModelChoice
Overridden by tests with a scripted model; the deployment builds Qwen through the AI Gateway.
Parameters
env
Env
context
datastoreId
string
feature
string
Returns
shapes
shapes: (
realm) => readonlyShape[]
The realm’s SHACL shapes, which is what a turn reads classes from. Absent shapes answer no classes.
Parameters
realm
Realm
Returns
readonly Shape[]
typecheck?
optionaltypecheck?: (source) => readonlyTypeProblem[]
A compiler over a written view. Absent, a proposal is judged on its shape alone.
Parameters
source
string
Returns
readonly TypeProblem[]
StudioRoutesEnv
StudioRoutesEnv =
DevSessionEnv&StudioModelEnv&object
Type Declaration
MANTA_AGENTS_URL?
optionalMANTA_AGENTS_URL?:string
UPSTREAM?
optionalUPSTREAM?:UpstreamFetcher
VITE_KEYCLOAK_REALM?
optionalVITE_KEYCLOAK_REALM?:string
UpstreamFetcher
UpstreamFetcher =
object
How this worker reaches the upstream, where a host has a way of its own. A host that is the upstream passes itself, so a call stays in the process rather than leaving through the public hostname; a service binding fits too.
Properties
fetch
fetch: (
request) =>Response|Promise<Response>
Parameters
request
Request
Returns
Response | Promise<Response>
Variables
callbackPath
constcallbackPath:"/auth/callback"="/auth/callback"
datastoreAccessUnavailableMessage
constdatastoreAccessUnavailableMessage:"Could not check this session's datastore access."="Could not check this session's datastore access."
datastoreNotGrantedMessage
constdatastoreNotGrantedMessage:"That datastore is not one this session can open."="That datastore is not one this session can open."
hornTemplatePath
consthornTemplatePath:"/horn.html"="/horn.html"
loginPath
constloginPath:"/login"="/login"
logoutPath
constlogoutPath:"/logout"="/logout"
maxHistoryTurns
constmaxHistoryTurns:6=6
How much of the conversation goes back to the model.
The draft itself is in <useful-context>, so the history is there for intent, not for state — and every
message of it is context the turn cannot spend on work. dyad keeps three turns by default; this keeps six,
because our messages are short and the earlier ones carry what someone wants the Horn to look like.
maxScreenshotBytes
constmaxScreenshotBytes:number
signedOutMessage
constsignedOutMessage:"Not signed in — sign in to Manta to reach the live data source."= “Not signed in \u2014 sign in to Manta to reach the live data source.”
Functions
actionPlanRoutes()
actionPlanRoutes<
Env>():Hono<{Bindings:Env; },any,"/">
Type Parameters
Env
Env extends HornRoutesEnv
Returns
Hono<{ Bindings: Env; }, any, "/">
agentsSparqlSelect()
agentsSparqlSelect(
args):SparqlSelect
Server-side reads, as the viewer.
The read-only check is this worker’s, not agents’: it is the write-authorization boundary (ARCHITECTURE.md §11), and a SELECT that is not one must not reach agents merely because it travelled as a GraphQL variable rather than a request body.
Parameters
args
AgentsCaller
Returns
SparqlSelect
agentsSparqlUpdate()
agentsSparqlUpdate(
args):SparqlUpdate
Parameters
args
agentsUrl
string | undefined
datastoreId
string
purpose
WritePurpose
updateKey
string | undefined
upstream?
Returns
SparqlUpdate
asJsonRequest()
asJsonRequest(
request):Request
The request agents gets: the caller’s own, but asking for JSON so a failure comes back as one.
Parameters
request
Request
Returns
Request
authorizeStudioConversation()
authorizeStudioConversation(
request,env,datastoreId):Promise<{ok:true;props:StudioOpening; } | {ok:false;response:Response; }>
Who may open a Studio conversation, decided before the object is reached rather than inside it.
Parameters
request
Request
env
datastoreId
string
Returns
Promise<{ ok: true; props: StudioOpening; } | { ok: false; response: Response; }>
authUnavailableResponse()
authUnavailableResponse(
request):Response
Parameters
request
Request
Returns
Response
datastoreAccessFor()
datastoreAccessFor(
env,session):Promise<DatastoreAccessResult>
Parameters
env
DatastoreAccessEnv
session
Returns
Promise<DatastoreAccessResult>
followedLink()
followedLink(
response,agentsUrl):Response|undefined
Where agents sent the caller, made to work from this site. A platform’s own URL is left alone; a path on agents (an operator’s record page) is made absolute there, because this site has no such page.
Parameters
response
Response
agentsUrl
string
Returns
Response | undefined
forgetDatastoreAccess()
forgetDatastoreAccess(
session):void
Parameters
session
Returns
void
grantsDatastore()
grantsDatastore(
access,datastoreId):boolean
Parameters
access
DatastoreAccess
datastoreId
string
Returns
boolean
hornRoutes()
hornRoutes<
Env>(deps?):Hono<{Bindings:Env; },any,"/">
Type Parameters
Env
Env extends HornRoutesEnv
Parameters
deps?
Returns
Hono<{ Bindings: Env; }, any, "/">
localSignOutResponse()
localSignOutResponse(
request,sessionCookiePrefix?):Response
Parameters
request
Request
sessionCookiePrefix?
string
Returns
Response
loginRequestWithMarker()
loginRequestWithMarker(
request):Request
Parameters
request
Request
Returns
Request
logoutResponseReturningTo()
logoutResponseReturningTo(
response,request):Response
Parameters
response
Response
request
Request
Returns
Response
ndjsonResponse()
ndjsonResponse(
run,headers?):Response
A turn as a stream: one JSON object per line, as the turn produces them, the last of which is the result. A turn is several model rounds and takes a minute, and a minute of nothing reads as a hang.
run starts now, not when someone reads: a client that walks away must not leave half a turn behind, so the
lines queue until a reader wants them. Anything run throws becomes a last { type: "error" } line, because
by then the status is already sent.
Parameters
run
(emit) => Promise<void>
headers?
Readonly<Record<string, string>>
Returns
Response
noPageToOpen()
noPageToOpen(
datastoreId,status):Response
A page a person can read when there is nowhere to go, with the way back to their Horns.
Parameters
datastoreId
string
status
number
Returns
Response
proxyToMantaAgents()
proxyToMantaAgents(
args):Promise<Response>
Parameters
args
ProxyToMantaAgentsArgs
Returns
Promise<Response>
renderHornDocument()
renderHornDocument(
args):string
Parameters
args
mode
"page" | "embed"
snapshot
{ generatedAt: string; horn: { datastoreId: string; iri: string; realm: "hiremanta-com" | "journey-travel"; revision: number; slug: string; title: string; }; labels: z.ZodRecord<z.ZodString, z.ZodString>; layout: { columns: 12; items: object[]; kind: "grid"; }; links: z.ZodRecord<z.ZodString, z.ZodString>; plans: object[]; snapshotVersion: 1; style: { accent?: "blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"; density?: "compact" | "comfortable"; radius?: "sharp" | "soft" | "round"; theme?: "light" | "dark"; }; variables: object[]; views: object[]; }
snapshot.generatedAt
string
snapshot.horn
{ datastoreId: string; iri: string; realm: "hiremanta-com" | "journey-travel"; revision: number; slug: string; title: string; }
snapshot.horn.datastoreId
string
snapshot.horn.iri
string
snapshot.horn.realm
"hiremanta-com" | "journey-travel"
snapshot.horn.revision
number
snapshot.horn.slug
string
snapshot.horn.title
string
snapshot.labels
z.ZodRecord<z.ZodString, z.ZodString>
snapshot.layout
{ columns: 12; items: object[]; kind: "grid"; }
snapshot.layout.columns
12
snapshot.layout.items
object[]
snapshot.layout.kind
"grid"
snapshot.links
z.ZodRecord<z.ZodString, z.ZodString>
snapshot.plans
object[]
snapshot.snapshotVersion
1
snapshot.style
{ accent?: "blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"; density?: "compact" | "comfortable"; radius?: "sharp" | "soft" | "round"; theme?: "light" | "dark"; }
snapshot.style.accent?
"blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"
snapshot.style.density?
"compact" | "comfortable"
snapshot.style.radius?
"sharp" | "soft" | "round"
snapshot.style.theme?
"light" | "dark"
snapshot.variables
object[]
snapshot.views
object[]
template
string
Returns
string
requestSession()
requestSession(
request,env):MantaSessionState|undefined
Parameters
request
Request
env
Returns
MantaSessionState | undefined
resetDatastoreAccessCache()
resetDatastoreAccessCache():
void
Returns
void
sameOriginDeniedResponse()
sameOriginDeniedResponse(
request):Response|undefined
Parameters
request
Request
Returns
Response | undefined
sentryOptionsForDeploy()
sentryOptionsForDeploy(
env): {beforeSend: (event) =>ErrorEvent;dsn:string|undefined;environment:string;integrations:any[];release:string;sendDefaultPii:boolean; } |undefined
Parameters
env
Returns
{ beforeSend: (event) => ErrorEvent; dsn: string | undefined; environment: string; integrations: any[]; release: string; sendDefaultPii: boolean; } | undefined
signInFirst()
signInFirst(
request):Response
Parameters
request
Request
Returns
Response
studioConversationName()
studioConversationName(
datastoreId,conversation):string
One object per conversation per datastore: a name that crossed datastores would carry a draft with it.
Parameters
datastoreId
string
conversation
string
Returns
string
studioRoutes()
studioRoutes<
Env>(deps):Hono<{Bindings:Env; },any,"/">
One turn of talking to a Horn. The draft arrives in the body and comes back changed — nothing is stored here: saving is the save route’s job, with its own lock check and its own authorization.
Prior turns travel as their text alone. Their tool calls described a draft the user has since changed, and re-sending them would ask the model to reason from a Horn that no longer exists; useful-context carries the one that does.
Type Parameters
Env
Env extends StudioRoutesEnv
Parameters
deps
StudioRoutesDeps<Env>
Returns
Hono<{ Bindings: Env; }, any, "/">
References
badSessionCookiePrefixMessage
Re-exports badSessionCookiePrefixMessage
contentSecurityPolicy
Re-exports contentSecurityPolicy
criticModel
Re-exports criticModel
Env
Re-exports Env
isSignedIn
Re-exports isSignedIn
MantaSessionState
Re-exports MantaSessionState
readNdjson
Re-exports readNdjson
sessionCookiePrefix
Re-exports sessionCookiePrefix
sessionCookiePrefixOf
Re-exports sessionCookiePrefixOf
sessionSetCookies
Re-exports sessionSetCookies
signedInParam
Re-exports signedInParam
StudioAgentProps
Re-exports StudioAgentProps
studioModel
Re-exports studioModel
StudioModelChoice
Re-exports StudioModelChoice
StudioModelEnv
Re-exports StudioModelEnv
studioOpening
Re-exports studioOpening
StudioOpening
Re-exports StudioOpening
withoutPiiErrorEvent
Re-exports withoutPiiErrorEvent