@proagentstore/cli 0.4.78 → 0.4.80

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.
@@ -16,6 +16,8 @@ import { LocalBrowserRuntime } from "./local-browser/runtime.js";
16
16
  import { LOCAL_BROWSER_TASK_TYPE } from "./local-browser/contract.js";
17
17
  import { LocalArtifactRuntime } from "./local-artifact/runtime.js";
18
18
  import { LOCAL_ARTIFACT_TASK_TYPE } from "./local-artifact/contract.js";
19
+ import { LocalApplyRuntime } from "./local-apply/runtime.js";
20
+ import { LOCAL_APPLY_TASK_TYPE } from "./local-apply/contract.js";
19
21
  import { WORKFLOW_DRIVEN_TASKS } from "./task-types.js";
20
22
  /** True for a plain object. */
21
23
  function isRecord(value) {
@@ -81,6 +83,8 @@ export class LocalRunner {
81
83
  localBrowser;
82
84
  /** Local artifact generation (#956): the Application Tailor's résumé + cover letter, from the owner's own files. */
83
85
  localArtifact;
86
+ /** Local application execution (#957): a signed-in CLI filling one application through the apply bridge. */
87
+ localApply;
84
88
  /** This runner's own local URL, once the server listens — the bridge forwarder calls back to it. */
85
89
  selfUrl = null;
86
90
  /** Live human-takeover sessions, keyed by task id (the page is kept alive). */
@@ -90,20 +94,18 @@ export class LocalRunner {
90
94
  mkdirSync(config.dataDir, { recursive: true });
91
95
  this.store = new RunnerStore(config.dataDir);
92
96
  this.coding = new CodingRuntime(join(config.dataDir, "repos"));
93
- this.localBrowser = new LocalBrowserRuntime({
94
- dataDir: config.dataDir,
95
- selfUrl: () => this.selfUrl,
96
- // `default` is the runner's own signed-in browser, shared and never closed by a run;
97
- // `isolated` is a fresh profile inside the run's folder, removed with it.
98
- browserFor: async (profile, runDir) => {
99
- if (profile === "default")
100
- return { tools: await this.getMcp(), stop: async () => undefined };
101
- const mcp = new McpRuntime();
102
- await mcp.start({ userDataDir: join(runDir, "profile"), headless: config.headless });
103
- return { tools: mcp, stop: () => mcp.stop() };
104
- },
105
- });
97
+ // `default` is the runner's own signed-in browser, shared and never closed by a run;
98
+ // `isolated` is a fresh profile inside the run's folder, removed with it.
99
+ const browserFor = async (profile, runDir) => {
100
+ if (profile === "default")
101
+ return { tools: await this.getMcp(), stop: async () => undefined };
102
+ const mcp = new McpRuntime();
103
+ await mcp.start({ userDataDir: join(runDir, "profile"), headless: config.headless });
104
+ return { tools: mcp, stop: () => mcp.stop() };
105
+ };
106
+ this.localBrowser = new LocalBrowserRuntime({ dataDir: config.dataDir, selfUrl: () => this.selfUrl, browserFor });
106
107
  this.localArtifact = new LocalArtifactRuntime({ dataDir: config.dataDir });
108
+ this.localApply = new LocalApplyRuntime({ dataDir: config.dataDir, selfUrl: () => this.selfUrl, browserFor });
107
109
  // Tasks paused/running on a previous process are orphaned now — their
108
110
  // pages and takeover sessions are gone. Fail them so the board is clean.
109
111
  const expired = this.store.expireInFlightTasks();
@@ -118,7 +120,7 @@ export class LocalRunner {
118
120
  runtimePlane: "pags",
119
121
  runnerRole: "tool-executor",
120
122
  capabilities: [...CAPABILITIES, ...CodingRuntime.capabilities()],
121
- taskTypes: ["echo", "browser.open", "job.apply_agent", "site_builder_runtime", LOCAL_BROWSER_TASK_TYPE, LOCAL_ARTIFACT_TASK_TYPE, ...CodingRuntime.taskTypes()],
123
+ taskTypes: ["echo", "browser.open", "job.apply_agent", "site_builder_runtime", LOCAL_BROWSER_TASK_TYPE, LOCAL_ARTIFACT_TASK_TYPE, LOCAL_APPLY_TASK_TYPE, ...CodingRuntime.taskTypes()],
122
124
  approvalRequiredFor: [...APPROVAL_REQUIRED_TASKS],
123
125
  };
124
126
  }
@@ -256,6 +258,7 @@ export class LocalRunner {
256
258
  async close() {
257
259
  this.localBrowser.closeAll();
258
260
  this.localArtifact.closeAll();
261
+ this.localApply.closeAll();
259
262
  try {
260
263
  this.coding.closeAll();
261
264
  }
@@ -12,7 +12,11 @@ export function createRunnerServer(runner) {
12
12
  if (!req.headers.origin && req.method === "POST" && (req.url || "").split("?")[0] === "/local-browser/bridge") {
13
13
  const body = await readJson(req);
14
14
  const token = String(req.headers["x-pags-bridge-token"] || "");
15
- if (!runner.localBrowser.authorizeBridge(String(body.runId ?? ""), token))
15
+ const runId = String(body.runId ?? "");
16
+ // The same forwarder serves application runs (#957); each runtime knows only its own tokens.
17
+ if (runner.localApply.authorizeBridge(runId, token))
18
+ return json(res, 200, await runner.localApply.bridge(body));
19
+ if (!runner.localBrowser.authorizeBridge(runId, token))
16
20
  return json(res, 401, { error: "Unauthorized" });
17
21
  return json(res, 200, await runner.localBrowser.bridge(body));
18
22
  }
@@ -187,6 +191,19 @@ async function route(runner, req, res) {
187
191
  if (req.method === "POST" && path === "/local-artifact/cancel") {
188
192
  return json(res, 200, runner.localArtifact.cancel(await readJson(req)));
189
193
  }
194
+ // Local application execution (#957) — run, status, resume, cancel; PULL like research.
195
+ if (req.method === "POST" && path === "/local-apply/run") {
196
+ return json(res, 202, runner.localApply.start(await readJson(req)));
197
+ }
198
+ if (req.method === "POST" && path === "/local-apply/status") {
199
+ return json(res, 200, runner.localApply.status(await readJson(req)));
200
+ }
201
+ if (req.method === "POST" && path === "/local-apply/resume") {
202
+ return json(res, 200, runner.localApply.resume(await readJson(req)));
203
+ }
204
+ if (req.method === "POST" && path === "/local-apply/cancel") {
205
+ return json(res, 200, runner.localApply.cancel(await readJson(req)));
206
+ }
190
207
  if (req.method === "POST" && path === "/coding/start") {
191
208
  const b = await readJson(req);
192
209
  return json(res, 200, runner.coding.start(b));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proagentstore/cli",
3
- "version": "0.4.78",
3
+ "version": "0.4.80",
4
4
  "description": "CLI for creating, publishing, and running ProAgentStore agents",
5
5
  "license": "MIT",
6
6
  "type": "module",