paperclip-github-plugin 0.9.13 → 0.10.0

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
@@ -106,7 +106,7 @@ They can also link a Paperclip issue to a GitHub issue or pull request in any ac
106
106
  ## Requirements
107
107
 
108
108
  - Node.js 20+
109
- - a Paperclip host with plugin installation enabled. GitHub Sync is built and tested against Paperclip `2026.517.0`; the manifest relies on explicit capabilities instead of a strict host-version gate because current latest/development hosts can report `0.0.0` during plugin upgrade.
109
+ - a Paperclip host with plugin installation enabled. GitHub Sync is built and tested against Paperclip `2026.529.0`; the manifest relies on explicit capabilities instead of a strict host-version gate because current latest/development hosts can report `0.0.0` during plugin upgrade.
110
110
  - a GitHub token with API access to the repositories you want to sync
111
111
 
112
112
  ## Install from npm
@@ -186,7 +186,6 @@ 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 a scheduled 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 fires or is cleared.
190
189
  - 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`.
191
190
  - When the sync changes a Paperclip issue status, it adds a Paperclip comment explaining what changed and why.
192
191
 
@@ -366,8 +365,8 @@ Useful scripts:
366
365
 
367
366
  - `pnpm dev` watches the manifest, worker, and UI bundles and rebuilds them into `dist/`
368
367
  - `pnpm dev:ui` starts a local Paperclip plugin UI dev server from `dist/ui` on port `4177`
369
- - `pnpm test:e2e` builds the plugin, boots an isolated Paperclip `2026.517.0` instance, installs the plugin, and verifies the hosted settings page renders
370
- - `pnpm verify:manual` builds the plugin, boots a local-trusted Paperclip `2026.517.0` instance for manual inspection, seeds a `Dummy Company` with a mapped review project and a `CEO` agent on the Codex local adapter using model `gpt-5.4`, installs the plugin, and opens the company dashboard without seeding KPI history.
368
+ - `pnpm test:e2e` builds the plugin, boots an isolated Paperclip `2026.529.0` instance, installs the plugin, and verifies the hosted settings page renders
369
+ - `pnpm verify:manual` builds the plugin, boots a local-trusted Paperclip `2026.529.0` instance for manual inspection, seeds a `Dummy Company` with a mapped review project and a `CEO` agent on the Codex local adapter using model `gpt-5.4`, installs the plugin, and opens the company dashboard without seeding KPI history.
371
370
 
372
371
  For fast hosted UI iteration, run `pnpm dev` in one terminal and `pnpm dev:ui` in another.
373
372
 
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.13"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
645
+ var MANIFEST_VERSION = "0.10.0"?.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
@@ -836,6 +836,14 @@ var pluginRuntimeContext = null;
836
836
  function normalizeCompanyId(value) {
837
837
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
838
838
  }
839
+ function normalizeActionRecord(input, context) {
840
+ const record = input && typeof input === "object" ? { ...input } : {};
841
+ const scopedCompanyId = normalizeCompanyId(context?.companyId);
842
+ if (scopedCompanyId) {
843
+ record.companyId = scopedCompanyId;
844
+ }
845
+ return record;
846
+ }
839
847
  var activeSyncPromise = null;
840
848
  var activeRunningSyncState = null;
841
849
  var activeRunningSyncCompanyId;
@@ -5421,8 +5429,7 @@ function normalizePaperclipIssueExecutionState(value) {
5421
5429
  const lastDecisionId = normalizeOptionalString2(record.lastDecisionId) ?? null;
5422
5430
  const lastDecisionOutcome = normalizeOptionalString2(record.lastDecisionOutcome) ?? null;
5423
5431
  const completedStageIds = Array.isArray(record.completedStageIds) ? record.completedStageIds.map((stageId) => normalizeOptionalString2(stageId)).filter((stageId) => Boolean(stageId)) : [];
5424
- const monitor = normalizePaperclipIssueMonitorState(record.monitor);
5425
- if (!status && currentStageId === null && currentStageIndex === null && currentStageType === null && currentParticipant === null && returnAssignee === null && completedStageIds.length === 0 && lastDecisionId === null && lastDecisionOutcome === null && monitor === null) {
5432
+ if (!status && currentStageId === null && currentStageIndex === null && currentStageType === null && currentParticipant === null && returnAssignee === null && completedStageIds.length === 0 && lastDecisionId === null && lastDecisionOutcome === null) {
5426
5433
  return null;
5427
5434
  }
5428
5435
  return {
@@ -5434,25 +5441,7 @@ function normalizePaperclipIssueExecutionState(value) {
5434
5441
  returnAssignee,
5435
5442
  completedStageIds,
5436
5443
  ...lastDecisionId !== null ? { lastDecisionId } : {},
5437
- ...lastDecisionOutcome !== null ? { lastDecisionOutcome } : {},
5438
- ...monitor !== null ? { monitor } : {}
5439
- };
5440
- }
5441
- function normalizePaperclipIssueMonitorState(value) {
5442
- if (!value || typeof value !== "object") {
5443
- return null;
5444
- }
5445
- const record = value;
5446
- const status = normalizeOptionalString2(record.status);
5447
- const clearedAt = normalizeOptionalString2(record.clearedAt) ?? null;
5448
- const clearReason = normalizeOptionalString2(record.clearReason) ?? null;
5449
- if (!status && clearedAt === null && clearReason === null && Object.keys(record).length === 0) {
5450
- return null;
5451
- }
5452
- return {
5453
- ...status ? { status } : {},
5454
- clearedAt,
5455
- clearReason
5444
+ ...lastDecisionOutcome !== null ? { lastDecisionOutcome } : {}
5456
5445
  };
5457
5446
  }
5458
5447
  function getPaperclipIssueAssigneePrincipal(issue) {
@@ -5478,17 +5467,6 @@ function getPaperclipIssueSyncContext(issue) {
5478
5467
  executionState: normalizePaperclipIssueExecutionState(record.executionState)
5479
5468
  };
5480
5469
  }
5481
- function hasScheduledPaperclipIssueMonitor(syncContext) {
5482
- const monitor = syncContext.executionState?.monitor;
5483
- if (!monitor) {
5484
- return false;
5485
- }
5486
- if (monitor.clearedAt || monitor.clearReason) {
5487
- return false;
5488
- }
5489
- const normalizedStatus = monitor.status?.trim().toLowerCase();
5490
- return normalizedStatus === "scheduled";
5491
- }
5492
5470
  function hasUnresolvedPaperclipIssueBlockerSummary(blockers) {
5493
5471
  if (!Array.isArray(blockers)) {
5494
5472
  return false;
@@ -5708,13 +5686,6 @@ function isClearableMaintainerWaitExecutionState(executionState) {
5708
5686
  if (executionState === null) {
5709
5687
  return true;
5710
5688
  }
5711
- if (hasScheduledPaperclipIssueMonitor({
5712
- assignee: null,
5713
- executionPolicy: null,
5714
- executionState
5715
- })) {
5716
- return false;
5717
- }
5718
5689
  if (executionState.currentParticipant !== null || executionState.returnAssignee !== null || executionState.currentStageId !== null || executionState.currentStageIndex !== null || executionState.currentStageType !== null || executionState.completedStageIds.length > 0 || executionState.lastDecisionId || executionState.lastDecisionOutcome) {
5719
5690
  return false;
5720
5691
  }
@@ -9559,18 +9530,6 @@ async function cancelUnmappedTransferredGitHubIssue(ctx, params) {
9559
9530
  };
9560
9531
  }
9561
9532
  const paperclipIssueSyncContext = getPaperclipIssueSyncContext(paperclipIssue);
9562
- if (hasScheduledPaperclipIssueMonitor(paperclipIssueSyncContext)) {
9563
- ctx.logger.info("GitHub sync skipped transferred issue cancellation because an issue monitor is scheduled.", {
9564
- companyId,
9565
- issueId: params.importedIssue.paperclipIssueId,
9566
- transferredRepositoryUrl: params.transferredRepository.url,
9567
- currentStatus: paperclipIssue.status,
9568
- resolvedStatus: "cancelled"
9569
- });
9570
- return {
9571
- updatedStatusesCount: 0
9572
- };
9573
- }
9574
9533
  await unlinkPaperclipIssueFromGitHub(ctx, {
9575
9534
  companyId,
9576
9535
  issueId: params.importedIssue.paperclipIssueId
@@ -9899,17 +9858,6 @@ async function synchronizePaperclipIssueStatuses(ctx, octokit, repository, mappi
9899
9858
  importedIssue.lastSeenCommentCount = snapshot.commentCount;
9900
9859
  importedIssue.lastSeenGitHubState = snapshot.state;
9901
9860
  importedIssue.linkedPullRequestCommentCounts = currentLinkedPullRequestCommentCounts;
9902
- if (hasScheduledPaperclipIssueMonitor(paperclipIssueSyncContext)) {
9903
- ctx.logger.info("GitHub sync skipped Paperclip issue state changes because an issue monitor is scheduled.", {
9904
- companyId: mapping.companyId,
9905
- issueId: importedIssue.paperclipIssueId,
9906
- repositoryUrl: repository.url,
9907
- githubIssueNumber: githubIssue.number,
9908
- currentStatus: paperclipIssue.status,
9909
- resolvedStatus: nextStatus
9910
- });
9911
- continue;
9912
- }
9913
9861
  if (paperclipIssue.status === nextStatus) {
9914
9862
  if (shouldClearTransitionAssignee || shouldClearCompletedExecutionPolicy) {
9915
9863
  updateSyncFailureContext(syncFailureContext, {
@@ -10166,16 +10114,6 @@ async function synchronizePaperclipPullRequestIssueStatuses(ctx, octokit, mappin
10166
10114
  const shouldClearTransitionAssignee = nextStatus === "in_review" && (nextTransitionAssignee === null || shouldPreserveMaintainerWaitRouting) && paperclipIssueSyncContext.assignee !== null;
10167
10115
  const nextAssigneeChanged = nextTransitionAssignee ? !doesPaperclipIssueAssigneeMatch(paperclipIssueSyncContext.assignee, nextTransitionAssignee.principal) : false;
10168
10116
  const shouldWakeTransitionAssignee = paperclipIssue.status !== nextStatus && nextTransitionAssignee?.principal.kind === "agent" && isActionablePaperclipIssueStatus(nextStatus) && (nextAssigneeChanged || paperclipIssue.status !== nextStatus);
10169
- if (hasScheduledPaperclipIssueMonitor(paperclipIssueSyncContext)) {
10170
- ctx.logger.info("GitHub sync skipped Paperclip pull request issue state changes because an issue monitor is scheduled.", {
10171
- companyId: mapping.companyId,
10172
- issueId: paperclipIssueId,
10173
- repositoryUrl: primaryRepository?.url,
10174
- currentStatus: paperclipIssue.status,
10175
- resolvedStatus: nextStatus
10176
- });
10177
- continue;
10178
- }
10179
10117
  if (paperclipIssue.status === nextStatus) {
10180
10118
  if (shouldClearTransitionAssignee || shouldClearCompletedExecutionPolicy) {
10181
10119
  updateSyncFailureContext(syncFailureContext, {
@@ -15978,8 +15916,8 @@ var plugin = definePlugin({
15978
15916
  const record = input && typeof input === "object" ? input : {};
15979
15917
  return buildCommentAnnotationData(ctx, record);
15980
15918
  });
15981
- ctx.actions.register("issue.linkGitHubItem", async (input) => {
15982
- const record = input && typeof input === "object" ? input : {};
15919
+ ctx.actions.register("issue.linkGitHubItem", async (input, actionContext) => {
15920
+ const record = normalizeActionRecord(input, actionContext);
15983
15921
  const kind = normalizeIssueGitHubLinkKind(record.kind);
15984
15922
  if (!kind) {
15985
15923
  throw new Error('kind must be "issue" or "pull_request".');
@@ -16006,8 +15944,8 @@ var plugin = definePlugin({
16006
15944
  requireUnlinked: true
16007
15945
  });
16008
15946
  });
16009
- ctx.actions.register("issue.unlinkGitHubItem", async (input) => {
16010
- const record = input && typeof input === "object" ? input : {};
15947
+ ctx.actions.register("issue.unlinkGitHubItem", async (input, actionContext) => {
15948
+ const record = normalizeActionRecord(input, actionContext);
16011
15949
  const companyId = normalizeCompanyId(record.companyId);
16012
15950
  const issueId = normalizeOptionalString2(record.issueId);
16013
15951
  if (!companyId || !issueId) {
@@ -16018,10 +15956,10 @@ var plugin = definePlugin({
16018
15956
  issueId
16019
15957
  });
16020
15958
  });
16021
- ctx.actions.register("settings.saveRegistration", async (input) => {
15959
+ ctx.actions.register("settings.saveRegistration", async (input, actionContext) => {
16022
15960
  const previous = normalizeSettings(await ctx.state.get(SETTINGS_SCOPE));
16023
15961
  const config = await getResolvedConfig(ctx);
16024
- const record = input && typeof input === "object" ? input : {};
15962
+ const record = normalizeActionRecord(input, actionContext);
16025
15963
  const requestedCompanyId = normalizeCompanyId(record.companyId);
16026
15964
  const requestedGitHubTokenLogin = "githubTokenLogin" in record ? normalizeOptionalString2(record.githubTokenLogin) : void 0;
16027
15965
  const hasMappingsPatch = "mappings" in record;
@@ -16123,10 +16061,10 @@ var plugin = definePlugin({
16123
16061
  availableAssignees: requestedCompanyId ? await listAvailableAssignees(ctx, requestedCompanyId, next) : []
16124
16062
  };
16125
16063
  });
16126
- ctx.actions.register("settings.updateBoardAccess", async (input) => {
16064
+ ctx.actions.register("settings.updateBoardAccess", async (input, actionContext) => {
16127
16065
  const previous = normalizeSettings(await ctx.state.get(SETTINGS_SCOPE));
16128
16066
  const config = await getResolvedConfig(ctx);
16129
- const record = input && typeof input === "object" ? input : {};
16067
+ const record = normalizeActionRecord(input, actionContext);
16130
16068
  const companyId = normalizeCompanyId(record.companyId);
16131
16069
  if (!companyId) {
16132
16070
  throw new Error("A company id is required to update Paperclip board access.");
@@ -16197,16 +16135,17 @@ var plugin = definePlugin({
16197
16135
  paperclipBoardAccessConfigured: hasConfiguredPaperclipBoardAccess(next, config, companyId)
16198
16136
  };
16199
16137
  });
16200
- ctx.actions.register("settings.validateToken", async (input) => {
16201
- const token = input && typeof input === "object" && "token" in input ? input.token : void 0;
16138
+ ctx.actions.register("settings.validateToken", async (input, actionContext) => {
16139
+ const record = normalizeActionRecord(input, actionContext);
16140
+ const token = "token" in record ? record.token : void 0;
16202
16141
  const trimmedToken = typeof token === "string" ? token.trim() : "";
16203
16142
  if (!trimmedToken) {
16204
16143
  throw new Error("Enter a GitHub token.");
16205
16144
  }
16206
16145
  return validateGithubToken(ctx, trimmedToken);
16207
16146
  });
16208
- ctx.actions.register("settings.ensureGitHubTokenAvailable", async (input) => {
16209
- const record = input && typeof input === "object" ? input : {};
16147
+ ctx.actions.register("settings.ensureGitHubTokenAvailable", async (input, actionContext) => {
16148
+ const record = normalizeActionRecord(input, actionContext);
16210
16149
  const companyId = normalizeCompanyId(record.companyId);
16211
16150
  const githubTokenRef = normalizeSecretRef(record.githubTokenRef);
16212
16151
  const token = normalizeGitHubToken(record.token);
@@ -16243,48 +16182,49 @@ var plugin = definePlugin({
16243
16182
  fallbackStored: true
16244
16183
  };
16245
16184
  });
16246
- ctx.actions.register("project.pullRequests.createIssue", async (input) => {
16247
- const record = input && typeof input === "object" ? input : {};
16185
+ ctx.actions.register("project.pullRequests.createIssue", async (input, actionContext) => {
16186
+ const record = normalizeActionRecord(input, actionContext);
16248
16187
  return createProjectPullRequestPaperclipIssue(ctx, record);
16249
16188
  });
16250
- ctx.actions.register("project.pullRequests.refresh", async (input) => {
16251
- const record = input && typeof input === "object" ? input : {};
16189
+ ctx.actions.register("project.pullRequests.refresh", async (input, actionContext) => {
16190
+ const record = normalizeActionRecord(input, actionContext);
16252
16191
  return refreshProjectPullRequests(ctx, record);
16253
16192
  });
16254
- ctx.actions.register("project.pullRequests.updateBranch", async (input) => {
16255
- const record = input && typeof input === "object" ? input : {};
16193
+ ctx.actions.register("project.pullRequests.updateBranch", async (input, actionContext) => {
16194
+ const record = normalizeActionRecord(input, actionContext);
16256
16195
  return updateProjectPullRequestBranch(ctx, record);
16257
16196
  });
16258
- ctx.actions.register("project.pullRequests.requestCopilotAction", async (input) => {
16259
- const record = input && typeof input === "object" ? input : {};
16197
+ ctx.actions.register("project.pullRequests.requestCopilotAction", async (input, actionContext) => {
16198
+ const record = normalizeActionRecord(input, actionContext);
16260
16199
  return requestProjectPullRequestCopilotAction(ctx, record);
16261
16200
  });
16262
- ctx.actions.register("project.pullRequests.merge", async (input) => {
16263
- const record = input && typeof input === "object" ? input : {};
16201
+ ctx.actions.register("project.pullRequests.merge", async (input, actionContext) => {
16202
+ const record = normalizeActionRecord(input, actionContext);
16264
16203
  return mergeProjectPullRequest(ctx, record);
16265
16204
  });
16266
- ctx.actions.register("project.pullRequests.close", async (input) => {
16267
- const record = input && typeof input === "object" ? input : {};
16205
+ ctx.actions.register("project.pullRequests.close", async (input, actionContext) => {
16206
+ const record = normalizeActionRecord(input, actionContext);
16268
16207
  return closeProjectPullRequest(ctx, record);
16269
16208
  });
16270
- ctx.actions.register("project.pullRequests.addComment", async (input) => {
16271
- const record = input && typeof input === "object" ? input : {};
16209
+ ctx.actions.register("project.pullRequests.addComment", async (input, actionContext) => {
16210
+ const record = normalizeActionRecord(input, actionContext);
16272
16211
  return addProjectPullRequestComment(ctx, record);
16273
16212
  });
16274
- ctx.actions.register("project.pullRequests.review", async (input) => {
16275
- const record = input && typeof input === "object" ? input : {};
16213
+ ctx.actions.register("project.pullRequests.review", async (input, actionContext) => {
16214
+ const record = normalizeActionRecord(input, actionContext);
16276
16215
  return reviewProjectPullRequest(ctx, record);
16277
16216
  });
16278
- ctx.actions.register("project.pullRequests.rerunCi", async (input) => {
16279
- const record = input && typeof input === "object" ? input : {};
16217
+ ctx.actions.register("project.pullRequests.rerunCi", async (input, actionContext) => {
16218
+ const record = normalizeActionRecord(input, actionContext);
16280
16219
  return rerunProjectPullRequestCi(ctx, record);
16281
16220
  });
16282
- ctx.actions.register("sync.runNow", async (input) => {
16283
- const waitForCompletion = input && typeof input === "object" && "waitForCompletion" in input ? Boolean(input.waitForCompletion) : false;
16284
- const paperclipApiBaseUrl = input && typeof input === "object" && "paperclipApiBaseUrl" in input ? input.paperclipApiBaseUrl : void 0;
16285
- const companyId = input && typeof input === "object" && "companyId" in input && typeof input.companyId === "string" ? input.companyId : void 0;
16286
- const projectId = input && typeof input === "object" && "projectId" in input && typeof input.projectId === "string" ? input.projectId : void 0;
16287
- const issueId = input && typeof input === "object" && "issueId" in input && typeof input.issueId === "string" ? input.issueId : void 0;
16221
+ ctx.actions.register("sync.runNow", async (input, actionContext) => {
16222
+ const record = normalizeActionRecord(input, actionContext);
16223
+ const waitForCompletion = "waitForCompletion" in record ? Boolean(record.waitForCompletion) : false;
16224
+ const paperclipApiBaseUrl = "paperclipApiBaseUrl" in record ? record.paperclipApiBaseUrl : void 0;
16225
+ const companyId = "companyId" in record && typeof record.companyId === "string" ? record.companyId : void 0;
16226
+ const projectId = "projectId" in record && typeof record.projectId === "string" ? record.projectId : void 0;
16227
+ const issueId = "issueId" in record && typeof record.issueId === "string" ? record.issueId : void 0;
16288
16228
  const currentSettings = normalizeSettings(await ctx.state.get(SETTINGS_SCOPE));
16289
16229
  const target = await resolveManualSyncTarget(ctx, currentSettings, {
16290
16230
  ...companyId ? { companyId } : {},
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.9.13",
3
+ "version": "0.10.0",
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.2.2",
7
+ "packageManager": "pnpm@11.5.0",
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.517.0",
44
+ "@paperclipai/plugin-sdk": "^2026.529.0",
45
45
  "react": "^19.2.6",
46
46
  "react-markdown": "^10.1.0",
47
47
  "rehype-raw": "^7.0.0",