The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Rename utils package to utils-core (#43)
Chirag Jain10f94340bc6a
diff --git a/.github/workflows/generate-sdk.yaml b/.github/workflows/generate-sdk.yamlindex 35b7a0825..c21d2f5ef 100644--- a/.github/workflows/generate-sdk.yaml+++ b/.github/workflows/generate-sdk.yaml@@ -57,9 +57,9 @@ jobs:- name: Install dependenciesrun: pnpm install --frozen-lockfile- # The spec script imports @truefoundry/utils from its build output.- - name: Build utils- run: pnpm --filter @truefoundry/utils build+ # The spec script imports @truefoundry/utils-core from its build output.+ - name: Build utils-core+ run: pnpm --filter @truefoundry/utils-core build- name: Write OpenAPI documentrun: pnpm --filter @truefoundry/server openapi:writediff --git a/AGENTS.md b/AGENTS.mdindex 439fffb38..7de39dd61 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,5 @@- Workspace tasks MUST use `package.json` scripts; add a script when a missing workflow is repeatable like the existing commands, not ad hoc commands.-- Release wiring MUST keep dist-free host development, `pnpm smoke`, and packed CJS/ESM consumers working without changes in `tfy-llm-gateway`.+- Release wiring MUST keep dist-free host development, `pnpm smoke`, and packed CJS/ESM consumers of `@truefoundry/utils-core` working without changes in `tfy-llm-gateway` (beyond the package rename from `@truefoundry/utils`).- Shared Postgres/Redis settings in `docker-compose.yml` and `docker-compose.dev.yml` (image versions, health checks, `env_file`) MUST stay synchronized; intentional differences (app services, data paths, project `name`, host ports, in-network `POSTGRES_HOST` / `REDIS_URL`) MUST stay explicit. `packages/server/.env` is the host-dev + secrets source; `docker-compose.yml` may read it but MUST override container connectivity so host-dev localhost values are not used inside the smoke-test stack.- Changes to types or schemas MUST keep `packages/harness`, `packages/frontend`, `packages/server`, and `patches` synchronized; they MUST NOT update only one affected layer.- TypeScript code MUST NOT use assertion escapes such as `as T`, `as unknown as T`, non-null `!`, or `as never` to silence type errors; implementations MUST use sound contracts, guards, or corrected types.diff --git a/Dockerfile b/Dockerfileindex c8c501843..48ec89269 100644--- a/Dockerfile+++ b/Dockerfile@@ -3,7 +3,7 @@# Multi-stage build for @truefoundry/server, which also serves the UI: the only image the stack needs.## Lives at the repository root because the build needs the whole pnpm workspace-# as its context: the server depends on the workspace package @truefoundry/utils.+# as its context: the server depends on the workspace package @truefoundry/utils-core.## Dependency install uses pnpm fetch (lockfile-only) then install --offline so# the download layer stays cached when only package.json / scripts change.@@ -42,14 +42,14 @@ COPY packages/harness/scripts packages/harness/scriptsCOPY packages/harness/src/core/sandbox/scripts packages/harness/src/core/sandbox/scripts# ----------------------------------------------------------------------------# builder: install all deps (incl. dev) and build utils + server.+# builder: install all deps (incl. dev) and build utils-core + server.# ---------------------------------------------------------------------------FROM workspace AS builderRUN --mount=type=cache,id=pnpm,target=/pnpm/store \pnpm install --frozen-lockfile --offline --filter @truefoundry/server...COPY packages/harness packages/harnessCOPY packages/server packages/server-RUN pnpm --filter @truefoundry/utils build && pnpm --filter @truefoundry/server build+RUN pnpm --filter @truefoundry/utils-core build && pnpm --filter @truefoundry/server build# ---------------------------------------------------------------------------# frontend-builder: build the UI the server serves (parallel to builder above).@@ -78,7 +78,7 @@ COPY --from=prod-deps /app/node_modules ./node_modulesCOPY --from=prod-deps /app/packages/harness/node_modules ./packages/harness/node_modulesCOPY --from=prod-deps /app/packages/server/node_modules ./packages/server/node_modules-# Built workspace dependency (@truefoundry/utils).+# Built workspace dependency (@truefoundry/utils-core).COPY --from=builder /app/packages/harness/package.json ./packages/harness/package.jsonCOPY --from=builder /app/packages/harness/dist ./packages/harness/distdiff --git a/README.md b/README.mdindex 17f1d89eb..e43579cd0 100644--- a/README.md+++ b/README.md@@ -2,11 +2,11 @@pnpm workspace with:-| Package | Path | Role |-| --------------------- | ---------------------------------------- | ------------------------------------------------- |-| `@truefoundry/utils` | [`packages/harness`](packages/harness) | Published library (`core` + `agent-session`) |-| `@truefoundry/server` | [`packages/server`](packages/server) | HTTP server + UI host (private; depends on utils) |-| `frontend` | [`packages/frontend`](packages/frontend) | Private draft-only agent chat UI (not published) |+| Package | Path | Role |+| ------------------------- | ---------------------------------------- | ------------------------------------------------------ |+| `@truefoundry/utils-core` | [`packages/harness`](packages/harness) | Published library (`core` + `agent-session`) |+| `@truefoundry/server` | [`packages/server`](packages/server) | HTTP server + UI host (private; depends on utils-core) |+| `frontend` | [`packages/frontend`](packages/frontend) | Private draft-only agent chat UI (not published) |## Development@@ -36,9 +36,9 @@ Terminal 2:pnpm dev # API on :8790 and Vite on :3000```-Open `http://localhost:3000`. Frontend changes update through Vite HMR; server changes automatically restart the API on `:8790`. Vite proxies `/api/*` to the API. Local server scripts resolve `@truefoundry/utils` from source (`exports.development`), so a utils `dist/` build is not required for `pnpm dev`. For drain testing without server hot reload, use `pnpm dev:no-watch` instead of `pnpm dev`.+Open `http://localhost:3000`. Frontend changes update through Vite HMR; server changes automatically restart the API on `:8790`. Vite proxies `/api/*` to the API. Local server scripts resolve `@truefoundry/utils-core` from source (`exports.development`), so a utils-core `dist/` build is not required for `pnpm dev`. For drain testing without server hot reload, use `pnpm dev:no-watch` instead of `pnpm dev`.-The workspace utils package is ESM so the host server and source schemas share one ESM dependency graph. `NODE_OPTIONS=--conditions=development` selects `src/` at runtime, and TypeScript uses the same condition for source-based static analysis. Development, lint, typecheck, tests, OpenAPI generation, and migrations do not read or recreate `packages/harness/dist`; release builds, package checks, and Docker smoke tests create it intentionally.+The workspace utils-core package is ESM so the host server and source schemas share one ESM dependency graph. `NODE_OPTIONS=--conditions=development` selects `src/` at runtime, and TypeScript uses the same condition for source-based static analysis. Development, lint, typecheck, tests, OpenAPI generation, and migrations do not read or recreate `packages/harness/dist`; release builds, package checks, and Docker smoke tests create it intentionally.Server dev scripts regenerate the embedded sandbox Python helpers before startup. Root `pnpm dev` also watches those Python files, regenerates the TypeScript source module after edits, and lets the server watcher restart normally. Neither path builds `dist`.@@ -64,7 +64,7 @@ pnpm testpnpm typecheck```-Root `build` / `typecheck` (and CI) include utils, server, and frontend. `FRONTEND_PORT` moves Vite off `:3000`, `VITE_SERVER_URL` points it at another API. See [`packages/frontend/README.md`](packages/frontend/README.md).+Root `build` / `typecheck` (and CI) include utils-core, server, and frontend. `FRONTEND_PORT` moves Vite off `:3000`, `VITE_SERVER_URL` points it at another API. See [`packages/frontend/README.md`](packages/frontend/README.md).## Serving the UI from the server@@ -101,16 +101,16 @@ fern check && fern generate --group ts-sdk --version 0.0.0 --local --generate-te## Library imports```ts-import { AgentThread } from '@truefoundry/utils/core';-import { Sessions } from '@truefoundry/utils/agent-session';+import { AgentThread } from '@truefoundry/utils-core/core';+import { Sessions } from '@truefoundry/utils-core/agent-session';```Or namespaced:```ts-import { core, agentSession } from '@truefoundry/utils';+import { core, agentSession } from '@truefoundry/utils-core';```-Workspace-only `development` exports are removed from the published package. Its staged `dist/package.json` remains CommonJS so `require()` uses `.js`, while ESM consumers use `.mjs`. This preserves existing consumers such as `tfy-llm-gateway`; they do not need source changes. Consumer compatibility is checked against a packed artifact, including root, barrel, deep skill imports, and both CJS and ESM loading.+Workspace-only `development` exports are removed from the published package. Its staged `dist/package.json` remains CommonJS so `require()` uses `.js`, while ESM consumers use `.mjs`. After switching from `@truefoundry/utils` to `@truefoundry/utils-core`, consumers such as `tfy-llm-gateway` keep the same deep-import and CJS/ESM layout. Consumer compatibility is checked against a packed artifact, including root, barrel, deep skill imports, and both CJS and ESM loading.Server-only deps (`hono`, `@hono/node-server`, `@hono/swagger-ui`, `yaml`) live in `packages/server` and never reach library consumers.diff --git a/RELEASING.md b/RELEASING.mdindex acbe771eb..2c1ae84f2 100644--- a/RELEASING.md+++ b/RELEASING.md@@ -1,7 +1,7 @@-# Releasing `@truefoundry/utils`+# Releasing `@truefoundry/utils-core`Interim setup for the fast development phase: the library in-`packages/harness` is published **publicly** to npm as `@truefoundry/utils`+`packages/harness` is published **publicly** to npm as `@truefoundry/utils-core`so the gateway can consume it like any normal dependency. The realopen-source release happens later — every deferred item carries a`TODO(oss):` comment in code so we can grep for them when that day comes.@@ -23,7 +23,7 @@ dist-relative paths (`scripts/make-dist-package-json.mjs`), so the tarballroot is the compiled file tree. Consequences:- Deep imports mirror the source tree with no `dist/` segment:- `@truefoundry/utils/core/llm/LLMTypes`, `.../core/runtime/contextUtils`.+ `@truefoundry/utils-core/core/llm/LLMTypes`, `.../core/runtime/contextUtils`.- Legacy `moduleResolution: "node"` consumers (the gateway) resolve subpathsas literal file lookups — no `exports`/`typesVersions` support needed.- `require()` and `import` both work (`.js` is CJS, `.mjs` is ESM).@@ -63,7 +63,7 @@ root is the compiled file tree. Consequences:during the fast 0.x churn:```json- "@truefoundry/utils": "0.x.y"+ "@truefoundry/utils-core": "0.x.y"```## Local iteration without publishingdiff --git a/package.json b/package.jsonindex 8458289df..4106f37ad 100644--- a/package.json+++ b/package.json@@ -3,18 +3,18 @@"private": true,"packageManager": "[email protected]+sha512.b767e9a98fc87aec0f42daefcd0e84941c2cdb45d73c4e1e68860fb2bdfdbe032ab592105479e5e05c237f740c8a5ffdbbb52385797ddc2296745a1bbb883e8d","scripts": {- "build": "pnpm --filter @truefoundry/utils build && pnpm --filter @truefoundry/server build && pnpm --filter frontend build",+ "build": "pnpm --filter @truefoundry/utils-core build && pnpm --filter @truefoundry/server build && pnpm --filter frontend build","clean": "node scripts/clean.mjs","clean:all": "node scripts/clean.mjs --dependencies",- "typecheck": "pnpm --filter @truefoundry/utils typecheck && pnpm --filter @truefoundry/server typecheck && pnpm --filter frontend typecheck",+ "typecheck": "pnpm --filter @truefoundry/utils-core typecheck && pnpm --filter @truefoundry/server typecheck && pnpm --filter frontend typecheck","lint": "eslint . --fix --cache --cache-location .eslintcache","lint:ci": "eslint . --cache --cache-location .eslintcache","format": "prettier --write . --cache --config .prettierrc","format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\" --cache --error-on-unmatched-pattern --config .prettierrc","format:fix": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\" --cache --config .prettierrc",- "test": "pnpm --filter @truefoundry/utils test && pnpm --filter @truefoundry/server test && pnpm --filter frontend test",+ "test": "pnpm --filter @truefoundry/utils-core test && pnpm --filter @truefoundry/server test && pnpm --filter frontend test","test:store:local": "bash scripts/test-store-local.sh",- "dev": "pnpm --parallel --filter @truefoundry/utils --filter @truefoundry/server --filter frontend dev",+ "dev": "pnpm --parallel --filter @truefoundry/utils-core --filter @truefoundry/server --filter frontend dev","dev:no-watch": "pnpm --parallel --filter @truefoundry/server --filter frontend dev:no-watch","dev:infra": "docker compose -f docker-compose.dev.yml up","dev:server": "pnpm --filter @truefoundry/server dev",@@ -25,8 +25,8 @@"openapi:write": "pnpm --filter @truefoundry/server openapi:write","ui:shot": "node ui-shots/shot.mjs","ui:clean": "node ui-shots/clean.mjs",- "pack:dry": "pnpm --filter @truefoundry/utils pack:dry",- "postinstall": "pnpm --filter @truefoundry/utils build:gen",+ "pack:dry": "pnpm --filter @truefoundry/utils-core pack:dry",+ "postinstall": "pnpm --filter @truefoundry/utils-core build:gen","prepare": "husky || true"},"devDependencies": {diff --git a/packages/harness/package.json b/packages/harness/package.jsonindex d4cd0879a..3409f940d 100644--- a/packages/harness/package.json+++ b/packages/harness/package.json@@ -1,6 +1,6 @@{- "name": "@truefoundry/utils",- "version": "0.1.7",+ "name": "@truefoundry/utils-core",+ "version": "0.1.8","description": "TrueFoundry agent core and session library","author": "Truefoundry","license": "UNLICENSED",diff --git a/packages/harness/scripts/make-dist-package-json.mjs b/packages/harness/scripts/make-dist-package-json.mjsindex 95da6b129..3de414695 100644--- a/packages/harness/scripts/make-dist-package-json.mjs+++ b/packages/harness/scripts/make-dist-package-json.mjs@@ -1,5 +1,5 @@// Generates dist/package.json so the package can be published from dist/,-// making dist the package root: src/core/foo.ts is importable as @truefoundry/utils/core/foo+// making dist the package root: src/core/foo.ts is importable as @truefoundry/utils-core/core/fooimport fs from 'node:fs';import path from 'node:path';import { fileURLToPath } from 'node:url';diff --git a/packages/harness/src/index.ts b/packages/harness/src/index.tsindex 2f70ee159..2041f56e5 100644--- a/packages/harness/src/index.ts+++ b/packages/harness/src/index.ts@@ -1,5 +1,5 @@/**- * Root barrel for @truefoundry/utils.+ * Root barrel for @truefoundry/utils-core.* Namespaced to avoid colliding event-schema exports between layers.*/export * as agentSession from './agent-session';diff --git a/packages/server/jest.eventsub.config.cjs b/packages/server/jest.eventsub.config.cjsindex 3bc3ecdad..33931ce75 100644--- a/packages/server/jest.eventsub.config.cjs+++ b/packages/server/jest.eventsub.config.cjs@@ -15,8 +15,8 @@ module.exports = {},moduleNameMapper: {'^(\\.{1,2}/.*)\\.js$': '$1',- '^@truefoundry/utils/agent-session/(.*)$': '<rootDir>/../harness/src/agent-session/$1',- '^@truefoundry/utils/core/(.*)$': '<rootDir>/../harness/src/core/$1',+ '^@truefoundry/utils-core/agent-session/(.*)$': '<rootDir>/../harness/src/agent-session/$1',+ '^@truefoundry/utils-core/core/(.*)$': '<rootDir>/../harness/src/core/$1',},testTimeout: 30_000,maxWorkers: '50%',diff --git a/packages/server/jest.store.postgres.config.cjs b/packages/server/jest.store.postgres.config.cjsindex 8697dedd6..6a6183a5a 100644--- a/packages/server/jest.store.postgres.config.cjs+++ b/packages/server/jest.store.postgres.config.cjs@@ -16,8 +16,8 @@ module.exports = {},moduleNameMapper: {'^(\\.{1,2}/.*)\\.js$': '$1',- '^@truefoundry/utils/agent-session/(.*)$': '<rootDir>/../harness/src/agent-session/$1',- '^@truefoundry/utils/core/(.*)$': '<rootDir>/../harness/src/core/$1',+ '^@truefoundry/utils-core/agent-session/(.*)$': '<rootDir>/../harness/src/agent-session/$1',+ '^@truefoundry/utils-core/core/(.*)$': '<rootDir>/../harness/src/core/$1',},transformIgnorePatterns: ['/node_modules/(?!.*kysely)'],testTimeout: 120_000,diff --git a/packages/server/jest.store.sqlite.config.cjs b/packages/server/jest.store.sqlite.config.cjsindex 1b49b934b..0502a8d9b 100644--- a/packages/server/jest.store.sqlite.config.cjs+++ b/packages/server/jest.store.sqlite.config.cjs@@ -15,8 +15,8 @@ module.exports = {},moduleNameMapper: {'^(\\.{1,2}/.*)\\.js$': '$1',- '^@truefoundry/utils/agent-session/(.*)$': '<rootDir>/../harness/src/agent-session/$1',- '^@truefoundry/utils/core/(.*)$': '<rootDir>/../harness/src/core/$1',+ '^@truefoundry/utils-core/agent-session/(.*)$': '<rootDir>/../harness/src/agent-session/$1',+ '^@truefoundry/utils-core/core/(.*)$': '<rootDir>/../harness/src/core/$1',},transformIgnorePatterns: ['/node_modules/(?!.*kysely)'],testTimeout: 120_000,diff --git a/packages/server/jest.unit.config.cjs b/packages/server/jest.unit.config.cjsindex 03ad8eb4b..9dfa9a0dd 100644--- a/packages/server/jest.unit.config.cjs+++ b/packages/server/jest.unit.config.cjs@@ -28,12 +28,12 @@ module.exports = {transformIgnorePatterns: [],moduleNameMapper: {'^(\\.{1,2}/.*)\\.js$': '$1',- '^@truefoundry/utils/agent-session$': '<rootDir>/../harness/src/agent-session/index.ts',- '^@truefoundry/utils/agent-session/(.*)$': '<rootDir>/../harness/src/agent-session/$1',- '^@truefoundry/utils/request-reply$': '<rootDir>/../harness/src/request-reply/index.ts',- '^@truefoundry/utils/request-reply/(.*)$': '<rootDir>/../harness/src/request-reply/$1',- '^@truefoundry/utils/core$': '<rootDir>/../harness/src/core/index.ts',- '^@truefoundry/utils/core/(.*)$': '<rootDir>/../harness/src/core/$1',+ '^@truefoundry/utils-core/agent-session$': '<rootDir>/../harness/src/agent-session/index.ts',+ '^@truefoundry/utils-core/agent-session/(.*)$': '<rootDir>/../harness/src/agent-session/$1',+ '^@truefoundry/utils-core/request-reply$': '<rootDir>/../harness/src/request-reply/index.ts',+ '^@truefoundry/utils-core/request-reply/(.*)$': '<rootDir>/../harness/src/request-reply/$1',+ '^@truefoundry/utils-core/core$': '<rootDir>/../harness/src/core/index.ts',+ '^@truefoundry/utils-core/core/(.*)$': '<rootDir>/../harness/src/core/$1',},testTimeout: 30_000,maxWorkers: '50%',diff --git a/packages/server/package.json b/packages/server/package.jsonindex febb63842..b3e66469c 100644--- a/packages/server/package.json+++ b/packages/server/package.json@@ -10,11 +10,11 @@"build:gen": "node scripts/generate-catalog.mjs","build:gen:watch": "node --watch-path=src/catalog/model-catalog.yaml --watch-path=src/catalog/mcp-catalog.yaml --watch-path=src/catalog/skill-catalog.yaml --watch-path=src/catalog/sandbox-catalog.yaml scripts/generate-catalog.mjs","build": "pnpm run build:gen && tsc --noEmit && tsup",- "predev": "pnpm --filter @truefoundry/utils build:gen && pnpm run build:gen",+ "predev": "pnpm --filter @truefoundry/utils-core build:gen && pnpm run build:gen","dev": "pnpm run --parallel catalog-watch dev:serve","catalog-watch": "pnpm run build:gen:watch","dev:serve": "NODE_OPTIONS='--conditions=development' NODE_ENV=development tsx watch --env-file=.env src/main.ts",- "predev:no-watch": "pnpm --filter @truefoundry/utils build:gen && pnpm run build:gen",+ "predev:no-watch": "pnpm --filter @truefoundry/utils-core build:gen && pnpm run build:gen","dev:no-watch": "NODE_OPTIONS='--conditions=development' NODE_ENV=production tsx --env-file=.env src/main.ts","migrate": "NODE_OPTIONS='--conditions=development' tsx --env-file=.env src/db/postgres/migrate-cli.ts","typecheck": "pnpm run build:gen && tsc --noEmit && tsc --noEmit -p tests/db/tsconfig.json && tsc --noEmit -p tests/unit/tsconfig.json",@@ -28,7 +28,7 @@"@hono/node-server": "^2.0.11","@hono/swagger-ui": "^0.2.1","@hono/zod-openapi": "^0.19.10",- "@truefoundry/utils": "workspace:*",+ "@truefoundry/utils-core": "workspace:*","better-sqlite3": "^13.0.2","hono": "^4.12.31","kysely": "^0.29.4",diff --git a/packages/server/scripts/write-openapi.ts b/packages/server/scripts/write-openapi.tsindex 017e2f479..82b02c3c1 100644--- a/packages/server/scripts/write-openapi.ts+++ b/packages/server/scripts/write-openapi.ts@@ -5,9 +5,9 @@* spec cannot drift from what the server serves. Nothing listens or dials out:* `.env.test` supplies dummy connection strings and the registry fixtures.*/-import type { TurnStreamingEvent } from '@truefoundry/utils/agent-session';-import { InMemorySessionStore, Sessions } from '@truefoundry/utils/agent-session';-import { RequestReplyRouter } from '@truefoundry/utils/request-reply';+import type { TurnStreamingEvent } from '@truefoundry/utils-core/agent-session';+import { InMemorySessionStore, Sessions } from '@truefoundry/utils-core/agent-session';+import { RequestReplyRouter } from '@truefoundry/utils-core/request-reply';import { mkdirSync, writeFileSync } from 'node:fs';import path from 'node:path';import winston from 'winston';diff --git a/packages/server/src/apis/legacyMcp.ts b/packages/server/src/apis/legacyMcp.tsindex 1690be1a1..f770ba943 100644--- a/packages/server/src/apis/legacyMcp.ts+++ b/packages/server/src/apis/legacyMcp.ts@@ -1,5 +1,5 @@import { OpenAPIHono, type RouteHandler } from '@hono/zod-openapi';-import { extractErrorLogFields, isAuthRequired, McpConnectionError, RemoteMCP } from '@truefoundry/utils/core';+import { extractErrorLogFields, isAuthRequired, McpConnectionError, RemoteMCP } from '@truefoundry/utils-core/core';import type { Logger } from 'winston';import type { McpStore } from '../legacy-registry-store/McpStore';import { listMcpServersRoute, listMcpToolsRoute } from '../routes/legacyMcpRoutes';diff --git a/packages/server/src/apis/mcpOAuth.ts b/packages/server/src/apis/mcpOAuth.tsindex a595051f9..13798abf1 100644--- a/packages/server/src/apis/mcpOAuth.ts+++ b/packages/server/src/apis/mcpOAuth.ts@@ -5,7 +5,7 @@ import {McpConnectionError,type IOAuthClientStore,type IOAuthTokenStore,-} from '@truefoundry/utils/core';+} from '@truefoundry/utils-core/core';import type { Logger } from 'winston';import { mcpOAuthCallbackRoute } from '../routes/mcpOAuthRoutes';diff --git a/packages/server/src/apis/mcpServers.ts b/packages/server/src/apis/mcpServers.tsindex 484cb8aa5..1b82f0702 100644--- a/packages/server/src/apis/mcpServers.ts+++ b/packages/server/src/apis/mcpServers.ts@@ -8,7 +8,7 @@ import {resolveMcpAuth,validateRedirectUris,type IOAuthTokenStore,-} from '@truefoundry/utils/core';+} from '@truefoundry/utils-core/core';import type { Logger } from 'winston';import type { McpCatalog } from '../catalog/McpCatalog';import configuration from '../config';diff --git a/packages/server/src/apis/sessions.ts b/packages/server/src/apis/sessions.tsindex 44394c94e..c2ba406d1 100644--- a/packages/server/src/apis/sessions.ts+++ b/packages/server/src/apis/sessions.ts@@ -1,12 +1,15 @@import { OpenAPIHono, type RouteHandler } from '@hono/zod-openapi';-import type { AgentSpec, ISessionStore, SessionRecord, Sessions } from '@truefoundry/utils/agent-session';+import type { AgentSpec, ISessionStore, SessionRecord, Sessions } from '@truefoundry/utils-core/agent-session';import {CancellationReason,SessionStoreConflictError,SessionStoreNotFoundError,-} from '@truefoundry/utils/agent-session';-import type { RouteHandler as RequestReplyRouteHandler, RequestReplyRouter } from '@truefoundry/utils/request-reply';-import { NoResponderError, redisRequest, RequestTimeoutError } from '@truefoundry/utils/request-reply';+} from '@truefoundry/utils-core/agent-session';+import type {+ RouteHandler as RequestReplyRouteHandler,+ RequestReplyRouter,+} from '@truefoundry/utils-core/request-reply';+import { NoResponderError, redisRequest, RequestTimeoutError } from '@truefoundry/utils-core/request-reply';import { HTTPException } from 'hono/http-exception';import type { RedisClientType } from 'redis';import { ulid } from 'ulid';diff --git a/packages/server/src/apis/settings.ts b/packages/server/src/apis/settings.tsindex b45756fe8..723cf7e30 100644--- a/packages/server/src/apis/settings.ts+++ b/packages/server/src/apis/settings.ts@@ -4,7 +4,7 @@* a single policy can wrap the whole tree later without touching each resource.*/import { OpenAPIHono } from '@hono/zod-openapi';-import type { IOAuthTokenStore } from '@truefoundry/utils/core';+import type { IOAuthTokenStore } from '@truefoundry/utils-core/core';import type { Logger } from 'winston';import type { McpCatalog } from '../catalog/McpCatalog';import type { ModelCatalog } from '../catalog/ModelCatalog';diff --git a/packages/server/src/apis/turns.ts b/packages/server/src/apis/turns.tsindex 5ff25d200..c19576388 100644--- a/packages/server/src/apis/turns.ts+++ b/packages/server/src/apis/turns.ts@@ -1,5 +1,5 @@import { OpenAPIHono, type RouteHandler } from '@hono/zod-openapi';-import type { ISessionStore, Sessions, Turn, TurnStreamingEvent } from '@truefoundry/utils/agent-session';+import type { ISessionStore, Sessions, Turn, TurnStreamingEvent } from '@truefoundry/utils-core/agent-session';import {CancellationReason,EventType,@@ -10,7 +10,7 @@ import {type TurnInputItem,type TurnRecordWithoutSnapshot,type TurnSandboxFactory,-} from '@truefoundry/utils/agent-session';+} from '@truefoundry/utils-core/agent-session';import {AgentHarnessError,extractErrorLogFields,@@ -18,7 +18,7 @@ import {isFileContentPart,McpConnectionError,VercelAILLM,-} from '@truefoundry/utils/core';+} from '@truefoundry/utils-core/core';import type { Context } from 'hono';import { HTTPException } from 'hono/http-exception';import { streamSSE } from 'hono/streaming';diff --git a/packages/server/src/app.ts b/packages/server/src/app.tsindex d82b95a84..d71134539 100644--- a/packages/server/src/app.ts+++ b/packages/server/src/app.ts@@ -1,9 +1,14 @@/** The API: resource routers, the OpenAPI document and Swagger UI, all under /api/v1. */import { swaggerUI } from '@hono/swagger-ui';import { OpenAPIHono } from '@hono/zod-openapi';-import type { ISessionStore, Sessions, TurnSandboxFactory, TurnStreamingEvent } from '@truefoundry/utils/agent-session';-import type { IOAuthTokenStore } from '@truefoundry/utils/core';-import type { RequestReplyRouter } from '@truefoundry/utils/request-reply';+import type {+ ISessionStore,+ Sessions,+ TurnSandboxFactory,+ TurnStreamingEvent,+} from '@truefoundry/utils-core/agent-session';+import type { IOAuthTokenStore } from '@truefoundry/utils-core/core';+import type { RequestReplyRouter } from '@truefoundry/utils-core/request-reply';import type { Context } from 'hono';import { HTTPException } from 'hono/http-exception';import type { RedisClientType } from 'redis';diff --git a/packages/server/src/db/mcpOAuthTypes.ts b/packages/server/src/db/mcpOAuthTypes.tsindex 48f1538a2..4b5b6bb46 100644--- a/packages/server/src/db/mcpOAuthTypes.ts+++ b/packages/server/src/db/mcpOAuthTypes.ts@@ -2,13 +2,13 @@* Canonical JSON shapes for MCP OAuth columns (`mcp_server`, `oauth_token`,* `oauth_pending_authorization`). Owned by the server DB layer — not the harness.*- * Contract types from `@truefoundry/utils/core` happen to match field for field today, so the+ * Contract types from `@truefoundry/utils-core/core` happen to match field for field today, so the* converters at the bottom are the seam that lets either side change without the other noticing.*/import type {OAuthClientRecord as ContractOAuthClientRecord,OAuthToken as ContractOAuthToken,-} from '@truefoundry/utils/core';+} from '@truefoundry/utils-core/core';// Absence is an explicit `| null`, not an optional `?:`diff --git a/packages/server/src/db/mcpServerStore.ts b/packages/server/src/db/mcpServerStore.tsindex ae7af6f5a..bfd2c021e 100644--- a/packages/server/src/db/mcpServerStore.ts+++ b/packages/server/src/db/mcpServerStore.ts@@ -6,7 +6,7 @@* Also owns the DCR registration columns (`oauth_server` / `oauth_client`) via* `IOAuthClientStore` — those are not a separate persistence root.*/-import type { IOAuthClientStore } from '@truefoundry/utils/core';+import type { IOAuthClientStore } from '@truefoundry/utils-core/core';import type { ResourceName } from '../schemas/common';import type { McpServerManifest } from '../schemas/mcpServer';diff --git a/packages/server/src/db/postgres/mcp-server-store/PostgresMcpServerStore.ts b/packages/server/src/db/postgres/mcp-server-store/PostgresMcpServerStore.tsindex 0e5dedd63..7f77d365f 100644--- a/packages/server/src/db/postgres/mcp-server-store/PostgresMcpServerStore.ts+++ b/packages/server/src/db/postgres/mcp-server-store/PostgresMcpServerStore.ts@@ -1,4 +1,4 @@-import type { OAuthClientRecord } from '@truefoundry/utils/core';+import type { OAuthClientRecord } from '@truefoundry/utils-core/core';import type { Kysely, Selectable } from 'kysely';import { ulid } from 'ulid';import { fromStoredOAuthClientRecord, toStoredOAuthClientRecord } from '../../mcpOAuthTypes';diff --git a/packages/server/src/db/postgres/session-store/PostgresSessionStore.ts b/packages/server/src/db/postgres/session-store/PostgresSessionStore.tsindex ce47a4182..fee179d5e 100644--- a/packages/server/src/db/postgres/session-store/PostgresSessionStore.ts+++ b/packages/server/src/db/postgres/session-store/PostgresSessionStore.ts@@ -1,7 +1,7 @@-import type { SessionRecord } from '@truefoundry/utils/agent-session/models/SessionRecord';-import type { TurnRecord } from '@truefoundry/utils/agent-session/models/TurnRecord';-import type { PersistedTurnEvent, SessionEventItem } from '@truefoundry/utils/agent-session/schemas/events';-import type { TokenPagination } from '@truefoundry/utils/agent-session/schemas/pagination';+import type { SessionRecord } from '@truefoundry/utils-core/agent-session/models/SessionRecord';+import type { TurnRecord } from '@truefoundry/utils-core/agent-session/models/TurnRecord';+import type { PersistedTurnEvent, SessionEventItem } from '@truefoundry/utils-core/agent-session/schemas/events';+import type { TokenPagination } from '@truefoundry/utils-core/agent-session/schemas/pagination';import type {AddThreadsInput,AppendToEventsInput,@@ -25,8 +25,11 @@ import type {TurnRecordWithoutSnapshot,UpdateSessionInput,UpdateTurnStateInput,-} from '@truefoundry/utils/agent-session/store/ISessionStore';-import { decodeOffsetPageToken, encodeOffsetPageToken } from '@truefoundry/utils/agent-session/store/OffsetPageToken';+} from '@truefoundry/utils-core/agent-session/store/ISessionStore';+import {+ decodeOffsetPageToken,+ encodeOffsetPageToken,+} from '@truefoundry/utils-core/agent-session/store/OffsetPageToken';import type { Kysely } from 'kysely';import type { Database } from '../types';import { patchThreadCapabilityState as patchThreadCapabilityStateQuery } from './queries/capabilities';diff --git a/packages/server/src/db/postgres/session-store/queries/capabilities.ts b/packages/server/src/db/postgres/session-store/queries/capabilities.tsindex 2ad42d8df..f9acca365 100644--- a/packages/server/src/db/postgres/session-store/queries/capabilities.ts+++ b/packages/server/src/db/postgres/session-store/queries/capabilities.ts@@ -1,4 +1,4 @@-import type { PatchThreadCapabilityStateInput } from '@truefoundry/utils/agent-session/store/ISessionStore';+import type { PatchThreadCapabilityStateInput } from '@truefoundry/utils-core/agent-session/store/ISessionStore';import { sql, type Kysely } from 'kysely';import { json } from '../../sqlExpressions';import type { Database } from '../../types';diff --git a/packages/server/src/db/postgres/session-store/queries/events.ts b/packages/server/src/db/postgres/session-store/queries/events.tsindex 70c9d2a78..246b70d58 100644--- a/packages/server/src/db/postgres/session-store/queries/events.ts+++ b/packages/server/src/db/postgres/session-store/queries/events.ts@@ -1,17 +1,20 @@-import type { PersistedTurnEvent, SessionEventItem } from '@truefoundry/utils/agent-session/schemas/events';-import type { TokenPagination } from '@truefoundry/utils/agent-session/schemas/pagination';+import type { PersistedTurnEvent, SessionEventItem } from '@truefoundry/utils-core/agent-session/schemas/events';+import type { TokenPagination } from '@truefoundry/utils-core/agent-session/schemas/pagination';import type {AppendToEventsInput,ListSessionEventsInput,ListTurnEventsInput,-} from '@truefoundry/utils/agent-session/store/ISessionStore';-import { decodeOffsetPageToken, paginateOffsetRows } from '@truefoundry/utils/agent-session/store/OffsetPageToken';+} from '@truefoundry/utils-core/agent-session/store/ISessionStore';+import { decodeOffsetPageToken, paginateOffsetRows } from '@truefoundry/utils-core/agent-session/store/OffsetPageToken';import {decodeSessionEventPageToken,paginateSessionEventRows,type SessionEventPageCursor,-} from '@truefoundry/utils/agent-session/store/SessionEventPageToken';-import { SessionNotFoundError, TurnNotFoundError } from '@truefoundry/utils/agent-session/store/SessionStoreErrors';+} from '@truefoundry/utils-core/agent-session/store/SessionEventPageToken';+import {+ SessionNotFoundError,+ TurnNotFoundError,+} from '@truefoundry/utils-core/agent-session/store/SessionStoreErrors';import type { Kysely } from 'kysely';import { sql } from 'kysely';import { json } from '../../sqlExpressions';diff --git a/packages/server/src/db/postgres/session-store/queries/sessions.ts b/packages/server/src/db/postgres/session-store/queries/sessions.tsindex a37a111bb..5918df240 100644--- a/packages/server/src/db/postgres/session-store/queries/sessions.ts+++ b/packages/server/src/db/postgres/session-store/queries/sessions.ts@@ -1,17 +1,17 @@-import type { SessionRecord } from '@truefoundry/utils/agent-session/models/SessionRecord';+import type { SessionRecord } from '@truefoundry/utils-core/agent-session/models/SessionRecord';import type {CreateSessionInput,DeleteSessionInput,GetSessionInput,ListSessionsInput,UpdateSessionInput,-} from '@truefoundry/utils/agent-session/store/ISessionStore';-import { decodeOffsetPageToken, paginateOffsetRows } from '@truefoundry/utils/agent-session/store/OffsetPageToken';+} from '@truefoundry/utils-core/agent-session/store/ISessionStore';+import { decodeOffsetPageToken, paginateOffsetRows } from '@truefoundry/utils-core/agent-session/store/OffsetPageToken';import {SessionAlreadyExistsError,SessionNotFoundError,SessionStoreInvariantError,-} from '@truefoundry/utils/agent-session/store/SessionStoreErrors';+} from '@truefoundry/utils-core/agent-session/store/SessionStoreErrors';import { sql, type Kysely } from 'kysely';import { json } from '../../sqlExpressions';import type { Database } from '../../types';diff --git a/packages/server/src/db/postgres/session-store/queries/threads.ts b/packages/server/src/db/postgres/session-store/queries/threads.tsindex 3762c79ae..bc7e1cf99 100644--- a/packages/server/src/db/postgres/session-store/queries/threads.ts+++ b/packages/server/src/db/postgres/session-store/queries/threads.ts@@ -5,11 +5,11 @@ import type {PatchMCPServersInput,PatchSandboxInfoInput,RemoveThreadsInput,-} from '@truefoundry/utils/agent-session/store/ISessionStore';-import type { JsonValue } from '@truefoundry/utils/core/capabilities/AgentCapability';-import type { AgentInfo } from '@truefoundry/utils/core/events/schema';-import type { ContextMessage, SubAgentCompletionMarker } from '@truefoundry/utils/core/runtime/AgentThread.types';-import type { CurrentContextUsage } from '@truefoundry/utils/core/runtime/contextUsage';+} from '@truefoundry/utils-core/agent-session/store/ISessionStore';+import type { JsonValue } from '@truefoundry/utils-core/core/capabilities/AgentCapability';+import type { AgentInfo } from '@truefoundry/utils-core/core/events/schema';+import type { ContextMessage, SubAgentCompletionMarker } from '@truefoundry/utils-core/core/runtime/AgentThread.types';+import type { CurrentContextUsage } from '@truefoundry/utils-core/core/runtime/contextUsage';import { sql, type Kysely, type RawBuilder, type Transaction } from 'kysely';import { json, jsonbSet } from '../../sqlExpressions';import type { Database, TurnThreadCheckpoint } from '../../types';diff --git a/packages/server/src/db/postgres/session-store/queries/turns.ts b/packages/server/src/db/postgres/session-store/queries/turns.tsindex 55431081d..7819f9e03 100644--- a/packages/server/src/db/postgres/session-store/queries/turns.ts+++ b/packages/server/src/db/postgres/session-store/queries/turns.ts@@ -1,16 +1,16 @@-import type { TurnRecord, TurnSnapshot } from '@truefoundry/utils/agent-session/models/TurnRecord';+import type { TurnRecord, TurnSnapshot } from '@truefoundry/utils-core/agent-session/models/TurnRecord';import {CancellationReason,type TerminalTurnState,type TurnInputItem,type TurnState,-} from '@truefoundry/utils/agent-session/schemas/turn';-import { assertCreateTurnThreadDelta } from '@truefoundry/utils/agent-session/store/assertCreateTurnThreadDelta';+} from '@truefoundry/utils-core/agent-session/schemas/turn';+import { assertCreateTurnThreadDelta } from '@truefoundry/utils-core/agent-session/store/assertCreateTurnThreadDelta';import type {FreezeAndGetTurnInput,TurnRecordWithoutSnapshot,UpdateTurnStateInput,-} from '@truefoundry/utils/agent-session/store/ISessionStore';+} from '@truefoundry/utils-core/agent-session/store/ISessionStore';import {PreviousTurnRunningError,SessionNotFoundError,@@ -20,13 +20,13 @@ import {TurnAlreadyExistsError,TurnNotFoundError,TurnNotRunningError,-} from '@truefoundry/utils/agent-session/store/SessionStoreErrors';-import type { CapabilityState, JsonValue } from '@truefoundry/utils/core/capabilities/AgentCapability';-import type { AgentInfo, AgentParent, MCPServerInitInfo } from '@truefoundry/utils/core/events/schema';-import type { AgentThreadSnapshot, ContextMessage } from '@truefoundry/utils/core/runtime/AgentThread.types';-import type { CurrentContextUsage } from '@truefoundry/utils/core/runtime/contextUsage';-import { getEmptyCurrentContextUsage } from '@truefoundry/utils/core/runtime/contextUsage';-import type { SandboxInfo } from '@truefoundry/utils/core/sandbox/Sandbox';+} from '@truefoundry/utils-core/agent-session/store/SessionStoreErrors';+import type { CapabilityState, JsonValue } from '@truefoundry/utils-core/core/capabilities/AgentCapability';+import type { AgentInfo, AgentParent, MCPServerInitInfo } from '@truefoundry/utils-core/core/events/schema';+import type { AgentThreadSnapshot, ContextMessage } from '@truefoundry/utils-core/core/runtime/AgentThread.types';+import type { CurrentContextUsage } from '@truefoundry/utils-core/core/runtime/contextUsage';+import { getEmptyCurrentContextUsage } from '@truefoundry/utils-core/core/runtime/contextUsage';+import type { SandboxInfo } from '@truefoundry/utils-core/core/sandbox/Sandbox';import { sql, type Kysely, type QueryCreator, type RawBuilder, type Transaction } from 'kysely';import { isUniqueViolation } from '../../client';import { json } from '../../sqlExpressions';diff --git a/packages/server/src/db/postgres/token-store/PostgresOAuthTokenStore.ts b/packages/server/src/db/postgres/token-store/PostgresOAuthTokenStore.tsindex 45118913a..7331a9f79 100644--- a/packages/server/src/db/postgres/token-store/PostgresOAuthTokenStore.ts+++ b/packages/server/src/db/postgres/token-store/PostgresOAuthTokenStore.ts@@ -1,4 +1,4 @@-import type { IOAuthTokenStore, OAuthPendingAuthorization, OAuthToken } from '@truefoundry/utils/core';+import type { IOAuthTokenStore, OAuthPendingAuthorization, OAuthToken } from '@truefoundry/utils-core/core';import type { Kysely } from 'kysely';import { fromStoredOAuthToken, toStoredOAuthToken } from '../../mcpOAuthTypes';import type { Database } from '../types';diff --git a/packages/server/src/db/postgres/token-store/queries/pendingAuthorization.ts b/packages/server/src/db/postgres/token-store/queries/pendingAuthorization.tsindex 0d8de3b55..2dafbb935 100644--- a/packages/server/src/db/postgres/token-store/queries/pendingAuthorization.ts+++ b/packages/server/src/db/postgres/token-store/queries/pendingAuthorization.ts@@ -1,4 +1,4 @@-import type { OAuthPendingAuthorization } from '@truefoundry/utils/core';+import type { OAuthPendingAuthorization } from '@truefoundry/utils-core/core';import type { Kysely } from 'kysely';import { PENDING_AUTHORIZATION_TTL_MS, type OAuthPendingAuthorizationData } from '../../../mcpOAuthTypes';import { json, now, nowMinusMs } from '../../sqlExpressions';diff --git a/packages/server/src/db/postgres/types.ts b/packages/server/src/db/postgres/types.tsindex 9c9a3f9e9..9f70ffda1 100644--- a/packages/server/src/db/postgres/types.ts+++ b/packages/server/src/db/postgres/types.ts@@ -2,7 +2,7 @@* Live app schema for the runtime Kysely client / Postgres-backed session store.* Migrations must not use this type — use `Kysely<unknown>` instead.*/-import type { AgentSpec, PersistedTurnEvent, TurnInputItem, TurnState } from '@truefoundry/utils/agent-session';+import type { AgentSpec, PersistedTurnEvent, TurnInputItem, TurnState } from '@truefoundry/utils-core/agent-session';import type {AgentInfo,AgentParent,@@ -11,8 +11,8 @@ import type {MCPServerInitInfo,SandboxInfo,SubAgentCompletionMarker,-} from '@truefoundry/utils/core';-import type { CurrentContextUsage } from '@truefoundry/utils/core/runtime/contextUsage';+} from '@truefoundry/utils-core/core';+import type { CurrentContextUsage } from '@truefoundry/utils-core/core/runtime/contextUsage';import type { ColumnType, Generated, JSONColumnType } from 'kysely';import type { McpServerManifest } from '../../schemas/mcpServer';import type { ModelProviderManifest } from '../../schemas/modelProvider';diff --git a/packages/server/src/db/sqlite/mcp-server-store/SqliteMcpServerStore.ts b/packages/server/src/db/sqlite/mcp-server-store/SqliteMcpServerStore.tsindex 3bafedf98..38e1891c4 100644--- a/packages/server/src/db/sqlite/mcp-server-store/SqliteMcpServerStore.ts+++ b/packages/server/src/db/sqlite/mcp-server-store/SqliteMcpServerStore.ts@@ -1,4 +1,4 @@-import type { OAuthClientRecord } from '@truefoundry/utils/core';+import type { OAuthClientRecord } from '@truefoundry/utils-core/core';import type { ExpressionBuilder, Kysely } from 'kysely';import { ulid } from 'ulid';import type { McpServerManifest } from '../../../schemas/mcpServer';diff --git a/packages/server/src/db/sqlite/session-store/SqliteSessionStore.ts b/packages/server/src/db/sqlite/session-store/SqliteSessionStore.tsindex 90d60a042..eb85c9556 100644--- a/packages/server/src/db/sqlite/session-store/SqliteSessionStore.ts+++ b/packages/server/src/db/sqlite/session-store/SqliteSessionStore.ts@@ -1,7 +1,7 @@-import type { SessionRecord } from '@truefoundry/utils/agent-session/models/SessionRecord';-import type { TurnRecord } from '@truefoundry/utils/agent-session/models/TurnRecord';-import type { PersistedTurnEvent, SessionEventItem } from '@truefoundry/utils/agent-session/schemas/events';-import type { TokenPagination } from '@truefoundry/utils/agent-session/schemas/pagination';+import type { SessionRecord } from '@truefoundry/utils-core/agent-session/models/SessionRecord';+import type { TurnRecord } from '@truefoundry/utils-core/agent-session/models/TurnRecord';+import type { PersistedTurnEvent, SessionEventItem } from '@truefoundry/utils-core/agent-session/schemas/events';+import type { TokenPagination } from '@truefoundry/utils-core/agent-session/schemas/pagination';import type {AddThreadsInput,AppendToEventsInput,@@ -25,8 +25,11 @@ import type {TurnRecordWithoutSnapshot,UpdateSessionInput,UpdateTurnStateInput,-} from '@truefoundry/utils/agent-session/store/ISessionStore';-import { decodeOffsetPageToken, encodeOffsetPageToken } from '@truefoundry/utils/agent-session/store/OffsetPageToken';+} from '@truefoundry/utils-core/agent-session/store/ISessionStore';+import {+ decodeOffsetPageToken,+ encodeOffsetPageToken,+} from '@truefoundry/utils-core/agent-session/store/OffsetPageToken';import type { Kysely } from 'kysely';import type { Database } from '../types';import { patchThreadCapabilityState as patchThreadCapabilityStateQuery } from './queries/capabilities';diff --git a/packages/server/src/db/sqlite/session-store/queries/capabilities.ts b/packages/server/src/db/sqlite/session-store/queries/capabilities.tsindex fa372fb02..4a99b7f51 100644--- a/packages/server/src/db/sqlite/session-store/queries/capabilities.ts+++ b/packages/server/src/db/sqlite/session-store/queries/capabilities.ts@@ -1,4 +1,4 @@-import type { PatchThreadCapabilityStateInput } from '@truefoundry/utils/agent-session/store/ISessionStore';+import type { PatchThreadCapabilityStateInput } from '@truefoundry/utils-core/agent-session/store/ISessionStore';import { sql, type Kysely } from 'kysely';import { jsonbBind, nowIso } from '../../sqlExpressions';import type { Database } from '../../types';diff --git a/packages/server/src/db/sqlite/session-store/queries/events.ts b/packages/server/src/db/sqlite/session-store/queries/events.tsindex 0bfdf5521..424d363a3 100644--- a/packages/server/src/db/sqlite/session-store/queries/events.ts+++ b/packages/server/src/db/sqlite/session-store/queries/events.ts@@ -1,17 +1,20 @@-import type { PersistedTurnEvent, SessionEventItem } from '@truefoundry/utils/agent-session/schemas/events';-import type { TokenPagination } from '@truefoundry/utils/agent-session/schemas/pagination';+import type { PersistedTurnEvent, SessionEventItem } from '@truefoundry/utils-core/agent-session/schemas/events';+import type { TokenPagination } from '@truefoundry/utils-core/agent-session/schemas/pagination';import type {AppendToEventsInput,ListSessionEventsInput,ListTurnEventsInput,-} from '@truefoundry/utils/agent-session/store/ISessionStore';-import { decodeOffsetPageToken, paginateOffsetRows } from '@truefoundry/utils/agent-session/store/OffsetPageToken';+} from '@truefoundry/utils-core/agent-session/store/ISessionStore';+import { decodeOffsetPageToken, paginateOffsetRows } from '@truefoundry/utils-core/agent-session/store/OffsetPageToken';import {decodeSessionEventPageToken,paginateSessionEventRows,type SessionEventPageCursor,-} from '@truefoundry/utils/agent-session/store/SessionEventPageToken';-import { SessionNotFoundError, TurnNotFoundError } from '@truefoundry/utils/agent-session/store/SessionStoreErrors';+} from '@truefoundry/utils-core/agent-session/store/SessionEventPageToken';+import {+ SessionNotFoundError,+ TurnNotFoundError,+} from '@truefoundry/utils-core/agent-session/store/SessionStoreErrors';import { sql, type Kysely } from 'kysely';import { jsonbBind, jsonText } from '../../sqlExpressions';import type { Database } from '../../types';diff --git a/packages/server/src/db/sqlite/session-store/queries/sessions.ts b/packages/server/src/db/sqlite/session-store/queries/sessions.tsindex 46a36b700..447432c52 100644--- a/packages/server/src/db/sqlite/session-store/queries/sessions.ts+++ b/packages/server/src/db/sqlite/session-store/queries/sessions.ts@@ -1,18 +1,18 @@-import type { AgentSpec } from '@truefoundry/utils/agent-session';-import type { SessionRecord } from '@truefoundry/utils/agent-session/models/SessionRecord';+import type { AgentSpec } from '@truefoundry/utils-core/agent-session';+import type { SessionRecord } from '@truefoundry/utils-core/agent-session/models/SessionRecord';import type {CreateSessionInput,DeleteSessionInput,GetSessionInput,ListSessionsInput,UpdateSessionInput,-} from '@truefoundry/utils/agent-session/store/ISessionStore';-import { decodeOffsetPageToken, paginateOffsetRows } from '@truefoundry/utils/agent-session/store/OffsetPageToken';+} from '@truefoundry/utils-core/agent-session/store/ISessionStore';+import { decodeOffsetPageToken, paginateOffsetRows } from '@truefoundry/utils-core/agent-session/store/OffsetPageToken';import {SessionAlreadyExistsError,SessionNotFoundError,SessionStoreInvariantError,-} from '@truefoundry/utils/agent-session/store/SessionStoreErrors';+} from '@truefoundry/utils-core/agent-session/store/SessionStoreErrors';import { sql, type Kysely } from 'kysely';import { isUniqueViolation } from '../../client';import { jsonbBind, jsonText, nowIso } from '../../sqlExpressions';diff --git a/packages/server/src/db/sqlite/session-store/queries/threads.ts b/packages/server/src/db/sqlite/session-store/queries/threads.tsindex 852abbb58..a3f220215 100644--- a/packages/server/src/db/sqlite/session-store/queries/threads.ts+++ b/packages/server/src/db/sqlite/session-store/queries/threads.ts@@ -5,9 +5,9 @@ import type {PatchMCPServersInput,PatchSandboxInfoInput,RemoveThreadsInput,-} from '@truefoundry/utils/agent-session/store/ISessionStore';-import type { ContextMessage, SubAgentCompletionMarker } from '@truefoundry/utils/core/runtime/AgentThread.types';-import type { CurrentContextUsage } from '@truefoundry/utils/core/runtime/contextUsage';+} from '@truefoundry/utils-core/agent-session/store/ISessionStore';+import type { ContextMessage, SubAgentCompletionMarker } from '@truefoundry/utils-core/core/runtime/AgentThread.types';+import type { CurrentContextUsage } from '@truefoundry/utils-core/core/runtime/contextUsage';import { sql, type Kysely, type RawBuilder, type Transaction } from 'kysely';import { jsonbBind, jsonbSet, nowIso } from '../../sqlExpressions';import type { Database, TurnThreadCheckpoint } from '../../types';diff --git a/packages/server/src/db/sqlite/session-store/queries/turns.ts b/packages/server/src/db/sqlite/session-store/queries/turns.tsindex 5c282952a..53856d554 100644--- a/packages/server/src/db/sqlite/session-store/queries/turns.ts+++ b/packages/server/src/db/sqlite/session-store/queries/turns.ts@@ -1,16 +1,16 @@-import type { TurnRecord, TurnSnapshot } from '@truefoundry/utils/agent-session/models/TurnRecord';+import type { TurnRecord, TurnSnapshot } from '@truefoundry/utils-core/agent-session/models/TurnRecord';import {CancellationReason,type TerminalTurnState,type TurnInputItem,type TurnState,-} from '@truefoundry/utils/agent-session/schemas/turn';-import { assertCreateTurnThreadDelta } from '@truefoundry/utils/agent-session/store/assertCreateTurnThreadDelta';+} from '@truefoundry/utils-core/agent-session/schemas/turn';+import { assertCreateTurnThreadDelta } from '@truefoundry/utils-core/agent-session/store/assertCreateTurnThreadDelta';import type {FreezeAndGetTurnInput,TurnRecordWithoutSnapshot,UpdateTurnStateInput,-} from '@truefoundry/utils/agent-session/store/ISessionStore';+} from '@truefoundry/utils-core/agent-session/store/ISessionStore';import {PreviousTurnRunningError,SessionNotFoundError,@@ -20,13 +20,13 @@ import {TurnAlreadyExistsError,TurnNotFoundError,TurnNotRunningError,-} from '@truefoundry/utils/agent-session/store/SessionStoreErrors';-import type { CapabilityState, JsonValue } from '@truefoundry/utils/core/capabilities/AgentCapability';-import type { AgentInfo, AgentParent, MCPServerInitInfo } from '@truefoundry/utils/core/events/schema';-import type { AgentThreadSnapshot, ContextMessage } from '@truefoundry/utils/core/runtime/AgentThread.types';-import type { CurrentContextUsage } from '@truefoundry/utils/core/runtime/contextUsage';-import { getEmptyCurrentContextUsage } from '@truefoundry/utils/core/runtime/contextUsage';-import type { SandboxInfo } from '@truefoundry/utils/core/sandbox/Sandbox';+} from '@truefoundry/utils-core/agent-session/store/SessionStoreErrors';+import type { CapabilityState, JsonValue } from '@truefoundry/utils-core/core/capabilities/AgentCapability';+import type { AgentInfo, AgentParent, MCPServerInitInfo } from '@truefoundry/utils-core/core/events/schema';+import type { AgentThreadSnapshot, ContextMessage } from '@truefoundry/utils-core/core/runtime/AgentThread.types';+import type { CurrentContextUsage } from '@truefoundry/utils-core/core/runtime/contextUsage';+import { getEmptyCurrentContextUsage } from '@truefoundry/utils-core/core/runtime/contextUsage';+import type { SandboxInfo } from '@truefoundry/utils-core/core/sandbox/Sandbox';import { sql, type Kysely, type RawBuilder, type Transaction } from 'kysely';import { isUniqueViolation } from '../../client';import { jsonbBind, jsonText, nowIso } from '../../sqlExpressions';diff --git a/packages/server/src/db/sqlite/token-store/SqliteOAuthTokenStore.ts b/packages/server/src/db/sqlite/token-store/SqliteOAuthTokenStore.tsindex cf581d5c1..39d02b678 100644--- a/packages/server/src/db/sqlite/token-store/SqliteOAuthTokenStore.ts+++ b/packages/server/src/db/sqlite/token-store/SqliteOAuthTokenStore.ts@@ -1,4 +1,4 @@-import type { IOAuthTokenStore, OAuthPendingAuthorization, OAuthToken } from '@truefoundry/utils/core';+import type { IOAuthTokenStore, OAuthPendingAuthorization, OAuthToken } from '@truefoundry/utils-core/core';import type { Kysely } from 'kysely';import { fromStoredOAuthToken, toStoredOAuthToken } from '../../mcpOAuthTypes';import type { Database } from '../types';diff --git a/packages/server/src/db/sqlite/token-store/queries/pendingAuthorization.ts b/packages/server/src/db/sqlite/token-store/queries/pendingAuthorization.tsindex 5f420a497..8df808e8f 100644--- a/packages/server/src/db/sqlite/token-store/queries/pendingAuthorization.ts+++ b/packages/server/src/db/sqlite/token-store/queries/pendingAuthorization.ts@@ -1,4 +1,4 @@-import type { OAuthPendingAuthorization } from '@truefoundry/utils/core';+import type { OAuthPendingAuthorization } from '@truefoundry/utils-core/core';import { sql, type Kysely } from 'kysely';import { PENDING_AUTHORIZATION_TTL_MS, type OAuthPendingAuthorizationData } from '../../../mcpOAuthTypes';import { isoMsAgo, jsonbBind, jsonText, nowIso } from '../../sqlExpressions';diff --git a/packages/server/src/db/sqlite/types.ts b/packages/server/src/db/sqlite/types.tsindex 64b5a2007..1ed970a80 100644--- a/packages/server/src/db/sqlite/types.ts+++ b/packages/server/src/db/sqlite/types.ts@@ -5,7 +5,7 @@* JSON payload columns are BLOB JSONB on disk. Reads must project `json(column)`;* `ParseJSONResultsPlugin` (configured in createSqliteDb) parses those top-level columns only.*/-import type { AgentSpec, PersistedTurnEvent, TurnInputItem, TurnState } from '@truefoundry/utils/agent-session';+import type { AgentSpec, PersistedTurnEvent, TurnInputItem, TurnState } from '@truefoundry/utils-core/agent-session';import type {AgentInfo,AgentParent,@@ -14,8 +14,8 @@ import type {MCPServerInitInfo,SandboxInfo,SubAgentCompletionMarker,-} from '@truefoundry/utils/core';-import type { CurrentContextUsage } from '@truefoundry/utils/core/runtime/contextUsage';+} from '@truefoundry/utils-core/core';+import type { CurrentContextUsage } from '@truefoundry/utils-core/core/runtime/contextUsage';import type { ColumnType, Generated, JSONColumnType } from 'kysely';import type { McpServerManifest } from '../../schemas/mcpServer';import type { ModelProviderManifest } from '../../schemas/modelProvider';diff --git a/packages/server/src/main.ts b/packages/server/src/main.tsindex 14c5808e3..e75600ba9 100644--- a/packages/server/src/main.ts+++ b/packages/server/src/main.ts@@ -5,7 +5,7 @@* SQLite migrations are packaged under dist/ but are not run at startup.*/import { serve } from '@hono/node-server';-import type { TurnStreamingEvent } from '@truefoundry/utils/agent-session';+import type { TurnStreamingEvent } from '@truefoundry/utils-core/agent-session';import type { RedisClientType } from 'redis';import winston from 'winston';@@ -44,11 +44,11 @@ try {import('./legacy-registry-store/ModelStore'),import('./legacy-registry-store/McpStore'),import('./legacy-registry-store/SkillStore'),- import('@truefoundry/utils/agent-session'),+ import('@truefoundry/utils-core/agent-session'),import('./runtime/activeTurns'),import('./runtime/sandboxFactory'),import('./runtime/redis'),- import('@truefoundry/utils/request-reply'),+ import('@truefoundry/utils-core/request-reply'),import('./db/postgres/session-store/PostgresSessionStore'),import('./runtime/event-subscription'),import('./catalog/ModelCatalog'),diff --git a/packages/server/src/runtime/activeTurns.ts b/packages/server/src/runtime/activeTurns.tsindex 592348b55..e847ca1d4 100644--- a/packages/server/src/runtime/activeTurns.ts+++ b/packages/server/src/runtime/activeTurns.ts@@ -4,7 +4,7 @@* TurnHandle.stream() writes the terminal state when the signal fires.* `track()` owns registration and cleanup around the stream lifecycle.*/-import { CancellationReason } from '@truefoundry/utils/agent-session';+import { CancellationReason } from '@truefoundry/utils-core/agent-session';interface ActiveTurnRun {abortController: AbortController;diff --git a/packages/server/src/runtime/sandboxFactory.ts b/packages/server/src/runtime/sandboxFactory.tsindex f54acbfa5..6f65acb48 100644--- a/packages/server/src/runtime/sandboxFactory.ts+++ b/packages/server/src/runtime/sandboxFactory.ts@@ -8,8 +8,13 @@* Called from main.ts so a malformed SANDBOX_SETTINGS aborts startup instead* of failing mid-turn.*/-import type { TurnSandboxFactory } from '@truefoundry/utils/agent-session';-import { createSandboxProvider, Sandbox, SandboxProviderSettingsSchema, SkillMounter } from '@truefoundry/utils/core';+import type { TurnSandboxFactory } from '@truefoundry/utils-core/agent-session';+import {+ createSandboxProvider,+ Sandbox,+ SandboxProviderSettingsSchema,+ SkillMounter,+} from '@truefoundry/utils-core/core';import type { Logger } from 'winston';import { ZodError } from 'zod';import { TENANT_ID } from '../apis/sessions';diff --git a/packages/server/src/schemas/events.ts b/packages/server/src/schemas/events.tsindex 6527be6d4..7d14f2a35 100644--- a/packages/server/src/schemas/events.ts+++ b/packages/server/src/schemas/events.ts@@ -9,7 +9,7 @@ import {TokenPaginationSchema,TurnCreatedEventSchema,TurnDoneEventSchema,-} from '@truefoundry/utils/agent-session';+} from '@truefoundry/utils-core/agent-session';import {MCPAuthRequiredEventSchema,MCPInitializeEventSchema,@@ -21,9 +21,9 @@ import {ToolApprovalRequiredEventSchema,ToolResponseEventSchema,ToolResponseRequiredEventSchema,-} from '@truefoundry/utils/core';+} from '@truefoundry/utils-core/core';-export type { TurnCreatedEvent } from '@truefoundry/utils/agent-session';+export type { TurnCreatedEvent } from '@truefoundry/utils-core/agent-session';export { EventType };/** Live SSE stream for session turns — content events, deltas and lifecycle. */diff --git a/packages/server/src/schemas/session.ts b/packages/server/src/schemas/session.tsindex ec416da0a..25c33e2be 100644--- a/packages/server/src/schemas/session.ts+++ b/packages/server/src/schemas/session.ts@@ -5,9 +5,9 @@ import {SessionSchema,TokenPaginationSchema,UpdateSessionRequestSchema,-} from '@truefoundry/utils/agent-session';+} from '@truefoundry/utils-core/agent-session';-export type { Session } from '@truefoundry/utils/agent-session';+export type { Session } from '@truefoundry/utils-core/agent-session';export { CreateSessionRequestSchema, UpdateSessionRequestSchema };export const DEFAULT_SESSIONS_LIMIT = 10;diff --git a/packages/server/src/schemas/turn.ts b/packages/server/src/schemas/turn.tsindex bf0a59294..f92a82569 100644--- a/packages/server/src/schemas/turn.ts+++ b/packages/server/src/schemas/turn.ts@@ -1,9 +1,9 @@/** Server-only turn wire schemas (SSE resume / cancel / list). Core turn schemas live in agent-session. */import { z } from '@hono/zod-openapi';-import { SessionEventSchema, TokenPaginationSchema, TurnSchema } from '@truefoundry/utils/agent-session';+import { SessionEventSchema, TokenPaginationSchema, TurnSchema } from '@truefoundry/utils-core/agent-session';-export { CreateTurnRequestSchema, TurnSchema } from '@truefoundry/utils/agent-session';-export type { Turn } from '@truefoundry/utils/agent-session';+export { CreateTurnRequestSchema, TurnSchema } from '@truefoundry/utils-core/agent-session';+export type { Turn } from '@truefoundry/utils-core/agent-session';export const SubscribeTurnQuerySchema = z.object({diff --git a/packages/server/tests/db/mcpServerStoreContractSuite.ts b/packages/server/tests/db/mcpServerStoreContractSuite.tsindex 83f4946f0..b5192be36 100644--- a/packages/server/tests/db/mcpServerStoreContractSuite.ts+++ b/packages/server/tests/db/mcpServerStoreContractSuite.ts@@ -2,7 +2,7 @@* Backend-agnostic behavioural contract for IMcpServerStore.* Runs under jest against a fresh store per test (see backend test files).*/-import type { OAuthClientRecord } from '@truefoundry/utils/core';+import type { OAuthClientRecord } from '@truefoundry/utils-core/core';import type { IMcpServerStore } from '../../src/db/mcpServerStore';import type { McpServerManifest } from '../../src/schemas/mcpServer';diff --git a/packages/server/tests/db/oauthTokenStoreContractSuite.ts b/packages/server/tests/db/oauthTokenStoreContractSuite.tsindex a8ea2fdab..9beeb3196 100644--- a/packages/server/tests/db/oauthTokenStoreContractSuite.ts+++ b/packages/server/tests/db/oauthTokenStoreContractSuite.ts@@ -6,7 +6,7 @@* each backend supplies `seedResource` (create the FK parent) and `expirePending` (backdate a* pending row past its TTL).*/-import type { IOAuthTokenStore, OAuthPendingAuthorization, OAuthToken } from '@truefoundry/utils/core';+import type { IOAuthTokenStore, OAuthPendingAuthorization, OAuthToken } from '@truefoundry/utils-core/core';export interface OAuthTokenStoreHarness {store: IOAuthTokenStore;diff --git a/packages/server/tests/db/postgres/session-store/contract.test.ts b/packages/server/tests/db/postgres/session-store/contract.test.tsindex 9c87b8bee..6d895854a 100644--- a/packages/server/tests/db/postgres/session-store/contract.test.ts+++ b/packages/server/tests/db/postgres/session-store/contract.test.ts@@ -1,4 +1,4 @@-import type { ISessionStore } from '@truefoundry/utils/agent-session/store/ISessionStore';+import type { ISessionStore } from '@truefoundry/utils-core/agent-session/store/ISessionStore';import { sql } from 'kysely';import { runStoreContractSuite } from '../../../../../harness/tests/agent-session/store/storeContractSuite';diff --git a/packages/server/tests/db/sqlite/session-store/contract.test.ts b/packages/server/tests/db/sqlite/session-store/contract.test.tsindex e0d6c4f2c..766500f40 100644--- a/packages/server/tests/db/sqlite/session-store/contract.test.ts+++ b/packages/server/tests/db/sqlite/session-store/contract.test.ts@@ -1,4 +1,4 @@-import type { ISessionStore } from '@truefoundry/utils/agent-session/store/ISessionStore';+import type { ISessionStore } from '@truefoundry/utils-core/agent-session/store/ISessionStore';import { runStoreContractSuite } from '../../../../../harness/tests/agent-session/store/storeContractSuite';import { SqliteSessionStore } from '../../../../src/db/sqlite/session-store/SqliteSessionStore';diff --git a/packages/server/tests/unit/apis/deletedSessionCrud.test.ts b/packages/server/tests/unit/apis/deletedSessionCrud.test.tsindex ed82b9586..a639d4109 100644--- a/packages/server/tests/unit/apis/deletedSessionCrud.test.ts+++ b/packages/server/tests/unit/apis/deletedSessionCrud.test.ts@@ -1,6 +1,6 @@import { OpenAPIHono } from '@hono/zod-openapi';-import { InMemorySessionStore, Sessions } from '@truefoundry/utils/agent-session';-import { RequestReplyRouter } from '@truefoundry/utils/request-reply';+import { InMemorySessionStore, Sessions } from '@truefoundry/utils-core/agent-session';+import { RequestReplyRouter } from '@truefoundry/utils-core/request-reply';import { createClient } from 'redis';import { createLogger } from 'winston';import { createSessionsRouter, TENANT_ID } from '../../../src/apis/sessions';diff --git a/packages/server/tests/unit/apis/mcpOAuth.test.ts b/packages/server/tests/unit/apis/mcpOAuth.test.tsindex c596f5cd9..ec8e6210d 100644--- a/packages/server/tests/unit/apis/mcpOAuth.test.ts+++ b/packages/server/tests/unit/apis/mcpOAuth.test.ts@@ -2,7 +2,7 @@* Authorize + OAuth callback against real sqlite stores with fetch stubbed* (same pattern as packages/harness MCP OAuth tests).*/-import { mcpOAuthCallbackUrl } from '@truefoundry/utils/core';+import { mcpOAuthCallbackUrl } from '@truefoundry/utils-core/core';import winston from 'winston';import { createMcpOAuthRouter } from '../../../src/apis/mcpOAuth';import { createMcpServersRouter } from '../../../src/apis/mcpServers';diff --git a/packages/server/tests/unit/apis/sessions.test.ts b/packages/server/tests/unit/apis/sessions.test.tsindex e59ee16ce..ce57cee69 100644--- a/packages/server/tests/unit/apis/sessions.test.ts+++ b/packages/server/tests/unit/apis/sessions.test.ts@@ -1,5 +1,5 @@-import type { ISessionStore, TurnRecord, TurnState } from '@truefoundry/utils/agent-session';-import { CancellationReason } from '@truefoundry/utils/agent-session';+import type { ISessionStore, TurnRecord, TurnState } from '@truefoundry/utils-core/agent-session';+import { CancellationReason } from '@truefoundry/utils-core/agent-session';import { HTTPException } from 'hono/http-exception';import { createClient, type RedisClientType } from 'redis';import { cancelSessionTurn } from '../../../src/apis/sessions';diff --git a/packages/server/tests/unit/apis/turnStreamAfterDelete.test.ts b/packages/server/tests/unit/apis/turnStreamAfterDelete.test.tsindex 23542d66b..b4478a714 100644--- a/packages/server/tests/unit/apis/turnStreamAfterDelete.test.ts+++ b/packages/server/tests/unit/apis/turnStreamAfterDelete.test.ts@@ -1,6 +1,6 @@import { OpenAPIHono } from '@hono/zod-openapi';-import type { Sessions } from '@truefoundry/utils/agent-session';-import { InMemorySessionStore, TurnNotFoundError } from '@truefoundry/utils/agent-session';+import type { Sessions } from '@truefoundry/utils-core/agent-session';+import { InMemorySessionStore, TurnNotFoundError } from '@truefoundry/utils-core/agent-session';import { createLogger } from 'winston';import { createTurnsRouter } from '../../../src/apis/turns';import { McpStore } from '../../../src/legacy-registry-store/McpStore';diff --git a/packages/server/tests/unit/runtime/activeTurns.test.ts b/packages/server/tests/unit/runtime/activeTurns.test.tsindex 136a05ea7..322fb0911 100644--- a/packages/server/tests/unit/runtime/activeTurns.test.ts+++ b/packages/server/tests/unit/runtime/activeTurns.test.ts@@ -1,4 +1,4 @@-import { CancellationReason } from '@truefoundry/utils/agent-session';+import { CancellationReason } from '@truefoundry/utils-core/agent-session';import { ActiveTurnRegistry } from '../../../src/runtime/activeTurns';async function* values<T>(items: T[]): AsyncGenerator<T> {diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex dcc2419dd..248696805 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -206,7 +206,7 @@ importers:'@hono/zod-openapi':specifier: ^0.19.10version: 0.19.10([email protected])([email protected])- '@truefoundry/utils':+ '@truefoundry/utils-core':specifier: workspace:*version: link:../harnessbetter-sqlite3: