<feed xmlns='http://www.w3.org/2005/Atom'>
<title>newos4/modules/ext, branch main</title>
<subtitle>newOS4 - the browser terminal that runs WebX11 user spaces</subtitle>
<id>https://newos.webx11.duckdns.org/newos4/atom?h=main</id>
<link rel='self' href='https://newos.webx11.duckdns.org/newos4/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/'/>
<updated>2026-11-02T21:02:45+00:00</updated>
<entry>
<title>fix(auth-ui): stop offering a Telegram widget where it cannot work</title>
<updated>2026-11-02T21:02:45+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-11-02T21:02:45+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=ade40a078213c13e093623429bf7c3743c756f3b'/>
<id>urn:sha1:ade40a078213c13e093623429bf7c3743c756f3b</id>
<content type='text'>
Two hosts cannot complete the widget flow and both are in use: an Android WebView /
in-app browser (the operator's phone UA ends "; wv)") and a desktop browser that blocks
the popup or hands the link to the Telegram app. The widget needs a popup that can
postMessage back into the opener; in those hosts the link lands in a browser tab or in
Chrome with no opener, onTelegramAuth never fires, and the login card looks dead —
"it opens my default browser" (reported twice: phone, then Max's laptop).

modules/wx11-tg-webview.js (new)
  WX11TG.isWebView()  -&gt; "; wv)", Telegram in-app, Meta in-app UAs
  WX11TG.dropWidgets()-&gt; removes already-rendered oauth.telegram.org iframes/scripts

dashboard.html
  code box is open by default and drops the nested &lt;details&gt;
  WebView: widget removed + "cannot work inside an app window" hint
  desktop: if the widget was clicked and onTelegramAuth has not fired in 12 s, open the
  code flow with a hint instead of leaving a dead card

spaces/newos4 (webdav-login panel)
  in a WebView the widget is never injected, the mount is hidden and the device-code
  flow starts by itself; desktop keeps the widget unchanged
  version v4.6.145

Measured with playwright (390x844 WebView UA and 1440x900 Chrome):
  WebView  -&gt; 0 Telegram iframes, hint shown, code box open, real WX11- code minted
  desktop  -&gt; widget still rendered, code box open, real WX11- code minted
  newOS4 WebView -&gt; no widget injected, code area auto-visible, code WX11-..., no JS errors
  newOS4 desktop -&gt; widget still offered
</content>
</entry>
<entry>
<title>fix(newos4): memory-graph loads stop rewriting user data; unknown sizes say unknown</title>
<updated>2026-11-02T20:15:28+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-11-02T20:15:28+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=08a77451f503f531eee44c69c14bed3a2961cc5c'/>
<id>urn:sha1:08a77451f503f531eee44c69c14bed3a2961cc5c</id>
<content type='text'>
Three follow-ups from the merge review, each with the assertion that pins it.

module-memory-graph.js
- _normalizeEdges no longer mutates stored weights. It capped legacy 'failed' edges
  from 0.8 to 0.2 in memory, and the next debounced save made that permanent - an
  irreversible migration of the user's graph with no schema version. The cap moved to
  _effectiveWeight(), which ranking (showStats "Strongest relationships"), the session
  view and prune() now use; the stored record is left exactly as written.
- config.json is stamped version: 2 so a future format change can migrate deliberately.

ext/webdav.js
- the two fallback parsers emit size: null instead of 0. They cannot see the size
  column, and 0 rendered as "0 B" - the same "every file looks empty" symptom as the
  parseInt bug fixed in e639c2d, one regex miss away.
- _formatSize(null) renders '—' (unknown) rather than '0 B'; 0 still renders '0 B'.

module-aiassist.js
- the lock timeout now says what to do: "AI is still busy with another turn (waited Ns).
  Wait for it to finish, or run 'ai-stop' and retry - the running turn's lock is left
  alone." It used to be a dead-end string.

Tests: test-memory-graph 39 (T6.4 rewritten to the read-time contract: stored weight
stays 0.8, effective 0.2, success unaffected), test-webdav-sizes 28 (A14d null -&gt; '—').
maintain 26/26, live v4.6.141: _effectiveWeight 0.2 with the edge object unchanged,
_formatSize(null) '—', '0 B' still '0 B'.
</content>
</entry>
<entry>
<title>fix(newos4): WebDAV listing sizes + pull, and five MemoryGraph defects</title>
<updated>2026-11-02T20:05:58+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-11-02T20:05:58+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=c2f2ea62503f81c07f4d36d7c3a798b91146153e'/>
<id>urn:sha1:c2f2ea62503f81c07f4d36d7c3a798b91146153e</id>
<content type='text'>
Closes STEER-20261102-205416-facd and STEER-20261102-204031-f82a.

WebDAV (modules/ext/webdav.js):
- listings showed "21 B" for a 21 KB file: nginx emits humanised sizes
  (autoindex_exact_size off, vhost :412) and _parseAutoindex did parseInt("21K").
  _parseAutoindexSize() handles K/M/G, decimals, lowercase and "-"; PROPFIND's
  exact getcontentlength path is untouched.
- webdav-pull into a missing local directory printed "Pulled: ... (N bytes)" and
  wrote nothing: it ignored fs.writeFile's false return (virtual-fs.js:561).
  It now creates the parent chain, checks the write, and only reports success
  after a confirmed write. The byte count uses TextEncoder, not .length
  (a Cyrillic file under-reported ~2x).
- _formatSize gained the GB branch the parser already accepted (3 GB printed
  "3072.0 MB") and no longer prints "NaN MB" for a missing size.

MemoryGraph (modules/core/module-memory-graph.js):
- addEdge averages weights, so every repeat pulled a strong edge toward the
  call site's constant (0.9 -&gt; 0.7 -&gt; 0.6). Now Math.max, with decay left to
  applyDecay(); prune() untouched.
- task ids were `task-${Date.now()}`, so re-submitting a task never deduped:
  now a hash of agent + normalised text.
- recordFileAccess no longer records the graph's own /.memory_graph/ store.
- failed tool calls were weighted 0.8 vs success 0.5, so showStats ranked
  failures as strongest: now 0.2. Legacy 0.8 failures are capped on load.
- concept ids keep punctuation ("concept:(v2!),"): slugged, and the slug uses
  \p{L}\p{N} so Cyrillic/CJK/accented text still yields nodes -- an a-z0-9 slug
  silently produced none.

Review findings folded in from the regression pass: the non-Latin regression
(a-z0-9 slug), the GB formatter asymmetry, and the pull byte count were all
found by review, not by the patch authors, and each now has a test.

Tests: test-webdav-sizes.js 27 (was RED 15/24 before the fix), test-memory-graph.js
37 (RED 17/32), both auto-discovered by newos4-maintain -- 26/26 node tests.
Live on v4.6.140: _parseAutoindexSize('21K') 21504, _formatSize -&gt; "21.0 KB",
_formatSize(2GiB) "2.0 GB", slug Cyrillic "исправить-парсер-ошибок", 0 console errors.
</content>
</entry>
<entry>
<title>feat(newos4): register `test` / `[` so chains decide locally instead of asking a model (v4.6.135)</title>
<updated>2026-10-29T11:53:41+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-10-29T11:53:41+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=6daf236b585dc47ad8ffe293cdefd5de8231c5d8'/>
<id>urn:sha1:6daf236b585dc47ad8ffe293cdefd5de8231c5d8</id>
<content type='text'>
`[ -f "/qt.txt" ] &amp;&amp; echo exists` — the probe that closed the v4.6.132 batch — was not a shell test
at all: both commands were unregistered, so the line fell through to the AI fallback and a model was
asked whether a file exists. `_evalTest()` has implemented `-f -d -e -z -n ! = !=` for the if/while
parser since the script runner was written; only the command was missing.

  * `test` and `[` registered in ShellModule. Success resolves silently; false rejects with a
    `silent` error so `&amp;&amp;`/`||` skip it — POSIX prints nothing on exit 1.
  * `[` requires the closing bracket (`[ : missing ']'`), and that message is NOT silent.
  * `test` already names the on-demand regression-suite runner ("test auto" / "test list" in
    help.html). A argv that does not look like a test expression (`-f`/`-d`/`-e`/`-z`/`-n`/`!`,
    or `a = b` / `a != b`) is delegated to the handler registered before us, so `test auto`
    still runs the suite and the two meanings cannot collide.
  * terminal.dispatchCommand() now honours `err.silent` — without it a top-level `test -f /nope`
    printed `Error in ShellModule.test:` (measured on v4.6.134, fixed in v4.6.135).
  * help.html documents the bracket form next to the existing `test` row.

Three tags were minted minutes apart — v4.6.133 (commands), v4.6.134 (suite delegation),
v4.6.135 (silent top-level) — each a real cache-bust for a fix that superseded the previous build;
the net change is this commit.

Verification
  node modules/test/test-shell-test-cmd.js -&gt; 24/24 pass (RED against HEAD: "test command
      registered" fails, "m.commands.test is not a function")
  node modules/test/test-pipe-guard.js     -&gt; all seven flags true
  node modules/test/test-parse-args.js     -&gt; 28/28 · daily job -&gt; node tests 22/22 pass
  newos4-maintain.py -&gt; atlas 355 commands (was 354), modules-index 349, help 364/364
  live v4.6.135, read from the terminal DOM:
    [ -f /qt.txt ] &amp;&amp; echo F135          -&gt; F135
    test -f /nope || echo M135           -&gt; M135
    [ -d /nope ] &amp;&amp; echo BAD || echo N134-&gt; N134   (false branch skipped, nothing printed)
    test                                 -&gt; no output (suite not loaded; POSIX false)
    test -f /nope                        -&gt; no output
    js "a b".length | wc -c              -&gt; 1       (v4.6.132 pipe fix still intact)
  The AI fallback is no longer reachable for a bracketed file test.
</content>
</entry>
<entry>
<title>fix(newos4): shell tokenises command lines quote-aware everywhere (v4.6.132)</title>
<updated>2026-10-29T11:47:46+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-10-29T11:47:46+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=1a27ba0e2ec736aa9b30c69a3aa2ee2ab86d0709'/>
<id>urn:sha1:1a27ba0e2ec736aa9b30c69a3aa2ee2ab86d0709</id>
<content type='text'>
v4.6.131 taught the pipe stages to forward their raw text, but the shell's own wrapper still split
each stage with `cmdText.split(/\s+/)` — so `grep "alpha beta" /qt.txt | wc -l` handed grep the two
args `"alpha` and `beta"` and matched nothing. Measured live: the wrapper (ShellModule.init() replaces
terminal.executePipeChain) is the implementation that runs, so the core fix alone is decorative.

All six command-line split sites in modules/ext/shell.js now go through one helper, `_tokenize()`,
which delegates to `security._parseArgs` — the parser the bare-command path already uses — so the two
cannot drift again:

  111  single command in a `&amp;&amp;` / `;` chain     -&gt; `grep "a b" f ; echo done`
  176  pipe stage (the wrapper that runs)       -&gt; `grep "a b" f | wc -l`
  358  `&lt;` redirect input                       -&gt; `cat &lt; /f`
  401  pipe chain inside the script runner      -&gt; also forwards the stage's raw text now
  424  single command in the script runner      -&gt; also forwards raw text
  778  `[ -f "path" ]` / `test -f "path"`       -&gt; quoted paths in test expressions

Empty stages are skipped instead of being dispatched as a command named '' (`help | | wc -l`).
The guard test grew the assertion that would have caught this: test-pipe-guard.js now checks
`shellTokensQuoted` (tokeniser used, no `cmdText.split(`, empty-stage guard present) alongside
`shellForwardsRaw`; both are RED against HEAD's shell.js.

Verification
  node modules/test/test-pipe-guard.js -&gt; {"empty":[],"blank":[],"classifyGuarded":true,
      "pipeGuarded":true,"shellForwardsRaw":true,"shellTokensQuoted":true}
  node modules/test/test-parse-args.js -&gt; 28/28 · daily job -&gt; node tests 21/21 pass
  newos4-maintain.py -&gt; maintenance result: OK (index 349, help 363/363, changelog v4.6.132)
  live v4.6.132, read from the terminal DOM (no print monkey-patch):
    cat /qt.txt                          -&gt; alpha beta
    grep "alpha beta" /qt.txt            -&gt; 1 match, 1 file
    grep "alpha beta" /qt.txt | wc -l    -&gt; 2   (match line + summary; 1 when the quotes are lost)
    grep "alpha beta" /qt.txt ; echo done-&gt; match count + done
    ShellModule._tokenize(c) === security._parseArgs(c) for 5 sample lines -&gt; true
    _tokenize('') / _tokenize('   ')     -&gt; [] / []

Also closes the last open feedback item: RPT-20261027-160751 ("Connection failed on all providers")
-&gt; resolve, recorded in decisions.jsonl with evidence (headless probe URL `?probe=ctx`, v4.6.117,
single occurrence, no stack; Ollama answers 200 with 37 models now). Feedback queue: awaiting 0.
</content>
</entry>
<entry>
<title>fix(newos4): pipe stage quoting, maintain ordering, help cost row, plan status (v4.6.131)</title>
<updated>2026-10-29T11:42:30+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-10-29T11:42:30+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=af36a408670e6caa61527b5bc5e6f9915b69369c'/>
<id>urn:sha1:af36a408670e6caa61527b5bc5e6f9915b69369c</id>
<content type='text'>
Four items closed in one batch; three ran as parallel subagents on disjoint files, the bundle was
rebuilt once by the parent (rebuild-bundles.py serialises the working tree, which carries other
sessions' work — see 161372f).

1. PIPE STAGES KEEP THEIR QUOTES. `js "a b".length | wc -c` reached eval as `a b.length` and printed
   a ReferenceError. terminal.js executePipeChain() now keeps `stages[i]` aligned 1:1 with
   `pipeParts[i]` (the `.filter(argv =&gt; argv.length &gt; 0)` shifted the index; replaced by a lastStage
   scan + `if (argv.length === 0) continue`) and forwards the stage's own text to the dispatcher.
   The core path alone was dead code: ShellModule.init() replaces terminal.executePipeChain
   (shell.js:144), and that override is what runs in the browser (`executePipeChain.toString()`
   contained `cmdText.split`, not `lastStage`). Both now pass `cmdText`/`pipeParts[i]`.
   test-pipe-guard.js was rewritten for the new shape and now also asserts the shell override
   forwards raw text — the assertion that would have caught the shadowing. RED on HEAD: both flags
   false; GREEN now.

2. MAINTENANCE --fix CAN CLEAR ITS OWN WARN. check_index() ran before check_atlas(), which is what
   regenerates course/atlas.json, so --fix rebuilt modules-index.json from the stale atlas and the
   same WARN reappeared every run. check_atlas() now runs immediately before check_index().
   modules-index.json regenerated: cost/usage present, 349 commands, version 2026-10-29-atlas.

3. `cost` DOCUMENTED. modules/core/module-billing.js registers `cost [on|off]` (an alias of `usage`);
   help.html had no row. Added above the `usage` row. help coverage 362/363 -&gt; 363/363.

4. SHIPPED PLANS STOP ASKING FOR A DECISION. The applier only flips review&lt;-&gt;safe, so every executed
   review-gated plan kept counting as an open decision (5 of 5). newos4-feedback-collect.py now reads
   the body: a `## Status` / `## Implementation` heading followed by shipped|executed plus a version,
   commit or date is `status: done`; those stay in `plans` (visible as shipped) but leave
   plans_review and awaiting_decision. Counts: plans_review 5 -&gt; 0, awaiting_decision 4 -&gt; 1
   (the remaining one is a real open report, RPT-20261027-160751).
   admin/feedback.html read `it.status[0]`, which would render `d` for a string status; it now
   prefers `status_lines[0]`.

Also carried, authored by earlier uncommitted sessions and already live in the bundle (attributed,
not silently absorbed): modules/core/module-billing.js (new, BillingModule: cost/usage),
its CORE_FILES entry in scripts/rebuild-bundles.py, and the BillingModule registry entry in
terminal.js. The bundle was rebuilt from HEAD + this batch with ollama-manager.js taken from HEAD,
so another session's in-flight `_httpError` refactor is deliberately NOT in the shipped bundle
(grep -c _httpError core-bundle.js = 0).

Verification
  node modules/test/test-pipe-guard.js   -&gt; {"empty":[],"blank":[],"classifyGuarded":true,"pipeGuarded":true,"shellForwardsRaw":true}
  node modules/test/test-parse-args.js   -&gt; 28/28 pass
  maintained job                          -&gt; node tests 21/21 pass
  scripts/newos4-maintain.py             -&gt; maintenance result: OK (modules-index 349, help 363/363,
                                            changelog current v4.6.131)
  live v4.6.131 (real DOM, no print monkey-patch):
    js "a b".length | wc -c   -&gt; 1        (js printed 3, one byte)
    js "a b".length           -&gt; 3
    js "abc".toUpperCase()    -&gt; ABC
    echo "two words"          -&gt; two words
    node -e "import('fs')"    -&gt; red error + Node-builtin hint
    js 6*7                    -&gt; 42
    unhandledrejection        -&gt; 0
  livePipeImpl: shell-override, livePipeForwardsRaw: true, costRegistered: true
</content>
</entry>
<entry>
<title>fix(newos4): js keeps its string literals — dispatcher forwards the raw command line (v4.6.130)</title>
<updated>2026-10-29T11:29:14+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-10-29T11:29:14+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=db65ce7628b0073c41ff1c13334723a043b24479'/>
<id>urn:sha1:db65ce7628b0073c41ff1c13334723a043b24479</id>
<content type='text'>
_parseArgs() treats quote characters as delimiters and drops them, so every string literal in a
js expression died before eval: `js "abc".toUpperCase()` reached the module as
`abc.toUpperCase()` → ReferenceError: abc is not defined. Same for `js import('fs')` →
`import(fs)`. Found while verifying the v4.6.128 console fix
(plan 2026-10-29_112000-newos4-parseargs-strips-js-string-literals.md).

- terminal.js: checkAndRun() records the untokenised line (`_currentRaw`), _dispatch() forwards it,
  dispatchCommand(cmd, args, rawText) passes it to the module. Security classification still runs
  on the tokenised form, and pipes/AI/script-runner calls pass nothing, so they behave as before.
- console.js: `js` evaluates _expr(args, rawText) — the raw remainder. `node -e` deliberately does
  NOT: the tokenizer already keeps `'…'` inside `"…"`, and the raw form would hand eval the string
  literal `"import('fs')"` instead of the import (caught by the live probe, not by review).
  js-run keeps tokenised paths.
- modules/test/test-parse-args.js: tokenizer table (records the deletion as the current contract),
  dispatcher plumbing asserts, _expr cases, and the user-visible paths. 27 assertions.
- module-loader.js + main.html + bundle: v4.6.130 (129 was minted, then console.js changed again —
  re-minting so no cached client keeps the intermediate).

Verification
  node modules/test/test-parse-args.js        -&gt; 27/27 pass
  same file against HEAD sources (git show HEAD:...)  -&gt; TypeError: _expr is not a function (RED)
  scripts/lint-no-undef.py terminal.js console.js     -&gt; clean, 122 cross-file globals
  core-bundle.js rebuilt from HEAD sources + this patch in /tmp/iso (the working tree carries
  another session's uncommitted ollama-manager.js `_httpError`); diff vs HEAD bundle = 14 lines,
  all mine. critical-ext-bundle.js byte-identical.
  Live page v4.6.130 (real executeCommand, output captured):
    js "abc".toUpperCase()        -&gt; ABC
    js 'a b'.split(' ').length    -&gt; 2
    js JSON.stringify({a:1})      -&gt; {"a":1}
    js 6*7                        -&gt; 42
    js import('fs')               -&gt; red "Failed to resolve module specifier 'fs'" + Node-builtin hint
    node -e "import('fs')"        -&gt; same error + hint (was printing the expression as a string)
    echo "two words"              -&gt; two words
    js-run /nope.js               -&gt; js-run: /nope.js: No such file
    unhandledrejection count      -&gt; 0

The sibling's parked terminal.js hunk (BillingModule registry entry) was stashed for this commit and
is restored in the working tree afterwards; it is not part of this change.
</content>
</entry>
<entry>
<title>fix(newos4): js console handles promise rejections + Node-builtin hint (v4.6.128)</title>
<updated>2026-10-29T11:13:33+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-10-29T11:13:33+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=43d067396b5a620441b9a299c45e7b0b129ccd15'/>
<id>urn:sha1:43d067396b5a620441b9a299c45e7b0b129ccd15</id>
<content type='text'>
evalJS() evaluated the expression bare and printed JSON.stringify(result), so a
rejected thenable (e.g. `js import('fs')`) became `{}` on screen while the rejection
escaped to window.onunhandledrejection and was auto-filed as a runtime bug report
(RPT-20261028-172211-9c7f2adb, cluster 480x). evalJSFile() already had .then/.catch —
the asymmetry was the defect.

- modules/ext/console.js: thenable branch in evalJS() awaits and catches; new
  _printError() is the single error sink for all four catch paths and appends a hint
  when a bare specifier fails to resolve ("'fs' is a Node built-in; the browser has no
  Node — use the VFS (ls/cat/run, terminal.fs) instead").
- help.html: js / js-run rows say "browser only — no Node built-ins".
- module-loader.js + main.html: v4.6.128.

Verification (/tmp/test-console-fs.js, 11 asserts, new Function harness over the module):
  GREEN 11/11 — rejection prints one red error + hint, no unhandledRejection; resolved
  thenable prints its value; sync value/throw unchanged; js-run file + missing file OK.
  RED 4/11 against .bkp-console-20261029_121243/console.js — A1/A2/A3 print `{}`,
  A4/G2 leak "Failed to resolve module specifier 'fs'".
  node --check modules/ext/console.js → OK.
console.js is loaded separately via extKeys (not in critical-ext-bundle.js), so no bundle
rebuild — proven by `grep -c JSConsoleModule modules/ext/critical-ext-bundle.js` = 0.

Consumes STEER-20261028-195043-8084. Plan: .hermes/plans/2026-10-29_063000-newos4-js-console-fs-specifier.md
</content>
</entry>
<entry>
<title>fix(newos4): `if test …` was always false and `for` items never globbed</title>
<updated>2026-10-27T16:10:40+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-10-27T16:10:40+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=b78eba08d320a58c4cd793cf4811444e351ffa17'/>
<id>urn:sha1:b78eba08d320a58c4cd793cf4811444e351ffa17</id>
<content type='text'>
Found by running the shipped runner the way a user would, not by re-reading it.

- _evalTest() stripped [ ] but not the `test` keyword, so `if test -f /work/alpha.txt` evaluated
  the word "test" as an operator, returned false, and every such branch took the else arm —
  measured live: "alpha missing" for a file that exists. Both spellings work now
  (`test -f x`, `[ -f x ]`), plus `-d`, `-e`, `-z`, `-n`, `!` and the = / != comparisons.
- `for f in /work/*.txt` ran ONCE with $f set to the literal pattern, because only command
  arguments went through _expandGlobs. Loop items are expanded per iteration now, so the body runs
  once per matched file with the real path.
- _expandGlobs() falls back to readDir() when a fs has no ls(), so the helper works against either
  shape instead of silently returning the literal pattern.

Verification, live on v4.6.119:
- for+glob: "--- /work/alpha.txt / 3 /work/alpha.txt / --- /work/beta.txt / 1 /work/beta.txt"
  (6 statements, exit 0) — previously one iteration printing the pattern.
- conditionals: "alpha exists", "nope missing", grep + $? intact.
- end-to-end /work/report.sh (loop + glob + &gt;&gt; append + test -f) wrote a correct log:
  "start / file: /work/alpha.txt / 3 /work/alpha.txt / file: /work/beta.txt / 1 /work/beta.txt …".
- unknown command still reports "command not found" and never calls the AI.
- test-shell-script.js 27 -&gt; 35 asserts.

Retracted: I reported `echo x &gt; file` as broken. It was my probe monkey-patching terminal.print,
which bypassed the capture stack the redirect uses. Both paths write correctly:
direct helper -&gt; "direct-call", prompt -&gt; "prompt-call\n".
</content>
</entry>
<entry>
<title>fix(newos4): piped grep searched the working directory instead of its input</title>
<updated>2026-10-27T15:26:30+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-10-27T15:26:30+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=40c4f5ccd9a54b60cad3a3f29c6c9d32d3fbdac5'/>
<id>urn:sha1:40c4f5ccd9a54b60cad3a3f29c6c9d32d3fbdac5</id>
<content type='text'>
The stdin work in 5cf5010 fixed wc/head/tail but left grep alone, and grep's no-operand branch
sweeps the cwd. Measured on v4.6.115: `cat /gdir/in.txt | grep zzz` answered
`other.txt:1: zzz in a cwd file` — a file that was never piped, and `cat in.txt | grep bbb`
reported the match twice (`in.txt` from the cwd sweep plus `__pipebuf__` from the injected file).

- module-fs.js: when terminal._pipeInput is set and no file operand was given, grep searches the
  staged text and prints `&lt;line&gt;: &lt;text&gt;` (stdin has no filename, as in GNU). The cwd sweep stays
  for a bare interactive `grep x`.
- shell.js: _isPipeAware now covers only sort/cut/uniq/expand. grep/head/tail/wc read _pipeInput
  themselves, so injecting the __pipebuf__ file produced duplicate hits and named stdin results.

Verification:
- test-shell-stdin.js 20 asserts (+4 for grep: no cwd match, non-match reports none, match prints
  no filename, -c counts stdin). RED on HEAD: G1/G2/G3 fail with `other.txt:1: zzz in a cwd file`.
- Suite 18/18 files; maintain --fix "node tests 18/18 pass".
- Live v4.6.116 after `cd /gdir` (where other.txt contains zzz):
  `cat /gdir/in.txt | grep zzz` -&gt; (no matches) · `| grep bbb` -&gt; `2: bbb` · `| grep -c b` -&gt; 1 ·
  `| head -n 2` -&gt; aaa,bbb · `| tail -n 1` -&gt; ccc · `| wc -l` -&gt; 3.

Credit: the false-positive grep was reported by the stdin subagent as an aside; re-derived here
against the live terminal before fixing.
</content>
</entry>
</feed>
