@halot/cli 1.0.3 → 1.0.5

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.
@@ -5,12 +5,15 @@ const wallet_manager_1 = require("@halot/cli/shared/wallet/wallet.manager");
5
5
  const authority_util_1 = require("@halot/cli/shared/wallet/authority.util");
6
6
  const init_cluster_util_1 = require("@halot/cli/shared/wallet/init-cluster.util");
7
7
  const workspace_service_1 = require("@halot/cli/shared/workspace/workspace.service");
8
+ const console_1 = require("@halot/cli/shared/ui/console");
8
9
  async function runProviderInitCommand(options = {}) {
9
10
  const cluster = (0, init_cluster_util_1.resolveInitCluster)(options);
10
11
  const authorities = (0, init_cluster_util_1.describeClusterAuthorities)(cluster);
11
12
  const workspace = new workspace_service_1.WorkspaceService();
12
13
  const walletManager = new wallet_manager_1.WalletManager(workspace);
13
14
  const wallets = walletManager.createWallets(cluster);
15
+ const zeroGAddress = (0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.zeroG);
16
+ const stellarAddress = (0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.stellar);
14
17
  workspace.writeProviderConfig({
15
18
  providerId: '',
16
19
  displayName: 'My Provider',
@@ -20,7 +23,7 @@ async function runProviderInitCommand(options = {}) {
20
23
  erc8004TokenId: '',
21
24
  agentRegistry: '',
22
25
  agentUri: '',
23
- ownerAddress: (0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.zeroG),
26
+ ownerAddress: zeroGAddress,
24
27
  domain: 'myprovider.0g',
25
28
  domainType: 'space-id',
26
29
  },
@@ -30,7 +33,21 @@ async function runProviderInitCommand(options = {}) {
30
33
  },
31
34
  settlementWallets: (0, authority_util_1.createDefaultSettlementWallets)(wallets),
32
35
  });
33
- console.log(`Provider ${cluster} workspace initialized.`);
34
- console.log(`${authorities.zeroG} authority: ${(0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.zeroG)}`);
35
- console.log(`${authorities.stellar} authority: ${(0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.stellar)}`);
36
+ (0, console_1.printInitSummary)({
37
+ title: 'Provider workspace initialized',
38
+ subtitle: `Cluster: ${cluster}`,
39
+ rows: [
40
+ { label: 'Actor', value: authorities.zeroG },
41
+ { label: '0G Wallet', value: zeroGAddress },
42
+ { label: 'Stellar', value: stellarAddress },
43
+ { label: 'Settlement', value: `${authorities.zeroG}, ${authorities.stellar}` },
44
+ ],
45
+ files: ['wallets.json', 'halot.provider.json', '.gitignore'],
46
+ warnings: ['wallets.json contains private keys. Do not commit it.'],
47
+ nextSteps: [
48
+ 'Edit halot.provider.json',
49
+ `Run ${(0, console_1.command)('halot provider register')}`,
50
+ `Run ${(0, console_1.command)('halot service init --name "GPT-5.4 Text" --category text')}`,
51
+ ],
52
+ });
36
53
  }
@@ -5,12 +5,15 @@ const wallet_manager_1 = require("@halot/cli/shared/wallet/wallet.manager");
5
5
  const authority_util_1 = require("@halot/cli/shared/wallet/authority.util");
6
6
  const init_cluster_util_1 = require("@halot/cli/shared/wallet/init-cluster.util");
7
7
  const workspace_service_1 = require("@halot/cli/shared/workspace/workspace.service");
8
+ const console_1 = require("@halot/cli/shared/ui/console");
8
9
  async function runRequesterInitCommand(options = {}) {
9
10
  const cluster = (0, init_cluster_util_1.resolveInitCluster)(options);
10
11
  const authorities = (0, init_cluster_util_1.describeClusterAuthorities)(cluster);
11
12
  const workspace = new workspace_service_1.WorkspaceService();
12
13
  const walletManager = new wallet_manager_1.WalletManager(workspace);
13
14
  const wallets = walletManager.createWallets(cluster);
15
+ const zeroGAddress = (0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.zeroG);
16
+ const stellarAddress = (0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.stellar);
14
17
  workspace.writeRequesterConfig({
15
18
  requesterId: '',
16
19
  displayName: 'Halot Requester',
@@ -19,7 +22,20 @@ async function runRequesterInitCommand(options = {}) {
19
22
  actor: authorities.zeroG,
20
23
  },
21
24
  });
22
- console.log(`Requester ${cluster} workspace initialized.`);
23
- console.log(`${authorities.zeroG} authority: ${(0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.zeroG)}`);
24
- console.log(`${authorities.stellar} authority: ${(0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.stellar)}`);
25
+ (0, console_1.printInitSummary)({
26
+ title: 'Requester workspace initialized',
27
+ subtitle: `Cluster: ${cluster}`,
28
+ rows: [
29
+ { label: 'Actor', value: authorities.zeroG },
30
+ { label: '0G Wallet', value: zeroGAddress },
31
+ { label: 'Stellar', value: stellarAddress },
32
+ ],
33
+ files: ['wallets.json', 'halot.requester.json', '.gitignore'],
34
+ warnings: ['wallets.json contains private keys. Do not commit it.'],
35
+ nextSteps: [
36
+ `Run ${(0, console_1.command)('halot browse')}`,
37
+ `Run ${(0, console_1.command)('halot quote --service <serviceId> --input \'{"query":"hello"}\'')}`,
38
+ `Run ${(0, console_1.command)('halot job create --service <serviceId> --input \'{"query":"hello"}\'')}`,
39
+ ],
40
+ });
25
41
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runServiceInitCommand = runServiceInitCommand;
4
4
  const sdk_1 = require("@halot/sdk");
5
+ const console_1 = require("@halot/cli/shared/ui/console");
5
6
  const workspace_service_1 = require("@halot/cli/shared/workspace/workspace.service");
6
7
  async function runServiceInitCommand(options) {
7
8
  const workspace = new workspace_service_1.WorkspaceService();
@@ -67,7 +68,21 @@ async function runServiceInitCommand(options) {
67
68
  },
68
69
  };
69
70
  workspace.writeService(fileName, service);
70
- console.log(`Created service draft services/${fileName}`);
71
+ (0, console_1.printInitSummary)({
72
+ title: 'Service draft initialized',
73
+ rows: [
74
+ { label: 'Service', value: name },
75
+ { label: 'Category', value: category },
76
+ { label: 'Trust', value: trustLevel },
77
+ { label: 'Draft', value: `services/${fileName}` },
78
+ ],
79
+ files: [`services/${fileName}`],
80
+ nextSteps: [
81
+ `Edit services/${fileName}`,
82
+ `Run ${(0, console_1.command)(`halot service register --file ${fileName}`)}`,
83
+ 'Use the returned serviceId in SDK middleware or worker configuration',
84
+ ],
85
+ });
71
86
  }
72
87
  function parseServiceCategory(value) {
73
88
  if (!value) {
@@ -5,12 +5,15 @@ const wallet_manager_1 = require("@halot/cli/shared/wallet/wallet.manager");
5
5
  const authority_util_1 = require("@halot/cli/shared/wallet/authority.util");
6
6
  const init_cluster_util_1 = require("@halot/cli/shared/wallet/init-cluster.util");
7
7
  const workspace_service_1 = require("@halot/cli/shared/workspace/workspace.service");
8
+ const console_1 = require("@halot/cli/shared/ui/console");
8
9
  async function runVerifierInitCommand(options = {}) {
9
10
  const cluster = (0, init_cluster_util_1.resolveInitCluster)(options);
10
11
  const authorities = (0, init_cluster_util_1.describeClusterAuthorities)(cluster);
11
12
  const workspace = new workspace_service_1.WorkspaceService();
12
13
  const walletManager = new wallet_manager_1.WalletManager(workspace);
13
14
  const wallets = walletManager.createWallets(cluster);
15
+ const zeroGAddress = (0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.zeroG);
16
+ const stellarAddress = (0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.stellar);
14
17
  workspace.writeVerifierConfig({
15
18
  verifierId: '',
16
19
  displayName: 'My Verifier',
@@ -19,7 +22,7 @@ async function runVerifierInitCommand(options = {}) {
19
22
  erc8004TokenId: '',
20
23
  agentRegistry: '',
21
24
  agentUri: '',
22
- ownerAddress: (0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.zeroG),
25
+ ownerAddress: zeroGAddress,
23
26
  domain: 'myverifier.0g',
24
27
  domainType: 'space-id',
25
28
  },
@@ -66,7 +69,29 @@ async function runVerifierInitCommand(options = {}) {
66
69
  maxConcurrentJobs: 5,
67
70
  minConfidenceThreshold: 0.75,
68
71
  });
69
- console.log(`Verifier ${cluster} workspace initialized.`);
70
- console.log(`${authorities.zeroG} authority: ${(0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.zeroG)}`);
71
- console.log(`${authorities.stellar} authority: ${(0, authority_util_1.resolveAuthorityAddress)(wallets, authorities.stellar)}`);
72
+ (0, console_1.printInitSummary)({
73
+ title: 'Verifier workspace initialized',
74
+ subtitle: `Cluster: ${cluster}`,
75
+ rows: [
76
+ { label: 'Actor', value: authorities.zeroG },
77
+ { label: '0G Wallet', value: zeroGAddress },
78
+ { label: 'Stellar', value: stellarAddress },
79
+ { label: 'Settlement', value: `${authorities.zeroG}, ${authorities.stellar}` },
80
+ ],
81
+ files: [
82
+ 'wallets.json',
83
+ 'halot.verifier.json',
84
+ 'model.config.json',
85
+ 'inference.json',
86
+ 'specializations.json',
87
+ '.gitignore',
88
+ ],
89
+ warnings: ['wallets.json contains private keys. Do not commit it.'],
90
+ nextSteps: [
91
+ 'Edit halot.verifier.json',
92
+ 'Edit model.config.json, inference.json, and specializations.json',
93
+ `Run ${(0, console_1.command)('halot verifier register')}`,
94
+ `Run ${(0, console_1.command)('halot verifier run')}`,
95
+ ],
96
+ });
72
97
  }
package/dist/index.js CHANGED
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
3
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
4
9
  const commander_1 = require("commander");
5
10
  const browse_command_1 = require("@halot/cli/features/browse/browse.command");
6
11
  const job_create_command_1 = require("@halot/cli/features/jobs/job-create.command");
@@ -28,7 +33,7 @@ const program = new commander_1.Command();
28
33
  program
29
34
  .name('halot')
30
35
  .description('Halot protocol CLI')
31
- .version('1.0.0');
36
+ .version(resolveCliVersion());
32
37
  program
33
38
  .command('browse')
34
39
  .option('--server <url>', 'Halot server url', defaultServerUrl)
@@ -142,3 +147,13 @@ program.parseAsync().catch((error) => {
142
147
  console.error(error instanceof Error ? error.message : error);
143
148
  process.exitCode = 1;
144
149
  });
150
+ function resolveCliVersion() {
151
+ try {
152
+ const packageJsonPath = node_path_1.default.resolve(__dirname, '..', 'package.json');
153
+ const packageJson = JSON.parse(node_fs_1.default.readFileSync(packageJsonPath, 'utf8'));
154
+ return packageJson.version ?? '0.0.0';
155
+ }
156
+ catch {
157
+ return '0.0.0';
158
+ }
159
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printInitSummary = printInitSummary;
4
+ exports.command = command;
5
+ const HALOT_ASCII = [
6
+ ' _ _ _ _ ___ _____',
7
+ '| | | | / \\ | | / _ \\_ _|',
8
+ '| |_| | / _ \\ | | | | | || |',
9
+ '| _ |/ ___ \\| |__| |_| || |',
10
+ '|_| |_/_/ \\_\\_____\\___/ |_|',
11
+ ].join('\n');
12
+ const colorEnabled = Boolean(process.stdout.isTTY && !process.env.NO_COLOR);
13
+ const paint = {
14
+ bold: (value) => wrap(value, '1', '22'),
15
+ dim: (value) => wrap(value, '2', '22'),
16
+ green: (value) => wrap(value, '32', '39'),
17
+ orange: (value) => wrap(value, '38;5;215', '39'),
18
+ cyan: (value) => wrap(value, '36', '39'),
19
+ };
20
+ function printInitSummary(summary) {
21
+ const output = [
22
+ '',
23
+ paint.orange(HALOT_ASCII),
24
+ '',
25
+ paint.bold(summary.title),
26
+ summary.subtitle ? paint.dim(summary.subtitle) : undefined,
27
+ summary.rows?.length ? renderRows(summary.rows) : undefined,
28
+ summary.files?.length ? renderList('Files', summary.files) : undefined,
29
+ summary.warnings?.length ? renderList('Notes', summary.warnings) : undefined,
30
+ summary.nextSteps?.length ? renderNumberedList('Next', summary.nextSteps) : undefined,
31
+ '',
32
+ ].filter((line) => Boolean(line));
33
+ console.log(output.join('\n'));
34
+ }
35
+ function command(value) {
36
+ return paint.cyan(value);
37
+ }
38
+ function renderRows(rows) {
39
+ const width = rows.reduce((max, row) => Math.max(max, row.label.length), 0);
40
+ return rows
41
+ .map((row) => `${paint.dim(row.label.padEnd(width))} ${paint.green(row.value)}`)
42
+ .join('\n');
43
+ }
44
+ function renderList(title, items) {
45
+ return [
46
+ paint.bold(title),
47
+ ...items.map((item) => `- ${item}`),
48
+ ].join('\n');
49
+ }
50
+ function renderNumberedList(title, items) {
51
+ return [
52
+ paint.bold(title),
53
+ ...items.map((item, index) => `${index + 1}. ${item}`),
54
+ ].join('\n');
55
+ }
56
+ function wrap(value, open, close) {
57
+ if (!colorEnabled) {
58
+ return value;
59
+ }
60
+ return `\x1b[${open}m${value}\x1b[${close}m`;
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halot/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Halot protocol CLI",
5
5
  "main": "dist/index.js",
6
6
  "bin": {