agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
173 lines • 17.3 kB
JavaScript
;
/**
* agentfootprint Injection Engine — public barrel.
*
* The unifying primitive of agentfootprint context engineering.
* One `Injection` type. One `InjectionEngine` subflow. N typed sugar
* factories. See `README.md` in this folder for the full concept.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.constrainedEnumPick = exports.llmClassifier = exports.validateIntentScores = exports.CLASSIFIER_SCORER_UNAVAILABLE = exports.CLASSIFIER_SCORER_QUESTION = exports.classifierScorer = exports.rankEntries = exports.embeddingScorer = exports.keywordScorer = exports.classifySkillTarget = exports.SKILL_GRAPH_DEFERRED_CONTRACT_KEY = exports.plainGuardCaption = exports.GUARD_HOP_KEYS = exports.SKILL_GRAPH_METADATA_KEY = exports.formatCheckup = exports.decideSkill = exports.defineSkillMap = exports.skillGraph = exports.defineInjection = exports.defineFact = exports.defineSteering = exports.useSkillGraphDevMode = exports.TOOL_RESULT_STATUSES = exports.readSkillDescriptor = exports.listSkillsDescriptor = exports.buildSkipStepTool = exports.buildReadSkillTool = exports.buildListSkillsTool = exports.runbookFromDir = exports.skillsFromDir = exports.SkillRegistry = exports.vocabularyOf = exports.checkArtifactVocabularies = exports.STEPS_HINT_METADATA_KEY = exports.defineStepsHint = exports.skipStepDescriptor = exports.SKIP_STEP_TOOL_NAME = exports.pointerOf = exports.resolveSurfaceMode = exports.defineSkill = exports.MENU_HINT_METADATA_KEY = exports.defineMenuHint = exports.READS_ENTRY_SCORES_METADATA_KEY = exports.defineRelevanceHint = exports.defineInstruction = exports.buildInjectionEngineSubflow = exports.evaluateInjections = exports.saidByPerson = exports.toolResultsOf = exports.projectActiveInjection = void 0;
exports.skillToolNames = exports.checkSkillContracts = exports.checkSkillContract = exports.menuOutstanding = exports.decideTier2 = exports.DEFAULT_ROUTING_POLICY = exports.MENU_SIZE = exports.NEAR_TIE_MARGIN = void 0;
// Bind the pure core's dev-warn seam to footprintjs's `isDevMode` (9.34.0).
// Side-effect import, on purpose: the skill-graph core no longer imports the
// engine, so SOMEONE has to hand it the dev flag, and this barrel is on every
// path inside this package that can reach `skillGraph()`. Without it,
// `enableDevMode()` would stop switching skill-graph warnings on — the one
// behavior the fence refactor must not change. `agentfootprint/skill-graph`
// deliberately skips it; see `devWarn.ts`.
require("./devWarnHost.js");
// POJO projection — used by slot subflows + advanced consumers
var types_js_1 = require("./types.js");
Object.defineProperty(exports, "projectActiveInjection", { enumerable: true, get: function () { return types_js_1.projectActiveInjection; } });
// The iteration's tool-result batch with the singular fallback applied
// (9.16.0) — the one reader `rule` predicates should use to see every call of
// a parallel batch, not only the last (`ctx.toolResults ?? [ctx.lastToolResult]`).
var types_js_2 = require("./types.js");
Object.defineProperty(exports, "toolResultsOf", { enumerable: true, get: function () { return types_js_2.toolResultsOf; } });
// The messages a PERSON wrote (9.84.0) — the one reader for a predicate that
// judges what was said. `ctx.history` also holds the five user-role messages
// this library writes itself (compaction frame, drop notice, schema-check
// correction, evidence-check correction, delivered message), and a rule
// scanning it raw matches our own bookkeeping.
var types_js_3 = require("./types.js");
Object.defineProperty(exports, "saidByPerson", { enumerable: true, get: function () { return types_js_3.saidByPerson; } });
// Engine
var evaluator_js_1 = require("./evaluator.js");
Object.defineProperty(exports, "evaluateInjections", { enumerable: true, get: function () { return evaluator_js_1.evaluateInjections; } });
var buildInjectionEngineSubflow_js_1 = require("./buildInjectionEngineSubflow.js");
Object.defineProperty(exports, "buildInjectionEngineSubflow", { enumerable: true, get: function () { return buildInjectionEngineSubflow_js_1.buildInjectionEngineSubflow; } });
// Sugar factories — Ships four; more flavors planned (RAG / Memory / Guardrail)
var defineInstruction_js_1 = require("./factories/defineInstruction.js");
Object.defineProperty(exports, "defineInstruction", { enumerable: true, get: function () { return defineInstruction_js_1.defineInstruction; } });
var defineRelevanceHint_js_1 = require("./factories/defineRelevanceHint.js");
Object.defineProperty(exports, "defineRelevanceHint", { enumerable: true, get: function () { return defineRelevanceHint_js_1.defineRelevanceHint; } });
Object.defineProperty(exports, "READS_ENTRY_SCORES_METADATA_KEY", { enumerable: true, get: function () { return defineRelevanceHint_js_1.READS_ENTRY_SCORES_METADATA_KEY; } });
var defineMenuHint_js_1 = require("./factories/defineMenuHint.js");
Object.defineProperty(exports, "defineMenuHint", { enumerable: true, get: function () { return defineMenuHint_js_1.defineMenuHint; } });
Object.defineProperty(exports, "MENU_HINT_METADATA_KEY", { enumerable: true, get: function () { return defineMenuHint_js_1.MENU_HINT_METADATA_KEY; } });
var defineSkill_js_1 = require("./factories/defineSkill.js");
Object.defineProperty(exports, "defineSkill", { enumerable: true, get: function () { return defineSkill_js_1.defineSkill; } });
Object.defineProperty(exports, "resolveSurfaceMode", { enumerable: true, get: function () { return defineSkill_js_1.resolveSurfaceMode; } });
// Steps-as-data (9.18.0) — the procedure grammar. `skillSteps.ts` is the ONE
// owner of the types, the pointer's shape and every sentence the model reads;
// the public slice here is what a consumer needs to DECLARE steps, READ the
// pointer off a snapshot (`pointerOf(sharedState.stepPointer)`), and compose
// the integrity tool into custom wiring (the buildReadSkillTool precedent).
var skillSteps_js_1 = require("./skillSteps.js");
Object.defineProperty(exports, "pointerOf", { enumerable: true, get: function () { return skillSteps_js_1.pointerOf; } });
Object.defineProperty(exports, "SKIP_STEP_TOOL_NAME", { enumerable: true, get: function () { return skillSteps_js_1.SKIP_STEP_TOOL_NAME; } });
Object.defineProperty(exports, "skipStepDescriptor", { enumerable: true, get: function () { return skillSteps_js_1.skipStepDescriptor; } });
var defineStepsHint_js_1 = require("./factories/defineStepsHint.js");
Object.defineProperty(exports, "defineStepsHint", { enumerable: true, get: function () { return defineStepsHint_js_1.defineStepsHint; } });
Object.defineProperty(exports, "STEPS_HINT_METADATA_KEY", { enumerable: true, get: function () { return defineStepsHint_js_1.STEPS_HINT_METADATA_KEY; } });
// Artifact vocabularies (9.25.0) — `produces`/`consumes` on a skill or a step.
// The public slice is what a consumer needs to READ a skill's declared data
// legs off its metadata (`vocabularyOf`, for a lens or an inventory) and to run
// the satisfiability check itself over a list of skills the library did not
// assemble. `assertArtifactVocabulary` stays private: it is the authoring-time
// refusal `defineSkill` already applies.
var skillVocabulary_js_1 = require("./skillVocabulary.js");
Object.defineProperty(exports, "checkArtifactVocabularies", { enumerable: true, get: function () { return skillVocabulary_js_1.checkArtifactVocabularies; } });
Object.defineProperty(exports, "vocabularyOf", { enumerable: true, get: function () { return skillVocabulary_js_1.vocabularyOf; } });
var SkillRegistry_js_1 = require("./SkillRegistry.js");
Object.defineProperty(exports, "SkillRegistry", { enumerable: true, get: function () { return SkillRegistry_js_1.SkillRegistry; } });
// File-authored skills — a loader over `defineSkill`, not a second mechanism.
// Node-only (reads the filesystem); node:fs is imported lazily inside the call
// so this barrel stays safe to import from a browser bundle.
// `runbookFromDir` is the same loader read as a whole runbook — skills PLUS the
// edges each file's `routes:` declares, ready for `skillGraph({ ...runbook })`.
var skillsFromDir_js_1 = require("./skillsFromDir.js");
Object.defineProperty(exports, "skillsFromDir", { enumerable: true, get: function () { return skillsFromDir_js_1.skillsFromDir; } });
Object.defineProperty(exports, "runbookFromDir", { enumerable: true, get: function () { return skillsFromDir_js_1.runbookFromDir; } });
// Skill-tool builders — used by SkillRegistry.toTools() and the Agent's
// auto-attach path. Exported so consumers building custom tool wiring
// (e.g., gatedTools chains) can compose the same `list_skills` /
// `read_skill` tools directly.
var skillTools_js_1 = require("./skillTools.js");
Object.defineProperty(exports, "buildListSkillsTool", { enumerable: true, get: function () { return skillTools_js_1.buildListSkillsTool; } });
Object.defineProperty(exports, "buildReadSkillTool", { enumerable: true, get: function () { return skillTools_js_1.buildReadSkillTool; } });
Object.defineProperty(exports, "buildSkipStepTool", { enumerable: true, get: function () { return skillTools_js_1.buildSkipStepTool; } });
// The graph's own DESCRIPTIONS of the tools it needs (9.34.0) — the POJOs the
// builders above wrap. Exported because a host composing its own tool objects
// (another framework, a custom ToolProvider) should read `read_skill`'s enum,
// reachability offer and result sentences from the library rather than
// re-writing them. Also the whole surface of `agentfootprint/skill-graph`.
var skillToolDescriptors_js_1 = require("./skillToolDescriptors.js");
Object.defineProperty(exports, "listSkillsDescriptor", { enumerable: true, get: function () { return skillToolDescriptors_js_1.listSkillsDescriptor; } });
Object.defineProperty(exports, "readSkillDescriptor", { enumerable: true, get: function () { return skillToolDescriptors_js_1.readSkillDescriptor; } });
var toolOutcome_js_1 = require("../semantics/toolOutcome.js");
Object.defineProperty(exports, "TOOL_RESULT_STATUSES", { enumerable: true, get: function () { return toolOutcome_js_1.TOOL_RESULT_STATUSES; } });
var devWarn_js_1 = require("./devWarn.js");
Object.defineProperty(exports, "useSkillGraphDevMode", { enumerable: true, get: function () { return devWarn_js_1.useSkillGraphDevMode; } });
var defineSteering_js_1 = require("./factories/defineSteering.js");
Object.defineProperty(exports, "defineSteering", { enumerable: true, get: function () { return defineSteering_js_1.defineSteering; } });
var defineFact_js_1 = require("./factories/defineFact.js");
Object.defineProperty(exports, "defineFact", { enumerable: true, get: function () { return defineFact_js_1.defineFact; } });
// Unified factory — a `type` discriminant routes to the four named factories
// above. Use when the flavor is chosen programmatically; prefer the named
// factories when you know the flavor at author time.
var defineInjection_js_1 = require("./factories/defineInjection.js");
Object.defineProperty(exports, "defineInjection", { enumerable: true, get: function () { return defineInjection_js_1.defineInjection; } });
// Declarative skill graph (proposal 002) — declare skills + routing edges →
// graph-derived triggers + a drawable topology. Sugar over the trigger model.
var skillGraph_js_1 = require("./skillGraph.js");
Object.defineProperty(exports, "skillGraph", { enumerable: true, get: function () { return skillGraph_js_1.skillGraph; } });
// The official vocabulary (9.51.0): you declare the SkillMap; the agent is
// the SkillWalker; the recording carries both. `defineSkillMap` is a
// permanent reference-equal alias of `skillGraph`, `SkillMap` of
// `SkillGraph` — both names ship forever, neither is a rename.
Object.defineProperty(exports, "defineSkillMap", { enumerable: true, get: function () { return skillGraph_js_1.defineSkillMap; } });
Object.defineProperty(exports, "decideSkill", { enumerable: true, get: function () { return skillGraph_js_1.decideSkill; } });
// 8.7.0 — render a `graph.checkup()` for a log line or a CI failure. The formatter
// the library itself uses; without it every consumer wrote their own. `checkupGraph`
// stays private: its input is the graph's internal wiring shape, and `graph.checkup()`
// is already the door to it.
Object.defineProperty(exports, "formatCheckup", { enumerable: true, get: function () { return skillGraph_js_1.formatCheckup; } });
Object.defineProperty(exports, "SKILL_GRAPH_METADATA_KEY", { enumerable: true, get: function () { return skillGraph_js_1.SKILL_GRAPH_METADATA_KEY; } });
// Guards-as-data on route edges (9.51.0) — the SkillWalker's guard mover as
// data: `guard:` beside the code `when`, compiled once into the predicate,
// the serializable `SkillGuardData` (edges/provenance/`skill.graph_declared`)
// and the per-condition evidence (`cursorMove.guard`/`guardsClosed`).
Object.defineProperty(exports, "GUARD_HOP_KEYS", { enumerable: true, get: function () { return skillGraph_js_1.GUARD_HOP_KEYS; } });
Object.defineProperty(exports, "plainGuardCaption", { enumerable: true, get: function () { return skillGraph_js_1.plainGuardCaption; } });
// The graph's note that its body-contract checks wait for Agent build (present
// only when built without `knownTools`) — see SkillGraph.deferredBodyContract.
// The note rides the graph AND each compiled skill's metadata (under
// SKILL_GRAPH_DEFERRED_CONTRACT_KEY), so Agent build honors it whichever way
// the skills arrive — `.skillGraph(graph)` or `.skills({ list: () => graph.skills })`.
Object.defineProperty(exports, "SKILL_GRAPH_DEFERRED_CONTRACT_KEY", { enumerable: true, get: function () { return skillGraph_js_1.SKILL_GRAPH_DEFERRED_CONTRACT_KEY; } });
// The ONE owner of "is this target the cursor?" (9.86.0) — every gate,
// description and refusal switches on it instead of re-deriving it.
Object.defineProperty(exports, "classifySkillTarget", { enumerable: true, get: function () { return skillGraph_js_1.classifySkillTarget; } });
var entryScorer_js_1 = require("./entryScorer.js");
Object.defineProperty(exports, "keywordScorer", { enumerable: true, get: function () { return entryScorer_js_1.keywordScorer; } });
Object.defineProperty(exports, "embeddingScorer", { enumerable: true, get: function () { return entryScorer_js_1.embeddingScorer; } });
Object.defineProperty(exports, "rankEntries", { enumerable: true, get: function () { return entryScorer_js_1.rankEntries; } });
var classifierScorer_js_1 = require("./classifierScorer.js");
Object.defineProperty(exports, "classifierScorer", { enumerable: true, get: function () { return classifierScorer_js_1.classifierScorer; } });
Object.defineProperty(exports, "CLASSIFIER_SCORER_QUESTION", { enumerable: true, get: function () { return classifierScorer_js_1.CLASSIFIER_SCORER_QUESTION; } });
Object.defineProperty(exports, "CLASSIFIER_SCORER_UNAVAILABLE", { enumerable: true, get: function () { return classifierScorer_js_1.CLASSIFIER_SCORER_UNAVAILABLE; } });
// The turn-start routing cascade (SG-C, 9.17.0) — the intent-scorer port +
// the built-in LLM classifier, the tie policy that judges tier 2, and the
// graph surfaces the agent consumes. keywordScorer/embeddingScorer above ARE
// IntentScorers too (same factories, a second arity).
var intentScorer_js_1 = require("./intentScorer.js");
Object.defineProperty(exports, "validateIntentScores", { enumerable: true, get: function () { return intentScorer_js_1.validateIntentScores; } });
var llmClassifier_js_1 = require("./llmClassifier.js");
Object.defineProperty(exports, "llmClassifier", { enumerable: true, get: function () { return llmClassifier_js_1.llmClassifier; } });
// The constrained-enum machinery behind the classifier AND the tier-3
// decider (9.19.0) — one model call that can only answer from a fixed list.
var constrainedEnumPick_js_1 = require("./constrainedEnumPick.js");
Object.defineProperty(exports, "constrainedEnumPick", { enumerable: true, get: function () { return constrainedEnumPick_js_1.constrainedEnumPick; } });
var routingPolicy_js_1 = require("./routingPolicy.js");
Object.defineProperty(exports, "NEAR_TIE_MARGIN", { enumerable: true, get: function () { return routingPolicy_js_1.NEAR_TIE_MARGIN; } });
Object.defineProperty(exports, "MENU_SIZE", { enumerable: true, get: function () { return routingPolicy_js_1.MENU_SIZE; } });
Object.defineProperty(exports, "DEFAULT_ROUTING_POLICY", { enumerable: true, get: function () { return routingPolicy_js_1.DEFAULT_ROUTING_POLICY; } });
Object.defineProperty(exports, "decideTier2", { enumerable: true, get: function () { return routingPolicy_js_1.decideTier2; } });
Object.defineProperty(exports, "menuOutstanding", { enumerable: true, get: function () { return routingPolicy_js_1.menuOutstanding; } });
var skillContract_js_1 = require("./skillContract.js");
Object.defineProperty(exports, "checkSkillContract", { enumerable: true, get: function () { return skillContract_js_1.checkSkillContract; } });
Object.defineProperty(exports, "checkSkillContracts", { enumerable: true, get: function () { return skillContract_js_1.checkSkillContracts; } });
Object.defineProperty(exports, "skillToolNames", { enumerable: true, get: function () { return skillContract_js_1.skillToolNames; } });
//# sourceMappingURL=index.js.map