72 Commits

Author SHA1 Message Date
can1357 b279db1790 test: refactored test suites to eliminate time-based sleeps and polling loops
- Replaced time-based sleeps and polling loops with event-driven promise resolvers and fake timers across agent and tool tests.
- Migrated test suites to share in-memory auth storage and fixtures using lifecycle hooks.
- Updated catalog model definitions, metadata, and configurations.
2026-08-13 19:32:22 +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
roboomp 7ffe1eb877 fix(coding-agent): ship omp:// docs to npm consumers
exports resolve to TypeScript source, where the build-time PI_DOCS_EMBED
placeholder is empty and the dev-tree fallback resolved docs to an
unreachable node_modules/docs, so OmpProtocolHandler.complete()/.resolve()
threw ENOENT for every npm/SDK consumer.

- bundle-dist.ts writes the docs corpus to dist/docs-index.generated.txt
  (shipped via package.json files), reusing the same payload it inlines
  into dist/cli.js.
- docs-index.ts reads the shipped embed when the env embed is empty and
  the on-disk docs/ directory is absent, and degrades to an empty index
  (with a warning) instead of propagating ENOENT.
- Added a generator-to-runtime payload round-trip test.

Fixes #8134
2026-08-10 05:34:32 +00:00
can1357 c8096ee6e7 Merge PR #7773: fix(vault): pass vault= as top-level obsidian cli option (@roboomp) 2026-08-07 13:39:53 +02:00
roboomp f5f7b09dd7 fix(vault): pass vault= as top-level obsidian cli option
The vault=<name> argument was appended after the subcommand
(obsidian bases vault=Work), but the Obsidian CLI only honors it as a
top-level option before the subcommand. Placed after, the subcommand
consumed/ignored it and the command bound to whichever vault had window
focus, so vault://<name>?op=... silently queried the wrong vault.

Prepend the vault arg in #runCli and #vaultInfo so it precedes the
subcommand (obsidian vault=Work bases), matching the CLI's documented
top-level-option semantics.

Fixes #7771
2026-08-06 01:36:01 +00:00
can1357 ae84aff853 Merge PR #7675: fix(memory): hide disabled memory protocol (@roboomp) 2026-08-05 22:16:28 +02:00
can1357 c01d18eb57 Merge PR #7657: fix(read): split semicolon-delimited internal URLs (@revofusion) 2026-08-05 21:50:25 +02:00
roboomp 619412c987 fix(memory): hid disabled memory protocol
Made the Read schema session-aware and rejected memory URLs when the calling session has memory disabled.

Fixes #7673
2026-08-05 04:07:40 +00:00
can1357 d53d5c0035 fix(coding-agent): scope hindsight memory errors to caller 2026-08-05 01:12:01 +02:00
Revofusion 84c4c58063 fix(read): preserve literal routed URL semicolons 2026-08-04 15:53:58 -06:00
roboomp 8b152f7bdf fix(coding-agent): give memory:// a corrective error under hindsight backend
The shared `recall` tool description instructs a follow-up `read memory://<id>`,
but the memory:// handler resolves only `root` and mnemopi ids. Under
memory.backend=hindsight, following the tool's own docs hit the generic
"Unknown memory namespace" error that only mentions mnemopi, causing repeated
failed reads and derailment.

Make the handler backend-aware: when a memory://<id> read arrives while a
Hindsight session is active and no mnemopi state can serve it, throw a
corrective error pointing at `recall`/`reflect` so a stray read self-corrects
in one turn.

Fixes #7587
2026-08-04 03:42:57 +00:00
Kyle McCleary d90e54fb09 fix(coding-agent): harden native security workflow 2026-07-29 20:05:57 -07:00
Kyle McCleary 9314e200fe fix(security): harden scan runtime boundaries 2026-07-29 18:47:51 -07:00
Kyle McCleary b708b39915 fix(security): harden native scan contracts 2026-07-29 18:47:51 -07:00
Kyle McCleary 089a9963f8 feat(security): OMP-native security subsystem (planner handoff) 2026-07-29 18:47:51 -07:00
roboomp c88c59db84 fix(coding-agent): surfaced MCP resource templates in resource summary
formatAvailableResources only listed concrete resources, so the
assistant-facing summary shown on a failed mcp:// read understated the
server's contract even though template routing and /mcp resources
already handle them. Now templates are listed alongside concrete
resources.

Fixes #6911

(cherry picked from commit 254f35bb04cda8a615bbe1291d73b13cac0eabaa)
2026-07-29 23:08:28 +02:00
can1357 d16a251777 chore: reorg tests 2026-07-27 16:43:53 +02:00
can1357 41ce810cff fix(mcp): preserved native resource URIs and opaque scheme routing
- Native (non-mcp://) resource URIs now pass through byte-for-byte via
  rawHref; slash elision applies only to the legacy mcp:// wrapper, so
  catalog://root/ style URIs match exact-equality server lookups.
- resources/templates/list failure no longer discards a successful
  resources/list (Promise.allSettled; templates retried later).
- Opaque RFC 3986 URIs (urn:doc, custom:item) are recognized by both
  the router and read-cli discovery gates, with drive-path and
  read-selector false positives guarded.
- Review follow-up for PR #6790.
2026-07-27 16:15:02 +02:00
Dongmen Laohu 2c77c8535a fix(mcp): resolve native resource URIs 2026-07-27 18:59:12 +08:00
can1357 b849a4503f fix(coding-agent): kept encoded glob metacharacters literal in memory glob suffixes 2026-07-27 04:58:26 +02:00
usr-bin-roygbiv 49d5145fff fix(coding-agent): preserve encoded memory glob bases 2026-07-26 21:33:13 +00:00
usr-bin-roygbiv 6b65fd2996 fix(coding-agent): preserve question-mark memory globs 2026-07-26 20:58:33 +00:00
Roy 90cb91489e fix(coding-agent): safely glob memory directories 2026-07-26 16:36:47 +00:00
can1357 3566b78817 test(internal-urls): cover hasResolvableTranscript availability contract 2026-07-23 11:37:12 +02:00
roboomp dc7238f5a4 fix(read): supported history URL selectors
Added history to selector-aware internal URL schemes so read paging resolves the agent id before applying transcript ranges.

Fixes #5806
2026-07-17 07:46:37 +00:00
can1357 69de4b7725 style: formatted history-protocol test imports 2026-07-14 22:59:35 +02:00
can1357 6f7b2483da fix(internal-urls): ignore non-directory artifact candidates 2026-07-14 22:58:48 +02:00
can1357 ba5c915777 Merge PR #5455: fix(internal-urls): serve history:// transcripts from disk fallback (@roboomp) 2026-07-14 22:58:48 +02:00
roboomp e29fbce55c fix(internal-urls): serve history:// transcripts from disk fallback
history:// resolve/complete/index queried the in-memory AgentRegistry
exclusively, so transcripts of unregistered one-shot helpers
(keepAlive: false), released agents, or any subagent after a session
resume threw "Unknown agent" despite their .jsonl session file
persisting on disk — unlike agent://, which reads .md outputs off disk.

Added sessionFilesFromDisk() to registry-helpers: a recursive scan of
the artifacts dirs keyed by agent id, excluding advisor transcripts
(__advisor*.jsonl) and EPERM-rewrite backups (.bak). HistoryProtocolHandler
now falls back to it on a registry miss (resolve and the else branch),
merges on-disk agents into the index, and unions them into completions.
Documented history:// in the system prompt's Internal URLs section.

Fixes #5261
2026-07-14 17:41:26 +00:00
can1357 a9998ae07b Merge PR #5086: fix(agent): isolate memory root resolution (@roboomp)
# Conflicts:
#	packages/coding-agent/src/internal-urls/memory-protocol.ts
2026-07-14 18:41:54 +02:00
can1357 a011e07d18 Merge PR #5078: fix(coding-agent): prevent memory URL writes from leaking to cwd (@roboomp) 2026-07-14 18:41:17 +02:00
can1357 d469064d1a fix: handle stale tests 2026-07-11 07:54:19 +02:00
can1357 33c161d9dd refactor(coding-agent): restructured plugin system and build logic
- Migrated legacy static bundled-module registry to a dynamic Bun-based in-memory plugin system.
- Removed over 4,000 lines of manually maintained registry files to reduce maintenance overhead.
- Implemented CJS absolute path rewriting and native-addon load hooks to improve FFI dependency resolution.
- Standardized binary build processes by centralizing compilation logic into shared utilities.
2026-07-11 07:33:22 +02:00
roboomp f26fffb8e0 fix(agent): isolated memory root resolution
Resolved file-backed memory://root URLs from the calling session cwd before falling back to the global registry.

Passed the caller cwd through bash internal-URL expansion so redirected memory paths cannot pick another live agent root.

Fixes #5079
2026-07-10 14:48:24 +00:00
roboomp a4f43be040 fix(coding-agent): rejected read-only internal url writes
Blocked write tool filesystem fallback for read-only internal URL schemes so memory:// targets cannot be materialized as project-relative paths.

Added a regression test covering memory://root/memory_summary.md writes and the leaked memory:/root path.

Fixes #5075
2026-07-10 14:18:53 +00:00
can1357 efc90d26b8 style: applied biome fixes to integrated issue fixes 2026-07-09 18:34:06 +02:00
can1357 ca68daa81c fix(mnemopi): made recall fact ids resolvable via memory reads
recall (includeFacts) surfaces facts.fact_id as a result id, but
store.get only searched working_memory + episodic_memory, so every
surfaced fact id was a dead end for 'read memory://<id>' and
memory_edit ('not found in any scoped bank').

- store.get now falls back to the facts table (visibility mirrors
  factRecall: same-session or scope='global'), returning a read-only
  row with memory_store 'fact' and the full triple as content.
- coding-agent labels the store honestly ('fact') in memory:// reads
  and reports not_editable (instead of not_found) for memory_edit ops
  on fact ids; the facts table stays immutable.

Fixes #4725
2026-07-09 18:27:23 +02:00
can1357 29340cf3cb Merge PR #4445: fix(mnemopi): let agents read stored memories in full (@roboomp)
# Conflicts:
#	packages/mnemopi/src/core/beam/recall.ts
2026-07-05 13:12:31 +02:00
roboomp 2b8c8cadfb fix(read): kept raw artifact chunks verbatim and broadened path-only resolution
Skipped the workflow notice on raw selectors so bounded raw reads stay byte-for-byte, and taught resolveToolSearchScope to request pathOnly resolution so ast_grep/ast_edit scope-only calls no longer trip the inline-content cap on large artifacts.

Fixes #4482
2026-07-03 23:36:57 +00:00
roboomp ff397cf27a fix(read): kept large artifacts reachable from path-only resolvers
Bash URL expansion and search/grep only need sourcePath; they now request pathOnly resolution so large artifacts stay usable for search/copy workflows while unbounded content materialization stays blocked.

Fixes #4482
2026-07-03 23:17:46 +00:00
roboomp 536ecc725a fix(mnemopi): let agents read stored memories in full
Recall silently clipped every result to 500 chars mid-word with no marker,
and memory_edit update replaces content wholesale by id. There was no way
for an agent to inspect the full row before overwriting it: Mnemopi.get
existed but nothing surfaced it, and the advertised URI only served the
file-backed memory summary. The natural recall/inspect/update loop had no
inspect step.

Three fixes across mnemopi and coding-agent:
- recall now appends an ellipsis marker when it clips content and reports
  truncated=true plus full_length. The cap is exposed as
  RecallOptions.contentPreviewChars (default 500, 0 disables). The factLine
  200-char clip used by the enhanced-context sandwich gets the same marker.
- Under the mnemopi backend the read-tool URI scheme now routes an id host
  to Mnemopi.get() across every session's scoped banks, returning the row
  as text/markdown with a YAML-frontmatter header (bank, store, source,
  timestamp, importance, veracity). The root namespace remains for the
  file-backed summary. Miss errors now name the backend explicitly.
- Updated the recall and memory_edit tool prompts to document the
  truncation marker and require reading the full memory before any
  wholesale content update.

Fixes #4443
2026-07-03 15:05:43 +00:00
roboomp 92740d3c4f docs(coding-agent): completed full omp docs sync
Added a contributor-facing native crate map (docs/native-crates.md) covering pi-natives, pi-shell, pi-ast, pi-iso, pi-walker, pi_uu_grep, pi-uutils-ctx, and vendored brush crates, and linked it from natives-architecture.md and user-facing-packages.md.

Added a docs-index tool coverage test asserting every BUILTIN_TOOL_NAMES entry and injected custom tool (generate_image, tts) has a docs/tools/<name>.md page served by omp://.

Inlined tiny fail/buildPayloadText/checkDocsIndexFreshness helpers in generate-docs-index.ts per the project rule against single-expression named functions.

Fixes #3934
2026-07-01 00:00:52 +00:00
roboomp 3c3cb2a76b docs(coding-agent): synced omp docs coverage
Added root omp docs for memory_edit, learn, manage_skill, generate_image, and tts, plus package-level coverage for user-facing README-only CLIs.

Added a docs-index freshness check to package check and made gen:bundle generate and reset the docs embed itself.

Fixes #3934
2026-06-30 23:53:42 +00:00
oldschoola a2854ba768 fix: migrate coding-agent tests from fs.rm to removeWithRetries
Migrate 203 test files (356 call sites) from fs.rm/fs.rmSync to
removeWithRetries/removeSyncWithRetries to reduce EBUSY test failures
on Windows. removeWithRetries is now exported from @oh-my-pi/pi-utils.

The migration uses a regex-based approach that:
- Replaces fs.rm(path, { recursive, force }) → removeWithRetries(path)
- Replaces fs.rmSync(path, { recursive, force }) → removeSyncWithRetries(path)
- Replaces fs.rm(path) → removeWithRetries(path) (no options)
- Skips fs.rm/fs.rmSync inside template literals (bun --eval scripts)
- Adds imports to existing @oh-my-pi/pi-utils import or creates new one
- Removes unused fs imports where fs.rm was the only fs usage (4 files)
2026-06-23 15:28:05 -07:00
roboomp b098addaf3 fix(tool): resolved internal url directories
Allow file-backed internal URL handlers to return existing directories as resources so read can list them and search/find can walk their source paths.

Fixes #3116
2026-06-20 09:44:10 +00:00
can1357 29d250fae2 feat(coding-agent): supported advisor transcript persistence
- Implemented `AdvisorTranscriptRecorder` to persist advisor sessions to append-only `__advisor.jsonl` files.
- Integrated transcript recording into agent sessions with managed flushing, atomic file switching, and synthetic turn attribution.
- Restricted advisor-kind agents by excluding them from rosters, history protocols, messaging, and interactive agent commands.
- Reserved the `__advisor` filename stem across the output manager and task registry to prevent task ID collisions.
2026-06-19 03:50:00 +02:00
can1357 831b664a4c perf(coding-agent): optimized documentation indexing via compressed blob
- Replaced raw TypeScript documentation map with a lazily-inflated gzip blob.
- Reduced bundled binary/npm package size by approximately 0.9MB.
- Encapsulated index logic into `docs-index.ts` to separate header metadata from content.
- Added `postpack` and robust `try/finally` patterns in build scripts to ensure clean artifacts.
- Implemented disk-based fallback during development to maintain existing developer experience.
2026-06-18 18:57:13 +02:00
roboomp 47fb727582 fix(github): refreshed stale issue and pr views
Refresh soft-expired issue and PR view cache rows synchronously before returning content, while keeping PR diff rows on stale-first refresh semantics.

Add stale fallback warnings when a live refresh fails and cover the cache/protocol behavior in tests.

Fixes #2684
2026-06-15 15:25:54 +00:00
roboomp fc9534e92b fix(coding-agent): kept short local root stable across session moves
- Derived the short Windows '/data/workspaces/can1357__oh-my-pi__2551/.omp-session/2026-06-14T07-09-37-753Z_019ec4f6-ee59-7000-8226-e1b7ed0680e9/local' root from the stable session id instead of the artifact path, so SessionManager.moveTo() keeps reading the pre-move local files.
- Locked the move stability with a dedicated regression test alongside the long-path coverage.

Refs #2551
2026-06-14 07:27:37 +00:00
roboomp 841d51aed0 fix(coding-agent): guarded nested task rendering cycles
- Added cycle and depth guards for nested task progress rendering so async fan-out snapshots cannot recurse until the TUI crashes.
- Shortened long Windows '/data/workspaces/can1357__oh-my-pi__2551/.omp-session/2026-06-14T07-09-37-753Z_019ec4f6-ee59-7000-8226-e1b7ed0680e9/local' roots into temp-backed session roots before plan/handoff writes hit MAX_PATH.

Fixes #2551
2026-06-14 07:21:53 +00:00