Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ff67c6d
fix(benchmarks): reject unfair empty-gold TB negatives
datduyng Aug 8, 2026
56e8c81
fix(benchmarks): LLM-judge empty-gold TB negative fairness
datduyng Aug 8, 2026
a56534e
style: apply prettier formatting and policy fixes
typeagent-bot[bot] Aug 8, 2026
5c7d3de
refactor(benchmarks): clean negative fairness assessment gate
datduyng Aug 8, 2026
fff48b6
refactor(benchmarks): tighten negative fairness module + order-pair test
datduyng Aug 8, 2026
1693f21
docs: regenerate README.AUTOGEN.md, command reference, and action bro…
typeagent-bot[bot] Aug 8, 2026
6a09a86
fix(benchmarks): path-key negativeAssessments for TB empty-gold fairness
datduyng Aug 8, 2026
0b840b1
style: apply prettier formatting and policy fixes
typeagent-bot[bot] Aug 8, 2026
4e1dfc8
refactor(benchmarks): strip negative fairness error string noise
datduyng Aug 8, 2026
e713517
style: apply prettier formatting and policy fixes
typeagent-bot[bot] Aug 8, 2026
b6e33fe
fix(benchmarks): parallel TB generation + empty-params validation
datduyng Aug 8, 2026
7365cd3
docs: regenerate README.AUTOGEN.md, command reference, and action bro…
typeagent-bot[bot] Aug 8, 2026
84f9daa
fix(benchmarks): empty-gold must be zero-action under full catalog
datduyng Aug 8, 2026
26e2e76
refactor(benchmarks): path-map negative fairness without regex parse
datduyng Aug 8, 2026
71f800c
fix(benchmarks): partial gen when coverage optional; required nested …
datduyng Aug 8, 2026
cf50c60
fix(benchmarks): derive coverage/caseCount from emitted cases on part…
datduyng Aug 8, 2026
7e6f307
refactor(benchmarks): single source of truth for fair empty-gold kinds
datduyng Aug 8, 2026
9b6652e
feat(benchmarks): fairer TB generation — param specs, non-eval action…
datduyng Aug 9, 2026
a8f8d61
style: apply prettier formatting and policy fixes
typeagent-bot[bot] Aug 9, 2026
44fe92a
fix(benchmarks): address review — negativeKind label match, atomic ch…
datduyng Aug 9, 2026
b913ab0
fix(tb-synth): detect cross-schema confusable colliders
datduyng Aug 9, 2026
974f5fe
feat(benchmarks): package LLM eligible-gold allowlist under policy/
datduyng Aug 9, 2026
e950dd0
style: apply prettier formatting and policy fixes
typeagent-bot[bot] Aug 9, 2026
7061509
fix(benchmarks): remove chat.generateResponse and system.help.answerT…
datduyng Aug 10, 2026
bfb37f9
style: apply prettier formatting and policy fixes
typeagent-bot[bot] Aug 10, 2026
0d59f46
fix(benchmarks): drop lookupAndAnswerConversation from eligible actions
datduyng Aug 10, 2026
bb1c440
docs: regenerate README.AUTOGEN.md, command reference, and action bro…
typeagent-bot[bot] Aug 10, 2026
93ecbb8
fix(benchmarks): explicitly include single-turn media and hardware co…
datduyng Aug 10, 2026
b4bb504
feat(benchmarks): require per-action explanation in eligible-gold picker
datduyng Aug 10, 2026
e355faf
feat(benchmarks): add local TB runner, global TPM limiter, and named-…
datduyng Aug 10, 2026
414cb04
style: apply prettier formatting and policy fixes
typeagent-bot[bot] Aug 10, 2026
a19d7f7
refactor(benchmarks): extract cross-process TPM limiter + run config …
datduyng Aug 10, 2026
280fb0c
docs: regenerate README.AUTOGEN.md, command reference, and action bro…
typeagent-bot[bot] Aug 10, 2026
b77c420
feat(benchmarks): add model-agnostic prompt-token estimator
datduyng Aug 10, 2026
cb11312
Merge remote-tracking branch 'origin/main' into _heal
typeagent-bot[bot] Aug 11, 2026
5542b75
docs: regenerate README.AUTOGEN.md, command reference, and action bro…
typeagent-bot[bot] Aug 11, 2026
375ae29
feat(tb): restore cue-based utterance disambiguation gate
datduyng Aug 11, 2026
a8a7241
feat(tb): add production translation-bench runner and CLIs
datduyng Aug 11, 2026
224138f
fix(tb): address deep-review correctness findings
datduyng Aug 11, 2026
4d3aafb
chore(tb): remove unused runner fixtures
datduyng Aug 11, 2026
44dffcb
fix(tb-synth): gate empty-gold negatives on utterance shape
datduyng Aug 11, 2026
bc886a8
fix(dispatcher): keep unknown abstention from throwing
datduyng Aug 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ts/packages/benchmarks/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules/
dist/
data/
results/
local/
*.tsbuildinfo
72 changes: 72 additions & 0 deletions ts/packages/benchmarks/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# @typeagent/benchmarks — agent notes

## Layout

- `src/core/` — domain-agnostic infrastructure.
- `rateLimiter.ts` — cross-process tokens-per-minute limiter (shared SQLite).
- `tokenEstimate.ts` — model-agnostic prompt token estimate for reservations.
- `src/translationBench/`
- `runConfig.ts` + `config.schema.json` — pure JSON run-config loader/resolver.
- `synthesizer/` — dataset generation, quality gates, negative fairness.
- `runner/` — suite execution, scoring, checkpoints, reports, explainer.
- `policy/` — eligible-gold allowlist + action quality picker.
- `scripts/tbEval.ts`, `scripts/tbGenerate.ts` — thin production CLIs.
- Assets (`config.schema.json`, prompt packs) are copied to `dist/` by
`scripts/copyAssets.mjs` during build.

## Config: JSON + commander, no `TB_*` env

Run configuration is a JSON file validated by `config.schema.json`. Runtime
overrides are **commander flags**, prop-drilled into the library — do not read
`process.env.TB_*`.

```bash
# eval (requires a pre-approved artifact; never auto-approves)
node dist/translationBench/scripts/tbEval.js \
--draft ./artifacts/benchmark-draft-1000.jsonl \
--approved ./artifacts/benchmark-approved-1000.jsonl \
--config ./run-config.json \
--batch eval

# generate
node dist/translationBench/scripts/tbGenerate.js \
--source ./source/anchors.jsonl \
--manifest ./source/source-manifest.json \
--config ./run-config.json \
--batch synthesizer
```

`tb-eval` refuses to mint `approval.status: "approved"` and fails when draft
content drifts from the approved file. See
`src/translationBench/config/run-config.example.json`.

## Credential env boundary

`OPENAI_*` / `AZURE_*` env is the `@typeagent/aiclient` contract
(`initRuntimeConfigFromProcessEnv()`) and is intentionally kept.

## TPM rate limiter

`createRateLimiter(tpmLimits, { dbPath, estTokensPerCall, maxWaitMs?, onWait? })`
requires `dbPath`. Concurrent `run()` calls reserve tokens against the shared
SQLite ledger over a rolling 60s window and settle to actual usage.

## Runner library

Import via package subpath (not star-exported from the main barrel — names
overlap synthesizer checkpoint helpers):

```ts
import {
runTranslationBench,
scoreTranslationBench,
} from "@typeagent/benchmarks/translationBench/runner";
```

Callers own dispatcher bootstrap (`initializeCommandHandlerContext`). The runner
only crosses into agent-dispatcher at `translateRequest`.

## local/ is gitignored

Scratch run artifacts stay under `local/` (gitignored). Committed code lives
under `src/`.
14 changes: 7 additions & 7 deletions ts/packages/benchmarks/README.AUTOGEN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!-- AUTOGEN:DOCS:START -->

<!-- AUTOGEN:DOCS:HASH:sha256=04ffc6fa34cfbe0d06383b4e35423fc5a203f9c3bd8b8f07c91c20b2cef9903c -->
<!-- AUTOGEN:DOCS:HASH:sha256=d90f01503aa167c441eaf2d3c2a5086314545f404a3eea19a573fdcc3c423963 -->
<!-- AUTOGEN:DOCS:SOURCE: ./README.md (hand-written documentation; this file is the AI-generated companion) -->

# @typeagent/benchmarks — AI-generated documentation
Expand Down Expand Up @@ -34,7 +34,7 @@ Workspace:
- [agent-dispatcher](../../packages/dispatcher/dispatcher/README.md)
- [default-agent-provider](../../packages/defaultAgentProvider/README.md)

External: `commander`, `js-yaml`, `zod`
External: `commander`, `gpt-tokenizer`, `js-yaml`, `zod`

### Used by

Expand All @@ -44,18 +44,18 @@ _None._

- [./src/index.ts](./src/index.ts)
- [./src/translationBench/index.ts](./src/translationBench/index.ts)
- [./src/translationBench/synthesizer/catalogGenerator/index.ts](./src/translationBench/synthesizer/catalogGenerator/index.ts)
- [./src/translationBench/policy/index.ts](./src/translationBench/policy/index.ts)
- [./src/translationBench/synthesizer/index.ts](./src/translationBench/synthesizer/index.ts)
- [./src/core/model-prices.generated.json](./src/core/model-prices.generated.json)
- [./src/core/paths.ts](./src/core/paths.ts)
- [./src/core/prices.ts](./src/core/prices.ts)
- [./src/core/rateLimiter.ts](./src/core/rateLimiter.ts)
- [./src/core/tokenEstimate.ts](./src/core/tokenEstimate.ts)
- [./src/core/types.ts](./src/core/types.ts)
- [./src/translationBench/action-parameters-grader.generated.json](./src/translationBench/action-parameters-grader.generated.json)
- [./src/translationBench/catalog.generated.json](./src/translationBench/catalog.generated.json)
- _…and 29 more under `./src/`._
- _…and 44 more under `./src/`._

---

_Auto-generated against commit `54efea2e226011740764eddb4beee99edc562313` on `2026-08-08T00:27:51.771Z` by `docs-generate.yml`. Links validated at that commit; the working tree may have drifted by up to 24h. Re-run `pnpm --filter @typeagent/benchmarks docs:verify-links` to spot-check._
_Auto-generated against commit `cb113126e39f7f4c5ebb1ec3603a78ecf5241572` on `2026-08-11T01:06:02.321Z` by `docs-generate.yml`. Links validated at that commit; the working tree may have drifted by up to 24h. Re-run `pnpm --filter @typeagent/benchmarks docs:verify-links` to spot-check._

<!-- AUTOGEN:DOCS:END -->
9 changes: 8 additions & 1 deletion ts/packages/benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ Action-translation eval for TypeAgent: pinned catalogs, model prices, and scorin

## Catalog + action-parameters grader

Pinned `catalog.generated.json` and `action-parameters-grader.generated.json`. Code/script parameters use verify mode `llmAsAJudge` (not exact); synthesizer exclusions are derived from those fields. Regenerate with `pnpm run gen-catalog` (`--force` full rebuild). Tests: `pnpm run test:local`.
Pinned `catalog.generated.json` and `action-parameters-grader.generated.json`.

Human policy lives in `src/translationBench/policy/action-eligibility.json` (+ `.schema.json`):

- **`removedActions`** — actions that must not be gold targets (`type: "action"` exact ids, or `type: "prefix"` `onboarding.*` only). They stay in the catalog for routing.
- **`parameterOverrides`** — pin per-field **`verify`** only (`type: "field"`). `create` is never set in policy; type/regex derive minting. Override paths are skipped by the LLM classifier when regenerating the grader.

Regenerate grader: `pnpm run gen-policy` (alias `gen-action-parameters-grader`). Full catalog+grader: `pnpm run gen-catalog`. Tests: `pnpm run test:local`.

## Dataset synthesizer (part 3)

Expand Down
15 changes: 11 additions & 4 deletions ts/packages/benchmarks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"exports": {
".": "./dist/index.js",
"./translationBench": "./dist/translationBench/index.js",
"./internal": "./dist/index.js"
"./internal": "./dist/index.js",
"./translationBench/runner": "./dist/translationBench/runner/index.js"
},
"files": [
"dist",
Expand All @@ -23,22 +24,28 @@
"scripts": {
"build": "tsc -b && node ./scripts/copyAssets.mjs",
"clean": "node ./scripts/clean.mjs",
"gen-action-parameters-grader": "pnpm run build && node --max-old-space-size=4096 dist/translationBench/scripts/genActionParametersGrader.js",
"gen-catalog": "pnpm run build && node --max-old-space-size=4096 dist/translationBench/scripts/genCatalog.js && node --max-old-space-size=4096 dist/translationBench/scripts/genActionParametersGrader.js",
"gen-action-parameters-grader": "pnpm run gen-policy",
"gen-catalog": "pnpm run build && node --max-old-space-size=4096 dist/translationBench/scripts/genCatalog.js && node --max-old-space-size=4096 dist/translationBench/scripts/genPolicy.js && node --max-old-space-size=4096 dist/translationBench/scripts/pickEligibleActions.js --model ${TB_PICKER_MODEL:-azure/gpt-5.6-sol} && node ./scripts/copyAssets.mjs",
"gen-policy": "pnpm run build && node --max-old-space-size=4096 dist/translationBench/scripts/genPolicy.js && node ./scripts/copyAssets.mjs",
"jest-esm": "node --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js",
"pick-eligible-actions": "pnpm run build && node --max-old-space-size=4096 dist/translationBench/scripts/pickEligibleActions.js --model ${TB_PICKER_MODEL:-azure/gpt-5.6-sol} && node ./scripts/copyAssets.mjs",
"prettier": "prettier --check package.json tsconfig.json src scripts test --ignore-path ../../.prettierignore",
"prettier:fix": "prettier --write package.json tsconfig.json src scripts test --ignore-path ../../.prettierignore",
"test": "npm run test:local",
"test:local": "pnpm run build && pnpm run jest-esm --testPathPattern=\".*[.]spec[.]js\"",
"tsc": "tsc -b"
"tsc": "tsc -b",
"tb-eval": "node ./dist/translationBench/scripts/tbEval.js",
"tb-generate": "node ./dist/translationBench/scripts/tbGenerate.js"
},
"dependencies": {
"@typeagent/action-schema": "workspace:*",
"@typeagent/agent-cache": "workspace:*",
"@typeagent/agent-sdk": "workspace:*",
"@typeagent/aiclient": "workspace:*",
"agent-dispatcher": "workspace:*",
"commander": "^12.1.0",
"default-agent-provider": "workspace:*",
"gpt-tokenizer": "^2.9.0",
"js-yaml": "^4.3.0",
"zod": "^4.1.13"
},
Expand Down
57 changes: 56 additions & 1 deletion ts/packages/benchmarks/scripts/copyAssets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,36 @@ const files = [
"src/translationBench/action-parameters-grader.generated.json",
"dist/translationBench/action-parameters-grader.generated.json",
],
[
"src/translationBench/eligible-gold-actions.generated.json",
"dist/translationBench/eligible-gold-actions.generated.json",
],
[
"src/translationBench/config.schema.json",
"dist/translationBench/config.schema.json",
],
[
"src/translationBench/config/run-config.example.json",
"dist/translationBench/config/run-config.example.json",
],
[
"src/core/model-prices.generated.json",
"dist/core/model-prices.generated.json",
],
];

const requiredGenerated = new Set([
"src/translationBench/catalog.generated.json",
"src/translationBench/action-parameters-grader.generated.json",
"src/translationBench/eligible-gold-actions.generated.json",
"src/translationBench/policy/action-eligibility.json",
]);
for (const [fromRel, toRel] of files) {
copyFileFast(path.join(root, fromRel), path.join(root, toRel));
const from = path.join(root, fromRel);
if (requiredGenerated.has(fromRel) && !existsSync(from)) {
throw new Error(`copyAssets: missing required asset ${fromRel}`);
}
copyFileFast(from, path.join(root, toRel));
}

const yamlSrc = path.join(root, "src/translationBench/synthesizer");
Expand All @@ -70,6 +92,39 @@ if (existsSync(yamlSrc)) {
}
}

const policyFiles = [
[
"src/translationBench/policy/action-eligibility.json",
"dist/translationBench/policy/action-eligibility.json",
],
[
"src/translationBench/policy/action-eligibility.schema.json",
"dist/translationBench/policy/action-eligibility.schema.json",
],
];
for (const [fromRel, toRel] of policyFiles) {
const from = path.join(root, fromRel);
if (!existsSync(from)) {
throw new Error(`copyAssets: missing required asset ${fromRel}`);
}
copyFileFast(from, path.join(root, toRel));
}

const policyYamlSrc = path.join(root, "src/translationBench/policy");
const policyYamlDst = path.join(root, "dist/translationBench/policy");
if (existsSync(policyYamlSrc)) {
for (const name of readdirSync(policyYamlSrc, { withFileTypes: true })) {
if (!name.isFile()) continue;
if (!name.name.endsWith(".yaml") && !name.name.endsWith(".yml")) {
continue;
}
copyFileFast(
path.join(policyYamlSrc, name.name),
path.join(policyYamlDst, name.name),
);
}
}

const seedSrc = path.join(root, "src/translationBench/synthesizer/seed");
const seedDst = path.join(root, "dist/translationBench/synthesizer/seed");
if (existsSync(seedSrc)) {
Expand Down
Loading