@mastra/factory 0.0.0 → 0.1.0-alpha.2
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 +10 -0
- package/LICENSE.md +30 -0
- package/dist/auth.d.ts +181 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +370 -0
- package/dist/auth.js.map +1 -0
- package/dist/capabilities/connection.d.ts +9 -0
- package/dist/capabilities/connection.d.ts.map +1 -0
- package/dist/capabilities/connection.js +1 -0
- package/dist/capabilities/connection.js.map +1 -0
- package/dist/capabilities/intake.d.ts +93 -0
- package/dist/capabilities/intake.d.ts.map +1 -0
- package/dist/capabilities/intake.js +1 -0
- package/dist/capabilities/intake.js.map +1 -0
- package/dist/capabilities/version-control.d.ts +239 -0
- package/dist/capabilities/version-control.d.ts.map +1 -0
- package/dist/capabilities/version-control.js +1 -0
- package/dist/capabilities/version-control.js.map +1 -0
- package/dist/factory.d.ts +145 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +38208 -0
- package/dist/factory.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38208 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/base.d.ts +197 -0
- package/dist/integrations/base.d.ts.map +1 -0
- package/dist/integrations/base.js +1 -0
- package/dist/integrations/base.js.map +1 -0
- package/dist/integrations/github/config.d.ts +60 -0
- package/dist/integrations/github/config.d.ts.map +1 -0
- package/dist/integrations/github/config.js +28 -0
- package/dist/integrations/github/config.js.map +1 -0
- package/dist/integrations/github/factory-session.d.ts +12 -0
- package/dist/integrations/github/factory-session.d.ts.map +1 -0
- package/dist/integrations/github/factory-session.js +41 -0
- package/dist/integrations/github/factory-session.js.map +1 -0
- package/dist/integrations/github/integration.d.ts +191 -0
- package/dist/integrations/github/integration.d.ts.map +1 -0
- package/dist/integrations/github/integration.js +2999 -0
- package/dist/integrations/github/integration.js.map +1 -0
- package/dist/integrations/github/issue-triage.d.ts +27 -0
- package/dist/integrations/github/issue-triage.d.ts.map +1 -0
- package/dist/integrations/github/issue-triage.js +82 -0
- package/dist/integrations/github/issue-triage.js.map +1 -0
- package/dist/integrations/github/project-lock.d.ts +78 -0
- package/dist/integrations/github/project-lock.d.ts.map +1 -0
- package/dist/integrations/github/project-lock.js +70 -0
- package/dist/integrations/github/project-lock.js.map +1 -0
- package/dist/integrations/github/provenance.d.ts +27 -0
- package/dist/integrations/github/provenance.d.ts.map +1 -0
- package/dist/integrations/github/provenance.js +104 -0
- package/dist/integrations/github/provenance.js.map +1 -0
- package/dist/integrations/github/routes.d.ts +72 -0
- package/dist/integrations/github/routes.d.ts.map +1 -0
- package/dist/integrations/github/routes.js +1832 -0
- package/dist/integrations/github/routes.js.map +1 -0
- package/dist/integrations/github/sandbox.d.ts +268 -0
- package/dist/integrations/github/sandbox.d.ts.map +1 -0
- package/dist/integrations/github/sandbox.js +381 -0
- package/dist/integrations/github/sandbox.js.map +1 -0
- package/dist/integrations/github/session-subscriptions.d.ts +23 -0
- package/dist/integrations/github/session-subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/session-subscriptions.js +190 -0
- package/dist/integrations/github/session-subscriptions.js.map +1 -0
- package/dist/integrations/github/subscriptions.d.ts +54 -0
- package/dist/integrations/github/subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/subscriptions.js +70 -0
- package/dist/integrations/github/subscriptions.js.map +1 -0
- package/dist/integrations/github/webhook.d.ts +87 -0
- package/dist/integrations/github/webhook.d.ts.map +1 -0
- package/dist/integrations/github/webhook.js +381 -0
- package/dist/integrations/github/webhook.js.map +1 -0
- package/dist/integrations/linear/agent-tools.d.ts +34 -0
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -0
- package/dist/integrations/linear/agent-tools.js +108 -0
- package/dist/integrations/linear/agent-tools.js.map +1 -0
- package/dist/integrations/linear/integration.d.ts +233 -0
- package/dist/integrations/linear/integration.d.ts.map +1 -0
- package/dist/integrations/linear/integration.js +962 -0
- package/dist/integrations/linear/integration.js.map +1 -0
- package/dist/integrations/linear/routes.d.ts +61 -0
- package/dist/integrations/linear/routes.d.ts.map +1 -0
- package/dist/integrations/linear/routes.js +242 -0
- package/dist/integrations/linear/routes.js.map +1 -0
- package/dist/integrations/linear/storage.d.ts +65 -0
- package/dist/integrations/linear/storage.d.ts.map +1 -0
- package/dist/integrations/linear/storage.js +1 -0
- package/dist/integrations/linear/storage.js.map +1 -0
- package/dist/integrations/platform/api-client.d.ts +24 -0
- package/dist/integrations/platform/api-client.d.ts.map +1 -0
- package/dist/integrations/platform/api-client.js +153 -0
- package/dist/integrations/platform/api-client.js.map +1 -0
- package/dist/integrations/platform/github/event-worker.d.ts +42 -0
- package/dist/integrations/platform/github/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/github/event-worker.js +577 -0
- package/dist/integrations/platform/github/event-worker.js.map +1 -0
- package/dist/integrations/platform/github/integration.d.ts +36 -0
- package/dist/integrations/platform/github/integration.d.ts.map +1 -0
- package/dist/integrations/platform/github/integration.js +3242 -0
- package/dist/integrations/platform/github/integration.js.map +1 -0
- package/dist/integrations/platform/linear/integration.d.ts +46 -0
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -0
- package/dist/integrations/platform/linear/integration.js +891 -0
- package/dist/integrations/platform/linear/integration.js.map +1 -0
- package/dist/integrations/workos/integration.d.ts +39 -0
- package/dist/integrations/workos/integration.d.ts.map +1 -0
- package/dist/integrations/workos/integration.js +96 -0
- package/dist/integrations/workos/integration.js.map +1 -0
- package/dist/routes/config.d.ts +220 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +770 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/fs.d.ts +105 -0
- package/dist/routes/fs.d.ts.map +1 -0
- package/dist/routes/fs.js +294 -0
- package/dist/routes/fs.js.map +1 -0
- package/dist/routes/intake.d.ts +23 -0
- package/dist/routes/intake.d.ts.map +1 -0
- package/dist/routes/intake.js +179 -0
- package/dist/routes/intake.js.map +1 -0
- package/dist/routes/oauth.d.ts +43 -0
- package/dist/routes/oauth.d.ts.map +1 -0
- package/dist/routes/oauth.js +25058 -0
- package/dist/routes/oauth.js.map +1 -0
- package/dist/routes/projects.d.ts +19 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +395 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/provider-credentials.d.ts +81 -0
- package/dist/routes/provider-credentials.d.ts.map +1 -0
- package/dist/routes/provider-credentials.js +68 -0
- package/dist/routes/provider-credentials.js.map +1 -0
- package/dist/routes/route.d.ts +48 -0
- package/dist/routes/route.d.ts.map +1 -0
- package/dist/routes/route.js +11 -0
- package/dist/routes/route.js.map +1 -0
- package/dist/routes/skills.d.ts +30 -0
- package/dist/routes/skills.d.ts.map +1 -0
- package/dist/routes/skills.js +181 -0
- package/dist/routes/skills.js.map +1 -0
- package/dist/routes/surface.d.ts +83 -0
- package/dist/routes/surface.d.ts.map +1 -0
- package/dist/routes/surface.js +28504 -0
- package/dist/routes/surface.js.map +1 -0
- package/dist/routes/tenant-credentials.d.ts +74 -0
- package/dist/routes/tenant-credentials.d.ts.map +1 -0
- package/dist/routes/tenant-credentials.js +181 -0
- package/dist/routes/tenant-credentials.js.map +1 -0
- package/dist/routes/work-items.d.ts +40 -0
- package/dist/routes/work-items.d.ts.map +1 -0
- package/dist/routes/work-items.js +902 -0
- package/dist/routes/work-items.js.map +1 -0
- package/dist/rules/binding-context.d.ts +5 -0
- package/dist/rules/binding-context.d.ts.map +1 -0
- package/dist/rules/binding-context.js +40 -0
- package/dist/rules/binding-context.js.map +1 -0
- package/dist/rules/defaults.d.ts +9 -0
- package/dist/rules/defaults.d.ts.map +1 -0
- package/dist/rules/defaults.js +328 -0
- package/dist/rules/defaults.js.map +1 -0
- package/dist/rules/dispatcher.d.ts +40 -0
- package/dist/rules/dispatcher.d.ts.map +1 -0
- package/dist/rules/dispatcher.js +695 -0
- package/dist/rules/dispatcher.js.map +1 -0
- package/dist/rules/github-service.d.ts +27 -0
- package/dist/rules/github-service.d.ts.map +1 -0
- package/dist/rules/github-service.js +460 -0
- package/dist/rules/github-service.js.map +1 -0
- package/dist/rules/index.d.ts +7 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +577 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/linear-service.d.ts +27 -0
- package/dist/rules/linear-service.d.ts.map +1 -0
- package/dist/rules/linear-service.js +343 -0
- package/dist/rules/linear-service.js.map +1 -0
- package/dist/rules/processor.d.ts +54 -0
- package/dist/rules/processor.d.ts.map +1 -0
- package/dist/rules/processor.js +629 -0
- package/dist/rules/processor.js.map +1 -0
- package/dist/rules/resolve.d.ts +17 -0
- package/dist/rules/resolve.d.ts.map +1 -0
- package/dist/rules/resolve.js +27 -0
- package/dist/rules/resolve.js.map +1 -0
- package/dist/rules/start-coordinator.d.ts +58 -0
- package/dist/rules/start-coordinator.d.ts.map +1 -0
- package/dist/rules/start-coordinator.js +136 -0
- package/dist/rules/start-coordinator.js.map +1 -0
- package/dist/rules/tools.d.ts +10 -0
- package/dist/rules/tools.d.ts.map +1 -0
- package/dist/rules/tools.js +93 -0
- package/dist/rules/tools.js.map +1 -0
- package/dist/rules/transition-service.d.ts +32 -0
- package/dist/rules/transition-service.d.ts.map +1 -0
- package/dist/rules/transition-service.js +474 -0
- package/dist/rules/transition-service.js.map +1 -0
- package/dist/rules/types.d.ts +220 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +33 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/rules/validation.d.ts +11 -0
- package/dist/rules/validation.d.ts.map +1 -0
- package/dist/rules/validation.js +310 -0
- package/dist/rules/validation.js.map +1 -0
- package/dist/sandbox/fleet.d.ts +208 -0
- package/dist/sandbox/fleet.d.ts.map +1 -0
- package/dist/sandbox/fleet.js +259 -0
- package/dist/sandbox/fleet.js.map +1 -0
- package/dist/sandbox/reattach.d.ts +3 -0
- package/dist/sandbox/reattach.d.ts.map +1 -0
- package/dist/sandbox/reattach.js +9 -0
- package/dist/sandbox/reattach.js.map +1 -0
- package/dist/server-error.d.ts +12 -0
- package/dist/server-error.d.ts.map +1 -0
- package/dist/server-error.js +20 -0
- package/dist/server-error.js.map +1 -0
- package/dist/skills/service.d.ts +48 -0
- package/dist/skills/service.d.ts.map +1 -0
- package/dist/skills/service.js +45 -0
- package/dist/skills/service.js.map +1 -0
- package/dist/spa-static.d.ts +34 -0
- package/dist/spa-static.d.ts.map +1 -0
- package/dist/spa-static.js +73 -0
- package/dist/spa-static.js.map +1 -0
- package/dist/state-signing.d.ts +48 -0
- package/dist/state-signing.d.ts.map +1 -0
- package/dist/state-signing.js +48 -0
- package/dist/state-signing.js.map +1 -0
- package/dist/storage/domains/audit/agent-audit.d.ts +27 -0
- package/dist/storage/domains/audit/agent-audit.d.ts.map +1 -0
- package/dist/storage/domains/audit/agent-audit.js +65 -0
- package/dist/storage/domains/audit/agent-audit.js.map +1 -0
- package/dist/storage/domains/audit/base.d.ts +140 -0
- package/dist/storage/domains/audit/base.d.ts.map +1 -0
- package/dist/storage/domains/audit/base.js +127 -0
- package/dist/storage/domains/audit/base.js.map +1 -0
- package/dist/storage/domains/audit/domain.d.ts +69 -0
- package/dist/storage/domains/audit/domain.d.ts.map +1 -0
- package/dist/storage/domains/audit/domain.js +165 -0
- package/dist/storage/domains/audit/domain.js.map +1 -0
- package/dist/storage/domains/credentials/base.d.ts +134 -0
- package/dist/storage/domains/credentials/base.d.ts.map +1 -0
- package/dist/storage/domains/credentials/base.js +257 -0
- package/dist/storage/domains/credentials/base.js.map +1 -0
- package/dist/storage/domains/intake/base.d.ts +38 -0
- package/dist/storage/domains/intake/base.d.ts.map +1 -0
- package/dist/storage/domains/intake/base.js +62 -0
- package/dist/storage/domains/intake/base.js.map +1 -0
- package/dist/storage/domains/integrations/base.d.ts +126 -0
- package/dist/storage/domains/integrations/base.d.ts.map +1 -0
- package/dist/storage/domains/integrations/base.js +252 -0
- package/dist/storage/domains/integrations/base.js.map +1 -0
- package/dist/storage/domains/model-packs/base.d.ts +49 -0
- package/dist/storage/domains/model-packs/base.d.ts.map +1 -0
- package/dist/storage/domains/model-packs/base.js +95 -0
- package/dist/storage/domains/model-packs/base.js.map +1 -0
- package/dist/storage/domains/projects/base.d.ts +55 -0
- package/dist/storage/domains/projects/base.d.ts.map +1 -0
- package/dist/storage/domains/projects/base.js +99 -0
- package/dist/storage/domains/projects/base.js.map +1 -0
- package/dist/storage/domains/queue-health/base.d.ts +52 -0
- package/dist/storage/domains/queue-health/base.d.ts.map +1 -0
- package/dist/storage/domains/queue-health/base.js +87 -0
- package/dist/storage/domains/queue-health/base.js.map +1 -0
- package/dist/storage/domains/source-control/base.d.ts +288 -0
- package/dist/storage/domains/source-control/base.d.ts.map +1 -0
- package/dist/storage/domains/source-control/base.js +722 -0
- package/dist/storage/domains/source-control/base.js.map +1 -0
- package/dist/storage/domains/source-control/inmemory.d.ts +158 -0
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/source-control/inmemory.js +348 -0
- package/dist/storage/domains/source-control/inmemory.js.map +1 -0
- package/dist/storage/domains/work-items/base.d.ts +412 -0
- package/dist/storage/domains/work-items/base.d.ts.map +1 -0
- package/dist/storage/domains/work-items/base.js +1174 -0
- package/dist/storage/domains/work-items/base.js.map +1 -0
- package/dist/storage/domains/work-items/metrics.d.ts +101 -0
- package/dist/storage/domains/work-items/metrics.d.ts.map +1 -0
- package/dist/storage/domains/work-items/metrics.js +203 -0
- package/dist/storage/domains/work-items/metrics.js.map +1 -0
- package/dist/workspace.d.ts +20 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +364 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +19 -19
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `FactoryIntegration` — the common contract for pluggable web integrations
|
|
3
|
+
* (GitHub, Linear, third-party).
|
|
4
|
+
*
|
|
5
|
+
* Each integration is a self-contained class: the deploy entry
|
|
6
|
+
* (`src/mastra/index.ts`) reads that integration's env vars ONCE, constructs
|
|
7
|
+
* an instance with explicit credentials, and passes it to `MastraFactory`
|
|
8
|
+
* via `integrations: [...]`. The factory registers the pieces each instance
|
|
9
|
+
* provides — HTTP routes, agent/session tools, diagnostics — into the system.
|
|
10
|
+
* No system code reads integration env vars or imports integration free
|
|
11
|
+
* functions; everything downstream talks to instances through this interface.
|
|
12
|
+
*
|
|
13
|
+
* An absent integration means: its routes never mount, its tools never
|
|
14
|
+
* register, diagnostics report "not configured", and the server boots fine.
|
|
15
|
+
* Third parties add capabilities by implementing this same interface — no
|
|
16
|
+
* factory changes required (the same capability-based philosophy as the
|
|
17
|
+
* sandbox machine's `derive()` gate).
|
|
18
|
+
*/
|
|
19
|
+
import type { MastraCodeConfig, MountedMastraCode } from '@mastra/code-sdk';
|
|
20
|
+
import type { RequestContext } from '@mastra/core/request-context';
|
|
21
|
+
import type { ApiRoute } from '@mastra/core/server';
|
|
22
|
+
import type { FactoryStorage } from '@mastra/core/storage';
|
|
23
|
+
import type { MastraWorker } from '@mastra/core/worker';
|
|
24
|
+
import type { Intake } from '../capabilities/intake.js';
|
|
25
|
+
import type { VersionControl } from '../capabilities/version-control.js';
|
|
26
|
+
import type { RouteAuth } from '../routes/route.js';
|
|
27
|
+
import type { SandboxFleet } from '../sandbox/fleet.js';
|
|
28
|
+
import type { StateSigner } from '../state-signing.js';
|
|
29
|
+
import type { AuditEventRow } from '../storage/domains/audit/base.js';
|
|
30
|
+
import type { AuditEmitter } from '../storage/domains/audit/domain.js';
|
|
31
|
+
import type { IntakeStorage } from '../storage/domains/intake/base.js';
|
|
32
|
+
import type { IntegrationStorageHandle } from '../storage/domains/integrations/base.js';
|
|
33
|
+
import type { FactoryProjectsStorage } from '../storage/domains/projects/base.js';
|
|
34
|
+
import type { SourceControlStorageHandle } from '../storage/domains/source-control/base.js';
|
|
35
|
+
import type { ParsedGithubWebhook } from './github/webhook.js';
|
|
36
|
+
export interface LinearIssueIngress {
|
|
37
|
+
id: string;
|
|
38
|
+
identifier: string;
|
|
39
|
+
title: string;
|
|
40
|
+
url: string;
|
|
41
|
+
state: string;
|
|
42
|
+
stateType: string;
|
|
43
|
+
priorityLabel: string;
|
|
44
|
+
assignee: string | null;
|
|
45
|
+
team: string | null;
|
|
46
|
+
labels: string[];
|
|
47
|
+
createdAt: string;
|
|
48
|
+
updatedAt: string;
|
|
49
|
+
}
|
|
50
|
+
/** Factory-owned hooks integrations may invoke. */
|
|
51
|
+
export interface IntegrationHooks {
|
|
52
|
+
emitAudit?: AuditEmitter['emit'];
|
|
53
|
+
ingestGithubEvent?: (event: ParsedGithubWebhook) => Promise<unknown>;
|
|
54
|
+
ingestLinearIssues?: (input: {
|
|
55
|
+
orgId: string;
|
|
56
|
+
userId: string;
|
|
57
|
+
factoryProjectId: string;
|
|
58
|
+
issues: LinearIssueIngress[];
|
|
59
|
+
}) => Promise<unknown>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Tool records integrations contribute — the same static-record shape the
|
|
63
|
+
* SDK's `extraTools` accepts, so the factory can merge every integration's
|
|
64
|
+
* tools into one dynamic tool set.
|
|
65
|
+
*/
|
|
66
|
+
export type IntegrationTools = Extract<NonNullable<MastraCodeConfig['extraTools']>, Record<string, unknown>>;
|
|
67
|
+
export interface IntegrationPostToolContext {
|
|
68
|
+
toolName: string;
|
|
69
|
+
input: unknown;
|
|
70
|
+
output?: unknown;
|
|
71
|
+
error?: unknown;
|
|
72
|
+
context: unknown;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Everything the factory hands an integration when collecting its routes.
|
|
76
|
+
* Built once per boot in `MastraFactory.prepare()`.
|
|
77
|
+
*/
|
|
78
|
+
export interface IntegrationContext {
|
|
79
|
+
/** Host auth seam — integration routes resolve callers through this. */
|
|
80
|
+
auth: RouteAuth;
|
|
81
|
+
/**
|
|
82
|
+
* Sandbox fleet for per-project sandboxes. Always constructed at boot; a
|
|
83
|
+
* fleet built without a machine config reports `enabled: false` and
|
|
84
|
+
* sandbox-backed routes respond 503.
|
|
85
|
+
*/
|
|
86
|
+
fleet: SandboxFleet;
|
|
87
|
+
/**
|
|
88
|
+
* Root factory storage backend. Supplies the cross-replica
|
|
89
|
+
* `withDistributedLock` capability and the `appDbConfigured` diagnostic.
|
|
90
|
+
* Absent when the host runs without an application database.
|
|
91
|
+
*/
|
|
92
|
+
factoryStorage?: FactoryStorage;
|
|
93
|
+
/** Browser-facing origin (OAuth redirect base), no trailing slash. */
|
|
94
|
+
baseUrl?: string;
|
|
95
|
+
/** Mounted agent controller for webhook → session signal delivery. */
|
|
96
|
+
controller?: MountedMastraCode['controller'];
|
|
97
|
+
/**
|
|
98
|
+
* Shared OAuth state signer created by the factory. One signer per boot, so
|
|
99
|
+
* every integration's OAuth flow signs and verifies with the same secret.
|
|
100
|
+
*/
|
|
101
|
+
stateSigner?: StateSigner;
|
|
102
|
+
/** Persistence handles pre-scoped to this integration's stable id. */
|
|
103
|
+
storage: {
|
|
104
|
+
generic: IntegrationStorageHandle;
|
|
105
|
+
sourceControl: SourceControlStorageHandle;
|
|
106
|
+
/** Factory projects domain — e.g. resolving a project's default model. */
|
|
107
|
+
projects: FactoryProjectsStorage;
|
|
108
|
+
/** Cross-integration intake selection (which sources are synced). */
|
|
109
|
+
intake: IntakeStorage;
|
|
110
|
+
};
|
|
111
|
+
/** System hooks integrations may invoke. */
|
|
112
|
+
hooks?: IntegrationHooks;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A pluggable web integration. Implementations own their credentials
|
|
116
|
+
* (validated at construction), their API surface, and their HTTP routes.
|
|
117
|
+
*/
|
|
118
|
+
export interface FactoryIntegration {
|
|
119
|
+
/** Stable identifier: `'github'`, `'linear'`, custom ids for third parties. */
|
|
120
|
+
readonly id: string;
|
|
121
|
+
/** Issue-oriented capability consumed by Intake. */
|
|
122
|
+
readonly intake?: Intake;
|
|
123
|
+
/** Repository, installation, and pull-request capability. */
|
|
124
|
+
readonly versionControl?: VersionControl;
|
|
125
|
+
/**
|
|
126
|
+
* Bind the integration's generic persistence handle. Called once by the
|
|
127
|
+
* factory during `prepare()` (before routes/tools/workers are collected),
|
|
128
|
+
* so instance methods that run outside an `IntegrationContext` — per-request
|
|
129
|
+
* agent tools, intake capability calls — reach storage without a service
|
|
130
|
+
* locator. Mirrors `sourceControl.initialize`.
|
|
131
|
+
*/
|
|
132
|
+
initialize?(args: {
|
|
133
|
+
storage: IntegrationStorageHandle;
|
|
134
|
+
projects: FactoryProjectsStorage;
|
|
135
|
+
auth: RouteAuth;
|
|
136
|
+
}): void;
|
|
137
|
+
/**
|
|
138
|
+
* The integration's full HTTP surface (status, OAuth, webhooks, feature
|
|
139
|
+
* routes), as Mastra `apiRoutes`. Called once at boot; the factory folds
|
|
140
|
+
* the result into the server's route table.
|
|
141
|
+
*/
|
|
142
|
+
routes(ctx: IntegrationContext): ApiRoute[];
|
|
143
|
+
/**
|
|
144
|
+
* Org-scoped agent tools resolved per request (e.g. Linear's issue tools).
|
|
145
|
+
* Optional capability; the factory merges results into the SDK's async
|
|
146
|
+
* `extraTools` provider.
|
|
147
|
+
*/
|
|
148
|
+
agentTools?(args: {
|
|
149
|
+
requestContext: RequestContext;
|
|
150
|
+
}): Promise<IntegrationTools>;
|
|
151
|
+
/**
|
|
152
|
+
* Session-scoped tools (e.g. GitHub's PR subscribe/unsubscribe). Optional
|
|
153
|
+
* capability, resolved synchronously per request.
|
|
154
|
+
*/
|
|
155
|
+
sessionTools?(args: {
|
|
156
|
+
requestContext: RequestContext;
|
|
157
|
+
}): IntegrationTools;
|
|
158
|
+
/**
|
|
159
|
+
* Optional provider-owned observer for successful or failed tool calls.
|
|
160
|
+
* The factory invokes every configured observer independently so one
|
|
161
|
+
* integration cannot prevent another from observing the same tool result.
|
|
162
|
+
*/
|
|
163
|
+
postToolObserver?(args: {
|
|
164
|
+
toolContext: IntegrationPostToolContext;
|
|
165
|
+
requestContext?: RequestContext;
|
|
166
|
+
}): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Background workers the integration needs running for its lifecycle
|
|
169
|
+
* (e.g. polling an upstream that doesn't support webhooks). Optional
|
|
170
|
+
* capability: called once at boot for READY integrations only; the factory
|
|
171
|
+
* folds the returned workers into the server Mastra's `workers` option, so
|
|
172
|
+
* they are merged with the built-in workers and started with them
|
|
173
|
+
* (`startWorkers()`). Worker names must be unique across integrations —
|
|
174
|
+
* duplicates fail the `new Mastra(...)` construction loudly.
|
|
175
|
+
*/
|
|
176
|
+
workers?(ctx: IntegrationContext): MastraWorker[];
|
|
177
|
+
/**
|
|
178
|
+
* Non-secret config snapshot (booleans + names only, never values). The
|
|
179
|
+
* factory merges it into system diagnostics/startup logs.
|
|
180
|
+
*/
|
|
181
|
+
diagnostics(): Record<string, unknown>;
|
|
182
|
+
/**
|
|
183
|
+
* Optional best-effort destination for locally persisted audit events.
|
|
184
|
+
* Audit export remains independent of the configured web auth adapter.
|
|
185
|
+
*/
|
|
186
|
+
audit?(args: {
|
|
187
|
+
event: AuditEventRow;
|
|
188
|
+
}): Promise<void>;
|
|
189
|
+
/**
|
|
190
|
+
* True when the integration signs OAuth `state` and therefore needs a
|
|
191
|
+
* replica-stable signer. The factory fails loud at boot when a registered
|
|
192
|
+
* integration requires stability but only a per-process random secret is
|
|
193
|
+
* available (see `./state-signing.ts`).
|
|
194
|
+
*/
|
|
195
|
+
readonly requiresStableStateSigner?: boolean;
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +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,EAA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AC,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composite feature gate + diagnostics for the GitHub App project feature.
|
|
3
|
+
*
|
|
4
|
+
* The GitHub feature is enabled only when *all three* hold:
|
|
5
|
+
* - a `GithubIntegration` instance is registered with the factory
|
|
6
|
+
* (constructed by the deploy entry from the `GITHUB_APP_*` env vars),
|
|
7
|
+
* - web auth is enabled (a per-user installation requires a logged-in user),
|
|
8
|
+
* - the application database is configured.
|
|
9
|
+
*
|
|
10
|
+
* OAuth/install `state` signing lives in `../../state-signing.ts` — the factory
|
|
11
|
+
* creates one shared signer at boot and hands it to every integration.
|
|
12
|
+
*
|
|
13
|
+
* Everything here is pure: callers pass the handles they already own (the
|
|
14
|
+
* integration, auth seam, state signer, sandbox fleet) — there is no global
|
|
15
|
+
* registry lookup.
|
|
16
|
+
*/
|
|
17
|
+
import type { RouteAuth } from '../../routes/route.js';
|
|
18
|
+
import type { SandboxFleet } from '../../sandbox/fleet.js';
|
|
19
|
+
import type { StateSigner } from '../../state-signing.js';
|
|
20
|
+
import type { GithubIntegration } from './integration.js';
|
|
21
|
+
/** Handles the GitHub feature gate + diagnostics are computed from. */
|
|
22
|
+
export interface GithubFeatureGateOptions {
|
|
23
|
+
/** The registered GitHub integration, when configured. */
|
|
24
|
+
github: GithubIntegration | undefined;
|
|
25
|
+
/** Web auth seam — the feature requires a logged-in user. */
|
|
26
|
+
auth: RouteAuth;
|
|
27
|
+
/** True when the application database is configured. */
|
|
28
|
+
appDbConfigured: boolean;
|
|
29
|
+
/** Shared OAuth/install `state` signer, when configured. */
|
|
30
|
+
stateSigner?: StateSigner;
|
|
31
|
+
/** Sandbox fleet, when sandboxes are configured. */
|
|
32
|
+
fleet?: SandboxFleet;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* True when the GitHub App project feature should be active.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isGithubFeatureEnabled(options: Pick<GithubFeatureGateOptions, 'github' | 'auth'>): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Non-secret diagnostic snapshot of every GitHub feature gate. Used by startup
|
|
40
|
+
* logs, `/web/github/status`, and the SPA so all three explain the same state.
|
|
41
|
+
*
|
|
42
|
+
* Only env var *names* and booleans are exposed — never secret values.
|
|
43
|
+
*/
|
|
44
|
+
export interface GithubFeatureDiagnostics {
|
|
45
|
+
githubAppConfigured: boolean;
|
|
46
|
+
factoryAuthEnabled: boolean;
|
|
47
|
+
appDbConfigured: boolean;
|
|
48
|
+
stateSecretConfigured: boolean;
|
|
49
|
+
sandboxEnabled: boolean;
|
|
50
|
+
sandboxProvider: string;
|
|
51
|
+
/** Names of the GitHub App env vars still needed (empty when configured). */
|
|
52
|
+
missingGithubAppEnvVars: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Collect a non-secret diagnostic snapshot of every GitHub feature gate. Centralizes
|
|
56
|
+
* the feature-gate reasoning so startup logs, the status API, and the SPA explain
|
|
57
|
+
* the same state. Does not change `isGithubFeatureEnabled()` behavior.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getGithubFeatureDiagnostics(options: GithubFeatureGateOptions): GithubFeatureDiagnostics;
|
|
60
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/config.ts"],"names":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
|
|
5
|
+
"GITHUB_APP_CLIENT_ID",
|
|
6
|
+
"GITHUB_APP_CLIENT_SECRET",
|
|
7
|
+
"GITHUB_APP_SLUG"
|
|
8
|
+
];
|
|
9
|
+
function isGithubFeatureEnabled(options) {
|
|
10
|
+
return options.github !== void 0 && options.auth.enabled();
|
|
11
|
+
}
|
|
12
|
+
function getGithubFeatureDiagnostics(options) {
|
|
13
|
+
const { github, auth, appDbConfigured, stateSigner, fleet } = options;
|
|
14
|
+
return {
|
|
15
|
+
githubAppConfigured: github !== void 0,
|
|
16
|
+
factoryAuthEnabled: auth.enabled(),
|
|
17
|
+
appDbConfigured,
|
|
18
|
+
stateSecretConfigured: stateSigner?.stable ?? false,
|
|
19
|
+
sandboxEnabled: fleet?.enabled ?? false,
|
|
20
|
+
sandboxProvider: fleet?.provider ?? "none",
|
|
21
|
+
missingGithubAppEnvVars: github ? [] : [...GITHUB_APP_ENV_VARS]
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
getGithubFeatureDiagnostics,
|
|
26
|
+
isGithubFeatureEnabled
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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 fleet) — there is no global\n * registry lookup.\n */\n\nimport type { RouteAuth } from '../../routes/route.js';\nimport type { SandboxFleet } from '../../sandbox/fleet.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 /** Sandbox fleet, when sandboxes are configured. */\n fleet?: SandboxFleet;\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, fleet } = options;\n return {\n githubAppConfigured: github !== undefined,\n factoryAuthEnabled: auth.enabled(),\n appDbConfigured,\n stateSecretConfigured: stateSigner?.stable ?? false,\n sandboxEnabled: fleet?.enabled ?? false,\n sandboxProvider: fleet?.provider ?? 'none',\n missingGithubAppEnvVars: github ? [] : [...GITHUB_APP_ENV_VARS],\n };\n}\n"],"mappings":";AA6BA,IAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAmBO,SAAS,uBAAuB,SAAqE;AAC1G,SAAO,QAAQ,WAAW,UAAa,QAAQ,KAAK,QAAQ;AAC9D;AAwBO,SAAS,4BAA4B,SAA6D;AACvG,QAAM,EAAE,QAAQ,MAAM,iBAAiB,aAAa,MAAM,IAAI;AAC9D,SAAO;AAAA,IACL,qBAAqB,WAAW;AAAA,IAChC,oBAAoB,KAAK,QAAQ;AAAA,IACjC;AAAA,IACA,uBAAuB,aAAa,UAAU;AAAA,IAC9C,gBAAgB,OAAO,WAAW;AAAA,IAClC,iBAAiB,OAAO,YAAY;AAAA,IACpC,yBAAyB,SAAS,CAAC,IAAI,CAAC,GAAG,mBAAmB;AAAA,EAChE;AACF;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GithubIntegration } from './integration.js';
|
|
2
|
+
export declare function ensureFactoryRuleSession(args: {
|
|
3
|
+
github: GithubIntegration;
|
|
4
|
+
orgId: string;
|
|
5
|
+
factoryProjectId: string;
|
|
6
|
+
repositorySlug?: string;
|
|
7
|
+
branch: string;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
sessionId: string;
|
|
10
|
+
userId: string;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=factory-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-session.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/factory-session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,wBAAsB,wBAAwB,CAAC,IAAI,EAAE;IACnD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAoCjD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/integrations/github/factory-session.ts
|
|
2
|
+
import { randomUUID } from "crypto";
|
|
3
|
+
async function ensureFactoryRuleSession(args) {
|
|
4
|
+
const connections = await args.github.sourceControlStorage.connections.list({
|
|
5
|
+
orgId: args.orgId,
|
|
6
|
+
factoryProjectId: args.factoryProjectId
|
|
7
|
+
});
|
|
8
|
+
const connection = connections.find((candidate) => candidate.integrationId === args.github.id);
|
|
9
|
+
if (!connection) throw new Error("Factory GitHub connection not found.");
|
|
10
|
+
const projectRepositories = await args.github.sourceControlStorage.projectRepositories.list({
|
|
11
|
+
orgId: args.orgId,
|
|
12
|
+
connectionId: connection.id
|
|
13
|
+
});
|
|
14
|
+
const resolvedRepositories = await Promise.all(
|
|
15
|
+
projectRepositories.map(async (projectRepository) => ({
|
|
16
|
+
projectRepository,
|
|
17
|
+
repository: await args.github.sourceControlStorage.repositories.get({
|
|
18
|
+
orgId: args.orgId,
|
|
19
|
+
id: projectRepository.repositoryId
|
|
20
|
+
})
|
|
21
|
+
}))
|
|
22
|
+
);
|
|
23
|
+
const resolved = resolvedRepositories.find(
|
|
24
|
+
(candidate) => candidate.repository && (!args.repositorySlug || candidate.repository.slug === args.repositorySlug)
|
|
25
|
+
);
|
|
26
|
+
if (!resolved?.repository) throw new Error("Factory GitHub repository not found.");
|
|
27
|
+
const userId = connection.createdByUserId;
|
|
28
|
+
const session = await args.github.sourceControlStorage.sessions.create({
|
|
29
|
+
sessionId: randomUUID(),
|
|
30
|
+
projectRepositoryId: resolved.projectRepository.id,
|
|
31
|
+
orgId: args.orgId,
|
|
32
|
+
userId,
|
|
33
|
+
branch: args.branch,
|
|
34
|
+
baseBranch: resolved.projectRepository.branch ?? resolved.repository.defaultBranch
|
|
35
|
+
});
|
|
36
|
+
return { sessionId: session.sessionId, userId };
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
ensureFactoryRuleSession
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=factory-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/integrations/github/factory-session.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport type { GithubIntegration } from './integration.js';\n\nexport async function ensureFactoryRuleSession(args: {\n github: GithubIntegration;\n orgId: string;\n factoryProjectId: string;\n repositorySlug?: string;\n branch: string;\n}): Promise<{ sessionId: string; userId: string }> {\n const connections = await args.github.sourceControlStorage.connections.list({\n orgId: args.orgId,\n factoryProjectId: args.factoryProjectId,\n });\n const connection = connections.find(candidate => candidate.integrationId === args.github.id);\n if (!connection) throw new Error('Factory GitHub connection not found.');\n\n const projectRepositories = await args.github.sourceControlStorage.projectRepositories.list({\n orgId: args.orgId,\n connectionId: connection.id,\n });\n const resolvedRepositories = await Promise.all(\n projectRepositories.map(async projectRepository => ({\n projectRepository,\n repository: await args.github.sourceControlStorage.repositories.get({\n orgId: args.orgId,\n id: projectRepository.repositoryId,\n }),\n })),\n );\n const resolved = resolvedRepositories.find(\n candidate => candidate.repository && (!args.repositorySlug || candidate.repository.slug === args.repositorySlug),\n );\n if (!resolved?.repository) throw new Error('Factory GitHub repository not found.');\n\n const userId = connection.createdByUserId;\n const session = await args.github.sourceControlStorage.sessions.create({\n sessionId: randomUUID(),\n projectRepositoryId: resolved.projectRepository.id,\n orgId: args.orgId,\n userId,\n branch: args.branch,\n baseBranch: resolved.projectRep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 -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `GithubIntegration` — the injectable GitHub App integration for the web
|
|
3
|
+
* factory.
|
|
4
|
+
*
|
|
5
|
+
* The deploy entry (`src/mastra/index.ts`) reads the `GITHUB_APP_*` env vars
|
|
6
|
+
* once, constructs an instance, and passes it to `MastraFactory` (the same
|
|
7
|
+
* dependency-injection pattern as the auth adapter and the sandbox machine).
|
|
8
|
+
* The factory seeds it into the runtime-config registry for the feature gate
|
|
9
|
+
* (`./config.ts`) and hands the instance to every consumer explicitly — route
|
|
10
|
+
* handlers receive it through `routes()`, the webhook fan-out and session
|
|
11
|
+
* subscription tools through their deps.
|
|
12
|
+
*
|
|
13
|
+
* The class owns:
|
|
14
|
+
* - the GitHub App credentials (validated + PEM-normalized at construction),
|
|
15
|
+
* - every GitHub API operation the web surface performs (Octokit factories,
|
|
16
|
+
* token minting, installation/repo/issue/PR listings, OAuth exchange),
|
|
17
|
+
* - the webhook secret used to verify GitHub webhook deliveries,
|
|
18
|
+
* - its own HTTP surface: `routes()` returns the `/web/github/*` +
|
|
19
|
+
* `/auth/github/*` Mastra `apiRoutes`.
|
|
20
|
+
*
|
|
21
|
+
* A custom integration (different app per tenant, custom Octokit config) can
|
|
22
|
+
* subclass this and override individual methods — everything downstream only
|
|
23
|
+
* talks to the instance.
|
|
24
|
+
*/
|
|
25
|
+
import type { RequestContext } from '@mastra/core/request-context';
|
|
26
|
+
import type { ApiRoute } from '@mastra/core/server';
|
|
27
|
+
import { Octokit } from '@octokit/rest';
|
|
28
|
+
import type { Intake } from '../../capabilities/intake.js';
|
|
29
|
+
import type { VersionControl } from '../../capabilities/version-control.js';
|
|
30
|
+
import type { FactoryIntegration, IntegrationContext, IntegrationTools } from '../base.js';
|
|
31
|
+
import type { GithubSubscriptionStorage } from './subscriptions.js';
|
|
32
|
+
/**
|
|
33
|
+
* Normalize a PEM private key supplied via env. Env tooling tends to mangle
|
|
34
|
+
* multi-line PEMs, so two single-line forms are supported:
|
|
35
|
+
* - `\n`-escaped: literal `\n` sequences become real newlines
|
|
36
|
+
* - fully flattened: newlines stripped entirely — the PEM is rebuilt by
|
|
37
|
+
* re-wrapping the base64 body (Node's decoder rejects header/body/footer
|
|
38
|
+
* on one line with `error:1E08010C:DECODER routines::unsupported`)
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizePrivateKey(raw: string): string;
|
|
41
|
+
export interface UserInstallation {
|
|
42
|
+
installationId: number;
|
|
43
|
+
accountLogin: string | null;
|
|
44
|
+
accountType: string | null;
|
|
45
|
+
}
|
|
46
|
+
export interface RepoSummary {
|
|
47
|
+
id: number;
|
|
48
|
+
fullName: string;
|
|
49
|
+
name: string;
|
|
50
|
+
owner: string;
|
|
51
|
+
defaultBranch: string;
|
|
52
|
+
private: boolean;
|
|
53
|
+
installationId: number;
|
|
54
|
+
}
|
|
55
|
+
export type GithubRepositoryPermission = 'admin' | 'maintain' | 'write' | 'triage' | 'read' | 'none';
|
|
56
|
+
export interface IssueSummary {
|
|
57
|
+
number: number;
|
|
58
|
+
title: string;
|
|
59
|
+
url: string;
|
|
60
|
+
author: string | null;
|
|
61
|
+
labels: string[];
|
|
62
|
+
comments: number;
|
|
63
|
+
createdAt: string;
|
|
64
|
+
updatedAt: string;
|
|
65
|
+
}
|
|
66
|
+
/** Page size for issue/PR listings; one GitHub API call per page. */
|
|
67
|
+
export declare const LIST_PAGE_SIZE = 30;
|
|
68
|
+
export interface IssuePage {
|
|
69
|
+
issues: IssueSummary[];
|
|
70
|
+
/** Next page number to request, or `null` when this was the last page. */
|
|
71
|
+
nextPage: number | null;
|
|
72
|
+
}
|
|
73
|
+
export interface ListRepoOpenIssuesOptions {
|
|
74
|
+
label?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface GithubIntegrationConfig {
|
|
77
|
+
/** GitHub App id (the numeric id, as a string). */
|
|
78
|
+
appId: string;
|
|
79
|
+
/**
|
|
80
|
+
* App private key (PEM). Multi-line, `\n`-escaped, and fully flattened
|
|
81
|
+
* single-line forms are all accepted (normalized at construction).
|
|
82
|
+
*/
|
|
83
|
+
privateKey: string;
|
|
84
|
+
/** OAuth client id of the GitHub App. */
|
|
85
|
+
clientId: string;
|
|
86
|
+
/** OAuth client secret of the GitHub App. */
|
|
87
|
+
clientSecret: string;
|
|
88
|
+
/** App slug — the URL name used to build the install URL. */
|
|
89
|
+
slug: string;
|
|
90
|
+
/**
|
|
91
|
+
* Secret GitHub uses to sign webhook deliveries. Omitted → webhook
|
|
92
|
+
* signature verification rejects all deliveries. Also serves as the default
|
|
93
|
+
* replica-stable OAuth/install `state` secret (see `./config.ts`).
|
|
94
|
+
*/
|
|
95
|
+
webhookSecret?: string;
|
|
96
|
+
}
|
|
97
|
+
export declare class GithubIntegration implements FactoryIntegration {
|
|
98
|
+
#private;
|
|
99
|
+
/** Stable integration identifier (see `../factory-integration.ts`). */
|
|
100
|
+
readonly id = "github";
|
|
101
|
+
readonly intake: Intake;
|
|
102
|
+
readonly versionControl: VersionControl;
|
|
103
|
+
/**
|
|
104
|
+
* The OAuth/install flow round-trips a signed `state` through GitHub, so a
|
|
105
|
+
* multi-replica deploy needs a deployment-stable state secret.
|
|
106
|
+
*/
|
|
107
|
+
readonly requiresStableStateSigner = true;
|
|
108
|
+
constructor(config: GithubIntegrationConfig);
|
|
109
|
+
/** App slug — the URL name used to build the install URL. */
|
|
110
|
+
get slug(): string;
|
|
111
|
+
get genericStorage(): IntegrationContext['storage']['generic'];
|
|
112
|
+
get sourceControlStorage(): IntegrationContext['storage']['sourceControl'];
|
|
113
|
+
get integrationStorage(): GithubSubscriptionStorage;
|
|
114
|
+
/** Secret GitHub uses to sign webhook deliveries, when configured. */
|
|
115
|
+
get webhookSecret(): string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Octokit authenticated as the GitHub App itself (app JWT). Used for
|
|
118
|
+
* app-level operations and to mint installation tokens.
|
|
119
|
+
*/
|
|
120
|
+
getAppOctokit(): Octokit;
|
|
121
|
+
/**
|
|
122
|
+
* Octokit authenticated as a specific installation (installation access
|
|
123
|
+
* token). Used to list repos and to operate on a repo on the user's behalf.
|
|
124
|
+
*/
|
|
125
|
+
getInstallationOctokit(installationId: number): Octokit;
|
|
126
|
+
/** Octokit authenticated as a user via their OAuth token (the identify step). */
|
|
127
|
+
getUserOctokit(userToken: string): Octokit;
|
|
128
|
+
/**
|
|
129
|
+
* Mint a short-lived installation access token. Returned token is used only
|
|
130
|
+
* server-side / inside the sandbox clone URL and never sent to the browser.
|
|
131
|
+
*/
|
|
132
|
+
mintInstallationToken(installationId: number): Promise<string>;
|
|
133
|
+
/**
|
|
134
|
+
* List the installations the authenticated user can access, via their OAuth
|
|
135
|
+
* token (`GET /user/installations`).
|
|
136
|
+
*/
|
|
137
|
+
listUserInstallations(userToken: string): Promise<UserInstallation[]>;
|
|
138
|
+
/** List repos accessible to an installation (paginated). */
|
|
139
|
+
listInstallationRepos(installationId: number): Promise<RepoSummary[]>;
|
|
140
|
+
/**
|
|
141
|
+
* The authenticated user's permission level on a repo, through the
|
|
142
|
+
* installation. `undefined` when the repo/user is not accessible.
|
|
143
|
+
*/
|
|
144
|
+
getRepositoryCollaboratorPermission(installationId: number, repoFullName: string, username: string, signal?: AbortSignal): Promise<GithubRepositoryPermission | undefined>;
|
|
145
|
+
/**
|
|
146
|
+
* Fetch a single repo's metadata through an installation token and confirm
|
|
147
|
+
* the installation actually has access to it. Returns `null` when the repo
|
|
148
|
+
* is not accessible to the installation (so a client can't create a project
|
|
149
|
+
* for an arbitrary repo under an installation id it merely owns).
|
|
150
|
+
*/
|
|
151
|
+
getInstallationRepo(installationId: number, repoFullName: string): Promise<RepoSummary | null>;
|
|
152
|
+
/** Add labels to an issue (deduplicated; no-op on empty/malformed input). */
|
|
153
|
+
addIssueLabels(installationId: number, repoFullName: string, issueNumber: number, labels: string[]): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* List one page of a repo's open issues through an installation token. The
|
|
156
|
+
* issues API also returns pull requests, so those are filtered out (the
|
|
157
|
+
* filter can make a non-final page shorter than the page size — `nextPage`
|
|
158
|
+
* is derived from the raw response length, not the filtered one).
|
|
159
|
+
*/
|
|
160
|
+
listRepoOpenIssues(installationId: number, repoFullName: string, page: number, options?: ListRepoOpenIssuesOptions): Promise<IssuePage>;
|
|
161
|
+
/**
|
|
162
|
+
* Build the GitHub App install URL. `state` is carried through the install
|
|
163
|
+
* flow and validated on callback.
|
|
164
|
+
*/
|
|
165
|
+
buildInstallUrl(state: string): string;
|
|
166
|
+
/**
|
|
167
|
+
* Build the OAuth identify URL (authorize) used to confirm the user's
|
|
168
|
+
* identity and obtain a user token for listing their installations.
|
|
169
|
+
*/
|
|
170
|
+
buildOAuthIdentifyUrl(state: string, redirectUri: string): string;
|
|
171
|
+
/** Exchange an OAuth `code` for a user access token. */
|
|
172
|
+
exchangeOAuthCode(code: string, redirectUri: string): Promise<string>;
|
|
173
|
+
/**
|
|
174
|
+
* The integration's HTTP surface: the `/web/github/*` + `/auth/github/*`
|
|
175
|
+
* Mastra `apiRoutes` (webhook handler, install/OAuth flow, project +
|
|
176
|
+
* worktree + session operations). The factory folds these into the server's
|
|
177
|
+
* `apiRoutes` when the feature is ready. Handlers operate on this instance.
|
|
178
|
+
*/
|
|
179
|
+
routes(ctx: IntegrationContext): ApiRoute[];
|
|
180
|
+
/**
|
|
181
|
+
* Session-scoped agent tools: PR subscribe/unsubscribe for sessions bound
|
|
182
|
+
* to a GitHub-backed project. Empty for sessions outside a GitHub project.
|
|
183
|
+
*/
|
|
184
|
+
sessionTools({ requestContext }: {
|
|
185
|
+
requestContext: RequestContext;
|
|
186
|
+
}): IntegrationTools;
|
|
187
|
+
postToolObserver({ toolContext, requestContext, }: Parameters<NonNullable<FactoryIntegration['postToolObserver']>>[0]): Promise<void>;
|
|
188
|
+
/** Non-secret config snapshot for system diagnostics/startup logs. */
|
|
189
|
+
diagnostics(): Record<string, unknown>;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=integration.d.ts.map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