opencrowd 0.5.3 → 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 +48 -42
  2. package/package.json +1 -1
@@ -16348,7 +16348,7 @@ function normalizeConfig(value) {
16348
16348
  const proxyDefaults = providerDefaults(raw["openrouter-x402-proxy"] ?? raw.x402, DEFAULT_CONFIG["openrouter-x402-proxy"]);
16349
16349
  const mcpServers = recordValue(raw.mcpServers);
16350
16350
  const servers = { ...DEFAULT_CONFIG.mcpServers, ...mcpServers };
16351
- if (servers.crowdcode?.command === "npx" && JSON.stringify(servers.crowdcode.args) === JSON.stringify(["--yes", "crowdcode-mcp@0.5"])) {
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
16352
  servers.crowdcode = { ...servers.crowdcode, args: [...DEFAULT_CONFIG.mcpServers.crowdcode.args] };
16353
16353
  }
16354
16354
  return {
@@ -16398,7 +16398,7 @@ var init_config = __esm({
16398
16398
  configVersion: 3,
16399
16399
  mcpServers: {
16400
16400
  agentcash: { command: "npx", args: ["--yes", "agentcash@0.17"] },
16401
- crowdcode: { command: "npx", args: ["--yes", "crowdcode-mcp@0.5.2"] }
16401
+ crowdcode: { command: "npx", args: ["--yes", "crowdcode-mcp@0.5.3"] }
16402
16402
  },
16403
16403
  // GAIA provider benchmark (2026-08-25): same-model BlockRun matched the
16404
16404
  // current route's accuracy and completed the sample 6.7x faster. The
@@ -33475,10 +33475,36 @@ function normalizeEvidence(raw) {
33475
33475
  score: numberValue3(record3.score),
33476
33476
  nEff: numberValue3(record3.n_eff ?? record3.nEff),
33477
33477
  unproven: typeof record3.unproven === "boolean" ? record3.unproven : void 0,
33478
- summary: typeof record3.summary === "string" ? record3.summary : void 0,
33478
+ summary: summarizeEvidence(record3),
33479
33479
  raw
33480
33480
  };
33481
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
+ }
33482
33508
  function numberValue3(value) {
33483
33509
  if (typeof value === "number" && Number.isFinite(value)) {
33484
33510
  return value;
@@ -33513,14 +33539,17 @@ var init_crowdcode = __esm({
33513
33539
  const result = await this.connection.call("review_service", {
33514
33540
  rating: review.rating,
33515
33541
  reason: review.reason,
33516
- payment_reference: review.paymentReference,
33542
+ ...review.paymentReference !== void 0 ? { payment_reference: review.paymentReference } : {},
33543
+ ...review.reviewNonce ? { review_nonce: review.reviewNonce } : {},
33517
33544
  ...review.apiEndpoint ? { api_endpoint: review.apiEndpoint } : {},
33518
33545
  ...review.paymentProvider ? { payment_provider: review.paymentProvider } : {},
33519
33546
  ...review.paymentProof ? { payment_proof: review.paymentProof } : {},
33520
33547
  ...review.paymentTargetRef ? { payment_target_ref: review.paymentTargetRef } : {},
33521
33548
  ...review.taskContext ? { task_context: review.taskContext } : {}
33522
33549
  });
33523
- 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 };
33524
33553
  }
33525
33554
  };
33526
33555
  }
@@ -33983,6 +34012,7 @@ var init_gateway = __esm({
33983
34012
  charged_cost_cents: record3.charged_cost_cents,
33984
34013
  artifact_path: artifact?.path,
33985
34014
  review_required: record3.review_required,
34015
+ review_available: true,
33986
34016
  data: result.data,
33987
34017
  ...result.ok ? {} : { error: result.error }
33988
34018
  },
@@ -34070,27 +34100,16 @@ var init_gateway = __esm({
34070
34100
  if (state.reviewStatus === "submitted") {
34071
34101
  return { ok: false, error: `purchase ${purchaseId} is already reviewed` };
34072
34102
  }
34073
- if (state.reviewStatus === "not_required") {
34074
- if (state.record.outcome === "paid_success" || state.record.outcome === "paid_failure") {
34075
- return {
34076
- ok: false,
34077
- error: `purchase ${purchaseId} was recorded as ${state.record.outcome} without a verifiable settlement reference; this legacy receipt cannot be submitted to CrowdCode automatically`
34078
- };
34079
- }
34080
- return { ok: false, error: `purchase ${purchaseId} has no paid receipt to review (outcome: ${state.record.outcome})` };
34081
- }
34082
34103
  const evidence = state.record.evidence;
34083
- if (!evidence?.reference) {
34084
- return { ok: false, error: `purchase ${purchaseId} has no settlement reference; it cannot be reviewed` };
34085
- }
34086
34104
  const result = await this.options.crowdcode.reviewService({
34087
34105
  rating,
34088
34106
  reason,
34089
- paymentReference: evidence.reference,
34107
+ paymentReference: evidence?.reference,
34108
+ reviewNonce: evidence?.reference ? void 0 : state.record.purchase_id,
34090
34109
  apiEndpoint: state.record.endpoint,
34091
- paymentProvider: state.record.rail === "mppx" ? "mppx" : "x402",
34092
- paymentProof: evidence.proof,
34093
- 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,
34094
34113
  taskContext: stringArg(args.task_context)
34095
34114
  });
34096
34115
  if (!result.ok) {
@@ -34199,7 +34218,7 @@ var init_gateway = __esm({
34199
34218
  },
34200
34219
  {
34201
34220
  name: "review_paid_service",
34202
- 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.",
34203
34222
  parameters: {
34204
34223
  type: "object",
34205
34224
  properties: {
@@ -80156,20 +80175,6 @@ function parseListedService(raw) {
80156
80175
  num_reviews: numberValue6(row.num_reviews ?? service.num_reviews)
80157
80176
  };
80158
80177
  }
80159
- function summarizeEvidence(body) {
80160
- const summary = objectValue4(body.summary);
80161
- const lines = [...stringList(summary?.strengths), ...stringList(summary?.caveats)];
80162
- if (lines.length) {
80163
- return lines.slice(0, 4).join(" ");
80164
- }
80165
- return stringValue5(body.summary);
80166
- }
80167
- function stringList(value) {
80168
- if (typeof value === "string") {
80169
- return value ? [value] : [];
80170
- }
80171
- return Array.isArray(value) ? value.filter((item) => typeof item === "string" && item.length > 0) : [];
80172
- }
80173
80178
  function endpointKey(url3) {
80174
80179
  try {
80175
80180
  const parsed = new URL(url3);
@@ -80461,9 +80466,10 @@ var init_hosted_economy = __esm({
80461
80466
  try {
80462
80467
  const reply = await postHostedTool(this.socket, "economy.review", {
80463
80468
  api_endpoint: review.apiEndpoint,
80464
- payment_provider: "x402",
80469
+ payment_provider: review.paymentProvider,
80465
80470
  payment_target_ref: review.paymentTargetRef,
80466
80471
  payment_reference: review.paymentReference,
80472
+ review_nonce: review.reviewNonce,
80467
80473
  rating: review.rating,
80468
80474
  reason: review.reason,
80469
80475
  task_context: review.taskContext
@@ -81115,7 +81121,7 @@ async function runAgentTaskDetailed(session, task, options = {}) {
81115
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."
81116
81122
  ];
81117
81123
  if (options.dynamicTools) {
81118
- 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 ?? []);
81119
81125
  } else {
81120
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.");
81121
81127
  }
@@ -84051,9 +84057,9 @@ function flattenService(detail) {
84051
84057
  num_verified_reviews: Number(detail.num_verified_reviews ?? 0),
84052
84058
  histogram: detail.histogram,
84053
84059
  summary: Object.keys(summary).length > 0 ? {
84054
- strengths: stringList2(summary.strengths),
84055
- failure_modes: stringList2(summary.failure_modes),
84056
- caveats: stringList2(summary.caveats)
84060
+ strengths: stringList(summary.strengths),
84061
+ failure_modes: stringList(summary.failure_modes),
84062
+ caveats: stringList(summary.caveats)
84057
84063
  } : void 0,
84058
84064
  reviews
84059
84065
  };
@@ -84110,7 +84116,7 @@ function originOf3(endpoint) {
84110
84116
  return endpoint;
84111
84117
  }
84112
84118
  }
84113
- function stringList2(value) {
84119
+ function stringList(value) {
84114
84120
  return Array.isArray(value) ? value.map((item) => String(item)) : void 0;
84115
84121
  }
84116
84122
  function compact(value, maxLength) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencrowd",
3
- "version": "0.5.3",
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",