@vess-id/ai-identity 0.7.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
@@ -4763,8 +4763,8 @@ var ACTION_REGISTRY = {
4763
4763
  action: "gmail.message.send",
4764
4764
  resource_type: "gmail:thread",
4765
4765
  required_relations: ["editor", "act_as"],
4766
- required_scopes: ["https://www.googleapis.com/auth/gmail.send"],
4767
- capability: "gmail.send",
4766
+ required_scopes: ["https://www.googleapis.com/auth/gmail.compose"],
4767
+ capability: "gmail.compose",
4768
4768
  input_schema: {
4769
4769
  type: "object",
4770
4770
  properties: {
@@ -4789,6 +4789,36 @@ var ACTION_REGISTRY = {
4789
4789
  },
4790
4790
  version: "1.0.0"
4791
4791
  },
4792
+ {
4793
+ action: "gmail.draft.create",
4794
+ resource_type: "gmail:thread",
4795
+ required_relations: ["editor", "act_as"],
4796
+ required_scopes: ["https://www.googleapis.com/auth/gmail.compose"],
4797
+ capability: "gmail.compose",
4798
+ input_schema: {
4799
+ type: "object",
4800
+ properties: {
4801
+ to: { type: "string", minLength: 1 },
4802
+ subject: { type: "string", minLength: 1 },
4803
+ body: { type: "string", minLength: 1 },
4804
+ cc: { type: "string" },
4805
+ bcc: { type: "string" }
4806
+ },
4807
+ required: ["to", "subject", "body"],
4808
+ additionalProperties: false
4809
+ },
4810
+ constraints: { rate_bucket: "gmail.write" },
4811
+ effects: ["Create:Draft"],
4812
+ risk: "high",
4813
+ target_bindings: {
4814
+ resource_id: { source: "param", param: "to", multi: true, separator: "," },
4815
+ secondary: [
4816
+ { name: "cc", source: { source: "param", param: "cc" }, type: "recipient" },
4817
+ { name: "bcc", source: { source: "param", param: "bcc" }, type: "recipient" }
4818
+ ]
4819
+ },
4820
+ version: "1.0.0"
4821
+ },
4792
4822
  {
4793
4823
  action: "gmail.label.read",
4794
4824
  resource_type: "gmail:label",
@@ -5382,9 +5412,9 @@ var ACTION_REGISTRY = {
5382
5412
  version: "1.0.0"
5383
5413
  },
5384
5414
  {
5385
- capability: "gmail.send",
5386
- description: "Send emails via Gmail",
5387
- includes: ["gmail.message.send"],
5415
+ capability: "gmail.compose",
5416
+ description: "Send emails and create drafts via Gmail",
5417
+ includes: ["gmail.message.send", "gmail.draft.create"],
5388
5418
  version: "1.0.0"
5389
5419
  },
5390
5420
  {
@@ -5579,6 +5609,142 @@ function normalizeMcpActionName(toolName, actionName) {
5579
5609
  return actionName;
5580
5610
  }
5581
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
+
5582
5748
  // src/resolver/target-resolver.ts
5583
5749
  var TargetResolver = class {
5584
5750
  /**
@@ -5672,6 +5838,7 @@ function getTierLimits(tier) {
5672
5838
  // src/index.ts
5673
5839
  var version = "0.0.1";
5674
5840
  export {
5841
+ ACTION_PARAMS_MAX_SIZE,
5675
5842
  ACTION_PREFIXES,
5676
5843
  ACTION_REGISTRY,
5677
5844
  AIdentityClient,
@@ -5739,6 +5906,8 @@ export {
5739
5906
  evaluateConstraints,
5740
5907
  extractPublicKey,
5741
5908
  extractPublicKeyFromDid,
5909
+ generateActionParamsDisplay,
5910
+ generateActionSummary,
5742
5911
  generateKeyPair,
5743
5912
  generateNonce,
5744
5913
  getActionAliases,