@vess-id/ai-identity 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -5609,6 +5609,142 @@ function normalizeMcpActionName(toolName, actionName) {
5609
5609
  return actionName;
5610
5610
  }
5611
5611
 
5612
+ // src/registry/action-summary.ts
5613
+ var ACTION_DISPLAY_CONFIGS = {
5614
+ "slack.message.post": {
5615
+ summaryTemplate: (p) => {
5616
+ const parts = [];
5617
+ if (p.channel) parts.push(p.channel + ":");
5618
+ if (p.text) parts.push(String(p.text));
5619
+ return parts.join(" ");
5620
+ },
5621
+ displayFields: [
5622
+ { key: "channel", label: "Channel" },
5623
+ { key: "text", label: "Message" }
5624
+ ]
5625
+ },
5626
+ "gmail.message.send": {
5627
+ summaryTemplate: (p) => {
5628
+ const parts = [];
5629
+ if (p.to) parts.push(`To: ${p.to}`);
5630
+ if (p.subject) parts.push(`Subject: ${p.subject}`);
5631
+ return parts.join(", ");
5632
+ },
5633
+ displayFields: [
5634
+ { key: "to", label: "To" },
5635
+ { key: "subject", label: "Subject" },
5636
+ { key: "body", label: "Body" }
5637
+ ]
5638
+ },
5639
+ "gmail.draft.create": {
5640
+ summaryTemplate: (p) => {
5641
+ const parts = [];
5642
+ if (p.to) parts.push(`To: ${p.to}`);
5643
+ if (p.subject) parts.push(`Subject: ${p.subject}`);
5644
+ return parts.join(", ");
5645
+ },
5646
+ displayFields: [
5647
+ { key: "to", label: "To" },
5648
+ { key: "subject", label: "Subject" },
5649
+ { key: "body", label: "Body" }
5650
+ ]
5651
+ },
5652
+ "calendar.event.create": {
5653
+ summaryTemplate: (p) => {
5654
+ const parts = [];
5655
+ if (p.summary) parts.push(p.summary);
5656
+ if (p.start) parts.push(`(${p.start})`);
5657
+ return parts.join(" ");
5658
+ },
5659
+ displayFields: [
5660
+ { key: "summary", label: "Event" },
5661
+ { key: "start", label: "Start" },
5662
+ { key: "end", label: "End" },
5663
+ { key: "attendees", label: "Attendees" }
5664
+ ]
5665
+ },
5666
+ "calendar.event.update": {
5667
+ summaryTemplate: (p) => {
5668
+ const parts = [];
5669
+ if (p.summary) parts.push(p.summary);
5670
+ if (p.start) parts.push(`(${p.start})`);
5671
+ return parts.join(" ");
5672
+ },
5673
+ displayFields: [
5674
+ { key: "summary", label: "Event" },
5675
+ { key: "start", label: "Start" },
5676
+ { key: "end", label: "End" },
5677
+ { key: "attendees", label: "Attendees" }
5678
+ ]
5679
+ },
5680
+ "jira.issue.create": {
5681
+ summaryTemplate: (p) => {
5682
+ const parts = [];
5683
+ if (p.project) parts.push(`${p.project}:`);
5684
+ if (p.summary) parts.push(p.summary);
5685
+ return parts.join(" ");
5686
+ },
5687
+ displayFields: [
5688
+ { key: "project", label: "Project" },
5689
+ { key: "issuetype", label: "Type" },
5690
+ { key: "summary", label: "Summary" },
5691
+ { key: "description", label: "Description" }
5692
+ ]
5693
+ },
5694
+ "jira.issue.update": {
5695
+ summaryTemplate: (p) => {
5696
+ const parts = [];
5697
+ if (p.issueKey) parts.push(`${p.issueKey}:`);
5698
+ if (p.summary) parts.push(p.summary);
5699
+ return parts.join(" ");
5700
+ },
5701
+ displayFields: [
5702
+ { key: "issueKey", label: "Issue" },
5703
+ { key: "summary", label: "Summary" },
5704
+ { key: "description", label: "Description" }
5705
+ ]
5706
+ }
5707
+ };
5708
+ function truncate(text, maxLength) {
5709
+ if (text.length <= maxLength) return text;
5710
+ return text.slice(0, maxLength - 3) + "...";
5711
+ }
5712
+ function formatValue(value) {
5713
+ if (value === null || value === void 0) return "";
5714
+ if (Array.isArray(value)) return value.map(String).join(", ");
5715
+ if (typeof value === "object") return JSON.stringify(value);
5716
+ return String(value);
5717
+ }
5718
+ var ACTION_PARAMS_MAX_SIZE = 1e4;
5719
+ function generateActionSummary(action, params, maxLength = 50) {
5720
+ if (!params || Object.keys(params).length === 0) return "";
5721
+ const config = ACTION_DISPLAY_CONFIGS[action];
5722
+ if (config) {
5723
+ const raw = config.summaryTemplate(params);
5724
+ return raw ? truncate(raw, maxLength) : "";
5725
+ }
5726
+ for (const [key, val] of Object.entries(params)) {
5727
+ if (val !== null && val !== void 0 && typeof val !== "object") {
5728
+ return truncate(`${key}: ${String(val)}`, maxLength);
5729
+ }
5730
+ }
5731
+ return "";
5732
+ }
5733
+ function generateActionParamsDisplay(action, params) {
5734
+ if (!params || Object.keys(params).length === 0) return [];
5735
+ const config = ACTION_DISPLAY_CONFIGS[action];
5736
+ if (config) {
5737
+ return config.displayFields.filter((f) => params[f.key] !== void 0 && params[f.key] !== null).map((f) => ({
5738
+ label: f.label,
5739
+ value: formatValue(params[f.key])
5740
+ }));
5741
+ }
5742
+ return Object.entries(params).filter(([, v]) => v !== void 0 && v !== null).slice(0, 3).map(([key, val]) => ({
5743
+ label: key,
5744
+ value: formatValue(val)
5745
+ }));
5746
+ }
5747
+
5612
5748
  // src/resolver/target-resolver.ts
5613
5749
  var TargetResolver = class {
5614
5750
  /**
@@ -5702,6 +5838,7 @@ function getTierLimits(tier) {
5702
5838
  // src/index.ts
5703
5839
  var version = "0.0.1";
5704
5840
  export {
5841
+ ACTION_PARAMS_MAX_SIZE,
5705
5842
  ACTION_PREFIXES,
5706
5843
  ACTION_REGISTRY,
5707
5844
  AIdentityClient,
@@ -5769,6 +5906,8 @@ export {
5769
5906
  evaluateConstraints,
5770
5907
  extractPublicKey,
5771
5908
  extractPublicKeyFromDid,
5909
+ generateActionParamsDisplay,
5910
+ generateActionSummary,
5772
5911
  generateKeyPair,
5773
5912
  generateNonce,
5774
5913
  getActionAliases,