@apmantza/greedysearch-pi 1.7.7 → 1.8.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/CHANGELOG.md +18 -0
- package/bin/coding-task.mjs +27 -1
- package/bin/search.mjs +260 -1539
- package/index.ts +134 -421
- package/package.json +1 -1
- package/src/github.mjs +6 -1
- package/src/search/chrome.mjs +223 -0
- package/src/search/constants.mjs +38 -0
- package/src/search/defaults.mjs +15 -0
- package/src/search/engines.mjs +58 -0
- package/src/search/fetch-source.mjs +230 -0
- package/src/search/output.mjs +59 -0
- package/src/search/sources.mjs +446 -0
- package/src/search/synthesis-runner.mjs +64 -0
- package/src/search/synthesis.mjs +212 -0
- package/src/tools/deep-research-handler.ts +37 -0
- package/src/tools/greedy-search-handler.ts +58 -0
- package/src/tools/shared.ts +131 -0
- package/src/types.ts +104 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.8.0 (2026-04-16)
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
- **`cdpAvailable()` missing `baseDir` argument** — two callsites in `index.ts` (session_start handler and coding_task handler) were calling `cdpAvailable()` without the required `baseDir` parameter, producing an incorrect path (`join(undefined, "bin", "cdp.mjs")`). Both now pass `__dir` so the CDP check resolves against the correct package directory.
|
|
7
|
+
- **Duplicated `ENGINES` map removed** — `ENGINES` was defined identically in both `src/search/constants.mjs` and `src/search/engines.mjs`. Now `engines.mjs` imports and re-exports from `constants.mjs`, keeping a single canonical source and eliminating sync drift risk.
|
|
8
|
+
- **`ALL_ENGINES` sync comment** — added a `// Keep in sync with src/search/constants.mjs` comment on the `ALL_ENGINES` tuple in `shared.ts` so future maintainers know where the canonical definition lives.
|
|
9
|
+
|
|
10
|
+
## v1.7.7 (2026-04-14)
|
|
11
|
+
|
|
12
|
+
### Fixes
|
|
13
|
+
- **`--deep` flag leaking into queries** — `depth: "deep"` was passing `--deep` as a bare flag to `search.mjs`, which didn't recognize it and appended it to the query string. Fixed by passing `--depth deep` instead; also added `--deep` as a recognized flag in `search.mjs` for backward compatibility with the legacy `deep_research` tool.
|
|
14
|
+
- **GitHub fetch always failing** — `git clone` was being `await`-ed on a non-Promise `ChildProcess` object (Node `execFile` is callback-based), so the clone never actually completed and content was always empty. Replaced git clone entirely with GitHub REST API calls: repo info + README + file tree fetched via parallel HTTP requests (~2-5s vs 30-60s, no git dependency). Non-existent repos now correctly return `ok: false`.
|
|
15
|
+
- **`--inline` test false negative** — smoke test was interpolating multiline JSON stdout into a `node -e` string, always producing `PARSE_ERROR`. Fixed to write stdout to a temp file and parse from file.
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
- **Rich source metadata** — HTTP-fetched sources now include `publishedTime`, `lastModified`, `byline`, `siteName`, and `lang`. `publishedTime` is extracted from Readability's parser plus a fallback chain of 8 `<meta>` selectors (Open Graph, schema.org, Dublin Core). All fields flow through to the Gemini synthesis prompt. Gemini is instructed to flag sources older than 2 years as potentially stale in caveats.
|
|
19
|
+
- **GitHub Fetch Tests** — smoke/edge/quick test modes now include 4 GitHub-specific tests: root repo API fetch (README + tree), blob file via raw URL, blob via HTTP fetcher pipeline, and graceful failure on non-existent repo.
|
|
20
|
+
|
|
3
21
|
## v1.7.6 (2026-04-11)
|
|
4
22
|
|
|
5
23
|
### Fixes
|
package/bin/coding-task.mjs
CHANGED
|
@@ -9,12 +9,16 @@
|
|
|
9
9
|
// Output (stdout): JSON { engine, task, code: [{language, code}], explanation, raw }
|
|
10
10
|
// Errors go to stderr only.
|
|
11
11
|
|
|
12
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
12
|
+
import { existsSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
13
13
|
import { tmpdir } from "node:os";
|
|
14
|
+
import { dirname, isAbsolute, join, relative } from "node:path";
|
|
14
15
|
import { fileURLToPath } from "node:url";
|
|
15
16
|
import { cdp, injectClipboardInterceptor, waitForCopyButton } from "../extractors/common.mjs";
|
|
16
17
|
import { dismissConsent, handleVerification } from "../extractors/consent.mjs";
|
|
17
18
|
|
|
19
|
+
const MAX_FILE_SIZE = 50 * 1024; // 50KB per file
|
|
20
|
+
const MAX_FILES = 5;
|
|
21
|
+
|
|
18
22
|
const __dir = fileURLToPath(new URL(".", import.meta.url));
|
|
19
23
|
const PAGES_CACHE = `${tmpdir().replace(/\\/g, "/")}/cdp-pages.json`;
|
|
20
24
|
|
|
@@ -309,6 +313,28 @@ async function main() {
|
|
|
309
313
|
filePaths.push(args[i + 1]);
|
|
310
314
|
}
|
|
311
315
|
}
|
|
316
|
+
|
|
317
|
+
// Validate file paths: limit count, check readability, enforce size
|
|
318
|
+
if (filePaths.length > MAX_FILES) {
|
|
319
|
+
process.stderr.write(`Error: too many --file arguments (max ${MAX_FILES})\n`);
|
|
320
|
+
process.exit(1);
|
|
321
|
+
}
|
|
322
|
+
for (const p of filePaths) {
|
|
323
|
+
if (!existsSync(p)) {
|
|
324
|
+
process.stderr.write(`Error: file not found: ${p}\n`);
|
|
325
|
+
process.exit(1);
|
|
326
|
+
}
|
|
327
|
+
if (isAbsolute(p) && !p.startsWith(process.cwd())) {
|
|
328
|
+
process.stderr.write(`Error: file must be within project directory: ${p}\n`);
|
|
329
|
+
process.exit(1);
|
|
330
|
+
}
|
|
331
|
+
const stat = statSync(p);
|
|
332
|
+
if (stat.size > MAX_FILE_SIZE) {
|
|
333
|
+
process.stderr.write(`Error: file too large (${Math.round(stat.size / 1024)}KB, max ${MAX_FILE_SIZE / 1024}KB): ${p}\n`);
|
|
334
|
+
process.exit(1);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
312
338
|
const fileContext =
|
|
313
339
|
filePaths.length > 0
|
|
314
340
|
? filePaths
|