@silmaril-security/sdk 0.8.0 → 0.8.1

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/index.js CHANGED
@@ -773,7 +773,34 @@ async function protectLangChainRunnable(firewall, runnable, options = {}) {
773
773
  });
774
774
  }
775
775
  }
776
- return new ProtectedBinding({ bound: runnable, config: {}, configFactories });
776
+ const bindings = /* @__PURE__ */ new Set();
777
+ const installBoundary = (candidate) => {
778
+ if (!RunnableBinding.isRunnableBinding(candidate)) {
779
+ return new ProtectedBinding({ bound: candidate, config: {}, configFactories });
780
+ }
781
+ if (bindings.has(candidate)) throw new TypeError("Cannot protect cyclic runnable bindings");
782
+ bindings.add(candidate);
783
+ const binding = candidate;
784
+ const Binding = binding.constructor;
785
+ return new Binding({ ...binding, bound: installBoundary(binding.bound) });
786
+ };
787
+ class ComposableBinding extends RunnableBinding {
788
+ withConfig(config) {
789
+ return new ComposableBinding({ bound: this.bound, config: mergeConfigs(this.config, config) });
790
+ }
791
+ withListeners(fields) {
792
+ return new RunnableBinding({ bound: this, config: {} }).withListeners(fields);
793
+ }
794
+ withRetry(fields) {
795
+ return new RunnableRetry({
796
+ bound: this,
797
+ config: {},
798
+ ...fields?.stopAfterAttempt === void 0 ? {} : { maxAttemptNumber: fields.stopAfterAttempt },
799
+ ...fields?.onFailedAttempt === void 0 ? {} : { onFailedAttempt: fields.onFailedAttempt }
800
+ });
801
+ }
802
+ }
803
+ return new ComposableBinding({ bound: installBoundary(runnable), config: {} });
777
804
  }
778
805
  var handlerCleanups, USER_ROLES;
779
806
  var init_langchain = __esm({
@@ -1151,7 +1178,7 @@ function sanitizeText(text) {
1151
1178
  }
1152
1179
 
1153
1180
  // src/firewall.ts
1154
- var SDK_VERSION = "0.8.0";
1181
+ var SDK_VERSION = "0.8.1";
1155
1182
  var DEFAULT_TIMEOUT_MS = 1e4;
1156
1183
  var DEFAULT_MAX_RETRIES = 5;
1157
1184
  var MAX_BACKOFF_SECONDS = 30;