patchrelay 0.31.0 → 0.32.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.
- package/dist/build-info.json +3 -3
- package/dist/cli/commands/watch.js +9 -3
- package/dist/cli/watch/App.js +9 -4
- package/dist/cli/watch/HelpBar.js +2 -2
- package/dist/cli/watch/IssueDetailView.js +89 -1
- package/dist/cli/watch/IssueListView.js +8 -3
- package/dist/cli/watch/IssueRow.js +58 -5
- package/dist/cli/watch/StatusBar.js +2 -2
- package/dist/cli/watch/use-detail-stream.js +4 -2
- package/dist/cli/watch/use-watch-stream.js +3 -1
- package/dist/db/linear-installation-store.js +67 -3
- package/dist/db/migrations.js +10 -0
- package/dist/db.js +68 -2
- package/dist/github-failure-context.js +93 -0
- package/dist/github-webhook-handler.js +187 -19
- package/dist/linear-client.js +3 -3
- package/dist/run-orchestrator.js +39 -15
- package/dist/service.js +5 -1
- package/dist/webhook-handler.js +15 -1
- package/package.json +3 -3
package/dist/webhook-handler.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { buildAgentSessionPlanForIssue, } from "./agent-session-plan.js";
|
|
2
2
|
import { buildAgentSessionExternalUrls } from "./agent-session-presentation.js";
|
|
3
|
+
import { TERMINAL_STATES } from "./factory-state.js";
|
|
3
4
|
import { buildAlreadyRunningThought, buildDelegationThought, buildPromptDeliveredThought, buildStopConfirmationActivity, } from "./linear-session-reporting.js";
|
|
4
5
|
import { resolveProject, triggerEventAllowed, trustedActorAllowed } from "./project-resolution.js";
|
|
5
6
|
import { normalizeWebhook } from "./webhooks.js";
|
|
@@ -161,8 +162,9 @@ export class WebhookHandler {
|
|
|
161
162
|
const hydratedIssue = await this.syncIssueDependencies(project.id, normalizedIssue);
|
|
162
163
|
const unresolvedBlockers = this.db.countUnresolvedBlockers(project.id, normalizedIssue.id);
|
|
163
164
|
const pendingRunContextJson = mergePendingImplementationContext(existingIssue?.pendingRunContextJson, normalized);
|
|
165
|
+
const terminalForAutomation = isTerminalDelegationState(existingIssue, hydratedIssue);
|
|
164
166
|
let pendingRunType;
|
|
165
|
-
if (delegated && triggerAllowed && unresolvedBlockers === 0 && !activeRun && !existingIssue?.pendingRunType) {
|
|
167
|
+
if (delegated && triggerAllowed && unresolvedBlockers === 0 && !activeRun && !existingIssue?.pendingRunType && !terminalForAutomation) {
|
|
166
168
|
pendingRunType = "implementation";
|
|
167
169
|
}
|
|
168
170
|
const clearPendingImplementation = unresolvedBlockers > 0 && existingIssue?.pendingRunType === "implementation" && !activeRun;
|
|
@@ -537,6 +539,18 @@ export class WebhookHandler {
|
|
|
537
539
|
return undefined;
|
|
538
540
|
}
|
|
539
541
|
}
|
|
542
|
+
function isResolvedLinearState(stateType, stateName) {
|
|
543
|
+
return stateType === "completed" || stateName?.trim().toLowerCase() === "done";
|
|
544
|
+
}
|
|
545
|
+
function isTerminalDelegationState(existingIssue, hydratedIssue) {
|
|
546
|
+
if (existingIssue?.prState === "merged") {
|
|
547
|
+
return true;
|
|
548
|
+
}
|
|
549
|
+
if (existingIssue?.factoryState && TERMINAL_STATES.has(existingIssue.factoryState)) {
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
return isResolvedLinearState(hydratedIssue.stateType, hydratedIssue.stateName);
|
|
553
|
+
}
|
|
540
554
|
function hasCompleteIssueContext(issue) {
|
|
541
555
|
return Boolean(issue.stateName && issue.delegateId && issue.teamId && issue.teamKey);
|
|
542
556
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "patchrelay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"prepack": "npm run build",
|
|
34
34
|
"start": "node dist/index.js serve",
|
|
35
35
|
"doctor": "node dist/index.js doctor",
|
|
36
|
-
"restart": "node dist/index.js restart
|
|
37
|
-
"deploy": "npm run build && npm install -g . && node dist/index.js restart
|
|
36
|
+
"restart": "node dist/index.js service restart",
|
|
37
|
+
"deploy": "npm run build && npm install -g . && node dist/index.js service restart",
|
|
38
38
|
"lint": "eslint .",
|
|
39
39
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
40
40
|
"check": "npm run typecheck",
|