UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

28 lines (27 loc) • 2.53 kB
/** * `@sema-agent/core/host-env` — the environment a child a HOST spawns starts with, without loading the engine: the * declaration of the engine's own credentials and the one composition over it, the same functions the package root * exports (this entry re-exports them; it defines nothing). A host's own executor for a settings command hook reads * them here: `declareWithheldEnv` once when the process starts, then * `hostChildEnv({ policy, settingsEnv: <the settings file's env block> }, <the hook's own variables>)` per child. * * One table per thread: the declaration and the engine-held credential values live on one `globalThis` slot of the * thread, so this entry and the root — the same module file in one install, or two copies of the package in one * thread — read and write the same table, and a declaration made through either is the one every composition in that * thread reads. A worker thread has its own `globalThis`, so its own table: a host that composes a child's environment * in a worker declares again in that thread. * * What this entry loads is the composition's own module graph (the credential vocabulary, the notice throat, the * member receipt), not the engine's. * * It also re-exports `judgeHookCondition` (plus its closed event and reason tables): the pure judge that tells a * host's local hook selector whether an entry's `if` condition matches a tool call (definite answers for empty * conditions, equal engine-catalog non-Monitor names without content, and strictly flat Bash commands; `untested` * with a closed reason word everywhere else). Both its accuracy and its no-host-code promise for plain data hold * in a realm whose built-in objects are as loaded; R-J catches a key added to, removed from, or reordered on * `Object.prototype` or `Array.prototype` relative to module load (`untested:invalid_input`), while any other * built-in modification, pre-load pollution, and cross-realm `null`-prototype exotic objects are outside the * contract (`docs/KNOWN-LIMITS.md` KL-4994-a / KL-4994-b). */ export { declareWithheldEnv, hostChildEnv, hostChildEnvProblem, inheritedHostEnv, inheritEnvPolicyProblem, type HostChildEnv, type HostChildInheritance, type InheritEnvPolicy, type SecretEnvFinding, type SecretEnvFindingKind, type WithheldEnvDeclaration, } from "./core/secret-env.js"; export { HOOK_CONDITION_EVENTS, HOOK_CONDITION_UNTESTED_REASONS, judgeHookCondition, type HookConditionInput, type HookConditionVerdict, } from "./core/hook-condition.js";