@granular-software/sdk 0.4.82 → 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/agent-evals.mjs
CHANGED
|
@@ -8706,16 +8706,27 @@ function wrap(fn, name, reference, process2, options = {}) {
|
|
|
8706
8706
|
validate(options.contract?.args, args);
|
|
8707
8707
|
phase = "execution";
|
|
8708
8708
|
const value = fn.apply(this, args);
|
|
8709
|
+
const observeResult = (result) => {
|
|
8710
|
+
let succeeded = true;
|
|
8711
|
+
try {
|
|
8712
|
+
succeeded = (options.succeeded ?? process2?.succeeded)?.(result) ?? true;
|
|
8713
|
+
} catch {
|
|
8714
|
+
}
|
|
8715
|
+
if (succeeded)
|
|
8716
|
+
emit("completed");
|
|
8717
|
+
else
|
|
8718
|
+
emit("failed", "execution");
|
|
8719
|
+
};
|
|
8709
8720
|
const complete = (result) => {
|
|
8710
8721
|
phase = "output";
|
|
8711
8722
|
validate(options.contract?.result, result);
|
|
8712
|
-
|
|
8723
|
+
observeResult(result);
|
|
8713
8724
|
return result;
|
|
8714
8725
|
};
|
|
8715
8726
|
if (value && typeof value.then === "function") {
|
|
8716
8727
|
if (options.contract?.result)
|
|
8717
8728
|
return Promise.resolve(value).then(complete).catch(failed);
|
|
8718
|
-
void Promise.resolve(value).then(
|
|
8729
|
+
void Promise.resolve(value).then(observeResult, () => emit("failed", "execution"));
|
|
8719
8730
|
return value;
|
|
8720
8731
|
}
|
|
8721
8732
|
return complete(value);
|