gm-skill 2.0.1615 → 2.0.1616

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.
@@ -12,18 +12,20 @@ YOU drive the browser through the spool: plugkit holds the Chromium handle, per-
12
12
 
13
13
  ## Body shapes
14
14
 
15
- The body is a string, six shapes only:
15
+ The body is a string, these shapes:
16
16
 
17
17
  ```
18
18
  session new
19
19
  session list
20
20
  session close <id>
21
21
  <arbitrary JS expression evaluated in page context>
22
+ <https://... bare URL>
23
+ url=<url>\n<expression>
22
24
  timeout=<ms>\n<expression>
23
25
  capture\n<expression>
24
26
  ```
25
27
 
26
- A bare expression with no live session opens one against `about:blank`; with a live session it reuses it. `session new` returns the id you carry; with more than one open, target it via `session=<id>\n<expr>`. (`session close` and `session kill` are aliases.) Default per-eval timeout 120000ms; operations that legitimately exceed it prefix `timeout=<ms>\n` (wrapper clamps to 120000ms). The response carries `timeout_ms_used`; `browser.runner-timeout` fires at the cap -- read `stderr`, narrow or raise, never retry blind at the same budget.
28
+ **Open on the page you want to test, not a blank one.** A bare `https://...` URL body navigates the session straight to that page and returns `{url, title}` -- the simplest "show me this page." `url=<url>\n<expression>` navigates first, then runs your expression on the loaded page, so the global/DOM you assert is already there in one dispatch instead of a blank surface you must `page.goto` yourself. `url=` composes with `timeout=` and `capture` -- stack the prefix lines in order `timeout=`, then `url=`, then `capture`, the expression last; the prepended `page.goto` rides inside the capture so its navigation console/network is captured too. A bare expression with no URL prefix and no live session opens against `about:blank`; with a live session it reuses it. `session new` returns the id you carry; with more than one open, target it via `session=<id>\n<expr>`. (`session close` and `session kill` are aliases.) Default per-eval timeout 120000ms; operations that legitimately exceed it prefix `timeout=<ms>\n` (wrapper clamps to 120000ms). The response carries `timeout_ms_used`; `browser.runner-timeout` fires at the cap -- read `stderr`, narrow or raise, never retry blind at the same budget.
27
29
 
28
30
  **`capture\n<expression>` is the zero-boilerplate debug path -- prefer it.** Prefix your script with `capture` (or `profile`) on its own line and the wrapper auto-attaches `page.on('console'|'pageerror'|'requestfinished')` before your code runs, runs your script in an async wrapper (your top-level `await`/`return` work unchanged), and returns `{result: <your return>, debug: {console, pageErrors, network, performance}}` -- page console logs, uncaught errors, per-request network timing, and navigation performance, captured for free. Combine with timeout via `timeout=<ms>\ncapture\n<expr>`. Use the bare expression only when you do not want the capture overhead.
29
31
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1615",
3
+ "version": "2.0.1616",
4
4
  "description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Includes plugkit-wasm-wrapper for WASM-based spool watching.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -2000,6 +2000,22 @@ function makeHostFunctions(instanceRef) {
2000
2000
  evalBody = timeoutMatch[2];
2001
2001
  }
2002
2002
  }
2003
+ let startUrl = null;
2004
+ const urlMatch = evalBody.match(/^url=(\S+)[ \t]*\n([\s\S]*)$/);
2005
+ if (urlMatch) {
2006
+ startUrl = urlMatch[1];
2007
+ evalBody = urlMatch[2];
2008
+ } else {
2009
+ const bare = evalBody.trim();
2010
+ if (/^https?:\/\/\S+$/.test(bare)) {
2011
+ startUrl = bare;
2012
+ evalBody = 'return {url: page.url(), title: await page.title()};';
2013
+ }
2014
+ }
2015
+ const navTimeout = Math.min(timeoutMs, 60000);
2016
+ const gotoPrefix = startUrl
2017
+ ? `await page.goto(${JSON.stringify(startUrl)},{waitUntil:'load',timeout:${navTimeout}});\n`
2018
+ : '';
2003
2019
  const captureMatch = evalBody.match(/^(?:capture|profile)[ \t]*\n([\s\S]*)$/);
2004
2020
  if (captureMatch) {
2005
2021
  const userScript = captureMatch[1];
@@ -2007,9 +2023,11 @@ function makeHostFunctions(instanceRef) {
2007
2023
  + `try{page.on('console',m=>{try{__logs.push({type:m.type(),text:m.text()});}catch(_){}});`
2008
2024
  + `page.on('pageerror',e=>{try{__errs.push(String(e&&e.message||e));}catch(_){}});`
2009
2025
  + `page.on('requestfinished',r=>{try{const t=r.timing();__net.push({url:String(r.url()).slice(0,120),dur_ms:Math.round(t.responseEnd),ttfb_ms:Math.round(t.responseStart)});}catch(_){}});}catch(_){}\n`
2010
- + `const __result = await (async () => {\n${userScript}\n})();\n`
2026
+ + `const __result = await (async () => {\n${gotoPrefix}${userScript}\n})();\n`
2011
2027
  + `let __perf=null;try{__perf=await page.evaluate(()=>{const n=performance.getEntriesByType('navigation')[0];return n?{load_ms:Math.round(n.loadEventEnd||0),dcl_ms:Math.round(n.domContentLoadedEventEnd||0),resources:performance.getEntriesByType('resource').length,now:Math.round(performance.now())}:null;});}catch(_){}\n`
2012
2028
  + `return {result:__result,debug:{console:__logs,pageErrors:__errs,network:__net.slice(0,30),performance:__perf}};`;
2029
+ } else if (startUrl) {
2030
+ evalBody = `${gotoPrefix}${evalBody}`;
2013
2031
  }
2014
2032
  const outerTimeoutMs = Math.min(timeoutMs + 6000, 126000);
2015
2033
  const r = runBrowserRunner(pw, ['-s', pwSessionId, '--timeout', String(timeoutMs), '-e', evalBody], outerTimeoutMs, cwd, sessionId);
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1615",
3
+ "version": "2.0.1616",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1615",
3
+ "version": "2.0.1616",
4
4
  "description": "Canonical universal harness — AI-native software engineering via skill-driven orchestration; bootstraps plugkit for task execution and session isolation. Install in any AI coding agent host.",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",