@withpica/mcp-sdk 1.27.0 → 1.28.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/dist/index.js CHANGED
@@ -258,6 +258,16 @@ class WorksResource extends BaseResource {
258
258
  const result = await this.request("GET", `/admin/works/${workId}/releases`);
259
259
  return result?.data || [];
260
260
  }
261
+ /**
262
+ * Stamp a human-creation provenance attestation. Complement to the
263
+ * AI-disclosure side — captures who signed, when, the attestation
264
+ * method, supporting-evidence flags, and an optional sha256 signature
265
+ * hash (raw signature is never persisted). Writes to the
266
+ * `work_licensing.provenance_attestation` jsonb.
267
+ */
268
+ async attest(workId, input) {
269
+ return this.request("POST", `/admin/works/${workId}/attest`, input ?? {});
270
+ }
261
271
  }
262
272
  class PeopleResource extends BaseResource {
263
273
  async list(params) {
@@ -406,6 +416,16 @@ class CreditsResource extends BaseResource {
406
416
  async atomicRemove(workId, creditId) {
407
417
  return this.request("DELETE", `/admin/works/${workId}/credits/${creditId}`);
408
418
  }
419
+ /**
420
+ * Send pending credits on a work to their recipients for attestation.
421
+ * Lightweight alternative to pica_split_sheet_send — fans out the
422
+ * notification rails (in-app + telegram + email) without generating
423
+ * a formal split-sheet document. Recipients click through to
424
+ * confirm/dispute; this call only sends the prompt.
425
+ */
426
+ async sendForAttestation(workId, input) {
427
+ return this.request("POST", `/admin/works/${workId}/credits/send-for-attestation`, input ?? {});
428
+ }
409
429
  }
410
430
  class CreditsBalanceResource extends BaseResource {
411
431
  async getBalance() {
@@ -1051,6 +1071,22 @@ class DashboardResource extends BaseResource {
1051
1071
  async pulse() {
1052
1072
  return this.request("GET", "/admin/dashboard/pulse");
1053
1073
  }
1074
+ /**
1075
+ * ADR-242 — actionable items projection.
1076
+ * Calls /admin/dashboard/actionable-items which is backed by the
1077
+ * shared getActionableIssues() source of truth. Returns per-row shape
1078
+ * with {class, entity_id, entity_type, entity_label, suggested_skill,
1079
+ * urgency_score}, sorted by urgency_score desc, capped at limit.
1080
+ */
1081
+ async actionableItems(params) {
1082
+ const query = new URLSearchParams();
1083
+ if (params?.class)
1084
+ query.set("class", params.class);
1085
+ if (params?.limit)
1086
+ query.set("limit", String(params.limit));
1087
+ const qs = query.toString();
1088
+ return this.request("GET", `/admin/dashboard/actionable-items${qs ? `?${qs}` : ""}`);
1089
+ }
1054
1090
  }
1055
1091
  // --- Integrations Resource ---
1056
1092
  class IntegrationsResource extends BaseResource {
@@ -1542,8 +1578,11 @@ class ExportResource extends BaseResource {
1542
1578
  const query = params?.format ? `?format=${params.format}` : "";
1543
1579
  return this.request("GET", `/admin/works/export${query}`);
1544
1580
  }
1545
- async songRegistration() {
1546
- return this.request("GET", "/admin/exports/song-registration");
1581
+ async songRegistration(params) {
1582
+ const qs = params?.iswc_status
1583
+ ? `?iswc_status=${encodeURIComponent(params.iswc_status)}`
1584
+ : "";
1585
+ return this.request("GET", `/admin/exports/song-registration${qs}`);
1547
1586
  }
1548
1587
  async industryReady() {
1549
1588
  return this.request("GET", "/admin/exports/industry-ready");
@@ -1828,6 +1867,181 @@ class CollaboratorsResource extends BaseResource {
1828
1867
  }
1829
1868
  return results;
1830
1869
  }
1870
+ /**
1871
+ * ADR-236 — preview an active invite by its one-time claim_code.
1872
+ * Returns the proposed credit shape WITHOUT mutating. The preview is
1873
+ * informational; a subsequent acceptByCode() atomically re-resolves and
1874
+ * may return `invite_terms_changed` if the sender modified the row.
1875
+ */
1876
+ async previewByCode(code) {
1877
+ return this.request("POST", "/admin/collaborators/preview-by-code", {
1878
+ code,
1879
+ });
1880
+ }
1881
+ /**
1882
+ * ADR-236 — accept an invite by its one-time claim_code. Atomically
1883
+ * re-resolves, writes the work_credit row in the inviter's org scope,
1884
+ * flips status to `confirmed`, and invalidates both invite_token and
1885
+ * claim_code. Throws on `invite_no_longer_valid`, `not_recipient`,
1886
+ * `invalid_code`.
1887
+ */
1888
+ async acceptByCode(code) {
1889
+ return this.request("POST", "/admin/collaborators/claim-by-code", { code });
1890
+ }
1891
+ /**
1892
+ * ADR-236 — recipient declines an invite by claim_code. Optional reason,
1893
+ * max 500 chars. Emits a discovery event to the inviter's org so the
1894
+ * sender's agent surfaces the decline.
1895
+ */
1896
+ async declineByCode(code, reason) {
1897
+ return this.request("POST", "/admin/collaborators/decline-by-code", {
1898
+ code,
1899
+ ...(reason ? { reason } : {}),
1900
+ });
1901
+ }
1902
+ /**
1903
+ * ADR-236 — sender-side invite-status check. Returns status, claim
1904
+ * attempts, recipient resolution, and confirmed_user_id (if claimed).
1905
+ * One of invite_id or work_id is required.
1906
+ *
1907
+ * ADR-238 — `include_history: true` extends the response with `counters:
1908
+ * CollaborationInviteCounter[]` ordered chronologically. The counter
1909
+ * chain is the auditable negotiation trail.
1910
+ */
1911
+ async inviteStatus(params) {
1912
+ const qp = new URLSearchParams();
1913
+ if (params.invite_id)
1914
+ qp.set("invite_id", params.invite_id);
1915
+ if (params.work_id)
1916
+ qp.set("work_id", params.work_id);
1917
+ if (params.include_history)
1918
+ qp.set("include_history", "true");
1919
+ return this.request("GET", `/admin/collaborators/invite-status?${qp.toString()}`);
1920
+ }
1921
+ /**
1922
+ * ADR-238 — recipient proposes a counter on an active invite by code.
1923
+ * Server validates the recipient identity (workspace_email match),
1924
+ * round cap (5 per invite across both directions), and supersedes any
1925
+ * prior pending counter. Inserts a new pending counter; flips invite
1926
+ * to counter_proposed; emits counter_proposed event to sender.
1927
+ */
1928
+ async proposeCounter(params) {
1929
+ return this.request("POST", "/admin/collaborators/counters/propose", {
1930
+ code: params.code,
1931
+ credit_type: params.credit_type,
1932
+ percentage_split: params.percentage_split,
1933
+ ...(params.message ? { message: params.message } : {}),
1934
+ });
1935
+ }
1936
+ /**
1937
+ * ADR-238 — counter-party accepts a pending counter. Atomically writes
1938
+ * work_collaborators with COUNTER's values, flips counter to accepted,
1939
+ * supersedes earlier counters, flips invite to confirmed.
1940
+ * confirmed_user_id is the original recipient regardless of which
1941
+ * party proposed the accepted counter (credit-bearer invariant).
1942
+ */
1943
+ async acceptCounter(counterId) {
1944
+ return this.request("POST", "/admin/collaborators/counters/accept", {
1945
+ counter_id: counterId,
1946
+ });
1947
+ }
1948
+ /**
1949
+ * ADR-238 — counter-party declines a pending counter. Reverts invite
1950
+ * to pending; the original proposal is implicitly back on the table.
1951
+ */
1952
+ async declineCounter(counterId, reason) {
1953
+ return this.request("POST", "/admin/collaborators/counters/decline", {
1954
+ counter_id: counterId,
1955
+ ...(reason ? { reason } : {}),
1956
+ });
1957
+ }
1958
+ /**
1959
+ * ADR-238 — sender counters-back against a recipient's pending or
1960
+ * declined counter. Supersedes prior pending counters; inserts a new
1961
+ * sender-proposed pending counter; invite stays counter_proposed.
1962
+ * Round-cap counts (5 across both directions).
1963
+ */
1964
+ async counterBack(params) {
1965
+ return this.request("POST", "/admin/collaborators/counters/counter-back", {
1966
+ counter_id: params.counter_id,
1967
+ credit_type: params.credit_type,
1968
+ percentage_split: params.percentage_split,
1969
+ ...(params.message ? { message: params.message } : {}),
1970
+ });
1971
+ }
1972
+ /**
1973
+ * ADR-236 — sender revokes a pending invite. Destructive tier — the
1974
+ * MCP layer enforces the two-step confirmation_token gate via
1975
+ * @withpica/mcp-utils; the SDK call assumes confirmation has already
1976
+ * been validated.
1977
+ */
1978
+ async revokeInvite(inviteId) {
1979
+ return this.request("POST", `/admin/collaborators/invites/${inviteId}/revoke`);
1980
+ }
1981
+ }
1982
+ /**
1983
+ * ADR-236 — cross-org credit visibility for the recipient. Returns works
1984
+ * the caller is credited on in OTHER organisations.
1985
+ */
1986
+ class CollaborationsResource extends BaseResource {
1987
+ async received(params) {
1988
+ const qp = new URLSearchParams();
1989
+ if (params?.limit !== undefined)
1990
+ qp.set("limit", String(params.limit));
1991
+ if (params?.offset !== undefined)
1992
+ qp.set("offset", String(params.offset));
1993
+ const qs = qp.toString();
1994
+ return this.request("GET", `/admin/collaborations/received${qs ? `?${qs}` : ""}`);
1995
+ }
1996
+ }
1997
+ /**
1998
+ * ADR-237 — opt-in public handles + user-authored bio + avatar.
1999
+ * Cross-org discovery surface that lets the sender's agent invite a
2000
+ * collaborator by `@handle` without ever learning the recipient's
2001
+ * email (resolution happens server-side).
2002
+ */
2003
+ class UsersResource extends BaseResource {
2004
+ /**
2005
+ * Exact-match handle lookup. Same `{ found: false }` shape for
2006
+ * unclaimed | nonexistent | non-string input — never reveals
2007
+ * "exists but private". On a match, the public profile includes
2008
+ * `handle_accepts_invites` so the caller can decide whether to
2009
+ * proceed with an invite.
2010
+ */
2011
+ async findByHandle(handle) {
2012
+ const res = await this.request("POST", "/admin/users/find-by-handle", { handle });
2013
+ return res.data;
2014
+ }
2015
+ async setHandle(handle) {
2016
+ const res = await this.request("POST", "/admin/users/handle", { handle });
2017
+ return res.data;
2018
+ }
2019
+ async clearHandle() {
2020
+ await this.request("DELETE", "/admin/users/handle");
2021
+ }
2022
+ async getMyProfile() {
2023
+ const res = await this.request("GET", "/admin/users/profile");
2024
+ return res.data;
2025
+ }
2026
+ async setBio(bio) {
2027
+ const res = await this.request("POST", "/admin/users/bio", { bio });
2028
+ return res.data;
2029
+ }
2030
+ async setAvatarUrl(avatarUrl) {
2031
+ const res = await this.request("POST", "/admin/users/avatar", { avatar_url: avatarUrl });
2032
+ return res.data;
2033
+ }
2034
+ /**
2035
+ * Copy `people.biography` into `user_profiles.bio`. Returns the new
2036
+ * bio on success. On `would_overwrite` (existing bio + overwrite
2037
+ * false), surfaces both the existing and proposed bios so the agent
2038
+ * can present a yes/no to the user before re-calling with
2039
+ * `overwrite: true`.
2040
+ */
2041
+ async importBioFromPerson(params) {
2042
+ const res = await this.request("POST", "/admin/users/import-bio-from-person", params ?? {});
2043
+ return res.data;
2044
+ }
1831
2045
  }
1832
2046
  class DirectoryResource extends BaseResource {
1833
2047
  async getSettings() {
@@ -1911,6 +2125,16 @@ class CountExplainResource extends BaseResource {
1911
2125
  }
1912
2126
  return this.request("GET", `/admin/count-explain?${params.toString()}`);
1913
2127
  }
2128
+ /**
2129
+ * ADR-242 — GET /admin/count-explain (no count_source)
2130
+ *
2131
+ * Returns the full actionable taxonomy as sources[] with drill_down_skill.
2132
+ * This is the coherence surface that ties pica_dashboard_briefing.critical_issues_total
2133
+ * to the per-class breakdown, making pica_count_explain a machine-readable routing table.
2134
+ */
2135
+ async taxonomy() {
2136
+ return this.request("GET", "/admin/count-explain");
2137
+ }
1914
2138
  }
1915
2139
  class AudioPipelineStatusResource extends BaseResource {
1916
2140
  /**
@@ -2459,6 +2683,9 @@ export class PicaClient {
2459
2683
  exports;
2460
2684
  duplicates;
2461
2685
  collaborators;
2686
+ collaborations;
2687
+ // ADR-237 — opt-in public handles + bio + avatar (cross-org discovery)
2688
+ users;
2462
2689
  entityContext;
2463
2690
  comparisons;
2464
2691
  send;
@@ -2556,6 +2783,9 @@ export class PicaClient {
2556
2783
  this.exports = new ExportResource(baseUrl, config.apiKey, debug);
2557
2784
  this.duplicates = new DuplicatesResource(baseUrl, config.apiKey, debug);
2558
2785
  this.collaborators = new CollaboratorsResource(baseUrl, config.apiKey, debug);
2786
+ this.collaborations = new CollaborationsResource(baseUrl, config.apiKey, debug);
2787
+ // ADR-237 — opt-in public handles + bio + avatar (cross-org discovery)
2788
+ this.users = new UsersResource(baseUrl, config.apiKey, debug);
2559
2789
  this.entityContext = new EntityContextResource(baseUrl, config.apiKey, debug);
2560
2790
  this.comparisons = new ComparisonsResource(baseUrl, config.apiKey, debug);
2561
2791
  this.send = new SendResource(baseUrl, config.apiKey, debug);