@t2000/id 5.7.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 t2000
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # @t2000/id
2
+
3
+ **Agent ID** — a tiny, dependency-light client for the on-chain `agent_id::registry` Move package (Sui mainnet). Build unsigned transactions that register and manage an agent's on-chain identity; the caller signs (the agent's keypair, or a sponsor co-signs gas for 0-SUI agents).
4
+
5
+ Part of the [t2000](https://t2000.ai) agent stack. See the developer docs at [developers.t2000.ai](https://developers.t2000.ai).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @t2000/id @mysten/sui
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { buildRegisterTx, AGENT_ID_REGISTRY_ID } from "@t2000/id";
17
+
18
+ // Register the SIGNER as an agent (self-sovereign: sender == agent).
19
+ const tx = buildRegisterTx({
20
+ mcpEndpoint: "https://my-agent.example/mcp",
21
+ paymentMethods: ["x402"],
22
+ });
23
+ // → sign with the agent keypair + execute (optionally sponsor the gas).
24
+ ```
25
+
26
+ ### Builders
27
+
28
+ | Function | Move call | Signer |
29
+ |---|---|---|
30
+ | `buildRegisterTx(reg?)` | `register` | the agent |
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 |
35
+
36
+ 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
+
38
+ ## License
39
+
40
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ var transactions = require('@mysten/sui/transactions');
4
+
5
+ // src/index.ts
6
+ var AGENT_ID_PACKAGE_ID = process.env.AGENT_ID_PACKAGE_ID ?? "0x7669be207f9ac28a34d2cbd45dcfdade11e6fd503ad24e687c180931be9a45e9";
7
+ var AGENT_ID_REGISTRY_ID = process.env.AGENT_ID_REGISTRY_ID ?? "0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119";
8
+ var CLOCK_ID = "0x6";
9
+ var MODULE = "registry";
10
+ function registrationArgs(tx, reg) {
11
+ return [
12
+ tx.object(AGENT_ID_REGISTRY_ID),
13
+ tx.pure.option("string", reg.mcpEndpoint ?? null),
14
+ tx.pure.vector("string", reg.paymentMethods ?? []),
15
+ tx.pure.option("string", reg.did ?? null),
16
+ tx.pure.option("string", reg.metadataUri ?? null),
17
+ tx.object(CLOCK_ID)
18
+ ];
19
+ }
20
+ function buildRegisterTx(reg = {}) {
21
+ const tx = new transactions.Transaction();
22
+ tx.moveCall({
23
+ target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::register`,
24
+ arguments: registrationArgs(tx, reg)
25
+ });
26
+ return tx;
27
+ }
28
+ function buildUpdateTx(reg = {}) {
29
+ const tx = new transactions.Transaction();
30
+ tx.moveCall({
31
+ target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::update`,
32
+ arguments: registrationArgs(tx, reg)
33
+ });
34
+ return tx;
35
+ }
36
+ function buildSetPendingOwnerTx(owner) {
37
+ const tx = new transactions.Transaction();
38
+ tx.moveCall({
39
+ target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_pending_owner`,
40
+ arguments: [
41
+ tx.object(AGENT_ID_REGISTRY_ID),
42
+ tx.pure.address(owner),
43
+ tx.object(CLOCK_ID)
44
+ ]
45
+ });
46
+ return tx;
47
+ }
48
+ function buildConfirmOwnershipTx(agent) {
49
+ const tx = new transactions.Transaction();
50
+ tx.moveCall({
51
+ target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::confirm_ownership`,
52
+ arguments: [
53
+ tx.object(AGENT_ID_REGISTRY_ID),
54
+ tx.pure.address(agent),
55
+ tx.object(CLOCK_ID)
56
+ ]
57
+ });
58
+ return tx;
59
+ }
60
+ function buildSetActiveTx(agent, active) {
61
+ const tx = new transactions.Transaction();
62
+ tx.moveCall({
63
+ target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_active`,
64
+ arguments: [
65
+ tx.object(AGENT_ID_REGISTRY_ID),
66
+ tx.pure.address(agent),
67
+ tx.pure.bool(active),
68
+ tx.object(CLOCK_ID)
69
+ ]
70
+ });
71
+ return tx;
72
+ }
73
+
74
+ exports.AGENT_ID_PACKAGE_ID = AGENT_ID_PACKAGE_ID;
75
+ exports.AGENT_ID_REGISTRY_ID = AGENT_ID_REGISTRY_ID;
76
+ exports.buildConfirmOwnershipTx = buildConfirmOwnershipTx;
77
+ exports.buildRegisterTx = buildRegisterTx;
78
+ exports.buildSetActiveTx = buildSetActiveTx;
79
+ exports.buildSetPendingOwnerTx = buildSetPendingOwnerTx;
80
+ exports.buildUpdateTx = buildUpdateTx;
81
+ //# sourceMappingURL=index.cjs.map
82
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["Transaction"],"mappings":";;;;;AAaO,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,EAAG,mBAAmB,CAAA,EAAA,EAAK,MAAM,CAAA,UAAA,CAAA;AAAA,IACzC,SAAA,EAAW,gBAAA,CAAiB,EAAA,EAAI,GAAG;AAAA,GACpC,CAAA;AACD,EAAA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MAAA,EAA8B;AAC5E,EAAA,MAAM,EAAA,GAAK,IAAIA,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 { Transaction } from '@mysten/sui/transactions';\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. */\nexport const AGENT_ID_PACKAGE_ID =\n process.env.AGENT_ID_PACKAGE_ID ??\n '0x7669be207f9ac28a34d2cbd45dcfdade11e6fd503ad24e687c180931be9a45e9';\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/** 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"]}
@@ -0,0 +1,35 @@
1
+ import { Transaction } from '@mysten/sui/transactions';
2
+
3
+ /**
4
+ * @t2000/id — client for the `agent_id::registry` Move package (Agent ID
5
+ * Phase B). These builders construct UNSIGNED transactions calling the on-chain
6
+ * registry; the caller signs (the agent's keypair for register/update/active;
7
+ * the proposed owner for confirm) and may sponsor gas (the agent is the sender,
8
+ * so `sender == agent` auth holds; a SUI-funded t2000 account co-signs gas).
9
+ *
10
+ * Deployed on Sui mainnet 2026-06-29. Override via env for testnet/dev.
11
+ */
12
+ /** The published `agent_id` package id. */
13
+ declare const AGENT_ID_PACKAGE_ID: string;
14
+ /** The shared `Registry` object id. */
15
+ declare const AGENT_ID_REGISTRY_ID: string;
16
+ /** The mutable registration payload. `update` is full-replace — supply the
17
+ * complete desired state (omitted fields clear on-chain). */
18
+ interface AgentRegistration {
19
+ mcpEndpoint?: string | null;
20
+ paymentMethods?: string[];
21
+ did?: string | null;
22
+ metadataUri?: string | null;
23
+ }
24
+ /** Register the SIGNER as an agent (self-sovereign: `sender == agent`). */
25
+ declare function buildRegisterTx(reg?: AgentRegistration): Transaction;
26
+ /** Update the signer's record (full-replace). */
27
+ declare function buildUpdateTx(reg?: AgentRegistration): Transaction;
28
+ /** The agent (signer) proposes an owner; nothing binds until the owner confirms. */
29
+ declare function buildSetPendingOwnerTx(owner: string): Transaction;
30
+ /** The proposed owner (signer) confirms ownership of `agent`. */
31
+ declare function buildConfirmOwnershipTx(agent: string): Transaction;
32
+ /** Toggle an agent's active flag (signer must be the agent or its owner). */
33
+ declare function buildSetActiveTx(agent: string, active: boolean): Transaction;
34
+
35
+ export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, type AgentRegistration, buildConfirmOwnershipTx, buildRegisterTx, buildSetActiveTx, buildSetPendingOwnerTx, buildUpdateTx };
@@ -0,0 +1,35 @@
1
+ import { Transaction } from '@mysten/sui/transactions';
2
+
3
+ /**
4
+ * @t2000/id — client for the `agent_id::registry` Move package (Agent ID
5
+ * Phase B). These builders construct UNSIGNED transactions calling the on-chain
6
+ * registry; the caller signs (the agent's keypair for register/update/active;
7
+ * the proposed owner for confirm) and may sponsor gas (the agent is the sender,
8
+ * so `sender == agent` auth holds; a SUI-funded t2000 account co-signs gas).
9
+ *
10
+ * Deployed on Sui mainnet 2026-06-29. Override via env for testnet/dev.
11
+ */
12
+ /** The published `agent_id` package id. */
13
+ declare const AGENT_ID_PACKAGE_ID: string;
14
+ /** The shared `Registry` object id. */
15
+ declare const AGENT_ID_REGISTRY_ID: string;
16
+ /** The mutable registration payload. `update` is full-replace — supply the
17
+ * complete desired state (omitted fields clear on-chain). */
18
+ interface AgentRegistration {
19
+ mcpEndpoint?: string | null;
20
+ paymentMethods?: string[];
21
+ did?: string | null;
22
+ metadataUri?: string | null;
23
+ }
24
+ /** Register the SIGNER as an agent (self-sovereign: `sender == agent`). */
25
+ declare function buildRegisterTx(reg?: AgentRegistration): Transaction;
26
+ /** Update the signer's record (full-replace). */
27
+ declare function buildUpdateTx(reg?: AgentRegistration): Transaction;
28
+ /** The agent (signer) proposes an owner; nothing binds until the owner confirms. */
29
+ declare function buildSetPendingOwnerTx(owner: string): Transaction;
30
+ /** The proposed owner (signer) confirms ownership of `agent`. */
31
+ declare function buildConfirmOwnershipTx(agent: string): Transaction;
32
+ /** Toggle an agent's active flag (signer must be the agent or its owner). */
33
+ declare function buildSetActiveTx(agent: string, active: boolean): Transaction;
34
+
35
+ export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, type AgentRegistration, buildConfirmOwnershipTx, buildRegisterTx, buildSetActiveTx, buildSetPendingOwnerTx, buildUpdateTx };
package/dist/index.js ADDED
@@ -0,0 +1,74 @@
1
+ import { Transaction } from '@mysten/sui/transactions';
2
+
3
+ // src/index.ts
4
+ var AGENT_ID_PACKAGE_ID = process.env.AGENT_ID_PACKAGE_ID ?? "0x7669be207f9ac28a34d2cbd45dcfdade11e6fd503ad24e687c180931be9a45e9";
5
+ var AGENT_ID_REGISTRY_ID = process.env.AGENT_ID_REGISTRY_ID ?? "0xf41683aa9f4c121f34e4082c35180b0efdbd6d5293e3c88b1bcfa45ddf5c4119";
6
+ var CLOCK_ID = "0x6";
7
+ var MODULE = "registry";
8
+ function registrationArgs(tx, reg) {
9
+ return [
10
+ tx.object(AGENT_ID_REGISTRY_ID),
11
+ tx.pure.option("string", reg.mcpEndpoint ?? null),
12
+ tx.pure.vector("string", reg.paymentMethods ?? []),
13
+ tx.pure.option("string", reg.did ?? null),
14
+ tx.pure.option("string", reg.metadataUri ?? null),
15
+ tx.object(CLOCK_ID)
16
+ ];
17
+ }
18
+ function buildRegisterTx(reg = {}) {
19
+ const tx = new Transaction();
20
+ tx.moveCall({
21
+ target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::register`,
22
+ arguments: registrationArgs(tx, reg)
23
+ });
24
+ return tx;
25
+ }
26
+ function buildUpdateTx(reg = {}) {
27
+ const tx = new Transaction();
28
+ tx.moveCall({
29
+ target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::update`,
30
+ arguments: registrationArgs(tx, reg)
31
+ });
32
+ return tx;
33
+ }
34
+ function buildSetPendingOwnerTx(owner) {
35
+ const tx = new Transaction();
36
+ tx.moveCall({
37
+ target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_pending_owner`,
38
+ arguments: [
39
+ tx.object(AGENT_ID_REGISTRY_ID),
40
+ tx.pure.address(owner),
41
+ tx.object(CLOCK_ID)
42
+ ]
43
+ });
44
+ return tx;
45
+ }
46
+ function buildConfirmOwnershipTx(agent) {
47
+ const tx = new Transaction();
48
+ tx.moveCall({
49
+ target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::confirm_ownership`,
50
+ arguments: [
51
+ tx.object(AGENT_ID_REGISTRY_ID),
52
+ tx.pure.address(agent),
53
+ tx.object(CLOCK_ID)
54
+ ]
55
+ });
56
+ return tx;
57
+ }
58
+ function buildSetActiveTx(agent, active) {
59
+ const tx = new Transaction();
60
+ tx.moveCall({
61
+ target: `${AGENT_ID_PACKAGE_ID}::${MODULE}::set_active`,
62
+ arguments: [
63
+ tx.object(AGENT_ID_REGISTRY_ID),
64
+ tx.pure.address(agent),
65
+ tx.pure.bool(active),
66
+ tx.object(CLOCK_ID)
67
+ ]
68
+ });
69
+ return tx;
70
+ }
71
+
72
+ export { AGENT_ID_PACKAGE_ID, AGENT_ID_REGISTRY_ID, buildConfirmOwnershipTx, buildRegisterTx, buildSetActiveTx, buildSetPendingOwnerTx, buildUpdateTx };
73
+ //# sourceMappingURL=index.js.map
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAaO,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,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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,OAAO,QAAQ;AAAA;AACpB,GACD,CAAA;AACD,EAAA,OAAO,EAAA;AACT;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 { Transaction } from '@mysten/sui/transactions';\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. */\nexport const AGENT_ID_PACKAGE_ID =\n process.env.AGENT_ID_PACKAGE_ID ??\n '0x7669be207f9ac28a34d2cbd45dcfdade11e6fd503ad24e687c180931be9a45e9';\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/** 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"]}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@t2000/id",
3
+ "version": "5.7.0",
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
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "keywords": [
21
+ "sui",
22
+ "agent",
23
+ "identity",
24
+ "agent-id",
25
+ "registry",
26
+ "erc-8004"
27
+ ],
28
+ "author": "t2000",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/mission69b/t2000.git",
32
+ "directory": "packages/id"
33
+ },
34
+ "homepage": "https://id.t2000.ai",
35
+ "dependencies": {
36
+ "@mysten/sui": "^2.17.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^20",
40
+ "eslint": "^9",
41
+ "tsup": "^8",
42
+ "typescript": "^5",
43
+ "typescript-eslint": "^8.58.0",
44
+ "vitest": "^3"
45
+ },
46
+ "license": "MIT",
47
+ "scripts": {
48
+ "build": "tsup",
49
+ "dev": "tsup --watch",
50
+ "test": "vitest run",
51
+ "typecheck": "tsc --noEmit",
52
+ "lint": "eslint src/",
53
+ "clean": "rm -rf dist"
54
+ }
55
+ }