@withpica/mcp-server 2.102.0 → 2.104.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 +114 -0
- package/README.md +10 -6
- package/dist/lib/changelog.generated.d.ts +2 -2
- package/dist/lib/changelog.generated.d.ts.map +1 -1
- package/dist/lib/changelog.generated.js +2 -2
- package/dist/lib/changelog.generated.js.map +1 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +28 -1
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/required-schemas.generated.d.ts +77 -0
- package/dist/resources/required-schemas.generated.d.ts.map +1 -1
- package/dist/resources/required-schemas.generated.js +114 -0
- package/dist/resources/required-schemas.generated.js.map +1 -1
- package/dist/resources/required-schemas.source.d.ts.map +1 -1
- package/dist/resources/required-schemas.source.js +85 -0
- package/dist/resources/required-schemas.source.js.map +1 -1
- package/dist/server-instructions.d.ts +2 -2
- package/dist/server-instructions.d.ts.map +1 -1
- package/dist/server-instructions.js +2 -0
- package/dist/server-instructions.js.map +1 -1
- package/dist/skills/skills.generated.d.ts.map +1 -1
- package/dist/skills/skills.generated.js +36 -3
- package/dist/skills/skills.generated.js.map +1 -1
- package/dist/tools/agent-hygiene.d.ts.map +1 -1
- package/dist/tools/agent-hygiene.js +2 -0
- package/dist/tools/agent-hygiene.js.map +1 -1
- package/dist/tools/agreement-types.d.ts.map +1 -1
- package/dist/tools/agreement-types.js +2 -0
- package/dist/tools/agreement-types.js.map +1 -1
- package/dist/tools/agreements.d.ts.map +1 -1
- package/dist/tools/agreements.js +9 -2
- package/dist/tools/agreements.js.map +1 -1
- package/dist/tools/assets.d.ts.map +1 -1
- package/dist/tools/assets.js +2 -0
- package/dist/tools/assets.js.map +1 -1
- package/dist/tools/audio-files.d.ts.map +1 -1
- package/dist/tools/audio-files.js +12 -8
- package/dist/tools/audio-files.js.map +1 -1
- package/dist/tools/audit.d.ts.map +1 -1
- package/dist/tools/audit.js +2 -0
- package/dist/tools/audit.js.map +1 -1
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +2 -0
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/bookings.d.ts.map +1 -1
- package/dist/tools/bookings.js +8 -4
- package/dist/tools/bookings.js.map +1 -1
- package/dist/tools/catalogue-argument.d.ts +76 -0
- package/dist/tools/catalogue-argument.d.ts.map +1 -0
- package/dist/tools/catalogue-argument.js +114 -0
- package/dist/tools/catalogue-argument.js.map +1 -0
- package/dist/tools/collaborations.d.ts.map +1 -1
- package/dist/tools/collaborations.js +2 -0
- package/dist/tools/collaborations.js.map +1 -1
- package/dist/tools/collaborators.d.ts.map +1 -1
- package/dist/tools/collaborators.js +33 -6
- package/dist/tools/collaborators.js.map +1 -1
- package/dist/tools/consent.d.ts.map +1 -1
- package/dist/tools/consent.js +5 -1
- package/dist/tools/consent.js.map +1 -1
- package/dist/tools/custody.d.ts +2 -2
- package/dist/tools/custody.d.ts.map +1 -1
- package/dist/tools/custody.js +47 -25
- package/dist/tools/custody.js.map +1 -1
- package/dist/tools/dashboard.d.ts.map +1 -1
- package/dist/tools/dashboard.js +12 -4
- package/dist/tools/dashboard.js.map +1 -1
- package/dist/tools/directory.d.ts.map +1 -1
- package/dist/tools/directory.js +7 -3
- package/dist/tools/directory.js.map +1 -1
- package/dist/tools/discovery.d.ts.map +1 -1
- package/dist/tools/discovery.js +31 -2
- package/dist/tools/discovery.js.map +1 -1
- package/dist/tools/documents.js +2 -2
- package/dist/tools/documents.js.map +1 -1
- package/dist/tools/duplicates.d.ts +15 -2
- package/dist/tools/duplicates.d.ts.map +1 -1
- package/dist/tools/duplicates.js +120 -14
- package/dist/tools/duplicates.js.map +1 -1
- package/dist/tools/enrichment.d.ts.map +1 -1
- package/dist/tools/enrichment.js +24 -32
- package/dist/tools/enrichment.js.map +1 -1
- package/dist/tools/handovers.d.ts +42 -0
- package/dist/tools/handovers.d.ts.map +1 -0
- package/dist/tools/handovers.js +302 -0
- package/dist/tools/handovers.js.map +1 -0
- package/dist/tools/import-documents.d.ts.map +1 -1
- package/dist/tools/import-documents.js +4 -0
- package/dist/tools/import-documents.js.map +1 -1
- package/dist/tools/index.d.ts +14 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +102 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/labels.d.ts.map +1 -1
- package/dist/tools/labels.js +18 -2
- package/dist/tools/labels.js.map +1 -1
- package/dist/tools/licensing.d.ts.map +1 -1
- package/dist/tools/licensing.js +13 -6
- package/dist/tools/licensing.js.map +1 -1
- package/dist/tools/measured-audio.d.ts +32 -0
- package/dist/tools/measured-audio.d.ts.map +1 -0
- package/dist/tools/measured-audio.js +65 -0
- package/dist/tools/measured-audio.js.map +1 -0
- package/dist/tools/memory.d.ts.map +1 -1
- package/dist/tools/memory.js +2 -0
- package/dist/tools/memory.js.map +1 -1
- package/dist/tools/metadata.d.ts.map +1 -1
- package/dist/tools/metadata.js +115 -0
- package/dist/tools/metadata.js.map +1 -1
- package/dist/tools/multimedia.d.ts.map +1 -1
- package/dist/tools/multimedia.js +2 -0
- package/dist/tools/multimedia.js.map +1 -1
- package/dist/tools/my-recent-questions.d.ts.map +1 -1
- package/dist/tools/my-recent-questions.js +2 -0
- package/dist/tools/my-recent-questions.js.map +1 -1
- package/dist/tools/my-reported-issues.d.ts.map +1 -1
- package/dist/tools/my-reported-issues.js +2 -0
- package/dist/tools/my-reported-issues.js.map +1 -1
- package/dist/tools/notes.d.ts.map +1 -1
- package/dist/tools/notes.js +2 -0
- package/dist/tools/notes.js.map +1 -1
- package/dist/tools/notifications.d.ts.map +1 -1
- package/dist/tools/notifications.js +12 -3
- package/dist/tools/notifications.js.map +1 -1
- package/dist/tools/party-claims.d.ts.map +1 -1
- package/dist/tools/party-claims.js +14 -3
- package/dist/tools/party-claims.js.map +1 -1
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js +58 -47
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/profile-claims.d.ts +6 -0
- package/dist/tools/profile-claims.d.ts.map +1 -1
- package/dist/tools/profile-claims.js +7 -0
- package/dist/tools/profile-claims.js.map +1 -1
- package/dist/tools/projects.d.ts.map +1 -1
- package/dist/tools/projects.js +2 -0
- package/dist/tools/projects.js.map +1 -1
- package/dist/tools/publishers.d.ts.map +1 -1
- package/dist/tools/publishers.js +20 -5
- package/dist/tools/publishers.js.map +1 -1
- package/dist/tools/recordings.d.ts.map +1 -1
- package/dist/tools/recordings.js +49 -49
- package/dist/tools/recordings.js.map +1 -1
- package/dist/tools/recovery-hints.d.ts.map +1 -1
- package/dist/tools/recovery-hints.js +143 -0
- package/dist/tools/recovery-hints.js.map +1 -1
- package/dist/tools/relationship-change.d.ts +16 -0
- package/dist/tools/relationship-change.d.ts.map +1 -0
- package/dist/tools/relationship-change.js +60 -0
- package/dist/tools/relationship-change.js.map +1 -0
- package/dist/tools/relationship-copy.d.ts +99 -0
- package/dist/tools/relationship-copy.d.ts.map +1 -0
- package/dist/tools/relationship-copy.js +213 -0
- package/dist/tools/relationship-copy.js.map +1 -0
- package/dist/tools/relationship-scope.d.ts +104 -0
- package/dist/tools/relationship-scope.d.ts.map +1 -0
- package/dist/tools/relationship-scope.js +106 -0
- package/dist/tools/relationship-scope.js.map +1 -0
- package/dist/tools/relationships.d.ts +64 -0
- package/dist/tools/relationships.d.ts.map +1 -0
- package/dist/tools/relationships.js +1062 -0
- package/dist/tools/relationships.js.map +1 -0
- package/dist/tools/release-notes.d.ts.map +1 -1
- package/dist/tools/release-notes.js +2 -0
- package/dist/tools/release-notes.js.map +1 -1
- package/dist/tools/release-rich.d.ts.map +1 -1
- package/dist/tools/release-rich.js +4 -6
- package/dist/tools/release-rich.js.map +1 -1
- package/dist/tools/releases.d.ts.map +1 -1
- package/dist/tools/releases.js +16 -11
- package/dist/tools/releases.js.map +1 -1
- package/dist/tools/royalties.d.ts.map +1 -1
- package/dist/tools/royalties.js +10 -0
- package/dist/tools/royalties.js.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +2 -0
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/selections.d.ts.map +1 -1
- package/dist/tools/selections.js +4 -0
- package/dist/tools/selections.js.map +1 -1
- package/dist/tools/send.d.ts.map +1 -1
- package/dist/tools/send.js +2 -0
- package/dist/tools/send.js.map +1 -1
- package/dist/tools/sessions.d.ts.map +1 -1
- package/dist/tools/sessions.js +13 -7
- package/dist/tools/sessions.js.map +1 -1
- package/dist/tools/settings.d.ts.map +1 -1
- package/dist/tools/settings.js +4 -1
- package/dist/tools/settings.js.map +1 -1
- package/dist/tools/statements.d.ts.map +1 -1
- package/dist/tools/statements.js +2 -0
- package/dist/tools/statements.js.map +1 -1
- package/dist/tools/sync-fit.d.ts +27 -0
- package/dist/tools/sync-fit.d.ts.map +1 -0
- package/dist/tools/sync-fit.js +118 -0
- package/dist/tools/sync-fit.js.map +1 -0
- package/dist/tools/sync-placements.d.ts.map +1 -1
- package/dist/tools/sync-placements.js +2 -0
- package/dist/tools/sync-placements.js.map +1 -1
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +14 -3
- package/dist/tools/users.js.map +1 -1
- package/dist/tools/work-themes.d.ts +39 -0
- package/dist/tools/work-themes.d.ts.map +1 -0
- package/dist/tools/work-themes.js +330 -0
- package/dist/tools/work-themes.js.map +1 -0
- package/dist/tools/works.d.ts +11 -0
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js +67 -5
- package/dist/tools/works.js.map +1 -1
- package/package.json +4 -4
- package/scripts/build-required-schemas.ts +6 -4
- package/server.json +2 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ToolResult } from "./index.js";
|
|
2
|
+
export type ChangeOutcome<T> = {
|
|
3
|
+
kind: "proposed";
|
|
4
|
+
reference: string;
|
|
5
|
+
expiresAt: string | null;
|
|
6
|
+
} | {
|
|
7
|
+
kind: "applied";
|
|
8
|
+
record: T;
|
|
9
|
+
};
|
|
10
|
+
export declare function readChangeOutcome<T>(answer: unknown): ChangeOutcome<T>;
|
|
11
|
+
/** The answer for a change sent to the client as a proposal. */
|
|
12
|
+
export declare function formatProposedChange(entity: "work" | "recording", id: string, fields: string[], outcome: {
|
|
13
|
+
reference: string;
|
|
14
|
+
expiresAt: string | null;
|
|
15
|
+
}): ToolResult;
|
|
16
|
+
//# sourceMappingURL=relationship-change.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship-change.d.ts","sourceRoot":"","sources":["../../src/tools/relationship-change.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,MAAM,aAAa,CAAC,CAAC,IACvB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC;AAEnC,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,CAgCtE;AAED,gEAAgE;AAChE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,GAAG,WAAW,EAC5B,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACvD,UAAU,CAYZ"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
/**
|
|
3
|
+
* What a song or recording edit in a CLIENT's catalogue came back as
|
|
4
|
+
* (ADR-333 PR 1.3).
|
|
5
|
+
*
|
|
6
|
+
* PATCH /api/admin/works/:id and /recordings/:id, named for a client
|
|
7
|
+
* catalogue, answer one of two envelopes (clientCataloguePatch in each route,
|
|
8
|
+
* lib/services/relationship-proposals.ts changeThroughRelationship):
|
|
9
|
+
* - a proposal, 202 `{ applied: false, proposal_reference, expires_at,
|
|
10
|
+
* message }`: nothing has changed; the client's owners decide it;
|
|
11
|
+
* - a direct change (an administrator), `{ applied: true, result }`: the
|
|
12
|
+
* updated record is `result`.
|
|
13
|
+
* In the caller's own catalogue the answer is the record itself.
|
|
14
|
+
*
|
|
15
|
+
* The MCP callers of those two routes (updateWork, updateRecording,
|
|
16
|
+
* pica_enrichment_clear) read the answer here, so a proposal is not reported
|
|
17
|
+
* as "updated" and a direct change's record is read from `result` (D2 Gate 2,
|
|
18
|
+
* holdout run 38435148161: pica_works_update answered "Work updated
|
|
19
|
+
* successfully" for a representative's proposal). A new caller that skips
|
|
20
|
+
* this fails tools/__tests__/client-catalogue-replies.test.ts ("every caller
|
|
21
|
+
* of works.update / recordings.update reads the change outcome").
|
|
22
|
+
*/
|
|
23
|
+
import { currentCatalogue } from "@withpica/mcp-sdk";
|
|
24
|
+
import { formatSuccess } from "@withpica/mcp-utils";
|
|
25
|
+
export function readChangeOutcome(answer) {
|
|
26
|
+
if (answer && typeof answer === "object" && "applied" in answer) {
|
|
27
|
+
const a = answer;
|
|
28
|
+
if (a.applied === false) {
|
|
29
|
+
// A proposal with no reference cannot be followed up: say so rather
|
|
30
|
+
// than report either outcome.
|
|
31
|
+
if (typeof a.proposal_reference !== "string" || !a.proposal_reference)
|
|
32
|
+
throw new Error("the change was not applied, and no proposal reference came back");
|
|
33
|
+
return {
|
|
34
|
+
kind: "proposed",
|
|
35
|
+
reference: a.proposal_reference,
|
|
36
|
+
expiresAt: typeof a.expires_at === "string" ? a.expires_at : null,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (a.applied === true && "result" in a)
|
|
40
|
+
return { kind: "applied", record: a.result };
|
|
41
|
+
}
|
|
42
|
+
// In a client's catalogue the route always answers one of the two
|
|
43
|
+
// envelopes. Anything else means the envelope changed: refuse to call it
|
|
44
|
+
// applied, or a proposal would be reported as "updated" again.
|
|
45
|
+
if (currentCatalogue() !== undefined)
|
|
46
|
+
throw new Error("the change's outcome in this client's catalogue could not be read: neither applied nor proposed came back");
|
|
47
|
+
return { kind: "applied", record: answer };
|
|
48
|
+
}
|
|
49
|
+
/** The answer for a change sent to the client as a proposal. */
|
|
50
|
+
export function formatProposedChange(entity, id, fields, outcome) {
|
|
51
|
+
return formatSuccess(`Proposed to the client: nothing changes until one of the catalogue's owners approves it`, {
|
|
52
|
+
id,
|
|
53
|
+
entity,
|
|
54
|
+
applied: false,
|
|
55
|
+
proposed_fields: fields,
|
|
56
|
+
proposal_reference: outcome.reference,
|
|
57
|
+
expires_at: outcome.expiresAt,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=relationship-change.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship-change.js","sourceRoot":"","sources":["../../src/tools/relationship-change.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,MAAM,UAAU,iBAAiB,CAAI,MAAe;IAClD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;QAChE,MAAM,CAAC,GAAG,MAKT,CAAC;QACF,IAAI,CAAC,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YACxB,oEAAoE;YACpE,8BAA8B;YAC9B,IAAI,OAAO,CAAC,CAAC,kBAAkB,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,kBAAkB;gBACnE,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;YACJ,OAAO;gBACL,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,CAAC,CAAC,kBAAkB;gBAC/B,SAAS,EAAE,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI;aAClE,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,CAAC,OAAO,KAAK,IAAI,IAAI,QAAQ,IAAI,CAAC;YACrC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,MAAW,EAAE,CAAC;IACtD,CAAC;IACD,kEAAkE;IAClE,yEAAyE;IACzE,+DAA+D;IAC/D,IAAI,gBAAgB,EAAE,KAAK,SAAS;QAClC,MAAM,IAAI,KAAK,CACb,2GAA2G,CAC5G,CAAC;IACJ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAW,EAAE,CAAC;AAClD,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAClC,MAA4B,EAC5B,EAAU,EACV,MAAgB,EAChB,OAAwD;IAExD,OAAO,aAAa,CAClB,yFAAyF,EACzF;QACE,EAAE;QACF,MAAM;QACN,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,MAAM;QACvB,kBAAkB,EAAE,OAAO,CAAC,SAAS;QACrC,UAAU,EAAE,OAAO,CAAC,SAAS;KAC9B,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-333 — plain words for a relationship (who looks after whose
|
|
3
|
+
* catalogue), as the assistant tools say them.
|
|
4
|
+
*
|
|
5
|
+
* The MCP package cannot import the app, so this keeps its own copy of what
|
|
6
|
+
* the screens say: the type labels and statuses (from
|
|
7
|
+
* lib/services/portfolio-relationship-model.ts), the screen addresses (from
|
|
8
|
+
* lib/config/relationship-paths.ts), and the status and history sentences
|
|
9
|
+
* (from app/inspect/lib/relationship-copy.ts). The tools and the screens
|
|
10
|
+
* cannot say different things without
|
|
11
|
+
* lib/services/__tests__/relationship-scope-mcp-parity.test.ts failing: it
|
|
12
|
+
* compares every constant here with the app's and runs both sentence
|
|
13
|
+
* builders over every status and event kind.
|
|
14
|
+
*
|
|
15
|
+
* Pure: no imports.
|
|
16
|
+
*/
|
|
17
|
+
export declare const GRANTABLE_RELATIONSHIP_TYPES: readonly ["co_owner", "administrator", "representative", "viewer"];
|
|
18
|
+
export type RelationshipTypeName = (typeof GRANTABLE_RELATIONSHIP_TYPES)[number];
|
|
19
|
+
export declare const RELATIONSHIP_TYPE_LABELS: Record<RelationshipTypeName, string>;
|
|
20
|
+
export declare const RELATIONSHIP_STATUSES: readonly ["proposed", "active", "declined", "revoked", "stepped_down", "expired", "suspended"];
|
|
21
|
+
export type RelationshipStatusName = (typeof RELATIONSHIP_STATUSES)[number];
|
|
22
|
+
/** What a type may do, said to the catalogue's owner. */
|
|
23
|
+
export declare const TYPE_DOES: Record<RelationshipTypeName, string>;
|
|
24
|
+
/** The same allowances, said to the organisation that holds them. */
|
|
25
|
+
export declare const TYPE_DOES_FOR_ORG: Record<RelationshipTypeName, string>;
|
|
26
|
+
export declare const RELATIONSHIPS_PATH = "/inspect/relationships";
|
|
27
|
+
export declare function relationshipPath(relationshipId: string): string;
|
|
28
|
+
export declare const INVITATIONS_FOR_YOU_PATH = "/inspect/relationships#invitations-for-you";
|
|
29
|
+
export declare function relationshipActivityPath(granteeOrgId?: string): string;
|
|
30
|
+
/** Hand-overs (ADR-333 D5); the app's are lib/config/handover-paths.ts. */
|
|
31
|
+
export declare const HANDOVERS_PATH = "/inspect/handovers";
|
|
32
|
+
export declare function handoverPath(handoverId: string): string;
|
|
33
|
+
export declare const NEW_HANDOVER_PATH = "/inspect/handovers/new";
|
|
34
|
+
export type ReaderSide = "grantor" | "grantee";
|
|
35
|
+
/** The fields statusLine reads (a RelationshipRecord satisfies it). */
|
|
36
|
+
export interface RelationshipForCopy {
|
|
37
|
+
status: RelationshipStatusName;
|
|
38
|
+
proposedBySide: ReaderSide;
|
|
39
|
+
grantorOrgName: string;
|
|
40
|
+
granteeOrgName: string;
|
|
41
|
+
proposedAt: string;
|
|
42
|
+
respondedAt: string | null;
|
|
43
|
+
endedAt: string | null;
|
|
44
|
+
endReason: string | null;
|
|
45
|
+
proposalExpiresAt: string | null;
|
|
46
|
+
suspendedAt: string | null;
|
|
47
|
+
scope: {
|
|
48
|
+
termEndsOn: string | null;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface StatusLine {
|
|
52
|
+
text: string;
|
|
53
|
+
/** The reader has to answer it. */
|
|
54
|
+
needsYou: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** Where a relationship stands, for the side reading it. */
|
|
57
|
+
export declare function statusLine(r: RelationshipForCopy, reader: ReaderSide): StatusLine;
|
|
58
|
+
/** The fields eventLine reads (a RelationshipEventRecord satisfies it). */
|
|
59
|
+
export interface RelationshipEventForCopy {
|
|
60
|
+
kind: string;
|
|
61
|
+
actorSide: "grantor" | "grantee" | "system" | "platform";
|
|
62
|
+
actorDisplayName: string | null;
|
|
63
|
+
grantorOrgName: string;
|
|
64
|
+
granteeOrgName: string;
|
|
65
|
+
type: RelationshipTypeName;
|
|
66
|
+
reason: string | null;
|
|
67
|
+
action: string | null;
|
|
68
|
+
entityType: string | null;
|
|
69
|
+
scope: {
|
|
70
|
+
termEndsOn: string | null;
|
|
71
|
+
};
|
|
72
|
+
detail?: Record<string, unknown>;
|
|
73
|
+
}
|
|
74
|
+
/** One audit row as a sentence: who did what, through which relationship. */
|
|
75
|
+
export declare function eventLine(e: RelationshipEventForCopy): string;
|
|
76
|
+
/** The fields scopeSummary reads. */
|
|
77
|
+
export interface ScopeForCopy {
|
|
78
|
+
half: "both" | "composition" | "master";
|
|
79
|
+
territories: string[];
|
|
80
|
+
termStartsOn: string | null;
|
|
81
|
+
termEndsOn: string | null;
|
|
82
|
+
money: boolean;
|
|
83
|
+
directory: boolean;
|
|
84
|
+
catalogue: "whole" | "chosen";
|
|
85
|
+
workIds?: string[];
|
|
86
|
+
recordingIds?: string[];
|
|
87
|
+
songsChosen?: number;
|
|
88
|
+
recordingsChosen?: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The scope in one line for the side reading it: what, which side, where,
|
|
92
|
+
* when, money and (administrators) the directory. Territories are ISO codes
|
|
93
|
+
* here ("GB, IE"); the screens spell the country names.
|
|
94
|
+
*/
|
|
95
|
+
export declare function scopeSummary(scope: ScopeForCopy, type: RelationshipTypeName, reader: {
|
|
96
|
+
side: ReaderSide;
|
|
97
|
+
grantorName: string;
|
|
98
|
+
}): string;
|
|
99
|
+
//# sourceMappingURL=relationship-copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship-copy.d.ts","sourceRoot":"","sources":["../../src/tools/relationship-copy.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,4BAA4B,oEAK/B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAC9B,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAKzE,CAAC;AAEF,eAAO,MAAM,qBAAqB,gGAQxB,CAAC;AACX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,yDAAyD;AACzD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAQ1D,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAQlE,CAAC;AAMF,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAE3D,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,eAAO,MAAM,wBAAwB,+CAA8C,CAAC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B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,CAAC,EAAE,wBAAwB,GAAG,MAAM,CAsD7D;AAWD,qCAAqC;AACrC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,QAAQ,CAAC;IACxC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,oBAAoB,EAC1B,MAAM,EAAE;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAChD,MAAM,CAoCR"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
/**
|
|
3
|
+
* ADR-333 — plain words for a relationship (who looks after whose
|
|
4
|
+
* catalogue), as the assistant tools say them.
|
|
5
|
+
*
|
|
6
|
+
* The MCP package cannot import the app, so this keeps its own copy of what
|
|
7
|
+
* the screens say: the type labels and statuses (from
|
|
8
|
+
* lib/services/portfolio-relationship-model.ts), the screen addresses (from
|
|
9
|
+
* lib/config/relationship-paths.ts), and the status and history sentences
|
|
10
|
+
* (from app/inspect/lib/relationship-copy.ts). The tools and the screens
|
|
11
|
+
* cannot say different things without
|
|
12
|
+
* lib/services/__tests__/relationship-scope-mcp-parity.test.ts failing: it
|
|
13
|
+
* compares every constant here with the app's and runs both sentence
|
|
14
|
+
* builders over every status and event kind.
|
|
15
|
+
*
|
|
16
|
+
* Pure: no imports.
|
|
17
|
+
*/
|
|
18
|
+
export const GRANTABLE_RELATIONSHIP_TYPES = [
|
|
19
|
+
"co_owner",
|
|
20
|
+
"administrator",
|
|
21
|
+
"representative",
|
|
22
|
+
"viewer",
|
|
23
|
+
];
|
|
24
|
+
export const RELATIONSHIP_TYPE_LABELS = {
|
|
25
|
+
co_owner: "co-owner with a share",
|
|
26
|
+
administrator: "administrator",
|
|
27
|
+
representative: "representative",
|
|
28
|
+
viewer: "viewer",
|
|
29
|
+
};
|
|
30
|
+
export const RELATIONSHIP_STATUSES = [
|
|
31
|
+
"proposed",
|
|
32
|
+
"active",
|
|
33
|
+
"declined",
|
|
34
|
+
"revoked",
|
|
35
|
+
"stepped_down",
|
|
36
|
+
"expired",
|
|
37
|
+
"suspended",
|
|
38
|
+
];
|
|
39
|
+
/** What a type may do, said to the catalogue's owner. */
|
|
40
|
+
export const TYPE_DOES = {
|
|
41
|
+
administrator: "can edit and register your songs and send exports for you. changes to splits or custody come to you to approve.",
|
|
42
|
+
representative: "can see and export what's in scope, and suggest changes. every change to your record comes to you to approve first.",
|
|
43
|
+
viewer: "can see and export what's in scope, and nothing else.",
|
|
44
|
+
co_owner: "can see the songs and recordings it has a share in. it can't change your facts.",
|
|
45
|
+
};
|
|
46
|
+
/** The same allowances, said to the organisation that holds them. */
|
|
47
|
+
export const TYPE_DOES_FOR_ORG = {
|
|
48
|
+
administrator: "can edit and register their songs and send exports for them. changes to splits or custody go to them to approve.",
|
|
49
|
+
representative: "can see and export what's in scope, and suggest changes. every change to their record goes to them to approve first.",
|
|
50
|
+
viewer: "can see and export what's in scope, and nothing else.",
|
|
51
|
+
co_owner: "can see the songs and recordings it has a share in. it can't change their facts.",
|
|
52
|
+
};
|
|
53
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
54
|
+
// Screen addresses (paths; the tools prefix the web origin)
|
|
55
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
56
|
+
export const RELATIONSHIPS_PATH = "/inspect/relationships";
|
|
57
|
+
export function relationshipPath(relationshipId) {
|
|
58
|
+
return `${RELATIONSHIPS_PATH}/${encodeURIComponent(relationshipId)}`;
|
|
59
|
+
}
|
|
60
|
+
export const INVITATIONS_FOR_YOU_PATH = `${RELATIONSHIPS_PATH}#invitations-for-you`;
|
|
61
|
+
export function relationshipActivityPath(granteeOrgId) {
|
|
62
|
+
return granteeOrgId
|
|
63
|
+
? `${RELATIONSHIPS_PATH}/activity?org=${encodeURIComponent(granteeOrgId)}`
|
|
64
|
+
: `${RELATIONSHIPS_PATH}/activity`;
|
|
65
|
+
}
|
|
66
|
+
/** Hand-overs (ADR-333 D5); the app's are lib/config/handover-paths.ts. */
|
|
67
|
+
export const HANDOVERS_PATH = "/inspect/handovers";
|
|
68
|
+
export function handoverPath(handoverId) {
|
|
69
|
+
return `${HANDOVERS_PATH}/${encodeURIComponent(handoverId)}`;
|
|
70
|
+
}
|
|
71
|
+
export const NEW_HANDOVER_PATH = `${HANDOVERS_PATH}/new`;
|
|
72
|
+
/** Where a relationship stands, for the side reading it. */
|
|
73
|
+
export function statusLine(r, reader) {
|
|
74
|
+
const other = reader === "grantor" ? r.granteeOrgName : r.grantorOrgName;
|
|
75
|
+
const day = (iso) => (iso ? iso.slice(0, 10) : "");
|
|
76
|
+
switch (r.status) {
|
|
77
|
+
case "proposed": {
|
|
78
|
+
const lapses = r.proposalExpiresAt
|
|
79
|
+
? ` · expires ${day(r.proposalExpiresAt)}`
|
|
80
|
+
: "";
|
|
81
|
+
return r.proposedBySide === reader
|
|
82
|
+
? { text: `waiting for ${other} to answer${lapses}`, needsYou: false }
|
|
83
|
+
: {
|
|
84
|
+
text: `${other} is asking · needs your answer${lapses}`,
|
|
85
|
+
needsYou: true,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
case "suspended":
|
|
89
|
+
return {
|
|
90
|
+
text: `paused by pica ${day(r.suspendedAt)} · it grants nothing while paused. ask pica if you have questions.`,
|
|
91
|
+
needsYou: false,
|
|
92
|
+
};
|
|
93
|
+
case "active":
|
|
94
|
+
return {
|
|
95
|
+
text: `active since ${day(r.respondedAt) || day(r.proposedAt)}${r.scope.termEndsOn ? ` · ends ${r.scope.termEndsOn}` : ""}`,
|
|
96
|
+
needsYou: false,
|
|
97
|
+
};
|
|
98
|
+
case "declined":
|
|
99
|
+
return { text: `declined ${day(r.respondedAt)}`, needsYou: false };
|
|
100
|
+
case "revoked":
|
|
101
|
+
return { text: `ended by the owner ${day(r.endedAt)}`, needsYou: false };
|
|
102
|
+
case "stepped_down":
|
|
103
|
+
return {
|
|
104
|
+
text: `${r.granteeOrgName} stepped down ${day(r.endedAt)}`,
|
|
105
|
+
needsYou: false,
|
|
106
|
+
};
|
|
107
|
+
case "expired":
|
|
108
|
+
return {
|
|
109
|
+
text: r.endReason === "proposal_unanswered"
|
|
110
|
+
? `lapsed unanswered ${day(r.endedAt)}`
|
|
111
|
+
: `term ended ${day(r.endedAt)}`,
|
|
112
|
+
needsYou: false,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** One audit row as a sentence: who did what, through which relationship. */
|
|
117
|
+
export function eventLine(e) {
|
|
118
|
+
const org = e.actorSide === "grantor"
|
|
119
|
+
? e.grantorOrgName
|
|
120
|
+
: e.actorSide === "grantee"
|
|
121
|
+
? e.granteeOrgName
|
|
122
|
+
: null;
|
|
123
|
+
// The PICA team acts as PICA: its people are not named to customers.
|
|
124
|
+
const who = e.actorSide === "platform"
|
|
125
|
+
? "pica"
|
|
126
|
+
: e.actorDisplayName
|
|
127
|
+
? org
|
|
128
|
+
? `${e.actorDisplayName} (${org})`
|
|
129
|
+
: e.actorDisplayName
|
|
130
|
+
: (org ?? "pica");
|
|
131
|
+
const type = RELATIONSHIP_TYPE_LABELS[e.type] ?? humanise(e.type);
|
|
132
|
+
switch (e.kind) {
|
|
133
|
+
case "proposed":
|
|
134
|
+
return `${who} proposed ${e.granteeOrgName} as ${type}`;
|
|
135
|
+
case "accepted":
|
|
136
|
+
return `${who} accepted ${e.granteeOrgName} as ${type}`;
|
|
137
|
+
case "declined":
|
|
138
|
+
return `${who} declined`;
|
|
139
|
+
case "scope_changed":
|
|
140
|
+
return `${who} changed what's covered`;
|
|
141
|
+
case "revoked":
|
|
142
|
+
return `${who} ended the relationship`;
|
|
143
|
+
case "stepped_down":
|
|
144
|
+
return `${who} stepped down`;
|
|
145
|
+
case "expired":
|
|
146
|
+
return e.reason === "proposal_unanswered"
|
|
147
|
+
? "the request lapsed unanswered"
|
|
148
|
+
: "the term ended";
|
|
149
|
+
case "term_ending_soon": {
|
|
150
|
+
const on = detailDate(e, "term_ends_on") ?? e.scope.termEndsOn;
|
|
151
|
+
return `the term ends on ${on ?? "its end date"}`;
|
|
152
|
+
}
|
|
153
|
+
case "proposal_expiring_soon": {
|
|
154
|
+
const on = detailDate(e, "proposal_expires_at");
|
|
155
|
+
return `the request lapses${on ? ` on ${on}` : " soon"} if nobody answers`;
|
|
156
|
+
}
|
|
157
|
+
case "suspended":
|
|
158
|
+
return "pica paused it: it grants nothing while paused";
|
|
159
|
+
case "reinstated":
|
|
160
|
+
return "pica resumed it";
|
|
161
|
+
case "acted":
|
|
162
|
+
return `${who} ${humanise(e.action) || "acted"}${e.entityType ? ` · ${humanise(e.entityType)}` : ""}`;
|
|
163
|
+
default:
|
|
164
|
+
// A kind added after this copy: said by its name, never dropped.
|
|
165
|
+
return `${who} · ${humanise(e.kind)}`;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function detailDate(e, key) {
|
|
169
|
+
const v = e.detail?.[key];
|
|
170
|
+
return typeof v === "string" && v.length >= 10 ? v.slice(0, 10) : null;
|
|
171
|
+
}
|
|
172
|
+
function humanise(s) {
|
|
173
|
+
return (s ?? "").replace(/_/g, " ").trim();
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The scope in one line for the side reading it: what, which side, where,
|
|
177
|
+
* when, money and (administrators) the directory. Territories are ISO codes
|
|
178
|
+
* here ("GB, IE"); the screens spell the country names.
|
|
179
|
+
*/
|
|
180
|
+
export function scopeSummary(scope, type, reader) {
|
|
181
|
+
const whose = reader.side === "grantor" ? "your" : `${reader.grantorName}'s`;
|
|
182
|
+
const songs = scope.workIds?.length ?? scope.songsChosen ?? 0;
|
|
183
|
+
const recordings = scope.recordingIds?.length ?? scope.recordingsChosen ?? 0;
|
|
184
|
+
const count = (n, one) => `${n} ${one}${n === 1 ? "" : "s"}`;
|
|
185
|
+
const what = scope.catalogue === "whole"
|
|
186
|
+
? `${whose} whole catalogue`
|
|
187
|
+
: [
|
|
188
|
+
songs > 0 ? count(songs, "song") : null,
|
|
189
|
+
recordings > 0 ? count(recordings, "recording") : null,
|
|
190
|
+
]
|
|
191
|
+
.filter(Boolean)
|
|
192
|
+
.join(" and ") + ` from ${whose} catalogue`;
|
|
193
|
+
const half = scope.half === "both"
|
|
194
|
+
? "songs and recordings"
|
|
195
|
+
: scope.half === "composition"
|
|
196
|
+
? "the song side only"
|
|
197
|
+
: "the recording side only";
|
|
198
|
+
const where = scope.territories.includes("WW")
|
|
199
|
+
? "worldwide"
|
|
200
|
+
: scope.territories.join(", ");
|
|
201
|
+
const when = (scope.termStartsOn ? `from ${scope.termStartsOn}` : "from acceptance") +
|
|
202
|
+
(scope.termEndsOn ? ` until ${scope.termEndsOn}` : ", no end date");
|
|
203
|
+
const money = scope.money
|
|
204
|
+
? "can see statements"
|
|
205
|
+
: "can't see statements or earnings";
|
|
206
|
+
const directory = type === "administrator"
|
|
207
|
+
? scope.directory
|
|
208
|
+
? "; can list songs in the public directory"
|
|
209
|
+
: "; can't list songs in the public directory"
|
|
210
|
+
: "";
|
|
211
|
+
return `${what}, ${half}, ${where}, ${when}; ${money}${directory}`;
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=relationship-copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship-copy.js","sourceRoot":"","sources":["../../src/tools/relationship-copy.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,UAAU;IACV,eAAe;IACf,gBAAgB;IAChB,QAAQ;CACA,CAAC;AAIX,MAAM,CAAC,MAAM,wBAAwB,GAAyC;IAC5E,QAAQ,EAAE,uBAAuB;IACjC,aAAa,EAAE,eAAe;IAC9B,cAAc,EAAE,gBAAgB;IAChC,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,UAAU;IACV,QAAQ;IACR,UAAU;IACV,SAAS;IACT,cAAc;IACd,SAAS;IACT,WAAW;CACH,CAAC;AAGX,yDAAyD;AACzD,MAAM,CAAC,MAAM,SAAS,GAAyC;IAC7D,aAAa,EACX,iHAAiH;IACnH,cAAc,EACZ,qHAAqH;IACvH,MAAM,EAAE,uDAAuD;IAC/D,QAAQ,EACN,iFAAiF;CACpF,CAAC;AAEF,qEAAqE;AACrE,MAAM,CAAC,MAAM,iBAAiB,GAAyC;IACrE,aAAa,EACX,kHAAkH;IACpH,cAAc,EACZ,sHAAsH;IACxH,MAAM,EAAE,uDAAuD;IAC/D,QAAQ,EACN,kFAAkF;CACrF,CAAC;AAEF,gFAAgF;AAChF,4DAA4D;AAC5D,gFAAgF;AAEhF,MAAM,CAAC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I,CAAC,OAAO,CAAC,GAAG,SAAS,KAAK,YAAY,CAAC;IACpD,MAAM,IAAI,GACR,KAAK,CAAC,IAAI,KAAK,MAAM;QACnB,CAAC,CAAC,sBAAsB;QACxB,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,aAAa;YAC5B,CAAC,CAAC,oBAAoB;YACtB,CAAC,CAAC,yBAAyB,CAAC;IAClC,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC5C,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,IAAI,GACR,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC;QACvE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IACtE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK;QACvB,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,kCAAkC,CAAC;IACvC,MAAM,SAAS,GACb,IAAI,KAAK,eAAe;QACtB,CAAC,CAAC,KAAK,CAAC,SAAS;YACf,CAAC,CAAC,0CAA0C;YAC5C,CAAC,CAAC,4CAA4C;QAChD,CAAC,CAAC,EAAE,CAAC;IACT,OAAO,GAAG,IAAI,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,GAAG,SAAS,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scope of a portfolio relationship, as the assistant tools accept it
|
|
3
|
+
* (ADR-333 D3). The main MCP server cannot import the app, so this mirrors
|
|
4
|
+
* `relationshipScopeSchema` in lib/services/portfolio-relationship-model.ts
|
|
5
|
+
* with snake_case names. lib/services/__tests__/relationship-scope-mcp-
|
|
6
|
+
* parity.test.ts fails if a field, an allowed value or a limit drifts.
|
|
7
|
+
*
|
|
8
|
+
* Every field is optional: the app fills the defaults (whole catalogue, both
|
|
9
|
+
* halves, worldwide, no end date, money on only for an administrator,
|
|
10
|
+
* directory off). The rules that join two fields (for example "worldwide
|
|
11
|
+
* cannot be combined with other territories") are enforced by the app, which
|
|
12
|
+
* refuses with a plain reason; the descriptions below state them.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately has no imports, so the parity test can load it directly.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SCOPE_HALVES: readonly ["both", "composition", "master"];
|
|
17
|
+
export declare const SCOPE_CATALOGUES: readonly ["whole", "chosen"];
|
|
18
|
+
export declare const SCOPE_MAX_TERRITORIES = 300;
|
|
19
|
+
export declare const SCOPE_MAX_ITEMS = 5000;
|
|
20
|
+
export declare const SCOPE_TERRITORY_PATTERN = "^[A-Z]{2}$";
|
|
21
|
+
export declare const SCOPE_DATE_PATTERN = "^\\d{4}-\\d{2}-\\d{2}$";
|
|
22
|
+
/** The tool argument name for each field of the app's scope. */
|
|
23
|
+
export declare const SCOPE_FIELD_NAMES: {
|
|
24
|
+
readonly half: "half";
|
|
25
|
+
readonly territories: "territories";
|
|
26
|
+
readonly term_starts_on: "termStartsOn";
|
|
27
|
+
readonly term_ends_on: "termEndsOn";
|
|
28
|
+
readonly money: "money";
|
|
29
|
+
readonly directory: "directory";
|
|
30
|
+
readonly catalogue: "catalogue";
|
|
31
|
+
readonly work_ids: "workIds";
|
|
32
|
+
readonly recording_ids: "recordingIds";
|
|
33
|
+
};
|
|
34
|
+
export type ScopeArgName = keyof typeof SCOPE_FIELD_NAMES;
|
|
35
|
+
/** JSON Schema for the optional `scope` argument of grant, invite and answer. */
|
|
36
|
+
export declare const RELATIONSHIP_SCOPE_INPUT_SCHEMA: {
|
|
37
|
+
readonly type: "object";
|
|
38
|
+
readonly description: string;
|
|
39
|
+
readonly additionalProperties: false;
|
|
40
|
+
readonly properties: {
|
|
41
|
+
readonly half: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly enum: readonly ["both", "composition", "master"];
|
|
44
|
+
readonly description: "Which half of the songs: both, composition (the song and its publishing) or master (the recordings).";
|
|
45
|
+
};
|
|
46
|
+
readonly territories: {
|
|
47
|
+
readonly type: "array";
|
|
48
|
+
readonly items: {
|
|
49
|
+
readonly type: "string";
|
|
50
|
+
readonly pattern: "^[A-Z]{2}$";
|
|
51
|
+
};
|
|
52
|
+
readonly minItems: 1;
|
|
53
|
+
readonly maxItems: 300;
|
|
54
|
+
readonly description: "Countries covered. Only [\"WW\"] (worldwide) is accepted today: limiting a relationship to some countries is not available yet, and any other value is refused.";
|
|
55
|
+
};
|
|
56
|
+
readonly term_starts_on: {
|
|
57
|
+
readonly type: readonly ["string", "null"];
|
|
58
|
+
readonly pattern: "^\\d{4}-\\d{2}-\\d{2}$";
|
|
59
|
+
readonly description: "First day covered, YYYY-MM-DD (UTC). Leave out or null to start when it is accepted.";
|
|
60
|
+
};
|
|
61
|
+
readonly term_ends_on: {
|
|
62
|
+
readonly type: readonly ["string", "null"];
|
|
63
|
+
readonly pattern: "^\\d{4}-\\d{2}-\\d{2}$";
|
|
64
|
+
readonly description: "Last day covered, YYYY-MM-DD (UTC), inclusive. Leave out or null for until revoked. On that date access ends by itself.";
|
|
65
|
+
};
|
|
66
|
+
readonly money: {
|
|
67
|
+
readonly type: "boolean";
|
|
68
|
+
readonly description: "true lets the organisation see statements and earnings in scope.";
|
|
69
|
+
};
|
|
70
|
+
readonly directory: {
|
|
71
|
+
readonly type: "boolean";
|
|
72
|
+
readonly description: "true lets an administrator list or hide songs in the public directory and answer enquiries. Administrators only.";
|
|
73
|
+
};
|
|
74
|
+
readonly catalogue: {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
readonly enum: readonly ["whole", "chosen"];
|
|
77
|
+
readonly description: "whole for the whole catalogue, or chosen for only the songs and recordings named in work_ids and recording_ids.";
|
|
78
|
+
};
|
|
79
|
+
readonly work_ids: {
|
|
80
|
+
readonly type: "array";
|
|
81
|
+
readonly items: {
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
readonly format: "uuid";
|
|
84
|
+
};
|
|
85
|
+
readonly maxItems: 5000;
|
|
86
|
+
readonly description: "Songs covered when catalogue is chosen (ids from pica_works_query). Not allowed for a master-only scope.";
|
|
87
|
+
};
|
|
88
|
+
readonly recording_ids: {
|
|
89
|
+
readonly type: "array";
|
|
90
|
+
readonly items: {
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
readonly format: "uuid";
|
|
93
|
+
};
|
|
94
|
+
readonly maxItems: 5000;
|
|
95
|
+
readonly description: "Recordings covered when catalogue is chosen (ids from pica_recordings_query). Not allowed for a composition-only scope.";
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Convert the tool's `scope` argument to the app's field names. Unknown keys
|
|
101
|
+
* are dropped here; the schema above already refuses them at the MCP layer.
|
|
102
|
+
*/
|
|
103
|
+
export declare function scopeArgToApi(scope: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
104
|
+
//# sourceMappingURL=relationship-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship-scope.d.ts","sourceRoot":"","sources":["../../src/tools/relationship-scope.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,YAAY,4CAA6C,CAAC;AACvE,eAAO,MAAM,gBAAgB,8BAA+B,CAAC;AAC7D,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,eAAe,OAAO,CAAC;AACpC,eAAO,MAAM,uBAAuB,eAAe,CAAC;AACpD,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAE3D,gEAAgE;AAChE,eAAO,MAAM,iBAAiB;;;;;;;;;;CAUpB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAE1D,iFAAiF;AACjF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiElC,CAAC;AAEX;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACzC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAOrC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
/**
|
|
3
|
+
* The scope of a portfolio relationship, as the assistant tools accept it
|
|
4
|
+
* (ADR-333 D3). The main MCP server cannot import the app, so this mirrors
|
|
5
|
+
* `relationshipScopeSchema` in lib/services/portfolio-relationship-model.ts
|
|
6
|
+
* with snake_case names. lib/services/__tests__/relationship-scope-mcp-
|
|
7
|
+
* parity.test.ts fails if a field, an allowed value or a limit drifts.
|
|
8
|
+
*
|
|
9
|
+
* Every field is optional: the app fills the defaults (whole catalogue, both
|
|
10
|
+
* halves, worldwide, no end date, money on only for an administrator,
|
|
11
|
+
* directory off). The rules that join two fields (for example "worldwide
|
|
12
|
+
* cannot be combined with other territories") are enforced by the app, which
|
|
13
|
+
* refuses with a plain reason; the descriptions below state them.
|
|
14
|
+
*
|
|
15
|
+
* Deliberately has no imports, so the parity test can load it directly.
|
|
16
|
+
*/
|
|
17
|
+
export const SCOPE_HALVES = ["both", "composition", "master"];
|
|
18
|
+
export const SCOPE_CATALOGUES = ["whole", "chosen"];
|
|
19
|
+
export const SCOPE_MAX_TERRITORIES = 300;
|
|
20
|
+
export const SCOPE_MAX_ITEMS = 5000;
|
|
21
|
+
export const SCOPE_TERRITORY_PATTERN = "^[A-Z]{2}$";
|
|
22
|
+
export const SCOPE_DATE_PATTERN = "^\\d{4}-\\d{2}-\\d{2}$";
|
|
23
|
+
/** The tool argument name for each field of the app's scope. */
|
|
24
|
+
export const SCOPE_FIELD_NAMES = {
|
|
25
|
+
half: "half",
|
|
26
|
+
territories: "territories",
|
|
27
|
+
term_starts_on: "termStartsOn",
|
|
28
|
+
term_ends_on: "termEndsOn",
|
|
29
|
+
money: "money",
|
|
30
|
+
directory: "directory",
|
|
31
|
+
catalogue: "catalogue",
|
|
32
|
+
work_ids: "workIds",
|
|
33
|
+
recording_ids: "recordingIds",
|
|
34
|
+
};
|
|
35
|
+
/** JSON Schema for the optional `scope` argument of grant, invite and answer. */
|
|
36
|
+
export const RELATIONSHIP_SCOPE_INPUT_SCHEMA = {
|
|
37
|
+
type: "object",
|
|
38
|
+
description: "What the relationship covers. Leave out any field to use the default: the whole catalogue, " +
|
|
39
|
+
"both halves, worldwide, until revoked, statements hidden (shown by default only to an " +
|
|
40
|
+
"administrator), directory off.",
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
properties: {
|
|
43
|
+
half: {
|
|
44
|
+
type: "string",
|
|
45
|
+
enum: [...SCOPE_HALVES],
|
|
46
|
+
description: "Which half of the songs: both, composition (the song and its publishing) or master (the recordings).",
|
|
47
|
+
},
|
|
48
|
+
territories: {
|
|
49
|
+
type: "array",
|
|
50
|
+
items: { type: "string", pattern: SCOPE_TERRITORY_PATTERN },
|
|
51
|
+
minItems: 1,
|
|
52
|
+
maxItems: SCOPE_MAX_TERRITORIES,
|
|
53
|
+
description: 'Countries covered. Only ["WW"] (worldwide) is accepted today: limiting a relationship to some countries is not available yet, and any other value is refused.',
|
|
54
|
+
},
|
|
55
|
+
term_starts_on: {
|
|
56
|
+
type: ["string", "null"],
|
|
57
|
+
pattern: SCOPE_DATE_PATTERN,
|
|
58
|
+
description: "First day covered, YYYY-MM-DD (UTC). Leave out or null to start when it is accepted.",
|
|
59
|
+
},
|
|
60
|
+
term_ends_on: {
|
|
61
|
+
type: ["string", "null"],
|
|
62
|
+
pattern: SCOPE_DATE_PATTERN,
|
|
63
|
+
description: "Last day covered, YYYY-MM-DD (UTC), inclusive. Leave out or null for until revoked. On that date access ends by itself.",
|
|
64
|
+
},
|
|
65
|
+
money: {
|
|
66
|
+
type: "boolean",
|
|
67
|
+
description: "true lets the organisation see statements and earnings in scope.",
|
|
68
|
+
},
|
|
69
|
+
directory: {
|
|
70
|
+
type: "boolean",
|
|
71
|
+
description: "true lets an administrator list or hide songs in the public directory and answer enquiries. Administrators only.",
|
|
72
|
+
},
|
|
73
|
+
catalogue: {
|
|
74
|
+
type: "string",
|
|
75
|
+
enum: [...SCOPE_CATALOGUES],
|
|
76
|
+
description: "whole for the whole catalogue, or chosen for only the songs and recordings named in work_ids and recording_ids.",
|
|
77
|
+
},
|
|
78
|
+
work_ids: {
|
|
79
|
+
type: "array",
|
|
80
|
+
items: { type: "string", format: "uuid" },
|
|
81
|
+
maxItems: SCOPE_MAX_ITEMS,
|
|
82
|
+
description: "Songs covered when catalogue is chosen (ids from pica_works_query). Not allowed for a master-only scope.",
|
|
83
|
+
},
|
|
84
|
+
recording_ids: {
|
|
85
|
+
type: "array",
|
|
86
|
+
items: { type: "string", format: "uuid" },
|
|
87
|
+
maxItems: SCOPE_MAX_ITEMS,
|
|
88
|
+
description: "Recordings covered when catalogue is chosen (ids from pica_recordings_query). Not allowed for a composition-only scope.",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Convert the tool's `scope` argument to the app's field names. Unknown keys
|
|
94
|
+
* are dropped here; the schema above already refuses them at the MCP layer.
|
|
95
|
+
*/
|
|
96
|
+
export function scopeArgToApi(scope) {
|
|
97
|
+
if (!scope)
|
|
98
|
+
return undefined;
|
|
99
|
+
const out = {};
|
|
100
|
+
for (const [arg, api] of Object.entries(SCOPE_FIELD_NAMES)) {
|
|
101
|
+
if (scope[arg] !== undefined)
|
|
102
|
+
out[api] = scope[arg];
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=relationship-scope.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