Commit Graph

9 Commits

Author SHA1 Message Date
0ca7831c53 feat: adopt SDK 525 features — askUserQuestions + documents.upsert
Two new event types accepted on the existing case-status webhook
(eventType discriminator added; legacy status_change still default):

* **missing_precedent_created** → ``ctx.issues.askUserQuestions``
  with a single-choice question {upload | irrelevant | defer}.
  continuationPolicy=wake_assignee_on_accept routes the chair's
  answer straight back to the CEO heartbeat without an extra hop.

* **export_complete** → ``ctx.issues.documents.upsert`` with a
  markdown "final-decision" doc that links back to the DOCX on
  legal-ai. (The SDK's documents API stores text only — binary
  attachment isn't natively supported here.)

Manifest: +issue.documents.write capability (issue.interactions.create
was already declared in the previous SDK upgrade).

Tested: plugin activates with all 18 capabilities, 8 tools + 3 jobs
+ 1 webhook + 2 event subs registered.
2026-05-26 13:28:43 +00:00
6388062cdc chore(sdk): upgrade @paperclipai/plugin-sdk to 2026.525.0
200-version bump from 2026.325.0 → 2026.525.0 (matches host).

**Why now**: host is already on 2026.525.0; staying on 325 was unnecessary
technical debt. Production logs showed real bugs ("missing, expired,
or unknown invocation scope") that newer SDK versions are known to
have fixed.

**Compatibility**:
- TS build clean with zero changes to worker.ts or legal-api.ts.
- apiVersion: 1 still the schema (no v2 yet).
- Plugin activated successfully — 8 tools + 3 jobs + 1 webhook + 2 event
  subs all registered, worker reports "Legal AI plugin ready".

**Manifest gaps fixed**: added 3 capabilities that the worker actually
uses (one of them was the root cause of repeated host-side errors):
* `agents.invoke` — required by `ctx.agents.invoke()` calls (CEO wakeup
  from event handlers + comment routing). Previously the plugin was
  invoking agents without the declared capability, raising
  "missing scope" errors on every issue.created event.
* `issue.comments.read` — required by `ctx.issues.listComments()`
  calls in the comment routing path.
* `issue.interactions.create` — forward-looking capability for the
  AskUserQuestion-like flows the SDK exposes via `createInteraction`.

**Backup**: full 5-layer snapshot at /tmp/plugin-legal-ai-backup-*.tar.gz
+ tag `pre-sdk-upgrade-2026-05-26` (pushed). Rollback: `git reset --hard
pre-sdk-upgrade-2026-05-26 && npm ci && npm run build && reinstall`.

Closes TaskMaster #26.
2026-05-26 12:19:04 +00:00
a8999b70c2 chore: snapshot before SDK upgrade
Includes pending stale-case-reminder days fix (3→30) alongside
the backup commit, since both will be preserved by the same tag.
2026-05-26 12:13:52 +00:00
52c3e600e7 style: biome auto-fix (const, import order, formatter)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 10:18:33 +00:00
06679bb061 feat: add stale-case-reminder and weekly-feedback-analysis jobs
Declare two new cron jobs in plugin.json and manifest.ts, and implement
their handlers in worker.ts. stale-case-reminder runs daily at 08:00 and
posts a warning comment on any Paperclip issue linked to a legal-ai case
that has not been updated in 3+ days. weekly-feedback-analysis runs every
Sunday at 19:00, fetches the weekly chair-feedback summary from legal-ai,
and invokes the CEO agent to update decision-lessons.md with new lessons.
2026-05-16 17:40:33 +00:00
9633617e26 fix: declare case-status webhook endpoint in manifest
Add webhooks[] array to plugin.json and manifest.ts with the
'case-status' endpointKey. Without this declaration, Paperclip
registers 0 webhooks even when onWebhook() is implemented, so
POST /api/plugins/marcusgroup.legal-ai/webhooks/case-status would
return 501 and never reach the handler.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 17:29:56 +00:00
f5a4cd1c62 feat: add webhooks.receive capability to plugin manifest 2026-05-16 17:19:10 +00:00
bec5d1bf3a Add biome config and update plugin source + dependencies
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:54:55 +00:00
587a2a76ca Initial commit: Paperclip plugin for Legal AI integration
16 agent tools, event handler for auto-linking, sync job every 15m.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 08:03:43 +00:00