paperclip-github-plugin 0.9.7 → 0.9.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/worker.js CHANGED
@@ -5418,7 +5418,8 @@ function normalizePaperclipIssueExecutionState(value) {
5418
5418
  const lastDecisionId = normalizeOptionalString2(record.lastDecisionId) ?? null;
5419
5419
  const lastDecisionOutcome = normalizeOptionalString2(record.lastDecisionOutcome) ?? null;
5420
5420
  const completedStageIds = Array.isArray(record.completedStageIds) ? record.completedStageIds.map((stageId) => normalizeOptionalString2(stageId)).filter((stageId) => Boolean(stageId)) : [];
5421
- if (!status && currentStageId === null && currentStageIndex === null && currentStageType === null && currentParticipant === null && returnAssignee === null && completedStageIds.length === 0 && lastDecisionId === null && lastDecisionOutcome === null) {
5421
+ const monitor = normalizePaperclipIssueMonitorState(record.monitor);
5422
+ if (!status && currentStageId === null && currentStageIndex === null && currentStageType === null && currentParticipant === null && returnAssignee === null && completedStageIds.length === 0 && lastDecisionId === null && lastDecisionOutcome === null && monitor === null) {
5422
5423
  return null;
5423
5424
  }
5424
5425
  return {
@@ -5430,7 +5431,25 @@ function normalizePaperclipIssueExecutionState(value) {
5430
5431
  returnAssignee,
5431
5432
  completedStageIds,
5432
5433
  ...lastDecisionId !== null ? { lastDecisionId } : {},
5433
- ...lastDecisionOutcome !== null ? { lastDecisionOutcome } : {}
5434
+ ...lastDecisionOutcome !== null ? { lastDecisionOutcome } : {},
5435
+ ...monitor !== null ? { monitor } : {}
5436
+ };
5437
+ }
5438
+ function normalizePaperclipIssueMonitorState(value) {
5439
+ if (!value || typeof value !== "object") {
5440
+ return null;
5441
+ }
5442
+ const record = value;
5443
+ const status = normalizeOptionalString2(record.status);
5444
+ const clearedAt = normalizeOptionalString2(record.clearedAt) ?? null;
5445
+ const clearReason = normalizeOptionalString2(record.clearReason) ?? null;
5446
+ if (!status && clearedAt === null && clearReason === null && Object.keys(record).length === 0) {
5447
+ return null;
5448
+ }
5449
+ return {
5450
+ ...status ? { status } : {},
5451
+ clearedAt,
5452
+ clearReason
5434
5453
  };
5435
5454
  }
5436
5455
  function getPaperclipIssueAssigneePrincipal(issue) {
@@ -5456,6 +5475,17 @@ function getPaperclipIssueSyncContext(issue) {
5456
5475
  executionState: normalizePaperclipIssueExecutionState(record.executionState)
5457
5476
  };
5458
5477
  }
5478
+ function hasActivePaperclipIssueMonitor(syncContext) {
5479
+ const monitor = syncContext.executionState?.monitor;
5480
+ if (!monitor) {
5481
+ return false;
5482
+ }
5483
+ if (monitor.clearedAt || monitor.clearReason) {
5484
+ return false;
5485
+ }
5486
+ const normalizedStatus = monitor.status?.trim().toLowerCase();
5487
+ return normalizedStatus !== "cleared" && normalizedStatus !== "completed" && normalizedStatus !== "cancelled" && normalizedStatus !== "canceled";
5488
+ }
5459
5489
  function hasUnresolvedPaperclipIssueBlockerSummary(blockers) {
5460
5490
  if (!Array.isArray(blockers)) {
5461
5491
  return false;
@@ -5675,6 +5705,13 @@ function isClearableMaintainerWaitExecutionState(executionState) {
5675
5705
  if (executionState === null) {
5676
5706
  return true;
5677
5707
  }
5708
+ if (hasActivePaperclipIssueMonitor({
5709
+ assignee: null,
5710
+ executionPolicy: null,
5711
+ executionState
5712
+ })) {
5713
+ return false;
5714
+ }
5678
5715
  if (executionState.currentParticipant !== null || executionState.returnAssignee !== null || executionState.currentStageId !== null || executionState.currentStageIndex !== null || executionState.currentStageType !== null || executionState.completedStageIds.length > 0 || executionState.lastDecisionId || executionState.lastDecisionOutcome) {
5679
5716
  return false;
5680
5717
  }
@@ -9518,6 +9555,19 @@ async function cancelUnmappedTransferredGitHubIssue(ctx, params) {
9518
9555
  updatedStatusesCount: 0
9519
9556
  };
9520
9557
  }
9558
+ const paperclipIssueSyncContext = getPaperclipIssueSyncContext(paperclipIssue);
9559
+ if (hasActivePaperclipIssueMonitor(paperclipIssueSyncContext)) {
9560
+ ctx.logger.info("GitHub sync skipped transferred issue cancellation because an issue monitor is active.", {
9561
+ companyId,
9562
+ issueId: params.importedIssue.paperclipIssueId,
9563
+ transferredRepositoryUrl: params.transferredRepository.url,
9564
+ currentStatus: paperclipIssue.status,
9565
+ resolvedStatus: "cancelled"
9566
+ });
9567
+ return {
9568
+ updatedStatusesCount: 0
9569
+ };
9570
+ }
9521
9571
  await unlinkPaperclipIssueFromGitHub(ctx, {
9522
9572
  companyId,
9523
9573
  issueId: params.importedIssue.paperclipIssueId
@@ -9527,7 +9577,7 @@ async function cancelUnmappedTransferredGitHubIssue(ctx, params) {
9527
9577
  companyId,
9528
9578
  issueId: params.importedIssue.paperclipIssueId,
9529
9579
  currentStatus: paperclipIssue.status,
9530
- syncContext: getPaperclipIssueSyncContext(paperclipIssue),
9580
+ syncContext: paperclipIssueSyncContext,
9531
9581
  nextStatus,
9532
9582
  transitionComment: buildUnmappedTransferredIssueCancellationComment({
9533
9583
  previousStatus: paperclipIssue.status,
@@ -9846,6 +9896,17 @@ async function synchronizePaperclipIssueStatuses(ctx, octokit, repository, mappi
9846
9896
  importedIssue.lastSeenCommentCount = snapshot.commentCount;
9847
9897
  importedIssue.lastSeenGitHubState = snapshot.state;
9848
9898
  importedIssue.linkedPullRequestCommentCounts = currentLinkedPullRequestCommentCounts;
9899
+ if (hasActivePaperclipIssueMonitor(paperclipIssueSyncContext)) {
9900
+ ctx.logger.info("GitHub sync skipped Paperclip issue state changes because an issue monitor is active.", {
9901
+ companyId: mapping.companyId,
9902
+ issueId: importedIssue.paperclipIssueId,
9903
+ repositoryUrl: repository.url,
9904
+ githubIssueNumber: githubIssue.number,
9905
+ currentStatus: paperclipIssue.status,
9906
+ resolvedStatus: nextStatus
9907
+ });
9908
+ continue;
9909
+ }
9849
9910
  if (paperclipIssue.status === nextStatus) {
9850
9911
  if (shouldClearTransitionAssignee || shouldClearCompletedExecutionPolicy) {
9851
9912
  updateSyncFailureContext(syncFailureContext, {
@@ -10102,6 +10163,16 @@ async function synchronizePaperclipPullRequestIssueStatuses(ctx, octokit, mappin
10102
10163
  const shouldClearTransitionAssignee = nextStatus === "in_review" && (nextTransitionAssignee === null || shouldPreserveMaintainerWaitRouting) && paperclipIssueSyncContext.assignee !== null;
10103
10164
  const nextAssigneeChanged = nextTransitionAssignee ? !doesPaperclipIssueAssigneeMatch(paperclipIssueSyncContext.assignee, nextTransitionAssignee.principal) : false;
10104
10165
  const shouldWakeTransitionAssignee = paperclipIssue.status !== nextStatus && nextTransitionAssignee?.principal.kind === "agent" && isActionablePaperclipIssueStatus(nextStatus) && (nextAssigneeChanged || paperclipIssue.status !== nextStatus);
10166
+ if (hasActivePaperclipIssueMonitor(paperclipIssueSyncContext)) {
10167
+ ctx.logger.info("GitHub sync skipped Paperclip pull request issue state changes because an issue monitor is active.", {
10168
+ companyId: mapping.companyId,
10169
+ issueId: paperclipIssueId,
10170
+ repositoryUrl: primaryRepository?.url,
10171
+ currentStatus: paperclipIssue.status,
10172
+ resolvedStatus: nextStatus
10173
+ });
10174
+ continue;
10175
+ }
10105
10176
  if (paperclipIssue.status === nextStatus) {
10106
10177
  if (shouldClearTransitionAssignee || shouldClearCompletedExecutionPolicy) {
10107
10178
  updateSyncFailureContext(syncFailureContext, {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "Paperclip plugin for synchronizing GitHub issues into Paperclip projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
- "packageManager": "pnpm@11.0.9",
7
+ "packageManager": "pnpm@11.1.2",
8
8
  "engines": {
9
9
  "node": ">=20"
10
10
  },
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@octokit/rest": "^22.0.1",
44
- "@paperclipai/plugin-sdk": "^2026.512.0",
44
+ "@paperclipai/plugin-sdk": "^2026.517.0",
45
45
  "react": "^19.2.6",
46
46
  "react-markdown": "^10.1.0",
47
47
  "rehype-raw": "^7.0.0",
@@ -49,11 +49,11 @@
49
49
  "remark-gfm": "^4.0.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@types/node": "24.12.3",
52
+ "@types/node": "24.12.4",
53
53
  "@types/react": "19.2.14",
54
54
  "esbuild": "0.28.0",
55
- "playwright": "1.59.1",
56
- "tsx": "4.21.0",
55
+ "playwright": "1.60.0",
56
+ "tsx": "4.22.1",
57
57
  "typescript": "6.0.3"
58
58
  }
59
59
  }