Read tools (getPage, getPageJson, getNode, diffPageVersions, exportPageMarkdown) return whole pages with no size cap. Their outputs were stored verbatim in metadata.parts and the tool_calls column, and metadata.parts is replayed to the provider on every later turn via convertToModelMessages. After reading a couple of large pages the prompt grew by full page bodies each turn — rising token cost, latency and DB row size. Add compactToolOutput(): a pure, recursive, size-bounded compactor used in assistantParts() and serializeSteps(). It preserves the value's kind and small scalar fields (id/title/pageId, which the client reads to build citations on reload) while truncating long strings, capping long arrays with a marker, and collapsing subtrees past a depth limit. Small outputs are returned unchanged by identity. Tool inputs are left intact so replayed tool_use arguments keep their object shape. Compaction runs only at persistence time (onFinish/onAbort), so the live stream and the current turn's multi-step reasoning still see full bodies. Add unit tests for compactToolOutput.
A progressive Node.js framework for building efficient and scalable server-side applications.
Description
Nest framework TypeScript starter repository.
Installation
$ npm install
Running the app
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Migrations
# This creates a new empty migration file named 'init'
$ npm run migration:create --name=init
# Generates 'init' migration file from existing entities to update the database schema
$ npm run migration:generate --name=init
# Runs all pending migrations to update the database schema
$ npm run migration:run
# Reverts the last executed migration
$ npm run migration:revert
# Reverts all migrations
$ npm run migration:revert
# Shows the list of executed and pending migrations
$ npm run migration:show
## Test
```bash
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
License
Nest is MIT licensed.