Skip to content

Add Arc-context-aware command/query discovery and gating in Lens options#8

Merged
einari merged 6 commits into
mainfrom
copilot/add-arc-context-awareness
May 25, 2026
Merged

Add Arc-context-aware command/query discovery and gating in Lens options#8
einari merged 6 commits into
mainfrom
copilot/add-arc-context-awareness

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

Lens currently depends on a manually configured Arc base URL, which breaks the expected Arc flow and exposes Commands/Queries even when the current page is not an Arc app. This change makes Lens context-aware by detecting Arc context from the active page and driving command/query availability from that snapshot.

  • Arc context capture from active page

    • Added page-context detection via React fiber traversal to identify Arc context (reconnectQueries marker) and derive base URL (fallback: page origin).
    • Captured context is stored in chrome.storage.session for options-page consumption.
    • Added scripting permission to support active-tab script execution.
  • Options UI now gated by Arc availability

    • Commands/Queries tabs are rendered only when Arc context is present.
    • When Arc context is missing, options shows a warning banner: not an Arc application.
    • Tab resolution was updated to avoid invalid tab states when Arc-only tabs disappear.
  • Commands/Queries panels now context-driven

    • Removed manual URL entry requirement in these panels.
    • Panels consume detected Arc base URL and introspect directly via:
      • GET {baseUrl}/.cratis/commands
      • GET {baseUrl}/.cratis/queries
    • Introduced shared constant for Arc-context-unavailable messaging to keep UX consistent.
  • Arc settings and docs alignment

    • Arc settings now clarifies that Commands/Queries use detected Arc context.
    • Existing Arc base URL field remains as header-injection scope configuration.
    • Local development docs updated to instruct opening Lens on an Arc page before using Commands/Queries.
const [executionResult] = await chrome.scripting.executeScript({
    target: { tabId: activeTab.id },
    world: 'MAIN',
    func: detectArcContextFromPage,
});

// Arc provider found => baseUrl from configuration or page origin
const baseUrl = getConfiguredBaseUrl(configuration, pageOrigin) ?? pageOrigin;

Arc context UI screenshot

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.cratis.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue May 25, 2026 that may be closed by this pull request
Copilot AI and others added 5 commits May 25, 2026 06:37
Agent-Logs-Url: https://github.com/Cratis/Lens/sessions/04c942fe-6efe-4d76-9b16-f847802ce2c1

Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Arc context awareness to extension Add Arc-context-aware command/query discovery and gating in Lens options May 25, 2026
Copilot finished work on behalf of einari May 25, 2026 06:44
Copilot AI requested a review from einari May 25, 2026 06:44
@einari einari marked this pull request as ready for review May 25, 2026 07:57
@einari einari merged commit 5b04e8b into main May 25, 2026
@einari einari deleted the copilot/add-arc-context-awareness branch May 25, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arc Context aware

2 participants