@fidacy/mcp 0.1.20 → 0.1.22

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.22
4
+
5
+ ### Patch Changes
6
+
7
+ - ba44b92: Human-directed claim links in nudges: value-moment messages now point the operator at fidacy.com/claim?ref=<anon_id> (see and claim this install's block history) instead of asking the agent to call the upgrade tool. Scope denies became actionable: category_not_allowed and currency_not_allowed explain exactly which mandate field to adjust in ~/.fidacy/config.json (hot-reloaded).
8
+
3
9
  All notable changes to `@fidacy/mcp` are documented here. This project follows
4
10
  semantic versioning.
5
11
 
package/dist/core.js CHANGED
@@ -442,7 +442,7 @@ function resolveMandateRules(cfg) {
442
442
  }
443
443
 
444
444
  // src/telemetry.ts
445
- var CLIENT_VERSION = true ? "0.1.20" : "dev";
445
+ var CLIENT_VERSION = true ? "0.1.22" : "dev";
446
446
  function bandOf(amount) {
447
447
  if (typeof amount !== "number" || !Number.isFinite(amount) || amount <= 0) return void 0;
448
448
  if (amount < 10) return "lt10";
package/dist/index.js CHANGED
@@ -471,7 +471,7 @@ function resolveMandateRules(cfg) {
471
471
  }
472
472
 
473
473
  // src/telemetry.ts
474
- var CLIENT_VERSION = true ? "0.1.20" : "dev";
474
+ var CLIENT_VERSION = true ? "0.1.22" : "dev";
475
475
  function bandOf(amount) {
476
476
  if (typeof amount !== "number" || !Number.isFinite(amount) || amount <= 0) return void 0;
477
477
  if (amount < 10) return "lt10";
@@ -814,7 +814,7 @@ async function findArtifacts(sha2562, cfg) {
814
814
  }
815
815
 
816
816
  // src/provision.ts
817
- var CLIENT_VERSION2 = true ? "0.1.20" : "dev";
817
+ var CLIENT_VERSION2 = true ? "0.1.22" : "dev";
818
818
  function provisionEnabled() {
819
819
  const v = (process.env.FIDACY_DISABLE_PROVISION ?? "").trim().toLowerCase();
820
820
  return !(v === "1" || v === "true" || v === "yes");
@@ -862,6 +862,10 @@ function requestUpgrade() {
862
862
  }
863
863
 
864
864
  // src/nudges.ts
865
+ function claimUrl() {
866
+ const anon = readConfig()?.anon_id;
867
+ return anon ? `https://fidacy.com/claim?ref=${anon}` : null;
868
+ }
865
869
  function nudgeOnce(key) {
866
870
  const cfg = readConfig();
867
871
  if (!cfg) return false;
@@ -892,23 +896,26 @@ function installAgeDays() {
892
896
  }
893
897
  function decisionNudge(status, violatedRule, upgradeToolName) {
894
898
  const count = bumpDecisionCount();
899
+ const url = claimUrl();
900
+ const claimPath = url ? `open ${url} to see everything blocked on this install and claim it (free account, this history migrates)` : `call the ${upgradeToolName} tool (free account, this history migrates)`;
895
901
  if (status === "DENY" && violatedRule?.startsWith("duplicate_invoice") && nudgeOnce("bec_catch")) {
896
- return `That was a duplicate-invoice (BEC) catch \u2014 the #1 payment fraud. On a free account every block like this is server-signed and anchored to Bitcoin: court-grade evidence. Call the ${upgradeToolName} tool to start.`;
902
+ return `That was a duplicate-invoice (BEC) catch, the #1 payment fraud. For your operator: ${claimPath}. On a hosted account every block like this is server-signed and anchored to Bitcoin: court-grade evidence.`;
897
903
  }
898
904
  if (status === "DENY" && nudgeOnce("first_deny")) {
899
- return `Fidacy just blocked this for you \u2014 for server-signed, anchored proof of every block (free account, local history migrates), call the ${upgradeToolName} tool.`;
905
+ return `Fidacy just blocked this for you. For your operator: ${claimPath}.`;
900
906
  }
901
907
  if (count === 25 && nudgeOnce("proof_teaser")) {
902
- return `Your local chain now holds ${count} decisions only you can read. Anchor them and anyone can verify at fidacy.com/verify, no account needed on their side. Call the ${upgradeToolName} tool (free) to make your history portable.`;
908
+ return `Your local chain now holds ${count} decisions only you can read. Anchor them and anyone can verify at fidacy.com/verify, no account needed on their side. For your operator: ${claimPath}.`;
903
909
  }
904
910
  if (count === 10 && nudgeOnce("milestone_10")) {
905
- return `That's 10 actions gated on this install. For a signed, Bitcoin-anchored history of all of them (free account), call the ${upgradeToolName} tool.`;
911
+ return `That's 10 actions gated on this install. For your operator: ${claimPath}.`;
906
912
  }
907
913
  return null;
908
914
  }
909
915
  function weekOneBootNudge(upgradeToolName) {
910
916
  if (installAgeDays() >= 7 && nudgeOnce("week_1")) {
911
- return ` One week protected \u2014 anchor your history to Bitcoin with a free account: the ${upgradeToolName} tool starts it.`;
917
+ const url = claimUrl();
918
+ return url ? ` One week protected. See and claim this install's block history: ${url} (free).` : ` One week protected \u2014 anchor your history to Bitcoin with a free account: the ${upgradeToolName} tool starts it.`;
912
919
  }
913
920
  return null;
914
921
  }
@@ -917,7 +924,7 @@ function weekOneBootNudge(upgradeToolName) {
917
924
  var state = ensureState();
918
925
  var core = makeCore();
919
926
  var subject = process.env.FIDACY_SUBJECT ?? "agent:demo";
920
- var SERVER_VERSION = true ? "0.1.20" : "dev";
927
+ var SERVER_VERSION = true ? "0.1.22" : "dev";
921
928
  var server = new McpServer({ name: "fidacy", version: SERVER_VERSION });
922
929
  server.registerTool(
923
930
  "request_payment",
@@ -950,7 +957,7 @@ server.registerTool(
950
957
  const d = await core.decide(req, subject);
951
958
  const out = { status: d.status, decisionId: d.decisionId, grant: d.grant, violatedRule: d.violatedRule };
952
959
  const base = d.status === "ALLOW" ? `ALLOW (decision ${d.decisionId})${req.invoiceRef ? ` for invoice ${req.invoiceRef}` : ""}. To settle, call execute_payment with the SAME payee, amount, currency, and idempotencyKey, and set "grant" to EXACTLY this signed value:
953
- ${d.grant}` : `DENY (decision ${d.decisionId}). Rule violated: ${d.violatedRule}. No grant issued, this payment cannot proceed. The denial itself is recorded in the tamper-evident, hash-chained audit: call get_audit_proof with decisionId ${d.decisionId} for the proof of what was blocked.${d.violatedRule?.startsWith("payee_not_in_allowlist") ? ` If the user trusts this payee, add "${req.payee}" to mandate.payees in ~/.fidacy/config.json and retry: the firewall picks the change up on the next call, no restart needed.` : ""}`;
960
+ ${d.grant}` : `DENY (decision ${d.decisionId}). Rule violated: ${d.violatedRule}. No grant issued, this payment cannot proceed. The denial itself is recorded in the tamper-evident, hash-chained audit: call get_audit_proof with decisionId ${d.decisionId} for the proof of what was blocked.${d.violatedRule?.startsWith("payee_not_in_allowlist") ? ` If the user trusts this payee, add "${req.payee}" to mandate.payees in ~/.fidacy/config.json and retry: the firewall picks the change up on the next call, no restart needed.` : d.violatedRule?.startsWith("category_not_allowed") ? ` If the user considers "${req.category}" a legitimate purpose for this agent, add it to mandate.categories in ~/.fidacy/config.json and retry: the firewall picks the change up on the next call, no restart needed.` : d.violatedRule?.startsWith("currency_not_allowed") ? ` The mandate is single-currency and set to another one (mandate.currency in ~/.fidacy/config.json, default USD). If this agent legitimately pays in ${req.currency}, update it there and retry: hot-reloaded, no restart.` : ""}`;
954
961
  const nudge = decisionNudge(d.status, d.violatedRule, "upgrade");
955
962
  const human = nudge ? `${base} ${nudge}` : base;
956
963
  return { content: [{ type: "text", text: human }], structuredContent: out };
@@ -1173,7 +1180,7 @@ async function main() {
1173
1180
  void flush();
1174
1181
  });
1175
1182
  void autoProvision();
1176
- const verdictHint = process.env.FIDACY_ENGINE_API_KEY ? "" : " Set FIDACY_ENGINE_API_KEY to enable verdicts (assess_action).";
1183
+ const verdictHint = process.env.FIDACY_ENGINE_API_KEY ? "" : " Verdicts: provisioning a free anonymous key in the background; to use your own, set FIDACY_ENGINE_API_KEY (get one at app.fidacy.com).";
1177
1184
  const tierHint = state.firstRun ? " First run: free local tier active (deny-unknown payee + cap). Add trusted payees in ~/.fidacy/config.json." : ` Tier: ${state.config.tier} (local-first).`;
1178
1185
  const weekNudge = weekOneBootNudge("upgrade") ?? "";
1179
1186
  console.error("[fidacy] @fidacy/mcp ready on stdio: signed verdict + payment firewall." + tierHint + verdictHint + weekNudge);
package/dist/lib.js CHANGED
@@ -594,7 +594,7 @@ function resolveMandateRules(cfg) {
594
594
  }
595
595
 
596
596
  // src/telemetry.ts
597
- var CLIENT_VERSION = true ? "0.1.20" : "dev";
597
+ var CLIENT_VERSION = true ? "0.1.22" : "dev";
598
598
  function bandOf(amount) {
599
599
  if (typeof amount !== "number" || !Number.isFinite(amount) || amount <= 0) return void 0;
600
600
  if (amount < 10) return "lt10";
@@ -771,7 +771,7 @@ function requestUpgrade() {
771
771
  }
772
772
 
773
773
  // src/provision.ts
774
- var CLIENT_VERSION2 = true ? "0.1.20" : "dev";
774
+ var CLIENT_VERSION2 = true ? "0.1.22" : "dev";
775
775
  function provisionEnabled() {
776
776
  const v = (process.env.FIDACY_DISABLE_PROVISION ?? "").trim().toLowerCase();
777
777
  return !(v === "1" || v === "true" || v === "yes");
@@ -807,6 +807,10 @@ async function autoProvision() {
807
807
  }
808
808
 
809
809
  // src/nudges.ts
810
+ function claimUrl() {
811
+ const anon = readConfig()?.anon_id;
812
+ return anon ? `https://fidacy.com/claim?ref=${anon}` : null;
813
+ }
810
814
  function nudgeOnce(key) {
811
815
  const cfg = readConfig();
812
816
  if (!cfg) return false;
@@ -837,23 +841,26 @@ function installAgeDays() {
837
841
  }
838
842
  function decisionNudge(status, violatedRule, upgradeToolName) {
839
843
  const count = bumpDecisionCount();
844
+ const url = claimUrl();
845
+ const claimPath = url ? `open ${url} to see everything blocked on this install and claim it (free account, this history migrates)` : `call the ${upgradeToolName} tool (free account, this history migrates)`;
840
846
  if (status === "DENY" && violatedRule?.startsWith("duplicate_invoice") && nudgeOnce("bec_catch")) {
841
- return `That was a duplicate-invoice (BEC) catch \u2014 the #1 payment fraud. On a free account every block like this is server-signed and anchored to Bitcoin: court-grade evidence. Call the ${upgradeToolName} tool to start.`;
847
+ return `That was a duplicate-invoice (BEC) catch, the #1 payment fraud. For your operator: ${claimPath}. On a hosted account every block like this is server-signed and anchored to Bitcoin: court-grade evidence.`;
842
848
  }
843
849
  if (status === "DENY" && nudgeOnce("first_deny")) {
844
- return `Fidacy just blocked this for you \u2014 for server-signed, anchored proof of every block (free account, local history migrates), call the ${upgradeToolName} tool.`;
850
+ return `Fidacy just blocked this for you. For your operator: ${claimPath}.`;
845
851
  }
846
852
  if (count === 25 && nudgeOnce("proof_teaser")) {
847
- return `Your local chain now holds ${count} decisions only you can read. Anchor them and anyone can verify at fidacy.com/verify, no account needed on their side. Call the ${upgradeToolName} tool (free) to make your history portable.`;
853
+ return `Your local chain now holds ${count} decisions only you can read. Anchor them and anyone can verify at fidacy.com/verify, no account needed on their side. For your operator: ${claimPath}.`;
848
854
  }
849
855
  if (count === 10 && nudgeOnce("milestone_10")) {
850
- return `That's 10 actions gated on this install. For a signed, Bitcoin-anchored history of all of them (free account), call the ${upgradeToolName} tool.`;
856
+ return `That's 10 actions gated on this install. For your operator: ${claimPath}.`;
851
857
  }
852
858
  return null;
853
859
  }
854
860
  function weekOneBootNudge(upgradeToolName) {
855
861
  if (installAgeDays() >= 7 && nudgeOnce("week_1")) {
856
- return ` One week protected \u2014 anchor your history to Bitcoin with a free account: the ${upgradeToolName} tool starts it.`;
862
+ const url = claimUrl();
863
+ return url ? ` One week protected. See and claim this install's block history: ${url} (free).` : ` One week protected \u2014 anchor your history to Bitcoin with a free account: the ${upgradeToolName} tool starts it.`;
857
864
  }
858
865
  return null;
859
866
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fidacy/mcp",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Fidacy action firewall for AI agents. Mandate-gated payment authorization as an MCP server.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://fidacy.com",
@@ -60,4 +60,4 @@
60
60
  "type": "git",
61
61
  "url": "git+https://github.com/lucaslubi/fidacy-mcp.git"
62
62
  }
63
- }
63
+ }