Repository navigation
refactor(runtime)!: replace pino and clarinet with built-in code - #8165
Conversation
@copilotkit/runtime no longer depends on pino, clarinet, or @types/clarinet. - core/logger.ts writes the same JSON lines as pino did (number levels, time, component, msg), so `npx pino-pretty` still works. LOG_LEVEL still sets the level. A log call never throws. - ArgsParser for generateSandboxedUi now uses a small internal streaming JSON scanner. The activity events it sends do not change. BREAKING CHANGE: CopilotRuntimeLogger (the type of runtime.debugLogger) is no longer pino's Logger. It has debug, info, warn, error, and child only.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the
|
Production Digest-Pinning AuditAll 43 services digest-pinned. Run 2026-11-03 02:58:05 PST — 0 finding(s). |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/markdown
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/runtime
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
|
Size Change: 0 B Total Size: 2.09 MB ℹ️ View Unchanged
|
The generated snippet tsconfig did not set `types`. TypeScript 6 and later load no @types package unless `types` names it. The snippets only saw `process` through pino's types, and the runtime no longer uses pino.
@copilotkit/runtimeno longer installspino(and its 10 sub-dependencies),clarinet, or@types/clarinet. The runtime now has its own small JSON-lines logger and a small streaming JSON scanner. The debug log lines and the Open Generative UI events do not change. Only theCopilotRuntimeLoggertype is smaller.What does this PR do?
core/logger.tswrites one JSON line per log withconsole.log, in the same shape that pino wrote:{"level":20,"time":...,"component":"copilotkit-debug",...,"msg":"..."}.npx pino-prettystill formats the output.LOG_LEVELstill sets the level. It also acceptstrace,fatal, andsilent. An unknown value falls back toerror.Erroris written as{ type, message, stack }. A circular reference is written as"[Circular]".event-transforms/streaming-json-scanner.tsreplaces clarinet inArgsParser(thegenerateSandboxedUitool-call streaming).\uXXXXescape or a surrogate pair.debugLoggermethods. The debug-mode pages say "JSON logs in the pino format".types: ["node"]. TypeScript 6 and later load no@typespackage unlesstypesnames it. The snippets gotprocessonly through pino's types, so without pino, 18 snippets failed withTS2591: Cannot find name 'process'.fflatestays as it is.BREAKING CHANGE:
CopilotRuntimeLogger(the type ofruntime.debugLogger) is no longer pino'sLogger. It hasdebug,info,warn,error, andchildonly. If your code calls other pino methods onruntime.debugLogger(for exampletrace,fatal,level, orflush), change it to use these 5 methods.Related PRs and Issues
Checklist
!(for examplefeat(react-core)!: ...) and the description has aBREAKING CHANGE:line with migration steps. See VERSIONING.mdTesting
Commands run (local, light checks only):
vitest runon the changed and new test files inpackages/runtime: 7 files passed, 74 tests in total.logger.test.ts(new, 15)streaming-json-scanner.test.ts(new, 12)debug-sse-response.test.ts,sse-connect-agent-id.test.ts,handle-suggest.test.tsopen-generative-ui-middleware.e2e.test.ts(22, no expected event changed),recorded-events.test.tstsc --noEmitonpackages/runtime: no errors in the changed files. The other errors locally areCannot find module '@copilotkit/channels*', because I did not build those workspace packages. CI builds them.oxfmt --checkon the changed files: clean.pnpm install --frozen-lockfilewith the new lockfile: passes.@copilotkit/runtime, then ran the snippettsccheck on the 18 snippets that failed in CI. Before the harness fix:TS2591(reproduced on the mastra quickstart). After: all 18 pass.Skipped, CI runs them: the full runtime test suite,
publint,attw, builds, and E2E. I also skipped thetest-packagespre-commit hook step, for the same reason.Manual test:
new CopilotRuntime({ ..., debug: true })."component":"copilotkit-debug". Pipe them throughnpx pino-prettyto see the formatted output.How this PR makes testing easy:
streaming-json-scanner.test.tswrites a sample at every split point and compares the events to a fixed list.logger.test.tscovers the line shape, levels,LOG_LEVEL,child,Error, and circular values.Risk / rollback
runtime.debugLoggerstops compiling. The migration page covers this.Public API change
Before
After