@mastra/factory 0.1.0-alpha.6 → 0.1.0-alpha.7
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/CHANGELOG.md +7 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +140 -8
- package/dist/factory.js.map +1 -1
- package/dist/index.js +140 -8
- package/dist/index.js.map +1 -1
- package/dist/integrations/github/integration.js +108 -1
- package/dist/integrations/github/integration.js.map +1 -1
- package/dist/integrations/github/pat.d.ts +38 -0
- package/dist/integrations/github/pat.d.ts.map +1 -0
- package/dist/integrations/github/pat.js +48 -0
- package/dist/integrations/github/pat.js.map +1 -0
- package/dist/integrations/github/provenance.js.map +1 -1
- package/dist/integrations/github/routes.d.ts.map +1 -1
- package/dist/integrations/github/routes.js +94 -1
- package/dist/integrations/github/routes.js.map +1 -1
- package/dist/integrations/github/session-subscriptions.d.ts.map +1 -1
- package/dist/integrations/github/session-subscriptions.js +30 -0
- package/dist/integrations/github/session-subscriptions.js.map +1 -1
- package/dist/integrations/github/token-refresh.d.ts +6 -0
- package/dist/integrations/github/token-refresh.d.ts.map +1 -1
- package/dist/integrations/github/token-refresh.js +10 -0
- package/dist/integrations/github/token-refresh.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +110 -2
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/routes/surface.js +7 -1
- package/dist/routes/surface.js.map +1 -1
- package/dist/routes/work-items.js.map +1 -1
- package/dist/rules/start-coordinator.d.ts.map +1 -1
- package/dist/rules/start-coordinator.js +7 -1
- package/dist/rules/start-coordinator.js.map +1 -1
- package/dist/workspace.d.ts +5 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +64 -5
- package/dist/workspace.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{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AAC;IACtB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,0EAA0E;IAC1E,OAAO,CAAC,EAAE,0BAA0B,CAAC;IACrC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACpC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC;;;;;;OAMG;IACH,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAwFD,qBAAa,aAAa;;gBAOZ,MAAM,EAAE,mBAAmB;IAWvC;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;IA8dpC;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAS/B,iFAAiF;IAC3E,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
|
package/dist/factory.js
CHANGED
|
@@ -24778,6 +24778,48 @@ function createFactoryAuthGate(provider) {
|
|
|
24778
24778
|
import { createTool } from "@mastra/core/tools";
|
|
24779
24779
|
import { z } from "zod";
|
|
24780
24780
|
|
|
24781
|
+
// src/integrations/github/pat.ts
|
|
24782
|
+
var PAT_SETTINGS_USER_ID = "__github_org_settings__";
|
|
24783
|
+
var FIELD_FOR_KIND = {
|
|
24784
|
+
default: "pat",
|
|
24785
|
+
reviewer: "reviewerPat"
|
|
24786
|
+
};
|
|
24787
|
+
function asToken(value) {
|
|
24788
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
24789
|
+
}
|
|
24790
|
+
async function getGithubPat(getStorage, orgId, kind = "default") {
|
|
24791
|
+
try {
|
|
24792
|
+
const settings = await getStorage().settings.get(orgId, PAT_SETTINGS_USER_ID);
|
|
24793
|
+
if (!settings) return null;
|
|
24794
|
+
if (kind === "reviewer") return asToken(settings.reviewerPat) ?? asToken(settings.pat);
|
|
24795
|
+
return asToken(settings.pat);
|
|
24796
|
+
} catch {
|
|
24797
|
+
return null;
|
|
24798
|
+
}
|
|
24799
|
+
}
|
|
24800
|
+
async function getGithubPatStatus(getStorage, orgId) {
|
|
24801
|
+
try {
|
|
24802
|
+
const settings = await getStorage().settings.get(orgId, PAT_SETTINGS_USER_ID);
|
|
24803
|
+
return {
|
|
24804
|
+
configured: asToken(settings?.pat) !== null,
|
|
24805
|
+
reviewerConfigured: asToken(settings?.reviewerPat) !== null
|
|
24806
|
+
};
|
|
24807
|
+
} catch {
|
|
24808
|
+
return { configured: false, reviewerConfigured: false };
|
|
24809
|
+
}
|
|
24810
|
+
}
|
|
24811
|
+
async function setGithubPat(storage, orgId, pat, kind = "default") {
|
|
24812
|
+
const existing = await storage.settings.get(orgId, PAT_SETTINGS_USER_ID) ?? {};
|
|
24813
|
+
await storage.settings.save(orgId, PAT_SETTINGS_USER_ID, { ...existing, [FIELD_FOR_KIND[kind]]: pat });
|
|
24814
|
+
}
|
|
24815
|
+
async function clearGithubPat(storage, orgId, kind = "default") {
|
|
24816
|
+
const existing = await storage.settings.get(orgId, PAT_SETTINGS_USER_ID);
|
|
24817
|
+
const field = FIELD_FOR_KIND[kind];
|
|
24818
|
+
if (!existing?.[field]) return;
|
|
24819
|
+
const { [field]: _removed, ...rest } = existing;
|
|
24820
|
+
await storage.settings.save(orgId, PAT_SETTINGS_USER_ID, rest);
|
|
24821
|
+
}
|
|
24822
|
+
|
|
24781
24823
|
// src/integrations/github/subscriptions.ts
|
|
24782
24824
|
function changeRequestTargetKey(input) {
|
|
24783
24825
|
return `change-request:${input.installationExternalId}:${input.repositoryExternalId}:${input.changeRequestId}`;
|
|
@@ -24832,9 +24874,17 @@ function retirePullRequestSubscription(id, status, storage) {
|
|
|
24832
24874
|
|
|
24833
24875
|
// src/integrations/github/token-refresh.ts
|
|
24834
24876
|
var GITHUB_TOKEN_INJECTOR_CONTEXT_KEY = "factoryGithubTokenInjector";
|
|
24877
|
+
var GITHUB_PAT_KIND_CONTEXT_KEY = "factoryGithubPatKind";
|
|
24835
24878
|
function registerGithubTokenInjector(requestContext, injector) {
|
|
24836
24879
|
requestContext.set(GITHUB_TOKEN_INJECTOR_CONTEXT_KEY, injector);
|
|
24837
24880
|
}
|
|
24881
|
+
function registerGithubPatKind(requestContext, kind) {
|
|
24882
|
+
requestContext.set(GITHUB_PAT_KIND_CONTEXT_KEY, kind);
|
|
24883
|
+
}
|
|
24884
|
+
function getRegisteredGithubPatKind(requestContext) {
|
|
24885
|
+
const kind = requestContext.get(GITHUB_PAT_KIND_CONTEXT_KEY);
|
|
24886
|
+
return kind === "reviewer" ? "reviewer" : "default";
|
|
24887
|
+
}
|
|
24838
24888
|
function injectGithubToken(requestContext, token) {
|
|
24839
24889
|
const injector = requestContext.get(GITHUB_TOKEN_INJECTOR_CONTEXT_KEY);
|
|
24840
24890
|
if (!injector) {
|
|
@@ -24932,6 +24982,15 @@ async function unsubscribeCurrentSessionFromPullRequest(requestContext, pullRequ
|
|
|
24932
24982
|
}
|
|
24933
24983
|
async function refreshGithubToken(requestContext, github) {
|
|
24934
24984
|
const target = await resolveSessionTarget(requestContext, github);
|
|
24985
|
+
const pat = await getGithubPat(
|
|
24986
|
+
() => github.integrationStorage,
|
|
24987
|
+
target.orgId,
|
|
24988
|
+
getRegisteredGithubPatKind(requestContext)
|
|
24989
|
+
);
|
|
24990
|
+
if (pat) {
|
|
24991
|
+
injectGithubToken(requestContext, pat);
|
|
24992
|
+
return;
|
|
24993
|
+
}
|
|
24935
24994
|
const access = await github.versionControl.getRepositoryAccess({
|
|
24936
24995
|
orgId: target.orgId,
|
|
24937
24996
|
repositoryId: target.repository.id
|
|
@@ -26659,6 +26718,56 @@ function buildGithubRoutes(options) {
|
|
|
26659
26718
|
}
|
|
26660
26719
|
})
|
|
26661
26720
|
);
|
|
26721
|
+
const parsePatKind = (value) => {
|
|
26722
|
+
if (value === void 0 || value === null || value === "default") return "default";
|
|
26723
|
+
if (value === "reviewer") return "reviewer";
|
|
26724
|
+
return null;
|
|
26725
|
+
};
|
|
26726
|
+
routes.push(
|
|
26727
|
+
registerApiRoute2("/web/github/pat", {
|
|
26728
|
+
method: "GET",
|
|
26729
|
+
requiresAuth: false,
|
|
26730
|
+
handler: async (c) => {
|
|
26731
|
+
const resolved = await resolveOrgTenant(loose(c), auth);
|
|
26732
|
+
if ("response" in resolved) return resolved.response;
|
|
26733
|
+
return c.json(await getGithubPatStatus(() => github.integrationStorage, resolved.tenant.orgId));
|
|
26734
|
+
}
|
|
26735
|
+
}),
|
|
26736
|
+
registerApiRoute2("/web/github/pat", {
|
|
26737
|
+
method: "POST",
|
|
26738
|
+
requiresAuth: false,
|
|
26739
|
+
handler: async (c) => {
|
|
26740
|
+
const resolved = await resolveOrgTenant(loose(c), auth);
|
|
26741
|
+
if ("response" in resolved) return resolved.response;
|
|
26742
|
+
let body;
|
|
26743
|
+
try {
|
|
26744
|
+
body = await c.req.json();
|
|
26745
|
+
} catch {
|
|
26746
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
26747
|
+
}
|
|
26748
|
+
const kind = parsePatKind(body.kind);
|
|
26749
|
+
if (!kind) return c.json({ error: "kind must be 'default' or 'reviewer'" }, 400);
|
|
26750
|
+
const token = typeof body.token === "string" ? body.token.trim() : "";
|
|
26751
|
+
if (!token) return c.json({ error: "A token is required" }, 400);
|
|
26752
|
+
if (token.length > 500) return c.json({ error: "Token too long (max 500 characters)" }, 400);
|
|
26753
|
+
if (/\s/.test(token)) return c.json({ error: "Token must not contain whitespace" }, 400);
|
|
26754
|
+
await setGithubPat(github.integrationStorage, resolved.tenant.orgId, token, kind);
|
|
26755
|
+
return c.json(await getGithubPatStatus(() => github.integrationStorage, resolved.tenant.orgId));
|
|
26756
|
+
}
|
|
26757
|
+
}),
|
|
26758
|
+
registerApiRoute2("/web/github/pat", {
|
|
26759
|
+
method: "DELETE",
|
|
26760
|
+
requiresAuth: false,
|
|
26761
|
+
handler: async (c) => {
|
|
26762
|
+
const resolved = await resolveOrgTenant(loose(c), auth);
|
|
26763
|
+
if ("response" in resolved) return resolved.response;
|
|
26764
|
+
const kind = parsePatKind(c.req.query("kind"));
|
|
26765
|
+
if (!kind) return c.json({ error: "kind must be 'default' or 'reviewer'" }, 400);
|
|
26766
|
+
await clearGithubPat(github.integrationStorage, resolved.tenant.orgId, kind);
|
|
26767
|
+
return c.json(await getGithubPatStatus(() => github.integrationStorage, resolved.tenant.orgId));
|
|
26768
|
+
}
|
|
26769
|
+
})
|
|
26770
|
+
);
|
|
26662
26771
|
routes.push(...buildProjectGitRoutes({ github, auth, fleet, storage, emitAudit }));
|
|
26663
26772
|
return routes;
|
|
26664
26773
|
}
|
|
@@ -26701,11 +26810,12 @@ async function prepareProject(options) {
|
|
|
26701
26810
|
if (!access.authorization) {
|
|
26702
26811
|
throw new MaterializeError("Repository access did not include a bearer token.", "clone-failed");
|
|
26703
26812
|
}
|
|
26813
|
+
const ghCliToken = await getGithubPat(() => github.integrationStorage, project.installation.orgId) ?? access.authorization.token;
|
|
26704
26814
|
const sandbox = await ensureProjectSandbox({
|
|
26705
26815
|
fleet,
|
|
26706
26816
|
row: sandboxRow,
|
|
26707
26817
|
storage: github.sourceControlStorage.sandboxes,
|
|
26708
|
-
token:
|
|
26818
|
+
token: ghCliToken,
|
|
26709
26819
|
onProgress
|
|
26710
26820
|
});
|
|
26711
26821
|
const fresh = await github.sourceControlStorage.sandboxes.getById({ id: sandboxRow.id });
|
|
@@ -27739,6 +27849,7 @@ var PlatformGithubIntegration = class {
|
|
|
27739
27849
|
getRepositoryAccess: async ({ orgId, repositoryId }) => {
|
|
27740
27850
|
const repository = await this.storage.repositories.get({ orgId, id: repositoryId });
|
|
27741
27851
|
if (!repository) throw new Error("Version-control repository not found.");
|
|
27852
|
+
const cloneUrl = `https://github.com/${repository.slug}.git`;
|
|
27742
27853
|
const installation = await this.storage.installations.get({ orgId, id: repository.installationId });
|
|
27743
27854
|
if (!installation) throw new Error("Version-control installation not found.");
|
|
27744
27855
|
const installationId = parsePositiveInteger(installation.externalId);
|
|
@@ -27750,7 +27861,7 @@ var PlatformGithubIntegration = class {
|
|
|
27750
27861
|
{ repositories: [repositoryName], permissions: REPOSITORY_TOKEN_PERMISSIONS }
|
|
27751
27862
|
);
|
|
27752
27863
|
return {
|
|
27753
|
-
cloneUrl
|
|
27864
|
+
cloneUrl,
|
|
27754
27865
|
authorization: { scheme: "bearer", token: token.token }
|
|
27755
27866
|
};
|
|
27756
27867
|
},
|
|
@@ -30558,13 +30669,19 @@ var FactoryStartCoordinator = class {
|
|
|
30558
30669
|
if (!request.requestContext) {
|
|
30559
30670
|
requestContext.set("user", { workosId: request.userId, organizationId: request.orgId });
|
|
30560
30671
|
}
|
|
30672
|
+
const sessionState = {
|
|
30673
|
+
factoryProjectId: request.factoryProjectId,
|
|
30674
|
+
projectRepositoryId: sourceSession.projectRepositoryId
|
|
30675
|
+
};
|
|
30561
30676
|
const session = await this.#controller.createSession({
|
|
30562
30677
|
id: sourceSession.sessionId,
|
|
30563
30678
|
ownerId: request.userId,
|
|
30564
30679
|
resourceId: sourceSession.sessionId,
|
|
30565
30680
|
threadId: sourceSession.sessionId,
|
|
30566
|
-
requestContext
|
|
30681
|
+
requestContext,
|
|
30682
|
+
tags: sessionState
|
|
30567
30683
|
});
|
|
30684
|
+
await session.state.set(sessionState);
|
|
30568
30685
|
const threadId = await configureThread(session, request);
|
|
30569
30686
|
const kickoffMessage = await resolveKickoffMessage(session, request.invocation);
|
|
30570
30687
|
const prepared = await storage.prepareRunStart({
|
|
@@ -38391,7 +38508,7 @@ var factorySkillExtension = {
|
|
|
38391
38508
|
createSource: (fallback, fallbackSkillRoots) => new FactorySkillSource(fallback, fallbackSkillRoots)
|
|
38392
38509
|
};
|
|
38393
38510
|
function createWorkspaceFactory(options = {}) {
|
|
38394
|
-
const { sandbox: sandboxConfig, github, fleet } = options;
|
|
38511
|
+
const { sandbox: sandboxConfig, github, fleet, workItems } = options;
|
|
38395
38512
|
const isLocalSandbox = sandboxConfig?.machine instanceof LocalSandbox;
|
|
38396
38513
|
const githubTokenInjectors = /* @__PURE__ */ new Map();
|
|
38397
38514
|
return async ({ requestContext, mastra, skillExtension }) => {
|
|
@@ -38445,8 +38562,11 @@ function createWorkspaceFactory(options = {}) {
|
|
|
38445
38562
|
const existing = mastra?.getWorkspaceById(workspaceId);
|
|
38446
38563
|
if (existing) {
|
|
38447
38564
|
existing.setToolsConfig(MASTRACODE_WORKSPACE_TOOLS);
|
|
38448
|
-
const
|
|
38449
|
-
if (
|
|
38565
|
+
const registered = githubTokenInjectors.get(workspaceId);
|
|
38566
|
+
if (registered) {
|
|
38567
|
+
registerGithubTokenInjector(requestContext, registered.inject);
|
|
38568
|
+
registerGithubPatKind(requestContext, registered.patKind);
|
|
38569
|
+
}
|
|
38450
38570
|
return existing;
|
|
38451
38571
|
}
|
|
38452
38572
|
} catch {
|
|
@@ -38457,9 +38577,19 @@ function createWorkspaceFactory(options = {}) {
|
|
|
38457
38577
|
});
|
|
38458
38578
|
const token = access.authorization?.token;
|
|
38459
38579
|
if (!token) throw new Error("Repository access did not include a bearer token for the Factory session");
|
|
38580
|
+
let patKind = "default";
|
|
38581
|
+
if (workItems) {
|
|
38582
|
+
try {
|
|
38583
|
+
const address = getFactorySessionAddress(requestContext);
|
|
38584
|
+
const runBinding = address ? await workItems.findRunBindingBySession(address) : null;
|
|
38585
|
+
if (runBinding?.role === "review" && runBinding.orgId === session.orgId) patKind = "reviewer";
|
|
38586
|
+
} catch {
|
|
38587
|
+
}
|
|
38588
|
+
}
|
|
38589
|
+
const ghCliToken = await getGithubPat(() => github.integrationStorage, session.orgId, patKind) ?? token;
|
|
38460
38590
|
const sandbox = await fleet.ensureSandbox(
|
|
38461
38591
|
binding,
|
|
38462
|
-
{ GH_TOKEN:
|
|
38592
|
+
{ GH_TOKEN: ghCliToken },
|
|
38463
38593
|
void 0,
|
|
38464
38594
|
isLocalSandbox ? { workingDirectory: workdir } : {}
|
|
38465
38595
|
);
|
|
@@ -38483,8 +38613,9 @@ function createWorkspaceFactory(options = {}) {
|
|
|
38483
38613
|
}
|
|
38484
38614
|
sandbox.setEnvironmentVariable("GH_TOKEN", freshToken);
|
|
38485
38615
|
};
|
|
38486
|
-
githubTokenInjectors.set(workspaceId, injectGithubToken2);
|
|
38616
|
+
githubTokenInjectors.set(workspaceId, { inject: injectGithubToken2, patKind });
|
|
38487
38617
|
registerGithubTokenInjector(requestContext, injectGithubToken2);
|
|
38618
|
+
registerGithubPatKind(requestContext, patKind);
|
|
38488
38619
|
const filesystem = new SandboxFilesystem({ sandbox, workdir });
|
|
38489
38620
|
const projectSkillPaths = [path2.join(configDir, "skills"), ".claude/skills", ".agents/skills"];
|
|
38490
38621
|
const skillPaths = [...effectiveSkillExtension?.paths ?? [], ...projectSkillPaths];
|
|
@@ -38721,6 +38852,7 @@ var MastraFactory = class {
|
|
|
38721
38852
|
workspace: createWorkspaceFactory({
|
|
38722
38853
|
...this.#config.sandbox ? { sandbox: this.#config.sandbox } : {},
|
|
38723
38854
|
...githubIntegration ? { github: githubIntegration } : {},
|
|
38855
|
+
...workItemsStorage ? { workItems: workItemsStorage } : {},
|
|
38724
38856
|
fleet
|
|
38725
38857
|
}),
|
|
38726
38858
|
disableGithubSignals: true,
|