agentfootprint 9.83.0 → 9.85.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/CHANGELOG.md +713 -512
- package/dist/artifacts/present.js +21 -3
- package/dist/artifacts/present.js.map +1 -1
- package/dist/artifacts/wants.js +19 -4
- package/dist/artifacts/wants.js.map +1 -1
- package/dist/core/Agent.js +10 -0
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/buildToolRegistry.js +137 -0
- package/dist/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/core/agent/evidence/frames.js +15 -6
- package/dist/core/agent/evidence/frames.js.map +1 -1
- package/dist/core/agent/outputEnforcement.js +7 -4
- package/dist/core/agent/outputEnforcement.js.map +1 -1
- package/dist/core/agent/selfCallNotice.js +174 -0
- package/dist/core/agent/selfCallNotice.js.map +1 -0
- package/dist/core/agent/stages/routeTurn.js +28 -3
- package/dist/core/agent/stages/routeTurn.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +87 -2
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/agent/window/currentRequest.js +11 -13
- package/dist/core/agent/window/currentRequest.js.map +1 -1
- package/dist/core/agent/window/notice.js +9 -9
- package/dist/core/agent/window/notice.js.map +1 -1
- package/dist/core/agent/window/summarize.js +9 -9
- package/dist/core/agent/window/summarize.js.map +1 -1
- package/dist/core/codeRunnerTool.js +25 -6
- package/dist/core/codeRunnerTool.js.map +1 -1
- package/dist/doors/skill-graph.js +2 -1
- package/dist/doors/skill-graph.js.map +1 -1
- package/dist/esm/artifacts/present.js +21 -3
- package/dist/esm/artifacts/present.js.map +1 -1
- package/dist/esm/artifacts/wants.js +19 -4
- package/dist/esm/artifacts/wants.js.map +1 -1
- package/dist/esm/core/Agent.js +10 -0
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +15 -0
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/buildToolRegistry.d.ts +137 -0
- package/dist/esm/core/agent/buildToolRegistry.js +137 -0
- package/dist/esm/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/esm/core/agent/evidence/frames.d.ts +9 -4
- package/dist/esm/core/agent/evidence/frames.js +13 -5
- package/dist/esm/core/agent/evidence/frames.js.map +1 -1
- package/dist/esm/core/agent/outputEnforcement.d.ts +1 -2
- package/dist/esm/core/agent/outputEnforcement.js +4 -2
- package/dist/esm/core/agent/outputEnforcement.js.map +1 -1
- package/dist/esm/core/agent/selfCallNotice.d.ts +140 -0
- package/dist/esm/core/agent/selfCallNotice.js +169 -0
- package/dist/esm/core/agent/selfCallNotice.js.map +1 -0
- package/dist/esm/core/agent/stages/routeTurn.js +28 -3
- package/dist/esm/core/agent/stages/routeTurn.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +6 -0
- package/dist/esm/core/agent/stages/toolCalls.js +87 -2
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/window/currentRequest.d.ts +9 -3
- package/dist/esm/core/agent/window/currentRequest.js +11 -13
- package/dist/esm/core/agent/window/currentRequest.js.map +1 -1
- package/dist/esm/core/agent/window/notice.d.ts +1 -4
- package/dist/esm/core/agent/window/notice.js +5 -6
- package/dist/esm/core/agent/window/notice.js.map +1 -1
- package/dist/esm/core/agent/window/summarize.d.ts +1 -4
- package/dist/esm/core/agent/window/summarize.js +5 -6
- package/dist/esm/core/agent/window/summarize.js.map +1 -1
- package/dist/esm/core/codeRunnerTool.js +25 -6
- package/dist/esm/core/codeRunnerTool.js.map +1 -1
- package/dist/esm/doors/skill-graph.d.ts +1 -1
- package/dist/esm/doors/skill-graph.js +1 -1
- package/dist/esm/doors/skill-graph.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +15 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/index.d.ts +1 -0
- package/dist/esm/lib/injection-engine/index.js +6 -0
- package/dist/esm/lib/injection-engine/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillToolDescriptors.d.ts +29 -0
- package/dist/esm/lib/injection-engine/skillToolDescriptors.js +138 -8
- package/dist/esm/lib/injection-engine/skillToolDescriptors.js.map +1 -1
- package/dist/esm/lib/injection-engine/types.d.ts +54 -0
- package/dist/esm/lib/injection-engine/types.js +28 -0
- package/dist/esm/lib/injection-engine/types.js.map +1 -1
- package/dist/esm/lib/saidByPerson.d.ts +99 -0
- package/dist/esm/lib/saidByPerson.js +104 -0
- package/dist/esm/lib/saidByPerson.js.map +1 -0
- package/dist/esm/maps/engagement/parkCard.js +7 -1
- package/dist/esm/maps/engagement/parkCard.js.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/injection-engine/index.js +9 -2
- package/dist/lib/injection-engine/index.js.map +1 -1
- package/dist/lib/injection-engine/skillToolDescriptors.js +140 -9
- package/dist/lib/injection-engine/skillToolDescriptors.js.map +1 -1
- package/dist/lib/injection-engine/types.js +30 -1
- package/dist/lib/injection-engine/types.js.map +1 -1
- package/dist/lib/saidByPerson.js +111 -0
- package/dist/lib/saidByPerson.js.map +1 -0
- package/dist/maps/engagement/parkCard.js +7 -1
- package/dist/maps/engagement/parkCard.js.map +1 -1
- package/dist/types/artifacts/present.d.ts.map +1 -1
- package/dist/types/artifacts/wants.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +15 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/buildToolRegistry.d.ts +137 -0
- package/dist/types/core/agent/buildToolRegistry.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/frames.d.ts +9 -4
- package/dist/types/core/agent/evidence/frames.d.ts.map +1 -1
- package/dist/types/core/agent/outputEnforcement.d.ts +1 -2
- package/dist/types/core/agent/outputEnforcement.d.ts.map +1 -1
- package/dist/types/core/agent/selfCallNotice.d.ts +141 -0
- package/dist/types/core/agent/selfCallNotice.d.ts.map +1 -0
- package/dist/types/core/agent/stages/routeTurn.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +6 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/window/currentRequest.d.ts +9 -3
- package/dist/types/core/agent/window/currentRequest.d.ts.map +1 -1
- package/dist/types/core/agent/window/notice.d.ts +1 -4
- package/dist/types/core/agent/window/notice.d.ts.map +1 -1
- package/dist/types/core/agent/window/summarize.d.ts +1 -4
- package/dist/types/core/agent/window/summarize.d.ts.map +1 -1
- package/dist/types/doors/skill-graph.d.ts +1 -1
- package/dist/types/doors/skill-graph.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +15 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/index.d.ts +1 -0
- package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillToolDescriptors.d.ts +29 -0
- package/dist/types/lib/injection-engine/skillToolDescriptors.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/types.d.ts +54 -0
- package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
- package/dist/types/lib/saidByPerson.d.ts +100 -0
- package/dist/types/lib/saidByPerson.d.ts.map +1 -0
- package/dist/types/maps/engagement/parkCard.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -35,6 +35,143 @@
|
|
|
35
35
|
* name once the skill is active, and dispatch looks up by name. We
|
|
36
36
|
* add them to the dispatch map (`registryByName`) so `lookupTool`
|
|
37
37
|
* resolves correctly.
|
|
38
|
+
*
|
|
39
|
+
* ── THE CAPABILITY LAW, EPOCH-SCOPED ──────────────────────────────────
|
|
40
|
+
*
|
|
41
|
+
* An EPOCH is one composed request plus the dispatch of the tool calls
|
|
42
|
+
* that request comes back with. For one epoch E:
|
|
43
|
+
*
|
|
44
|
+
* every offered capability resolves to a dispatchable implementation
|
|
45
|
+
* with stable identity. Attention may alter the offer. Omission from
|
|
46
|
+
* the offer must NOT be presented as proof of permanent capability loss.
|
|
47
|
+
*
|
|
48
|
+
* Clause one is what the two maps returned from here are FOR, and it is
|
|
49
|
+
* scoped to THE TOOLS THIS FILE ROUTES. `augmentedRegistry` (plus the
|
|
50
|
+
* per-iteration narrowing the tools slot applies downstream) is this file's
|
|
51
|
+
* CONTRIBUTION to the offer; `registryByName` is DISPATCH. It is not the
|
|
52
|
+
* whole offer: the wire list is assembled one layer out, as
|
|
53
|
+
* `[static, provider, skill, step]` merged first-occurrence-wins
|
|
54
|
+
* (`buildToolsSlot`), and PROVIDER schemas are a source these maps never
|
|
55
|
+
* contain. Within the scoped set, a name in the offer that is missing from
|
|
56
|
+
* dispatch is an `Unknown tool` the model was invited to call — which is why
|
|
57
|
+
* the autoActivate invariant above exists, and why the name-uniqueness throws
|
|
58
|
+
* below are throws: an identity that is not stable is one the model cannot
|
|
59
|
+
* address. Where a provider schema reaches the wire ahead of a skill tool of
|
|
60
|
+
* the same name, the identity half is the SHADOW SEAM illustrated below.
|
|
61
|
+
*
|
|
62
|
+
* `with stable identity` is kept rather than dropped, and the reason is the
|
|
63
|
+
* event. A law reading only "every offered name resolves to something" would
|
|
64
|
+
* be true everywhere and would leave `agentfootprint.tools.shadowed` reporting
|
|
65
|
+
* a deviation from nothing — the framework spends an event on that seam
|
|
66
|
+
* precisely because reading one contract and calling another implementation is
|
|
67
|
+
* a violation of an expectation worth naming. Scoping a true clause and
|
|
68
|
+
* walking its exceptions keeps the expectation stated; weakening the clause to
|
|
69
|
+
* name resolution would delete it.
|
|
70
|
+
*
|
|
71
|
+
* Clause two is the whole point of the narrowing dials — `autoActivate`,
|
|
72
|
+
* `skillGraph({ scopeTools })`, `.toolsFromActiveSkill()`, a parked map,
|
|
73
|
+
* an open step tenure. Every one of them subtracts from the OFFER.
|
|
74
|
+
*
|
|
75
|
+
* Clause three is a rule about SENTENCES, and nothing in this file can
|
|
76
|
+
* enforce it; the surfaces that write them are inventoried by
|
|
77
|
+
* `test/modelFacingSurfaces.test.ts` and judged by
|
|
78
|
+
* `test/helpers/modelFacingClaims.ts`. It is stated HERE because this is
|
|
79
|
+
* where a reader learns what an offer is, and therefore where the wrong
|
|
80
|
+
* inference is cheapest to draw: a tool absent from this iteration's list
|
|
81
|
+
* is a tool the attention policy did not put there, never a capability
|
|
82
|
+
* that has been taken away.
|
|
83
|
+
*
|
|
84
|
+
* ── WHAT THE LAW DELIBERATELY DOES NOT SAY ────────────────────────────
|
|
85
|
+
*
|
|
86
|
+
* Three drafts of it read "position governs the offer, never dispatch".
|
|
87
|
+
* That generalisation is FALSE across the framework, and it is false in a
|
|
88
|
+
* direction that matters: it would license telling a model that anything
|
|
89
|
+
* it once saw is still callable. It holds for the tools THIS file routes —
|
|
90
|
+
* a scoped skill tool leaves `augmentedRegistry` and stays in
|
|
91
|
+
* `registryByName`, which is exactly the invariant above. It does not hold
|
|
92
|
+
* where the implementation never lived in these maps, or where the SCHEMA
|
|
93
|
+
* the model read never did.
|
|
94
|
+
*
|
|
95
|
+
* ── WHERE IT DOES NOT HOLD IS NOT WRITTEN DOWN HERE ───────────────────
|
|
96
|
+
*
|
|
97
|
+
* It used to be: a list, in this comment, that called itself complete. It was
|
|
98
|
+
* wrong three times in three rounds — round 1 missed provider tools vanishing
|
|
99
|
+
* cross-epoch, round 2 the same-epoch provider/skill shadow, round 3 an
|
|
100
|
+
* INACTIVE skill shadowing silently and a provider able to claim `skip_step`.
|
|
101
|
+
* Each round stated the list more precisely and each round an independent
|
|
102
|
+
* check found one more. A hand-maintained enumeration that claims completeness
|
|
103
|
+
* is the exact defect this library exists to fix, one level up, so this one is
|
|
104
|
+
* no longer maintained by hand:
|
|
105
|
+
*
|
|
106
|
+
* THE ENUMERATION IS `test/core/agent/toolDivergenceWalk.test.ts`.
|
|
107
|
+
*
|
|
108
|
+
* It walks the configuration space — every source that can put a name on the
|
|
109
|
+
* wire or answer to one, crossed with the narrowings that change resolution —
|
|
110
|
+
* drives a REAL run per configuration, and records per epoch what name was
|
|
111
|
+
* offered, whose contract was on the wire, whose implementation answered, and
|
|
112
|
+
* whether `agentfootprint.tools.shadowed` fired and what it claimed. Its
|
|
113
|
+
* committed baseline is the list this comment used to be, kept by observation
|
|
114
|
+
* instead of by memory: a divergence missing from it fails, and one that stops
|
|
115
|
+
* appearing fails too. Read it for the SET, and for the reason each member is
|
|
116
|
+
* tolerated.
|
|
117
|
+
*
|
|
118
|
+
* What follows is ILLUSTRATION — the seams a reader of THIS file meets first,
|
|
119
|
+
* so the two maps below make sense. It is not a boundary, and nothing here
|
|
120
|
+
* should be read as "and no others":
|
|
121
|
+
*
|
|
122
|
+
* • PROVIDER-DELIVERED tools (`ToolProvider`). Dispatch resolves those
|
|
123
|
+
* from `providerToolCache.current`, which the Tools slot OVERWRITES
|
|
124
|
+
* with this iteration's `provider.list(ctx)` (buildToolsSlot.ts). So
|
|
125
|
+
* `skillScopedTools(id, …)`, which answers `[]` whenever
|
|
126
|
+
* `ctx.activeSkillId` is not its skill — and that field reports only a
|
|
127
|
+
* `read_skill` activation — drops the tool out of the offer and out of
|
|
128
|
+
* dispatch on the SAME epoch.
|
|
129
|
+
* Same-epoch offer implies same-epoch dispatch; the cross-epoch half is
|
|
130
|
+
* simply not true there.
|
|
131
|
+
* • `read_skill` RECOVERY is cursor-gated, so it is not the escape hatch
|
|
132
|
+
* that would make the cross-epoch claim harmless anyway.
|
|
133
|
+
* `makeReachableSkills` filters the cursor out of its own successor set,
|
|
134
|
+
* and under `.tree()` the reachable set is `() => []` outright
|
|
135
|
+
* (skillGraph.ts) — a tree routes by predicate and has no cursor to move.
|
|
136
|
+
* • The SHADOW SEAM — a SAME-EPOCH divergence, and the one the framework
|
|
137
|
+
* TRIES to emit an event for — `claim-swallowed` fires it outside the
|
|
138
|
+
* shadow seam too, so the event is a signal, never a boundary. A `ToolProvider` and an ACTIVE skill can declare the
|
|
139
|
+
* same tool name, and the two lose in opposite directions, each by a rule
|
|
140
|
+
* rather than a race: the wire merge puts provider schemas
|
|
141
|
+
* ahead of skill injections first-occurrence-wins, so the model reads the
|
|
142
|
+
* PROVIDER's description and `inputSchema`; `lookupTool` checks
|
|
143
|
+
* `registryByName` first, where every skill tool lives and no provider
|
|
144
|
+
* tool does, so the SKILL's `execute` runs. Clause one's dispatchability
|
|
145
|
+
* survives — the name resolves, there is no `Unknown tool` — but stable
|
|
146
|
+
* identity does not: the contract offered and the implementation that
|
|
147
|
+
* answered are different tools, inside ONE epoch. Nothing throws, because
|
|
148
|
+
* nothing here can see it coming: the provider's list is resolved per
|
|
149
|
+
* iteration (`list(ctx)`) and the skill has to be active, so there is no
|
|
150
|
+
* build-time moment at which the pair is knowable. The pair this file CAN
|
|
151
|
+
* see — a static `.tool()` against a skill tool — is refused below, which
|
|
152
|
+
* is the better answer whenever the answer is available that early.
|
|
153
|
+
* Reported rather than refused: `agentfootprint.tools.shadowed` every
|
|
154
|
+
* iteration plus one dev-mode line (`reportShadowedTools`,
|
|
155
|
+
* buildToolsSlot.ts). Pinned by `test/toolShadowing.test.ts` and, as a
|
|
156
|
+
* counterexample to this law, by epoch-laws 1(g).
|
|
157
|
+
* What the event covers is NARROWER than the seam, which is the reason
|
|
158
|
+
* this bullet is illustration and the walk is the enumeration: the walk
|
|
159
|
+
* records the same divergence with an INACTIVE skill winning dispatch and
|
|
160
|
+
* no event at all, a provider claiming `skip_step` and the framework's own
|
|
161
|
+
* tool answering, and a configuration where the event fires and names the
|
|
162
|
+
* wrong schema source. Their reasons are in the baseline.
|
|
163
|
+
*
|
|
164
|
+
* MCP does not add a seam of its OWN, and it is worth saying so because it
|
|
165
|
+
* looks like it does: `mcpServe` builds `listing` and `byName` ONCE at
|
|
166
|
+
* construction from the same array, and every server instance installs
|
|
167
|
+
* those same two captures, so the offer and the dispatch map there cannot
|
|
168
|
+
* diverge at all. What it does add is a mount: an MCP source reaches an agent
|
|
169
|
+
* as `staticTools(await client.tools())` — a `ToolProvider` — so it inherits
|
|
170
|
+
* every provider seam above unchanged. The walk drives both and gets the same
|
|
171
|
+
* rows for each, which is the only way that claim is worth making.
|
|
172
|
+
*
|
|
173
|
+
* Pinned by `test/core/agent/epoch-laws.test.ts` (the law) and
|
|
174
|
+
* `test/core/agent/toolDivergenceWalk.test.ts` (the set).
|
|
38
175
|
*/
|
|
39
176
|
import type { Injection } from '../../lib/injection-engine/types.js';
|
|
40
177
|
import type { LLMToolSchema } from '../../adapters/types.js';
|
|
@@ -35,6 +35,143 @@
|
|
|
35
35
|
* name once the skill is active, and dispatch looks up by name. We
|
|
36
36
|
* add them to the dispatch map (`registryByName`) so `lookupTool`
|
|
37
37
|
* resolves correctly.
|
|
38
|
+
*
|
|
39
|
+
* ── THE CAPABILITY LAW, EPOCH-SCOPED ──────────────────────────────────
|
|
40
|
+
*
|
|
41
|
+
* An EPOCH is one composed request plus the dispatch of the tool calls
|
|
42
|
+
* that request comes back with. For one epoch E:
|
|
43
|
+
*
|
|
44
|
+
* every offered capability resolves to a dispatchable implementation
|
|
45
|
+
* with stable identity. Attention may alter the offer. Omission from
|
|
46
|
+
* the offer must NOT be presented as proof of permanent capability loss.
|
|
47
|
+
*
|
|
48
|
+
* Clause one is what the two maps returned from here are FOR, and it is
|
|
49
|
+
* scoped to THE TOOLS THIS FILE ROUTES. `augmentedRegistry` (plus the
|
|
50
|
+
* per-iteration narrowing the tools slot applies downstream) is this file's
|
|
51
|
+
* CONTRIBUTION to the offer; `registryByName` is DISPATCH. It is not the
|
|
52
|
+
* whole offer: the wire list is assembled one layer out, as
|
|
53
|
+
* `[static, provider, skill, step]` merged first-occurrence-wins
|
|
54
|
+
* (`buildToolsSlot`), and PROVIDER schemas are a source these maps never
|
|
55
|
+
* contain. Within the scoped set, a name in the offer that is missing from
|
|
56
|
+
* dispatch is an `Unknown tool` the model was invited to call — which is why
|
|
57
|
+
* the autoActivate invariant above exists, and why the name-uniqueness throws
|
|
58
|
+
* below are throws: an identity that is not stable is one the model cannot
|
|
59
|
+
* address. Where a provider schema reaches the wire ahead of a skill tool of
|
|
60
|
+
* the same name, the identity half is the SHADOW SEAM illustrated below.
|
|
61
|
+
*
|
|
62
|
+
* `with stable identity` is kept rather than dropped, and the reason is the
|
|
63
|
+
* event. A law reading only "every offered name resolves to something" would
|
|
64
|
+
* be true everywhere and would leave `agentfootprint.tools.shadowed` reporting
|
|
65
|
+
* a deviation from nothing — the framework spends an event on that seam
|
|
66
|
+
* precisely because reading one contract and calling another implementation is
|
|
67
|
+
* a violation of an expectation worth naming. Scoping a true clause and
|
|
68
|
+
* walking its exceptions keeps the expectation stated; weakening the clause to
|
|
69
|
+
* name resolution would delete it.
|
|
70
|
+
*
|
|
71
|
+
* Clause two is the whole point of the narrowing dials — `autoActivate`,
|
|
72
|
+
* `skillGraph({ scopeTools })`, `.toolsFromActiveSkill()`, a parked map,
|
|
73
|
+
* an open step tenure. Every one of them subtracts from the OFFER.
|
|
74
|
+
*
|
|
75
|
+
* Clause three is a rule about SENTENCES, and nothing in this file can
|
|
76
|
+
* enforce it; the surfaces that write them are inventoried by
|
|
77
|
+
* `test/modelFacingSurfaces.test.ts` and judged by
|
|
78
|
+
* `test/helpers/modelFacingClaims.ts`. It is stated HERE because this is
|
|
79
|
+
* where a reader learns what an offer is, and therefore where the wrong
|
|
80
|
+
* inference is cheapest to draw: a tool absent from this iteration's list
|
|
81
|
+
* is a tool the attention policy did not put there, never a capability
|
|
82
|
+
* that has been taken away.
|
|
83
|
+
*
|
|
84
|
+
* ── WHAT THE LAW DELIBERATELY DOES NOT SAY ────────────────────────────
|
|
85
|
+
*
|
|
86
|
+
* Three drafts of it read "position governs the offer, never dispatch".
|
|
87
|
+
* That generalisation is FALSE across the framework, and it is false in a
|
|
88
|
+
* direction that matters: it would license telling a model that anything
|
|
89
|
+
* it once saw is still callable. It holds for the tools THIS file routes —
|
|
90
|
+
* a scoped skill tool leaves `augmentedRegistry` and stays in
|
|
91
|
+
* `registryByName`, which is exactly the invariant above. It does not hold
|
|
92
|
+
* where the implementation never lived in these maps, or where the SCHEMA
|
|
93
|
+
* the model read never did.
|
|
94
|
+
*
|
|
95
|
+
* ── WHERE IT DOES NOT HOLD IS NOT WRITTEN DOWN HERE ───────────────────
|
|
96
|
+
*
|
|
97
|
+
* It used to be: a list, in this comment, that called itself complete. It was
|
|
98
|
+
* wrong three times in three rounds — round 1 missed provider tools vanishing
|
|
99
|
+
* cross-epoch, round 2 the same-epoch provider/skill shadow, round 3 an
|
|
100
|
+
* INACTIVE skill shadowing silently and a provider able to claim `skip_step`.
|
|
101
|
+
* Each round stated the list more precisely and each round an independent
|
|
102
|
+
* check found one more. A hand-maintained enumeration that claims completeness
|
|
103
|
+
* is the exact defect this library exists to fix, one level up, so this one is
|
|
104
|
+
* no longer maintained by hand:
|
|
105
|
+
*
|
|
106
|
+
* THE ENUMERATION IS `test/core/agent/toolDivergenceWalk.test.ts`.
|
|
107
|
+
*
|
|
108
|
+
* It walks the configuration space — every source that can put a name on the
|
|
109
|
+
* wire or answer to one, crossed with the narrowings that change resolution —
|
|
110
|
+
* drives a REAL run per configuration, and records per epoch what name was
|
|
111
|
+
* offered, whose contract was on the wire, whose implementation answered, and
|
|
112
|
+
* whether `agentfootprint.tools.shadowed` fired and what it claimed. Its
|
|
113
|
+
* committed baseline is the list this comment used to be, kept by observation
|
|
114
|
+
* instead of by memory: a divergence missing from it fails, and one that stops
|
|
115
|
+
* appearing fails too. Read it for the SET, and for the reason each member is
|
|
116
|
+
* tolerated.
|
|
117
|
+
*
|
|
118
|
+
* What follows is ILLUSTRATION — the seams a reader of THIS file meets first,
|
|
119
|
+
* so the two maps below make sense. It is not a boundary, and nothing here
|
|
120
|
+
* should be read as "and no others":
|
|
121
|
+
*
|
|
122
|
+
* • PROVIDER-DELIVERED tools (`ToolProvider`). Dispatch resolves those
|
|
123
|
+
* from `providerToolCache.current`, which the Tools slot OVERWRITES
|
|
124
|
+
* with this iteration's `provider.list(ctx)` (buildToolsSlot.ts). So
|
|
125
|
+
* `skillScopedTools(id, …)`, which answers `[]` whenever
|
|
126
|
+
* `ctx.activeSkillId` is not its skill — and that field reports only a
|
|
127
|
+
* `read_skill` activation — drops the tool out of the offer and out of
|
|
128
|
+
* dispatch on the SAME epoch.
|
|
129
|
+
* Same-epoch offer implies same-epoch dispatch; the cross-epoch half is
|
|
130
|
+
* simply not true there.
|
|
131
|
+
* • `read_skill` RECOVERY is cursor-gated, so it is not the escape hatch
|
|
132
|
+
* that would make the cross-epoch claim harmless anyway.
|
|
133
|
+
* `makeReachableSkills` filters the cursor out of its own successor set,
|
|
134
|
+
* and under `.tree()` the reachable set is `() => []` outright
|
|
135
|
+
* (skillGraph.ts) — a tree routes by predicate and has no cursor to move.
|
|
136
|
+
* • The SHADOW SEAM — a SAME-EPOCH divergence, and the one the framework
|
|
137
|
+
* TRIES to emit an event for — `claim-swallowed` fires it outside the
|
|
138
|
+
* shadow seam too, so the event is a signal, never a boundary. A `ToolProvider` and an ACTIVE skill can declare the
|
|
139
|
+
* same tool name, and the two lose in opposite directions, each by a rule
|
|
140
|
+
* rather than a race: the wire merge puts provider schemas
|
|
141
|
+
* ahead of skill injections first-occurrence-wins, so the model reads the
|
|
142
|
+
* PROVIDER's description and `inputSchema`; `lookupTool` checks
|
|
143
|
+
* `registryByName` first, where every skill tool lives and no provider
|
|
144
|
+
* tool does, so the SKILL's `execute` runs. Clause one's dispatchability
|
|
145
|
+
* survives — the name resolves, there is no `Unknown tool` — but stable
|
|
146
|
+
* identity does not: the contract offered and the implementation that
|
|
147
|
+
* answered are different tools, inside ONE epoch. Nothing throws, because
|
|
148
|
+
* nothing here can see it coming: the provider's list is resolved per
|
|
149
|
+
* iteration (`list(ctx)`) and the skill has to be active, so there is no
|
|
150
|
+
* build-time moment at which the pair is knowable. The pair this file CAN
|
|
151
|
+
* see — a static `.tool()` against a skill tool — is refused below, which
|
|
152
|
+
* is the better answer whenever the answer is available that early.
|
|
153
|
+
* Reported rather than refused: `agentfootprint.tools.shadowed` every
|
|
154
|
+
* iteration plus one dev-mode line (`reportShadowedTools`,
|
|
155
|
+
* buildToolsSlot.ts). Pinned by `test/toolShadowing.test.ts` and, as a
|
|
156
|
+
* counterexample to this law, by epoch-laws 1(g).
|
|
157
|
+
* What the event covers is NARROWER than the seam, which is the reason
|
|
158
|
+
* this bullet is illustration and the walk is the enumeration: the walk
|
|
159
|
+
* records the same divergence with an INACTIVE skill winning dispatch and
|
|
160
|
+
* no event at all, a provider claiming `skip_step` and the framework's own
|
|
161
|
+
* tool answering, and a configuration where the event fires and names the
|
|
162
|
+
* wrong schema source. Their reasons are in the baseline.
|
|
163
|
+
*
|
|
164
|
+
* MCP does not add a seam of its OWN, and it is worth saying so because it
|
|
165
|
+
* looks like it does: `mcpServe` builds `listing` and `byName` ONCE at
|
|
166
|
+
* construction from the same array, and every server instance installs
|
|
167
|
+
* those same two captures, so the offer and the dispatch map there cannot
|
|
168
|
+
* diverge at all. What it does add is a mount: an MCP source reaches an agent
|
|
169
|
+
* as `staticTools(await client.tools())` — a `ToolProvider` — so it inherits
|
|
170
|
+
* every provider seam above unchanged. The walk drives both and gets the same
|
|
171
|
+
* rows for each, which is the only way that claim is worth making.
|
|
172
|
+
*
|
|
173
|
+
* Pinned by `test/core/agent/epoch-laws.test.ts` (the law) and
|
|
174
|
+
* `test/core/agent/toolDivergenceWalk.test.ts` (the set).
|
|
38
175
|
*/
|
|
39
176
|
import { buildReadSkillTool, buildSkipStepTool } from '../../lib/injection-engine/skillTools.js';
|
|
40
177
|
import { stepsOf, SKIP_STEP_TOOL_NAME } from '../../lib/injection-engine/skillSteps.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildToolRegistry.js","sourceRoot":"","sources":["../../../../src/core/agent/buildToolRegistry.ts"],"names":[],"mappings":"AAAA
|
|
1
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MAAM,CAAC,CAAC;IAEhE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -22,15 +22,20 @@
|
|
|
22
22
|
* from the exempt corpus. The frames are stable exported constants for this
|
|
23
23
|
* reason as much as for the tests that match on them.
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
* and readers match on it. */
|
|
27
|
-
export declare const EVIDENCE_CHECK_FRAME_PREFIX = "[evidence check";
|
|
25
|
+
export { EVIDENCE_CHECK_FRAME_PREFIX } from '../../../lib/saidByPerson.js';
|
|
28
26
|
/**
|
|
29
|
-
* True when this message content is a
|
|
27
|
+
* True when this message content is a CORRECTION the library wrote.
|
|
30
28
|
*
|
|
31
29
|
* Both in-loop corrections are listed: the schema re-ask quotes a validator's
|
|
32
30
|
* message about the model's own output, and the evidence recheck quotes the
|
|
33
31
|
* model's own values. Neither is a person supplying data, and treating either
|
|
34
32
|
* as one would exempt the very text it was written to challenge.
|
|
33
|
+
*
|
|
34
|
+
* DELIBERATELY NARROWER than `isSaidByPerson` (9.84.0), which excludes all
|
|
35
|
+
* four authored frames. This one is the exempt corpus's rule, and the exempt
|
|
36
|
+
* corpus is about who SUPPLIED a value, not who typed the message: widening it
|
|
37
|
+
* to the drop notice and the compaction frame would change which values the
|
|
38
|
+
* evidence gate exempts, which is a decision about the gate and not about
|
|
39
|
+
* authorship. Read `LIBRARY_AUTHORED_PREFIXES` if you want the whole list.
|
|
35
40
|
*/
|
|
36
41
|
export declare function isLibraryAuthoredTurn(content: string): boolean;
|
|
@@ -22,17 +22,25 @@
|
|
|
22
22
|
* from the exempt corpus. The frames are stable exported constants for this
|
|
23
23
|
* reason as much as for the tests that match on them.
|
|
24
24
|
*/
|
|
25
|
-
import { SCHEMA_CHECK_FRAME_PREFIX } from '
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
import { EVIDENCE_CHECK_FRAME_PREFIX, SCHEMA_CHECK_FRAME_PREFIX, } from '../../../lib/saidByPerson.js';
|
|
26
|
+
// Both markers live in the authorship registry (9.84.0) — the one list of
|
|
27
|
+
// openings this library puts on a user-role message it wrote. The sentences
|
|
28
|
+
// that carry them are still `gate.ts`'s and `outputEnforcement.ts`'s.
|
|
29
|
+
export { EVIDENCE_CHECK_FRAME_PREFIX } from '../../../lib/saidByPerson.js';
|
|
29
30
|
/**
|
|
30
|
-
* True when this message content is a
|
|
31
|
+
* True when this message content is a CORRECTION the library wrote.
|
|
31
32
|
*
|
|
32
33
|
* Both in-loop corrections are listed: the schema re-ask quotes a validator's
|
|
33
34
|
* message about the model's own output, and the evidence recheck quotes the
|
|
34
35
|
* model's own values. Neither is a person supplying data, and treating either
|
|
35
36
|
* as one would exempt the very text it was written to challenge.
|
|
37
|
+
*
|
|
38
|
+
* DELIBERATELY NARROWER than `isSaidByPerson` (9.84.0), which excludes all
|
|
39
|
+
* four authored frames. This one is the exempt corpus's rule, and the exempt
|
|
40
|
+
* corpus is about who SUPPLIED a value, not who typed the message: widening it
|
|
41
|
+
* to the drop notice and the compaction frame would change which values the
|
|
42
|
+
* evidence gate exempts, which is a decision about the gate and not about
|
|
43
|
+
* authorship. Read `LIBRARY_AUTHORED_PREFIXES` if you want the whole list.
|
|
36
44
|
*/
|
|
37
45
|
export function isLibraryAuthoredTurn(content) {
|
|
38
46
|
return (content.startsWith(EVIDENCE_CHECK_FRAME_PREFIX) || content.startsWith(SCHEMA_CHECK_FRAME_PREFIX));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../../../../src/core/agent/evidence/frames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../../../../src/core/agent/evidence/frames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AAEtC,0EAA0E;AAC1E,4EAA4E;AAC5E,sEAAsE;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,CACL,OAAO,CAAC,UAAU,CAAC,2BAA2B,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,yBAAyB,CAAC,CACjG,CAAC;AACJ,CAAC"}
|
|
@@ -105,8 +105,7 @@ export interface OutputFailure {
|
|
|
105
105
|
* the two paths report a failure the same way.
|
|
106
106
|
*/
|
|
107
107
|
export declare function describeFailure(err: unknown): OutputFailure;
|
|
108
|
-
|
|
109
|
-
export declare const SCHEMA_CHECK_FRAME_PREFIX = "[schema check";
|
|
108
|
+
export { SCHEMA_CHECK_FRAME_PREFIX } from '../../lib/saidByPerson.js';
|
|
110
109
|
/**
|
|
111
110
|
* The two messages a failed attempt adds to the conversation: the answer
|
|
112
111
|
* that failed, and the correction.
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
*/
|
|
36
36
|
import { fnv1a } from '../slots/helpers.js';
|
|
37
37
|
import { applyOutputSchema } from '../outputSchema.js';
|
|
38
|
+
import { SCHEMA_CHECK_FRAME_PREFIX } from '../../lib/saidByPerson.js';
|
|
38
39
|
/**
|
|
39
40
|
* Append one row to the run's output-attempt ledger.
|
|
40
41
|
*
|
|
@@ -65,8 +66,9 @@ export function describeFailure(err) {
|
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
68
|
// ─── The corrective turn ─────────────────────────────────────────────
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
// The marker lives in the authorship registry both this file and a rule author
|
|
70
|
+
// can import (9.84.0) — see `lib/saidByPerson.ts`. The frame below is ours.
|
|
71
|
+
export { SCHEMA_CHECK_FRAME_PREFIX } from '../../lib/saidByPerson.js';
|
|
70
72
|
/**
|
|
71
73
|
* The two messages a failed attempt adds to the conversation: the answer
|
|
72
74
|
* that failed, and the correction.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputEnforcement.js","sourceRoot":"","sources":["../../../../src/core/agent/outputEnforcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAA2B,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"outputEnforcement.js","sourceRoot":"","sources":["../../../../src/core/agent/outputEnforcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAA2B,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAoDtE;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAwB,EAAE,GAAkB;IAC9E,MAAM,IAAI,GAAI,KAAK,CAAC,cAAuD,IAAI,EAAE,CAAC;IAClF,2EAA2E;IAC3E,+DAA+D;IAC/D,KAAK,CAAC,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC;AAcD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,MAAM,CAAC,GAAG,GAOT,CAAC;IACF,MAAM,UAAU,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IACzC,MAAM,IAAI,GACR,UAAU,EAAE,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,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;IAEnC,IAAI,CAAC;QACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The answer a `read_skill` SELF-CALL gets back (9.84.0).
|
|
3
|
+
*
|
|
4
|
+
* A self-call is `read_skill("X")` from a cursor already standing on X. It used
|
|
5
|
+
* to fall through the skill-graph gate's reachability arm — `makeReachableSkills`
|
|
6
|
+
* filters the cursor out of its own successor set (a MOVE to where you already
|
|
7
|
+
* are is not a move) and `openSkillIds()` excludes every graph-wired skill, so
|
|
8
|
+
* the cursor's own id is in neither half of `hops ∪ open`. The model was told:
|
|
9
|
+
*
|
|
10
|
+
* read_skill("X") is not reachable from here. Reachable skills: …
|
|
11
|
+
*
|
|
12
|
+
* while X's body was in its system prompt and X's tools were in that very call's
|
|
13
|
+
* tool list. Read as a statement about AVAILABILITY — which is how a model reads
|
|
14
|
+
* "not reachable" — that is a flat contradiction of the request it arrived in,
|
|
15
|
+
* and the observed behaviour was to stop and answer that it could not help.
|
|
16
|
+
*
|
|
17
|
+
* ── THE LAW THIS FILE IS WRITTEN AGAINST ──────────────────────────────────
|
|
18
|
+
*
|
|
19
|
+
* A TOOL RESULT IS NOT READ ONCE. It is composed during iteration N, written
|
|
20
|
+
* into `history`, and then read by the model on call N+1 AND ON EVERY CALL
|
|
21
|
+
* AFTER IT for the rest of the turn — including the out-of-budget WRAP-UP,
|
|
22
|
+
* which `callLLM` serves with an EMPTY tool list under a user message saying
|
|
23
|
+
* "Do not request tools".
|
|
24
|
+
*
|
|
25
|
+
* The consequence is the whole design: NO COMPOSE-TIME CHECK CAN MAKE A
|
|
26
|
+
* FORWARD-LOOKING SENTENCE SAFE. A budget test, a posture test, a cursor test
|
|
27
|
+
* — each is true at the instant it runs and each is outlived by the sentence
|
|
28
|
+
* it admitted. Three rounds of this file fixed one clause at a time and each
|
|
29
|
+
* time a different clause was still false, because every one of them was a
|
|
30
|
+
* PREDICTION and the fix was always a better prediction.
|
|
31
|
+
*
|
|
32
|
+
* So the notice makes no predictions at all. Every clause is a fact about ONE
|
|
33
|
+
* already-finished event — the call the model made `read_skill` on — and every
|
|
34
|
+
* clause is anchored to that call by name ("that call"), never by deixis ("the
|
|
35
|
+
* call you just made", which denotes a different call each time it is re-read).
|
|
36
|
+
* A past fact about a named call cannot be falsified by anything that happens
|
|
37
|
+
* afterwards: not by the budget running out, not by a posture refusing a hop,
|
|
38
|
+
* not by a sibling tool in the same batch moving the cursor.
|
|
39
|
+
*
|
|
40
|
+
* ── WHAT WAS DELETED, AND WHY THE NOTICE STILL DOES ITS JOB ───────────────
|
|
41
|
+
*
|
|
42
|
+
* Gone: the exhortation ("Go ahead and act on the request"), the move offer
|
|
43
|
+
* ("read_skill MOVES you somewhere else — from here that would be: beta"), the
|
|
44
|
+
* open-skill offer ("These activate without moving you: gamma"), and the
|
|
45
|
+
* budget clause that was added to gate them. Each was false somewhere:
|
|
46
|
+
*
|
|
47
|
+
* • the exhortation, on the wrap-up call, beside "Do not request tools";
|
|
48
|
+
* • the move offer, on the wrap-up call (a hop is a tool call), under
|
|
49
|
+
* `strictness: 'rails'` (every model hop refused) and under `'guard'` on a
|
|
50
|
+
* decisively-routed turn (every hop not on an outstanding menu refused) —
|
|
51
|
+
* where the sibling posture arm answers a taken-up offer with "read_skill
|
|
52
|
+
* here reaches only the open skills: gamma", contradicting the notice from
|
|
53
|
+
* the arm immediately above it, and spending escalation budget to do so;
|
|
54
|
+
* • the budget clause, because a budget read at compose time is a claim
|
|
55
|
+
* about a call that has not happened.
|
|
56
|
+
*
|
|
57
|
+
* The notice's JOB is to stop a model concluding its capability is gone. It
|
|
58
|
+
* does that by stating what it held, not by promising what it may do: you were
|
|
59
|
+
* standing in this skill, its instructions were in that call's prompt, its
|
|
60
|
+
* tools were on that call's wire, and asking took nothing away. A model that
|
|
61
|
+
* reads those four facts has no ground left for "I cannot help".
|
|
62
|
+
*
|
|
63
|
+
* The forward-looking half had a rightful owner all along, and it is not a
|
|
64
|
+
* tool result: the `read_skill` DESCRIPTION is recomposed on every single call,
|
|
65
|
+
* so it can safely speak in the present ("You are in 'beta'."), it is filtered
|
|
66
|
+
* for per-role visibility at source, and it is absent from the wrap-up because
|
|
67
|
+
* the whole tool list is. One owner for the present tense, one for the past,
|
|
68
|
+
* and they can no longer disagree — which is the only property that survived
|
|
69
|
+
* every round of this bug.
|
|
70
|
+
*/
|
|
71
|
+
import type { ActiveInjection } from '../../lib/injection-engine/types.js';
|
|
72
|
+
import type { LLMToolSchema } from '../../adapters/types.js';
|
|
73
|
+
/** What the current skill's tools did on the call the model made `read_skill` on. */
|
|
74
|
+
export interface SelfSkillTools {
|
|
75
|
+
/** Every tool the skill declares — `[]` for a skill that declares none. */
|
|
76
|
+
readonly declared: readonly string[];
|
|
77
|
+
/** Those actually on that call's wire. A subset of `declared`. */
|
|
78
|
+
readonly served: readonly string[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The skill's tools, as of the call the model just made — or `undefined` when
|
|
82
|
+
* that cannot be established, which is not the same answer and must not be
|
|
83
|
+
* reported as one.
|
|
84
|
+
*
|
|
85
|
+
* `undefined` means the notice says nothing about tools at all. It happens when
|
|
86
|
+
* the tools slot composed no per-iteration list (`reactMode: 'classic'` caches
|
|
87
|
+
* the slot, and `callLLM` falls back to its build-time schemas), or when the
|
|
88
|
+
* cursor's skill is not in the active set. Silence is the only honest output
|
|
89
|
+
* there: the alternative is a sentence naming tools the model may not have.
|
|
90
|
+
*
|
|
91
|
+
* The out-of-budget wrap-up is NOT one of these cases and must not be modelled
|
|
92
|
+
* as one. Its empty tool list belongs to a LATER call; the wire read here is
|
|
93
|
+
* always the one the model was really handed on the call being answered, and
|
|
94
|
+
* the notice speaks of that call and only that call.
|
|
95
|
+
*/
|
|
96
|
+
export declare function selfSkillTools(skillId: string, activeInjections: readonly ActiveInjection[] | undefined, wire: readonly LLMToolSchema[] | undefined): SelfSkillTools | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* The self-call's tool result.
|
|
99
|
+
*
|
|
100
|
+
* NOT a refusal to the MODEL, and deliberately so. The gate's other two arms
|
|
101
|
+
* refuse because the model asked for something it may not have; a self-call
|
|
102
|
+
* asks for a body it already holds, and the useful reply is the fact — where
|
|
103
|
+
* you stood, and what rode that call — not a decline. It is still counted as a
|
|
104
|
+
* refusal by the ESCALATION BUDGET (`noteSkillRefusal`, beside the emit), and
|
|
105
|
+
* those two facts do not fight: the budget is not measuring how the sentence
|
|
106
|
+
* reads, it is measuring a model that keeps asking the graph where it is
|
|
107
|
+
* instead of working, which is exactly the stuck run the budget escalates.
|
|
108
|
+
*
|
|
109
|
+
* It still OVERWRITES the tool's own result the way every other arm does,
|
|
110
|
+
* because that overwrite is what puts the authoritative sentence in front of
|
|
111
|
+
* the governance rules, the refusal cap and the after-tool moment, on both
|
|
112
|
+
* channels, before the model reads anything.
|
|
113
|
+
*
|
|
114
|
+
* The one thing not overwritten is a BODY. The live case is `surfaceMode:
|
|
115
|
+
* 'both'` — `'tool-only'` cannot arise here, because `skillBodyDelivery`
|
|
116
|
+
* refuses it at BUILD time for anything but an `llm-activated` skill and only a
|
|
117
|
+
* graph-wired skill can be the cursor. Under `'both'` the body is in the system
|
|
118
|
+
* prompt AND rides the tool result, and the second copy is the whole point of
|
|
119
|
+
* the mode: recency-first delivery, the body at the end of the window rather
|
|
120
|
+
* than only at the top of the prompt. Dropping it here would quietly demote
|
|
121
|
+
* `'both'` to `'system-prompt'` on the one call that asked to re-read.
|
|
122
|
+
*
|
|
123
|
+
* TENSE IS LOAD-BEARING, AND SO IS DEIXIS. Every clause below is past tense
|
|
124
|
+
* about a single named call, and every reference to that call is "that call" —
|
|
125
|
+
* bound by the opening clause, which says which call it was. "The call you just
|
|
126
|
+
* made" was the earlier wording and it is not safe: re-read four calls later it
|
|
127
|
+
* denotes call four, and the tools it names rode call one.
|
|
128
|
+
*
|
|
129
|
+
* There are exactly two present-tense phrases in the output and both are
|
|
130
|
+
* timeless rather than temporal: "It declares no tools of its own" (a
|
|
131
|
+
* declaration is fixed when the skill is defined and cannot vary within a run)
|
|
132
|
+
* and "Its instructions are repeated below" (the body is appended to this very
|
|
133
|
+
* string, so the sentence is true wherever the string is read).
|
|
134
|
+
*/
|
|
135
|
+
export declare function selfCallNotice(args: {
|
|
136
|
+
readonly skillId: string;
|
|
137
|
+
/** `undefined` when the wire could not be established — see `selfSkillTools`. */
|
|
138
|
+
readonly tools: SelfSkillTools | undefined;
|
|
139
|
+
readonly body?: string;
|
|
140
|
+
}): string;
|