@t2000/id 10.32.0 → 10.32.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.
- package/README.md +11 -1
- package/dist/index.cjs +6 -4
- package/dist/index.d.cts +21 -8
- package/dist/index.d.ts +21 -8
- package/dist/index.js +5 -5
- package/package.json +4 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -31,7 +31,17 @@ const tx = buildRegisterTx({
|
|
|
31
31
|
| `buildUpdateTx(reg?)` | `update` (full-replace) | the agent |
|
|
32
32
|
| `buildSetActiveTx(agent, active)` | `set_active` | the agent |
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Two tiers of ids (S.1049):
|
|
35
|
+
|
|
36
|
+
- **`MAINNET_AGENT_ID_PACKAGE_ID` / `MAINNET_AGENT_ID_REGISTRY_ID`** — literal
|
|
37
|
+
mainnet trust anchors, never influenced by the environment. Anything that
|
|
38
|
+
*verifies* a transaction before signing (allowlists, intent guards) must
|
|
39
|
+
use these.
|
|
40
|
+
- **`AGENT_ID_PACKAGE_ID` / `AGENT_ID_REGISTRY_ID`** — builder ids, overridable
|
|
41
|
+
via the same-named env vars for testnet/dev. These are conveniences for
|
|
42
|
+
*constructing* transactions, **not** a security boundary: a guard that read
|
|
43
|
+
them would let whoever controls the environment supply both the transaction
|
|
44
|
+
and the yardstick it is checked against.
|
|
35
45
|
|
|
36
46
|
## License
|
|
37
47
|
|
package/dist/index.cjs
CHANGED
|
@@ -6,8 +6,10 @@ var transactions = require('@mysten/sui/transactions');
|
|
|
6
6
|
var utils = require('@mysten/sui/utils');
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var MAINNET_AGENT_ID_PACKAGE_ID = "0xe94a8b8f14104b75ee4c7e359289da78698fbfffdd0e5e3e9cb7d250887df7a7";
|
|
10
|
+
var MAINNET_AGENT_ID_REGISTRY_ID = "0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119";
|
|
11
|
+
var AGENT_ID_PACKAGE_ID = process.env.AGENT_ID_PACKAGE_ID ?? MAINNET_AGENT_ID_PACKAGE_ID;
|
|
12
|
+
var AGENT_ID_REGISTRY_ID = process.env.AGENT_ID_REGISTRY_ID ?? MAINNET_AGENT_ID_REGISTRY_ID;
|
|
11
13
|
var CLOCK_ID = "0x6";
|
|
12
14
|
var MODULE = "registry";
|
|
13
15
|
function registrationArgs(tx, reg) {
|
|
@@ -80,9 +82,9 @@ function buildSetActiveTx(agent, active) {
|
|
|
80
82
|
|
|
81
83
|
exports.AGENT_ID_PACKAGE_ID = AGENT_ID_PACKAGE_ID;
|
|
82
84
|
exports.AGENT_ID_REGISTRY_ID = AGENT_ID_REGISTRY_ID;
|
|
85
|
+
exports.MAINNET_AGENT_ID_PACKAGE_ID = MAINNET_AGENT_ID_PACKAGE_ID;
|
|
86
|
+
exports.MAINNET_AGENT_ID_REGISTRY_ID = MAINNET_AGENT_ID_REGISTRY_ID;
|
|
83
87
|
exports.buildRegisterTx = buildRegisterTx;
|
|
84
88
|
exports.buildSetActiveTx = buildSetActiveTx;
|
|
85
89
|
exports.buildUpdateTx = buildUpdateTx;
|
|
86
90
|
exports.getAgentRecord = getAgentRecord;
|
|
87
|
-
//# sourceMappingURL=index.cjs.map
|
|
88
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -15,15 +15,28 @@ import { Transaction } from '@mysten/sui/transactions';
|
|
|
15
15
|
*
|
|
16
16
|
* Deployed on Sui mainnet 2026-06-29. Override via env for testnet/dev.
|
|
17
17
|
*/
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
18
|
+
/** MAINNET trust anchor (S.1049 — the S.930 escrow pattern): the published
|
|
19
|
+
* `agent_id` package id as a LITERAL, never `process.env`. Signature-time
|
|
20
|
+
* verification (the CLI intent guard's allowlist) imports THIS — reading
|
|
21
|
+
* the env-aware constant below would let an attacker who controls the
|
|
22
|
+
* environment supply both the transaction and the yardstick.
|
|
23
|
+
*
|
|
24
|
+
* Pin the LATEST upgrade id ONLY (the S.1019 rule; event/type anchors stay
|
|
25
|
+
* on the original package `0x7669be20…be9a45e9`, which remains callable for
|
|
26
|
+
* its own functions). LATEST = the S.1032 v2 upgrade (2026-08-13, ownership
|
|
27
|
+
* deprecated; Registry migrated to version 2 — upgrade digest 7ZUiRi48…,
|
|
28
|
+
* migrate digest 97sNqgt9…). The previous id `0x78d36506…d15451` now aborts
|
|
24
29
|
* EWrongVersion on every mutator. */
|
|
30
|
+
declare const MAINNET_AGENT_ID_PACKAGE_ID = "0xe94a8b8f14104b75ee4c7e359289da78698fbfffdd0e5e3e9cb7d250887df7a7";
|
|
31
|
+
/** MAINNET trust anchor: the shared `Registry` object id (same rule —
|
|
32
|
+
* literal, never env). */
|
|
33
|
+
declare const MAINNET_AGENT_ID_REGISTRY_ID = "0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119";
|
|
34
|
+
/** BUILDER id — env-overridable for testnet/dev. NOT a trust anchor:
|
|
35
|
+
* transaction BUILDERS may read it so a dev chain works, but guards and
|
|
36
|
+
* allowlists must use MAINNET_AGENT_ID_PACKAGE_ID (S.1049). */
|
|
25
37
|
declare const AGENT_ID_PACKAGE_ID: string;
|
|
26
|
-
/**
|
|
38
|
+
/** BUILDER id — env-overridable for testnet/dev; same not-a-trust-anchor
|
|
39
|
+
* rule as AGENT_ID_PACKAGE_ID. */
|
|
27
40
|
declare const AGENT_ID_REGISTRY_ID: string;
|
|
28
41
|
/** The mutable registration payload. `update` is full-replace — supply the
|
|
29
42
|
* complete desired state (omitted fields clear on-chain). */
|
|
@@ -61,4 +74,4 @@ declare function getAgentRecord(address: string, opts?: {
|
|
|
61
74
|
* agent-only since registry v2 / S.1032). */
|
|
62
75
|
declare function buildSetActiveTx(agent: string, active: boolean): Transaction;
|
|
63
76
|
|
|
64
|
-
export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, type AgentRegistration, type OnChainAgentRecord, buildRegisterTx, buildSetActiveTx, buildUpdateTx, getAgentRecord };
|
|
77
|
+
export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, type AgentRegistration, MAINNET_AGENT_ID_PACKAGE_ID, MAINNET_AGENT_ID_REGISTRY_ID, type OnChainAgentRecord, buildRegisterTx, buildSetActiveTx, buildUpdateTx, getAgentRecord };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,15 +15,28 @@ import { Transaction } from '@mysten/sui/transactions';
|
|
|
15
15
|
*
|
|
16
16
|
* Deployed on Sui mainnet 2026-06-29. Override via env for testnet/dev.
|
|
17
17
|
*/
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
18
|
+
/** MAINNET trust anchor (S.1049 — the S.930 escrow pattern): the published
|
|
19
|
+
* `agent_id` package id as a LITERAL, never `process.env`. Signature-time
|
|
20
|
+
* verification (the CLI intent guard's allowlist) imports THIS — reading
|
|
21
|
+
* the env-aware constant below would let an attacker who controls the
|
|
22
|
+
* environment supply both the transaction and the yardstick.
|
|
23
|
+
*
|
|
24
|
+
* Pin the LATEST upgrade id ONLY (the S.1019 rule; event/type anchors stay
|
|
25
|
+
* on the original package `0x7669be20…be9a45e9`, which remains callable for
|
|
26
|
+
* its own functions). LATEST = the S.1032 v2 upgrade (2026-08-13, ownership
|
|
27
|
+
* deprecated; Registry migrated to version 2 — upgrade digest 7ZUiRi48…,
|
|
28
|
+
* migrate digest 97sNqgt9…). The previous id `0x78d36506…d15451` now aborts
|
|
24
29
|
* EWrongVersion on every mutator. */
|
|
30
|
+
declare const MAINNET_AGENT_ID_PACKAGE_ID = "0xe94a8b8f14104b75ee4c7e359289da78698fbfffdd0e5e3e9cb7d250887df7a7";
|
|
31
|
+
/** MAINNET trust anchor: the shared `Registry` object id (same rule —
|
|
32
|
+
* literal, never env). */
|
|
33
|
+
declare const MAINNET_AGENT_ID_REGISTRY_ID = "0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119";
|
|
34
|
+
/** BUILDER id — env-overridable for testnet/dev. NOT a trust anchor:
|
|
35
|
+
* transaction BUILDERS may read it so a dev chain works, but guards and
|
|
36
|
+
* allowlists must use MAINNET_AGENT_ID_PACKAGE_ID (S.1049). */
|
|
25
37
|
declare const AGENT_ID_PACKAGE_ID: string;
|
|
26
|
-
/**
|
|
38
|
+
/** BUILDER id — env-overridable for testnet/dev; same not-a-trust-anchor
|
|
39
|
+
* rule as AGENT_ID_PACKAGE_ID. */
|
|
27
40
|
declare const AGENT_ID_REGISTRY_ID: string;
|
|
28
41
|
/** The mutable registration payload. `update` is full-replace — supply the
|
|
29
42
|
* complete desired state (omitted fields clear on-chain). */
|
|
@@ -61,4 +74,4 @@ declare function getAgentRecord(address: string, opts?: {
|
|
|
61
74
|
* agent-only since registry v2 / S.1032). */
|
|
62
75
|
declare function buildSetActiveTx(agent: string, active: boolean): Transaction;
|
|
63
76
|
|
|
64
|
-
export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, type AgentRegistration, type OnChainAgentRecord, buildRegisterTx, buildSetActiveTx, buildUpdateTx, getAgentRecord };
|
|
77
|
+
export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, type AgentRegistration, MAINNET_AGENT_ID_PACKAGE_ID, MAINNET_AGENT_ID_REGISTRY_ID, type OnChainAgentRecord, buildRegisterTx, buildSetActiveTx, buildUpdateTx, getAgentRecord };
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,10 @@ import { Transaction } from '@mysten/sui/transactions';
|
|
|
4
4
|
import { deriveDynamicFieldID } from '@mysten/sui/utils';
|
|
5
5
|
|
|
6
6
|
// src/index.ts
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var MAINNET_AGENT_ID_PACKAGE_ID = "0xe94a8b8f14104b75ee4c7e359289da78698fbfffdd0e5e3e9cb7d250887df7a7";
|
|
8
|
+
var MAINNET_AGENT_ID_REGISTRY_ID = "0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119";
|
|
9
|
+
var AGENT_ID_PACKAGE_ID = process.env.AGENT_ID_PACKAGE_ID ?? MAINNET_AGENT_ID_PACKAGE_ID;
|
|
10
|
+
var AGENT_ID_REGISTRY_ID = process.env.AGENT_ID_REGISTRY_ID ?? MAINNET_AGENT_ID_REGISTRY_ID;
|
|
9
11
|
var CLOCK_ID = "0x6";
|
|
10
12
|
var MODULE = "registry";
|
|
11
13
|
function registrationArgs(tx, reg) {
|
|
@@ -76,6 +78,4 @@ function buildSetActiveTx(agent, active) {
|
|
|
76
78
|
return tx;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, buildRegisterTx, buildSetActiveTx, buildUpdateTx, getAgentRecord };
|
|
80
|
-
//# sourceMappingURL=index.js.map
|
|
81
|
-
//# sourceMappingURL=index.js.map
|
|
81
|
+
export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, MAINNET_AGENT_ID_PACKAGE_ID, MAINNET_AGENT_ID_REGISTRY_ID, buildRegisterTx, buildSetActiveTx, buildUpdateTx, getAgentRecord };
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/id",
|
|
3
|
-
"version": "10.32.
|
|
3
|
+
"version": "10.32.2",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=20"
|
|
6
|
+
},
|
|
4
7
|
"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
8
|
"type": "module",
|
|
6
9
|
"main":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,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.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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 `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"]}
|