@rainfall-devkit/sdk 0.2.3 → 0.2.4
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/dist/chunk-2FYYTIJQ.mjs +993 -0
- package/dist/cli/index.js +132 -8
- package/dist/cli/index.mjs +128 -8
- package/dist/daemon/index.d.mts +3 -3
- package/dist/daemon/index.d.ts +3 -3
- package/dist/daemon/index.js +5 -1
- package/dist/daemon/index.mjs +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -1
- package/dist/index.mjs +1 -1
- package/dist/listeners-BCEypw1u.d.ts +372 -0
- package/dist/listeners-BGdrWpkP.d.mts +372 -0
- package/dist/mcp.d.mts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +5 -1
- package/dist/mcp.mjs +1 -1
- package/dist/sdk-BUVNdBc7.d.mts +1167 -0
- package/dist/sdk-BUVNdBc7.d.ts +1167 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -491,9 +491,13 @@ var init_client = __esm({
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
const subscriberId = await this.ensureSubscriberId();
|
|
494
|
+
const body = params || {};
|
|
495
|
+
if (options?.targetEdge) {
|
|
496
|
+
body._targetEdge = options.targetEdge;
|
|
497
|
+
}
|
|
494
498
|
const response = await this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}`, {
|
|
495
499
|
method: "POST",
|
|
496
|
-
body
|
|
500
|
+
body
|
|
497
501
|
}, options);
|
|
498
502
|
if (response.success === false) {
|
|
499
503
|
const errorMessage = typeof response.error === "string" ? response.error : JSON.stringify(response.error);
|
|
@@ -4316,6 +4320,7 @@ Commands:
|
|
|
4316
4320
|
config llm Show LLM configuration
|
|
4317
4321
|
|
|
4318
4322
|
edge generate-keys Generate key pair for edge node encryption
|
|
4323
|
+
edge register <proc-node-id> Register a proc node for edge execution
|
|
4319
4324
|
edge status Show edge node security status
|
|
4320
4325
|
|
|
4321
4326
|
version Show version information
|
|
@@ -4661,6 +4666,7 @@ Options:
|
|
|
4661
4666
|
--raw Output raw JSON (no formatting)
|
|
4662
4667
|
--table Output as table (if applicable)
|
|
4663
4668
|
--terminal Output for terminal consumption (minimal formatting)
|
|
4669
|
+
--target-edge <id> Execute on specific edge node (for cross-node jobs)
|
|
4664
4670
|
--<key> <value> Pass individual parameters (e.g., --query "AI news")
|
|
4665
4671
|
Arrays: --tickers AAPL,GOOGL (comma-separated)
|
|
4666
4672
|
Numbers: --count 42
|
|
@@ -4673,6 +4679,7 @@ Examples:
|
|
|
4673
4679
|
rainfall run finviz-quotes --tickers AAPL,GOOGL,MSFT
|
|
4674
4680
|
rainfall run github-create-issue --owner facebook --repo react --title "Bug"
|
|
4675
4681
|
rainfall run github-create-issue -f ./issue.json
|
|
4682
|
+
rainfall run exa-web-search --query "latest AI" --target-edge <edge-id>
|
|
4676
4683
|
echo '{"query": "hello"}' | rainfall run exa-web-search
|
|
4677
4684
|
`);
|
|
4678
4685
|
return;
|
|
@@ -4680,6 +4687,7 @@ Examples:
|
|
|
4680
4687
|
let params = {};
|
|
4681
4688
|
const rawArgs = [];
|
|
4682
4689
|
let displayMode = "pretty";
|
|
4690
|
+
let targetEdge;
|
|
4683
4691
|
for (let i = 1; i < args.length; i++) {
|
|
4684
4692
|
const arg = args[i];
|
|
4685
4693
|
if (arg === "--params" || arg === "-p") {
|
|
@@ -4712,6 +4720,12 @@ Examples:
|
|
|
4712
4720
|
displayMode = "table";
|
|
4713
4721
|
} else if (arg === "--terminal") {
|
|
4714
4722
|
displayMode = "terminal";
|
|
4723
|
+
} else if (arg === "--target-edge") {
|
|
4724
|
+
targetEdge = args[++i];
|
|
4725
|
+
if (!targetEdge) {
|
|
4726
|
+
console.error("Error: --target-edge requires an edge node ID");
|
|
4727
|
+
process.exit(1);
|
|
4728
|
+
}
|
|
4715
4729
|
} else if (arg.startsWith("--")) {
|
|
4716
4730
|
const key = arg.slice(2);
|
|
4717
4731
|
const value = args[++i];
|
|
@@ -4767,7 +4781,7 @@ Examples:
|
|
|
4767
4781
|
};
|
|
4768
4782
|
} catch {
|
|
4769
4783
|
}
|
|
4770
|
-
const cliFlags = /* @__PURE__ */ new Set(["--params", "-p", "--file", "-f", "--raw", "--table", "--terminal"]);
|
|
4784
|
+
const cliFlags = /* @__PURE__ */ new Set(["--params", "-p", "--file", "-f", "--raw", "--table", "--terminal", "--target-edge"]);
|
|
4771
4785
|
const toolArgs = args.slice(1).filter((arg, i, arr) => {
|
|
4772
4786
|
if (cliFlags.has(arg)) {
|
|
4773
4787
|
return false;
|
|
@@ -4826,6 +4840,8 @@ Examples:
|
|
|
4826
4840
|
let result;
|
|
4827
4841
|
if (skipExecution !== void 0) {
|
|
4828
4842
|
result = skipExecution;
|
|
4843
|
+
} else if (targetEdge) {
|
|
4844
|
+
result = await rainfall.executeTool(toolId, executionParams, { targetEdge });
|
|
4829
4845
|
} else {
|
|
4830
4846
|
result = await rainfall.executeTool(toolId, executionParams);
|
|
4831
4847
|
}
|
|
@@ -5153,7 +5169,7 @@ async function edgeGenerateKeys() {
|
|
|
5153
5169
|
console.log(" Private:", privateKeyPath);
|
|
5154
5170
|
console.log("\n\u{1F4CB} To register this edge node:");
|
|
5155
5171
|
console.log(" 1. Copy the public key above");
|
|
5156
|
-
console.log(" 2. Register with: rainfall edge register <public-key>");
|
|
5172
|
+
console.log(" 2. Register proc node with: rainfall edge register <proc-node-id> --public-key <key>");
|
|
5157
5173
|
console.log(" 3. The backend will return an edgeNodeSecret (JWT)");
|
|
5158
5174
|
console.log(" 4. Store the secret securely - it expires in 30 days");
|
|
5159
5175
|
} catch (error) {
|
|
@@ -5161,6 +5177,98 @@ async function edgeGenerateKeys() {
|
|
|
5161
5177
|
process.exit(1);
|
|
5162
5178
|
}
|
|
5163
5179
|
}
|
|
5180
|
+
async function edgeRegister(args) {
|
|
5181
|
+
const procNodeId = args[0];
|
|
5182
|
+
if (!procNodeId) {
|
|
5183
|
+
console.error("Error: Proc node ID required");
|
|
5184
|
+
console.error("\nUsage: rainfall edge register <proc-node-id> [options]");
|
|
5185
|
+
console.error("\nOptions:");
|
|
5186
|
+
console.error(" --public-key <key> Public key for encryption (optional)");
|
|
5187
|
+
console.error(" --list <id1,id2,...> Register multiple proc nodes (comma-separated)");
|
|
5188
|
+
console.error("\nExamples:");
|
|
5189
|
+
console.error(" rainfall edge register exa-web-search");
|
|
5190
|
+
console.error(' rainfall edge register exa-web-search --public-key "base64key..."');
|
|
5191
|
+
console.error(' rainfall edge register --list "exa-web-search,github-create-issue"');
|
|
5192
|
+
process.exit(1);
|
|
5193
|
+
}
|
|
5194
|
+
const rainfall = getRainfall();
|
|
5195
|
+
const config = loadConfig();
|
|
5196
|
+
let publicKey;
|
|
5197
|
+
let procNodeIds = [procNodeId];
|
|
5198
|
+
for (let i = 1; i < args.length; i++) {
|
|
5199
|
+
const arg = args[i];
|
|
5200
|
+
if (arg === "--public-key" || arg === "-k") {
|
|
5201
|
+
publicKey = args[++i];
|
|
5202
|
+
} else if (arg === "--list" || arg === "-l") {
|
|
5203
|
+
const list = args[++i];
|
|
5204
|
+
if (list) {
|
|
5205
|
+
procNodeIds = list.split(",").map((id) => id.trim());
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
5208
|
+
}
|
|
5209
|
+
if (!publicKey) {
|
|
5210
|
+
const configDir = getConfigDir();
|
|
5211
|
+
const keysDir = (0, import_path2.join)(configDir, "keys");
|
|
5212
|
+
const publicKeyPath = (0, import_path2.join)(keysDir, "edge-node.pub");
|
|
5213
|
+
if ((0, import_fs2.existsSync)(publicKeyPath)) {
|
|
5214
|
+
publicKey = (0, import_fs2.readFileSync)(publicKeyPath, "utf-8");
|
|
5215
|
+
}
|
|
5216
|
+
}
|
|
5217
|
+
console.log(`\u{1F310} Registering ${procNodeIds.length} proc node(s) for edge execution...
|
|
5218
|
+
`);
|
|
5219
|
+
try {
|
|
5220
|
+
let edgeNodeId = config.edgeNodeId;
|
|
5221
|
+
if (!edgeNodeId) {
|
|
5222
|
+
console.log("\u{1F4E1} Registering edge node with backend...");
|
|
5223
|
+
const registerResult = await rainfall.executeTool("register-edge-node", {
|
|
5224
|
+
hostname: process.env.HOSTNAME || "local-edge",
|
|
5225
|
+
capabilities: procNodeIds,
|
|
5226
|
+
version: "1.0.0",
|
|
5227
|
+
metadata: {
|
|
5228
|
+
publicKey: publicKey || void 0,
|
|
5229
|
+
source: "rainfall-devkit-cli"
|
|
5230
|
+
}
|
|
5231
|
+
});
|
|
5232
|
+
edgeNodeId = registerResult.edgeNodeId;
|
|
5233
|
+
console.log(` Edge node registered: ${edgeNodeId}`);
|
|
5234
|
+
} else {
|
|
5235
|
+
console.log(` Using existing edge node: ${edgeNodeId}`);
|
|
5236
|
+
}
|
|
5237
|
+
console.log("\n\u{1F4E1} Registering proc nodes...");
|
|
5238
|
+
const result = await rainfall.executeTool("register-proc-edge-nodes", {
|
|
5239
|
+
edgeNodeId,
|
|
5240
|
+
procNodeIds,
|
|
5241
|
+
publicKey,
|
|
5242
|
+
hostname: process.env.HOSTNAME || "local-edge"
|
|
5243
|
+
});
|
|
5244
|
+
if (!result.success) {
|
|
5245
|
+
console.error("\u274C Registration failed");
|
|
5246
|
+
process.exit(1);
|
|
5247
|
+
}
|
|
5248
|
+
config.edgeNodeId = result.edgeNodeId;
|
|
5249
|
+
config.edgeNodeSecret = result.edgeNodeSecret;
|
|
5250
|
+
config.edgeNodeKeysPath = (0, import_path2.join)(getConfigDir(), "keys");
|
|
5251
|
+
saveConfig(config);
|
|
5252
|
+
console.log("\u2705 Proc node(s) registered successfully!\n");
|
|
5253
|
+
console.log("Edge Node ID:", result.edgeNodeId);
|
|
5254
|
+
console.log("Proc Nodes Registered:");
|
|
5255
|
+
for (const nodeId of result.registeredProcNodes) {
|
|
5256
|
+
console.log(` \u2022 ${nodeId}`);
|
|
5257
|
+
}
|
|
5258
|
+
console.log("\n\u{1F510} Edge node secret stored in config.");
|
|
5259
|
+
console.log(" This secret is used for authentication with the backend.");
|
|
5260
|
+
console.log("\n\u{1F4CB} You can now run tools on this edge node:");
|
|
5261
|
+
console.log(` rainfall run ${procNodeIds[0]} --target-edge ${result.edgeNodeId}`);
|
|
5262
|
+
} catch (error) {
|
|
5263
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5264
|
+
console.error("\u274C Failed to register proc node:", message);
|
|
5265
|
+
if (message.includes("not found") || message.includes("does not exist")) {
|
|
5266
|
+
console.error("\n\u{1F4A1} The backend may not have the registration tools yet.");
|
|
5267
|
+
console.error(" Make sure you are running the latest version of Rainyday.");
|
|
5268
|
+
}
|
|
5269
|
+
process.exit(1);
|
|
5270
|
+
}
|
|
5271
|
+
}
|
|
5164
5272
|
async function edgeStatus() {
|
|
5165
5273
|
const configDir = getConfigDir();
|
|
5166
5274
|
const keysDir = (0, import_path2.join)(configDir, "keys");
|
|
@@ -5178,23 +5286,36 @@ async function edgeStatus() {
|
|
|
5178
5286
|
console.log(" " + publicKey.substring(0, 50) + "...");
|
|
5179
5287
|
}
|
|
5180
5288
|
const config = loadConfig();
|
|
5289
|
+
console.log("\nRegistration:");
|
|
5181
5290
|
if (config.edgeNodeId) {
|
|
5182
|
-
console.log("\nRegistration:");
|
|
5183
5291
|
console.log(" Edge Node ID:", config.edgeNodeId);
|
|
5292
|
+
} else {
|
|
5293
|
+
console.log(" Edge Node ID: \u274C Not registered");
|
|
5184
5294
|
}
|
|
5185
5295
|
if (config.edgeNodeSecret) {
|
|
5186
|
-
console.log(" JWT Secret: \u2705 Present
|
|
5296
|
+
console.log(" JWT Secret: \u2705 Present");
|
|
5297
|
+
const masked = config.edgeNodeSecret.substring(0, 10) + "..." + config.edgeNodeSecret.substring(config.edgeNodeSecret.length - 4);
|
|
5298
|
+
console.log(" (" + masked + ")");
|
|
5187
5299
|
} else {
|
|
5188
5300
|
console.log(" JWT Secret: \u274C Not configured");
|
|
5189
5301
|
}
|
|
5302
|
+
if (config.procNodeIds && config.procNodeIds.length > 0) {
|
|
5303
|
+
console.log("\nRegistered Proc Nodes:");
|
|
5304
|
+
for (const nodeId of config.procNodeIds) {
|
|
5305
|
+
console.log(` \u2022 ${nodeId}`);
|
|
5306
|
+
}
|
|
5307
|
+
}
|
|
5190
5308
|
console.log("\n\u{1F4DA} Next steps:");
|
|
5191
5309
|
if (!hasPublicKey) {
|
|
5192
5310
|
console.log(" 1. Run: rainfall edge generate-keys");
|
|
5311
|
+
console.log(" 2. Run: rainfall edge register <proc-node-id>");
|
|
5193
5312
|
} else if (!config.edgeNodeSecret) {
|
|
5194
|
-
console.log(" 1. Register your
|
|
5195
|
-
console.log("
|
|
5313
|
+
console.log(" 1. Register your proc node:");
|
|
5314
|
+
console.log(" rainfall edge register exa-web-search");
|
|
5196
5315
|
} else {
|
|
5197
5316
|
console.log(" Edge node is configured and ready for secure operation");
|
|
5317
|
+
console.log(" Run tools on this edge node:");
|
|
5318
|
+
console.log(` rainfall run <tool> --target-edge ${config.edgeNodeId}`);
|
|
5198
5319
|
}
|
|
5199
5320
|
}
|
|
5200
5321
|
async function main() {
|
|
@@ -5307,12 +5428,15 @@ async function main() {
|
|
|
5307
5428
|
case "generate-keys":
|
|
5308
5429
|
await edgeGenerateKeys();
|
|
5309
5430
|
break;
|
|
5431
|
+
case "register":
|
|
5432
|
+
await edgeRegister(rest);
|
|
5433
|
+
break;
|
|
5310
5434
|
case "status":
|
|
5311
5435
|
await edgeStatus();
|
|
5312
5436
|
break;
|
|
5313
5437
|
default:
|
|
5314
5438
|
console.error("Error: Unknown edge subcommand");
|
|
5315
|
-
console.error("\nUsage: rainfall edge <generate-keys|status>");
|
|
5439
|
+
console.error("\nUsage: rainfall edge <generate-keys|register|status>");
|
|
5316
5440
|
process.exit(1);
|
|
5317
5441
|
}
|
|
5318
5442
|
break;
|
package/dist/cli/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "../chunk-6FXRLPLR.mjs";
|
|
6
6
|
import {
|
|
7
7
|
Rainfall
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-2FYYTIJQ.mjs";
|
|
9
9
|
import "../chunk-LJQEO3CY.mjs";
|
|
10
10
|
import {
|
|
11
11
|
formatResult
|
|
@@ -54,6 +54,7 @@ Commands:
|
|
|
54
54
|
config llm Show LLM configuration
|
|
55
55
|
|
|
56
56
|
edge generate-keys Generate key pair for edge node encryption
|
|
57
|
+
edge register <proc-node-id> Register a proc node for edge execution
|
|
57
58
|
edge status Show edge node security status
|
|
58
59
|
|
|
59
60
|
version Show version information
|
|
@@ -399,6 +400,7 @@ Options:
|
|
|
399
400
|
--raw Output raw JSON (no formatting)
|
|
400
401
|
--table Output as table (if applicable)
|
|
401
402
|
--terminal Output for terminal consumption (minimal formatting)
|
|
403
|
+
--target-edge <id> Execute on specific edge node (for cross-node jobs)
|
|
402
404
|
--<key> <value> Pass individual parameters (e.g., --query "AI news")
|
|
403
405
|
Arrays: --tickers AAPL,GOOGL (comma-separated)
|
|
404
406
|
Numbers: --count 42
|
|
@@ -411,6 +413,7 @@ Examples:
|
|
|
411
413
|
rainfall run finviz-quotes --tickers AAPL,GOOGL,MSFT
|
|
412
414
|
rainfall run github-create-issue --owner facebook --repo react --title "Bug"
|
|
413
415
|
rainfall run github-create-issue -f ./issue.json
|
|
416
|
+
rainfall run exa-web-search --query "latest AI" --target-edge <edge-id>
|
|
414
417
|
echo '{"query": "hello"}' | rainfall run exa-web-search
|
|
415
418
|
`);
|
|
416
419
|
return;
|
|
@@ -418,6 +421,7 @@ Examples:
|
|
|
418
421
|
let params = {};
|
|
419
422
|
const rawArgs = [];
|
|
420
423
|
let displayMode = "pretty";
|
|
424
|
+
let targetEdge;
|
|
421
425
|
for (let i = 1; i < args.length; i++) {
|
|
422
426
|
const arg = args[i];
|
|
423
427
|
if (arg === "--params" || arg === "-p") {
|
|
@@ -450,6 +454,12 @@ Examples:
|
|
|
450
454
|
displayMode = "table";
|
|
451
455
|
} else if (arg === "--terminal") {
|
|
452
456
|
displayMode = "terminal";
|
|
457
|
+
} else if (arg === "--target-edge") {
|
|
458
|
+
targetEdge = args[++i];
|
|
459
|
+
if (!targetEdge) {
|
|
460
|
+
console.error("Error: --target-edge requires an edge node ID");
|
|
461
|
+
process.exit(1);
|
|
462
|
+
}
|
|
453
463
|
} else if (arg.startsWith("--")) {
|
|
454
464
|
const key = arg.slice(2);
|
|
455
465
|
const value = args[++i];
|
|
@@ -505,7 +515,7 @@ Examples:
|
|
|
505
515
|
};
|
|
506
516
|
} catch {
|
|
507
517
|
}
|
|
508
|
-
const cliFlags = /* @__PURE__ */ new Set(["--params", "-p", "--file", "-f", "--raw", "--table", "--terminal"]);
|
|
518
|
+
const cliFlags = /* @__PURE__ */ new Set(["--params", "-p", "--file", "-f", "--raw", "--table", "--terminal", "--target-edge"]);
|
|
509
519
|
const toolArgs = args.slice(1).filter((arg, i, arr) => {
|
|
510
520
|
if (cliFlags.has(arg)) {
|
|
511
521
|
return false;
|
|
@@ -564,6 +574,8 @@ Examples:
|
|
|
564
574
|
let result;
|
|
565
575
|
if (skipExecution !== void 0) {
|
|
566
576
|
result = skipExecution;
|
|
577
|
+
} else if (targetEdge) {
|
|
578
|
+
result = await rainfall.executeTool(toolId, executionParams, { targetEdge });
|
|
567
579
|
} else {
|
|
568
580
|
result = await rainfall.executeTool(toolId, executionParams);
|
|
569
581
|
}
|
|
@@ -891,7 +903,7 @@ async function edgeGenerateKeys() {
|
|
|
891
903
|
console.log(" Private:", privateKeyPath);
|
|
892
904
|
console.log("\n\u{1F4CB} To register this edge node:");
|
|
893
905
|
console.log(" 1. Copy the public key above");
|
|
894
|
-
console.log(" 2. Register with: rainfall edge register <public-key>");
|
|
906
|
+
console.log(" 2. Register proc node with: rainfall edge register <proc-node-id> --public-key <key>");
|
|
895
907
|
console.log(" 3. The backend will return an edgeNodeSecret (JWT)");
|
|
896
908
|
console.log(" 4. Store the secret securely - it expires in 30 days");
|
|
897
909
|
} catch (error) {
|
|
@@ -899,6 +911,98 @@ async function edgeGenerateKeys() {
|
|
|
899
911
|
process.exit(1);
|
|
900
912
|
}
|
|
901
913
|
}
|
|
914
|
+
async function edgeRegister(args) {
|
|
915
|
+
const procNodeId = args[0];
|
|
916
|
+
if (!procNodeId) {
|
|
917
|
+
console.error("Error: Proc node ID required");
|
|
918
|
+
console.error("\nUsage: rainfall edge register <proc-node-id> [options]");
|
|
919
|
+
console.error("\nOptions:");
|
|
920
|
+
console.error(" --public-key <key> Public key for encryption (optional)");
|
|
921
|
+
console.error(" --list <id1,id2,...> Register multiple proc nodes (comma-separated)");
|
|
922
|
+
console.error("\nExamples:");
|
|
923
|
+
console.error(" rainfall edge register exa-web-search");
|
|
924
|
+
console.error(' rainfall edge register exa-web-search --public-key "base64key..."');
|
|
925
|
+
console.error(' rainfall edge register --list "exa-web-search,github-create-issue"');
|
|
926
|
+
process.exit(1);
|
|
927
|
+
}
|
|
928
|
+
const rainfall = getRainfall();
|
|
929
|
+
const config = loadConfig();
|
|
930
|
+
let publicKey;
|
|
931
|
+
let procNodeIds = [procNodeId];
|
|
932
|
+
for (let i = 1; i < args.length; i++) {
|
|
933
|
+
const arg = args[i];
|
|
934
|
+
if (arg === "--public-key" || arg === "-k") {
|
|
935
|
+
publicKey = args[++i];
|
|
936
|
+
} else if (arg === "--list" || arg === "-l") {
|
|
937
|
+
const list = args[++i];
|
|
938
|
+
if (list) {
|
|
939
|
+
procNodeIds = list.split(",").map((id) => id.trim());
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
if (!publicKey) {
|
|
944
|
+
const configDir = getConfigDir();
|
|
945
|
+
const keysDir = join(configDir, "keys");
|
|
946
|
+
const publicKeyPath = join(keysDir, "edge-node.pub");
|
|
947
|
+
if (existsSync(publicKeyPath)) {
|
|
948
|
+
publicKey = readFileSync(publicKeyPath, "utf-8");
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
console.log(`\u{1F310} Registering ${procNodeIds.length} proc node(s) for edge execution...
|
|
952
|
+
`);
|
|
953
|
+
try {
|
|
954
|
+
let edgeNodeId = config.edgeNodeId;
|
|
955
|
+
if (!edgeNodeId) {
|
|
956
|
+
console.log("\u{1F4E1} Registering edge node with backend...");
|
|
957
|
+
const registerResult = await rainfall.executeTool("register-edge-node", {
|
|
958
|
+
hostname: process.env.HOSTNAME || "local-edge",
|
|
959
|
+
capabilities: procNodeIds,
|
|
960
|
+
version: "1.0.0",
|
|
961
|
+
metadata: {
|
|
962
|
+
publicKey: publicKey || void 0,
|
|
963
|
+
source: "rainfall-devkit-cli"
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
edgeNodeId = registerResult.edgeNodeId;
|
|
967
|
+
console.log(` Edge node registered: ${edgeNodeId}`);
|
|
968
|
+
} else {
|
|
969
|
+
console.log(` Using existing edge node: ${edgeNodeId}`);
|
|
970
|
+
}
|
|
971
|
+
console.log("\n\u{1F4E1} Registering proc nodes...");
|
|
972
|
+
const result = await rainfall.executeTool("register-proc-edge-nodes", {
|
|
973
|
+
edgeNodeId,
|
|
974
|
+
procNodeIds,
|
|
975
|
+
publicKey,
|
|
976
|
+
hostname: process.env.HOSTNAME || "local-edge"
|
|
977
|
+
});
|
|
978
|
+
if (!result.success) {
|
|
979
|
+
console.error("\u274C Registration failed");
|
|
980
|
+
process.exit(1);
|
|
981
|
+
}
|
|
982
|
+
config.edgeNodeId = result.edgeNodeId;
|
|
983
|
+
config.edgeNodeSecret = result.edgeNodeSecret;
|
|
984
|
+
config.edgeNodeKeysPath = join(getConfigDir(), "keys");
|
|
985
|
+
saveConfig(config);
|
|
986
|
+
console.log("\u2705 Proc node(s) registered successfully!\n");
|
|
987
|
+
console.log("Edge Node ID:", result.edgeNodeId);
|
|
988
|
+
console.log("Proc Nodes Registered:");
|
|
989
|
+
for (const nodeId of result.registeredProcNodes) {
|
|
990
|
+
console.log(` \u2022 ${nodeId}`);
|
|
991
|
+
}
|
|
992
|
+
console.log("\n\u{1F510} Edge node secret stored in config.");
|
|
993
|
+
console.log(" This secret is used for authentication with the backend.");
|
|
994
|
+
console.log("\n\u{1F4CB} You can now run tools on this edge node:");
|
|
995
|
+
console.log(` rainfall run ${procNodeIds[0]} --target-edge ${result.edgeNodeId}`);
|
|
996
|
+
} catch (error) {
|
|
997
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
998
|
+
console.error("\u274C Failed to register proc node:", message);
|
|
999
|
+
if (message.includes("not found") || message.includes("does not exist")) {
|
|
1000
|
+
console.error("\n\u{1F4A1} The backend may not have the registration tools yet.");
|
|
1001
|
+
console.error(" Make sure you are running the latest version of Rainyday.");
|
|
1002
|
+
}
|
|
1003
|
+
process.exit(1);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
902
1006
|
async function edgeStatus() {
|
|
903
1007
|
const configDir = getConfigDir();
|
|
904
1008
|
const keysDir = join(configDir, "keys");
|
|
@@ -916,23 +1020,36 @@ async function edgeStatus() {
|
|
|
916
1020
|
console.log(" " + publicKey.substring(0, 50) + "...");
|
|
917
1021
|
}
|
|
918
1022
|
const config = loadConfig();
|
|
1023
|
+
console.log("\nRegistration:");
|
|
919
1024
|
if (config.edgeNodeId) {
|
|
920
|
-
console.log("\nRegistration:");
|
|
921
1025
|
console.log(" Edge Node ID:", config.edgeNodeId);
|
|
1026
|
+
} else {
|
|
1027
|
+
console.log(" Edge Node ID: \u274C Not registered");
|
|
922
1028
|
}
|
|
923
1029
|
if (config.edgeNodeSecret) {
|
|
924
|
-
console.log(" JWT Secret: \u2705 Present
|
|
1030
|
+
console.log(" JWT Secret: \u2705 Present");
|
|
1031
|
+
const masked = config.edgeNodeSecret.substring(0, 10) + "..." + config.edgeNodeSecret.substring(config.edgeNodeSecret.length - 4);
|
|
1032
|
+
console.log(" (" + masked + ")");
|
|
925
1033
|
} else {
|
|
926
1034
|
console.log(" JWT Secret: \u274C Not configured");
|
|
927
1035
|
}
|
|
1036
|
+
if (config.procNodeIds && config.procNodeIds.length > 0) {
|
|
1037
|
+
console.log("\nRegistered Proc Nodes:");
|
|
1038
|
+
for (const nodeId of config.procNodeIds) {
|
|
1039
|
+
console.log(` \u2022 ${nodeId}`);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
928
1042
|
console.log("\n\u{1F4DA} Next steps:");
|
|
929
1043
|
if (!hasPublicKey) {
|
|
930
1044
|
console.log(" 1. Run: rainfall edge generate-keys");
|
|
1045
|
+
console.log(" 2. Run: rainfall edge register <proc-node-id>");
|
|
931
1046
|
} else if (!config.edgeNodeSecret) {
|
|
932
|
-
console.log(" 1. Register your
|
|
933
|
-
console.log("
|
|
1047
|
+
console.log(" 1. Register your proc node:");
|
|
1048
|
+
console.log(" rainfall edge register exa-web-search");
|
|
934
1049
|
} else {
|
|
935
1050
|
console.log(" Edge node is configured and ready for secure operation");
|
|
1051
|
+
console.log(" Run tools on this edge node:");
|
|
1052
|
+
console.log(` rainfall run <tool> --target-edge ${config.edgeNodeId}`);
|
|
936
1053
|
}
|
|
937
1054
|
}
|
|
938
1055
|
async function main() {
|
|
@@ -1045,12 +1162,15 @@ async function main() {
|
|
|
1045
1162
|
case "generate-keys":
|
|
1046
1163
|
await edgeGenerateKeys();
|
|
1047
1164
|
break;
|
|
1165
|
+
case "register":
|
|
1166
|
+
await edgeRegister(rest);
|
|
1167
|
+
break;
|
|
1048
1168
|
case "status":
|
|
1049
1169
|
await edgeStatus();
|
|
1050
1170
|
break;
|
|
1051
1171
|
default:
|
|
1052
1172
|
console.error("Error: Unknown edge subcommand");
|
|
1053
|
-
console.error("\nUsage: rainfall edge <generate-keys|status>");
|
|
1173
|
+
console.error("\nUsage: rainfall edge <generate-keys|register|status>");
|
|
1054
1174
|
process.exit(1);
|
|
1055
1175
|
}
|
|
1056
1176
|
break;
|
package/dist/daemon/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as RainfallConfig, g as MCPClientConfig, h as MCPProxyHub } from '../sdk-
|
|
2
|
-
export { i as MCPClientInfo, j as MCPToolInfo, k as MCPTransportType } from '../sdk-
|
|
3
|
-
import { N as NetworkedExecutorOptions, C as ContextOptions, R as RainfallNetworkedExecutor, a as RainfallDaemonContext, b as RainfallListenerRegistry } from '../listeners-
|
|
1
|
+
import { R as RainfallConfig, g as MCPClientConfig, h as MCPProxyHub } from '../sdk-BUVNdBc7.mjs';
|
|
2
|
+
export { i as MCPClientInfo, j as MCPToolInfo, k as MCPTransportType } from '../sdk-BUVNdBc7.mjs';
|
|
3
|
+
import { N as NetworkedExecutorOptions, C as ContextOptions, R as RainfallNetworkedExecutor, a as RainfallDaemonContext, b as RainfallListenerRegistry } from '../listeners-BGdrWpkP.mjs';
|
|
4
4
|
import 'ws';
|
|
5
5
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/stdio.js';
|
package/dist/daemon/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as RainfallConfig, g as MCPClientConfig, h as MCPProxyHub } from '../sdk-
|
|
2
|
-
export { i as MCPClientInfo, j as MCPToolInfo, k as MCPTransportType } from '../sdk-
|
|
3
|
-
import { N as NetworkedExecutorOptions, C as ContextOptions, R as RainfallNetworkedExecutor, a as RainfallDaemonContext, b as RainfallListenerRegistry } from '../listeners-
|
|
1
|
+
import { R as RainfallConfig, g as MCPClientConfig, h as MCPProxyHub } from '../sdk-BUVNdBc7.js';
|
|
2
|
+
export { i as MCPClientInfo, j as MCPToolInfo, k as MCPTransportType } from '../sdk-BUVNdBc7.js';
|
|
3
|
+
import { N as NetworkedExecutorOptions, C as ContextOptions, R as RainfallNetworkedExecutor, a as RainfallDaemonContext, b as RainfallListenerRegistry } from '../listeners-BCEypw1u.js';
|
|
4
4
|
import 'ws';
|
|
5
5
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/stdio.js';
|
package/dist/daemon/index.js
CHANGED
|
@@ -594,9 +594,13 @@ var RainfallClient = class {
|
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
const subscriberId = await this.ensureSubscriberId();
|
|
597
|
+
const body = params || {};
|
|
598
|
+
if (options?.targetEdge) {
|
|
599
|
+
body._targetEdge = options.targetEdge;
|
|
600
|
+
}
|
|
597
601
|
const response = await this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}`, {
|
|
598
602
|
method: "POST",
|
|
599
|
-
body
|
|
603
|
+
body
|
|
600
604
|
}, options);
|
|
601
605
|
if (response.success === false) {
|
|
602
606
|
const errorMessage = typeof response.error === "string" ? response.error : JSON.stringify(response.error);
|
package/dist/daemon/index.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { l as RainfallClient, a as Rainfall } from './sdk-
|
|
2
|
-
export { A as AI, b as ApiError, c as ApiResponse, d as Articles, D as Data, I as Integrations, M as Memory, P as ParamSchema, R as RainfallConfig, e as RateLimitInfo, f as RequestOptions, m as ToolParamsSchema, T as ToolSchema, U as Utils, V as ValidationIssue, n as ValidationResult, W as Web, o as clearSchemaCache, p as fetchToolSchema, q as formatValidationErrors, v as validateParams } from './sdk-
|
|
1
|
+
import { l as RainfallClient, a as Rainfall } from './sdk-BUVNdBc7.mjs';
|
|
2
|
+
export { A as AI, b as ApiError, c as ApiResponse, d as Articles, D as Data, I as Integrations, M as Memory, P as ParamSchema, R as RainfallConfig, e as RateLimitInfo, f as RequestOptions, m as ToolParamsSchema, T as ToolSchema, U as Utils, V as ValidationIssue, n as ValidationResult, W as Web, o as clearSchemaCache, p as fetchToolSchema, q as formatValidationErrors, v as validateParams } from './sdk-BUVNdBc7.mjs';
|
|
3
3
|
export { A as AuthenticationError, N as NetworkError, a as NotFoundError, R as RainfallError, b as RateLimitError, S as ServerError, T as TimeoutError, c as ToolNotFoundError, V as ValidationError } from './errors-BMPseAnM.mjs';
|
|
4
|
-
export { C as ContextOptions, c as CronTriggerConfig, E as EdgeNodeRegistration, F as FileWatcherConfig, L as ListenerEvent, d as ListenerRegistry, M as MemoryEntry, N as NetworkedExecutorOptions, e as NodeCapabilities, Q as QueuedJob, a as RainfallDaemonContext, b as RainfallListenerRegistry, R as RainfallNetworkedExecutor, S as SessionContext, T as ToolExecutionRecord, f as createCronWorkflow, g as createFileWatcherWorkflow } from './listeners-
|
|
4
|
+
export { C as ContextOptions, c as CronTriggerConfig, E as EdgeNodeRegistration, F as FileWatcherConfig, L as ListenerEvent, d as ListenerRegistry, M as MemoryEntry, N as NetworkedExecutorOptions, e as NodeCapabilities, Q as QueuedJob, a as RainfallDaemonContext, b as RainfallListenerRegistry, R as RainfallNetworkedExecutor, S as SessionContext, T as ToolExecutionRecord, f as createCronWorkflow, g as createFileWatcherWorkflow } from './listeners-BGdrWpkP.mjs';
|
|
5
5
|
import 'ws';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
7
7
|
import '@modelcontextprotocol/sdk/client/stdio.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { l as RainfallClient, a as Rainfall } from './sdk-
|
|
2
|
-
export { A as AI, b as ApiError, c as ApiResponse, d as Articles, D as Data, I as Integrations, M as Memory, P as ParamSchema, R as RainfallConfig, e as RateLimitInfo, f as RequestOptions, m as ToolParamsSchema, T as ToolSchema, U as Utils, V as ValidationIssue, n as ValidationResult, W as Web, o as clearSchemaCache, p as fetchToolSchema, q as formatValidationErrors, v as validateParams } from './sdk-
|
|
1
|
+
import { l as RainfallClient, a as Rainfall } from './sdk-BUVNdBc7.js';
|
|
2
|
+
export { A as AI, b as ApiError, c as ApiResponse, d as Articles, D as Data, I as Integrations, M as Memory, P as ParamSchema, R as RainfallConfig, e as RateLimitInfo, f as RequestOptions, m as ToolParamsSchema, T as ToolSchema, U as Utils, V as ValidationIssue, n as ValidationResult, W as Web, o as clearSchemaCache, p as fetchToolSchema, q as formatValidationErrors, v as validateParams } from './sdk-BUVNdBc7.js';
|
|
3
3
|
export { A as AuthenticationError, N as NetworkError, a as NotFoundError, R as RainfallError, b as RateLimitError, S as ServerError, T as TimeoutError, c as ToolNotFoundError, V as ValidationError } from './errors-BMPseAnM.js';
|
|
4
|
-
export { C as ContextOptions, c as CronTriggerConfig, E as EdgeNodeRegistration, F as FileWatcherConfig, L as ListenerEvent, d as ListenerRegistry, M as MemoryEntry, N as NetworkedExecutorOptions, e as NodeCapabilities, Q as QueuedJob, a as RainfallDaemonContext, b as RainfallListenerRegistry, R as RainfallNetworkedExecutor, S as SessionContext, T as ToolExecutionRecord, f as createCronWorkflow, g as createFileWatcherWorkflow } from './listeners-
|
|
4
|
+
export { C as ContextOptions, c as CronTriggerConfig, E as EdgeNodeRegistration, F as FileWatcherConfig, L as ListenerEvent, d as ListenerRegistry, M as MemoryEntry, N as NetworkedExecutorOptions, e as NodeCapabilities, Q as QueuedJob, a as RainfallDaemonContext, b as RainfallListenerRegistry, R as RainfallNetworkedExecutor, S as SessionContext, T as ToolExecutionRecord, f as createCronWorkflow, g as createFileWatcherWorkflow } from './listeners-BCEypw1u.js';
|
|
5
5
|
import 'ws';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
7
7
|
import '@modelcontextprotocol/sdk/client/stdio.js';
|
package/dist/index.js
CHANGED
|
@@ -800,9 +800,13 @@ var RainfallClient = class {
|
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
const subscriberId = await this.ensureSubscriberId();
|
|
803
|
+
const body = params || {};
|
|
804
|
+
if (options?.targetEdge) {
|
|
805
|
+
body._targetEdge = options.targetEdge;
|
|
806
|
+
}
|
|
803
807
|
const response = await this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}`, {
|
|
804
808
|
method: "POST",
|
|
805
|
-
body
|
|
809
|
+
body
|
|
806
810
|
}, options);
|
|
807
811
|
if (response.success === false) {
|
|
808
812
|
const errorMessage = typeof response.error === "string" ? response.error : JSON.stringify(response.error);
|