@mastra/github-signals 0.5.2-alpha.0 → 0.5.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/dist/index.cjs +32 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -25
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
@@ -79,7 +79,7 @@ async function resolveGithubAuthEnv() {
|
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/github-app-owner.ts
|
|
82
|
-
const OWNER_CACHE_TTL_MS =
|
|
82
|
+
const OWNER_CACHE_TTL_MS = 864e5;
|
|
83
83
|
let execFileAsync$1;
|
|
84
84
|
const defaultRunGhApi = async (args) => {
|
|
85
85
|
if (!execFileAsync$1) {
|
|
@@ -138,7 +138,10 @@ var GithubAppOwnerResolver = class {
|
|
|
138
138
|
//#region src/index.ts
|
|
139
139
|
let _execFileAsync;
|
|
140
140
|
async function execFileAsync(file, args, options) {
|
|
141
|
-
if (!_execFileAsync)
|
|
141
|
+
if (!_execFileAsync) {
|
|
142
|
+
const cp = await import("child_process");
|
|
143
|
+
_execFileAsync = (0, util.promisify)(cp.execFile);
|
|
144
|
+
}
|
|
142
145
|
return _execFileAsync(file, args, options);
|
|
143
146
|
}
|
|
144
147
|
const GITHUB_SUBSCRIBE_PR_TAG = "github-subscribe-pr";
|
|
@@ -151,7 +154,7 @@ const DEFAULT_AUTHORIZED_PERMISSIONS = [
|
|
|
151
154
|
"write"
|
|
152
155
|
];
|
|
153
156
|
const DEFAULT_AUTHORIZED_BOTS = ["coderabbitai[bot]", "devin-ai-integration[bot]"];
|
|
154
|
-
const PERMISSION_CACHE_TTL_MS =
|
|
157
|
+
const PERMISSION_CACHE_TTL_MS = 3e5;
|
|
155
158
|
/** Notification kinds that include comment content and should be gated by author permission. */
|
|
156
159
|
const AUTHOR_GATED_NOTIFICATION_KINDS = /* @__PURE__ */ new Set(["pull-request-activity"]);
|
|
157
160
|
const createGithubTool = _mastra_core_tools.createTool;
|
|
@@ -189,9 +192,9 @@ async function readDbPathFromGitcrawlConfig(configPath) {
|
|
|
189
192
|
if (match?.[1]) return resolveHomePath(match[1]);
|
|
190
193
|
} catch {}
|
|
191
194
|
}
|
|
192
|
-
async function fileExists(path
|
|
195
|
+
async function fileExists(path) {
|
|
193
196
|
try {
|
|
194
|
-
await (0, fs_promises.stat)(path
|
|
197
|
+
await (0, fs_promises.stat)(path);
|
|
195
198
|
return true;
|
|
196
199
|
} catch {
|
|
197
200
|
return false;
|
|
@@ -661,7 +664,7 @@ var GitcrawlSyncClient = class {
|
|
|
661
664
|
if (fromEnvConfig) return fromEnvConfig;
|
|
662
665
|
}
|
|
663
666
|
try {
|
|
664
|
-
const { stdout } = await execFileAsync(this.#command, ["status", "--json"], { maxBuffer:
|
|
667
|
+
const { stdout } = await execFileAsync(this.#command, ["status", "--json"], { maxBuffer: 10485760 });
|
|
665
668
|
const status = JSON.parse(stdout);
|
|
666
669
|
const reported = readString(status.database_path) ?? readString(status.db_path);
|
|
667
670
|
if (reported) return resolveHomePath(reported);
|
|
@@ -685,7 +688,7 @@ var GitcrawlSyncClient = class {
|
|
|
685
688
|
"-json",
|
|
686
689
|
dbPath,
|
|
687
690
|
sql
|
|
688
|
-
], { maxBuffer:
|
|
691
|
+
], { maxBuffer: 10485760 });
|
|
689
692
|
return JSON.parse(stdout || "[]");
|
|
690
693
|
} catch (error) {
|
|
691
694
|
this.#dbPathPromise = void 0;
|
|
@@ -708,7 +711,7 @@ var GitcrawlSyncClient = class {
|
|
|
708
711
|
const { stdout, stderr } = await execFileAsync(this.#command, args, {
|
|
709
712
|
cwd: input.cwd,
|
|
710
713
|
signal: input.abortSignal,
|
|
711
|
-
maxBuffer:
|
|
714
|
+
maxBuffer: 10485760,
|
|
712
715
|
env: await resolveGithubAuthEnv()
|
|
713
716
|
});
|
|
714
717
|
return {
|
|
@@ -733,7 +736,7 @@ var GitcrawlSyncClient = class {
|
|
|
733
736
|
], {
|
|
734
737
|
cwd: input.cwd,
|
|
735
738
|
signal: input.abortSignal,
|
|
736
|
-
maxBuffer:
|
|
739
|
+
maxBuffer: 10485760
|
|
737
740
|
});
|
|
738
741
|
const thread = JSON.parse(stdout).threads?.find((item) => readNumber(item.number) === input.number);
|
|
739
742
|
if (!thread) return void 0;
|
|
@@ -1629,26 +1632,27 @@ var GithubSignals = class extends _mastra_core_signals.SignalProvider {
|
|
|
1629
1632
|
const agent = this.#getNotificationAgent(input.polling);
|
|
1630
1633
|
if (!agent?.sendNotificationSignal) return [];
|
|
1631
1634
|
const notifications = [];
|
|
1632
|
-
if (input.subscription.mode === "review")
|
|
1633
|
-
|
|
1634
|
-
snapshot: input.snapshot,
|
|
1635
|
-
terminalState: input.terminalState
|
|
1636
|
-
}));
|
|
1637
|
-
else {
|
|
1638
|
-
if (input.latestCommentChanged) notifications.push(classifyGithubCommentActivityNotification({
|
|
1635
|
+
if (input.subscription.mode === "review") {
|
|
1636
|
+
if (input.terminalState) notifications.push(classifyGithubTerminalActivityNotification({
|
|
1639
1637
|
subscription: input.subscription,
|
|
1640
|
-
snapshot: input.snapshot
|
|
1641
|
-
|
|
1642
|
-
if (input.headChanged) notifications.push(classifyGithubHeadActivityNotification({
|
|
1643
|
-
subscription: input.subscription,
|
|
1644
|
-
snapshot: input.snapshot
|
|
1645
|
-
}));
|
|
1646
|
-
if (input.reviewStateChanged) notifications.push(classifyGithubReviewStateActivityNotification({
|
|
1647
|
-
subscription: input.subscription,
|
|
1648
|
-
snapshot: input.snapshot
|
|
1638
|
+
snapshot: input.snapshot,
|
|
1639
|
+
terminalState: input.terminalState
|
|
1649
1640
|
}));
|
|
1650
|
-
|
|
1651
|
-
|
|
1641
|
+
else {
|
|
1642
|
+
if (input.latestCommentChanged) notifications.push(classifyGithubCommentActivityNotification({
|
|
1643
|
+
subscription: input.subscription,
|
|
1644
|
+
snapshot: input.snapshot
|
|
1645
|
+
}));
|
|
1646
|
+
if (input.headChanged) notifications.push(classifyGithubHeadActivityNotification({
|
|
1647
|
+
subscription: input.subscription,
|
|
1648
|
+
snapshot: input.snapshot
|
|
1649
|
+
}));
|
|
1650
|
+
if (input.reviewStateChanged) notifications.push(classifyGithubReviewStateActivityNotification({
|
|
1651
|
+
subscription: input.subscription,
|
|
1652
|
+
snapshot: input.snapshot
|
|
1653
|
+
}));
|
|
1654
|
+
}
|
|
1655
|
+
} else {
|
|
1652
1656
|
notifications.push(classifyGithubActivityNotification({
|
|
1653
1657
|
subscription: input.subscription,
|
|
1654
1658
|
snapshot: input.snapshot
|