@mastra/factory 0.28.0-alpha.13 → 0.28.0-alpha.15

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 (123) hide show
  1. package/README.md +43 -28
  2. package/dist/boards/board-writes.d.ts +3 -3
  3. package/dist/boards/board-writes.d.ts.map +1 -1
  4. package/dist/boards/board-writes.js +24 -20
  5. package/dist/boards/board-writes.js.map +1 -1
  6. package/dist/boards/project-boards.d.ts +20 -0
  7. package/dist/boards/project-boards.d.ts.map +1 -1
  8. package/dist/boards/project-boards.js +35 -11
  9. package/dist/boards/project-boards.js.map +1 -1
  10. package/dist/boards/registry.d.ts.map +1 -1
  11. package/dist/boards/registry.js +0 -3
  12. package/dist/boards/registry.js.map +1 -1
  13. package/dist/environment/build-runner.d.ts +13 -2
  14. package/dist/environment/build-runner.d.ts.map +1 -1
  15. package/dist/environment/build-runner.js +42 -0
  16. package/dist/environment/build-runner.js.map +1 -1
  17. package/dist/environment/build-workflow.d.ts +6 -4
  18. package/dist/environment/build-workflow.d.ts.map +1 -1
  19. package/dist/environment/build-workflow.js +70 -66
  20. package/dist/environment/build-workflow.js.map +1 -1
  21. package/dist/environment/build.d.ts +19 -4
  22. package/dist/environment/build.d.ts.map +1 -1
  23. package/dist/environment/build.js +70 -14
  24. package/dist/environment/build.js.map +1 -1
  25. package/dist/factory.d.ts +5 -2
  26. package/dist/factory.d.ts.map +1 -1
  27. package/dist/factory.js +29 -24
  28. package/dist/factory.js.map +1 -1
  29. package/dist/integrations/github/sandbox-release.d.ts +12 -0
  30. package/dist/integrations/github/sandbox-release.d.ts.map +1 -1
  31. package/dist/integrations/github/sandbox-release.js +16 -1
  32. package/dist/integrations/github/sandbox-release.js.map +1 -1
  33. package/dist/integrations/platform/github/integration.d.ts.map +1 -1
  34. package/dist/integrations/platform/github/integration.js +24 -12
  35. package/dist/integrations/platform/github/integration.js.map +1 -1
  36. package/dist/integrations/platform/jira/integration.d.ts.map +1 -1
  37. package/dist/integrations/platform/jira/integration.js +5 -1
  38. package/dist/integrations/platform/jira/integration.js.map +1 -1
  39. package/dist/routes/board-snapshot.d.ts +5 -0
  40. package/dist/routes/board-snapshot.d.ts.map +1 -1
  41. package/dist/routes/board-snapshot.js +12 -1
  42. package/dist/routes/board-snapshot.js.map +1 -1
  43. package/dist/routes/boards.d.ts +2 -3
  44. package/dist/routes/boards.d.ts.map +1 -1
  45. package/dist/routes/boards.js.map +1 -1
  46. package/dist/routes/contracts.d.ts +66 -0
  47. package/dist/routes/contracts.d.ts.map +1 -1
  48. package/dist/routes/contracts.js +41 -1
  49. package/dist/routes/contracts.js.map +1 -1
  50. package/dist/routes/projects.d.ts.map +1 -1
  51. package/dist/routes/projects.js +5 -0
  52. package/dist/routes/projects.js.map +1 -1
  53. package/dist/routes/sandbox-envs.d.ts +2 -0
  54. package/dist/routes/sandbox-envs.d.ts.map +1 -1
  55. package/dist/routes/sandbox-envs.js +3 -0
  56. package/dist/routes/sandbox-envs.js.map +1 -1
  57. package/dist/routes/source-control-settings.d.ts +2 -0
  58. package/dist/routes/source-control-settings.d.ts.map +1 -1
  59. package/dist/routes/source-control-settings.js +5 -0
  60. package/dist/routes/source-control-settings.js.map +1 -1
  61. package/dist/routes/surface.d.ts +2 -0
  62. package/dist/routes/surface.d.ts.map +1 -1
  63. package/dist/routes/surface.js +2 -1
  64. package/dist/routes/surface.js.map +1 -1
  65. package/dist/routes/work-item-activity.d.ts +11 -0
  66. package/dist/routes/work-item-activity.d.ts.map +1 -0
  67. package/dist/routes/work-item-activity.js +25 -0
  68. package/dist/routes/work-item-activity.js.map +1 -0
  69. package/dist/routes/work-item-starters.d.ts +29 -0
  70. package/dist/routes/work-item-starters.d.ts.map +1 -0
  71. package/dist/routes/work-item-starters.js +169 -0
  72. package/dist/routes/work-item-starters.js.map +1 -0
  73. package/dist/routes/work-items.d.ts.map +1 -1
  74. package/dist/routes/work-items.js +59 -1
  75. package/dist/routes/work-items.js.map +1 -1
  76. package/dist/rules/dispatcher.d.ts.map +1 -1
  77. package/dist/rules/dispatcher.js +49 -14
  78. package/dist/rules/dispatcher.js.map +1 -1
  79. package/dist/rules/transition-service.d.ts +20 -2
  80. package/dist/rules/transition-service.d.ts.map +1 -1
  81. package/dist/rules/transition-service.js +40 -18
  82. package/dist/rules/transition-service.js.map +1 -1
  83. package/dist/sandbox/context-sandboxes.d.ts +70 -0
  84. package/dist/sandbox/context-sandboxes.d.ts.map +1 -0
  85. package/dist/sandbox/context-sandboxes.js +120 -0
  86. package/dist/sandbox/context-sandboxes.js.map +1 -0
  87. package/dist/sandbox/session-retirement.d.ts +11 -4
  88. package/dist/sandbox/session-retirement.d.ts.map +1 -1
  89. package/dist/sandbox/session-retirement.js +39 -13
  90. package/dist/sandbox/session-retirement.js.map +1 -1
  91. package/dist/storage/domains/boards/base.d.ts +25 -5
  92. package/dist/storage/domains/boards/base.d.ts.map +1 -1
  93. package/dist/storage/domains/boards/base.js +57 -20
  94. package/dist/storage/domains/boards/base.js.map +1 -1
  95. package/dist/storage/domains/projects/base.d.ts +8 -2
  96. package/dist/storage/domains/projects/base.d.ts.map +1 -1
  97. package/dist/storage/domains/projects/base.js +21 -4
  98. package/dist/storage/domains/projects/base.js.map +1 -1
  99. package/dist/storage/domains/work-items/base.d.ts +17 -4
  100. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  101. package/dist/storage/domains/work-items/base.js +24 -4
  102. package/dist/storage/domains/work-items/base.js.map +1 -1
  103. package/dist/storage/domains/work-items/legacy-review.d.ts +19 -1
  104. package/dist/storage/domains/work-items/legacy-review.d.ts.map +1 -1
  105. package/dist/storage/domains/work-items/legacy-review.js +47 -2
  106. package/dist/storage/domains/work-items/legacy-review.js.map +1 -1
  107. package/dist/tools/annotations.d.ts.map +1 -1
  108. package/dist/tools/annotations.js +4 -0
  109. package/dist/tools/annotations.js.map +1 -1
  110. package/dist/tools/audit-events-tool.d.ts +29 -0
  111. package/dist/tools/audit-events-tool.d.ts.map +1 -0
  112. package/dist/tools/audit-events-tool.js +180 -0
  113. package/dist/tools/audit-events-tool.js.map +1 -0
  114. package/dist/tools/index.d.ts +2 -1
  115. package/dist/tools/index.d.ts.map +1 -1
  116. package/dist/tools/index.js +2 -0
  117. package/dist/tools/index.js.map +1 -1
  118. package/dist/tools/permissions.d.ts.map +1 -1
  119. package/dist/tools/permissions.js +1 -0
  120. package/dist/tools/permissions.js.map +1 -1
  121. package/dist/tools/sessions-state-processor.js +1 -1
  122. package/dist/tools/sessions-state-processor.js.map +1 -1
  123. package/package.json +9 -9
@@ -26,6 +26,18 @@ export declare function destroyDetachedSessionSandbox(options: {
26
26
  sandbox: FactorySandbox;
27
27
  session: Pick<SourceControlSession, 'id' | 'sandboxId'>;
28
28
  }): Promise<void>;
29
+ /**
30
+ * Stop a session's VM by identity from a process that holds no instance of
31
+ * it, keeping its files for the next start. Like the detached destroy it
32
+ * calls the provider's plain `stop()`, never the `_stop` lifecycle wrapper:
33
+ * E2B pauses the VM it finds by identity, Docker stops the container named
34
+ * after it, and providers with nothing to stop from outside (Platform,
35
+ * local) return.
36
+ */
37
+ export declare function stopDetachedSessionSandbox(options: {
38
+ sandbox: FactorySandbox;
39
+ session: Pick<SourceControlSession, 'id' | 'sandboxId'>;
40
+ }): Promise<void>;
29
41
  /**
30
42
  * Tear down the sandbox a just-deleted user session was holding. The row is
31
43
  * already gone, so the VM is destroyed rather than stopped — nothing will
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox-release.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/sandbox-release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAEzF;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACnD,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,OAAO,CA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IAAI,CAAC,CAUhB;AAED;;;;GAIG;AACH,wBAAsB,4BAA4B,CAAC,OAAO,EAAE;IAC1D,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;CAC3C,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhB"}
@@ -39,6 +39,21 @@ async function destroyDetachedSessionSandbox(options) {
39
39
  }, {}).destroy();
40
40
  }
41
41
  /**
42
+ * Stop a session's VM by identity from a process that holds no instance of
43
+ * it, keeping its files for the next start. Like the detached destroy it
44
+ * calls the provider's plain `stop()`, never the `_stop` lifecycle wrapper:
45
+ * E2B pauses the VM it finds by identity, Docker stops the container named
46
+ * after it, and providers with nothing to stop from outside (Platform,
47
+ * local) return.
48
+ */
49
+ async function stopDetachedSessionSandbox(options) {
50
+ await options.sandbox.create({
51
+ sessionId: options.session.id,
52
+ sandboxId: options.session.sandboxId ?? void 0,
53
+ getRepositoryAccess: void 0
54
+ }, {}).stop();
55
+ }
56
+ /**
42
57
  * Tear down the sandbox a just-deleted user session was holding. The row is
43
58
  * already gone, so the VM is destroyed rather than stopped — nothing will
44
59
  * ever resolve this session id again.
@@ -49,6 +64,6 @@ async function reclaimDeletedSessionSandbox(options) {
49
64
  destroy: true
50
65
  });
51
66
  }
52
- export { destroyDetachedSessionSandbox, reclaimDeletedSessionSandbox, releaseSessionSandbox };
67
+ export { destroyDetachedSessionSandbox, reclaimDeletedSessionSandbox, releaseSessionSandbox, stopDetachedSessionSandbox };
53
68
 
54
69
  //# sourceMappingURL=sandbox-release.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox-release.js","names":[],"sources":["../../../src/integrations/github/sandbox-release.ts"],"sourcesContent":["import type { FactorySandbox } from '@mastra/core/workspace';\n\nimport { evictSessionSandbox, peekSessionSandbox } from '../../sandbox/session-sandbox.js';\nimport type { SourceControlSession } from '../../storage/domains/source-control/base.js';\n\n/**\n * Stop or destroy the sandbox a session holds in this process, dropping it\n * from the per-process memo first so later opens construct fresh.\n *\n * Sandbox identity is the session id, so there is no reuse pool to publish\n * into — a reopened session resolves the same id through its provider\n * (reconnect/resume, or a fresh VM whose setup hook re-materializes).\n * Sessions never opened in this replica have no memo entry; destroying those\n * goes through {@link destroyDetachedSessionSandbox}.\n */\nexport async function releaseSessionSandbox(options: {\n /** The session's storage row id (the sandbox identity). */\n sessionId: string;\n /** Destroy instead of stop — for sessions that are gone for good. */\n destroy?: boolean;\n}): Promise<void> {\n const entry = peekSessionSandbox(options.sessionId);\n if (!entry) return;\n evictSessionSandbox(options.sessionId);\n const sandbox = entry.sandbox as unknown as {\n _stop?: () => Promise<void>;\n _destroy?: () => Promise<void>;\n stop?: () => Promise<void>;\n destroy?: () => Promise<void>;\n status?: string;\n };\n if (options.destroy) {\n // Constructed here but never started: the lifecycle wrapper treats that as\n // nothing to clean up, yet the VM may exist from an earlier process. The\n // provider's own destroy kills it by identity without resuming.\n if (sandbox.status === 'pending' && sandbox.destroy) {\n await sandbox.destroy();\n return;\n }\n await (sandbox._destroy ? sandbox._destroy() : sandbox.destroy?.());\n return;\n }\n await (sandbox._stop ? sandbox._stop() : sandbox.stop?.());\n}\n\n/**\n * Destroy a session's VM by identity from a process that holds no instance of\n * it. Constructs the provider sandbox (cheap, side-effect-free by contract)\n * and calls its plain `destroy()` — never `start()` and never the `_destroy`\n * lifecycle wrapper, which skips sandboxes this instance never started.\n */\nexport async function destroyDetachedSessionSandbox(options: {\n sandbox: FactorySandbox;\n session: Pick<SourceControlSession, 'id' | 'sandboxId'>;\n}): Promise<void> {\n const sandbox = options.sandbox.create(\n {\n sessionId: options.session.id,\n sandboxId: options.session.sandboxId ?? undefined,\n getRepositoryAccess: undefined,\n },\n {},\n );\n await sandbox.destroy();\n}\n\n/**\n * Tear down the sandbox a just-deleted user session was holding. The row is\n * already gone, so the VM is destroyed rather than stopped — nothing will\n * ever resolve this session id again.\n */\nexport async function reclaimDeletedSessionSandbox(options: {\n session: Pick<SourceControlSession, 'id'>;\n}): Promise<void> {\n await releaseSessionSandbox({ sessionId: options.session.id, destroy: true });\n}\n"],"mappings":";;;;;;;;;;;;AAeA,eAAsB,sBAAsB,SAK1B;CAChB,MAAM,QAAQ,mBAAmB,QAAQ,SAAS;CAClD,IAAI,CAAC,OAAO;CACZ,oBAAoB,QAAQ,SAAS;CACrC,MAAM,UAAU,MAAM;CAOtB,IAAI,QAAQ,SAAS;EAInB,IAAI,QAAQ,WAAW,aAAa,QAAQ,SAAS;GACnD,MAAM,QAAQ,QAAQ;GACtB;EACF;EACA,OAAO,QAAQ,WAAW,QAAQ,SAAS,IAAI,QAAQ,UAAU;EACjE;CACF;CACA,OAAO,QAAQ,QAAQ,QAAQ,MAAM,IAAI,QAAQ,OAAO;AAC1D;;;;;;;AAQA,eAAsB,8BAA8B,SAGlC;CAShB,MARgB,QAAQ,QAAQ,OAC9B;EACE,WAAW,QAAQ,QAAQ;EAC3B,WAAW,QAAQ,QAAQ,aAAa,KAAA;EACxC,qBAAqB,KAAA;CACvB,GACA,CAAC,CAES,CAAC,CAAC,QAAQ;AACxB;;;;;;AAOA,eAAsB,6BAA6B,SAEjC;CAChB,MAAM,sBAAsB;EAAE,WAAW,QAAQ,QAAQ;EAAI,SAAS;CAAK,CAAC;AAC9E"}
1
+ {"version":3,"file":"sandbox-release.js","names":[],"sources":["../../../src/integrations/github/sandbox-release.ts"],"sourcesContent":["import type { FactorySandbox } from '@mastra/core/workspace';\n\nimport { evictSessionSandbox, peekSessionSandbox } from '../../sandbox/session-sandbox.js';\nimport type { SourceControlSession } from '../../storage/domains/source-control/base.js';\n\n/**\n * Stop or destroy the sandbox a session holds in this process, dropping it\n * from the per-process memo first so later opens construct fresh.\n *\n * Sandbox identity is the session id, so there is no reuse pool to publish\n * into — a reopened session resolves the same id through its provider\n * (reconnect/resume, or a fresh VM whose setup hook re-materializes).\n * Sessions never opened in this replica have no memo entry; destroying those\n * goes through {@link destroyDetachedSessionSandbox}.\n */\nexport async function releaseSessionSandbox(options: {\n /** The session's storage row id (the sandbox identity). */\n sessionId: string;\n /** Destroy instead of stop — for sessions that are gone for good. */\n destroy?: boolean;\n}): Promise<void> {\n const entry = peekSessionSandbox(options.sessionId);\n if (!entry) return;\n evictSessionSandbox(options.sessionId);\n const sandbox = entry.sandbox as unknown as {\n _stop?: () => Promise<void>;\n _destroy?: () => Promise<void>;\n stop?: () => Promise<void>;\n destroy?: () => Promise<void>;\n status?: string;\n };\n if (options.destroy) {\n // Constructed here but never started: the lifecycle wrapper treats that as\n // nothing to clean up, yet the VM may exist from an earlier process. The\n // provider's own destroy kills it by identity without resuming.\n if (sandbox.status === 'pending' && sandbox.destroy) {\n await sandbox.destroy();\n return;\n }\n await (sandbox._destroy ? sandbox._destroy() : sandbox.destroy?.());\n return;\n }\n await (sandbox._stop ? sandbox._stop() : sandbox.stop?.());\n}\n\n/**\n * Destroy a session's VM by identity from a process that holds no instance of\n * it. Constructs the provider sandbox (cheap, side-effect-free by contract)\n * and calls its plain `destroy()` — never `start()` and never the `_destroy`\n * lifecycle wrapper, which skips sandboxes this instance never started.\n */\nexport async function destroyDetachedSessionSandbox(options: {\n sandbox: FactorySandbox;\n session: Pick<SourceControlSession, 'id' | 'sandboxId'>;\n}): Promise<void> {\n const sandbox = options.sandbox.create(\n {\n sessionId: options.session.id,\n sandboxId: options.session.sandboxId ?? undefined,\n getRepositoryAccess: undefined,\n },\n {},\n );\n await sandbox.destroy();\n}\n\n/**\n * Stop a session's VM by identity from a process that holds no instance of\n * it, keeping its files for the next start. Like the detached destroy it\n * calls the provider's plain `stop()`, never the `_stop` lifecycle wrapper:\n * E2B pauses the VM it finds by identity, Docker stops the container named\n * after it, and providers with nothing to stop from outside (Platform,\n * local) return.\n */\nexport async function stopDetachedSessionSandbox(options: {\n sandbox: FactorySandbox;\n session: Pick<SourceControlSession, 'id' | 'sandboxId'>;\n}): Promise<void> {\n const sandbox = options.sandbox.create(\n {\n sessionId: options.session.id,\n sandboxId: options.session.sandboxId ?? undefined,\n getRepositoryAccess: undefined,\n },\n {},\n );\n await sandbox.stop();\n}\n\n/**\n * Tear down the sandbox a just-deleted user session was holding. The row is\n * already gone, so the VM is destroyed rather than stopped — nothing will\n * ever resolve this session id again.\n */\nexport async function reclaimDeletedSessionSandbox(options: {\n session: Pick<SourceControlSession, 'id'>;\n}): Promise<void> {\n await releaseSessionSandbox({ sessionId: options.session.id, destroy: true });\n}\n"],"mappings":";;;;;;;;;;;;AAeA,eAAsB,sBAAsB,SAK1B;CAChB,MAAM,QAAQ,mBAAmB,QAAQ,SAAS;CAClD,IAAI,CAAC,OAAO;CACZ,oBAAoB,QAAQ,SAAS;CACrC,MAAM,UAAU,MAAM;CAOtB,IAAI,QAAQ,SAAS;EAInB,IAAI,QAAQ,WAAW,aAAa,QAAQ,SAAS;GACnD,MAAM,QAAQ,QAAQ;GACtB;EACF;EACA,OAAO,QAAQ,WAAW,QAAQ,SAAS,IAAI,QAAQ,UAAU;EACjE;CACF;CACA,OAAO,QAAQ,QAAQ,QAAQ,MAAM,IAAI,QAAQ,OAAO;AAC1D;;;;;;;AAQA,eAAsB,8BAA8B,SAGlC;CAShB,MARgB,QAAQ,QAAQ,OAC9B;EACE,WAAW,QAAQ,QAAQ;EAC3B,WAAW,QAAQ,QAAQ,aAAa,KAAA;EACxC,qBAAqB,KAAA;CACvB,GACA,CAAC,CAES,CAAC,CAAC,QAAQ;AACxB;;;;;;;;;AAUA,eAAsB,2BAA2B,SAG/B;CAShB,MARgB,QAAQ,QAAQ,OAC9B;EACE,WAAW,QAAQ,QAAQ;EAC3B,WAAW,QAAQ,QAAQ,aAAa,KAAA;EACxC,qBAAqB,KAAA;CACvB,GACA,CAAC,CAES,CAAC,CAAC,KAAK;AACrB;;;;;;AAOA,eAAsB,6BAA6B,SAEjC;CAChB,MAAM,sBAAsB;EAAE,WAAW,QAAQ,QAAQ;EAAI,SAAS;CAAK,CAAC;AAC9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../src/integrations/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AO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAoCjD;IAEK,qBAAqB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAyBzG;IAED;;;OAGG;IACG,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAGnG;IAEK,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAWnE;IAEK,cAAc,CAClB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAOnB;IAEK,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOnH;IAED,sBAAsB,CAAC,eAAe,EAAE,MAAM,GAAG,UAAU,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,CAAC,CAYvG;CAoaF"}
@@ -13,6 +13,14 @@ import { PlatformGithubEventWorker } from "./event-worker.js";
13
13
  import { registerApiRoute } from "@mastra/core/server";
14
14
  import { Octokit } from "@octokit/rest";
15
15
  // src/integrations/platform/github/integration.ts
16
+ /**
17
+ * Status reason for a settled installation list. A personal install Platform withholds would otherwise
18
+ * read as "nothing installed", so say so; any usable installation still means ready.
19
+ */
20
+ function githubStatusReason(hasUsableInstallation, hiddenPersonalInstallReason) {
21
+ if (hasUsableInstallation) return "ready";
22
+ return hiddenPersonalInstallReason ? "personal_install_hidden" : "not_connected";
23
+ }
16
24
  const PAGE_SIZE = 30;
17
25
  const OPEN_ISSUE_DISCOVERY_MAX_PAGES = 5;
18
26
  const API_PREFIX = "/v1/server";
@@ -558,7 +566,7 @@ var PlatformGithubIntegration = class {
558
566
  reason: "organization_required",
559
567
  diagnostics: this.diagnostics()
560
568
  });
561
- const [installations, userConnection] = await Promise.all([this.#syncInstallations(tenant.orgId, tenant.userId), this.#fetchUserConnection(tenant.userId)]);
569
+ const [{ installations, hiddenPersonalInstallReason }, userConnection] = await Promise.all([this.#syncInstallations(tenant.orgId, tenant.userId), this.#fetchUserConnection(tenant.userId)]);
562
570
  return c.json({
563
571
  enabled: true,
564
572
  sandboxEnabled: !!ctx.sandbox,
@@ -570,7 +578,7 @@ var PlatformGithubIntegration = class {
570
578
  })),
571
579
  userConnected: userConnection.connected,
572
580
  userGithubUsername: userConnection.githubUsername,
573
- reason: installations.length > 0 ? "ready" : "not_connected",
581
+ reason: githubStatusReason(installations.length > 0, hiddenPersonalInstallReason),
574
582
  diagnostics: this.diagnostics()
575
583
  });
576
584
  }
@@ -646,16 +654,20 @@ var PlatformGithubIntegration = class {
646
654
  }
647
655
  }
648
656
  async #syncInstallations(orgId, userId) {
649
- const usableInstallations = (await this.#client.request("GET", `${API_PREFIX}/github-app/installations`)).installations.filter((installation) => installation.usable && !installation.suspendedAt);
650
- return Promise.all(usableInstallations.map((installation) => this.versionControl.registerInstallation({
651
- orgId,
652
- userId,
653
- installation: {
654
- externalId: String(installation.installationId),
655
- accountName: installation.accountLogin,
656
- accountType: installation.accountType
657
- }
658
- })));
657
+ const result = await this.#client.request("GET", `${API_PREFIX}/github-app/installations`);
658
+ const usableInstallations = result.installations.filter((installation) => installation.usable && !installation.suspendedAt);
659
+ return {
660
+ installations: await Promise.all(usableInstallations.map((installation) => this.versionControl.registerInstallation({
661
+ orgId,
662
+ userId,
663
+ installation: {
664
+ externalId: String(installation.installationId),
665
+ accountName: installation.accountLogin,
666
+ accountType: installation.accountType
667
+ }
668
+ }))),
669
+ hiddenPersonalInstallReason: result.hiddenPersonalInstallReason ?? void 0
670
+ };
659
671
  }
660
672
  workers(ctx) {
661
673
  if (!this.#pollingEnabled && !this.#pullRequestReconcileEnabled && !this.#issueReconcileEnabled) return [];