@granular-software/sdk 0.4.83 → 0.4.84
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/dist/agent-evals.js +13 -2
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +13 -2
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/cli/index.js +14 -3
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -292,16 +292,27 @@ function wrap(fn, name, reference, process10, options = {}) {
|
|
|
292
292
|
validate(options.contract?.args, args);
|
|
293
293
|
phase2 = "execution";
|
|
294
294
|
const value = fn.apply(this, args);
|
|
295
|
+
const observeResult = (result) => {
|
|
296
|
+
let succeeded = true;
|
|
297
|
+
try {
|
|
298
|
+
succeeded = (options.succeeded ?? process10?.succeeded)?.(result) ?? true;
|
|
299
|
+
} catch {
|
|
300
|
+
}
|
|
301
|
+
if (succeeded)
|
|
302
|
+
emit2("completed");
|
|
303
|
+
else
|
|
304
|
+
emit2("failed", "execution");
|
|
305
|
+
};
|
|
295
306
|
const complete = (result) => {
|
|
296
307
|
phase2 = "output";
|
|
297
308
|
validate(options.contract?.result, result);
|
|
298
|
-
|
|
309
|
+
observeResult(result);
|
|
299
310
|
return result;
|
|
300
311
|
};
|
|
301
312
|
if (value && typeof value.then === "function") {
|
|
302
313
|
if (options.contract?.result)
|
|
303
314
|
return Promise.resolve(value).then(complete).catch(failed);
|
|
304
|
-
void Promise.resolve(value).then(
|
|
315
|
+
void Promise.resolve(value).then(observeResult, () => emit2("failed", "execution"));
|
|
305
316
|
return value;
|
|
306
317
|
}
|
|
307
318
|
return complete(value);
|
|
@@ -13829,7 +13840,7 @@ var {
|
|
|
13829
13840
|
} = import_index.default;
|
|
13830
13841
|
|
|
13831
13842
|
// package.json
|
|
13832
|
-
var version = "0.4.
|
|
13843
|
+
var version = "0.4.84";
|
|
13833
13844
|
var package_default = {
|
|
13834
13845
|
version};
|
|
13835
13846
|
|
package/dist/index.js
CHANGED
|
@@ -241,16 +241,27 @@ function wrap(fn, name, reference, process2, options = {}) {
|
|
|
241
241
|
validate(options.contract?.args, args);
|
|
242
242
|
phase = "execution";
|
|
243
243
|
const value = fn.apply(this, args);
|
|
244
|
+
const observeResult = (result) => {
|
|
245
|
+
let succeeded = true;
|
|
246
|
+
try {
|
|
247
|
+
succeeded = (options.succeeded ?? process2?.succeeded)?.(result) ?? true;
|
|
248
|
+
} catch {
|
|
249
|
+
}
|
|
250
|
+
if (succeeded)
|
|
251
|
+
emit("completed");
|
|
252
|
+
else
|
|
253
|
+
emit("failed", "execution");
|
|
254
|
+
};
|
|
244
255
|
const complete = (result) => {
|
|
245
256
|
phase = "output";
|
|
246
257
|
validate(options.contract?.result, result);
|
|
247
|
-
|
|
258
|
+
observeResult(result);
|
|
248
259
|
return result;
|
|
249
260
|
};
|
|
250
261
|
if (value && typeof value.then === "function") {
|
|
251
262
|
if (options.contract?.result)
|
|
252
263
|
return Promise.resolve(value).then(complete).catch(failed);
|
|
253
|
-
void Promise.resolve(value).then(
|
|
264
|
+
void Promise.resolve(value).then(observeResult, () => emit("failed", "execution"));
|
|
254
265
|
return value;
|
|
255
266
|
}
|
|
256
267
|
return complete(value);
|