@oobe-protocol-labs/synapse-sap-sdk 0.8.0 → 0.9.2

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.
@@ -49,6 +49,7 @@ const discovery_1 = require("../registries/discovery");
49
49
  const x402_1 = require("../registries/x402");
50
50
  const session_1 = require("../registries/session");
51
51
  const builder_1 = require("../registries/builder");
52
+ const metaplex_bridge_1 = require("../registries/metaplex-bridge");
52
53
  // IDL is embedded inside the SDK — no external workspace dependency
53
54
  const synapse_agent_sap_json_1 = __importDefault(require("../idl/synapse_agent_sap.json"));
54
55
  /**
@@ -126,6 +127,7 @@ class SapClient {
126
127
  #discovery;
127
128
  #x402;
128
129
  #session;
130
+ #metaplex;
129
131
  constructor(program) {
130
132
  this.program = program;
131
133
  this.walletPubkey = program.provider.wallet.publicKey;
@@ -464,6 +466,35 @@ class SapClient {
464
466
  get builder() {
465
467
  return new builder_1.AgentBuilder(this.program);
466
468
  }
469
+ /**
470
+ * @name metaplex
471
+ * @description Bridge between SAP and the Metaplex Agent Kit
472
+ * (MPL Core Asset + AgentIdentity plugin). Read-side merges SAP
473
+ * `AgentAccount` with MPL Core asset metadata; write-side composes
474
+ * atomic dual-protocol delegation instructions.
475
+ *
476
+ * Requires the optional peer dependencies
477
+ * `@metaplex-foundation/mpl-core` and
478
+ * `@metaplex-foundation/umi-bundle-defaults`. They are imported lazily
479
+ * the first time a method that needs them is called, so consumers that
480
+ * do not use the bridge incur zero overhead.
481
+ *
482
+ * @returns {MetaplexBridge} The lazily-instantiated `MetaplexBridge` singleton.
483
+ * @category Registries
484
+ * @since v0.9.0
485
+ * @see {@link MetaplexBridge}
486
+ *
487
+ * @example
488
+ * ```ts
489
+ * const profile = await client.metaplex.getUnifiedProfile({
490
+ * wallet: agentWallet,
491
+ * rpcUrl: "https://api.mainnet-beta.solana.com",
492
+ * });
493
+ * ```
494
+ */
495
+ get metaplex() {
496
+ return (this.#metaplex ??= new metaplex_bridge_1.MetaplexBridge(this.program));
497
+ }
467
498
  }
468
499
  exports.SapClient = SapClient;
469
500
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/core/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;;;;AAEH,8CAAiE;AAEjE,4CAA8C;AAC9C,4CAA+C;AAC/C,kDAAqD;AACrD,kDAAqD;AACrD,4CAA+C;AAC/C,4CAA+C;AAC/C,8CAAiD;AACjD,oDAAsD;AACtD,gDAAmD;AACnD,gDAAmD;AACnD,0DAA6D;AAC7D,wDAA2D;AAC3D,8CAAiD;AACjD,sCAAwC;AACxC,6CAAqD;AACrD,uDAA4D;AAC5D,6CAAkD;AAClD,mDAAuD;AACvD,mDAAqD;AAErD,oEAAoE;AACpE,2FAAgD;AAMhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAa,SAAS;IACpB;;;;;;;OAOG;IACM,OAAO,CAAa;IAE7B;;;;;;;;OAQG;IACM,YAAY,CAAY;IAEjC,qDAAqD;IACrD,MAAM,CAAe;IACrB,SAAS,CAAkB;IAC3B,SAAS,CAAkB;IAC3B,MAAM,CAAe;IACrB,MAAM,CAAe;IACrB,OAAO,CAAgB;IACvB,SAAS,CAAkB;IAC3B,QAAQ,CAAiB;IACzB,QAAQ,CAAiB;IACzB,aAAa,CAAsB;IACnC,YAAY,CAAqB;IACjC,OAAO,CAAgB;IACvB,OAAO,CAAe;IAEtB,iDAAiD;IACjD,OAAO,CAAqB;IAE5B,qDAAqD;IACrD,UAAU,CAAqB;IAC/B,KAAK,CAAgB;IACrB,QAAQ,CAAkB;IAE1B,YAAoB,OAAmB;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAI,OAAO,CAAC,QAA2B,CAAC,MAAM,CAAC,SAAS,CAAC;IAC5E,CAAC;IAED,gDAAgD;IACh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AI;QACN,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,mBAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,OAAO;QACT,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,wBAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,sBAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,IAAI,QAAQ;QACV,OAAO,CAAC,IAAI,CAAC,SAAS,KAAK,IAAI,gCAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF;AAxbD,8BAwbC"}
package/dist/cjs/index.js CHANGED
@@ -47,7 +47,7 @@
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
48
  exports.deriveSubscription = exports.deriveStake = exports.deriveDispute = exports.derivePendingSettlement = exports.deriveEscrowV2 = exports.deriveEscrow = exports.deriveTool = exports.deriveCheckpoint = exports.deriveVaultDelegate = exports.deriveEpochPage = exports.deriveSession = exports.deriveVault = exports.deriveToolCategoryIndex = exports.deriveProtocolIndex = exports.deriveCapabilityIndex = exports.deriveFeedback = exports.deriveAgentStats = exports.deriveAgent = exports.deriveGlobalRegistry = exports.IDL_METADATA = exports.IDL_PROGRAM_ADDRESS = exports.SAP_IDL = exports.SapNetwork = exports.HTTP_METHOD_VALUES = exports.TOOL_CATEGORY_VALUES = exports.VAULT_PROTOCOL_VERSION = exports.AGENT_VERSION = exports.LIMITS = exports.SEEDS = exports.LOCALNET_SAP_PROGRAM_ID = exports.DEVNET_SAP_PROGRAM_ID = exports.MAINNET_SAP_PROGRAM_ID = exports.SAP_PROGRAM_ID = exports.SAP_PROGRAM_ADDRESS = exports.ResolutionLayer = exports.DisputeType = exports.BillingInterval = exports.DisputeOutcome = exports.SettlementSecurity = exports.CompressionType = exports.SchemaType = exports.DelegatePermission = exports.ToolCategory = exports.ToolHttpMethod = exports.SettlementMode = exports.PluginType = exports.TokenType = exports.KeypairWallet = exports.SapConnection = exports.SapClient = void 0;
49
49
  exports.SapError = exports.getX402DirectPayments = exports.parseX402Headers = exports.SapMerchantValidator = exports.MissingEscrowAtaError = exports.toAccountMetas = exports.attachSplAccounts = exports.validateEscrowState = exports.DEFAULT_BATCH_SETTLE_COMPUTE_UNITS = exports.DEFAULT_SETTLE_COMPUTE_UNITS = exports.DEFAULT_SETTLE_PRIORITY_FEE = exports.FAST_BATCH_SETTLE_OPTIONS = exports.FAST_SETTLE_OPTIONS = exports.buildRpcOptions = exports.buildPriorityFeeIxs = exports.validateOrThrow = exports.createCallArgsSchema = exports.createRegisterAgentSchema = exports.createPreparePaymentSchema = exports.createAgentManifestSchema = exports.createToolManifestEntrySchema = exports.createHealthCheckSchema = exports.createEndpointDescriptorSchema = exports.createEnvSchema = exports.extractAnchorErrorCode = exports.classifyAnchorError = exports.findATA = exports.createDualConnection = exports.getFallbackRpcUrl = exports.getRpcUrl = exports.validateAgentEndpoints = exports.validateHealthCheck = exports.validateEndpointDescriptor = exports.validateEndpoint = exports.isKnownNetwork = exports.getNetworkClusterName = exports.getNetworkGenesisHash = exports.isNetworkEquivalent = exports.normalizeNetworkId = exports.serializeValue = exports.serializeAccount = exports.assert = exports.hashToArray = exports.sha256 = exports.deriveReceiptBatch = exports.deriveLedgerPage = exports.deriveLedger = exports.deriveAttestation = exports.deriveIndexPage = exports.deriveShard = void 0;
50
- exports.AgentBuilder = exports.SessionManager = exports.X402Registry = exports.DiscoveryRegistry = exports.TransactionParser = exports.extractAccountKeys = exports.filterSapInnerInstructions = exports.decodeInnerInstructions = exports.parseSapTransactionBatch = exports.parseSapTransactionComplete = exports.containsSapInstruction = exports.parseSapInstructionNamesFromList = exports.parseSapInstructionsFromList = exports.parseSapInstructionNamesFromTransaction = exports.parseSapInstructionsFromTransaction = exports.SAP_TABLE_MAP = exports.SapSyncEngine = exports.SapPostgres = exports.SAP_PROTOCOLS = exports.SAPPlugin = exports.createSAPPlugin = exports.BaseModule = exports.LedgerModule = exports.AttestationModule = exports.SubscriptionModule = exports.StakingModule = exports.ReceiptModule = exports.EscrowV2Module = exports.EscrowModule = exports.VaultModule = exports.ToolsModule = exports.IndexingModule = exports.FeedbackModule = exports.AgentModule = exports.GeyserEventStream = exports.SAP_EVENT_NAMES = exports.EventParser = exports.SapPermissionError = exports.SapTimeoutError = exports.SapAccountNotFoundError = exports.SapRpcError = exports.SapValidationError = void 0;
50
+ exports.MetaplexBridge = exports.AgentBuilder = exports.SessionManager = exports.X402Registry = exports.DiscoveryRegistry = exports.TransactionParser = exports.extractAccountKeys = exports.filterSapInnerInstructions = exports.decodeInnerInstructions = exports.parseSapTransactionBatch = exports.parseSapTransactionComplete = exports.containsSapInstruction = exports.parseSapInstructionNamesFromList = exports.parseSapInstructionsFromList = exports.parseSapInstructionNamesFromTransaction = exports.parseSapInstructionsFromTransaction = exports.SAP_TABLE_MAP = exports.SapSyncEngine = exports.SapPostgres = exports.SAP_PROTOCOLS = exports.SAPPlugin = exports.createSAPPlugin = exports.BaseModule = exports.LedgerModule = exports.AttestationModule = exports.SubscriptionModule = exports.StakingModule = exports.ReceiptModule = exports.EscrowV2Module = exports.EscrowModule = exports.VaultModule = exports.ToolsModule = exports.IndexingModule = exports.FeedbackModule = exports.AgentModule = exports.GeyserEventStream = exports.SAP_EVENT_NAMES = exports.EventParser = exports.SapPermissionError = exports.SapTimeoutError = exports.SapAccountNotFoundError = exports.SapRpcError = exports.SapValidationError = void 0;
51
51
  // ── Core ─────────────────────────────────────────────
52
52
  var core_1 = require("./core");
53
53
  Object.defineProperty(exports, "SapClient", { enumerable: true, get: function () { return core_1.SapClient; } });
@@ -231,4 +231,5 @@ Object.defineProperty(exports, "DiscoveryRegistry", { enumerable: true, get: fun
231
231
  Object.defineProperty(exports, "X402Registry", { enumerable: true, get: function () { return index_4.X402Registry; } });
232
232
  Object.defineProperty(exports, "SessionManager", { enumerable: true, get: function () { return index_4.SessionManager; } });
233
233
  Object.defineProperty(exports, "AgentBuilder", { enumerable: true, get: function () { return index_4.AgentBuilder; } });
234
+ Object.defineProperty(exports, "MetaplexBridge", { enumerable: true, get: function () { return index_4.MetaplexBridge; } });
234
235
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;;;;;AAEH,wDAAwD;AACxD,+BAAiE;AAAxD,iGAAA,SAAS,OAAA;AAAE,qGAAA,aAAa,OAAA;AAAE,qGAAA,aAAa,OAAA;AA2EhD,iCAciB;AAbf,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,2GAAA,kBAAkB,OAAA;AAClB,mGAAA,UAAU,OAAA;AACV,wGAAA,eAAe,OAAA;AACf,2GAAA,kBAAkB,OAAA;AAClB,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,oGAAA,WAAW,OAAA;AACX,wGAAA,eAAe,OAAA;AAGjB,wDAAwD;AACxD,yCAaqB;AAZnB,gHAAA,mBAAmB,OAAA;AACnB,2GAAA,cAAc,OAAA;AACd,mHAAA,sBAAsB,OAAA;AACtB,kHAAA,qBAAqB,OAAA;AACrB,oHAAA,uBAAuB,OAAA;AACvB,kGAAA,KAAK,OAAA;AACL,mGAAA,MAAM,OAAA;AACN,0GAAA,aAAa,OAAA;AACb,mHAAA,sBAAsB,OAAA;AACtB,iHAAA,oBAAoB,OAAA;AACpB,+GAAA,kBAAkB,OAAA;AAClB,uGAAA,U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CAA4D;AAAnD,wGAAA,eAAe,OAAA;AAAE,kGAAA,SAAS,OAAA;AAYnC,gDAAmD;AAA1C,0GAAA,aAAa,OAAA;AAEtB,4DAA4D;AAC5D,uCAAuE;AAA9D,uGAAA,WAAW,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,yGAAA,aAAa,OAAA;AAelD,0DAA0D;AAC1D,mCAYkB;AAXhB,6HAAA,mCAAmC,OAAA;AACnC,iIAAA,uCAAuC,OAAA;AACvC,sHAAA,4BAA4B,OAAA;AAC5B,0HAAA,gCAAgC,OAAA;AAChC,gHAAA,sBAAsB,OAAA;AACtB,qHAAA,2BAA2B,OAAA;AAC3B,kHAAA,wBAAwB,OAAA;AACxB,iHAAA,uBAAuB,OAAA;AACvB,oHAAA,0BAA0B,OAAA;AAC1B,4GAAA,kBAAkB,OAAA;AAClB,2GAAA,iBAAiB,OAAA;AAYnB,yDAAyD;AACzD,4CAM4B;AAL1B,0GAAA,iBAAiB,OAAA;AACjB,qGAAA,YAAY,OAAA;AACZ,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,uGAAA,cAAc,OAAA"}
@@ -39,7 +39,7 @@
39
39
  * @see {@link AgentBuilder}
40
40
  */
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.AgentBuilder = exports.SessionManager = exports.X402Registry = exports.DiscoveryRegistry = void 0;
42
+ exports.MetaplexBridge = exports.AgentBuilder = exports.SessionManager = exports.X402Registry = exports.DiscoveryRegistry = void 0;
43
43
  var discovery_1 = require("./discovery");
44
44
  Object.defineProperty(exports, "DiscoveryRegistry", { enumerable: true, get: function () { return discovery_1.DiscoveryRegistry; } });
45
45
  var x402_1 = require("./x402");
@@ -48,4 +48,6 @@ var session_1 = require("./session");
48
48
  Object.defineProperty(exports, "SessionManager", { enumerable: true, get: function () { return session_1.SessionManager; } });
49
49
  var builder_1 = require("./builder");
50
50
  Object.defineProperty(exports, "AgentBuilder", { enumerable: true, get: function () { return builder_1.AgentBuilder; } });
51
+ var metaplex_bridge_1 = require("./metaplex-bridge");
52
+ Object.defineProperty(exports, "MetaplexBridge", { enumerable: true, get: function () { return metaplex_bridge_1.MetaplexBridge; } });
51
53
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/registries/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;;;AAEH,yCAAgD;AAAvC,8GAAA,iBAAiB,OAAA;AAS1B,+BAAsC;AAA7B,oGAAA,YAAY,OAAA;AAYrB,qCAA2C;AAAlC,yGAAA,cAAc,OAAA;AASvB,qCAAyC;AAAhC,uGAAA,YAAY,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/registries/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;;;AAEH,yCAAgD;AAAvC,8GAAA,iBAAiB,OAAA;AAS1B,+BAAsC;AAA7B,oGAAA,YAAY,OAAA;AAYrB,qCAA2C;AAAlC,yGAAA,cAAc,OAAA;AASvB,qCAAyC;AAAhC,uGAAA,YAAY,OAAA;AASrB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
@@ -0,0 +1,513 @@
1
+ "use strict";
2
+ /**
3
+ * @module registries/metaplex-bridge
4
+ * @description Bridge between Synapse Agent Protocol (SAP) and Metaplex
5
+ * Core's `AgentIdentity` external plugin adapter (mpl-core ≥ 1.9.0).
6
+ *
7
+ * ## Why this design (verified against mpl-core PR #258, v1.9.0)
8
+ *
9
+ * The MPL Core `AgentIdentity` plugin has exactly one field:
10
+ *
11
+ * ```ts
12
+ * type AgentIdentity = { uri: string };
13
+ * ```
14
+ *
15
+ * The URI must point to an **EIP-8004** agent registration JSON. There is
16
+ * no on-chain executive list, no `addExecutive` / `delegateExecutionV1`
17
+ * instruction. Capabilities, services, executives, and reputation live
18
+ * off-chain in that JSON. The plugin only hooks the `Execute` lifecycle
19
+ * event, allowing the URI's authority to gate execution.
20
+ *
21
+ * The most efficient SAP × MPL integration therefore is:
22
+ *
23
+ * 1. SAP serves a **live EIP-8004 JSON** at a deterministic URL derived
24
+ * from the SAP `AgentAccount` PDA (e.g.
25
+ * `https://explorer.oobeprotocol.ai/agents/<sapAgentPda>/eip-8004.json`).
26
+ * 2. The MPL Core asset attaches an `AgentIdentity` adapter whose `uri`
27
+ * points to that URL.
28
+ * 3. Every SAP write (capability change, vault delegate add/revoke, x402
29
+ * tier update) is reflected in the JSON automatically — **no second
30
+ * transaction required, on either chain or for any wallet.**
31
+ *
32
+ * One SAP transaction = both protocols updated. That is the efficiency
33
+ * win that motivated the Phase 1 redesign on 2026-04-22.
34
+ *
35
+ * @category Registries
36
+ * @since v0.9.0
37
+ * @see https://github.com/metaplex-foundation/mpl-core/pull/258
38
+ * @see https://eips.ethereum.org/EIPS/eip-8004
39
+ */
40
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
41
+ if (k2 === undefined) k2 = k;
42
+ var desc = Object.getOwnPropertyDescriptor(m, k);
43
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
44
+ desc = { enumerable: true, get: function() { return m[k]; } };
45
+ }
46
+ Object.defineProperty(o, k2, desc);
47
+ }) : (function(o, m, k, k2) {
48
+ if (k2 === undefined) k2 = k;
49
+ o[k2] = m[k];
50
+ }));
51
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
52
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
53
+ }) : function(o, v) {
54
+ o["default"] = v;
55
+ });
56
+ var __importStar = (this && this.__importStar) || (function () {
57
+ var ownKeys = function(o) {
58
+ ownKeys = Object.getOwnPropertyNames || function (o) {
59
+ var ar = [];
60
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
61
+ return ar;
62
+ };
63
+ return ownKeys(o);
64
+ };
65
+ return function (mod) {
66
+ if (mod && mod.__esModule) return mod;
67
+ var result = {};
68
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
69
+ __setModuleDefault(result, mod);
70
+ return result;
71
+ };
72
+ })();
73
+ Object.defineProperty(exports, "__esModule", { value: true });
74
+ exports.MetaplexBridge = void 0;
75
+ const web3_js_1 = require("@solana/web3.js");
76
+ const pda_1 = require("../pda");
77
+ // ═══════════════════════════════════════════════════════════════════
78
+ // Lazy peer-dep loader
79
+ // ═══════════════════════════════════════════════════════════════════
80
+ const PEER_DEP_INSTALL_HINT = "MetaplexBridge requires @metaplex-foundation/mpl-core (>=1.9.0) and " +
81
+ "@metaplex-foundation/umi-bundle-defaults. " +
82
+ "Install: npm i @metaplex-foundation/mpl-core @metaplex-foundation/umi-bundle-defaults";
83
+ let cachedRuntime = null;
84
+ async function loadMplCore() {
85
+ if (cachedRuntime)
86
+ return cachedRuntime;
87
+ try {
88
+ const [mplCore, umiBundle, umiCore] = await Promise.all([
89
+ Promise.resolve().then(() => __importStar(require("@metaplex-foundation/mpl-core"))),
90
+ Promise.resolve().then(() => __importStar(require("@metaplex-foundation/umi-bundle-defaults"))),
91
+ Promise.resolve().then(() => __importStar(require("@metaplex-foundation/umi"))),
92
+ ]);
93
+ cachedRuntime = { mplCore, umiBundle, umiCore };
94
+ return cachedRuntime;
95
+ }
96
+ catch (cause) {
97
+ throw new Error(PEER_DEP_INSTALL_HINT, { cause: cause });
98
+ }
99
+ }
100
+ // ═══════════════════════════════════════════════════════════════════
101
+ // MetaplexBridge
102
+ // ═══════════════════════════════════════════════════════════════════
103
+ /**
104
+ * @name MetaplexBridge
105
+ * @description Read-side merger and write-side instruction composer for
106
+ * SAP × Metaplex Core `AgentIdentity` integration.
107
+ *
108
+ * Linking is **single-transaction**: the MPL `addExternalPluginAdapterV1`
109
+ * instruction sets a URI that points at SAP's live registration host.
110
+ * Subsequent SAP state changes propagate automatically — no extra MPL
111
+ * transaction required.
112
+ *
113
+ * @category Registries
114
+ * @since v0.9.0
115
+ */
116
+ class MetaplexBridge {
117
+ program;
118
+ constructor(program) {
119
+ this.program = program;
120
+ }
121
+ // ─────────────────────────────────────────────────────
122
+ // Pure helpers
123
+ // ─────────────────────────────────────────────────────
124
+ /**
125
+ * @name deriveRegistrationUrl
126
+ * @description Compute the deterministic EIP-8004 registration URL for
127
+ * a SAP agent. Hosts MUST serve the JSON at exactly this path so that
128
+ * {@link MetaplexBridge.verifyLink} validates without external config.
129
+ *
130
+ * @since v0.9.0
131
+ */
132
+ deriveRegistrationUrl(sapAgentPda, baseUrl) {
133
+ const trimmed = baseUrl.replace(/\/+$/, "");
134
+ return `${trimmed}/agents/${sapAgentPda.toBase58()}/eip-8004.json`;
135
+ }
136
+ /**
137
+ * @name buildEip8004Registration
138
+ * @description Build a canonical EIP-8004 JSON document for a SAP agent.
139
+ * Designed to be called server-side by a registry host.
140
+ *
141
+ * @since v0.9.0
142
+ */
143
+ async buildEip8004Registration(args) {
144
+ const [sapPda] = (0, pda_1.deriveAgent)(args.sapAgentOwner);
145
+ const identity = await this.fetchAgentNullable(sapPda);
146
+ if (!identity) {
147
+ throw new Error(`buildEip8004Registration: SAP agent not found for owner ${args.sapAgentOwner.toBase58()}`);
148
+ }
149
+ const delegates = await this.fetchActiveVaultDelegates(sapPda);
150
+ return {
151
+ version: "0.1",
152
+ name: this.readString(identity, "name") ?? "Synapse Agent",
153
+ description: this.readString(identity, "description") ?? undefined,
154
+ synapseAgent: sapPda.toBase58(),
155
+ authority: args.sapAgentOwner.toBase58(),
156
+ capabilities: this.readCapabilities(identity),
157
+ services: args.services ?? [],
158
+ executives: delegates,
159
+ updatedAt: new Date().toISOString(),
160
+ extra: args.extra,
161
+ };
162
+ }
163
+ // ─────────────────────────────────────────────────────
164
+ // Write side — build MPL instructions only
165
+ // ─────────────────────────────────────────────────────
166
+ /**
167
+ * @name buildAttachAgentIdentityIx
168
+ * @description Build the MPL Core `addExternalPluginAdapterV1`
169
+ * `TransactionInstruction` that attaches an `AgentIdentity` plugin
170
+ * pointing at SAP's live EIP-8004 registration URL.
171
+ *
172
+ * @since v0.9.0
173
+ */
174
+ async buildAttachAgentIdentityIx(opts) {
175
+ const [sapPda] = (0, pda_1.deriveAgent)(opts.sapAgentOwner);
176
+ const uri = this.deriveRegistrationUrl(sapPda, opts.registrationBaseUrl);
177
+ return this.buildAddExternalPluginIx({
178
+ asset: opts.asset,
179
+ authority: opts.authority,
180
+ payer: opts.payer ?? opts.authority,
181
+ uri,
182
+ rpcUrl: opts.rpcUrl,
183
+ });
184
+ }
185
+ /**
186
+ * @name buildUpdateAgentIdentityUriIx
187
+ * @description Build the MPL Core `updateExternalPluginAdapterV1`
188
+ * instruction that re-points an existing `AgentIdentity` plugin.
189
+ *
190
+ * @since v0.9.0
191
+ */
192
+ async buildUpdateAgentIdentityUriIx(opts) {
193
+ const { mplCore, umiBundle, umiCore } = await loadMplCore();
194
+ const umi = umiBundle.createUmi(opts.rpcUrl).use(mplCore.mplCore());
195
+ const authority = umiCore.createNoopSigner(umiCore.publicKey(opts.authority.toBase58()));
196
+ const payer = umiCore.createNoopSigner(umiCore.publicKey((opts.payer ?? opts.authority).toBase58()));
197
+ const builder = mplCore.updateExternalPluginAdapterV1(umi, {
198
+ asset: umiCore.publicKey(opts.asset.toBase58()),
199
+ authority,
200
+ payer,
201
+ key: { __kind: "AgentIdentity" },
202
+ updateInfo: {
203
+ __kind: "AgentIdentity",
204
+ fields: [
205
+ {
206
+ uri: opts.newUri,
207
+ lifecycleChecks: null,
208
+ },
209
+ ],
210
+ },
211
+ });
212
+ return this.firstWeb3Ix(builder, "updateExternalPluginAdapterV1");
213
+ }
214
+ // ─────────────────────────────────────────────────────
215
+ // Read side
216
+ // ─────────────────────────────────────────────────────
217
+ /**
218
+ * @name getUnifiedProfile
219
+ * @description Fetch a merged view of an agent across SAP and Metaplex.
220
+ * Provide `wallet` (SAP-first) or `asset` (MPL-first), or both.
221
+ *
222
+ * @since v0.9.0
223
+ */
224
+ async getUnifiedProfile(input) {
225
+ if (!input.wallet && !input.asset) {
226
+ throw new Error("getUnifiedProfile: provide `wallet` or `asset`");
227
+ }
228
+ let sapPda = null;
229
+ let identity = null;
230
+ let stats = null;
231
+ if (input.wallet) {
232
+ [sapPda] = (0, pda_1.deriveAgent)(input.wallet);
233
+ identity = await this.fetchAgentNullable(sapPda);
234
+ stats = await this.fetchStatsNullable(sapPda);
235
+ }
236
+ let mpl = null;
237
+ if (input.asset) {
238
+ mpl = await this.fetchMplSnapshot(input.asset, input.rpcUrl);
239
+ if (!sapPda && mpl?.registration?.synapseAgent) {
240
+ try {
241
+ sapPda = new web3_js_1.PublicKey(mpl.registration.synapseAgent);
242
+ identity = await this.fetchAgentNullable(sapPda);
243
+ stats = await this.fetchStatsNullable(sapPda);
244
+ }
245
+ catch {
246
+ /* invalid PDA in JSON */
247
+ }
248
+ }
249
+ }
250
+ if (!sapPda) {
251
+ throw new Error("getUnifiedProfile: failed to resolve SAP agent PDA");
252
+ }
253
+ return {
254
+ sap: { pda: sapPda, identity, stats },
255
+ mpl,
256
+ linked: this.detectLink(sapPda, mpl),
257
+ };
258
+ }
259
+ /**
260
+ * @name resolveAgentIdentifier
261
+ * @description Resolve a generic agent identifier to canonical SAP routing
262
+ * keys. Useful when callers may receive either owner wallets or Metaplex
263
+ * Core asset IDs (e.g. metaplex.com/agents/<core-asset-id>).
264
+ *
265
+ * Resolution order:
266
+ * 1) Treat input as wallet and check if a SAP agent exists.
267
+ * 2) If not found, treat input as MPL Core asset and resolve owner wallet.
268
+ *
269
+ * @since v0.9.2
270
+ */
271
+ async resolveAgentIdentifier(input) {
272
+ let asPubkey;
273
+ try {
274
+ asPubkey = new web3_js_1.PublicKey(input.identifier);
275
+ }
276
+ catch {
277
+ return {
278
+ input: input.identifier,
279
+ kind: "unknown",
280
+ wallet: null,
281
+ sapAgentPda: null,
282
+ asset: null,
283
+ hasSapAgent: false,
284
+ error: "Invalid public key",
285
+ };
286
+ }
287
+ // 1) Wallet-first resolution (SAP-native)
288
+ const [walletSapPda] = (0, pda_1.deriveAgent)(asPubkey);
289
+ const walletIdentity = await this.fetchAgentNullable(walletSapPda);
290
+ if (walletIdentity) {
291
+ return {
292
+ input: input.identifier,
293
+ kind: "wallet",
294
+ wallet: asPubkey,
295
+ sapAgentPda: walletSapPda,
296
+ asset: null,
297
+ hasSapAgent: true,
298
+ error: null,
299
+ };
300
+ }
301
+ // 2) MPL Core asset resolution
302
+ const mpl = await this.fetchMplSnapshot(asPubkey, input.rpcUrl);
303
+ if (!mpl) {
304
+ return {
305
+ input: input.identifier,
306
+ kind: "unknown",
307
+ wallet: null,
308
+ sapAgentPda: null,
309
+ asset: null,
310
+ hasSapAgent: false,
311
+ error: "Not a SAP wallet and not a readable MPL Core asset",
312
+ };
313
+ }
314
+ const [sapPdaFromOwner] = (0, pda_1.deriveAgent)(mpl.owner);
315
+ const ownerIdentity = await this.fetchAgentNullable(sapPdaFromOwner);
316
+ return {
317
+ input: input.identifier,
318
+ kind: "core-asset",
319
+ wallet: mpl.owner,
320
+ sapAgentPda: sapPdaFromOwner,
321
+ asset: asPubkey,
322
+ hasSapAgent: !!ownerIdentity,
323
+ error: ownerIdentity ? null : "Core asset owner has no SAP agent profile",
324
+ };
325
+ }
326
+ /**
327
+ * @name verifyLink
328
+ * @description Verify the bidirectional link between an MPL Core asset
329
+ * and a SAP agent. Returns `true` only when both URL and JSON sides
330
+ * reference the SAP agent PDA.
331
+ *
332
+ * @since v0.9.0
333
+ */
334
+ async verifyLink(args) {
335
+ const snap = await this.fetchMplSnapshot(args.asset, args.rpcUrl);
336
+ if (!snap?.agentIdentityUri || !snap.registration)
337
+ return false;
338
+ const expectedSuffix = `/agents/${args.sapAgentPda.toBase58()}/eip-8004.json`;
339
+ if (!snap.agentIdentityUri.endsWith(expectedSuffix))
340
+ return false;
341
+ return snap.registration.synapseAgent === args.sapAgentPda.toBase58();
342
+ }
343
+ // ═════════════════════════════════════════════════════
344
+ // Private — SAP fetching
345
+ // ═════════════════════════════════════════════════════
346
+ get accounts() {
347
+ return this.program.account;
348
+ }
349
+ async fetchAgentNullable(pda) {
350
+ try {
351
+ return await this.accounts.agentAccount.fetch(pda);
352
+ }
353
+ catch {
354
+ return null;
355
+ }
356
+ }
357
+ async fetchStatsNullable(agentPda) {
358
+ try {
359
+ const [statsPda] = (0, pda_1.deriveAgentStats)(agentPda);
360
+ return await this.accounts.agentStats.fetch(statsPda);
361
+ }
362
+ catch {
363
+ return null;
364
+ }
365
+ }
366
+ async fetchActiveVaultDelegates(agentPda) {
367
+ try {
368
+ const [vaultPda] = (0, pda_1.deriveVault)(agentPda);
369
+ // VaultDelegate layout: [discriminator(8) | bump(1) | vault(32) | ...]
370
+ const all = await this.accounts.vaultDelegate.all([
371
+ { memcmp: { offset: 8 + 1, bytes: vaultPda.toBase58() } },
372
+ ]);
373
+ const now = Math.floor(Date.now() / 1000);
374
+ return all
375
+ .map(({ account }) => {
376
+ const expiresRaw = account.expiresAt.toString();
377
+ const expiresAt = expiresRaw === "0" ? null : expiresRaw;
378
+ return { wallet: account.delegate.toBase58(), expiresAt };
379
+ })
380
+ .filter((d) => d.expiresAt === null || Number(d.expiresAt) > now);
381
+ }
382
+ catch {
383
+ return [];
384
+ }
385
+ }
386
+ // ═════════════════════════════════════════════════════
387
+ // Private — MPL fetching
388
+ // ═════════════════════════════════════════════════════
389
+ async fetchMplSnapshot(asset, rpcUrl) {
390
+ const { mplCore, umiBundle, umiCore } = await loadMplCore();
391
+ const umi = umiBundle.createUmi(rpcUrl).use(mplCore.mplCore());
392
+ try {
393
+ const fetched = await mplCore.fetchAsset(umi, umiCore.publicKey(asset.toBase58()));
394
+ const owner = new web3_js_1.PublicKey(fetched.owner.toString());
395
+ const uri = this.extractAgentIdentityUri(fetched);
396
+ const registration = uri ? await this.fetchEip8004Safe(uri) : null;
397
+ return {
398
+ asset,
399
+ owner,
400
+ name: fetched.name ?? null,
401
+ agentIdentityUri: uri,
402
+ registration,
403
+ };
404
+ }
405
+ catch {
406
+ return null;
407
+ }
408
+ }
409
+ extractAgentIdentityUri(asset) {
410
+ const adapters = asset.agentIdentities;
411
+ if (!adapters || adapters.length === 0)
412
+ return null;
413
+ const first = adapters[0];
414
+ if (!first)
415
+ return null;
416
+ return typeof first.uri === "string" ? first.uri : null;
417
+ }
418
+ async fetchEip8004Safe(uri) {
419
+ try {
420
+ const res = await fetch(uri, { method: "GET" });
421
+ if (!res.ok)
422
+ return null;
423
+ const json = (await res.json());
424
+ if (typeof json.synapseAgent !== "string" ||
425
+ typeof json.authority !== "string") {
426
+ return null;
427
+ }
428
+ return {
429
+ version: json.version ?? "0.1",
430
+ name: json.name ?? "",
431
+ description: json.description,
432
+ synapseAgent: json.synapseAgent,
433
+ authority: json.authority,
434
+ capabilities: Array.isArray(json.capabilities) ? json.capabilities : [],
435
+ services: Array.isArray(json.services) ? json.services : [],
436
+ executives: Array.isArray(json.executives) ? json.executives : [],
437
+ updatedAt: json.updatedAt ?? "",
438
+ extra: json.extra,
439
+ };
440
+ }
441
+ catch {
442
+ return null;
443
+ }
444
+ }
445
+ // ═════════════════════════════════════════════════════
446
+ // Private — MPL instruction building
447
+ // ═════════════════════════════════════════════════════
448
+ async buildAddExternalPluginIx(args) {
449
+ const { mplCore, umiBundle, umiCore } = await loadMplCore();
450
+ const umi = umiBundle.createUmi(args.rpcUrl).use(mplCore.mplCore());
451
+ const authority = umiCore.createNoopSigner(umiCore.publicKey(args.authority.toBase58()));
452
+ const payer = umiCore.createNoopSigner(umiCore.publicKey(args.payer.toBase58()));
453
+ // HookableLifecycleEvent.Execute = 4; ExternalCheckResult { flags: 1 } = CanApprove
454
+ const ExecuteEvent = mplCore.HookableLifecycleEvent.Execute;
455
+ const builder = mplCore.addExternalPluginAdapterV1(umi, {
456
+ asset: umiCore.publicKey(args.asset.toBase58()),
457
+ authority,
458
+ payer,
459
+ initInfo: {
460
+ __kind: "AgentIdentity",
461
+ fields: [
462
+ {
463
+ uri: args.uri,
464
+ initPluginAuthority: { __kind: "UpdateAuthority" },
465
+ lifecycleChecks: [[ExecuteEvent, { flags: 1 }]],
466
+ },
467
+ ],
468
+ },
469
+ });
470
+ return this.firstWeb3Ix(builder, "addExternalPluginAdapterV1");
471
+ }
472
+ async firstWeb3Ix(builder, name) {
473
+ const items = builder.getInstructions();
474
+ const first = items[0];
475
+ if (!first) {
476
+ throw new Error(`MetaplexBridge: ${name} produced no instructions`);
477
+ }
478
+ return this.umiIxToWeb3(first);
479
+ }
480
+ umiIxToWeb3(ix) {
481
+ return {
482
+ programId: new web3_js_1.PublicKey(ix.programId.toString()),
483
+ keys: ix.keys.map((k) => ({
484
+ pubkey: new web3_js_1.PublicKey(k.pubkey.toString()),
485
+ isSigner: k.isSigner,
486
+ isWritable: k.isWritable,
487
+ })),
488
+ data: Buffer.from(ix.data),
489
+ };
490
+ }
491
+ // ═════════════════════════════════════════════════════
492
+ // Private — link detection + duck-typed readers
493
+ // ═════════════════════════════════════════════════════
494
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
495
+ detectLink(sapPda, mpl) {
496
+ if (!mpl?.agentIdentityUri || !mpl.registration)
497
+ return false;
498
+ const expectedSuffix = `/agents/${sapPda.toBase58()}/eip-8004.json`;
499
+ if (!mpl.agentIdentityUri.endsWith(expectedSuffix))
500
+ return false;
501
+ return mpl.registration.synapseAgent === sapPda.toBase58();
502
+ }
503
+ readString(identity, key) {
504
+ const value = identity[key];
505
+ return typeof value === "string" ? value : null;
506
+ }
507
+ readCapabilities(identity) {
508
+ const caps = identity.capabilities ?? [];
509
+ return caps.map((c) => c.id).filter((s) => typeof s === "string");
510
+ }
511
+ }
512
+ exports.MetaplexBridge = MetaplexBridge;
513
+ //# sourceMappingURL=metaplex-bridge.js.map