paperclip-github-plugin 0.15.0 → 0.15.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/README.md CHANGED
@@ -102,6 +102,20 @@ Operators can unlink a linked Paperclip issue from the GitHub detail surface whe
102
102
  Paperclip agents can search GitHub for duplicates, read and update issues, assign issues to the saved token owner, post comments, create pull requests, inspect changed files and CI, reply to review threads, resolve or unresolve threads, request reviewers, search org-level GitHub Projects, and associate pull requests with those projects without leaving the Paperclip plugin surface.
103
103
  They can also link a Paperclip issue to a GitHub issue or pull request in any accessible repository with `link_github_item`, including third-party repositories that are not mapped to a Paperclip project.
104
104
 
105
+ ### Issue interaction ledger and 30-day summary
106
+
107
+ GitHub Sync keeps a forward-only, issue-scoped interaction ledger in `paperclip-github-plugin.issue-interaction-event` entities. It captures sync status decisions (changes and meaningful no-ops, including direct-PR status paths) and issue-scoped mutating GitHub agent tool attempts. Each mutation records a uniquely identified durable intent before execution and a separate result afterward; known mutation/comment/annotation failures receive failed results, while only unmatched structured intent events are reported as uncertain attempts. Events use content-addressed entity IDs so concurrent identical writes converge without allowing different payloads to overwrite one another. Agent/run/model attribution and normalized remote identifiers are retained when available, including identifiers resolved from Paperclip issue/PR links, derived from `reference` and `pullRequestUrl` inputs, and returned by newly created GitHub items; HTTP(S) metadata has userinfo, query strings, and fragments removed, and raw issue or comment bodies, logs, credentials, secret references, headers, and provider payloads are never stored. Required intent persistence failures prevent the mutation, while intent/result persistence failures return structured tool errors instead of rejecting the tool call or silently reporting a fully recorded mutation.
108
+
109
+ Agents can call `get_issue_interaction_summary` with:
110
+
111
+ - `paperclipIssueId` (required)
112
+ - `from` (optional inclusive ISO timestamp)
113
+ - `to` (optional exclusive ISO timestamp)
114
+
115
+ The authenticated tool-run company is authoritative. The worker verifies the issue in that company and rejects cross-company access. The default range is the 30 days ending now, custom ranges use UTC `[from,to)` semantics, and no query may exceed 30 days. Results are deterministic compact JSON with coverage metadata, counts for events/runs/comments/mutating-tool attempts/remote writes/status decisions/transitions/failures/no-ops, ordered transitions, repeated-action and reversal signals, and explicit limitations.
116
+
117
+ Coverage is dimensioned rather than reported as one misleading complete flag: the response marks overall history incomplete, reports the plugin-ledger start and window completeness separately, and explicitly states that Paperclip core history and arbitrary external GitHub history are not included. Malformed rows, conflicting logical dedupe keys, or the 5,000-row scan safety cutoff make plugin-ledger coverage incomplete and are reported in integrity/truncation metadata; transitions and repeated-action details are also capped while aggregate counts remain bounded by that scan. The ledger starts with the earliest captured valid event for that issue; GitHub Sync does not reconstruct earlier history. GitHub actions performed outside captured plugin paths are absent, and mutating tools only produce issue-ledger entries when they are invoked with `paperclipIssueId`. Thread-only mutations accept an optional `paperclipIssueId` for this attribution. This first increment does not capture read-only tools, operator UI mutations, arbitrary external GitHub activity, token/cost data, or historical comments/runs.
118
+
105
119
  ## Requirements
106
120
 
107
121
  - Node.js 20+
@@ -179,10 +193,11 @@ Additional behavior:
179
193
  - Newly imported issues that finish sync in `todo` and are assigned to an agent enqueue an assignee wakeup so the agent can pick them up promptly.
180
194
  - For linked pull requests, GitHub Sync treats merge-conflict, behind-branch, blocked, draft, unstable merge states, and unresolved review threads as executor work, while merge-ready states such as `CLEAN` and `HAS_HOOKS` can move work into `in_review` when CI is green and review threads are resolved. If an issue is already `blocked` and GitHub reports only pending external merge requirements while CI is unfinished, sync preserves the external wait instead of waking an executor. A stale aggregate `CHANGES_REQUESTED` review decision alone does not move that maintainer wait back to active execution. Transient `UNKNOWN` mergeability also does not move an already `in_review` maintainer wait back to active execution when CI is green and review threads are resolved.
181
195
  - Imported issues that are already `blocked` stay `blocked` while any first-class `blockedBy` issue is still non-terminal, even if the linked GitHub pull request is otherwise green and review-ready.
182
- - When sync moves work into `in_review`, GitHub Sync first follows the Paperclip issue execution policy's current reviewer or approver when that stage is visible on the issue. If Paperclip exposes an internal review or approval stage but not yet the participant, the plugin falls back to the configured reviewer or approver handoff assignee. If the transition is only a healthy linked-PR wait with no visible internal review or approval stage, GitHub Sync leaves the issue unassigned so it can wait on normal maintainer review without waking an internal owner.
196
+ - When sync moves work into `in_review`, GitHub Sync first follows the Paperclip issue execution policy's current reviewer or approver when that stage is visible on the issue. If Paperclip exposes an internal review or approval stage but not yet the participant, the plugin falls back to the configured reviewer or approver handoff assignee. If the transition is only a healthy linked-PR wait with no visible internal review or approval stage, GitHub Sync leaves the issue unassigned so it can wait on normal maintainer review without waking an internal owner. An execution state explicitly marked `completed` contains historical stage and decision fields, not active routing: GitHub Sync clears that completed policy/state and the stale internal assignee atomically when restoring `done` to `in_review`, and it emits no assignment wakeup.
183
197
  - When sync moves work back into active execution, GitHub Sync first follows the Paperclip issue execution policy `returnAssignee` when it is available. Otherwise it falls back to the configured executor handoff assignee and then to the default imported assignee.
184
198
  - 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.
185
- - Open imported issues that are already in `backlog` stay in `backlog` until someone changes them in Paperclip.
199
+ - After applying a GitHub-derived state, GitHub Sync immediately stores a bounded fingerprint of the effective issue/PR condition (including head SHA, closure outcome, and the highest-priority actionable check/review/merge condition). If an agent later acknowledges that condition by changing the Paperclip status, the same fingerprint remains quiescent: sync does not repeat the transition, comment, or wake, including for `done`/`cancelled` closure outcomes and directly PR-linked issues. Raw `UNKNOWN`/aggregate jitter that does not change the effective action cannot re-arm the transition. A changed effective fingerprint or a trusted new issue/PR/review comment bypasses suppression; untrusted comment-count changes do not. Status/comment watermarks advance only after their action succeeds. When a required assignee wake fails, the successful mutation and a bounded pending-wake record are already durable, so the next sync retries only the wake without repeating the status change or comment.
200
+ - Open imported issues that are already `backlog` stay in `backlog` until someone changes them in Paperclip.
186
201
  - 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.
187
202
  - 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`.
188
203
  - When the sync changes a Paperclip issue status, it adds a Paperclip comment explaining what changed and why.
@@ -239,9 +254,9 @@ The plugin exposes GitHub workflow tools to Paperclip agents, including:
239
254
  - review-thread reads, replies, resolve and unresolve actions, and `request_pull_request_reviewers` reviewer requests
240
255
  - organization-level GitHub Project search/listing and pull-request-to-project association
241
256
 
242
- `create_pull_request` is the single agent-facing delivery call for both branch publication and PR creation. The caller supplies the Paperclip issue id, a plain local branch name, the exact 40-character local branch-tip SHA, the base branch, and the PR metadata. The optional `repository` may select any GitHub repository, including one that is not mapped in Paperclip, provided it matches the issue execution workspace; if omitted, the issue project must have exactly one mapped repository. The trusted plugin worker verifies checkout ownership, resolves the issue's execution worktree and GitHub secret, verifies the checked-out branch, worktree HEAD, local branch tip, and base ancestry, publishes only that exact commit with a non-forcing refspec, reads the remote branch SHA back, and only then asks GitHub to create and link the PR. GitHub token permissions determine whether publication and PR creation are allowed. The credential is never returned to or injected into the calling agent.
257
+ `create_pull_request` is the single agent-facing delivery call for both branch publication and PR creation. The caller supplies the Paperclip issue id, a plain local branch name, the exact 40-character local branch-tip SHA, the base branch, and the PR metadata. The optional `repository` may select any GitHub repository, including one that is not mapped in Paperclip; if omitted, the issue project must have exactly one mapped repository. By default the tool uses the execution-workspace root as the local Git checkout. For general-purpose workspaces that contain several repositories, `workspaceRelativePath` selects a checkout below that trusted root, with realpath containment enforced. The trusted plugin worker verifies checkout ownership, resolves the issue's execution worktree and GitHub secret, verifies the checked-out branch, worktree HEAD, local branch tip, and base ancestry, publishes only that exact commit with a non-forcing refspec, reads the remote branch SHA back, and only then asks GitHub to create and link the PR. GitHub token permissions determine whether publication and PR creation are allowed. The credential is never returned to or injected into the calling agent.
243
258
 
244
- Branch publication uses an isolated temporary bare repository backed by the trusted workspace object database. It does not execute repository hooks, accept arbitrary refspecs, or honor repository-local remotes. The selected target repository is accepted only when it is a canonical GitHub `owner/repo` reference matching the trusted execution workspace. Publication rejects owner-qualified heads, base-branch targets, non-fast-forward updates, cross-project issues, mismatched local branch tips, and remote SHA mismatches.
259
+ Branch publication uses an isolated temporary bare repository backed by the selected trusted-workspace checkout's object database. It does not execute repository hooks, accept arbitrary refspecs, or honor repository-local remotes. An optional checkout path must resolve inside the issue execution workspace, while the selected target repository must be a canonical GitHub `owner/repo` reference. Publication rejects owner-qualified heads, base-branch targets, non-fast-forward updates, cross-project issues, mismatched local branch tips, and remote SHA mismatches.
245
260
 
246
261
  The call is ordered and retry-safe rather than a cross-system transaction: a published branch may remain if GitHub PR creation or Paperclip link persistence fails. On retry, the tool re-verifies and republishes the exact SHA, then recovers an already-open PR only when repository, head, base, and head SHA all match before repairing the link and metric. It never deletes a branch or closes a PR as automatic compensation.
247
262
 
package/dist/manifest.js CHANGED
@@ -262,7 +262,11 @@ var GITHUB_AGENT_TOOLS = [
262
262
  properties: {
263
263
  repository: {
264
264
  type: "string",
265
- description: "Target GitHub repository as owner/repo or https://github.com/owner/repo. It may be outside Paperclip repository mappings, but it must match the issue execution workspace. Omit only when the issue project has exactly one mapped repository."
265
+ description: "Target GitHub repository as owner/repo or https://github.com/owner/repo. It may be outside Paperclip repository mappings. Omit only when the issue project has exactly one mapped repository."
266
+ },
267
+ workspaceRelativePath: {
268
+ type: "string",
269
+ description: "Optional path to the local Git checkout, relative to the trusted issue execution workspace. Use this when a general-purpose workspace contains the target repository in a subdirectory."
266
270
  },
267
271
  paperclipIssueId: {
268
272
  type: "string",
@@ -407,7 +411,8 @@ var GITHUB_AGENT_TOOLS = [
407
411
  minLength: 1,
408
412
  description: "Human-facing reply body without the AI footer. It must remain non-empty after trimming and removing any existing AI footer."
409
413
  },
410
- llmModel: llmModelProperty
414
+ llmModel: llmModelProperty,
415
+ paperclipIssueId: paperclipIssueIdProperty
411
416
  }
412
417
  }
413
418
  },
@@ -423,7 +428,8 @@ var GITHUB_AGENT_TOOLS = [
423
428
  threadId: {
424
429
  type: "string",
425
430
  description: "GitHub pull request review thread node id."
426
- }
431
+ },
432
+ paperclipIssueId: paperclipIssueIdProperty
427
433
  }
428
434
  }
429
435
  },
@@ -439,7 +445,8 @@ var GITHUB_AGENT_TOOLS = [
439
445
  threadId: {
440
446
  type: "string",
441
447
  description: "GitHub pull request review thread node id."
442
- }
448
+ },
449
+ paperclipIssueId: paperclipIssueIdProperty
443
450
  }
444
451
  }
445
452
  },
@@ -631,6 +638,30 @@ var GITHUB_AGENT_TOOLS = [
631
638
  }
632
639
  }
633
640
  }
641
+ },
642
+ {
643
+ name: "get_issue_interaction_summary",
644
+ displayName: "Get Issue Interaction Summary",
645
+ description: "Return a deterministic, sanitized interaction summary for one Paperclip issue over a maximum 30-day [from,to) UTC range.",
646
+ parametersSchema: {
647
+ type: "object",
648
+ additionalProperties: false,
649
+ required: ["paperclipIssueId"],
650
+ properties: {
651
+ paperclipIssueId: {
652
+ type: "string",
653
+ description: "Paperclip issue id in the authenticated tool run company."
654
+ },
655
+ from: {
656
+ type: "string",
657
+ description: "Optional inclusive ISO timestamp. Defaults to 30 days before to."
658
+ },
659
+ to: {
660
+ type: "string",
661
+ description: "Optional exclusive ISO timestamp. Defaults to the current time."
662
+ }
663
+ }
664
+ }
634
665
  }
635
666
  ];
636
667
 
@@ -644,7 +675,7 @@ var COMPANY_METRIC_API_ROUTE_URL_PATH = `/api/plugins/${GITHUB_SYNC_PLUGIN_ID}/a
644
675
  var require2 = createRequire(import.meta.url);
645
676
  var packageJson = require2("../package.json");
646
677
  var SCHEDULE_TICK_CRON = "* * * * *";
647
- var MANIFEST_VERSION = "0.15.0"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
678
+ var MANIFEST_VERSION = "0.15.2"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
648
679
  var manifest = {
649
680
  id: GITHUB_SYNC_PLUGIN_ID,
650
681
  apiVersion: 1,