@capxul/mcp 4.2.0-rc.4 → 4.2.0-rc.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.
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "source": {
3
- "commit": "400e4b861e8c10091ad2d9e71fc0502fe222a801",
4
- "tree": "c3afb8bb5f3ce69ee8aa1e8fbe811fe213627887",
3
+ "commit": "8e8ae6c3c56c5d5260c469cf8e4e7bbe172a098f",
4
+ "tree": "6fcb3062a577d0af2b426b2e50ef92c0d9027701",
5
5
  "branch": "codex/programme-rc",
6
6
  "repository": "https://github.com/Xelmar-tech/infrastructure",
7
7
  "lockfileSha256": "5870f53b72706d103220c1bcf733cb4fb71196aea32a9cfbdc277d73cc959264"
8
8
  },
9
9
  "name": "@capxul/mcp",
10
- "version": "4.2.0-rc.4"
10
+ "version": "4.2.0-rc.6"
11
11
  }
package/dist/main.mjs CHANGED
@@ -3738,6 +3738,12 @@ const USDX_BASE_SEPOLIA_TOKEN = {
3738
3738
  USDX_BASE_SEPOLIA_TOKEN.chainId;
3739
3739
  USDX_BASE_SEPOLIA_TOKEN.chainId;
3740
3740
  10n ** BigInt(6);
3741
+ /**
3742
+ * The bootstrap manage role. It administers people and roles, cannot spend,
3743
+ * and is not a signer of the Organization Safe; "Owner" implied the latter,
3744
+ * so the label is Admin (ruled 2026-09-06).
3745
+ */
3746
+ const ADMIN_ROLE_LABEL = "Admin";
3741
3747
  function normalizeOrgRoleLabel(label) {
3742
3748
  const normalized = label.trim().replace(/\s+/g, " ");
3743
3749
  if (normalized.length === 0) throw Errors.invalidInput("role.label", "must be a non-empty role label");
@@ -8652,7 +8658,8 @@ const CAPXUL_FUNCTIONS = {
8652
8658
  listMine: "org/queries:listMine",
8653
8659
  listRolesByOrgId: "org/queries:listRolesByOrgId",
8654
8660
  loadByOrgId: "org/queries:loadByOrgId",
8655
- me: "org/queries:me"
8661
+ me: "org/queries:me",
8662
+ pendingSetup: "org/queries:pendingSetup"
8656
8663
  },
8657
8664
  "smartAccount/actions": {
8658
8665
  claim: "smartAccount/actions:claim",
@@ -12251,7 +12258,7 @@ const moneyExecutionContract = {
12251
12258
  };
12252
12259
  //#endregion
12253
12260
  //#region ../../packages/sdk/package.json
12254
- var version$1 = "4.2.0-rc.4";
12261
+ var version$1 = "4.2.0-rc.6";
12255
12262
  //#endregion
12256
12263
  //#region ../../packages/sdk/src/telemetry/exception-projection.ts
12257
12264
  /** Fixed fallback for failures that have no safe message. */
@@ -14678,7 +14685,8 @@ var BetterAuthBrowserAdapter = class {
14678
14685
  try {
14679
14686
  const res = await this.fetchImpl(this.url("/api/auth/get-session"), withSignal$1({
14680
14687
  method: "GET",
14681
- credentials: "include"
14688
+ credentials: "include",
14689
+ cache: "no-store"
14682
14690
  }, options?.signal));
14683
14691
  if (options?.signal?.aborted) return {
14684
14692
  ok: false,
@@ -14750,7 +14758,8 @@ var BetterAuthBrowserAdapter = class {
14750
14758
  try {
14751
14759
  const res = await this.fetchImpl(this.url("/api/auth/convex/token"), withSignal$1({
14752
14760
  method: "GET",
14753
- credentials: "include"
14761
+ credentials: "include",
14762
+ cache: "no-store"
14754
14763
  }, options?.signal));
14755
14764
  if (options?.signal?.aborted) return {
14756
14765
  ok: false,
@@ -19199,6 +19208,7 @@ function orgIdBody(orgId) {
19199
19208
  //#region ../../packages/sdk/src/adapters/org/ConvexOrganizationAdapter.ts
19200
19209
  const DEFAULT_FUNCTIONS$1 = {
19201
19210
  listAll: makeFunctionReference(CAPXUL_FUNCTIONS["org/queries"].listAll),
19211
+ pendingSetup: makeFunctionReference(CAPXUL_FUNCTIONS["org/queries"].pendingSetup),
19202
19212
  listRoles: makeFunctionReference(CAPXUL_FUNCTIONS["org/queries"].listRolesByOrgId),
19203
19213
  listMembers: makeFunctionReference(CAPXUL_FUNCTIONS["org/queries"].listMembersByOrgId),
19204
19214
  readTreasury: makeFunctionReference(CAPXUL_FUNCTIONS["org/actions"].readTreasury),
@@ -19234,6 +19244,9 @@ var ConvexOrganizationAdapter = class {
19234
19244
  return brandOrgView(wire, treasury, viewerRole);
19235
19245
  })))), Effect.catchDefect((cause) => Effect.fail(toOrgError("listOrgs", cause))));
19236
19246
  }
19247
+ pendingSetup(input) {
19248
+ return this.#convex.query(this.#fns.pendingSetup, copyInvocationObservation(input, {})).pipe(Effect.mapError((error) => orgErrorFromCapxul("pendingSetup", error.publicError, error)), Effect.map((wire) => wire === null ? null : { orgId: toOrgId(wire.orgId) }), Effect.catchDefect((cause) => Effect.fail(toOrgError("pendingSetup", cause))));
19249
+ }
19237
19250
  readTreasury(input) {
19238
19251
  return this.#readTreasuryWire(input).pipe(Effect.catchDefect((cause) => Effect.fail(toOrgError("readTreasury", cause))));
19239
19252
  }
@@ -42779,7 +42792,10 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
42779
42792
  tokenCalls += 1;
42780
42793
  const tokenStartedAt = Date.now();
42781
42794
  try {
42782
- const response = await fetch(betterAuthSessionUrl(), { credentials: "include" });
42795
+ const response = await fetch(betterAuthSessionUrl(), {
42796
+ credentials: "include",
42797
+ cache: "no-store"
42798
+ });
42783
42799
  if (!response.ok) {
42784
42800
  diagnostic?.trace("openfort.token", {
42785
42801
  ok: false,
@@ -45215,7 +45231,7 @@ function hermeticOrgView(input) {
45215
45231
  name: input.name,
45216
45232
  handle: input.handle,
45217
45233
  safeAddress: toAddress(placeholder),
45218
- role: "Owner",
45234
+ role: ADMIN_ROLE_LABEL,
45219
45235
  treasury: zeroTreasury(orgId),
45220
45236
  bio: null,
45221
45237
  size: null,
@@ -46011,6 +46027,43 @@ function startSignerReadinessOnClaim(actor, signer) {
46011
46027
  browserSigner.ensureWalletReady?.().catch(() => {});
46012
46028
  });
46013
46029
  }
46030
+ /**
46031
+ * Attach a pending Organization when the identity becomes claimed.
46032
+ *
46033
+ * A reload during Organization setup used to leave the app re-submitting the
46034
+ * stored draft, and that second submission raced the controller's resume on
46035
+ * `ReadSession` — the loser was refused with `SUPERSEDED`. The backend already
46036
+ * knows the truth: `pendingSetup()` reports the owner's Organization whose
46037
+ * setup has not finished. The SDK asks once per authenticated user and sends
46038
+ * `AttachOrganization`, which the identity flow runs as `orgLane(…, attach)`.
46039
+ * The app then re-submits nothing.
46040
+ *
46041
+ * The read is fire-and-forget, as the signer readiness cycle is: a failure is
46042
+ * swallowed and the ask is released, so the next state change retries. The ask
46043
+ * is held to ONE per authUserId, so the claimed transitions that follow (the
46044
+ * org lane's own) start no second read, and a new session asks again.
46045
+ */
46046
+ function attachPendingOrganizationOnClaim(actor, organizationPort) {
46047
+ const pendingSetup = organizationPort?.pendingSetup?.bind(organizationPort);
46048
+ if (pendingSetup === void 0) return () => {};
46049
+ let askedFor = null;
46050
+ return actor.subscribe((state) => {
46051
+ if (state.phase !== "authenticated" || state.account.at !== "claimed") return;
46052
+ if (state.account.org !== null) return;
46053
+ const authUserId = state.session.authUserId;
46054
+ if (askedFor === authUserId) return;
46055
+ askedFor = authUserId;
46056
+ Effect.runPromise(pendingSetup({})).then((pending) => {
46057
+ if (pending === null) return;
46058
+ return Effect.runPromise(actor.ask({
46059
+ _tag: "AttachOrganization",
46060
+ orgId: String(pending.orgId)
46061
+ }));
46062
+ }).catch(() => {
46063
+ askedFor = null;
46064
+ });
46065
+ });
46066
+ }
46014
46067
  function assembleCapxulClient(input) {
46015
46068
  const observation = input;
46016
46069
  const authCache = input.authCache ?? detectAuthCacheAdapter();
@@ -46040,18 +46093,20 @@ function assembleCapxulClient(input) {
46040
46093
  }, failureObservation, normalizeCapxulOperation(`identity.${record.event}`), "machine");
46041
46094
  });
46042
46095
  const unsubscribeSignerReadiness = startSignerReadinessOnClaim(actor, input.signer);
46096
+ const selectedOrgPort = input.orgPort ?? input.orgDeploymentPort;
46097
+ const unsubscribePendingOrganization = attachPendingOrganizationOnClaim(actor, selectedOrgPort);
46043
46098
  let stopPromise = null;
46044
46099
  const stopActor = () => {
46045
46100
  if (stopPromise === null) {
46046
46101
  unsubscribeProductTelemetry();
46047
46102
  unsubscribeFailureObservation();
46048
46103
  unsubscribeSignerReadiness();
46104
+ unsubscribePendingOrganization();
46049
46105
  stopPromise = effectRunner.runPromise(Scope.close(scope, Exit.void));
46050
46106
  }
46051
46107
  return stopPromise;
46052
46108
  };
46053
46109
  if (input.signal !== void 0) input.signal.addEventListener("abort", () => void stopActor(), { once: true });
46054
- const selectedOrgPort = input.orgPort ?? input.orgDeploymentPort;
46055
46110
  let detectPendingOrgInvitations;
46056
46111
  let kickProvisioning;
46057
46112
  const financialOps = makeFinancialOpsMethods({
@@ -47738,7 +47793,7 @@ function stdioIdentity(env = process.env, options = {}) {
47738
47793
  }
47739
47794
  //#endregion
47740
47795
  //#region package.json
47741
- var version = "4.2.0-rc.4";
47796
+ var version = "4.2.0-rc.6";
47742
47797
  //#endregion
47743
47798
  //#region src/deps.ts
47744
47799
  const NO_IDENTITY = async () => void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/mcp",
3
- "version": "4.2.0-rc.4",
3
+ "version": "4.2.0-rc.6",
4
4
  "private": false,
5
5
  "description": "Capxul MCP server for auth, Account readiness, identity, Organizations, relationships, requests, destinations, and testnet funding over Streamable HTTP.",
6
6
  "keywords": [
@@ -50,8 +50,8 @@
50
50
  "typescript": "npm:@typescript/typescript6@6.0.2",
51
51
  "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
52
52
  "vite-plus": "0.3.0",
53
- "@capxul/sdk": "4.2.0-rc.4",
54
53
  "@capxul/config": "0.3.0",
54
+ "@capxul/sdk": "4.2.0-rc.6",
55
55
  "@capxul/typescript-config": "0.0.0"
56
56
  },
57
57
  "scripts": {