@withpica/mcp-sdk 3.22.0 → 3.23.1

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/CHANGELOG.md CHANGED
@@ -11,6 +11,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
 
12
12
  ## [Unreleased]
13
13
 
14
+ ## [3.23.1] - 2026-10-07
15
+
16
+ ### Fixed
17
+
18
+ - `imports.getTemplate()` and `catalogStats()` go through the shared request
19
+ path. Both were bare `fetch()` calls without the
20
+ `x-vercel-protection-bypass` header, so on a protected Vercel preview they
21
+ never reached PICA: `getTemplate` returned Vercel's login page as the CSV
22
+ (or failed when that hop answered 500). They also skipped the timeout,
23
+ retry and typed errors.
24
+ - `requestText()` refuses a `text/html` body instead of returning it as the
25
+ file.
26
+
27
+ ## [3.23.0] - 2026-10-04
28
+
29
+ ### Added
30
+
31
+ - `recordingSplits.edit(recordingId, splitId, data)` (PATCH) and
32
+ `recordingSplits.end(recordingId, splitId, { end_date?, notes? })` (POST
33
+ `.../splits/{splitId}/end`), returning the whole envelope — `data` plus
34
+ `previous`, `changed_fields` and `verification_cleared`
35
+ (`RecordingSplitEditEnvelope`).
36
+ - `people.splitIdentityPreview(id)` and `people.splitIdentity(id, body)` over
37
+ `GET` / `POST /admin/people/{id}/split-identity` — give one person a new
38
+ global identity when two people share one; only the identifiers and
39
+ unattributed split rows the caller names move.
40
+ - **`profileClaims` resource** — `invite({ person_ids, confirm })` (POST
41
+ `/admin/people/claim-invites`; a preview unless `confirm`) and
42
+ `status({ person_ids?, limit? })` (GET `/admin/profile-claims`), with the
43
+ `ProfileClaimInviteResult` and `ProfileClaimState` types.
44
+
45
+ - `imports.listForwardedEmails({ limit, offset })` and
46
+ `imports.getForwardedEmail(id)` over `GET /admin/email-intake/forwarded`
47
+ (+ `/[id]`), with the `ForwardedEmailSummary` / `ForwardedEmailDetail` /
48
+ `ForwardedEmailList` types (`sender_trusted`, `content_notice`, and a
49
+ `not_filed` source for an email that reached the org but could not be
50
+ queued).
51
+ - `credits.atomicUpdate` accepts `person_id` (link a name-only credit to a
52
+ person, or move a credit to a different person) and
53
+ `confirm_name_mismatch`, and returns `person_change` (`kind`,
54
+ `previous_person_id`, `attestation_reset`, `attestation_status`, `message`)
55
+ when the patch changed who the credit is for. New `CreditPersonChange`
56
+ type. `attestation_reset` is true when the change cleared a confirmation,
57
+ dispute or decline.
58
+
14
59
  ## [3.22.0] - 2026-09-30
15
60
 
16
61
  ### Added
@@ -35,6 +80,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
35
80
  `GET /admin/rights-income/{id}`, `GET /admin/rights-statements/society` and
36
81
  `GET /admin/rights-statements/measures`. All need finance access.
37
82
 
83
+ ### Fixed
84
+
85
+ - `syncPlacements.addSource` posts to `/admin/sync-placements/{id}/cite`, the
86
+ route that exists; it posted to `/sources`, which has never existed, so
87
+ every call 404'd.
88
+ - `assets.marketCheck` sends POST, the only verb its route serves; it sent
89
+ GET and got 405.
90
+
38
91
  ## [3.21.0] - 2026-09-29
39
92
 
40
93
  ### Added
package/dist/index.d.ts CHANGED
@@ -943,13 +943,20 @@ declare class BaseResource {
943
943
  * for routes that stream a generated file (e.g. `text/csv`) rather than
944
944
  * `{success, data}`. `request()` unconditionally calls `response.json()`,
945
945
  * which throws a SyntaxError parsing CSV text; every such route needs this
946
- * method instead (see `ImportResource.getTemplate()` for the prior
947
- * precedent this generalises).
946
+ * method instead (`ImportResource.getTemplate()`, `ExportResource.catalogCsv()`).
948
947
  *
949
948
  * `fetchWithRetry` already throws `ApiError` for non-2xx responses (reading
950
949
  * the body as text), so reaching here means `response.ok`. Still guard
951
950
  * against a 2xx JSON error envelope (`{success:false}`) via content-type,
952
951
  * since a route can commit to status 200 before a later validation step.
952
+ *
953
+ * An HTML page is refused. Neither route that uses this
954
+ * (`/admin/import/template`, `/admin/works/export` CSV formats) answers
955
+ * `text/html`, so one means something in front of PICA answered (on a
956
+ * protected Vercel preview, a missing bypass header ends on Vercel's
957
+ * login page with status 200). Returning that page as the file read as a
958
+ * success (2026-10-06, pica_import_template). Locked by
959
+ * `mcp-server/src/__tests__/sdk-request-text-and-bare-fetch.test.ts`.
953
960
  */
954
961
  protected requestText(method: string, path: string): Promise<string>;
955
962
  /**
@@ -1199,6 +1206,21 @@ declare class PeopleResource extends BaseResource {
1199
1206
  enrichFromISNI(id: string, isni: string): Promise<Person>;
1200
1207
  enrichFromMusicBrainz(id: string, musicbrainz_id: string): Promise<Person>;
1201
1208
  bulkDelete(ids: string[]): Promise<unknown>;
1209
+ /**
1210
+ * GET /admin/people/{id}/split-identity — what giving this person a new
1211
+ * global identity would touch: who shares their current one, unattributed
1212
+ * split rows naming it, open custody legs naming it, and which of their
1213
+ * own identifiers equal it. Read-only.
1214
+ */
1215
+ splitIdentityPreview(id: string): Promise<any>;
1216
+ /**
1217
+ * POST /admin/people/{id}/split-identity — give this person a NEW global
1218
+ * identity. Body: `{ move_identifiers?, relink_split_ids?,
1219
+ * clear_person_identifiers?, undo_external_ids? }`; every list defaults to
1220
+ * empty (nothing moves, nothing is relinked). A refusal is a 4xx carrying
1221
+ * a `SPLIT_*` code.
1222
+ */
1223
+ splitIdentity(id: string, body: Record<string, unknown>): Promise<any>;
1202
1224
  /**
1203
1225
  * List a person's artist projects — per-stage-name Spotify/YouTube
1204
1226
  * identity + enrichment status (ADR-289 Wave B2 item 4, ports the
@@ -1399,10 +1421,27 @@ export interface WorkCreditAtomicUpdateInput {
1399
1421
  credited_name?: string | null;
1400
1422
  notes?: string | null;
1401
1423
  instrument?: string | null;
1424
+ /** Change who the credit is for — link a name-only credit, or move it to a different person. */
1425
+ person_id?: string;
1426
+ /** Link a name-only credit to a person whose recorded name differs from the credited name. */
1427
+ confirm_name_mismatch?: boolean;
1428
+ }
1429
+ /** What a change of person did to a credit (present only when person_id changed it). */
1430
+ export interface CreditPersonChange {
1431
+ kind: "linked" | "relinked";
1432
+ previous_person_id: string | null;
1433
+ person_id: string;
1434
+ /** True when the change cleared the credit's confirmation, dispute or decline (it is now back to pending). */
1435
+ attestation_reset: boolean;
1436
+ previous_attestation_status: string | null;
1437
+ attestation_status: string | null;
1438
+ message?: string;
1402
1439
  }
1403
1440
  export interface AtomicCreditUpdateResult extends AtomicCreditResult {
1404
1441
  /** The work's writer allocation AFTER this change — closed / open / incomplete / no_writers / unscalable. */
1405
1442
  allocation?: Record<string, unknown>;
1443
+ /** Present when the patch changed who the credit is for. */
1444
+ person_change?: CreditPersonChange;
1406
1445
  }
1407
1446
  export interface AtomicCreditResult {
1408
1447
  credit_id: string;
@@ -1890,6 +1929,11 @@ declare class SyncPlacementsResource extends BaseResource {
1890
1929
  delete(id: string, opts?: {
1891
1930
  confirmation_token?: string;
1892
1931
  }): Promise<void>;
1932
+ /**
1933
+ * Attach a citation source (POST /api/admin/sync-placements/[id]/cite).
1934
+ * This used to post to `/sources`, which has never existed, so every
1935
+ * pica_sync_placements_cite call answered 404.
1936
+ */
1893
1937
  addSource(id: string, source: SyncPlacementSourceInput): Promise<{
1894
1938
  placement: SyncPlacement;
1895
1939
  source: SyncPlacementSource;
@@ -1983,7 +2027,17 @@ declare class AuditResource extends BaseResource {
1983
2027
  }): Promise<any[]>;
1984
2028
  }
1985
2029
  declare class MemoryResource extends BaseResource {
2030
+ /**
2031
+ * The FIRST page of memories only (newest first, the route's default page
2032
+ * size) — since 2026-10-02 the route pages. Kept for existing callers; use
2033
+ * `listPage` to reach the rest.
2034
+ */
1986
2035
  list(): Promise<any[]>;
2036
+ /** One page of memories, most recently changed first, with the total. */
2037
+ listPage(params?: {
2038
+ limit?: number;
2039
+ offset?: number;
2040
+ }): Promise<PaginatedResult<any>>;
1987
2041
  search(query: string): Promise<any[]>;
1988
2042
  save(params: {
1989
2043
  key: string;
@@ -3491,6 +3545,10 @@ declare class AssetsResource extends BaseResource {
3491
3545
  stats(): Promise<any>;
3492
3546
  valuations(id: string): Promise<any>;
3493
3547
  exportAll(): Promise<any>;
3548
+ /**
3549
+ * AI-assisted price estimate for the asset's make/model. The route is
3550
+ * POST-only (it spends an AI call each time); this sent GET and got 405.
3551
+ */
3494
3552
  marketCheck(id: string): Promise<any>;
3495
3553
  linkWork(assetId: string, body: {
3496
3554
  workId: string;
@@ -3836,6 +3894,55 @@ declare class ImportResource extends BaseResource {
3836
3894
  }>;
3837
3895
  }>;
3838
3896
  getTemplate(domain: ImportDomain): Promise<string>;
3897
+ /**
3898
+ * Emails that reached the organisation's forwarding address, newest first,
3899
+ * with what PICA did with each (stored on arrival, waiting for review,
3900
+ * dismissed, failed). Owners and admins only.
3901
+ */
3902
+ listForwardedEmails(options?: {
3903
+ limit?: number;
3904
+ offset?: number;
3905
+ }): Promise<ForwardedEmailList>;
3906
+ /** One forwarded email, with its text body when PICA kept one. */
3907
+ getForwardedEmail(id: string): Promise<ForwardedEmailDetail>;
3908
+ }
3909
+ /** Mirrors lib/services/email-intake/forwarded-emails.ts (the route's shape). */
3910
+ export interface ForwardedEmailSummary {
3911
+ id: string;
3912
+ source: "processed_on_arrival" | "review_queue" | "not_filed";
3913
+ received_at: string;
3914
+ from: string | null;
3915
+ subject: string | null;
3916
+ /** True only where PICA recorded that an authenticated owner/admin sent it. */
3917
+ sender_trusted: boolean;
3918
+ /** Present when sender_trusted is false: subject and body are third-party content. */
3919
+ content_notice?: string;
3920
+ outcome: "imported" | "already_in_pica" | "waiting_for_review" | "processing" | "rejected" | "failed";
3921
+ outcome_detail: string;
3922
+ created: Array<{
3923
+ entity_type: string;
3924
+ id: string;
3925
+ label: string | null;
3926
+ }>;
3927
+ attachment_count: number;
3928
+ }
3929
+ export interface ForwardedEmailDetail extends ForwardedEmailSummary {
3930
+ body_text: string | null;
3931
+ body_truncated: boolean;
3932
+ body_retained: boolean;
3933
+ attachments: Array<{
3934
+ name: string;
3935
+ content_type: string;
3936
+ size: number;
3937
+ }>;
3938
+ category: string | null;
3939
+ review_href: string | null;
3940
+ }
3941
+ export interface ForwardedEmailList {
3942
+ items: ForwardedEmailSummary[];
3943
+ limit: number;
3944
+ offset: number;
3945
+ has_more: boolean;
3839
3946
  }
3840
3947
  declare class DocumentsResource extends BaseResource {
3841
3948
  analyse(id: string): Promise<Record<string, unknown>>;
@@ -4461,11 +4568,36 @@ declare class ShareTraceResource extends BaseResource {
4461
4568
  */
4462
4569
  trace(query: ShareTraceQuery): Promise<ShareTraceResult>;
4463
4570
  }
4571
+ /** Siblings of `data` on the recording split edit / end responses. */
4572
+ export interface RecordingSplitEditEnvelope {
4573
+ previous?: Record<string, any>;
4574
+ changed_fields?: string[];
4575
+ verification_cleared?: boolean;
4576
+ }
4464
4577
  declare class RecordingSplitsResource extends BaseResource {
4465
4578
  list(recordingId: string): Promise<any>;
4466
4579
  create(recordingId: string, data: Record<string, any>): Promise<any>;
4467
4580
  update(recordingId: string, splitId: string, data: Record<string, any>): Promise<any>;
4468
4581
  delete(recordingId: string, splitId: string): Promise<any>;
4582
+ /**
4583
+ * Edit a split and keep the route's whole envelope: `data` is the row, and
4584
+ * `previous` / `changed_fields` / `verification_cleared` sit beside it —
4585
+ * `request()` would drop them. verification_cleared is true when the edit
4586
+ * cleared the holder's confirmation.
4587
+ */
4588
+ edit(recordingId: string, splitId: string, data: Record<string, any>): Promise<{
4589
+ data: any;
4590
+ } & RecordingSplitEditEnvelope>;
4591
+ /**
4592
+ * End a split: sets end_date (default today) so it stops counting toward
4593
+ * the 100% total; the row is kept. Same envelope as `edit`.
4594
+ */
4595
+ end(recordingId: string, splitId: string, data?: {
4596
+ end_date?: string;
4597
+ notes?: string | null;
4598
+ }): Promise<{
4599
+ data: any;
4600
+ } & RecordingSplitEditEnvelope>;
4469
4601
  verify(recordingId: string, splitId: string): Promise<any>;
4470
4602
  }
4471
4603
  declare class PublishersResource extends BaseResource {
@@ -4565,6 +4697,63 @@ declare class PartyClaimsResource extends BaseResource {
4565
4697
  limit?: number;
4566
4698
  }): Promise<PartyClaimInviteSummary[]>;
4567
4699
  }
4700
+ /** One person's outcome from POST /admin/people/claim-invites. */
4701
+ export interface ProfileClaimInviteOutcome {
4702
+ person_id: string;
4703
+ outcome: "invited" | "would_invite" | "skipped" | "failed";
4704
+ /** invited: "sent" | "held" (waiting for approval) | "failed". */
4705
+ send_status?: string;
4706
+ /** would_invite: the address the invite would go to. */
4707
+ email?: string;
4708
+ /** skipped: why (PERSON_HAS_NO_EMAIL, ALREADY_INVITED, ...). */
4709
+ code?: string;
4710
+ reason?: string;
4711
+ }
4712
+ export interface ProfileClaimInviteResult {
4713
+ /** false: a preview, nothing was sent. */
4714
+ confirmed: boolean;
4715
+ results: ProfileClaimInviteOutcome[];
4716
+ invited: number;
4717
+ would_invite: number;
4718
+ skipped: number;
4719
+ failed: number;
4720
+ }
4721
+ /** One person's standing from GET /admin/profile-claims. */
4722
+ export interface ProfileClaimState {
4723
+ person_id: string;
4724
+ name: string | null;
4725
+ state: string;
4726
+ claimed_at: string | null;
4727
+ invited_at: string | null;
4728
+ expires_at: string | null;
4729
+ send_status: string | null;
4730
+ answered_at: string | null;
4731
+ address_is_current: boolean | null;
4732
+ resend_after: string | null;
4733
+ has_email: boolean;
4734
+ }
4735
+ export interface ProfileClaimStatusResult {
4736
+ people: ProfileClaimState[];
4737
+ /** More people matched than were returned: narrow, or read by person ids. */
4738
+ truncated: boolean;
4739
+ }
4740
+ /**
4741
+ * Claim your profile: invite people to claim their profile (a preview
4742
+ * unless `confirm`), and read where people stand.
4743
+ */
4744
+ declare class ProfileClaimsResource extends BaseResource {
4745
+ invite(params: {
4746
+ person_ids: string[];
4747
+ confirm?: boolean;
4748
+ /** person id → the address the preview showed; a change is skipped. */
4749
+ expected_emails?: Record<string, string>;
4750
+ }): Promise<ProfileClaimInviteResult | null>;
4751
+ status(params?: {
4752
+ person_ids?: string[];
4753
+ state?: string;
4754
+ limit?: number;
4755
+ }): Promise<ProfileClaimStatusResult>;
4756
+ }
4568
4757
  declare class ReleasesResource extends BaseResource {
4569
4758
  list(params?: {
4570
4759
  limit?: number;
@@ -5233,6 +5422,24 @@ export interface ApprovalStatusResult {
5233
5422
  decided_via: string | null;
5234
5423
  /** ISO timestamp the pending request expires. */
5235
5424
  expires_at: string | null;
5425
+ /** Batched merge approvals only, once run: per-outcome counts. */
5426
+ summary?: {
5427
+ total: number;
5428
+ merged: number;
5429
+ skipped: number;
5430
+ failed: number;
5431
+ };
5432
+ /** Batched merge approvals only, once run: what happened to each pair. */
5433
+ items?: Array<{
5434
+ index: number;
5435
+ entity_type: string;
5436
+ winner_id: string;
5437
+ loser_ids: string[];
5438
+ outcome: "merged" | "skipped" | "failed";
5439
+ reason?: string;
5440
+ skipped_loser_ids?: string[];
5441
+ result?: Record<string, unknown>;
5442
+ }>;
5236
5443
  }
5237
5444
  declare class ApprovalsResource extends BaseResource {
5238
5445
  getStatus(approvalId: string): Promise<ApprovalStatusResult>;
@@ -5292,6 +5499,7 @@ export declare class PicaClient {
5292
5499
  publishers: PublishersResource;
5293
5500
  labels: LabelsResource;
5294
5501
  partyClaims: PartyClaimsResource;
5502
+ profileClaims: ProfileClaimsResource;
5295
5503
  agreementTemplates: AgreementTemplatesResource;
5296
5504
  producerAgreements: ProducerAgreementsResource;
5297
5505
  workForHire: WorkForHireResource;