Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/deps-patch-minor-147.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'thinker': patch
---

Bump patch and minor dependencies (NestJS 11.2, Vite 6.4, pg, zod, modelparams 0.0.72 and others) and read the modelparams catalog in both of its data.js layouts.
1,030 changes: 542 additions & 488 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@
},
"devDependencies": {
"@changesets/cli": "^3.0.3",
"@typescript-eslint/eslint-plugin": "^8.69.0",
"@typescript-eslint/parser": "^8.56.0",
"@typescript-eslint/eslint-plugin": "^8.71.1",
"@typescript-eslint/parser": "^8.71.1",
"ajv": "8.20.0",
"eslint": "^10.10.0",
"eslint": "^10.12.0",
"eslint-config-prettier": "^10.1.8",
"husky": "^9.1.7",
"lint-staged": "^17.4.1",
"prettier": "^3.9.6",
"lint-staged": "^17.6.0",
"prettier": "^3.9.10",
"turbo": "^2"
}
}
38 changes: 19 additions & 19 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
"backfill:requests:prod": "node dist/database/backfills/request-backfill.cli.js"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.1127.0",
"@aws-sdk/client-s3": "^3.1149.0",
"@better-auth/cimd": "1.7.7",
"@better-auth/mcp": "1.7.7",
"@better-auth/oauth-provider": "1.7.7",
"@modelcontextprotocol/server": "2.0.0",
"@modelcontextprotocol/server": "2.3.1",
"@nestjs/cache-manager": "^3.1.3",
"@nestjs/common": "^11.2.1",
"@nestjs/common": "^11.2.7",
"@nestjs/config": "^4.0.4",
"@nestjs/core": "^11.2.1",
"@nestjs/platform-express": "^11.2.1",
"@nestjs/core": "^11.2.7",
"@nestjs/platform-express": "^11.2.7",
"@nestjs/schedule": "^6.1.3",
"@nestjs/serve-static": "^5.0.5",
"@nestjs/throttler": "^6.0.0",
"@nestjs/throttler": "^6.7.1",
"@nestjs/typeorm": "^11.0.3",
"@react-email/components": "^1.0.12",
"@react-email/render": "^2.0.4",
Expand All @@ -47,38 +47,38 @@
"class-transformer": "^0.5.1",
"class-validator": "^0.15.1",
"compression": "^1.8.2",
"eventsource-parser": "^3.1.0",
"express-rate-limit": "^8.7.0",
"eventsource-parser": "^3.1.1",
"express-rate-limit": "^8.7.1",
"helmet": "^8.3.0",
"modelparams": "^0.0.57",
"pg": "^8.23.0",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"modelparams": "^0.0.72",
"pg": "^8.23.1",
"react": "^19.3.0",
"react-dom": "^19.3.0",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.0",
"thinker-shared": "*",
"typeorm": "^0.3.0",
"undici": "6.29.0",
"uuid": "^11.0.0",
"zod": "^4.4.3"
"zod": "^4.6.5"
},
"devDependencies": {
"@nestjs/cli": "^11.0.24",
"@nestjs/schematics": "^11.0.0",
"@nestjs/testing": "^11.2.1",
"@nestjs/testing": "^11.2.7",
"@types/compression": "^1.8.1",
"@types/express": "^5.0.6",
"@types/jest": "^30.0.0",
"@types/node": "^22.20.1",
"@types/node": "^22.20.5",
"@types/pg": "^8.23.1",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.7",
"@types/supertest": "^6.0.0",
"@types/supertest": "^7.2.1",
"@types/uuid": "^10.0.0",
"jest": "^30.5.1",
"jest-environment-node": "^30.5.1",
"supertest": "^7.0.0",
"ts-jest": "^29.4.12",
"jest-environment-node": "^30.5.2",
"supertest": "^7.3.1",
"ts-jest": "^29.4.14",
"ts-node": "^10.9.2",
"typescript": "^5.7.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
ProviderParamSpecService,
extractModelparamsCatalogLiteral,
parseModelParametersCatalog,
} from '../provider-param-spec.service';

Expand Down Expand Up @@ -293,3 +294,29 @@ describe('parseModelParametersCatalog', () => {
expect(catalog?.[0].params).toEqual([]);
});
});

describe('extractModelparamsCatalogLiteral', () => {
const entries = [{ provider: 'openai', model: 'gpt-4o', note: 'a ]; b ] c ;' }];
const literal = JSON.stringify(entries, null, 2);

it('reads the pre-0.0.71 layout', () => {
const source = `export const CATALOG = ${literal};\nfunction authSuffix(a) {\n return a;\n}\n`;
expect(JSON.parse(extractModelparamsCatalogLiteral(source))).toEqual(entries);
});

it('reads the 0.0.71+ layout', () => {
const source = `const GENERATED_CATALOG = ${literal};\nexport const CATALOG = GENERATED_CATALOG;\n`;
expect(JSON.parse(extractModelparamsCatalogLiteral(source))).toEqual(entries);
});

it('keeps string values that contain ] and ;', () => {
const source = `const GENERATED_CATALOG = ${JSON.stringify(entries)};\nexport const CATALOG = GENERATED_CATALOG;\n`;
expect(JSON.parse(extractModelparamsCatalogLiteral(source))[0].note).toBe('a ]; b ] c ;');
});

it('throws on an unknown layout', () => {
expect(() => extractModelparamsCatalogLiteral(`export default ${literal};\n`)).toThrow(
'modelparams package catalog file has an unknown shape',
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,21 @@ function loadModelparamsCatalog(): ProviderParamSpecCatalog {
function loadModelparamsCatalogData(): unknown {
const packageJsonPath = requireFromThisModule.resolve(MODELPARAMS_PACKAGE_JSON);
const dataPath = join(dirname(packageJsonPath), MODELPARAMS_DATA_RELATIVE_PATH);
const dataModule = readFileSync(dataPath, 'utf8');
// modelparams is ESM-only while the backend is CommonJS, so read the generated
// JSON-shaped catalog literal directly from the installed package.
const match = dataModule.match(/export const CATALOG = ([\s\S]*?);\nfunction authSuffix/);
return JSON.parse(extractModelparamsCatalogLiteral(readFileSync(dataPath, 'utf8'))) as unknown;
}

/**
* modelparams is ESM-only while the backend is CommonJS, so the JSON-shaped
* catalog literal is read straight from the installed `dist/generated/data.js`.
* Older releases emit `export const CATALOG = [...]`; 0.0.71+ emit
* `const GENERATED_CATALOG = [...]` followed by `export const CATALOG = GENERATED_CATALOG`.
*/
export function extractModelparamsCatalogLiteral(source: string): string {
const match = source.match(
/(?:export )?const (?:GENERATED_)?CATALOG = (\[[\s\S]*?\]);\n(?:export const CATALOG|function authSuffix)/,
);
if (!match) throw new Error('modelparams package catalog file has an unknown shape');
return JSON.parse(match[1]) as unknown;
return match[1];
}

function providerMetadataIdentity(
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.10.2",
"@types/node": "^22.20.5",
"jest": "^29.7.0",
"prettier": "^3.0.0",
"prettier": "^3.9.10",
"thinker-shared": "*",
"ts-jest": "^29.4.12",
"ts-jest": "^29.4.14",
"typescript": "^5.7.3"
}
}
12 changes: 6 additions & 6 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
},
"dependencies": {
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.16.2",
"@solidjs/router": "^0.16.3",
"better-auth": "1.7.7",
"dompurify": "^3.4.16",
"highlight.js": "^11.12.0",
"marked": "^18.0.11",
"motion": "^12.42.2",
"marked": "^18.1.0",
"motion": "^12.43.0",
"solid-js": "^1.9.17",
"thinker-shared": "*",
"uplot": "^1.6.31"
},
"devDependencies": {
"@solidjs/testing-library": "^0.8.0",
"@types/dompurify": "^3.2.0",
"@types/node": "^22.20.1",
"@types/node": "^22.20.5",
"@vitest/coverage-v8": "^5.0.0",
"jsdom": "^30.0.1",
"jsdom": "^30.1.2",
"typescript": "^5.7.0",
"vite": "^6.1.0",
"vite": "^6.4.4",
"vite-plugin-solid": "^2.11.14",
"vitest": "^5.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"devDependencies": {
"@types/jest": "^30.0.0",
"jest": "^30.5.1",
"ts-jest": "^29.4.12",
"ts-jest": "^29.4.14",
"typescript": "^5.7.3"
}
}
Loading