feat(sdk): prepare pinned Babysitter catalog export
Cloud #3940 must not enable Babysitter from the legacy Claude/comment extension or mutable references. This adds a read-only exporter that fetches an immutable AgentWorkforce/flows ref through the existing SDK, verifies independently supplied bundle and manifest digests, and requires the native Codex/cloud:babysitter-turn permission declaration. It preserves digest-bound manifest bytes, never executes handler code, and refuses to overwrite an output file.
The handoff document identifies the existing Software Factory catalog JSON/API and Cloud parser. This PR does not publish an artifact, change catalog entries, or enable execution. Native handler implementation, reviewed artifact pins, catalog provenance, and released lineage/native-delivery/receipt dependencies remain blockers. #549 intentionally refuses matched handlers; changing permission strings on the old handler cannot close that gap.
Validation used the repository CI local-Surface override (npm ci --prefix packages/surface --ignore-scripts, then npm install ./packages/surface --prefix packages/sdk --no-save --ignore-scripts). Initial installed dependencies lacked current Surface hooks/events and relay-helpers rampClient; refreshing/building the local dependencies resolved those setup failures. No dependency manifests or gates changed.
Captured verification (also committed at evidence/babysitter-catalog-export/verification.txt):
$ (cd . && npm run build --prefix packages/surface)
> @relayflows/surface@2.0.25 build
> tsc
Exit: 0
$ (cd packages/sdk && npm run typecheck)
> @relayflows/sdk@2.0.25 typecheck
> tsc --noEmit && tsc -p tsconfig.type-tests.json
Exit: 0
$ (cd packages/sdk && npm run typecheck:tests)
> @relayflows/sdk@2.0.25 typecheck:tests
> tsc -p tsconfig.tests.json
Exit: 0
$ (cd packages/sdk && npm run build)
> @relayflows/sdk@2.0.25 build
> tsc && node scripts/make-cli-executable.mjs
Exit: 0
$ (cd packages/sdk && ./node_modules/.bin/vitest run tests/babysitter-catalog-export.test.ts)
RUN v2.1.9 /Users/khaliqgant/Projects/AgentWorkforce/flows/packages/sdk
✓ tests/babysitter-catalog-export.test.ts (13 tests) 358ms
Test Files 1 passed (1)
Tests 13 passed (13)
Start at 01:22:27
Duration 3.14s (transform 759ms, setup 0ms, collect 1.37s, tests 358ms, environment 0ms, prepare 226ms)
Exit: 0
CLI regression follow-up: invokes the real command with offline GitHub responses and covers successful export, EEXIST with byte preservation, and digest refusal without output creation.
$ (cd packages/sdk && npm run build && npm run typecheck:tests && ./node_modules/.bin/vitest run tests/babysitter-catalog-export.test.ts)
> @relayflows/sdk@2.0.25 build
> tsc && node scripts/make-cli-executable.mjs
> @relayflows/sdk@2.0.25 typecheck:tests
> tsc -p tsconfig.tests.json
RUN v2.1.9 /Users/khaliqgant/Projects/AgentWorkforce/flows/packages/sdk
✓ tests/babysitter-catalog-export.test.ts (14 tests) 2030ms
✓ Babysitter catalog artifact export > CLI refuses an existing output and leaves no file on validation failure 1689ms
Test Files 1 passed (1)
Tests 14 passed (14)
Start at 01:35:33
Duration 4.82s (transform 715ms, setup 0ms, collect 1.25s, tests 2.03s, environment 0ms, prepare 293ms)
Exit: 0
[!NOTE]
Low Risk
Adds offline export/validation tooling and docs only; it does not change catalog data, Cloud enablement, or extension execution paths.
Overview
Adds a read-only SDK path to produce a pinned Babysitter FlowExtensionSubmission for the server-owned Software Factory catalog, without publishing an artifact or enabling runtime Babysitter.
exportBabysitterCatalogBundle reuses resolveExtensionSubmission to fetch a canonical AgentWorkforce/flows commit ref, then enforces independently supplied bundle/manifest SHA-256 pins, Software Factory compatibility, the native permission shape (GitHub + Codex, no MCP, only cloud:babysitter-turn), and handlers-only manifests. It returns digest-bound manifest bytes and does not execute handler code. A small CLI writes JSON with wx so failed validation or duplicate runs cannot truncate an existing export.
Vitest covers pin drift, mutable refs, overbroad manifests, byte preservation, and CLI EEXIST / no-output-on-failure behavior. docs/BABYSITTER-CATALOG-HANDOFF.md documents export steps, catalog insertion targets, and explicit blockers (native handler, catalog provenance, lineage/receipts); committed evidence/ captures build/test runs.
Reviewed by Cursor Bugbot for commit b74fb5bcf6901ebc8b29fdc93c84991dd7874c42. Bugbot is set up for automated code reviews on this repo. Configure here.