blitzwing 0.2.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blitzwing",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Interactive setup wizard to join a Blitzwing Petals mother swarm as a compute contributor",
5
5
  "bin": {
6
6
  "blitzwing": "bin/blitzwing.js"
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "license": "MIT",
25
25
  "config": {
26
- "discoveryUrl": "http://35.238.86.1:9000"
26
+ "discoveryUrl": "http://35.226.124.189:9000"
27
27
  },
28
28
  "dependencies": {
29
29
  "@clack/prompts": "^0.9.1",
package/src/config.js CHANGED
@@ -2,7 +2,7 @@
2
2
  export const DEFAULT_DISCOVERY_URL =
3
3
  process.env.BLITZWING_DISCOVERY_URL ||
4
4
  process.env.npm_package_config_discoveryUrl ||
5
- "http://35.238.86.1:9000";
5
+ "http://35.226.124.189:9000";
6
6
 
7
7
  export const HOME_DIR = process.env.BLITZWING_HOME || `${process.env.HOME || process.env.USERPROFILE}/.blitzwing`;
8
8
  export const STATE_PATH = `${HOME_DIR}/contributor.json`;
package/src/wizard.js CHANGED
@@ -117,48 +117,77 @@ async function wizard(args) {
117
117
  process.exit(1);
118
118
  }
119
119
 
120
- const layers = await p.text({
121
- message: `How many layers can this machine host? (1–${maxLayers})`,
122
- initialValue: String(Math.min(8, maxLayers)),
123
- validate(v) {
124
- const n = Number(v);
125
- if (!Number.isInteger(n) || n < 1 || n > maxLayers) {
126
- return `Enter an integer between 1 and ${maxLayers}`;
127
- }
128
- },
129
- });
130
- if (p.isCancel(layers)) {
131
- p.cancel("Setup cancelled");
132
- process.exit(0);
120
+ const nonInteractive =
121
+ process.env.BLITZWING_NONINTERACTIVE === "1" ||
122
+ process.env.BLITZWING_YES === "1" ||
123
+ !process.stdin.isTTY;
124
+
125
+ let layersN;
126
+ if (nonInteractive && process.env.BLITZWING_LAYERS) {
127
+ layersN = Number(process.env.BLITZWING_LAYERS);
128
+ if (!Number.isInteger(layersN) || layersN < 1 || layersN > maxLayers) {
129
+ p.cancel(`BLITZWING_LAYERS must be an integer between 1 and ${maxLayers}`);
130
+ process.exit(1);
131
+ }
132
+ p.log.info(`Layers: ${layersN} (non-interactive)`);
133
+ } else {
134
+ const layers = await p.text({
135
+ message: `How many layers can this machine host? (1–${maxLayers})`,
136
+ initialValue: String(Math.min(8, maxLayers)),
137
+ validate(v) {
138
+ const n = Number(v);
139
+ if (!Number.isInteger(n) || n < 1 || n > maxLayers) {
140
+ return `Enter an integer between 1 and ${maxLayers}`;
141
+ }
142
+ },
143
+ });
144
+ if (p.isCancel(layers)) {
145
+ p.cancel("Setup cancelled");
146
+ process.exit(0);
147
+ }
148
+ layersN = Number(layers);
133
149
  }
134
- const layersN = Number(layers);
135
150
 
136
151
  const hederaPrefill =
137
152
  process.env.BLITZWING_HEDERA_ACCOUNT_ID ||
138
153
  process.env.HEDERA_ACCOUNT_ID ||
139
154
  existing?.hedera_account_id ||
140
155
  "";
141
- const hederaAccount = await p.text({
142
- message: "Hedera account ID for layer payouts (e.g. 0.0.123456)",
143
- initialValue: hederaPrefill,
144
- validate(v) {
145
- const s = String(v || "").trim();
146
- if (!/^0\.0\.\d+$/.test(s)) return "Enter a Hedera account like 0.0.123456";
147
- },
148
- });
149
- if (p.isCancel(hederaAccount)) {
150
- p.cancel("Setup cancelled");
151
- process.exit(0);
156
+ let hederaAccountId;
157
+ if (nonInteractive && hederaPrefill) {
158
+ hederaAccountId = String(hederaPrefill).trim();
159
+ if (!/^0\.0\.\d+$/.test(hederaAccountId)) {
160
+ p.cancel("BLITZWING_HEDERA_ACCOUNT_ID must look like 0.0.123456");
161
+ process.exit(1);
162
+ }
163
+ p.log.info(`Hedera payouts: ${hederaAccountId} (non-interactive)`);
164
+ } else {
165
+ const hederaAccount = await p.text({
166
+ message: "Hedera account ID for layer payouts (e.g. 0.0.123456)",
167
+ initialValue: hederaPrefill,
168
+ validate(v) {
169
+ const s = String(v || "").trim();
170
+ if (!/^0\.0\.\d+$/.test(s)) return "Enter a Hedera account like 0.0.123456";
171
+ },
172
+ });
173
+ if (p.isCancel(hederaAccount)) {
174
+ p.cancel("Setup cancelled");
175
+ process.exit(0);
176
+ }
177
+ hederaAccountId = String(hederaAccount).trim();
152
178
  }
153
- const hederaAccountId = String(hederaAccount).trim();
154
179
 
155
- const confirm = await p.confirm({
156
- message: `Join ${selected.model} hosting ${layersN} layers, payouts to ${hederaAccountId}?`,
157
- initialValue: true,
158
- });
159
- if (p.isCancel(confirm) || !confirm) {
160
- p.cancel("Setup cancelled");
161
- process.exit(0);
180
+ if (!nonInteractive) {
181
+ const confirm = await p.confirm({
182
+ message: `Join ${selected.model} hosting ${layersN} layers, payouts to ${hederaAccountId}?`,
183
+ initialValue: true,
184
+ });
185
+ if (p.isCancel(confirm) || !confirm) {
186
+ p.cancel("Setup cancelled");
187
+ process.exit(0);
188
+ }
189
+ } else {
190
+ p.log.info(`Joining ${selected.model} with ${layersN} layers…`);
162
191
  }
163
192
 
164
193
  spin.start("Preparing Python environment + Petals");