@ory/mastra 0.10.0 → 0.11.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.
Files changed (2) hide show
  1. package/dist/index.js +10 -10
  2. package/package.json +7 -2
package/dist/index.js CHANGED
@@ -19,19 +19,19 @@ exports.withOry = withOry;
19
19
  const argus_1 = require("@ory/argus");
20
20
  const HARNESS = "mastra";
21
21
  function lazySession(client, projectUrl) {
22
- let started = false;
23
- return async () => {
24
- if (started)
25
- return;
26
- started = true;
27
- try {
28
- await (0, argus_1.sessionStart)(client, { harness: HARNESS, projectUrl });
29
- }
30
- catch (err) {
22
+ let sessionPromise;
23
+ // Cache the in-flight promise (not a boolean) so concurrent first calls all
24
+ // await the same session start instead of racing past a still-running gate.
25
+ // Fail-open: a rejection is logged, never rethrown, and clears the cache so
26
+ // a later call can retry.
27
+ return () => {
28
+ sessionPromise ??= (0, argus_1.sessionStart)(client, { harness: HARNESS, projectUrl }).then(() => undefined, (err) => {
29
+ sessionPromise = undefined;
31
30
  client.logger.warn("session_start.failed", {
32
31
  message: err instanceof Error ? err.message : String(err),
33
32
  });
34
- }
33
+ });
34
+ return sessionPromise;
35
35
  };
36
36
  }
37
37
  /**
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@ory/mastra",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "description": "Ory Agent Security for Mastra — per-tool authorization, tracing, and identity propagation via agent tool-call hooks (or wrapping tool execute). Built on @ory/argus.",
5
5
  "license": "Apache-2.0",
6
+ "publishConfig": {
7
+ "access": "public",
8
+ "registry": "https://registry.npmjs.org/",
9
+ "provenance": true
10
+ },
6
11
  "main": "dist/index.js",
7
12
  "types": "dist/index.d.ts",
8
13
  "exports": {
@@ -24,7 +29,7 @@
24
29
  "permissions"
25
30
  ],
26
31
  "dependencies": {
27
- "@ory/argus": "0.10.0"
32
+ "@ory/argus": "0.11.1"
28
33
  },
29
34
  "devDependencies": {
30
35
  "typescript": "^6.0.2",