Repository navigation
AGE-2642: feat: accept x-tfg-tools so a turn can mount ask_user_secret - #1194
Conversation
A TrueFoundry-mode turn can enable the client-side secret tool on the root agent. The header is not stored, and the secret value never enters the harness. Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
🦋 Changeset detectedLatest commit: 80830a7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Callers send the name, description, and JSON schema for each client-side tool. The harness mounts that list on the root agent for the turn. Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
Without a host secret form, the composer offered a plaintext answer and stored it as the ask_user_secret result. Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
This package no longer special-cases the secret tool. The host that sends x-tfg-tools owns the form. Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
Qodex review(no summary) Effort: ●●●○○ (3/5) · No findings worth raising. The diff reads clean. Since last review: 0 addressed, 0 new. Scope: the changes since the last review (delta: only what changed since the previously reviewed commit bee24f3 is reviewed; findings are anchored on the whole change). Qodex review threads: 0 open, 1 resolved by Qodex, 2 resolved by a reviewer. WalkthroughWhat Qodex checkedLenses (openqodex review with checked answers, all dimensions)
Scanners
Quality filters
Verification (M1b probes against PR preview)
Cross-review dedup
Output
Reviewer: 0 tool calls served, 0 model calls, 0 correction rounds, 0.0s. The library does not report tool calls asked apart from those it served, or a step cap. Every dimension is reviewed. Bugs, security, and performance post inline; low-severity style and convention notes are collected in the group above rather than dropped. Mark a finding resolved or flag a false positive in the Qodex Pull Requests view. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bee24f3. Configure here.
* AGE-2642: feat: accept x-tfg-tools so a turn can mount ask_user_secret (#1194) * feat: accept x-tfg-tools so a turn can mount ask_user_secret A TrueFoundry-mode turn can enable the client-side secret tool on the root agent. The header is not stored, and the secret value never enters the harness. Signed-off-by: Raman Tehlan <ramantehlan@gmail.com> * feat: accept tool definitions in x-tfg-tools Callers send the name, description, and JSON schema for each client-side tool. The harness mounts that list on the root agent for the turn. Signed-off-by: Raman Tehlan <ramantehlan@gmail.com> * fix: keep a typed secret out of the tool result Without a host secret form, the composer offered a plaintext answer and stored it as the ask_user_secret result. Signed-off-by: Raman Tehlan <ramantehlan@gmail.com> * fix: leave ask_user_secret rendering to the host frontend This package no longer special-cases the secret tool. The host that sends x-tfg-tools owns the form. Signed-off-by: Raman Tehlan <ramantehlan@gmail.com> * review comments * review comments: replace definiation with schema * Move assert tfgToolsHeader to turns.ts * review comment, fix drop of output schema * restructure to add capabilitiesStore --------- Signed-off-by: Raman Tehlan <ramantehlan@gmail.com> * Regenerate OpenAPI document and SDKs --------- Signed-off-by: Raman Tehlan <ramantehlan@gmail.com> Co-authored-by: trueforge-dev-bot[bot] <trueforge-dev-bot[bot]@users.noreply.github.com>

Summary
A TrueFoundry-mode turn can send
x-tfg-toolsas a JSON array of tool definitions (name,description,parameters). Those tools mount on the root agent for that turn. The header is not stored, child threads do not get the tools, and a secret value never enters the harness. Without a host form forask_user_secret, the composer does not accept a typed secret.Closes #
Changes
x-tfg-toolsas tool definitions and reject a bad payload, a reserved name, or use outside TrueFoundry mode.ask_user_secretcard in live chat. If no host secret form is registered, the composer shows a notice instead of a plaintext answer.How was this tested?
pnpm --filter @truefoundry/trueforge exec jest --config jest.unit.config.cjs -- tests/unit/truefoundry/tfgTools.test.ts tests/unit/truefoundry/TrueFoundryTurnResourceResolver.test.tspnpm --filter @truefoundry/trueforge-ui exec vitest run test/hooks/useComposerPauseView.test.tsx test/containers/AskUserContainer.test.tsx test/containers/ComposerContainer.test.tsx test/containers/ToolCallContainer.test.tsxpnpm exec eslinton the changed source files with--max-warnings=0Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,python/trueforge_sdk,.github/fern/openapi/openapi.json,docs/openapi.json). Fork PRs omit SDK regen; maintainers regenerate after merge..env.exampleupdated if configuration or behavior changedNote
Medium Risk
Adds a new per-turn tool surface on the main agent thread with client-side execution semantics; validation and TrueFoundry-only gating limit exposure, but tool metadata affects what the model can invoke.
Overview
TrueFoundry-mode HTTP turns can now send
x-tfg-tools: a JSON array of MCP tool definitions (inputSchema, optionaloutputSchemaandannotations). The server parses and validates the header before a turn id is minted, rejects use outside TrueFoundry mode, and does not persist it (resumed turns must resend the header). Schedule runs omit the header and mount nothing.Parsed tools become client-side system tools on the root agent thread only via a new
rootCapabilitieshook onTurnResourceResolver; sub-agents do not inherit them. Server-side execution returns a client-side-required response instead of running the tool in the harness.LocalToolMCP.listToolsnow forwardsoutputSchemaandannotationsso discovery and selector policy match full tool metadata (needed for tools likeask_user_secret).Reviewed by Cursor Bugbot for commit 80830a7. Bugbot is set up for automated code reviews on this repo. Configure here.