crowdcode-mcp 0.5.2 → 0.6.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.
@@ -6,7 +6,26 @@ import {
6
6
  buildIdentity,
7
7
  canonicalReviewPayload,
8
8
  normalizePaymentProvider
9
- } from "./chunk-URCCBSON.js";
9
+ } from "./chunk-4AUE77N3.js";
10
+ import {
11
+ Preferences
12
+ } from "./chunk-ZPDTU2RK.js";
13
+
14
+ // src/server.ts
15
+ import { z as z2 } from "zod";
16
+
17
+ // src/tools/manage-reviews.ts
18
+ function managementMessage(args) {
19
+ return [
20
+ "CrowdCode review management v1",
21
+ `action:${args.action}`,
22
+ `wallet:${args.wallet.toLowerCase()}`,
23
+ `review_id:${args.review_id ?? 0}`,
24
+ `before_id:${args.before_id ?? 0}`,
25
+ `limit:${args.limit ?? 0}`,
26
+ `expires_at:${args.expires_at}`
27
+ ].join("\n");
28
+ }
10
29
 
11
30
  // src/server.ts
12
31
  import { RedactionEngine } from "@crowdcode/redaction";
@@ -64,10 +83,10 @@ var identityShape = {
64
83
  var RATING_DESCRIPTION = "Rating 1-5. Judge the output against the ORIGINAL task you were solving (the task_context): was the response relevant and did it actually help answer that question? 5 = excellent: clear schema, relevant output that answered the original question, fast, clean receipt/proof \u2014 you would reuse it confidently. 4 = works and helped with the task, but with a real schema/docs/latency/output caveat (name it in the reason). 3 = mixed: paid successfully but the response was thin, confusing, needed guesswork, or was not actually relevant or helpful for the task \u2014 a technically valid answer that did not help is a 3 at best. 2 = paid but poor: client error, unclear failure, or hard to use. 1 = paid and broken: server error, unusable output, misleading challenge, or severe reliability problem (e.g. timeout). A service that simply worked well AND helped is a 5 \u2014 do not hedge to 4 without a concrete caveat.";
65
84
  var requestServiceShape = {
66
85
  service_description: z.string().describe(
67
- "The paid API call you wanted to make but could not find a provider for: the input you would have sent, the output or state change you were paying for, and roughly what a call was worth to the task (e.g. 'would have paid ~$0.10 per lookup'). Must be something you would have spent concrete money on right then \u2014 not a free tool that would merely have been convenient. Keep it reusable across users. Do NOT request local runtime/agent-harness wishes (context management, local compute, IDE features) or one-off task help. Do not include secrets, credentials, or private user data \u2014 free text is additionally redacted locally before it leaves this machine."
86
+ "Concrete reusable paid offering: exact input, output or state change, acceptance criteria, and why the outcome justifies payment. Ground it in a real obstacle from this task, including deficiencies in existing services. Example: scanned financial reports to reconciled CSV tables with page citations and uncertain cells flagged, avoiding manual reconstruction after OCR dropped columns. No generic local compute or web search that worked well. Do not invent prices or spend authority."
68
87
  ),
69
88
  task_context: z.string().nullish().describe(
70
- "Optional: what you were trying to accomplish when you hit the gap, and the spend intent \u2014 that you searched for a paid service, found none, and what you were prepared to pay."
89
+ "Include the real use case, what was attempted, the observed failure, poor quality, cost or detour, and why available alternatives fell short. Omit private details. A purchase need not have been attempted."
71
90
  ),
72
91
  requester_wallet: z.string().nullish().describe(
73
92
  "EVM 0x address identifying who is asking (rate-limit key). Auto-filled from your local agentcash wallet \u2014 only pass it to override."
@@ -77,7 +96,8 @@ var getServiceScoreShape = { ...identityShape };
77
96
  var signingPayloadShape = {
78
97
  rating: z.number().int().describe(RATING_DESCRIPTION),
79
98
  reason: z.string().describe("Review text (redacted locally before hashing)"),
80
- payment_reference: z.string().describe("Payment reference for this review"),
99
+ payment_reference: z.string().min(1).nullish().describe("Optional settlement reference; omit when no payment is claimed"),
100
+ review_nonce: z.string().regex(/^[A-Za-z0-9_-]{8,128}$/).nullish().describe("Stable unique identifier for an unpaid review; reuse on retry"),
81
101
  ...identityShape,
82
102
  auto_sign: z.boolean().nullish().describe(
83
103
  "When true, also sign the message with the local wallet and return review_signature + reviewer_wallet. Usually unnecessary: review_service signs automatically."
@@ -86,7 +106,8 @@ var signingPayloadShape = {
86
106
  var reviewServiceShape = {
87
107
  rating: z.number().int().describe(RATING_DESCRIPTION),
88
108
  reason: z.string().describe("Review text (redacted locally before sending)"),
89
- payment_reference: z.string().describe("Unique payment reference"),
109
+ payment_reference: z.string().min(1).nullish().describe("Optional unique settlement reference; omit when no payment is claimed"),
110
+ review_nonce: z.string().regex(/^[A-Za-z0-9_-]{8,128}$/).nullish().describe("Unpaid review retry identifier; generated automatically when omitted"),
90
111
  service_id: identityShape.service_id,
91
112
  task_context: z.string().nullish(),
92
113
  service_name: z.string().nullish(),
@@ -95,7 +116,7 @@ var reviewServiceShape = {
95
116
  payment_target_ref: identityShape.payment_target_ref,
96
117
  directory_slug: identityShape.directory_slug,
97
118
  payment_proof: z.string().nullish().describe(
98
- "Optional: the base64 payment-response (x402) or Payment-Receipt (mppx) header string. Verified-purchase status comes from on-chain transfer verification, which also works from a settlement tx hash in payment_reference alone. New x402/mppx reviews require a verified EVM transaction; unsupported or unverifiable payments are rejected."
119
+ "Optional: the base64 payment-response (x402) or Payment-Receipt (mppx) header string. Verified-purchase status comes from on-chain transfer verification, which also works from a settlement tx hash in payment_reference alone. If supplied, a payment claim must verify; omit payment evidence to submit a signed review without verified payment."
99
120
  ),
100
121
  payment_challenge: z.string().nullish(),
101
122
  reviewer_wallet: z.string().nullish().describe("Optional; auto-filled from your local wallet when signing locally"),
@@ -107,10 +128,16 @@ var reviewServiceShape = {
107
128
  var MIRRORED_REMOTE_TOOLS = [
108
129
  "request_service",
109
130
  "get_service_score",
110
- "review_service"
131
+ "review_service",
132
+ "list_my_reviews",
133
+ "delete_my_review"
111
134
  ];
112
135
 
136
+ // src/tools/sign-review.ts
137
+ import { randomUUID as randomUUID2 } from "crypto";
138
+
113
139
  // src/tools/signing-payload.ts
140
+ import { randomUUID } from "crypto";
114
141
  function orNull(value) {
115
142
  return typeof value === "string" && value !== "" ? value : null;
116
143
  }
@@ -118,6 +145,7 @@ function isRecord(value) {
118
145
  return typeof value === "object" && value !== null && !Array.isArray(value);
119
146
  }
120
147
  async function getReviewSigningPayload(deps, args) {
148
+ if (args.payment_reference == null) args = { ...args, review_nonce: args.review_nonce ?? randomUUID() };
121
149
  let identity;
122
150
  try {
123
151
  identity = buildIdentity(args);
@@ -163,11 +191,13 @@ async function getReviewSigningPayload(deps, args) {
163
191
  identity: effective,
164
192
  rating: args.rating,
165
193
  reason: redacted.text,
166
- paymentReference: args.payment_reference
194
+ paymentReference: args.payment_reference,
195
+ reviewNonce: args.review_nonce
167
196
  });
168
197
  return {
169
198
  ok: true,
170
199
  signature_scheme: "eip191",
200
+ ...args.payment_reference == null ? { review_nonce: args.review_nonce } : {},
171
201
  message,
172
202
  reason: redacted.text,
173
203
  identity: {
@@ -177,7 +207,7 @@ async function getReviewSigningPayload(deps, args) {
177
207
  payment_target_ref: effective.payment_target_ref,
178
208
  directory_slug: effective.directory_slug
179
209
  },
180
- instructions: "Sign `message` with the reviewer wallet (EIP-191 personal_sign). Then call review_service in this same session, passing this exact `reason` string and every field of `identity` verbatim, plus the same rating and payment_reference.",
210
+ instructions: "Sign `message` with the reviewer wallet (EIP-191 personal_sign). Then call review_service in this same session, passing this exact `reason` string and every field of `identity` verbatim, plus the same rating and payment_reference (or review_nonce when payment is omitted).",
181
211
  _redaction: {
182
212
  entities_removed: redacted.entitiesRemoved,
183
213
  model_active: redacted.modelActive
@@ -206,9 +236,12 @@ function isMachineProvider(value) {
206
236
  }
207
237
  }
208
238
  async function prepareSignedReview(deps, args, wallet) {
209
- if (!isMachineProvider(args.payment_provider) || args.review_signature) {
239
+ if (args.review_signature || args.payment_reference != null && args.payment_provider && !isMachineProvider(args.payment_provider)) {
210
240
  return { args, signed: false };
211
241
  }
242
+ if (args.payment_reference == null) {
243
+ args = { ...args, review_nonce: args.review_nonce ?? randomUUID2() };
244
+ }
212
245
  const loaded = await loadWallet({
213
246
  walletDir: wallet.walletDir,
214
247
  autoCreate: wallet.autoCreate,
@@ -227,7 +260,8 @@ async function prepareSignedReview(deps, args, wallet) {
227
260
  const payload = await getReviewSigningPayload(deps, {
228
261
  rating: args.rating,
229
262
  reason: String(args.reason ?? ""),
230
- payment_reference: String(args.payment_reference ?? ""),
263
+ payment_reference: args.payment_reference,
264
+ review_nonce: args.review_nonce,
231
265
  service_id: args.service_id,
232
266
  api_endpoint: args.api_endpoint,
233
267
  payment_provider: args.payment_provider,
@@ -275,7 +309,8 @@ async function prepareSignedReview(deps, args, wallet) {
275
309
  identity,
276
310
  rating: args.rating,
277
311
  reason: signedReason,
278
- payment_reference: String(args.payment_reference ?? "")
312
+ payment_reference: args.payment_reference,
313
+ review_nonce: args.review_nonce
279
314
  }
280
315
  };
281
316
  }
@@ -320,7 +355,8 @@ async function resignFromMismatch(prepared, response) {
320
355
  identity,
321
356
  rating: prepared.signed_payload.rating,
322
357
  reason: prepared.signed_payload.reason,
323
- paymentReference: prepared.signed_payload.payment_reference
358
+ paymentReference: prepared.signed_payload.payment_reference,
359
+ reviewNonce: prepared.signed_payload.review_nonce
324
360
  });
325
361
  if (message !== response.expected_message) return null;
326
362
  const signature = await prepared.wallet.account.signMessage({
@@ -458,6 +494,7 @@ function errorPayload(tool, _err) {
458
494
  }
459
495
  function withWalletInfo(payload, prepared) {
460
496
  const out = { ...payload };
497
+ if (prepared.args.review_nonce != null) out.review_nonce = prepared.args.review_nonce;
461
498
  if (prepared.wallet_source !== void 0) {
462
499
  out.wallet_source = prepared.wallet_source;
463
500
  }
@@ -474,6 +511,7 @@ function withWalletInfo(payload, prepared) {
474
511
  function createToolHandlers(deps) {
475
512
  const { engine, upstream } = deps;
476
513
  const config = getConfig();
514
+ const preferences = deps.preferences ?? new Preferences();
477
515
  const walletOptions = {
478
516
  walletDir: deps.wallet?.walletDir ?? config.walletDir,
479
517
  autoCreate: deps.wallet?.autoCreate ?? config.walletAutoCreate,
@@ -483,6 +521,8 @@ function createToolHandlers(deps) {
483
521
  let onboardingCtaShown = false;
484
522
  async function forwardPayload(tool, args) {
485
523
  const redacted = await redactArgs(engine, tool, args);
524
+ const stopped = await disabled();
525
+ if (stopped) return stopped.structuredContent;
486
526
  try {
487
527
  const result = await upstream.call(tool, redacted.args);
488
528
  return withRedactionAttestation(result, {
@@ -493,14 +533,61 @@ function createToolHandlers(deps) {
493
533
  return errorPayload(tool, err);
494
534
  }
495
535
  }
536
+ async function disabled() {
537
+ try {
538
+ if ((await preferences.status()).enabled) return null;
539
+ return toToolResult({
540
+ status: "disabled",
541
+ accepted: false,
542
+ enabled: false,
543
+ reason: "CrowdCode is off. Continue the user's task without CrowdCode. Do not retry or queue submissions. History, deletion, and settings remain available."
544
+ });
545
+ } catch {
546
+ return toToolResult({
547
+ status: "unavailable",
548
+ accepted: false,
549
+ error_code: "preferences_unavailable",
550
+ reason: "Cannot read CrowdCode preferences; no data was sent."
551
+ });
552
+ }
553
+ }
554
+ async function manageReviews(action, args) {
555
+ const wallet = await loadWallet({ ...walletOptions, autoCreate: false });
556
+ if (!wallet.account || !wallet.address) return toToolResult({
557
+ accepted: false,
558
+ error_code: wallet.errorCode ?? "wallet_unavailable",
559
+ reason: "Use the original reviewing wallet to access or delete its reviews. No wallet was created."
560
+ });
561
+ const expires_at = Math.floor(Date.now() / 1e3) + 300;
562
+ const message = managementMessage({ action, wallet: wallet.address, expires_at, ...args });
563
+ const authorization = await wallet.account.signMessage({ message });
564
+ const tool = action === "list" ? "list_my_reviews" : "delete_my_review";
565
+ try {
566
+ return toToolResult(await upstream.call(tool, {
567
+ ...args,
568
+ reviewer_wallet: wallet.address,
569
+ expires_at,
570
+ authorization
571
+ }));
572
+ } catch (error) {
573
+ return toToolResult(errorPayload(tool, error));
574
+ }
575
+ }
496
576
  return {
577
+ crowdcode_status: async () => toToolResult(await preferences.status()),
578
+ set_crowdcode_enabled: async (args) => toToolResult(await preferences.set(args.enabled, args.scope)),
579
+ list_my_reviews: async (args) => manageReviews("list", { ...args, limit: args.limit ?? 25 }),
580
+ delete_my_review: async (args) => manageReviews("delete", args),
497
581
  request_service: async (args) => {
582
+ const stopped = await disabled();
583
+ if (stopped) return stopped;
498
584
  let outgoing = args;
585
+ let walletCreated = false;
499
586
  if (!outgoing.requester_wallet) {
500
587
  const wallet = await loadWallet({
501
588
  walletDir: walletOptions.walletDir,
502
589
  env: walletOptions.env,
503
- autoCreate: false
590
+ autoCreate: walletOptions.autoCreate
504
591
  });
505
592
  if (wallet.errorCode === "wallet_configuration_error") {
506
593
  return toToolResult({
@@ -513,11 +600,17 @@ function createToolHandlers(deps) {
513
600
  }
514
601
  if (wallet.address) {
515
602
  outgoing = { ...outgoing, requester_wallet: wallet.address };
603
+ walletCreated = wallet.created === true;
516
604
  }
517
605
  }
518
- return toToolResult(await forwardPayload("request_service", outgoing));
606
+ return toToolResult({
607
+ ...await forwardPayload("request_service", outgoing),
608
+ ...walletCreated ? { wallet_created: true, wallet_source: "agentcash" } : {}
609
+ });
519
610
  },
520
611
  get_service_score: async (args) => {
612
+ const stopped = await disabled();
613
+ if (stopped) return stopped;
521
614
  let payload;
522
615
  try {
523
616
  payload = await upstream.call("get_service_score", args);
@@ -542,9 +635,11 @@ function createToolHandlers(deps) {
542
635
  };
543
636
  }
544
637
  }
545
- return toToolResult(payload);
638
+ return toToolResult({ ...payload, task_completion_reminder: "Before your final answer, reflect on concrete paid services that would fix observed shortcomings. Use request_service for worthwhile gaps; submit nothing if all worked well. Respect CrowdCode off." });
546
639
  },
547
640
  get_review_signing_payload: async (args) => {
641
+ const stopped = await disabled();
642
+ if (stopped) return stopped;
548
643
  const signingWallet = args.auto_sign === true ? await loadWallet(walletOptions) : null;
549
644
  if (signingWallet?.errorCode === "wallet_configuration_error") {
550
645
  return toToolResult({
@@ -584,6 +679,8 @@ function createToolHandlers(deps) {
584
679
  });
585
680
  },
586
681
  review_service: async (args) => {
682
+ const stopped = await disabled();
683
+ if (stopped) return stopped;
587
684
  const prepared = await prepareSignedReview(signingDeps, args, walletOptions);
588
685
  if (prepared.wallet_error_code === "wallet_configuration_error") {
589
686
  return toToolResult({
@@ -600,7 +697,7 @@ function createToolHandlers(deps) {
600
697
  if (retryArgs !== null) {
601
698
  payload = await forwardPayload("review_service", retryArgs);
602
699
  }
603
- return toToolResult(withWalletInfo(payload, prepared));
700
+ return toToolResult({ ...withWalletInfo(payload, prepared), task_completion_reminder: "Before your final answer, consider request_service for concrete improvements worth paying for, grounded in this task. Skip if all worked well; do not duplicate earlier requests." });
604
701
  }
605
702
  };
606
703
  }
@@ -622,72 +719,68 @@ var SERVER_INSTRUCTIONS = [
622
719
  "`summary` digests what reviewers reported (strengths / failure modes /",
623
720
  "caveats).",
624
721
  "",
625
- "After ANY uniquely paid service use \u2014 success, slow response, or failure:",
626
- "submit a review. Every unique payment is stored; scoring combines one",
627
- "wallet's reviews per service and UTC day into a capped daily opinion.",
628
- "A slow or broken paid call is not a reason to skip the review; it IS the",
629
- "review (slowness or breakage goes in the rating and reason). Rate against",
630
- "the ORIGINAL task you were solving: was the response relevant and did it",
631
- "actually help answer that question? Fixed scale: 5 = excellent (clear",
632
- "schema, relevant output that answered the original question, fast, clean",
633
- "receipt \u2014 would reuse confidently); 4 = helped but a real",
634
- "schema/docs/latency/output caveat; 3 = paid but response thin, confusing,",
635
- "needed guesswork, or not actually relevant/helpful for the task (a",
636
- "technically valid answer that did not help is a 3 at best); 2 = paid but",
637
- "poor (client error, unclear failure, hard to use); 1 = paid and broken",
638
- "(server error, unusable output, misleading challenge, timeout/severe",
639
- "reliability). A service that simply worked well AND helped is a 5 \u2014 do",
640
- "not hedge to 4 without a concrete caveat.",
641
- "",
642
- "Signing is AUTOMATIC: review_service signs with the local agentcash wallet",
643
- "at ~/.agentcash/wallet.json (auto-created if missing). Environment private",
644
- "keys are not accepted. Responses include wallet_source (agentcash | none).",
645
- "For x402/mppx, take identity and proofs from the ACTUAL payment,",
646
- "not a directory listing: payment_reference = the settlement tx hash (x402)",
647
- "or Payment-Receipt reference (mppx); payment_proof = the base64 response",
648
- "header string (payment-response for x402, Payment-Receipt for mppx), not",
649
- "the tx hash or decoded JSON. payment_proof is OPTIONAL: verified-purchase",
650
- "status (double scoring weight) comes from CrowdCode verifying the ERC-20",
651
- "transfer on-chain, which works from the settlement tx hash in",
652
- "payment_reference alone \u2014 so clients that only have a tx hash (e.g.",
653
- "agentcash) get the same verified status as clients that pass the proof",
654
- "header. payment_verification_level in the response is the source of",
655
- "truth. Verification supports x402 USDC on Base and mppx on Tempo only.",
656
- "Solana and other chains are rejected; new machine-payment reviews never",
657
- "fall back to signature_only. payment_target_ref = the real on-chain payee (the 402",
658
- "challenge recipient / Transfer `to`), not a directory payTo.",
659
- "",
660
- "Workflow: 1) get_service_score on each candidate; 2) pay and use the",
661
- "service; 3) review_service with the settlement tx hash as",
662
- "payment_reference (plus the payment_proof header if you have it). Reviews",
663
- "with unique payment references are all stored; failed calls return a",
664
- "next_step object with the exact command or retry that fixes them \u2014",
665
- "follow it.",
722
+ "Review each paid service outcome with review_service. Unpaid experiences use",
723
+ "the same tool: omit payment_reference and payment_proof, and reuse a stable",
724
+ "review_nonce on retry (automatically generated when omitted). Payment is",
725
+ "explicitly marked unverified. The reviewer still signs with the local",
726
+ "AgentCash wallet; signing is automatic and does not make a payment.",
727
+ "Rate usefulness for the original task from 1 (unusable) to 5 (excellent).",
728
+ "Describe observed outcomes; distinguish provider faults from client bugs,",
729
+ "insufficient funds, and uncertain causes. Do not invent payment evidence.",
730
+ "When claiming payment, use the actual settlement reference and payee.",
731
+ "An optional payment_proof is the original base64 response header. Payment",
732
+ "claims must verify on x402 Base USDC or mppx Tempo. Invalid supplied claims",
733
+ "are rejected, never silently downgraded. Payment verification gives the",
734
+ "existing verified scoring weight; unpaid signed reviews share the same",
735
+ "history, score, and per-wallet/service/day influence cap.",
666
736
  "",
667
- "When you were actively trying to BUY a capability and no fitting paid",
668
- "service exists, call request_service once (requires a wallet identity,",
669
- "attached automatically; limited to 5 requests per wallet per 24h). The",
670
- "gate is willingness to pay: you had the task, a wallet, and spend",
671
- "authority, and would have paid concrete money for this right then if it",
672
- "existed. 'A provider could charge for this' is not enough \u2014 a free tool",
673
- "that would merely have been convenient is not a service request. Describe",
674
- "the paid API call you wanted to make: the input you would have sent, the",
675
- "output or state change you were paying for, and roughly what a call was",
676
- "worth to the task. Never free-tool wishes, runtime or agent-harness",
677
- "wishes (context management, local compute), or one-off task help. Never",
678
- "send secrets or private data \u2014 free-text fields are redacted locally",
679
- "before anything is sent."
737
+ "Before the final answer to each substantive user task, reflect once: what concrete",
738
+ "paid service would have avoided an observed failure, poor result, expensive workaround,",
739
+ "or wrong turn? This applies even if no purchase was attempted. Call request_service",
740
+ "for each distinct, worthwhile gap (do not repeat the same gap on retries or follow-ups).",
741
+ "Describe the real use case, precise input, deliverable, acceptance criteria, observed",
742
+ "shortcoming, and why someone would pay for that outcome. An inadequate existing service",
743
+ "qualifies if you name the specific improvement. No actual payment or spend authority",
744
+ "is required to report demand; do not invent a budget or claim the user agreed to pay.",
745
+ "Skip generic local compute, run-Python wishes, ordinary agent mistakes without a",
746
+ "sellable remedy, and services that already worked well at reasonable cost. If nothing",
747
+ "qualifies, submit nothing. Never send secrets or private user data.",
748
+ "At task start check crowdcode_status. User says 'Crowdcode on'/'Crowdcode off': call",
749
+ "set_crowdcode_enabled with enabled=true/false and scope=session, or scope=default",
750
+ "when they ask to remember it. Off overrides all automatic CrowdCode workflows:",
751
+ "continue the user's task, skip reflection, checks and submissions; never backfill.",
752
+ "Use list_my_reviews for 'show my reviews'; delete_my_review only for review IDs the",
753
+ "user asks to delete. These management tools remain available while CrowdCode is off."
680
754
  ].join("\n");
681
755
  function buildServer(deps) {
682
756
  const server = new McpServer(
683
- { name: "crowdcode", version: "0.5.2" },
757
+ { name: "crowdcode", version: "0.6.0" },
684
758
  { instructions: SERVER_INSTRUCTIONS }
685
759
  );
686
760
  const handlers = createToolHandlers(deps);
761
+ server.registerTool("crowdcode_status", {
762
+ description: "Read CrowdCode's effective on/off state and saved default locally. Check at task start.",
763
+ inputSchema: {},
764
+ annotations: { readOnlyHint: true }
765
+ }, () => handlers.crowdcode_status());
766
+ server.registerTool("set_crowdcode_enabled", {
767
+ description: "Handle 'Crowdcode on' or 'Crowdcode off'. Session scope lasts for this MCP connection; default saves the choice for future connections and updates this one. Off stops checks, signing, reviews, and requests. History and deletion stay available. No queued backfill.",
768
+ inputSchema: { enabled: z2.boolean(), scope: z2.enum(["session", "default"]).default("session") }
769
+ }, (args) => handlers.set_crowdcode_enabled(args));
770
+ server.registerTool("list_my_reviews", {
771
+ description: "Show reviews submitted by the local wallet, newest first, including review IDs for deletion. Follow next_before_id to see older reviews. Works while CrowdCode is off. Locally signs an expiring ownership proof; never creates a wallet.",
772
+ inputSchema: { before_id: z2.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(), limit: z2.number().int().min(1).max(100).default(25) },
773
+ annotations: { readOnlyHint: true }
774
+ }, (args) => handlers.list_my_reviews(args));
775
+ server.registerTool("delete_my_review", {
776
+ description: "Permanently delete the specific review ID requested by the user, owned by the local wallet. List reviews first if the ID is unknown. Removes review text and invalidates its summary and score; retains only a hashed replay-prevention key. Works while off. Never bulk-delete or choose IDs without user direction.",
777
+ inputSchema: { review_id: z2.number().int().positive().max(Number.MAX_SAFE_INTEGER) },
778
+ annotations: { destructiveHint: true, idempotentHint: true }
779
+ }, (args) => handlers.delete_my_review(args));
687
780
  server.registerTool(
688
781
  "request_service",
689
782
  {
690
- description: "Record unmet paid-service demand for future directory coverage. Call this only when you were actively trying to BUY a capability \u2014 you had the task, a wallet, and spend authority, and would have paid concrete money right then if the service existed \u2014 and no fitting paid service (x402/mppx/Stripe) could be found. 'A provider could charge for this' is not enough; if you would only use it for free, do not request it. Describe the paid API call you wanted to make: the input you would have sent, the output or state change you were paying for, and roughly what a call was worth to the task, phrased generally enough to serve multiple users. Good: 'resolve a citation like Smith et al. 2019 to the actual paper, or report that it does not exist \u2014 worth ~$0.10 per lookup'; 'semantic search over paywalled full-text academic PDFs returning page-level citations \u2014 worth ~$0.25 per query'. Bad: free tools that would merely have been convenient, wishes about your own runtime or harness ('cleaner context', 'more memory', local compute/IDE features), and one-off task help ('fix my CI'). Requires a wallet identity (attached automatically from your local agentcash wallet); limited to 5 requests per wallet per 24h. Free-text fields are redacted locally (PII and secrets become [PLACEHOLDER]s) before anything is sent to the shared CrowdCode backend.",
783
+ description: "Record a concrete paid service that would have materially improved the task. Before your final answer, reflect on failures, poor results, excessive cost, and avoidable detours, even when no purchase was attempted. Describe the actual use case, exact input, paid deliverable, acceptance criteria, what failed, and why the outcome is worth paying for. Existing services may qualify when you explain the specific deficiency. Example: scanned annual reports to reconciled tables with page citations and confidence flags, because ordinary OCR dropped columns and required manual reconciliation. Skip generic web search that worked well, run-Python/local runtime wishes, and unsupported hypothetical needs. No payment or spending authority is needed; never invent a budget. One request per distinct gap per task; respect the returned wallet limit. Submit nothing if all worked well at reasonable cost. Free text is redacted locally.",
691
784
  inputSchema: requestServiceShape
692
785
  },
693
786
  (args) => handlers.request_service(args)
@@ -711,7 +804,7 @@ function buildServer(deps) {
711
804
  server.registerTool(
712
805
  "review_service",
713
806
  {
714
- description: "Submit a review after paying for a service \u2014 call this after EVERY uniquely paid x402/mppx use, including slow responses and failures. A bad outcome is not a reason to skip the review; it IS the review: rate 1-2 with the failure in the reason. Rate against the ORIGINAL task you were solving: was the response relevant and did it actually help answer that question? Rating scale: 5 = excellent (clear schema, relevant output that answered the original question, fast, clean receipt \u2014 would reuse confidently); 4 = helped but a real schema/docs/latency/output caveat; 3 = paid but thin/confusing/needed guesswork or not actually relevant/helpful for the task (a technically valid answer that did not help is a 3 at best); 2 = paid but poor (client error, unclear failure, hard to use); 1 = paid and broken (server error, unusable output, misleading challenge, timeout). A service that simply worked well AND helped is a 5 \u2014 do not hedge to 4 without a concrete caveat. SIGNING IS AUTOMATIC: this tool signs with your local agentcash wallet (auto-created if missing); environment private keys are not accepted \u2014 do not call get_review_signing_payload or sign externally. Get identity and proofs from the ACTUAL payment, not a directory listing: payment_reference = the settlement tx hash (x402) or Payment-Receipt `reference` (mppx); payment_proof = the base64 response header STRING \u2014 `payment-response` for x402, `Payment-Receipt` for mppx \u2014 NOT the tx hash and NOT decoded JSON. payment_proof is OPTIONAL: verified-purchase status (double scoring weight) comes from on-chain transfer verification, which works from the settlement tx hash in payment_reference alone \u2014 pass the proof header too when you have it. Only x402 USDC on Base and mppx on Tempo are supported; Solana and other chains are rejected. payment_verification_level in the response is the source of truth; payment_target_ref = the real payee (the 402 challenge recipient / on-chain Transfer `to`), not a bazaar/directory payTo. If you paid from a different wallet than the local one, pass reviewer_wallet and review_signature yourself (the wallet that SENT the payment \u2014 the ERC-20 Transfer `from`, not the gasless facilitator). Every unique payment may be reviewed; daily scoring influence is capped. Free-text is redacted locally.",
807
+ description: "Review a service experience, paid or unpaid, with a rating from 1 to 5 and concrete observations about usefulness for the original task. Review every paid outcome; unpaid successes and failures can use the same tool. Distinguish provider faults from client errors, insufficient funds, and uncertain causes. Signing with the local AgentCash wallet is automatic. Omit payment_reference and payment_proof when no payment is claimed; payment is then marked unverified. Use a stable review_nonce for unpaid retries (generated automatically if omitted). For paid reviews, supply the actual settlement reference and payee; optional payment_proof is the original base64 response header. Claims must verify on x402 Base USDC or mppx Tempo; invalid payment evidence is rejected, never downgraded. Daily scoring influence is capped. Review text is redacted locally.",
715
808
  inputSchema: reviewServiceShape
716
809
  },
717
810
  (args) => handlers.review_service(args)
@@ -740,11 +833,11 @@ async function startServer() {
740
833
  const upstream = new UpstreamClient(config.backendUrl, config.upstreamTimeoutMs);
741
834
  const server = buildServer({ engine, upstream });
742
835
  await server.connect(new StdioServerTransport());
743
- void warnOnToolDrift(upstream);
836
+ if ((await new Preferences().status()).enabled) void warnOnToolDrift(upstream);
744
837
  }
745
838
  export {
746
839
  buildServer,
747
840
  createToolHandlers,
748
841
  startServer
749
842
  };
750
- //# sourceMappingURL=server-64YCEXFW.js.map
843
+ //# sourceMappingURL=server-Q6FUDOBY.js.map