@ens-node-metadata/agent 0.2.0 → 0.2.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.
Files changed (48) hide show
  1. package/README.md +2 -110
  2. package/dist/cli.d.ts +0 -2
  3. package/dist/cli.js +9 -7
  4. package/dist/index.d.ts +188 -5
  5. package/dist/index.js +63 -4
  6. package/package.json +8 -4
  7. package/dist/cli.d.ts.map +0 -1
  8. package/dist/commands/metadata/set.d.ts +0 -21
  9. package/dist/commands/metadata/set.d.ts.map +0 -1
  10. package/dist/commands/metadata/set.js +0 -75
  11. package/dist/commands/metadata/template.d.ts +0 -4
  12. package/dist/commands/metadata/template.d.ts.map +0 -1
  13. package/dist/commands/metadata/template.js +0 -7
  14. package/dist/commands/metadata/validate.d.ts +0 -10
  15. package/dist/commands/metadata/validate.d.ts.map +0 -1
  16. package/dist/commands/metadata/validate.js +0 -44
  17. package/dist/commands/register.d.ts +0 -21
  18. package/dist/commands/register.d.ts.map +0 -1
  19. package/dist/commands/register.js +0 -76
  20. package/dist/commands/registration-file/publish.d.ts +0 -10
  21. package/dist/commands/registration-file/publish.d.ts.map +0 -1
  22. package/dist/commands/registration-file/publish.js +0 -79
  23. package/dist/commands/registration-file/template.d.ts +0 -3
  24. package/dist/commands/registration-file/template.d.ts.map +0 -1
  25. package/dist/commands/registration-file/template.js +0 -48
  26. package/dist/commands/registration-file/validate.d.ts +0 -10
  27. package/dist/commands/registration-file/validate.d.ts.map +0 -1
  28. package/dist/commands/registration-file/validate.js +0 -35
  29. package/dist/commands/registry/identity.d.ts +0 -18
  30. package/dist/commands/registry/identity.d.ts.map +0 -1
  31. package/dist/commands/registry/identity.js +0 -115
  32. package/dist/commands/skill.d.ts +0 -16
  33. package/dist/commands/skill.d.ts.map +0 -1
  34. package/dist/commands/skill.js +0 -53
  35. package/dist/commands/update.d.ts +0 -21
  36. package/dist/commands/update.d.ts.map +0 -1
  37. package/dist/commands/update.js +0 -76
  38. package/dist/index.d.ts.map +0 -1
  39. package/dist/lib/ens-write.d.ts +0 -6
  40. package/dist/lib/ens-write.d.ts.map +0 -1
  41. package/dist/lib/ens-write.js +0 -23
  42. package/dist/lib/ui.d.ts +0 -6
  43. package/dist/lib/ui.d.ts.map +0 -1
  44. package/dist/lib/ui.js +0 -14
  45. package/dist/types.d.ts +0 -181
  46. package/dist/types.d.ts.map +0 -1
  47. package/dist/types.js +0 -84
  48. package/src/index.ts +0 -8
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { z } from 'zod';
3
- export declare const description = "Register agent on ENS with metadata payload";
4
- export declare const args: z.ZodTuple<[z.ZodString, z.ZodString], null>;
5
- export declare const options: z.ZodObject<{
6
- privateKey: z.ZodString;
7
- broadcast: z.ZodDefault<z.ZodBoolean>;
8
- }, "strip", z.ZodTypeAny, {
9
- privateKey: string;
10
- broadcast: boolean;
11
- }, {
12
- privateKey: string;
13
- broadcast?: boolean | undefined;
14
- }>;
15
- type Props = {
16
- args: z.infer<typeof args>;
17
- options: z.infer<typeof options>;
18
- };
19
- export default function Register({ args: [ensName, payloadFile], options }: Props): React.JSX.Element;
20
- export {};
21
- //# sourceMappingURL=register.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/commands/register.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,WAAW,gDAAgD,CAAA;AAExE,eAAO,MAAM,IAAI,8CAGf,CAAA;AAEF,eAAO,MAAM,OAAO;;;;;;;;;EAMlB,CAAA;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAA;IAC1B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAA;CACjC,CAAA;AAQD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,qBA8DhF"}
@@ -1,76 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { Box, Text, useApp } from 'ink';
3
- import React from 'react';
4
- import { z } from 'zod';
5
- import { AgentMetadataPayloadSchema } from '../index.js';
6
- import { setEnsTextRecords } from '../lib/ens-write.js';
7
- export const description = 'Register agent on ENS with metadata payload';
8
- export const args = z.tuple([
9
- z.string().describe('EnsNode'),
10
- z.string().describe('payload.json'),
11
- ]);
12
- export const options = z.object({
13
- privateKey: z.string().describe('Private key for signing (hex, prefixed with 0x)'),
14
- broadcast: z
15
- .boolean()
16
- .default(false)
17
- .describe('Broadcast the transaction on-chain (default: dry run)'),
18
- });
19
- export default function Register({ args: [ensName, payloadFile], options }) {
20
- const { exit } = useApp();
21
- const [state, setState] = React.useState({ status: 'idle' });
22
- React.useEffect(() => {
23
- async function run() {
24
- let payload;
25
- try {
26
- const raw = JSON.parse(readFileSync(payloadFile, 'utf8'));
27
- const result = AgentMetadataPayloadSchema.safeParse(raw);
28
- if (!result.success) {
29
- const issues = result.error.issues
30
- .map((i) => `[${i.path.join('.') || 'root'}] ${i.message}`)
31
- .join('\n');
32
- setState({ status: 'error', message: `Invalid payload:\n${issues}` });
33
- exit(new Error('validation failed'));
34
- return;
35
- }
36
- payload = result.data;
37
- }
38
- catch (err) {
39
- setState({ status: 'error', message: `Error reading payload: ${err.message}` });
40
- exit(new Error('read error'));
41
- return;
42
- }
43
- const texts = Object.entries(payload).map(([key, value]) => ({ key, value }));
44
- if (!options.broadcast) {
45
- const lines = [
46
- `Dry run — would set ${texts.length} text records on ${ensName}:`,
47
- '',
48
- ...texts.map((t) => ` setText("${t.key}", "${t.value}")`),
49
- '',
50
- 'Run with --broadcast to submit on-chain.',
51
- ];
52
- setState({ status: 'done', message: lines.join('\n') });
53
- exit();
54
- return;
55
- }
56
- setState({ status: 'working', message: `Setting ${texts.length} text records on ${ensName}…` });
57
- try {
58
- const hash = await setEnsTextRecords(ensName, texts, options.privateKey);
59
- setState({ status: 'done', message: `✅ Transaction submitted: ${hash}` });
60
- exit();
61
- }
62
- catch (err) {
63
- setState({ status: 'error', message: `Transaction failed: ${err.message}` });
64
- exit(new Error('tx failed'));
65
- }
66
- }
67
- run();
68
- }, [exit, ensName, payloadFile, options]);
69
- return (React.createElement(Box, { flexDirection: "column" },
70
- state.status === 'idle' && React.createElement(Text, { color: "gray" }, "Preparing\u2026"),
71
- state.status === 'working' && React.createElement(Text, { color: "cyan" }, state.message),
72
- state.status === 'done' && React.createElement(Text, { color: "green" }, state.message),
73
- state.status === 'error' && React.createElement(Text, { color: "red" },
74
- "\u274C ",
75
- state.message)));
76
- }
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { z } from 'zod';
3
- export declare const description = "Publish registration file to IPFS via Pinata";
4
- export declare const args: z.ZodTuple<[z.ZodString], null>;
5
- type Props = {
6
- args: z.infer<typeof args>;
7
- };
8
- export default function RegistrationFilePublish({ args: [file] }: Props): React.JSX.Element;
9
- export {};
10
- //# sourceMappingURL=publish.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../src/commands/registration-file/publish.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,WAAW,iDAAiD,CAAA;AAEzE,eAAO,MAAM,IAAI,iCAA2D,CAAA;AAE5E,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAA;CAC3B,CAAA;AASD,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,qBAkFtE"}
@@ -1,79 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { Box, Text, useApp } from 'ink';
3
- import React from 'react';
4
- import { z } from 'zod';
5
- import { validateRegistrationFile } from '../../index.js';
6
- import { publishFile } from '@ens-node-metadata/shared';
7
- export const description = 'Publish registration file to IPFS via Pinata';
8
- export const args = z.tuple([z.string().describe('registration-file.json')]);
9
- export default function RegistrationFilePublish({ args: [file] }) {
10
- const { exit } = useApp();
11
- const [state, setState] = React.useState({ status: 'idle' });
12
- React.useEffect(() => {
13
- async function run() {
14
- // 1. Check env vars
15
- const pinataJwt = process.env.PINATA_JWT;
16
- const pinataKey = process.env.PINATA_API_KEY;
17
- const pinataSecret = process.env.PINATA_API_SECRET;
18
- if (!pinataJwt && !(pinataKey && pinataSecret)) {
19
- setState({
20
- status: 'error',
21
- message: 'Missing Pinata credentials. Set PINATA_JWT or both PINATA_API_KEY and PINATA_API_SECRET.',
22
- });
23
- exit(new Error('missing env vars'));
24
- return;
25
- }
26
- // 2. Validate registration file
27
- setState({ status: 'validating' });
28
- let raw;
29
- try {
30
- raw = JSON.parse(readFileSync(file, 'utf8'));
31
- }
32
- catch (err) {
33
- setState({ status: 'error', message: `Error reading file: ${err.message}` });
34
- exit(new Error('read error'));
35
- return;
36
- }
37
- const result = validateRegistrationFile(raw);
38
- if (!result.success) {
39
- const issues = result.error.issues
40
- .map((i) => `[${i.path.join('.') || 'root'}] ${i.message}`)
41
- .join('\n');
42
- setState({ status: 'error', message: `Invalid registration file:\n${issues}` });
43
- exit(new Error('validation failed'));
44
- return;
45
- }
46
- // 3. Upload to IPFS via Pinata
47
- setState({ status: 'uploading' });
48
- try {
49
- const { cid } = await publishFile({
50
- provider: 'pinata',
51
- filePath: file,
52
- pinataJwt,
53
- pinataKey,
54
- pinataSecret,
55
- schemaId: result.data.name,
56
- version: '1.0.0',
57
- });
58
- setState({ status: 'done', uri: `ipfs://${cid}` });
59
- exit();
60
- }
61
- catch (err) {
62
- setState({ status: 'error', message: `Upload failed: ${err.message}` });
63
- exit(new Error('upload failed'));
64
- }
65
- }
66
- run();
67
- }, [exit, file]);
68
- return (React.createElement(Box, { flexDirection: "column" },
69
- state.status === 'idle' && React.createElement(Text, { color: "gray" }, "Preparing\u2026"),
70
- state.status === 'validating' && React.createElement(Text, { color: "cyan" }, "Validating registration file\u2026"),
71
- state.status === 'uploading' && React.createElement(Text, { color: "cyan" }, "Uploading to IPFS via Pinata\u2026"),
72
- state.status === 'done' && (React.createElement(Box, { flexDirection: "column" },
73
- React.createElement(Text, { color: "green" }, "\u2705 Published to IPFS"),
74
- React.createElement(Text, null, state.uri))),
75
- state.status === 'error' && (React.createElement(Box, { flexDirection: "column" },
76
- React.createElement(Text, { color: "red" },
77
- "\u274C ",
78
- state.message)))));
79
- }
@@ -1,3 +0,0 @@
1
- export declare const description = "Generate empty ERC-8004 v2.0 registration file template";
2
- export default function RegistrationFileTemplate(): null;
3
- //# sourceMappingURL=template.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/commands/registration-file/template.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,4DAA4D,CAAA;AAwCpF,MAAM,CAAC,OAAO,UAAU,wBAAwB,SAQ/C"}
@@ -1,48 +0,0 @@
1
- import { useApp } from 'ink';
2
- import React from 'react';
3
- export const description = 'Generate empty ERC-8004 v2.0 registration file template';
4
- /**
5
- * Derived from <https://best-practices.8004scan.io/docs/01-agent-metadata-standard.html>
6
- */
7
- const TEMPLATE = {
8
- type: 'https://eips.ethereum.org/EIPS/eip-8004#registration-v1',
9
- name: 'My Agent',
10
- description: 'A short description of what this agent does and its capabilities.',
11
- image: 'https://example.com/agent-avatar.png',
12
- services: [
13
- {
14
- name: 'MCP',
15
- endpoint: 'https://api.example.com/mcp',
16
- version: '2025-11-25',
17
- mcpTools: [],
18
- capabilities: [],
19
- },
20
- {
21
- name: 'A2A',
22
- endpoint: 'https://example.com/.well-known/agent-card.json',
23
- version: '0.3.0',
24
- },
25
- {
26
- name: 'agentWallet',
27
- endpoint: 'eip155:1:0x0000000000000000000000000000000000000000',
28
- },
29
- ],
30
- registrations: [
31
- {
32
- agentId: 0,
33
- agentRegistry: 'eip155:1:0x8004a6090Cd10A7288092483047B097295Fb8847',
34
- },
35
- ],
36
- supportedTrust: ['reputation'],
37
- active: false,
38
- x402Support: false,
39
- updatedAt: Math.floor(Date.now() / 1000),
40
- };
41
- export default function RegistrationFileTemplate() {
42
- const { exit } = useApp();
43
- React.useEffect(() => {
44
- process.stdout.write(`${JSON.stringify(TEMPLATE, null, 2)}\n`);
45
- exit();
46
- }, [exit]);
47
- return null;
48
- }
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { z } from 'zod';
3
- export declare const description = "Validate registration file against ERC-8004 v2.0 schema";
4
- export declare const args: z.ZodTuple<[z.ZodString], null>;
5
- type Props = {
6
- args: z.infer<typeof args>;
7
- };
8
- export default function RegistrationFileValidate({ args: [file] }: Props): React.JSX.Element;
9
- export {};
10
- //# sourceMappingURL=validate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/registration-file/validate.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,WAAW,4DAA4D,CAAA;AAEpF,eAAO,MAAM,IAAI,iCAA2D,CAAA;AAE5E,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAA;CAC3B,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,qBAkCvE"}
@@ -1,35 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { Box, Text, useApp } from 'ink';
3
- import React from 'react';
4
- import { z } from 'zod';
5
- import { validateRegistrationFile } from '../../index.js';
6
- import { ZodIssueList } from '../../lib/ui.js';
7
- export const description = 'Validate registration file against ERC-8004 v2.0 schema';
8
- export const args = z.tuple([z.string().describe('registration-file.json')]);
9
- export default function RegistrationFileValidate({ args: [file] }) {
10
- const { exit } = useApp();
11
- let fileError = null;
12
- let result = null;
13
- try {
14
- const raw = JSON.parse(readFileSync(file, 'utf8'));
15
- result = validateRegistrationFile(raw);
16
- }
17
- catch (err) {
18
- fileError = err.message;
19
- }
20
- React.useEffect(() => {
21
- exit(fileError || (result && !result.success) ? new Error('validation failed') : undefined);
22
- }, [exit, fileError, result]);
23
- if (fileError) {
24
- return React.createElement(Text, { color: "red" },
25
- "\u274C Error reading file: ",
26
- fileError);
27
- }
28
- if (result.success) {
29
- return (React.createElement(Box, { flexDirection: "column" },
30
- React.createElement(Text, { color: "green" }, "\u2705 Valid ERC-8004 v2.0 AgentRegistrationFile")));
31
- }
32
- return (React.createElement(Box, { flexDirection: "column" },
33
- React.createElement(Text, { color: "red" }, "\u274C Invalid AgentRegistrationFile"),
34
- React.createElement(ZodIssueList, { issues: result.error.issues })));
35
- }
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { z } from 'zod';
3
- export declare const description = "Query ERC-8004 registry for agent identity";
4
- export declare const options: z.ZodObject<{
5
- chainName: z.ZodDefault<z.ZodEnum<["base", "mainnet"]>>;
6
- }, "strip", z.ZodTypeAny, {
7
- chainName: "base" | "mainnet";
8
- }, {
9
- chainName?: "base" | "mainnet" | undefined;
10
- }>;
11
- export declare const args: z.ZodTuple<[z.ZodString], null>;
12
- type Props = {
13
- options: z.infer<typeof options>;
14
- args: z.infer<typeof args>;
15
- };
16
- export default function RegistryIdentity({ options: { chainName }, args: [agentUri] }: Props): React.JSX.Element;
17
- export {};
18
- //# sourceMappingURL=identity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/commands/registry/identity.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,WAAW,+CAA+C,CAAA;AAEvE,eAAO,MAAM,OAAO;;;;;;EAKlB,CAAA;AAEF,eAAO,MAAM,IAAI,iCAA8C,CAAA;AAE/D,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAA;IAChC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAA;CAC3B,CAAA;AA+CD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,qBAuE3F"}
@@ -1,115 +0,0 @@
1
- import { Box, Text, useApp } from 'ink';
2
- import React from 'react';
3
- import { http, createPublicClient } from 'viem';
4
- import { base, mainnet } from 'viem/chains';
5
- import { z } from 'zod';
6
- export const description = 'Query ERC-8004 registry for agent identity';
7
- export const options = z.object({
8
- chainName: z
9
- .enum(['base', 'mainnet'])
10
- .default('mainnet')
11
- .describe('Chain to query (base | mainnet)'),
12
- });
13
- export const args = z.tuple([z.string().describe('agent-uri')]);
14
- /**
15
- * Known ERC-8004 Identity Registry contract addresses.
16
- * Override via ERC8004_REGISTRY_BASE / ERC8004_REGISTRY_MAINNET env vars.
17
- */
18
- const REGISTRY_ADDRESSES = {
19
- mainnet: (process.env.ERC8004_REGISTRY_MAINNET ??
20
- '0x0000000000000000000000000000000000000000'),
21
- base: (process.env.ERC8004_REGISTRY_BASE ??
22
- '0x0000000000000000000000000000000000000000'),
23
- };
24
- const ERC8004_REGISTRY_ABI = [
25
- {
26
- name: 'agentOf',
27
- type: 'function',
28
- stateMutability: 'view',
29
- inputs: [{ name: 'agentUri', type: 'string' }],
30
- outputs: [
31
- { name: 'owner', type: 'address' },
32
- { name: 'tokenId', type: 'uint256' },
33
- { name: 'agentUri', type: 'string' },
34
- ],
35
- },
36
- {
37
- name: 'balanceOf',
38
- type: 'function',
39
- stateMutability: 'view',
40
- inputs: [{ name: 'owner', type: 'address' }],
41
- outputs: [{ name: '', type: 'uint256' }],
42
- },
43
- ];
44
- export default function RegistryIdentity({ options: { chainName }, args: [agentUri] }) {
45
- const { exit } = useApp();
46
- const [state, setState] = React.useState({ status: 'loading' });
47
- React.useEffect(() => {
48
- async function run() {
49
- const chain = chainName === 'base' ? base : mainnet;
50
- const registryAddress = REGISTRY_ADDRESSES[chainName];
51
- if (registryAddress === '0x0000000000000000000000000000000000000000') {
52
- setState({
53
- status: 'error',
54
- message: `No registry address configured for ${chainName}.\n` +
55
- `Set ERC8004_REGISTRY_${chainName.toUpperCase()} env var to the contract address.`,
56
- });
57
- exit(new Error('no registry address'));
58
- return;
59
- }
60
- try {
61
- const client = createPublicClient({
62
- chain,
63
- transport: http(),
64
- });
65
- const result = await client.readContract({
66
- address: registryAddress,
67
- abi: ERC8004_REGISTRY_ABI,
68
- functionName: 'agentOf',
69
- args: [agentUri],
70
- });
71
- setState({
72
- status: 'done',
73
- identity: {
74
- owner: result[0],
75
- tokenId: result[1],
76
- agentUri: result[2],
77
- chain: chainName,
78
- registryAddress,
79
- },
80
- });
81
- exit();
82
- }
83
- catch (err) {
84
- setState({
85
- status: 'error',
86
- message: `Registry read failed: ${err.message}`,
87
- });
88
- exit(new Error('registry read failed'));
89
- }
90
- }
91
- run();
92
- }, [exit, chainName, agentUri]);
93
- return (React.createElement(Box, { flexDirection: "column" },
94
- state.status === 'loading' && React.createElement(Text, { color: "cyan" }, "Querying ERC-8004 registry\u2026"),
95
- state.status === 'done' && (React.createElement(Box, { flexDirection: "column" },
96
- React.createElement(Text, { color: "green" },
97
- "\u2705 Agent Identity (",
98
- state.identity.chain,
99
- ")"),
100
- React.createElement(Text, null,
101
- " Agent URI: ",
102
- state.identity.agentUri),
103
- React.createElement(Text, null,
104
- " Owner: ",
105
- state.identity.owner),
106
- React.createElement(Text, null,
107
- " Token ID: ",
108
- state.identity.tokenId.toString()),
109
- React.createElement(Text, null,
110
- " Registry: ",
111
- state.identity.registryAddress))),
112
- state.status === 'error' && React.createElement(Text, { color: "red" },
113
- "\u274C ",
114
- state.message)));
115
- }
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { z } from 'zod';
3
- export declare const description = "Print or install SKILL.md guide";
4
- export declare const options: z.ZodObject<{
5
- install: z.ZodDefault<z.ZodBoolean>;
6
- }, "strip", z.ZodTypeAny, {
7
- install: boolean;
8
- }, {
9
- install?: boolean | undefined;
10
- }>;
11
- type Props = {
12
- options: z.infer<typeof options>;
13
- };
14
- export default function Skill({ options: { install } }: Props): React.JSX.Element;
15
- export {};
16
- //# sourceMappingURL=skill.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/commands/skill.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,WAAW,oCAAoC,CAAA;AAE5D,eAAO,MAAM,OAAO;;;;;;EAElB,CAAA;AAEF,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAA;CACjC,CAAA;AAiBD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,qBA2B5D"}
@@ -1,53 +0,0 @@
1
- import { copyFileSync, existsSync, readFileSync } from 'node:fs';
2
- import { dirname, join, resolve } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- import { Text, useApp } from 'ink';
5
- import React from 'react';
6
- import { z } from 'zod';
7
- export const description = 'Print or install SKILL.md guide';
8
- export const options = z.object({
9
- install: z.boolean().default(false).describe('Copy SKILL.md to the current working directory'),
10
- });
11
- const __dirname = dirname(fileURLToPath(import.meta.url));
12
- function getSkillMdPath() {
13
- // When built: dist/commands/skill.js → root is ../../
14
- const candidates = [
15
- join(__dirname, '../../SKILL.md'),
16
- join(__dirname, '../SKILL.md'),
17
- join(__dirname, 'SKILL.md'),
18
- ];
19
- for (const p of candidates) {
20
- if (existsSync(p))
21
- return p;
22
- }
23
- throw new Error('SKILL.md not found in package');
24
- }
25
- export default function Skill({ options: { install } }) {
26
- const { exit } = useApp();
27
- const [output, setOutput] = React.useState('');
28
- const [error, setError] = React.useState(null);
29
- React.useEffect(() => {
30
- try {
31
- const skillPath = getSkillMdPath();
32
- const content = readFileSync(skillPath, 'utf8');
33
- if (install) {
34
- const dest = resolve(process.cwd(), 'SKILL.md');
35
- copyFileSync(skillPath, dest);
36
- setOutput(`✅ SKILL.md copied to ${dest}`);
37
- }
38
- else {
39
- setOutput(content);
40
- }
41
- }
42
- catch (err) {
43
- setError(err.message);
44
- }
45
- exit();
46
- }, [exit, install]);
47
- if (error) {
48
- return React.createElement(Text, { color: "red" },
49
- "\u274C ",
50
- error);
51
- }
52
- return React.createElement(Text, null, output);
53
- }
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { z } from 'zod';
3
- export declare const description = "Update existing agent's ENS metadata records";
4
- export declare const args: z.ZodTuple<[z.ZodString, z.ZodString], null>;
5
- export declare const options: z.ZodObject<{
6
- privateKey: z.ZodString;
7
- broadcast: z.ZodDefault<z.ZodBoolean>;
8
- }, "strip", z.ZodTypeAny, {
9
- privateKey: string;
10
- broadcast: boolean;
11
- }, {
12
- privateKey: string;
13
- broadcast?: boolean | undefined;
14
- }>;
15
- type Props = {
16
- args: z.infer<typeof args>;
17
- options: z.infer<typeof options>;
18
- };
19
- export default function Update({ args: [ensName, payloadFile], options }: Props): React.JSX.Element;
20
- export {};
21
- //# sourceMappingURL=update.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,WAAW,iDAAiD,CAAA;AAEzE,eAAO,MAAM,IAAI,8CAGf,CAAA;AAEF,eAAO,MAAM,OAAO;;;;;;;;;EAMlB,CAAA;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAA;IAC1B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAA;CACjC,CAAA;AAQD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,qBA8D9E"}
@@ -1,76 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { Box, Text, useApp } from 'ink';
3
- import React from 'react';
4
- import { z } from 'zod';
5
- import { AgentMetadataPayloadSchema } from '../index.js';
6
- import { setEnsTextRecords } from '../lib/ens-write.js';
7
- export const description = "Update existing agent's ENS metadata records";
8
- export const args = z.tuple([
9
- z.string().describe('ENS name (e.g. myagent.eth)'),
10
- z.string().describe('payload.json — flat ENS text-record object'),
11
- ]);
12
- export const options = z.object({
13
- privateKey: z.string().describe('Private key for signing (hex, prefixed with 0x)'),
14
- broadcast: z
15
- .boolean()
16
- .default(false)
17
- .describe('Broadcast the transaction on-chain (default: dry run)'),
18
- });
19
- export default function Update({ args: [ensName, payloadFile], options }) {
20
- const { exit } = useApp();
21
- const [state, setState] = React.useState({ status: 'idle' });
22
- React.useEffect(() => {
23
- async function run() {
24
- let payload;
25
- try {
26
- const raw = JSON.parse(readFileSync(payloadFile, 'utf8'));
27
- const result = AgentMetadataPayloadSchema.safeParse(raw);
28
- if (!result.success) {
29
- const issues = result.error.issues
30
- .map((i) => `[${i.path.join('.') || 'root'}] ${i.message}`)
31
- .join('\n');
32
- setState({ status: 'error', message: `Invalid payload:\n${issues}` });
33
- exit(new Error('validation failed'));
34
- return;
35
- }
36
- payload = result.data;
37
- }
38
- catch (err) {
39
- setState({ status: 'error', message: `Error reading payload: ${err.message}` });
40
- exit(new Error('read error'));
41
- return;
42
- }
43
- const texts = Object.entries(payload).map(([key, value]) => ({ key, value }));
44
- if (!options.broadcast) {
45
- const lines = [
46
- `Dry run — would update ${texts.length} text records on ${ensName}:`,
47
- '',
48
- ...texts.map((t) => ` setText("${t.key}", "${t.value}")`),
49
- '',
50
- 'Run with --broadcast to submit on-chain.',
51
- ];
52
- setState({ status: 'done', message: lines.join('\n') });
53
- exit();
54
- return;
55
- }
56
- setState({ status: 'working', message: `Updating ${texts.length} text records on ${ensName}…` });
57
- try {
58
- const hash = await setEnsTextRecords(ensName, texts, options.privateKey);
59
- setState({ status: 'done', message: `✅ Transaction submitted: ${hash}` });
60
- exit();
61
- }
62
- catch (err) {
63
- setState({ status: 'error', message: `Transaction failed: ${err.message}` });
64
- exit(new Error('tx failed'));
65
- }
66
- }
67
- run();
68
- }, [exit, ensName, payloadFile, options]);
69
- return (React.createElement(Box, { flexDirection: "column" },
70
- state.status === 'idle' && React.createElement(Text, { color: "gray" }, "Preparing\u2026"),
71
- state.status === 'working' && React.createElement(Text, { color: "cyan" }, state.message),
72
- state.status === 'done' && React.createElement(Text, { color: "green" }, state.message),
73
- state.status === 'error' && React.createElement(Text, { color: "red" },
74
- "\u274C ",
75
- state.message)));
76
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAErD"}
@@ -1,6 +0,0 @@
1
- export type TextRecord = {
2
- key: string;
3
- value: string;
4
- };
5
- export declare function setEnsTextRecords(ensName: string, texts: TextRecord[], privateKey: string): Promise<string>;
6
- //# sourceMappingURL=ens-write.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ens-write.d.ts","sourceRoot":"","sources":["../../src/lib/ens-write.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,UAAU,EAAE,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAwBjB"}