@mastra/factory 0.25.0-alpha.3 → 0.25.0-alpha.5
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/auth.js +1 -2
- package/dist/boards/define-board.js +1 -2
- package/dist/boards/index.js +1 -2
- package/dist/boards/registry.js +1 -2
- package/dist/boards/relocate.js +1 -2
- package/dist/boards/review.js +1 -2
- package/dist/boards/semantics.js +1 -2
- package/dist/boards/transition-policy.js +1 -2
- package/dist/boards/work-tool-rules.js +1 -2
- package/dist/boards/work-transition-policy.js +1 -2
- package/dist/boards/work.js +1 -2
- package/dist/environment/build-runner.js +1 -2
- package/dist/environment/build-schedule.js +1 -2
- package/dist/environment/build-workflow.js +1 -2
- package/dist/environment/build.js +1 -2
- package/dist/environment/heads.js +1 -2
- package/dist/factory.d.ts +4 -2
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +43 -16
- package/dist/factory.js.map +1 -1
- package/dist/feed-events.js +1 -2
- package/dist/index.js +2 -2
- package/dist/integrations/channel-thread-announcements.d.ts +8 -0
- package/dist/integrations/channel-thread-announcements.d.ts.map +1 -0
- package/dist/integrations/channel-thread-announcements.js +16 -0
- package/dist/integrations/channel-thread-announcements.js.map +1 -0
- package/dist/integrations/github/acceptance-labels.js +1 -2
- package/dist/integrations/github/app-identity.js +1 -2
- package/dist/integrations/github/commits.js +1 -2
- package/dist/integrations/github/config.js +1 -2
- package/dist/integrations/github/default-rules.js +2 -3
- package/dist/integrations/github/integration.js +3 -4
- package/dist/integrations/github/issue-reconciler.js +1 -2
- package/dist/integrations/github/pat.js +1 -2
- package/dist/integrations/github/provenance.d.ts.map +1 -1
- package/dist/integrations/github/provenance.js +2 -5
- package/dist/integrations/github/provenance.js.map +1 -1
- package/dist/integrations/github/reconcile-worker.js +1 -2
- package/dist/integrations/github/reconciliation-config.js +1 -2
- package/dist/integrations/github/routes.js +4 -5
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +14 -3
- package/dist/integrations/github/rules.js.map +1 -1
- package/dist/integrations/github/sandbox-release.js +1 -2
- package/dist/integrations/github/sandbox.js +1 -2
- package/dist/integrations/github/session-subscriptions.js +1 -2
- package/dist/integrations/github/settle-or-abort.js +1 -2
- package/dist/integrations/github/stale-reviews.js +1 -2
- package/dist/integrations/github/subscriptions.js +1 -2
- package/dist/integrations/github/token-refresh.js +1 -2
- package/dist/integrations/github/webhook.d.ts.map +1 -1
- package/dist/integrations/github/webhook.js +17 -3
- package/dist/integrations/github/webhook.js.map +1 -1
- package/dist/integrations/gitlab/agent-tools.js +1 -2
- package/dist/integrations/gitlab/api.js +1 -2
- package/dist/integrations/gitlab/default-rules.js +1 -2
- package/dist/integrations/gitlab/integration.js +2 -3
- package/dist/integrations/gitlab/issue-reconciler.js +1 -2
- package/dist/integrations/gitlab/merge-request-reconciler.js +1 -2
- package/dist/integrations/gitlab/reconciler.js +1 -2
- package/dist/integrations/gitlab/reconciliation-config.js +1 -2
- package/dist/integrations/gitlab/routes.js +1 -2
- package/dist/integrations/gitlab/rules.js +1 -2
- package/dist/integrations/gitlab/session-subscriptions.js +1 -2
- package/dist/integrations/gitlab/subscriptions.js +1 -2
- package/dist/integrations/gitlab/version-control.js +1 -2
- package/dist/integrations/gitlab/webhook-dispatch.js +1 -2
- package/dist/integrations/gitlab/webhook.js +1 -2
- package/dist/integrations/incidentio/agent-tools.js +1 -2
- package/dist/integrations/incidentio/api.js +1 -2
- package/dist/integrations/incidentio/claim.js +1 -2
- package/dist/integrations/incidentio/default-rules.js +1 -2
- package/dist/integrations/incidentio/intake.js +1 -2
- package/dist/integrations/incidentio/integration.js +1 -2
- package/dist/integrations/incidentio/issue-reconciler.js +1 -2
- package/dist/integrations/incidentio/reconciliation-config.js +1 -2
- package/dist/integrations/incidentio/routes.js +1 -2
- package/dist/integrations/incidentio/rules.js +1 -2
- package/dist/integrations/issue-reconcile-worker.js +1 -2
- package/dist/integrations/issue-reconciler.js +1 -2
- package/dist/integrations/jira/adf.js +1 -2
- package/dist/integrations/jira/agent-tools.js +1 -2
- package/dist/integrations/jira/api.js +1 -2
- package/dist/integrations/jira/claim.js +1 -2
- package/dist/integrations/jira/default-rules.js +1 -2
- package/dist/integrations/jira/integration.js +1 -2
- package/dist/integrations/jira/issue-reconciler.js +1 -2
- package/dist/integrations/jira/reconciliation-config.js +1 -2
- package/dist/integrations/jira/routes.js +1 -2
- package/dist/integrations/jira/rules.js +1 -2
- package/dist/integrations/linear/agent-tools.d.ts +1 -1
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -1
- package/dist/integrations/linear/agent-tools.js +5 -5
- package/dist/integrations/linear/agent-tools.js.map +1 -1
- package/dist/integrations/linear/claim.js +1 -2
- package/dist/integrations/linear/default-rules.js +1 -2
- package/dist/integrations/linear/integration.d.ts +2 -0
- package/dist/integrations/linear/integration.d.ts.map +1 -1
- package/dist/integrations/linear/integration.js +2 -2
- package/dist/integrations/linear/integration.js.map +1 -1
- package/dist/integrations/linear/issue-reconciler.js +1 -2
- package/dist/integrations/linear/reconciliation-config.js +1 -2
- package/dist/integrations/linear/routes.js +1 -2
- package/dist/integrations/linear/rules.js +1 -2
- package/dist/integrations/platform/api-client.js +1 -2
- package/dist/integrations/platform/connect/routes.js +1 -2
- package/dist/integrations/platform/github/event-worker.js +6 -2
- package/dist/integrations/platform/github/event-worker.js.map +1 -1
- package/dist/integrations/platform/github/integration.js +1 -2
- package/dist/integrations/platform/gitlab/event-worker.js +1 -2
- package/dist/integrations/platform/gitlab/integration.js +1 -2
- package/dist/integrations/platform/incidentio/integration.js +1 -2
- package/dist/integrations/platform/jira/agent-tools.js +1 -2
- package/dist/integrations/platform/jira/integration.js +1 -2
- package/dist/integrations/platform/jira/routes.js +1 -2
- package/dist/integrations/platform/linear/event-worker.js +1 -2
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -1
- package/dist/integrations/platform/linear/integration.js +2 -2
- package/dist/integrations/platform/linear/integration.js.map +1 -1
- package/dist/integrations/pull-request-head.js +1 -2
- package/dist/integrations/reconciliation-config.js +1 -2
- package/dist/integrations/slack/channel-reply-processor.d.ts.map +1 -1
- package/dist/integrations/slack/channel-reply-processor.js +11 -5
- package/dist/integrations/slack/channel-reply-processor.js.map +1 -1
- package/dist/integrations/slack/channel-session-link-processor.js +1 -2
- package/dist/integrations/slack/connect-route.js +1 -2
- package/dist/integrations/slack/emoji-shortcodes.generated.js +1 -2
- package/dist/integrations/slack/emoji.js +1 -2
- package/dist/integrations/slack/feed-publisher.js +1 -2
- package/dist/integrations/slack/integration.d.ts +5 -0
- package/dist/integrations/slack/integration.d.ts.map +1 -1
- package/dist/integrations/slack/integration.js +13 -2
- package/dist/integrations/slack/integration.js.map +1 -1
- package/dist/integrations/slack/reply-reminder-processor.js +1 -2
- package/dist/integrations/slack/reply-tool.js +1 -2
- package/dist/integrations/slack/share-file-tool.js +1 -2
- package/dist/integrations/slack/slack.js +2 -3
- package/dist/integrations/subscription-session.js +1 -2
- package/dist/integrations/workos/integration.js +1 -2
- package/dist/mcp/disconnect.js +1 -2
- package/dist/mcp/events.js +2 -3
- package/dist/mcp/routes.js +1 -2
- package/dist/packages/_internals/workspace/dist/index.js +1 -2
- package/dist/packages/_internals/workspace/dist/index.js.map +1 -1
- package/dist/platform-auth-host.js +1 -2
- package/dist/provider-display-name.js +1 -2
- package/dist/review-verdict.d.ts +1 -0
- package/dist/review-verdict.d.ts.map +1 -1
- package/dist/review-verdict.js +9 -3
- package/dist/review-verdict.js.map +1 -1
- package/dist/routes/attention-activity.js +1 -2
- package/dist/routes/attention-parked.js +1 -2
- package/dist/routes/attention-proposed.js +1 -2
- package/dist/routes/attention-providers.js +1 -2
- package/dist/routes/attention.js +1 -2
- package/dist/routes/automation-runs.js +1 -2
- package/dist/routes/config.d.ts +4 -0
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +7 -2
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/contracts.js +1 -2
- package/dist/routes/custom-provider-source.js +1 -2
- package/dist/routes/fs.js +1 -2
- package/dist/routes/intake.js +1 -2
- package/dist/routes/knowledge.js +1 -2
- package/dist/routes/oauth.js +1 -2
- package/dist/routes/projects.js +1 -2
- package/dist/routes/provider-credentials.js +1 -2
- package/dist/routes/route.js +1 -2
- package/dist/routes/session-access.js +1 -2
- package/dist/routes/skills.js +1 -2
- package/dist/routes/source-control-sessions.js +5 -6
- package/dist/routes/source-control-settings.js +1 -2
- package/dist/routes/surface.js +2 -3
- package/dist/routes/telemetry.js +1 -2
- package/dist/routes/tenant-credentials.js +1 -2
- package/dist/routes/work-items.js +2 -3
- package/dist/rules/binding-context.js +1 -2
- package/dist/rules/decision-applicability.js +1 -2
- package/dist/rules/dispatch-errors.js +1 -2
- package/dist/rules/dispatcher.js +1 -2
- package/dist/rules/event-rules.js +1 -2
- package/dist/rules/processor.js +1 -2
- package/dist/rules/resolve.js +1 -2
- package/dist/rules/review-source-tool.js +1 -2
- package/dist/rules/start-coordinator.js +1 -2
- package/dist/rules/terminal-cleanup.js +1 -2
- package/dist/rules/tools.js +1 -2
- package/dist/rules/transition-service.js +1 -2
- package/dist/rules/types.d.ts +4 -1
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js +1 -2
- package/dist/rules/types.js.map +1 -1
- package/dist/rules/validation.js +1 -2
- package/dist/sandbox/callback-factory-sandbox.js +1 -2
- package/dist/sandbox/git-ref.js +1 -2
- package/dist/sandbox/local-factory-sandbox.d.ts +12 -4
- package/dist/sandbox/local-factory-sandbox.d.ts.map +1 -1
- package/dist/sandbox/local-factory-sandbox.js +32 -7
- package/dist/sandbox/local-factory-sandbox.js.map +1 -1
- package/dist/sandbox/materialization.js +1 -2
- package/dist/sandbox/session-retirement.js +1 -2
- package/dist/sandbox/session-sandbox.js +1 -2
- package/dist/sandbox/workdir.js +1 -2
- package/dist/secret-encryption.js +1 -2
- package/dist/server-error.js +1 -2
- package/dist/session/credential-policy.js +1 -2
- package/dist/session/default-model-hydration.js +1 -2
- package/dist/session/environment-repositories.js +1 -2
- package/dist/session/environment-state-processor.d.ts +0 -1
- package/dist/session/environment-state-processor.d.ts.map +1 -1
- package/dist/session/environment-state-processor.js +2 -3
- package/dist/session/environment-state-processor.js.map +1 -1
- package/dist/session/factory-session.js +1 -2
- package/dist/session/filesystem-capture.js +2 -3
- package/dist/session/filesystem-capture.js.map +1 -1
- package/dist/session/first-exec-capture.js +2 -3
- package/dist/session/first-exec-capture.js.map +1 -1
- package/dist/session/first-message-capture.js +1 -2
- package/dist/session/live-sessions.js +1 -2
- package/dist/session/memory-settings-hydration.js +1 -2
- package/dist/session/org-seed.js +1 -2
- package/dist/session/reply-credential-processor.js +1 -2
- package/dist/session/resource-migration.js +1 -2
- package/dist/session/run-audit.js +1 -2
- package/dist/session/session-threads.js +1 -2
- package/dist/session/session-title.js +1 -2
- package/dist/session/shell-commands.js +1 -2
- package/dist/session/source-control-tools.js +2 -3
- package/dist/session/thinking-default.js +1 -2
- package/dist/session/thread-session-stamp.js +1 -2
- package/dist/session/thread-title-mirror.js +1 -2
- package/dist/session/thread-title-mirror.js.map +1 -1
- package/dist/session/work-item-repository.js +1 -2
- package/dist/session-owner-signal.js +1 -2
- package/dist/skills/catalog.js +1 -2
- package/dist/skills/service.js +1 -2
- package/dist/spa-static.js +1 -2
- package/dist/state-signing.js +1 -2
- package/dist/storage/domains/audit/actions.js +1 -2
- package/dist/storage/domains/audit/actors.js +1 -2
- package/dist/storage/domains/audit/agent-audit.js +1 -2
- package/dist/storage/domains/audit/base.js +1 -2
- package/dist/storage/domains/audit/domain.js +1 -2
- package/dist/storage/domains/audit/wire.js +1 -2
- package/dist/storage/domains/channel-identity/base.js +1 -2
- package/dist/storage/domains/comments/activity.js +1 -2
- package/dist/storage/domains/comments/actor.js +1 -2
- package/dist/storage/domains/comments/base.js +1 -2
- package/dist/storage/domains/comments/domain.js +1 -2
- package/dist/storage/domains/comments/feed-context.js +1 -2
- package/dist/storage/domains/comments/parse.js +1 -2
- package/dist/storage/domains/comments/routes.js +1 -2
- package/dist/storage/domains/comments/schema.js +1 -2
- package/dist/storage/domains/comments/wire.js +1 -2
- package/dist/storage/domains/credentials/base.d.ts +4 -1
- package/dist/storage/domains/credentials/base.d.ts.map +1 -1
- package/dist/storage/domains/credentials/base.js +40 -44
- package/dist/storage/domains/credentials/base.js.map +1 -1
- package/dist/storage/domains/custom-providers/base.js +1 -2
- package/dist/storage/domains/filesystem/base.js +1 -2
- package/dist/storage/domains/intake/base.js +1 -2
- package/dist/storage/domains/integrations/base.js +1 -2
- package/dist/storage/domains/memory-settings/base.js +1 -2
- package/dist/storage/domains/model-defaults/base.js +1 -2
- package/dist/storage/domains/projects/base.js +1 -2
- package/dist/storage/domains/queue-health/base.js +1 -2
- package/dist/storage/domains/source-control/base.js +1 -2
- package/dist/storage/domains/source-control/inmemory.js +1 -2
- package/dist/storage/domains/work-items/base.js +1 -2
- package/dist/storage/domains/work-items/board-version.js +1 -2
- package/dist/storage/domains/work-items/metrics.js +1 -2
- package/dist/telemetry-types.js +1 -2
- package/dist/telemetry.js +1 -2
- package/dist/timing.js +1 -2
- package/dist/tools/annotations.js +1 -2
- package/dist/tools/approval-tools.js +1 -2
- package/dist/tools/deliver.js +2 -3
- package/dist/tools/index.js +1 -2
- package/dist/tools/messaging-tools.js +1 -2
- package/dist/tools/permissions.js +1 -2
- package/dist/tools/read-tools.js +1 -2
- package/dist/tools/reports.js +1 -2
- package/dist/tools/run-watch.js +1 -2
- package/dist/tools/sandbox-tools.js +1 -2
- package/dist/tools/scope.js +2 -3
- package/dist/tools/session-tools.js +1 -2
- package/dist/tools/sessions-state-processor.js +1 -2
- package/dist/tools/side-sessions.js +1 -2
- package/dist/tools/work-item-tools.js +1 -2
- package/dist/work-item-branch.js +1 -2
- package/dist/work-item-branch.js.map +1 -1
- package/dist/work-items/create-work-item.js +1 -2
- package/dist/work-items/decision-actions.js +1 -2
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +1 -3
- package/dist/workspace.js.map +1 -1
- package/factory-skills/factory-rereview/SKILL.md +12 -2
- package/factory-skills/factory-review/SKILL.md +12 -2
- package/factory-skills/factory-triage/SKILL.md +7 -7
- package/package.json +19 -17
package/dist/auth.js
CHANGED
|
@@ -6,7 +6,7 @@ import { MastraAuthWorkos } from "@mastra/auth-workos";
|
|
|
6
6
|
import { MASTRA_MESSAGE_AUTHOR_KEY } from "@mastra/core/request-context";
|
|
7
7
|
import { isAuthHttpHandler, isCredentialsProvider, isOrganizationsProvider, isSSOProvider, isSessionProvider, registerApiRoute } from "@mastra/core/server";
|
|
8
8
|
import { HTTPException } from "hono/http-exception";
|
|
9
|
-
|
|
9
|
+
// src/auth.ts
|
|
10
10
|
const ORGANIZATION_ID_HEADER = "X-Mastra-Organization-Id";
|
|
11
11
|
/**
|
|
12
12
|
* Validate that a `returnTo` value is a safe same-site path, to prevent
|
|
@@ -667,7 +667,6 @@ function mountFactoryAuth(app, options = {}) {
|
|
|
667
667
|
app.use("*", createFactoryAuthGate(provider));
|
|
668
668
|
return true;
|
|
669
669
|
}
|
|
670
|
-
//#endregion
|
|
671
670
|
export { FACTORY_INTERACTIVE_KEY, bearerTokenOrgClaim, buildAuthDisabledRoutes, buildAuthRoutes, createFactoryAuthGate, createFactoryInteractiveMarker, createFactoryRouteAuth, ensureFactoryAuthUser, factoryAuthTenant, factoryUserOrgId, getBearerToken, getFactoryAuthOrgId, getFactoryAuthUser, getFactoryAuthUserFromContext, getFactoryAuthUserId, getWorkOSProvider, isCrossSiteAuth, isOrganizationAdmin, isWorkOSAuth, mountFactoryAuth, registerAuthRoutes, sanitizeReturnTo };
|
|
672
671
|
|
|
673
672
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FACTORY_GITHUB_EVENTS, FACTORY_GITLAB_EVENTS, FACTORY_INCIDENTIO_EVENTS, FACTORY_JIRA_EVENTS, FACTORY_LINEAR_EVENTS } from "../rules/types.js";
|
|
2
2
|
import { IDENTIFIER_RE, isBoardIdentifier } from "../rules/validation.js";
|
|
3
|
-
|
|
3
|
+
// src/boards/define-board.ts
|
|
4
4
|
const BOARD_EVENT_NAMES = {
|
|
5
5
|
github: FACTORY_GITHUB_EVENTS,
|
|
6
6
|
gitlab: FACTORY_GITLAB_EVENTS,
|
|
@@ -150,7 +150,6 @@ function defineBoard(config) {
|
|
|
150
150
|
phaseForRole: (role) => phaseByRole.get(role)
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
//#endregion
|
|
154
153
|
export { BoardDefinitionError, defineBoard };
|
|
155
154
|
|
|
156
155
|
//# sourceMappingURL=define-board.js.map
|
package/dist/boards/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { boardEventHandlers, boardForWorkItem, eventBoardId, isTerminalWorkItem,
|
|
|
3
3
|
import { isReviewBoardPhase, reviewBoard } from "./review.js";
|
|
4
4
|
import { isWorkBoardPhase, workBoard } from "./work.js";
|
|
5
5
|
import { createBoardRegistry, defaultBoards } from "./registry.js";
|
|
6
|
-
|
|
6
|
+
// src/boards/index.ts
|
|
7
7
|
const builtInBoards = {
|
|
8
8
|
work: workBoard,
|
|
9
9
|
review: reviewBoard
|
|
@@ -15,7 +15,6 @@ function allowsBuiltInBoardTransition(board, from, to) {
|
|
|
15
15
|
if (board === "work") return isWorkBoardPhase(from) && isWorkBoardPhase(to) && workBoard.allowsTransition(from, to);
|
|
16
16
|
return isReviewBoardPhase(from) && isReviewBoardPhase(to) && reviewBoard.allowsTransition(from, to);
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { BoardDefinitionError, allowsBuiltInBoardTransition, boardEventHandlers, boardForWorkItem, builtInBoard, createBoardRegistry, defaultBoards, defineBoard, eventBoardId, isTerminalWorkItem, resolveBoardClosure, resolveBoardToolRule, resolvePhaseSemantics, reviewBoard, rulePhaseContext, rulePhaseField, withBoardClosure, workBoard, workItemPhaseSemantics };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=index.js.map
|
package/dist/boards/registry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { reviewBoard } from "./review.js";
|
|
2
2
|
import { workBoard } from "./work.js";
|
|
3
|
-
|
|
3
|
+
// src/boards/registry.ts
|
|
4
4
|
const defaultBoards = Object.freeze([workBoard, reviewBoard]);
|
|
5
5
|
function createBoardRegistry(options = {}) {
|
|
6
6
|
const installed = options.includeDefaultBoards === false ? [] : defaultBoards;
|
|
@@ -19,7 +19,6 @@ function createBoardRegistry(options = {}) {
|
|
|
19
19
|
[Symbol.iterator]: registry[Symbol.iterator].bind(registry)
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { createBoardRegistry, defaultBoards };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=registry.js.map
|
package/dist/boards/relocate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkItemUpdateConflictError } from "../storage/domains/work-items/base.js";
|
|
2
|
-
|
|
2
|
+
// src/boards/relocate.ts
|
|
3
3
|
/** Rows that predate persisted boards used source-type routing. */
|
|
4
4
|
function effectiveBoard(item) {
|
|
5
5
|
return item.board ?? (item.externalSource?.type === "pull-request" ? "review" : "work");
|
|
@@ -52,7 +52,6 @@ function cardLabels(item) {
|
|
|
52
52
|
const labels = item.metadata?.labels;
|
|
53
53
|
return Array.isArray(labels) ? labels.filter((label) => typeof label === "string") : [];
|
|
54
54
|
}
|
|
55
|
-
//#endregion
|
|
56
55
|
export { cardLabels, effectiveBoard, moveCardToBoard };
|
|
57
56
|
|
|
58
57
|
//# sourceMappingURL=relocate.js.map
|
package/dist/boards/review.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineBoard } from "./define-board.js";
|
|
2
2
|
import { legacyGithubWorkItemBranch, workItemBranch, workItemNumber } from "../work-item-branch.js";
|
|
3
|
-
|
|
3
|
+
// src/boards/review.ts
|
|
4
4
|
function sourceRef(item) {
|
|
5
5
|
const link = item.url ? ` (${item.url})` : "";
|
|
6
6
|
const number = workItemNumber(item);
|
|
@@ -119,7 +119,6 @@ const reviewBoard = defineBoard({
|
|
|
119
119
|
function isReviewBoardPhase(value) {
|
|
120
120
|
return value in reviewBoard.phases;
|
|
121
121
|
}
|
|
122
|
-
//#endregion
|
|
123
122
|
export { hasRecordedVerdict, isReviewBoardPhase, reviewBoard };
|
|
124
123
|
|
|
125
124
|
//# sourceMappingURL=review.js.map
|
package/dist/boards/semantics.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/boards/semantics.ts
|
|
2
2
|
/**
|
|
3
3
|
* Board that owns a work item. Rows created before boards were persisted carry no `board`;
|
|
4
4
|
* they belong to Review when they track a pull request and to Work otherwise, matching the
|
|
@@ -113,7 +113,6 @@ function rulePhaseField(boards, item) {
|
|
|
113
113
|
const phase = rulePhaseContext(boards, item);
|
|
114
114
|
return phase ? { phase } : {};
|
|
115
115
|
}
|
|
116
|
-
//#endregion
|
|
117
116
|
export { boardEventHandlers, boardForWorkItem, eventBoardId, isTerminalWorkItem, resolveBoardClosure, resolveBoardToolRule, resolvePhaseSemantics, rulePhaseContext, rulePhaseField, withBoardClosure, workItemPhaseSemantics };
|
|
118
117
|
|
|
119
118
|
//# sourceMappingURL=semantics.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FACTORY_TRIAGE_TYPES } from "../rules/types.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
3
|
+
// src/boards/transition-policy.ts
|
|
4
4
|
function immutablePolicySnapshot(value) {
|
|
5
5
|
if (value instanceof Date) return value.toISOString();
|
|
6
6
|
if (Array.isArray(value)) return Object.freeze(value.map((entry) => immutablePolicySnapshot(entry)));
|
|
@@ -30,7 +30,6 @@ const boardTransitionPolicyResultSchema = z.union([z.undefined(), z.discriminate
|
|
|
30
30
|
]),
|
|
31
31
|
reason: z.string().trim().min(1).max(512)
|
|
32
32
|
}).strict()])]);
|
|
33
|
-
//#endregion
|
|
34
33
|
export { boardTransitionPolicyResultSchema, immutablePolicySnapshot };
|
|
35
34
|
|
|
36
35
|
//# sourceMappingURL=transition-policy.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/boards/work-tool-rules.ts
|
|
2
2
|
function resultContent(value) {
|
|
3
3
|
if (typeof value === "string") return value;
|
|
4
4
|
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
@@ -14,7 +14,6 @@ function advanceApprovedPlan(context) {
|
|
|
14
14
|
stage: "execute"
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { advanceApprovedPlan };
|
|
19
18
|
|
|
20
19
|
//# sourceMappingURL=work-tool-rules.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/boards/work-transition-policy.ts
|
|
2
2
|
const workTransitionPolicy = (context) => {
|
|
3
3
|
const { item, requestedTriageType, actor, fromStage, toStage, isHumanTransition, plansAutoApproved, planApproved } = context;
|
|
4
4
|
const triageAgent = actor.type === "agent" && actor.role === "triage";
|
|
@@ -51,7 +51,6 @@ const workTransitionPolicy = (context) => {
|
|
|
51
51
|
...isHumanTransition && entersWork && !item.acceptedAt ? { accept: true } : {}
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
|
-
//#endregion
|
|
55
54
|
export { workTransitionPolicy };
|
|
56
55
|
|
|
57
56
|
//# sourceMappingURL=work-transition-policy.js.map
|
package/dist/boards/work.js
CHANGED
|
@@ -3,7 +3,7 @@ import { defineBoard } from "./define-board.js";
|
|
|
3
3
|
import { workItemNumber } from "../work-item-branch.js";
|
|
4
4
|
import { advanceApprovedPlan } from "./work-tool-rules.js";
|
|
5
5
|
import { workTransitionPolicy } from "./work-transition-policy.js";
|
|
6
|
-
|
|
6
|
+
// src/boards/work.ts
|
|
7
7
|
function sourceIdentifier(item) {
|
|
8
8
|
const identifier = item.metadata?.identifier;
|
|
9
9
|
return typeof identifier === "string" ? identifier : void 0;
|
|
@@ -279,7 +279,6 @@ const workBoard = defineBoard({
|
|
|
279
279
|
function isWorkBoardPhase(value) {
|
|
280
280
|
return Object.prototype.hasOwnProperty.call(workBoard.phases, value);
|
|
281
281
|
}
|
|
282
|
-
//#endregion
|
|
283
282
|
export { SELF_REVIEW_ROUND_LIMIT, isWorkBoardPhase, openApprovedChangeRequest, selfReviewRounds, workBoard };
|
|
284
283
|
|
|
285
284
|
//# sourceMappingURL=work.js.map
|
|
@@ -2,7 +2,7 @@ import { environmentBuildContext, errorReason, resolveEnvironmentHeads } from ".
|
|
|
2
2
|
import { resolveProjectEnvironment } from "../workspace.js";
|
|
3
3
|
import { ENVIRONMENT_BUILD_WORKFLOW_ID, createEnvironmentBuildWorkflow } from "./build-workflow.js";
|
|
4
4
|
import { probeSchedulesAvailable } from "./build-schedule.js";
|
|
5
|
-
|
|
5
|
+
// src/environment/build-runner.ts
|
|
6
6
|
var EnvironmentBuildRunner = class {
|
|
7
7
|
workflow;
|
|
8
8
|
#deps;
|
|
@@ -126,7 +126,6 @@ var EnvironmentBuildRunner = class {
|
|
|
126
126
|
return outcome;
|
|
127
127
|
};
|
|
128
128
|
};
|
|
129
|
-
//#endregion
|
|
130
129
|
export { EnvironmentBuildRunner };
|
|
131
130
|
|
|
132
131
|
//# sourceMappingURL=build-runner.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ENVIRONMENT_BUILD_WORKFLOW_ID } from "./build-workflow.js";
|
|
2
2
|
import { validateCron } from "@mastra/core/workflows";
|
|
3
|
-
|
|
3
|
+
// src/environment/build-schedule.ts
|
|
4
4
|
const SCHEDULES_UNAVAILABLE_ERROR_ID = "SCHEDULES_NO_SCHEDULES_STORAGE";
|
|
5
5
|
/**
|
|
6
6
|
* The project's schedule id in its stored form. Core normalizes a created
|
|
@@ -88,7 +88,6 @@ async function ensureSchedule(schedules, projectId, input) {
|
|
|
88
88
|
if (!input.enabled && next.status === "active") next = await schedules.pause(current.id);
|
|
89
89
|
return toView(isWorkflowSchedule(next) ? next : null);
|
|
90
90
|
}
|
|
91
|
-
//#endregion
|
|
92
91
|
export { SCHEDULES_UNAVAILABLE_ERROR_ID, ensureSchedule, invalidCronMessage, probeSchedulesAvailable, readSchedule, scheduleIdFor };
|
|
93
92
|
|
|
94
93
|
//# sourceMappingURL=build-schedule.js.map
|
|
@@ -2,7 +2,7 @@ import { ENVIRONMENT_BUILD_TRIGGERS, environmentBuildContext, errorReason, redac
|
|
|
2
2
|
import { resolveProjectEnvironment } from "../workspace.js";
|
|
3
3
|
import { createStep, createWorkflow } from "@mastra/core/workflows";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/environment/build-workflow.ts
|
|
6
6
|
/**
|
|
7
7
|
* The `factory-environment-build` workflow: step one decides and starts a
|
|
8
8
|
* build (`runEnvironmentBuild`), step two polls the provider until the build
|
|
@@ -143,7 +143,6 @@ function createEnvironmentBuildWorkflow(deps, options = {}) {
|
|
|
143
143
|
outputSchema: environmentBuildOutputSchema
|
|
144
144
|
}).then(start).then(awaitBuild).commit();
|
|
145
145
|
}
|
|
146
|
-
//#endregion
|
|
147
146
|
export { DEFAULT_BUILD_POLL_MS, ENVIRONMENT_BUILD_WORKFLOW_ID, MAX_BUILD_WAIT_MS, createEnvironmentBuildWorkflow, environmentBuildInputSchema, environmentBuildOutputSchema };
|
|
148
147
|
|
|
149
148
|
//# sourceMappingURL=build-workflow.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { headsChanged, recordedHeadResolver, resolveCurrentHeads } from "./heads.js";
|
|
2
2
|
import { environmentSandboxContext, resolveProjectEnvironment } from "../workspace.js";
|
|
3
3
|
import { createHash, randomUUID } from "crypto";
|
|
4
|
-
|
|
4
|
+
// src/environment/build.ts
|
|
5
5
|
/**
|
|
6
6
|
* One proactive environment build: decide whether a trigger should build,
|
|
7
7
|
* hand the sandbox's `builds` capability a context identical to a session's,
|
|
@@ -340,7 +340,6 @@ async function runEnvironmentBuild(deps, input) {
|
|
|
340
340
|
clearInterval(renewal);
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
//#endregion
|
|
344
343
|
export { BUILD_START_LEASE_MS, ENVIRONMENT_BUILD_TRIGGERS, environmentBuildContext, environmentBuildInputs, environmentBuildSessionId, errorReason, redactCredentials, resolveEnvironmentHeads, runEnvironmentBuild };
|
|
345
344
|
|
|
346
345
|
//# sourceMappingURL=build.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getBranchHead } from "../integrations/github/commits.js";
|
|
2
|
-
|
|
2
|
+
// src/environment/heads.ts
|
|
3
3
|
/** `owner/repo` from a clone URL in any common spelling, lower-cased, `.git` stripped; undefined when unparseable. */
|
|
4
4
|
function cloneUrlSlug(cloneUrl) {
|
|
5
5
|
let path;
|
|
@@ -54,7 +54,6 @@ async function resolveCurrentHeads(github, input) {
|
|
|
54
54
|
});
|
|
55
55
|
return heads;
|
|
56
56
|
}
|
|
57
|
-
//#endregion
|
|
58
57
|
export { cloneUrlSlug, headsChanged, matchEnvironmentSlug, recordedHeadResolver, resolveCurrentHeads };
|
|
59
58
|
|
|
60
59
|
//# sourceMappingURL=heads.js.map
|
package/dist/factory.d.ts
CHANGED
|
@@ -108,8 +108,10 @@ export interface MastraFactoryConfig {
|
|
|
108
108
|
* `new PlatformFactorySandbox({ ... })`, which owns the session sandbox
|
|
109
109
|
* constructor, the repo template and the schema of environment settings.
|
|
110
110
|
* A bare callback is also accepted and wrapped as a `provider: 'custom'`
|
|
111
|
-
* sandbox with no settings. Omitted →
|
|
112
|
-
*
|
|
111
|
+
* sandbox with no settings. Omitted with Platform credentials → the factory
|
|
112
|
+
* installs a `LocalFactorySandbox` under `mastra dev` and a
|
|
113
|
+
* `PlatformFactorySandbox` in built deployments. Omitted without Platform
|
|
114
|
+
* credentials → repository sandboxes are disabled.
|
|
113
115
|
*/
|
|
114
116
|
sandbox?: MastraFactorySandboxOption;
|
|
115
117
|
/** Browser automation provider for Factory agent sessions. */
|
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,KAAK,EAAiC,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,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;AAY1G,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKvE,OAAO,KAAK,EAAE,kBAAkB,EAAgD,MAAM,wBAAwB,CAAC;AAE/G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"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"}
|
package/dist/factory.js
CHANGED
|
@@ -19,25 +19,17 @@ import { recordFactoryPullRequestProvenance, resolveFactoryPullRequestParentWork
|
|
|
19
19
|
import { dismissStaleFactoryReviews } from "./integrations/github/stale-reviews.js";
|
|
20
20
|
import { PlatformApiClient, platformApiClientConfigFromEnv } from "./integrations/platform/api-client.js";
|
|
21
21
|
import { buildPlatformConnectRoutes } from "./integrations/platform/connect/routes.js";
|
|
22
|
-
import { createSessionAccessGuard } from "./routes/session-access.js";
|
|
23
|
-
import { observeSessionFirstExec } from "./session/first-exec-capture.js";
|
|
24
|
-
import { observeSessionFilesystem } from "./session/filesystem-capture.js";
|
|
25
|
-
import { sessionMemoryResourceId, sessionStampCounts } from "./session/session-threads.js";
|
|
26
22
|
import { createPlaintextFactorySecretEncryption } from "./secret-encryption.js";
|
|
27
23
|
import { ModelCredentialsStorage } from "./storage/domains/credentials/base.js";
|
|
28
24
|
import { tenantOrgId } from "./routes/provider-credentials.js";
|
|
29
25
|
import { createTenantCredentialPrimer, primeTenantCredentials, registerTenantCredentialResolver } from "./routes/tenant-credentials.js";
|
|
30
26
|
import { hasResolvedOrg } from "./session/org-seed.js";
|
|
31
27
|
import { createSessionAsRowOwner, prepareSessionRunContext } from "./integrations/subscription-session.js";
|
|
32
|
-
import { PlatformGithubIntegration } from "./integrations/platform/github/integration.js";
|
|
33
|
-
import { PlatformGitLabIntegration } from "./integrations/platform/gitlab/integration.js";
|
|
34
|
-
import { PlatformIncidentioIntegration } from "./integrations/platform/incidentio/integration.js";
|
|
35
|
-
import { PlatformJiraIntegration } from "./integrations/platform/jira/integration.js";
|
|
36
|
-
import { PlatformLinearIntegration } from "./integrations/platform/linear/integration.js";
|
|
37
28
|
import { FactoryProjectsStorage } from "./storage/domains/projects/base.js";
|
|
38
29
|
import { SourceControlStorage } from "./storage/domains/source-control/base.js";
|
|
39
30
|
import { createSourceControlSessionLookup } from "./session/factory-session.js";
|
|
40
31
|
import { AuditStorage } from "./storage/domains/audit/base.js";
|
|
32
|
+
import { sessionMemoryResourceId, sessionStampCounts } from "./session/session-threads.js";
|
|
41
33
|
import { resolveFactoryToolScope } from "./tools/scope.js";
|
|
42
34
|
import { deliverFactorySessionNotification } from "./tools/deliver.js";
|
|
43
35
|
import { createSessionApprovalNotifier, createSessionRunEndReporter, createStageChangeNotifier, createWorkItemRunEndReporter } from "./tools/reports.js";
|
|
@@ -45,6 +37,9 @@ import { resolveFactoryCredentialTenant, resolveFactoryModelPolicy } from "./ses
|
|
|
45
37
|
import { hydrateSessionMemorySettings } from "./session/memory-settings-hydration.js";
|
|
46
38
|
import { MemorySettingsStorage, factoryMemorySettingsUserId } from "./storage/domains/memory-settings/base.js";
|
|
47
39
|
import { resolveDeploymentModelProviders } from "./routes/config.js";
|
|
40
|
+
import { observeSessionFirstExec } from "./session/first-exec-capture.js";
|
|
41
|
+
import { observeSessionFilesystem } from "./session/filesystem-capture.js";
|
|
42
|
+
import { createSessionAccessGuard } from "./routes/session-access.js";
|
|
48
43
|
import { observeSessionRunEnd } from "./session/run-audit.js";
|
|
49
44
|
import { observeSessionRunReports } from "./tools/run-watch.js";
|
|
50
45
|
import { applyFactoryToolPermissions } from "./tools/permissions.js";
|
|
@@ -65,6 +60,7 @@ import { createReviewSourceTool, resolveReviewSourceUiOrigin } from "./rules/rev
|
|
|
65
60
|
import { createTerminalStageCleanup } from "./rules/terminal-cleanup.js";
|
|
66
61
|
import { createFactoryTransitionTools } from "./rules/tools.js";
|
|
67
62
|
import { CallbackFactorySandbox } from "./sandbox/callback-factory-sandbox.js";
|
|
63
|
+
import { LocalFactorySandbox } from "./sandbox/local-factory-sandbox.js";
|
|
68
64
|
import { SessionRetirementCoordinator } from "./sandbox/session-retirement.js";
|
|
69
65
|
import { handleServerError } from "./server-error.js";
|
|
70
66
|
import { hydrateSessionDefaultModel } from "./session/default-model-hydration.js";
|
|
@@ -96,7 +92,7 @@ import { getDynamicMemory } from "@mastra/code-sdk/agents/memory";
|
|
|
96
92
|
import { AgentControllerChannels } from "@mastra/core/channels";
|
|
97
93
|
import { EventEmitterPubSub } from "@mastra/core/events";
|
|
98
94
|
import { describeFactorySandbox, isFactorySandbox } from "@mastra/core/workspace";
|
|
99
|
-
|
|
95
|
+
// src/factory.ts
|
|
100
96
|
/**
|
|
101
97
|
* `MastraFactory` — the single entry point to the whole Mastra Software Factory.
|
|
102
98
|
*
|
|
@@ -134,6 +130,24 @@ function hasPlatformCredentials() {
|
|
|
134
130
|
return Boolean(process.env.MASTRA_PLATFORM_ACCESS_TOKEN?.trim() || process.env.MASTRA_PLATFORM_SECRET_KEY?.trim());
|
|
135
131
|
}
|
|
136
132
|
/**
|
|
133
|
+
* The sandbox the factory installs when the host passes none and Platform
|
|
134
|
+
* credentials are present: a local sandbox under `mastra dev` (or
|
|
135
|
+
* NODE_ENV=development), so development never boots remote machines, and
|
|
136
|
+
* a Platform sandbox in built deployments. Without credentials, sandboxes
|
|
137
|
+
* stay disabled.
|
|
138
|
+
*/
|
|
139
|
+
async function platformDefaultSandbox() {
|
|
140
|
+
if (!hasPlatformCredentials()) return void 0;
|
|
141
|
+
if (process.env.MASTRA_DEV === "true" || process.env.NODE_ENV === "development") return new LocalFactorySandbox();
|
|
142
|
+
const missing = ["MASTRA_PROJECT_ID", "MASTRA_ENVIRONMENT_ID"].filter((key) => !process.env[key]?.trim());
|
|
143
|
+
if (missing.length > 0) {
|
|
144
|
+
console.warn(`MastraFactory: Platform credentials are set but ${missing.join(" and ")} ${missing.length > 1 ? "are" : "is"} missing, so no Platform sandbox was installed and repository sandboxes are disabled.`);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const { PlatformFactorySandbox } = await import("@mastra/platform-workspace");
|
|
148
|
+
return new PlatformFactorySandbox();
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
137
151
|
* Default auth provider — `MastraAuthStudio`, which proxies identity to the
|
|
138
152
|
* shared Mastra platform API and resolves its own env (`MASTRA_SHARED_API_URL`,
|
|
139
153
|
* `MASTRA_ORGANIZATION_ID`, ...).
|
|
@@ -249,16 +263,29 @@ var MastraFactory = class {
|
|
|
249
263
|
let installedPlatformGithub = false;
|
|
250
264
|
if (hasPlatformCredentials()) {
|
|
251
265
|
if (!explicitGithub) {
|
|
266
|
+
const { PlatformGithubIntegration } = await import("./integrations/platform/github/integration.js");
|
|
252
267
|
integrations.push(new PlatformGithubIntegration({
|
|
253
268
|
rules: this.#config.platform?.github?.rules,
|
|
254
269
|
slug: this.#config.platform?.github?.slug ?? this.#config.platform?.githubAppSlug
|
|
255
270
|
}));
|
|
256
271
|
installedPlatformGithub = true;
|
|
257
272
|
}
|
|
258
|
-
if (!integrations.some((integration) => integration.id === "incidentio"))
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
273
|
+
if (!integrations.some((integration) => integration.id === "incidentio")) {
|
|
274
|
+
const { PlatformIncidentioIntegration } = await import("./integrations/platform/incidentio/integration.js");
|
|
275
|
+
integrations.push(new PlatformIncidentioIntegration());
|
|
276
|
+
}
|
|
277
|
+
if (!integrations.some((integration) => integration.id === "jira")) {
|
|
278
|
+
const { PlatformJiraIntegration } = await import("./integrations/platform/jira/integration.js");
|
|
279
|
+
integrations.push(new PlatformJiraIntegration());
|
|
280
|
+
}
|
|
281
|
+
if (!integrations.some((integration) => integration.id === "gitlab")) {
|
|
282
|
+
const { PlatformGitLabIntegration } = await import("./integrations/platform/gitlab/integration.js");
|
|
283
|
+
integrations.push(new PlatformGitLabIntegration());
|
|
284
|
+
}
|
|
285
|
+
if (!integrations.some((integration) => integration.id === "linear")) {
|
|
286
|
+
const { PlatformLinearIntegration } = await import("./integrations/platform/linear/integration.js");
|
|
287
|
+
integrations.push(new PlatformLinearIntegration());
|
|
288
|
+
}
|
|
262
289
|
}
|
|
263
290
|
if (this.#config.platform?.github && !installedPlatformGithub) console.warn("[factory] 'platform.github' config was provided but the factory installed no GitHub integration of its own " + (explicitGithub ? "(an explicit integration with id 'github' takes precedence, so these options were ignored)." : "(no Platform credentials are configured and no explicit GitHub integration was passed)."));
|
|
264
291
|
const integrationIds = /* @__PURE__ */ new Set();
|
|
@@ -323,7 +350,8 @@ var MastraFactory = class {
|
|
|
323
350
|
});
|
|
324
351
|
const sandboxOption = this.#config.sandbox;
|
|
325
352
|
let sandboxConfig;
|
|
326
|
-
if (sandboxOption === void 0
|
|
353
|
+
if (sandboxOption === void 0) sandboxConfig = await platformDefaultSandbox();
|
|
354
|
+
else if (isFactorySandbox(sandboxOption)) sandboxConfig = sandboxOption;
|
|
327
355
|
else if (typeof sandboxOption === "function") sandboxConfig = new CallbackFactorySandbox(sandboxOption);
|
|
328
356
|
else throw new Error(invalidSandboxOptionMessage(sandboxOption));
|
|
329
357
|
this.#sandbox = sandboxConfig;
|
|
@@ -1300,7 +1328,6 @@ var MastraFactory = class {
|
|
|
1300
1328
|
await this.#dispatcher?.stop();
|
|
1301
1329
|
}
|
|
1302
1330
|
};
|
|
1303
|
-
//#endregion
|
|
1304
1331
|
export { MastraFactory };
|
|
1305
1332
|
|
|
1306
1333
|
//# sourceMappingURL=factory.js.map
|