feat(agent-profile-cell): AGENT_PROFILE_KINDS + toAgentProfileJson + buildSandboxAgentProfileCell#86
Merged
Conversation
…fileCell Closes #82. Two pieces of boilerplate every product consuming `buildAgentProfileCell` has been duplicating — gtm-agent #137, blueprint-agent #1756/#1757: 1. A `JSON.parse(JSON.stringify(value))` helper that canonicalizes an arbitrary sandbox-SDK `AgentProfile` into `AgentProfileJson`, with a fail-loud error when the profile is not JSON-serializable. 2. The magic string `'sandbox-agent-profile'` for `sourceProfile.kind`. Both belong here so the cross-product cell join (same canonical profile hashes to the same `sourceProfile.hash` across products) is enforced by the type system, not by every consumer remembering to do it right. Exports: - `AGENT_PROFILE_KINDS` — typed const with `SANDBOX_AGENT_PROFILE`. Open for extension when new profile shapes land. - `toAgentProfileJson(value)` — JSON round-trip with `AgentProfileCell- ValidationError` on functions / BigInt / cycles / `undefined` results. - `buildSandboxAgentProfileCell(profile, rest)` — higher-level wrapper that hard-codes `profileId = ${name}@${version}` and the sandbox kind, reserving the manual `buildAgentProfileCell` call for advanced cases. 11 new tests; full suite 1326/1326 pass; `tsc --noEmit` clean. Tests explicitly verify the cross-product invariant — a hand-rolled cell call following the README recipe produces the identical hash to the helper.
drewstone
added a commit
that referenced
this pull request
May 23, 2026
…uildSandboxAgentProfileCell (#86 patch release)
drewstone
added a commit
that referenced
this pull request
May 23, 2026
…uildSandboxAgentProfileCell (#86 patch release)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #82.
What
Two pieces of boilerplate every product consuming
buildAgentProfileCellhas been duplicating — gtm-agent#137, blueprint-agent#1756 / #1757:JSON.parse(JSON.stringify(value))helper that canonicalizes an arbitrary sandbox-SDKAgentProfileintoAgentProfileJson, with a fail-loud error when the profile is not JSON-serializable.'sandbox-agent-profile'forsourceProfile.kind.Both belong here so the cross-product cell join (same canonical profile hashes to the same
sourceProfile.hashacross products) is enforced by the type system, not by every consumer remembering to do it right.API additions
buildSandboxAgentProfileCellis the higher-level wrapper — hard-codesprofileId = \${name}@${version}`and thesandbox-agent-profilekind. The manualbuildAgentProfileCell` call stays for advanced cases (custom kinds, pre-computed source hashes, alternate profileId conventions).Verification
tsc --noEmitclean.buildAgentProfileCellcall following the documented README recipe produces the identicalsourceProfile.hash+cellIdasbuildSandboxAgentProfileCell. Two products converging on this helper are guaranteed to hash the same canonical profile identically.Downstream
eval/agent-profile-cell.tscan delete its localtoAgentProfileJsonand import the canonical one.scripts/experiments/lib/agent-profile-cell.ts(currently shipping its ownsandboxAgentProfileToJson+ the magic string) will follow up with a PR collapsing the duplication.