@redaksjon/protokoll 0.2.0 → 0.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.
@@ -1695,7 +1695,7 @@ const tools = [
1695
1695
  },
1696
1696
  {
1697
1697
  name: "protokoll_edit_project",
1698
- description: "Edit an existing project with manual modifications. Unlike protokoll_update_project (which regenerates from a source), this allows direct edits: adding specific sounds_like variants, changing routing, modifying classification, etc. For array fields (sounds_like, topics, explicit_phrases), use add_* to append or remove_* to delete specific values, or use the base field name to replace the entire array.",
1698
+ description: "Edit an existing project with manual modifications. Unlike protokoll_update_project (which regenerates from a source), this allows direct edits: adding specific sounds_like variants, changing routing, modifying classification, managing relationships, etc. For array fields (sounds_like, topics, explicit_phrases, associated_people, associated_companies, children, siblings, related_terms), use add_* to append or remove_* to delete specific values, or use the base field name to replace the entire array.",
1699
1699
  inputSchema: {
1700
1700
  type: "object",
1701
1701
  properties: {
@@ -1774,6 +1774,70 @@ const tools = [
1774
1774
  items: { type: "string" },
1775
1775
  description: "Remove these explicit trigger phrases"
1776
1776
  },
1777
+ associated_people: {
1778
+ type: "array",
1779
+ items: { type: "string" },
1780
+ description: "Replace all associated people (person IDs) with this array"
1781
+ },
1782
+ add_associated_people: {
1783
+ type: "array",
1784
+ items: { type: "string" },
1785
+ description: "Add these person IDs to associated people"
1786
+ },
1787
+ remove_associated_people: {
1788
+ type: "array",
1789
+ items: { type: "string" },
1790
+ description: "Remove these person IDs from associated people"
1791
+ },
1792
+ associated_companies: {
1793
+ type: "array",
1794
+ items: { type: "string" },
1795
+ description: "Replace all associated companies (company IDs) with this array"
1796
+ },
1797
+ add_associated_companies: {
1798
+ type: "array",
1799
+ items: { type: "string" },
1800
+ description: "Add these company IDs to associated companies"
1801
+ },
1802
+ remove_associated_companies: {
1803
+ type: "array",
1804
+ items: { type: "string" },
1805
+ description: "Remove these company IDs from associated companies"
1806
+ },
1807
+ parent: {
1808
+ type: "string",
1809
+ description: "Set parent project ID (for project relationships)"
1810
+ },
1811
+ add_children: {
1812
+ type: "array",
1813
+ items: { type: "string" },
1814
+ description: "Add these project IDs as children"
1815
+ },
1816
+ remove_children: {
1817
+ type: "array",
1818
+ items: { type: "string" },
1819
+ description: "Remove these project IDs from children"
1820
+ },
1821
+ add_siblings: {
1822
+ type: "array",
1823
+ items: { type: "string" },
1824
+ description: "Add these project IDs as siblings"
1825
+ },
1826
+ remove_siblings: {
1827
+ type: "array",
1828
+ items: { type: "string" },
1829
+ description: "Remove these project IDs from siblings"
1830
+ },
1831
+ add_related_terms: {
1832
+ type: "array",
1833
+ items: { type: "string" },
1834
+ description: "Add these term IDs as related terms (for project relationships)"
1835
+ },
1836
+ remove_related_terms: {
1837
+ type: "array",
1838
+ items: { type: "string" },
1839
+ description: "Remove these term IDs from related terms"
1840
+ },
1777
1841
  contextDirectory: {
1778
1842
  type: "string",
1779
1843
  description: "Path to the .protokoll context directory"
@@ -3071,6 +3135,37 @@ async function handleEditProject(args) {
3071
3135
  args.add_explicit_phrases,
3072
3136
  args.remove_explicit_phrases
3073
3137
  );
3138
+ const updatedAssociatedPeople = mergeArray(
3139
+ existingProject.classification?.associated_people,
3140
+ args.associated_people,
3141
+ args.add_associated_people,
3142
+ args.remove_associated_people
3143
+ );
3144
+ const updatedAssociatedCompanies = mergeArray(
3145
+ existingProject.classification?.associated_companies,
3146
+ args.associated_companies,
3147
+ args.add_associated_companies,
3148
+ args.remove_associated_companies
3149
+ );
3150
+ const existingRelationships = existingProject.relationships || {};
3151
+ const updatedChildren = mergeArray(
3152
+ existingRelationships.children,
3153
+ void 0,
3154
+ args.add_children,
3155
+ args.remove_children
3156
+ );
3157
+ const updatedSiblings = mergeArray(
3158
+ existingRelationships.siblings,
3159
+ void 0,
3160
+ args.add_siblings,
3161
+ args.remove_siblings
3162
+ );
3163
+ const updatedRelatedTerms = mergeArray(
3164
+ existingRelationships.relatedTerms,
3165
+ void 0,
3166
+ args.add_related_terms,
3167
+ args.remove_related_terms
3168
+ );
3074
3169
  const updatedProject = {
3075
3170
  ...existingProject,
3076
3171
  ...args.name !== void 0 && { name: args.name },
@@ -3102,6 +3197,31 @@ async function handleEditProject(args) {
3102
3197
  } else if (existingProject.classification?.explicit_phrases && (args.explicit_phrases !== void 0 || args.remove_explicit_phrases)) {
3103
3198
  delete updatedProject.classification.explicit_phrases;
3104
3199
  }
3200
+ if (updatedAssociatedPeople !== void 0) {
3201
+ updatedProject.classification.associated_people = updatedAssociatedPeople;
3202
+ } else if (existingProject.classification?.associated_people && (args.associated_people !== void 0 || args.remove_associated_people)) {
3203
+ delete updatedProject.classification.associated_people;
3204
+ }
3205
+ if (updatedAssociatedCompanies !== void 0) {
3206
+ updatedProject.classification.associated_companies = updatedAssociatedCompanies;
3207
+ } else if (existingProject.classification?.associated_companies && (args.associated_companies !== void 0 || args.remove_associated_companies)) {
3208
+ delete updatedProject.classification.associated_companies;
3209
+ }
3210
+ if (args.parent !== void 0 || updatedChildren || updatedSiblings || updatedRelatedTerms) {
3211
+ updatedProject.relationships = {
3212
+ ...existingRelationships,
3213
+ ...args.parent !== void 0 && { parent: args.parent }
3214
+ };
3215
+ if (updatedChildren !== void 0) {
3216
+ updatedProject.relationships.children = updatedChildren;
3217
+ }
3218
+ if (updatedSiblings !== void 0) {
3219
+ updatedProject.relationships.siblings = updatedSiblings;
3220
+ }
3221
+ if (updatedRelatedTerms !== void 0) {
3222
+ updatedProject.relationships.relatedTerms = updatedRelatedTerms;
3223
+ }
3224
+ }
3105
3225
  await context.saveEntity(updatedProject);
3106
3226
  const changes = [];
3107
3227
  if (args.name !== void 0) changes.push(`name: "${args.name}"`);
@@ -3119,6 +3239,19 @@ async function handleEditProject(args) {
3119
3239
  if (args.explicit_phrases !== void 0) changes.push(`explicit_phrases replaced with ${args.explicit_phrases.length} items`);
3120
3240
  if (args.add_explicit_phrases?.length) changes.push(`added ${args.add_explicit_phrases.length} explicit phrases`);
3121
3241
  if (args.remove_explicit_phrases?.length) changes.push(`removed ${args.remove_explicit_phrases.length} explicit phrases`);
3242
+ if (args.associated_people !== void 0) changes.push(`associated_people replaced with ${args.associated_people.length} items`);
3243
+ if (args.add_associated_people?.length) changes.push(`added ${args.add_associated_people.length} associated people`);
3244
+ if (args.remove_associated_people?.length) changes.push(`removed ${args.remove_associated_people.length} associated people`);
3245
+ if (args.associated_companies !== void 0) changes.push(`associated_companies replaced with ${args.associated_companies.length} items`);
3246
+ if (args.add_associated_companies?.length) changes.push(`added ${args.add_associated_companies.length} associated companies`);
3247
+ if (args.remove_associated_companies?.length) changes.push(`removed ${args.remove_associated_companies.length} associated companies`);
3248
+ if (args.parent !== void 0) changes.push(`parent: "${args.parent}"`);
3249
+ if (args.add_children?.length) changes.push(`added ${args.add_children.length} children`);
3250
+ if (args.remove_children?.length) changes.push(`removed ${args.remove_children.length} children`);
3251
+ if (args.add_siblings?.length) changes.push(`added ${args.add_siblings.length} siblings`);
3252
+ if (args.remove_siblings?.length) changes.push(`removed ${args.remove_siblings.length} siblings`);
3253
+ if (args.add_related_terms?.length) changes.push(`added ${args.add_related_terms.length} related terms`);
3254
+ if (args.remove_related_terms?.length) changes.push(`removed ${args.remove_related_terms.length} related terms`);
3122
3255
  return {
3123
3256
  success: true,
3124
3257
  message: `Updated project "${existingProject.name}"`,