@withpica/mcp-sdk 1.26.0 → 1.27.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,62 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
 
12
12
  ## [Unreleased]
13
13
 
14
+ ## [1.27.1] - 2026-05-16
15
+
16
+ ### Changed
17
+
18
+ - Brand consistency: "PICA" → "withPICA" in package metadata (description, author).
19
+
20
+ ### Added
21
+
22
+ - **`OpsIssueExplicitKind` union widened with `"tool_failure"` (PR #457, 2026-05-15).**
23
+ Sixth member of the explicit-kind enum on `OpsIssuesResource.reportIssue`,
24
+ alongside `workflow_gap | inconsistent_result | missing_step | data_issue
25
+ | ux_confusion`. Mirrored by a first-ever CHECK constraint on
26
+ `ops_issues.kind` (the column was previously free-text in Postgres).
27
+ Use this kind for SDK / upstream-tool failures the agent decides are
28
+ worth reporting — the fail-quiet wrappers on `pica_submit_feedback` and
29
+ `pica_physical_assets_create` are the canonical callers.
30
+
31
+ ## [1.27.0] - 2026-05-13
32
+
33
+ > Skipped `1.26.0` — that version was claimed by a parallel publish on
34
+ > 2026-05-12T17:40Z before this branch's publish chain ran. Sister of
35
+ > the `1.23.0 → 1.25.0` hop noted in the `feedback_npm_publish_chain_order`
36
+ > memory entry. CHANGELOG content unchanged; only the version number
37
+ > moved.
38
+
39
+ ### Added
40
+
41
+ - **`ImportResource.analyze/validate/execute` now accept `fileId` as an alternative to `fileContent` (PR #415 + #416, shipped 2026-05-13).**
42
+ Closes the workflow loop between `pica_upload` / `pica_upload_complete`
43
+ and the import pipeline. New `ImportFileSource` discriminated union
44
+ (`{ fileContent } | { fileId }`) enforces XOR at the call site;
45
+ the route enforces the same at runtime. When `fileId` is provided
46
+ (a `documents.id` from `pica_upload_complete`), the server fetches
47
+ bytes from storage via a short-lived signed URL — agents no longer
48
+ have to materialise CSV content into tool arguments.
49
+
50
+ ## [1.25.1] - 2026-05-13
51
+
52
+ ### Fixed
53
+
54
+ - **`PicaImportsResource.analyze` return-type aligned to the route's actual wire shape (PR #408, shipped 2026-05-13).**
55
+ Type was declared `parsed: { headers, rows, totalRows }`; the route
56
+ has always returned `parsed: { headers, preview, totalRows, delimiter }`.
57
+ The mismatch let `mcp-server`'s executor compile a `parsed.rows
58
+ .slice(0, 3)` call that exploded at runtime. Renamed `rows` → `preview`
59
+ and added the missing `delimiter` field on `ParsedCSV`. The SDK's
60
+ `request<T>()` is a JSON.parse cast with no runtime validation, so
61
+ unit tests that mocked the old shape gave false confidence — those
62
+ were also updated in the companion `@withpica/mcp-server@2.52.1` PR.
63
+
64
+ ## [1.25.0] - 2026-05-12
65
+
66
+ Closes out the Unreleased buffer accumulated since 1.22.0. The
67
+ `lint-changelog` script that lands in the next sister-package bump
68
+ prevents this drift going forward.
69
+
14
70
  ### Added
15
71
 
16
72
  - **`FilesResource` on `PicaClient` — first-class outbound file delivery (PR #385, shipped 2026-05-12).**
package/dist/index.d.ts CHANGED
@@ -663,6 +663,35 @@ declare class WorksResource extends BaseResource {
663
663
  track_number: number;
664
664
  disc_number: number | null;
665
665
  }>>;
666
+ /**
667
+ * Stamp a human-creation provenance attestation. Complement to the
668
+ * AI-disclosure side — captures who signed, when, the attestation
669
+ * method, supporting-evidence flags, and an optional sha256 signature
670
+ * hash (raw signature is never persisted). Writes to the
671
+ * `work_licensing.provenance_attestation` jsonb.
672
+ */
673
+ attest(workId: string, input?: {
674
+ method?: "self_declaration" | "collaborator_verified" | "third_party";
675
+ supporting_evidence?: {
676
+ session_files?: boolean;
677
+ stems_available?: boolean;
678
+ creation_timeline?: boolean;
679
+ witness_collaborators?: string[];
680
+ };
681
+ signature?: string;
682
+ }): Promise<{
683
+ work_id: string;
684
+ attestation: {
685
+ human_created: boolean;
686
+ attested_by: string;
687
+ attested_at: string;
688
+ attestation_method: string | null;
689
+ supporting_evidence: Record<string, unknown>;
690
+ ip_address?: string;
691
+ signature_hash?: string;
692
+ certificate_id?: string;
693
+ } | null;
694
+ }>;
666
695
  }
667
696
  declare class PeopleResource extends BaseResource {
668
697
  list(params?: {
@@ -739,6 +768,31 @@ declare class CreditsResource extends BaseResource {
739
768
  * semantics — never leaks 404 vs 403 via latency).
740
769
  */
741
770
  atomicRemove(workId: string, creditId: string): Promise<AtomicCreditResult>;
771
+ /**
772
+ * Send pending credits on a work to their recipients for attestation.
773
+ * Lightweight alternative to pica_split_sheet_send — fans out the
774
+ * notification rails (in-app + telegram + email) without generating
775
+ * a formal split-sheet document. Recipients click through to
776
+ * confirm/dispute; this call only sends the prompt.
777
+ */
778
+ sendForAttestation(workId: string, input?: {
779
+ credit_ids?: string[];
780
+ reminder_type?: "initial" | "reminder";
781
+ }): Promise<{
782
+ sent: number;
783
+ failed: number;
784
+ results: Array<{
785
+ person_id: string;
786
+ person_name?: string;
787
+ delivered: boolean;
788
+ reason?: string;
789
+ channels?: {
790
+ in_app: boolean;
791
+ telegram: boolean;
792
+ email: boolean;
793
+ };
794
+ }>;
795
+ }>;
742
796
  }
743
797
  declare class CreditsBalanceResource extends BaseResource {
744
798
  getBalance(): Promise<any>;
@@ -1624,7 +1678,7 @@ declare class OpsIssuesResource extends BaseResource {
1624
1678
  * audit trigger can't see.
1625
1679
  */
1626
1680
  reportIssue(params: {
1627
- kind: "workflow_gap" | "inconsistent_result" | "missing_step" | "data_issue" | "ux_confusion";
1681
+ kind: "workflow_gap" | "inconsistent_result" | "missing_step" | "data_issue" | "tool_failure" | "ux_confusion";
1628
1682
  summary: string;
1629
1683
  attempted?: string;
1630
1684
  expected?: string;
@@ -1773,7 +1827,9 @@ declare class ExportResource extends BaseResource {
1773
1827
  catalogCsv(params?: {
1774
1828
  format?: string;
1775
1829
  }): Promise<any>;
1776
- songRegistration(): Promise<any>;
1830
+ songRegistration(params?: {
1831
+ iswc_status?: "missing" | "present" | "all";
1832
+ }): Promise<any>;
1777
1833
  industryReady(): Promise<any>;
1778
1834
  catalogAssetReport(params: {
1779
1835
  sections: {
@@ -1906,8 +1962,9 @@ type ImportDomain = "works" | "people" | "recordings" | "documents" | "enquiries
1906
1962
  interface ImportAnalysis {
1907
1963
  parsed: {
1908
1964
  headers: string[];
1909
- rows: Record<string, string>[];
1965
+ preview: Record<string, string>[];
1910
1966
  totalRows: number;
1967
+ delimiter: string;
1911
1968
  };
1912
1969
  analysis: {
1913
1970
  mappings: Record<string, {
@@ -1949,9 +2006,22 @@ interface ImportResult {
1949
2006
  summary: string;
1950
2007
  dryRun: boolean;
1951
2008
  }
2009
+ /**
2010
+ * Source of CSV content — exactly one must be provided:
2011
+ * - `fileContent`: raw CSV as a string (legacy / inline path)
2012
+ * - `fileId`: a `documents.id` produced by `pica_upload_complete`,
2013
+ * resolved server-side via short-lived signed URL. Avoids paying
2014
+ * the tool-arg cost of pasting large CSVs.
2015
+ */
2016
+ type ImportFileSource = {
2017
+ fileContent: string;
2018
+ fileId?: never;
2019
+ } | {
2020
+ fileContent?: never;
2021
+ fileId: string;
2022
+ };
1952
2023
  declare class ImportResource extends BaseResource {
1953
- analyze(params: {
1954
- fileContent: string;
2024
+ analyze(params: ImportFileSource & {
1955
2025
  domain: ImportDomain;
1956
2026
  }): Promise<ImportAnalysis>;
1957
2027
  suggestMapping(params: {
@@ -1970,18 +2040,16 @@ declare class ImportResource extends BaseResource {
1970
2040
  missingRequiredFields: string[];
1971
2041
  aiSuggestions: string[];
1972
2042
  }>;
1973
- validate(params: {
2043
+ validate(params: ImportFileSource & {
1974
2044
  domain: ImportDomain;
1975
- fileContent: string;
1976
2045
  mapping: Array<{
1977
2046
  csvColumn: string;
1978
2047
  targetField: string;
1979
2048
  transformType?: string;
1980
2049
  }>;
1981
2050
  }): Promise<ImportValidation>;
1982
- execute(params: {
2051
+ execute(params: ImportFileSource & {
1983
2052
  domain: ImportDomain;
1984
- fileContent: string;
1985
2053
  mapping: Array<{
1986
2054
  csvColumn: string;
1987
2055
  targetField: string;
@@ -2195,6 +2263,178 @@ declare class CollaboratorsResource extends BaseResource {
2195
2263
  error?: string;
2196
2264
  email: string;
2197
2265
  }>>;
2266
+ /**
2267
+ * ADR-236 — preview an active invite by its one-time claim_code.
2268
+ * Returns the proposed credit shape WITHOUT mutating. The preview is
2269
+ * informational; a subsequent acceptByCode() atomically re-resolves and
2270
+ * may return `invite_terms_changed` if the sender modified the row.
2271
+ */
2272
+ previewByCode(code: string): Promise<{
2273
+ invite_id: string;
2274
+ work_id: string;
2275
+ work_title: string | null;
2276
+ credit_type: string;
2277
+ percentage_split: number | null;
2278
+ inviter_display_name: string | null;
2279
+ inviter_org_id: string | null;
2280
+ expires_at: string;
2281
+ claim_code: string | null;
2282
+ }>;
2283
+ /**
2284
+ * ADR-236 — accept an invite by its one-time claim_code. Atomically
2285
+ * re-resolves, writes the work_credit row in the inviter's org scope,
2286
+ * flips status to `confirmed`, and invalidates both invite_token and
2287
+ * claim_code. Throws on `invite_no_longer_valid`, `not_recipient`,
2288
+ * `invalid_code`.
2289
+ */
2290
+ acceptByCode(code: string): Promise<Record<string, unknown>>;
2291
+ /**
2292
+ * ADR-236 — recipient declines an invite by claim_code. Optional reason,
2293
+ * max 500 chars. Emits a discovery event to the inviter's org so the
2294
+ * sender's agent surfaces the decline.
2295
+ */
2296
+ declineByCode(code: string, reason?: string): Promise<Record<string, unknown>>;
2297
+ /**
2298
+ * ADR-236 — sender-side invite-status check. Returns status, claim
2299
+ * attempts, recipient resolution, and confirmed_user_id (if claimed).
2300
+ * One of invite_id or work_id is required.
2301
+ *
2302
+ * ADR-238 — `include_history: true` extends the response with `counters:
2303
+ * CollaborationInviteCounter[]` ordered chronologically. The counter
2304
+ * chain is the auditable negotiation trail.
2305
+ */
2306
+ inviteStatus(params: {
2307
+ invite_id?: string;
2308
+ work_id?: string;
2309
+ include_history?: boolean;
2310
+ }): Promise<Record<string, unknown>>;
2311
+ /**
2312
+ * ADR-238 — recipient proposes a counter on an active invite by code.
2313
+ * Server validates the recipient identity (workspace_email match),
2314
+ * round cap (5 per invite across both directions), and supersedes any
2315
+ * prior pending counter. Inserts a new pending counter; flips invite
2316
+ * to counter_proposed; emits counter_proposed event to sender.
2317
+ */
2318
+ proposeCounter(params: {
2319
+ code: string;
2320
+ credit_type: string;
2321
+ percentage_split: number;
2322
+ message?: string;
2323
+ }): Promise<Record<string, unknown>>;
2324
+ /**
2325
+ * ADR-238 — counter-party accepts a pending counter. Atomically writes
2326
+ * work_collaborators with COUNTER's values, flips counter to accepted,
2327
+ * supersedes earlier counters, flips invite to confirmed.
2328
+ * confirmed_user_id is the original recipient regardless of which
2329
+ * party proposed the accepted counter (credit-bearer invariant).
2330
+ */
2331
+ acceptCounter(counterId: string): Promise<Record<string, unknown>>;
2332
+ /**
2333
+ * ADR-238 — counter-party declines a pending counter. Reverts invite
2334
+ * to pending; the original proposal is implicitly back on the table.
2335
+ */
2336
+ declineCounter(counterId: string, reason?: string): Promise<Record<string, unknown>>;
2337
+ /**
2338
+ * ADR-238 — sender counters-back against a recipient's pending or
2339
+ * declined counter. Supersedes prior pending counters; inserts a new
2340
+ * sender-proposed pending counter; invite stays counter_proposed.
2341
+ * Round-cap counts (5 across both directions).
2342
+ */
2343
+ counterBack(params: {
2344
+ counter_id: string;
2345
+ credit_type: string;
2346
+ percentage_split: number;
2347
+ message?: string;
2348
+ }): Promise<Record<string, unknown>>;
2349
+ /**
2350
+ * ADR-236 — sender revokes a pending invite. Destructive tier — the
2351
+ * MCP layer enforces the two-step confirmation_token gate via
2352
+ * @withpica/mcp-utils; the SDK call assumes confirmation has already
2353
+ * been validated.
2354
+ */
2355
+ revokeInvite(inviteId: string): Promise<Record<string, unknown>>;
2356
+ }
2357
+ /**
2358
+ * ADR-236 — cross-org credit visibility for the recipient. Returns works
2359
+ * the caller is credited on in OTHER organisations.
2360
+ */
2361
+ declare class CollaborationsResource extends BaseResource {
2362
+ received(params?: {
2363
+ limit?: number;
2364
+ offset?: number;
2365
+ }): Promise<{
2366
+ works: Array<{
2367
+ work_id: string;
2368
+ title: string;
2369
+ owner_org_id: string;
2370
+ owner_org_name: string;
2371
+ my_role: string;
2372
+ my_split_percentage: number | null;
2373
+ accepted_at: string | null;
2374
+ collaboration_invite_id: string | null;
2375
+ }>;
2376
+ total: number;
2377
+ }>;
2378
+ }
2379
+ /**
2380
+ * ADR-237 — opt-in public handles + user-authored bio + avatar.
2381
+ * Cross-org discovery surface that lets the sender's agent invite a
2382
+ * collaborator by `@handle` without ever learning the recipient's
2383
+ * email (resolution happens server-side).
2384
+ */
2385
+ declare class UsersResource extends BaseResource {
2386
+ /**
2387
+ * Exact-match handle lookup. Same `{ found: false }` shape for
2388
+ * unclaimed | nonexistent | non-string input — never reveals
2389
+ * "exists but private". On a match, the public profile includes
2390
+ * `handle_accepts_invites` so the caller can decide whether to
2391
+ * proceed with an invite.
2392
+ */
2393
+ findByHandle(handle: string): Promise<{
2394
+ found: true;
2395
+ profile: {
2396
+ handle: string;
2397
+ display_name: string | null;
2398
+ avatar_url: string | null;
2399
+ bio: string | null;
2400
+ handle_accepts_invites: boolean;
2401
+ };
2402
+ } | {
2403
+ found: false;
2404
+ }>;
2405
+ setHandle(handle: string): Promise<{
2406
+ handle: string;
2407
+ }>;
2408
+ clearHandle(): Promise<void>;
2409
+ getMyProfile(): Promise<{
2410
+ user_id: string;
2411
+ workspace_email: string | null;
2412
+ full_name: string | null;
2413
+ public_handle: string | null;
2414
+ handle_accepts_invites: boolean;
2415
+ avatar_url: string | null;
2416
+ bio: string | null;
2417
+ linked_person_id: string | null;
2418
+ }>;
2419
+ setBio(bio: string | null): Promise<{
2420
+ bio: string | null;
2421
+ }>;
2422
+ setAvatarUrl(avatarUrl: string | null): Promise<{
2423
+ avatar_url: string | null;
2424
+ }>;
2425
+ /**
2426
+ * Copy `people.biography` into `user_profiles.bio`. Returns the new
2427
+ * bio on success. On `would_overwrite` (existing bio + overwrite
2428
+ * false), surfaces both the existing and proposed bios so the agent
2429
+ * can present a yes/no to the user before re-calling with
2430
+ * `overwrite: true`.
2431
+ */
2432
+ importBioFromPerson(params?: {
2433
+ overwrite?: boolean;
2434
+ }): Promise<{
2435
+ ok?: true;
2436
+ bio?: string;
2437
+ }>;
2198
2438
  }
2199
2439
  interface DirectorySettings {
2200
2440
  organisation_id: string;
@@ -2801,6 +3041,8 @@ export declare class PicaClient {
2801
3041
  exports: ExportResource;
2802
3042
  duplicates: DuplicatesResource;
2803
3043
  collaborators: CollaboratorsResource;
3044
+ collaborations: CollaborationsResource;
3045
+ users: UsersResource;
2804
3046
  entityContext: EntityContextResource;
2805
3047
  comparisons: ComparisonsResource;
2806
3048
  send: SendResource;