@proagentstore/cli 0.4.10 → 0.4.12
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.
|
@@ -67,9 +67,9 @@ if (!config.token && !LOOPBACK.has(config.host)) {
|
|
|
67
67
|
process.exit(1);
|
|
68
68
|
}
|
|
69
69
|
const started = await startRunnerServer(config);
|
|
70
|
-
process.stdout.write(`
|
|
70
|
+
process.stdout.write(`ProAgentStore browser runtime listening at ${started.url}\n`);
|
|
71
71
|
process.stdout.write(`Data dir: ${config.dataDir}\n`);
|
|
72
|
-
process.stdout.write("Control plane: PAGS; runtime plane:
|
|
72
|
+
process.stdout.write("Control plane: PAGS; runtime plane: PAGS; brain placement: PAGS; runner role: tool-executor\n");
|
|
73
73
|
if (config.token)
|
|
74
74
|
process.stdout.write("Auth: bearer token required\n");
|
|
75
75
|
if (config.instanceId)
|
|
@@ -74,10 +74,10 @@ export class LocalRunner {
|
|
|
74
74
|
}
|
|
75
75
|
capabilities() {
|
|
76
76
|
return {
|
|
77
|
-
runtime: "
|
|
77
|
+
runtime: "pags-browser-runtime",
|
|
78
78
|
brainPlacement: "pags",
|
|
79
79
|
controlPlane: "pags",
|
|
80
|
-
runtimePlane: "
|
|
80
|
+
runtimePlane: "pags",
|
|
81
81
|
runnerRole: "tool-executor",
|
|
82
82
|
capabilities: [...CAPABILITIES, ...CodingRuntime.capabilities()],
|
|
83
83
|
taskTypes: ["echo", "browser.open", "job.apply_agent", ...CodingRuntime.taskTypes()],
|
|
@@ -42,10 +42,10 @@ async function route(runner, req, res) {
|
|
|
42
42
|
if ((req.method === "GET" || req.method === "POST") && path === "/health") {
|
|
43
43
|
return json(res, 200, {
|
|
44
44
|
ok: true,
|
|
45
|
-
service: "
|
|
45
|
+
service: "proagentstore-browser-runtime",
|
|
46
46
|
brainPlacement: "pags",
|
|
47
47
|
controlPlane: "pags",
|
|
48
|
-
runtimePlane: "
|
|
48
|
+
runtimePlane: "pags",
|
|
49
49
|
instanceId: runner.config.instanceId,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -44,6 +44,14 @@ export class RunnerStore {
|
|
|
44
44
|
const now = new Date().toISOString();
|
|
45
45
|
let expired = 0;
|
|
46
46
|
for (const task of data.tasks) {
|
|
47
|
+
// Job-application tasks are driven by a DURABLE Cloudflare Workflow, not this
|
|
48
|
+
// runner process — they survive a runner restart (relay reconnect / crash) and
|
|
49
|
+
// the workflow owns their lifecycle. Expiring them here would flip a LIVE apply
|
|
50
|
+
// to "failed", which re-mirrors to the board, resurrects the Retry button, and
|
|
51
|
+
// slips past the API single-flight guard → a second concurrent apply on the one
|
|
52
|
+
// browser page. Mirrors the API carve-out in expireOrphanedRuntimeTasks.
|
|
53
|
+
if (task.type === "job.apply_agent")
|
|
54
|
+
continue;
|
|
47
55
|
if (task.status === "needs_human" || task.status === "running") {
|
|
48
56
|
task.status = "failed";
|
|
49
57
|
task.error =
|
package/dist/index.js
CHANGED
|
@@ -932,9 +932,9 @@ function openRelaySocket(instanceId, wsBase, mintToken, localUrl, runnerToken, f
|
|
|
932
932
|
}
|
|
933
933
|
function createRunnerCommand() {
|
|
934
934
|
const command = new Command6("runner").description(
|
|
935
|
-
"Manage the local
|
|
935
|
+
"Manage the local ProAgentStore browser runtime for ProAgentStore agents"
|
|
936
936
|
);
|
|
937
|
-
command.command("start").description("Start the local
|
|
937
|
+
command.command("start").description("Start the local ProAgentStore 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) => {
|
|
938
938
|
await startRunnerForeground(opts);
|
|
939
939
|
});
|
|
940
940
|
command.command("connect <instanceIds...>").description("Start ONE local runtime, connect via WebSocket relay, and register it for every given PAGS instance").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("--runner-version <version>", "Runner version").option("--force", "Take over from another connected machine").action(async (instanceIds, opts) => {
|
|
@@ -968,7 +968,7 @@ function createRunnerCommand() {
|
|
|
968
968
|
});
|
|
969
969
|
try {
|
|
970
970
|
await waitForLocalRunner({ url: localUrl, token: runnerToken, instanceId: primary });
|
|
971
|
-
writeLine(`Local
|
|
971
|
+
writeLine(`Local browser runtime healthy at ${localUrl}`);
|
|
972
972
|
await connectViaRelay(instanceIds, localUrl, runnerToken, opts, Boolean(opts.force));
|
|
973
973
|
await new Promise((resolvePromise) => {
|
|
974
974
|
runner.on("exit", () => resolvePromise());
|
|
@@ -978,12 +978,12 @@ function createRunnerCommand() {
|
|
|
978
978
|
throw error;
|
|
979
979
|
}
|
|
980
980
|
});
|
|
981
|
-
command.command("status").description("Check local
|
|
981
|
+
command.command("status").description("Check local browser 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) => {
|
|
982
982
|
const health = await requestRunner("GET", "/health", opts);
|
|
983
983
|
const capabilities = await requestRunner("GET", "/capabilities", opts);
|
|
984
984
|
writeLine(JSON.stringify({ health, capabilities }, null, 2));
|
|
985
985
|
});
|
|
986
|
-
command.command("task").description("Create a local
|
|
986
|
+
command.command("task").description("Create a local browser 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(
|
|
987
987
|
async (opts) => {
|
|
988
988
|
let input = {};
|
|
989
989
|
if (opts.input) {
|
|
@@ -1004,7 +1004,7 @@ function createRunnerCommand() {
|
|
|
1004
1004
|
writeLine(JSON.stringify(task, null, 2));
|
|
1005
1005
|
}
|
|
1006
1006
|
);
|
|
1007
|
-
command.command("register <instanceId>").description("Register a local or managed
|
|
1007
|
+
command.command("register <instanceId>").description("Register a local or managed browser runtime endpoint with a PAGS instance").requiredOption("--endpoint-url <url>", "browser 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>", "browser runtime bearer token to store in PAGS").option("--url <url>", "Local browser runtime URL to probe for capabilities").option("--token <token>", "Local browser 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 browser runtime before registering").action(async (instanceId, opts) => {
|
|
1008
1008
|
let capabilities = opts.capability || [];
|
|
1009
1009
|
if (opts.probe) {
|
|
1010
1010
|
const data = await requestRunner("GET", "/capabilities", {
|
|
@@ -1018,7 +1018,7 @@ function createRunnerCommand() {
|
|
|
1018
1018
|
const result = await requestPags("POST", `/v1/instances/${apiPathSegment(instanceId)}/runtime`, opts, body);
|
|
1019
1019
|
writeLine(JSON.stringify(result, null, 2));
|
|
1020
1020
|
});
|
|
1021
|
-
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
|
|
1021
|
+
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 browser runtime").action(async (instanceId, opts) => {
|
|
1022
1022
|
const path = opts.probe ? `/v1/instances/${apiPathSegment(instanceId)}/runtime/status` : `/v1/instances/${apiPathSegment(instanceId)}/runtime`;
|
|
1023
1023
|
const result = await requestPags("GET", path, opts);
|
|
1024
1024
|
writeLine(JSON.stringify(result, null, 2));
|
|
@@ -1027,7 +1027,7 @@ function createRunnerCommand() {
|
|
|
1027
1027
|
const result = await requestPags("DELETE", `/v1/instances/${apiPathSegment(instanceId)}/runtime`, opts);
|
|
1028
1028
|
writeLine(JSON.stringify(result, null, 2));
|
|
1029
1029
|
});
|
|
1030
|
-
command.command("run <instanceId>").description("Create a task through PAGS on an instance's registered
|
|
1030
|
+
command.command("run <instanceId>").description("Create a task through PAGS on an instance's registered browser 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(
|
|
1031
1031
|
async (instanceId, opts) => {
|
|
1032
1032
|
let input = {};
|
|
1033
1033
|
if (opts.input) {
|
|
@@ -1048,7 +1048,7 @@ function createRunnerCommand() {
|
|
|
1048
1048
|
writeLine(JSON.stringify(result, null, 2));
|
|
1049
1049
|
}
|
|
1050
1050
|
);
|
|
1051
|
-
command.command("approve-task <instanceId> <taskId>").description("Approve a registered
|
|
1051
|
+
command.command("approve-task <instanceId> <taskId>").description("Approve a registered browser 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) => {
|
|
1052
1052
|
const result = await requestPags(
|
|
1053
1053
|
"POST",
|
|
1054
1054
|
`/v1/instances/${apiPathSegment(instanceId)}/tasks/${apiPathSegment(taskId)}/approve`,
|
|
@@ -1056,7 +1056,7 @@ function createRunnerCommand() {
|
|
|
1056
1056
|
);
|
|
1057
1057
|
writeLine(JSON.stringify(result, null, 2));
|
|
1058
1058
|
});
|
|
1059
|
-
command.command("cancel-task <instanceId> <taskId>").description("Cancel a registered
|
|
1059
|
+
command.command("cancel-task <instanceId> <taskId>").description("Cancel a registered browser 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) => {
|
|
1060
1060
|
const result = await requestPags(
|
|
1061
1061
|
"POST",
|
|
1062
1062
|
`/v1/instances/${apiPathSegment(instanceId)}/tasks/${apiPathSegment(taskId)}/cancel`,
|
|
@@ -1064,7 +1064,7 @@ function createRunnerCommand() {
|
|
|
1064
1064
|
);
|
|
1065
1065
|
writeLine(JSON.stringify(result, null, 2));
|
|
1066
1066
|
});
|
|
1067
|
-
command.command("task-events <instanceId>").description("Read registered
|
|
1067
|
+
command.command("task-events <instanceId>").description("Read registered browser 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) => {
|
|
1068
1068
|
const result = await requestPags(
|
|
1069
1069
|
"GET",
|
|
1070
1070
|
`/v1/instances/${apiPathSegment(instanceId)}/task-events?limit=${Number(opts.limit) || 50}`,
|
|
@@ -1076,11 +1076,11 @@ function createRunnerCommand() {
|
|
|
1076
1076
|
const task = await requestRunner("POST", `/tasks/${apiPathSegment(taskId)}/approve`, opts);
|
|
1077
1077
|
writeLine(JSON.stringify(task, null, 2));
|
|
1078
1078
|
});
|
|
1079
|
-
command.command("cancel <taskId>").description("Cancel a local
|
|
1079
|
+
command.command("cancel <taskId>").description("Cancel a local browser 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) => {
|
|
1080
1080
|
const task = await requestRunner("POST", `/tasks/${apiPathSegment(taskId)}/cancel`, opts);
|
|
1081
1081
|
writeLine(JSON.stringify(task, null, 2));
|
|
1082
1082
|
});
|
|
1083
|
-
command.command("events").description("List recent
|
|
1083
|
+
command.command("events").description("List recent browser 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) => {
|
|
1084
1084
|
const events = await requestRunner("GET", `/events?limit=${Number(opts.limit) || 50}`, opts);
|
|
1085
1085
|
writeLine(JSON.stringify(events, null, 2));
|
|
1086
1086
|
});
|
|
@@ -1289,7 +1289,7 @@ var upCommand = new Command7("up").description("Start the browser runner for all
|
|
|
1289
1289
|
printStatus(state);
|
|
1290
1290
|
continue;
|
|
1291
1291
|
}
|
|
1292
|
-
if (trimmed.includes("
|
|
1292
|
+
if (trimmed.includes("browser runtime listening")) {
|
|
1293
1293
|
state.runner = "online";
|
|
1294
1294
|
state.lastEvent = "Runner started";
|
|
1295
1295
|
printStatus(state);
|