@withpica/mcp-sdk 3.21.0 → 3.23.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/CHANGELOG.md CHANGED
@@ -11,6 +11,70 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
 
12
12
  ## [Unreleased]
13
13
 
14
+ ## [3.23.0] - 2026-10-04
15
+
16
+ ### Added
17
+
18
+ - `recordingSplits.edit(recordingId, splitId, data)` (PATCH) and
19
+ `recordingSplits.end(recordingId, splitId, { end_date?, notes? })` (POST
20
+ `.../splits/{splitId}/end`), returning the whole envelope — `data` plus
21
+ `previous`, `changed_fields` and `verification_cleared`
22
+ (`RecordingSplitEditEnvelope`).
23
+ - `people.splitIdentityPreview(id)` and `people.splitIdentity(id, body)` over
24
+ `GET` / `POST /admin/people/{id}/split-identity` — give one person a new
25
+ global identity when two people share one; only the identifiers and
26
+ unattributed split rows the caller names move.
27
+ - **`profileClaims` resource** — `invite({ person_ids, confirm })` (POST
28
+ `/admin/people/claim-invites`; a preview unless `confirm`) and
29
+ `status({ person_ids?, limit? })` (GET `/admin/profile-claims`), with the
30
+ `ProfileClaimInviteResult` and `ProfileClaimState` types.
31
+
32
+ - `imports.listForwardedEmails({ limit, offset })` and
33
+ `imports.getForwardedEmail(id)` over `GET /admin/email-intake/forwarded`
34
+ (+ `/[id]`), with the `ForwardedEmailSummary` / `ForwardedEmailDetail` /
35
+ `ForwardedEmailList` types (`sender_trusted`, `content_notice`, and a
36
+ `not_filed` source for an email that reached the org but could not be
37
+ queued).
38
+ - `credits.atomicUpdate` accepts `person_id` (link a name-only credit to a
39
+ person, or move a credit to a different person) and
40
+ `confirm_name_mismatch`, and returns `person_change` (`kind`,
41
+ `previous_person_id`, `attestation_reset`, `attestation_status`, `message`)
42
+ when the patch changed who the credit is for. New `CreditPersonChange`
43
+ type. `attestation_reset` is true when the change cleared a confirmation,
44
+ dispute or decline.
45
+
46
+ ## [3.22.0] - 2026-09-30
47
+
48
+ ### Added
49
+
50
+ - `integrity.waive` accepts `kind` (`not_applicable` | `restricted`) for the
51
+ platform-presence codes `PLATFORM_SPOTIFY` / `PLATFORM_YOUTUBE` /
52
+ `PLATFORM_APPLE_MUSIC`, and returns the work's re-scored `completeness`
53
+ for them; `integrity.revokeWaiver` now returns the route's answer
54
+ (`{ id, revoked, completeness? }`) instead of `void`.
55
+ - `PlatformWaiverCode` / `PlatformWaiverKind` types; `IntegrityGapCode` gains
56
+ `WORK_NO_MASTER`, `WORK_SPLITS_ABSENT`, `WORK_SPLITS_INVALID`.
57
+
58
+ ### Deprecated
59
+
60
+ - `Work.is_verified` is now optional and deprecated. `works` has no such
61
+ column (no applied migration adds one), so works responses do not carry it;
62
+ PICA keeps no work-level verified flag. Remove at the next major, with
63
+ `works.verify`.
64
+ - `rights.statements()`, `rights.statement(incomeId)`, `rights.recordIncome(body)`,
65
+ `rights.societyChecks(workId)` and `rights.measures()` — ADR-321 Phase 3
66
+ (distribution, computed and not paid), over `GET/POST /admin/rights-income`,
67
+ `GET /admin/rights-income/{id}`, `GET /admin/rights-statements/society` and
68
+ `GET /admin/rights-statements/measures`. All need finance access.
69
+
70
+ ### Fixed
71
+
72
+ - `syncPlacements.addSource` posts to `/admin/sync-placements/{id}/cite`, the
73
+ route that exists; it posted to `/sources`, which has never existed, so
74
+ every call 404'd.
75
+ - `assets.marketCheck` sends POST, the only verb its route serves; it sent
76
+ GET and got 405.
77
+
14
78
  ## [3.21.0] - 2026-09-29
15
79
 
16
80
  ### Added
package/dist/index.d.ts CHANGED
@@ -306,7 +306,13 @@ interface Work {
306
306
  isrc?: string;
307
307
  primary_artist?: string;
308
308
  duration_seconds?: number;
309
- is_verified: boolean;
309
+ /**
310
+ * @deprecated `works` has no `is_verified` column (no applied migration
311
+ * adds one), so works responses do not carry this field. PICA keeps no
312
+ * work-level verified flag (see `WorksResource.verify`). Kept only so the
313
+ * published SDK's surface does not break; remove at the next major.
314
+ */
315
+ is_verified?: boolean;
310
316
  lyrics?: string;
311
317
  genre?: string;
312
318
  mood?: string;
@@ -1193,6 +1199,21 @@ declare class PeopleResource extends BaseResource {
1193
1199
  enrichFromISNI(id: string, isni: string): Promise<Person>;
1194
1200
  enrichFromMusicBrainz(id: string, musicbrainz_id: string): Promise<Person>;
1195
1201
  bulkDelete(ids: string[]): Promise<unknown>;
1202
+ /**
1203
+ * GET /admin/people/{id}/split-identity — what giving this person a new
1204
+ * global identity would touch: who shares their current one, unattributed
1205
+ * split rows naming it, open custody legs naming it, and which of their
1206
+ * own identifiers equal it. Read-only.
1207
+ */
1208
+ splitIdentityPreview(id: string): Promise<any>;
1209
+ /**
1210
+ * POST /admin/people/{id}/split-identity — give this person a NEW global
1211
+ * identity. Body: `{ move_identifiers?, relink_split_ids?,
1212
+ * clear_person_identifiers?, undo_external_ids? }`; every list defaults to
1213
+ * empty (nothing moves, nothing is relinked). A refusal is a 4xx carrying
1214
+ * a `SPLIT_*` code.
1215
+ */
1216
+ splitIdentity(id: string, body: Record<string, unknown>): Promise<any>;
1196
1217
  /**
1197
1218
  * List a person's artist projects — per-stage-name Spotify/YouTube
1198
1219
  * identity + enrichment status (ADR-289 Wave B2 item 4, ports the
@@ -1393,10 +1414,27 @@ export interface WorkCreditAtomicUpdateInput {
1393
1414
  credited_name?: string | null;
1394
1415
  notes?: string | null;
1395
1416
  instrument?: string | null;
1417
+ /** Change who the credit is for — link a name-only credit, or move it to a different person. */
1418
+ person_id?: string;
1419
+ /** Link a name-only credit to a person whose recorded name differs from the credited name. */
1420
+ confirm_name_mismatch?: boolean;
1421
+ }
1422
+ /** What a change of person did to a credit (present only when person_id changed it). */
1423
+ export interface CreditPersonChange {
1424
+ kind: "linked" | "relinked";
1425
+ previous_person_id: string | null;
1426
+ person_id: string;
1427
+ /** True when the change cleared the credit's confirmation, dispute or decline (it is now back to pending). */
1428
+ attestation_reset: boolean;
1429
+ previous_attestation_status: string | null;
1430
+ attestation_status: string | null;
1431
+ message?: string;
1396
1432
  }
1397
1433
  export interface AtomicCreditUpdateResult extends AtomicCreditResult {
1398
1434
  /** The work's writer allocation AFTER this change — closed / open / incomplete / no_writers / unscalable. */
1399
1435
  allocation?: Record<string, unknown>;
1436
+ /** Present when the patch changed who the credit is for. */
1437
+ person_change?: CreditPersonChange;
1400
1438
  }
1401
1439
  export interface AtomicCreditResult {
1402
1440
  credit_id: string;
@@ -1478,7 +1516,14 @@ declare class PicaScoreResource extends BaseResource {
1478
1516
  * exported shapes (the SDK does not import from `lib/`, mcp<->lib
1479
1517
  * isolation). Keep in sync by hand if the service's exported types change.
1480
1518
  */
1481
- export type IntegrityGapCode = "WORK_NO_RECORDING" | "RECORDING_NO_WORK" | "RECORDING_NO_RELEASE" | "WORK_NO_WRITER" | "RECORDING_NO_OWNER" | "COLLABORATOR_NOT_INVITED" | "COLLABORATOR_NOT_ATTESTED";
1519
+ export type IntegrityGapCode = "WORK_NO_RECORDING" | "RECORDING_NO_WORK" | "RECORDING_NO_RELEASE" | "WORK_NO_WRITER" | "RECORDING_NO_OWNER" | "COLLABORATOR_NOT_INVITED" | "COLLABORATOR_NOT_ATTESTED" | "WORK_NO_MASTER" | "WORK_SPLITS_ABSENT" | "WORK_SPLITS_INVALID";
1520
+ /**
1521
+ * Platform-presence codes a work may be waived on (mig 20260929163712):
1522
+ * the platform is not applicable to it, or restricted. Identifiers and
1523
+ * registrations are never waivable.
1524
+ */
1525
+ export type PlatformWaiverCode = "PLATFORM_SPOTIFY" | "PLATFORM_YOUTUBE" | "PLATFORM_APPLE_MUSIC";
1526
+ export type PlatformWaiverKind = "not_applicable" | "restricted";
1482
1527
  export type IntegrityEntityType = "work" | "recording" | "release" | "person";
1483
1528
  export interface AttestationProposal {
1484
1529
  kind: "send_attestation_invites";
@@ -1539,11 +1584,28 @@ declare class IntegrityResource extends BaseResource {
1539
1584
  entity_type: string;
1540
1585
  entity_id: string;
1541
1586
  reason: string;
1587
+ /** Required for a platform code (PLATFORM_*); omitted otherwise. */
1588
+ kind?: PlatformWaiverKind;
1542
1589
  }): Promise<{
1543
1590
  id: string;
1591
+ kind?: PlatformWaiverKind;
1592
+ completeness?: {
1593
+ score: number | null;
1594
+ platforms: number | null;
1595
+ };
1596
+ }>;
1597
+ /**
1598
+ * PATCH /admin/integrity/waivers { waiver_id, revoke: true }. No un-revoke
1599
+ * path. A platform waiver answers with the work's re-scored `completeness`.
1600
+ */
1601
+ revokeWaiver(waiverId: string): Promise<{
1602
+ id: string;
1603
+ revoked: boolean;
1604
+ completeness?: {
1605
+ score: number | null;
1606
+ platforms: number | null;
1607
+ };
1544
1608
  }>;
1545
- /** PATCH /admin/integrity/waivers { waiver_id, revoke: true }. No un-revoke path. */
1546
- revokeWaiver(waiverId: string): Promise<void>;
1547
1609
  }
1548
1610
  interface PresignedUploadResult {
1549
1611
  uploadUrl: string;
@@ -1860,6 +1922,11 @@ declare class SyncPlacementsResource extends BaseResource {
1860
1922
  delete(id: string, opts?: {
1861
1923
  confirmation_token?: string;
1862
1924
  }): Promise<void>;
1925
+ /**
1926
+ * Attach a citation source (POST /api/admin/sync-placements/[id]/cite).
1927
+ * This used to post to `/sources`, which has never existed, so every
1928
+ * pica_sync_placements_cite call answered 404.
1929
+ */
1863
1930
  addSource(id: string, source: SyncPlacementSourceInput): Promise<{
1864
1931
  placement: SyncPlacement;
1865
1932
  source: SyncPlacementSource;
@@ -1953,7 +2020,17 @@ declare class AuditResource extends BaseResource {
1953
2020
  }): Promise<any[]>;
1954
2021
  }
1955
2022
  declare class MemoryResource extends BaseResource {
2023
+ /**
2024
+ * The FIRST page of memories only (newest first, the route's default page
2025
+ * size) — since 2026-10-02 the route pages. Kept for existing callers; use
2026
+ * `listPage` to reach the rest.
2027
+ */
1956
2028
  list(): Promise<any[]>;
2029
+ /** One page of memories, most recently changed first, with the total. */
2030
+ listPage(params?: {
2031
+ limit?: number;
2032
+ offset?: number;
2033
+ }): Promise<PaginatedResult<any>>;
1957
2034
  search(query: string): Promise<any[]>;
1958
2035
  save(params: {
1959
2036
  key: string;
@@ -3461,6 +3538,10 @@ declare class AssetsResource extends BaseResource {
3461
3538
  stats(): Promise<any>;
3462
3539
  valuations(id: string): Promise<any>;
3463
3540
  exportAll(): Promise<any>;
3541
+ /**
3542
+ * AI-assisted price estimate for the asset's make/model. The route is
3543
+ * POST-only (it spends an AI call each time); this sent GET and got 405.
3544
+ */
3464
3545
  marketCheck(id: string): Promise<any>;
3465
3546
  linkWork(assetId: string, body: {
3466
3547
  workId: string;
@@ -3806,6 +3887,55 @@ declare class ImportResource extends BaseResource {
3806
3887
  }>;
3807
3888
  }>;
3808
3889
  getTemplate(domain: ImportDomain): Promise<string>;
3890
+ /**
3891
+ * Emails that reached the organisation's forwarding address, newest first,
3892
+ * with what PICA did with each (stored on arrival, waiting for review,
3893
+ * dismissed, failed). Owners and admins only.
3894
+ */
3895
+ listForwardedEmails(options?: {
3896
+ limit?: number;
3897
+ offset?: number;
3898
+ }): Promise<ForwardedEmailList>;
3899
+ /** One forwarded email, with its text body when PICA kept one. */
3900
+ getForwardedEmail(id: string): Promise<ForwardedEmailDetail>;
3901
+ }
3902
+ /** Mirrors lib/services/email-intake/forwarded-emails.ts (the route's shape). */
3903
+ export interface ForwardedEmailSummary {
3904
+ id: string;
3905
+ source: "processed_on_arrival" | "review_queue" | "not_filed";
3906
+ received_at: string;
3907
+ from: string | null;
3908
+ subject: string | null;
3909
+ /** True only where PICA recorded that an authenticated owner/admin sent it. */
3910
+ sender_trusted: boolean;
3911
+ /** Present when sender_trusted is false: subject and body are third-party content. */
3912
+ content_notice?: string;
3913
+ outcome: "imported" | "already_in_pica" | "waiting_for_review" | "processing" | "rejected" | "failed";
3914
+ outcome_detail: string;
3915
+ created: Array<{
3916
+ entity_type: string;
3917
+ id: string;
3918
+ label: string | null;
3919
+ }>;
3920
+ attachment_count: number;
3921
+ }
3922
+ export interface ForwardedEmailDetail extends ForwardedEmailSummary {
3923
+ body_text: string | null;
3924
+ body_truncated: boolean;
3925
+ body_retained: boolean;
3926
+ attachments: Array<{
3927
+ name: string;
3928
+ content_type: string;
3929
+ size: number;
3930
+ }>;
3931
+ category: string | null;
3932
+ review_href: string | null;
3933
+ }
3934
+ export interface ForwardedEmailList {
3935
+ items: ForwardedEmailSummary[];
3936
+ limit: number;
3937
+ offset: number;
3938
+ has_more: boolean;
3809
3939
  }
3810
3940
  declare class DocumentsResource extends BaseResource {
3811
3941
  analyse(id: string): Promise<Record<string, unknown>>;
@@ -4431,11 +4561,36 @@ declare class ShareTraceResource extends BaseResource {
4431
4561
  */
4432
4562
  trace(query: ShareTraceQuery): Promise<ShareTraceResult>;
4433
4563
  }
4564
+ /** Siblings of `data` on the recording split edit / end responses. */
4565
+ export interface RecordingSplitEditEnvelope {
4566
+ previous?: Record<string, any>;
4567
+ changed_fields?: string[];
4568
+ verification_cleared?: boolean;
4569
+ }
4434
4570
  declare class RecordingSplitsResource extends BaseResource {
4435
4571
  list(recordingId: string): Promise<any>;
4436
4572
  create(recordingId: string, data: Record<string, any>): Promise<any>;
4437
4573
  update(recordingId: string, splitId: string, data: Record<string, any>): Promise<any>;
4438
4574
  delete(recordingId: string, splitId: string): Promise<any>;
4575
+ /**
4576
+ * Edit a split and keep the route's whole envelope: `data` is the row, and
4577
+ * `previous` / `changed_fields` / `verification_cleared` sit beside it —
4578
+ * `request()` would drop them. verification_cleared is true when the edit
4579
+ * cleared the holder's confirmation.
4580
+ */
4581
+ edit(recordingId: string, splitId: string, data: Record<string, any>): Promise<{
4582
+ data: any;
4583
+ } & RecordingSplitEditEnvelope>;
4584
+ /**
4585
+ * End a split: sets end_date (default today) so it stops counting toward
4586
+ * the 100% total; the row is kept. Same envelope as `edit`.
4587
+ */
4588
+ end(recordingId: string, splitId: string, data?: {
4589
+ end_date?: string;
4590
+ notes?: string | null;
4591
+ }): Promise<{
4592
+ data: any;
4593
+ } & RecordingSplitEditEnvelope>;
4439
4594
  verify(recordingId: string, splitId: string): Promise<any>;
4440
4595
  }
4441
4596
  declare class PublishersResource extends BaseResource {
@@ -4535,6 +4690,63 @@ declare class PartyClaimsResource extends BaseResource {
4535
4690
  limit?: number;
4536
4691
  }): Promise<PartyClaimInviteSummary[]>;
4537
4692
  }
4693
+ /** One person's outcome from POST /admin/people/claim-invites. */
4694
+ export interface ProfileClaimInviteOutcome {
4695
+ person_id: string;
4696
+ outcome: "invited" | "would_invite" | "skipped" | "failed";
4697
+ /** invited: "sent" | "held" (waiting for approval) | "failed". */
4698
+ send_status?: string;
4699
+ /** would_invite: the address the invite would go to. */
4700
+ email?: string;
4701
+ /** skipped: why (PERSON_HAS_NO_EMAIL, ALREADY_INVITED, ...). */
4702
+ code?: string;
4703
+ reason?: string;
4704
+ }
4705
+ export interface ProfileClaimInviteResult {
4706
+ /** false: a preview, nothing was sent. */
4707
+ confirmed: boolean;
4708
+ results: ProfileClaimInviteOutcome[];
4709
+ invited: number;
4710
+ would_invite: number;
4711
+ skipped: number;
4712
+ failed: number;
4713
+ }
4714
+ /** One person's standing from GET /admin/profile-claims. */
4715
+ export interface ProfileClaimState {
4716
+ person_id: string;
4717
+ name: string | null;
4718
+ state: string;
4719
+ claimed_at: string | null;
4720
+ invited_at: string | null;
4721
+ expires_at: string | null;
4722
+ send_status: string | null;
4723
+ answered_at: string | null;
4724
+ address_is_current: boolean | null;
4725
+ resend_after: string | null;
4726
+ has_email: boolean;
4727
+ }
4728
+ export interface ProfileClaimStatusResult {
4729
+ people: ProfileClaimState[];
4730
+ /** More people matched than were returned: narrow, or read by person ids. */
4731
+ truncated: boolean;
4732
+ }
4733
+ /**
4734
+ * Claim your profile: invite people to claim their profile (a preview
4735
+ * unless `confirm`), and read where people stand.
4736
+ */
4737
+ declare class ProfileClaimsResource extends BaseResource {
4738
+ invite(params: {
4739
+ person_ids: string[];
4740
+ confirm?: boolean;
4741
+ /** person id → the address the preview showed; a change is skipped. */
4742
+ expected_emails?: Record<string, string>;
4743
+ }): Promise<ProfileClaimInviteResult | null>;
4744
+ status(params?: {
4745
+ person_ids?: string[];
4746
+ state?: string;
4747
+ limit?: number;
4748
+ }): Promise<ProfileClaimStatusResult>;
4749
+ }
4538
4750
  declare class ReleasesResource extends BaseResource {
4539
4751
  list(params?: {
4540
4752
  limit?: number;
@@ -4728,6 +4940,28 @@ declare class RightsResource extends BaseResource {
4728
4940
  status(ruleId: string): Promise<any>;
4729
4941
  /** GET /admin/works/{id}/rights — every rule on a song, history, holds. */
4730
4942
  inspect(workId: string): Promise<any>;
4943
+ /**
4944
+ * ADR-321 Phase 3 — GET /admin/rights-income. Statements: direct income
4945
+ * and what it WOULD pay (no money moves). Needs finance access.
4946
+ */
4947
+ statements(params?: {
4948
+ workId?: string;
4949
+ limit?: number;
4950
+ before?: string;
4951
+ }): Promise<any>;
4952
+ /** GET /admin/rights-income/{id} — one income event, recomputed now. */
4953
+ statement(incomeId: string): Promise<any>;
4954
+ /**
4955
+ * POST /admin/rights-income — record direct income. Body is
4956
+ * `{ work_id, side, recording_id?, income_type, fee_kind, currency,
4957
+ * amount: "1250.00", earned_on, description? }` or
4958
+ * `{ enquiry_id, side, recording_id?, earned_on }`.
4959
+ */
4960
+ recordIncome(body: Record<string, unknown>): Promise<any>;
4961
+ /** GET /admin/rights-statements/society?work_id= — society statements checked against the split. */
4962
+ societyChecks(workId: string): Promise<any>;
4963
+ /** GET /admin/rights-statements/measures — the four measures (ADR-321 §7a). */
4964
+ measures(): Promise<any>;
4731
4965
  }
4732
4966
  declare class RoyaltiesResource extends BaseResource {
4733
4967
  payments(params?: {
@@ -5181,6 +5415,24 @@ export interface ApprovalStatusResult {
5181
5415
  decided_via: string | null;
5182
5416
  /** ISO timestamp the pending request expires. */
5183
5417
  expires_at: string | null;
5418
+ /** Batched merge approvals only, once run: per-outcome counts. */
5419
+ summary?: {
5420
+ total: number;
5421
+ merged: number;
5422
+ skipped: number;
5423
+ failed: number;
5424
+ };
5425
+ /** Batched merge approvals only, once run: what happened to each pair. */
5426
+ items?: Array<{
5427
+ index: number;
5428
+ entity_type: string;
5429
+ winner_id: string;
5430
+ loser_ids: string[];
5431
+ outcome: "merged" | "skipped" | "failed";
5432
+ reason?: string;
5433
+ skipped_loser_ids?: string[];
5434
+ result?: Record<string, unknown>;
5435
+ }>;
5184
5436
  }
5185
5437
  declare class ApprovalsResource extends BaseResource {
5186
5438
  getStatus(approvalId: string): Promise<ApprovalStatusResult>;
@@ -5240,6 +5492,7 @@ export declare class PicaClient {
5240
5492
  publishers: PublishersResource;
5241
5493
  labels: LabelsResource;
5242
5494
  partyClaims: PartyClaimsResource;
5495
+ profileClaims: ProfileClaimsResource;
5243
5496
  agreementTemplates: AgreementTemplatesResource;
5244
5497
  producerAgreements: ProducerAgreementsResource;
5245
5498
  workForHire: WorkForHireResource;