agentfootprint 16.0.1 → 16.1.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/CAPABILITIES.md +1 -0
- package/dist/core/runRecorders.js +2 -0
- package/dist/core/runRecorders.js.map +1 -1
- package/dist/esm/core/runRecorders.js +2 -0
- package/dist/esm/core/runRecorders.js.map +1 -1
- package/dist/esm/hosting/stream.d.ts +8 -0
- package/dist/esm/hosting/stream.js +101 -35
- package/dist/esm/hosting/stream.js.map +1 -1
- package/dist/esm/injection-engine/skillsFromDir/frontmatter.d.ts +40 -0
- package/dist/esm/injection-engine/skillsFromDir/frontmatter.js +272 -0
- package/dist/esm/injection-engine/skillsFromDir/frontmatter.js.map +1 -0
- package/dist/esm/injection-engine/skillsFromDir.js +2 -270
- package/dist/esm/injection-engine/skillsFromDir.js.map +1 -1
- package/dist/esm/injection-engine/skillsFromDirRoutes.d.ts +1 -1
- package/dist/esm/injection-engine/skillsFromDirRoutes.js +1 -1
- package/dist/esm/lib/humanizeLLMError.d.ts +1 -1
- package/dist/esm/lib/humanizeLLMError.js +4 -1
- package/dist/esm/lib/humanizeLLMError.js.map +1 -1
- package/dist/esm/recorders/core/ErrorBridge.d.ts +3 -0
- package/dist/esm/recorders/core/ErrorBridge.js +3 -1
- package/dist/esm/recorders/core/ErrorBridge.js.map +1 -1
- package/dist/hosting/stream.js +101 -35
- package/dist/hosting/stream.js.map +1 -1
- package/dist/injection-engine/skillsFromDir/frontmatter.js +275 -0
- package/dist/injection-engine/skillsFromDir/frontmatter.js.map +1 -0
- package/dist/injection-engine/skillsFromDir.js +2 -270
- package/dist/injection-engine/skillsFromDir.js.map +1 -1
- package/dist/injection-engine/skillsFromDirRoutes.js +1 -1
- package/dist/lib/humanizeLLMError.js +4 -1
- package/dist/lib/humanizeLLMError.js.map +1 -1
- package/dist/recorders/core/ErrorBridge.js +3 -1
- package/dist/recorders/core/ErrorBridge.js.map +1 -1
- package/dist/types/core/runRecorders.d.ts.map +1 -1
- package/dist/types/hosting/stream.d.ts +8 -0
- package/dist/types/hosting/stream.d.ts.map +1 -1
- package/dist/types/injection-engine/skillsFromDir/frontmatter.d.ts +41 -0
- package/dist/types/injection-engine/skillsFromDir/frontmatter.d.ts.map +1 -0
- package/dist/types/injection-engine/skillsFromDir.d.ts.map +1 -1
- package/dist/types/injection-engine/skillsFromDirRoutes.d.ts +1 -1
- package/dist/types/lib/humanizeLLMError.d.ts +1 -1
- package/dist/types/lib/humanizeLLMError.d.ts.map +1 -1
- package/dist/types/recorders/core/ErrorBridge.d.ts +3 -0
- package/dist/types/recorders/core/ErrorBridge.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/hosting/stream.js
CHANGED
|
@@ -36,13 +36,16 @@ async function* toSSE(runner, options = {}) {
|
|
|
36
36
|
const format = options.format ?? 'full';
|
|
37
37
|
const heartbeatMs = options.heartbeatMs ?? 0;
|
|
38
38
|
const framing = framingOf(options);
|
|
39
|
-
|
|
39
|
+
const start = options.start;
|
|
40
|
+
// A composition's bound transcript reads the served record.
|
|
40
41
|
const native = (0, runnerLive_js_1.runnerLive)(runner);
|
|
41
42
|
const ownsTurn = native?.turn !== undefined;
|
|
42
|
-
|
|
43
|
+
const transcript = start !== undefined && format === 'text' && !ownsTurn;
|
|
44
|
+
// Events wait in arrival order until the consumer reads them.
|
|
43
45
|
const queue = [];
|
|
44
46
|
let waiter = null;
|
|
45
47
|
let done = false;
|
|
48
|
+
let accepting = start === undefined;
|
|
46
49
|
const wakeup = () => {
|
|
47
50
|
if (waiter) {
|
|
48
51
|
const w = waiter;
|
|
@@ -62,10 +65,12 @@ async function* toSSE(runner, options = {}) {
|
|
|
62
65
|
// same `turn_end` event, paired by the stage that ended the turn. A runner
|
|
63
66
|
// that is not a RunnerBase has no redaction and no live taps: its events
|
|
64
67
|
// are the record and the reply at once.
|
|
65
|
-
const live = format === 'text' ? native : undefined;
|
|
68
|
+
const live = format === 'text' && !transcript ? native : undefined;
|
|
66
69
|
const replies = new Map();
|
|
67
70
|
const answers = new Map();
|
|
68
71
|
const offReplies = live?.onRealEvent((event) => {
|
|
72
|
+
if (!accepting)
|
|
73
|
+
return;
|
|
69
74
|
if (event.type === 'agentfootprint.agent.turn_end') {
|
|
70
75
|
answers.set(event.meta?.runtimeStageId ?? '', unrefusedAnswerOf(event));
|
|
71
76
|
return;
|
|
@@ -111,9 +116,12 @@ async function* toSSE(runner, options = {}) {
|
|
|
111
116
|
let closesOnPause = false;
|
|
112
117
|
const innerTurns = [];
|
|
113
118
|
const listener = (event) => {
|
|
119
|
+
if (!accepting)
|
|
120
|
+
return;
|
|
114
121
|
const mounted = ownsTurn && event.meta?.mountedTurn === true;
|
|
115
122
|
// These boundaries establish scope even when the output filter drops them.
|
|
116
|
-
if (
|
|
123
|
+
if (!transcript &&
|
|
124
|
+
(ownsTurn || format === 'text') &&
|
|
117
125
|
!mounted &&
|
|
118
126
|
event.type === 'agentfootprint.agent.turn_start') {
|
|
119
127
|
const path = pathOf(event);
|
|
@@ -122,33 +130,43 @@ async function* toSSE(runner, options = {}) {
|
|
|
122
130
|
else if (!ownsTurn)
|
|
123
131
|
innerTurns.push(path);
|
|
124
132
|
}
|
|
125
|
-
if (event.type === 'agentfootprint.pause.resume' && ownsTurn && !rootTurnOpen) {
|
|
126
|
-
// A stream opened on resume closes again if that leg pauses.
|
|
127
|
-
closesOnPause = true;
|
|
128
|
-
}
|
|
129
133
|
const turnEnd = event.type === 'agentfootprint.agent.turn_end';
|
|
130
134
|
const rootEnd = turnEnd && event.meta?.rootTurn === true;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
if (start === undefined) {
|
|
136
|
+
if (event.type === 'agentfootprint.pause.resume' && ownsTurn && !rootTurnOpen) {
|
|
137
|
+
// A stream opened on resume closes again if that leg pauses.
|
|
138
|
+
closesOnPause = true;
|
|
139
|
+
}
|
|
140
|
+
const terminal = event.type === 'agentfootprint.error.fatal' ||
|
|
141
|
+
(ownsTurn ? rootEnd : turnEnd) ||
|
|
142
|
+
(closesOnPause && event.type === 'agentfootprint.pause.request');
|
|
143
|
+
// The output filter can omit a terminal event without keeping the stream open.
|
|
144
|
+
if (terminal) {
|
|
145
|
+
done = true;
|
|
146
|
+
wakeup();
|
|
147
|
+
}
|
|
139
148
|
}
|
|
140
149
|
// Consume paired values before applying either output filter.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
150
|
+
let reply;
|
|
151
|
+
if (event.type === 'agentfootprint.stream.token') {
|
|
152
|
+
if (live !== undefined)
|
|
153
|
+
reply = replyFor(event);
|
|
154
|
+
else if (transcript)
|
|
155
|
+
reply = event.payload?.content;
|
|
156
|
+
}
|
|
157
|
+
const answer = format === 'text' && !transcript && turnEnd ? answerFor(event, rootEnd, mounted) : undefined;
|
|
145
158
|
if (filter && !filter(event))
|
|
146
159
|
return;
|
|
147
160
|
// Mounted call boundaries leave the root answer's streamed prefix intact.
|
|
148
161
|
if (format === 'text' && mounted)
|
|
149
162
|
return;
|
|
163
|
+
if (transcript && typeof reply !== 'string')
|
|
164
|
+
return;
|
|
150
165
|
queue.push(reply !== undefined
|
|
151
|
-
? {
|
|
166
|
+
? {
|
|
167
|
+
type: transcript ? 'agentfootprint.stream.token' : event.type,
|
|
168
|
+
payload: { content: reply },
|
|
169
|
+
}
|
|
152
170
|
: format === 'text' && turnEnd
|
|
153
171
|
? {
|
|
154
172
|
type: event.type,
|
|
@@ -157,23 +175,51 @@ async function* toSSE(runner, options = {}) {
|
|
|
157
175
|
: event);
|
|
158
176
|
wakeup();
|
|
159
177
|
};
|
|
160
|
-
|
|
161
|
-
const unsub = () => {
|
|
162
|
-
offRecord();
|
|
163
|
-
offReplies?.();
|
|
164
|
-
};
|
|
178
|
+
let offRecord;
|
|
165
179
|
let heartbeat;
|
|
166
|
-
|
|
167
|
-
heartbeat
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
180
|
+
const release = () => {
|
|
181
|
+
if (heartbeat !== undefined)
|
|
182
|
+
clearInterval(heartbeat);
|
|
183
|
+
replies.clear();
|
|
184
|
+
answers.clear();
|
|
185
|
+
try {
|
|
186
|
+
offRecord?.();
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
offReplies?.();
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const finish = () => {
|
|
193
|
+
if (done)
|
|
194
|
+
return;
|
|
195
|
+
accepting = false;
|
|
196
|
+
done = true;
|
|
197
|
+
wakeup();
|
|
198
|
+
try {
|
|
199
|
+
release();
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// A foreign unsubscribe cannot reopen a settled invocation.
|
|
203
|
+
}
|
|
204
|
+
};
|
|
172
205
|
/** Frames written to THIS stream so far — the {@link SseFramePosition} of the next one. */
|
|
173
206
|
let written = 0;
|
|
174
207
|
/** 'text': what this stream wrote since the last `llm_start`; `undefined` = nothing. */
|
|
175
208
|
let streamed;
|
|
176
209
|
try {
|
|
210
|
+
offRecord = runner.on('*', listener);
|
|
211
|
+
if (heartbeatMs > 0) {
|
|
212
|
+
heartbeat = setInterval(() => {
|
|
213
|
+
if (!accepting)
|
|
214
|
+
return;
|
|
215
|
+
queue.push({ type: '__heartbeat' });
|
|
216
|
+
wakeup();
|
|
217
|
+
}, heartbeatMs);
|
|
218
|
+
}
|
|
219
|
+
if (start !== undefined) {
|
|
220
|
+
accepting = true;
|
|
221
|
+
observeSettlement(start, finish);
|
|
222
|
+
}
|
|
177
223
|
while (!done || queue.length > 0) {
|
|
178
224
|
while (queue.length > 0) {
|
|
179
225
|
// queue.length > 0 guards the shift; result is defined.
|
|
@@ -215,12 +261,32 @@ async function* toSSE(runner, options = {}) {
|
|
|
215
261
|
}
|
|
216
262
|
}
|
|
217
263
|
finally {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
264
|
+
if (start === undefined) {
|
|
265
|
+
release();
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
finish();
|
|
269
|
+
// An early reader exit may still have admitted events it will never read.
|
|
270
|
+
queue.length = 0;
|
|
271
|
+
}
|
|
221
272
|
}
|
|
222
273
|
}
|
|
223
274
|
exports.toSSE = toSSE;
|
|
275
|
+
/** Observe either outcome without reading its value or replacing the caller's promise. */
|
|
276
|
+
function observeSettlement(start, finish) {
|
|
277
|
+
try {
|
|
278
|
+
const pending = start();
|
|
279
|
+
const then = pending?.then;
|
|
280
|
+
if (typeof then === 'function') {
|
|
281
|
+
void then.call(pending, finish, finish);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
// A synchronous failure stops the stream without producing a frame.
|
|
287
|
+
}
|
|
288
|
+
finish();
|
|
289
|
+
}
|
|
224
290
|
/**
|
|
225
291
|
* Class form for consumers who prefer `new SSEFormatter(runner).stream()`.
|
|
226
292
|
* Identical behavior to `toSSE(runner)` — pick by preference.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/hosting/stream.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAKH,yDAAmD;AACnD,oDAAgD;AAChD,2DAAqD;
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/hosting/stream.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAKH,yDAAmD;AACnD,oDAAgD;AAChD,2DAAqD;AAqIrD;;;;GAIG;AACU,QAAA,iBAAiB,GAAoC;IAChE,WAAW,EAAE,mBAAmB;IAChC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACI,KAAK,SAAS,CAAC,CAAC,KAAK,CAC1B,MAAqC,EACrC,UAAwB,EAAE;I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C,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSkillFile = void 0;
|
|
4
|
+
const skillsFromDirRoutes_js_1 = require("../skillsFromDirRoutes.js");
|
|
5
|
+
/**
|
|
6
|
+
* Skill ids ride into `read_skill`'s `enum` and into the skill-graph's node
|
|
7
|
+
* ids. The house tool-name charset keeps them quotable in a prompt, comparable
|
|
8
|
+
* as plain strings, and safe as an object key.
|
|
9
|
+
*/
|
|
10
|
+
const SKILL_NAME_RE = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
11
|
+
/**
|
|
12
|
+
* Parse one `SKILL.md`. Every refusal names the file — a loader that says
|
|
13
|
+
* "malformed frontmatter" over a directory of forty files has told you nothing.
|
|
14
|
+
*
|
|
15
|
+
* The grammar is deliberately small: an opening `---` line, `key: value` lines
|
|
16
|
+
* (`#` comments and blank lines skipped, single/double quotes stripped), a
|
|
17
|
+
* closing `---` line, then the body. A key with NOTHING after the colon opens a
|
|
18
|
+
* block list, whose items are the following `- …` lines. Keys other than the
|
|
19
|
+
* five known ones are IGNORED rather than rejected, so a file carrying extra
|
|
20
|
+
* frontmatter for another tool still loads here.
|
|
21
|
+
*/
|
|
22
|
+
function parseSkillFile(raw, file) {
|
|
23
|
+
// Strip a UTF-8 BOM — an editor artifact, not the author's intent.
|
|
24
|
+
const text = raw.charCodeAt(0) === 0xfeff ? raw.slice(1) : raw;
|
|
25
|
+
const lines = text.split(/\r?\n/);
|
|
26
|
+
if (lines[0]?.trim() !== '---') {
|
|
27
|
+
throw new Error(`skillsFromDir: '${file}' does not start with a '---' frontmatter block. ` +
|
|
28
|
+
`Expected:\n---\nname: my-skill\ndescription: When to use it.\n---\n<the body>`);
|
|
29
|
+
}
|
|
30
|
+
const closingIndex = lines.findIndex((line, i) => i > 0 && line.trim() === '---');
|
|
31
|
+
if (closingIndex === -1) {
|
|
32
|
+
throw new Error(`skillsFromDir: '${file}' opens a '---' frontmatter block that is never closed. ` +
|
|
33
|
+
`Add a '---' line after the last frontmatter key.`);
|
|
34
|
+
}
|
|
35
|
+
const fields = parseFrontmatterFields(lines, closingIndex, file);
|
|
36
|
+
const name = readScalar(fields, 'name', file);
|
|
37
|
+
const description = readScalar(fields, 'description', file);
|
|
38
|
+
const body = lines
|
|
39
|
+
.slice(closingIndex + 1)
|
|
40
|
+
.join('\n')
|
|
41
|
+
.trim();
|
|
42
|
+
if (name.length === 0) {
|
|
43
|
+
throw new Error(`skillsFromDir: '${file}' frontmatter is missing 'name'. It becomes the skill id the ` +
|
|
44
|
+
`model passes to read_skill.`);
|
|
45
|
+
}
|
|
46
|
+
if (!SKILL_NAME_RE.test(name)) {
|
|
47
|
+
throw new Error(`skillsFromDir: '${file}' frontmatter name '${name}' must match ` +
|
|
48
|
+
`/^[a-zA-Z0-9_-]{1,64}$/ — it is the id the model passes to read_skill.`);
|
|
49
|
+
}
|
|
50
|
+
if (description.length === 0) {
|
|
51
|
+
throw new Error(`skillsFromDir: '${file}' frontmatter is missing 'description'. It is the ONLY thing ` +
|
|
52
|
+
`the model reads when deciding whether to open this skill.`);
|
|
53
|
+
}
|
|
54
|
+
if (body.length === 0) {
|
|
55
|
+
throw new Error(`skillsFromDir: '${file}' has no body after the closing '---'. The body is what the ` +
|
|
56
|
+
`model reads once it activates the skill.`);
|
|
57
|
+
}
|
|
58
|
+
const toolNames = readToolNames(fields, file);
|
|
59
|
+
const steps = readSteps(fields, file, toolNames);
|
|
60
|
+
const onSkip = readOnSkip(fields, file, steps);
|
|
61
|
+
const routes = readRoutes(fields, file, toolNames);
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
description,
|
|
65
|
+
body,
|
|
66
|
+
...(toolNames !== undefined && { toolNames }),
|
|
67
|
+
...(steps !== undefined && { steps }),
|
|
68
|
+
...(onSkip !== undefined && { onSkip }),
|
|
69
|
+
...(routes !== undefined && { routes }),
|
|
70
|
+
file,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
exports.parseSkillFile = parseSkillFile;
|
|
74
|
+
/**
|
|
75
|
+
* The frontmatter lines → `key → value` map.
|
|
76
|
+
*
|
|
77
|
+
* A `- …` line is an ITEM only while a list is open (the line above it was a
|
|
78
|
+
* key with an empty value). Anywhere else it falls through to the `key: value`
|
|
79
|
+
* rule exactly as it always did — so a stray dash in somebody's unknown key
|
|
80
|
+
* keeps loading, and only a deliberate block list is read as one.
|
|
81
|
+
*/
|
|
82
|
+
function parseFrontmatterFields(lines, closingIndex, file) {
|
|
83
|
+
const fields = new Map();
|
|
84
|
+
let openList;
|
|
85
|
+
for (let i = 1; i < closingIndex; i++) {
|
|
86
|
+
const line = lines[i] ?? '';
|
|
87
|
+
const trimmed = line.trim();
|
|
88
|
+
if (trimmed.length === 0 || trimmed.startsWith('#'))
|
|
89
|
+
continue;
|
|
90
|
+
if (openList !== undefined && (trimmed === '-' || trimmed.startsWith('- '))) {
|
|
91
|
+
const item = trimmed === '-' ? '' : trimmed.slice(2).trim();
|
|
92
|
+
const separator = item.indexOf(':');
|
|
93
|
+
openList.push(separator === -1
|
|
94
|
+
? { key: item, line: i + 1 }
|
|
95
|
+
: {
|
|
96
|
+
key: item.slice(0, separator).trim(),
|
|
97
|
+
value: unquote(item.slice(separator + 1).trim()),
|
|
98
|
+
line: i + 1,
|
|
99
|
+
});
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const separator = line.indexOf(':');
|
|
103
|
+
if (separator === -1) {
|
|
104
|
+
throw new Error(`skillsFromDir: '${file}' frontmatter line ${i + 1} is not 'key: value' — got ` +
|
|
105
|
+
`${JSON.stringify(line)}.`);
|
|
106
|
+
}
|
|
107
|
+
const key = line.slice(0, separator).trim();
|
|
108
|
+
if (key.length === 0) {
|
|
109
|
+
throw new Error(`skillsFromDir: '${file}' frontmatter line ${i + 1} has an empty key — got ` +
|
|
110
|
+
`${JSON.stringify(line)}.`);
|
|
111
|
+
}
|
|
112
|
+
const value = unquote(line.slice(separator + 1).trim());
|
|
113
|
+
if (value.length === 0) {
|
|
114
|
+
// An empty value OPENS a list. With no items after it the field stays an
|
|
115
|
+
// empty list, which every reader below treats exactly as the empty string
|
|
116
|
+
// it used to be — so `name:` with nothing after it still says "missing
|
|
117
|
+
// 'name'", not something new about lists.
|
|
118
|
+
const items = [];
|
|
119
|
+
openList = items;
|
|
120
|
+
fields.set(key, { kind: 'list', items });
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
openList = undefined;
|
|
124
|
+
fields.set(key, { kind: 'scalar', text: value });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return fields;
|
|
128
|
+
}
|
|
129
|
+
/** A single-valued key, as it always read. An empty block list reads as '' — a
|
|
130
|
+
* key with nothing under it never carried a value in the first place. */
|
|
131
|
+
function readScalar(fields, key, file) {
|
|
132
|
+
const field = fields.get(key);
|
|
133
|
+
if (field === undefined)
|
|
134
|
+
return '';
|
|
135
|
+
if (field.kind === 'scalar')
|
|
136
|
+
return field.text;
|
|
137
|
+
if (field.items.length === 0)
|
|
138
|
+
return '';
|
|
139
|
+
throw new Error(`skillsFromDir: '${file}' frontmatter '${key}' is a list, and '${key}' takes one value. ` +
|
|
140
|
+
`Write it as '${key}: <value>' on one line.`);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* `tools:` → the declared names, or undefined when the key is absent.
|
|
144
|
+
*
|
|
145
|
+
* Two spellings, because both read naturally at the size they are for:
|
|
146
|
+
* `tools: a, b` for the two-tool skill, and a block list once there are six.
|
|
147
|
+
*/
|
|
148
|
+
function readToolNames(fields, file) {
|
|
149
|
+
const field = fields.get('tools');
|
|
150
|
+
if (field === undefined)
|
|
151
|
+
return undefined;
|
|
152
|
+
const names = field.kind === 'scalar'
|
|
153
|
+
? field.text
|
|
154
|
+
.split(',')
|
|
155
|
+
.map((n) => unquote(n.trim()))
|
|
156
|
+
.filter((n) => n.length > 0)
|
|
157
|
+
: field.items.map((item) => {
|
|
158
|
+
if (item.value !== undefined) {
|
|
159
|
+
throw new Error(`skillsFromDir: '${file}' line ${item.line}: a 'tools' item is a NAME, not a ` +
|
|
160
|
+
`pair — write '- ${item.key}'. (Did you mean to put this under 'steps', where ` +
|
|
161
|
+
`each item is '- <tool>: <why>'?)`);
|
|
162
|
+
}
|
|
163
|
+
return item.key;
|
|
164
|
+
});
|
|
165
|
+
if (names.length === 0) {
|
|
166
|
+
throw new Error(`skillsFromDir: '${file}' declares 'tools' with no names. Say what you mean and omit ` +
|
|
167
|
+
`the key — a skill with no tools is exactly what this loader has always produced. ` +
|
|
168
|
+
`Otherwise: 'tools: lookup_order, issue_refund', or a '- <name>' block list.`);
|
|
169
|
+
}
|
|
170
|
+
const seen = new Set();
|
|
171
|
+
for (const name of names) {
|
|
172
|
+
if (seen.has(name)) {
|
|
173
|
+
throw new Error(`skillsFromDir: '${file}' lists the tool '${name}' twice in 'tools'. Each tool ` +
|
|
174
|
+
`belongs to a skill once (a skill's tools must be unique within itself); repeat it ` +
|
|
175
|
+
`in 'steps' instead if the procedure runs it twice.`);
|
|
176
|
+
}
|
|
177
|
+
seen.add(name);
|
|
178
|
+
}
|
|
179
|
+
return names;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* `steps:` → the procedure, as data.
|
|
183
|
+
*
|
|
184
|
+
* Validated against the file's OWN `tools` here, ahead of `defineSkill`'s
|
|
185
|
+
* identical check, for one reason: this message can name the FILE and the LINE.
|
|
186
|
+
* `defineSkill` sees a skill id and cannot.
|
|
187
|
+
*/
|
|
188
|
+
function readSteps(fields, file, toolNames) {
|
|
189
|
+
const field = fields.get('steps');
|
|
190
|
+
if (field === undefined)
|
|
191
|
+
return undefined;
|
|
192
|
+
if (field.kind === 'scalar') {
|
|
193
|
+
throw new Error(`skillsFromDir: '${file}' writes 'steps' on one line, and a procedure is an ORDERED ` +
|
|
194
|
+
`list of pairs. Write it as a block:\nsteps:\n - lookup_order: look up the order ` +
|
|
195
|
+
`first\n - issue_refund: refund only what the lookup found`);
|
|
196
|
+
}
|
|
197
|
+
if (field.items.length === 0) {
|
|
198
|
+
throw new Error(`skillsFromDir: '${file}' declares 'steps' with no items. Say what you mean and omit ` +
|
|
199
|
+
`the key — a skill without steps is byte-identical to one that never heard of them.`);
|
|
200
|
+
}
|
|
201
|
+
if (toolNames === undefined) {
|
|
202
|
+
throw new Error(`skillsFromDir: '${file}' declares 'steps' but no 'tools'. Every step runs one of the ` +
|
|
203
|
+
`skill's own tools, so a sequence with nothing to sequence can never engage. Add ` +
|
|
204
|
+
`'tools: …', or drop 'steps'.`);
|
|
205
|
+
}
|
|
206
|
+
const declared = new Set(toolNames);
|
|
207
|
+
return field.items.map((item) => {
|
|
208
|
+
if (item.value === undefined || item.value.length === 0) {
|
|
209
|
+
throw new Error(`skillsFromDir: '${file}' line ${item.line}: every step is '- <tool>: <why>' and ` +
|
|
210
|
+
`this one has no why. The note is the sentence the model reads about why the step ` +
|
|
211
|
+
`exists — a step without one is a force-march instruction, and the note is the ` +
|
|
212
|
+
`whole point.`);
|
|
213
|
+
}
|
|
214
|
+
if (item.key.length === 0) {
|
|
215
|
+
throw new Error(`skillsFromDir: '${file}' line ${item.line}: this step names no tool. Every step is ` +
|
|
216
|
+
`'- <tool>: <why>'.`);
|
|
217
|
+
}
|
|
218
|
+
if (!declared.has(item.key)) {
|
|
219
|
+
throw new Error(`skillsFromDir: '${file}' line ${item.line}: step '${item.key}' is not in this ` +
|
|
220
|
+
`file's 'tools' (${toolNames.join(', ')}). Steps may only sequence the skill's own ` +
|
|
221
|
+
`tools — add it to 'tools', or fix the name. Everything else the agent has stays ` +
|
|
222
|
+
`available as an escape hatch, unsequenced.`);
|
|
223
|
+
}
|
|
224
|
+
return { tool: item.key, note: item.value };
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* `routes:` → the edges out of this skill (9.43.0), as data.
|
|
229
|
+
*
|
|
230
|
+
* A block list, like `steps:` and for the same reason: routing is an ordered
|
|
231
|
+
* list of pairs (a target and its guard), and one line cannot carry that
|
|
232
|
+
* without a separator soup. The grammar itself — and every refusal in it —
|
|
233
|
+
* lives in `skillsFromDirRoutes.ts`; this reader only decides that the key is
|
|
234
|
+
* present and shaped like a list.
|
|
235
|
+
*/
|
|
236
|
+
function readRoutes(fields, file, toolNames) {
|
|
237
|
+
const field = fields.get('routes');
|
|
238
|
+
if (field === undefined)
|
|
239
|
+
return undefined;
|
|
240
|
+
if (field.kind === 'scalar') {
|
|
241
|
+
throw new Error(`skillsFromDir: '${file}' writes 'routes' on one line, and routing is a LIST of edges ` +
|
|
242
|
+
`(each with its own guard). Write it as a block:\nroutes:\n - escalation: on ` +
|
|
243
|
+
`issue_refund status=denied\n - receipts: on issue_refund`);
|
|
244
|
+
}
|
|
245
|
+
return (0, skillsFromDirRoutes_js_1.readDeclaredRoutes)(field.items, file, toolNames);
|
|
246
|
+
}
|
|
247
|
+
/** `onSkip:` → the skip policy. Refused here rather than at `defineSkill` so
|
|
248
|
+
* the message can name the file the author has to open. */
|
|
249
|
+
function readOnSkip(fields, file, steps) {
|
|
250
|
+
if (fields.get('onSkip') === undefined)
|
|
251
|
+
return undefined;
|
|
252
|
+
const raw = readScalar(fields, 'onSkip', file);
|
|
253
|
+
if (steps === undefined) {
|
|
254
|
+
throw new Error(`skillsFromDir: '${file}' declares 'onSkip' with no 'steps'. It says what a SKIPPED ` +
|
|
255
|
+
`step does, and this file declares no steps. Add 'steps:', or drop 'onSkip'.`);
|
|
256
|
+
}
|
|
257
|
+
if (raw !== 'advance' && raw !== 'hold') {
|
|
258
|
+
throw new Error(`skillsFromDir: '${file}' declares onSkip '${raw}', which is not a policy this ` +
|
|
259
|
+
`library has. The two are 'advance' (record the skip and move on — the default) and ` +
|
|
260
|
+
`'hold' (record the skip and keep the step current).`);
|
|
261
|
+
}
|
|
262
|
+
return raw;
|
|
263
|
+
}
|
|
264
|
+
/** Strip one layer of matching single or double quotes from a YAML-ish scalar. */
|
|
265
|
+
function unquote(value) {
|
|
266
|
+
if (value.length >= 2) {
|
|
267
|
+
const first = value[0];
|
|
268
|
+
const last = value[value.length - 1];
|
|
269
|
+
if ((first === '"' && last === '"') || (first === "'" && last === "'")) {
|
|
270
|
+
return value.slice(1, -1);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return value;
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=frontmatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../../src/injection-engine/skillsFromDir/frontmatter.ts"],"names":[],"mappings":";;;AACA,sEAAmF;AAEnF;;;;GAIG;AACH,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAmD9C;;;;;;;;;;GAUG;AACH,SAAS,cAAc,CAAC,GAAW,EAAE,IAAY;IAC/C,mEAAmE;IACnE,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAElC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,mBAAmB,IAAI,mDAAmD;YACxE,+EAA+E,CAClF,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC;IAClF,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,mBAAmB,IAAI,0DAA0D;YAC/E,kD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