@mastra/factory 0.21.1-alpha.3 → 0.22.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.
- package/dist/capabilities/version-control.d.ts +13 -8
- package/dist/capabilities/version-control.d.ts.map +1 -1
- package/dist/environment/build-runner.d.ts +72 -0
- package/dist/environment/build-runner.d.ts.map +1 -0
- package/dist/environment/build-runner.js +131 -0
- package/dist/environment/build-runner.js.map +1 -0
- package/dist/environment/build-schedule.d.ts +40 -0
- package/dist/environment/build-schedule.d.ts.map +1 -0
- package/dist/environment/build-schedule.js +94 -0
- package/dist/environment/build-schedule.js.map +1 -0
- package/dist/environment/build-workflow.d.ts +62 -0
- package/dist/environment/build-workflow.d.ts.map +1 -0
- package/dist/environment/build-workflow.js +149 -0
- package/dist/environment/build-workflow.js.map +1 -0
- package/dist/environment/build.d.ts +111 -0
- package/dist/environment/build.d.ts.map +1 -0
- package/dist/environment/build.js +344 -0
- package/dist/environment/build.js.map +1 -0
- package/dist/environment/heads.d.ts +36 -0
- package/dist/environment/heads.d.ts.map +1 -0
- package/dist/environment/heads.js +60 -0
- package/dist/environment/heads.js.map +1 -0
- package/dist/factory.d.ts +18 -4
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +89 -15
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/integrations/base.d.ts +17 -2
- package/dist/integrations/base.d.ts.map +1 -1
- package/dist/integrations/github/commits.d.ts +11 -0
- package/dist/integrations/github/commits.d.ts.map +1 -1
- package/dist/integrations/github/commits.js +20 -1
- package/dist/integrations/github/commits.js.map +1 -1
- package/dist/integrations/github/config.d.ts +3 -3
- package/dist/integrations/github/config.d.ts.map +1 -1
- package/dist/integrations/github/config.js +1 -1
- package/dist/integrations/github/config.js.map +1 -1
- package/dist/integrations/github/routes.d.ts +2 -2
- package/dist/integrations/github/routes.d.ts.map +1 -1
- package/dist/integrations/github/routes.js +6 -5
- package/dist/integrations/github/routes.js.map +1 -1
- package/dist/integrations/github/rules.d.ts +3 -1
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +31 -1
- package/dist/integrations/github/rules.js.map +1 -1
- package/dist/integrations/github/sandbox.d.ts +35 -0
- package/dist/integrations/github/sandbox.d.ts.map +1 -1
- package/dist/integrations/github/sandbox.js +203 -2
- package/dist/integrations/github/sandbox.js.map +1 -1
- package/dist/integrations/github/session-subscriptions.d.ts.map +1 -1
- package/dist/integrations/github/session-subscriptions.js +117 -62
- package/dist/integrations/github/session-subscriptions.js.map +1 -1
- package/dist/integrations/github/token-refresh.d.ts +7 -0
- package/dist/integrations/github/token-refresh.d.ts.map +1 -1
- package/dist/integrations/github/token-refresh.js.map +1 -1
- package/dist/integrations/github/webhook.js.map +1 -1
- package/dist/integrations/gitlab/agent-tools.js +1 -1
- package/dist/integrations/gitlab/routes.d.ts +2 -2
- package/dist/integrations/gitlab/routes.d.ts.map +1 -1
- package/dist/integrations/gitlab/routes.js.map +1 -1
- package/dist/integrations/gitlab/session-subscriptions.d.ts.map +1 -1
- package/dist/integrations/gitlab/session-subscriptions.js +8 -7
- package/dist/integrations/gitlab/session-subscriptions.js.map +1 -1
- package/dist/integrations/incidentio/agent-tools.js +1 -1
- package/dist/integrations/jira/agent-tools.js +1 -1
- package/dist/integrations/linear/agent-tools.js +1 -1
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +46 -2
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/integrations/platform/jira/agent-tools.js +1 -1
- package/dist/integrations/slack/slack.d.ts.map +1 -1
- package/dist/integrations/slack/slack.js +15 -16
- package/dist/integrations/slack/slack.js.map +1 -1
- package/dist/integrations/subscription-session.js +1 -1
- package/dist/packages/_internals/workspace/dist/index.js +21 -1
- package/dist/packages/_internals/workspace/dist/index.js.map +1 -1
- package/dist/routes/contracts.d.ts +386 -2
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +166 -1
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/fs.d.ts +25 -0
- package/dist/routes/fs.d.ts.map +1 -1
- package/dist/routes/fs.js +142 -46
- package/dist/routes/fs.js.map +1 -1
- package/dist/routes/projects.d.ts +6 -0
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +344 -1
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/source-control-sessions.d.ts +2 -0
- package/dist/routes/source-control-sessions.d.ts.map +1 -1
- package/dist/routes/source-control-sessions.js +36 -1
- package/dist/routes/source-control-sessions.js.map +1 -1
- package/dist/routes/supervisor.js +1 -1
- package/dist/routes/surface.d.ts +6 -3
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +21 -34
- package/dist/routes/surface.js.map +1 -1
- package/dist/rules/binding-context.d.ts +1 -1
- package/dist/rules/binding-context.d.ts.map +1 -1
- package/dist/rules/binding-context.js +1 -1
- package/dist/rules/binding-context.js.map +1 -1
- package/dist/rules/review-source-tool.js +1 -1
- package/dist/rules/start-coordinator.d.ts.map +1 -1
- package/dist/rules/start-coordinator.js +7 -2
- package/dist/rules/start-coordinator.js.map +1 -1
- package/dist/rules/tools.js +1 -1
- package/dist/sandbox/callback-factory-sandbox.d.ts +15 -0
- package/dist/sandbox/callback-factory-sandbox.d.ts.map +1 -0
- package/dist/sandbox/callback-factory-sandbox.js +22 -0
- package/dist/sandbox/callback-factory-sandbox.js.map +1 -0
- package/dist/sandbox/local-factory-sandbox.d.ts +20 -0
- package/dist/sandbox/local-factory-sandbox.d.ts.map +1 -0
- package/dist/sandbox/local-factory-sandbox.js +27 -0
- package/dist/sandbox/local-factory-sandbox.js.map +1 -0
- package/dist/sandbox/session-retirement.d.ts.map +1 -1
- package/dist/sandbox/session-retirement.js +23 -3
- package/dist/sandbox/session-retirement.js.map +1 -1
- package/dist/sandbox/session-sandbox.d.ts +82 -40
- package/dist/sandbox/session-sandbox.d.ts.map +1 -1
- package/dist/sandbox/session-sandbox.js +130 -13
- package/dist/sandbox/session-sandbox.js.map +1 -1
- package/dist/sandbox/workdir.d.ts +10 -0
- package/dist/sandbox/workdir.d.ts.map +1 -1
- package/dist/sandbox/workdir.js +10 -1
- package/dist/sandbox/workdir.js.map +1 -1
- package/dist/session/environment-repositories.d.ts +31 -0
- package/dist/session/environment-repositories.d.ts.map +1 -0
- package/dist/session/environment-repositories.js +89 -0
- package/dist/session/environment-repositories.js.map +1 -0
- package/dist/session/environment-state-processor.d.ts +59 -0
- package/dist/session/environment-state-processor.d.ts.map +1 -0
- package/dist/session/environment-state-processor.js +105 -0
- package/dist/session/environment-state-processor.js.map +1 -0
- package/dist/session/factory-session.d.ts +26 -35
- package/dist/session/factory-session.d.ts.map +1 -1
- package/dist/session/factory-session.js +34 -71
- package/dist/session/factory-session.js.map +1 -1
- package/dist/session/filesystem-capture.d.ts +13 -0
- package/dist/session/filesystem-capture.d.ts.map +1 -1
- package/dist/session/filesystem-capture.js +73 -14
- package/dist/session/filesystem-capture.js.map +1 -1
- package/dist/session/source-control-tools.d.ts +1 -1
- package/dist/session/source-control-tools.d.ts.map +1 -1
- package/dist/session/source-control-tools.js +144 -71
- package/dist/session/source-control-tools.js.map +1 -1
- package/dist/spa-static.js +2 -2
- package/dist/storage/domains/audit/agent-audit.d.ts +6 -1
- package/dist/storage/domains/audit/agent-audit.d.ts.map +1 -1
- package/dist/storage/domains/audit/agent-audit.js +31 -13
- package/dist/storage/domains/audit/agent-audit.js.map +1 -1
- package/dist/storage/domains/projects/base.d.ts +115 -2
- package/dist/storage/domains/projects/base.d.ts.map +1 -1
- package/dist/storage/domains/projects/base.js +219 -12
- package/dist/storage/domains/projects/base.js.map +1 -1
- package/dist/storage/domains/source-control/base.d.ts +123 -7
- package/dist/storage/domains/source-control/base.d.ts.map +1 -1
- package/dist/storage/domains/source-control/base.js +406 -33
- package/dist/storage/domains/source-control/base.js.map +1 -1
- package/dist/storage/domains/source-control/inmemory.d.ts +19 -6
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/source-control/inmemory.js +90 -2
- package/dist/storage/domains/source-control/inmemory.js.map +1 -1
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +12 -5
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/supervisor/read-tools.js +1 -1
- package/dist/supervisor/write-tools.js +1 -1
- package/dist/workspace.d.ts +50 -7
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +344 -24
- package/dist/workspace.js.map +1 -1
- package/package.json +7 -7
|
@@ -22,12 +22,12 @@ import type { RequestContext } from '@mastra/core/request-context';
|
|
|
22
22
|
import type { ApiRoute, IUserProvider } from '@mastra/core/server';
|
|
23
23
|
import type { FactoryStorage } from '@mastra/core/storage';
|
|
24
24
|
import type { MastraWorker } from '@mastra/core/worker';
|
|
25
|
+
import type { FactorySandbox } from '@mastra/core/workspace';
|
|
25
26
|
import type { BoardRegistry } from '../boards/index.js';
|
|
26
27
|
import type { Intake } from '../capabilities/intake.js';
|
|
27
28
|
import type { VersionControl } from '../capabilities/version-control.js';
|
|
28
29
|
import type { RouteAuth } from '../routes/route.js';
|
|
29
30
|
import type { SessionRetirementCoordinator } from '../sandbox/session-retirement.js';
|
|
30
|
-
import type { MastraFactorySandboxConfig } from '../sandbox/session-sandbox.js';
|
|
31
31
|
import type { StateSigner } from '../state-signing.js';
|
|
32
32
|
import type { AuditEventRow } from '../storage/domains/audit/base.js';
|
|
33
33
|
import type { AuditEmitter } from '../storage/domains/audit/domain.js';
|
|
@@ -41,9 +41,24 @@ import type { ModelDefaultsStorage } from '../storage/domains/model-defaults/bas
|
|
|
41
41
|
import type { FactoryProjectsStorage } from '../storage/domains/projects/base.js';
|
|
42
42
|
import type { SourceControlStorageHandle } from '../storage/domains/source-control/base.js';
|
|
43
43
|
import type { WorkItemsStorage } from '../storage/domains/work-items/base.js';
|
|
44
|
+
/** A push to a repository linked to a project, as a version-control integration reports it. */
|
|
45
|
+
export interface RepositoryPushEvent {
|
|
46
|
+
orgId: string;
|
|
47
|
+
factoryProjectId: string;
|
|
48
|
+
projectRepository: {
|
|
49
|
+
id: string;
|
|
50
|
+
inEnvironment: boolean;
|
|
51
|
+
};
|
|
52
|
+
/** The pushed git ref, for example `refs/heads/main`. */
|
|
53
|
+
ref: string;
|
|
54
|
+
/** The repository's default branch as the provider reports it. */
|
|
55
|
+
defaultBranch: string;
|
|
56
|
+
}
|
|
44
57
|
/** Factory-owned hooks integrations may invoke. */
|
|
45
58
|
export interface IntegrationHooks {
|
|
46
59
|
emitAudit?: AuditEmitter['emit'];
|
|
60
|
+
/** Hand a push off for an environment build; never blocks the webhook and never throws. */
|
|
61
|
+
onRepositoryPush?: (event: RepositoryPushEvent) => void;
|
|
47
62
|
}
|
|
48
63
|
/**
|
|
49
64
|
* Tool records integrations contribute — the same static-record shape the
|
|
@@ -72,7 +87,7 @@ export interface IntegrationContext {
|
|
|
72
87
|
* sandboxes. Absent when no sandbox is configured — sandbox-backed
|
|
73
88
|
* routes respond 503.
|
|
74
89
|
*/
|
|
75
|
-
sandbox?:
|
|
90
|
+
sandbox?: FactorySandbox;
|
|
76
91
|
/**
|
|
77
92
|
* Root factory storage backend and source of the `appDbConfigured`
|
|
78
93
|
* diagnostic. Absent when the host runs without an application database.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/integrations/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KA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C,IAAI,EAAE;QAAE,cAAc,EAAE,cAAc,CAAA;KAAE,GAAG,gBAAgB,CAAC;IAC1E;;;;OAIG;IACH,gBAAgB,CAAC,CAAC,IAAI,EAAE;QAAE,WAAW,EAAE,0BAA0B,CAAC;QAAC,cAAc,CAAC,EAAE,cAAc,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrH;;;;;;;;OAQG;IACH,OAAO,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,YAAY,EAAE,CAAC;IAClD;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,qBAAqB,CAAC;IAC1D;;;;;OAKG;IACH,aAAa,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,qBAAqB,CAAC;IAC/D;;;OAGG;IACH,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC;;;OAGG;IACH,KAAK,CAAC,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,aAAa,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD;;;;;OAKG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CAC9C"}
|
|
@@ -26,4 +26,15 @@ export declare function listRepositoryCommits(github: {
|
|
|
26
26
|
branch: string;
|
|
27
27
|
limit: number;
|
|
28
28
|
}): Promise<RepositoryCommit[]>;
|
|
29
|
+
/** The commit a branch points at right now, as a full sha. Throws when GitHub rejects the lookup. */
|
|
30
|
+
export declare function getBranchHead(github: {
|
|
31
|
+
versionControl: Pick<VersionControl, 'getRepositoryAccess'>;
|
|
32
|
+
}, input: {
|
|
33
|
+
orgId: string;
|
|
34
|
+
repository: {
|
|
35
|
+
id: string;
|
|
36
|
+
slug: string;
|
|
37
|
+
};
|
|
38
|
+
branch: string;
|
|
39
|
+
}): Promise<string>;
|
|
29
40
|
//# sourceMappingURL=commits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commits.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/commits.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAI5E,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;CACb;AASD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE;IAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAA;CAAE,EACvE,KAAK,EAAE;IACL,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE;QAAE,UAAU,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,GACA,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA2B7B"}
|
|
1
|
+
{"version":3,"file":"commits.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/commits.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAI5E,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;CACb;AASD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE;IAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAA;CAAE,EACvE,KAAK,EAAE;IACL,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE;QAAE,UAAU,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,GACA,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA2B7B;AAID,qGAAqG;AACrG,wBAAsB,aAAa,CACjC,MAAM,EAAE;IAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAA;CAAE,EACvE,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACjF,OAAO,CAAC,MAAM,CAAC,CA0BjB"}
|
|
@@ -23,7 +23,26 @@ async function listRepositoryCommits(github, input) {
|
|
|
23
23
|
url: entry.html_url
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
26
|
+
const SHA_PATTERN = /^[0-9a-f]{40}$/;
|
|
27
|
+
/** The commit a branch points at right now, as a full sha. Throws when GitHub rejects the lookup. */
|
|
28
|
+
async function getBranchHead(github, input) {
|
|
29
|
+
const access = await github.versionControl.getRepositoryAccess({
|
|
30
|
+
orgId: input.orgId,
|
|
31
|
+
repositoryId: input.repository.id
|
|
32
|
+
});
|
|
33
|
+
const response = await fetch(`${GITHUB_API}/repos/${input.repository.slug}/commits/${encodeURIComponent(input.branch)}`, {
|
|
34
|
+
headers: {
|
|
35
|
+
accept: "application/vnd.github.sha",
|
|
36
|
+
...access.authorization ? { authorization: `Bearer ${access.authorization.token}` } : {}
|
|
37
|
+
},
|
|
38
|
+
signal: AbortSignal.timeout(1e4)
|
|
39
|
+
});
|
|
40
|
+
if (!response.ok) throw new Error(`GitHub rejected the head lookup for ${input.repository.slug}@${input.branch} (${response.status}).`);
|
|
41
|
+
const sha = (await response.text()).trim();
|
|
42
|
+
if (!SHA_PATTERN.test(sha)) throw new Error(`GitHub returned no commit sha for ${input.repository.slug}@${input.branch}.`);
|
|
43
|
+
return sha;
|
|
44
|
+
}
|
|
26
45
|
//#endregion
|
|
27
|
-
export { listRepositoryCommits };
|
|
46
|
+
export { getBranchHead, listRepositoryCommits };
|
|
28
47
|
|
|
29
48
|
//# sourceMappingURL=commits.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commits.js","names":[],"sources":["../../../src/integrations/github/commits.ts"],"sourcesContent":["/**\n * Read with the installation token that already clones and pushes, not through\n * `getInstallationOctokit`: the Platform deployment answers that with a\n * pull-request-only stub, so `repos.*` is undefined there at runtime while the\n * cast keeps the compiler quiet.\n */\n\nimport type { VersionControl } from '../../capabilities/version-control.js';\n\nconst GITHUB_API = 'https://api.github.com';\n\nexport interface RepositoryCommit {\n sha: string;\n message: string;\n author: string | null;\n avatarUrl: string | null;\n committedAt: string | null;\n url: string;\n}\n\ninterface GithubCommitResponse {\n sha: string;\n html_url: string;\n commit: { message: string; author: { name?: string; date?: string } | null };\n author: { login: string; avatar_url: string } | null;\n}\n\nexport async function listRepositoryCommits(\n github: { versionControl: Pick<VersionControl, 'getRepositoryAccess'> },\n input: {\n orgId: string;\n project: { repository: { id: string; slug: string } };\n branch: string;\n limit: number;\n },\n): Promise<RepositoryCommit[]> {\n const access = await github.versionControl.getRepositoryAccess({\n orgId: input.orgId,\n repositoryId: input.project.repository.id,\n });\n\n const query = new URLSearchParams({ sha: input.branch, per_page: String(input.limit) });\n const response = await fetch(`${GITHUB_API}/repos/${input.project.repository.slug}/commits?${query}`, {\n headers: {\n accept: 'application/vnd.github+json',\n ...(access.authorization ? { authorization: `Bearer ${access.authorization.token}` } : {}),\n },\n });\n\n if (!response.ok) {\n throw new Error(`GitHub rejected the commit listing for ${input.project.repository.slug} (${response.status}).`);\n }\n\n const commits = (await response.json()) as GithubCommitResponse[];\n return commits.map(entry => ({\n sha: entry.sha,\n message: entry.commit.message.split('\\n')[0] ?? '',\n author: entry.author?.login ?? entry.commit.author?.name ?? null,\n avatarUrl: entry.author?.avatar_url ?? null,\n committedAt: entry.commit.author?.date ?? null,\n url: entry.html_url,\n }));\n}\n"],"mappings":";AASA,MAAM,aAAa;AAkBnB,eAAsB,sBACpB,QACA,OAM6B;CAC7B,MAAM,SAAS,MAAM,OAAO,eAAe,oBAAoB;EAC7D,OAAO,MAAM;EACb,cAAc,MAAM,QAAQ,WAAW;CACzC,CAAC;CAED,MAAM,QAAQ,IAAI,gBAAgB;EAAE,KAAK,MAAM;EAAQ,UAAU,OAAO,MAAM,KAAK;CAAE,CAAC;CACtF,MAAM,WAAW,MAAM,MAAM,GAAG,WAAW,SAAS,MAAM,QAAQ,WAAW,KAAK,WAAW,SAAS,EACpG,SAAS;EACP,QAAQ;EACR,GAAI,OAAO,gBAAgB,EAAE,eAAe,UAAU,OAAO,cAAc,QAAQ,IAAI,CAAC;CAC1F,EACF,CAAC;CAED,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MAAM,0CAA0C,MAAM,QAAQ,WAAW,KAAK,IAAI,SAAS,OAAO,GAAG;CAIjH,QAAO,MADgB,SAAS,KAAK,EAAA,CACtB,KAAI,WAAU;EAC3B,KAAK,MAAM;EACX,SAAS,MAAM,OAAO,QAAQ,MAAM,IAAI,CAAC,CAAC,MAAM;EAChD,QAAQ,MAAM,QAAQ,SAAS,MAAM,OAAO,QAAQ,QAAQ;EAC5D,WAAW,MAAM,QAAQ,cAAc;EACvC,aAAa,MAAM,OAAO,QAAQ,QAAQ;EAC1C,KAAK,MAAM;CACb,EAAE;AACJ"}
|
|
1
|
+
{"version":3,"file":"commits.js","names":[],"sources":["../../../src/integrations/github/commits.ts"],"sourcesContent":["/**\n * Read with the installation token that already clones and pushes, not through\n * `getInstallationOctokit`: the Platform deployment answers that with a\n * pull-request-only stub, so `repos.*` is undefined there at runtime while the\n * cast keeps the compiler quiet.\n */\n\nimport type { VersionControl } from '../../capabilities/version-control.js';\n\nconst GITHUB_API = 'https://api.github.com';\n\nexport interface RepositoryCommit {\n sha: string;\n message: string;\n author: string | null;\n avatarUrl: string | null;\n committedAt: string | null;\n url: string;\n}\n\ninterface GithubCommitResponse {\n sha: string;\n html_url: string;\n commit: { message: string; author: { name?: string; date?: string } | null };\n author: { login: string; avatar_url: string } | null;\n}\n\nexport async function listRepositoryCommits(\n github: { versionControl: Pick<VersionControl, 'getRepositoryAccess'> },\n input: {\n orgId: string;\n project: { repository: { id: string; slug: string } };\n branch: string;\n limit: number;\n },\n): Promise<RepositoryCommit[]> {\n const access = await github.versionControl.getRepositoryAccess({\n orgId: input.orgId,\n repositoryId: input.project.repository.id,\n });\n\n const query = new URLSearchParams({ sha: input.branch, per_page: String(input.limit) });\n const response = await fetch(`${GITHUB_API}/repos/${input.project.repository.slug}/commits?${query}`, {\n headers: {\n accept: 'application/vnd.github+json',\n ...(access.authorization ? { authorization: `Bearer ${access.authorization.token}` } : {}),\n },\n });\n\n if (!response.ok) {\n throw new Error(`GitHub rejected the commit listing for ${input.project.repository.slug} (${response.status}).`);\n }\n\n const commits = (await response.json()) as GithubCommitResponse[];\n return commits.map(entry => ({\n sha: entry.sha,\n message: entry.commit.message.split('\\n')[0] ?? '',\n author: entry.author?.login ?? entry.commit.author?.name ?? null,\n avatarUrl: entry.author?.avatar_url ?? null,\n committedAt: entry.commit.author?.date ?? null,\n url: entry.html_url,\n }));\n}\n\nconst SHA_PATTERN = /^[0-9a-f]{40}$/;\n\n/** The commit a branch points at right now, as a full sha. Throws when GitHub rejects the lookup. */\nexport async function getBranchHead(\n github: { versionControl: Pick<VersionControl, 'getRepositoryAccess'> },\n input: { orgId: string; repository: { id: string; slug: string }; branch: string },\n): Promise<string> {\n const access = await github.versionControl.getRepositoryAccess({\n orgId: input.orgId,\n repositoryId: input.repository.id,\n });\n\n const response = await fetch(\n `${GITHUB_API}/repos/${input.repository.slug}/commits/${encodeURIComponent(input.branch)}`,\n {\n headers: {\n accept: 'application/vnd.github.sha',\n ...(access.authorization ? { authorization: `Bearer ${access.authorization.token}` } : {}),\n },\n signal: AbortSignal.timeout(10_000),\n },\n );\n\n if (!response.ok) {\n throw new Error(`GitHub rejected the head lookup for ${input.repository.slug}@${input.branch} (${response.status}).`);\n }\n\n const sha = (await response.text()).trim();\n if (!SHA_PATTERN.test(sha)) {\n throw new Error(`GitHub returned no commit sha for ${input.repository.slug}@${input.branch}.`);\n }\n return sha;\n}\n"],"mappings":";AASA,MAAM,aAAa;AAkBnB,eAAsB,sBACpB,QACA,OAM6B;CAC7B,MAAM,SAAS,MAAM,OAAO,eAAe,oBAAoB;EAC7D,OAAO,MAAM;EACb,cAAc,MAAM,QAAQ,WAAW;CACzC,CAAC;CAED,MAAM,QAAQ,IAAI,gBAAgB;EAAE,KAAK,MAAM;EAAQ,UAAU,OAAO,MAAM,KAAK;CAAE,CAAC;CACtF,MAAM,WAAW,MAAM,MAAM,GAAG,WAAW,SAAS,MAAM,QAAQ,WAAW,KAAK,WAAW,SAAS,EACpG,SAAS;EACP,QAAQ;EACR,GAAI,OAAO,gBAAgB,EAAE,eAAe,UAAU,OAAO,cAAc,QAAQ,IAAI,CAAC;CAC1F,EACF,CAAC;CAED,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MAAM,0CAA0C,MAAM,QAAQ,WAAW,KAAK,IAAI,SAAS,OAAO,GAAG;CAIjH,QAAO,MADgB,SAAS,KAAK,EAAA,CACtB,KAAI,WAAU;EAC3B,KAAK,MAAM;EACX,SAAS,MAAM,OAAO,QAAQ,MAAM,IAAI,CAAC,CAAC,MAAM;EAChD,QAAQ,MAAM,QAAQ,SAAS,MAAM,OAAO,QAAQ,QAAQ;EAC5D,WAAW,MAAM,QAAQ,cAAc;EACvC,aAAa,MAAM,OAAO,QAAQ,QAAQ;EAC1C,KAAK,MAAM;CACb,EAAE;AACJ;AAEA,MAAM,cAAc;;AAGpB,eAAsB,cACpB,QACA,OACiB;CACjB,MAAM,SAAS,MAAM,OAAO,eAAe,oBAAoB;EAC7D,OAAO,MAAM;EACb,cAAc,MAAM,WAAW;CACjC,CAAC;CAED,MAAM,WAAW,MAAM,MACrB,GAAG,WAAW,SAAS,MAAM,WAAW,KAAK,WAAW,mBAAmB,MAAM,MAAM,KACvF;EACE,SAAS;GACP,QAAQ;GACR,GAAI,OAAO,gBAAgB,EAAE,eAAe,UAAU,OAAO,cAAc,QAAQ,IAAI,CAAC;EAC1F;EACA,QAAQ,YAAY,QAAQ,GAAM;CACpC,CACF;CAEA,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MAAM,uCAAuC,MAAM,WAAW,KAAK,GAAG,MAAM,OAAO,IAAI,SAAS,OAAO,GAAG;CAGtH,MAAM,OAAO,MAAM,SAAS,KAAK,EAAA,CAAG,KAAK;CACzC,IAAI,CAAC,YAAY,KAAK,GAAG,GACvB,MAAM,IAAI,MAAM,qCAAqC,MAAM,WAAW,KAAK,GAAG,MAAM,OAAO,EAAE;CAE/F,OAAO;AACT"}
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* integration, auth seam, state signer, sandbox surface) — there is no global
|
|
15
15
|
* registry lookup.
|
|
16
16
|
*/
|
|
17
|
+
import type { FactorySandbox } from '@mastra/core/workspace';
|
|
17
18
|
import type { RouteAuth } from '../../routes/route.js';
|
|
18
|
-
import type { MastraFactorySandboxConfig } from '../../sandbox/session-sandbox.js';
|
|
19
19
|
import type { StateSigner } from '../../state-signing.js';
|
|
20
20
|
import type { GithubIntegration } from './integration.js';
|
|
21
21
|
/** Handles the GitHub feature gate + diagnostics are computed from. */
|
|
@@ -28,8 +28,8 @@ export interface GithubFeatureGateOptions {
|
|
|
28
28
|
appDbConfigured: boolean;
|
|
29
29
|
/** Shared OAuth/install `state` signer, when configured. */
|
|
30
30
|
stateSigner?: StateSigner;
|
|
31
|
-
/** The deploy's sandbox
|
|
32
|
-
sandbox?:
|
|
31
|
+
/** The deploy's sandbox, when sandboxes are configured. */
|
|
32
|
+
sandbox?: FactorySandbox;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* True when the GitHub App project feature should be active.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAiB1D,uEAAuE;AACvE,MAAM,WAAW,wBAAwB;IACvC,0DAA0D;IAC1D,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACtC,6DAA6D;IAC7D,IAAI,EAAE,SAAS,CAAC;IAChB,wDAAwD;IACxD,eAAe,EAAE,OAAO,CAAC;IACzB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,2DAA2D;IAC3D,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,MAAM,CAAC,GAAG,OAAO,CAE1G;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,uBAAuB,EAAE,MAAM,EAAE,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,wBAAwB,GAAG,wBAAwB,CAWvG"}
|
|
@@ -32,7 +32,7 @@ function getGithubFeatureDiagnostics(options) {
|
|
|
32
32
|
appDbConfigured,
|
|
33
33
|
stateSecretConfigured: stateSigner?.stable ?? false,
|
|
34
34
|
sandboxEnabled: !!sandbox,
|
|
35
|
-
sandboxProvider: sandbox
|
|
35
|
+
sandboxProvider: sandbox?.provider ?? "none",
|
|
36
36
|
missingGithubAppEnvVars: github ? [] : [...GITHUB_APP_ENV_VARS]
|
|
37
37
|
};
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":[],"sources":["../../../src/integrations/github/config.ts"],"sourcesContent":["/**\n * Composite feature gate + diagnostics for the GitHub App project feature.\n *\n * The GitHub feature is enabled only when *all three* hold:\n * - a `GithubIntegration` instance is registered with the factory\n * (constructed by the deploy entry from the `GITHUB_APP_*` env vars),\n * - web auth is enabled (a per-user installation requires a logged-in user),\n * - the application database is configured.\n *\n * OAuth/install `state` signing lives in `../../state-signing.ts` — the factory\n * creates one shared signer at boot and hands it to every integration.\n *\n * Everything here is pure: callers pass the handles they already own (the\n * integration, auth seam, state signer, sandbox surface) — there is no global\n * registry lookup.\n */\n\nimport type {
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../../../src/integrations/github/config.ts"],"sourcesContent":["/**\n * Composite feature gate + diagnostics for the GitHub App project feature.\n *\n * The GitHub feature is enabled only when *all three* hold:\n * - a `GithubIntegration` instance is registered with the factory\n * (constructed by the deploy entry from the `GITHUB_APP_*` env vars),\n * - web auth is enabled (a per-user installation requires a logged-in user),\n * - the application database is configured.\n *\n * OAuth/install `state` signing lives in `../../state-signing.ts` — the factory\n * creates one shared signer at boot and hands it to every integration.\n *\n * Everything here is pure: callers pass the handles they already own (the\n * integration, auth seam, state signer, sandbox surface) — there is no global\n * registry lookup.\n */\n\nimport type { FactorySandbox } from '@mastra/core/workspace';\nimport type { RouteAuth } from '../../routes/route.js';\nimport type { StateSigner } from '../../state-signing.js';\nimport type { GithubIntegration } from './integration.js';\n\n/**\n * Env vars the deploy entry reads to construct a `GithubIntegration`. Names\n * only — used by diagnostics to tell an operator what to set when the\n * integration is absent. The entry enforces all-or-nothing: partial config\n * fails the boot, so at runtime the integration is either fully configured or\n * not configured at all.\n */\nconst GITHUB_APP_ENV_VARS = [\n 'GITHUB_APP_ID',\n 'GITHUB_APP_PRIVATE_KEY',\n 'GITHUB_APP_CLIENT_ID',\n 'GITHUB_APP_CLIENT_SECRET',\n 'GITHUB_APP_SLUG',\n] as const;\n\n/** Handles the GitHub feature gate + diagnostics are computed from. */\nexport interface GithubFeatureGateOptions {\n /** The registered GitHub integration, when configured. */\n github: GithubIntegration | undefined;\n /** Web auth seam — the feature requires a logged-in user. */\n auth: RouteAuth;\n /** True when the application database is configured. */\n appDbConfigured: boolean;\n /** Shared OAuth/install `state` signer, when configured. */\n stateSigner?: StateSigner;\n /** The deploy's sandbox, when sandboxes are configured. */\n sandbox?: FactorySandbox;\n}\n\n/**\n * True when the GitHub App project feature should be active.\n */\nexport function isGithubFeatureEnabled(options: Pick<GithubFeatureGateOptions, 'github' | 'auth'>): boolean {\n return options.github !== undefined && options.auth.enabled();\n}\n\n/**\n * Non-secret diagnostic snapshot of every GitHub feature gate. Used by startup\n * logs, `/web/github/status`, and the SPA so all three explain the same state.\n *\n * Only env var *names* and booleans are exposed — never secret values.\n */\nexport interface GithubFeatureDiagnostics {\n githubAppConfigured: boolean;\n factoryAuthEnabled: boolean;\n appDbConfigured: boolean;\n stateSecretConfigured: boolean;\n sandboxEnabled: boolean;\n sandboxProvider: string;\n /** Names of the GitHub App env vars still needed (empty when configured). */\n missingGithubAppEnvVars: string[];\n}\n\n/**\n * Collect a non-secret diagnostic snapshot of every GitHub feature gate. Centralizes\n * the feature-gate reasoning so startup logs, the status API, and the SPA explain\n * the same state. Does not change `isGithubFeatureEnabled()` behavior.\n */\nexport function getGithubFeatureDiagnostics(options: GithubFeatureGateOptions): GithubFeatureDiagnostics {\n const { github, auth, appDbConfigured, stateSigner, sandbox } = options;\n return {\n githubAppConfigured: github !== undefined,\n factoryAuthEnabled: auth.enabled(),\n appDbConfigured,\n stateSecretConfigured: stateSigner?.stable ?? false,\n sandboxEnabled: !!sandbox,\n sandboxProvider: sandbox?.provider ?? 'none',\n missingGithubAppEnvVars: github ? [] : [...GITHUB_APP_ENV_VARS],\n };\n}\n"],"mappings":";;;;;;;;AA6BA,MAAM,sBAAsB;CAC1B;CACA;CACA;CACA;CACA;AACF;;;;AAmBA,SAAgB,uBAAuB,SAAqE;CAC1G,OAAO,QAAQ,WAAW,KAAA,KAAa,QAAQ,KAAK,QAAQ;AAC9D;;;;;;AAwBA,SAAgB,4BAA4B,SAA6D;CACvG,MAAM,EAAE,QAAQ,MAAM,iBAAiB,aAAa,YAAY;CAChE,OAAO;EACL,qBAAqB,WAAW,KAAA;EAChC,oBAAoB,KAAK,QAAQ;EACjC;EACA,uBAAuB,aAAa,UAAU;EAC9C,gBAAgB,CAAC,CAAC;EAClB,iBAAiB,SAAS,YAAY;EACtC,yBAAyB,SAAS,CAAC,IAAI,CAAC,GAAG,mBAAmB;CAChE;AACF"}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
import type { MountedMastraCode } from '@mastra/code-sdk';
|
|
14
14
|
import type { ApiRoute, IUserProvider } from '@mastra/core/server';
|
|
15
15
|
import type { FactoryStorage } from '@mastra/core/storage';
|
|
16
|
+
import type { FactorySandbox } from '@mastra/core/workspace';
|
|
16
17
|
import type { RouteAuth } from '../../routes/route.js';
|
|
17
|
-
import type { MastraFactorySandboxConfig } from '../../sandbox/session-sandbox.js';
|
|
18
18
|
import type { StateSigner } from '../../state-signing.js';
|
|
19
19
|
import type { AuditEmitter } from '../../storage/domains/audit/domain.js';
|
|
20
20
|
import type { MemorySettingsStorage } from '../../storage/domains/memory-settings/base.js';
|
|
@@ -32,7 +32,7 @@ export interface MountGithubRoutesOptions {
|
|
|
32
32
|
* `sandboxEnabled: false` and sandbox-backed routes respond 503. Sandboxes
|
|
33
33
|
* themselves are constructed per session and started lazily elsewhere.
|
|
34
34
|
*/
|
|
35
|
-
sandbox?:
|
|
35
|
+
sandbox?: FactorySandbox;
|
|
36
36
|
/** Factory storage backend used for the `appDbConfigured` diagnostic. */
|
|
37
37
|
storage?: FactoryStorage;
|
|
38
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAA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AAC;IAChH,+FAA+F;IAC/F,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACvE;AAyQD;;;;;GAKG;AACH,wBAAsB,6BAA6B,CAAC,IAAI,EAAE;IACxD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,wBAAwB,CAAC,oBAAoB,CAAC,CAAC;CACpE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgChB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,QAAQ,EAAE,CAsoB/E;AA+GD,KAAK,wBAAwB,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { AUTO_TRIAGED_LABEL, NEEDS_APPROVAL_LABEL } from "../../rules/types.js";
|
|
2
|
-
import {
|
|
3
|
-
import { polledPullRequestEvent } from "./rules.js";
|
|
2
|
+
import { listRepositoryCommits } from "./commits.js";
|
|
4
3
|
import { clearGithubPat, getGithubPatStatus, setGithubPat } from "./pat.js";
|
|
4
|
+
import { isValidGitRef } from "../../sandbox/git-ref.js";
|
|
5
|
+
import { MaterializeError, SetupCommandError, commitAll, pushBranch } from "./sandbox.js";
|
|
5
6
|
import { requireExec } from "../../sandbox/materialization.js";
|
|
6
7
|
import { sanitizeSegment } from "../../sandbox/workdir.js";
|
|
7
8
|
import { peekSessionSandbox } from "../../sandbox/session-sandbox.js";
|
|
9
|
+
import { listPullRequestSubscriptionsForThread, subscribeToPullRequest } from "./subscriptions.js";
|
|
10
|
+
import { polledPullRequestEvent } from "./rules.js";
|
|
8
11
|
import { waitForPendingFilesystemCapture } from "../../session/filesystem-capture.js";
|
|
9
12
|
import { normalizeSessionTitle } from "../../session/session-title.js";
|
|
10
|
-
import { listRepositoryCommits } from "./commits.js";
|
|
11
13
|
import { getGithubFeatureDiagnostics, isGithubFeatureEnabled } from "./config.js";
|
|
12
14
|
import { reclaimDeletedSessionSandbox } from "./sandbox-release.js";
|
|
13
|
-
import { isValidGitRef } from "../../sandbox/git-ref.js";
|
|
14
|
-
import { MaterializeError, SetupCommandError, commitAll, pushBranch } from "./sandbox.js";
|
|
15
15
|
import { handleGithubWebhook } from "./webhook.js";
|
|
16
16
|
import { RequestContext } from "@mastra/core/request-context";
|
|
17
17
|
import { registerApiRoute } from "@mastra/core/server";
|
|
@@ -993,6 +993,7 @@ function buildProjectGitRoutes({ github, auth, sandbox, users, controller, memor
|
|
|
993
993
|
const session = await github.sourceControlStorage.sessions.create({
|
|
994
994
|
sessionId,
|
|
995
995
|
projectRepositoryId: project.id,
|
|
996
|
+
factoryProjectId: project.factoryProjectId,
|
|
996
997
|
orgId,
|
|
997
998
|
userId,
|
|
998
999
|
branch,
|