From 3ab6c5d774939f2e637a808e672b005ec2d1aeca Mon Sep 17 00:00:00 2001 From: Chris Dickinson Date: Wed, 24 Jul 2024 10:45:23 -0700 Subject: [PATCH] fix: reset plugin on call This aligns the js-sdk with libextism behavior [1]. [1]: https://github.com/extism/extism/blob/d04e2e42bf6091aeb9a13d4cf2e64cdd86a00a28/runtime/src/plugin.rs#L509 --- src/foreground-plugin.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/foreground-plugin.ts b/src/foreground-plugin.ts index fa0b210..e29c583 100644 --- a/src/foreground-plugin.ts +++ b/src/foreground-plugin.ts @@ -62,6 +62,8 @@ export class ForegroundPlugin { } async call(funcName: string, input?: string | Uint8Array, hostContext?: T): Promise { + this.#context[RESET](); + const inputIdx = this.#context[STORE](input); this.#context[SET_HOST_CONTEXT](hostContext);