@capxul/mcp 1.0.0-alpha.19 → 1.0.0-alpha.20
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/dist/main.mjs +60 -17
- package/package.json +8 -8
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.
|
|
235
|
+
var version$1 = "1.0.0-alpha.20";
|
|
236
236
|
//#endregion
|
|
237
237
|
//#region src/tool-result.ts
|
|
238
238
|
function okResult(structured) {
|
|
@@ -4035,13 +4035,31 @@ function parseV8StackFrames(error) {
|
|
|
4035
4035
|
}
|
|
4036
4036
|
return frames;
|
|
4037
4037
|
}
|
|
4038
|
+
/** Fixed, leak-safe frame used when the error carries no parseable stack. */
|
|
4039
|
+
const SDK_BOUNDARY_FILENAME = "capxul-sdk-observation://boundary";
|
|
4038
4040
|
/**
|
|
4039
|
-
* Build PostHog's `$exception_list`
|
|
4040
|
-
*
|
|
4041
|
+
* Build PostHog's `$exception_list` (always a single entry). Error Tracking
|
|
4042
|
+
* groups on `type`, so it is ALWAYS present (the CapxulError code) — the
|
|
4043
|
+
* previous `[{ frames }]` shape omitted it and PostHog dropped the event as
|
|
4044
|
+
* "missing field `type`". When the error has no parseable stack, a synthetic
|
|
4045
|
+
* boundary frame stands in so the event still ingests as a real Issue (#1031).
|
|
4041
4046
|
*/
|
|
4042
|
-
function buildExceptionList(
|
|
4043
|
-
|
|
4044
|
-
|
|
4047
|
+
function buildExceptionList(input) {
|
|
4048
|
+
const frames = input.frames.length > 0 ? input.frames : [{
|
|
4049
|
+
filename: SDK_BOUNDARY_FILENAME,
|
|
4050
|
+
function: input.operation ?? "unknown",
|
|
4051
|
+
lineno: 1,
|
|
4052
|
+
colno: 1
|
|
4053
|
+
}];
|
|
4054
|
+
return [{
|
|
4055
|
+
type: input.type,
|
|
4056
|
+
value: input.value,
|
|
4057
|
+
mechanism: {
|
|
4058
|
+
handled: true,
|
|
4059
|
+
type: "capxul_sdk_boundary"
|
|
4060
|
+
},
|
|
4061
|
+
stacktrace: { frames }
|
|
4062
|
+
}];
|
|
4045
4063
|
}
|
|
4046
4064
|
//#endregion
|
|
4047
4065
|
//#region ../../packages/sdk/src/telemetry/get-failure-mode.ts
|
|
@@ -4092,6 +4110,8 @@ function resolveFailureMode(error, contextFailureMode) {
|
|
|
4092
4110
|
}
|
|
4093
4111
|
//#endregion
|
|
4094
4112
|
//#region ../../packages/sdk/src/telemetry/capture-exception.ts
|
|
4113
|
+
/** Fixed, leak-safe message — the raw error message may carry PII and never ships. */
|
|
4114
|
+
const EXCEPTION_MESSAGE = "Capxul SDK operation failed";
|
|
4095
4115
|
/**
|
|
4096
4116
|
* Capture an error as a `$exception` event through the telemetry port,
|
|
4097
4117
|
* formatted for PostHog Error Tracking.
|
|
@@ -4105,16 +4125,24 @@ function resolveFailureMode(error, contextFailureMode) {
|
|
|
4105
4125
|
*/
|
|
4106
4126
|
function captureException(telemetry, error, context) {
|
|
4107
4127
|
return Effect.catchAllDefect(Effect.sync(() => {
|
|
4108
|
-
const
|
|
4128
|
+
const frames = error instanceof Error ? parseV8StackFrames(error) : [];
|
|
4109
4129
|
const capxulError = isCapxulError(error) ? error : null;
|
|
4130
|
+
const errorCode = capxulError?.code ?? context?.capxul_error_code ?? "UNKNOWN";
|
|
4110
4131
|
const props = {
|
|
4111
|
-
capxul_error_code:
|
|
4132
|
+
capxul_error_code: errorCode,
|
|
4133
|
+
$exception_type: errorCode,
|
|
4134
|
+
$exception_message: EXCEPTION_MESSAGE,
|
|
4135
|
+
$exception_list: buildExceptionList({
|
|
4136
|
+
type: errorCode,
|
|
4137
|
+
value: EXCEPTION_MESSAGE,
|
|
4138
|
+
...context?.operation === void 0 ? {} : { operation: context.operation },
|
|
4139
|
+
frames
|
|
4140
|
+
}),
|
|
4112
4141
|
layer: capxulError?.layer ?? context?.layer,
|
|
4113
4142
|
operation: context?.operation,
|
|
4114
4143
|
provider: context?.provider,
|
|
4115
4144
|
failure_mode: resolveFailureMode(error, context?.failure_mode)
|
|
4116
4145
|
};
|
|
4117
|
-
if (exceptionList !== void 0) props.$exception_list = exceptionList;
|
|
4118
4146
|
if (capxulError?.details !== void 0) props.details = JSON.stringify(capxulError.details);
|
|
4119
4147
|
for (const key of Object.keys(props)) if (props[key] === void 0) delete props[key];
|
|
4120
4148
|
return telemetry.emit({
|
|
@@ -5274,7 +5302,7 @@ async function recoverRawDigestSigner(input) {
|
|
|
5274
5302
|
}
|
|
5275
5303
|
//#endregion
|
|
5276
5304
|
//#region ../../packages/sdk/package.json
|
|
5277
|
-
var version = "1.0.0-alpha.
|
|
5305
|
+
var version = "1.0.0-alpha.20";
|
|
5278
5306
|
//#endregion
|
|
5279
5307
|
//#region ../../packages/sdk/src/ports/auth-client.ts
|
|
5280
5308
|
var AuthClientError = class extends Data.TaggedError("AuthClientError") {};
|
|
@@ -8438,6 +8466,18 @@ function transportErrorFromThrown(operation, request, cause) {
|
|
|
8438
8466
|
return transportErrorFromCapxul(operation, request, cause instanceof Error ? Errors.providerError("transport", request.name, cause) : Errors.providerError("transport", request.name, new Error(String(cause))), cause);
|
|
8439
8467
|
}
|
|
8440
8468
|
//#endregion
|
|
8469
|
+
//#region ../../packages/sdk/src/adapters/diagnostic/ConsoleDiagnosticAdapter.ts
|
|
8470
|
+
const DEFAULT_ACCOUNT_SETUP_LOG_PREFIX = "[capxul:account-setup]";
|
|
8471
|
+
var ConsoleDiagnosticAdapter = class {
|
|
8472
|
+
prefix;
|
|
8473
|
+
constructor(prefix = DEFAULT_ACCOUNT_SETUP_LOG_PREFIX) {
|
|
8474
|
+
this.prefix = prefix;
|
|
8475
|
+
}
|
|
8476
|
+
trace(scope, detail) {
|
|
8477
|
+
globalThis.console?.debug?.(`${this.prefix} ${scope}`, detail);
|
|
8478
|
+
}
|
|
8479
|
+
};
|
|
8480
|
+
//#endregion
|
|
8441
8481
|
//#region ../../packages/sdk/src/openfort/create-openfort-browser-signer.ts
|
|
8442
8482
|
function openfortProviderError(operation, cause) {
|
|
8443
8483
|
return cause instanceof CapxulError ? cause : Errors.providerError("openfort", operation, cause, { failure_mode: "unknown" });
|
|
@@ -9798,10 +9838,6 @@ function makeCurrentUserMethods(deps) {
|
|
|
9798
9838
|
deps.smartAccount.loadCurrent(options),
|
|
9799
9839
|
deps.orgs(options)
|
|
9800
9840
|
]);
|
|
9801
|
-
if (!account.ok) return {
|
|
9802
|
-
ok: false,
|
|
9803
|
-
error: account.error
|
|
9804
|
-
};
|
|
9805
9841
|
if (!smartAccount.ok) return {
|
|
9806
9842
|
ok: false,
|
|
9807
9843
|
error: smartAccount.error
|
|
@@ -9810,6 +9846,10 @@ function makeCurrentUserMethods(deps) {
|
|
|
9810
9846
|
ok: false,
|
|
9811
9847
|
error: organizations.error
|
|
9812
9848
|
};
|
|
9849
|
+
if (!account.ok && account.error.code !== "SMART_ACCOUNT_MISSING") return {
|
|
9850
|
+
ok: false,
|
|
9851
|
+
error: account.error
|
|
9852
|
+
};
|
|
9813
9853
|
return {
|
|
9814
9854
|
ok: true,
|
|
9815
9855
|
value: {
|
|
@@ -9820,10 +9860,10 @@ function makeCurrentUserMethods(deps) {
|
|
|
9820
9860
|
handle: null,
|
|
9821
9861
|
paymentLink: null
|
|
9822
9862
|
},
|
|
9823
|
-
personalAccount: {
|
|
9863
|
+
personalAccount: account.ok ? {
|
|
9824
9864
|
id: account.value.id,
|
|
9825
9865
|
address: smartAccount.value?.smartAccountAddress ?? null
|
|
9826
|
-
},
|
|
9866
|
+
} : null,
|
|
9827
9867
|
organizations: organizations.value.map((organization) => ({
|
|
9828
9868
|
id: organization.id,
|
|
9829
9869
|
name: organization.name,
|
|
@@ -12109,7 +12149,7 @@ function normalizeErrorKind(value) {
|
|
|
12109
12149
|
return typeof value === "string" && /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/u.test(value) ? value : "Error";
|
|
12110
12150
|
}
|
|
12111
12151
|
function syntheticException(operation, kind) {
|
|
12112
|
-
const error = /* @__PURE__ */ new Error(
|
|
12152
|
+
const error = /* @__PURE__ */ new Error(EXCEPTION_MESSAGE);
|
|
12113
12153
|
error.name = kind;
|
|
12114
12154
|
error.stack = `${kind}: ${error.message}\n at CapxulSdkBoundary.${operation} (capxul-sdk-observation://boundary/${operation}:1:1)`;
|
|
12115
12155
|
return error;
|
|
@@ -12455,6 +12495,9 @@ async function createCapxulClient(input) {
|
|
|
12455
12495
|
if (signer === void 0 && runtime === "browser") signer = createOpenfortBrowserSignerFromBootstrap({
|
|
12456
12496
|
...adapters.value.bootstrap,
|
|
12457
12497
|
authBaseUrl: resolvedAuthBaseUrl
|
|
12498
|
+
}, {
|
|
12499
|
+
diagnostic: new ConsoleDiagnosticAdapter(),
|
|
12500
|
+
telemetry: adapters.value.ports.telemetry
|
|
12458
12501
|
});
|
|
12459
12502
|
const client = wireOpenfortSignerLifecycle(assembleCapxulClient({
|
|
12460
12503
|
ports: adapters.value.ports,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/mcp",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.20",
|
|
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.
|
|
56
|
-
"@capxul/config": "0.1.0-alpha.
|
|
57
|
-
"@capxul/errors": "0.0.0",
|
|
58
|
-
"@capxul/observability": "0.1.0-alpha.
|
|
59
|
-
"@capxul/sdk": "1.0.0-alpha.
|
|
60
|
-
"@capxul/types": "0.1.0-alpha.
|
|
61
|
-
"@capxul/wire": "0.1.0-alpha.
|
|
55
|
+
"@capxul/backend": "0.1.0-alpha.5",
|
|
56
|
+
"@capxul/config": "0.1.0-alpha.3",
|
|
57
|
+
"@capxul/errors": "0.0.1-alpha.0",
|
|
58
|
+
"@capxul/observability": "0.1.0-alpha.1",
|
|
59
|
+
"@capxul/sdk": "1.0.0-alpha.20",
|
|
60
|
+
"@capxul/types": "0.1.0-alpha.1",
|
|
61
|
+
"@capxul/wire": "0.1.0-alpha.3"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"dev": "vp exec tsx src/main.ts serve",
|