ax-grep 0.0.0 → 0.1.1
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.
- package/LICENSE +21 -0
- package/README.md +106 -1
- package/dist/browser.d.ts +11 -0
- package/dist/browser.js +12 -0
- package/dist/browser.js.map +1 -0
- package/dist/chunk-HPZ32BKV.js +612 -0
- package/dist/chunk-HPZ32BKV.js.map +1 -0
- package/dist/chunk-ZXTURCRT.js +925 -0
- package/dist/chunk-ZXTURCRT.js.map +1 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +22364 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +436 -0
- package/dist/index.js.map +1 -0
- package/dist/static.d.ts +6 -0
- package/dist/static.js +8 -0
- package/dist/static.js.map +1 -0
- package/dist/types-gwHWhYmw.d.ts +3660 -0
- package/docs/README.md +19 -0
- package/docs/agent-handoff.md +95 -0
- package/docs/agent-readiness.md +38 -0
- package/docs/assets/ax-grep-benchmark.png +0 -0
- package/docs/assets/ax-grep-og.png +0 -0
- package/docs/assets/ax-grep-search.png +0 -0
- package/docs/benchmarks.md +123 -0
- package/docs/cli-agent.md +194 -0
- package/docs/comparison-baseline.md +625 -0
- package/docs/features.md +28 -0
- package/docs/library-api.md +211 -0
- package/docs/progress.md +1306 -0
- package/package.json +92 -6
- package/skills/ax-grep-cli/SKILL.md +89 -0
- package/skills.sh +24 -0
- package/index.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hmmhmmhm
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,109 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# ax-grep
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/ax-grep)
|
|
6
|
+
[](./tests)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
[](./docs/agent-handoff.md)
|
|
9
|
+
[](./skills/ax-grep-cli/SKILL.md)
|
|
10
|
+
[](./docs/cli-agent.md)
|
|
11
|
+
[](./docs/cli-agent.md)
|
|
12
|
+
|
|
13
|
+
<img src="./docs/assets/ax-grep-og.png" alt="ax-grep promo image" width="920">
|
|
14
|
+
|
|
15
|
+
<img src="./docs/assets/ax-grep-benchmark.png" alt="ax-grep benchmark comparison image" width="920">
|
|
16
|
+
|
|
17
|
+
<img src="./docs/assets/ax-grep-search.png" alt="ax-grep auto search comparison image" width="920">
|
|
18
|
+
|
|
19
|
+
Compact semantic trees and agent-ready page checks from HTML, URLs, WebViews, and live browser pages.
|
|
20
|
+
It approximates the accessibility tree browsers expose, but can do it from
|
|
21
|
+
static HTML before launching browser automation.
|
|
22
|
+
|
|
23
|
+
The CLI defaults to `impit` for browser-like HTTP/2/TLS static fetches, detects
|
|
24
|
+
hCaptcha, reCAPTCHA, and Cloudflare challenge markers, then tells agents when a
|
|
25
|
+
browser is actually needed. In the local benchmark, the decision handoff used
|
|
26
|
+
15.4x less peak RAM on average and 3.0x fewer decision tokens on the content
|
|
27
|
+
fixture than `agent-browser snapshot`.
|
|
28
|
+
|
|
29
|
+
`--search` auto mode tries DuckDuckGo, Bing, and StartPage, records every
|
|
30
|
+
engine attempt, and hands ranked source choices back to the agent.
|
|
31
|
+
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
## 1. Try With A Prompt
|
|
35
|
+
|
|
36
|
+
Paste this into a Codex session or subagent prompt before opening a browser:
|
|
37
|
+
|
|
38
|
+
```md
|
|
39
|
+
Before opening a browser, inspect pages with ax-grep when possible.
|
|
40
|
+
|
|
41
|
+
Run:
|
|
42
|
+
npx --yes ax-grep@latest <url> --agent-brief
|
|
43
|
+
|
|
44
|
+
Read agent.executor, agent.handoff, agent.readTargets, pageCheck, and
|
|
45
|
+
verification first. Open a browser only when the payload says static HTML is
|
|
46
|
+
not enough.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 2. Install The CLI Skill
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
curl -fsSL https://raw.githubusercontent.com/hmmhmmhm/ax-grep/main/skills.sh | sh
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This installs the Codex skill prompt only. Restart Codex if the new skill is not listed immediately.
|
|
56
|
+
|
|
57
|
+
## 3. Try The CLI
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
npx --yes ax-grep@latest https://example.com --agent-brief
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
If you installed the binary globally, use `ax-grep` directly.
|
|
64
|
+
Agents should read `agent.executor`, `agent.handoff`, `agent.readTargets`,
|
|
65
|
+
`pageCheck`, and `verification` first. Open a browser only when the handoff
|
|
66
|
+
fields say static HTML is not enough.
|
|
67
|
+
|
|
68
|
+
## 4. Use From A Server
|
|
69
|
+
|
|
70
|
+
Use this inside agent services built with Codex SDK, OpenRouter, or similar
|
|
71
|
+
LLM routing stacks to turn fetched HTML into compact source evidence before
|
|
72
|
+
spending tokens or memory on browser automation.
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
npm install ax-grep
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { extract, formatSemanticTreeText } from "ax-grep";
|
|
80
|
+
|
|
81
|
+
const html = await fetch("https://example.com").then((r) => r.text());
|
|
82
|
+
const tree = extract(html);
|
|
83
|
+
const promptText = formatSemanticTreeText(tree);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`ax-grep` is ESM-only and requires Node 18 or newer. CommonJS services can use `const { extract } = await import("ax-grep")`.
|
|
87
|
+
|
|
88
|
+
## 5. Use In WebViews Or Pages
|
|
89
|
+
|
|
90
|
+
In mobile apps, WebViews, and in-page agents, inject the extractor to create an
|
|
91
|
+
accessibility-style structure immediately from the current page. It is useful
|
|
92
|
+
for local sLLM web search, local web parsing, and instant agent-ready page
|
|
93
|
+
summaries without leaving the app.
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { createExtractorScript } from "ax-grep";
|
|
97
|
+
|
|
98
|
+
const script = createExtractorScript({ format: "text" });
|
|
99
|
+
const text = await page.evaluate(script);
|
|
100
|
+
// iOS/Android WebView: evaluateJavaScript(script) returns the same text value.
|
|
101
|
+
```
|
|
4
102
|
|
|
103
|
+
## Docs
|
|
104
|
+
- [Documentation index](./docs/README.md)
|
|
105
|
+
- [CLI skill prompt](./skills/ax-grep-cli/SKILL.md)
|
|
106
|
+
- [CLI and agent mode](./docs/cli-agent.md)
|
|
107
|
+
- [Agent handoff loop](./docs/agent-handoff.md)
|
|
108
|
+
- [Benchmarks](./docs/benchmarks.md)
|
|
109
|
+
- [Library API](./docs/library-api.md)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { a as SemanticTreeOptions, S as SemanticNode, aE as SemanticTreeChange, aF as SemanticTreeObserverOptions } from './types-gwHWhYmw.js';
|
|
2
|
+
|
|
3
|
+
declare function extractSemanticTree(options?: SemanticTreeOptions): SemanticNode;
|
|
4
|
+
|
|
5
|
+
declare function formatSemanticTreeText(node: SemanticNode): string;
|
|
6
|
+
declare function observeSemanticTree(onChange: (change: SemanticTreeChange) => void, options?: SemanticTreeObserverOptions): {
|
|
7
|
+
disconnect: () => void;
|
|
8
|
+
snapshot: () => SemanticNode;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { extractSemanticTree as extract, extractSemanticTree, formatSemanticTreeText, observeSemanticTree };
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extractSemanticTree,
|
|
3
|
+
formatSemanticTreeText,
|
|
4
|
+
observeSemanticTree
|
|
5
|
+
} from "./chunk-HPZ32BKV.js";
|
|
6
|
+
export {
|
|
7
|
+
extractSemanticTree as extract,
|
|
8
|
+
extractSemanticTree,
|
|
9
|
+
formatSemanticTreeText,
|
|
10
|
+
observeSemanticTree
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|