Skip to content

feat: add instrument.ts harness bridge#26

Merged
Cedric / ViaDézo1er (viadezo1er) merged 45 commits into
mainfrom
cedric/revamp-onboarding-pi-instrument
May 18, 2026
Merged

feat: add instrument.ts harness bridge#26
Cedric / ViaDézo1er (viadezo1er) merged 45 commits into
mainfrom
cedric/revamp-onboarding-pi-instrument

Conversation

@viadezo1er
Copy link
Copy Markdown
Collaborator

@viadezo1er Cedric / ViaDézo1er (viadezo1er) commented May 11, 2026

Adds src/instrument.ts: the bridge between the wizard and the harness.

  • ensureBtOnPath — installs bt via curl -fsSL https://bt.dev/cli/install.sh | bash on macOS/Linux if it's not already on PATH
  • writePromptToTemp — writes the rendered prompt to a temp file and returns the path
  • buildHarnessCommand — constructs the copy-paste command to resume the agent session
  • runInstrumentation — resolves the harness binary, spawns it with BRAINTRUST_API_KEY in the env, and returns the trace permalink and resume command when done

LOGO_PATTERN only matched ▀▄ (half-blocks from PNG rendering) but not █
(full-blocks from the fallback logo). In environments where the PNG fails
to load, all three logo-presence assertions would fail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-harness branch from 631014f to 362e114 Compare May 11, 2026 22:33
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-instrument branch 2 times, most recently from 2d58db1 to c91eb23 Compare May 11, 2026 23:08
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-harness branch from 362e114 to e944e5f Compare May 11, 2026 23:08
Comment on lines +9 to +25
const HARNESS_PACKAGE_BIN =
"@braintrust/bt-wizard-harness/bin/bt-wizard-harness.mjs";

function resolveHarnessPath():
| { readonly ok: true; readonly path: string }
| { readonly ok: false; readonly reason: string } {
try {
const require = createRequire(import.meta.url);
return { ok: true, path: require.resolve(HARNESS_PACKAGE_BIN) };
} catch (err) {
return {
ok: false,
reason: err instanceof Error ? err.message : String(err),
};
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is funky

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in 21edc1c.

@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-harness branch from e944e5f to 9505984 Compare May 12, 2026 19:40
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-instrument branch from c91eb23 to 8c28ff9 Compare May 12, 2026 19:40
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-instrument branch from 8c28ff9 to 75a11f8 Compare May 12, 2026 20:33
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-harness branch 2 times, most recently from 33024f9 to 602893c Compare May 12, 2026 22:02
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-instrument branch from 75a11f8 to 2fc0466 Compare May 12, 2026 22:02
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-harness branch from 602893c to a17984f Compare May 12, 2026 22:38
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-instrument branch from 2fc0466 to 1899c3c Compare May 12, 2026 22:38
Replace the single password prompt for provider API keys with
collectCredentials(), which loops over provider.credentials for
multi-field providers (Bedrock, Vertex, Azure) and falls back to a
single secret prompt for single-key providers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All wizard source, tests, and build configs move from the repo root into
packages/braintrust-wizard so nothing lives half at root / half in packages.
Root package.json becomes a lean workspace root that delegates scripts via
--filter and -r. The bt-wizard-harness scaffold gains ESLint, TypeScript,
and Prettier configs plus the corresponding devDependencies and scripts.
parseArgs is async but was called without await, making parsed a Promise
and causing parsed.options to be undefined at runtime. Awaiting it fixes
the crash. The manual --help branch and helpText export are removed since
yargs' built-in .help() already handles --help by printing and exiting
during parseAsync.
Drop bin/files/typings from bt-wizard-harness (no source files yet),
fix typebox → @sinclair/typebox, and resolve two exactOptionalPropertyTypes
errors in clack-wizard.ts and providers.test.ts so pnpm -r run typings passes.
All wizard source, tests, and build configs move from the repo root into
packages/braintrust-wizard so nothing lives half at root / half in packages.
Root package.json becomes a lean workspace root that delegates scripts via
--filter and -r. The bt-wizard-harness scaffold gains ESLint, TypeScript,
and Prettier configs plus the corresponding devDependencies and scripts.
@viadezo1er Cedric / ViaDézo1er (viadezo1er) changed the base branch from cedric/revamp-onboarding-pi-harness to main May 15, 2026 16:56
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-instrument branch from 737e73e to 31052d3 Compare May 15, 2026 17:18
@viadezo1er Cedric / ViaDézo1er (viadezo1er) marked this pull request as ready for review May 15, 2026 18:44
Replace the providerEnvVar/providerApiKey pair with
providerCredentials?: Record<string, string>, spread directly into the
child process env. Supports multi-credential providers (Bedrock, Vertex,
Azure) alongside existing single-key providers.
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-instrument branch from e95def8 to d332b37 Compare May 15, 2026 18:54
@viadezo1er
Copy link
Copy Markdown
Collaborator Author

Rebased against cedric/revamp-onboarding-pi-harness, only change was a comment.

Declare a bin entry in @braintrust/bt-wizard-harness and resolve it from
the wizard via import.meta.resolve + fileURLToPath. Drops the createRequire
shim and the harness-not-found result branch — if resolution fails, that's
a broken install, so let it throw at module load.
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/revamp-onboarding-pi-instrument branch from 212dae0 to 21edc1c Compare May 15, 2026 19:09
@viadezo1er
Copy link
Copy Markdown
Collaborator Author

Fixed formatting.

@viadezo1er Cedric / ViaDézo1er (viadezo1er) merged commit 9c0ad32 into main May 18, 2026
4 checks passed
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.

2 participants