@mastra/factory 0.2.0 → 0.2.1-alpha.1

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/capabilities/intake.d.ts +45 -0
  3. package/dist/capabilities/intake.d.ts.map +1 -1
  4. package/dist/factory.js +920 -549
  5. package/dist/factory.js.map +1 -1
  6. package/dist/index.js +920 -549
  7. package/dist/index.js.map +1 -1
  8. package/dist/integrations/github/integration.d.ts.map +1 -1
  9. package/dist/integrations/github/integration.js +126 -11
  10. package/dist/integrations/github/integration.js.map +1 -1
  11. package/dist/integrations/github/project-lock.d.ts +24 -2
  12. package/dist/integrations/github/project-lock.d.ts.map +1 -1
  13. package/dist/integrations/github/project-lock.js +43 -10
  14. package/dist/integrations/github/project-lock.js.map +1 -1
  15. package/dist/integrations/github/routes.js +41 -10
  16. package/dist/integrations/github/routes.js.map +1 -1
  17. package/dist/integrations/linear/agent-tools.js.map +1 -1
  18. package/dist/integrations/linear/integration.d.ts.map +1 -1
  19. package/dist/integrations/linear/integration.js +60 -1
  20. package/dist/integrations/linear/integration.js.map +1 -1
  21. package/dist/integrations/linear/routes.js.map +1 -1
  22. package/dist/integrations/platform/github/event-worker.d.ts.map +1 -1
  23. package/dist/integrations/platform/github/event-worker.js +7 -1
  24. package/dist/integrations/platform/github/event-worker.js.map +1 -1
  25. package/dist/integrations/platform/github/integration.d.ts.map +1 -1
  26. package/dist/integrations/platform/github/integration.js +104 -12
  27. package/dist/integrations/platform/github/integration.js.map +1 -1
  28. package/dist/integrations/platform/linear/integration.d.ts.map +1 -1
  29. package/dist/integrations/platform/linear/integration.js +91 -0
  30. package/dist/integrations/platform/linear/integration.js.map +1 -1
  31. package/dist/routes/fs.d.ts +16 -0
  32. package/dist/routes/fs.d.ts.map +1 -1
  33. package/dist/routes/fs.js +103 -3
  34. package/dist/routes/fs.js.map +1 -1
  35. package/dist/routes/oauth.js +564 -478
  36. package/dist/routes/oauth.js.map +1 -1
  37. package/dist/routes/projects.d.ts.map +1 -1
  38. package/dist/routes/projects.js +1 -0
  39. package/dist/routes/projects.js.map +1 -1
  40. package/dist/routes/surface.d.ts.map +1 -1
  41. package/dist/routes/surface.js +717 -526
  42. package/dist/routes/surface.js.map +1 -1
  43. package/dist/storage/domains/source-control/base.d.ts +0 -1
  44. package/dist/storage/domains/source-control/base.d.ts.map +1 -1
  45. package/dist/storage/domains/source-control/base.js +6 -7
  46. package/dist/storage/domains/source-control/base.js.map +1 -1
  47. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @mastra/factory
2
2
 
3
+ ## 0.2.1-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`c8d8a01`](https://github.com/mastra-ai/mastra/commit/c8d8a010ee2efe2b7bf4d07707382c34c87b14e4), [`371cf60`](https://github.com/mastra-ai/mastra/commit/371cf6075cef88ac6919a08d59a82e485397364a), [`263d2ca`](https://github.com/mastra-ai/mastra/commit/263d2cac80ba3b03b9c0f008db6f1f1b9eb0278c)]:
8
+ - @mastra/core@1.53.0-alpha.1
9
+ - @mastra/code-sdk@1.0.2-alpha.1
10
+
11
+ ## 0.2.1-alpha.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Improved Platform GitHub event polling efficiency and added event-count and latency logging for each poll. ([#20123](https://github.com/mastra-ai/mastra/pull/20123))
16
+
17
+ - Bound the `withProjectLock` / `withDbAdvisoryLock` critical section with an `AbortSignal` timeout (default 60s, configurable via `timeoutMs`). Previously, an unbounded outbound call inside the lock could keep the transaction open for up to Neon's `idle_in_transaction_session_timeout` (5 minutes), pinning the pool connection and the advisory lock the entire time. On timeout the wrapper aborts the `fn`'s signal, rolls the transaction back, releases the connection, and throws `ProjectLockTimeoutError`. ([#20129](https://github.com/mastra-ai/mastra/pull/20129))
18
+
19
+ - Fixed the workspace files panel in Factory web returning "Path is outside the browsable root" for Factory sessions. The workspace file endpoints now recognize a session id, reattach to that session's sandbox, and list and read rendered files (like .artifacts) directly from the sandbox, so session artifacts render on deployed factories. ([#20101](https://github.com/mastra-ai/mastra/pull/20101))
20
+
21
+ - Added an updateIssue capability to the Intake surface so Factory can change the state of external issues (open/closed on GitHub, workflow state on Linear) as a side effect of stage transitions. Adapters cover the direct GitHub, direct Linear, platform GitHub, and platform Linear integrations. GitHub adapters reject pull-request targets. Linear adapters resolve the target workflow state per team and skip when the issue is already in the desired state. The platform Linear adapter degrades to a no-op (returns null) when the platform workflow-states endpoint is not yet deployed, so this change is safe to ship ahead of the platform companion route. This is a plumbing change: no rule currently emits the new decision, so behavior is unchanged. ([#20111](https://github.com/mastra-ai/mastra/pull/20111))
22
+
23
+ - Updated dependencies [[`df6a9ce`](https://github.com/mastra-ai/mastra/commit/df6a9ce87214f7aadb2edfe62f67605fe998a0a4), [`cadd3a2`](https://github.com/mastra-ai/mastra/commit/cadd3a276f8e0026e3c84cffe935538419cb890c)]:
24
+ - @mastra/core@1.52.2-alpha.0
25
+ - @mastra/code-sdk@1.0.2-alpha.0
26
+
3
27
  ## 0.2.0
4
28
 
5
29
  ### Minor Changes
@@ -84,12 +84,57 @@ export interface CreatedIntakeComment {
84
84
  id: string;
85
85
  url: string;
86
86
  }
87
+ /**
88
+ * Provider-neutral target state for `Intake.updateIssue`.
89
+ *
90
+ * `byType` uses the workflow-state family so callers don't have to know per-team
91
+ * state names; `byName` is escape hatch for teams that need a specific state.
92
+ * Adapters that don't support custom states (GitHub) ignore `byName` with a
93
+ * warn log.
94
+ */
95
+ export type IntakeIssueTargetState = {
96
+ kind: 'byType';
97
+ stateType: 'unstarted' | 'started' | 'completed' | 'canceled';
98
+ } | {
99
+ kind: 'byName';
100
+ name: string;
101
+ };
102
+ export interface UpdateIntakeIssueInput extends GetIntakeIssueInput {
103
+ state: IntakeIssueTargetState;
104
+ /** End user the state change should be attributed to, when the provider supports acting on a user's behalf. */
105
+ actingUserId?: string;
106
+ }
107
+ export interface ResolveIntakeDispatchInput {
108
+ orgId: string;
109
+ externalSource: {
110
+ type: string;
111
+ externalId: string;
112
+ };
113
+ }
114
+ export interface ResolvedIntakeDispatch {
115
+ connection: IntegrationConnection;
116
+ sourceId?: string;
117
+ issueId: string;
118
+ }
87
119
  /** Fixed issue-oriented contract implemented by GitHub, Linear, and future sources. */
88
120
  export interface Intake {
121
+ /**
122
+ * Resolve the connection and provider-specific identifiers needed to call
123
+ * this capability from a background dispatch context.
124
+ */
125
+ resolveIntakeDispatch?(input: ResolveIntakeDispatchInput): Promise<ResolvedIntakeDispatch | null>;
89
126
  listSources(input: ListIntakeSourcesInput): Promise<IntakeSource[]>;
90
127
  listItems(input: ListIntakeItemsInput): Promise<IntakeItemPage>;
91
128
  listIssues(input: ListIntakeIssuesInput): Promise<IntakeIssuePage>;
92
129
  getIssue(input: GetIntakeIssueInput): Promise<IntakeIssueDetail | null>;
93
130
  createComment(input: CreateIntakeCommentInput): Promise<CreatedIntakeComment | null>;
131
+ /**
132
+ * Move an issue to a target state. Returns the refreshed `IntakeIssue` on
133
+ * success, or `null` when the target is not applicable (e.g., a GitHub PR,
134
+ * or no matching workflow state). Adapters MUST NOT throw for policy misses
135
+ * — only for infrastructure errors (network, auth). This distinction lets
136
+ * the executor idempotency guard treat `null` as "done, nothing to do".
137
+ */
138
+ updateIssue(input: UpdateIntakeIssueInput): Promise<IntakeIssue | null>;
94
139
  }
95
140
  //# sourceMappingURL=intake.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"intake.d.ts","sourceRoot":"","sources":["../../src/capabilities/intake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA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