@capxul/mcp 1.0.0-alpha.13 → 1.0.0-alpha.15

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/dist/main.mjs +25 -3
  2. package/package.json +4 -4
package/dist/main.mjs CHANGED
@@ -232,7 +232,7 @@ function normalizeEmail(email) {
232
232
  }
233
233
  //#endregion
234
234
  //#region package.json
235
- var version$1 = "1.0.0-alpha.13";
235
+ var version$1 = "1.0.0-alpha.15";
236
236
  //#endregion
237
237
  //#region src/tool-result.ts
238
238
  function okResult(structured) {
@@ -1060,6 +1060,28 @@ const WithdrawalDocumentEnvelope = Schema.Struct({
1060
1060
  message: WithdrawalDocument
1061
1061
  });
1062
1062
  const PaymentDocumentEnvelope = Schema.Union(AttachablePaymentDocumentEnvelope, WithdrawalDocumentEnvelope);
1063
+ const ENVELOPE_PRIMARY_TYPE_TO_KIND = {
1064
+ Memo: "memo",
1065
+ Invoice: "invoice",
1066
+ Payslip: "payslip",
1067
+ Receipt: "receipt",
1068
+ Withdrawal: "withdrawal"
1069
+ };
1070
+ /**
1071
+ * Derive the wire `paymentType` an UNKNOWN document envelope classifies to
1072
+ * (payment-document-spec.md D11: memo/withdrawal → unspecified, invoice →
1073
+ * invoice, payslip → payroll, receipt → reimbursement), or `undefined` if the
1074
+ * envelope is absent / malformed — the same tolerance as
1075
+ * `tryHashPaymentDocument`. Callers holding an untyped envelope (e.g. the MCP
1076
+ * org spend port, #712) use this so the type they record agrees with the type
1077
+ * the backend re-derives from the same document.
1078
+ */
1079
+ function paymentTypeForDocumentEnvelope(envelope) {
1080
+ if (envelope === void 0 || envelope === null) return void 0;
1081
+ const decoded = Schema.decodeUnknownEither(PaymentDocumentEnvelope)(envelope);
1082
+ if (decoded._tag === "Left") return void 0;
1083
+ return paymentTypeForDocumentKind(ENVELOPE_PRIMARY_TYPE_TO_KIND[decoded.right.primaryType]);
1084
+ }
1063
1085
  Schema.Struct({
1064
1086
  payeeId: PayeeIdSchema,
1065
1087
  label: Schema.String,
@@ -5170,7 +5192,7 @@ async function recoverRawDigestSigner(input) {
5170
5192
  }
5171
5193
  //#endregion
5172
5194
  //#region ../../packages/sdk/package.json
5173
- var version = "1.0.0-alpha.13";
5195
+ var version = "1.0.0-alpha.15";
5174
5196
  //#endregion
5175
5197
  //#region ../../packages/sdk/src/ports/auth-client.ts
5176
5198
  var AuthClientError = class extends Data.TaggedError("AuthClientError") {};
@@ -14764,7 +14786,6 @@ function makeDevOrgSpendPort(deps) {
14764
14786
  ...deps.port === void 0 ? {} : { port: deps.port }
14765
14787
  });
14766
14788
  if (!executed.ok) throw toRoleDenial(executed.error, operation);
14767
- const paymentType = operation === "org.batchPayroll" ? "payroll" : "unspecified";
14768
14789
  const payments = [];
14769
14790
  const occurrences = /* @__PURE__ */ new Map();
14770
14791
  for (let index = 0; index < runs.length; index += 1) {
@@ -14778,6 +14799,7 @@ function makeDevOrgSpendPort(deps) {
14778
14799
  const occurrenceKey = `${recipientSafeAddress.toLowerCase()}:${amount.value}:${amount.decimals}:${amount.currency}`;
14779
14800
  const occurrenceIndex = occurrences.get(occurrenceKey) ?? 0;
14780
14801
  occurrences.set(occurrenceKey, occurrenceIndex + 1);
14802
+ const paymentType = operation === "org.batchPayroll" ? "payroll" : paymentTypeForDocumentEnvelope(run.document) ?? "unspecified";
14781
14803
  const recorded = await recordOrgPayment({
14782
14804
  orgId,
14783
14805
  recipientLabel: run.to,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/mcp",
3
- "version": "1.0.0-alpha.13",
3
+ "version": "1.0.0-alpha.15",
4
4
  "private": false,
5
5
  "description": "Capxul MCP server — agent-facing financial-ops tools (auth, account readiness, balances, testnet faucet, payments) exposed over Streamable HTTP with OAuth bearer auth and a dev-mode custody gate.",
6
6
  "keywords": [
@@ -52,13 +52,13 @@
52
52
  "typescript": "5.9.2",
53
53
  "vite": "npm:@voidzero-dev/vite-plus-core@0.1.23",
54
54
  "vite-plus": "0.1.23",
55
+ "@capxul/backend": "0.1.0-alpha.2",
55
56
  "@capxul/config": "0.1.0-alpha.1",
56
- "@capxul/sdk": "1.0.0-alpha.13",
57
+ "@capxul/sdk": "1.0.0-alpha.15",
57
58
  "@capxul/types": "0.1.0-alpha.0",
58
59
  "@capxul/wire": "0.1.0-alpha.1",
59
60
  "@capxul/errors": "0.0.0",
60
- "@capxul/observability": "0.1.0-alpha.0",
61
- "@capxul/backend": "0.1.0-alpha.1"
61
+ "@capxul/observability": "0.1.0-alpha.0"
62
62
  },
63
63
  "scripts": {
64
64
  "dev": "vp exec tsx src/main.ts serve",