@fidacy/openclaw-plugin 0.3.0 → 0.4.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.js CHANGED
@@ -4685,7 +4685,9 @@ function readConfig() {
4685
4685
  created_at: typeof raw.created_at === "string" ? raw.created_at : void 0,
4686
4686
  nudges: raw.nudges && typeof raw.nudges === "object" ? raw.nudges : void 0,
4687
4687
  decisions_count: typeof raw.decisions_count === "number" ? raw.decisions_count : void 0,
4688
- hosted_lapsed_at: typeof raw.hosted_lapsed_at === "string" ? raw.hosted_lapsed_at : void 0
4688
+ hosted_lapsed_at: typeof raw.hosted_lapsed_at === "string" ? raw.hosted_lapsed_at : void 0,
4689
+ operator_email: typeof raw.operator_email === "string" ? raw.operator_email : void 0,
4690
+ registered_email: typeof raw.registered_email === "string" ? raw.registered_email : void 0
4689
4691
  };
4690
4692
  } catch {
4691
4693
  return null;
@@ -4737,7 +4739,7 @@ function resolveMandateRules(cfg) {
4737
4739
  }
4738
4740
 
4739
4741
  // ../mcp/src/telemetry.ts
4740
- var CLIENT_VERSION = true ? "0.3.0" : "dev";
4742
+ var CLIENT_VERSION = true ? "0.4.0" : "dev";
4741
4743
  function bandOf(amount) {
4742
4744
  if (typeof amount !== "number" || !Number.isFinite(amount) || amount <= 0) return void 0;
4743
4745
  if (amount < 10) return "lt10";
@@ -4925,7 +4927,7 @@ function requestUpgrade() {
4925
4927
  }
4926
4928
 
4927
4929
  // ../mcp/src/provision.ts
4928
- var CLIENT_VERSION2 = true ? "0.3.0" : "dev";
4930
+ var CLIENT_VERSION2 = true ? "0.4.0" : "dev";
4929
4931
  function provisionEnabled() {
4930
4932
  const v = (process.env.FIDACY_DISABLE_PROVISION ?? "").trim().toLowerCase();
4931
4933
  return !(v === "1" || v === "true" || v === "yes");
@@ -5066,6 +5068,37 @@ function trialCountdownLine(keyOverride) {
5066
5068
  return ` [fidacy] ${left} free anonymous decision${left === 1 ? "" : "s"} left on this install before the firewall requires activation. For your operator: free API key at ${url} (history migrates), then set FIDACY_ENGINE_API_KEY.`;
5067
5069
  }
5068
5070
 
5071
+ // ../mcp/src/register.ts
5072
+ var CLIENT_VERSION3 = true ? "0.4.0" : "dev";
5073
+ function endpoint3() {
5074
+ const base = (process.env.FIDACY_ENGINE_URL ?? "https://api.fidacy.com").replace(/\/$/, "");
5075
+ return `${base}/v1/register`;
5076
+ }
5077
+ function looksLikeEmail(s) {
5078
+ return /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(s);
5079
+ }
5080
+ async function registerEmail(email, shell = "mcp") {
5081
+ const cfg = readConfig();
5082
+ if (!cfg) return "skipped";
5083
+ const clean = email.trim();
5084
+ if (!looksLikeEmail(clean)) return "skipped";
5085
+ if (cfg.registered_email && cfg.registered_email.toLowerCase() === clean.toLowerCase()) return "skipped";
5086
+ try {
5087
+ const res = await fetch(endpoint3(), {
5088
+ method: "POST",
5089
+ headers: { "content-type": "application/json" },
5090
+ body: JSON.stringify({ anon_id: cfg.anon_id, email: clean, client_version: CLIENT_VERSION3, shell })
5091
+ });
5092
+ if (res.status === 429) return "rate_limited";
5093
+ if (!res.ok) return "failed";
5094
+ const fresh = readConfig() ?? cfg;
5095
+ writeConfig({ ...fresh, operator_email: clean, registered_email: clean });
5096
+ return "registered";
5097
+ } catch {
5098
+ return "failed";
5099
+ }
5100
+ }
5101
+
5069
5102
  // ../mcp/src/protection.ts
5070
5103
  var BRAND = "Fidacy AI Agent Firewall";
5071
5104
  var FREE_MONTHLY_VERDICTS = 300;
@@ -5524,6 +5557,11 @@ function boot() {
5524
5557
  function subjectOf(config) {
5525
5558
  return config.subject ?? process.env.FIDACY_SUBJECT ?? "agent:demo";
5526
5559
  }
5560
+ function maybeRegisterOperator(config) {
5561
+ const email = (config.operatorEmail ?? process.env.FIDACY_OPERATOR_EMAIL ?? "").trim();
5562
+ if (email) void registerEmail(email, "openclaw-plugin").catch(() => {
5563
+ });
5564
+ }
5527
5565
  var ASSESS_KINDS = ["ap2_payment", "message_send", "voice_call", "custom", "claim_document"];
5528
5566
  var index_default = defineToolPlugin({
5529
5567
  id: "fidacy",
@@ -5531,6 +5569,17 @@ var index_default = defineToolPlugin({
5531
5569
  description: "A signed, independently-verifiable verdict on every money-moving agent action. Blocks wrong/lookalike payee, over-cap, and duplicate-invoice fraud before money moves. Non-custodial, local-first, deny-by-default.",
5532
5570
  configSchema: typebox_exports.Object(
5533
5571
  {
5572
+ // FIRST field on purpose: this is the install-time ask. OpenClaw renders
5573
+ // configSchema when the operator sets the plugin up, so the email is
5574
+ // collected at the one moment a HUMAN is present and paying attention —
5575
+ // no prompt is possible later (the plugin runs headless inside the agent).
5576
+ // Optional by design: a blank field must never block the install, and the
5577
+ // firewall protects with or without it.
5578
+ operatorEmail: typebox_exports.Optional(
5579
+ typebox_exports.String({
5580
+ description: "Your email (optional). Ties this agent's protection history to you so it can move into a free account, and lets Fidacy reach you about this install. Never shared; remove any time."
5581
+ })
5582
+ ),
5534
5583
  engineApiKey: typebox_exports.Optional(
5535
5584
  typebox_exports.String({
5536
5585
  description: "Fidacy engine API key (fky_live_/fky_test_) enabling signed verdicts via assess_action. Falls back to FIDACY_ENGINE_API_KEY."
@@ -5573,6 +5622,7 @@ var index_default = defineToolPlugin({
5573
5622
  )
5574
5623
  }),
5575
5624
  async execute(params, config) {
5625
+ maybeRegisterOperator(config);
5576
5626
  const gate = activationGate(config.engineApiKey);
5577
5627
  if (gate) {
5578
5628
  const halted = protectionWarning(decisionsUsed(), config.engineApiKey) ?? gate.message;
@@ -3,7 +3,7 @@
3
3
  "name": "Fidacy AI Agent Firewall",
4
4
  "description": "A signed, independently-verifiable verdict on every money-moving agent action. Blocks wrong/lookalike payee, over-cap, and duplicate-invoice fraud before money moves. Non-custodial, local-first, deny-by-default.",
5
5
  "icon": "https://fidacy.com/logo.png",
6
- "version": "0.3.0",
6
+ "version": "0.4.0",
7
7
  "contracts": {
8
8
  "tools": [
9
9
  "request_payment",
@@ -23,6 +23,10 @@
23
23
  "type": "object",
24
24
  "additionalProperties": false,
25
25
  "properties": {
26
+ "operatorEmail": {
27
+ "type": "string",
28
+ "description": "Your email (optional). Ties this agent's protection history to you so it can move into a free account, and lets Fidacy reach you about this install. Never shared; remove any time."
29
+ },
26
30
  "engineApiKey": {
27
31
  "type": "string",
28
32
  "description": "Fidacy engine API key (fky_live_/fky_test_) enabling signed verdicts via assess_action. Falls back to FIDACY_ENGINE_API_KEY."
@@ -38,6 +42,11 @@
38
42
  }
39
43
  },
40
44
  "uiHints": {
45
+ "operatorEmail": {
46
+ "label": "Your email (optional)",
47
+ "placeholder": "you@company.com",
48
+ "help": "Ties this agent's protection history to you so it can move into a free account, and lets Fidacy reach you about this install. Optional — the firewall works without it."
49
+ },
41
50
  "engineApiKey": {
42
51
  "label": "Engine API key",
43
52
  "placeholder": "fky_live_...",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fidacy/openclaw-plugin",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Fidacy payment firewall as a native OpenClaw plugin: signed, verifiable verdicts on every money-moving agent action, in-process (no MCP subprocess).",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Fidacy (ZeepCode Group Technology LLC) <hello@fidacy.com> (https://fidacy.com)",
@@ -57,7 +57,7 @@
57
57
  "typebox": "1.1.39",
58
58
  "typescript": "^5.6.3",
59
59
  "@fidacy/firewall": "0.1.1",
60
- "@fidacy/mcp": "0.4.2"
60
+ "@fidacy/mcp": "0.5.1"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "node scripts/bundle.mjs",