@sprucelabs/sprucebot-llm 18.1.5 → 18.1.6
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.
|
@@ -187,6 +187,15 @@ export default class ResponseParserV2 {
|
|
|
187
187
|
let message = response.replace(DONE_TOKEN, '').trim();
|
|
188
188
|
let state = undefined;
|
|
189
189
|
let callbackResults = undefined;
|
|
190
|
+
const missingParens = message.matchAll(/^@(\w+) \{.*\}/gm);
|
|
191
|
+
for (const match of missingParens) {
|
|
192
|
+
const name = match[1];
|
|
193
|
+
const error = this.renderCallbackResults({
|
|
194
|
+
name,
|
|
195
|
+
error: `Missing parentheses for @${name}()`,
|
|
196
|
+
}).trim();
|
|
197
|
+
callbackResults = `${callbackResults !== null && callbackResults !== void 0 ? callbackResults : ''}\n${error}`.trim();
|
|
198
|
+
}
|
|
190
199
|
// Enter the pass when any @name( call shape is present (incl. typos)
|
|
191
200
|
// or when a registered callback name appears as a call prefix.
|
|
192
201
|
const hasCallShape = message != null && /^[ \t]*@\w+\(/m.test(message);
|
|
@@ -195,7 +204,8 @@ export default class ResponseParserV2 {
|
|
|
195
204
|
const hasCallbacks = hasCallShape || hasRegisteredName;
|
|
196
205
|
if (hasCallbacks) {
|
|
197
206
|
const { callbackResults: c, message: m } = yield this.invokeCallbacks(message, callbacks);
|
|
198
|
-
callbackResults =
|
|
207
|
+
callbackResults =
|
|
208
|
+
`${callbackResults !== null && callbackResults !== void 0 ? callbackResults : ''}\n${c !== null && c !== void 0 ? c : ''}`.trim() || undefined;
|
|
199
209
|
message = m;
|
|
200
210
|
}
|
|
201
211
|
const hasState = response.includes('@updateState');
|
|
@@ -183,6 +183,15 @@ class ResponseParserV2 {
|
|
|
183
183
|
let message = response.replace(templates_1.DONE_TOKEN, '').trim();
|
|
184
184
|
let state = undefined;
|
|
185
185
|
let callbackResults = undefined;
|
|
186
|
+
const missingParens = message.matchAll(/^@(\w+) \{.*\}/gm);
|
|
187
|
+
for (const match of missingParens) {
|
|
188
|
+
const name = match[1];
|
|
189
|
+
const error = this.renderCallbackResults({
|
|
190
|
+
name,
|
|
191
|
+
error: `Missing parentheses for @${name}()`,
|
|
192
|
+
}).trim();
|
|
193
|
+
callbackResults = `${callbackResults ?? ''}\n${error}`.trim();
|
|
194
|
+
}
|
|
186
195
|
// Enter the pass when any @name( call shape is present (incl. typos)
|
|
187
196
|
// or when a registered callback name appears as a call prefix.
|
|
188
197
|
const hasCallShape = message != null && /^[ \t]*@\w+\(/m.test(message);
|
|
@@ -191,7 +200,8 @@ class ResponseParserV2 {
|
|
|
191
200
|
const hasCallbacks = hasCallShape || hasRegisteredName;
|
|
192
201
|
if (hasCallbacks) {
|
|
193
202
|
const { callbackResults: c, message: m } = await this.invokeCallbacks(message, callbacks);
|
|
194
|
-
callbackResults =
|
|
203
|
+
callbackResults =
|
|
204
|
+
`${callbackResults ?? ''}\n${c ?? ''}`.trim() || undefined;
|
|
195
205
|
message = m;
|
|
196
206
|
}
|
|
197
207
|
const hasState = response.includes('@updateState');
|