@mastra/github-signals 0.5.1 → 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.js
CHANGED
|
@@ -55,7 +55,7 @@ async function resolveGithubAuthEnv() {
|
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/github-app-owner.ts
|
|
58
|
-
const OWNER_CACHE_TTL_MS =
|
|
58
|
+
const OWNER_CACHE_TTL_MS = 864e5;
|
|
59
59
|
let execFileAsync$1;
|
|
60
60
|
const defaultRunGhApi = async (args) => {
|
|
61
61
|
if (!execFileAsync$1) {
|
|
@@ -114,7 +114,10 @@ var GithubAppOwnerResolver = class {
|
|
|
114
114
|
//#region src/index.ts
|
|
115
115
|
let _execFileAsync;
|
|
116
116
|
async function execFileAsync(file, args, options) {
|
|
117
|
-
if (!_execFileAsync)
|
|
117
|
+
if (!_execFileAsync) {
|
|
118
|
+
const cp = await import("child_process");
|
|
119
|
+
_execFileAsync = promisify(cp.execFile);
|
|
120
|
+
}
|
|
118
121
|
return _execFileAsync(file, args, options);
|
|
119
122
|
}
|
|
120
123
|
const GITHUB_SUBSCRIBE_PR_TAG = "github-subscribe-pr";
|
|
@@ -127,7 +130,7 @@ const DEFAULT_AUTHORIZED_PERMISSIONS = [
|
|
|
127
130
|
"write"
|
|
128
131
|
];
|
|
129
132
|
const DEFAULT_AUTHORIZED_BOTS = ["coderabbitai[bot]", "devin-ai-integration[bot]"];
|
|
130
|
-
const PERMISSION_CACHE_TTL_MS =
|
|
133
|
+
const PERMISSION_CACHE_TTL_MS = 3e5;
|
|
131
134
|
/** Notification kinds that include comment content and should be gated by author permission. */
|
|
132
135
|
const AUTHOR_GATED_NOTIFICATION_KINDS = /* @__PURE__ */ new Set(["pull-request-activity"]);
|
|
133
136
|
const createGithubTool = createTool;
|
|
@@ -637,7 +640,7 @@ var GitcrawlSyncClient = class {
|
|
|
637
640
|
if (fromEnvConfig) return fromEnvConfig;
|
|
638
641
|
}
|
|
639
642
|
try {
|
|
640
|
-
const { stdout } = await execFileAsync(this.#command, ["status", "--json"], { maxBuffer:
|
|
643
|
+
const { stdout } = await execFileAsync(this.#command, ["status", "--json"], { maxBuffer: 10485760 });
|
|
641
644
|
const status = JSON.parse(stdout);
|
|
642
645
|
const reported = readString(status.database_path) ?? readString(status.db_path);
|
|
643
646
|
if (reported) return resolveHomePath(reported);
|
|
@@ -661,7 +664,7 @@ var GitcrawlSyncClient = class {
|
|
|
661
664
|
"-json",
|
|
662
665
|
dbPath,
|
|
663
666
|
sql
|
|
664
|
-
], { maxBuffer:
|
|
667
|
+
], { maxBuffer: 10485760 });
|
|
665
668
|
return JSON.parse(stdout || "[]");
|
|
666
669
|
} catch (error) {
|
|
667
670
|
this.#dbPathPromise = void 0;
|
|
@@ -684,7 +687,7 @@ var GitcrawlSyncClient = class {
|
|
|
684
687
|
const { stdout, stderr } = await execFileAsync(this.#command, args, {
|
|
685
688
|
cwd: input.cwd,
|
|
686
689
|
signal: input.abortSignal,
|
|
687
|
-
maxBuffer:
|
|
690
|
+
maxBuffer: 10485760,
|
|
688
691
|
env: await resolveGithubAuthEnv()
|
|
689
692
|
});
|
|
690
693
|
return {
|
|
@@ -709,7 +712,7 @@ var GitcrawlSyncClient = class {
|
|
|
709
712
|
], {
|
|
710
713
|
cwd: input.cwd,
|
|
711
714
|
signal: input.abortSignal,
|
|
712
|
-
maxBuffer:
|
|
715
|
+
maxBuffer: 10485760
|
|
713
716
|
});
|
|
714
717
|
const thread = JSON.parse(stdout).threads?.find((item) => readNumber(item.number) === input.number);
|
|
715
718
|
if (!thread) return void 0;
|
|
@@ -1605,26 +1608,27 @@ var GithubSignals = class extends SignalProvider {
|
|
|
1605
1608
|
const agent = this.#getNotificationAgent(input.polling);
|
|
1606
1609
|
if (!agent?.sendNotificationSignal) return [];
|
|
1607
1610
|
const notifications = [];
|
|
1608
|
-
if (input.subscription.mode === "review")
|
|
1609
|
-
|
|
1610
|
-
snapshot: input.snapshot,
|
|
1611
|
-
terminalState: input.terminalState
|
|
1612
|
-
}));
|
|
1613
|
-
else {
|
|
1614
|
-
if (input.latestCommentChanged) notifications.push(classifyGithubCommentActivityNotification({
|
|
1611
|
+
if (input.subscription.mode === "review") {
|
|
1612
|
+
if (input.terminalState) notifications.push(classifyGithubTerminalActivityNotification({
|
|
1615
1613
|
subscription: input.subscription,
|
|
1616
|
-
snapshot: input.snapshot
|
|
1617
|
-
|
|
1618
|
-
if (input.headChanged) notifications.push(classifyGithubHeadActivityNotification({
|
|
1619
|
-
subscription: input.subscription,
|
|
1620
|
-
snapshot: input.snapshot
|
|
1621
|
-
}));
|
|
1622
|
-
if (input.reviewStateChanged) notifications.push(classifyGithubReviewStateActivityNotification({
|
|
1623
|
-
subscription: input.subscription,
|
|
1624
|
-
snapshot: input.snapshot
|
|
1614
|
+
snapshot: input.snapshot,
|
|
1615
|
+
terminalState: input.terminalState
|
|
1625
1616
|
}));
|
|
1626
|
-
|
|
1627
|
-
|
|
1617
|
+
else {
|
|
1618
|
+
if (input.latestCommentChanged) notifications.push(classifyGithubCommentActivityNotification({
|
|
1619
|
+
subscription: input.subscription,
|
|
1620
|
+
snapshot: input.snapshot
|
|
1621
|
+
}));
|
|
1622
|
+
if (input.headChanged) notifications.push(classifyGithubHeadActivityNotification({
|
|
1623
|
+
subscription: input.subscription,
|
|
1624
|
+
snapshot: input.snapshot
|
|
1625
|
+
}));
|
|
1626
|
+
if (input.reviewStateChanged) notifications.push(classifyGithubReviewStateActivityNotification({
|
|
1627
|
+
subscription: input.subscription,
|
|
1628
|
+
snapshot: input.snapshot
|
|
1629
|
+
}));
|
|
1630
|
+
}
|
|
1631
|
+
} else {
|
|
1628
1632
|
notifications.push(classifyGithubActivityNotification({
|
|
1629
1633
|
subscription: input.subscription,
|
|
1630
1634
|
snapshot: input.snapshot
|