@proagentstore/cli 0.1.7 → 0.1.8
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.
|
@@ -25,7 +25,7 @@ function configFromArgs() {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
if (flag("--help") || flag("-h")) {
|
|
28
|
-
process.stdout.write(`
|
|
28
|
+
process.stdout.write(`FreeAgentStore browser runtime for ProAgentStore
|
|
29
29
|
|
|
30
30
|
Usage:
|
|
31
31
|
pags-browser-runner [--host 127.0.0.1] [--port 49171] [--data-dir path] [--token token] [--instance-id id] [--headless]
|
|
@@ -44,9 +44,9 @@ Endpoints:
|
|
|
44
44
|
}
|
|
45
45
|
const config = configFromArgs();
|
|
46
46
|
const started = await startRunnerServer(config);
|
|
47
|
-
process.stdout.write(`
|
|
47
|
+
process.stdout.write(`FAGS browser runtime listening at ${started.url}\n`);
|
|
48
48
|
process.stdout.write(`Data dir: ${config.dataDir}\n`);
|
|
49
|
-
process.stdout.write(
|
|
49
|
+
process.stdout.write("Control plane: PAGS; runtime plane: FAGS; brain placement: PAGS; runner role: tool-executor\n");
|
|
50
50
|
if (config.token)
|
|
51
51
|
process.stdout.write("Auth: bearer token required\n");
|
|
52
52
|
if (config.instanceId)
|
|
@@ -28,8 +28,10 @@ export class LocalRunner {
|
|
|
28
28
|
}
|
|
29
29
|
capabilities() {
|
|
30
30
|
return {
|
|
31
|
-
runtime: "
|
|
31
|
+
runtime: "fags-browser-runtime",
|
|
32
32
|
brainPlacement: "pags",
|
|
33
|
+
controlPlane: "pags",
|
|
34
|
+
runtimePlane: "fags",
|
|
33
35
|
runnerRole: "tool-executor",
|
|
34
36
|
capabilities: CAPABILITIES,
|
|
35
37
|
taskTypes: ["echo", "browser.open", "job.apply_basic"],
|
|
@@ -42,8 +42,10 @@ async function route(runner, req, res) {
|
|
|
42
42
|
if (req.method === "GET" && path === "/health") {
|
|
43
43
|
return json(res, 200, {
|
|
44
44
|
ok: true,
|
|
45
|
-
service: "
|
|
45
|
+
service: "freeagentstore-browser-runtime",
|
|
46
46
|
brainPlacement: "pags",
|
|
47
|
+
controlPlane: "pags",
|
|
48
|
+
runtimePlane: "fags",
|
|
47
49
|
instanceId: runner.config.instanceId,
|
|
48
50
|
});
|
|
49
51
|
}
|
package/dist/index.js
CHANGED
|
@@ -641,12 +641,12 @@ function collectCapability(value, previous = []) {
|
|
|
641
641
|
}
|
|
642
642
|
function createRunnerCommand() {
|
|
643
643
|
const command = new Command5("runner").description(
|
|
644
|
-
"Manage
|
|
644
|
+
"Manage the local FAGS browser runtime for ProAgentStore agents"
|
|
645
645
|
);
|
|
646
|
-
command.command("start").description("Start the local browser
|
|
646
|
+
command.command("start").description("Start the local FAGS browser runtime in the foreground").option("--host <host>", "Host to bind", "127.0.0.1").option("--port <port>", "Port to bind", "49171").option("--data-dir <path>", "Runner data directory").option("--token <token>", "Require this bearer token").option("--instance-id <id>", "Bind runner requests to a PAGS instance id").option("--headless", "Run Playwright headless").action(async (opts) => {
|
|
647
647
|
await startRunnerForeground(opts);
|
|
648
648
|
});
|
|
649
|
-
command.command("connect <instanceId>").description("Start
|
|
649
|
+
command.command("connect <instanceId>").description("Start the local FAGS runtime, open a Cloudflare quick tunnel, and register it with PAGS").option("--host <host>", "Host to bind", "127.0.0.1").option("--port <port>", "Port to bind", "49171").option("--data-dir <path>", "Runner data directory").option("--token <token>", "Runner bearer token. Defaults to PAGS_RUNNER_TOKEN or a generated token").option("--headless", "Run Playwright headless").option("--api-base <url>", "PAGS API base URL").option("--pags-token <token>", "PAGS session token. Defaults to PAGS_TOKEN").option("--cloudflared <path>", "cloudflared executable", "cloudflared").option("--runner-version <version>", "Runner version").option("--skip-probe", "Skip PAGS FAGS-runtime probe after registration").action(async (instanceId, opts) => {
|
|
650
650
|
const runnerToken = clean(opts.token) || clean(process.env.PAGS_RUNNER_TOKEN) || `pags_runner_${randomUUID()}`;
|
|
651
651
|
const host = clean(opts.host) || "127.0.0.1";
|
|
652
652
|
const port = clean(opts.port) || "49171";
|
|
@@ -684,7 +684,7 @@ function createRunnerCommand() {
|
|
|
684
684
|
});
|
|
685
685
|
try {
|
|
686
686
|
await waitForLocalRunner({ url: localUrl, token: runnerToken, instanceId });
|
|
687
|
-
writeLine(`Local
|
|
687
|
+
writeLine(`Local FAGS runtime healthy at ${localUrl}`);
|
|
688
688
|
const tunnelUrl = await new Promise((resolveTunnel, reject) => {
|
|
689
689
|
let output = "";
|
|
690
690
|
const cloudflared = clean(opts.cloudflared) || "cloudflared";
|
|
@@ -731,7 +731,7 @@ function createRunnerCommand() {
|
|
|
731
731
|
);
|
|
732
732
|
writeLine(JSON.stringify(status, null, 2));
|
|
733
733
|
}
|
|
734
|
-
writeLine("Connected. Keep this process running while the agent uses your
|
|
734
|
+
writeLine("Connected. Keep this process running while the agent uses your FAGS browser runtime.");
|
|
735
735
|
await new Promise((resolvePromise) => {
|
|
736
736
|
runner.on("exit", () => resolvePromise());
|
|
737
737
|
tunnel?.on("exit", () => resolvePromise());
|
|
@@ -741,12 +741,12 @@ function createRunnerCommand() {
|
|
|
741
741
|
throw error;
|
|
742
742
|
}
|
|
743
743
|
});
|
|
744
|
-
command.command("status").description("Check local
|
|
744
|
+
command.command("status").description("Check local FAGS runtime health and capabilities").option("--url <url>", "Runner URL").option("--token <token>", "Runner bearer token").option("--instance-id <id>", "PAGS instance id header").action(async (opts) => {
|
|
745
745
|
const health = await requestRunner("GET", "/health", opts);
|
|
746
746
|
const capabilities = await requestRunner("GET", "/capabilities", opts);
|
|
747
747
|
writeLine(JSON.stringify({ health, capabilities }, null, 2));
|
|
748
748
|
});
|
|
749
|
-
command.command("task").description("Create a
|
|
749
|
+
command.command("task").description("Create a local FAGS runtime task").requiredOption("--type <type>", "Task type, e.g. echo or browser.open").option("--url <url>", "Runner URL").option("--token <token>", "Runner bearer token").option("--instance-id <id>", "PAGS instance id header").option("--input <json>", "Task input JSON").option("--job-url <url>", "Shortcut input for browser.open").option("--approve", "Create task in needs_approval state").option("--approval-prompt <text>", "Approval prompt").action(
|
|
750
750
|
async (opts) => {
|
|
751
751
|
let input = {};
|
|
752
752
|
if (opts.input) {
|
|
@@ -767,7 +767,7 @@ function createRunnerCommand() {
|
|
|
767
767
|
writeLine(JSON.stringify(task, null, 2));
|
|
768
768
|
}
|
|
769
769
|
);
|
|
770
|
-
command.command("register <instanceId>").description("Register a local or managed
|
|
770
|
+
command.command("register <instanceId>").description("Register a local or managed FAGS runtime endpoint with a PAGS instance").requiredOption("--endpoint-url <url>", "FAGS runtime endpoint URL to store in PAGS").option("--api-base <url>", "PAGS API base URL").option("--pags-token <token>", "PAGS session token. Defaults to PAGS_TOKEN").option("--runner-token <token>", "FAGS runtime bearer token to store in PAGS").option("--url <url>", "Local FAGS runtime URL to probe for capabilities").option("--token <token>", "Local FAGS runtime bearer token for capability probe").option("--instance-id <id>", "PAGS instance id header for capability probe").option("--placement <placement>", "Runtime placement: local or managed", "local").option("--runner-version <version>", "Runner version").option("--capability <name>", "Runtime capability; repeatable", collectCapability, []).option("--probe", "Read capabilities from the FAGS runtime before registering").action(async (instanceId, opts) => {
|
|
771
771
|
let capabilities = opts.capability || [];
|
|
772
772
|
if (opts.probe) {
|
|
773
773
|
const data = await requestRunner("GET", "/capabilities", {
|
|
@@ -781,7 +781,7 @@ function createRunnerCommand() {
|
|
|
781
781
|
const result = await requestPags("POST", `/v1/instances/${apiPathSegment(instanceId)}/runtime`, opts, body);
|
|
782
782
|
writeLine(JSON.stringify(result, null, 2));
|
|
783
783
|
});
|
|
784
|
-
command.command("runtime <instanceId>").description("Read the PAGS runtime registration for an instance").option("--api-base <url>", "PAGS API base URL").option("--pags-token <token>", "PAGS session token. Defaults to PAGS_TOKEN").option("--probe", "Ask PAGS to probe /health and /capabilities on the
|
|
784
|
+
command.command("runtime <instanceId>").description("Read the PAGS runtime registration for an instance").option("--api-base <url>", "PAGS API base URL").option("--pags-token <token>", "PAGS session token. Defaults to PAGS_TOKEN").option("--probe", "Ask PAGS to probe /health and /capabilities on the FAGS runtime").action(async (instanceId, opts) => {
|
|
785
785
|
const path = opts.probe ? `/v1/instances/${apiPathSegment(instanceId)}/runtime/status` : `/v1/instances/${apiPathSegment(instanceId)}/runtime`;
|
|
786
786
|
const result = await requestPags("GET", path, opts);
|
|
787
787
|
writeLine(JSON.stringify(result, null, 2));
|
|
@@ -790,7 +790,7 @@ function createRunnerCommand() {
|
|
|
790
790
|
const result = await requestPags("DELETE", `/v1/instances/${apiPathSegment(instanceId)}/runtime`, opts);
|
|
791
791
|
writeLine(JSON.stringify(result, null, 2));
|
|
792
792
|
});
|
|
793
|
-
command.command("run <instanceId>").description("Create a task through PAGS on an instance's registered
|
|
793
|
+
command.command("run <instanceId>").description("Create a task through PAGS on an instance's registered FAGS runtime").requiredOption("--type <type>", "Task type, e.g. echo or browser.open").option("--api-base <url>", "PAGS API base URL").option("--pags-token <token>", "PAGS session token. Defaults to PAGS_TOKEN").option("--input <json>", "Task input JSON").option("--job-url <url>", "Shortcut input for browser.open").option("--approve", "Create task in needs_approval state").option("--approval-prompt <text>", "Approval prompt").action(
|
|
794
794
|
async (instanceId, opts) => {
|
|
795
795
|
let input = {};
|
|
796
796
|
if (opts.input) {
|
|
@@ -811,7 +811,7 @@ function createRunnerCommand() {
|
|
|
811
811
|
writeLine(JSON.stringify(result, null, 2));
|
|
812
812
|
}
|
|
813
813
|
);
|
|
814
|
-
command.command("approve-task <instanceId> <taskId>").description("Approve a registered
|
|
814
|
+
command.command("approve-task <instanceId> <taskId>").description("Approve a registered FAGS runtime task through PAGS").option("--api-base <url>", "PAGS API base URL").option("--pags-token <token>", "PAGS session token. Defaults to PAGS_TOKEN").action(async (instanceId, taskId, opts) => {
|
|
815
815
|
const result = await requestPags(
|
|
816
816
|
"POST",
|
|
817
817
|
`/v1/instances/${apiPathSegment(instanceId)}/tasks/${apiPathSegment(taskId)}/approve`,
|
|
@@ -819,7 +819,7 @@ function createRunnerCommand() {
|
|
|
819
819
|
);
|
|
820
820
|
writeLine(JSON.stringify(result, null, 2));
|
|
821
821
|
});
|
|
822
|
-
command.command("cancel-task <instanceId> <taskId>").description("Cancel a registered
|
|
822
|
+
command.command("cancel-task <instanceId> <taskId>").description("Cancel a registered FAGS runtime task through PAGS").option("--api-base <url>", "PAGS API base URL").option("--pags-token <token>", "PAGS session token. Defaults to PAGS_TOKEN").action(async (instanceId, taskId, opts) => {
|
|
823
823
|
const result = await requestPags(
|
|
824
824
|
"POST",
|
|
825
825
|
`/v1/instances/${apiPathSegment(instanceId)}/tasks/${apiPathSegment(taskId)}/cancel`,
|
|
@@ -827,7 +827,7 @@ function createRunnerCommand() {
|
|
|
827
827
|
);
|
|
828
828
|
writeLine(JSON.stringify(result, null, 2));
|
|
829
829
|
});
|
|
830
|
-
command.command("task-events <instanceId>").description("Read registered
|
|
830
|
+
command.command("task-events <instanceId>").description("Read registered FAGS runtime task events through PAGS").option("--api-base <url>", "PAGS API base URL").option("--pags-token <token>", "PAGS session token. Defaults to PAGS_TOKEN").option("--limit <n>", "Number of events", "50").action(async (instanceId, opts) => {
|
|
831
831
|
const result = await requestPags(
|
|
832
832
|
"GET",
|
|
833
833
|
`/v1/instances/${apiPathSegment(instanceId)}/task-events?limit=${Number(opts.limit) || 50}`,
|
|
@@ -839,11 +839,11 @@ function createRunnerCommand() {
|
|
|
839
839
|
const task = await requestRunner("POST", `/tasks/${apiPathSegment(taskId)}/approve`, opts);
|
|
840
840
|
writeLine(JSON.stringify(task, null, 2));
|
|
841
841
|
});
|
|
842
|
-
command.command("cancel <taskId>").description("Cancel a local
|
|
842
|
+
command.command("cancel <taskId>").description("Cancel a local FAGS runtime task").option("--url <url>", "Runner URL").option("--token <token>", "Runner bearer token").option("--instance-id <id>", "PAGS instance id header").action(async (taskId, opts) => {
|
|
843
843
|
const task = await requestRunner("POST", `/tasks/${apiPathSegment(taskId)}/cancel`, opts);
|
|
844
844
|
writeLine(JSON.stringify(task, null, 2));
|
|
845
845
|
});
|
|
846
|
-
command.command("events").description("List recent
|
|
846
|
+
command.command("events").description("List recent FAGS runtime events").option("--url <url>", "Runner URL").option("--token <token>", "Runner bearer token").option("--instance-id <id>", "PAGS instance id header").option("--limit <n>", "Number of events", "50").action(async (opts) => {
|
|
847
847
|
const events = await requestRunner("GET", `/events?limit=${Number(opts.limit) || 50}`, opts);
|
|
848
848
|
writeLine(JSON.stringify(events, null, 2));
|
|
849
849
|
});
|