@paybond/kit 0.2.1 → 0.4.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.
@@ -2,6 +2,8 @@
2
2
  * Principal intent creation signing for raw `predicate_dsl` (no managed-policy binding).
3
3
  * Matches `crates/harbor-intent-escrow/src/signing.rs` (`intent_creation_sign_bytes_raw`).
4
4
  */
5
+ /** Tenant-configured settlement rail names. Clients may request a rail, not a destination. */
6
+ export type SettlementRail = "stripe_connect" | "x402_usdc_base";
5
7
  export declare function intentCreationSignBytesRaw(input: {
6
8
  tenantId: string;
7
9
  intentId: string;
@@ -30,8 +32,11 @@ export type BuildSignedCreateIntentParams = {
30
32
  deadlineRfc3339: string;
31
33
  allowedTools: string[];
32
34
  predicateRef?: string;
35
+ /** Optional rail request for the new intent. Harbor resolves the destination server-side. */
36
+ settlementRail?: SettlementRail;
33
37
  };
34
38
  /**
35
39
  * Build a Harbor `POST /intents` JSON body with principal Ed25519 detached signature.
40
+ * `settlementRail` only requests an allowed rail; destinations remain tenant-owned server-side.
36
41
  */
37
42
  export declare function buildSignedCreateIntentBody(params: BuildSignedCreateIntentParams): Record<string, unknown>;
@@ -5,6 +5,13 @@
5
5
  import { sign, getPublicKey } from "@noble/ed25519";
6
6
  import { parse as parseUuid } from "uuid";
7
7
  import { jsonValueDigest } from "./json-digest.js";
8
+ const SETTLEMENT_RAIL_VALUES = new Set(["stripe_connect", "x402_usdc_base"]);
9
+ function validateSettlementRail(value) {
10
+ if (!SETTLEMENT_RAIL_VALUES.has(value)) {
11
+ throw new Error(`settlementRail must be one of ${[...SETTLEMENT_RAIL_VALUES].join(", ")}`);
12
+ }
13
+ return value;
14
+ }
8
15
  function concatBytes(...parts) {
9
16
  const n = parts.reduce((a, p) => a + p.length, 0);
10
17
  const out = new Uint8Array(n);
@@ -80,6 +87,7 @@ function bytesToBase64(bytes) {
80
87
  }
81
88
  /**
82
89
  * Build a Harbor `POST /intents` JSON body with principal Ed25519 detached signature.
90
+ * `settlementRail` only requests an allowed rail; destinations remain tenant-owned server-side.
83
91
  */
84
92
  export function buildSignedCreateIntentBody(params) {
85
93
  if (params.principalSigningSeed.length !== 32) {
@@ -88,6 +96,9 @@ export function buildSignedCreateIntentBody(params) {
88
96
  if (params.allowedTools.length === 0) {
89
97
  throw new Error("allowedTools must be non-empty");
90
98
  }
99
+ const settlementRail = params.settlementRail
100
+ ? validateSettlementRail(params.settlementRail)
101
+ : undefined;
91
102
  const predicateRef = params.predicateRef ?? "";
92
103
  const msg = intentCreationSignBytesRaw({
93
104
  tenantId: params.tenantId,
@@ -124,5 +135,8 @@ export function buildSignedCreateIntentBody(params) {
124
135
  if (predicateRef.trim() !== "") {
125
136
  body.predicate_ref = predicateRef;
126
137
  }
138
+ if (settlementRail) {
139
+ body.settlement_rail = settlementRail;
140
+ }
127
141
  return body;
128
142
  }
package/package.json CHANGED
@@ -1,15 +1,22 @@
1
1
  {
2
2
  "name": "@paybond/kit",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "Paybond Kit for TypeScript: tenant-bound Harbor sessions, capability verification, and signed intent/evidence flows.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
+ "bin": {
10
+ "paybond-mcp-server": "dist/mcp-server.js"
11
+ },
9
12
  "exports": {
10
13
  ".": {
11
14
  "types": "./dist/index.d.ts",
12
15
  "import": "./dist/index.js"
16
+ },
17
+ "./mcp-server": {
18
+ "types": "./dist/mcp-server.d.ts",
19
+ "import": "./dist/mcp-server.js"
13
20
  }
14
21
  },
15
22
  "files": [
@@ -34,7 +41,8 @@
34
41
  "agents",
35
42
  "typescript",
36
43
  "escrow",
37
- "capabilities"
44
+ "capabilities",
45
+ "mcp"
38
46
  ],
39
47
  "publishConfig": {
40
48
  "access": "public",