Skip to content

feat(connector): M4 — @understudy/connector + publish pipeline - #4

Merged
gcharang merged 2 commits into
masterfrom
m4-connector-publish
Jul 16, 2026
Merged

feat(connector): M4 — @understudy/connector + publish pipeline#4
gcharang merged 2 commits into
masterfrom
m4-connector-publish

Conversation

@gcharang

Copy link
Copy Markdown
Contributor

Summary

The understudy-side half of M4 (consumer integration + published contract): the reference breakwater connector package consumers import, publish-ready npm metadata for both packages, and the changesets + GitHub Actions release pipeline. The remaining M4 half (metamind / smart-compliance Mastra agent + flowsafe approvals driving understudy end-to-end) is cross-repo and not in scope here.

packages/connector@understudy/connector 0.1.0

connector id class protocol commands
observe browser.observe read — no approval snapshot (a11y/dom/screenshot), get_tabs, wait
act browser.act write — grant-gated, idempotent, dry-runnable, 60/min click, type, navigate, key, scroll, switch_tab
fillCredential browser.fill_credential vaulted write, 30/min fill_secret (opaque secretRef; plaintext never enters the Worker/model/audit)

Plus callBrowserWrite / callBrowserDryRun workflow helpers mirroring metamind's shipped intake/connectors.ts. Verified against anchorage breakwater v0.3.x source and the shipped M3 service contract — deliberate deltas from the smart-compliance docs sketch (which predates M3): bearer caller auth, fill_secret from protocol v0.3.0, full protocol coverage, an optional breakwater policies pass-through (audit logger, tenantIsolation, test fetch seam), and Mastra's silent input-validation sentinel normalized to a throw. resolve_ref stays unreachable (internal service↔extension probe; consumers use the dryRun flag).

Load-bearing fix caught in review: egress declares URL.hostname, not .host.host carries :port, which breakwater's egress allowlist rejects at construction, so every wrangler dev (localhost:8787) consumer loop would have thrown.

Publish + release

  • MIT license (root + per-package), files-scoped tarballs (5 files each; workspace:^ verified to rewrite to ^0.3.0), npm READMEs, full publish metadata for @understudy/protocol 0.3.0 and @understudy/connector 0.1.0.
  • ci.yml (typecheck/test/build) + release.yml — single-branch changesets flow adapted from anchorage: Version Packages PR when changesets are pending, publish with tags/GitHub releases/provenance when not. First push to master publishes 0.3.0/0.1.0 directly (versions pre-set; no changeset file on purpose).
  • Blocked on repo setup before merge does anything on npm: create the npm understudy org (scope verified unclaimed 2026-07-16) and add an automation-token NPM_TOKEN repo secret. Without it the publish step fails loudly (ENEEDAUTH); nothing partial happens.
  • pnpm-workspace.yaml: minimumReleaseAgeExclude for @proofoftech/breakwater (every published version is younger than the 7-day supply-chain quarantine).

Docs

Root README's stale pre-Topology-1 header ("backend brain") rewritten; technical plan repo layout / Consumer integration / M4 status updated to point at packages/connector as the canonical reference.

Test plan

  • pnpm -r typecheck — 4/4 projects clean
  • pnpm -r test131 passed (protocol 19 / extension 37 / connector 22 / backend 53)
  • npm pack --dry-run both packages — 5-file tarballs incl. LICENSE; connector tarball's protocol dep rewrites to ^0.3.0
  • Quality gate (parallel quality-reviewer / architect / QA lanes): all clean after fixes — .hostname egress fix + regression test, audit/policies seam + test, QA's recommended coverage (rate-limit denial, wrong-connector grant, release-on-throw retry, wait-failure, validation-sentinel) folded in
  • Post-merge: npm org + NPM_TOKEN secret, then master push publishes both packages (release.yml)

🤖 Generated with Claude Code

gcharang and others added 2 commits July 16, 2026 20:03
…th packages

The understudy-side half of M4 (consumer integration + published contract):

- packages/connector (@understudy/connector 0.1.0): reference breakwater
  connectors consumers import as Mastra tools — observe (snapshot/get_tabs/
  wait, ungated read) / act (click/type/navigate/key/scroll/switch_tab;
  grant-gated, idempotent, dry-runnable, 60/min) / fillCredential (vaulted
  fill_secret, 30/min) — plus callBrowserWrite/callBrowserDryRun helpers
  mirroring metamind's shipped intake/connectors.ts. Deltas vs the
  smart-compliance sketch (it predates M3): bearer caller auth, fill_secret
  from protocol v0.3.0, full protocol coverage, an optional breakwater
  policies pass-through (audit/evaluators/fetch), and Mastra's silent
  input-validation sentinel normalized to a throw. Egress pins to
  URL.hostname (.host carries :port, which breakwater's allowlist rejects
  at construction — would have broken every wrangler-dev consumer loop).
  22 tests against the real breakwater wrapper: grant fail-closed,
  wrong-connector grant, idempotent replay + release-on-throw retry,
  rate-limit denial, per-hop egress redirect denial, dry-run precedence,
  no-plaintext wire assertion.

- Publish prep: MIT (LICENSE at root + per-package), files-scoped tarballs
  for @understudy/protocol 0.3.0 + @understudy/connector 0.1.0, npm READMEs,
  repository/keywords/sideEffects/prepublishOnly metadata.

- Release flow: changesets + GitHub Actions (ci.yml: typecheck/test/build;
  release.yml: single-branch adaptation of anchorage's flow — Version
  Packages PR when changesets are pending, publish with tags/releases/
  provenance when not). First master push publishes 0.3.0/0.1.0 directly
  (versions pre-set, no changeset needed). Requires the NPM_TOKEN secret;
  publish waits on the npm "understudy" org.

- pnpm-workspace: minimumReleaseAgeExclude for @proofoftech/breakwater
  (every published version is younger than the 7-day quarantine).

- Docs: root README pre-Topology-1 header rewritten; technical plan points
  at packages/connector as the canonical consumer reference.

Workspace: 131 tests green (protocol 19 / extension 37 / connector 22 /
backend 53), pnpm -r typecheck clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@understudy/protocol and @understudy/connector resolve via dist/ (the
npm-publish-correct layout), but dist is gitignored - on a fresh checkout
the backend/connector typecheck hits TS2307 before anything is built.
Build ./packages/* first (topological: protocol before connector); same
ordering fix in the README's fresh-clone commands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gcharang
gcharang merged commit ed65f5a into master Jul 16, 2026
1 check passed
@gcharang
gcharang deleted the m4-connector-publish branch July 16, 2026 16:29
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.

1 participant