9b4b38a611
Production OOM'd (JS heap 1.85 GB / 2 GB limit) during a ~20-step,
~28k-chunk autonomous agent turn. Heap snapshot analysis (memlab) showed a
single DefaultStreamTextResult retaining ~1.7 GB via the never-consumed
leftover tee() branch of its internal baseStream.
Root cause in ai@6.0.134: streamText substitutes the default text() output
strategy even when the caller passes NO `output` option. Its
createOutputTransformStream then accumulates the ENTIRE turn text and, on
EVERY text-delta, enqueues `{ part, partialOutput }` where partialOutput is
a flat snapshot of all text so far (JSON.stringify flattens the
cons-string) — O(n²) memory across the turn. Every consumer accessor tees
baseStream and keeps the second branch as the new baseStream; the final
leftover branch is never read, so its controller queue holds every chunk
(28,225 x ~164 KB in the OOM'd run) for the life of the turn.
Fix (pnpm patch on both dist/index.js and dist/index.mjs):
- pass the raw, possibly-undefined `output` option into
createOutputTransformStream instead of defaulting to text()
- when output == null, publish each text-delta immediately without
accumulating turn text or producing partialOutput snapshots; streaming
granularity is unchanged, and callers that DO request an output strategy
keep the original behavior
Our server never uses partialOutputStream / experimental_output / the
output option, so no behavior changes for us beyond memory.
Regression spec ai-sdk-partial-output.patch.spec.ts drives the real
patched SDK with MockLanguageModelV3: asserts per-delta textStream
granularity, an EMPTY experimental_partialOutputStream (tripwire — yields
one cumulative partial per delta when unpatched), and the PATCH(docmost
marker in both installed dist bundles. Also documents the patch in
AGENTS.md (must be re-created when bumping `ai`) and CHANGELOG.md.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
144 lines
4.6 KiB
JSON
144 lines
4.6 KiB
JSON
{
|
|
"name": "docmost",
|
|
"homepage": "https://docmost.com",
|
|
"version": "0.94.1",
|
|
"private": true,
|
|
"scripts": {
|
|
"build": "nx run-many -t build",
|
|
"start": "pnpm --filter ./apps/server run start:prod",
|
|
"collab": "pnpm --filter ./apps/server run collab:prod",
|
|
"collab:dev": "pnpm --filter ./apps/server run collab:dev",
|
|
"server:build": "nx run server:build",
|
|
"client:build": "nx run client:build",
|
|
"editor-ext:build": "nx run @docmost/editor-ext:build",
|
|
"client:dev": "nx run client:dev",
|
|
"server:dev": "nx run server:start:dev",
|
|
"server:start": "nx run server:start:prod",
|
|
"email:dev": "nx run server:email:dev",
|
|
"dev": "pnpm concurrently -n \"frontend,backend\" -c \"cyan,green\" \"pnpm run client:dev\" \"pnpm run server:dev\"",
|
|
"clean": "rm -rf apps/*/dist packages/*/dist apps/client/node_modules/.vite"
|
|
},
|
|
"dependencies": {
|
|
"@braintree/sanitize-url": "^7.1.2",
|
|
"@casl/ability": "6.8.0",
|
|
"@docmost/editor-ext": "workspace:*",
|
|
"@floating-ui/dom": "^1.7.3",
|
|
"@hocuspocus/provider": "3.4.4",
|
|
"@hocuspocus/server": "3.4.4",
|
|
"@hocuspocus/transformer": "3.4.4",
|
|
"@joplin/turndown": "^4.0.82",
|
|
"@joplin/turndown-plugin-gfm": "^1.0.64",
|
|
"@sindresorhus/slugify": "3.0.0",
|
|
"@tiptap/core": "3.20.4",
|
|
"@tiptap/extension-audio": "3.20.4",
|
|
"@tiptap/extension-code-block": "3.20.4",
|
|
"@tiptap/extension-collaboration": "3.20.4",
|
|
"@tiptap/extension-collaboration-caret": "3.20.4",
|
|
"@tiptap/extension-color": "3.20.4",
|
|
"@tiptap/extension-document": "3.20.4",
|
|
"@tiptap/extension-heading": "3.20.4",
|
|
"@tiptap/extension-highlight": "3.20.4",
|
|
"@tiptap/extension-history": "3.20.4",
|
|
"@tiptap/extension-image": "3.20.4",
|
|
"@tiptap/extension-link": "3.20.4",
|
|
"@tiptap/extension-list": "3.20.4",
|
|
"@tiptap/extension-placeholder": "3.20.4",
|
|
"@tiptap/extension-subscript": "3.20.4",
|
|
"@tiptap/extension-superscript": "3.20.4",
|
|
"@tiptap/extension-table": "3.20.4",
|
|
"@tiptap/extension-text": "3.20.4",
|
|
"@tiptap/extension-text-align": "3.20.4",
|
|
"@tiptap/extension-text-style": "3.20.4",
|
|
"@tiptap/extension-typography": "3.20.4",
|
|
"@tiptap/extension-unique-id": "3.20.4",
|
|
"@tiptap/extension-youtube": "3.20.4",
|
|
"@tiptap/html": "3.20.4",
|
|
"@tiptap/pm": "3.20.4",
|
|
"@tiptap/react": "3.20.4",
|
|
"@tiptap/starter-kit": "3.20.4",
|
|
"@tiptap/suggestion": "3.20.4",
|
|
"@tiptap/y-tiptap": "3.0.2",
|
|
"bytes": "^3.1.2",
|
|
"cross-env": "^10.1.0",
|
|
"date-fns": "^4.1.0",
|
|
"diff": "8.0.3",
|
|
"dompurify": "3.4.1",
|
|
"fractional-indexing-jittered": "^1.0.0",
|
|
"highlight.js": "^11.11.1",
|
|
"image-dimensions": "^2.5.0",
|
|
"jszip": "^3.10.1",
|
|
"linkifyjs": "^4.3.2",
|
|
"marked": "17.0.5",
|
|
"ms": "3.0.0-canary.1",
|
|
"qrcode": "^1.5.4",
|
|
"rfc6902": "5.2.0",
|
|
"uuid": "^14.0.0",
|
|
"y-indexeddb": "^9.0.12",
|
|
"y-prosemirror": "1.3.7",
|
|
"yjs": "^13.6.30"
|
|
},
|
|
"devDependencies": {
|
|
"@nx/js": "22.6.1",
|
|
"@types/bytes": "^3.1.5",
|
|
"@types/qrcode": "^1.5.6",
|
|
"@types/turndown": "^5.0.6",
|
|
"concurrently": "^9.2.1",
|
|
"nx": "22.6.1",
|
|
"tsx": "^4.21.0"
|
|
},
|
|
"workspaces": {
|
|
"packages": [
|
|
"apps/*",
|
|
"packages/*"
|
|
]
|
|
},
|
|
"packageManager": "pnpm@10.4.0",
|
|
"pnpm": {
|
|
"patchedDependencies": {
|
|
"scimmy@1.3.5": "patches/scimmy@1.3.5.patch",
|
|
"yjs@13.6.30": "patches/yjs@13.6.30.patch",
|
|
"ai@6.0.134": "patches/ai@6.0.134.patch"
|
|
},
|
|
"overrides": {
|
|
"prosemirror-changeset": "2.4.0",
|
|
"y-prosemirror": "1.3.7",
|
|
"glob": "13.0.6",
|
|
"ws": "8.20.1",
|
|
"dompurify": "3.4.1",
|
|
"tmp": "0.2.6",
|
|
"hono": "4.12.18",
|
|
"mermaid": "11.15.0",
|
|
"nanoid@^3": "3.3.8",
|
|
"socket.io-parser": "4.2.6",
|
|
"serialize-javascript": "7.0.3",
|
|
"lodash-es": "4.18.1",
|
|
"lodash": "4.18.1",
|
|
"@hono/node-server": "1.19.13",
|
|
"undici": "7.24.0",
|
|
"ajv@^6": "6.14.0",
|
|
"ajv@^8": "8.18.0",
|
|
"underscore": "1.13.8",
|
|
"immutable": "4.3.8",
|
|
"express-rate-limit": "8.2.2",
|
|
"minimatch@^3": "3.1.5",
|
|
"minimatch@^5": "5.1.8",
|
|
"flatted": "3.4.2",
|
|
"picomatch@<2.3.2": "2.3.2",
|
|
"picomatch@>=4.0.0 <4.0.4": "4.0.4",
|
|
"fastify": "5.8.5",
|
|
"yaml@>=1.0.0 <1.10.3": "1.10.3",
|
|
"yaml@>=2.0.0 <2.8.3": "2.8.3",
|
|
"path-to-regexp@^8": "8.4.0",
|
|
"brace-expansion@^5": "5.0.6",
|
|
"@xmldom/xmldom": "0.8.13",
|
|
"handlebars": "4.7.9",
|
|
"axios": "1.16.0",
|
|
"langsmith": "0.7.0",
|
|
"follow-redirects": "1.16.0",
|
|
"protobufjs": "7.5.8",
|
|
"ip-address": "10.1.1"
|
|
},
|
|
"neverBuiltDependencies": []
|
|
}
|
|
}
|