@t2000/id 10.30.5 → 10.31.1

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/README.md CHANGED
@@ -29,9 +29,7 @@ const tx = buildRegisterTx({
29
29
  |---|---|---|
30
30
  | `buildRegisterTx(reg?)` | `register` | the agent |
31
31
  | `buildUpdateTx(reg?)` | `update` (full-replace) | the agent |
32
- | `buildSetPendingOwnerTx(owner)` | `set_pending_owner` | the agent |
33
- | `buildConfirmOwnershipTx(agent)` | `confirm_ownership` | the proposed owner |
34
- | `buildSetActiveTx(agent, active)` | `set_active` | the agent or its owner |
32
+ | `buildSetActiveTx(agent, active)` | `set_active` | the agent |
35
33
 
36
34
  Package + Registry object ids are baked in (mainnet) and overridable via `AGENT_ID_PACKAGE_ID` / `AGENT_ID_REGISTRY_ID` env vars for testnet/dev.
37
35
 
package/dist/index.cjs CHANGED
@@ -6,7 +6,7 @@ var transactions = require('@mysten/sui/transactions');
6
6
  var utils = require('@mysten/sui/utils');
7
7
 
8
8
  // src/index.ts
9
- var AGENT_ID_PACKAGE_ID = process.env.AGENT_ID_PACKAGE_ID ?? "0x78d365066fb0e6468a9dcb49595e559434a53d7a12d845f776bcda76b4d15451";
9
+ var AGENT_ID_PACKAGE_ID = process.env.AGENT_ID_PACKAGE_ID ?? "0xe94a8b8f14104b75ee4c7e359289da78698fbfffdd0e5e3e9cb7d250887df7a7";
10
10
  var AGENT_ID_REGISTRY_ID = process.env.AGENT_ID_REGISTRY_ID ?? "0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119";
11
11
  var CLOCK_ID = "0x6";
12
12
  var MODULE = "registry";
@@ -36,42 +36,6 @@ function buildUpdateTx(reg = {}) {
36
36
  });
37
37
  return tx;
38
38
  }
39
- function buildSetPendingOwnerTx(owner) {
40
- const tx = new transactions.Transaction();
41
- tx.moveCall({
42
- target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_pending_owner`,
43
- arguments: [
44
- tx.object(AGENT_ID_REGISTRY_ID),
45
- tx.pure.address(owner),
46
- tx.object(CLOCK_ID)
47
- ]
48
- });
49
- return tx;
50
- }
51
- function buildConfirmOwnershipTx(agent) {
52
- const tx = new transactions.Transaction();
53
- tx.moveCall({
54
- target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::confirm_ownership`,
55
- arguments: [
56
- tx.object(AGENT_ID_REGISTRY_ID),
57
- tx.pure.address(agent),
58
- tx.object(CLOCK_ID)
59
- ]
60
- });
61
- return tx;
62
- }
63
- function buildRenounceOwnershipTx(agent) {
64
- const tx = new transactions.Transaction();
65
- tx.moveCall({
66
- target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::renounce_ownership`,
67
- arguments: [
68
- tx.object(AGENT_ID_REGISTRY_ID),
69
- tx.pure.address(agent),
70
- tx.object(CLOCK_ID)
71
- ]
72
- });
73
- return tx;
74
- }
75
39
  async function getAgentRecord(address, opts = {}) {
76
40
  const network = opts.network ?? "mainnet";
77
41
  const client = opts.client ?? new grpc.SuiGrpcClient({
@@ -116,11 +80,8 @@ function buildSetActiveTx(agent, active) {
116
80
 
117
81
  exports.AGENT_ID_PACKAGE_ID = AGENT_ID_PACKAGE_ID;
118
82
  exports.AGENT_ID_REGISTRY_ID = AGENT_ID_REGISTRY_ID;
119
- exports.buildConfirmOwnershipTx = buildConfirmOwnershipTx;
120
83
  exports.buildRegisterTx = buildRegisterTx;
121
- exports.buildRenounceOwnershipTx = buildRenounceOwnershipTx;
122
84
  exports.buildSetActiveTx = buildSetActiveTx;
123
- exports.buildSetPendingOwnerTx = buildSetPendingOwnerTx;
124
85
  exports.buildUpdateTx = buildUpdateTx;
125
86
  exports.getAgentRecord = getAgentRecord;
126
87
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["Transaction","SuiGrpcClient","deriveDynamicFieldID","bcs"],"mappings":";;;;;;;;AAmBO,IAAM,mBAAA,GACX,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;AAAA,EACT;AACF;AAGO,SAAS,gBAAA,CAAiB,OAAe,MAAA,EAA8B;AAC5E,EAAA,MAAM,EAAA,GAAK,IAAIH,wBAAA,EAAY;AAC3B,EAAA,EAAA,CAAG,QAAA,CAAS;AAAA,IACV,MAAA,EAAQ,CAAA,EAAG,mBAAmB,CAAA,EAAA,EAAK,MAAM,CAAA,YAAA,CAAA;AAAA,IACzC,SAAA,EAAW;AAAA,MACT,EAAA,CAAG,OAAO,oBAAoB,CAAA;AAAA,MAC9B,EAAA,CAAG,IAAA,CAAK,OAAA,CAAQ,KAAK,CAAA;AAAA,MACrB,EAAA,CAAG,IAAA,CAAK,IAAA,CAAK,MAAM,CAAA;AAAA,MACnB,EAAA,CAAG,OAAO,QAAQ;AAAA;AACpB,GACD,CAAA;AACD,EAAA,OAAO,EAAA;AACT","file":"index.cjs","sourcesContent":["import { bcs } from '@mysten/sui/bcs';\nimport { SuiGrpcClient } from '@mysten/sui/grpc';\nimport { Transaction } from '@mysten/sui/transactions';\nimport { deriveDynamicFieldID } from '@mysten/sui/utils';\n\n/**\n * @t2000/id — client for the `agent_id::registry` Move package (Agent ID\n * Phase B). These builders construct UNSIGNED transactions calling the on-chain\n * registry; the caller signs (the agent's keypair for register/update/active;\n * the proposed owner for confirm) and may sponsor gas (the agent is the sender,\n * so `sender == agent` auth holds; a SUI-funded t2000 account co-signs gas).\n *\n * Deployed on Sui mainnet 2026-06-29. Override via env for testnet/dev.\n */\n\n/** The published `agent_id` package id — the LATEST version (v2, the\n * 2026-07-09 additive upgrade that added `renounce_ownership`; the shared\n * Registry object is unchanged). The original v1 package\n * (`0x7669be20…be9a45e9`) remains callable for its own functions. */\nexport const AGENT_ID_PACKAGE_ID =\n process.env.AGENT_ID_PACKAGE_ID ??\n '0x78d365066fb0e6468a9dcb49595e559434a53d7a12d845f776bcda76b4d15451';\n\n/** The shared `Registry` object id. */\nexport const AGENT_ID_REGISTRY_ID =\n process.env.AGENT_ID_REGISTRY_ID ??\n '0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119';\n\nconst CLOCK_ID = '0x6';\nconst MODULE = 'registry';\n\n/** The mutable registration payload. `update` is full-replace — supply the\n * complete desired state (omitted fields clear on-chain). */\nexport interface AgentRegistration {\n mcpEndpoint?: string | null;\n paymentMethods?: string[];\n did?: string | null;\n metadataUri?: string | null;\n}\n\nfunction registrationArgs(tx: Transaction, reg: AgentRegistration) {\n return [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.option('string', reg.mcpEndpoint ?? null),\n tx.pure.vector('string', reg.paymentMethods ?? []),\n tx.pure.option('string', reg.did ?? null),\n tx.pure.option('string', reg.metadataUri ?? null),\n tx.object(CLOCK_ID),\n ];\n}\n\n/** Register the SIGNER as an agent (self-sovereign: `sender == agent`). */\nexport function buildRegisterTx(reg: AgentRegistration = {}): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::register`,\n arguments: registrationArgs(tx, reg),\n });\n return tx;\n}\n\n/** Update the signer's record (full-replace). */\nexport function buildUpdateTx(reg: AgentRegistration = {}): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::update`,\n arguments: registrationArgs(tx, reg),\n });\n return tx;\n}\n\n/** The agent (signer) proposes an owner; nothing binds until the owner confirms. */\nexport function buildSetPendingOwnerTx(owner: string): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_pending_owner`,\n arguments: [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.address(owner),\n tx.object(CLOCK_ID),\n ],\n });\n return tx;\n}\n\n/** The proposed owner (signer) confirms ownership of `agent`. */\nexport function buildConfirmOwnershipTx(agent: string): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::confirm_ownership`,\n arguments: [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.address(agent),\n tx.object(CLOCK_ID),\n ],\n });\n return tx;\n}\n\n/** The confirmed owner (signer) renounces ownership of `agent` — the record\n * returns to autonomous (`owner = none`). Re-linking is the normal two-sided\n * flow (the agent proposes, the owner confirms). Requires package v2+. */\nexport function buildRenounceOwnershipTx(agent: string): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::renounce_ownership`,\n arguments: [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.address(agent),\n tx.object(CLOCK_ID),\n ],\n });\n return tx;\n}\n\n/** An agent's on-chain registry record (registry Table dynamic field),\n * field names as stored by the Move package. */\nexport interface OnChainAgentRecord {\n agent: string;\n mcp_endpoint?: string | null;\n payment_methods?: string[] | null;\n did?: string | null;\n metadata_uri?: string | null;\n}\n\n/**\n * Read one agent's registry record. Returns `null` when the address is not\n * registered. gRPC only (JSON-RPC is deactivated July 31, 2026).\n *\n * Callers that already hold a `SuiGrpcClient` should pass it; otherwise a\n * mainnet client is constructed per call.\n */\nexport async function getAgentRecord(\n address: string,\n opts: { client?: SuiGrpcClient; network?: 'mainnet' | 'testnet' } = {},\n): Promise<OnChainAgentRecord | null> {\n const network = opts.network ?? 'mainnet';\n const client =\n opts.client ??\n new SuiGrpcClient({\n baseUrl:\n network === 'testnet'\n ? 'https://fullnode.testnet.sui.io'\n : 'https://fullnode.mainnet.sui.io',\n network,\n });\n const reg = await client.core.getObject({\n objectId: AGENT_ID_REGISTRY_ID,\n include: { json: true },\n });\n const tableId = (reg.object?.json as { agents?: { id?: string } } | undefined)\n ?.agents?.id;\n if (!tableId) return null;\n const fieldId = deriveDynamicFieldID(\n tableId,\n 'address',\n bcs.Address.serialize(address).toBytes(),\n );\n try {\n const obj = await client.core.getObject({\n objectId: fieldId,\n include: { json: true },\n });\n const rec = (obj.object?.json as { value?: OnChainAgentRecord } | undefined)\n ?.value;\n return rec?.agent ? rec : null;\n } catch {\n // Field object absent → not registered.\n return null;\n }\n}\n\n/** Toggle an agent's active flag (signer must be the agent or its owner). */\nexport function buildSetActiveTx(agent: string, active: boolean): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_active`,\n arguments: [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.address(agent),\n tx.pure.bool(active),\n tx.object(CLOCK_ID),\n ],\n });\n return tx;\n}\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["Transaction","SuiGrpcClient","deriveDynamicFieldID","bcs"],"mappings":";;;;;;;;AA2BO,IAAM,mBAAA,GACX,OAAA,CAAQ,GAAA,CAAI,mBAAA,IACZ;AAGK,IAAM,oBAAA,GACX,OAAA,CAAQ,GAAA,CAAI,oBAAA,IACZ;AAEF,IAAM,QAAA,GAAW,KAAA;AACjB,IAAM,MAAA,GAAS,UAAA;AAWf,SAAS,gBAAA,CAAiB,IAAiB,GAAA,EAAwB;AACjE,EAAA,OAAO;AAAA,IACL,EAAA,CAAG,OAAO,oBAAoB,CAAA;AAAA,IAC9B,GAAG,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,eAAe,IAAI,CAAA;AAAA,IAChD,GAAG,IAAA,CAAK,MAAA,CAAO,UAAU,GAAA,CAAI,cAAA,IAAkB,EAAE,CAAA;AAAA,IACjD,GAAG,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,OAAO,IAAI,CAAA;AAAA,IACxC,GAAG,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,eAAe,IAAI,CAAA;AAAA,IAChD,EAAA,CAAG,OAAO,QAAQ;AAAA,GACpB;AACF;AAGO,SAAS,eAAA,CAAgB,GAAA,GAAyB,EAAC,EAAgB;AACxE,EAAA,MAAM,EAAA,GAAK,IAAIA,wBAAA,EAAY;AAC3B,EAAA,EAAA,CAAG,QAAA,CAAS;AAAA,IACV,MAAA,EAAQ,CAAA,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;AACF,IAAA,MAAM,GAAA,GAAM,MAAM,MAAA,CAAO,IAAA,CAAK,SAAA,CAAU;AAAA,MACtC,QAAA,EAAU,OAAA;AAAA,MACV,OAAA,EAAS,EAAE,IAAA,EAAM,IAAA;AAAK,KACvB,CAAA;AACD,IAAA,MAAM,GAAA,GAAO,GAAA,CAAI,MAAA,EAAQ,IAAA,EACrB,KAAA;AACJ,IAAA,OAAO,GAAA,EAAK,QAAQ,GAAA,GAAM,IAAA;AAAA,EAC5B,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAIO,SAAS,gBAAA,CAAiB,OAAe,MAAA,EAA8B;AAC5E,EAAA,MAAM,EAAA,GAAK,IAAIH,wBAAA,EAAY;AAC3B,EAAA,EAAA,CAAG,QAAA,CAAS;AAAA,IACV,MAAA,EAAQ,CAAA,EAAG,mBAAmB,CAAA,EAAA,EAAK,MAAM,CAAA,YAAA,CAAA;AAAA,IACzC,SAAA,EAAW;AAAA,MACT,EAAA,CAAG,OAAO,oBAAoB,CAAA;AAAA,MAC9B,EAAA,CAAG,IAAA,CAAK,OAAA,CAAQ,KAAK,CAAA;AAAA,MACrB,EAAA,CAAG,IAAA,CAAK,IAAA,CAAK,MAAM,CAAA;AAAA,MACnB,EAAA,CAAG,OAAO,QAAQ;AAAA;AACpB,GACD,CAAA;AACD,EAAA,OAAO,EAAA;AACT","file":"index.cjs","sourcesContent":["import { bcs } from '@mysten/sui/bcs';\nimport { SuiGrpcClient } from '@mysten/sui/grpc';\nimport { Transaction } from '@mysten/sui/transactions';\nimport { deriveDynamicFieldID } from '@mysten/sui/utils';\n\n/**\n * @t2000/id — client for the `agent_id::registry` Move package (Agent ID\n * Phase B). These builders construct UNSIGNED transactions calling the on-chain\n * registry; the caller signs (always the AGENT's keypair — every mutator is\n * agent-signed since S.1032) and may sponsor gas (the agent is the sender,\n * so `sender == agent` auth holds; a SUI-funded t2000 account co-signs gas).\n *\n * Passport↔agent OWNERSHIP left the product (S.1032, 2026-08-13): the\n * link/confirm/renounce builders are gone, and the on-chain mutators\n * always abort (`EOwnershipDeprecated`) once the Registry is migrated.\n * Historical `owner`/`pending_owner` record fields remain on-chain, inert.\n *\n * Deployed on Sui mainnet 2026-06-29. Override via env for testnet/dev.\n */\n\n/** The published `agent_id` package id — pin the LATEST upgrade id ONLY\n * (the S.1019 rule; event/type anchors stay on the original package\n * `0x7669be20…be9a45e9`, which remains callable for its own functions).\n * LATEST = the S.1032 v2 upgrade (2026-08-13, ownership deprecated;\n * Registry migrated to version 2 — upgrade digest 7ZUiRi48…, migrate\n * digest 97sNqgt9…). The previous id `0x78d36506…d15451` now aborts\n * EWrongVersion on every mutator. */\nexport const AGENT_ID_PACKAGE_ID =\n process.env.AGENT_ID_PACKAGE_ID ??\n '0xe94a8b8f14104b75ee4c7e359289da78698fbfffdd0e5e3e9cb7d250887df7a7';\n\n/** The shared `Registry` object id. */\nexport const AGENT_ID_REGISTRY_ID =\n process.env.AGENT_ID_REGISTRY_ID ??\n '0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119';\n\nconst CLOCK_ID = '0x6';\nconst MODULE = 'registry';\n\n/** The mutable registration payload. `update` is full-replace — supply the\n * complete desired state (omitted fields clear on-chain). */\nexport interface AgentRegistration {\n mcpEndpoint?: string | null;\n paymentMethods?: string[];\n did?: string | null;\n metadataUri?: string | null;\n}\n\nfunction registrationArgs(tx: Transaction, reg: AgentRegistration) {\n return [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.option('string', reg.mcpEndpoint ?? null),\n tx.pure.vector('string', reg.paymentMethods ?? []),\n tx.pure.option('string', reg.did ?? null),\n tx.pure.option('string', reg.metadataUri ?? null),\n tx.object(CLOCK_ID),\n ];\n}\n\n/** Register the SIGNER as an agent (self-sovereign: `sender == agent`). */\nexport function buildRegisterTx(reg: AgentRegistration = {}): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::register`,\n arguments: registrationArgs(tx, reg),\n });\n return tx;\n}\n\n/** Update the signer's record (full-replace). */\nexport function buildUpdateTx(reg: AgentRegistration = {}): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::update`,\n arguments: registrationArgs(tx, reg),\n });\n return tx;\n}\n\n// Ownership builders (buildSetPendingOwnerTx / buildConfirmOwnershipTx /\n// buildRenounceOwnershipTx) were REMOVED in S.1032 — the on-chain mutators\n// always abort since registry v2. There is no ownership surface to build for.\n\n/** An agent's on-chain registry record (registry Table dynamic field),\n * field names as stored by the Move package. */\nexport interface OnChainAgentRecord {\n agent: string;\n mcp_endpoint?: string | null;\n payment_methods?: string[] | null;\n did?: string | null;\n metadata_uri?: string | null;\n}\n\n/**\n * Read one agent's registry record. Returns `null` when the address is not\n * registered. gRPC only (JSON-RPC is deactivated July 31, 2026).\n *\n * Callers that already hold a `SuiGrpcClient` should pass it; otherwise a\n * mainnet client is constructed per call.\n */\nexport async function getAgentRecord(\n address: string,\n opts: { client?: SuiGrpcClient; network?: 'mainnet' | 'testnet' } = {},\n): Promise<OnChainAgentRecord | null> {\n const network = opts.network ?? 'mainnet';\n const client =\n opts.client ??\n new SuiGrpcClient({\n baseUrl:\n network === 'testnet'\n ? 'https://fullnode.testnet.sui.io'\n : 'https://fullnode.mainnet.sui.io',\n network,\n });\n const reg = await client.core.getObject({\n objectId: AGENT_ID_REGISTRY_ID,\n include: { json: true },\n });\n const tableId = (reg.object?.json as { agents?: { id?: string } } | undefined)\n ?.agents?.id;\n if (!tableId) return null;\n const fieldId = deriveDynamicFieldID(\n tableId,\n 'address',\n bcs.Address.serialize(address).toBytes(),\n );\n try {\n const obj = await client.core.getObject({\n objectId: fieldId,\n include: { json: true },\n });\n const rec = (obj.object?.json as { value?: OnChainAgentRecord } | undefined)\n ?.value;\n return rec?.agent ? rec : null;\n } catch {\n // Field object absent → not registered.\n return null;\n }\n}\n\n/** Toggle an agent's active flag (signer must be the agent itself —\n * agent-only since registry v2 / S.1032). */\nexport function buildSetActiveTx(agent: string, active: boolean): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_active`,\n arguments: [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.address(agent),\n tx.pure.bool(active),\n tx.object(CLOCK_ID),\n ],\n });\n return tx;\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -4,16 +4,24 @@ import { Transaction } from '@mysten/sui/transactions';
4
4
  /**
5
5
  * @t2000/id — client for the `agent_id::registry` Move package (Agent ID
6
6
  * Phase B). These builders construct UNSIGNED transactions calling the on-chain
7
- * registry; the caller signs (the agent's keypair for register/update/active;
8
- * the proposed owner for confirm) and may sponsor gas (the agent is the sender,
7
+ * registry; the caller signs (always the AGENT's keypair every mutator is
8
+ * agent-signed since S.1032) and may sponsor gas (the agent is the sender,
9
9
  * so `sender == agent` auth holds; a SUI-funded t2000 account co-signs gas).
10
10
  *
11
+ * Passport↔agent OWNERSHIP left the product (S.1032, 2026-08-13): the
12
+ * link/confirm/renounce builders are gone, and the on-chain mutators
13
+ * always abort (`EOwnershipDeprecated`) once the Registry is migrated.
14
+ * Historical `owner`/`pending_owner` record fields remain on-chain, inert.
15
+ *
11
16
  * Deployed on Sui mainnet 2026-06-29. Override via env for testnet/dev.
12
17
  */
13
- /** The published `agent_id` package id — the LATEST version (v2, the
14
- * 2026-07-09 additive upgrade that added `renounce_ownership`; the shared
15
- * Registry object is unchanged). The original v1 package
16
- * (`0x7669be20…be9a45e9`) remains callable for its own functions. */
18
+ /** The published `agent_id` package id — pin the LATEST upgrade id ONLY
19
+ * (the S.1019 rule; event/type anchors stay on the original package
20
+ * `0x7669be20…be9a45e9`, which remains callable for its own functions).
21
+ * LATEST = the S.1032 v2 upgrade (2026-08-13, ownership deprecated;
22
+ * Registry migrated to version 2 — upgrade digest 7ZUiRi48…, migrate
23
+ * digest 97sNqgt9…). The previous id `0x78d36506…d15451` now aborts
24
+ * EWrongVersion on every mutator. */
17
25
  declare const AGENT_ID_PACKAGE_ID: string;
18
26
  /** The shared `Registry` object id. */
19
27
  declare const AGENT_ID_REGISTRY_ID: string;
@@ -29,14 +37,6 @@ interface AgentRegistration {
29
37
  declare function buildRegisterTx(reg?: AgentRegistration): Transaction;
30
38
  /** Update the signer's record (full-replace). */
31
39
  declare function buildUpdateTx(reg?: AgentRegistration): Transaction;
32
- /** The agent (signer) proposes an owner; nothing binds until the owner confirms. */
33
- declare function buildSetPendingOwnerTx(owner: string): Transaction;
34
- /** The proposed owner (signer) confirms ownership of `agent`. */
35
- declare function buildConfirmOwnershipTx(agent: string): Transaction;
36
- /** The confirmed owner (signer) renounces ownership of `agent` — the record
37
- * returns to autonomous (`owner = none`). Re-linking is the normal two-sided
38
- * flow (the agent proposes, the owner confirms). Requires package v2+. */
39
- declare function buildRenounceOwnershipTx(agent: string): Transaction;
40
40
  /** An agent's on-chain registry record (registry Table dynamic field),
41
41
  * field names as stored by the Move package. */
42
42
  interface OnChainAgentRecord {
@@ -57,7 +57,8 @@ declare function getAgentRecord(address: string, opts?: {
57
57
  client?: SuiGrpcClient;
58
58
  network?: 'mainnet' | 'testnet';
59
59
  }): Promise<OnChainAgentRecord | null>;
60
- /** Toggle an agent's active flag (signer must be the agent or its owner). */
60
+ /** Toggle an agent's active flag (signer must be the agent itself
61
+ * agent-only since registry v2 / S.1032). */
61
62
  declare function buildSetActiveTx(agent: string, active: boolean): Transaction;
62
63
 
63
- export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, type AgentRegistration, type OnChainAgentRecord, buildConfirmOwnershipTx, buildRegisterTx, buildRenounceOwnershipTx, buildSetActiveTx, buildSetPendingOwnerTx, buildUpdateTx, getAgentRecord };
64
+ export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, type AgentRegistration, type OnChainAgentRecord, buildRegisterTx, buildSetActiveTx, buildUpdateTx, getAgentRecord };
package/dist/index.d.ts CHANGED
@@ -4,16 +4,24 @@ import { Transaction } from '@mysten/sui/transactions';
4
4
  /**
5
5
  * @t2000/id — client for the `agent_id::registry` Move package (Agent ID
6
6
  * Phase B). These builders construct UNSIGNED transactions calling the on-chain
7
- * registry; the caller signs (the agent's keypair for register/update/active;
8
- * the proposed owner for confirm) and may sponsor gas (the agent is the sender,
7
+ * registry; the caller signs (always the AGENT's keypair every mutator is
8
+ * agent-signed since S.1032) and may sponsor gas (the agent is the sender,
9
9
  * so `sender == agent` auth holds; a SUI-funded t2000 account co-signs gas).
10
10
  *
11
+ * Passport↔agent OWNERSHIP left the product (S.1032, 2026-08-13): the
12
+ * link/confirm/renounce builders are gone, and the on-chain mutators
13
+ * always abort (`EOwnershipDeprecated`) once the Registry is migrated.
14
+ * Historical `owner`/`pending_owner` record fields remain on-chain, inert.
15
+ *
11
16
  * Deployed on Sui mainnet 2026-06-29. Override via env for testnet/dev.
12
17
  */
13
- /** The published `agent_id` package id — the LATEST version (v2, the
14
- * 2026-07-09 additive upgrade that added `renounce_ownership`; the shared
15
- * Registry object is unchanged). The original v1 package
16
- * (`0x7669be20…be9a45e9`) remains callable for its own functions. */
18
+ /** The published `agent_id` package id — pin the LATEST upgrade id ONLY
19
+ * (the S.1019 rule; event/type anchors stay on the original package
20
+ * `0x7669be20…be9a45e9`, which remains callable for its own functions).
21
+ * LATEST = the S.1032 v2 upgrade (2026-08-13, ownership deprecated;
22
+ * Registry migrated to version 2 — upgrade digest 7ZUiRi48…, migrate
23
+ * digest 97sNqgt9…). The previous id `0x78d36506…d15451` now aborts
24
+ * EWrongVersion on every mutator. */
17
25
  declare const AGENT_ID_PACKAGE_ID: string;
18
26
  /** The shared `Registry` object id. */
19
27
  declare const AGENT_ID_REGISTRY_ID: string;
@@ -29,14 +37,6 @@ interface AgentRegistration {
29
37
  declare function buildRegisterTx(reg?: AgentRegistration): Transaction;
30
38
  /** Update the signer's record (full-replace). */
31
39
  declare function buildUpdateTx(reg?: AgentRegistration): Transaction;
32
- /** The agent (signer) proposes an owner; nothing binds until the owner confirms. */
33
- declare function buildSetPendingOwnerTx(owner: string): Transaction;
34
- /** The proposed owner (signer) confirms ownership of `agent`. */
35
- declare function buildConfirmOwnershipTx(agent: string): Transaction;
36
- /** The confirmed owner (signer) renounces ownership of `agent` — the record
37
- * returns to autonomous (`owner = none`). Re-linking is the normal two-sided
38
- * flow (the agent proposes, the owner confirms). Requires package v2+. */
39
- declare function buildRenounceOwnershipTx(agent: string): Transaction;
40
40
  /** An agent's on-chain registry record (registry Table dynamic field),
41
41
  * field names as stored by the Move package. */
42
42
  interface OnChainAgentRecord {
@@ -57,7 +57,8 @@ declare function getAgentRecord(address: string, opts?: {
57
57
  client?: SuiGrpcClient;
58
58
  network?: 'mainnet' | 'testnet';
59
59
  }): Promise<OnChainAgentRecord | null>;
60
- /** Toggle an agent's active flag (signer must be the agent or its owner). */
60
+ /** Toggle an agent's active flag (signer must be the agent itself
61
+ * agent-only since registry v2 / S.1032). */
61
62
  declare function buildSetActiveTx(agent: string, active: boolean): Transaction;
62
63
 
63
- export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, type AgentRegistration, type OnChainAgentRecord, buildConfirmOwnershipTx, buildRegisterTx, buildRenounceOwnershipTx, buildSetActiveTx, buildSetPendingOwnerTx, buildUpdateTx, getAgentRecord };
64
+ export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, type AgentRegistration, type OnChainAgentRecord, buildRegisterTx, buildSetActiveTx, buildUpdateTx, getAgentRecord };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { Transaction } from '@mysten/sui/transactions';
4
4
  import { deriveDynamicFieldID } from '@mysten/sui/utils';
5
5
 
6
6
  // src/index.ts
7
- var AGENT_ID_PACKAGE_ID = process.env.AGENT_ID_PACKAGE_ID ?? "0x78d365066fb0e6468a9dcb49595e559434a53d7a12d845f776bcda76b4d15451";
7
+ var AGENT_ID_PACKAGE_ID = process.env.AGENT_ID_PACKAGE_ID ?? "0xe94a8b8f14104b75ee4c7e359289da78698fbfffdd0e5e3e9cb7d250887df7a7";
8
8
  var AGENT_ID_REGISTRY_ID = process.env.AGENT_ID_REGISTRY_ID ?? "0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119";
9
9
  var CLOCK_ID = "0x6";
10
10
  var MODULE = "registry";
@@ -34,42 +34,6 @@ function buildUpdateTx(reg = {}) {
34
34
  });
35
35
  return tx;
36
36
  }
37
- function buildSetPendingOwnerTx(owner) {
38
- const tx = new Transaction();
39
- tx.moveCall({
40
- target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_pending_owner`,
41
- arguments: [
42
- tx.object(AGENT_ID_REGISTRY_ID),
43
- tx.pure.address(owner),
44
- tx.object(CLOCK_ID)
45
- ]
46
- });
47
- return tx;
48
- }
49
- function buildConfirmOwnershipTx(agent) {
50
- const tx = new Transaction();
51
- tx.moveCall({
52
- target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::confirm_ownership`,
53
- arguments: [
54
- tx.object(AGENT_ID_REGISTRY_ID),
55
- tx.pure.address(agent),
56
- tx.object(CLOCK_ID)
57
- ]
58
- });
59
- return tx;
60
- }
61
- function buildRenounceOwnershipTx(agent) {
62
- const tx = new Transaction();
63
- tx.moveCall({
64
- target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::renounce_ownership`,
65
- arguments: [
66
- tx.object(AGENT_ID_REGISTRY_ID),
67
- tx.pure.address(agent),
68
- tx.object(CLOCK_ID)
69
- ]
70
- });
71
- return tx;
72
- }
73
37
  async function getAgentRecord(address, opts = {}) {
74
38
  const network = opts.network ?? "mainnet";
75
39
  const client = opts.client ?? new SuiGrpcClient({
@@ -112,6 +76,6 @@ function buildSetActiveTx(agent, active) {
112
76
  return tx;
113
77
  }
114
78
 
115
- export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, buildConfirmOwnershipTx, buildRegisterTx, buildRenounceOwnershipTx, buildSetActiveTx, buildSetPendingOwnerTx, buildUpdateTx, getAgentRecord };
79
+ export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, buildRegisterTx, buildSetActiveTx, buildUpdateTx, getAgentRecord };
116
80
  //# sourceMappingURL=index.js.map
117
81
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAmBO,IAAM,mBAAA,GACX,OAAA,CAAQ,GAAA,CAAI,mBAAA,IACZ;AAGK,IAAM,oBAAA,GACX,OAAA,CAAQ,GAAA,CAAI,oBAAA,IACZ;AAEF,IAAM,QAAA,GAAW,KAAA;AACjB,IAAM,MAAA,GAAS,UAAA;AAWf,SAAS,gBAAA,CAAiB,IAAiB,GAAA,EAAwB;AACjE,EAAA,OAAO;AAAA,IACL,EAAA,CAAG,OAAO,oBAAoB,CAAA;AAAA,IAC9B,GAAG,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,eAAe,IAAI,CAAA;AAAA,IAChD,GAAG,IAAA,CAAK,MAAA,CAAO,UAAU,GAAA,CAAI,cAAA,IAAkB,EAAE,CAAA;AAAA,IACjD,GAAG,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,OAAO,IAAI,CAAA;AAAA,IACxC,GAAG,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,eAAe,IAAI,CAAA;AAAA,IAChD,EAAA,CAAG,OAAO,QAAQ;AAAA,GACpB;AACF;AAGO,SAAS,eAAA,CAAgB,GAAA,GAAyB,EAAC,EAAgB;AACxE,EAAA,MAAM,EAAA,GAAK,IAAI,WAAA,EAAY;AAC3B,EAAA,EAAA,CAAG,QAAA,CAAS;AAAA,IACV,MAAA,EAAQ,CAAA,EAAG,mBAAmB,CAAA,EAAA,EAAK,MAAM,CAAA,UAAA,CAAA;AAAA,IACzC,SAAA,EAAW,gBAAA,CAAiB,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SAAA,CAAU;AAAA,MACtC,QAAA,EAAU,OAAA;AAAA,MACV,OAAA,EAAS,EAAE,IAAA,EAAM,IAAA;AAAK,KACvB,CAAA;AACD,IAAA,MAAM,GAAA,GAAO,GAAA,CAAI,MAAA,EAAQ,IAAA,EACrB,KAAA;AACJ,IAAA,OAAO,GAAA,EAAK,QAAQ,GAAA,GAAM,IAAA;AAAA,EAC5B,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,gBAAA,CAAiB,OAAe,MAAA,EAA8B;AAC5E,EAAA,MAAM,EAAA,GAAK,IAAI,WAAA,EAAY;AAC3B,EAAA,EAAA,CAAG,QAAA,CAAS;AAAA,IACV,MAAA,EAAQ,CAAA,EAAG,mBAAmB,CAAA,EAAA,EAAK,MAAM,CAAA,YAAA,CAAA;AAAA,IACzC,SAAA,EAAW;AAAA,MACT,EAAA,CAAG,OAAO,oBAAoB,CAAA;AAAA,MAC9B,EAAA,CAAG,IAAA,CAAK,OAAA,CAAQ,KAAK,CAAA;AAAA,MACrB,EAAA,CAAG,IAAA,CAAK,IAAA,CAAK,MAAM,CAAA;AAAA,MACnB,EAAA,CAAG,OAAO,QAAQ;AAAA;AACpB,GACD,CAAA;AACD,EAAA,OAAO,EAAA;AACT","file":"index.js","sourcesContent":["import { bcs } from '@mysten/sui/bcs';\nimport { SuiGrpcClient } from '@mysten/sui/grpc';\nimport { Transaction } from '@mysten/sui/transactions';\nimport { deriveDynamicFieldID } from '@mysten/sui/utils';\n\n/**\n * @t2000/id — client for the `agent_id::registry` Move package (Agent ID\n * Phase B). These builders construct UNSIGNED transactions calling the on-chain\n * registry; the caller signs (the agent's keypair for register/update/active;\n * the proposed owner for confirm) and may sponsor gas (the agent is the sender,\n * so `sender == agent` auth holds; a SUI-funded t2000 account co-signs gas).\n *\n * Deployed on Sui mainnet 2026-06-29. Override via env for testnet/dev.\n */\n\n/** The published `agent_id` package id — the LATEST version (v2, the\n * 2026-07-09 additive upgrade that added `renounce_ownership`; the shared\n * Registry object is unchanged). The original v1 package\n * (`0x7669be20be9a45e9`) remains callable for its own functions. */\nexport const AGENT_ID_PACKAGE_ID =\n process.env.AGENT_ID_PACKAGE_ID ??\n '0x78d365066fb0e6468a9dcb49595e559434a53d7a12d845f776bcda76b4d15451';\n\n/** The shared `Registry` object id. */\nexport const AGENT_ID_REGISTRY_ID =\n process.env.AGENT_ID_REGISTRY_ID ??\n '0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119';\n\nconst CLOCK_ID = '0x6';\nconst MODULE = 'registry';\n\n/** The mutable registration payload. `update` is full-replace — supply the\n * complete desired state (omitted fields clear on-chain). */\nexport interface AgentRegistration {\n mcpEndpoint?: string | null;\n paymentMethods?: string[];\n did?: string | null;\n metadataUri?: string | null;\n}\n\nfunction registrationArgs(tx: Transaction, reg: AgentRegistration) {\n return [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.option('string', reg.mcpEndpoint ?? null),\n tx.pure.vector('string', reg.paymentMethods ?? []),\n tx.pure.option('string', reg.did ?? null),\n tx.pure.option('string', reg.metadataUri ?? null),\n tx.object(CLOCK_ID),\n ];\n}\n\n/** Register the SIGNER as an agent (self-sovereign: `sender == agent`). */\nexport function buildRegisterTx(reg: AgentRegistration = {}): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::register`,\n arguments: registrationArgs(tx, reg),\n });\n return tx;\n}\n\n/** Update the signer's record (full-replace). */\nexport function buildUpdateTx(reg: AgentRegistration = {}): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::update`,\n arguments: registrationArgs(tx, reg),\n });\n return tx;\n}\n\n/** The agent (signer) proposes an owner; nothing binds until the owner confirms. */\nexport function buildSetPendingOwnerTx(owner: string): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_pending_owner`,\n arguments: [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.address(owner),\n tx.object(CLOCK_ID),\n ],\n });\n return tx;\n}\n\n/** The proposed owner (signer) confirms ownership of `agent`. */\nexport function buildConfirmOwnershipTx(agent: string): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::confirm_ownership`,\n arguments: [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.address(agent),\n tx.object(CLOCK_ID),\n ],\n });\n return tx;\n}\n\n/** The confirmed owner (signer) renounces ownership of `agent` — the record\n * returns to autonomous (`owner = none`). Re-linking is the normal two-sided\n * flow (the agent proposes, the owner confirms). Requires package v2+. */\nexport function buildRenounceOwnershipTx(agent: string): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::renounce_ownership`,\n arguments: [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.address(agent),\n tx.object(CLOCK_ID),\n ],\n });\n return tx;\n}\n\n/** An agent's on-chain registry record (registry Table dynamic field),\n * field names as stored by the Move package. */\nexport interface OnChainAgentRecord {\n agent: string;\n mcp_endpoint?: string | null;\n payment_methods?: string[] | null;\n did?: string | null;\n metadata_uri?: string | null;\n}\n\n/**\n * Read one agent's registry record. Returns `null` when the address is not\n * registered. gRPC only (JSON-RPC is deactivated July 31, 2026).\n *\n * Callers that already hold a `SuiGrpcClient` should pass it; otherwise a\n * mainnet client is constructed per call.\n */\nexport async function getAgentRecord(\n address: string,\n opts: { client?: SuiGrpcClient; network?: 'mainnet' | 'testnet' } = {},\n): Promise<OnChainAgentRecord | null> {\n const network = opts.network ?? 'mainnet';\n const client =\n opts.client ??\n new SuiGrpcClient({\n baseUrl:\n network === 'testnet'\n ? 'https://fullnode.testnet.sui.io'\n : 'https://fullnode.mainnet.sui.io',\n network,\n });\n const reg = await client.core.getObject({\n objectId: AGENT_ID_REGISTRY_ID,\n include: { json: true },\n });\n const tableId = (reg.object?.json as { agents?: { id?: string } } | undefined)\n ?.agents?.id;\n if (!tableId) return null;\n const fieldId = deriveDynamicFieldID(\n tableId,\n 'address',\n bcs.Address.serialize(address).toBytes(),\n );\n try {\n const obj = await client.core.getObject({\n objectId: fieldId,\n include: { json: true },\n });\n const rec = (obj.object?.json as { value?: OnChainAgentRecord } | undefined)\n ?.value;\n return rec?.agent ? rec : null;\n } catch {\n // Field object absent → not registered.\n return null;\n }\n}\n\n/** Toggle an agent's active flag (signer must be the agent or its owner). */\nexport function buildSetActiveTx(agent: string, active: boolean): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_active`,\n arguments: [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.address(agent),\n tx.pure.bool(active),\n tx.object(CLOCK_ID),\n ],\n });\n return tx;\n}\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AA2BO,IAAM,mBAAA,GACX,OAAA,CAAQ,GAAA,CAAI,mBAAA,IACZ;AAGK,IAAM,oBAAA,GACX,OAAA,CAAQ,GAAA,CAAI,oBAAA,IACZ;AAEF,IAAM,QAAA,GAAW,KAAA;AACjB,IAAM,MAAA,GAAS,UAAA;AAWf,SAAS,gBAAA,CAAiB,IAAiB,GAAA,EAAwB;AACjE,EAAA,OAAO;AAAA,IACL,EAAA,CAAG,OAAO,oBAAoB,CAAA;AAAA,IAC9B,GAAG,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,eAAe,IAAI,CAAA;AAAA,IAChD,GAAG,IAAA,CAAK,MAAA,CAAO,UAAU,GAAA,CAAI,cAAA,IAAkB,EAAE,CAAA;AAAA,IACjD,GAAG,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,OAAO,IAAI,CAAA;AAAA,IACxC,GAAG,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAA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,EACzB,MAAA,EAAQ,EAAA;AACZ,EAAA,IAAI,CAAC,SAAS,OAAO,IAAA;AACrB,EAAA,MAAM,OAAA,GAAU,oBAAA;AAAA,IACd,OAAA;AAAA,IACA,SAAA;AAAA,IACA,GAAA,CAAI,OAAA,CAAQ,SAAA,CAAU,OAAO,EAAE,OAAA;AAAQ,GACzC;AACA,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,MAAM,MAAA,CAAO,IAAA,CAAK,SAAA,CAAU;AAAA,MACtC,QAAA,EAAU,OAAA;AAAA,MACV,OAAA,EAAS,EAAE,IAAA,EAAM,IAAA;AAAK,KACvB,CAAA;AACD,IAAA,MAAM,GAAA,GAAO,GAAA,CAAI,MAAA,EAAQ,IAAA,EACrB,KAAA;AACJ,IAAA,OAAO,GAAA,EAAK,QAAQ,GAAA,GAAM,IAAA;AAAA,EAC5B,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAIO,SAAS,gBAAA,CAAiB,OAAe,MAAA,EAA8B;AAC5E,EAAA,MAAM,EAAA,GAAK,IAAI,WAAA,EAAY;AAC3B,EAAA,EAAA,CAAG,QAAA,CAAS;AAAA,IACV,MAAA,EAAQ,CAAA,EAAG,mBAAmB,CAAA,EAAA,EAAK,MAAM,CAAA,YAAA,CAAA;AAAA,IACzC,SAAA,EAAW;AAAA,MACT,EAAA,CAAG,OAAO,oBAAoB,CAAA;AAAA,MAC9B,EAAA,CAAG,IAAA,CAAK,OAAA,CAAQ,KAAK,CAAA;AAAA,MACrB,EAAA,CAAG,IAAA,CAAK,IAAA,CAAK,MAAM,CAAA;AAAA,MACnB,EAAA,CAAG,OAAO,QAAQ;AAAA;AACpB,GACD,CAAA;AACD,EAAA,OAAO,EAAA;AACT","file":"index.js","sourcesContent":["import { bcs } from '@mysten/sui/bcs';\nimport { SuiGrpcClient } from '@mysten/sui/grpc';\nimport { Transaction } from '@mysten/sui/transactions';\nimport { deriveDynamicFieldID } from '@mysten/sui/utils';\n\n/**\n * @t2000/id — client for the `agent_id::registry` Move package (Agent ID\n * Phase B). These builders construct UNSIGNED transactions calling the on-chain\n * registry; the caller signs (always the AGENT's keypair every mutator is\n * agent-signed since S.1032) and may sponsor gas (the agent is the sender,\n * so `sender == agent` auth holds; a SUI-funded t2000 account co-signs gas).\n *\n * Passport↔agent OWNERSHIP left the product (S.1032, 2026-08-13): the\n * link/confirm/renounce builders are gone, and the on-chain mutators\n * always abort (`EOwnershipDeprecated`) once the Registry is migrated.\n * Historical `owner`/`pending_owner` record fields remain on-chain, inert.\n *\n * Deployed on Sui mainnet 2026-06-29. Override via env for testnet/dev.\n */\n\n/** The published `agent_id` package id — pin the LATEST upgrade id ONLY\n * (the S.1019 rule; event/type anchors stay on the original package\n * `0x7669be20…be9a45e9`, which remains callable for its own functions).\n * LATEST = the S.1032 v2 upgrade (2026-08-13, ownership deprecated;\n * Registry migrated to version 2 — upgrade digest 7ZUiRi48…, migrate\n * digest 97sNqgt9…). The previous id `0x78d36506d15451` now aborts\n * EWrongVersion on every mutator. */\nexport const AGENT_ID_PACKAGE_ID =\n process.env.AGENT_ID_PACKAGE_ID ??\n '0xe94a8b8f14104b75ee4c7e359289da78698fbfffdd0e5e3e9cb7d250887df7a7';\n\n/** The shared `Registry` object id. */\nexport const AGENT_ID_REGISTRY_ID =\n process.env.AGENT_ID_REGISTRY_ID ??\n '0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119';\n\nconst CLOCK_ID = '0x6';\nconst MODULE = 'registry';\n\n/** The mutable registration payload. `update` is full-replace — supply the\n * complete desired state (omitted fields clear on-chain). */\nexport interface AgentRegistration {\n mcpEndpoint?: string | null;\n paymentMethods?: string[];\n did?: string | null;\n metadataUri?: string | null;\n}\n\nfunction registrationArgs(tx: Transaction, reg: AgentRegistration) {\n return [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.option('string', reg.mcpEndpoint ?? null),\n tx.pure.vector('string', reg.paymentMethods ?? []),\n tx.pure.option('string', reg.did ?? null),\n tx.pure.option('string', reg.metadataUri ?? null),\n tx.object(CLOCK_ID),\n ];\n}\n\n/** Register the SIGNER as an agent (self-sovereign: `sender == agent`). */\nexport function buildRegisterTx(reg: AgentRegistration = {}): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::register`,\n arguments: registrationArgs(tx, reg),\n });\n return tx;\n}\n\n/** Update the signer's record (full-replace). */\nexport function buildUpdateTx(reg: AgentRegistration = {}): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::update`,\n arguments: registrationArgs(tx, reg),\n });\n return tx;\n}\n\n// Ownership builders (buildSetPendingOwnerTx / buildConfirmOwnershipTx /\n// buildRenounceOwnershipTx) were REMOVED in S.1032 — the on-chain mutators\n// always abort since registry v2. There is no ownership surface to build for.\n\n/** An agent's on-chain registry record (registry Table dynamic field),\n * field names as stored by the Move package. */\nexport interface OnChainAgentRecord {\n agent: string;\n mcp_endpoint?: string | null;\n payment_methods?: string[] | null;\n did?: string | null;\n metadata_uri?: string | null;\n}\n\n/**\n * Read one agent's registry record. Returns `null` when the address is not\n * registered. gRPC only (JSON-RPC is deactivated July 31, 2026).\n *\n * Callers that already hold a `SuiGrpcClient` should pass it; otherwise a\n * mainnet client is constructed per call.\n */\nexport async function getAgentRecord(\n address: string,\n opts: { client?: SuiGrpcClient; network?: 'mainnet' | 'testnet' } = {},\n): Promise<OnChainAgentRecord | null> {\n const network = opts.network ?? 'mainnet';\n const client =\n opts.client ??\n new SuiGrpcClient({\n baseUrl:\n network === 'testnet'\n ? 'https://fullnode.testnet.sui.io'\n : 'https://fullnode.mainnet.sui.io',\n network,\n });\n const reg = await client.core.getObject({\n objectId: AGENT_ID_REGISTRY_ID,\n include: { json: true },\n });\n const tableId = (reg.object?.json as { agents?: { id?: string } } | undefined)\n ?.agents?.id;\n if (!tableId) return null;\n const fieldId = deriveDynamicFieldID(\n tableId,\n 'address',\n bcs.Address.serialize(address).toBytes(),\n );\n try {\n const obj = await client.core.getObject({\n objectId: fieldId,\n include: { json: true },\n });\n const rec = (obj.object?.json as { value?: OnChainAgentRecord } | undefined)\n ?.value;\n return rec?.agent ? rec : null;\n } catch {\n // Field object absent → not registered.\n return null;\n }\n}\n\n/** Toggle an agent's active flag (signer must be the agent itself —\n * agent-only since registry v2 / S.1032). */\nexport function buildSetActiveTx(agent: string, active: boolean): Transaction {\n const tx = new Transaction();\n tx.moveCall({\n target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_active`,\n arguments: [\n tx.object(AGENT_ID_REGISTRY_ID),\n tx.pure.address(agent),\n tx.pure.bool(active),\n tx.object(CLOCK_ID),\n ],\n });\n return tx;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t2000/id",
3
- "version": "10.30.5",
3
+ "version": "10.31.1",
4
4
  "description": "Agent ID — on-chain agent identity registry client for the t2000 stack (Sui). Build register/update/ownership/active transactions against the agent_id::registry Move package.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",