Add tab activate, links pagination/filtering, and text marker extraction; remove phase 09 tooling#25
Merged
Merged
Conversation
Features planned: - tab.activate command (background-handled, follows tab.pin pattern) - links --href-contains filter (content-script substring predicate) - Response truncation fix + links --offset pagination - text --after CLI-local marker extraction Rejected: - scroll --until-end (violates ADR-017/ADR-024) - --activate-if-needed on destructive actions (hidden strategy)
Implement tab.activate as a background-handled browser action that foregrounds a session-owned tab and focuses its window. Follows the exact tab.pin pattern across all layers. Changes: - shared: add tab.activate to Action union, params, result, forwarded params - cli: new tab/activate.ts command, registry classification (destructive) - service: routing in tab-actions.ts, Zod schema - extension: BrowserWindowsSeam interface, handleTabActivate implementation - tests: extension unit tests, service routing test, CLI registry coverage Closes the TAB_NOT_VISIBLE → screenshot --activate → retry workaround by giving agents an explicit one-shot way to foreground a tab.
Phase 10, Feature 2: allow agents to filter links at extraction time
by case-sensitive substring match on the resolved absolute href.
Changes across all layers:
- shared: add hrefContains?: string to ActionParams['links']
- service: add hrefContains to links Zod schema
- cli: add --href-contains flag, wire to params
- extension: apply filter after toLinkInfo, before limit cap
- tests: extension unit tests (match/no-match/empty/undefined/limit)
and CLI param wiring test
Filter semantics:
- Case-sensitive .includes() on absolute URL
- Empty string matches everything (no-op)
- undefined means no filter (standard omission)
- Applied before limit cap: --limit 5 --href-contains '/in/' returns
at most 5 matching links, not 5 links then filtered
Refs: #21
Part A — Truncation fix:
- executeExitPlan uses synchronous writeFileSync(fd=1) for stdout
when no test stream is injected, preventing pipe-buffer truncation
on payloads >64KB (root cause of 'unterminated string at char 65200')
- Added regression test with 250-entry links response (>64KB)
Part B — links --offset pagination:
- ActionParams['links'] gains offset?: number
- ActionResult['links'] changes to { links, total, capped? }
- Extension handleLinks refactored: collect-then-slice with
MAX_COLLECTION_CAP (2000) safety bound
- CLI adds --offset flag (non-negative integer)
- Service Zod schema adds offset validation
- Daemon decorateReadHandles preserves total/capped fields
All 845 tests pass. pnpm check clean.
Breaking wire change: ActionResult['links'] now requires 'total: number' field (offset pagination, Feature 3B). Old extensions that omit 'total' produce incompatible responses. Cohesion-of-name refactoring: - All scattered protocol_version/protocolVersion literals replaced with the PROTOCOL_VERSION constant imported from @bproxy/shared - Future version bumps are a single-line change in shared/src/version.ts - Type definitions use 'typeof PROTOCOL_VERSION' for compile-time safety Test improvements: - Compile-time assertion for ActionResult['links'] shape (_LinksResult) - Extension: capped behavior test (MAX_COLLECTION_CAP boundary, 2001 links) - CLI: offset/limit parsing validation tests (+9) - Service: schema coverage for offset/hrefContains (+3) 53 files changed, 858 tests passing, pnpm check green.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
This PR primarily delivers the Phase 10 work from
docs/internal/plans/phases/10-agent-session-dx.md, then folds in the follow-up cleanup that removed the ineffective Phase 09 Pi search-tooling experiment.Phase 10 implementation
tab activateas an explicit background-handled browser actionlinks --href-containsfor substring filtering on absolute hrefslinks --offsetpagination and extend links results withtotal/cappedPROTOCOL_VERSIONtext --afterand--limit-charspost-processingFollow-up cleanup in this branch
0.9.0and sync versioned artifactsValidation
pnpm checkpnpm testpnpm check-versions