@fidacy/mcp 0.1.21 → 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 +6 -0
- package/dist/core.js +1 -1
- package/dist/index.js +16 -9
- package/dist/lib.js +14 -7
- package/package.json +1 -1
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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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
|
-
|
|
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.
|
|
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 };
|
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.
|
|
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.
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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
|
-
|
|
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