From 2e60893e87e9e461676e8e892ee99c0246af1abd Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 4 Sep 2026 00:31:59 +0000 Subject: [PATCH] chore(examples): drop stray host-test probe note; add mcp-app typecheck script and make it pass --strict --- examples/host-test/probe-note.txt | 1 - examples/mcp-app/README.md | 4 +++- examples/mcp-app/package.json | 3 ++- examples/mcp-app/src/compiler-status-contract.ts | 11 ++++++++--- .../browser-app/status-panel.browser.test.ts | 9 ++++++--- examples/mcp-app/tsconfig.json | 15 +++++++++++++++ website/docs/en/examples/mcp-app.mdx | 3 ++- website/docs/zh/examples/mcp-app.mdx | 3 ++- 8 files changed, 38 insertions(+), 11 deletions(-) delete mode 100644 examples/host-test/probe-note.txt create mode 100644 examples/mcp-app/tsconfig.json diff --git a/examples/host-test/probe-note.txt b/examples/host-test/probe-note.txt deleted file mode 100644 index 65d6fd4e6..000000000 --- a/examples/host-test/probe-note.txt +++ /dev/null @@ -1 +0,0 @@ -host-test diff --git a/examples/mcp-app/README.md b/examples/mcp-app/README.md index 11404f0b2..7e99937ca 100644 --- a/examples/mcp-app/README.md +++ b/examples/mcp-app/README.md @@ -73,6 +73,7 @@ from the example package: cd examples/mcp-app pnpm validate pnpm build +pnpm typecheck pnpm exec agent-bundle eval --case status-is-healthy --trials 1 pnpm dev ``` @@ -95,6 +96,7 @@ variants, by default. Launch environment precedence is manifest env, then `--env-file ` to replace the conventional files, `--no-env` to skip them, and `--plugin-root ` only for a copied-artifact rehearsal. -Use `pnpm check` for validation and build without opening the Workbench. The +Use `pnpm check` for validation, build, and typecheck without opening the +Workbench. The deterministic portable eval and fixture check read only checked-in data and require no native Claude/Codex login or API key. diff --git a/examples/mcp-app/package.json b/examples/mcp-app/package.json index a629cefcf..00af95fa4 100644 --- a/examples/mcp-app/package.json +++ b/examples/mcp-app/package.json @@ -5,9 +5,10 @@ "type": "module", "scripts": { "build": "agent-bundle build", - "check": "pnpm validate && pnpm build", + "check": "pnpm validate && pnpm build && pnpm typecheck", "dev": "agent-bundle dev", "test:browser-app": "rstest --config rstest.browser-app.config.ts", + "typecheck": "tsc -p tsconfig.json --noEmit", "validate": "agent-bundle validate" }, "devDependencies": { diff --git a/examples/mcp-app/src/compiler-status-contract.ts b/examples/mcp-app/src/compiler-status-contract.ts index 1d17f246b..609c16b2c 100644 --- a/examples/mcp-app/src/compiler-status-contract.ts +++ b/examples/mcp-app/src/compiler-status-contract.ts @@ -17,14 +17,19 @@ export const isHealthyCompilerFixture = (value: unknown): boolean => { || value.service !== healthyCompilerStatus.service || value.status !== healthyCompilerStatus.status || value.summary !== healthyCompilerStatus.summary - || !Array.isArray(value.checks) - || value.checks.length !== healthyCompilerStatus.checks.length ) { return false; } + // Bind the property once: a narrowing on `value.checks` does not survive + // into the `every` callback, so the guard and the indexing share one binding. + const checks: unknown = value.checks; + if (!Array.isArray(checks) || checks.length !== healthyCompilerStatus.checks.length) { + return false; + } + return healthyCompilerStatus.checks.every((expected, index) => { - const received = value.checks[index]; + const received: unknown = checks[index]; return isRecord(received) && received.label === expected.label && received.status === expected.status; diff --git a/examples/mcp-app/tests/browser-app/status-panel.browser.test.ts b/examples/mcp-app/tests/browser-app/status-panel.browser.test.ts index 909cd1513..ccea8f80e 100644 --- a/examples/mcp-app/tests/browser-app/status-panel.browser.test.ts +++ b/examples/mcp-app/tests/browser-app/status-panel.browser.test.ts @@ -1,6 +1,9 @@ import { afterEach, expect, it } from '@rstest/core'; -import { mountBrowserApp, type MountedBrowserApp } from 'agent-bundle/test/browser'; +import { mountBrowserApp, type MountBrowserAppOptions, type MountedBrowserApp } from 'agent-bundle/test/browser'; + +type BindingOperations = MountBrowserAppOptions['operations']; +type ToolCallResult = Awaited>; const statusResult = Object.freeze({ content: Object.freeze([Object.freeze({ @@ -33,10 +36,10 @@ const waitFor = async (predicate: () => boolean, timeoutMs = 2_000): Promise Promise; + readonly callTool?: () => Promise; readonly calls?: string[]; readonly reads?: string[]; -} = {}) => ({ +} = {}): BindingOperations => ({ callTool: async (_bindingId: string, request: { readonly name: string }) => { options.calls?.push(request.name); return options.callTool?.() ?? statusResult; diff --git a/examples/mcp-app/tsconfig.json b/examples/mcp-app/tsconfig.json new file mode 100644 index 000000000..77f8330c8 --- /dev/null +++ b/examples/mcp-app/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "jsx": "react-jsx" + }, + "include": [ + "agent-bundle.config.ts", + "evals/**/*.ts", + "src/**/*.ts", + "src/**/*.tsx", + "tests/**/*.ts", + "tests/**/*.tsx", + "views/**/*.ts" + ] +} diff --git a/website/docs/en/examples/mcp-app.mdx b/website/docs/en/examples/mcp-app.mdx index 404c5dd4a..1cb5db9f8 100644 --- a/website/docs/en/examples/mcp-app.mdx +++ b/website/docs/en/examples/mcp-app.mdx @@ -84,10 +84,11 @@ After the repository-level `pnpm build`: cd examples/mcp-app pnpm validate pnpm build +pnpm typecheck pnpm exec agent-bundle eval --case status-is-healthy --trials 1 ``` -`pnpm check` is the validation-and-build pair without the Workbench. +`pnpm check` runs validation, build, and typecheck without the Workbench. ## Running the server on stdio diff --git a/website/docs/zh/examples/mcp-app.mdx b/website/docs/zh/examples/mcp-app.mdx index d135d322c..cc23f6499 100644 --- a/website/docs/zh/examples/mcp-app.mdx +++ b/website/docs/zh/examples/mcp-app.mdx @@ -74,10 +74,11 @@ description: 'MCP App 示例:把一条服务就绪度工作流表达为生成 cd examples/mcp-app pnpm validate pnpm build +pnpm typecheck pnpm exec agent-bundle eval --case status-is-healthy --trials 1 ``` -`pnpm check` 是不打开 Workbench 的“校验加构建”这一对。 +`pnpm check` 在不打开 Workbench 的情况下依次运行校验、构建和类型检查。 ## 在 stdio 上运行服务器