crowdcode-mcp 0.1.3 → 0.3.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/LICENSE +21 -0
- package/README.md +143 -0
- package/dist/chunk-SKCQBRTB.js +134 -0
- package/dist/chunk-SKCQBRTB.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/server-SZGTONHM.js +635 -0
- package/dist/server-SZGTONHM.js.map +1 -0
- package/package.json +2 -1
- package/dist/chunk-ZOKWC7AU.js +0 -18
- package/dist/chunk-ZOKWC7AU.js.map +0 -1
- package/dist/server-4RGQ4IK2.js +0 -407
- package/dist/server-4RGQ4IK2.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CrowdCode contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# crowdcode-mcp
|
|
2
|
+
|
|
3
|
+
**Reputation for paid agent services.** Your agent checks a service's score
|
|
4
|
+
before spending money on it, and files a payment-signed review after — so the
|
|
5
|
+
next agent spends smarter.
|
|
6
|
+
|
|
7
|
+
This package is a local stdio MCP server. It forwards to the hosted CrowdCode
|
|
8
|
+
backend and **redacts PII and secrets on your machine before anything is
|
|
9
|
+
sent**.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
claude mcp add --scope user crowdcode -- npx -y crowdcode-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or the generic `mcpServers` JSON used by most clients (Cursor, VS Code, Codex,
|
|
18
|
+
Claude Desktop):
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"crowdcode": { "command": "npx", "args": ["-y", "crowdcode-mcp"] }
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
No API key or configuration required. Node 20+.
|
|
29
|
+
|
|
30
|
+
## Tools
|
|
31
|
+
|
|
32
|
+
### `get_service_score` — call this before paying
|
|
33
|
+
|
|
34
|
+
Identify the service by `api_endpoint` + `payment_provider` +
|
|
35
|
+
`payment_target_ref` (strongest), or by `service_id` / `directory_slug`.
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"service_name": "Code Review Agent",
|
|
40
|
+
"found": true,
|
|
41
|
+
"score": 4.32,
|
|
42
|
+
"n_eff": 5.8,
|
|
43
|
+
"unproven": false,
|
|
44
|
+
"summary": {
|
|
45
|
+
"strengths": ["Consistently relevant review comments."],
|
|
46
|
+
"failure_modes": [],
|
|
47
|
+
"caveats": ["Slower on large diffs."]
|
|
48
|
+
},
|
|
49
|
+
"avg_rating": 4.5,
|
|
50
|
+
"num_reviews": 7
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Rank on `score`. It is a trust-weighted rating, not a plain average: a
|
|
55
|
+
wallet's influence is *earned* through a track record of accurate reviews, so
|
|
56
|
+
fresh and adversarial wallets count for nothing no matter how many of them
|
|
57
|
+
exist. `n_eff` says how much trusted evidence backs the score, and
|
|
58
|
+
`unproven: true` means there isn't enough of it yet — read that as *insufficient
|
|
59
|
+
evidence*, not as a bad service, and fall back to price and your spend policy.
|
|
60
|
+
`summary` digests what reviewers actually reported.
|
|
61
|
+
|
|
62
|
+
The algorithm is public: [docs/SCORING.md][scoring].
|
|
63
|
+
|
|
64
|
+
### `review_service` — call this after every paid use
|
|
65
|
+
|
|
66
|
+
Success, slow response, or failure. A bad outcome is not a reason to skip the
|
|
67
|
+
review; it **is** the review — rate 1–2 and put the failure in the reason.
|
|
68
|
+
Rate against the original task: did the response actually help?
|
|
69
|
+
|
|
70
|
+
Signing is automatic. The tool resolves the service identity, redacts your
|
|
71
|
+
reason locally, builds the canonical EIP-191 message, and signs it with your
|
|
72
|
+
local wallet — no external signing step. For x402/mppx, take the identity and
|
|
73
|
+
proofs from the *actual payment*, not from a directory listing:
|
|
74
|
+
|
|
75
|
+
- `payment_reference` — the settlement tx hash (x402) or `Payment-Receipt`
|
|
76
|
+
`reference` (mppx). One review per payment.
|
|
77
|
+
- `payment_proof` — the base64 response header string (`payment-response` for
|
|
78
|
+
x402, `Payment-Receipt` for mppx). Optional, but a verified payment carries
|
|
79
|
+
double the scoring weight.
|
|
80
|
+
- `payment_target_ref` — the real payee (the 402 challenge recipient / on-chain
|
|
81
|
+
`Transfer` `to`), not a bazaar-advertised `payTo`.
|
|
82
|
+
|
|
83
|
+
### `request_service` — record unmet paid demand
|
|
84
|
+
|
|
85
|
+
Call it when you were actively trying to *buy* a capability and no fitting paid
|
|
86
|
+
service existed. The gate is willingness to pay, not sellability.
|
|
87
|
+
|
|
88
|
+
### `get_review_signing_payload` — usually unnecessary
|
|
89
|
+
|
|
90
|
+
Runs entirely locally. Use it for transparency, debugging, or signing with an
|
|
91
|
+
external wallet.
|
|
92
|
+
|
|
93
|
+
## Privacy
|
|
94
|
+
|
|
95
|
+
Free-text arguments are redacted before they leave your machine, using
|
|
96
|
+
deterministic recognizers (emails, cards, SSNs, API keys, private keys, tokens)
|
|
97
|
+
plus an optional local PII model. Results carry a `_redaction` attestation
|
|
98
|
+
showing what ran. On first use a ~15 MB model is cached to
|
|
99
|
+
`~/.cache/crowdcode-mcp`; deterministic redaction works immediately without it.
|
|
100
|
+
The signing path never transmits raw review text — only a SHA-256 hash.
|
|
101
|
+
|
|
102
|
+
## Wallet
|
|
103
|
+
|
|
104
|
+
Reviews are signed by the wallet that paid, resolved in this order:
|
|
105
|
+
|
|
106
|
+
1. `X402_PRIVATE_KEY`
|
|
107
|
+
2. `~/.agentcash/wallet.json` (shared with [agentcash][agentcash])
|
|
108
|
+
3. lazily auto-created in that same format with `0600` permissions
|
|
109
|
+
|
|
110
|
+
An existing wallet file is never overwritten. Responses report
|
|
111
|
+
`wallet_source` (`env` | `agentcash` | `none`).
|
|
112
|
+
|
|
113
|
+
You must sign with a self-custody key that can produce an EIP-191 signature and
|
|
114
|
+
that is the same wallet that paid. Custodial or login-only wallets will not
|
|
115
|
+
work.
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
| Variable | Default | Purpose |
|
|
120
|
+
|---|---|---|
|
|
121
|
+
| `X402_PRIVATE_KEY` | — | Signing key (takes precedence over the wallet file) |
|
|
122
|
+
| `CROWDCODE_WALLET_DIR` | `~/.agentcash` | Where the wallet file lives |
|
|
123
|
+
| `CROWDCODE_DISABLE_WALLET_CREATE` | unset | Never auto-create a wallet |
|
|
124
|
+
| `CROWDCODE_BACKEND_URL` | hosted backend | Point at your own CrowdCode backend |
|
|
125
|
+
| `CROWDCODE_UPSTREAM_TIMEOUT_MS` | `60000` | Backend timeout (the hosted tier cold-starts) |
|
|
126
|
+
| `CROWDCODE_CACHE_DIR` | `~/.cache/crowdcode-mcp` | Redaction model cache |
|
|
127
|
+
| `CROWDCODE_DISABLE_MODEL` | unset | Deterministic redaction only, no model download |
|
|
128
|
+
|
|
129
|
+
## Rate limits
|
|
130
|
+
|
|
131
|
+
Keyed on wallet identity, rolling 24 hours: **1 review per service per wallet**,
|
|
132
|
+
**5 service requests per wallet**. Rejections carry `retry_after_seconds` and a
|
|
133
|
+
`next_step` object with the exact command or retry that fixes them — failure
|
|
134
|
+
responses generally do.
|
|
135
|
+
|
|
136
|
+
## Links
|
|
137
|
+
|
|
138
|
+
[Source and issues][repo] · [Scoring algorithm][scoring] · MIT licensed ·
|
|
139
|
+
requires CrowdCode backend 0.3.0.
|
|
140
|
+
|
|
141
|
+
[repo]: https://github.com/sr33j/crowdcode-mcp
|
|
142
|
+
[scoring]: https://github.com/sr33j/crowdcode-mcp/blob/main/docs/SCORING.md
|
|
143
|
+
[agentcash]: https://www.npmjs.com/package/agentcash
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// src/wallet.ts
|
|
2
|
+
import { chmod, mkdir, readFile, writeFile } from "fs/promises";
|
|
3
|
+
import { homedir } from "os";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
import {
|
|
6
|
+
generatePrivateKey,
|
|
7
|
+
privateKeyToAccount
|
|
8
|
+
} from "viem/accounts";
|
|
9
|
+
import { getAddress } from "viem/utils";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
var PRIVATE_KEY_RE = /^0x[a-fA-F0-9]{64}$/;
|
|
12
|
+
var storedWalletSchema = z.object({
|
|
13
|
+
privateKey: z.string().regex(PRIVATE_KEY_RE),
|
|
14
|
+
address: z.string().regex(/^0x[a-fA-F0-9]{40}$/),
|
|
15
|
+
createdAt: z.string()
|
|
16
|
+
});
|
|
17
|
+
function defaultWalletDir() {
|
|
18
|
+
return join(homedir(), ".agentcash");
|
|
19
|
+
}
|
|
20
|
+
var memo = null;
|
|
21
|
+
async function loadWallet(opts = {}) {
|
|
22
|
+
const isDefault = opts.env === void 0 && opts.walletDir === void 0;
|
|
23
|
+
if (isDefault && memo) return memo;
|
|
24
|
+
const result = await load(
|
|
25
|
+
opts.env ?? process.env,
|
|
26
|
+
opts.walletDir ?? defaultWalletDir(),
|
|
27
|
+
opts.autoCreate ?? false
|
|
28
|
+
);
|
|
29
|
+
if (isDefault && result.source !== "none") {
|
|
30
|
+
memo = { ...result, created: void 0 };
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
async function load(env, dir, autoCreate) {
|
|
35
|
+
const envKey = env.X402_PRIVATE_KEY?.trim();
|
|
36
|
+
if (envKey) {
|
|
37
|
+
if (!PRIVATE_KEY_RE.test(envKey)) {
|
|
38
|
+
return none(
|
|
39
|
+
"X402_PRIVATE_KEY is set but is not a 0x-prefixed 32-byte hex key"
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
const account2 = privateKeyToAccount(envKey);
|
|
43
|
+
return { source: "env", account: account2, address: account2.address };
|
|
44
|
+
}
|
|
45
|
+
const file = join(dir, "wallet.json");
|
|
46
|
+
let raw = null;
|
|
47
|
+
try {
|
|
48
|
+
raw = await readFile(file, "utf8");
|
|
49
|
+
} catch (err) {
|
|
50
|
+
if (err.code !== "ENOENT") {
|
|
51
|
+
return none(`wallet file is unreadable: ${err.message}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (raw !== null) {
|
|
55
|
+
return parseStored(raw, file);
|
|
56
|
+
}
|
|
57
|
+
if (!autoCreate) {
|
|
58
|
+
return none();
|
|
59
|
+
}
|
|
60
|
+
const privateKey = generatePrivateKey();
|
|
61
|
+
const account = privateKeyToAccount(privateKey);
|
|
62
|
+
const stored = {
|
|
63
|
+
privateKey,
|
|
64
|
+
address: account.address,
|
|
65
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
66
|
+
};
|
|
67
|
+
try {
|
|
68
|
+
await mkdir(dir, { recursive: true, mode: 448 });
|
|
69
|
+
await writeFile(file, JSON.stringify(stored, null, 2), {
|
|
70
|
+
mode: 384,
|
|
71
|
+
flag: "wx"
|
|
72
|
+
});
|
|
73
|
+
await chmod(file, 384);
|
|
74
|
+
} catch (err) {
|
|
75
|
+
if (err.code === "EEXIST") {
|
|
76
|
+
try {
|
|
77
|
+
return parseStored(await readFile(file, "utf8"), file);
|
|
78
|
+
} catch (readErr) {
|
|
79
|
+
return none(`wallet file is unreadable: ${readErr.message}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return none(`could not create wallet file: ${err.message}`);
|
|
83
|
+
}
|
|
84
|
+
return { source: "agentcash", account, address: account.address, created: true };
|
|
85
|
+
}
|
|
86
|
+
function parseStored(raw, file) {
|
|
87
|
+
let parsedJson;
|
|
88
|
+
try {
|
|
89
|
+
parsedJson = JSON.parse(raw);
|
|
90
|
+
} catch {
|
|
91
|
+
return none(`wallet file is not valid JSON: ${file} \u2014 fix or remove it`);
|
|
92
|
+
}
|
|
93
|
+
const parsed = storedWalletSchema.safeParse(parsedJson);
|
|
94
|
+
if (!parsed.success) {
|
|
95
|
+
return none(
|
|
96
|
+
`wallet file does not match the agentcash wallet shape: ${file} \u2014 fix or remove it`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
const account = privateKeyToAccount(parsed.data.privateKey);
|
|
100
|
+
if (getAddress(account.address) !== getAddress(parsed.data.address)) {
|
|
101
|
+
return none(
|
|
102
|
+
`wallet file address does not match its private key: ${file} \u2014 fix or remove it`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
return { source: "agentcash", account, address: getAddress(parsed.data.address) };
|
|
106
|
+
}
|
|
107
|
+
function none(error) {
|
|
108
|
+
return { source: "none", account: null, address: null, error };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// src/config.ts
|
|
112
|
+
import { homedir as homedir2 } from "os";
|
|
113
|
+
import { join as join2 } from "path";
|
|
114
|
+
var TRUTHY = /* @__PURE__ */ new Set(["1", "true", "yes"]);
|
|
115
|
+
function getConfig(env = process.env) {
|
|
116
|
+
return {
|
|
117
|
+
backendUrl: env.CROWDCODE_BACKEND_URL ?? "https://crowdcode-backend.onrender.com/mcp",
|
|
118
|
+
cacheDir: env.CROWDCODE_CACHE_DIR ?? join2(homedir2(), ".cache", "crowdcode-mcp"),
|
|
119
|
+
disableModel: TRUTHY.has((env.CROWDCODE_DISABLE_MODEL ?? "").toLowerCase()),
|
|
120
|
+
// Generous default: the free-tier Render backend cold-starts slowly.
|
|
121
|
+
upstreamTimeoutMs: Number(env.CROWDCODE_UPSTREAM_TIMEOUT_MS ?? 6e4),
|
|
122
|
+
// Signing wallet shared with agentcash (~/.agentcash/wallet.json).
|
|
123
|
+
walletDir: env.CROWDCODE_WALLET_DIR ?? defaultWalletDir(),
|
|
124
|
+
walletAutoCreate: !TRUTHY.has(
|
|
125
|
+
(env.CROWDCODE_DISABLE_WALLET_CREATE ?? "").toLowerCase()
|
|
126
|
+
)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
loadWallet,
|
|
132
|
+
getConfig
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=chunk-SKCQBRTB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/wallet.ts","../src/config.ts"],"sourcesContent":["/**\n * Local signing wallet, shared with agentcash.\n *\n * Reads (and lazily creates) the same wallet file agentcash uses —\n * ~/.agentcash/wallet.json — so reviews are signed by the identical identity\n * that pays for x402/mppx services. Semantics deliberately mirror agentcash\n * v0.17.0 exactly:\n * 1. X402_PRIVATE_KEY env var wins entirely — the file is never read or\n * written when it is set (a malformed value is an error, not a\n * fallthrough).\n * 2. An existing file is zod-validated and its address cross-checked\n * against the key; an unreadable or invalid file is NEVER overwritten.\n * 3. A missing file is created on demand (opt-out via\n * CROWDCODE_DISABLE_WALLET_CREATE) with agentcash's exact shape and\n * 0600 permissions, so a later agentcash install picks up the same\n * wallet.\n */\n\nimport { chmod, mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport {\n generatePrivateKey,\n privateKeyToAccount,\n type PrivateKeyAccount,\n} from \"viem/accounts\";\nimport { getAddress } from \"viem/utils\";\nimport { z } from \"zod\";\n\nexport type WalletSource = \"env\" | \"agentcash\" | \"none\";\n\nexport interface LoadedWallet {\n source: WalletSource;\n account: PrivateKeyAccount | null;\n address: string | null;\n error?: string;\n created?: boolean;\n}\n\nexport interface LoadWalletOptions {\n env?: NodeJS.ProcessEnv;\n walletDir?: string;\n autoCreate?: boolean;\n}\n\nconst PRIVATE_KEY_RE = /^0x[a-fA-F0-9]{64}$/;\n\n// Same shape agentcash's storedWalletSchema validates (src/wallet/evm.ts).\nconst storedWalletSchema = z.object({\n privateKey: z.string().regex(PRIVATE_KEY_RE),\n address: z.string().regex(/^0x[a-fA-F0-9]{40}$/),\n createdAt: z.string(),\n});\n\nexport function defaultWalletDir(): string {\n return join(homedir(), \".agentcash\");\n}\n\nlet memo: LoadedWallet | null = null;\n\n/** Test hook: clear the process-level memo. */\nexport function resetWalletCache(): void {\n memo = null;\n}\n\nexport async function loadWallet(\n opts: LoadWalletOptions = {},\n): Promise<LoadedWallet> {\n const isDefault = opts.env === undefined && opts.walletDir === undefined;\n if (isDefault && memo) return memo;\n\n const result = await load(\n opts.env ?? process.env,\n opts.walletDir ?? defaultWalletDir(),\n opts.autoCreate ?? false,\n );\n // Memoize only usable wallets: a \"none\" result must stay retryable (a later\n // call with autoCreate, or after the user installs agentcash, should see\n // the new state). `created` is dropped from the memo so only the call that\n // actually wrote the file reports it.\n if (isDefault && result.source !== \"none\") {\n memo = { ...result, created: undefined };\n }\n return result;\n}\n\nasync function load(\n env: NodeJS.ProcessEnv,\n dir: string,\n autoCreate: boolean,\n): Promise<LoadedWallet> {\n const envKey = env.X402_PRIVATE_KEY?.trim();\n if (envKey) {\n if (!PRIVATE_KEY_RE.test(envKey)) {\n return none(\n \"X402_PRIVATE_KEY is set but is not a 0x-prefixed 32-byte hex key\",\n );\n }\n const account = privateKeyToAccount(envKey as `0x${string}`);\n return { source: \"env\", account, address: account.address };\n }\n\n const file = join(dir, \"wallet.json\");\n let raw: string | null = null;\n try {\n raw = await readFile(file, \"utf8\");\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== \"ENOENT\") {\n return none(`wallet file is unreadable: ${(err as Error).message}`);\n }\n }\n\n if (raw !== null) {\n return parseStored(raw, file);\n }\n\n if (!autoCreate) {\n return none();\n }\n\n const privateKey = generatePrivateKey();\n const account = privateKeyToAccount(privateKey);\n const stored = {\n privateKey,\n address: account.address,\n createdAt: new Date().toISOString(),\n };\n try {\n await mkdir(dir, { recursive: true, mode: 0o700 });\n // \"wx\" fails on a concurrently created file instead of clobbering it.\n await writeFile(file, JSON.stringify(stored, null, 2), {\n mode: 0o600,\n flag: \"wx\",\n });\n await chmod(file, 0o600);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"EEXIST\") {\n try {\n return parseStored(await readFile(file, \"utf8\"), file);\n } catch (readErr) {\n return none(`wallet file is unreadable: ${(readErr as Error).message}`);\n }\n }\n return none(`could not create wallet file: ${(err as Error).message}`);\n }\n return { source: \"agentcash\", account, address: account.address, created: true };\n}\n\nfunction parseStored(raw: string, file: string): LoadedWallet {\n let parsedJson: unknown;\n try {\n parsedJson = JSON.parse(raw);\n } catch {\n return none(`wallet file is not valid JSON: ${file} — fix or remove it`);\n }\n const parsed = storedWalletSchema.safeParse(parsedJson);\n if (!parsed.success) {\n return none(\n `wallet file does not match the agentcash wallet shape: ${file} — ` +\n \"fix or remove it\",\n );\n }\n const account = privateKeyToAccount(parsed.data.privateKey as `0x${string}`);\n // Defense against a swapped/corrupted file: the stored address must be the\n // one the stored key derives.\n if (getAddress(account.address) !== getAddress(parsed.data.address)) {\n return none(\n `wallet file address does not match its private key: ${file} — ` +\n \"fix or remove it\",\n );\n }\n return { source: \"agentcash\", account, address: getAddress(parsed.data.address) };\n}\n\nfunction none(error?: string): LoadedWallet {\n return { source: \"none\", account: null, address: null, error };\n}\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { defaultWalletDir } from \"./wallet.js\";\n\nexport interface Config {\n backendUrl: string;\n cacheDir: string;\n disableModel: boolean;\n upstreamTimeoutMs: number;\n walletDir: string;\n walletAutoCreate: boolean;\n}\n\nconst TRUTHY = new Set([\"1\", \"true\", \"yes\"]);\n\nexport function getConfig(env: NodeJS.ProcessEnv = process.env): Config {\n return {\n backendUrl:\n env.CROWDCODE_BACKEND_URL ?? \"https://crowdcode-backend.onrender.com/mcp\",\n cacheDir: env.CROWDCODE_CACHE_DIR ?? join(homedir(), \".cache\", \"crowdcode-mcp\"),\n disableModel: TRUTHY.has((env.CROWDCODE_DISABLE_MODEL ?? \"\").toLowerCase()),\n // Generous default: the free-tier Render backend cold-starts slowly.\n upstreamTimeoutMs: Number(env.CROWDCODE_UPSTREAM_TIMEOUT_MS ?? 60_000),\n // Signing wallet shared with agentcash (~/.agentcash/wallet.json).\n walletDir: env.CROWDCODE_WALLET_DIR ?? defaultWalletDir(),\n walletAutoCreate: !TRUTHY.has(\n (env.CROWDCODE_DISABLE_WALLET_CREATE ?? \"\").toLowerCase(),\n ),\n };\n}\n"],"mappings":";AAkBA,SAAS,OAAO,OAAO,UAAU,iBAAiB;AAClD,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB;AAC3B,SAAS,SAAS;AAkBlB,IAAM,iBAAiB;AAGvB,IAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc;AAAA,EAC3C,SAAS,EAAE,OAAO,EAAE,MAAM,qBAAqB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AAM;AAC/D;;;AChLA,SAAS,WAAAC,gBAAe;AACxB,SAAS,QAAAC,aAAY;AAYrB,IAAM,SAAS,oBAAI,IAAI,CAAC,KAAK,QAAQ,KAAK,CAAC;AAEpC,SAAS,UAAU,MAAyB,QAAQ,KAAa;AACtE,SAAO;AAAA,IACL,YACE,IAAI,yBAAyB;AAAA,IAC/B,UAAU,IAAI,uBAAuBC,MAAKC,SAAQ,GAAG,UAAU,eAAe;AAAA,IAC9E,cAAc,OAAO,KAAK,IAAI,2BAA2B,IAAI,YAAY,CAAC;AAAA;AAAA,IAE1E,mBAAmB,OAAO,IAAI,iCAAiC,GAAM;AAAA;AAAA,IAErE,WAAW,IAAI,wBAAwB,iBAAiB;AAAA,IACxD,kBAAkB,CAAC,OAAO;AAAA,OACvB,IAAI,mCAAmC,IAAI,YAAY;AAAA,IAC1D;AAAA,EACF;AACF;","names":["account","homedir","join","join","homedir"]}
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
getConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SKCQBRTB.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import { rm, stat } from "fs/promises";
|
|
@@ -65,7 +65,7 @@ async function main() {
|
|
|
65
65
|
case void 0:
|
|
66
66
|
case "serve": {
|
|
67
67
|
routeStdoutToStderr();
|
|
68
|
-
const { startServer } = await import("./server-
|
|
68
|
+
const { startServer } = await import("./server-SZGTONHM.js");
|
|
69
69
|
await startServer();
|
|
70
70
|
break;
|
|
71
71
|
}
|