paperclip-github-plugin 0.9.7 → 0.9.8

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/README.md CHANGED
@@ -186,6 +186,7 @@ Additional behavior:
186
186
  - Sync-driven handoffs to agent assignees best-effort enqueue an explicit wakeup so the next reviewer, approver, or executor can pick the issue up even when their agent is not running heartbeats.
187
187
  - Open imported issues that are already in `backlog` stay in `backlog` until someone changes them in Paperclip.
188
188
  - If an imported issue is `done` or `cancelled` and GitHub shows it open again with no linked pull request, sync moves it to `todo` so agents can pick it up again.
189
+ - When an issue has an active Paperclip issue monitor, GitHub Sync lets that monitor own the wait. It still refreshes GitHub metadata, but it does not change the issue's Paperclip status, assignee, execution state, transition comments, or wakeups until the monitor is no longer active.
189
190
  - Trusted new GitHub comments from the original issue author or a verified maintainer/admin can move an open imported issue back into active work, whether the new comment lands on the source issue, in a linked pull request's top-level comment stream, or in a linked pull request review thread; GitHub Sync uses `in_progress` when it can route the issue to an executor and otherwise `todo`.
190
191
  - When the sync changes a Paperclip issue status, it adds a Paperclip comment explaining what changed and why.
191
192
 
package/dist/manifest.js CHANGED
@@ -642,7 +642,7 @@ var PULL_REQUEST_ASSET_API_ROUTE_URL_PATH = `/api/plugins/${GITHUB_SYNC_PLUGIN_I
642
642
  var require2 = createRequire(import.meta.url);
643
643
  var packageJson = require2("../package.json");
644
644
  var SCHEDULE_TICK_CRON = "* * * * *";
645
- var MANIFEST_VERSION = "0.9.7"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
645
+ var MANIFEST_VERSION = "0.9.8"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
646
646
  var manifest = {
647
647
  id: GITHUB_SYNC_PLUGIN_ID,
648
648
  apiVersion: 1,
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,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "Paperclip plugin for synchronizing GitHub issues into Paperclip projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -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.0",
57
57
  "typescript": "6.0.3"
58
58
  }
59
59
  }