@docyrus/docyrus 0.0.56 → 0.0.58

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.
@@ -1,67 +1,82 @@
1
1
  ---
2
- name: docyrus-chrome-devtools-cli
3
- description: Use Docyrus CLI chrome commands for visible browser automation through Chrome DevTools. Use when you need to launch Chrome with remote debugging, navigate pages, inspect DOM state, evaluate JavaScript, capture screenshots, pick elements interactively, inspect cookies, extract readable page content, or scrape Hacker News.
2
+ name: docyrus-browser-cli
3
+ description: Use Docyrus CLI browser commands for browser automation (local Chrome or remote Cloudflare Browser Rendering). Use when you need to start a browser session, navigate pages, inspect DOM state, evaluate JavaScript, capture screenshots, pick elements interactively, inspect cookies, extract readable page content, or run CDP scripts.
4
4
  ---
5
5
 
6
- # Docyrus Chrome DevTools CLI
6
+ # Docyrus Browser CLI
7
7
 
8
- Chrome DevTools Protocol workflows exposed through the local `docyrus` CLI.
8
+ Browser automation commands exposed through the `docyrus` CLI. Works in both local mode (Chrome on `:9222`) and remote sandbox mode (Cloudflare Browser Rendering via WSS).
9
+
10
+ All commands return JSON with a `mode` field (`"local"` or `"remote"`). In remote mode, responses include `devtoolsFrontendUrl` for live DevTools access.
9
11
 
10
12
  ## Commands
11
13
 
12
- Start Chrome with remote debugging on `:9222`:
14
+ Start a browser session:
13
15
 
14
16
  ```bash
15
- docyrus chrome start
16
- docyrus chrome start --profile
17
+ docyrus browser start
18
+ docyrus browser start --profile
17
19
  ```
18
20
 
19
- - `--profile` copies the user's default Chrome profile so cookies and existing logins are available.
21
+ - Local mode: launches Chrome with remote debugging on `:9222`. `--profile` copies the user's default Chrome profile.
22
+ - Sandbox mode: creates a Cloudflare Browser Rendering session and opens the app preview URL.
20
23
 
21
24
  Navigate tabs:
22
25
 
23
26
  ```bash
24
- docyrus chrome nav https://example.com
25
- docyrus chrome nav https://example.com --new
26
- docyrus chrome nav https://example.com --reload
27
+ docyrus browser nav https://example.com
28
+ docyrus browser nav https://example.com --new
29
+ docyrus browser nav https://example.com --reload
27
30
  ```
28
31
 
29
32
  Run JavaScript in the active tab:
30
33
 
31
34
  ```bash
32
- docyrus chrome eval 'document.title'
33
- docyrus chrome eval 'document.querySelectorAll("a").length'
35
+ docyrus browser eval 'document.title'
36
+ docyrus browser eval 'document.querySelectorAll("a").length'
34
37
  ```
35
38
 
36
39
  Capture a screenshot of the active tab:
37
40
 
38
41
  ```bash
39
- docyrus chrome screenshot
42
+ docyrus browser screenshot
40
43
  ```
41
44
 
42
45
  Interactively pick DOM elements in the visible browser:
43
46
 
44
47
  ```bash
45
- docyrus chrome pick "Click the submit button"
48
+ docyrus browser pick "Click the submit button"
46
49
  ```
47
50
 
48
51
  Inspect cookies for the active tab:
49
52
 
50
53
  ```bash
51
- docyrus chrome cookies
54
+ docyrus browser cookies
52
55
  ```
53
56
 
54
57
  Extract readable content as markdown:
55
58
 
56
59
  ```bash
57
- docyrus chrome content https://example.com
60
+ docyrus browser content https://example.com
58
61
  ```
59
62
 
60
- Scrape Hacker News:
63
+ Run a CDP script on the active browser session:
61
64
 
62
65
  ```bash
63
- docyrus chrome hn-scraper
64
- docyrus chrome hn-scraper --limit 10
66
+ docyrus browser run-script my-script.js
67
+ docyrus browser run-script my-script.js --appId <appId>
68
+ docyrus browser run-script my-script.js --appSlug my-app
69
+ ```
70
+
71
+ - The script receives `browser` (Puppeteer Browser) and `page` (a new Page) as function arguments.
72
+ - Whatever the script returns is printed as JSON to stdout.
73
+
74
+ Example script (`scrape-title.js`):
75
+
76
+ ```js
77
+ await page.goto("https://example.com");
78
+ const title = await page.title();
79
+ return { title };
65
80
  ```
66
81
 
67
82
  ## When To Use
@@ -71,10 +86,12 @@ docyrus chrome hn-scraper --limit 10
71
86
  - You need to inspect DOM state without guessing selectors.
72
87
  - You want the user to click elements directly through an interactive picker.
73
88
  - You need quick page extraction or screenshot capture from a real browser session.
89
+ - You need to run CDP scripts against a remote headless browser from within a sandbox.
74
90
 
75
91
  ## Working Style
76
92
 
77
- - Start Chrome first with `docyrus chrome start` if the debugger is not already available.
78
- - Prefer `docyrus chrome eval` for DOM inspection and structured page state.
79
- - Use `docyrus chrome pick` when element targeting is ambiguous or user choice matters.
80
- - Use `docyrus chrome content` for readable markdown extraction from article-like pages.
93
+ - Start a session first with `docyrus browser start` if the browser is not already available.
94
+ - Prefer `docyrus browser eval` for DOM inspection and structured page state.
95
+ - Use `docyrus browser pick` when element targeting is ambiguous or user choice matters.
96
+ - Use `docyrus browser content` for readable markdown extraction from article-like pages.
97
+ - Use `docyrus browser run-script` to run full Puppeteer scripts on the active browser session.
@@ -108,19 +108,19 @@ Send a prompt to a Docyrus AI agent.
108
108
 
109
109
  ---
110
110
 
111
- ## chromeChrome DevTools Browser Automation
111
+ ## browser — Browser Automation
112
112
 
113
- Docyrus ships Chrome DevTools helper commands for visible browser automation against Chrome running with remote debugging on `:9222`.
113
+ Browser automation commands (local Chrome or remote Cloudflare Browser Rendering). All commands return JSON with a `mode` field (`"local"` or `"remote"`).
114
114
 
115
- ### `docyrus chrome start`
115
+ ### `docyrus browser start`
116
116
 
117
- Launch Chrome with remote debugging enabled.
117
+ Start a browser session. Local mode launches Chrome on `:9222`. Sandbox mode creates a Cloudflare session.
118
118
 
119
119
  | Option | Type | Description |
120
120
  |---|---|---|
121
- | `--profile` | boolean | Copy the default Chrome profile so existing cookies and logins are available |
121
+ | `--profile` | boolean | Copy the default Chrome profile (local mode only) |
122
122
 
123
- ### `docyrus chrome nav <url>`
123
+ ### `docyrus browser nav <url>`
124
124
 
125
125
  Navigate the active tab or open the URL in a new tab.
126
126
 
@@ -129,33 +129,35 @@ Navigate the active tab or open the URL in a new tab.
129
129
  | `--new` | boolean | Open the URL in a new tab |
130
130
  | `--reload` | boolean | Force a reload after navigation |
131
131
 
132
- ### `docyrus chrome eval <code>`
132
+ ### `docyrus browser eval <code>`
133
133
 
134
134
  Execute JavaScript in the active tab and print the result.
135
135
 
136
- ### `docyrus chrome screenshot`
136
+ ### `docyrus browser screenshot`
137
137
 
138
138
  Capture the current viewport and return the temporary screenshot file path.
139
139
 
140
- ### `docyrus chrome pick <message>`
140
+ ### `docyrus browser pick <message>`
141
141
 
142
142
  Open an interactive element picker in the active tab and return information about the selected element or elements.
143
143
 
144
- ### `docyrus chrome cookies`
144
+ ### `docyrus browser cookies`
145
145
 
146
146
  Print cookies for the active tab, including domain, path, `httpOnly`, and `secure` flags.
147
147
 
148
- ### `docyrus chrome content <url>`
148
+ ### `docyrus browser content <url>`
149
149
 
150
150
  Navigate to a URL and extract readable content as markdown.
151
151
 
152
- ### `docyrus chrome hn-scraper`
152
+ ### `docyrus browser run-script <script>`
153
153
 
154
- Scrape Hacker News front page submissions as JSON.
154
+ Run a CDP script file on the active browser session.
155
155
 
156
156
  | Option | Type | Description |
157
157
  |---|---|---|
158
- | `--limit` | number | Maximum number of submissions to return |
158
+ | `--appId` | string | App ID for browser session resolution |
159
+ | `--appSlug` | string | App slug for browser session resolution |
160
+ | `--keepAlive` | number | Session keep-alive in milliseconds |
159
161
 
160
162
  ---
161
163
 
package/server-loader.js CHANGED
@@ -17984,7 +17984,7 @@ var require_websocket_server = __commonJS({
17984
17984
  }
17985
17985
  });
17986
17986
 
17987
- // ../../node_modules/.pnpm/@hono+node-server@1.19.13_hono@4.12.12/node_modules/@hono/node-server/dist/index.mjs
17987
+ // ../../node_modules/.pnpm/@hono+node-server@1.19.13_hono@4.12.14/node_modules/@hono/node-server/dist/index.mjs
17988
17988
  var dist_exports = {};
17989
17989
  __export(dist_exports, {
17990
17990
  RequestError: () => RequestError,
@@ -18039,7 +18039,7 @@ function writeFromReadableStream(stream, writable) {
18039
18039
  }
18040
18040
  var import_http, import_http2, import_http22, import_stream2, import_crypto, RequestError, toRequestError, GlobalRequest, Request2, newHeadersFromIncoming, wrapBodyStream, newRequestFromIncoming, getRequestCache, requestCache, incomingKey, urlKey, headersKey, abortControllerKey, getAbortController, requestPrototype, newRequest, responseCache, getResponseCache, cacheKey, GlobalResponse, Response2, buildOutgoingHttpHeaders, X_ALREADY_SENT, outgoingEnded, incomingDraining, DRAIN_TIMEOUT_MS, MAX_DRAIN_BYTES, drainIncoming, handleRequestError, handleFetchError, handleResponseError, flushHeaders, responseViaCache, isPromise, responseViaResponseObject, getRequestListener, createAdaptorServer, serve;
18041
18041
  var init_dist = __esm({
18042
- "../../node_modules/.pnpm/@hono+node-server@1.19.13_hono@4.12.12/node_modules/@hono/node-server/dist/index.mjs"() {
18042
+ "../../node_modules/.pnpm/@hono+node-server@1.19.13_hono@4.12.14/node_modules/@hono/node-server/dist/index.mjs"() {
18043
18043
  "use strict";
18044
18044
  import_http = require("http");
18045
18045
  import_http2 = require("http2");
@@ -33177,7 +33177,7 @@ var EnvironmentConfigService = class {
33177
33177
  }
33178
33178
  };
33179
33179
 
33180
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/compose.js
33180
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/compose.js
33181
33181
  var compose = (middleware, onError, onNotFound) => {
33182
33182
  return (context, next) => {
33183
33183
  let index2 = -1;
@@ -33221,10 +33221,10 @@ var compose = (middleware, onError, onNotFound) => {
33221
33221
  };
33222
33222
  };
33223
33223
 
33224
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/request/constants.js
33224
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/request/constants.js
33225
33225
  var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
33226
33226
 
33227
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/utils/body.js
33227
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/utils/body.js
33228
33228
  var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
33229
33229
  const { all: all2 = false, dot = false } = options;
33230
33230
  const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
@@ -33296,7 +33296,7 @@ var handleParsingNestedValues = (form, key, value2) => {
33296
33296
  });
33297
33297
  };
33298
33298
 
33299
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/utils/url.js
33299
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/utils/url.js
33300
33300
  var splitPath = (path6) => {
33301
33301
  const paths = path6.split("/");
33302
33302
  if (paths[0] === "") {
@@ -33500,7 +33500,7 @@ var getQueryParams = (url2, key) => {
33500
33500
  };
33501
33501
  var decodeURIComponent_ = decodeURIComponent;
33502
33502
 
33503
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/request.js
33503
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/request.js
33504
33504
  var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
33505
33505
  var HonoRequest = class {
33506
33506
  /**
@@ -33768,7 +33768,7 @@ var HonoRequest = class {
33768
33768
  }
33769
33769
  };
33770
33770
 
33771
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/utils/html.js
33771
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/utils/html.js
33772
33772
  var HtmlEscapedCallbackPhase = {
33773
33773
  Stringify: 1,
33774
33774
  BeforeStream: 2,
@@ -33810,7 +33810,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
33810
33810
  }
33811
33811
  };
33812
33812
 
33813
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/context.js
33813
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/context.js
33814
33814
  var TEXT_PLAIN = "text/plain; charset=UTF-8";
33815
33815
  var setDefaultContentType = (contentType, headers) => {
33816
33816
  return {
@@ -34217,7 +34217,7 @@ var Context = class {
34217
34217
  };
34218
34218
  };
34219
34219
 
34220
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router.js
34220
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/router.js
34221
34221
  var METHOD_NAME_ALL = "ALL";
34222
34222
  var METHOD_NAME_ALL_LOWERCASE = "all";
34223
34223
  var METHODS = ["get", "post", "put", "delete", "options", "patch"];
@@ -34225,10 +34225,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
34225
34225
  var UnsupportedPathError = class extends Error {
34226
34226
  };
34227
34227
 
34228
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/utils/constants.js
34228
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/utils/constants.js
34229
34229
  var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
34230
34230
 
34231
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/hono-base.js
34231
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/hono-base.js
34232
34232
  var notFoundHandler = (c) => {
34233
34233
  return c.text("404 Not Found", 404);
34234
34234
  };
@@ -34599,7 +34599,7 @@ var Hono = class _Hono {
34599
34599
  };
34600
34600
  };
34601
34601
 
34602
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router/reg-exp-router/matcher.js
34602
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/router/reg-exp-router/matcher.js
34603
34603
  var emptyParam = [];
34604
34604
  function match(method, path6) {
34605
34605
  const matchers = this.buildAllMatchers();
@@ -34620,7 +34620,7 @@ function match(method, path6) {
34620
34620
  return match2(method, path6);
34621
34621
  }
34622
34622
 
34623
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router/reg-exp-router/node.js
34623
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/router/reg-exp-router/node.js
34624
34624
  var LABEL_REG_EXP_STR = "[^/]+";
34625
34625
  var ONLY_WILDCARD_REG_EXP_STR = ".*";
34626
34626
  var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
@@ -34728,7 +34728,7 @@ var Node = class _Node {
34728
34728
  }
34729
34729
  };
34730
34730
 
34731
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router/reg-exp-router/trie.js
34731
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/router/reg-exp-router/trie.js
34732
34732
  var Trie = class {
34733
34733
  #context = { varIndex: 0 };
34734
34734
  #root = new Node();
@@ -34784,7 +34784,7 @@ var Trie = class {
34784
34784
  }
34785
34785
  };
34786
34786
 
34787
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router/reg-exp-router/router.js
34787
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/router/reg-exp-router/router.js
34788
34788
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
34789
34789
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
34790
34790
  function buildWildcardRegExp(path6) {
@@ -34963,7 +34963,7 @@ var RegExpRouter = class {
34963
34963
  }
34964
34964
  };
34965
34965
 
34966
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router/smart-router/router.js
34966
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/router/smart-router/router.js
34967
34967
  var SmartRouter = class {
34968
34968
  name = "SmartRouter";
34969
34969
  #routers = [];
@@ -35018,7 +35018,7 @@ var SmartRouter = class {
35018
35018
  }
35019
35019
  };
35020
35020
 
35021
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router/trie-router/node.js
35021
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/router/trie-router/node.js
35022
35022
  var emptyParams = /* @__PURE__ */ Object.create(null);
35023
35023
  var hasChildren = (children) => {
35024
35024
  for (const _ in children) {
@@ -35193,7 +35193,7 @@ var Node2 = class _Node2 {
35193
35193
  }
35194
35194
  };
35195
35195
 
35196
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/router/trie-router/router.js
35196
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/router/trie-router/router.js
35197
35197
  var TrieRouter = class {
35198
35198
  name = "TrieRouter";
35199
35199
  #node;
@@ -35215,7 +35215,7 @@ var TrieRouter = class {
35215
35215
  }
35216
35216
  };
35217
35217
 
35218
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/hono.js
35218
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/hono.js
35219
35219
  var Hono2 = class extends Hono {
35220
35220
  /**
35221
35221
  * Creates an instance of the Hono class.
@@ -35230,7 +35230,7 @@ var Hono2 = class extends Hono {
35230
35230
  }
35231
35231
  };
35232
35232
 
35233
- // ../../node_modules/.pnpm/hono@4.12.12/node_modules/hono/dist/middleware/cors/index.js
35233
+ // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/middleware/cors/index.js
35234
35234
  var cors = (options) => {
35235
35235
  const defaults = {
35236
35236
  origin: "*",
@@ -43378,23 +43378,39 @@ function attachPtyBridge(server, authToken) {
43378
43378
  return;
43379
43379
  }
43380
43380
  }
43381
+ const origin = request.headers.origin ?? "unknown";
43382
+ const remoteAddr = request.socket?.remoteAddress ?? "unknown";
43383
+ process.stderr.write(` PTY WebSocket upgrade from ${remoteAddr} (origin: ${origin})
43384
+ `);
43381
43385
  wss.handleUpgrade(request, socket, head, (ws) => {
43382
43386
  wss.emit("connection", ws, request);
43383
43387
  });
43384
43388
  });
43385
43389
  wss.on("connection", (ws) => {
43386
43390
  const shell = getDefaultShell();
43387
- const ptyProcess = pty.spawn(shell, [], {
43388
- name: "xterm-256color",
43389
- cols: DEFAULT_COLS,
43390
- rows: DEFAULT_ROWS,
43391
- cwd: process.cwd(),
43392
- env: {
43393
- ...process.env,
43394
- TERM: "xterm-256color",
43395
- COLORTERM: "truecolor"
43391
+ let ptyProcess;
43392
+ try {
43393
+ ptyProcess = pty.spawn(shell, [], {
43394
+ name: "xterm-256color",
43395
+ cols: DEFAULT_COLS,
43396
+ rows: DEFAULT_ROWS,
43397
+ cwd: process.cwd(),
43398
+ env: {
43399
+ ...process.env,
43400
+ TERM: "xterm-256color",
43401
+ COLORTERM: "truecolor"
43402
+ }
43403
+ });
43404
+ } catch (err2) {
43405
+ const message = err2 instanceof Error ? err2.message : String(err2);
43406
+ process.stderr.write(` PTY spawn failed (${shell}): ${message}
43407
+ `);
43408
+ if (ws.readyState === import_websocket.default.OPEN) {
43409
+ ws.send(JSON.stringify({ type: "error", message: `Failed to spawn shell: ${message}` }));
43410
+ ws.close();
43396
43411
  }
43397
- });
43412
+ return;
43413
+ }
43398
43414
  const onData = ptyProcess.onData((data) => {
43399
43415
  if (ws.readyState === import_websocket.default.OPEN) {
43400
43416
  ws.send(data);
@@ -45657,14 +45673,11 @@ async function createAgentServer(params) {
45657
45673
  return c.json({ error: message }, status);
45658
45674
  }
45659
45675
  });
45660
- const CLI_EXEC = process.env.DOCYRUS_CLI_EXECUTABLE || process.execPath;
45661
- const CLI_ENTRY = process.env.DOCYRUS_CLI_ENTRY || (0, import_node_path22.resolve)(process.argv[1] ? (0, import_node_path22.join)(process.argv[1], "..") : __dirname, "main.js");
45662
- const CLI_SCOPE = process.env.DOCYRUS_CLI_SCOPE;
45676
+ const CLI_GLOBAL = process.env.DOCYRUS_CLI_SCOPE === "global";
45663
45677
  const CLI_TIMEOUT_MS = 3e4;
45664
45678
  function runCliCommand(args2) {
45665
45679
  return new Promise((resolveResult) => {
45666
- const scopeArgs = CLI_SCOPE ? ["--scope", CLI_SCOPE] : [];
45667
- const proc = (0, import_node_child_process3.spawn)(CLI_EXEC, [CLI_ENTRY, ...scopeArgs, ...args2, "--json"], {
45680
+ const proc = (0, import_node_child_process3.spawn)("docyrus", [...CLI_GLOBAL ? ["-g"] : [], ...args2, "--json"], {
45668
45681
  cwd: context.cwd,
45669
45682
  stdio: ["ignore", "pipe", "pipe"],
45670
45683
  timeout: CLI_TIMEOUT_MS
@@ -46313,8 +46326,7 @@ async function createAgentServer(params) {
46313
46326
  }
46314
46327
  const cliArgs = buildCliArgs(pathSegments, query, body2);
46315
46328
  return new Promise((resolveResponse) => {
46316
- const scopeArgs = CLI_SCOPE ? ["--scope", CLI_SCOPE] : [];
46317
- const proc = (0, import_node_child_process3.spawn)(CLI_EXEC, [CLI_ENTRY, ...scopeArgs, ...cliArgs], {
46329
+ const proc = (0, import_node_child_process3.spawn)("docyrus", [...CLI_GLOBAL ? ["-g"] : [], ...cliArgs], {
46318
46330
  cwd: context.cwd,
46319
46331
  stdio: ["ignore", "pipe", "pipe"],
46320
46332
  timeout: CLI_TIMEOUT_MS
@@ -46329,10 +46341,16 @@ async function createAgentServer(params) {
46329
46341
  });
46330
46342
  proc.on("close", (code) => {
46331
46343
  if (code !== 0) {
46344
+ let parsedStdout;
46345
+ try {
46346
+ parsedStdout = JSON.parse(stdout);
46347
+ } catch {
46348
+ }
46332
46349
  resolveResponse(c.json({
46333
46350
  error: stderr.trim() || `Command exited with code ${code}`,
46334
46351
  command: `docyrus ${cliArgs.join(" ")}`,
46335
- exitCode: code
46352
+ exitCode: code,
46353
+ ...parsedStdout !== void 0 ? { detail: parsedStdout } : stdout.trim() ? { output: stdout.trim() } : {}
46336
46354
  }, 500));
46337
46355
  return;
46338
46356
  }