agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
1,421 lines • 38 kB
JavaScript
/**
* knownStrings — THE one rule an event is served by under ANY policy that
* selects at least one name: every value is checked by its KIND, wherever it
* sits.
*
* Pattern: one small pure function (`keepKnownValues`) over the closed sets
* the library and the run declared.
* Role: what makes the served path SAFE without a per-field list. A record
* handed out whole can carry the conversation anywhere — a field
* nobody listed, a list inside a record, a key of a map, a copy the
* library derives from a selected value under a name of its own — so
* nothing is trusted by its position. A value is kept only when its
* kind says it cannot be what a person, the model, a tool or the data
* wrote:
*
* - numbers, booleans and null pass;
* - a string passes only when it is one of the library's own WORDS — an
* event type, a status, verdict or stop word, a fixed sentence:
* {@link LIBRARY_WORDS}, built from the code's own types and exhaustive by
* type (a word added to a payload union does not compile until it is
* listed). Ids, the names an app declared and the host's identity are not
* words: they are the placeholder too (a run's minted ids and its
* declared names come back later, each with a single owner and its own
* review);
* - every other string is the placeholder, inside lists and records too;
* - an object's KEY is a field name when the library's payload types name
* that field ({@link FIELD_NAMES}); any other key is data, checked by the
* same rule — the keys that fail are kept out together, as one
* placeholder entry;
* - a value that is not plain data (a class instance, a Map, a Date) cannot
* be vouched for and is the placeholder.
*
* What it serves is always a fresh copy of plain data (`keepKnownValues`).
* State, the snapshot and the commit log are not served by it: footprintjs's
* rule decides those, by name.
*/
import { SERVED_PLACEHOLDER } from './placeholder.js';
// The two literals below are WRITTEN BY `scripts/gen-known-strings.mjs` from the
// types above; the compiler checks them EXACTLY against those types (a member
// missing, or one too many, does not compile).
/** (a) Every library word, as a frozen record — see {@link LibraryWord}. */
const WORDS = {
// @generated words — start
Conditional: true,
'LLM produced no tool calls — final answer': true,
Loop: true,
Parallel: true,
Sequence: true,
'The call ran out of time before an answer arrived.': true,
'The request failed before an answer arrived. Its error is not kept.': true,
'The search ran and matched nothing — the call did not fail, and calling this tool again with the same arguments returns this same result. `checked` is the ground this answer covers, as the arguments of the call and the defaults the tool declares set it: where an argument was not sent, a default the tool applies may have narrowed the search. Anything under `not_checked` or `cannot_cover` is ground it does NOT cover, and reaching that needs a different question, not a retry.': true,
'The search ran and matched nothing. This is an ANSWER, not an error: nothing failed, nothing was substituted for what was asked, and calling this tool again with the same arguments returns this same result. `checked` is the ground this answer covers; anything under `not_checked` or `cannot_cover` is ground it does NOT cover, and reaching that needs a different question, not a retry.': true,
abort: true,
above: true,
'absence-kind-normalized': true,
absent: true,
accepted: true,
adapter: true,
advance: true,
'after-miss': true,
'after-tool': true,
'agentfootprint.agent.budget_exhausted': true,
'agentfootprint.agent.evidence_checked': true,
'agentfootprint.agent.grounding_nudged': true,
'agentfootprint.agent.handoff': true,
'agentfootprint.agent.iteration_end': true,
'agentfootprint.agent.iteration_start': true,
'agentfootprint.agent.output_contract_unmet': true,
'agentfootprint.agent.output_schema_retry': true,
'agentfootprint.agent.output_schema_validation_failed': true,
'agentfootprint.agent.route_decided': true,
'agentfootprint.agent.run_configured': true,
'agentfootprint.agent.thinking_omitted': true,
'agentfootprint.agent.thinking_parse_failed': true,
'agentfootprint.agent.turn_end': true,
'agentfootprint.agent.turn_start': true,
'agentfootprint.answer.assessed': true,
'agentfootprint.artifacts.expired': true,
'agentfootprint.artifacts.hand_over_failed': true,
'agentfootprint.artifacts.minted': true,
'agentfootprint.artifacts.presented': true,
'agentfootprint.artifacts.refused': true,
'agentfootprint.artifacts.resolved': true,
'agentfootprint.checkin.decision': true,
'agentfootprint.checkin.request': true,
'agentfootprint.composition.branch_complete': true,
'agentfootprint.composition.enter': true,
'agentfootprint.composition.exit': true,
'agentfootprint.composition.fork_start': true,
'agentfootprint.composition.iteration_exit': true,
'agentfootprint.composition.iteration_start': true,
'agentfootprint.composition.merge_end': true,
'agentfootprint.composition.route_decided': true,
'agentfootprint.context.budget_pressure': true,
'agentfootprint.context.evaluated': true,
'agentfootprint.context.evicted': true,
'agentfootprint.context.injected': true,
'agentfootprint.context.slot_composed': true,
'agentfootprint.cost.limit_hit': true,
'agentfootprint.cost.tick': true,
'agentfootprint.credential.acquired': true,
'agentfootprint.credential.authorization_required': true,
'agentfootprint.credential.failed': true,
'agentfootprint.credential.requested': true,
'agentfootprint.embedding.generated': true,
'agentfootprint.error.circuit_changed': true,
'agentfootprint.error.fatal': true,
'agentfootprint.error.recovered': true,
'agentfootprint.error.retried': true,
'agentfootprint.eval.score': true,
'agentfootprint.eval.threshold_crossed': true,
'agentfootprint.fallback.triggered': true,
'agentfootprint.findings.argument': true,
'agentfootprint.findings.contingent': true,
'agentfootprint.findings.declared': true,
'agentfootprint.findings.judge_failed': true,
'agentfootprint.findings.judged': true,
'agentfootprint.findings.negative_claim': true,
'agentfootprint.findings.period': true,
'agentfootprint.findings.standing': true,
'agentfootprint.integrity.context_error': true,
'agentfootprint.integrity.disposition': true,
'agentfootprint.integrity.external_ground_used': true,
'agentfootprint.map.engaged': true,
'agentfootprint.map.parked': true,
'agentfootprint.memory.attached': true,
'agentfootprint.memory.detached': true,
'agentfootprint.memory.retrieved': true,
'agentfootprint.memory.strategy_applied': true,
'agentfootprint.memory.written': true,
'agentfootprint.middleware.decision': true,
'agentfootprint.ontology.served': true,
'agentfootprint.pause.request': true,
'agentfootprint.pause.resume': true,
'agentfootprint.permission.check': true,
'agentfootprint.permission.gate_closed': true,
'agentfootprint.permission.gate_opened': true,
'agentfootprint.permission.halt': true,
'agentfootprint.reliability.fail_fast': true,
'agentfootprint.reliability.recovered': true,
'agentfootprint.reliability.retried': true,
'agentfootprint.resilience.output_canned_used': true,
'agentfootprint.resilience.output_fallback_triggered': true,
'agentfootprint.skill.activated': true,
'agentfootprint.skill.deactivated': true,
'agentfootprint.skill.escalated': true,
'agentfootprint.skill.graph_declared': true,
'agentfootprint.skill.rejected': true,
'agentfootprint.skill.reroute_superseded': true,
'agentfootprint.skill.route_conflict': true,
'agentfootprint.skill.step_advanced': true,
'agentfootprint.skill.step_skipped': true,
'agentfootprint.skill.steps_unfinished': true,
'agentfootprint.skill.turn_routed': true,
'agentfootprint.stream.llm_end': true,
'agentfootprint.stream.llm_start': true,
'agentfootprint.stream.thinking_delta': true,
'agentfootprint.stream.thinking_end': true,
'agentfootprint.stream.token': true,
'agentfootprint.stream.tool_end': true,
'agentfootprint.stream.tool_progress': true,
'agentfootprint.stream.tool_start': true,
'agentfootprint.tool_choice.failed': true,
'agentfootprint.tool_choice.outcome': true,
'agentfootprint.tool_choice.picked': true,
'agentfootprint.tools.absent': true,
'agentfootprint.tools.activated': true,
'agentfootprint.tools.answered_off_wire': true,
'agentfootprint.tools.claim_swallowed': true,
'agentfootprint.tools.code_run': true,
'agentfootprint.tools.coverage_declared': true,
'agentfootprint.tools.deactivated': true,
'agentfootprint.tools.discovery_completed': true,
'agentfootprint.tools.discovery_failed': true,
'agentfootprint.tools.discovery_started': true,
'agentfootprint.tools.effect': true,
'agentfootprint.tools.mcp_client': true,
'agentfootprint.tools.offered': true,
'agentfootprint.tools.repeated_call': true,
'agentfootprint.tools.request_attempts': true,
'agentfootprint.tools.result_refused': true,
'agentfootprint.tools.semantics_declared': true,
'agentfootprint.tools.session_close_failed': true,
'agentfootprint.tools.session_closed': true,
'agentfootprint.tools.session_reused': true,
'agentfootprint.tools.session_started': true,
'agentfootprint.tools.shadowed': true,
'agentfootprint.validation.args_invalid': true,
allow: true,
always: true,
answer: true,
'answer-check-failed': true,
'answer-checks': true,
answered: true,
anthropic: true,
'anthropic-messages': true,
app: true,
applied: true,
'argument-asked': true,
'argument-assumed': true,
'argument-read': true,
'argument-rules': true,
'argument-sources': true,
'argument-unsent': true,
'argument-unverified': true,
arguments: true,
'as-checked': true,
ask: true,
asked: true,
asserted: true,
assist: true,
assistant: true,
assume: true,
assumed: true,
auth: true,
auto: true,
'auto-extract': true,
autoActivate: true,
avg: true,
backtick: true,
base: true,
bears: true,
'before-tool': true,
below: true,
'below-threshold': true,
'binding-changed': true,
body_complete: true,
break: true,
budget: true,
budget_exhausted: true,
call: true,
'call-end': true,
cancelled: true,
'cap-reached': true,
causal: true,
cerbos: true,
'changes-without-key': true,
chars: true,
'check-unreachable': true,
'checked-fail': true,
choice: true,
chroma: true,
claim: true,
'claim-exceeds-search': true,
classic: true,
closed: true,
code: true,
cohere: true,
'column-difference': true,
'column-ratio': true,
'column-sum': true,
'column-type-mismatch': true,
compatibility: true,
complement: true,
complete: true,
completed: true,
'completed-with-failure': true,
completeness: true,
compose: true,
'composed-message': true,
configure: true,
consistent: true,
'content-changed': true,
continuity: true,
conversation: true,
'cost-budget': true,
'costBudget reached (onExceed: halt) — forcing final': true,
cost_guard: true,
count: true,
'coverage-gap': true,
covered: true,
'credential-limited': true,
custom: true,
cut: true,
'cut-short': true,
'dangling-reference': true,
decay: true,
decider: true,
declaration: true,
'declaration-overclaimed': true,
'declared-absent': true,
default: true,
degrade: true,
delete: true,
denied: true,
deny: true,
'derived-from-reading': true,
dev: true,
'digest-mismatch': true,
direct: true,
dispatch: true,
document: true,
'duplicate-execution': true,
dynamic: true,
'dynamic-grouped': true,
earlier: true,
'earlier-proposal': true,
'empty-lookup': true,
'empty-undeclared': true,
'ending-full': true,
entry: true,
episodic: true,
'epoch-ms': true,
'epoch-s': true,
eq: true,
err: true,
error: true,
escalation: true,
evict: true,
evicted: true,
'evidence-rails': true,
'evidence-recheck': true,
'evidence-recovery': true,
'evidence-revision': true,
exhausted: true,
existence: true,
expired: true,
explicit: true,
exploratory: true,
external_net: true,
extract: true,
fact: true,
'fact-extraction': true,
failed: true,
failure: true,
fallback: true,
filter: true,
final: true,
findings: true,
flagged: true,
fn: true,
framework: true,
gate_open: true,
gated: true,
get: true,
google: true,
grounded: true,
gt: true,
gte: true,
guard: true,
guard_false: true,
'half-open': true,
halt: true,
'handle-lost': true,
head: true,
heuristic: true,
hidden: true,
high: true,
'history-order': true,
hold: true,
hook: true,
host: true,
http: true,
hybrid: true,
identifier: true,
'identity-mismatch': true,
idle: true,
in: true,
'incomplete-identity': true,
'incomplete-stream': true,
'init-failed': true,
'init-timeout': true,
input: true,
'input-cancelled': true,
instructions: true,
intent: true,
invalid: true,
'invalid-answer': true,
'invalid-argument-shape': true,
'invalid-input': true,
'invalid-json': true,
'invariant-violation': true,
iso: true,
iteration: true,
joined: true,
'json-parse': true,
kept: true,
'kept-out': true,
'kind-mismatch': true,
known: true,
last: true,
latest: true,
'lease-expired': true,
lexical: true,
list: true,
listed: true,
llm: true,
'llm-activated': true,
local: true,
lookedFor: true,
low: true,
low_score: true,
lt: true,
lte: true,
machine: true,
manual: true,
match: true,
max: true,
'max-bytes': true,
'max-count': true,
'max-iterations': true,
'maxIterations reached — forcing final': true,
max_cost: true,
max_iterations: true,
max_tokens: true,
max_wallclock: true,
mcp: true,
medium: true,
memory: true,
memory_read: true,
memory_write: true,
mention: true,
menu: true,
message: true,
messages: true,
min: true,
missing: true,
'missing-column': true,
'missing-or-expired': true,
'missing-signature': true,
mock: true,
model: true,
'model-pick': true,
names: true,
'names-and-numbers': true,
narrative: true,
native: true,
ne: true,
'negative-claim': true,
'negative-claim-note': true,
'negative-prose-unverified': true,
'negative-recheck': true,
network: true,
'next-call': true,
'no-earlier-turn': true,
'no-identity': true,
'no-read': true,
'no-store': true,
'no-submission-this-turn': true,
'no-time-left': true,
noise: true,
none: true,
'not-applicable': true,
'not-assessed': true,
'not-entered': true,
'not-found': true,
'not-held': true,
'not-in-app-text': true,
'not-in-earlier-turns': true,
'not-in-result': true,
'not-needed': true,
'not-permitted': true,
'not-replayable': true,
'not-retryable': true,
'not-run': true,
'not-sure': true,
notIn: true,
nothing_found: true,
nudged: true,
number: true,
observe: true,
ok: true,
'on-tool-return': true,
'on-tool-status': true,
'only-in-model-answer': true,
ontology: true,
opa: true,
open: true,
openai: true,
opened: true,
operation: true,
'operations-full': true,
'outcome-unknown': true,
'outcomes-fn': true,
output: true,
'output-retry': true,
'over-budget': true,
'over-ceiling': true,
'over-char-budget': true,
'over-max-entries': true,
'over-size': true,
paged: true,
parked: true,
partial: true,
'partly-beyond-retention': true,
'partly-held': true,
pending: true,
period: true,
'period-beyond-retention': true,
'period-differs-from-asked': true,
'period-not-held': true,
'period-partly-held': true,
'period-shifted': true,
'period-undeclared': true,
'period-unknown': true,
permanent: true,
permission: true,
permission_granted: true,
permission_revoked: true,
persistent: true,
person: true,
phrase: true,
pinecone: true,
'placed-result': true,
policy: true,
'pool-full': true,
population: true,
'post-decide': true,
posture: true,
'pre-check': true,
predicate: true,
'predicate-threw': true,
'prefix-changed': true,
prepared: true,
'principal-full': true,
'prior-turn-evidence': true,
'propose-transition': true,
proposition: true,
prose: true,
provider: true,
put: true,
'python-fn': true,
qdrant: true,
query: true,
question: true,
quote: true,
'quote-not-found': true,
quoted: true,
rag: true,
rails: true,
ranking: true,
'rate-limited': true,
raw: true,
read_skill_result: true,
'record-composed': true,
recorded: true,
redacted_thinking: true,
refused: true,
'refused-before-execution': true,
registry: true,
'registry+injections': true,
'registry+provider+injections': true,
remote: true,
'reported-failure': true,
'reported-success': true,
request: true,
'request-unmatched': true,
'require-instruction': true,
result: true,
'result-period': true,
'result-shape': true,
retry: true,
'retry-other': true,
retryable: true,
returned: true,
reused: true,
'revision-asked': true,
rounded: true,
route: true,
rule: true,
'ruled-out': true,
run: true,
'run-end': true,
said: true,
'schema-validate': true,
scope: true,
score_low: true,
'script-match': true,
'script-unmatched': true,
'self-call': true,
semantic: true,
'sequence-changed': true,
server: true,
'server-404': true,
session: true,
'session-busy': true,
'session-end': true,
shared: true,
shutdown: true,
skill: true,
'skill-brains': true,
skill_activated: true,
skill_deactivated: true,
skill_inactive: true,
skill_read: true,
'sliding-window': true,
source: true,
'sources-conflict': true,
spelling: true,
'stage requested pause': true,
stale: true,
'stale-tools': true,
stay: true,
steering: true,
'step-nudge': true,
'steps-unfinished': true,
stop: true,
'stopped-early': true,
store: true,
structural: true,
subject: true,
submitted: true,
success: true,
sum: true,
summarize: true,
summarizing: true,
superseded: true,
system: true,
'system-prompt': true,
terminated: true,
text: true,
thinking: true,
'thinking-retired': true,
throttle: true,
tilde: true,
'timed-out': true,
timeout: true,
tokens: true,
'too-few': true,
tool: true,
'tool-call': true,
'tool-calls': true,
'tool-coverage': true,
'tool-proposal': true,
'tool-result': true,
toolCall: true,
tool_call: true,
tool_use: true,
tools: true,
'tools are off after the evidence revision (answer validation enforces) — forcing final': true,
topK: true,
'transport-forgot-handle': true,
tree: true,
ttl: true,
turn: true,
unavailable: true,
uncheckable: true,
undeclared: true,
'unit-scale': true,
unknown: true,
'unknown-fact': true,
'unknown-parent': true,
'unknown-result': true,
'unknown-skill': true,
'unknown-trigger-kind': true,
unlisted: true,
unmatched: true,
unreachable: true,
unrefuted: true,
'unsupported-argument': true,
'unsupported-claim': true,
'until-skill-exit': true,
unverified: true,
user: true,
user_data: true,
user_revoked: true,
'value-contingent': true,
'value-survived-revision': true,
'value-unsupported': true,
voyage: true,
wait: true,
'wait-limit': true,
warn: true,
weaviate: true,
window: true,
wire: true,
'wrap-up': true,
'wrapped-up': true,
write: true,
// @generated words — end
};
/** Every field name of the library's payloads, as a frozen record — see {@link FieldName}. */
const FIELDS = {
// @generated fields — start
about: true,
action: true,
actionTaken: true,
actions: true,
activeCount: true,
activeIds: true,
actor: true,
actual: true,
actualSummary: true,
addedIds: true,
admitted: true,
admittedCount: true,
advisory: true,
af_absent: true,
af_coverage: true,
af_semantics: true,
afterRefusals: true,
afterRevision: true,
against: true,
ageSeconds: true,
age_seconds: true,
agentId: true,
aggregate: true,
aggregation: true,
agrees: true,
aliases: true,
allowed: true,
alsoMatches: true,
anchor: true,
answerAssessment: true,
answerCoverage: true,
answerNegatives: true,
answeredBy: true,
answeredById: true,
any: true,
approved: true,
args: true,
argsFingerprint: true,
argument: true,
argumentsFailure: true,
argumentsFrom: true,
artifacts: true,
as: true,
asRecency: true,
asRole: true,
asked: true,
assertionCount: true,
assessment: true,
assistant: true,
assumed: true,
assumes: true,
at: true,
attempt: true,
attempts: true,
authoritative: true,
availableIds: true,
backoffMs: true,
base: true,
basis: true,
bears: true,
big: true,
binding: true,
blink: true,
block: true,
blockCount: true,
blockIndex: true,
blocks: true,
bold: true,
brain: true,
branch: true,
branchId: true,
branches: true,
brokenBy: true,
budget: true,
budgetSpent: true,
by: true,
bytes: true,
cache: true,
cacheRead: true,
cacheWrite: true,
called: true,
caller: true,
calls: true,
candidates: true,
candidatesComplete: true,
candidatesOmittedReason: true,
cannotCover: true,
cannot_cover: true,
cap: true,
capability: true,
carriedBy: true,
carriers: true,
cause: true,
changed: true,
changedArgKeys: true,
char: true,
charAt: true,
charCodeAt: true,
chars: true,
charsUsed: true,
chart_hint: true,
check: true,
checked: true,
checkerId: true,
checks: true,
childCount: true,
chosen: true,
citations: true,
claim: true,
claimed: true,
claims: true,
clarify: true,
client: true,
clientId: true,
closedFence: true,
code: true,
codePointAt: true,
coincides: true,
collapsed: true,
column: true,
columns: true,
complete: true,
completed: true,
componentId: true,
composition: true,
computed: true,
concat: true,
conditionalId: true,
conditions: true,
confidence: true,
conflictKeys: true,
consideredCount: true,
content: true,
contentDigest: true,
contentHash: true,
contentSummary: true,
contentWithheld: true,
continuity: true,
corpusEmpty: true,
correctiveMessageHash: true,
count: true,
coverage: true,
cumulative: true,
cumulativeRetries: true,
currentSkillId: true,
cursorMove: true,
custom: true,
decider: true,
decisive: true,
declaredOn: true,
declaredStatus: true,
declinedOffer: true,
deduplicated: true,
default: true,
definitions: true,
definitionsAgeMs: true,
delivery: true,
deliveryLease: true,
derivation: true,
description: true,
detail: true,
digest: true,
dimension: true,
dimensions: true,
direction: true,
dispatch: true,
dispatchTo: true,
dispatchToId: true,
disposition: true,
docUri: true,
draftWithheld: true,
droppedCount: true,
droppedIds: true,
droppedResume: true,
droppedSummaries: true,
durationMs: true,
during: true,
earlier: true,
earlierTurnRows: true,
edges: true,
effect: true,
embedderId: true,
end: true,
endpoint: true,
endsWith: true,
enforced: true,
entity: true,
ephemeral: true,
epoch: true,
error: true,
errorClass: true,
errorCode: true,
errorKind: true,
errorMessage: true,
errorName: true,
estimatedPromptTokens: true,
estimatedUsd: true,
evaluatedTotal: true,
evaluator: true,
evidence: true,
'evidence-recovery': true,
evidenceGate: true,
evidenceTruncated: true,
exitCode: true,
expect: true,
expected: true,
expiresAfter: true,
expiresAt: true,
explanation: true,
facet: true,
facets: true,
fact: true,
facts: true,
failed: true,
failure: true,
fallback: true,
fallbackConfigured: true,
fallbackErrorMessage: true,
field: true,
filter: true,
filter_note: true,
finalContent: true,
findings: true,
firstAgrees: true,
fixed: true,
flavor: true,
floor: true,
foldedExempt: true,
fontcolor: true,
fontsize: true,
foundedBy: true,
fractionOfCap: true,
free: true,
from: true,
fromAgentId: true,
fromProvider: true,
fromSkillId: true,
gap: true,
gaps: true,
gateId: true,
generation: true,
got: true,
grain: true,
guard: true,
guardsClosed: true,
hasProposition: true,
hash: true,
heading: true,
headroomChars: true,
held: true,
hidden: true,
hint: true,
history: true,
id: true,
idleCalls: true,
inProgress: true,
in_progress: true,
includes: true,
index: true,
indexOf: true,
initMs: true,
injectedBy: true,
injectedSystemPromptChars: true,
injectedTools: true,
injectionId: true,
input: true,
inputKind: true,
inputMemoryCount: true,
inputTokens: true,
instructionId: true,
instructions: true,
interval: true,
is_counter: true,
issues: true,
italics: true,
items: true,
iterIndex: true,
iteration: true,
iterationCount: true,
k: true,
key: true,
keyHash: true,
keyword: true,
kind: true,
label: true,
language: true,
lastError: true,
lastFiredAt: true,
lastIndexOf: true,
latencyMs: true,
layer: true,
layout: true,
length: true,
limit: true,
lines: true,
link: true,
llm: true,
localeCompare: true,
lookedFor: true,
lookedForRef: true,
lookedUp: true,
looked_for: true,
loopId: true,
losers: true,
lossy: true,
lostBy: true,
lostById: true,
malformed: true,
mapId: true,
match: true,
matchAll: true,
matched: true,
maxAttempts: true,
maxChars: true,
mayHaveRun: true,
measuredAt: true,
measured_at: true,
mediaType: true,
memories: true,
memory: true,
memoryId: true,
menuSize: true,
mergedBranchCount: true,
message: true,
messageIndex: true,
messages: true,
messagesCount: true,
metric: true,
metricId: true,
middleware: true,
missed: true,
mode: true,
model: true,
modelOverrides: true,
modelResult: true,
moment: true,
name: true,
namespace: true,
narrowBy: true,
narrowed: true,
narrowedSkipped: true,
nearTieMargin: true,
next: true,
nodes: true,
normalize: true,
notApplicable: true,
notChecked: true,
notDispatched: true,
notExecuted: true,
not_checked: true,
not_covered: true,
note: true,
notes: true,
occurrences: true,
of: true,
offered: true,
ok: true,
omitted: true,
on: true,
only: true,
ontology: true,
op: true,
openedBy: true,
orderingStrategy: true,
origin: true,
outcome: true,
output: true,
outputChars: true,
outputMemoryCount: true,
outputTokens: true,
overflowBy: true,
packVersion: true,
padEnd: true,
padStart: true,
page: true,
paging: true,
parallelCount: true,
parentId: true,
parentRefs: true,
passed: true,
path: true,
pausedCall: true,
pausedDurationMs: true,
payload: true,
pendingToolCalls: true,
period: true,
periods: true,
permission: true,
phase: true,
phraseId: true,
picked: true,
placement: true,
planAction: true,
policy: true,
policyEngine: true,
policyRuleId: true,
position: true,
posture: true,
predicate: true,
previous: true,
primary: true,
primaryErrorMessage: true,
priorFailures: true,
priorThinking: true,
projected: true,
protocol: true,
provenance: true,
provider: true,
providerId: true,
providerMeta: true,
providerName: true,
providerRequestRef: true,
providerResponseRef: true,
providerUsed: true,
queried: true,
queryHash: true,
question: true,
questionPayload: true,
rag: true,
ran: true,
rank: true,
rankPosition: true,
rationale: true,
rawContent: true,
rawOutput: true,
rawOutputPreview: true,
reachable: true,
reactMode: true,
readAt: true,
read_at: true,
reading: true,
reason: true,
reasons: true,
recipes: true,
recordings: true,
recoveredVia: true,
reengaged: true,
ref: true,
refs: true,
refsOmitted: true,
refusal: true,
refusalReason: true,
refusals: true,
refused: true,
region: true,
regionsDropped: true,
registry: true,
rejectedCount: true,
relevance: true,
remaining: true,
remote: true,
render: true,
repeat: true,
replace: true,
replaceAll: true,
replay: true,
request: true,
requestId: true,
requested: true,
requestedId: true,
resolved: true,
restsOn: true,
result: true,
resultFingerprint: true,
resultId: true,
resultSummary: true,
resultWithheld: true,
results: true,
resumeInput: true,
retriesRemaining: true,
retriesSpent: true,
retrieval: true,
retrievalScore: true,
retriever: true,
retryAfterMs: true,
retry_returns_the_same: true,
revalidated: true,
rewritten: true,
role: true,
routing: true,
rows: true,
rule: true,
runId: true,
runnerId: true,
runnerUp: true,
runtimeStageId: true,
salt: true,
schemaFrom: true,
schemaFromId: true,
scope: true,
score: true,
scoreEvidence: true,
scorer: true,
scores: true,
scripts: true,
scriptsDropped: true,
seam: true,
search: true,
sectionTag: true,
semantics: true,
sequenceLength: true,
series: true,
served: true,
server: true,
service: true,
serviceError: true,
sessionId: true,
setAside: true,
shape: true,
shapeHash: true,
short: true,
shown: true,
shownBytes: true,
signature: true,
sizeChars: true,
skill: true,
skillCatalog: true,
skillGraph: true,
skillId: true,
skippedCount: true,
skippedDetails: true,
slice: true,
slot: true,
small: true,
snapshot: true,
sort: true,
source: true,
sourceBreakdown: true,
sourceExportDate: true,
sourceId: true,
source_export_date: true,
sources: true,
span: true,
spenderTools: true,
split: true,
stage: true,
stagedInputs: true,
stagedRefs: true,
staleSince: true,
standing: true,
standingLineNames: true,
standings: true,
start: true,
startsWith: true,
state: true,
statedWaitMs: true,
statement: true,
status: true,
stay: true,
stayOffered: true,
steering: true,
step: true,
stopReason: true,
stoppedEarly: true,
strategy: true,
strategyId: true,
strategyKind: true,
stratum: true,
strike: true,
sub: true,
subflowId: true,
subject: true,
subjects: true,
substr: true,
substring: true,
summary: true,
sup: true,
supersededBy: true,
supersededIds: true,
survivalMs: true,
synthetic: true,
system: true,
systemPromptChars: true,
systemPromptText: true,
t: true,
target: true,
targetRef: true,
targetSkillId: true,
tellLLM: true,
temperature: true,
tenantChanged: true,
terminatedBy: true,
text: true,
thinking: true,
thinkingBlocks: true,
thinkingRetired: true,
threshold: true,
timeAxis: true,
timeChecks: true,
title: true,
to: true,
toAgentId: true,
toLocaleLowerCase: true,
toLocaleUpperCase: true,
toLowerCase: true,
toProvider: true,
toString: true,
toUpperCase: true,
tokenIndex: true,
tokens: true,
tokensInput: true,
tokensOutput: true,
tokensSpent: true,
tool: true,
'tool-result': true,
toolArgumentsFailure: true,
toolCallCount: true,
toolCallId: true,
toolCalls: true,
toolChars: true,
toolCount: true,
toolId: true,
toolName: true,
toolResultOrigin: true,
tools: true,
toolsCount: true,
toolset_name: true,
total: true,
totalBranchCount: true,
totalChars: true,
totalDurationMs: true,
totalInputTokens: true,
totalOutputTokens: true,
triggerKind: true,
triggerKindCounts: true,
trim: true,
trimEnd: true,
trimLeft: true,
trimRight: true,
trimStart: true,
truncated: true,
tryInstead: true,
tryInsteadTool: true,
try_instead: true,
try_instead_tool: true,
turn: true,
turnIndex: true,
type: true,
unit: true,
unknownId: true,
unreachable: true,
unsupported: true,
upgraded: true,
upstreamRef: true,
usage: true,
used: true,
user: true,
userPrompt: true,
value: true,
valueChars: true,
valueOf: true,
values: true,
verdict: true,
version: true,
via: true,
viaProtocol: true,
volunteeredId: true,
waitMs: true,
what: true,
why: true,
window: true,
winner: true,
withheldFromText: true,
withheldIds: true,
withheldReasons: true,
witness: true,
witnesses: true,
wonBy: true,
wonById: true,
wonId: true,
workExisted: true,
wrappedUp: true,
zone: true,
// @generated fields — end
};
Object.freeze(WORDS);
Object.freeze(FIELDS);
/** (a) The library's own words — one exported frozen set. */
export const LIBRARY_WORDS = WORDS;
/** The field names the library's payload types declare. */
export const FIELD_NAMES = FIELDS;
const has = (record, key) => Object.prototype.hasOwnProperty.call(record, key);
/** What one string is served as — itself when it is a library word, else the placeholder. */
export function servedString(value) {
return value === SERVED_PLACEHOLDER || has(WORDS, value) ? value : SERVED_PLACEHOLDER;
}
/** A walk deeper than this is not a record's data: served as the placeholder. */
const MAX_DEPTH = 64;
/**
* THE RULE — `value` with every string that is not a library word served as
* the placeholder, at every depth; numbers, booleans and null kept; a key
* that is not a payload field name checked like any string.
*
* Always a FRESH copy of plain data — never the object it was given: each
* value is read once (a getter is not asked twice), and only own enumerable
* string keys and array positions are copied, so nothing the walk did not
* check (a symbol key, a hidden property, a method on a list) rides along.
*/
export function keepKnownValues(value) {
return keep(value, 0);
}
function keep(value, depth) {
if (value === null || value === undefined)
return value;
switch (typeof value) {
case 'number':
case 'boolean':
return value;
case 'string':
return servedString(value);
case 'object':
break;
default:
// A function, a symbol, a bigint: nothing a record should hold.
return SERVED_PLACEHOLDER;
}
if (depth >= MAX_DEPTH)
return SERVED_PLACEHOLDER;
if (Array.isArray(value)) {
const list = value;
const length = list.length;
const items = [];
for (let i = 0; i < length; i++)
items.push(keep(list[i], depth + 1));
return items;
}
const proto = Object.getPrototypeOf(value);
if (proto !== Object.prototype && proto !== null)
return SERVED_PLACEHOLDER;
const record = value;
const copy = {};
let keptOutKeys = false;
for (const key of Object.keys(record)) {
// `__proto__` would set the copy's prototype, not a key: never data a record keeps.
const servedKey = key === '__proto__' ? SERVED_PLACEHOLDER : has(FIELDS, key) ? key : servedString(key);
if (servedKey === SERVED_PLACEHOLDER) {
// A key that is data and not known: kept out with its value.
keptOutKeys = true;
continue;
}
copy[servedKey] = keep(record[key], depth + 1);
}
if (keptOutKeys)
copy[SERVED_PLACEHOLDER] = SERVED_PLACEHOLDER;
return copy;
}
//# sourceMappingURL=knownStrings.js.map