@mastra/factory 0.24.0-alpha.3 → 0.24.0-alpha.4

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 (87) hide show
  1. package/dist/factory.d.ts.map +1 -1
  2. package/dist/factory.js +9 -3
  3. package/dist/factory.js.map +1 -1
  4. package/dist/integrations/github/default-rules.d.ts.map +1 -1
  5. package/dist/integrations/github/default-rules.js +1 -16
  6. package/dist/integrations/github/default-rules.js.map +1 -1
  7. package/dist/integrations/github/sandbox-release.d.ts +15 -3
  8. package/dist/integrations/github/sandbox-release.d.ts.map +1 -1
  9. package/dist/integrations/github/sandbox-release.js +20 -3
  10. package/dist/integrations/github/sandbox-release.js.map +1 -1
  11. package/dist/integrations/github/webhook.d.ts +4 -2
  12. package/dist/integrations/github/webhook.d.ts.map +1 -1
  13. package/dist/integrations/github/webhook.js +59 -36
  14. package/dist/integrations/github/webhook.js.map +1 -1
  15. package/dist/integrations/gitlab/api.d.ts +1 -1
  16. package/dist/integrations/gitlab/api.d.ts.map +1 -1
  17. package/dist/integrations/gitlab/api.js.map +1 -1
  18. package/dist/integrations/incidentio/intake.d.ts +1 -1
  19. package/dist/integrations/incidentio/intake.d.ts.map +1 -1
  20. package/dist/integrations/incidentio/intake.js.map +1 -1
  21. package/dist/integrations/platform/connect/routes.d.ts +1 -1
  22. package/dist/integrations/platform/connect/routes.d.ts.map +1 -1
  23. package/dist/integrations/platform/connect/routes.js.map +1 -1
  24. package/dist/integrations/platform/incidentio/integration.d.ts +1 -1
  25. package/dist/integrations/platform/incidentio/integration.d.ts.map +1 -1
  26. package/dist/integrations/platform/incidentio/integration.js.map +1 -1
  27. package/dist/integrations/platform/jira/integration.d.ts +1 -1
  28. package/dist/integrations/platform/jira/integration.d.ts.map +1 -1
  29. package/dist/integrations/platform/jira/integration.js.map +1 -1
  30. package/dist/integrations/platform/linear/event-worker.d.ts +1 -1
  31. package/dist/integrations/platform/linear/event-worker.d.ts.map +1 -1
  32. package/dist/integrations/platform/linear/event-worker.js.map +1 -1
  33. package/dist/review-verdict.d.ts +11 -0
  34. package/dist/review-verdict.d.ts.map +1 -1
  35. package/dist/review-verdict.js +16 -1
  36. package/dist/review-verdict.js.map +1 -1
  37. package/dist/routes/source-control-sessions.d.ts +7 -0
  38. package/dist/routes/source-control-sessions.d.ts.map +1 -1
  39. package/dist/routes/source-control-sessions.js +121 -3
  40. package/dist/routes/source-control-sessions.js.map +1 -1
  41. package/dist/routes/surface.d.ts +2 -2
  42. package/dist/routes/surface.d.ts.map +1 -1
  43. package/dist/routes/surface.js +2 -0
  44. package/dist/routes/surface.js.map +1 -1
  45. package/dist/rules/dispatcher.d.ts.map +1 -1
  46. package/dist/rules/dispatcher.js +10 -1
  47. package/dist/rules/dispatcher.js.map +1 -1
  48. package/dist/sandbox/session-retirement.d.ts +27 -3
  49. package/dist/sandbox/session-retirement.d.ts.map +1 -1
  50. package/dist/sandbox/session-retirement.js +158 -20
  51. package/dist/sandbox/session-retirement.js.map +1 -1
  52. package/dist/session/credential-policy.d.ts +1 -1
  53. package/dist/session/credential-policy.d.ts.map +1 -1
  54. package/dist/session/credential-policy.js.map +1 -1
  55. package/dist/session/factory-session.d.ts +1 -1
  56. package/dist/session/factory-session.d.ts.map +1 -1
  57. package/dist/session/factory-session.js.map +1 -1
  58. package/dist/session/work-item-repository.d.ts +1 -1
  59. package/dist/session/work-item-repository.d.ts.map +1 -1
  60. package/dist/session/work-item-repository.js.map +1 -1
  61. package/dist/storage/domains/filesystem/base.d.ts +4 -0
  62. package/dist/storage/domains/filesystem/base.d.ts.map +1 -1
  63. package/dist/storage/domains/filesystem/base.js +5 -0
  64. package/dist/storage/domains/filesystem/base.js.map +1 -1
  65. package/dist/storage/domains/work-items/base.d.ts +7 -5
  66. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  67. package/dist/storage/domains/work-items/base.js +5 -5
  68. package/dist/storage/domains/work-items/base.js.map +1 -1
  69. package/dist/timing.d.ts +23 -0
  70. package/dist/timing.d.ts.map +1 -1
  71. package/dist/timing.js +85 -6
  72. package/dist/timing.js.map +1 -1
  73. package/dist/tools/reports.d.ts +11 -0
  74. package/dist/tools/reports.d.ts.map +1 -1
  75. package/dist/tools/reports.js +20 -1
  76. package/dist/tools/reports.js.map +1 -1
  77. package/dist/tools/run-watch.d.ts +1 -1
  78. package/dist/tools/run-watch.d.ts.map +1 -1
  79. package/dist/tools/run-watch.js.map +1 -1
  80. package/dist/tools/session-tools.d.ts +1 -1
  81. package/dist/tools/session-tools.d.ts.map +1 -1
  82. package/dist/tools/session-tools.js.map +1 -1
  83. package/dist/workspace.d.ts +1 -1
  84. package/dist/workspace.d.ts.map +1 -1
  85. package/dist/workspace.js +10 -4
  86. package/dist/workspace.js.map +1 -1
  87. package/package.json +12 -14
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,KAAK,EAAiC,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGlG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAkB,yBAAyB,EAAoB,MAAM,wBAAwB,CAAC;AAa1G,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKvE,OAAO,KAAK,EAAE,kBAAkB,EAAgD,MAAM,wBAAwB,CAAC;AAE/G,OAAO,KAAK,EAAE,mBA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,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC3G,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgHD,qBAAa,aAAa;;gBAeZ,MAAM,EAAE,mBAAmB;IAsBvC;;;;OAIG;IACH,IAAI,kBAAkB,IAAI,yBAAyB,GAAG,SAAS,CAI9D;IAED;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;IAo0CpC;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAa/B,iFAAiF;IAC3E,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
package/dist/factory.js CHANGED
@@ -1,4 +1,4 @@
1
- import { timedPhase } from "./timing.js";
1
+ import { createRequestTimingMiddleware, factoryTimingEnabled, instrumentAsyncMethods, timedPhase } from "./timing.js";
2
2
  import { buildAuthDisabledRoutes, buildAuthRoutes, createFactoryAuthGate, createFactoryInteractiveMarker, createFactoryRouteAuth, factoryUserOrgId, getFactoryAuthOrgId, getFactoryAuthUserFromContext, getFactoryAuthUserId } from "./auth.js";
3
3
  import { assertFactoryConfigVersion } from "./rules/validation.js";
4
4
  import { boardForWorkItem, isTerminalWorkItem } from "./boards/semantics.js";
@@ -243,7 +243,7 @@ var MastraFactory = class {
243
243
  this.#preparing = true;
244
244
  const publicOrigin = (this.#config.publicUrl ?? "http://localhost:4111").replace(/\/+$/, "");
245
245
  const allowedOrigins = (this.#config.allowedOrigins ?? []).map((o) => o.replace(/\/+$/, "")).filter(Boolean);
246
- const storage = this.#config.storage;
246
+ const storage = instrumentAsyncMethods(this.#config.storage, "storage");
247
247
  const vector = this.#config.vector;
248
248
  const pubsub = this.#config.pubsub;
249
249
  const eventBus = pubsub ?? new EventEmitterPubSub();
@@ -388,7 +388,10 @@ var MastraFactory = class {
388
388
  const githubIntegration = integrations.find((integration) => integration.id === "github");
389
389
  const gitlabIntegration = integrations.find((integration) => integration.id === "gitlab" && integration.intake && integration.versionControl);
390
390
  const workItemsReady = storage.isDomainReady("work-items");
391
- const sessionRetirement = sandboxConfig && storage.isDomainReady("source-control") ? new SessionRetirementCoordinator({ invalidateSession: (sessionId) => workspaceRegistry.invalidateSession(sessionId) }) : void 0;
391
+ const sessionRetirement = sandboxConfig && storage.isDomainReady("source-control") ? new SessionRetirementCoordinator({
392
+ invalidateSession: (sessionId) => workspaceRegistry.invalidateSession(sessionId),
393
+ sandbox: sandboxConfig
394
+ }) : void 0;
392
395
  const retireTerminalSessions = sessionRetirement && workItemsReady ? async ({ orgId, workItemId }) => {
393
396
  const item = await workItemsStorage.get({
394
397
  orgId,
@@ -971,8 +974,10 @@ var MastraFactory = class {
971
974
  const onError = { onError: handleServerError };
972
975
  const uiDist = resolveUiDistDir();
973
976
  const spa = uiDist ? [createSpaStaticMiddleware(uiDist)] : [];
977
+ const timing = factoryTimingEnabled ? [createRequestTimingMiddleware()] : [];
974
978
  if (!auth) return {
975
979
  middleware: [
980
+ ...timing,
976
981
  createFactoryInteractiveMarker(),
977
982
  createCustomProvidersPrimer({
978
983
  auth: routeAuth,
@@ -987,6 +992,7 @@ var MastraFactory = class {
987
992
  return {
988
993
  auth,
989
994
  middleware: [
995
+ ...timing,
990
996
  createFactoryAuthGate(auth),
991
997
  createTenantCredentialPrimer({
992
998
  auth: routeAuth,