@0perator/operator 0.1.60 → 0.1.61

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 CHANGED
@@ -4,6 +4,17 @@ Operator is AXE's terminal coding agent (npm `@0perator/operator`), running on t
4
4
  Newest first. Every release bumps `src/cli.tsx` VERSION + `package.json`, adds an entry here, and ships to
5
5
  npm + both git remotes (memjar/kode, axetechnologies/kode). Test counts are the full suite at that release.
6
6
 
7
+ ## 0.1.61 — 2026-09-22
8
+ - **Fix: search glob honored without ripgrep (CI red).** 's glob (e.g. "*.ts") is now enforced by a JS post-filter on the result lines (basename fnmatch) in BOTH the ripgrep and grep-fallback paths — grep's --include / rg's -g have platform-varying semantics (GNU grep on CI let "*.ts" through), so the tool no longer trusts the flag alone. Fixes the 0.1.60 CI failure (ubuntu has no rg → grep fallback). Verified on the grep path with rg hidden.
9
+ - Tests: 379/379 (search glob now green on the no-rg path).
10
+
11
+ ## 0.1.61 — 2026-09-22
12
+ - **Fix: `search` glob honored without ripgrep (CI red on 0.1.60).** The glob (e.g. "*.ts") is now enforced
13
+ by a JS post-filter over the result lines (basename fnmatch) in BOTH the ripgrep and grep-fallback paths.
14
+ grep's `--include` and rg's `-g` have platform-varying semantics — GNU grep on CI (ubuntu, no rg) let
15
+ "*.ts" through — so the tool no longer trusts the underlying flag alone. Verified on the grep path with rg
16
+ hidden. Tests: 379/379.
17
+
7
18
  ## 0.1.60 — 2026-09-22
8
19
  - **`http_request` tool (capability #5).** A real HTTP client beyond `web_fetch`'s GET-and-scrape: any method
9
20
  (GET/POST/PUT/PATCH/DELETE/HEAD), custom headers, a JSON (`json`) or raw (`body`) payload, bearer/basic auth,
package/dist/cli.js CHANGED
@@ -24,7 +24,7 @@ import { homedir, hostname } from "node:os";
24
24
  import { createHash } from "node:crypto";
25
25
  // RELEASE CHECKLIST (every bump): update this + package.json "version", ADD A CHANGELOG.md ENTRY
26
26
  // (improvements / fixes / tests), run the suite, then publish to npm + push both remotes.
27
- const VERSION = "0.1.60";
27
+ const VERSION = "0.1.61";
28
28
  // operator/settings.json (override path via KODE_TSI_SETTINGS), env vars still win — see config/settings.ts.
29
29
  const settings = loadSettings();
30
30
  // Propagate the resolved sandbox mode to the tool layer (registry reads KODE_SANDBOX at exec time).
@@ -243,6 +243,27 @@ function capMatches(stdout) {
243
243
  out += `\n…[${lines.length - GREP_MAXLINES} more matching lines — narrow the pattern or pass a path/glob]`;
244
244
  return out;
245
245
  }
246
+ // A tiny fnmatch over a filename: `*` → any run, `?` → one char. Used to POST-FILTER search results by
247
+ // `glob` in JS so the filter is honored regardless of the underlying tool: ripgrep's -g and grep's
248
+ // --include have different (and platform-varying) semantics — notably GNU grep on CI let "*.ts" through —
249
+ // so we never trust the tool's flag alone.
250
+ function globToRegExp(glob) {
251
+ const re = glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
252
+ return new RegExp(`^${re}$`);
253
+ }
254
+ function filterLinesByGlob(stdout, glob) {
255
+ if (!glob)
256
+ return stdout;
257
+ const re = globToRegExp(glob);
258
+ return stdout.split("\n").filter((line) => {
259
+ if (!line.trim())
260
+ return false;
261
+ // content line "path:lineno:…" or files-only "path"; the file path is up to the first ":".
262
+ const p = line.includes(":") ? line.slice(0, line.indexOf(":")) : line;
263
+ const base = p.split("/").pop() ?? p;
264
+ return re.test(base);
265
+ }).join("\n");
266
+ }
246
267
  // Fast search backed by ripgrep — parallel, .gitignore-aware, skips binaries/hidden files, so it stays
247
268
  // scoped and quick instead of `find ~/ | grep | grep` over the whole home tree. Falls back to grep with
248
269
  // the SAME scoping + caps when rg isn't installed, so the tool always works. `files_with_matches` returns
@@ -254,6 +275,8 @@ async function ripgrepSearch(args) {
254
275
  return "error: no pattern given";
255
276
  const filesOnly = !!args.files_with_matches;
256
277
  const glob = args.glob ? str(args.glob) : "";
278
+ // Belt-and-suspenders over rg -g / grep --include: always JS-filter the output by the glob too.
279
+ const capG = (s) => capMatches(filterLinesByGlob(s, glob));
257
280
  const grepFallback = async () => {
258
281
  // rg absent — same intent via grep: recursive, skip .git/node_modules, honor glob + files-only.
259
282
  const gflags = ["-rns", "-I", "--exclude-dir=.git", "--exclude-dir=node_modules", "--exclude=.operator-session.json"];
@@ -263,11 +286,11 @@ async function ripgrepSearch(args) {
263
286
  gflags.push(`--include=${glob}`);
264
287
  try {
265
288
  const { stdout } = await pexecFile("grep", [...gflags, "-E", pattern, path], { maxBuffer: 10 * 1024 * 1024, timeout: 20_000, killSignal: "SIGKILL" });
266
- return capMatches(stdout);
289
+ return capG(stdout);
267
290
  }
268
291
  catch (ge) {
269
292
  if (ge.stdout && String(ge.stdout).trim())
270
- return capMatches(String(ge.stdout));
293
+ return capG(String(ge.stdout));
271
294
  if (ge.code === 1)
272
295
  return "(no matches)";
273
296
  if (ge.killed)
@@ -282,13 +305,13 @@ async function ripgrepSearch(args) {
282
305
  rgArgs.push("-e", pattern, path);
283
306
  try {
284
307
  const { stdout } = await pexecFile("rg", rgArgs, { maxBuffer: 10 * 1024 * 1024, timeout: 20_000, killSignal: "SIGKILL" });
285
- return capMatches(stdout);
308
+ return capG(stdout);
286
309
  }
287
310
  catch (e) {
288
311
  if (e.code === "ENOENT")
289
312
  return grepFallback(); // ripgrep not installed → grep
290
313
  if (e.stdout && String(e.stdout).trim())
291
- return capMatches(String(e.stdout));
314
+ return capG(String(e.stdout));
292
315
  if (e.code === 1)
293
316
  return "(no matches)";
294
317
  if (e.killed)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0perator/operator",
3
- "version": "0.1.60",
3
+ "version": "0.1.61",
4
4
  "description": "Operator (KODE) — TypeScript + Ink terminal coding agent. Full-frame render, single-engine core shared across CLI/web/mobile; runs against a local Aurora model.",
5
5
  "type": "module",
6
6
  "bin": {