opencrowd 0.5.2 → 0.5.4

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.
Files changed (2) hide show
  1. package/bundle/opencrowd.js +54 -42
  2. package/package.json +1 -1
@@ -16347,9 +16347,13 @@ function normalizeConfig(value) {
16347
16347
  const provider = legacyProvider && raw.blockrun === void 0 ? "blockrun" : normalizeConfigProvider(raw.provider) ?? DEFAULT_CONFIG.provider;
16348
16348
  const proxyDefaults = providerDefaults(raw["openrouter-x402-proxy"] ?? raw.x402, DEFAULT_CONFIG["openrouter-x402-proxy"]);
16349
16349
  const mcpServers = recordValue(raw.mcpServers);
16350
+ const servers = { ...DEFAULT_CONFIG.mcpServers, ...mcpServers };
16351
+ if (servers.crowdcode?.command === "npx" && ["0.5", "0.5.2"].some((version6) => JSON.stringify(servers.crowdcode.args) === JSON.stringify(["--yes", `crowdcode-mcp@${version6}`]))) {
16352
+ servers.crowdcode = { ...servers.crowdcode, args: [...DEFAULT_CONFIG.mcpServers.crowdcode.args] };
16353
+ }
16350
16354
  return {
16351
16355
  configVersion: 3,
16352
- mcpServers: mcpServers ? mcpServers : DEFAULT_CONFIG.mcpServers,
16356
+ mcpServers: servers,
16353
16357
  provider,
16354
16358
  blockrun: providerDefaults(raw.blockrun, DEFAULT_CONFIG.blockrun),
16355
16359
  "openrouter-x402-proxy": proxyDefaults,
@@ -16394,7 +16398,7 @@ var init_config = __esm({
16394
16398
  configVersion: 3,
16395
16399
  mcpServers: {
16396
16400
  agentcash: { command: "npx", args: ["--yes", "agentcash@0.17"] },
16397
- crowdcode: { command: "npx", args: ["--yes", "crowdcode-mcp@0.5"] }
16401
+ crowdcode: { command: "npx", args: ["--yes", "crowdcode-mcp@0.5.3"] }
16398
16402
  },
16399
16403
  // GAIA provider benchmark (2026-08-25): same-model BlockRun matched the
16400
16404
  // current route's accuracy and completed the sample 6.7x faster. The
@@ -33471,10 +33475,36 @@ function normalizeEvidence(raw) {
33471
33475
  score: numberValue3(record3.score),
33472
33476
  nEff: numberValue3(record3.n_eff ?? record3.nEff),
33473
33477
  unproven: typeof record3.unproven === "boolean" ? record3.unproven : void 0,
33474
- summary: typeof record3.summary === "string" ? record3.summary : void 0,
33478
+ summary: summarizeEvidence(record3),
33475
33479
  raw
33476
33480
  };
33477
33481
  }
33482
+ function summarizeEvidence(record3) {
33483
+ const summary = record3.summary;
33484
+ const lines = [];
33485
+ if (typeof summary === "string" && summary)
33486
+ lines.push(summary);
33487
+ else if (summary && typeof summary === "object" && !Array.isArray(summary)) {
33488
+ const digest = summary;
33489
+ for (const key of ["failure_modes", "strengths", "caveats"]) {
33490
+ const items = digest[key];
33491
+ if (Array.isArray(items))
33492
+ lines.push(...items.filter((item) => typeof item === "string").slice(0, 2));
33493
+ }
33494
+ }
33495
+ if (Array.isArray(record3.recent_reviews)) {
33496
+ for (const value of record3.recent_reviews.slice(0, 5)) {
33497
+ if (!value || typeof value !== "object")
33498
+ continue;
33499
+ const review = value;
33500
+ if (typeof review.reason !== "string" || !review.reason)
33501
+ continue;
33502
+ const payment = review.payment_verified === true ? "payment verified" : "payment not verified";
33503
+ lines.push(`Reviewer report (${payment}, ${review.rating}/5): ${review.reason.slice(0, 600)}`);
33504
+ }
33505
+ }
33506
+ return lines.length ? lines.join(" ") : void 0;
33507
+ }
33478
33508
  function numberValue3(value) {
33479
33509
  if (typeof value === "number" && Number.isFinite(value)) {
33480
33510
  return value;
@@ -33509,14 +33539,17 @@ var init_crowdcode = __esm({
33509
33539
  const result = await this.connection.call("review_service", {
33510
33540
  rating: review.rating,
33511
33541
  reason: review.reason,
33512
- payment_reference: review.paymentReference,
33542
+ ...review.paymentReference !== void 0 ? { payment_reference: review.paymentReference } : {},
33543
+ ...review.reviewNonce ? { review_nonce: review.reviewNonce } : {},
33513
33544
  ...review.apiEndpoint ? { api_endpoint: review.apiEndpoint } : {},
33514
33545
  ...review.paymentProvider ? { payment_provider: review.paymentProvider } : {},
33515
33546
  ...review.paymentProof ? { payment_proof: review.paymentProof } : {},
33516
33547
  ...review.paymentTargetRef ? { payment_target_ref: review.paymentTargetRef } : {},
33517
33548
  ...review.taskContext ? { task_context: review.taskContext } : {}
33518
33549
  });
33519
- return { ok: result.ok, error: result.error, raw: result.data };
33550
+ const payload = result.data && typeof result.data === "object" ? result.data : {};
33551
+ const accepted = result.ok && payload.accepted === true;
33552
+ return { ok: accepted, error: accepted ? void 0 : result.error ?? String(payload.reason ?? "CrowdCode did not accept the review"), raw: result.data };
33520
33553
  }
33521
33554
  };
33522
33555
  }
@@ -33979,6 +34012,7 @@ var init_gateway = __esm({
33979
34012
  charged_cost_cents: record3.charged_cost_cents,
33980
34013
  artifact_path: artifact?.path,
33981
34014
  review_required: record3.review_required,
34015
+ review_available: true,
33982
34016
  data: result.data,
33983
34017
  ...result.ok ? {} : { error: result.error }
33984
34018
  },
@@ -34066,27 +34100,16 @@ var init_gateway = __esm({
34066
34100
  if (state.reviewStatus === "submitted") {
34067
34101
  return { ok: false, error: `purchase ${purchaseId} is already reviewed` };
34068
34102
  }
34069
- if (state.reviewStatus === "not_required") {
34070
- if (state.record.outcome === "paid_success" || state.record.outcome === "paid_failure") {
34071
- return {
34072
- ok: false,
34073
- error: `purchase ${purchaseId} was recorded as ${state.record.outcome} without a verifiable settlement reference; this legacy receipt cannot be submitted to CrowdCode automatically`
34074
- };
34075
- }
34076
- return { ok: false, error: `purchase ${purchaseId} has no paid receipt to review (outcome: ${state.record.outcome})` };
34077
- }
34078
34103
  const evidence = state.record.evidence;
34079
- if (!evidence?.reference) {
34080
- return { ok: false, error: `purchase ${purchaseId} has no settlement reference; it cannot be reviewed` };
34081
- }
34082
34104
  const result = await this.options.crowdcode.reviewService({
34083
34105
  rating,
34084
34106
  reason,
34085
- paymentReference: evidence.reference,
34107
+ paymentReference: evidence?.reference,
34108
+ reviewNonce: evidence?.reference ? void 0 : state.record.purchase_id,
34086
34109
  apiEndpoint: state.record.endpoint,
34087
- paymentProvider: state.record.rail === "mppx" ? "mppx" : "x402",
34088
- paymentProof: evidence.proof,
34089
- paymentTargetRef: evidence.payTo,
34110
+ paymentProvider: evidence?.reference ? state.record.rail === "mppx" ? "mppx" : "x402" : void 0,
34111
+ paymentProof: evidence?.proof,
34112
+ paymentTargetRef: evidence?.reference ? evidence.payTo : void 0,
34090
34113
  taskContext: stringArg(args.task_context)
34091
34114
  });
34092
34115
  if (!result.ok) {
@@ -34195,7 +34218,7 @@ var init_gateway = __esm({
34195
34218
  },
34196
34219
  {
34197
34220
  name: "review_paid_service",
34198
- description: "Submit the required CrowdCode review for one stored purchase using its receipt evidence. Required after every confirmed paid call \u2014 success or failure; a broken paid call IS the review (rate 1-2 with the failure as the reason).",
34221
+ description: "Review a stored service interaction, paid or unpaid, using the same CrowdCode review flow. Payment evidence is attached when available; otherwise payment is marked unverified. Required after confirmed paid calls, optional for unpaid outcomes. Describe observed results and distinguish provider faults from caller errors, insufficient funds, and uncertain failures.",
34199
34222
  parameters: {
34200
34223
  type: "object",
34201
34224
  properties: {
@@ -34445,6 +34468,8 @@ ${text.slice(0, 2400)}`),
34445
34468
  return sharedPromise;
34446
34469
  }
34447
34470
  function resolvePinnedCommand(config4, binaryName) {
34471
+ if (binaryName === "crowdcode-mcp")
34472
+ return config4;
34448
34473
  if (config4.command !== "npx") {
34449
34474
  return config4;
34450
34475
  }
@@ -80150,20 +80175,6 @@ function parseListedService(raw) {
80150
80175
  num_reviews: numberValue6(row.num_reviews ?? service.num_reviews)
80151
80176
  };
80152
80177
  }
80153
- function summarizeEvidence(body) {
80154
- const summary = objectValue4(body.summary);
80155
- const lines = [...stringList(summary?.strengths), ...stringList(summary?.caveats)];
80156
- if (lines.length) {
80157
- return lines.slice(0, 4).join(" ");
80158
- }
80159
- return stringValue5(body.summary);
80160
- }
80161
- function stringList(value) {
80162
- if (typeof value === "string") {
80163
- return value ? [value] : [];
80164
- }
80165
- return Array.isArray(value) ? value.filter((item) => typeof item === "string" && item.length > 0) : [];
80166
- }
80167
80178
  function endpointKey(url3) {
80168
80179
  try {
80169
80180
  const parsed = new URL(url3);
@@ -80455,9 +80466,10 @@ var init_hosted_economy = __esm({
80455
80466
  try {
80456
80467
  const reply = await postHostedTool(this.socket, "economy.review", {
80457
80468
  api_endpoint: review.apiEndpoint,
80458
- payment_provider: "x402",
80469
+ payment_provider: review.paymentProvider,
80459
80470
  payment_target_ref: review.paymentTargetRef,
80460
80471
  payment_reference: review.paymentReference,
80472
+ review_nonce: review.reviewNonce,
80461
80473
  rating: review.rating,
80462
80474
  reason: review.reason,
80463
80475
  task_context: review.taskContext
@@ -81109,7 +81121,7 @@ async function runAgentTaskDetailed(session, task, options = {}) {
81109
81121
  "Before repeatedly fighting the local environment, decide whether the task needs external capability such as hosting, persistent infrastructure, remote compute, specialized APIs, live data, or access the user's device does not have."
81110
81122
  ];
81111
81123
  if (options.dynamicTools) {
81112
- systemPromptParts.push("When the local computer is not the right environment, or after one clear local capability failure, buy external capability: find_paid_service to discover, inspect_paid_service to see the exact schema/price/reputation, call_paid_service to execute through the enforced purchase lifecycle, and review_paid_service for the required review after every confirmed paid call (success or failure).", ...options.hosted ? ["Discover services through AgentCash search and provider catalogs. You can use new services without prior CrowdCode reviews. Only x402 USDC on Base is payable, within the user's configured limits; over-limit quotes request approval. Use read_service for authenticated job polling and never resubmit a pending generation job."] : [], capabilityIndex ?? DEFAULT_CAPABILITY_INDEX, "When a task needs current web facts, search results, or unfamiliar page content, make one paid web search your FIRST move \u2014 do not serially guess URLs with curl; one paid search replaces minutes of blind fetching and costs less than the LLM turns it saves.", "Approval, budget, reputation, and payment rails are enforced in code \u2014 you cannot bypass them, so state costs plainly and never invent payment details.", "Each tool result includes the budget before and after that tool call. Never ask for wallet private keys or secrets.", ...options.promptSections ?? []);
81124
+ systemPromptParts.push("When the local computer is not the right environment, or after one clear local capability failure, buy external capability: find_paid_service to discover, inspect_paid_service to see the exact schema/price/reputation, call_paid_service to execute through the enforced purchase lifecycle, and review_paid_service for the required review after every confirmed paid call (success or failure). The same review tool accepts unpaid experiences; review relevant free results or failed attempts without inventing payment evidence. Distinguish provider faults from local errors and uncertain failures.", ...options.hosted ? ["Discover services through AgentCash search and provider catalogs. You can use new services without prior CrowdCode reviews. Only x402 USDC on Base is payable, within the user's configured limits; over-limit quotes request approval. Use read_service for authenticated job polling and never resubmit a pending generation job."] : [], capabilityIndex ?? DEFAULT_CAPABILITY_INDEX, "When a task needs current web facts, search results, or unfamiliar page content, make one paid web search your FIRST move \u2014 do not serially guess URLs with curl; one paid search replaces minutes of blind fetching and costs less than the LLM turns it saves.", "Approval, budget, reputation, and payment rails are enforced in code \u2014 you cannot bypass them, so state costs plainly and never invent payment details.", "Each tool result includes the budget before and after that tool call. Never ask for wallet private keys or secrets.", ...options.promptSections ?? []);
81113
81125
  } else {
81114
81126
  systemPromptParts.push("Paid external services are unavailable in this run; work with local tools only and say so if the task truly requires external capability.");
81115
81127
  }
@@ -84045,9 +84057,9 @@ function flattenService(detail) {
84045
84057
  num_verified_reviews: Number(detail.num_verified_reviews ?? 0),
84046
84058
  histogram: detail.histogram,
84047
84059
  summary: Object.keys(summary).length > 0 ? {
84048
- strengths: stringList2(summary.strengths),
84049
- failure_modes: stringList2(summary.failure_modes),
84050
- caveats: stringList2(summary.caveats)
84060
+ strengths: stringList(summary.strengths),
84061
+ failure_modes: stringList(summary.failure_modes),
84062
+ caveats: stringList(summary.caveats)
84051
84063
  } : void 0,
84052
84064
  reviews
84053
84065
  };
@@ -84104,7 +84116,7 @@ function originOf3(endpoint) {
84104
84116
  return endpoint;
84105
84117
  }
84106
84118
  }
84107
- function stringList2(value) {
84119
+ function stringList(value) {
84108
84120
  return Array.isArray(value) ? value.map((item) => String(item)) : void 0;
84109
84121
  }
84110
84122
  function compact(value, maxLength) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencrowd",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "A CLI agent with its own wallet — discovers x402 services, pays in USDC, and completes tasks under a local budget",
5
5
  "type": "module",
6
6
  "license": "MIT",