@rynx-ai/cli 0.1.10
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/agent-file.d.ts +13 -0
- package/dist/agent-file.js +61 -0
- package/dist/browser-cli-args.d.ts +28 -0
- package/dist/browser-cli-args.js +181 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +11 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +2 -0
- package/dist/commands/agent.d.ts +1 -0
- package/dist/commands/agent.js +55 -0
- package/dist/commands/app-distribution.d.ts +6 -0
- package/dist/commands/app-distribution.js +98 -0
- package/dist/commands/browser.d.ts +1 -0
- package/dist/commands/browser.js +273 -0
- package/dist/commands/cleanup.d.ts +1 -0
- package/dist/commands/cleanup.js +24 -0
- package/dist/commands/emulator.d.ts +1 -0
- package/dist/commands/emulator.js +23 -0
- package/dist/commands/errors.d.ts +5 -0
- package/dist/commands/errors.js +10 -0
- package/dist/commands/index.d.ts +9 -0
- package/dist/commands/index.js +9 -0
- package/dist/commands/plugin.d.ts +6 -0
- package/dist/commands/plugin.js +289 -0
- package/dist/commands/runtime.d.ts +1 -0
- package/dist/commands/runtime.js +136 -0
- package/dist/commands/skills.d.ts +10 -0
- package/dist/commands/skills.js +80 -0
- package/dist/control-client.d.ts +163 -0
- package/dist/control-client.js +1028 -0
- package/dist/control-endpoint.d.ts +29 -0
- package/dist/control-endpoint.js +121 -0
- package/dist/desktop-browser-host-client.d.ts +44 -0
- package/dist/desktop-browser-host-client.js +430 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/legacy-adapter.d.ts +7 -0
- package/dist/legacy-adapter.js +63 -0
- package/dist/run-cli.d.ts +1 -0
- package/dist/run-cli.js +62 -0
- package/dist/usage.d.ts +1 -0
- package/dist/usage.js +56 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +8 -0
- package/package.json +52 -0
- package/skills/rynx-cli/SKILL.md +99 -0
- package/skills/rynx-cli/agents/openai.yaml +4 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
const LEGACY_CLI_ENV = "RYNX_LEGACY_CLI_PATH";
|
|
6
|
+
/**
|
|
7
|
+
* Temporary bridge for commands whose daemon-owned mutation has no management
|
|
8
|
+
* RPC yet. It crosses the package boundary as a subprocess, never by importing
|
|
9
|
+
* daemon implementation modules into the CLI process.
|
|
10
|
+
*/
|
|
11
|
+
export async function runLegacyDaemonCli(args) {
|
|
12
|
+
const cliPath = resolveLegacyDaemonCli();
|
|
13
|
+
if (!cliPath) {
|
|
14
|
+
throw new Error("This command still requires the legacy daemon CLI, but it is not installed. " +
|
|
15
|
+
`Set ${LEGACY_CLI_ENV} to its absolute cli.js path or use the bundled Rynx App.`);
|
|
16
|
+
}
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
const child = spawn(process.execPath, [cliPath, ...args], {
|
|
19
|
+
stdio: "inherit",
|
|
20
|
+
env: process.env,
|
|
21
|
+
});
|
|
22
|
+
child.once("error", (error) => {
|
|
23
|
+
reject(new Error(`failed to launch legacy daemon CLI: ${error.message}`));
|
|
24
|
+
});
|
|
25
|
+
child.once("exit", (code, signal) => {
|
|
26
|
+
if (signal) {
|
|
27
|
+
reject(new Error(`legacy daemon CLI exited with signal ${signal}`));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
resolve(code ?? 1);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export function resolveLegacyDaemonCli(env = process.env, moduleUrl = import.meta.url) {
|
|
35
|
+
const configured = env[LEGACY_CLI_ENV];
|
|
36
|
+
if (configured !== undefined) {
|
|
37
|
+
if (!path.isAbsolute(configured)) {
|
|
38
|
+
throw new Error(`${LEGACY_CLI_ENV} must be an absolute path`);
|
|
39
|
+
}
|
|
40
|
+
return validateCliFile(configured);
|
|
41
|
+
}
|
|
42
|
+
// Works both in the workspace and when @rynx-ai/cli and @rynx-ai/daemon are
|
|
43
|
+
// siblings under node_modules/@rynx-ai.
|
|
44
|
+
const sibling = fileURLToPath(new URL("../../daemon/dist/cli.js", moduleUrl));
|
|
45
|
+
return validateCliFile(sibling);
|
|
46
|
+
}
|
|
47
|
+
function validateCliFile(candidate) {
|
|
48
|
+
try {
|
|
49
|
+
if (!existsSync(candidate) || !statSync(candidate).isFile())
|
|
50
|
+
return null;
|
|
51
|
+
const resolved = realpathSync(candidate);
|
|
52
|
+
const current = process.argv[1];
|
|
53
|
+
if (current &&
|
|
54
|
+
existsSync(current) &&
|
|
55
|
+
realpathSync(current) === resolved) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return resolved;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runCli(argv: readonly string[]): Promise<number>;
|
package/dist/run-cli.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { runAgentCommand } from "./commands/agent.js";
|
|
2
|
+
import { runAppDistributionCommand, shouldUseAppDistributionCommand, } from "./commands/app-distribution.js";
|
|
3
|
+
import { runBrowserCommand } from "./commands/browser.js";
|
|
4
|
+
import { runCleanupCommand } from "./commands/cleanup.js";
|
|
5
|
+
import { runEmulatorCommand } from "./commands/emulator.js";
|
|
6
|
+
import { fail } from "./commands/errors.js";
|
|
7
|
+
import { runPluginCommand, runPluginManageCommand, } from "./commands/plugin.js";
|
|
8
|
+
import { runRuntimeCommand } from "./commands/runtime.js";
|
|
9
|
+
import { runSkillsCommand } from "./commands/skills.js";
|
|
10
|
+
import { runLegacyDaemonCli } from "./legacy-adapter.js";
|
|
11
|
+
import { USAGE } from "./usage.js";
|
|
12
|
+
import { installedVersion } from "./version.js";
|
|
13
|
+
const LEGACY_TOP_LEVEL_COMMANDS = new Set([
|
|
14
|
+
"setup",
|
|
15
|
+
"doctor",
|
|
16
|
+
"update",
|
|
17
|
+
"start",
|
|
18
|
+
"restart",
|
|
19
|
+
"stop",
|
|
20
|
+
"status",
|
|
21
|
+
"logs",
|
|
22
|
+
]);
|
|
23
|
+
export async function runCli(argv) {
|
|
24
|
+
const [command] = argv;
|
|
25
|
+
if (shouldUseAppDistributionCommand(command)) {
|
|
26
|
+
return runAppDistributionCommand(command, argv.slice(1));
|
|
27
|
+
}
|
|
28
|
+
if (command && LEGACY_TOP_LEVEL_COMMANDS.has(command)) {
|
|
29
|
+
return runLegacyDaemonCli(argv);
|
|
30
|
+
}
|
|
31
|
+
switch (command) {
|
|
32
|
+
case "version":
|
|
33
|
+
case "--version":
|
|
34
|
+
console.log(installedVersion());
|
|
35
|
+
return 0;
|
|
36
|
+
case "plugin":
|
|
37
|
+
if (argv[1] === "manage") {
|
|
38
|
+
return runPluginManageCommand(argv.slice(2));
|
|
39
|
+
}
|
|
40
|
+
return runPluginCommand(argv.slice(1));
|
|
41
|
+
case "agent":
|
|
42
|
+
return runAgentCommand(argv.slice(1));
|
|
43
|
+
case "emulator":
|
|
44
|
+
return runEmulatorCommand(argv.slice(1));
|
|
45
|
+
case "runtime":
|
|
46
|
+
return runRuntimeCommand(argv.slice(1));
|
|
47
|
+
case "skills":
|
|
48
|
+
return runSkillsCommand(argv.slice(1));
|
|
49
|
+
case "browser":
|
|
50
|
+
return runBrowserCommand(argv.slice(1));
|
|
51
|
+
case "cleanup":
|
|
52
|
+
return runCleanupCommand(argv.slice(1));
|
|
53
|
+
case undefined:
|
|
54
|
+
case "help":
|
|
55
|
+
case "-h":
|
|
56
|
+
case "--help":
|
|
57
|
+
console.log(USAGE);
|
|
58
|
+
return 0;
|
|
59
|
+
default:
|
|
60
|
+
fail(`Unknown command: ${command}\n\n${USAGE}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
package/dist/usage.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const USAGE = "Usage: rynx <command>\n\nGeneral:\n version | --version print the installed Rynx version\n\nSetup:\n setup interactive configuration wizard\n doctor read-only health check\n\nLifecycle:\n start | restart | stop | status | logs\n update [version] [--check] [--json]\n\nPlugins:\n plugin manage list\n plugin manage install <source> [--force] [--grant-all] [--expect-digest <sha256-...>] [...]\n plugin manage update <id> [--grant-all] [--expect-digest <sha256-...>] [...]\n plugin manage enable|disable|uninstall <id>\n plugin <id> <command> invoke a plugin command through daemon RPC\n\nAgents:\n agent list\n agent show <id>\n agent add <id>\n agent rm <id>\n\nBuiltin Skills:\n skills list [--json]\n skills get <name> [--json]\n\nMaintenance:\n cleanup sessions [--dry-run]\n\nEmulator:\n emulator <args...>\n\nRemote Runtime:\n runtime share --address <host|ws-url> [--label <label>] [--json]\n runtime add --pairing-code <rynx://...> [--name <name>]\n runtime list [--json]\n runtime test <local|daemon-id> [--json]\n runtime forget <daemon-id>\n runtime clients list [--json]\n runtime clients revoke <grant-id>\n\nBrowser:\n browser install|update|version|clean [...]\n browser open [url] --session <id> [--runtime <local|daemon-id>] [--json]\n browser status|pages|close --session <id> [--runtime <local|daemon-id>] [--json]\n browser endpoint [--ensure] --session <local-id> [--json]\n browser snapshot --session <local-id> [--json]\n browser navigate <url> --session <local-id> [--json]\n browser click (--ref <ref>|--selector <css>|--x <n> --y <n>) --session <local-id> [--json]\n browser type (--ref <ref>|--selector <css>) --text <text> --session <local-id> [--json]\n browser screenshot --output <absolute-path> --session <local-id> [--json]\n";
|
package/dist/usage.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const USAGE = `Usage: rynx <command>
|
|
2
|
+
|
|
3
|
+
General:
|
|
4
|
+
version | --version print the installed Rynx version
|
|
5
|
+
|
|
6
|
+
Setup:
|
|
7
|
+
setup interactive configuration wizard
|
|
8
|
+
doctor read-only health check
|
|
9
|
+
|
|
10
|
+
Lifecycle:
|
|
11
|
+
start | restart | stop | status | logs
|
|
12
|
+
update [version] [--check] [--json]
|
|
13
|
+
|
|
14
|
+
Plugins:
|
|
15
|
+
plugin manage list
|
|
16
|
+
plugin manage install <source> [--force] [--grant-all] [--expect-digest <sha256-...>] [...]
|
|
17
|
+
plugin manage update <id> [--grant-all] [--expect-digest <sha256-...>] [...]
|
|
18
|
+
plugin manage enable|disable|uninstall <id>
|
|
19
|
+
plugin <id> <command> invoke a plugin command through daemon RPC
|
|
20
|
+
|
|
21
|
+
Agents:
|
|
22
|
+
agent list
|
|
23
|
+
agent show <id>
|
|
24
|
+
agent add <id>
|
|
25
|
+
agent rm <id>
|
|
26
|
+
|
|
27
|
+
Builtin Skills:
|
|
28
|
+
skills list [--json]
|
|
29
|
+
skills get <name> [--json]
|
|
30
|
+
|
|
31
|
+
Maintenance:
|
|
32
|
+
cleanup sessions [--dry-run]
|
|
33
|
+
|
|
34
|
+
Emulator:
|
|
35
|
+
emulator <args...>
|
|
36
|
+
|
|
37
|
+
Remote Runtime:
|
|
38
|
+
runtime share --address <host|ws-url> [--label <label>] [--json]
|
|
39
|
+
runtime add --pairing-code <rynx://...> [--name <name>]
|
|
40
|
+
runtime list [--json]
|
|
41
|
+
runtime test <local|daemon-id> [--json]
|
|
42
|
+
runtime forget <daemon-id>
|
|
43
|
+
runtime clients list [--json]
|
|
44
|
+
runtime clients revoke <grant-id>
|
|
45
|
+
|
|
46
|
+
Browser:
|
|
47
|
+
browser install|update|version|clean [...]
|
|
48
|
+
browser open [url] --session <id> [--runtime <local|daemon-id>] [--json]
|
|
49
|
+
browser status|pages|close --session <id> [--runtime <local|daemon-id>] [--json]
|
|
50
|
+
browser endpoint [--ensure] --session <local-id> [--json]
|
|
51
|
+
browser snapshot --session <local-id> [--json]
|
|
52
|
+
browser navigate <url> --session <local-id> [--json]
|
|
53
|
+
browser click (--ref <ref>|--selector <css>|--x <n> --y <n>) --session <local-id> [--json]
|
|
54
|
+
browser type (--ref <ref>|--selector <css>) --text <text> --session <local-id> [--json]
|
|
55
|
+
browser screenshot --output <absolute-path> --session <local-id> [--json]
|
|
56
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function installedVersion(): string;
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
export function installedVersion() {
|
|
4
|
+
const version = require("../package.json").version;
|
|
5
|
+
return typeof version === "string" && version.trim() !== ""
|
|
6
|
+
? version
|
|
7
|
+
: "0.0.0";
|
|
8
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rynx-ai/cli",
|
|
3
|
+
"version": "0.1.10",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/rynx-ai/rynx.git",
|
|
7
|
+
"directory": "packages/cli"
|
|
8
|
+
},
|
|
9
|
+
"description": "Rynx command-line client and local control-plane management surface.",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org/",
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"skills"
|
|
19
|
+
],
|
|
20
|
+
"bin": {
|
|
21
|
+
"rynx": "./dist/cli.js"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./client": {
|
|
31
|
+
"types": "./dist/client.d.ts",
|
|
32
|
+
"default": "./dist/client.js"
|
|
33
|
+
},
|
|
34
|
+
"./commands": {
|
|
35
|
+
"types": "./dist/commands/index.d.ts",
|
|
36
|
+
"default": "./dist/commands/index.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"ws": "^8.21.0",
|
|
41
|
+
"@rynx-ai/core": "0.1.10",
|
|
42
|
+
"@rynx-ai/emulator": "0.1.10",
|
|
43
|
+
"@rynx-ai/protocol": "0.1.10",
|
|
44
|
+
"@rynx-ai/browser-cdp": "0.1.10"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/ws": "^8.18.1"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "rm -rf dist skills && tsc -p tsconfig.json && chmod +x dist/cli.js && mkdir -p skills && cp -R ../../skills/rynx-cli skills/"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rynx-cli
|
|
3
|
+
description: Operate Rynx-managed local and remote runtimes through the bundled `rynx` CLI, including Browser inspection and automation, Emulator control, runtime pairing, and plugin commands. Use when a task needs to inspect or act on a Rynx Session Browser or Emulator, manage a Rynx runtime target, or invoke a Rynx plugin. Prefer this bundled CLI over direct CDP calls, guessed ports, globally installed browser drivers, or ad-hoc device tools.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Rynx CLI
|
|
7
|
+
|
|
8
|
+
Use the bundled `rynx` command. Rynx supplies the correct executable and current
|
|
9
|
+
Session context; do not locate another installation with `which`, `npx`, or npm.
|
|
10
|
+
|
|
11
|
+
## Choose the target
|
|
12
|
+
|
|
13
|
+
- Inside a Rynx Session, omit `--session`; the injected Session credential
|
|
14
|
+
restricts commands to that Session.
|
|
15
|
+
- Outside a managed Session, pass `--session <id>`.
|
|
16
|
+
- Add `--runtime <local|daemon-id>` only when the user explicitly selected a
|
|
17
|
+
different paired Runtime.
|
|
18
|
+
- Prefer `--json` for inspection and automation output.
|
|
19
|
+
|
|
20
|
+
If the CLI reports that the daemon is unavailable, ask the user to open Rynx or
|
|
21
|
+
enable its resident daemon. Never start an unrelated service or guess a port.
|
|
22
|
+
|
|
23
|
+
## Browser workflow
|
|
24
|
+
|
|
25
|
+
Open the Session Browser when needed:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
rynx browser open https://example.com --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Inspect before acting:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
rynx browser snapshot --json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use a returned `ref` for the next action. Take a fresh snapshot after navigation
|
|
38
|
+
or substantial DOM replacement because old references become stale.
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
rynx browser click --ref <ref> --json
|
|
42
|
+
rynx browser type --ref <ref> --text "hello" --json
|
|
43
|
+
rynx browser navigate https://example.com/next --json
|
|
44
|
+
rynx browser screenshot --output /absolute/path/page.png --json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Use `--selector` only when no useful accessibility reference exists. Use
|
|
48
|
+
coordinate clicks only as a final fallback after a screenshot.
|
|
49
|
+
|
|
50
|
+
Useful inspection commands:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
rynx browser status --json
|
|
54
|
+
rynx browser pages --json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Do not request or connect to the raw CDP endpoint unless diagnosing Rynx itself.
|
|
58
|
+
Do not close a Browser generation that the user still needs.
|
|
59
|
+
|
|
60
|
+
## Emulator workflow
|
|
61
|
+
|
|
62
|
+
Inspect available commands and devices before acting:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
rynx emulator --help
|
|
66
|
+
rynx emulator devices
|
|
67
|
+
rynx emulator active
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Use the Session's bound device by default. Select another device or Runtime only
|
|
71
|
+
when the user asks. Re-inspect the screen after every navigation or state-changing
|
|
72
|
+
input, and never call `kill` or `shutdown` as cleanup unless requested.
|
|
73
|
+
|
|
74
|
+
## Runtime and plugin operations
|
|
75
|
+
|
|
76
|
+
List and test Runtime targets before selecting a remote target:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
rynx runtime list --json
|
|
80
|
+
rynx runtime test <local|daemon-id> --json
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Invoke plugin-declared commands through:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
rynx plugin <plugin-id> <command> --json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Treat pairing, client revocation, plugin installation, Browser engine updates,
|
|
90
|
+
and daemon lifecycle changes as administrative operations. Perform them only
|
|
91
|
+
when the user explicitly requests them.
|
|
92
|
+
|
|
93
|
+
## Failure handling
|
|
94
|
+
|
|
95
|
+
- On `stale reference`, take a new Browser snapshot and retry once.
|
|
96
|
+
- On `busy`, preserve the current Turn or Terminal and let the user resolve it.
|
|
97
|
+
- On an unavailable capability, report the missing App integration or macOS
|
|
98
|
+
permission; do not install an unpinned replacement.
|
|
99
|
+
- Preserve structured error codes and relevant stderr when reporting failure.
|