Skip to content

feat: add browser and github workflow primitives#718

Merged
khaliqgant merged 7 commits intomainfrom
feature/primitives
Apr 22, 2026
Merged

feat: add browser and github workflow primitives#718
khaliqgant merged 7 commits intomainfrom
feature/primitives

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Apr 10, 2026

Summary

Add packages/primitives with two workflow primitives:

packages/primitives/browser

Browser automation primitive with MCP server integration. Provides:

  • Navigation actions (goto, back, forward, refresh)
  • Interaction actions (click, type, hover, drag)
  • Extraction actions (text, value, attribute, screenshot)
  • Wait actions (load, dom, network)
  • MCP JSON-RPC server for browser control
  • Workflow step integration for relay

packages/primitives/github

GitHub API primitive with local/cloud adapter pattern:

  • Works locally via gh CLI (when user has gh installed and authenticated)
  • Works in cloud via Nango connection (when connected to relay-cloud)
  • Adapter pattern switches between runtimes transparently
  • Actions for repos, issues, pulls, branches, commits, files, users

Related Trajectories

5 trajectories included documenting the implementation decisions:

  • traj_05xg7j388bc4 - Add browser workflow step integration
  • traj_avmkyoo2s3rt - Implement Browser primitive client
  • traj_530xmbfeljyb - Implement GitHub primitive adapter base layer
  • traj_8oh4r5km5eic - Implement GitHub primitive actions
  • traj_tv1x9pamkqad - Add GitHub primitive workflow step integration

Files

  • packages/primitives/browser/ - 13 files
  • packages/primitives/github/ - 19 files
  • .trajectories/completed/2026-04/ - 5 trajectory pairs (json + md)

Open with Devin

Add packages/primitives with:
- browser: Browser automation primitive with MCP server integration
- github: GitHub API primitive with local/cloud adapter pattern

Also include related trajectories for these implementations.
github-advanced-security[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

MCP Register Flag Bot and others added 2 commits April 22, 2026 08:38
- Remove duplicate star-exports in browser barrel file
- Close externally-provided BrowserClient directly so closeSession
  does not silently no-op when context.client is supplied

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…mples

- examples/end-to-end-pr-workflow.ts: walks the full PR lifecycle
  (inspect → createBranch → createFile → createPR → getPR → updatePR →
  listPRs; mergePR off by default). Single runtime, illustrates how
  every PR-related action composes under one workflow definition.

- examples/multi-tenant-pr-workflow.ts: opens PRs in two tenants
  (AgentWorkforce + MSD) from one workflow by varying per-step
  `config:` — shows how cloud routes GitHub actions to the right Nango
  connection based on repo/workspace. Includes a resolver stand-in
  that cloud's real implementation will replace with a DB lookup.

- README: documents both examples and adds a cloud-adoption guide —
  the `githubConfigForRepo({ repo, workspaceId })` helper shape cloud
  will add so workflow authors can wire the primitive to any connected
  GitHub App (sage, nightcto, msd, etc.).

Addresses the cross-workspace GitHub PR creation need called out when
migrating cloud workflows off shell-invoked `gh pr create`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
devin-ai-integration[bot]

This comment was marked as resolved.

MCP Register Flag Bot and others added 2 commits April 22, 2026 21:24
Move packages/primitives/github -> packages/github-primitive and
packages/primitives/browser -> packages/browser-primitive so both match
the `packages/*` workspaces glob and the publish workflow's
`working-directory: packages/${{ matrix.package }}` pattern. This lets
the existing CI publish both packages without any workflow script
changes beyond adding two entries to the matrix.

Also drop two empty marker interfaces in types.ts (`GetRepoParams`,
`ReadFileParams`) to plain type aliases — ESLint caught them once the
files came into scope via workspaces.

Unblocks cloud adoption of @agent-relay/github-primitive.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	.github/workflows/publish.yml
#	package-lock.json
success: false,
error: error instanceof Error ? error.message : String(error),
metadata: {
sessionId: this.session.id,
if (!record.metadata) {
record.metadata = {
action: action.action,
sessionId: client.getSession().id,

export function trimTrailingSlash(value: string | undefined): string | undefined {
const trimmed = nonEmpty(value);
return trimmed?.replace(/\/+$/, '');
devin-ai-integration[bot]

This comment was marked as resolved.

@github-actions
Copy link
Copy Markdown
Contributor

Preview deployed!

Environment URL
Web https://pr-718.agentrelay.net

This preview will be cleaned up when the PR is merged or closed.

@miyaontherelay
Copy link
Copy Markdown
Contributor

Addressed the current Devin follow-ups on this branch:

  • fixed packages/github-primitive/vitest.config.ts to use the correct repo-relative setupFiles path (../../test/vitest.setup.ts)
  • fixed the browser submit action so waitForNavigation() is armed before requestSubmit() fires, matching the safe Promise.all([...listener, ...trigger]) ordering

Validation run:

  • npx vitest run packages/github-primitive packages/browser-primitive

Head is now fa0c1f8e.

devin-ai-integration[bot]

This comment was marked as resolved.

@miyaontherelay
Copy link
Copy Markdown
Contributor

Addressed review comment r3126494012 on the current PR head.

Fix:

  • updated mergeRuntimeConfig(...) in packages/github-primitive/src/workflow-step.ts so flat fields are assigned separately from nested nango / relayCloud / env objects
  • this preserves executor-level nested defaults while allowing step-level overrides to merge correctly instead of clobbering earlier config

Validation:

  • npx vitest run packages/github-primitive

@khaliqgant khaliqgant merged commit f005385 into main Apr 22, 2026
41 of 42 checks passed
@khaliqgant khaliqgant deleted the feature/primitives branch April 22, 2026 20:26
Copy link
Copy Markdown
Member

@willwashburn willwashburn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's with all the unrelated changes?

@khaliqgant
Copy link
Copy Markdown
Member Author

what's with all the unrelated changes?

Formatting fighting it looks like

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.

4 participants