@withpica/mcp-server 1.3.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.
Files changed (347) hide show
  1. package/.claude/settings.local.json +5 -0
  2. package/CHANGELOG.md +1850 -0
  3. package/README.md +304 -0
  4. package/assets/fonts/GeistSans-Light.woff2 +0 -0
  5. package/assets/fonts/InstrumentSerif-Italic.woff2 +0 -0
  6. package/assets/fonts/InstrumentSerif-Regular.woff2 +0 -0
  7. package/dist/apps/download.d.ts +2 -0
  8. package/dist/apps/download.d.ts.map +1 -0
  9. package/dist/apps/download.js +125 -0
  10. package/dist/apps/download.js.map +1 -0
  11. package/dist/apps/generated/shared-bundle.d.ts +5 -0
  12. package/dist/apps/generated/shared-bundle.d.ts.map +1 -0
  13. package/dist/apps/generated/shared-bundle.js +7 -0
  14. package/dist/apps/generated/shared-bundle.js.map +1 -0
  15. package/dist/apps/release.d.ts +2 -0
  16. package/dist/apps/release.d.ts.map +1 -0
  17. package/dist/apps/release.js +69 -0
  18. package/dist/apps/release.js.map +1 -0
  19. package/dist/apps/shared.d.ts +15 -0
  20. package/dist/apps/shared.d.ts.map +1 -0
  21. package/dist/apps/shared.js +480 -0
  22. package/dist/apps/shared.js.map +1 -0
  23. package/dist/apps/upload.d.ts +2 -0
  24. package/dist/apps/upload.d.ts.map +1 -0
  25. package/dist/apps/upload.js +280 -0
  26. package/dist/apps/upload.js.map +1 -0
  27. package/dist/config.d.ts +14 -0
  28. package/dist/config.d.ts.map +1 -0
  29. package/dist/config.js +73 -0
  30. package/dist/config.js.map +1 -0
  31. package/dist/index.d.ts +3 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +35 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/prompts/index.d.ts +86 -0
  36. package/dist/prompts/index.d.ts.map +1 -0
  37. package/dist/prompts/index.js +645 -0
  38. package/dist/prompts/index.js.map +1 -0
  39. package/dist/resources/agent-guide.d.ts +15 -0
  40. package/dist/resources/agent-guide.d.ts.map +1 -0
  41. package/dist/resources/agent-guide.js +284 -0
  42. package/dist/resources/agent-guide.js.map +1 -0
  43. package/dist/resources/index.d.ts +66 -0
  44. package/dist/resources/index.d.ts.map +1 -0
  45. package/dist/resources/index.js +510 -0
  46. package/dist/resources/index.js.map +1 -0
  47. package/dist/resources/llms-primer.d.ts +2 -0
  48. package/dist/resources/llms-primer.d.ts.map +1 -0
  49. package/dist/resources/llms-primer.js +68 -0
  50. package/dist/resources/llms-primer.js.map +1 -0
  51. package/dist/resources/required-schemas.generated.d.ts +455 -0
  52. package/dist/resources/required-schemas.generated.d.ts.map +1 -0
  53. package/dist/resources/required-schemas.generated.js +1041 -0
  54. package/dist/resources/required-schemas.generated.js.map +1 -0
  55. package/dist/resources/required-schemas.source.d.ts +53 -0
  56. package/dist/resources/required-schemas.source.d.ts.map +1 -0
  57. package/dist/resources/required-schemas.source.js +493 -0
  58. package/dist/resources/required-schemas.source.js.map +1 -0
  59. package/dist/resources/welcome.d.ts +14 -0
  60. package/dist/resources/welcome.d.ts.map +1 -0
  61. package/dist/resources/welcome.js +26 -0
  62. package/dist/resources/welcome.js.map +1 -0
  63. package/dist/server-instructions.d.ts +60 -0
  64. package/dist/server-instructions.d.ts.map +1 -0
  65. package/dist/server-instructions.js +93 -0
  66. package/dist/server-instructions.js.map +1 -0
  67. package/dist/server.d.ts +52 -0
  68. package/dist/server.d.ts.map +1 -0
  69. package/dist/server.js +334 -0
  70. package/dist/server.js.map +1 -0
  71. package/dist/tools/access-simulate.d.ts +23 -0
  72. package/dist/tools/access-simulate.d.ts.map +1 -0
  73. package/dist/tools/access-simulate.js +162 -0
  74. package/dist/tools/access-simulate.js.map +1 -0
  75. package/dist/tools/agent-identity.d.ts +36 -0
  76. package/dist/tools/agent-identity.d.ts.map +1 -0
  77. package/dist/tools/agent-identity.js +274 -0
  78. package/dist/tools/agent-identity.js.map +1 -0
  79. package/dist/tools/agreement-types.d.ts +27 -0
  80. package/dist/tools/agreement-types.d.ts.map +1 -0
  81. package/dist/tools/agreement-types.js +281 -0
  82. package/dist/tools/agreement-types.js.map +1 -0
  83. package/dist/tools/agreements.d.ts +20 -0
  84. package/dist/tools/agreements.d.ts.map +1 -0
  85. package/dist/tools/agreements.js +282 -0
  86. package/dist/tools/agreements.js.map +1 -0
  87. package/dist/tools/analytics.d.ts +20 -0
  88. package/dist/tools/analytics.d.ts.map +1 -0
  89. package/dist/tools/analytics.js +130 -0
  90. package/dist/tools/analytics.js.map +1 -0
  91. package/dist/tools/app-tools.d.ts +15 -0
  92. package/dist/tools/app-tools.d.ts.map +1 -0
  93. package/dist/tools/app-tools.js +388 -0
  94. package/dist/tools/app-tools.js.map +1 -0
  95. package/dist/tools/assets.d.ts +25 -0
  96. package/dist/tools/assets.d.ts.map +1 -0
  97. package/dist/tools/assets.js +454 -0
  98. package/dist/tools/assets.js.map +1 -0
  99. package/dist/tools/audio-files.d.ts +20 -0
  100. package/dist/tools/audio-files.d.ts.map +1 -0
  101. package/dist/tools/audio-files.js +409 -0
  102. package/dist/tools/audio-files.js.map +1 -0
  103. package/dist/tools/audit.d.ts +19 -0
  104. package/dist/tools/audit.d.ts.map +1 -0
  105. package/dist/tools/audit.js +58 -0
  106. package/dist/tools/audit.js.map +1 -0
  107. package/dist/tools/auth.d.ts +22 -0
  108. package/dist/tools/auth.d.ts.map +1 -0
  109. package/dist/tools/auth.js +212 -0
  110. package/dist/tools/auth.js.map +1 -0
  111. package/dist/tools/bulk.d.ts +22 -0
  112. package/dist/tools/bulk.d.ts.map +1 -0
  113. package/dist/tools/bulk.js +164 -0
  114. package/dist/tools/bulk.js.map +1 -0
  115. package/dist/tools/calendar.d.ts +15 -0
  116. package/dist/tools/calendar.d.ts.map +1 -0
  117. package/dist/tools/calendar.js +68 -0
  118. package/dist/tools/calendar.js.map +1 -0
  119. package/dist/tools/collaborators.d.ts +21 -0
  120. package/dist/tools/collaborators.d.ts.map +1 -0
  121. package/dist/tools/collaborators.js +381 -0
  122. package/dist/tools/collaborators.js.map +1 -0
  123. package/dist/tools/comparisons.d.ts +22 -0
  124. package/dist/tools/comparisons.d.ts.map +1 -0
  125. package/dist/tools/comparisons.js +80 -0
  126. package/dist/tools/comparisons.js.map +1 -0
  127. package/dist/tools/credits.d.ts +39 -0
  128. package/dist/tools/credits.d.ts.map +1 -0
  129. package/dist/tools/credits.js +541 -0
  130. package/dist/tools/credits.js.map +1 -0
  131. package/dist/tools/custody-hints.d.ts +16 -0
  132. package/dist/tools/custody-hints.d.ts.map +1 -0
  133. package/dist/tools/custody-hints.js +27 -0
  134. package/dist/tools/custody-hints.js.map +1 -0
  135. package/dist/tools/custody.d.ts +38 -0
  136. package/dist/tools/custody.d.ts.map +1 -0
  137. package/dist/tools/custody.js +281 -0
  138. package/dist/tools/custody.js.map +1 -0
  139. package/dist/tools/dashboard.d.ts +22 -0
  140. package/dist/tools/dashboard.d.ts.map +1 -0
  141. package/dist/tools/dashboard.js +258 -0
  142. package/dist/tools/dashboard.js.map +1 -0
  143. package/dist/tools/directory.d.ts +15 -0
  144. package/dist/tools/directory.d.ts.map +1 -0
  145. package/dist/tools/directory.js +107 -0
  146. package/dist/tools/directory.js.map +1 -0
  147. package/dist/tools/discovery.d.ts +49 -0
  148. package/dist/tools/discovery.d.ts.map +1 -0
  149. package/dist/tools/discovery.js +851 -0
  150. package/dist/tools/discovery.js.map +1 -0
  151. package/dist/tools/disputes.d.ts +18 -0
  152. package/dist/tools/disputes.d.ts.map +1 -0
  153. package/dist/tools/disputes.js +62 -0
  154. package/dist/tools/disputes.js.map +1 -0
  155. package/dist/tools/documents.d.ts +15 -0
  156. package/dist/tools/documents.d.ts.map +1 -0
  157. package/dist/tools/documents.js +37 -0
  158. package/dist/tools/documents.js.map +1 -0
  159. package/dist/tools/duplicates.d.ts +25 -0
  160. package/dist/tools/duplicates.d.ts.map +1 -0
  161. package/dist/tools/duplicates.js +108 -0
  162. package/dist/tools/duplicates.js.map +1 -0
  163. package/dist/tools/enrichment.d.ts +56 -0
  164. package/dist/tools/enrichment.d.ts.map +1 -0
  165. package/dist/tools/enrichment.js +616 -0
  166. package/dist/tools/enrichment.js.map +1 -0
  167. package/dist/tools/exports.d.ts +19 -0
  168. package/dist/tools/exports.d.ts.map +1 -0
  169. package/dist/tools/exports.js +184 -0
  170. package/dist/tools/exports.js.map +1 -0
  171. package/dist/tools/feedback.d.ts +22 -0
  172. package/dist/tools/feedback.d.ts.map +1 -0
  173. package/dist/tools/feedback.js +100 -0
  174. package/dist/tools/feedback.js.map +1 -0
  175. package/dist/tools/forbidden-keywords.d.ts +62 -0
  176. package/dist/tools/forbidden-keywords.d.ts.map +1 -0
  177. package/dist/tools/forbidden-keywords.js +99 -0
  178. package/dist/tools/forbidden-keywords.js.map +1 -0
  179. package/dist/tools/gap-hints.d.ts +53 -0
  180. package/dist/tools/gap-hints.d.ts.map +1 -0
  181. package/dist/tools/gap-hints.js +245 -0
  182. package/dist/tools/gap-hints.js.map +1 -0
  183. package/dist/tools/groups.d.ts +29 -0
  184. package/dist/tools/groups.d.ts.map +1 -0
  185. package/dist/tools/groups.js +186 -0
  186. package/dist/tools/groups.js.map +1 -0
  187. package/dist/tools/import-documents.d.ts +21 -0
  188. package/dist/tools/import-documents.d.ts.map +1 -0
  189. package/dist/tools/import-documents.js +206 -0
  190. package/dist/tools/import-documents.js.map +1 -0
  191. package/dist/tools/import.d.ts +31 -0
  192. package/dist/tools/import.d.ts.map +1 -0
  193. package/dist/tools/import.js +610 -0
  194. package/dist/tools/import.js.map +1 -0
  195. package/dist/tools/index.d.ts +293 -0
  196. package/dist/tools/index.d.ts.map +1 -0
  197. package/dist/tools/index.js +1182 -0
  198. package/dist/tools/index.js.map +1 -0
  199. package/dist/tools/integrations.d.ts +19 -0
  200. package/dist/tools/integrations.d.ts.map +1 -0
  201. package/dist/tools/integrations.js +120 -0
  202. package/dist/tools/integrations.js.map +1 -0
  203. package/dist/tools/labels.d.ts +20 -0
  204. package/dist/tools/labels.d.ts.map +1 -0
  205. package/dist/tools/labels.js +48 -0
  206. package/dist/tools/labels.js.map +1 -0
  207. package/dist/tools/licensing.d.ts +40 -0
  208. package/dist/tools/licensing.d.ts.map +1 -0
  209. package/dist/tools/licensing.js +436 -0
  210. package/dist/tools/licensing.js.map +1 -0
  211. package/dist/tools/memory.d.ts +21 -0
  212. package/dist/tools/memory.d.ts.map +1 -0
  213. package/dist/tools/memory.js +120 -0
  214. package/dist/tools/memory.js.map +1 -0
  215. package/dist/tools/metadata.d.ts +15 -0
  216. package/dist/tools/metadata.d.ts.map +1 -0
  217. package/dist/tools/metadata.js +1532 -0
  218. package/dist/tools/metadata.js.map +1 -0
  219. package/dist/tools/multimedia.d.ts +19 -0
  220. package/dist/tools/multimedia.d.ts.map +1 -0
  221. package/dist/tools/multimedia.js +371 -0
  222. package/dist/tools/multimedia.js.map +1 -0
  223. package/dist/tools/my-reported-issues.d.ts +32 -0
  224. package/dist/tools/my-reported-issues.d.ts.map +1 -0
  225. package/dist/tools/my-reported-issues.js +123 -0
  226. package/dist/tools/my-reported-issues.js.map +1 -0
  227. package/dist/tools/notes.d.ts +21 -0
  228. package/dist/tools/notes.d.ts.map +1 -0
  229. package/dist/tools/notes.js +115 -0
  230. package/dist/tools/notes.js.map +1 -0
  231. package/dist/tools/notifications.d.ts +28 -0
  232. package/dist/tools/notifications.d.ts.map +1 -0
  233. package/dist/tools/notifications.js +417 -0
  234. package/dist/tools/notifications.js.map +1 -0
  235. package/dist/tools/onboarding.d.ts +24 -0
  236. package/dist/tools/onboarding.d.ts.map +1 -0
  237. package/dist/tools/onboarding.js +81 -0
  238. package/dist/tools/onboarding.js.map +1 -0
  239. package/dist/tools/people.d.ts +254 -0
  240. package/dist/tools/people.d.ts.map +1 -0
  241. package/dist/tools/people.js +481 -0
  242. package/dist/tools/people.js.map +1 -0
  243. package/dist/tools/projects.d.ts +20 -0
  244. package/dist/tools/projects.d.ts.map +1 -0
  245. package/dist/tools/projects.js +316 -0
  246. package/dist/tools/projects.js.map +1 -0
  247. package/dist/tools/public-filter.d.ts +43 -0
  248. package/dist/tools/public-filter.d.ts.map +1 -0
  249. package/dist/tools/public-filter.js +356 -0
  250. package/dist/tools/public-filter.js.map +1 -0
  251. package/dist/tools/publishers.d.ts +30 -0
  252. package/dist/tools/publishers.d.ts.map +1 -0
  253. package/dist/tools/publishers.js +105 -0
  254. package/dist/tools/publishers.js.map +1 -0
  255. package/dist/tools/purchases.d.ts +27 -0
  256. package/dist/tools/purchases.d.ts.map +1 -0
  257. package/dist/tools/purchases.js +9 -0
  258. package/dist/tools/purchases.js.map +1 -0
  259. package/dist/tools/recording-attribution-hints.d.ts +24 -0
  260. package/dist/tools/recording-attribution-hints.d.ts.map +1 -0
  261. package/dist/tools/recording-attribution-hints.js +27 -0
  262. package/dist/tools/recording-attribution-hints.js.map +1 -0
  263. package/dist/tools/recordings.d.ts +96 -0
  264. package/dist/tools/recordings.d.ts.map +1 -0
  265. package/dist/tools/recordings.js +564 -0
  266. package/dist/tools/recordings.js.map +1 -0
  267. package/dist/tools/recovery-hints.d.ts +40 -0
  268. package/dist/tools/recovery-hints.d.ts.map +1 -0
  269. package/dist/tools/recovery-hints.js +827 -0
  270. package/dist/tools/recovery-hints.js.map +1 -0
  271. package/dist/tools/release-rich.d.ts +31 -0
  272. package/dist/tools/release-rich.d.ts.map +1 -0
  273. package/dist/tools/release-rich.js +245 -0
  274. package/dist/tools/release-rich.js.map +1 -0
  275. package/dist/tools/releases.d.ts +36 -0
  276. package/dist/tools/releases.d.ts.map +1 -0
  277. package/dist/tools/releases.js +649 -0
  278. package/dist/tools/releases.js.map +1 -0
  279. package/dist/tools/report-issue.d.ts +21 -0
  280. package/dist/tools/report-issue.d.ts.map +1 -0
  281. package/dist/tools/report-issue.js +101 -0
  282. package/dist/tools/report-issue.js.map +1 -0
  283. package/dist/tools/royalties.d.ts +23 -0
  284. package/dist/tools/royalties.d.ts.map +1 -0
  285. package/dist/tools/royalties.js +262 -0
  286. package/dist/tools/royalties.js.map +1 -0
  287. package/dist/tools/search.d.ts +30 -0
  288. package/dist/tools/search.d.ts.map +1 -0
  289. package/dist/tools/search.js +115 -0
  290. package/dist/tools/search.js.map +1 -0
  291. package/dist/tools/send.d.ts +17 -0
  292. package/dist/tools/send.d.ts.map +1 -0
  293. package/dist/tools/send.js +188 -0
  294. package/dist/tools/send.js.map +1 -0
  295. package/dist/tools/sessions.d.ts +18 -0
  296. package/dist/tools/sessions.d.ts.map +1 -0
  297. package/dist/tools/sessions.js +153 -0
  298. package/dist/tools/sessions.js.map +1 -0
  299. package/dist/tools/settings.d.ts +23 -0
  300. package/dist/tools/settings.d.ts.map +1 -0
  301. package/dist/tools/settings.js +365 -0
  302. package/dist/tools/settings.js.map +1 -0
  303. package/dist/tools/share-links.d.ts +22 -0
  304. package/dist/tools/share-links.d.ts.map +1 -0
  305. package/dist/tools/share-links.js +188 -0
  306. package/dist/tools/share-links.js.map +1 -0
  307. package/dist/tools/signup.d.ts +26 -0
  308. package/dist/tools/signup.d.ts.map +1 -0
  309. package/dist/tools/signup.js +266 -0
  310. package/dist/tools/signup.js.map +1 -0
  311. package/dist/tools/split-sheets.d.ts +25 -0
  312. package/dist/tools/split-sheets.d.ts.map +1 -0
  313. package/dist/tools/split-sheets.js +309 -0
  314. package/dist/tools/split-sheets.js.map +1 -0
  315. package/dist/tools/storage-config.d.ts +13 -0
  316. package/dist/tools/storage-config.d.ts.map +1 -0
  317. package/dist/tools/storage-config.js +245 -0
  318. package/dist/tools/storage-config.js.map +1 -0
  319. package/dist/tools/subscription.d.ts +60 -0
  320. package/dist/tools/subscription.d.ts.map +1 -0
  321. package/dist/tools/subscription.js +440 -0
  322. package/dist/tools/subscription.js.map +1 -0
  323. package/dist/tools/sync-placements.d.ts +31 -0
  324. package/dist/tools/sync-placements.d.ts.map +1 -0
  325. package/dist/tools/sync-placements.js +431 -0
  326. package/dist/tools/sync-placements.js.map +1 -0
  327. package/dist/tools/team.d.ts +22 -0
  328. package/dist/tools/team.d.ts.map +1 -0
  329. package/dist/tools/team.js +144 -0
  330. package/dist/tools/team.js.map +1 -0
  331. package/dist/tools/telegram.d.ts +21 -0
  332. package/dist/tools/telegram.d.ts.map +1 -0
  333. package/dist/tools/telegram.js +144 -0
  334. package/dist/tools/telegram.js.map +1 -0
  335. package/dist/tools/uploads.d.ts +17 -0
  336. package/dist/tools/uploads.d.ts.map +1 -0
  337. package/dist/tools/uploads.js +165 -0
  338. package/dist/tools/uploads.js.map +1 -0
  339. package/dist/tools/works.d.ts +71 -0
  340. package/dist/tools/works.d.ts.map +1 -0
  341. package/dist/tools/works.js +694 -0
  342. package/dist/tools/works.js.map +1 -0
  343. package/package.json +54 -0
  344. package/scripts/build-required-schemas.ts +233 -0
  345. package/scripts/bundle-apps.ts +61 -0
  346. package/scripts/refresh-schema-mirror.ts +182 -0
  347. package/server.json +20 -0
@@ -0,0 +1,281 @@
1
+ // Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
2
+ import { formatAsText, formatList, formatSuccess } from "@withpica/mcp-utils";
3
+ import { notifyParties, summarizeNotifications, withBillingGate, } from "@withpica/mcp-utils";
4
+ import { AGREEMENT_TYPES_WRITE_PROPERTIES, AGREEMENT_TYPES_CREATE_REQUIRED, AGREEMENT_TYPES_UPDATE_REQUIRED, } from "@withpica/mcp-utils";
5
+ export class AgreementTypesTools {
6
+ pica;
7
+ constructor(pica) {
8
+ this.pica = pica;
9
+ }
10
+ getResource(type) {
11
+ switch (type) {
12
+ case "template":
13
+ return this.pica.agreementTemplates;
14
+ case "producer":
15
+ return this.pica.producerAgreements;
16
+ case "work_for_hire":
17
+ return this.pica.workForHire;
18
+ default:
19
+ throw new Error(`Unknown agreement type: ${type}`);
20
+ }
21
+ }
22
+ labelFor(type) {
23
+ switch (type) {
24
+ case "template":
25
+ return "Agreement template";
26
+ case "producer":
27
+ return "Producer agreement";
28
+ case "work_for_hire":
29
+ return "Work-for-hire agreement";
30
+ }
31
+ }
32
+ getTools() {
33
+ return [
34
+ // ── Unified CRUD ────────────────────────────────────────────────
35
+ {
36
+ definition: {
37
+ name: "pica_agreement_types_query",
38
+ description: "List agreements by type — templates, producer agreements, or work-for-hire contracts.",
39
+ workflows: "infrastructure",
40
+ inputSchema: {
41
+ type: "object",
42
+ properties: {
43
+ type: {
44
+ type: "string",
45
+ enum: ["template", "producer", "work_for_hire"],
46
+ description: "Agreement sub-type to query",
47
+ },
48
+ limit: {
49
+ type: "number",
50
+ description: "Max results",
51
+ },
52
+ },
53
+ required: ["type"],
54
+ },
55
+ },
56
+ executor: this.query.bind(this),
57
+ },
58
+ {
59
+ definition: {
60
+ name: "pica_agreement_types_inspect",
61
+ description: "Get a specific agreement by type and ID — full details including body, terms, and metadata.",
62
+ workflows: "infrastructure",
63
+ inputSchema: {
64
+ type: "object",
65
+ properties: {
66
+ type: {
67
+ type: "string",
68
+ enum: ["template", "producer", "work_for_hire"],
69
+ description: "Agreement sub-type",
70
+ },
71
+ id: {
72
+ type: "string",
73
+ description: "Agreement ID",
74
+ },
75
+ },
76
+ required: ["type", "id"],
77
+ },
78
+ },
79
+ executor: this.inspect.bind(this),
80
+ },
81
+ {
82
+ definition: {
83
+ name: "pica_agreement_types_create",
84
+ description: "Create a new agreement of the specified type. Three branches dispatched via 'type': " +
85
+ "template (→ agreement_templates, needs name + category + templateText), " +
86
+ "producer (→ producer_agreements, needs producer_id + royalty_points + deliverables + work_id|recording_id), " +
87
+ "work_for_hire (→ work_for_hire_agreements, needs contractor_id + contractor_role + fee_amount + services_description + work_id|recording_id). " +
88
+ "Per-branch field applicability is documented on each property.",
89
+ workflows: "infrastructure",
90
+ inputSchema: {
91
+ type: "object",
92
+ properties: AGREEMENT_TYPES_WRITE_PROPERTIES,
93
+ required: [...AGREEMENT_TYPES_CREATE_REQUIRED],
94
+ },
95
+ },
96
+ executor: withBillingGate(this.pica, "agreement type creation", this.create.bind(this)),
97
+ },
98
+ {
99
+ definition: {
100
+ name: "pica_agreement_types_update",
101
+ description: "Update an existing agreement by type and ID. " +
102
+ "Note: PATCH on producer_agreements and work_for_hire_agreements is action-only " +
103
+ "(send_for_signature / countersign / mark_advance_paid / mark_paid / record_recoupment / " +
104
+ "calculate_royalty), not generic field-level. Template branch accepts field updates.",
105
+ workflows: "infrastructure",
106
+ inputSchema: {
107
+ type: "object",
108
+ properties: AGREEMENT_TYPES_WRITE_PROPERTIES,
109
+ required: [...AGREEMENT_TYPES_UPDATE_REQUIRED],
110
+ },
111
+ },
112
+ executor: withBillingGate(this.pica, "agreement type update", this.update.bind(this)),
113
+ },
114
+ {
115
+ definition: {
116
+ name: "pica_agreement_types_delete",
117
+ description: "Delete an agreement by type and ID.",
118
+ workflows: "infrastructure",
119
+ inputSchema: {
120
+ type: "object",
121
+ properties: {
122
+ type: {
123
+ type: "string",
124
+ enum: ["template", "producer", "work_for_hire"],
125
+ description: "Agreement sub-type",
126
+ },
127
+ id: {
128
+ type: "string",
129
+ description: "Agreement ID",
130
+ },
131
+ },
132
+ required: ["type", "id"],
133
+ },
134
+ },
135
+ executor: withBillingGate(this.pica, "agreement type deletion", this.delete.bind(this)),
136
+ },
137
+ // ── Template-specific operations ────────────────────────────────
138
+ {
139
+ definition: {
140
+ name: "pica_agreement_templates_render",
141
+ description: "Fill an agreement template with work and people data — generates a ready-to-send agreement. Pass the template ID plus work_id and/or people_ids to populate the placeholders with real catalog data.",
142
+ workflows: ["agreement-required"],
143
+ inputSchema: {
144
+ type: "object",
145
+ properties: {
146
+ id: {
147
+ type: "string",
148
+ description: "Template ID to render",
149
+ },
150
+ work_id: {
151
+ type: "string",
152
+ description: "Work ID to pull title, credits, and metadata from",
153
+ },
154
+ people_ids: {
155
+ type: "array",
156
+ items: { type: "string" },
157
+ description: "People IDs to include as parties in the agreement",
158
+ },
159
+ variables: {
160
+ type: "object",
161
+ description: "Additional variables to substitute — keys match placeholder names in the template body",
162
+ },
163
+ },
164
+ required: ["id"],
165
+ },
166
+ },
167
+ executor: this.renderTemplate.bind(this),
168
+ },
169
+ {
170
+ definition: {
171
+ name: "pica_agreement_templates_duplicate",
172
+ description: "Duplicate an agreement template — creates a copy you can customise without changing the original.",
173
+ workflows: "infrastructure",
174
+ inputSchema: {
175
+ type: "object",
176
+ properties: {
177
+ id: {
178
+ type: "string",
179
+ description: "Template ID to duplicate",
180
+ },
181
+ },
182
+ required: ["id"],
183
+ },
184
+ },
185
+ executor: withBillingGate(this.pica, "template duplication", this.duplicateTemplate.bind(this)),
186
+ },
187
+ {
188
+ definition: {
189
+ name: "pica_agreement_templates_set_default",
190
+ description: "Set a template as the default for its type — when creating agreements of that type, this template will be suggested first.",
191
+ workflows: "infrastructure",
192
+ inputSchema: {
193
+ type: "object",
194
+ properties: {
195
+ id: {
196
+ type: "string",
197
+ description: "Template ID to set as default",
198
+ },
199
+ },
200
+ required: ["id"],
201
+ },
202
+ },
203
+ executor: withBillingGate(this.pica, "template default", this.setDefaultTemplate.bind(this)),
204
+ },
205
+ ];
206
+ }
207
+ // ── Unified CRUD executors ──────────────────────────────────────────
208
+ async query(args) {
209
+ const resource = this.getResource(args.type);
210
+ const items = await resource.list();
211
+ return formatList(items, { total: items.length });
212
+ }
213
+ async inspect(args) {
214
+ const resource = this.getResource(args.type);
215
+ const item = await resource.get(args.id);
216
+ return formatAsText(item);
217
+ }
218
+ async create(args) {
219
+ const { type, ...fields } = args;
220
+ const resource = this.getResource(type);
221
+ const item = await resource.create(fields);
222
+ // Notification for producer agreements
223
+ if (type === "producer" && fields.producer_id) {
224
+ const results = await notifyParties(this.pica, [
225
+ {
226
+ person_id: fields.producer_id,
227
+ message: `a producer agreement has been created for "${fields.title || "untitled"}" — please review the terms`,
228
+ work_id: fields.work_id,
229
+ notification_type: "agreement_created",
230
+ },
231
+ ]);
232
+ const notifySummary = summarizeNotifications(results);
233
+ if (notifySummary) {
234
+ return formatSuccess(`Producer agreement created. ${notifySummary}`, item);
235
+ }
236
+ }
237
+ // Notification for work-for-hire
238
+ if (type === "work_for_hire" && fields.contractor_id) {
239
+ const results = await notifyParties(this.pica, [
240
+ {
241
+ person_id: fields.contractor_id,
242
+ message: `a work-for-hire agreement has been created: "${fields.title || "untitled"}" — please review`,
243
+ work_id: fields.work_id,
244
+ notification_type: "agreement_created",
245
+ },
246
+ ]);
247
+ const notifySummary = summarizeNotifications(results);
248
+ if (notifySummary) {
249
+ return formatSuccess(`Work-for-hire agreement created. ${notifySummary}`, item);
250
+ }
251
+ }
252
+ return formatSuccess(`${this.labelFor(type)} created`, item);
253
+ }
254
+ async update(args) {
255
+ const { type, id, ...updates } = args;
256
+ const resource = this.getResource(type);
257
+ const item = await resource.update(id, updates);
258
+ return formatSuccess(`${this.labelFor(type)} updated`, item);
259
+ }
260
+ async delete(args) {
261
+ const { type, id } = args;
262
+ const resource = this.getResource(type);
263
+ await resource.delete(id);
264
+ return formatSuccess(`${this.labelFor(type)} ${id} deleted`);
265
+ }
266
+ // ── Template-specific executors ─────────────────────────────────────
267
+ async renderTemplate(args) {
268
+ const { id, ...renderData } = args;
269
+ const rendered = await this.pica.agreementTemplates.render(id, renderData);
270
+ return formatSuccess("Template rendered with catalog data", rendered);
271
+ }
272
+ async duplicateTemplate(args) {
273
+ const duplicate = await this.pica.agreementTemplates.duplicate(args.id);
274
+ return formatSuccess("Template duplicated", duplicate);
275
+ }
276
+ async setDefaultTemplate(args) {
277
+ const result = await this.pica.agreementTemplates.setDefault(args.id);
278
+ return formatSuccess("Template set as default for its type", result);
279
+ }
280
+ }
281
+ //# sourceMappingURL=agreement-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agreement-types.js","sourceRoot":"","sources":["../../src/tools/agreement-types.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAW7D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gCAAgC,EAChC,+BAA+B,EAC/B,+BAA+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GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC/D,CAAC;IAED,uEAAuE;IAE/D,KAAK,CAAC,cAAc,CAAC,IAAyB;QACpD,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,EAAE,GAAG,IAAI,CAAC;QACnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QAC3E,OAAO,aAAa,CAAC,qCAAqC,EAAE,QAAQ,CAAC,CAAC;IACxE,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAC7B,IAAyB;QAEzB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxE,OAAO,aAAa,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;IACzD,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAC9B,IAAyB;QAEzB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtE,OAAO,aAAa,CAAC,sCAAsC,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Agreements Tools - MCP tools for managing agreements and contracts
3
+ */
4
+ import { PicaClient } from "@withpica/mcp-sdk";
5
+ import { ToolDefinition, ToolExecutor } from "./index.js";
6
+ export declare class AgreementsTools {
7
+ private pica;
8
+ constructor(pica: PicaClient);
9
+ getTools(): Array<{
10
+ definition: ToolDefinition;
11
+ executor: ToolExecutor;
12
+ }>;
13
+ private queryAgreements;
14
+ private inspectAgreement;
15
+ private createAgreement;
16
+ private updateAgreement;
17
+ private deleteAgreement;
18
+ private linkWork;
19
+ }
20
+ //# sourceMappingURL=agreements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agreements.d.ts","sourceRoot":"","sources":["../../src/tools/agreements.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AA6BtE,qBAAa,eAAe;IAC1B,OAAO,CAAC,IAAI,CAAa;gBAEb,IAAI,EAAE,UAAU;IAI5B,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;YAwL3D,eAAe;YAef,gBAAgB;YAqEhB,eAAe;YAyBf,eAAe;YAQf,eAAe;YAOf,QAAQ;CAQvB"}
@@ -0,0 +1,282 @@
1
+ // Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
2
+ import { formatList, formatSuccess, notifyParties, summarizeNotifications, withBillingGate, AGREEMENTS_WRITE_PROPERTIES, AGREEMENTS_CREATE_REQUIRED, AGREEMENTS_UPDATE_REQUIRED, } from "@withpica/mcp-utils";
3
+ import { computeAgreementGapHints } from "./gap-hints.js";
4
+ const AGREEMENT_TYPE_ENUM = [
5
+ "master_recording",
6
+ "library_music",
7
+ "publishing_admin",
8
+ "production",
9
+ "artist_contract",
10
+ "termination",
11
+ "report",
12
+ "other",
13
+ "sub_publishing",
14
+ "co_publishing",
15
+ "admin_only",
16
+ "distribution",
17
+ ];
18
+ export class AgreementsTools {
19
+ pica;
20
+ constructor(pica) {
21
+ this.pica = pica;
22
+ }
23
+ getTools() {
24
+ return [
25
+ {
26
+ definition: {
27
+ name: "pica_agreements_query",
28
+ description: "List agreements with optional filters. Returns contracts, publishing deals, and other agreements.",
29
+ workflows: "infrastructure",
30
+ inputSchema: {
31
+ type: "object",
32
+ properties: {
33
+ query: {
34
+ type: "string",
35
+ description: "Search by title or party name",
36
+ },
37
+ agreement_type: {
38
+ type: "string",
39
+ description: "Filter by agreement type",
40
+ enum: [...AGREEMENT_TYPE_ENUM],
41
+ },
42
+ status: {
43
+ type: "string",
44
+ description: "Filter by status",
45
+ enum: [
46
+ "draft",
47
+ "pending_signature",
48
+ "partially_signed",
49
+ "fully_executed",
50
+ "active",
51
+ "completed",
52
+ "terminated",
53
+ "expired",
54
+ "cancelled",
55
+ "unknown",
56
+ ],
57
+ },
58
+ party_name: {
59
+ type: "string",
60
+ description: "Filter by other party name",
61
+ },
62
+ limit: {
63
+ type: "number",
64
+ description: "Maximum results (default: 50, max: 100)",
65
+ },
66
+ offset: {
67
+ type: "number",
68
+ description: "Pagination offset (default: 0)",
69
+ },
70
+ },
71
+ },
72
+ },
73
+ executor: this.queryAgreements.bind(this),
74
+ },
75
+ {
76
+ definition: {
77
+ name: "pica_agreements_inspect",
78
+ description: "Get details for a specific agreement. Omit sections for everything. " +
79
+ "→ then: pica_agreements_update (modify), pica_agreements_link_work (attach work)",
80
+ workflows: "infrastructure",
81
+ inputSchema: {
82
+ type: "object",
83
+ properties: {
84
+ id: {
85
+ type: "string",
86
+ description: "Agreement ID",
87
+ },
88
+ sections: {
89
+ type: "array",
90
+ items: {
91
+ type: "string",
92
+ enum: ["basic", "works", "parties", "payments"],
93
+ },
94
+ description: "Which data sections to include. Omit for all sections.",
95
+ },
96
+ },
97
+ required: ["id"],
98
+ },
99
+ },
100
+ executor: this.inspectAgreement.bind(this),
101
+ },
102
+ {
103
+ definition: {
104
+ name: "pica_agreements_create",
105
+ description: "Create a new agreement. Requires title + agreement_type + other_party_name. " +
106
+ "Prefer resolving the counterparty to a linked org via `counterparty_org_id` " +
107
+ "(use pica_search_all to look up the org UUID) over free-text other_party_name — " +
108
+ "the FK form enables aggregate reporting by counterparty.",
109
+ workflows: ["agreement-required"],
110
+ inputSchema: {
111
+ type: "object",
112
+ properties: AGREEMENTS_WRITE_PROPERTIES,
113
+ required: [...AGREEMENTS_CREATE_REQUIRED],
114
+ },
115
+ },
116
+ executor: withBillingGate(this.pica, "agreement creation", this.createAgreement.bind(this)),
117
+ },
118
+ {
119
+ definition: {
120
+ name: "pica_agreements_update",
121
+ description: "Update an existing agreement. Status changes trigger notifications; " +
122
+ "counterparty_org_id changes require the linked-org check at the route layer.",
123
+ workflows: ["agreement-required"],
124
+ inputSchema: {
125
+ type: "object",
126
+ properties: AGREEMENTS_WRITE_PROPERTIES,
127
+ required: [...AGREEMENTS_UPDATE_REQUIRED],
128
+ },
129
+ },
130
+ executor: withBillingGate(this.pica, "agreement update", this.updateAgreement.bind(this)),
131
+ },
132
+ {
133
+ definition: {
134
+ name: "pica_agreements_delete",
135
+ description: "Delete an agreement (destructive — also removes linked work and party records).",
136
+ workflows: "infrastructure",
137
+ inputSchema: {
138
+ type: "object",
139
+ properties: {
140
+ id: {
141
+ type: "string",
142
+ description: "Agreement ID",
143
+ },
144
+ },
145
+ required: ["id"],
146
+ },
147
+ },
148
+ executor: withBillingGate(this.pica, "agreement deletion", this.deleteAgreement.bind(this)),
149
+ },
150
+ {
151
+ definition: {
152
+ name: "pica_agreements_link_work",
153
+ description: "Link a work to an agreement. Optionally set a royalty split percentage.",
154
+ workflows: ["agreement-required"],
155
+ inputSchema: {
156
+ type: "object",
157
+ properties: {
158
+ agreement_id: {
159
+ type: "string",
160
+ description: "Agreement ID",
161
+ },
162
+ work_id: {
163
+ type: "string",
164
+ description: "Work ID to link",
165
+ },
166
+ royalty_split_percentage: {
167
+ type: "number",
168
+ description: "Royalty split percentage for this work (0-100)",
169
+ },
170
+ notes: {
171
+ type: "string",
172
+ description: "Notes about this work's inclusion in the agreement",
173
+ },
174
+ },
175
+ required: ["agreement_id", "work_id"],
176
+ },
177
+ },
178
+ executor: withBillingGate(this.pica, "agreement link", this.linkWork.bind(this)),
179
+ },
180
+ ];
181
+ }
182
+ async queryAgreements(args) {
183
+ const agreements = await this.pica.agreements.list({
184
+ query: args.query,
185
+ agreement_type: args.agreement_type,
186
+ status: args.status,
187
+ party_name: args.party_name,
188
+ includeWorkCounts: true,
189
+ limit: args.limit,
190
+ offset: args.offset,
191
+ });
192
+ return formatList(agreements, { total: agreements.length });
193
+ }
194
+ async inspectAgreement(args) {
195
+ const sections = args.sections;
196
+ const includeAll = !sections || sections.length === 0;
197
+ const needsBasic = includeAll ||
198
+ sections.includes("basic") ||
199
+ sections.includes("parties") ||
200
+ sections.includes("payments");
201
+ const needsWorks = includeAll || sections.includes("works");
202
+ // Fetch data in parallel where possible
203
+ const [fullResult, works] = await Promise.all([
204
+ needsBasic ? this.pica.agreements.get(args.id) : null,
205
+ needsWorks ? this.pica.agreements.getWorks(args.id) : null,
206
+ ]);
207
+ const result = {};
208
+ if (includeAll || sections.includes("basic")) {
209
+ result.agreement = fullResult.agreement;
210
+ result.signatureStatus = fullResult.signatureStatus;
211
+ }
212
+ if (includeAll || sections.includes("works")) {
213
+ result.linkedWorks = works;
214
+ }
215
+ if (includeAll || sections.includes("parties")) {
216
+ // Parties are part of the agreement object
217
+ const agreement = fullResult.agreement;
218
+ result.parties = {
219
+ other_party_name: agreement.other_party_name,
220
+ other_party_type: agreement.other_party_type,
221
+ };
222
+ }
223
+ if (includeAll || sections.includes("payments")) {
224
+ // Payment info is part of the agreement object.
225
+ // ADR-201 Phase 2: dropped phantom `royalty_rate` and `payment_terms`
226
+ // columns (template-variable names from system-templates seed, never
227
+ // actual columns on `agreements`). Surfaced `advance_currency`,
228
+ // `is_recoupable`, `financial_terms` to match the write surface so
229
+ // the round-trip parity contract is satisfied. See
230
+ // docs/audits/2026-04-27-read-write-parity-audit.md § Agreements.
231
+ const agreement = fullResult.agreement;
232
+ result.payments = {
233
+ advance_amount: agreement.advance_amount,
234
+ advance_currency: agreement.advance_currency,
235
+ is_recoupable: agreement.is_recoupable,
236
+ financial_terms: agreement.financial_terms,
237
+ };
238
+ }
239
+ // ADR-193 Surface 2 — proactive peer-MCP hints when gaps are real.
240
+ const gap_hints = computeAgreementGapHints(result);
241
+ const enriched = gap_hints.length > 0 ? { ...result, gap_hints } : result;
242
+ return formatSuccess("Agreement details", enriched);
243
+ }
244
+ async createAgreement(args) {
245
+ const agreement = await this.pica.agreements.create(args);
246
+ // Auto-notify other party if person_id provided
247
+ let notifySummary = "";
248
+ if (args.other_party_person_id) {
249
+ const results = await notifyParties(this.pica, [
250
+ {
251
+ person_id: args.other_party_person_id,
252
+ message: `a new ${args.agreement_type || "agreement"} has been created: "${args.title || "untitled"}" — please review`,
253
+ work_id: args.work_id,
254
+ notification_type: "agreement_created",
255
+ },
256
+ ]);
257
+ notifySummary = summarizeNotifications(results);
258
+ }
259
+ const msg = notifySummary
260
+ ? `Agreement created. ${notifySummary}`
261
+ : "Agreement created";
262
+ return formatSuccess(msg, agreement);
263
+ }
264
+ async updateAgreement(args) {
265
+ const { id, ...updates } = args;
266
+ const agreement = await this.pica.agreements.update(id, updates);
267
+ return formatSuccess("Agreement updated", agreement);
268
+ }
269
+ async deleteAgreement(args) {
270
+ await this.pica.agreements.delete(args.id);
271
+ return formatSuccess(`Agreement ${args.id} deleted`);
272
+ }
273
+ async linkWork(args) {
274
+ const link = await this.pica.agreements.linkWork(args.agreement_id, {
275
+ work_id: args.work_id,
276
+ royalty_split_percentage: args.royalty_split_percentage,
277
+ notes: args.notes,
278
+ });
279
+ return formatSuccess("Work linked to agreement", link);
280
+ }
281
+ }
282
+ //# sourceMappingURL=agreements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agreements.js","sourceRoot":"","sources":["../../src/tools/agreements.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAQ7D,OAAO,EAEL,UAAU,EACV,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,mBAAmB,GAAG;IAC1B,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,YAAY;IACZ,iBAAiB;IACjB,aAAa;I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,CAAC,eAAe,CAC3B,IAAyB;QAEzB,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3C,OAAO,aAAa,CAAC,aAAa,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,IAAyB;QAC9C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE;YAClE,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;YACvD,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;QACH,OAAO,aAAa,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Analytics & Reporting Tools — carbon footprint, provenance, catalog diligence
3
+ */
4
+ import { PicaClient } from "@withpica/mcp-sdk";
5
+ import { ToolDefinition, ToolExecutor } from "./index.js";
6
+ export declare class AnalyticsTools {
7
+ private pica;
8
+ constructor(pica: PicaClient);
9
+ getTools(): Array<{
10
+ definition: ToolDefinition;
11
+ executor: ToolExecutor;
12
+ }>;
13
+ private carbonSummary;
14
+ private carbonLive;
15
+ private provenanceStats;
16
+ private provenanceWork;
17
+ private provenanceCertificate;
18
+ private catalogDiligence;
19
+ }
20
+ //# sourceMappingURL=analytics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/tools/analytics.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAGtE,qBAAa,cAAc;IACzB,OAAO,CAAC,IAAI,CAAa;gBAEb,IAAI,EAAE,UAAU;IAI5B,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;YAwG3D,aAAa;YAKb,UAAU;YAKV,eAAe;YAOf,cAAc;YAKd,qBAAqB;YAYrB,gBAAgB;CAM/B"}