@atbash/sdk 0.10.4-dev.0 → 0.10.6-dev.0
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/browser.mjs +159 -19
- package/dist/browser.mjs.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -3520,11 +3520,15 @@ var Atbash = class _Atbash {
|
|
|
3520
3520
|
* response bytes via the Rust core's `verifySignature`.
|
|
3521
3521
|
*/
|
|
3522
3522
|
async judgeAction(action, context = "", options = {}) {
|
|
3523
|
-
return this.track(
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3523
|
+
return this.track("judgeAction", this.auth.pubkey, async () => {
|
|
3524
|
+
try {
|
|
3525
|
+
return await this._judgeAction(action, context, options);
|
|
3526
|
+
} catch (err) {
|
|
3527
|
+
if (!isEncryptionStateMismatch(err)) throw err;
|
|
3528
|
+
this._orgKeyFromChain = null;
|
|
3529
|
+
return await this._judgeAction(action, context, options);
|
|
3530
|
+
}
|
|
3531
|
+
});
|
|
3528
3532
|
}
|
|
3529
3533
|
async _judgeAction(action, context, options) {
|
|
3530
3534
|
if (!action?.trim()) {
|
|
@@ -3571,6 +3575,7 @@ var Atbash = class _Atbash {
|
|
|
3571
3575
|
if (context) body.context = context;
|
|
3572
3576
|
if (options.provider) body.provider = options.provider;
|
|
3573
3577
|
if (options.toolName) body.tool_name = options.toolName;
|
|
3578
|
+
if (options.toolArgsJson) body.tool_args_json = options.toolArgsJson;
|
|
3574
3579
|
if (options.model) body.model = options.model;
|
|
3575
3580
|
if (options.resolved) body.resolved = options.resolved;
|
|
3576
3581
|
if (options.mode) body.mode = options.mode;
|
|
@@ -4197,6 +4202,10 @@ async function safeText(resp) {
|
|
|
4197
4202
|
function errorMessage(err) {
|
|
4198
4203
|
return err instanceof Error ? err.message : String(err);
|
|
4199
4204
|
}
|
|
4205
|
+
function isEncryptionStateMismatch(err) {
|
|
4206
|
+
const msg = errorMessage(err);
|
|
4207
|
+
return msg.includes("must be a valid encryption envelope") || msg.includes("must be plaintext");
|
|
4208
|
+
}
|
|
4200
4209
|
function stringifyArgs(args) {
|
|
4201
4210
|
if (args === null || args === void 0) return "";
|
|
4202
4211
|
if (typeof args === "string") return args;
|