@mastra/factory 0.1.0-alpha.7 → 0.1.0-alpha.9

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/index.js CHANGED
@@ -35423,9 +35423,9 @@ function trustedGithubActor(context) {
35423
35423
  function invokeIssueInvestigation(context) {
35424
35424
  return {
35425
35425
  type: "invokeSkill",
35426
- idempotencyKey: `${context.ingress.id}:understand-issue`,
35426
+ idempotencyKey: `${context.ingress.id}:factory-triage`,
35427
35427
  role: "triage",
35428
- skillName: "understand-issue",
35428
+ skillName: "factory-triage",
35429
35429
  arguments: context.item.url ? `GitHub issue (${context.item.url})` : context.item.title
35430
35430
  };
35431
35431
  }
@@ -35436,18 +35436,27 @@ function investigateTriagedLinearIssue(context) {
35436
35436
  const identifier = context.item.sourceKey?.startsWith("linear:") ? context.item.sourceKey.slice("linear:".length) : context.item.title;
35437
35437
  return {
35438
35438
  type: "invokeSkill",
35439
- idempotencyKey: `${context.ingress.id}:understand-linear-issue`,
35439
+ idempotencyKey: `${context.ingress.id}:factory-triage-linear`,
35440
35440
  role: "triage",
35441
- skillName: "understand-issue",
35441
+ skillName: "factory-triage",
35442
35442
  arguments: `Linear issue ${identifier}${context.item.url ? ` (${context.item.url})` : ""}`
35443
35443
  };
35444
35444
  }
35445
+ function planWorkItem(context) {
35446
+ return {
35447
+ type: "invokeSkill",
35448
+ idempotencyKey: `${context.ingress.id}:factory-plan`,
35449
+ role: "plan",
35450
+ skillName: "factory-plan",
35451
+ arguments: context.item.url ? `Work item (${context.item.url})` : context.item.title
35452
+ };
35453
+ }
35445
35454
  function reviewPullRequest(context) {
35446
35455
  return {
35447
35456
  type: "invokeSkill",
35448
- idempotencyKey: `${context.ingress.id}:understand-pr`,
35457
+ idempotencyKey: `${context.ingress.id}:factory-review`,
35449
35458
  role: "review",
35450
- skillName: "understand-pr",
35459
+ skillName: "factory-review",
35451
35460
  arguments: context.item.url ? `GitHub pull request (${context.item.url})` : context.item.title
35452
35461
  };
35453
35462
  }
@@ -35545,6 +35554,11 @@ var BUILT_IN_DEFAULTS = {
35545
35554
  triage: {
35546
35555
  issue: { onEnter: investigateTriagedIssue },
35547
35556
  linearIssue: { onEnter: investigateTriagedLinearIssue }
35557
+ },
35558
+ planning: {
35559
+ issue: { onEnter: planWorkItem },
35560
+ linearIssue: { onEnter: planWorkItem },
35561
+ manual: { onEnter: planWorkItem }
35548
35562
  }
35549
35563
  },
35550
35564
  review: { review: { pullRequest: { onEnter: reviewPullRequest } } },
@@ -38462,7 +38476,7 @@ var FACTORY_SKILLS_SOURCE_PATH = [
38462
38476
  join3(process.cwd(), "src", "mastra", "public", "factory-skills")
38463
38477
  ].find(existsSync2) ?? bundledFactorySkillsPath;
38464
38478
  var FACTORY_SKILLS_MOUNT = path2.resolve(path2.parse(process.cwd()).root, "__mastracode_factory_skills__");
38465
- var FACTORY_SKILL_NAMES = /* @__PURE__ */ new Set(["configure-factory-rules", "understand-issue", "understand-pr"]);
38479
+ var FACTORY_SKILL_NAMES = /* @__PURE__ */ new Set(["configure-factory-rules", "factory-plan", "factory-review", "factory-triage"]);
38466
38480
  var FactorySkillSource = class {
38467
38481
  constructor(fallback, fallbackSkillRoots) {
38468
38482
  this.fallback = fallback;
@@ -38566,6 +38580,13 @@ function createWorkspaceFactory(options = {}) {
38566
38580
  if (registered) {
38567
38581
  registerGithubTokenInjector(requestContext, registered.inject);
38568
38582
  registerGithubPatKind(requestContext, registered.patKind);
38583
+ try {
38584
+ const pat = await getGithubPat(() => github.integrationStorage, session.orgId, registered.patKind);
38585
+ if (pat && pat !== registered.ghToken) {
38586
+ registered.inject(pat);
38587
+ }
38588
+ } catch {
38589
+ }
38569
38590
  }
38570
38591
  return existing;
38571
38592
  }
@@ -38612,8 +38633,10 @@ function createWorkspaceFactory(options = {}) {
38612
38633
  throw new Error("The active sandbox provider does not support runtime GitHub token refresh.");
38613
38634
  }
38614
38635
  sandbox.setEnvironmentVariable("GH_TOKEN", freshToken);
38636
+ const registered = githubTokenInjectors.get(workspaceId);
38637
+ if (registered) registered.ghToken = freshToken;
38615
38638
  };
38616
- githubTokenInjectors.set(workspaceId, { inject: injectGithubToken2, patKind });
38639
+ githubTokenInjectors.set(workspaceId, { inject: injectGithubToken2, patKind, ghToken: ghCliToken });
38617
38640
  registerGithubTokenInjector(requestContext, injectGithubToken2);
38618
38641
  registerGithubPatKind(requestContext, patKind);
38619
38642
  const filesystem = new SandboxFilesystem({ sandbox, workdir });