@withpica/mcp-sdk 1.24.0 → 1.25.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.d.ts CHANGED
@@ -708,35 +708,11 @@ declare class LicensingResource extends BaseResource {
708
708
  */
709
709
  updateEnquiryStatus(id: string, status: string, notes?: string): Promise<LicenseEnquiry>;
710
710
  }
711
- export interface WorkCreditAtomicAddInput {
712
- person_id: string;
713
- credit_type?: "writer" | "composer" | "arranger" | "lyricist" | "producer" | "performer" | "engineer" | "mixer" | "mastering" | "owner" | "vocalist" | "instrumentalist" | "conductor" | "programmer" | "remixer";
714
- share_pct?: number;
715
- notes?: string;
716
- }
717
- export interface AtomicCreditResult {
718
- credit_id: string;
719
- credit?: Record<string, unknown>;
720
- work_id?: string;
721
- recording_id?: string;
722
- }
723
711
  declare class CreditsResource extends BaseResource {
724
712
  listForWork(workId: string): Promise<WorkCredit[]>;
725
713
  updateForWork(workId: string, credits: WorkCreditsInput): Promise<WorkCredit[]>;
726
714
  listCollaborators(workId: string): Promise<WorkCredit[]>;
727
715
  updateCollaborators(workId: string, collaborators: WorkCreditsInput): Promise<WorkCredit[]>;
728
- /**
729
- * ADR-232 atomic add — INSERT a single work credit. Race-safe under
730
- * concurrent writes (replace_work_credits is read-modify-write and
731
- * therefore not atomic for this verb). Returns the new credit_id.
732
- */
733
- atomicAdd(workId: string, input: WorkCreditAtomicAddInput): Promise<AtomicCreditResult>;
734
- /**
735
- * ADR-232 atomic remove — DELETE…RETURNING with 0-row → 403
736
- * INSUFFICIENT_SCOPE. No SELECT pre-probe (constant-time existence
737
- * semantics — never leaks 404 vs 403 via latency).
738
- */
739
- atomicRemove(workId: string, creditId: string): Promise<AtomicCreditResult>;
740
716
  }
741
717
  declare class CreditsBalanceResource extends BaseResource {
742
718
  getBalance(): Promise<any>;
@@ -911,28 +887,28 @@ declare class WorkspaceResource extends BaseResource {
911
887
  }>;
912
888
  }>;
913
889
  }
914
- declare class ShareSendResource extends BaseResource {
915
- send(args: {
916
- entity_type: "recording" | "work" | "audio_file" | "document";
917
- entity_id: string;
918
- recipient: {
919
- kind: "user_id" | "collaborator_id" | "email";
920
- value: string;
921
- };
922
- note?: string;
923
- expires_in_days?: number;
924
- scope?: "view" | "view+download";
925
- confirm_first_external_send?: boolean;
926
- }): Promise<{
927
- send_id: string;
928
- share_link_id: string;
929
- share_url: string;
930
- recipient_resolution: {
931
- classification: "internal_user" | "internal_contact" | "external";
932
- display_name: string | null;
933
- email_hash_prefix: string;
934
- };
935
- }>;
890
+ /**
891
+ * File delivery — first-class outbound-sharing record. Each delivery ties
892
+ * a file id to a specific recipient email with a token, expiry, and
893
+ * revocation capability. Wraps the routes under `/admin/files/deliver`.
894
+ */
895
+ export interface FileDeliveryLink {
896
+ id: string;
897
+ organisation_id: string;
898
+ file_id: string;
899
+ recipient_email: string;
900
+ access_token: string;
901
+ expires_at: string;
902
+ created_at: string;
903
+ revoked: boolean;
904
+ }
905
+ export declare class FilesResource extends BaseResource {
906
+ deliver(params: {
907
+ fileId: string;
908
+ recipientEmail: string;
909
+ expiresIn?: number;
910
+ }): Promise<FileDeliveryLink>;
911
+ revokeDelivery(deliveryId: string): Promise<void>;
936
912
  }
937
913
  declare class AuditResource extends BaseResource {
938
914
  list(params?: {
@@ -940,12 +916,6 @@ declare class AuditResource extends BaseResource {
940
916
  since?: string;
941
917
  tool_name?: string;
942
918
  risk_level?: string;
943
- /**
944
- * ADR-230 — filter by declared authority tier ("read" | "draft" |
945
- * "write" | "destructive"). The 4-value tier is PICA's authority
946
- * detail; risk_level remains the MCP-standard 3-value hint.
947
- */
948
- tier?: string;
949
919
  result_status?: string;
950
920
  }): Promise<any[]>;
951
921
  }
@@ -1618,57 +1588,6 @@ declare class OpsIssuesResource extends BaseResource {
1618
1588
  limit?: number;
1619
1589
  }): Promise<MyReportedIssue[]>;
1620
1590
  }
1621
- /**
1622
- * Reads from the Phase 4 substrate — `assistant_interactions` and
1623
- * `mcp_sessions`. Powers `pica_my_recent_questions` (the auditability tool)
1624
- * and the `pica_continue` prompt's open-loop offers.
1625
- *
1626
- * Strictly user-scoped: the API routes assert a non-null userId from the
1627
- * auth context and rely on RLS `(user_id = auth.uid())` for defence in depth.
1628
- */
1629
- export interface RecentInteractionEntry {
1630
- id: string;
1631
- session_id: string;
1632
- intent: string;
1633
- tools_used: string[] | null;
1634
- prompt_excerpt: string | null;
1635
- result_summary: string | null;
1636
- success: boolean;
1637
- was_confirmed: boolean | null;
1638
- required_confirmation: boolean | null;
1639
- created_at: string;
1640
- client_name: string | null;
1641
- client_version: string | null;
1642
- transport: string;
1643
- }
1644
- export interface OpenLoopEntry {
1645
- session_id: string;
1646
- reason: "unconfirmed_write" | "incomplete_multi_step";
1647
- intent: string;
1648
- result_summary: string | null;
1649
- entity_type: string | null;
1650
- entity_ids: string[] | null;
1651
- created_at: string;
1652
- }
1653
- declare class AssistantInteractionsResource extends BaseResource {
1654
- listRecent(params?: {
1655
- sessionId?: string;
1656
- since?: string;
1657
- success?: boolean;
1658
- intent?: string;
1659
- limit?: number;
1660
- }): Promise<RecentInteractionEntry[]>;
1661
- detectOpenLoops(): Promise<OpenLoopEntry[]>;
1662
- /**
1663
- * ADR-226 Phase 6 — fetch the user's vocabulary context as a single
1664
- * pre-rendered string (or null when the user has no entries). Hit by
1665
- * the stdio MCP server during start(), before transport.connect, to
1666
- * compose handshake-time server-instructions.
1667
- */
1668
- getVocabularyContext(): Promise<{
1669
- instructions: string | null;
1670
- }>;
1671
- }
1672
1591
  /**
1673
1592
  * Session-auth-only surface: the three HTTP routes backing these
1674
1593
  * methods refuse `pica_grant_` callers with 403 `session_auth_required`
@@ -2225,133 +2144,6 @@ export interface RecordingCreditCreateInput {
2225
2144
  declare class RecordingCreditsResource extends BaseResource {
2226
2145
  list(recordingId: string): Promise<RecordingCredit[]>;
2227
2146
  create(recordingId: string, input: RecordingCreditCreateInput): Promise<RecordingCredit>;
2228
- /**
2229
- * ADR-232 atomic add — semantically identical to `create` (a recording
2230
- * credit INSERT is already atomic) but reads more naturally next to
2231
- * CreditsResource.atomicAdd in the pica_credit_add tool implementation.
2232
- */
2233
- atomicAdd(recordingId: string, input: RecordingCreditCreateInput): Promise<AtomicCreditResult>;
2234
- /**
2235
- * ADR-232 atomic remove — DELETE with `?atomic=1` so the route returns 403
2236
- * INSUFFICIENT_SCOPE on 0-row instead of the legacy lenient silent
2237
- * success. AC-2 strict semantics for pica_credit_remove.
2238
- */
2239
- atomicRemove(recordingId: string, creditId: string): Promise<AtomicCreditResult>;
2240
- }
2241
- export type ShareTraceEntityType = "work" | "recording" | "person";
2242
- export interface ShareTraceQuery {
2243
- entity_type: ShareTraceEntityType;
2244
- entity_id: string;
2245
- viewer_user_id?: string;
2246
- viewer_org_id?: string;
2247
- }
2248
- export interface ShareTraceReason {
2249
- kind: "org_membership" | "custody_chain" | "share_link" | "cross_org_grant";
2250
- directness: 1 | 2 | 3 | 4;
2251
- via_org_id?: string;
2252
- via_org_name?: string | null;
2253
- chain_hops?: Array<{
2254
- custodian_org_id: string;
2255
- custodian_org_name?: string | null;
2256
- percentage: number;
2257
- territory: string;
2258
- }>;
2259
- share_link_id?: string;
2260
- expires_at?: string | null;
2261
- grant_id?: string;
2262
- scope?: string[];
2263
- granted_at?: string | null;
2264
- }
2265
- export interface ShareTraceResult {
2266
- entity: {
2267
- type: ShareTraceEntityType;
2268
- id: string;
2269
- name: string;
2270
- };
2271
- viewer: {
2272
- type: "user" | "org";
2273
- id: string;
2274
- name: string | null;
2275
- };
2276
- has_access: boolean;
2277
- reasons: ShareTraceReason[];
2278
- }
2279
- export interface CountExplainQuery {
2280
- count_source: string;
2281
- observed_value?: number;
2282
- }
2283
- export interface CountExplainResult {
2284
- source: {
2285
- name: string;
2286
- query: string;
2287
- description: string;
2288
- };
2289
- computed_value: number;
2290
- observed_value: number | null;
2291
- delta: number | null;
2292
- delta_breakdown?: Array<{
2293
- reason: string;
2294
- count: number;
2295
- sample_ids: string[];
2296
- }>;
2297
- }
2298
- declare class CountExplainResource extends BaseResource {
2299
- /**
2300
- * GET /admin/count-explain — explains a single dashboard / briefing
2301
- * count by reproducing the canonical query and (optionally) breaking
2302
- * down the delta against an observed value.
2303
- */
2304
- explain(query: CountExplainQuery): Promise<CountExplainResult>;
2305
- }
2306
- export interface AudioPipelineStatusQuery {
2307
- window_days?: number;
2308
- }
2309
- export interface AudioPipelineByState {
2310
- pending: number;
2311
- complete: number;
2312
- failed: number;
2313
- stuck_over_24h: number;
2314
- }
2315
- export interface AudioPipelineStatusResult {
2316
- window_days: number;
2317
- by_state: AudioPipelineByState;
2318
- samples: {
2319
- pending: Array<{
2320
- audio_file_id: string;
2321
- work_id: string | null;
2322
- queued_at: string;
2323
- }>;
2324
- failed: Array<{
2325
- audio_file_id: string;
2326
- work_id: string | null;
2327
- error: string | null;
2328
- last_attempt: string | null;
2329
- }>;
2330
- stuck_over_24h: Array<{
2331
- audio_file_id: string;
2332
- work_id: string | null;
2333
- queued_at: string;
2334
- last_attempt: string | null;
2335
- }>;
2336
- };
2337
- }
2338
- declare class AudioPipelineStatusResource extends BaseResource {
2339
- /**
2340
- * GET /admin/audio-pipeline-status — operational read of the audio
2341
- * analysis pipeline state for the calling org. AC-7: every bucket is
2342
- * an integer (zero-org reports structured zeros, not nulls).
2343
- */
2344
- status(query?: AudioPipelineStatusQuery): Promise<AudioPipelineStatusResult>;
2345
- }
2346
- declare class ShareTraceResource extends BaseResource {
2347
- /**
2348
- * GET /admin/share-trace — returns the unioned chain of reasons a
2349
- * viewer can see an entity. AC-3: 403 + INSUFFICIENT_SCOPE if the
2350
- * caller doesn't own the entity (existence-leak protection). AC-4:
2351
- * has_access:false with reasons:[] when the caller IS the owner but
2352
- * the viewer can't see.
2353
- */
2354
- trace(query: ShareTraceQuery): Promise<ShareTraceResult>;
2355
2147
  }
2356
2148
  declare class RecordingSplitsResource extends BaseResource {
2357
2149
  list(recordingId: string): Promise<any>;
@@ -2691,60 +2483,6 @@ declare class ImportDocumentsResource extends BaseResource {
2691
2483
  get(id: string): Promise<any>;
2692
2484
  ingest(content: string): Promise<any>;
2693
2485
  }
2694
- export type AccessSimulateEntityType = "work" | "recording" | "person" | "release";
2695
- export type AccessSimulateAction = "view" | "share_link_preview" | "claim" | "grant";
2696
- export type AccessSimulateRecipientType = "user" | "anonymous" | "share_link";
2697
- export interface AccessSimulateShareLinkConfig {
2698
- access_type: "private" | "limited" | "public";
2699
- allow_download?: boolean;
2700
- allow_streaming?: boolean;
2701
- allow_comments?: boolean;
2702
- allow_view_collaborators?: boolean;
2703
- allow_view_financials?: boolean;
2704
- watermark_audio?: boolean;
2705
- notify_on_access?: boolean;
2706
- allowed_person_ids?: string[];
2707
- sent_to_emails?: string[];
2708
- max_views?: number | null;
2709
- expires_at?: string | null;
2710
- }
2711
- export interface AccessSimulateInput {
2712
- entity_type: AccessSimulateEntityType;
2713
- entity_id: string;
2714
- action: AccessSimulateAction;
2715
- recipient: {
2716
- type: AccessSimulateRecipientType;
2717
- user_id?: string;
2718
- org_id?: string;
2719
- share_config?: AccessSimulateShareLinkConfig;
2720
- };
2721
- }
2722
- export type AccessSimulateRuleName = "rls" | "share_link" | "collaborator" | "cross_org_grant" | "identity_inheritance" | "not_yet_supported" | "entity_not_found";
2723
- export interface AccessSimulateReason {
2724
- rule: AccessSimulateRuleName;
2725
- decision: "allow" | "deny" | "info";
2726
- detail: string;
2727
- applies_to?: string[];
2728
- }
2729
- export interface AccessSimulateWarning {
2730
- severity: "info" | "warn" | "error";
2731
- message: string;
2732
- }
2733
- export interface AccessSimulateResult {
2734
- entity_type: AccessSimulateEntityType;
2735
- entity_id: string;
2736
- action: AccessSimulateAction;
2737
- visible: boolean;
2738
- visible_fields: string[];
2739
- hidden_fields: string[];
2740
- visible_relations: Record<string, "visible" | "hidden" | "watermarked">;
2741
- reasons: AccessSimulateReason[];
2742
- warnings: AccessSimulateWarning[];
2743
- not_yet_supported?: boolean;
2744
- }
2745
- declare class AccessSimulateResource extends BaseResource {
2746
- simulate(input: AccessSimulateInput): Promise<AccessSimulateResult>;
2747
- }
2748
2486
  export declare class PicaClient {
2749
2487
  works: WorksResource;
2750
2488
  people: PeopleResource;
@@ -2754,6 +2492,7 @@ export declare class PicaClient {
2754
2492
  creditsBalance: CreditsBalanceResource;
2755
2493
  picaScore: PicaScoreResource;
2756
2494
  audioFiles: AudioFilesResource;
2495
+ files: FilesResource;
2757
2496
  multimedia: MultimediaResource;
2758
2497
  agreements: AgreementsResource;
2759
2498
  syncPlacements: SyncPlacementsResource;
@@ -2790,9 +2529,6 @@ export declare class PicaClient {
2790
2529
  splitSheets: SplitSheetsResource;
2791
2530
  recordingSplits: RecordingSplitsResource;
2792
2531
  recordingCredits: RecordingCreditsResource;
2793
- shareTrace: ShareTraceResource;
2794
- countExplain: CountExplainResource;
2795
- audioPipelineStatus: AudioPipelineStatusResource;
2796
2532
  publishers: PublishersResource;
2797
2533
  labels: LabelsResource;
2798
2534
  agreementTemplates: AgreementTemplatesResource;
@@ -2814,9 +2550,6 @@ export declare class PicaClient {
2814
2550
  agentIdentity: AgentIdentityResource;
2815
2551
  uploads: UploadsResource;
2816
2552
  groups: GroupsResource;
2817
- assistantInteractions: AssistantInteractionsResource;
2818
- shareSend: ShareSendResource;
2819
- accessSimulate: AccessSimulateResource;
2820
2553
  /**
2821
2554
  * Get accurate catalog stats via SQL counts (no pagination limits)
2822
2555
  */