@noimosai/platform-mcp 0.1.2 → 0.1.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/README.md +17 -48
- package/bin/noimos-platform-mcp.mjs +4 -5
- package/dist/cli/cli.js +567 -0
- package/dist/cli/command-help.js +395 -0
- package/dist/cli/download.js +72 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/input-error.js +48 -0
- package/dist/cli/local-agents.js +199 -0
- package/dist/cli/mcp-supervisor.js +136 -0
- package/dist/cli/noimos-cli.js +72 -0
- package/dist/cli/project-archive.js +27 -0
- package/dist/cli/project-files.js +25 -0
- package/dist/cli/project-sync.js +259 -0
- package/dist/cli/setup-lock.js +1 -0
- package/dist/cli/setup.js +347 -0
- package/dist/cli/skills.js +142 -0
- package/dist/cli/team-harness-targets.js +337 -0
- package/dist/cli/team-harness.js +1562 -0
- package/dist/cli/team-resources.js +222 -0
- package/dist/cli/team-skills.js +457 -0
- package/dist/cli/update-bootstrap.js +437 -0
- package/dist/cli/update-release.js +212 -0
- package/dist/cli/version.js +1 -0
- package/dist/cli/wallet.js +85 -0
- package/dist/client/agent-run.js +1425 -0
- package/dist/client/browser.js +905 -0
- package/dist/client/distribution.js +2 -0
- package/dist/client/evm-wallet.js +214 -0
- package/dist/client/execution-context.js +14 -0
- package/dist/client/failure-recovery.js +128 -0
- package/dist/client/index.js +4 -225
- package/dist/client/local-input.js +33 -12
- package/dist/client/local-profile-lock.js +52 -0
- package/dist/client/local-profile.js +181 -0
- package/dist/client/local-projects.js +131 -0
- package/dist/client/local-setup.js +93 -0
- package/dist/client/realtime-voice.js +184 -0
- package/dist/client/tool-name-hints.js +48 -0
- package/dist/client/wallet-access.js +214 -0
- package/dist/mcp/agent-server.js +345 -0
- package/dist/mcp/context.js +86 -0
- package/dist/mcp/host-schema.js +76 -0
- package/dist/mcp/icon.js +1 -0
- package/dist/mcp/instructions.js +26 -0
- package/dist/mcp/local-projects.js +42 -0
- package/dist/mcp/local-upload.js +7 -13
- package/dist/mcp/noimos-runtime.js +18 -0
- package/dist/mcp/noimos-server.js +38 -0
- package/dist/mcp/operations.js +40 -0
- package/dist/mcp/parallel-result.js +17 -0
- package/dist/mcp/project-sync.js +105 -0
- package/dist/mcp/results-reply.js +15 -0
- package/dist/mcp/runtime.js +65 -11
- package/dist/mcp/server.js +382 -40
- package/dist/mcp/team-skill.js +63 -0
- package/dist/mcp/update-notice.js +75 -0
- package/dist/mcp/version.js +1 -0
- package/dist/schema/accountRequestMethods.js +1 -0
- package/dist/schema/boundedBody.js +30 -0
- package/dist/schema/cronValidator.js +150 -0
- package/dist/schema/platformApiKey.js +14 -0
- package/dist/schema/platformAppAuth.js +11 -0
- package/dist/schema/platformBillingConstants.js +4 -0
- package/dist/schema/platformCapabilityFamilies.js +293 -0
- package/dist/schema/platformConnectionCatalog.js +39 -0
- package/dist/schema/platformConnectionPolicy.js +33 -0
- package/dist/schema/platformCustomTools.js +148 -0
- package/dist/schema/platformEndUserApi.js +62 -0
- package/dist/schema/platformFunding.js +10 -0
- package/dist/schema/platformHttpConstraints.js +12 -0
- package/dist/schema/platformLocalSetup.js +25 -0
- package/dist/schema/platformMcpTools.js +7 -0
- package/dist/schema/platformMetaTools.js +63 -0
- package/dist/schema/platformMonitorSchedule.js +123 -0
- package/dist/schema/platformMonitors.js +159 -0
- package/dist/schema/platformOAuth.js +13 -0
- package/dist/schema/platformProjectPermissions.js +33 -0
- package/dist/schema/platformPublicExecution.js +202 -21
- package/dist/schema/platformRoutes.js +122 -0
- package/dist/schema/platformSkills.js +11 -0
- package/dist/schema/platformTeamSecretName.js +3 -0
- package/dist/schema/platformTeamSkillSlug.js +1 -0
- package/dist/schema/platformTeamSkills.js +302 -0
- package/dist/schema/platformToolAccess.js +62 -0
- package/dist/schema/platformTriggers.js +153 -0
- package/dist/schema/platformWorkflows.js +100 -0
- package/dist/schema/scheduleTimeZone.js +15 -0
- package/dist/schema/toolDiscovery.js +71 -0
- package/dist/schema/toolInputRepair.js +122 -0
- package/dist/schema/toolResultContext.js +51 -0
- package/dist/schema/untrustedContent.js +35 -0
- package/npm-shrinkwrap.json +73 -0
- package/package.json +5 -3
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { realpath } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { randomBytes } from "node:crypto";
|
|
4
|
+
import { parseArgs } from "node:util";
|
|
5
|
+
import { loadEvmWallet, walletSignIn, walletTopUp } from "../client/index.js";
|
|
6
|
+
import { relvoApiUrl } from "../client/local-setup.js";
|
|
7
|
+
import { localProfilePath, readLocalProfile, readPrivateText, runtimeConfig, writeLocalProfile } from "../client/local-profile.js";
|
|
8
|
+
import { rememberLocalProject, removeLocalProjects } from "../client/local-projects.js";
|
|
9
|
+
import { CliInputError } from "./input-error.js";
|
|
10
|
+
import { withProfileLock } from "./setup-lock.js";
|
|
11
|
+
const WALLET_SCOPES = ["project:read", "usage:read", "tools:read", "tools:execute", "executions:read"];
|
|
12
|
+
function uniqueOptions(tokens) {
|
|
13
|
+
const names = tokens.filter((token) => token.kind === "option").map((token) => token.name);
|
|
14
|
+
if (new Set(names).size !== names.length)
|
|
15
|
+
throw new CliInputError("Duplicate wallet option.");
|
|
16
|
+
}
|
|
17
|
+
async function loadWallet(env, keyFile) {
|
|
18
|
+
const fromEnv = env.RELVO_WALLET_PRIVATE_KEY?.trim();
|
|
19
|
+
if (fromEnv && keyFile)
|
|
20
|
+
throw new CliInputError("Use RELVO_WALLET_PRIVATE_KEY or --key-file, not both.");
|
|
21
|
+
if (!fromEnv && !keyFile)
|
|
22
|
+
throw new CliInputError("Set RELVO_WALLET_PRIVATE_KEY or pass --key-file <path> to a file only you can read.");
|
|
23
|
+
try {
|
|
24
|
+
return loadEvmWallet(fromEnv ?? (await readPrivateText(keyFile, 1024)).trim());
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
throw new CliInputError("The wallet private key is missing, unreadable or invalid (expected 0x followed by 64 hex characters in an owner-only file).");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function usdToCents(value, flag) {
|
|
31
|
+
if (!value || !/^\d{1,6}(?:\.\d{1,2})?$/.test(value))
|
|
32
|
+
throw new CliInputError(`${flag} must be a USD amount with at most two decimals, such as 5 or 5.00.`);
|
|
33
|
+
const [dollars, cents = ""] = value.split(".");
|
|
34
|
+
return Number(dollars) * 100 + Number(cents.padEnd(2, "0"));
|
|
35
|
+
}
|
|
36
|
+
export async function runWalletCommand(args, env, output, transport, options = {}) {
|
|
37
|
+
const [action, ...rest] = args.slice(1);
|
|
38
|
+
if (action !== "sign-in" && action !== "top-up")
|
|
39
|
+
throw new CliInputError("Use relvo wallet sign-in or relvo wallet top-up.");
|
|
40
|
+
const { values, tokens } = parseArgs({ args: rest, tokens: true, options: { "key-file": { type: "string" }, "api-url": { type: "string" }, local: { type: "boolean" },
|
|
41
|
+
amount: { type: "string" }, max: { type: "string" } } });
|
|
42
|
+
uniqueOptions(tokens);
|
|
43
|
+
const home = await realpath(options.home ?? homedir()), path = localProfilePath(home);
|
|
44
|
+
if (action === "sign-in") {
|
|
45
|
+
if (values.amount !== undefined || values.max !== undefined)
|
|
46
|
+
throw new CliInputError("sign-in takes --api-url, --local and --key-file only.");
|
|
47
|
+
const wallet = await loadWallet(env, values["key-file"]);
|
|
48
|
+
await withProfileLock(path, async () => {
|
|
49
|
+
const existing = await readLocalProfile(path);
|
|
50
|
+
if (existing?.state === "pending")
|
|
51
|
+
throw new Error("A browser setup is pending. Finish it with relvo setup or run relvo logout first.");
|
|
52
|
+
const requested = values["api-url"] ?? env.RELVO_API_URL ?? existing?.apiUrl;
|
|
53
|
+
if (!requested)
|
|
54
|
+
throw new CliInputError("Pass --api-url <url> or set RELVO_API_URL.");
|
|
55
|
+
const local = values.local ?? existing?.local ?? false, apiUrl = relvoApiUrl(requested, local);
|
|
56
|
+
if (existing && existing.apiUrl !== apiUrl)
|
|
57
|
+
throw new Error("A login for another Relvo API is saved. Run relvo logout first.");
|
|
58
|
+
if (existing)
|
|
59
|
+
await rememberLocalProject(path, existing);
|
|
60
|
+
else
|
|
61
|
+
await removeLocalProjects(path);
|
|
62
|
+
const result = await walletSignIn({ apiUrl, wallet, local, fetch: transport });
|
|
63
|
+
const grant = { status: "approved", apiKey: result.apiKey, apiKeyId: `wallet-${result.address.slice(2, 10).toLowerCase()}`, developerOrganizationId: result.organizationId,
|
|
64
|
+
developerProjectId: result.projectId, scopes: WALLET_SCOPES, expiresAt: result.expiresAt, approvedExpiresAt: result.expiresAt };
|
|
65
|
+
let profile;
|
|
66
|
+
if (existing) {
|
|
67
|
+
const { pendingAck, ...kept } = existing;
|
|
68
|
+
void pendingAck;
|
|
69
|
+
profile = { ...kept, grant };
|
|
70
|
+
}
|
|
71
|
+
else
|
|
72
|
+
profile = { managedBy: "relvo-cli", version: 1, installationId: randomBytes(12).toString("hex"), state: "ready", apiUrl, consoleUrl: new URL(apiUrl).origin, local, grant, registrations: [] };
|
|
73
|
+
await writeLocalProfile(path, profile);
|
|
74
|
+
await rememberLocalProject(path, profile);
|
|
75
|
+
output(JSON.stringify({ address: result.address, organizationId: result.organizationId, projectId: result.projectId, created: result.created, expiresAt: result.expiresAt }));
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (values["api-url"] !== undefined || values.local !== undefined)
|
|
80
|
+
throw new CliInputError("top-up uses the saved login or RELVO_API_URL and RELVO_API_KEY.");
|
|
81
|
+
const amountCents = usdToCents(values.amount, "--amount"), maximumCents = usdToCents(values.max, "--max");
|
|
82
|
+
const wallet = await loadWallet(env, values["key-file"]);
|
|
83
|
+
const config = await runtimeConfig(env, "cli", path);
|
|
84
|
+
output(JSON.stringify(await walletTopUp({ apiUrl: config.apiUrl, apiKey: config.apiKey, local: config.local, wallet, amountCents, maximumCents, fetch: transport })));
|
|
85
|
+
}
|