agentfootprint 8.4.0 → 8.6.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/CLAUDE.md +2 -1
- package/dist/core/Agent.js +132 -2
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/RunnerBase.js +7 -1
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +23 -1
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +5 -0
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +6 -0
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +163 -10
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/slots/buildToolsSlot.js +9 -1
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +51 -2
- package/dist/esm/core/Agent.js +132 -2
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/RunnerBase.js +7 -1
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +19 -1
- package/dist/esm/core/agent/AgentBuilder.js +23 -1
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.js +5 -0
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +6 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +45 -0
- package/dist/esm/core/agent/stages/toolCalls.js +163 -10
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +26 -0
- package/dist/esm/core/slots/buildToolsSlot.d.ts +13 -0
- package/dist/esm/core/slots/buildToolsSlot.js +9 -1
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +17 -0
- package/dist/esm/identity/CredentialConsentRequiredError.d.ts +63 -0
- package/dist/esm/identity/CredentialConsentRequiredError.js +65 -0
- package/dist/esm/identity/CredentialConsentRequiredError.js.map +1 -0
- package/dist/esm/identity/consent.d.ts +81 -0
- package/dist/esm/identity/consent.js +85 -0
- package/dist/esm/identity/consent.js.map +1 -0
- package/dist/esm/identity.d.ts +2 -0
- package/dist/esm/identity.js +1 -0
- package/dist/esm/identity.js.map +1 -1
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.d.ts +12 -0
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js +28 -4
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
- package/dist/esm/lib/injection-engine/index.d.ts +1 -1
- package/dist/esm/lib/injection-engine/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillBodyDelivery.d.ts +65 -0
- package/dist/esm/lib/injection-engine/skillBodyDelivery.js +110 -0
- package/dist/esm/lib/injection-engine/skillBodyDelivery.js.map +1 -0
- package/dist/esm/lib/injection-engine/skillGraph.d.ts +77 -8
- package/dist/esm/lib/injection-engine/skillGraph.js +83 -29
- package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillTools.d.ts +22 -1
- package/dist/esm/lib/injection-engine/skillTools.js +39 -7
- package/dist/esm/lib/injection-engine/skillTools.js.map +1 -1
- package/dist/esm/lib/mcp/mcpServe.js +11 -1
- package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
- package/dist/esm/recorders/observability/RouteRecorder.d.ts +11 -2
- package/dist/esm/recorders/observability/RouteRecorder.js +58 -6
- package/dist/esm/recorders/observability/RouteRecorder.js.map +1 -1
- package/dist/identity/CredentialConsentRequiredError.js +69 -0
- package/dist/identity/CredentialConsentRequiredError.js.map +1 -0
- package/dist/identity/consent.js +91 -0
- package/dist/identity/consent.js.map +1 -0
- package/dist/identity.js +3 -1
- package/dist/identity.js.map +1 -1
- package/dist/lib/injection-engine/buildInjectionEngineSubflow.js +28 -4
- package/dist/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
- package/dist/lib/injection-engine/index.js.map +1 -1
- package/dist/lib/injection-engine/skillBodyDelivery.js +116 -0
- package/dist/lib/injection-engine/skillBodyDelivery.js.map +1 -0
- package/dist/lib/injection-engine/skillGraph.js +83 -29
- package/dist/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/lib/injection-engine/skillTools.js +39 -7
- package/dist/lib/injection-engine/skillTools.js.map +1 -1
- package/dist/lib/mcp/mcpServe.js +11 -1
- package/dist/lib/mcp/mcpServe.js.map +1 -1
- package/dist/recorders/observability/RouteRecorder.js +58 -6
- package/dist/recorders/observability/RouteRecorder.js.map +1 -1
- package/dist/types/core/Agent.d.ts +51 -2
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/RunnerBase.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +19 -1
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +45 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +26 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/slots/buildToolsSlot.d.ts +13 -0
- package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +17 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/identity/CredentialConsentRequiredError.d.ts +64 -0
- package/dist/types/identity/CredentialConsentRequiredError.d.ts.map +1 -0
- package/dist/types/identity/consent.d.ts +82 -0
- package/dist/types/identity/consent.d.ts.map +1 -0
- package/dist/types/identity.d.ts +2 -0
- package/dist/types/identity.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts +12 -0
- package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/index.d.ts +1 -1
- package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillBodyDelivery.d.ts +66 -0
- package/dist/types/lib/injection-engine/skillBodyDelivery.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/skillGraph.d.ts +77 -8
- package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillTools.d.ts +22 -1
- package/dist/types/lib/injection-engine/skillTools.d.ts.map +1 -1
- package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
- package/dist/types/recorders/observability/RouteRecorder.d.ts +11 -2
- package/dist/types/recorders/observability/RouteRecorder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -26,12 +26,42 @@ export function formatRouteHop(hop) {
|
|
|
26
26
|
return `entered "${hop.toSkill}"`;
|
|
27
27
|
case 'route':
|
|
28
28
|
return `"${hop.fromSkill}" → "${hop.toSkill}"${hop.edgeLabel ? ` (${hop.edgeLabel})` : ''}${hop.lastTool ? ` on ${hop.lastTool}` : ''}`;
|
|
29
|
+
case 'model-pick':
|
|
30
|
+
// Deliberately carries no edge caption: no declared edge fired, and lending it
|
|
31
|
+
// one is the exact misattribution this outcome exists to end.
|
|
32
|
+
return hop.fromSkill === undefined
|
|
33
|
+
? `read_skill("${hop.toSkill}") accepted at cold start`
|
|
34
|
+
: `read_skill("${hop.toSkill}") accepted from "${hop.fromSkill}"`;
|
|
29
35
|
case 'stay':
|
|
30
36
|
return `stayed in "${hop.toSkill}"`;
|
|
31
37
|
case 'rejected':
|
|
32
38
|
return `read_skill("${hop.requestedSkill}") rejected from "${hop.fromSkill ?? 'cold start'}" — reachable: ${(hop.reachable ?? []).join(', ') || '(none)'}`;
|
|
33
39
|
}
|
|
34
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* The hop's cause as the GRAPH reported it (`context.evaluated`'s `cursorMove.by`,
|
|
43
|
+
* 8.5.0) — or `undefined` when the event carries none, so the caller can fall back
|
|
44
|
+
* to inferring it from the destination.
|
|
45
|
+
*
|
|
46
|
+
* `'none'` maps to `undefined` on purpose: it means the graph has no cursor at all
|
|
47
|
+
* this iteration, which is not a hop cause. A decision `tree()` reports it every
|
|
48
|
+
* iteration, and there the inferred outcome (entry, then stay) is the right story:
|
|
49
|
+
* a tree really does re-route by predicate rather than move a cursor.
|
|
50
|
+
*/
|
|
51
|
+
function causeOf(cursorMove) {
|
|
52
|
+
if (cursorMove === null || typeof cursorMove !== 'object')
|
|
53
|
+
return undefined;
|
|
54
|
+
const by = cursorMove.by;
|
|
55
|
+
switch (by) {
|
|
56
|
+
case 'entry':
|
|
57
|
+
case 'route':
|
|
58
|
+
case 'model-pick':
|
|
59
|
+
case 'stay':
|
|
60
|
+
return by;
|
|
61
|
+
default:
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
35
65
|
/** The current cursor skill from a `context.evaluated` routing[] — prefer a
|
|
36
66
|
* transitioned-into route target, then an entry, then a tree leaf, then model. */
|
|
37
67
|
function cursorFromRouting(routing) {
|
|
@@ -58,6 +88,7 @@ export function routeRecorder(options = {}) {
|
|
|
58
88
|
let cursor;
|
|
59
89
|
let lastTool;
|
|
60
90
|
let consecutiveRejected = 0;
|
|
91
|
+
let trippedRejectedCap = false;
|
|
61
92
|
const reset = () => {
|
|
62
93
|
store.clear();
|
|
63
94
|
trips.length = 0;
|
|
@@ -65,6 +96,7 @@ export function routeRecorder(options = {}) {
|
|
|
65
96
|
cursor = undefined;
|
|
66
97
|
lastTool = undefined;
|
|
67
98
|
consecutiveRejected = 0;
|
|
99
|
+
trippedRejectedCap = false;
|
|
68
100
|
};
|
|
69
101
|
const detectPingPong = (iteration) => {
|
|
70
102
|
if (transitions.length < pingPongWindow)
|
|
@@ -104,7 +136,15 @@ export function routeRecorder(options = {}) {
|
|
|
104
136
|
break; // no skill-graph routing this iteration
|
|
105
137
|
const iteration = Number(p.iteration ?? 0);
|
|
106
138
|
const from = cursor;
|
|
107
|
-
|
|
139
|
+
// The CAUSE, from the graph's own resolver when it reported one (8.5.0).
|
|
140
|
+
// Falling back to inferring it from the destination — what this recorder
|
|
141
|
+
// did before — is kept for a graph too old to explain itself, and is the
|
|
142
|
+
// only path that can still mistake a model pick for a declared edge.
|
|
143
|
+
const cause = causeOf(p.cursorMove);
|
|
144
|
+
const outcome = cause ?? (cursor === undefined ? 'entry' : cur.id !== cursor ? 'route' : 'stay');
|
|
145
|
+
// An edge caption belongs to a hop a declared EDGE drove. On a model pick
|
|
146
|
+
// the caption is the label of an edge that did not fire.
|
|
147
|
+
const wearsEdgeLabel = outcome === 'route' || outcome === 'entry';
|
|
108
148
|
const hop = {
|
|
109
149
|
runtimeStageId: event.runtimeStageId,
|
|
110
150
|
iteration,
|
|
@@ -112,17 +152,26 @@ export function routeRecorder(options = {}) {
|
|
|
112
152
|
toSkill: cur.id,
|
|
113
153
|
outcome,
|
|
114
154
|
why: '',
|
|
115
|
-
...(cur.label !== undefined ? { edgeLabel: cur.label } : {}),
|
|
155
|
+
...(wearsEdgeLabel && cur.label !== undefined ? { edgeLabel: cur.label } : {}),
|
|
116
156
|
...(outcome === 'route' && lastTool !== undefined ? { lastTool } : {}),
|
|
117
157
|
};
|
|
118
158
|
const finished = { ...hop, why: formatRouteHop(hop) };
|
|
119
159
|
store.push(finished);
|
|
120
|
-
|
|
160
|
+
const moved = outcome !== 'stay';
|
|
161
|
+
if (moved) {
|
|
121
162
|
transitions.push(cur.id);
|
|
122
163
|
detectPingPong(iteration);
|
|
123
164
|
}
|
|
124
165
|
cursor = cur.id;
|
|
125
|
-
|
|
166
|
+
// Only a CURSOR MOVE breaks a rejection run (8.5.0). Resetting on every
|
|
167
|
+
// evaluation made `maxRejectedRetries` untrippable: one evaluation fires
|
|
168
|
+
// between every pair of rejections, so the count never passed 1 and a model
|
|
169
|
+
// could re-ask for the same out-of-reach skill until the iteration cap. A
|
|
170
|
+
// 'stay' is precisely the case where the model asked and got nowhere.
|
|
171
|
+
if (moved) {
|
|
172
|
+
consecutiveRejected = 0;
|
|
173
|
+
trippedRejectedCap = false;
|
|
174
|
+
}
|
|
126
175
|
break;
|
|
127
176
|
}
|
|
128
177
|
case 'agentfootprint.skill.rejected': {
|
|
@@ -138,8 +187,11 @@ export function routeRecorder(options = {}) {
|
|
|
138
187
|
};
|
|
139
188
|
store.push({ ...hop, why: formatRouteHop(hop) });
|
|
140
189
|
consecutiveRejected += 1;
|
|
141
|
-
|
|
142
|
-
|
|
190
|
+
// ONE trip per run of rejections, re-armed when the cursor next moves.
|
|
191
|
+
// The old guard was per-ITERATION, so once the count passed the cap every
|
|
192
|
+
// further iteration pushed another identical trip.
|
|
193
|
+
if (consecutiveRejected >= maxRejectedRetries && !trippedRejectedCap) {
|
|
194
|
+
trippedRejectedCap = true;
|
|
143
195
|
trips.push({
|
|
144
196
|
kind: 'rejected-cap',
|
|
145
197
|
iteration,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteRecorder.js","sourceRoot":"","sources":["../../../../src/recorders/observability/RouteRecorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"RouteRecorder.js","sourceRoot":"","sources":["../../../../src/recorders/observability/RouteRecorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAyElD,mEAAmE;AACnE,MAAM,UAAU,cAAc,CAAC,GAAa;IAC1C,QAAQ,GAAG,CAAC,OAAO,EAAE,CAAC;QACpB,KAAK,OAAO;YACV,OAAO,YAAY,GAAG,CAAC,OAAO,GAAG,CAAC;QACpC,KAAK,OA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AG,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC;YAC5C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC/C,KAAK,EAAE,CAAC;gBACR,SAAS,GAAG,KAAK,CAAC;YACpB,CAAC;QACH,CAAC;QAED,OAAO;YACL,MAAM,IAAI,GAAa,EAAE,CAAC;YAC1B,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBACjC,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;oBACpE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;QAED,aAAa;YACX,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;QAChE,CAAC;QAED,QAAQ;YACN,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;QACpB,CAAC;QAED,KAAK;YACH,KAAK,EAAE,CAAC;QACV,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CredentialConsentRequiredError — typed error thrown by `Agent.run()` under
|
|
4
|
+
* `onAuthorizationRequired: 'tell-model'` when a turn finished while a tool's
|
|
5
|
+
* DECLARED credential was never obtained.
|
|
6
|
+
*
|
|
7
|
+
* Pattern: Typed Error (parallel to `PolicyHaltError` / `MessageDeniedError`).
|
|
8
|
+
* Role: The honesty terminal for the non-pausing mode. `'tell-model'` lets
|
|
9
|
+
* the model adapt in-loop after a consent block — but a turn that
|
|
10
|
+
* returned a plain answer string would be claiming a completion it
|
|
11
|
+
* did not earn, because the tool never ran. `AgentOutput` is a bare
|
|
12
|
+
* string with nowhere to hang "…and a consent is still outstanding",
|
|
13
|
+
* so the fact is surfaced as an error instead of being dropped.
|
|
14
|
+
* Emits: N/A (this file DEFINES the class; `agentfootprint.credential.
|
|
15
|
+
* authorization_required` fires from the toolCalls handler at the
|
|
16
|
+
* moment the block resolves, and carries `{ service, sessionId }`
|
|
17
|
+
* only — never the URL).
|
|
18
|
+
*
|
|
19
|
+
* **The `authorizationUrl` on this error is a bearer capability.** It carries a
|
|
20
|
+
* session-correlating `state` parameter: whoever holds the URL can complete the
|
|
21
|
+
* consent flow. It reaches the caller HERE and on `PendingAsk` under
|
|
22
|
+
* `'pause'` — and deliberately nowhere else. It is never written to the
|
|
23
|
+
* conversation, the snapshot, the narrative, the typed event stream, or a
|
|
24
|
+
* recording. Treat it like the token it stands in for: hand it to the person
|
|
25
|
+
* who must click it, and do not log it.
|
|
26
|
+
*
|
|
27
|
+
* Under the default `onAuthorizationRequired: 'pause'` this error never fires —
|
|
28
|
+
* the run pauses at the block instead and the same three fields ride
|
|
29
|
+
* `PendingAsk`.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* try {
|
|
33
|
+
* await agent.run({ message: 'pay invoice INV-42' });
|
|
34
|
+
* } catch (e) {
|
|
35
|
+
* if (e instanceof CredentialConsentRequiredError) {
|
|
36
|
+
* // Show the URL to the PERSON. Never log it.
|
|
37
|
+
* await notifyUser(e.service, e.authorizationUrl);
|
|
38
|
+
* } else {
|
|
39
|
+
* throw e;
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
*/
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.CredentialConsentRequiredError = void 0;
|
|
45
|
+
class CredentialConsentRequiredError extends Error {
|
|
46
|
+
code = 'ERR_CREDENTIAL_CONSENT_REQUIRED';
|
|
47
|
+
service;
|
|
48
|
+
/** The 3LO consent URL. A BEARER CAPABILITY — see the class note. */
|
|
49
|
+
authorizationUrl;
|
|
50
|
+
sessionId;
|
|
51
|
+
tool;
|
|
52
|
+
iteration;
|
|
53
|
+
constructor(ctx) {
|
|
54
|
+
// The MESSAGE deliberately omits the URL. An error message is the one
|
|
55
|
+
// string that reliably reaches a log line, and this class exists to keep
|
|
56
|
+
// a capability out of logs.
|
|
57
|
+
super(`Authorization required for '${ctx.service}' (tool='${ctx.tool}', ` +
|
|
58
|
+
`iteration=${ctx.iteration}). The tool did not run. Read ` +
|
|
59
|
+
`\`error.authorizationUrl\` to send the person to consent.`);
|
|
60
|
+
this.name = 'CredentialConsentRequiredError';
|
|
61
|
+
this.service = ctx.service;
|
|
62
|
+
this.authorizationUrl = ctx.authorizationUrl;
|
|
63
|
+
this.sessionId = ctx.sessionId;
|
|
64
|
+
this.tool = ctx.tool;
|
|
65
|
+
this.iteration = ctx.iteration;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.CredentialConsentRequiredError = CredentialConsentRequiredError;
|
|
69
|
+
//# sourceMappingURL=CredentialConsentRequiredError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CredentialConsentRequiredError.js","sourceRoot":"","sources":["../../src/identity/CredentialConsentRequiredError.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;;;AAeH,MAAa,8BAA+B,SAAQ,KAAK;IAC9C,IAAI,GAAG,iCAA0C,CAAC;IAClD,OAAO,CAAS;IACzB,qEAAqE;IAC5D,gBAAgB,CAAS;IACzB,SAAS,CAAS;IAClB,IAAI,CAAS;IACb,SAAS,CAAS;IAE3B,YAAY,GAAqC;QAC/C,sEAAsE;QACtE,yEAAyE;QACzE,4BAA4B;QAC5B,KAAK,CACH,+BAA+B,GAAG,CAAC,OAAO,YAAY,GAAG,CAAC,IAAI,KAAK;YACjE,aAAa,GAAG,CAAC,SAAS,gCAAgC;YAC1D,2DAA2D,CAC9D,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC,gBAAgB,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;IACjC,CAAC;CACF;AAzBD,wEAyBC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The 3LO consent vocabulary — one place, because four surfaces must agree on
|
|
4
|
+
* it and three of them are security boundaries.
|
|
5
|
+
*
|
|
6
|
+
* A `CredentialProvider` that answers `authorization-required` is saying: a
|
|
7
|
+
* PERSON has to click a link before this tool can run. Two things follow, and
|
|
8
|
+
* they are the whole of this module.
|
|
9
|
+
*
|
|
10
|
+
* **1. The URL is a bearer capability, not a message.** It carries a
|
|
11
|
+
* session-correlating `state` parameter; whoever holds it can complete the
|
|
12
|
+
* consent flow. It goes to the CALLER — on `PendingAsk` under `'pause'`, on
|
|
13
|
+
* `CredentialConsentRequiredError` under `'tell-model'` — and to nowhere else.
|
|
14
|
+
* Before 8.6.0 it was interpolated into the tool-result string, which put it in
|
|
15
|
+
* the conversation and therefore in every channel built to preserve tool output
|
|
16
|
+
* (history, `stream.tool_end`, `agent.iteration_end`, `context.injected`, the
|
|
17
|
+
* commit log, the snapshot, the narrative's `rawValue`, and any recording).
|
|
18
|
+
* `modelRefusal()` is the URL-free replacement, and it is why the interpolation
|
|
19
|
+
* has no remaining call site.
|
|
20
|
+
*
|
|
21
|
+
* **2. The model is the one party that cannot act on it.** So what the model
|
|
22
|
+
* reads names the service, says a person is handling it, and tells it what to
|
|
23
|
+
* do instead — the same shape as the `[permission denied: …]` refusal it
|
|
24
|
+
* already knows how to read.
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.redactConsentUrlForEvent = exports.consentQuestion = exports.modelRefusal = exports.CONSENT_URL_WITHHELD = exports.CONSENT_PAUSE_KEY = void 0;
|
|
28
|
+
/**
|
|
29
|
+
* The key under which a consent request rides `pauseData` (and therefore
|
|
30
|
+
* `PendingAsk.pauseData`). Named, rather than free-form, for one reason:
|
|
31
|
+
* `agentfootprint.pause.request` mirrors the WHOLE `pauseData` into its
|
|
32
|
+
* `questionPayload`, so the emitter has to be able to find this block and
|
|
33
|
+
* withhold the URL from the event stream. A free-form shape could not be
|
|
34
|
+
* bounded by name, and the URL would have leaked into every observer again.
|
|
35
|
+
*
|
|
36
|
+
* @see redactConsentUrlForEvent
|
|
37
|
+
*/
|
|
38
|
+
exports.CONSENT_PAUSE_KEY = 'authorization';
|
|
39
|
+
/** Placeholder written where the consent URL is deliberately withheld. */
|
|
40
|
+
exports.CONSENT_URL_WITHHELD = '[withheld: consent URL is caller-only]';
|
|
41
|
+
/**
|
|
42
|
+
* What the MODEL reads when a declared credential needs consent. Never the URL.
|
|
43
|
+
*
|
|
44
|
+
* Bracketed like the permission-gate refusal, because it is the same kind of
|
|
45
|
+
* fact: the call did not happen and the model must adapt. It names the service
|
|
46
|
+
* (so the model can reason about what is unavailable), says a person is on it
|
|
47
|
+
* (so it does not invent a way to authorize itself), and offers the two honest
|
|
48
|
+
* continuations.
|
|
49
|
+
*/
|
|
50
|
+
function modelRefusal(service) {
|
|
51
|
+
return (`[authorization required: '${service}' — a person must consent before this ` +
|
|
52
|
+
`tool can run. The caller has been told; you cannot do it yourself. ` +
|
|
53
|
+
`Continue with work that does not need '${service}', or say plainly that ` +
|
|
54
|
+
`you could not finish this step.]`);
|
|
55
|
+
}
|
|
56
|
+
exports.modelRefusal = modelRefusal;
|
|
57
|
+
/** The plain-words question a host shows the person, via `PendingAsk.question`. */
|
|
58
|
+
function consentQuestion(service, tool) {
|
|
59
|
+
return `Authorize access to '${service}' so '${tool}' can run.`;
|
|
60
|
+
}
|
|
61
|
+
exports.consentQuestion = consentQuestion;
|
|
62
|
+
/**
|
|
63
|
+
* Strip the consent URL out of a `pause.request` payload.
|
|
64
|
+
*
|
|
65
|
+
* `RunnerBase.emitPauseRequest` copies the whole `pauseData` into
|
|
66
|
+
* `PauseRequestPayload.questionPayload`, which is right for a check-in's
|
|
67
|
+
* evidence pack and wrong for a bearer URL. This withholds exactly one field by
|
|
68
|
+
* name and leaves every other pause shape untouched — the same discipline the
|
|
69
|
+
* audit adapter's `BOUND_FIELDS` already applies to `tool_end.result`.
|
|
70
|
+
*
|
|
71
|
+
* Returns the input unchanged (same reference) when there is no consent block,
|
|
72
|
+
* so no existing pause pays for this.
|
|
73
|
+
*/
|
|
74
|
+
function redactConsentUrlForEvent(payload) {
|
|
75
|
+
const block = payload[exports.CONSENT_PAUSE_KEY];
|
|
76
|
+
if (typeof block !== 'object' ||
|
|
77
|
+
block === null ||
|
|
78
|
+
!('authorizationUrl' in block) ||
|
|
79
|
+
typeof block.authorizationUrl !== 'string') {
|
|
80
|
+
return payload;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
...payload,
|
|
84
|
+
[exports.CONSENT_PAUSE_KEY]: {
|
|
85
|
+
...block,
|
|
86
|
+
authorizationUrl: exports.CONSENT_URL_WITHHELD,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
exports.redactConsentUrlForEvent = redactConsentUrlForEvent;
|
|
91
|
+
//# sourceMappingURL=consent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.js","sourceRoot":"","sources":["../../src/identity/consent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAeH;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,eAAe,CAAC;AAUjD,0EAA0E;AAC7D,QAAA,oBAAoB,GAAG,wCAAwC,CAAC;AAE7E;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAAC,OAAe;IAC1C,OAAO,CACL,6BAA6B,OAAO,wCAAwC;QAC5E,qEAAqE;QACrE,0CAA0C,OAAO,yBAAyB;QAC1E,kCAAkC,CACnC,CAAC;AACJ,CAAC;AAPD,oCAOC;AAED,mFAAmF;AACnF,SAAgB,eAAe,CAAC,OAAe,EAAE,IAAY;IAC3D,OAAO,wBAAwB,OAAO,SAAS,IAAI,YAAY,CAAC;AAClE,CAAC;AAFD,0CAEC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,wBAAwB,CACtC,OAA0C;IAE1C,MAAM,KAAK,GAAG,OAAO,CAAC,yBAAiB,CAAC,CAAC;IACzC,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,CAAC,kBAAkB,IAAI,KAAK,CAAC;QAC9B,OAAQ,KAAuC,CAAC,gBAAgB,KAAK,QAAQ,EAC7E,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO;QACL,GAAG,OAAO;QACV,CAAC,yBAAiB,CAAC,EAAE;YACnB,GAAI,KAAiC;YACrC,gBAAgB,EAAE,4BAAoB;SACvC;KACF,CAAC;AACJ,CAAC;AAnBD,4DAmBC"}
|
package/dist/identity.js
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* here is the same symbol on the new door, not a copy.
|
|
30
30
|
*/
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.agentCoreIdentity = exports.withCredentialRetry = exports.staticTokens = exports.headers = exports.basic = exports.apiKey = exports.bearer = exports.unconfiguredCredentialProvider = exports.isCredentialIssued = void 0;
|
|
32
|
+
exports.agentCoreIdentity = exports.withCredentialRetry = exports.CredentialConsentRequiredError = exports.staticTokens = exports.headers = exports.basic = exports.apiKey = exports.bearer = exports.unconfiguredCredentialProvider = exports.isCredentialIssued = void 0;
|
|
33
33
|
var types_js_1 = require("./identity/types.js");
|
|
34
34
|
Object.defineProperty(exports, "isCredentialIssued", { enumerable: true, get: function () { return types_js_1.isCredentialIssued; } });
|
|
35
35
|
Object.defineProperty(exports, "unconfiguredCredentialProvider", { enumerable: true, get: function () { return types_js_1.unconfiguredCredentialProvider; } });
|
|
@@ -40,6 +40,8 @@ Object.defineProperty(exports, "basic", { enumerable: true, get: function () { r
|
|
|
40
40
|
Object.defineProperty(exports, "headers", { enumerable: true, get: function () { return kinds_js_1.headers; } });
|
|
41
41
|
var staticTokens_js_1 = require("./identity/staticTokens.js");
|
|
42
42
|
Object.defineProperty(exports, "staticTokens", { enumerable: true, get: function () { return staticTokens_js_1.staticTokens; } });
|
|
43
|
+
var CredentialConsentRequiredError_js_1 = require("./identity/CredentialConsentRequiredError.js");
|
|
44
|
+
Object.defineProperty(exports, "CredentialConsentRequiredError", { enumerable: true, get: function () { return CredentialConsentRequiredError_js_1.CredentialConsentRequiredError; } });
|
|
43
45
|
var withCredentialRetry_js_1 = require("./identity/withCredentialRetry.js");
|
|
44
46
|
Object.defineProperty(exports, "withCredentialRetry", { enumerable: true, get: function () { return withCredentialRetry_js_1.withCredentialRetry; } });
|
|
45
47
|
var agentcore_js_1 = require("./adapters/identity/agentcore.js");
|
package/dist/identity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAWH,gDAAyF;AAAhF,8GAAA,kBAAkB,OAAA;AAAE,0HAAA,8BAA8B,OAAA;AAC3D,gDAS6B;AAR3B,kGAAA,MAAM,OAAA;AACN,kGAAA,MAAM,OAAA;AACN,iGAAA,KAAK,OAAA;AACL,mGAAA,OAAO,OAAA;AAMT,8DAAoF;AAA3E,+GAAA,YAAY,OAAA;
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAWH,gDAAyF;AAAhF,8GAAA,kBAAkB,OAAA;AAAE,0HAAA,8BAA8B,OAAA;AAC3D,gDAS6B;AAR3B,kGAAA,MAAM,OAAA;AACN,kGAAA,MAAM,OAAA;AACN,iGAAA,KAAK,OAAA;AACL,mGAAA,OAAO,OAAA;AAMT,8DAAoF;AAA3E,+GAAA,YAAY,OAAA;AAKrB,kGAGsD;AAFpD,mJAAA,8BAA8B,OAAA;AAGhC,4EAG2C;AAFzC,6HAAA,mBAAmB,OAAA;AAGrB,iEAK0C;AAJxC,iHAAA,iBAAiB,OAAA"}
|
|
@@ -76,7 +76,7 @@ function buildInjectionEngineSubflow(config) {
|
|
|
76
76
|
return (0, footprintjs_1.flowChart)('Gather', gatherStage, 'gather', {
|
|
77
77
|
description: "Snapshot this turn's injection inputs (iteration, history, last tool, LLM-activated)",
|
|
78
78
|
})
|
|
79
|
-
.addFunction('Evaluate', makeEvaluateStage(injections, config.nextSkill), 'evaluate', 'Evaluate every Injection trigger; produce activeInjections + metadata')
|
|
79
|
+
.addFunction('Evaluate', makeEvaluateStage(injections, config.nextSkill, config.explainNextSkill), 'evaluate', 'Evaluate every Injection trigger; produce activeInjections + metadata')
|
|
80
80
|
.addFunction('Route', routeStage, 'route', 'Partition active injections into per-slot buckets (system-prompt / messages / tools)')
|
|
81
81
|
.addFunction('Delta', deltaStage, 'delta', 'Per-slot delta vs last turn: what activated / deactivated / stayed')
|
|
82
82
|
.build();
|
|
@@ -94,7 +94,7 @@ function gatherStage(scope) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
// ── Stage 2: Evaluate (logic identical to the old single stage) ──────────
|
|
97
|
-
function makeEvaluateStage(injections, nextSkill) {
|
|
97
|
+
function makeEvaluateStage(injections, nextSkill, explainNextSkill) {
|
|
98
98
|
return (scope) => {
|
|
99
99
|
const args = scope.$getArgs();
|
|
100
100
|
const ctx = {
|
|
@@ -114,8 +114,13 @@ function makeEvaluateStage(injections, nextSkill) {
|
|
|
114
114
|
// (`nextSkillCursor`) because `currentSkillId` arrives as a readonly INPUT
|
|
115
115
|
// here; the mount's outputMapper maps it onto the parent's mutable
|
|
116
116
|
// `currentSkillId` for the next iteration. Skill-graph agents only.
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
// ONE consultation of the graph per iteration: when the graph can explain
|
|
118
|
+
// itself (8.5.0) the cursor comes out of `.to`, so asking for the cause costs
|
|
119
|
+
// nothing extra and cannot answer a different destination than the routing did.
|
|
120
|
+
const move = explainNextSkill ? explainNextSkill(ctx) : undefined;
|
|
121
|
+
const routes = explainNextSkill !== undefined || nextSkill !== undefined;
|
|
122
|
+
const cursor = move ? move.to : nextSkill ? nextSkill(ctx) : undefined;
|
|
123
|
+
if (routes) {
|
|
119
124
|
scope.$setValue('nextSkillCursor', cursor);
|
|
120
125
|
}
|
|
121
126
|
const evaluation = (0, evaluator_js_1.evaluateInjections)(injections, ctx);
|
|
@@ -145,6 +150,15 @@ function makeEvaluateStage(injections, nextSkill) {
|
|
|
145
150
|
const activePOJOs = evaluation.active.map(types_js_1.projectActiveInjection);
|
|
146
151
|
scope.$setValue('activeInjections', activePOJOs);
|
|
147
152
|
const routing = routingEntriesOf(evaluation.active);
|
|
153
|
+
// Structural copy (the events layer stays decoupled from `CursorMove`), and a
|
|
154
|
+
// POJO so it survives the emit channel's clone.
|
|
155
|
+
const cursorMove = move
|
|
156
|
+
? {
|
|
157
|
+
...(move.from !== undefined && { from: move.from }),
|
|
158
|
+
...(move.to !== undefined && { to: move.to }),
|
|
159
|
+
by: move.by,
|
|
160
|
+
}
|
|
161
|
+
: undefined;
|
|
148
162
|
// Aggregate evaluation metadata is pure OBSERVABILITY — no flow stage
|
|
149
163
|
// reads it — so it goes out the EMIT channel where a recorder/Lens can
|
|
150
164
|
// observe "what was considered, what won, what was skipped and why".
|
|
@@ -162,7 +176,17 @@ function makeEvaluateStage(injections, nextSkill) {
|
|
|
162
176
|
skillCatalog: skillCatalogOf(injections),
|
|
163
177
|
// Routing PROVENANCE for active skill-graph injections — the decision path
|
|
164
178
|
// / edge that reached each. Undefined when none came from a skillGraph().
|
|
179
|
+
//
|
|
180
|
+
// NOTE the difference from `cursorMove` below, which is the whole reason the
|
|
181
|
+
// latter exists: `routing[]` is BUILD-TIME provenance ("how is this skill
|
|
182
|
+
// reachable at all"), stamped once by the compiler. It answers per SKILL, not
|
|
183
|
+
// per HOP. Reading it as the cause of this turn's move is what made a model
|
|
184
|
+
// pick get recorded under a declared edge's label.
|
|
165
185
|
...(routing && { routing }),
|
|
186
|
+
// How the CURSOR actually moved this iteration, straight from the clause that
|
|
187
|
+
// won inside the resolver (8.5.0). Skill-graph agents only; absent for a graph
|
|
188
|
+
// built before `explainNextSkill` existed.
|
|
189
|
+
...(cursorMove && { cursorMove }),
|
|
166
190
|
});
|
|
167
191
|
};
|
|
168
192
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildInjectionEngineSubflow.js","sourceRoot":"","sources":["../../../src/lib/injection-engine/buildInjectionEngineSubflow.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;;;AAEH,6CAAwC;AAExC,oEAA8D;AAC9D,iDAAoD;AACpD,yCAKoB;AACpB,
|
|
1
|
+
{"version":3,"file":"buildInjectionEngineSubflow.js","sourceRoot":"","sources":["../../../src/lib/injection-engine/buildInjectionEngineSubflow.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;;;AAEH,6CAAwC;AAExC,oEAA8D;AAC9D,iDAAoD;AACpD,yCAKoB;AACpB,mDAA+F;AA2D/F,0EAA0E;AAC7D,QAAA,oBAAoB,GAAiB;IAChD,YAAY,EAAE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;AAAtE,2GAAA,UAAU,OAAA;AAEnB,6EAA6E;AAC7E,0EAA0E;AAC1E,qDAAqD;AACrD,qEAIwC;AAHtC,qHAAA,eAAe,OAAA;AAKjB,4EAA4E;AAC5E,8EAA8E;AAC9E,iDA+ByB;AA9BvB,2GAAA,UAAU,OAAA;AACV,4GAAA,WAAW,OAAA;AACX,yHAAA,wBAAwB,OAAA;AA6B1B,mDAO0B;AANxB,+GAAA,aAAa,OAAA;AACb,iHAAA,eAAe,OAAA;AACf,6GAAA,WAAW,OAAA;AAKb,uDAA6F;AAApF,sHAAA,kBAAkB,OAAA;AAAE,uHAAA,mBAAmB,OAAA;AAAE,kHAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Where a skill's BODY actually lands — and the one combination where the honest
|
|
4
|
+
* answer is "nowhere" (8.5.0).
|
|
5
|
+
*
|
|
6
|
+
* `surfaceMode` names a delivery CHANNEL, and `'tool-only'` names the channel that
|
|
7
|
+
* only exists when the model calls `read_skill`: the body is returned as that tool's
|
|
8
|
+
* result, and the system slot suppresses it by design (`buildSystemPromptSlot`,
|
|
9
|
+
* mirrored in `routeActiveInjections`). That is exactly right for a skill `read_skill`
|
|
10
|
+
* activates, which is what the mode was designed against and what every shipped
|
|
11
|
+
* Block-C test covers.
|
|
12
|
+
*
|
|
13
|
+
* It is a hole for a skill the GRAPH activates. A route target, a flat entry and a
|
|
14
|
+
* decision-tree leaf all activate off the cursor, without any `read_skill` call — so
|
|
15
|
+
* the tool result never happens, the system slot suppresses the body anyway, and the
|
|
16
|
+
* body reaches the model through no channel at all. The skill's TOOLS still arrive,
|
|
17
|
+
* which makes it worse than the skill not loading: the model is handed the tools of a
|
|
18
|
+
* procedure it was never told.
|
|
19
|
+
*
|
|
20
|
+
* The rule that closes it is the one 8.4.0 already uses for the `read_skill` gate:
|
|
21
|
+
* `trigger.kind === 'llm-activated'` is precisely "read_skill can really activate
|
|
22
|
+
* this". A skill may claim the read_skill delivery channel exactly when read_skill is
|
|
23
|
+
* what activates it.
|
|
24
|
+
*
|
|
25
|
+
* Refusal rather than a quiet fall back to the system slot, because the author wrote
|
|
26
|
+
* `'tool-only'` to keep the body OUT of the system prompt (token cost, attention
|
|
27
|
+
* placement). Silently putting it back would honour the activation and break the
|
|
28
|
+
* declaration — a different lie, not a fix. `'both'` already means "deliver it either
|
|
29
|
+
* way", so the refusal has a real, one-word answer to name.
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.toolOnlyDeliveryRefusal = exports.activatesByRead = exports.resolvedSurfaceModeOf = void 0;
|
|
33
|
+
const defineSkill_js_1 = require("./factories/defineSkill.js");
|
|
34
|
+
/** A skill's declared surface mode, before any provider resolution. */
|
|
35
|
+
function declaredSurfaceModeOf(skill) {
|
|
36
|
+
const meta = skill.metadata;
|
|
37
|
+
return meta?.surfaceMode ?? 'auto';
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The surface mode a skill will be TREATED as at runtime.
|
|
41
|
+
*
|
|
42
|
+
* Today the runtime compares the literal string, so `'auto'` is its own mode and
|
|
43
|
+
* lands in the system slot — pass no provider and that is what you get back, which
|
|
44
|
+
* is the truth about the current engine.
|
|
45
|
+
*
|
|
46
|
+
* Pass a provider (and model) to ask the OTHER question: what would `'auto'` become
|
|
47
|
+
* if the `resolveSurfaceMode` cascade were wired into the runtime? It resolves to
|
|
48
|
+
* `'tool-only'` for every non-Claude provider, so wiring it in without this guard
|
|
49
|
+
* would silently open the delivered-nowhere hole for every OpenAI / Bedrock / Ollama
|
|
50
|
+
* user at once. Routing both questions through ONE function is what keeps that from
|
|
51
|
+
* being a future accident: the refusal below is written against this, so the day the
|
|
52
|
+
* cascade is wired in, the guard already covers it.
|
|
53
|
+
*/
|
|
54
|
+
function resolvedSurfaceModeOf(skill, provider, model) {
|
|
55
|
+
const declared = declaredSurfaceModeOf(skill);
|
|
56
|
+
if (declared !== 'auto' || provider === undefined)
|
|
57
|
+
return declared;
|
|
58
|
+
return (0, defineSkill_js_1.resolveSurfaceMode)(provider, model);
|
|
59
|
+
}
|
|
60
|
+
exports.resolvedSurfaceModeOf = resolvedSurfaceModeOf;
|
|
61
|
+
/**
|
|
62
|
+
* Can this skill's body be delivered through the `read_skill` tool result?
|
|
63
|
+
*
|
|
64
|
+
* Only if `read_skill` is what activates it. `'llm-activated'` is the one trigger
|
|
65
|
+
* kind that reads `activatedInjectionIds`, which is the only thing a `read_skill`
|
|
66
|
+
* call writes — the same clause the gate's open-skill rule turns on (8.4.0).
|
|
67
|
+
*/
|
|
68
|
+
function activatesByRead(skill) {
|
|
69
|
+
return skill.trigger.kind === 'llm-activated';
|
|
70
|
+
}
|
|
71
|
+
exports.activatesByRead = activatesByRead;
|
|
72
|
+
/** How a refused skill is identified back to its author, so a directory-sized
|
|
73
|
+
* refusal reads as a list of names and reasons rather than one mystery. */
|
|
74
|
+
function describeRouting(skill) {
|
|
75
|
+
const routing = skill.metadata
|
|
76
|
+
?.skillGraph;
|
|
77
|
+
if (routing?.via === 'route') {
|
|
78
|
+
return routing.from
|
|
79
|
+
? `a route target (the graph routes "${routing.from}" → "${skill.id}")`
|
|
80
|
+
: 'a route target';
|
|
81
|
+
}
|
|
82
|
+
if (routing?.via === 'entry')
|
|
83
|
+
return 'a graph entry';
|
|
84
|
+
if (routing?.via === 'tree')
|
|
85
|
+
return 'a decision-tree leaf';
|
|
86
|
+
return `activated by rule (trigger '${skill.trigger.kind}')`;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Refuse every skill that claims the `read_skill` delivery channel without being
|
|
90
|
+
* activated by `read_skill`. Returns the message, or `undefined` when all is well.
|
|
91
|
+
*
|
|
92
|
+
* Runs over the FINAL injection list — the agent is the only place that sees every
|
|
93
|
+
* skill's compiled trigger, whichever call registered it — and names every offender,
|
|
94
|
+
* because `skillsFromDir({ surfaceMode: 'tool-only' })` under a graph refuses a whole
|
|
95
|
+
* directory at once and a list is debuggable where one sample is not.
|
|
96
|
+
*/
|
|
97
|
+
function toolOnlyDeliveryRefusal(injections) {
|
|
98
|
+
const offenders = injections.filter((i) => i.flavor === 'skill' &&
|
|
99
|
+
resolvedSurfaceModeOf(i) === 'tool-only' &&
|
|
100
|
+
!activatesByRead(i) &&
|
|
101
|
+
(i.inject.systemPrompt ?? '').length > 0);
|
|
102
|
+
if (offenders.length === 0)
|
|
103
|
+
return undefined;
|
|
104
|
+
const list = offenders.map((s) => ` • "${s.id}" — ${describeRouting(s)}`).join('\n');
|
|
105
|
+
const subject = offenders.length === 1 ? 'This skill sets' : 'These skills set';
|
|
106
|
+
const its = offenders.length === 1 ? 'its' : 'their';
|
|
107
|
+
return (`Agent: ${subject} surfaceMode: 'tool-only', which delivers the body as the ` +
|
|
108
|
+
`read_skill tool result — but nothing here activates by read_skill, so ${its} ` +
|
|
109
|
+
`body would reach the model NOWHERE: the system slot suppresses a tool-only body ` +
|
|
110
|
+
`by design, and no read_skill call happens to carry it.\n${list}\n` +
|
|
111
|
+
`Use 'both' (system prompt AND tool result) or 'system-prompt'. Only a skill ` +
|
|
112
|
+
`read_skill actually activates — trigger 'llm-activated', which is every skill a ` +
|
|
113
|
+
`graph does not route — can be 'tool-only'.`);
|
|
114
|
+
}
|
|
115
|
+
exports.toolOnlyDeliveryRefusal = toolOnlyDeliveryRefusal;
|
|
116
|
+
//# sourceMappingURL=skillBodyDelivery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillBodyDelivery.js","sourceRoot":"","sources":["../../../src/lib/injection-engine/skillBodyDelivery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAGH,+DAAkF;AAElF,uEAAuE;AACvE,SAAS,qBAAqB,CAAC,KAAgB;IAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,QAAqD,CAAC;IACzE,OAAO,IAAI,EAAE,WAAW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