@mastra/factory 0.23.0-alpha.1 → 0.23.0-alpha.3
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/factory.d.ts +8 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +16 -6
- package/dist/factory.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/github/integration.d.ts +7 -2
- package/dist/integrations/github/integration.d.ts.map +1 -1
- package/dist/integrations/github/integration.js +5 -2
- package/dist/integrations/github/integration.js.map +1 -1
- package/dist/integrations/github/routes.d.ts.map +1 -1
- package/dist/integrations/github/routes.js +9 -1
- package/dist/integrations/github/routes.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts +3 -1
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +2 -2
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/integrations/slack/slack.d.ts +5 -40
- package/dist/integrations/slack/slack.d.ts.map +1 -1
- package/dist/integrations/slack/slack.js +43 -132
- package/dist/integrations/slack/slack.js.map +1 -1
- package/dist/integrations/subscription-session.js +1 -1
- package/dist/routes/config.d.ts +3 -0
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +73 -3
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/contracts.d.ts +12 -2
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +2 -2
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +11 -2
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +13 -4
- package/dist/routes/surface.js.map +1 -1
- package/dist/routes/tenant-credentials.d.ts +12 -11
- package/dist/routes/tenant-credentials.d.ts.map +1 -1
- package/dist/routes/tenant-credentials.js +42 -28
- package/dist/routes/tenant-credentials.js.map +1 -1
- package/dist/routes/work-items.d.ts.map +1 -1
- package/dist/routes/work-items.js +7 -3
- package/dist/routes/work-items.js.map +1 -1
- package/dist/rules/start-coordinator.d.ts +8 -1
- package/dist/rules/start-coordinator.d.ts.map +1 -1
- package/dist/rules/start-coordinator.js +30 -10
- package/dist/rules/start-coordinator.js.map +1 -1
- package/dist/session/credential-policy.d.ts +20 -0
- package/dist/session/credential-policy.d.ts.map +1 -0
- package/dist/session/credential-policy.js +59 -0
- package/dist/session/credential-policy.js.map +1 -0
- package/dist/session/default-model-hydration.d.ts +13 -7
- package/dist/session/default-model-hydration.d.ts.map +1 -1
- package/dist/session/default-model-hydration.js +57 -12
- package/dist/session/default-model-hydration.js.map +1 -1
- package/dist/session/factory-session.d.ts +19 -9
- package/dist/session/factory-session.d.ts.map +1 -1
- package/dist/session/factory-session.js +56 -37
- package/dist/session/factory-session.js.map +1 -1
- package/dist/storage/domains/credentials/base.d.ts +4 -8
- package/dist/storage/domains/credentials/base.d.ts.map +1 -1
- package/dist/storage/domains/credentials/base.js +3 -7
- package/dist/storage/domains/credentials/base.js.map +1 -1
- package/dist/storage/domains/projects/base.d.ts +13 -5
- package/dist/storage/domains/projects/base.d.ts.map +1 -1
- package/dist/storage/domains/projects/base.js +16 -7
- package/dist/storage/domains/projects/base.js.map +1 -1
- package/dist/storage/domains/work-items/base.d.ts +9 -0
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +17 -1
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/supervisor/session.d.ts +3 -1
- package/dist/supervisor/session.d.ts.map +1 -1
- package/dist/supervisor/session.js +21 -3
- package/dist/supervisor/session.js.map +1 -1
- package/package.json +9 -8
package/dist/factory.d.ts
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* Integration readiness is derived from each instance's declared capabilities
|
|
19
19
|
* and the storage domains those capabilities require.
|
|
20
20
|
*/
|
|
21
|
+
import type { BuiltinToolId } from '@mastra/core/agent-controller';
|
|
21
22
|
import type { PubSub } from '@mastra/core/events';
|
|
22
23
|
import type { Knowledge } from '@mastra/core/knowledge';
|
|
23
24
|
import type { Mastra } from '@mastra/core/mastra';
|
|
@@ -108,6 +109,13 @@ export interface MastraFactoryConfig {
|
|
|
108
109
|
* (`'eager'`), so the boot overlaps the model's own latency.
|
|
109
110
|
*/
|
|
110
111
|
sandboxStart?: FactorySandboxStart;
|
|
112
|
+
/**
|
|
113
|
+
* Agent controller built-in tools (e.g. `submit_plan`) removed from every
|
|
114
|
+
* Factory session, along with their prompt guidance. Use this when a custom
|
|
115
|
+
* board gates planning with its own phase transition, so the in-session plan
|
|
116
|
+
* approval cannot bypass that gate.
|
|
117
|
+
*/
|
|
118
|
+
disableBuiltinTools?: BuiltinToolId[];
|
|
111
119
|
/** Background Factory dispatcher configuration. */
|
|
112
120
|
dispatcher?: MastraFactoryDispatcherConfig;
|
|
113
121
|
/**
|
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;
|
|
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,OAA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createBoardRegistry } from "./boards/registry.js";
|
|
|
6
6
|
import "./boards/index.js";
|
|
7
7
|
import { isValidGitRef } from "./sandbox/git-ref.js";
|
|
8
8
|
import { FactoryEnvironmentStateProcessor } from "./session/environment-state-processor.js";
|
|
9
|
+
import { createPlaintextFactorySecretEncryption } from "./secret-encryption.js";
|
|
10
|
+
import { ModelCredentialsStorage } from "./storage/domains/credentials/base.js";
|
|
11
|
+
import { createTenantCredentialPrimer, primeTenantCredentials, registerTenantCredentialResolver } from "./routes/tenant-credentials.js";
|
|
9
12
|
import { FactoryProjectsStorage } from "./storage/domains/projects/base.js";
|
|
10
13
|
import { SourceControlStorage } from "./storage/domains/source-control/base.js";
|
|
11
14
|
import { environmentSlugs, resolveSessionRepositories } from "./session/environment-repositories.js";
|
|
@@ -25,15 +28,13 @@ import { PlatformApiClient, platformApiClientConfigFromEnv } from "./integration
|
|
|
25
28
|
import { buildPlatformConnectRoutes } from "./integrations/platform/connect/routes.js";
|
|
26
29
|
import { observeSessionFirstExec } from "./session/first-exec-capture.js";
|
|
27
30
|
import { observeSessionFilesystem } from "./session/filesystem-capture.js";
|
|
28
|
-
import { createPlaintextFactorySecretEncryption } from "./secret-encryption.js";
|
|
29
|
-
import { ModelCredentialsStorage } from "./storage/domains/credentials/base.js";
|
|
30
|
-
import { createTenantCredentialPrimer, primeTenantCredentials, registerTenantCredentialResolver } from "./routes/tenant-credentials.js";
|
|
31
31
|
import { prepareSessionRunContext } from "./integrations/subscription-session.js";
|
|
32
32
|
import { PlatformGithubIntegration } from "./integrations/platform/github/integration.js";
|
|
33
33
|
import { PlatformGitLabIntegration } from "./integrations/platform/gitlab/integration.js";
|
|
34
34
|
import { PlatformIncidentioIntegration } from "./integrations/platform/incidentio/integration.js";
|
|
35
35
|
import { PlatformJiraIntegration } from "./integrations/platform/jira/integration.js";
|
|
36
36
|
import { PlatformLinearIntegration } from "./integrations/platform/linear/integration.js";
|
|
37
|
+
import { resolveFactoryCredentialTenant } from "./session/credential-policy.js";
|
|
37
38
|
import { hydrateSessionMemorySettings, layerPersonalMemorySettings } from "./session/memory-settings-hydration.js";
|
|
38
39
|
import { MemorySettingsStorage, factoryMemorySettingsUserId } from "./storage/domains/memory-settings/base.js";
|
|
39
40
|
import { resolveDeploymentModelProviders } from "./routes/config.js";
|
|
@@ -338,7 +339,6 @@ var MastraFactory = class {
|
|
|
338
339
|
allowedOrigins
|
|
339
340
|
}));
|
|
340
341
|
await timedPhase("prepare.storage.init", () => storage.init());
|
|
341
|
-
if (auth) registerTenantCredentialResolver(modelCredentialsStorage, deploymentModelProviders);
|
|
342
342
|
registerCustomProvidersSource({
|
|
343
343
|
storage: customProvidersStorage,
|
|
344
344
|
authEnabled: Boolean(auth)
|
|
@@ -355,6 +355,11 @@ var MastraFactory = class {
|
|
|
355
355
|
if (integration.versionControl && integrationSourceControl) integration.versionControl.initialize({ storage: integrationSourceControl });
|
|
356
356
|
}
|
|
357
357
|
const sourceControlSessions = createSourceControlSessionLookup([.../* @__PURE__ */ new Set(["github", ...integrations.filter((integration) => integration.versionControl).map(({ id }) => id)])].map((id) => sourceControlStorage.forIntegration(id)));
|
|
358
|
+
if (auth) registerTenantCredentialResolver(modelCredentialsStorage, deploymentModelProviders, (requestContext) => resolveFactoryCredentialTenant(requestContext, {
|
|
359
|
+
projects: factoryProjectsStorage,
|
|
360
|
+
sourceControl: sourceControlSessions,
|
|
361
|
+
workItems: workItemsStorage
|
|
362
|
+
}));
|
|
358
363
|
const integrationRegistrations = integrations.map((integration) => {
|
|
359
364
|
const requiredDomains = [
|
|
360
365
|
"integrations",
|
|
@@ -567,6 +572,7 @@ var MastraFactory = class {
|
|
|
567
572
|
const prepared = await timedPhase("prepare.controllerMount", () => prepareAgentControllerMount({
|
|
568
573
|
controllerId: CONTROLLER_ID,
|
|
569
574
|
coAuthor: { name: "mastra-platform[bot]" },
|
|
575
|
+
...this.#config.disableBuiltinTools?.length ? { disableBuiltinTools: this.#config.disableBuiltinTools } : {},
|
|
570
576
|
modes: false,
|
|
571
577
|
workspace: createWorkspaceFactory({
|
|
572
578
|
...sandboxConfig ? { sandbox: sandboxConfig } : {},
|
|
@@ -891,12 +897,16 @@ var MastraFactory = class {
|
|
|
891
897
|
observeSessionThreadTitle(session, { sourceControl: { sessions: sourceControlSessions } });
|
|
892
898
|
observeSessionRunEnd(session, { audit: auditDomain });
|
|
893
899
|
});
|
|
894
|
-
prepared.base.controller.onSessionCreated((session) => hydrateSupervisorSession(session, {
|
|
900
|
+
prepared.base.controller.onSessionCreated((session) => hydrateSupervisorSession(session, {
|
|
901
|
+
projects: factoryProjectsStorage,
|
|
902
|
+
modelDefaults: modelDefaultsStorage
|
|
903
|
+
}).catch((error) => {
|
|
895
904
|
console.warn("[Factory Supervisor] Failed to hydrate supervisor session", { error: error instanceof Error ? error.message : String(error) });
|
|
896
905
|
}), { blocking: true });
|
|
897
906
|
prepared.base.controller.onSessionCreated((session) => hydrateSessionMemorySettings(session, { sourceControl: { sessions: sourceControlSessions } }), { blocking: true });
|
|
898
907
|
prepared.base.controller.onSessionCreated((session) => hydrateSessionDefaultModel(session, {
|
|
899
|
-
sourceControl:
|
|
908
|
+
sourceControl: sourceControlSessions,
|
|
909
|
+
projects: factoryProjectsStorage,
|
|
900
910
|
workItems: workItemsStorage,
|
|
901
911
|
modelDefaults: modelDefaultsStorage
|
|
902
912
|
}), { blocking: true });
|