Commit Graph

299 Commits

Author SHA1 Message Date
can1357 93c1e5eb6b Merge PR #8458: fix(ci): distinguish a watchdog kill from an OOM kill in the sequential test path (@Mustaqeem66) 2026-08-16 02:13:39 +02:00
can1357 04fab5ecb4 feat: replaced custom mupdf wasm pipeline with native function
- Replaced the custom MuPDF-WASM PDF extraction and rendering pipeline with the new `pdfToMarkdown` native function from `@oh-my-pi/pi-natives`.
- Removed legacy MuPDF extraction modules, WASM embedding scripts, and PDF image extraction tools.
- Added OCR warnings and browser/text redirection for unsupported PDF image reads.
- Updated native package definitions, documentation, and test suites for the new PDF inspection capability.
2026-08-14 14:08:28 +02:00
can1357 ad318c7572 build: configured docker build pipelines for cargo native addons
- Switched Docker images to build native addons via cargo/napi-rs (`OMP_NATIVE_BUILD_BACKEND=cargo`) instead of Bazel.
- Updated Cargo.toml workspace members explicitly to prevent loading errors from stale directories under crates/.
- Added depth-agnostic patterns to .dockerignore files to exclude nested build outputs from Docker build contexts.
- Added OMP_NATIVE_CARGO_PROFILE environment variable to support configuring cargo profiles for addon builds.
2026-08-14 07:09:48 +02:00
Muhammad Mustaqeem b171f28183 Merge branch 'main' into fix/ci-singleton-bucket-oom-chunking 2026-08-13 23:57:21 +05:00
Muhammad Mustaqeem 21a4d0b2fa revert(ci): keep the singleton bucket unchunked
CI evidence overturns the chunking half of this branch. Splitting the
singleton bucket into 8 chunks made the job run 11m27s and go red, where
the unchunked bucket passes in ~1m31s on a concurrent PR. The duration
matches the 600s chunk watchdog, i.e. a chunk wedged rather than merely
running slowly -- the "these suites co-locate in one process" comment was
describing a real coupling, so restore it and the original plan entry.

The failure-attribution change is kept and is independently justified:
this run is precisely the case where a bare "exit code 137" cannot
distinguish the watchdog from the OOM killer.
2026-08-13 23:42:37 +05:00
Muhammad Mustaqeem 6b78c4e112 fix(ci): chunk the singleton bucket and name the cause of a SIGKILLed chunk
The singleton/global-state bucket was the only bucket left unchunked, and
it is the one that got OOM-killed: 79 files in a single `bun test`
process exited 137. Chunking exists precisely to hold peak RSS under the
runner's ceiling, so the bucket that opts out is the bucket that hits it.

The stated reason for leaving it whole does not hold. That bucket is
selected because its suites mutate process-wide state, and what keeps
them from colliding is sequencing, which `parallel: 1` already
guarantees. Splitting them across processes strictly increases isolation
rather than reducing it. Use 10 files per chunk, the width the 650-file
native bucket already sustains on the same runner.

Separately, the sequential path could not say why a chunk was SIGKILLed.
It arms a watchdog but never records when the watchdog fires, so an OOM
kill and a watchdog kill both surfaced as a bare "failed with exit code
137" - the exact message this failure produced, which points at neither
remedy. The parallel path already tracks this; apply the same idea here
and name the cause.
2026-08-13 23:22:53 +05:00
Muhammad Mustaqeem 077b6af2fb test(ci): pin how a chunk's SIGKILL cause is reported
Drives real subprocesses so the 137 under test is a genuine SIGKILL
rather than a hand-written constant: `kill -9 $$` for the OOM-killer
shape, and a watchdog-killed `sleep` for the timeout shape.
2026-08-13 23:19:59 +05:00
can1357 ddbf1ffecb feat: fell back to pinned bunx package for bun2nix generation
- Added a fallback to the pinned bunx package when generating Nix bun dependencies without an active Nix environment.
- Updated generator resolution logic and corresponding tests.
2026-08-13 07:18:17 +02:00
can1357 a69d166e00 perf(discovery): memoized WSL host-home probe per environment
- Deduplicated the re-imported changelog bullets from the PR #8403 merge,
  keeping the condensed register with only the new #8402 entry.
- getUserHomeCandidates memoizes the WSL home candidate keyed by
  platform + WSL markers + USERPROFILE, so a wedged interop pipe costs
  one bounded probe per process instead of one 500ms stall per
  discovery loader, while env changes (tests, SDK embeddings) still
  recompute.
2026-08-13 06:51:35 +02:00
can1357 1132c3e31c feat: implemented anthropic keep-alive and migration support for updates
- Added Anthropic prompt-cache refresh scheduling and state management to keep prompts warm across idle sessions.
- Updated pricing models and database stats tracking to calculate and store cost-weighted cache savings.
- Integrated cache savings metrics and efficiency displays into the stats CLI, dashboard routes, and UI components.
- Added support for package renaming, manifest pointer tracking, and installation migration during CLI updates.
2026-08-13 04:59:33 +02:00
can1357 b60bef961c feat: introduced nix packaging and path-based binary resolution
- Add comprehensive Nix flake definitions, derivations, modules, and CI workflows.
- Update tests and executables to resolve binaries from PATH rather than absolute paths.
- Ensure byte reproducibility and zeroed timestamps in embedded dashboard archives.
- Add handling for Nix-managed installations in CLI update checks.
2026-08-13 03:52:47 +02:00
can1357 b524dfe36f refactor: standardized outbound User-Agent headers on shared utility constant
- Define a centralized `USER_AGENT` constant in `@oh-my-pi/pi-utils` formatted as `omp/<version>`.
- Replace hardcoded and platform-specific user agent strings across AI providers, catalog scrapers, tools, and search providers with the unified `USER_AGENT`.
- Add unit tests for update-cli binary release distribution gating.
2026-08-11 15:38:32 +02:00
can1357 8fed93632a refactor(ai): rebranded openrouter identifiers and user agent to omp
- Updated user agent and openrouter titles in packages/ai from Oh-My-Pi to omp.
- Integrated getOpenRouterHeaders into image generation tool requests in packages/coding-agent.
- Updated provider documentation and test assertions to reflect the rebrand.
2026-08-11 15:28:28 +02:00
can1357 2ee9943563 refactor: unify builtins in one place 2026-08-08 10:19:25 +02:00
can1357 08819b279c ci(test): budgeted bun test parallelism across the chunk pool
The runner stacked two independent parallelism knobs: OMP_TEST_CONCURRENCY
spawned N `bun test` processes while each process ran its own --parallel=M
test files, so the workspace bucket put 4 x 8 = 32 files in flight on a
4-core runner. bun's per-test timeout is wall-clock, so CPU-starved suites
crossed the 5s default and failed at random - mnemopi's sqlite/CLI files
tripped a different pair every run.

- TestCommand now carries a `parallel` request instead of baking the flag
  into argv; the dispatcher resolves it against one shared budget
  (availableParallelism x 2, split by the live pool width) so total
  in-flight files track the machine. A chunk that runs alone still gets
  its full requested width, leaving the sequential CI path unchanged.
- Raised the per-test timeout to 30s (OMP_TEST_TIMEOUT to override).
  Suites here build real SQLite schemas and spawn CLIs, already running
  1-4s per case on a quiet runner; the 10-minute chunk watchdog stays the
  backstop for an actual hang.
- --dry-run now resolves the same budget, so it prints the argv a real run
  would use, and the pool header reports cores plus the granted width.
- Dropped the dead `{ smol: true }` argument: workspaceTestCommand never
  accepted it, and this file's own findings say a smaller heap makes bun
  1.3.14's GC crash more often, so it should not be wired up.
2026-08-08 07:06:07 +02:00
can1357 a0efb56b6b feat: cleanup command 2026-08-08 05:03:49 +02:00
zero 82436b0e93 fix(natives): make Windows-host builds and addon loading work end to end
Runtime: the loader's AVX2 probe used [System.Runtime.Intrinsics.X86.Avx2]
via powershell.exe, which only exists on .NET Core — stock Windows PowerShell
5.1 raised TypeNotFound, so every Windows host silently loaded the baseline
addon and paid ~270ms for the spawn on the startup path. Ask the kernel via
bun:ffi (IsProcessorFeaturePresent(PF_AVX2_INSTRUCTIONS_AVAILABLE), ~0.5ms)
and fall back to pwsh-then-powershell for Node embeds. scripts/host-detect.ts
shared the same broken probe for build-time variant selection.

Build: `bun run build:native` on a win32 host died deep inside the bazel msvc
repo rules (linux/mac exec hosts only, by design). The `host` pseudo-target
now delegates to the local napi build against real VS Build Tools, and other
targets fail fast with guidance. build-bindings.ts resolves the @napi-rs/cli
JS entry from its manifest (the node_modules/.bin shim is a PE launcher Bun
cannot parse) and auto-appends VS Build Tools' bundled CMake/Ninja to PATH
via vswhere so a vcvars prompt is no longer required. Cap maudio at
opt-level=1 to dodge a rustc ICE codegenning MaybeUninit<ma_fence> for
x86_64-pc-windows-msvc under the pinned nightly (Bazel's older pin is
unaffected).

Compile: Bun.Glob.scan yields backslash paths on Windows; the legacy Pi
virtual module used them verbatim for export keys and generated identifiers,
producing invalid JavaScript in compiled-binary builds.

Tests: strip ConPTY negotiation escapes in the pty argv test; ignore the
bazel-oh-my-pi convenience symlink.
2026-08-07 16:54:02 +08:00
can1357 2759b11b0a test(release): exercise checksum generation end to end 2026-08-05 22:16:29 +02:00
can1357 4e62f3b7fd Merge PR #7660: ci(release): add SHA256SUMS.txt to GitHub releases (@andrew-scott-fischer) 2026-08-05 22:16:29 +02:00
can1357 afe926329d docs(ci): update local TypeScript runner comment 2026-08-05 22:16:29 +02:00
can1357 a1316bb22b Merge PR #7726: ci: ran the mnemopi suite in the workspace bucket (@Cyrus580529) 2026-08-05 22:16:29 +02:00
can1357 f92f402456 Merge PR #7693: fix(install): make install.ps1 compatible with Windows PowerShell 5.1 (@metaphorics) 2026-08-05 21:50:26 +02:00
Cyrus 8bbe1ed01d ci: ran the mnemopi suite in the workspace bucket
The stated reason for the exclusion no longer holds: no test in
packages/mnemopi loads the fastembed model. The suites that touch embeddings
inject a deterministic in-process provider via setEmbeddingProviderForTests,
and the model-cache suite mocks globalThis.fetch, so nothing downloads or
reads a ~270MB model. On a clean checkout with no model cached, all 448 tests
across 73 files pass on linux-x64 in 11.7s.

packages/mnemopi moves into fastWorkspacePackages, which the workspace bucket
runs and which local-ts already covered through localOnlyWorkspacePackages, so
the local full run is unchanged.
2026-08-05 21:44:00 +08:00
metaphorics 781d98fbad fix(install): make install.ps1 compatible with Windows PowerShell 5.1 2026-08-05 11:43:34 +00:00
can1357 e9888367d1 refactor: migrated packages to internal utility modules and removed external dependencies
- Implemented in-house, zero-dependency utility modules in `pi-utils` covering DOM manipulation, markdown parsing, templating, browser automation helpers, and terminal buffers.
- Migrated packages across the repository to consume the new internal utilities and `omptype` schema validators instead of external dependencies.
- Removed multiple external runtime and development dependencies including Zod, Marked, LRU cache, Turndown, and Puppeteer browser packages.
2026-08-05 13:39:09 +02:00
Kyle McCleary afdc1caa6c fix(ci): align native install smoke metadata 2026-08-04 20:10:05 -07:00
can1357 6baaeec785 style: organized imports in release tooling (biome) 2026-08-05 01:15:43 +02:00
can1357 2605243f38 fix: complete version comparator centralization 2026-08-05 01:11:56 +02:00
Andrew Fischer e03407e684 perf(ci): stream release asset hashing instead of buffering into memory
Avoids holding every release binary in RAM at once when computing SHA256SUMS.txt.
2026-08-04 15:48:35 -07:00
Andrew Fischer 5da9525afd ci(release): add SHA256SUMS.txt to GitHub releases
Generate a sha256sum-compatible checksums file covering every release
binary and the browser-relay zip, and upload it as a release asset so
downloads can be verified offline without hitting the GitHub API.
2026-08-04 15:38:18 -07:00
metaphorics 3a9b823630 fix(release): import the comparator without loading native bindings
Wave-4 review finding on #7586:
- release.ts took compareVersions from the pi-utils barrel, which pulls
  file-lock and procmgr into the graph; those import pi-natives, whose
  entrypoint calls loadNative() and throws in a checkout without the
  built addon
- that also meant scripts/release.test.ts never executed under
  test:scripts, so the guard wired into CI last round proved nothing
- take the dependency-free version subpath instead
2026-08-05 04:50:17 +09:00
metaphorics df3fa86f7d fix(release): reject prereleases and normalize the version prefix
Wave-2 review findings on #7586:
- the guard accepted `17.2.8-rc.1`, and the publish step passes no
  --tag, so a prerelease would have become the npm `latest` every
  unqualified install and `omp update` resolve
- `v17.2.8` passed the guard and reached Cargo.toml verbatim, which
  cargo rejects only after every manifest was rewritten; validation now
  returns the normalized version and callers write that
2026-08-05 02:48:59 +09:00
metaphorics 726698e2b0 fix(release): validate explicit versions and drop duplicate comparators
Review findings on #7586:
- validate an explicit release version before comparing; the shared
  comparator never throws, so 999.bad previously reached every manifest
- ci-release-notes imports the comparator by relative path: the
  release_github job runs without bun install
- route Bun cache pruning through compareVersions and delete
  compareSemverLikeVersions
- regression test for the release-version guard
2026-08-05 02:48:59 +09:00
metaphorics 954894f1d4 refactor: centralize version comparison in pi-utils 2026-08-05 02:48:59 +09:00
can1357 e2412f68b2 Merge PR #7546: fix(setup): verify musl binary starts before reporting install success (@roboomp) 2026-08-03 23:41:21 +02:00
can1357 bc39ffa265 feat: introduced omptype validation package and migrated workspace dependencies
- Introduce `@oh-my-pi/omptype` as a new ArkType-compatible schema validation package featuring a lazy JIT runtime, JSON Schema emission, and compatibility adapters.
- Replace `arktype` across workspace packages and test utilities with `@oh-my-pi/omptype`.
- Add benchmark suites, tests, and documentation for the new validation engine and adapters.
- Update workspace build, test runner, and release configurations to include the new package.
2026-08-03 21:56:48 +02:00
roboomp 5046438f3b fix(setup): verify musl binary starts before reporting install success
install_binary downloaded the release binary, chmod'd it, and printed
"✓ Installed omp" with exit 0 without ever running it. Bun's musl-target
binaries link libstdc++/libgcc dynamically, which stock Alpine/musl systems
lack, so the binary exits 127 with relocation errors while the installer
still claimed success.

Smoke-run `omp --version` after install; on failure print the captured
error, add the `apk add libstdc++ libgcc` remediation for musl targets,
and exit non-zero. Document the Alpine/musl runtime requirement in the
README install section.

Fixes #7545
2026-08-03 18:55:10 +00:00
can1357 fc04aa6fa7 refactor(coding-agent): deferred startup parsing and schema compilation
- Wrapped security contract schemas in a lazy initializer with jitless scopes to eliminate startup JIT compilation tax.
- Enabled jitless scope configuration in auth-broker wire schemas to skip definition-time codegen.
- Deferred startup changelog parsing to overlap with interactive session creation.
2026-08-03 16:31:27 +02:00
can1357 8cd6e3e964 chore: delete dumb tests 2026-08-03 15:45:44 +02:00
can1357 881eec7d26 fix(release): shipped clipboard entrypoint in pi-natives npm package
- prepareNativeCorePackage's files whitelist predated the native/clipboard
  module; the packed tarball lacked it and the coding-agent CLI failed with
  'Cannot find module @oh-my-pi/pi-natives/clipboard' in the tarball install
  smoke. Verified the packed tarball now contains clipboard.js/.d.ts.
2026-08-02 23:32:24 +02:00
roboomp 9f9c9758a1 fix(tui): prevented test env from suppressing interactive launch
Scoped test-runtime detection to explicit runner markers and Bun test entrypoints, so application NODE_ENV/BUN_ENV values no longer make ProcessTerminal headless.

Added subprocess regression coverage and propagated the private marker to test children.

Fixes #7261
2026-08-01 11:39:57 +00:00
can1357 5ea583e413 feat: replaced legacy editing commands with unified put and cut syntax
- Replaced legacy `SWAP`, `INS`, and `PASTE` commands with unified `PUT` and `CUT` hunks across parser, grammar, tokenizer, and test suites.
- Added support for named registers and span paste operations in clipboard and block execution logic.
- Implemented indentation repair and enhanced gap locator formatting for improved patch resilience.
- Updated documentation, system prompts, and session analysis scripts to reflect the new syntax and header shapes.
2026-07-31 00:19:52 +02:00
can1357 55b23864e2 chore: update stats script with paste op 2026-07-30 23:21:40 +02:00
can1357 b238713fad style: formatted merge-pr script per biome 2026-07-30 17:07:48 +02:00
can1357 499017115f feat: added pr merge script with conventional commit validation
- Add merge script to automate local pull request merges with conventional commit validation.
- Add unit tests verifying conventional commit subject compliance and validation rules.
2026-07-30 16:14:50 +02:00
can1357 7b0780028f style(scripts): quoted the empty CDPATH assignment in link-omp.sh
`CDPATH=` already cleared the variable for the `cd` subshell, so this is
a readability-only change: `CDPATH=''` is the identical POSIX assignment
written with explicit empty quotes. No behavior change, and there was no
CDPATH leak to fix.
2026-07-28 10:22:57 +02:00
can1357 ed4c78bc0f feat: streamlined native addon builds and caching in ci workflows
- Enhance CI workflows to build and reuse native addon artifacts instead of recompiling.
- Update bazel cache actions with selective backend detection and separate remote and disk modes.
- Add `--source` CLI option to install prebuilt native targets without requiring Bazel.
- Increase Kata runner memory configuration from 12Gi to 24Gi.
2026-07-28 02:06:13 +02:00
can1357 3d9f28dd46 refactor: resolved cross-platform build warnings and add windows-sys features
- Add conditional attributes to silence dead-code warnings on platform-specific code and fields.
- Update target dependencies in pi-walker/Cargo.toml with explicit windows-sys feature sets.
- Simplify time cast expressions in linux_reflink and rcopy modules.
2026-07-27 17:04:52 +02:00
can1357 d16a251777 chore: reorg tests 2026-07-27 16:43:53 +02:00
can1357 8facd237d5 feat(build): migrated native pipeline to bazel with remote caching
- Replaced the napi-cli/cargo-zigbuild/cargo-xwin/sccache build path with
  Bazel: rules_rust + crate_universe over Cargo.lock, hermetic zig cc
  toolchains (linux-gnu pinned to glibc 2.17, linux-musl), host Xcode for
  darwin, and a repo-local hermetic clang-cl + llvm-ml + xwin toolchain for
  windows-msvc (bazel/toolchains/msvc).
- All eight shipped addons build as //:natives-<target> via the release
  transition in bazel/defs.bzl (opt, thin LTO, cgu=16, stripped, canonical
  .node naming); scripts/bazel-natives.ts is the single driver for local
  dev and CI.
- Rust validation moved to bazel test + clippy aspects (strict workspace
  policy for opted-in crates, default lints elsewhere, mirroring cargo
  semantics) and the rustfmt aspect; cargo stays as the dev-iteration
  surface, with brush-core/brush-builtins promoted to workspace members
  and excluded from cargo dev tasks to keep their historical scope.
- CI caches through an in-cluster bazel-remote action cache (TLS + basic
  auth, cluster-internal only); GitHub-hosted runners never touch the
  infrastructure and use an actions/cache-backed disk cache instead.
- Deleted the hand-rolled caching machinery: ci-target-cache,
  ci-native-artifact-cache, ci-build-native, native-source-hash,
  find-native-artifacts, restore-linux-native, native-prewarm workflow,
  ensure-* toolchain actions, and all sccache/Swatinem wiring.
- Warm native rebuilds drop from ~20 minutes to seconds; a cold client
  with a warm remote cache rebuilds the linux x64 pair in ~2.5 minutes.
2026-07-27 12:22:19 +02:00