agentfootprint 8.6.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/CLAUDE.md +1 -1
- package/README.md +1 -1
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/core/agent/AgentBuilder.js +104 -0
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/slots/buildToolsSlot.js +77 -0
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.js +104 -0
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/slots/buildToolsSlot.js +78 -1
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +29 -0
- package/dist/esm/events/registry.d.ts +3 -1
- package/dist/esm/events/registry.js +2 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/lib/injection-engine/factories/defineRelevanceHint.d.ts +15 -0
- package/dist/esm/lib/injection-engine/factories/defineRelevanceHint.js +16 -0
- package/dist/esm/lib/injection-engine/factories/defineRelevanceHint.js.map +1 -1
- package/dist/esm/lib/injection-engine/factories/defineSkill.d.ts +9 -0
- package/dist/esm/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/esm/lib/injection-engine/index.d.ts +3 -3
- package/dist/esm/lib/injection-engine/index.js +8 -3
- package/dist/esm/lib/injection-engine/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillContract.d.ts +25 -2
- package/dist/esm/lib/injection-engine/skillContract.js +11 -4
- package/dist/esm/lib/injection-engine/skillContract.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillGraph.d.ts +65 -4
- package/dist/esm/lib/injection-engine/skillGraph.js +36 -11
- package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillGraphCheckup.d.ts +47 -7
- package/dist/esm/lib/injection-engine/skillGraphCheckup.js +165 -13
- package/dist/esm/lib/injection-engine/skillGraphCheckup.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillsFromDir.d.ts +24 -0
- package/dist/esm/lib/injection-engine/skillsFromDir.js +19 -0
- package/dist/esm/lib/injection-engine/skillsFromDir.js.map +1 -1
- package/dist/esm/lib/injection-engine/types.d.ts +8 -0
- package/dist/esm/lib/injection-engine/types.js.map +1 -1
- package/dist/esm/tool-providers/index.d.ts +1 -1
- package/dist/esm/tool-providers/index.js +4 -1
- package/dist/esm/tool-providers/index.js.map +1 -1
- package/dist/esm/tool-providers/skillScopedTools.d.ts +4 -0
- package/dist/esm/tool-providers/skillScopedTools.js +33 -2
- package/dist/esm/tool-providers/skillScopedTools.js.map +1 -1
- package/dist/esm/tool-providers/types.d.ts +25 -0
- package/dist/events/registry.js +2 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/lib/injection-engine/factories/defineRelevanceHint.js +17 -1
- package/dist/lib/injection-engine/factories/defineRelevanceHint.js.map +1 -1
- package/dist/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/lib/injection-engine/index.js +7 -1
- package/dist/lib/injection-engine/index.js.map +1 -1
- package/dist/lib/injection-engine/skillContract.js +11 -4
- package/dist/lib/injection-engine/skillContract.js.map +1 -1
- package/dist/lib/injection-engine/skillGraph.js +37 -11
- package/dist/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/lib/injection-engine/skillGraphCheckup.js +165 -13
- package/dist/lib/injection-engine/skillGraphCheckup.js.map +1 -1
- package/dist/lib/injection-engine/skillsFromDir.js +19 -0
- package/dist/lib/injection-engine/skillsFromDir.js.map +1 -1
- package/dist/lib/injection-engine/types.js.map +1 -1
- package/dist/tool-providers/index.js +5 -1
- package/dist/tool-providers/index.js.map +1 -1
- package/dist/tool-providers/skillScopedTools.js +35 -3
- package/dist/tool-providers/skillScopedTools.js.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +29 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +3 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/factories/defineRelevanceHint.d.ts +15 -0
- package/dist/types/lib/injection-engine/factories/defineRelevanceHint.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts +9 -0
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/index.d.ts +3 -3
- package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillContract.d.ts +25 -2
- package/dist/types/lib/injection-engine/skillContract.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillGraph.d.ts +65 -4
- package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillGraphCheckup.d.ts +47 -7
- package/dist/types/lib/injection-engine/skillGraphCheckup.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillsFromDir.d.ts +24 -0
- package/dist/types/lib/injection-engine/skillsFromDir.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/types.d.ts +8 -0
- package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
- package/dist/types/tool-providers/index.d.ts +1 -1
- package/dist/types/tool-providers/index.d.ts.map +1 -1
- package/dist/types/tool-providers/skillScopedTools.d.ts +4 -0
- package/dist/types/tool-providers/skillScopedTools.d.ts.map +1 -1
- package/dist/types/tool-providers/types.d.ts +25 -0
- package/dist/types/tool-providers/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -50,6 +50,7 @@ import type { Injection, InjectionContext } from './types.js';
|
|
|
50
50
|
import type { Embedder } from '../../memory/embedding/types.js';
|
|
51
51
|
import type { EntryScore, EntryScoring, EntryScorer } from './entryScorer.js';
|
|
52
52
|
import { type GraphCheckup } from './skillGraphCheckup.js';
|
|
53
|
+
export { formatCheckup } from './skillGraphCheckup.js';
|
|
53
54
|
export type { GraphCheckup, GraphProblem, GraphProblemCode } from './skillGraphCheckup.js';
|
|
54
55
|
/** How `.build({ check })` reacts to the graph check-up. */
|
|
55
56
|
export type GraphCheckMode = 'throw' | 'warn' | 'off';
|
|
@@ -60,9 +61,36 @@ export interface BuildOptions {
|
|
|
60
61
|
* • `'throw'` — throw if any ERROR-level problem (unknown-skill / no-entry);
|
|
61
62
|
* • `'warn'` — console.warn every problem in dev mode (`enableDevMode()`), silent otherwise;
|
|
62
63
|
* • `'off'` — skip it entirely.
|
|
63
|
-
*
|
|
64
|
+
*
|
|
65
|
+
* **Default `'throw'` since 8.7.0** (was `'warn'`), matching the object-literal
|
|
66
|
+
* form. A graph with an error-level problem cannot start a turn at all, and under
|
|
67
|
+
* the old default it built silently outside dev mode and failed at run time
|
|
68
|
+
* instead. `'warn'` still means exactly what it says — never throws — so an
|
|
69
|
+
* explicit `check: 'warn'` keeps the old soft behavior.
|
|
70
|
+
*
|
|
71
|
+
* `graph.checkup()` is always available regardless.
|
|
64
72
|
*/
|
|
65
73
|
readonly check?: GraphCheckMode;
|
|
74
|
+
/**
|
|
75
|
+
* Tool names the AGENT exposes to every skill (`.tool()` / `.tools()` / a baseline
|
|
76
|
+
* `ToolProvider`). Without them the skill-body contract check reads a body's
|
|
77
|
+
* `lookup_order(id)` as a typo, because the graph only knows the tools its own
|
|
78
|
+
* skills carry. Same field as `checkup({ knownTools })` — see `SkillGraph.checkup`.
|
|
79
|
+
*/
|
|
80
|
+
readonly knownTools?: readonly string[];
|
|
81
|
+
}
|
|
82
|
+
/** Options for `graph.checkup()`. */
|
|
83
|
+
export interface CheckupOptions {
|
|
84
|
+
/**
|
|
85
|
+
* Tool names the AGENT exposes to every skill — `.tool()` / `.tools()`
|
|
86
|
+
* registrations and any always-on `ToolProvider`. A skill body may name them
|
|
87
|
+
* freely: they are callable from every skill, so they are neither `body-unknown-tool`
|
|
88
|
+
* (they exist) nor `body-foreign-tool` (they are not somebody else's).
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* graph.checkup({ knownTools: ['lookup_order', 'list_skills'] });
|
|
92
|
+
*/
|
|
93
|
+
readonly knownTools?: readonly string[];
|
|
66
94
|
}
|
|
67
95
|
/** Where a turn starts, in the object-literal (flat) form. */
|
|
68
96
|
export type SkillGraphStart = string | {
|
|
@@ -102,7 +130,12 @@ export interface SkillGraphFlatConfig {
|
|
|
102
130
|
/** Tool-result transitions; `from`/`to` are skill ids resolved against `skills`. */
|
|
103
131
|
readonly steps?: readonly SkillGraphStep[];
|
|
104
132
|
readonly tree?: never;
|
|
133
|
+
/** `tree`-only (there are no leaves to scope here) — typed `never` so the
|
|
134
|
+
* contradiction is a compile error, the same way `tree` is on this arm. */
|
|
135
|
+
readonly scopeTools?: never;
|
|
105
136
|
readonly check?: GraphCheckMode;
|
|
137
|
+
/** Baseline agent tool names — see {@link BuildOptions.knownTools}. */
|
|
138
|
+
readonly knownTools?: readonly string[];
|
|
106
139
|
}
|
|
107
140
|
/**
|
|
108
141
|
* Object-literal form, TREE arm — a decision tree owns the routing, so there is
|
|
@@ -115,9 +148,18 @@ export interface SkillGraphTreeConfig {
|
|
|
115
148
|
readonly skills: readonly Injection[];
|
|
116
149
|
/** A decision tree (instead of `start` + `steps`). */
|
|
117
150
|
readonly tree: DecisionNode | Injection;
|
|
151
|
+
/**
|
|
152
|
+
* Scope each leaf's tools to the routed leaf. The object form's half of
|
|
153
|
+
* `.tree(root, { scopeTools })` — added in 8.7.0, because until then this form
|
|
154
|
+
* hard-coded `true` and the fluent form's only opt-out had no object-form twin.
|
|
155
|
+
* Default `true`. See {@link TreeOptions.scopeTools}.
|
|
156
|
+
*/
|
|
157
|
+
readonly scopeTools?: boolean;
|
|
118
158
|
readonly start?: never;
|
|
119
159
|
readonly steps?: never;
|
|
120
160
|
readonly check?: GraphCheckMode;
|
|
161
|
+
/** Baseline agent tool names — see {@link BuildOptions.knownTools}. */
|
|
162
|
+
readonly knownTools?: readonly string[];
|
|
121
163
|
}
|
|
122
164
|
/**
|
|
123
165
|
* Object-literal form of a skill graph — an alternative to the fluent builder.
|
|
@@ -299,6 +341,14 @@ export interface SkillGraph {
|
|
|
299
341
|
* route triggers and the agent loop's cursor-update stage, so the two can never
|
|
300
342
|
* disagree. Flat entry/route graphs only; a decision `tree()` routes per-iteration
|
|
301
343
|
* by predicate (no cursor) and returns the unchanged `ctx.currentSkillId`.
|
|
344
|
+
*
|
|
345
|
+
* **The cursor is PER RUN.** It describes where the graph is inside ONE
|
|
346
|
+
* `agent.run()`, across that run's iterations. A second `run()` on the same agent
|
|
347
|
+
* starts cold — at the entry — whatever skill the first run ended on: a skill graph
|
|
348
|
+
* is a per-turn state machine, not conversation memory, and `currentSkillId` lives
|
|
349
|
+
* in the run's own state. To resume where the last turn stopped, persist the id
|
|
350
|
+
* yourself and start the next turn's graph from it (`start: { rules: [...] }`);
|
|
351
|
+
* nothing in the graph will carry it across for you.
|
|
302
352
|
*/
|
|
303
353
|
nextSkill(ctx: InjectionContext): string | undefined;
|
|
304
354
|
/**
|
|
@@ -347,10 +397,21 @@ export interface SkillGraph {
|
|
|
347
397
|
/**
|
|
348
398
|
* Build-time check-up — inspect the declared graph for wiring mistakes (a skill
|
|
349
399
|
* nobody can reach, an edge to an unknown skill, two un-prioritized edges from one
|
|
350
|
-
* skill, no entry, a self-loop
|
|
351
|
-
*
|
|
400
|
+
* skill, no entry, a self-loop, an entry menu with no way to choose from it, a
|
|
401
|
+
* transition the cold-start cursor can never take). Pure + side-effect-free; call
|
|
402
|
+
* it whenever. `ok` is false iff there's an error-level problem (`unknown-skill` /
|
|
403
|
+
* `no-entry`) — everything else is a warning, because a graph the model can still
|
|
404
|
+
* navigate is not a broken graph.
|
|
405
|
+
*
|
|
406
|
+
* Pass `knownTools` when the agent registers baseline tools with `.tool()`: the
|
|
407
|
+
* graph only knows the tools its own skills carry, so without them a body that
|
|
408
|
+
* says `lookup_order(id)` is reported as naming a tool that exists nowhere.
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* const report = graph.checkup({ knownTools: ['lookup_order'] });
|
|
412
|
+
* if (!report.ok) throw new Error(formatCheckup(report));
|
|
352
413
|
*/
|
|
353
|
-
checkup(): GraphCheckup;
|
|
414
|
+
checkup(options?: CheckupOptions): GraphCheckup;
|
|
354
415
|
}
|
|
355
416
|
export interface SkillGraphBuilder {
|
|
356
417
|
/** Mark a skill as reachable at turn start (optionally intent-conditional). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillGraph.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/skillGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAoB,MAAM,YAAY,CAAC;AAChF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,
|
|
1
|
+
{"version":3,"file":"skillGraph.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/skillGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAoB,MAAM,YAAY,CAAC;AAChF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,YAAY,E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;IACrE,gFAAgF;IAChF,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAAC;IACnF;;;8EAG0E;IAC1E,IAAI,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAAC;IAC5E;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,EAAE,WAAW,GAAG,iBAAiB,CAAC;IAChD;;;;;OAKG;IACH,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,CAAC;IACxD;;;;;;;;;;;;;OAaG;IACH,WAAW,IAAI,iBAAiB,CAAC;IACjC,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACxC;AAkCD,wBAAgB,UAAU,IAAI,iBAAiB,CAAC;AAChD,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CAAC"}
|
|
@@ -3,17 +3,36 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Pure + side-effect-free. Catches wiring mistakes at authoring time instead of
|
|
5
5
|
* mid-run: a skill nobody can reach, an edge to a skill that isn't in the graph,
|
|
6
|
-
* two un-prioritized edges leaving one skill, a graph with no start, a self-loop
|
|
6
|
+
* two un-prioritized edges leaving one skill, a graph with no start, a self-loop,
|
|
7
|
+
* an entry menu with no way to choose from it, a transition the cursor can never take.
|
|
7
8
|
*
|
|
8
9
|
* Surfaced two ways:
|
|
9
10
|
* • `graph.checkup()` → `{ ok, problems }` — always available, call it whenever.
|
|
10
11
|
* • `.build({ check: 'throw' | 'warn' | 'off' })` — run it at build time.
|
|
11
12
|
*
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* **Only `unknown-skill` and `no-entry` are ERRORS.** Everything else is a WARNING,
|
|
14
|
+
* and deliberately so: this file reports what it can PROVE from the declaration, and
|
|
15
|
+
* a graph the model can still navigate is not a broken graph. `unreachable-skill`,
|
|
16
|
+
* `model-edge-only` and `dead-entry-step` all describe skills or transitions that
|
|
17
|
+
* deterministic routing cannot reach — but `read_skill` can, so calling them errors
|
|
18
|
+
* would claim more than the declaration supports.
|
|
19
|
+
*
|
|
20
|
+
* ## What "reachable" means here (8.7.0)
|
|
21
|
+
*
|
|
22
|
+
* The BFS walks **deterministic** edges only — an edge with a `when` or an
|
|
23
|
+
* `onToolReturn`. A bare `.route(a, b)` compiles to no trigger at all (`b` keeps its
|
|
24
|
+
* `llm-activated` default), so counting it as reachability answered a question nobody
|
|
25
|
+
* asked: the graph does not route there, the model does. Bare edges get their own
|
|
26
|
+
* code, `model-edge-only`, which says exactly that and names the one cursor position
|
|
27
|
+
* the gate will grant the jump from.
|
|
15
28
|
*/
|
|
16
|
-
|
|
29
|
+
/**
|
|
30
|
+
* The compiled trigger kinds this file needs to tell apart. Mirrors
|
|
31
|
+
* `InjectionTrigger['kind']` without importing it — the check-up is pure over
|
|
32
|
+
* strings and must not depend on the engine's types.
|
|
33
|
+
*/
|
|
34
|
+
export type CheckupTriggerKind = 'always' | 'rule' | 'on-tool-return' | 'llm-activated';
|
|
35
|
+
export type GraphProblemCode = 'unknown-skill' | 'no-entry' | 'unreachable-skill' | 'model-edge-only' | 'multi-entry-fanout' | 'dead-entry-step' | 'ambiguous-routes' | 'self-loop' | 'body-foreign-tool' | 'body-unknown-tool';
|
|
17
36
|
/** One issue found by the check-up. `kind: 'error'` fails `ok` (and `'throw'`). */
|
|
18
37
|
export interface GraphProblem {
|
|
19
38
|
readonly kind: 'error' | 'warning';
|
|
@@ -29,11 +48,17 @@ export interface GraphCheckup {
|
|
|
29
48
|
readonly ok: boolean;
|
|
30
49
|
readonly problems: readonly GraphProblem[];
|
|
31
50
|
}
|
|
51
|
+
/** One declared entry, in declaration order. */
|
|
52
|
+
export interface CheckupEntry {
|
|
53
|
+
readonly id: string;
|
|
54
|
+
/** Has a `when` predicate — i.e. it does NOT unconditionally win the cold-start cursor. */
|
|
55
|
+
readonly conditional: boolean;
|
|
56
|
+
}
|
|
32
57
|
export interface CheckupInput {
|
|
33
58
|
/** Every skill id IN the graph. */
|
|
34
59
|
readonly skillIds: ReadonlySet<string>;
|
|
35
|
-
/** Declared
|
|
36
|
-
readonly
|
|
60
|
+
/** Declared entries, in declaration order (the order the cursor resolver reads). */
|
|
61
|
+
readonly entries: readonly CheckupEntry[];
|
|
37
62
|
/** Declared edges; `deterministic` = has a `when`/`onToolReturn` predicate. */
|
|
38
63
|
readonly routes: ReadonlyArray<{
|
|
39
64
|
fromId: string;
|
|
@@ -42,6 +67,21 @@ export interface CheckupInput {
|
|
|
42
67
|
}>;
|
|
43
68
|
/** Decision-`tree()` graphs are exhaustive by construction — only id checks apply. */
|
|
44
69
|
readonly isTree: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The entries are EXCLUSIVE — a scorer (`.entryBy()`/`.entryByRelevance()`) or
|
|
72
|
+
* `.entryByRead()` picks exactly one. When true, the fan-out checks do not apply:
|
|
73
|
+
* choosing among the entries is precisely what those strategies do.
|
|
74
|
+
*/
|
|
75
|
+
readonly exclusiveEntries: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The COMPILED trigger kind per skill id. Read only to keep `unreachable-skill`'s
|
|
78
|
+
* sentence true: "the model can still open it with read_skill" holds for an
|
|
79
|
+
* `llm-activated` trigger and for no other kind — the agent's gate admits an open
|
|
80
|
+
* pick only for that one (`Agent.openSkillIds`). A skill that arrived carrying a
|
|
81
|
+
* hand-authored `rule` trigger keeps it (`deriveTrigger` returns null for an
|
|
82
|
+
* unwired skill), and for that skill the old sentence was false.
|
|
83
|
+
*/
|
|
84
|
+
readonly triggerKinds: ReadonlyMap<string, CheckupTriggerKind>;
|
|
45
85
|
}
|
|
46
86
|
/** Run the check-up. Pure. */
|
|
47
87
|
export declare function checkupGraph(input: CheckupInput): GraphCheckup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillGraphCheckup.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/skillGraphCheckup.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"skillGraphCheckup.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/skillGraphCheckup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,MAAM,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAExF,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,UAAU,GACV,mBAAmB,GACnB,iBAAiB,GACjB,oBAAoB,GACpB,iBAAiB,GACjB,kBAAkB,GAClB,WAAW,GAEX,mBAAmB,GACnB,mBAAmB,CAAC;AAExB,mFAAmF;AACnF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,0EAA0E;AAC1E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;CAC5C;AAED,gDAAgD;AAChD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,2FAA2F;IAC3F,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,oFAAoF;IACpF,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAC1C,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACzF,sFAAsF;IACtF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAChE;AAED,8BAA8B;AAC9B,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAsN9D;AA2CD,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAE3D"}
|
|
@@ -29,6 +29,25 @@
|
|
|
29
29
|
* body (what it reads after deciding). That is the same file convention Claude
|
|
30
30
|
* Code made familiar, so a skill folder is portable between the two.
|
|
31
31
|
*
|
|
32
|
+
* ── What a SKILL.md can and cannot carry ─────────────────────────────────────
|
|
33
|
+
* `name`, `description`, the body. That is the whole per-file surface, and the
|
|
34
|
+
* limits follow from it rather than from an oversight:
|
|
35
|
+
*
|
|
36
|
+
* - **no `tools`** — a tool is code with an `execute`, and a markdown file has
|
|
37
|
+
* none. Every loaded skill is body-only. To give one tools, define that skill
|
|
38
|
+
* with `defineSkill` and mix the lists (`[...loaded, codeAuthored]`), or put
|
|
39
|
+
* the tools on the route target you declare in code.
|
|
40
|
+
* - **no `autoActivate`** — so a loaded skill never scopes the agent's tool list
|
|
41
|
+
* on its own (it has no tools to scope).
|
|
42
|
+
* - **no per-file `surfaceMode`, `cache` or `refreshPolicy`** — `surfaceMode` is
|
|
43
|
+
* settable for the WHOLE directory via `opts`, all of them or none; the others
|
|
44
|
+
* take `defineSkill`'s defaults.
|
|
45
|
+
* - unknown frontmatter keys are IGNORED, not rejected, so a file carrying
|
|
46
|
+
* another tool's metadata still loads here.
|
|
47
|
+
*
|
|
48
|
+
* A worked example feeding this into a graph:
|
|
49
|
+
* `examples/features/47-skills-from-dir-graph.ts`.
|
|
50
|
+
*
|
|
32
51
|
* ── Why authorship is decided here, at load time ─────────────────────────────
|
|
33
52
|
* A Skill body is *instructions to a model*. Where it came from is therefore a
|
|
34
53
|
* security property, not a convenience: content fetched at run time from
|
|
@@ -49,6 +68,11 @@ export interface SkillsFromDirOptions {
|
|
|
49
68
|
/**
|
|
50
69
|
* Override the activation tool name for every loaded skill. Defaults to
|
|
51
70
|
* `defineSkill`'s own default, `'read_skill'`.
|
|
71
|
+
*
|
|
72
|
+
* @deprecated Since 8.7.0 — see {@link DefineSkillOptions.viaToolName}. Nothing has
|
|
73
|
+
* ever read the field, and mounting a skill that carries another value is now
|
|
74
|
+
* refused, so a directory loaded with this option produces skills no agent will
|
|
75
|
+
* accept. Removed in 9.0.0.
|
|
52
76
|
*/
|
|
53
77
|
readonly viaToolName?: string;
|
|
54
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillsFromDir.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/skillsFromDir.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"skillsFromDir.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/skillsFromDir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAe3E,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;CACpC;AAeD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,oBAAyB,GAC9B,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CA+E/B"}
|
|
@@ -128,6 +128,14 @@ export interface InjectionContext {
|
|
|
128
128
|
* Set by the loop's cursor-update stage to `graph.nextSkill(ctx)` each
|
|
129
129
|
* iteration; absent for agents that don't use `skillGraph()`. Plain
|
|
130
130
|
* `rule`/`always`/`on-tool-return` predicates may ignore it.
|
|
131
|
+
*
|
|
132
|
+
* **Scope: ONE run.** "Persisted across iterations" means across the iterations of
|
|
133
|
+
* a single `agent.run()`. It lives in that run's state, so a second `run()` on the
|
|
134
|
+
* same agent begins cold — at the entry, not at the skill the previous turn ended
|
|
135
|
+
* on. That is deliberate: a skill graph declares how ONE turn is routed, and a
|
|
136
|
+
* cursor that survived would silently make turn 2 start somewhere the author never
|
|
137
|
+
* declared. To carry a position between turns, persist the id in your own store and
|
|
138
|
+
* start the next turn's graph from it.
|
|
131
139
|
*/
|
|
132
140
|
readonly currentSkillId?: string;
|
|
133
141
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAIxE;;;;GAIG;AACH,MAAM,MAAM,gBAAgB;AAC1B,yDAAyD;AACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE;AAC7B,wDAAwD;GACtD;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AAC;YAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,uBAAuB,EAAE,WAAW,CAAC;YAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;SAC1B,CAAC,CAAC;QACH,uEAAuE;QACvE,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;YAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,yBAAyB,EAAE,aAAa,CAAC;YACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;SAC9B,CAAC,CAAC;KACJ,CAAC;CACH;AAED,wEAAwE;AACxE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,SAAS,GAAG,eAAe,CAiCtE"}
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
*/
|
|
50
50
|
export { staticTools } from './staticTools.js';
|
|
51
51
|
export { gatedTools } from './gatedTools.js';
|
|
52
|
-
export { skillScopedTools } from './skillScopedTools.js';
|
|
52
|
+
export { skillScopedTools, skillScopedToolsTarget, SKILL_SCOPED_TOOLS_ID_PREFIX, } from './skillScopedTools.js';
|
|
53
53
|
export type { ToolProvider, ToolDispatchContext, ToolGatePredicate } from './types.js';
|
|
54
54
|
export { mcpClient, mcpServe, mockMcpClient, gatewayTransport, GatewayAuthorizationRequiredError, } from '../lib/mcp/index.js';
|
|
55
55
|
export type { GatewayTransportOptions, McpCallToolResult, McpClient, McpClientOptions, McpSdkClient, McpTransport, McpStdioTransport, McpHttpTransport, McpGatewayTransport, MockMcpClientOptions, MockMcpTool, McpServeOptions, McpServeHandle, McpServeTransport, McpStdioServeTransport, McpHttpServeTransport, McpSdkServer, } from '../lib/mcp/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tool-providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tool-providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAGhB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAKvF,OAAO,EACL,SAAS,EACT,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,iCAAiC,GAClC,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,GACb,MAAM,qBAAqB,CAAC"}
|
|
@@ -49,5 +49,9 @@
|
|
|
49
49
|
*/
|
|
50
50
|
import type { Tool } from '../core/tools.js';
|
|
51
51
|
import type { ToolProvider } from './types.js';
|
|
52
|
+
/** The `ToolProvider.id` prefix every `skillScopedTools(...)` carries. */
|
|
53
|
+
export declare const SKILL_SCOPED_TOOLS_ID_PREFIX = "skill-scoped:";
|
|
54
|
+
/** Recover the skill id from a `skillScopedTools` provider id, or `undefined`. */
|
|
55
|
+
export declare function skillScopedToolsTarget(providerId: string | undefined): string | undefined;
|
|
52
56
|
export declare function skillScopedTools(skillId: string, tools: readonly Tool[]): ToolProvider;
|
|
53
57
|
//# sourceMappingURL=skillScopedTools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillScopedTools.d.ts","sourceRoot":"","sources":["../../../src/tool-providers/skillScopedTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;
|
|
1
|
+
{"version":3,"file":"skillScopedTools.d.ts","sourceRoot":"","sources":["../../../src/tool-providers/skillScopedTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,YAAY,CAAC;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAIzF;AAGD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,YAAY,CAwCtF"}
|
|
@@ -62,8 +62,33 @@ export interface ToolDispatchContext {
|
|
|
62
62
|
* The id of the currently-activated Skill, if any.
|
|
63
63
|
* Set by `read_skill(id)` activation; cleared between turns.
|
|
64
64
|
* Used by `autoActivate`-driven per-skill tool gating.
|
|
65
|
+
*
|
|
66
|
+
* **This is the last `read_skill` activation, not the graph's position.** It is
|
|
67
|
+
* filled from the tail of `activatedInjectionIds`, which only `read_skill` ever
|
|
68
|
+
* appends to. For "which skills are actually loaded right now", including the ones
|
|
69
|
+
* an entry rule or a `skillGraph()` edge activated, read {@link activeSkillIds}.
|
|
65
70
|
*/
|
|
66
71
|
readonly activeSkillId?: string;
|
|
72
|
+
/**
|
|
73
|
+
* **Every skill active on this iteration** — the real active set, however each one
|
|
74
|
+
* got there: a `read_skill` activation, an entry rule, a `skillGraph()` route, a
|
|
75
|
+
* decision-tree leaf. Added in 8.7.0.
|
|
76
|
+
*
|
|
77
|
+
* `activeSkillId` answers "what did the model most recently open"; this answers
|
|
78
|
+
* "what is loaded". A provider that wants to follow the graph's POSITION — which
|
|
79
|
+
* `skillScopedTools`' own docs said was impossible — reads this one:
|
|
80
|
+
*
|
|
81
|
+
* ```ts
|
|
82
|
+
* const graphScoped = (id: string, tools: Tool[]): ToolProvider => ({
|
|
83
|
+
* id: `graph-scoped:${id}`,
|
|
84
|
+
* list: (ctx) => (ctx.activeSkillIds?.includes(id) ? tools : []),
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* Optional for forward-compat: a provider written before 8.7.0 sees `undefined` and
|
|
89
|
+
* behaves exactly as it always did.
|
|
90
|
+
*/
|
|
91
|
+
readonly activeSkillIds?: readonly string[];
|
|
67
92
|
/**
|
|
68
93
|
* Caller identity tuple — passed through from `agent.run({ identity })`.
|
|
69
94
|
* Permission predicates can role-check based on `identity.principal`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tool-providers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tool-providers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;KACjC,CAAC;IACF;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;OAOG;IACH,IAAI,CAAC,GAAG,EAAE,mBAAmB,GAAG,SAAS,IAAI,EAAE,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAE3E;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,iEAAiE;AACjE,MAAM,MAAM,iBAAiB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,mBAAmB,KAAK,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentfootprint",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0",
|
|
4
4
|
"description": "The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|