tersign 0.4.5 → 0.4.6

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.
@@ -8,6 +8,6 @@ export declare function envDeps(env?: Record<string, string | undefined>): McpDe
8
8
  * every client; mcp.test.ts pins it against package.json so a release bump can't drift it. */
9
9
  export declare const MCP_SERVER_IDENTITY: {
10
10
  readonly name: "tersign";
11
- readonly version: "0.4.5";
11
+ readonly version: "0.4.6";
12
12
  };
13
13
  export declare function buildServer(deps: McpDeps): McpServer;
@@ -3,14 +3,18 @@ import { z } from 'zod';
3
3
  import { privateKeyToAccount } from 'viem/accounts';
4
4
  import { Assure } from '../assure.js';
5
5
  import { LedgerClient } from '../ledgerClient.js';
6
+ import { resolveSignerKey } from '../keystore.js';
6
7
  import { adjudicateDisputeTool, getDisputeTool, issueReceiptTool, openDisputeTool, recordDisclosureTool, recordRefundTool, submitEvidenceTool, verifyReceiptTool, verifyRecordTool, } from './tools.js';
7
8
  /** MCP packaging: exposes assure as tools any MCP-speaking agent can call, so an agent
8
9
  * (or its framework) can issue, verify, and chain receipts without importing the SDK.
9
10
  * Config via env — see envDeps(). */
10
11
  export function envDeps(env = process.env) {
11
- const key = env.TERSIGN_SELLER_KEY;
12
- if (!key)
13
- throw new Error('TERSIGN_SELLER_KEY (0x-prefixed private key) is required');
12
+ // Same key resolution as the CLI surfaces: TERSIGN_SELLER_KEY, else the OS keychain, else a
13
+ // 0600 keyfile, else generate one and persist it. record_disclosure's own description promises
14
+ // that first call self-provisions a signer-keyed account; before this the MCP entry point threw
15
+ // instead, so `npx tersign` died on first run for anyone who had not already exported a key —
16
+ // and no directory or sandbox could introspect the server at all.
17
+ const key = env.TERSIGN_SELLER_KEY ?? resolveSignerKey({ create: true }).key;
14
18
  const account = privateKeyToAccount(key);
15
19
  const assure = new Assure({
16
20
  signer: account,
@@ -45,7 +49,7 @@ function json(value) {
45
49
  }
46
50
  /** MUST match package.json name/version — the MCP handshake self-reports this identity to
47
51
  * every client; mcp.test.ts pins it against package.json so a release bump can't drift it. */
48
- export const MCP_SERVER_IDENTITY = { name: 'tersign', version: '0.4.5' };
52
+ export const MCP_SERVER_IDENTITY = { name: 'tersign', version: '0.4.6' };
49
53
  export function buildServer(deps) {
50
54
  const server = new McpServer(MCP_SERVER_IDENTITY);
51
55
  server.registerTool('issue_receipt', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tersign",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Tersign \u2014 the evidence layer for the agent economy. Counter-signed receipts, agent action records, idempotency enforcement, refunds, disputes, and jury-ready evidence envelopes for x402/agent-commerce sellers.",
5
5
  "license": "MIT",
6
6
  "type": "module",