The open-source agent harness - the runtime layer that turns an LLM into a working agent.
MCP catalog and CRUD impl (#31)
Srajan Asthanaf98c42300685
diff --git a/.gitignore b/.gitignoreindex 1623a77c4..62313fea0 100644--- a/.gitignore+++ b/.gitignore@@ -12,5 +12,7 @@ coverage/.eslintcachepackages/harness/src/core/sandbox/sandboxScripts.gen.tspackages/server/src/catalog/modelCatalog.gen.ts+packages/server/src/catalog/mcpCatalog.gen.ts+packages/server/src/catalog/skillCatalog.gen.tsui-shots/*.pngdata/diff --git a/fern/openapi/openapi.json b/fern/openapi/openapi.jsonindex 036b762b5..d1f30c7ae 100644--- a/fern/openapi/openapi.json+++ b/fern/openapi/openapi.json@@ -304,6 +304,31 @@"properties": {},"type": "object"},+ "CatalogMcpServer": {+ "additionalProperties": false,+ "properties": {+ "auth": {+ "$ref": "#/components/schemas/ConfiguredMcpServerAuth"+ },+ "name": {+ "$ref": "#/components/schemas/ResourceName"+ },+ "type": {+ "$ref": "#/components/schemas/McpServerType"+ },+ "url": {+ "description": "URL of the remote MCP server.",+ "format": "uri",+ "type": "string"+ }+ },+ "required": [+ "type",+ "name",+ "url"+ ],+ "type": "object"+ },"CatalogProvider": {"additionalProperties": false,"properties": {@@ -332,6 +357,47 @@],"type": "object"},+ "CatalogSkill": {+ "additionalProperties": false,+ "properties": {+ "description": {+ "description": "Concise guidance for when the agent should use the skill.",+ "minLength": 1,+ "type": "string"+ },+ "name": {+ "$ref": "#/components/schemas/ResourceName"+ },+ "path": {+ "description": "Path to the skill directory within the repository. Omit to use the repository root.",+ "minLength": 1,+ "pattern": "^[A-Za-z0-9._\\-/]+$",+ "type": "string"+ },+ "ref": {+ "description": "Git ref — branch name, tag, or commit SHA.",+ "minLength": 1,+ "pattern": "^[A-Za-z0-9._\\-/]+$",+ "type": "string"+ },+ "type": {+ "$ref": "#/components/schemas/SkillType"+ },+ "url": {+ "description": "Full HTTPS URL of a GitHub or GitLab repository.",+ "minLength": 1,+ "pattern": "^https:\\/\\/(github\\.com\\/[A-Za-z0-9._-]+\\/[A-Za-z0-9._-]+|gitlab\\.com\\/[A-Za-z0-9._-]+(?:\\/[A-Za-z0-9._-]+)+)(\\/|\\.git)?$",+ "type": "string"+ }+ },+ "required": [+ "type",+ "name",+ "url",+ "description"+ ],+ "type": "object"+ },"ChatCompletionChunkDeltaToolCall": {"properties": {"function": {@@ -434,6 +500,72 @@],"type": "object"},+ "ConfiguredMcpAuthorizeResponse": {+ "properties": {+ "authorization_url": {+ "description": "Present only when status is auth_required.",+ "format": "uri",+ "type": "string"+ },+ "status": {+ "enum": [+ "authenticated",+ "auth_required"+ ],+ "type": "string"+ }+ },+ "required": [+ "status"+ ],+ "type": "object"+ },+ "ConfiguredMcpServer": {+ "additionalProperties": false,+ "properties": {+ "auth": {+ "$ref": "#/components/schemas/ConfiguredMcpServerAuth"+ },+ "auth_status": {+ "$ref": "#/components/schemas/McpAuthStatus"+ },+ "name": {+ "$ref": "#/components/schemas/ResourceName"+ },+ "type": {+ "$ref": "#/components/schemas/McpServerType"+ },+ "url": {+ "description": "URL of the remote MCP server.",+ "format": "uri",+ "type": "string"+ }+ },+ "required": [+ "type",+ "name",+ "url",+ "auth_status"+ ],+ "type": "object"+ },+ "ConfiguredMcpServerAuth": {+ "discriminator": {+ "mapping": {+ "dcr": "#/components/schemas/McpServerDcrAuth",+ "header": "#/components/schemas/McpServerHeaderAuth"+ },+ "propertyName": "type"+ },+ "oneOf": [+ {+ "$ref": "#/components/schemas/McpServerHeaderAuth"+ },+ {+ "$ref": "#/components/schemas/McpServerDcrAuth"+ }+ ]+ },"ContextManagementConfig": {"default": {"compaction": {@@ -652,6 +784,20 @@],"type": "object"},+ "GetMcpServerCatalogResponse": {+ "properties": {+ "data": {+ "items": {+ "$ref": "#/components/schemas/CatalogMcpServer"+ },+ "type": "array"+ }+ },+ "required": [+ "data"+ ],+ "type": "object"+ },"GetModelProviderCatalogResponse": {"properties": {"data": {@@ -677,6 +823,20 @@],"type": "object"},+ "GetSkillCatalogResponse": {+ "properties": {+ "data": {+ "items": {+ "$ref": "#/components/schemas/CatalogSkill"+ },+ "type": "array"+ }+ },+ "required": [+ "data"+ ],+ "type": "object"+ },"GetTurnResponse": {"properties": {"data": {@@ -752,6 +912,62 @@},"type": "object"},+ "ListAvailableMcpServersResponse": {+ "properties": {+ "data": {+ "items": {+ "$ref": "#/components/schemas/McpServerReadEntry"+ },+ "type": "array"+ }+ },+ "required": [+ "data"+ ],+ "type": "object"+ },+ "ListAvailableSkillsResponse": {+ "properties": {+ "data": {+ "items": {+ "$ref": "#/components/schemas/SkillReadEntry"+ },+ "type": "array"+ }+ },+ "required": [+ "data"+ ],+ "type": "object"+ },+ "ListConfiguredMcpServersResponse": {+ "properties": {+ "data": {+ "items": {+ "$ref": "#/components/schemas/ConfiguredMcpServer"+ },+ "type": "array"+ }+ },+ "required": [+ "data"+ ],+ "type": "object"+ },+ "ListConfiguredSkillsResponse": {+ "properties": {+ "data": {+ "items": {+ "$ref": "#/components/schemas/SkillManifest"+ },+ "type": "array"+ }+ },+ "required": [+ "data"+ ],+ "type": "object"+ },"ListLegacyModelsResponse": {"properties": {"data": {@@ -795,6 +1011,22 @@],"type": "object"},+ "ListMcpServerToolsResponse": {+ "properties": {+ "data": {+ "description": "MCP `tools/list` entries, passed through verbatim from the MCP server.",+ "items": {+ "additionalProperties": {},+ "type": "object"+ },+ "type": "array"+ }+ },+ "required": [+ "data"+ ],+ "type": "object"+ },"ListMcpServersResponse": {"properties": {"data": {@@ -1187,6 +1419,27 @@],"type": "object"},+ "McpAuthStatus": {+ "additionalProperties": false,+ "properties": {+ "authorization_url": {+ "description": "Present only when status is auth_required and a live authorize flow produced a URL.",+ "format": "uri",+ "type": "string"+ },+ "status": {+ "enum": [+ "authenticated",+ "auth_required"+ ],+ "type": "string"+ }+ },+ "required": [+ "status"+ ],+ "type": "object"+ },"McpAuthorizeResponse": {"properties": {"auth_url": {@@ -1225,6 +1478,21 @@}]},+ "McpServerDcrAuth": {+ "additionalProperties": false,+ "properties": {+ "type": {+ "enum": [+ "dcr"+ ],+ "type": "string"+ }+ },+ "required": [+ "type"+ ],+ "type": "object"+ },"McpServerEntry": {"additionalProperties": false,"properties": {@@ -1256,38 +1524,110 @@],"type": "object"},- "Model": {+ "McpServerHeaderAuth": {"additionalProperties": false,"properties": {- "model_id": {- "description": "Upstream, provider-specific identifier sent to the provider API.",- "type": "string"+ "headers": {+ "additionalProperties": {+ "minLength": 1,+ "type": "string"+ },+ "description": "HTTP headers sent on each request to this MCP server.",+ "type": "object"},- "name": {- "description": "Fully qualified name `name/model_name`, e.g. \"openai/gpt-5-6-sol\".",+ "type": {+ "enum": [+ "header"+ ],"type": "string"- },- "properties": {- "$ref": "#/components/schemas/ModelProperties"}},"required": [- "name",- "model_id",- "properties"+ "type",+ "headers"],"type": "object"},- "ModelEntry": {+ "McpServerManifest": {"additionalProperties": false,"properties": {- "model_id": {- "description": "Upstream, provider-specific identifier sent to the provider API.",- "minLength": 1,- "type": "string"+ "auth": {+ "$ref": "#/components/schemas/ConfiguredMcpServerAuth"},"name": {- "allOf": [+ "$ref": "#/components/schemas/ResourceName"+ },+ "type": {+ "$ref": "#/components/schemas/McpServerType"+ },+ "url": {+ "description": "URL of the remote MCP server.",+ "format": "uri",+ "type": "string"+ }+ },+ "required": [+ "type",+ "name",+ "url"+ ],+ "type": "object"+ },+ "McpServerReadEntry": {+ "additionalProperties": false,+ "properties": {+ "name": {+ "$ref": "#/components/schemas/ResourceName"+ },+ "url": {+ "format": "uri",+ "type": "string"+ }+ },+ "required": [+ "name",+ "url"+ ],+ "type": "object"+ },+ "McpServerType": {+ "enum": [+ "remote"+ ],+ "type": "string"+ },+ "Model": {+ "additionalProperties": false,+ "properties": {+ "model_id": {+ "description": "Upstream, provider-specific identifier sent to the provider API.",+ "type": "string"+ },+ "name": {+ "description": "Fully qualified name `name/model_name`, e.g. \"openai/gpt-5-6-sol\".",+ "type": "string"+ },+ "properties": {+ "$ref": "#/components/schemas/ModelProperties"+ }+ },+ "required": [+ "name",+ "model_id",+ "properties"+ ],+ "type": "object"+ },+ "ModelEntry": {+ "additionalProperties": false,+ "properties": {+ "model_id": {+ "description": "Upstream, provider-specific identifier sent to the provider API.",+ "minLength": 1,+ "type": "string"+ },+ "name": {+ "allOf": [{"$ref": "#/components/schemas/ResourceName"},@@ -1667,6 +2007,17 @@],"type": "string"},+ "PutMcpServerResponse": {+ "properties": {+ "data": {+ "$ref": "#/components/schemas/ConfiguredMcpServer"+ }+ },+ "required": [+ "data"+ ],+ "type": "object"+ },"PutModelProviderResponse": {"properties": {"data": {@@ -1678,6 +2029,17 @@],"type": "object"},+ "PutSkillResponse": {+ "properties": {+ "data": {+ "$ref": "#/components/schemas/SkillManifest"+ }+ },+ "required": [+ "data"+ ],+ "type": "object"+ },"RawToolCall": {"allOf": [{@@ -2077,6 +2439,47 @@],"type": "object"},+ "SkillManifest": {+ "additionalProperties": false,+ "properties": {+ "description": {+ "description": "Concise guidance for when the agent should use the skill.",+ "minLength": 1,+ "type": "string"+ },+ "name": {+ "$ref": "#/components/schemas/ResourceName"+ },+ "path": {+ "description": "Path to the skill directory within the repository. Omit to use the repository root.",+ "minLength": 1,+ "pattern": "^[A-Za-z0-9._\\-/]+$",+ "type": "string"+ },+ "ref": {+ "description": "Git ref — branch name, tag, or commit SHA.",+ "minLength": 1,+ "pattern": "^[A-Za-z0-9._\\-/]+$",+ "type": "string"+ },+ "type": {+ "$ref": "#/components/schemas/SkillType"+ },+ "url": {+ "description": "Full HTTPS URL of a GitHub or GitLab repository.",+ "minLength": 1,+ "pattern": "^https:\\/\\/(github\\.com\\/[A-Za-z0-9._-]+\\/[A-Za-z0-9._-]+|gitlab\\.com\\/[A-Za-z0-9._-]+(?:\\/[A-Za-z0-9._-]+)+)(\\/|\\.git)?$",+ "type": "string"+ }+ },+ "required": [+ "type",+ "name",+ "url",+ "description"+ ],+ "type": "object"+ },"SkillMount": {"properties": {"description": {@@ -2125,6 +2528,30 @@],"type": "object"},+ "SkillReadEntry": {+ "additionalProperties": false,+ "properties": {+ "description": {+ "description": "Concise guidance for when the agent should use the skill.",+ "minLength": 1,+ "type": "string"+ },+ "name": {+ "$ref": "#/components/schemas/ResourceName"+ }+ },+ "required": [+ "name",+ "description"+ ],+ "type": "object"+ },+ "SkillType": {+ "enum": [+ "git"+ ],+ "type": "string"+ },"TextContent": {"properties": {"text": {@@ -3258,6 +3685,31 @@"x-fern-sdk-method-name": "list"}},+ "/api/v1/mcp-servers": {+ "get": {+ "description": "Configured MCP servers as a slim name/url list for the composer. No auth or auth_status.",+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ListAvailableMcpServersResponse"+ }+ }+ },+ "description": "All configured MCP servers (chat projection)."+ }+ },+ "summary": "List MCP servers for chat",+ "tags": [+ "MCP Servers"+ ],+ "x-fern-sdk-group-name": [+ "mcpServers"+ ],+ "x-fern-sdk-method-name": "list"+ }+ },"/api/v1/models": {"get": {"description": "Models across all configured model providers, addressed by fully qualified name `name/model_name`.",@@ -4089,6 +4541,231 @@"x-fern-sdk-method-name": "list_turn_events"}},+ "/api/v1/settings/mcp-servers": {+ "get": {+ "description": "All configured MCP servers with nested auth_status (settings / admin projection).",+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ListConfiguredMcpServersResponse"+ }+ }+ },+ "description": "All configured MCP servers."+ }+ },+ "summary": "List configured MCP servers",+ "tags": [+ "MCP Servers"+ ],+ "x-fern-sdk-group-name": [+ "settings",+ "mcpServers"+ ],+ "x-fern-sdk-method-name": "list"+ },+ "put": {+ "description": "Full upsert keyed by `name`: creates the server or replaces its manifest. Does not start DCR or modify stored oauth_server / oauth_client columns.",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/McpServerManifest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/PutMcpServerResponse"+ }+ }+ },+ "description": "The saved MCP server with stub auth_status."+ },+ "400": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RequestErrorResponse"+ }+ }+ },+ "description": "Invalid request body."+ }+ },+ "summary": "Create or replace an MCP server",+ "tags": [+ "MCP Servers"+ ],+ "x-fern-sdk-group-name": [+ "settings",+ "mcpServers"+ ],+ "x-fern-sdk-method-name": "upsert"+ }+ },+ "/api/v1/settings/mcp-servers/catalog": {+ "get": {+ "description": "MCP server presets shipped with the server (mcp-catalog.yaml). Discovery-only: copy an entry into PUT /settings/mcp-servers to configure it.",+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GetMcpServerCatalogResponse"+ }+ }+ },+ "description": "The shipped catalog, verbatim."+ }+ },+ "summary": "Get the MCP catalog",+ "tags": [+ "MCP Servers"+ ],+ "x-fern-sdk-group-name": [+ "settings",+ "mcpServers"+ ],+ "x-fern-sdk-method-name": "catalog"+ }+ },+ "/api/v1/settings/mcp-servers/{name}/authorize": {+ "get": {+ "description": "Stub: returns authenticated when the server has no auth or header credentials on the row; auth_required with a placeholder authorization URL when auth.type is dcr. Real DCR lands in a follow-up.",+ "parameters": [+ {+ "description": "Configured MCP server name.",+ "in": "path",+ "name": "name",+ "required": true,+ "schema": {+ "description": "Configured MCP server name.",+ "minLength": 1,+ "type": "string"+ }+ },+ {+ "description": "Where to send the browser after OAuth completes.",+ "in": "query",+ "name": "redirect_url",+ "required": true,+ "schema": {+ "description": "Where to send the browser after OAuth completes.",+ "format": "uri",+ "type": "string"+ }+ }+ ],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ConfiguredMcpAuthorizeResponse"+ }+ }+ },+ "description": "Either already authenticated, or an authorization URL to redirect to."+ },+ "404": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RequestErrorResponse"+ }+ }+ },+ "description": "MCP server not found."+ }+ },+ "summary": "Start (or short-circuit) the auth flow for a configured MCP server",+ "tags": [+ "MCP Servers"+ ],+ "x-fern-sdk-group-name": [+ "settings",+ "mcpServers"+ ],+ "x-fern-sdk-method-name": "authorize"+ }+ },+ "/api/v1/settings/mcp-servers/{name}/tools": {+ "get": {+ "description": "All tools exposed by the given configured MCP server (non-paginated), as returned by the MCP `tools/list` call.",+ "parameters": [+ {+ "description": "Configured MCP server name.",+ "in": "path",+ "name": "name",+ "required": true,+ "schema": {+ "description": "Configured MCP server name.",+ "minLength": 1,+ "type": "string"+ }+ }+ ],+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ListMcpServerToolsResponse"+ }+ }+ },+ "description": "All tools of the MCP server."+ },+ "401": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RequestErrorResponse"+ }+ }+ },+ "description": "The MCP server requires authentication."+ },+ "404": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RequestErrorResponse"+ }+ }+ },+ "description": "MCP server not found."+ },+ "502": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RequestErrorResponse"+ }+ }+ },+ "description": "The MCP server could not be reached or returned an error."+ }+ },+ "summary": "List tools of a configured MCP server",+ "tags": [+ "MCP Servers"+ ],+ "x-fern-sdk-group-name": [+ "settings",+ "mcpServers"+ ],+ "x-fern-sdk-method-name": "list_tools"+ }+ },"/api/v1/settings/model-providers": {"get": {"description": "All configured providers with their models.",@@ -4184,6 +4861,127 @@],"x-fern-sdk-method-name": "catalog"}+ },+ "/api/v1/settings/skills": {+ "get": {+ "description": "All configured skills with full manifests (settings / admin projection).",+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ListConfiguredSkillsResponse"+ }+ }+ },+ "description": "All configured skills."+ }+ },+ "summary": "List configured skills",+ "tags": [+ "Skills"+ ],+ "x-fern-sdk-group-name": [+ "settings",+ "skills"+ ],+ "x-fern-sdk-method-name": "list"+ },+ "put": {+ "description": "Full upsert keyed by `name`: creates the skill or replaces its entire manifest.",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SkillManifest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/PutSkillResponse"+ }+ }+ },+ "description": "The saved skill."+ },+ "400": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RequestErrorResponse"+ }+ }+ },+ "description": "Invalid request body."+ }+ },+ "summary": "Create or replace a skill",+ "tags": [+ "Skills"+ ],+ "x-fern-sdk-group-name": [+ "settings",+ "skills"+ ],+ "x-fern-sdk-method-name": "upsert"+ }+ },+ "/api/v1/settings/skills/catalog": {+ "get": {+ "description": "Skill presets shipped with the server (skill-catalog.yaml). Discovery-only: copy an entry into PUT /settings/skills to configure it.",+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GetSkillCatalogResponse"+ }+ }+ },+ "description": "The shipped catalog, verbatim."+ }+ },+ "summary": "Get the skill catalog",+ "tags": [+ "Skills"+ ],+ "x-fern-sdk-group-name": [+ "settings",+ "skills"+ ],+ "x-fern-sdk-method-name": "catalog"+ }+ },+ "/api/v1/skills": {+ "get": {+ "description": "Configured skills as a slim name/description list for the composer.",+ "responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ListAvailableSkillsResponse"+ }+ }+ },+ "description": "All configured skills (chat projection)."+ }+ },+ "summary": "List skills for chat",+ "tags": [+ "Skills"+ ],+ "x-fern-sdk-group-name": [+ "skills"+ ],+ "x-fern-sdk-method-name": "list"+ }}},"webhooks": {}diff --git a/packages/sdk/.fern/metadata.json b/packages/sdk/.fern/metadata.jsonindex 906a3a4e5..c428fcbcb 100644--- a/packages/sdk/.fern/metadata.json+++ b/packages/sdk/.fern/metadata.json@@ -26,7 +26,7 @@"streamType": "web","useDefaultRequestParameterValues": true},- "originGitCommit": "0e17a9cb712eccd6768612277b0e0753a98f3ec8",+ "originGitCommit": "d6feb6f99b8379b4d4d21f4879ba997976282fbd","originGitCommitIsDirty": true,"invokedBy": "ci","requestedVersion": "0.0.0",diff --git a/packages/sdk/package.json b/packages/sdk/package.jsonindex 7ad5c53f8..01af8b67a 100644--- a/packages/sdk/package.json+++ b/packages/sdk/package.json@@ -40,6 +40,17 @@},"default": "./dist/cjs/api/resources/server/exports.js"},+ "./mcpServers": {+ "import": {+ "types": "./dist/esm/api/resources/mcpServers/exports.d.mts",+ "default": "./dist/esm/api/resources/mcpServers/exports.mjs"+ },+ "require": {+ "types": "./dist/cjs/api/resources/mcpServers/exports.d.ts",+ "default": "./dist/cjs/api/resources/mcpServers/exports.js"+ },+ "default": "./dist/cjs/api/resources/mcpServers/exports.js"+ },"./models": {"import": {"types": "./dist/esm/api/resources/models/exports.d.mts",@@ -62,6 +73,17 @@},"default": "./dist/cjs/api/resources/sessions/exports.js"},+ "./skills": {+ "import": {+ "types": "./dist/esm/api/resources/skills/exports.d.mts",+ "default": "./dist/esm/api/resources/skills/exports.mjs"+ },+ "require": {+ "types": "./dist/cjs/api/resources/skills/exports.d.ts",+ "default": "./dist/cjs/api/resources/skills/exports.js"+ },+ "default": "./dist/cjs/api/resources/skills/exports.js"+ },"./legacy": {"import": {"types": "./dist/esm/api/resources/legacy/exports.d.mts",@@ -117,6 +139,17 @@},"default": "./dist/cjs/api/resources/settings/exports.js"},+ "./settings/mcpServers": {+ "import": {+ "types": "./dist/esm/api/resources/settings/resources/mcpServers/exports.d.mts",+ "default": "./dist/esm/api/resources/settings/resources/mcpServers/exports.mjs"+ },+ "require": {+ "types": "./dist/cjs/api/resources/settings/resources/mcpServers/exports.d.ts",+ "default": "./dist/cjs/api/resources/settings/resources/mcpServers/exports.js"+ },+ "default": "./dist/cjs/api/resources/settings/resources/mcpServers/exports.js"+ },"./settings/modelProviders": {"import": {"types": "./dist/esm/api/resources/settings/resources/modelProviders/exports.d.mts",@@ -128,6 +161,17 @@},"default": "./dist/cjs/api/resources/settings/resources/modelProviders/exports.js"},+ "./settings/skills": {+ "import": {+ "types": "./dist/esm/api/resources/settings/resources/skills/exports.d.mts",+ "default": "./dist/esm/api/resources/settings/resources/skills/exports.mjs"+ },+ "require": {+ "types": "./dist/cjs/api/resources/settings/resources/skills/exports.d.ts",+ "default": "./dist/cjs/api/resources/settings/resources/skills/exports.js"+ },+ "default": "./dist/cjs/api/resources/settings/resources/skills/exports.js"+ },"./package.json": "./package.json"},"files": [diff --git a/packages/sdk/reference.md b/packages/sdk/reference.mdindex bd91e3dd9..693ed22e1 100644--- a/packages/sdk/reference.md+++ b/packages/sdk/reference.md@@ -51,6 +51,62 @@ await client.server.getCapabilities();</dl>+</dd>+</dl>+</details>++## McpServers+<details><summary><code>client.mcpServers.<a href="/src/api/resources/mcpServers/client/Client.ts">list</a>() -> TrueHarness.ListAvailableMcpServersResponse</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++Configured MCP servers as a slim name/url list for the composer. No auth or auth_status.+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.mcpServers.list();++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**requestOptions:** `McpServersClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>++</dd></dl></details>@@ -308,6 +364,69 @@ await client.sessions.get("sessionId");</dl>+</dd>+</dl>+</details>++<details><summary><code>client.sessions.<a href="/src/api/resources/sessions/client/Client.ts">delete</a>(sessionId) -> void</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++Delete a session and all related turns, events, and internal state. Idempotent if already gone.+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.sessions.delete("sessionId");++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**sessionId:** `string` — Session identifier.++</dd>+</dl>++<dl>+<dd>++**requestOptions:** `SessionsClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>++</dd></dl></details>@@ -817,6 +936,62 @@ await client.sessions.listTurnEvents("sessionId", "turnId");</dl>+</dd>+</dl>+</details>++## Skills+<details><summary><code>client.skills.<a href="/src/api/resources/skills/client/Client.ts">list</a>() -> TrueHarness.ListAvailableSkillsResponse</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++Configured skills as a slim name/description list for the composer.+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.skills.list();++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**requestOptions:** `SkillsClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>++</dd></dl></details>@@ -1125,8 +1300,8 @@ await client.legacy.skills.list();</dl></details>-## Settings ModelProviders-<details><summary><code>client.settings.modelProviders.<a href="/src/api/resources/settings/resources/modelProviders/client/Client.ts">list</a>() -> TrueHarness.ListModelProvidersResponse</code></summary>+## Settings McpServers+<details><summary><code>client.settings.mcpServers.<a href="/src/api/resources/settings/resources/mcpServers/client/Client.ts">list</a>() -> TrueHarness.ListConfiguredMcpServersResponse</code></summary><dl><dd>@@ -1138,7 +1313,7 @@ await client.legacy.skills.list();<dl><dd>-All configured providers with their models.+All configured MCP servers with nested auth_status (settings / admin projection).</dd></dl></dd>@@ -1153,7 +1328,7 @@ All configured providers with their models.<dd>```typescript-await client.settings.modelProviders.list();+await client.settings.mcpServers.list();```</dd>@@ -1169,7 +1344,7 @@ await client.settings.modelProviders.list();<dl><dd>-**requestOptions:** `ModelProvidersClient.RequestOptions`+**requestOptions:** `McpServersClient.RequestOptions`</dd></dl>@@ -1181,7 +1356,7 @@ await client.settings.modelProviders.list();</dl></details>-<details><summary><code>client.settings.modelProviders.<a href="/src/api/resources/settings/resources/modelProviders/client/Client.ts">upsert</a>({ ...params }) -> TrueHarness.PutModelProviderResponse</code></summary>+<details><summary><code>client.settings.mcpServers.<a href="/src/api/resources/settings/resources/mcpServers/client/Client.ts">upsert</a>({ ...params }) -> TrueHarness.PutMcpServerResponse</code></summary><dl><dd>@@ -1193,7 +1368,7 @@ await client.settings.modelProviders.list();<dl><dd>-Full upsert keyed by `name`: creates the provider or replaces its entire configuration (models included).+Full upsert keyed by `name`: creates the server or replaces its manifest. Does not start DCR or modify stored oauth_server / oauth_client columns.</dd></dl></dd>@@ -1208,21 +1383,9 @@ Full upsert keyed by `name`: creates the provider or replaces its entire configu<dd>```typescript-await client.settings.modelProviders.upsert({- auth: {- apiKey: "api_key"- },- baseUrl: "base_url",- models: [{- modelId: "model_id",- name: "name",- properties: {- contextLength: 1,- maxOutputTokens: 1- }- }],+await client.settings.mcpServers.upsert({name: "name",- type: "openai"+ url: "url"});```@@ -1239,7 +1402,7 @@ await client.settings.modelProviders.upsert({<dl><dd>-**request:** `TrueHarness.ModelProvider`+**request:** `TrueHarness.settings.McpServerManifest`</dd></dl>@@ -1247,7 +1410,7 @@ await client.settings.modelProviders.upsert({<dl><dd>-**requestOptions:** `ModelProvidersClient.RequestOptions`+**requestOptions:** `McpServersClient.RequestOptions`</dd></dl>@@ -1259,7 +1422,7 @@ await client.settings.modelProviders.upsert({</dl></details>-<details><summary><code>client.settings.modelProviders.<a href="/src/api/resources/settings/resources/modelProviders/client/Client.ts">catalog</a>() -> TrueHarness.GetModelProviderCatalogResponse</code></summary>+<details><summary><code>client.settings.mcpServers.<a href="/src/api/resources/settings/resources/mcpServers/client/Client.ts">catalog</a>() -> TrueHarness.GetMcpServerCatalogResponse</code></summary><dl><dd>@@ -1271,7 +1434,7 @@ await client.settings.modelProviders.upsert({<dl><dd>-Provider and model presets shipped with the server (model-catalog.yaml). Discovery-only: copy an entry into PUT /settings/model-providers to configure it. Custom providers are not listed here.+MCP server presets shipped with the server (mcp-catalog.yaml). Discovery-only: copy an entry into PUT /settings/mcp-servers to configure it.</dd></dl></dd>@@ -1286,7 +1449,7 @@ Provider and model presets shipped with the server (model-catalog.yaml). Discove<dd>```typescript-await client.settings.modelProviders.catalog();+await client.settings.mcpServers.catalog();```</dd>@@ -1302,7 +1465,511 @@ await client.settings.modelProviders.catalog();<dl><dd>-**requestOptions:** `ModelProvidersClient.RequestOptions`+**requestOptions:** `McpServersClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>+++</dd>+</dl>+</details>++<details><summary><code>client.settings.mcpServers.<a href="/src/api/resources/settings/resources/mcpServers/client/Client.ts">authorize</a>(name, { ...params }) -> TrueHarness.ConfiguredMcpAuthorizeResponse</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++Stub: returns authenticated when the server has no auth or header credentials on the row; auth_required with a placeholder authorization URL when auth.type is dcr. Real DCR lands in a follow-up.+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.settings.mcpServers.authorize("name", {+ redirectUrl: "redirect_url"+});++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**name:** `string` — Configured MCP server name.++</dd>+</dl>++<dl>+<dd>++**request:** `TrueHarness.settings.AuthorizeMcpServersRequest`++</dd>+</dl>++<dl>+<dd>++**requestOptions:** `McpServersClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>+++</dd>+</dl>+</details>++<details><summary><code>client.settings.mcpServers.<a href="/src/api/resources/settings/resources/mcpServers/client/Client.ts">listTools</a>(name) -> TrueHarness.ListMcpServerToolsResponse</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++All tools exposed by the given configured MCP server (non-paginated), as returned by the MCP `tools/list` call.+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.settings.mcpServers.listTools("name");++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**name:** `string` — Configured MCP server name.++</dd>+</dl>++<dl>+<dd>++**requestOptions:** `McpServersClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>+++</dd>+</dl>+</details>++## Settings ModelProviders+<details><summary><code>client.settings.modelProviders.<a href="/src/api/resources/settings/resources/modelProviders/client/Client.ts">list</a>() -> TrueHarness.ListModelProvidersResponse</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++All configured providers with their models.+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.settings.modelProviders.list();++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**requestOptions:** `ModelProvidersClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>+++</dd>+</dl>+</details>++<details><summary><code>client.settings.modelProviders.<a href="/src/api/resources/settings/resources/modelProviders/client/Client.ts">upsert</a>({ ...params }) -> TrueHarness.PutModelProviderResponse</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++Full upsert keyed by `name`: creates the provider or replaces its entire configuration (models included).+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.settings.modelProviders.upsert({+ auth: {+ apiKey: "api_key"+ },+ baseUrl: "base_url",+ models: [{+ modelId: "model_id",+ name: "name",+ properties: {+ contextLength: 1,+ maxOutputTokens: 1+ }+ }],+ name: "name",+ type: "openai"+});++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**request:** `TrueHarness.ModelProvider`++</dd>+</dl>++<dl>+<dd>++**requestOptions:** `ModelProvidersClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>+++</dd>+</dl>+</details>++<details><summary><code>client.settings.modelProviders.<a href="/src/api/resources/settings/resources/modelProviders/client/Client.ts">catalog</a>() -> TrueHarness.GetModelProviderCatalogResponse</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++Provider and model presets shipped with the server (model-catalog.yaml). Discovery-only: copy an entry into PUT /settings/model-providers to configure it. Custom providers are not listed here.+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.settings.modelProviders.catalog();++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**requestOptions:** `ModelProvidersClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>+++</dd>+</dl>+</details>++## Settings Skills+<details><summary><code>client.settings.skills.<a href="/src/api/resources/settings/resources/skills/client/Client.ts">list</a>() -> TrueHarness.ListConfiguredSkillsResponse</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++All configured skills with full manifests (settings / admin projection).+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.settings.skills.list();++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**requestOptions:** `SkillsClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>+++</dd>+</dl>+</details>++<details><summary><code>client.settings.skills.<a href="/src/api/resources/settings/resources/skills/client/Client.ts">upsert</a>({ ...params }) -> TrueHarness.PutSkillResponse</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++Full upsert keyed by `name`: creates the skill or replaces its entire manifest.+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.settings.skills.upsert({+ description: "description",+ name: "name",+ type: "git",+ url: "url"+});++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**request:** `TrueHarness.SkillManifest`++</dd>+</dl>++<dl>+<dd>++**requestOptions:** `SkillsClient.RequestOptions`++</dd>+</dl>+</dd>+</dl>+++</dd>+</dl>+</details>++<details><summary><code>client.settings.skills.<a href="/src/api/resources/settings/resources/skills/client/Client.ts">catalog</a>() -> TrueHarness.GetSkillCatalogResponse</code></summary>+<dl>+<dd>++#### 📝 Description++<dl>+<dd>++<dl>+<dd>++Skill presets shipped with the server (skill-catalog.yaml). Discovery-only: copy an entry into PUT /settings/skills to configure it.+</dd>+</dl>+</dd>+</dl>++#### 🔌 Usage++<dl>+<dd>++<dl>+<dd>++```typescript+await client.settings.skills.catalog();++```+</dd>+</dl>+</dd>+</dl>++#### ⚙️ Parameters++<dl>+<dd>++<dl>+<dd>++**requestOptions:** `SkillsClient.RequestOptions`</dd></dl>diff --git a/packages/sdk/src/Client.ts b/packages/sdk/src/Client.tsindex 98d7f4fcb..86df988d6 100644--- a/packages/sdk/src/Client.ts+++ b/packages/sdk/src/Client.ts@@ -1,10 +1,12 @@// This file was auto-generated by Fern from our API Definition.import { LegacyClient } from "./api/resources/legacy/client/Client.js";+import { McpServersClient } from "./api/resources/mcpServers/client/Client.js";import { ModelsClient } from "./api/resources/models/client/Client.js";import { ServerClient } from "./api/resources/server/client/Client.js";import { SessionsClient } from "./api/resources/sessions/client/Client.js";import { SettingsClient } from "./api/resources/settings/client/Client.js";+import { SkillsClient } from "./api/resources/skills/client/Client.js";import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";import { type NormalizedClientOptions, normalizeClientOptions } from "./BaseClient.js";import * as core from "./core/index.js";@@ -18,8 +20,10 @@ export declare namespace TrueHarness {export class TrueHarness {protected readonly _options: NormalizedClientOptions<TrueHarness.Options>;protected _server: ServerClient | undefined;+ protected _mcpServers: McpServersClient | undefined;protected _models: ModelsClient | undefined;protected _sessions: SessionsClient | undefined;+ protected _skills: SkillsClient | undefined;protected _legacy: LegacyClient | undefined;protected _settings: SettingsClient | undefined;@@ -31,6 +35,10 @@ export class TrueHarness {return (this._server ??= new ServerClient(this._options));}+ public get mcpServers(): McpServersClient {+ return (this._mcpServers ??= new McpServersClient(this._options));+ }+public get models(): ModelsClient {return (this._models ??= new ModelsClient(this._options));}@@ -39,6 +47,10 @@ export class TrueHarness {return (this._sessions ??= new SessionsClient(this._options));}+ public get skills(): SkillsClient {+ return (this._skills ??= new SkillsClient(this._options));+ }+public get legacy(): LegacyClient {return (this._legacy ??= new LegacyClient(this._options));}diff --git a/packages/sdk/src/api/resources/index.ts b/packages/sdk/src/api/resources/index.tsindex 46dca3748..6bb0eec50 100644--- a/packages/sdk/src/api/resources/index.ts+++ b/packages/sdk/src/api/resources/index.ts@@ -1,6 +1,8 @@export * as legacy from "./legacy/index.js";+export * as mcpServers from "./mcpServers/index.js";export * as models from "./models/index.js";export * as server from "./server/index.js";export * from "./sessions/client/requests/index.js";export * as sessions from "./sessions/index.js";export * as settings from "./settings/index.js";+export * as skills from "./skills/index.js";diff --git a/packages/sdk/src/api/resources/mcpServers/client/Client.ts b/packages/sdk/src/api/resources/mcpServers/client/Client.tsnew file mode 100644index 000000000..b49636a55--- /dev/null+++ b/packages/sdk/src/api/resources/mcpServers/client/Client.ts@@ -0,0 +1,84 @@+// This file was auto-generated by Fern from our API Definition.++import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";+import { type NormalizedClientOptions, normalizeClientOptions } from "../../../../BaseClient.js";+import { mergeHeaders } from "../../../../core/headers.js";+import * as core from "../../../../core/index.js";+import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js";+import * as errors from "../../../../errors/index.js";+import * as serializers from "../../../../serialization/index.js";+import type * as TrueHarness from "../../../index.js";++export declare namespace McpServersClient {+ export type Options = BaseClientOptions;++ export interface RequestOptions extends BaseRequestOptions {}+}++export class McpServersClient {+ protected readonly _options: NormalizedClientOptions<McpServersClient.Options>;++ constructor(options: McpServersClient.Options) {+ this._options = normalizeClientOptions(options);+ }++ /**+ * Configured MCP servers as a slim name/url list for the composer. No auth or auth_status.+ *+ * @param {McpServersClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.mcpServers.list()+ */+ public list(+ requestOptions?: McpServersClient.RequestOptions,+ ): core.HttpResponsePromise<TrueHarness.ListAvailableMcpServersResponse> {+ return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));+ }++ private async __list(+ requestOptions?: McpServersClient.RequestOptions,+ ): Promise<core.WithRawResponse<TrueHarness.ListAvailableMcpServersResponse>> {+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ "api/v1/mcp-servers",+ ),+ method: "GET",+ headers: _headers,+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return {+ data: serializers.ListAvailableMcpServersResponse.parseOrThrow(_response.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ rawResponse: _response.rawResponse,+ };+ }++ if (_response.error.reason === "status-code") {+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }++ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/v1/mcp-servers");+ }+}diff --git a/packages/sdk/src/api/resources/mcpServers/client/index.ts b/packages/sdk/src/api/resources/mcpServers/client/index.tsnew file mode 100644index 000000000..cb0ff5c3b--- /dev/null+++ b/packages/sdk/src/api/resources/mcpServers/client/index.ts@@ -0,0 +1 @@+export {};diff --git a/packages/sdk/src/api/resources/mcpServers/exports.ts b/packages/sdk/src/api/resources/mcpServers/exports.tsnew file mode 100644index 000000000..3a0df5f61--- /dev/null+++ b/packages/sdk/src/api/resources/mcpServers/exports.ts@@ -0,0 +1,4 @@+// This file was auto-generated by Fern from our API Definition.++export { McpServersClient } from "./client/Client.js";+export * from "./client/index.js";diff --git a/packages/sdk/src/api/resources/mcpServers/index.ts b/packages/sdk/src/api/resources/mcpServers/index.tsnew file mode 100644index 000000000..914b8c3c7--- /dev/null+++ b/packages/sdk/src/api/resources/mcpServers/index.ts@@ -0,0 +1 @@+export * from "./client/index.js";diff --git a/packages/sdk/src/api/resources/sessions/client/Client.ts b/packages/sdk/src/api/resources/sessions/client/Client.tsindex 16d8d148c..e27cb7d50 100644--- a/packages/sdk/src/api/resources/sessions/client/Client.ts+++ b/packages/sdk/src/api/resources/sessions/client/Client.ts@@ -323,6 +323,62 @@ export class SessionsClient {return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/v1/sessions/{sessionId}");}+ /**+ * Delete a session and all related turns, events, and internal state. Idempotent if already gone.+ *+ * @param {string} sessionId - Session identifier.+ * @param {SessionsClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.sessions.delete("sessionId")+ */+ public delete(sessionId: string, requestOptions?: SessionsClient.RequestOptions): core.HttpResponsePromise<void> {+ return core.HttpResponsePromise.fromPromise(this.__delete(sessionId, requestOptions));+ }++ private async __delete(+ sessionId: string,+ requestOptions?: SessionsClient.RequestOptions,+ ): Promise<core.WithRawResponse<void>> {+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ `api/v1/sessions/${core.url.encodePathParam(sessionId)}`,+ ),+ method: "DELETE",+ headers: _headers,+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return { data: undefined, rawResponse: _response.rawResponse };+ }++ if (_response.error.reason === "status-code") {+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }++ return handleNonStatusCodeError(+ _response.error,+ _response.rawResponse,+ "DELETE",+ "/api/v1/sessions/{sessionId}",+ );+ }+/*** Update a session's inline agent spec. An empty body is a valid no-op that refreshes `updated_at`.*diff --git a/packages/sdk/src/api/resources/settings/client/Client.ts b/packages/sdk/src/api/resources/settings/client/Client.tsindex 9ba055e96..8a5df6bb2 100644--- a/packages/sdk/src/api/resources/settings/client/Client.ts+++ b/packages/sdk/src/api/resources/settings/client/Client.ts@@ -2,7 +2,9 @@import type { BaseClientOptions } from "../../../../BaseClient.js";import { type NormalizedClientOptions, normalizeClientOptions } from "../../../../BaseClient.js";+import { McpServersClient } from "../resources/mcpServers/client/Client.js";import { ModelProvidersClient } from "../resources/modelProviders/client/Client.js";+import { SkillsClient } from "../resources/skills/client/Client.js";export declare namespace SettingsClient {export type Options = BaseClientOptions;@@ -10,13 +12,23 @@ export declare namespace SettingsClient {export class SettingsClient {protected readonly _options: NormalizedClientOptions<SettingsClient.Options>;+ protected _mcpServers: McpServersClient | undefined;protected _modelProviders: ModelProvidersClient | undefined;+ protected _skills: SkillsClient | undefined;constructor(options: SettingsClient.Options) {this._options = normalizeClientOptions(options);}+ public get mcpServers(): McpServersClient {+ return (this._mcpServers ??= new McpServersClient(this._options));+ }+public get modelProviders(): ModelProvidersClient {return (this._modelProviders ??= new ModelProvidersClient(this._options));}++ public get skills(): SkillsClient {+ return (this._skills ??= new SkillsClient(this._options));+ }}diff --git a/packages/sdk/src/api/resources/settings/resources/index.ts b/packages/sdk/src/api/resources/settings/resources/index.tsindex 013d81239..13de6e8be 100644--- a/packages/sdk/src/api/resources/settings/resources/index.ts+++ b/packages/sdk/src/api/resources/settings/resources/index.ts@@ -1 +1,4 @@+export * from "./mcpServers/client/requests/index.js";+export * as mcpServers from "./mcpServers/index.js";export * as modelProviders from "./modelProviders/index.js";+export * as skills from "./skills/index.js";diff --git a/packages/sdk/src/api/resources/settings/resources/mcpServers/client/Client.ts b/packages/sdk/src/api/resources/settings/resources/mcpServers/client/Client.tsnew file mode 100644index 000000000..a8fffde58--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/mcpServers/client/Client.ts@@ -0,0 +1,448 @@+// This file was auto-generated by Fern from our API Definition.++import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";+import { type NormalizedClientOptions, normalizeClientOptions } from "../../../../../../BaseClient.js";+import { mergeHeaders } from "../../../../../../core/headers.js";+import * as core from "../../../../../../core/index.js";+import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js";+import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js";+import * as errors from "../../../../../../errors/index.js";+import * as serializers from "../../../../../../serialization/index.js";+import * as TrueHarness from "../../../../../index.js";++export declare namespace McpServersClient {+ export type Options = BaseClientOptions;++ export interface RequestOptions extends BaseRequestOptions {}+}++export class McpServersClient {+ protected readonly _options: NormalizedClientOptions<McpServersClient.Options>;++ constructor(options: McpServersClient.Options) {+ this._options = normalizeClientOptions(options);+ }++ /**+ * All configured MCP servers with nested auth_status (settings / admin projection).+ *+ * @param {McpServersClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.settings.mcpServers.list()+ */+ public list(+ requestOptions?: McpServersClient.RequestOptions,+ ): core.HttpResponsePromise<TrueHarness.ListConfiguredMcpServersResponse> {+ return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));+ }++ private async __list(+ requestOptions?: McpServersClient.RequestOptions,+ ): Promise<core.WithRawResponse<TrueHarness.ListConfiguredMcpServersResponse>> {+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ "api/v1/settings/mcp-servers",+ ),+ method: "GET",+ headers: _headers,+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return {+ data: serializers.ListConfiguredMcpServersResponse.parseOrThrow(_response.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ rawResponse: _response.rawResponse,+ };+ }++ if (_response.error.reason === "status-code") {+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }++ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/v1/settings/mcp-servers");+ }++ /**+ * Full upsert keyed by `name`: creates the server or replaces its manifest. Does not start DCR or modify stored oauth_server / oauth_client columns.+ *+ * @param {TrueHarness.settings.McpServerManifest} request+ * @param {McpServersClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link TrueHarness.BadRequestError}+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.settings.mcpServers.upsert({+ * name: "name",+ * url: "url"+ * })+ */+ public upsert(+ request: TrueHarness.settings.McpServerManifest,+ requestOptions?: McpServersClient.RequestOptions,+ ): core.HttpResponsePromise<TrueHarness.PutMcpServerResponse> {+ return core.HttpResponsePromise.fromPromise(this.__upsert(request, requestOptions));+ }++ private async __upsert(+ request: TrueHarness.settings.McpServerManifest,+ requestOptions?: McpServersClient.RequestOptions,+ ): Promise<core.WithRawResponse<TrueHarness.PutMcpServerResponse>> {+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ "api/v1/settings/mcp-servers",+ ),+ method: "PUT",+ headers: _headers,+ contentType: "application/json",+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),+ requestType: "json",+ body: mergeAdditionalBodyParameters(+ {+ ...serializers.settings.McpServerManifest.jsonOrThrow(request, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ omitUndefined: true,+ }),+ type: "remote",+ },+ requestOptions?.additionalBodyParameters,+ ),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return {+ data: serializers.PutMcpServerResponse.parseOrThrow(_response.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ rawResponse: _response.rawResponse,+ };+ }++ if (_response.error.reason === "status-code") {+ switch (_response.error.statusCode) {+ case 400:+ throw new TrueHarness.BadRequestError(+ serializers.RequestErrorResponse.parseOrThrow(_response.error.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ _response.rawResponse,+ );+ default:+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }+ }++ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/api/v1/settings/mcp-servers");+ }++ /**+ * MCP server presets shipped with the server (mcp-catalog.yaml). Discovery-only: copy an entry into PUT /settings/mcp-servers to configure it.+ *+ * @param {McpServersClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.settings.mcpServers.catalog()+ */+ public catalog(+ requestOptions?: McpServersClient.RequestOptions,+ ): core.HttpResponsePromise<TrueHarness.GetMcpServerCatalogResponse> {+ return core.HttpResponsePromise.fromPromise(this.__catalog(requestOptions));+ }++ private async __catalog(+ requestOptions?: McpServersClient.RequestOptions,+ ): Promise<core.WithRawResponse<TrueHarness.GetMcpServerCatalogResponse>> {+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ "api/v1/settings/mcp-servers/catalog",+ ),+ method: "GET",+ headers: _headers,+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return {+ data: serializers.GetMcpServerCatalogResponse.parseOrThrow(_response.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ rawResponse: _response.rawResponse,+ };+ }++ if (_response.error.reason === "status-code") {+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }++ return handleNonStatusCodeError(+ _response.error,+ _response.rawResponse,+ "GET",+ "/api/v1/settings/mcp-servers/catalog",+ );+ }++ /**+ * Stub: returns authenticated when the server has no auth or header credentials on the row; auth_required with a placeholder authorization URL when auth.type is dcr. Real DCR lands in a follow-up.+ *+ * @param {string} name - Configured MCP server name.+ * @param {TrueHarness.settings.AuthorizeMcpServersRequest} request+ * @param {McpServersClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link TrueHarness.NotFoundError}+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.settings.mcpServers.authorize("name", {+ * redirectUrl: "redirect_url"+ * })+ */+ public authorize(+ name: string,+ request: TrueHarness.settings.AuthorizeMcpServersRequest,+ requestOptions?: McpServersClient.RequestOptions,+ ): core.HttpResponsePromise<TrueHarness.ConfiguredMcpAuthorizeResponse> {+ return core.HttpResponsePromise.fromPromise(this.__authorize(name, request, requestOptions));+ }++ private async __authorize(+ name: string,+ request: TrueHarness.settings.AuthorizeMcpServersRequest,+ requestOptions?: McpServersClient.RequestOptions,+ ): Promise<core.WithRawResponse<TrueHarness.ConfiguredMcpAuthorizeResponse>> {+ const { redirectUrl } = request;+ const _queryParams: Record<string, unknown> = {+ redirect_url: redirectUrl,+ };+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ `api/v1/settings/mcp-servers/${core.url.encodePathParam(name)}/authorize`,+ ),+ method: "GET",+ headers: _headers,+ queryString: core.url+ .queryBuilder()+ .addMany(_queryParams)+ .mergeAdditional(requestOptions?.queryParams)+ .build(),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return {+ data: serializers.ConfiguredMcpAuthorizeResponse.parseOrThrow(_response.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ rawResponse: _response.rawResponse,+ };+ }++ if (_response.error.reason === "status-code") {+ switch (_response.error.statusCode) {+ case 404:+ throw new TrueHarness.NotFoundError(+ serializers.RequestErrorResponse.parseOrThrow(_response.error.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ _response.rawResponse,+ );+ default:+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }+ }++ return handleNonStatusCodeError(+ _response.error,+ _response.rawResponse,+ "GET",+ "/api/v1/settings/mcp-servers/{name}/authorize",+ );+ }++ /**+ * All tools exposed by the given configured MCP server (non-paginated), as returned by the MCP `tools/list` call.+ *+ * @param {string} name - Configured MCP server name.+ * @param {McpServersClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link TrueHarness.UnauthorizedError}+ * @throws {@link TrueHarness.NotFoundError}+ * @throws {@link TrueHarness.BadGatewayError}+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.settings.mcpServers.listTools("name")+ */+ public listTools(+ name: string,+ requestOptions?: McpServersClient.RequestOptions,+ ): core.HttpResponsePromise<TrueHarness.ListMcpServerToolsResponse> {+ return core.HttpResponsePromise.fromPromise(this.__listTools(name, requestOptions));+ }++ private async __listTools(+ name: string,+ requestOptions?: McpServersClient.RequestOptions,+ ): Promise<core.WithRawResponse<TrueHarness.ListMcpServerToolsResponse>> {+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ `api/v1/settings/mcp-servers/${core.url.encodePathParam(name)}/tools`,+ ),+ method: "GET",+ headers: _headers,+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return {+ data: serializers.ListMcpServerToolsResponse.parseOrThrow(_response.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ rawResponse: _response.rawResponse,+ };+ }++ if (_response.error.reason === "status-code") {+ switch (_response.error.statusCode) {+ case 401:+ throw new TrueHarness.UnauthorizedError(+ serializers.RequestErrorResponse.parseOrThrow(_response.error.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ _response.rawResponse,+ );+ case 404:+ throw new TrueHarness.NotFoundError(+ serializers.RequestErrorResponse.parseOrThrow(_response.error.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ _response.rawResponse,+ );+ case 502:+ throw new TrueHarness.BadGatewayError(+ serializers.RequestErrorResponse.parseOrThrow(_response.error.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ _response.rawResponse,+ );+ default:+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }+ }++ return handleNonStatusCodeError(+ _response.error,+ _response.rawResponse,+ "GET",+ "/api/v1/settings/mcp-servers/{name}/tools",+ );+ }+}diff --git a/packages/sdk/src/api/resources/settings/resources/mcpServers/client/index.ts b/packages/sdk/src/api/resources/settings/resources/mcpServers/client/index.tsnew file mode 100644index 000000000..195f9aa8a--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/mcpServers/client/index.ts@@ -0,0 +1 @@+export * from "./requests/index.js";diff --git a/packages/sdk/src/api/resources/settings/resources/mcpServers/client/requests/AuthorizeMcpServersRequest.ts b/packages/sdk/src/api/resources/settings/resources/mcpServers/client/requests/AuthorizeMcpServersRequest.tsnew file mode 100644index 000000000..ef097a479--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/mcpServers/client/requests/AuthorizeMcpServersRequest.ts@@ -0,0 +1,12 @@+// This file was auto-generated by Fern from our API Definition.++/**+ * @example+ * {+ * redirectUrl: "redirect_url"+ * }+ */+export interface AuthorizeMcpServersRequest {+ /** Where to send the browser after OAuth completes. */+ redirectUrl: string;+}diff --git a/packages/sdk/src/api/resources/settings/resources/mcpServers/client/requests/McpServerManifest.ts b/packages/sdk/src/api/resources/settings/resources/mcpServers/client/requests/McpServerManifest.tsnew file mode 100644index 000000000..a3bc31a41--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/mcpServers/client/requests/McpServerManifest.ts@@ -0,0 +1,17 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../../../../../index.js";++/**+ * @example+ * {+ * name: "name",+ * url: "url"+ * }+ */+export interface McpServerManifest {+ auth?: TrueHarness.ConfiguredMcpServerAuth;+ name: TrueHarness.ResourceName;+ /** URL of the remote MCP server. */+ url: string;+}diff --git a/packages/sdk/src/api/resources/settings/resources/mcpServers/client/requests/index.ts b/packages/sdk/src/api/resources/settings/resources/mcpServers/client/requests/index.tsnew file mode 100644index 000000000..c8904f2ef--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/mcpServers/client/requests/index.ts@@ -0,0 +1,2 @@+export type { AuthorizeMcpServersRequest } from "./AuthorizeMcpServersRequest.js";+export type { McpServerManifest } from "./McpServerManifest.js";diff --git a/packages/sdk/src/api/resources/settings/resources/mcpServers/exports.ts b/packages/sdk/src/api/resources/settings/resources/mcpServers/exports.tsnew file mode 100644index 000000000..3a0df5f61--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/mcpServers/exports.ts@@ -0,0 +1,4 @@+// This file was auto-generated by Fern from our API Definition.++export { McpServersClient } from "./client/Client.js";+export * from "./client/index.js";diff --git a/packages/sdk/src/api/resources/settings/resources/mcpServers/index.ts b/packages/sdk/src/api/resources/settings/resources/mcpServers/index.tsnew file mode 100644index 000000000..914b8c3c7--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/mcpServers/index.ts@@ -0,0 +1 @@+export * from "./client/index.js";diff --git a/packages/sdk/src/api/resources/settings/resources/skills/client/Client.ts b/packages/sdk/src/api/resources/settings/resources/skills/client/Client.tsnew file mode 100644index 000000000..80da900a0--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/skills/client/Client.ts@@ -0,0 +1,244 @@+// This file was auto-generated by Fern from our API Definition.++import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";+import { type NormalizedClientOptions, normalizeClientOptions } from "../../../../../../BaseClient.js";+import { mergeHeaders } from "../../../../../../core/headers.js";+import * as core from "../../../../../../core/index.js";+import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js";+import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js";+import * as errors from "../../../../../../errors/index.js";+import * as serializers from "../../../../../../serialization/index.js";+import * as TrueHarness from "../../../../../index.js";++export declare namespace SkillsClient {+ export type Options = BaseClientOptions;++ export interface RequestOptions extends BaseRequestOptions {}+}++export class SkillsClient {+ protected readonly _options: NormalizedClientOptions<SkillsClient.Options>;++ constructor(options: SkillsClient.Options) {+ this._options = normalizeClientOptions(options);+ }++ /**+ * All configured skills with full manifests (settings / admin projection).+ *+ * @param {SkillsClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.settings.skills.list()+ */+ public list(+ requestOptions?: SkillsClient.RequestOptions,+ ): core.HttpResponsePromise<TrueHarness.ListConfiguredSkillsResponse> {+ return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));+ }++ private async __list(+ requestOptions?: SkillsClient.RequestOptions,+ ): Promise<core.WithRawResponse<TrueHarness.ListConfiguredSkillsResponse>> {+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ "api/v1/settings/skills",+ ),+ method: "GET",+ headers: _headers,+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return {+ data: serializers.ListConfiguredSkillsResponse.parseOrThrow(_response.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ rawResponse: _response.rawResponse,+ };+ }++ if (_response.error.reason === "status-code") {+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }++ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/v1/settings/skills");+ }++ /**+ * Full upsert keyed by `name`: creates the skill or replaces its entire manifest.+ *+ * @param {TrueHarness.SkillManifest} request+ * @param {SkillsClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link TrueHarness.BadRequestError}+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.settings.skills.upsert({+ * description: "description",+ * name: "name",+ * type: "git",+ * url: "url"+ * })+ */+ public upsert(+ request: TrueHarness.SkillManifest,+ requestOptions?: SkillsClient.RequestOptions,+ ): core.HttpResponsePromise<TrueHarness.PutSkillResponse> {+ return core.HttpResponsePromise.fromPromise(this.__upsert(request, requestOptions));+ }++ private async __upsert(+ request: TrueHarness.SkillManifest,+ requestOptions?: SkillsClient.RequestOptions,+ ): Promise<core.WithRawResponse<TrueHarness.PutSkillResponse>> {+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ "api/v1/settings/skills",+ ),+ method: "PUT",+ headers: _headers,+ contentType: "application/json",+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),+ requestType: "json",+ body: mergeAdditionalBodyParameters(+ serializers.SkillManifest.jsonOrThrow(request, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ omitUndefined: true,+ }),+ requestOptions?.additionalBodyParameters,+ ),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return {+ data: serializers.PutSkillResponse.parseOrThrow(_response.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ rawResponse: _response.rawResponse,+ };+ }++ if (_response.error.reason === "status-code") {+ switch (_response.error.statusCode) {+ case 400:+ throw new TrueHarness.BadRequestError(+ serializers.RequestErrorResponse.parseOrThrow(_response.error.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ _response.rawResponse,+ );+ default:+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }+ }++ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/api/v1/settings/skills");+ }++ /**+ * Skill presets shipped with the server (skill-catalog.yaml). Discovery-only: copy an entry into PUT /settings/skills to configure it.+ *+ * @param {SkillsClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.settings.skills.catalog()+ */+ public catalog(+ requestOptions?: SkillsClient.RequestOptions,+ ): core.HttpResponsePromise<TrueHarness.GetSkillCatalogResponse> {+ return core.HttpResponsePromise.fromPromise(this.__catalog(requestOptions));+ }++ private async __catalog(+ requestOptions?: SkillsClient.RequestOptions,+ ): Promise<core.WithRawResponse<TrueHarness.GetSkillCatalogResponse>> {+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ "api/v1/settings/skills/catalog",+ ),+ method: "GET",+ headers: _headers,+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return {+ data: serializers.GetSkillCatalogResponse.parseOrThrow(_response.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ rawResponse: _response.rawResponse,+ };+ }++ if (_response.error.reason === "status-code") {+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }++ return handleNonStatusCodeError(+ _response.error,+ _response.rawResponse,+ "GET",+ "/api/v1/settings/skills/catalog",+ );+ }+}diff --git a/packages/sdk/src/api/resources/settings/resources/skills/client/index.ts b/packages/sdk/src/api/resources/settings/resources/skills/client/index.tsnew file mode 100644index 000000000..cb0ff5c3b--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/skills/client/index.ts@@ -0,0 +1 @@+export {};diff --git a/packages/sdk/src/api/resources/settings/resources/skills/exports.ts b/packages/sdk/src/api/resources/settings/resources/skills/exports.tsnew file mode 100644index 000000000..b13b787d5--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/skills/exports.ts@@ -0,0 +1,4 @@+// This file was auto-generated by Fern from our API Definition.++export { SkillsClient } from "./client/Client.js";+export * from "./client/index.js";diff --git a/packages/sdk/src/api/resources/settings/resources/skills/index.ts b/packages/sdk/src/api/resources/settings/resources/skills/index.tsnew file mode 100644index 000000000..914b8c3c7--- /dev/null+++ b/packages/sdk/src/api/resources/settings/resources/skills/index.ts@@ -0,0 +1 @@+export * from "./client/index.js";diff --git a/packages/sdk/src/api/resources/skills/client/Client.ts b/packages/sdk/src/api/resources/skills/client/Client.tsnew file mode 100644index 000000000..18f5457f6--- /dev/null+++ b/packages/sdk/src/api/resources/skills/client/Client.ts@@ -0,0 +1,84 @@+// This file was auto-generated by Fern from our API Definition.++import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";+import { type NormalizedClientOptions, normalizeClientOptions } from "../../../../BaseClient.js";+import { mergeHeaders } from "../../../../core/headers.js";+import * as core from "../../../../core/index.js";+import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js";+import * as errors from "../../../../errors/index.js";+import * as serializers from "../../../../serialization/index.js";+import type * as TrueHarness from "../../../index.js";++export declare namespace SkillsClient {+ export type Options = BaseClientOptions;++ export interface RequestOptions extends BaseRequestOptions {}+}++export class SkillsClient {+ protected readonly _options: NormalizedClientOptions<SkillsClient.Options>;++ constructor(options: SkillsClient.Options) {+ this._options = normalizeClientOptions(options);+ }++ /**+ * Configured skills as a slim name/description list for the composer.+ *+ * @param {SkillsClient.RequestOptions} requestOptions - Request-specific configuration.+ *+ * @throws {@link errors.TrueHarnessError}+ * @throws {@link errors.TrueHarnessTimeoutError}+ *+ * @example+ * await client.skills.list()+ */+ public list(+ requestOptions?: SkillsClient.RequestOptions,+ ): core.HttpResponsePromise<TrueHarness.ListAvailableSkillsResponse> {+ return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));+ }++ private async __list(+ requestOptions?: SkillsClient.RequestOptions,+ ): Promise<core.WithRawResponse<TrueHarness.ListAvailableSkillsResponse>> {+ const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers);+ const _response = await (this._options.fetcher ?? core.fetcher)({+ url: core.url.join(+ (await core.Supplier.get(this._options.baseUrl)) ??+ (await core.Supplier.get(this._options.environment)),+ "api/v1/skills",+ ),+ method: "GET",+ headers: _headers,+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,+ abortSignal: requestOptions?.abortSignal,+ fetchFn: this._options?.fetch,+ logging: this._options.logging,+ });+ if (_response.ok) {+ return {+ data: serializers.ListAvailableSkillsResponse.parseOrThrow(_response.body, {+ unrecognizedObjectKeys: "passthrough",+ allowUnrecognizedUnionMembers: true,+ allowUnrecognizedEnumValues: true,+ skipValidation: true,+ breadcrumbsPrefix: ["response"],+ }),+ rawResponse: _response.rawResponse,+ };+ }++ if (_response.error.reason === "status-code") {+ throw new errors.TrueHarnessError({+ statusCode: _response.error.statusCode,+ body: _response.error.body,+ rawResponse: _response.rawResponse,+ });+ }++ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/v1/skills");+ }+}diff --git a/packages/sdk/src/api/resources/skills/client/index.ts b/packages/sdk/src/api/resources/skills/client/index.tsnew file mode 100644index 000000000..cb0ff5c3b--- /dev/null+++ b/packages/sdk/src/api/resources/skills/client/index.ts@@ -0,0 +1 @@+export {};diff --git a/packages/sdk/src/api/resources/skills/exports.ts b/packages/sdk/src/api/resources/skills/exports.tsnew file mode 100644index 000000000..b13b787d5--- /dev/null+++ b/packages/sdk/src/api/resources/skills/exports.ts@@ -0,0 +1,4 @@+// This file was auto-generated by Fern from our API Definition.++export { SkillsClient } from "./client/Client.js";+export * from "./client/index.js";diff --git a/packages/sdk/src/api/resources/skills/index.ts b/packages/sdk/src/api/resources/skills/index.tsnew file mode 100644index 000000000..914b8c3c7--- /dev/null+++ b/packages/sdk/src/api/resources/skills/index.ts@@ -0,0 +1 @@+export * from "./client/index.js";diff --git a/packages/sdk/src/api/types/CatalogMcpServer.ts b/packages/sdk/src/api/types/CatalogMcpServer.tsnew file mode 100644index 000000000..6ba3cfac9--- /dev/null+++ b/packages/sdk/src/api/types/CatalogMcpServer.ts@@ -0,0 +1,11 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface CatalogMcpServer {+ auth?: TrueHarness.ConfiguredMcpServerAuth;+ name: TrueHarness.ResourceName;+ type: TrueHarness.McpServerType;+ /** URL of the remote MCP server. */+ url: string;+}diff --git a/packages/sdk/src/api/types/CatalogSkill.ts b/packages/sdk/src/api/types/CatalogSkill.tsnew file mode 100644index 000000000..052460bff--- /dev/null+++ b/packages/sdk/src/api/types/CatalogSkill.ts@@ -0,0 +1,16 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface CatalogSkill {+ /** Concise guidance for when the agent should use the skill. */+ description: string;+ name: TrueHarness.ResourceName;+ /** Path to the skill directory within the repository. Omit to use the repository root. */+ path?: string;+ /** Git ref — branch name, tag, or commit SHA. */+ ref?: string;+ type: TrueHarness.SkillType;+ /** Full HTTPS URL of a GitHub or GitLab repository. */+ url: string;+}diff --git a/packages/sdk/src/api/types/ConfiguredMcpAuthorizeResponse.ts b/packages/sdk/src/api/types/ConfiguredMcpAuthorizeResponse.tsnew file mode 100644index 000000000..7608b9537--- /dev/null+++ b/packages/sdk/src/api/types/ConfiguredMcpAuthorizeResponse.ts@@ -0,0 +1,9 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface ConfiguredMcpAuthorizeResponse {+ /** Present only when status is auth_required. */+ authorizationUrl?: string;+ status: TrueHarness.ConfiguredMcpAuthorizeResponseStatus;+}diff --git a/packages/sdk/src/api/types/ConfiguredMcpAuthorizeResponseStatus.ts b/packages/sdk/src/api/types/ConfiguredMcpAuthorizeResponseStatus.tsnew file mode 100644index 000000000..955ad1ac2--- /dev/null+++ b/packages/sdk/src/api/types/ConfiguredMcpAuthorizeResponseStatus.ts@@ -0,0 +1,8 @@+// This file was auto-generated by Fern from our API Definition.++export const ConfiguredMcpAuthorizeResponseStatus = {+ Authenticated: "authenticated",+ AuthRequired: "auth_required",+} as const;+export type ConfiguredMcpAuthorizeResponseStatus =+ (typeof ConfiguredMcpAuthorizeResponseStatus)[keyof typeof ConfiguredMcpAuthorizeResponseStatus];diff --git a/packages/sdk/src/api/types/ConfiguredMcpServer.ts b/packages/sdk/src/api/types/ConfiguredMcpServer.tsnew file mode 100644index 000000000..5655b6667--- /dev/null+++ b/packages/sdk/src/api/types/ConfiguredMcpServer.ts@@ -0,0 +1,12 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface ConfiguredMcpServer {+ auth?: TrueHarness.ConfiguredMcpServerAuth;+ authStatus: TrueHarness.McpAuthStatus;+ name: TrueHarness.ResourceName;+ type: TrueHarness.McpServerType;+ /** URL of the remote MCP server. */+ url: string;+}diff --git a/packages/sdk/src/api/types/ConfiguredMcpServerAuth.ts b/packages/sdk/src/api/types/ConfiguredMcpServerAuth.tsnew file mode 100644index 000000000..0f2ba05da--- /dev/null+++ b/packages/sdk/src/api/types/ConfiguredMcpServerAuth.ts@@ -0,0 +1,5 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export type ConfiguredMcpServerAuth = TrueHarness.McpServerDcrAuth | TrueHarness.McpServerHeaderAuth;diff --git a/packages/sdk/src/api/types/GetMcpServerCatalogResponse.ts b/packages/sdk/src/api/types/GetMcpServerCatalogResponse.tsnew file mode 100644index 000000000..b82249ede--- /dev/null+++ b/packages/sdk/src/api/types/GetMcpServerCatalogResponse.ts@@ -0,0 +1,7 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface GetMcpServerCatalogResponse {+ data: TrueHarness.CatalogMcpServer[];+}diff --git a/packages/sdk/src/api/types/GetSkillCatalogResponse.ts b/packages/sdk/src/api/types/GetSkillCatalogResponse.tsnew file mode 100644index 000000000..518514a78--- /dev/null+++ b/packages/sdk/src/api/types/GetSkillCatalogResponse.ts@@ -0,0 +1,7 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface GetSkillCatalogResponse {+ data: TrueHarness.CatalogSkill[];+}diff --git a/packages/sdk/src/api/types/ListAvailableMcpServersResponse.ts b/packages/sdk/src/api/types/ListAvailableMcpServersResponse.tsnew file mode 100644index 000000000..1d4f0e844--- /dev/null+++ b/packages/sdk/src/api/types/ListAvailableMcpServersResponse.ts@@ -0,0 +1,7 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface ListAvailableMcpServersResponse {+ data: TrueHarness.McpServerReadEntry[];+}diff --git a/packages/sdk/src/api/types/ListAvailableSkillsResponse.ts b/packages/sdk/src/api/types/ListAvailableSkillsResponse.tsnew file mode 100644index 000000000..a4701bdb6--- /dev/null+++ b/packages/sdk/src/api/types/ListAvailableSkillsResponse.ts@@ -0,0 +1,7 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface ListAvailableSkillsResponse {+ data: TrueHarness.SkillReadEntry[];+}diff --git a/packages/sdk/src/api/types/ListConfiguredMcpServersResponse.ts b/packages/sdk/src/api/types/ListConfiguredMcpServersResponse.tsnew file mode 100644index 000000000..e89822bf5--- /dev/null+++ b/packages/sdk/src/api/types/ListConfiguredMcpServersResponse.ts@@ -0,0 +1,7 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface ListConfiguredMcpServersResponse {+ data: TrueHarness.ConfiguredMcpServer[];+}diff --git a/packages/sdk/src/api/types/ListConfiguredSkillsResponse.ts b/packages/sdk/src/api/types/ListConfiguredSkillsResponse.tsnew file mode 100644index 000000000..55d6ad6ec--- /dev/null+++ b/packages/sdk/src/api/types/ListConfiguredSkillsResponse.ts@@ -0,0 +1,7 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface ListConfiguredSkillsResponse {+ data: TrueHarness.SkillManifest[];+}diff --git a/packages/sdk/src/api/types/ListMcpServerToolsResponse.ts b/packages/sdk/src/api/types/ListMcpServerToolsResponse.tsnew file mode 100644index 000000000..2583c508d--- /dev/null+++ b/packages/sdk/src/api/types/ListMcpServerToolsResponse.ts@@ -0,0 +1,6 @@+// This file was auto-generated by Fern from our API Definition.++export interface ListMcpServerToolsResponse {+ /** MCP `tools/list` entries, passed through verbatim from the MCP server. */+ data: Record<string, unknown>[];+}diff --git a/packages/sdk/src/api/types/McpAuthStatus.ts b/packages/sdk/src/api/types/McpAuthStatus.tsnew file mode 100644index 000000000..423b7b050--- /dev/null+++ b/packages/sdk/src/api/types/McpAuthStatus.ts@@ -0,0 +1,9 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface McpAuthStatus {+ /** Present only when status is auth_required and a live authorize flow produced a URL. */+ authorizationUrl?: string;+ status: TrueHarness.McpAuthStatusStatus;+}diff --git a/packages/sdk/src/api/types/McpAuthStatusStatus.ts b/packages/sdk/src/api/types/McpAuthStatusStatus.tsnew file mode 100644index 000000000..b8bd39b92--- /dev/null+++ b/packages/sdk/src/api/types/McpAuthStatusStatus.ts@@ -0,0 +1,7 @@+// This file was auto-generated by Fern from our API Definition.++export const McpAuthStatusStatus = {+ Authenticated: "authenticated",+ AuthRequired: "auth_required",+} as const;+export type McpAuthStatusStatus = (typeof McpAuthStatusStatus)[keyof typeof McpAuthStatusStatus];diff --git a/packages/sdk/src/api/types/McpServerDcrAuth.ts b/packages/sdk/src/api/types/McpServerDcrAuth.tsnew file mode 100644index 000000000..a49a07945--- /dev/null+++ b/packages/sdk/src/api/types/McpServerDcrAuth.ts@@ -0,0 +1,5 @@+// This file was auto-generated by Fern from our API Definition.++export interface McpServerDcrAuth {+ type: "dcr";+}diff --git a/packages/sdk/src/api/types/McpServerHeaderAuth.ts b/packages/sdk/src/api/types/McpServerHeaderAuth.tsnew file mode 100644index 000000000..87ed3510e--- /dev/null+++ b/packages/sdk/src/api/types/McpServerHeaderAuth.ts@@ -0,0 +1,7 @@+// This file was auto-generated by Fern from our API Definition.++export interface McpServerHeaderAuth {+ /** HTTP headers sent on each request to this MCP server. */+ headers: Record<string, string>;+ type: "header";+}diff --git a/packages/sdk/src/api/types/McpServerReadEntry.ts b/packages/sdk/src/api/types/McpServerReadEntry.tsnew file mode 100644index 000000000..50cf494c6--- /dev/null+++ b/packages/sdk/src/api/types/McpServerReadEntry.ts@@ -0,0 +1,8 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface McpServerReadEntry {+ name: TrueHarness.ResourceName;+ url: string;+}diff --git a/packages/sdk/src/api/types/McpServerType.ts b/packages/sdk/src/api/types/McpServerType.tsnew file mode 100644index 000000000..01de5c507--- /dev/null+++ b/packages/sdk/src/api/types/McpServerType.ts@@ -0,0 +1,3 @@+// This file was auto-generated by Fern from our API Definition.++export type McpServerType = "remote";diff --git a/packages/sdk/src/api/types/PutMcpServerResponse.ts b/packages/sdk/src/api/types/PutMcpServerResponse.tsnew file mode 100644index 000000000..fc0d53bcc--- /dev/null+++ b/packages/sdk/src/api/types/PutMcpServerResponse.ts@@ -0,0 +1,7 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface PutMcpServerResponse {+ data: TrueHarness.ConfiguredMcpServer;+}diff --git a/packages/sdk/src/api/types/PutSkillResponse.ts b/packages/sdk/src/api/types/PutSkillResponse.tsnew file mode 100644index 000000000..742adf6ca--- /dev/null+++ b/packages/sdk/src/api/types/PutSkillResponse.ts@@ -0,0 +1,7 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface PutSkillResponse {+ data: TrueHarness.SkillManifest;+}diff --git a/packages/sdk/src/api/types/SkillManifest.ts b/packages/sdk/src/api/types/SkillManifest.tsnew file mode 100644index 000000000..49d8ba824--- /dev/null+++ b/packages/sdk/src/api/types/SkillManifest.ts@@ -0,0 +1,16 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface SkillManifest {+ /** Concise guidance for when the agent should use the skill. */+ description: string;+ name: TrueHarness.ResourceName;+ /** Path to the skill directory within the repository. Omit to use the repository root. */+ path?: string;+ /** Git ref — branch name, tag, or commit SHA. */+ ref?: string;+ type: TrueHarness.SkillType;+ /** Full HTTPS URL of a GitHub or GitLab repository. */+ url: string;+}diff --git a/packages/sdk/src/api/types/SkillReadEntry.ts b/packages/sdk/src/api/types/SkillReadEntry.tsnew file mode 100644index 000000000..897d182bb--- /dev/null+++ b/packages/sdk/src/api/types/SkillReadEntry.ts@@ -0,0 +1,9 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../index.js";++export interface SkillReadEntry {+ /** Concise guidance for when the agent should use the skill. */+ description: string;+ name: TrueHarness.ResourceName;+}diff --git a/packages/sdk/src/api/types/SkillType.ts b/packages/sdk/src/api/types/SkillType.tsnew file mode 100644index 000000000..934c9527a--- /dev/null+++ b/packages/sdk/src/api/types/SkillType.ts@@ -0,0 +1,3 @@+// This file was auto-generated by Fern from our API Definition.++export type SkillType = "git";diff --git a/packages/sdk/src/api/types/index.ts b/packages/sdk/src/api/types/index.tsindex 60d425c9d..b82da2ff1 100644--- a/packages/sdk/src/api/types/index.ts+++ b/packages/sdk/src/api/types/index.ts@@ -11,14 +11,20 @@ export * from "./AskUserQuestionsConfig.js";export * from "./BaseMcpAuthRequiredEvent.js";export * from "./BaseThreadDoneEvent.js";export * from "./CancelSessionResponse.js";+export * from "./CatalogMcpServer.js";export * from "./CatalogProvider.js";export * from "./CatalogProviderType.js";+export * from "./CatalogSkill.js";export * from "./ChatCompletionChunkDeltaToolCall.js";export * from "./ChatCompletionChunkDeltaToolCallFunction.js";export * from "./ChatCompletionContentPartRefusal.js";export * from "./ChatCompletionContentPartText.js";export * from "./ChatCompletionMessageToolCall.js";export * from "./ChatCompletionMessageToolCallFunction.js";+export * from "./ConfiguredMcpAuthorizeResponse.js";+export * from "./ConfiguredMcpAuthorizeResponseStatus.js";+export * from "./ConfiguredMcpServer.js";+export * from "./ConfiguredMcpServerAuth.js";export * from "./ContextManagementConfig.js";export * from "./ContextManagementConfigCompaction.js";export * from "./DynamicSubAgentsConfig.js";@@ -29,13 +35,20 @@ export * from "./GenerativeUiConfig.js";export * from "./GetCapabilitiesResponse.js";export * from "./GetCapabilitiesResponseData.js";export * from "./GetCapabilitiesResponseDataSandbox.js";+export * from "./GetMcpServerCatalogResponse.js";export * from "./GetModelProviderCatalogResponse.js";export * from "./GetSessionResponse.js";+export * from "./GetSkillCatalogResponse.js";export * from "./GetTurnResponse.js";export * from "./LargeToolResponseConfig.js";+export * from "./ListAvailableMcpServersResponse.js";+export * from "./ListAvailableSkillsResponse.js";+export * from "./ListConfiguredMcpServersResponse.js";+export * from "./ListConfiguredSkillsResponse.js";export * from "./ListLegacyModelsResponse.js";export * from "./ListLegacyModelsResponseDataItem.js";export * from "./ListMcpServersResponse.js";+export * from "./ListMcpServerToolsResponse.js";export * from "./ListMcpToolsResponse.js";export * from "./ListModelProvidersResponse.js";export * from "./ListModelsResponse.js";@@ -49,18 +62,24 @@ export * from "./ListTurnsResponse.js";export * from "./McpAuthorizeResponse.js";export * from "./McpAuthorizeResponseStatus.js";export * from "./McpAuthRequiredEvent.js";+export * from "./McpAuthStatus.js";+export * from "./McpAuthStatusStatus.js";export * from "./McpInitializeEvent.js";export * from "./McpServer.js";export * from "./McpServerAuthInfo.js";export * from "./McpServerAuthSettings.js";+export * from "./McpServerDcrAuth.js";export * from "./McpServerDisableToolsItem.js";export * from "./McpServerEnableToolsItem.js";export * from "./McpServerEntry.js";export * from "./McpServerEntryAuthStatus.js";+export * from "./McpServerHeaderAuth.js";export * from "./McpServerInitInfo.js";export * from "./McpServerInitInfoTransportType.js";export * from "./McpServerPreloadToolsItem.js";+export * from "./McpServerReadEntry.js";export * from "./McpServerRequireApprovalForToolsItem.js";+export * from "./McpServerType.js";export * from "./McpToolInfo.js";export * from "./Model.js";export * from "./ModelEntry.js";@@ -76,7 +95,9 @@ export * from "./ModelProvider.js";export * from "./ModelProviderAuth.js";export * from "./PreviousTurnIdInput.js";export * from "./ProviderType.js";+export * from "./PutMcpServerResponse.js";export * from "./PutModelProviderResponse.js";+export * from "./PutSkillResponse.js";export * from "./RawToolCall.js";export * from "./RequestErrorResponse.js";export * from "./RequestErrorResponseError.js";@@ -97,7 +118,10 @@ export * from "./Session.js";export * from "./SessionEvent.js";export * from "./SessionEventItem.js";export * from "./SkillEntry.js";+export * from "./SkillManifest.js";export * from "./SkillMount.js";+export * from "./SkillReadEntry.js";+export * from "./SkillType.js";export * from "./TextContent.js";export * from "./ThreadCreatedEvent.js";export * from "./ThreadDoneEvent.js";diff --git a/packages/sdk/src/serialization/resources/index.ts b/packages/sdk/src/serialization/resources/index.tsindex e34ab841f..c639ea5e0 100644--- a/packages/sdk/src/serialization/resources/index.ts+++ b/packages/sdk/src/serialization/resources/index.ts@@ -1,2 +1,3 @@export * from "./sessions/client/requests/index.js";export * as sessions from "./sessions/index.js";+export * as settings from "./settings/index.js";diff --git a/packages/sdk/src/serialization/resources/settings/index.ts b/packages/sdk/src/serialization/resources/settings/index.tsnew file mode 100644index 000000000..e445af0d8--- /dev/null+++ b/packages/sdk/src/serialization/resources/settings/index.ts@@ -0,0 +1 @@+export * from "./resources/index.js";diff --git a/packages/sdk/src/serialization/resources/settings/resources/index.ts b/packages/sdk/src/serialization/resources/settings/resources/index.tsnew file mode 100644index 000000000..76d13fe6a--- /dev/null+++ b/packages/sdk/src/serialization/resources/settings/resources/index.ts@@ -0,0 +1,2 @@+export * from "./mcpServers/client/requests/index.js";+export * as mcpServers from "./mcpServers/index.js";diff --git a/packages/sdk/src/serialization/resources/settings/resources/mcpServers/client/index.ts b/packages/sdk/src/serialization/resources/settings/resources/mcpServers/client/index.tsnew file mode 100644index 000000000..195f9aa8a--- /dev/null+++ b/packages/sdk/src/serialization/resources/settings/resources/mcpServers/client/index.ts@@ -0,0 +1 @@+export * from "./requests/index.js";diff --git a/packages/sdk/src/serialization/resources/settings/resources/mcpServers/client/requests/McpServerManifest.ts b/packages/sdk/src/serialization/resources/settings/resources/mcpServers/client/requests/McpServerManifest.tsnew file mode 100644index 000000000..7f692ec2e--- /dev/null+++ b/packages/sdk/src/serialization/resources/settings/resources/mcpServers/client/requests/McpServerManifest.ts@@ -0,0 +1,24 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../../../../../../api/index.js";+import * as core from "../../../../../../../core/index.js";+import type * as serializers from "../../../../../../index.js";+import { ConfiguredMcpServerAuth } from "../../../../../../types/ConfiguredMcpServerAuth.js";+import { ResourceName } from "../../../../../../types/ResourceName.js";++export const McpServerManifest: core.serialization.Schema<+ serializers.settings.McpServerManifest.Raw,+ TrueHarness.settings.McpServerManifest+> = core.serialization.object({+ auth: ConfiguredMcpServerAuth.optional(),+ name: ResourceName,+ url: core.serialization.string(),+});++export declare namespace McpServerManifest {+ export interface Raw {+ auth?: ConfiguredMcpServerAuth.Raw | null;+ name: ResourceName.Raw;+ url: string;+ }+}diff --git a/packages/sdk/src/serialization/resources/settings/resources/mcpServers/client/requests/index.ts b/packages/sdk/src/serialization/resources/settings/resources/mcpServers/client/requests/index.tsnew file mode 100644index 000000000..29be17470--- /dev/null+++ b/packages/sdk/src/serialization/resources/settings/resources/mcpServers/client/requests/index.ts@@ -0,0 +1 @@+export { McpServerManifest } from "./McpServerManifest.js";diff --git a/packages/sdk/src/serialization/resources/settings/resources/mcpServers/index.ts b/packages/sdk/src/serialization/resources/settings/resources/mcpServers/index.tsnew file mode 100644index 000000000..914b8c3c7--- /dev/null+++ b/packages/sdk/src/serialization/resources/settings/resources/mcpServers/index.ts@@ -0,0 +1 @@+export * from "./client/index.js";diff --git a/packages/sdk/src/serialization/types/CatalogMcpServer.ts b/packages/sdk/src/serialization/types/CatalogMcpServer.tsnew file mode 100644index 000000000..948dd4593--- /dev/null+++ b/packages/sdk/src/serialization/types/CatalogMcpServer.ts@@ -0,0 +1,27 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { ConfiguredMcpServerAuth } from "./ConfiguredMcpServerAuth.js";+import { McpServerType } from "./McpServerType.js";+import { ResourceName } from "./ResourceName.js";++export const CatalogMcpServer: core.serialization.ObjectSchema<+ serializers.CatalogMcpServer.Raw,+ TrueHarness.CatalogMcpServer+> = core.serialization.object({+ auth: ConfiguredMcpServerAuth.optional(),+ name: ResourceName,+ type: McpServerType,+ url: core.serialization.string(),+});++export declare namespace CatalogMcpServer {+ export interface Raw {+ auth?: ConfiguredMcpServerAuth.Raw | null;+ name: ResourceName.Raw;+ type: McpServerType.Raw;+ url: string;+ }+}diff --git a/packages/sdk/src/serialization/types/CatalogSkill.ts b/packages/sdk/src/serialization/types/CatalogSkill.tsnew file mode 100644index 000000000..94c6e39b7--- /dev/null+++ b/packages/sdk/src/serialization/types/CatalogSkill.ts@@ -0,0 +1,28 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { ResourceName } from "./ResourceName.js";+import { SkillType } from "./SkillType.js";++export const CatalogSkill: core.serialization.ObjectSchema<serializers.CatalogSkill.Raw, TrueHarness.CatalogSkill> =+ core.serialization.object({+ description: core.serialization.string(),+ name: ResourceName,+ path: core.serialization.string().optional(),+ ref: core.serialization.string().optional(),+ type: SkillType,+ url: core.serialization.string(),+ });++export declare namespace CatalogSkill {+ export interface Raw {+ description: string;+ name: ResourceName.Raw;+ path?: string | null;+ ref?: string | null;+ type: SkillType.Raw;+ url: string;+ }+}diff --git a/packages/sdk/src/serialization/types/ConfiguredMcpAuthorizeResponse.ts b/packages/sdk/src/serialization/types/ConfiguredMcpAuthorizeResponse.tsnew file mode 100644index 000000000..f01233579--- /dev/null+++ b/packages/sdk/src/serialization/types/ConfiguredMcpAuthorizeResponse.ts@@ -0,0 +1,21 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { ConfiguredMcpAuthorizeResponseStatus } from "./ConfiguredMcpAuthorizeResponseStatus.js";++export const ConfiguredMcpAuthorizeResponse: core.serialization.ObjectSchema<+ serializers.ConfiguredMcpAuthorizeResponse.Raw,+ TrueHarness.ConfiguredMcpAuthorizeResponse+> = core.serialization.object({+ authorizationUrl: core.serialization.property("authorization_url", core.serialization.string().optional()),+ status: ConfiguredMcpAuthorizeResponseStatus,+});++export declare namespace ConfiguredMcpAuthorizeResponse {+ export interface Raw {+ authorization_url?: string | null;+ status: ConfiguredMcpAuthorizeResponseStatus.Raw;+ }+}diff --git a/packages/sdk/src/serialization/types/ConfiguredMcpAuthorizeResponseStatus.ts b/packages/sdk/src/serialization/types/ConfiguredMcpAuthorizeResponseStatus.tsnew file mode 100644index 000000000..dda954c10--- /dev/null+++ b/packages/sdk/src/serialization/types/ConfiguredMcpAuthorizeResponseStatus.ts@@ -0,0 +1,14 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";++export const ConfiguredMcpAuthorizeResponseStatus: core.serialization.Schema<+ serializers.ConfiguredMcpAuthorizeResponseStatus.Raw,+ TrueHarness.ConfiguredMcpAuthorizeResponseStatus+> = core.serialization.enum_(["authenticated", "auth_required"]);++export declare namespace ConfiguredMcpAuthorizeResponseStatus {+ export type Raw = "authenticated" | "auth_required";+}diff --git a/packages/sdk/src/serialization/types/ConfiguredMcpServer.ts b/packages/sdk/src/serialization/types/ConfiguredMcpServer.tsnew file mode 100644index 000000000..93f81dcb8--- /dev/null+++ b/packages/sdk/src/serialization/types/ConfiguredMcpServer.ts@@ -0,0 +1,30 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { ConfiguredMcpServerAuth } from "./ConfiguredMcpServerAuth.js";+import { McpAuthStatus } from "./McpAuthStatus.js";+import { McpServerType } from "./McpServerType.js";+import { ResourceName } from "./ResourceName.js";++export const ConfiguredMcpServer: core.serialization.ObjectSchema<+ serializers.ConfiguredMcpServer.Raw,+ TrueHarness.ConfiguredMcpServer+> = core.serialization.object({+ auth: ConfiguredMcpServerAuth.optional(),+ authStatus: core.serialization.property("auth_status", McpAuthStatus),+ name: ResourceName,+ type: McpServerType,+ url: core.serialization.string(),+});++export declare namespace ConfiguredMcpServer {+ export interface Raw {+ auth?: ConfiguredMcpServerAuth.Raw | null;+ auth_status: McpAuthStatus.Raw;+ name: ResourceName.Raw;+ type: McpServerType.Raw;+ url: string;+ }+}diff --git a/packages/sdk/src/serialization/types/ConfiguredMcpServerAuth.ts b/packages/sdk/src/serialization/types/ConfiguredMcpServerAuth.tsnew file mode 100644index 000000000..ad1b97e2c--- /dev/null+++ b/packages/sdk/src/serialization/types/ConfiguredMcpServerAuth.ts@@ -0,0 +1,16 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { McpServerDcrAuth } from "./McpServerDcrAuth.js";+import { McpServerHeaderAuth } from "./McpServerHeaderAuth.js";++export const ConfiguredMcpServerAuth: core.serialization.Schema<+ serializers.ConfiguredMcpServerAuth.Raw,+ TrueHarness.ConfiguredMcpServerAuth+> = core.serialization.undiscriminatedUnion([McpServerDcrAuth, McpServerHeaderAuth]);++export declare namespace ConfiguredMcpServerAuth {+ export type Raw = McpServerDcrAuth.Raw | McpServerHeaderAuth.Raw;+}diff --git a/packages/sdk/src/serialization/types/GetMcpServerCatalogResponse.ts b/packages/sdk/src/serialization/types/GetMcpServerCatalogResponse.tsnew file mode 100644index 000000000..4ec3fe225--- /dev/null+++ b/packages/sdk/src/serialization/types/GetMcpServerCatalogResponse.ts@@ -0,0 +1,19 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { CatalogMcpServer } from "./CatalogMcpServer.js";++export const GetMcpServerCatalogResponse: core.serialization.ObjectSchema<+ serializers.GetMcpServerCatalogResponse.Raw,+ TrueHarness.GetMcpServerCatalogResponse+> = core.serialization.object({+ data: core.serialization.list(CatalogMcpServer),+});++export declare namespace GetMcpServerCatalogResponse {+ export interface Raw {+ data: CatalogMcpServer.Raw[];+ }+}diff --git a/packages/sdk/src/serialization/types/GetSkillCatalogResponse.ts b/packages/sdk/src/serialization/types/GetSkillCatalogResponse.tsnew file mode 100644index 000000000..afe2ba036--- /dev/null+++ b/packages/sdk/src/serialization/types/GetSkillCatalogResponse.ts@@ -0,0 +1,19 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { CatalogSkill } from "./CatalogSkill.js";++export const GetSkillCatalogResponse: core.serialization.ObjectSchema<+ serializers.GetSkillCatalogResponse.Raw,+ TrueHarness.GetSkillCatalogResponse+> = core.serialization.object({+ data: core.serialization.list(CatalogSkill),+});++export declare namespace GetSkillCatalogResponse {+ export interface Raw {+ data: CatalogSkill.Raw[];+ }+}diff --git a/packages/sdk/src/serialization/types/ListAvailableMcpServersResponse.ts b/packages/sdk/src/serialization/types/ListAvailableMcpServersResponse.tsnew file mode 100644index 000000000..3b8796659--- /dev/null+++ b/packages/sdk/src/serialization/types/ListAvailableMcpServersResponse.ts@@ -0,0 +1,19 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { McpServerReadEntry } from "./McpServerReadEntry.js";++export const ListAvailableMcpServersResponse: core.serialization.ObjectSchema<+ serializers.ListAvailableMcpServersResponse.Raw,+ TrueHarness.ListAvailableMcpServersResponse+> = core.serialization.object({+ data: core.serialization.list(McpServerReadEntry),+});++export declare namespace ListAvailableMcpServersResponse {+ export interface Raw {+ data: McpServerReadEntry.Raw[];+ }+}diff --git a/packages/sdk/src/serialization/types/ListAvailableSkillsResponse.ts b/packages/sdk/src/serialization/types/ListAvailableSkillsResponse.tsnew file mode 100644index 000000000..6918dd97c--- /dev/null+++ b/packages/sdk/src/serialization/types/ListAvailableSkillsResponse.ts@@ -0,0 +1,19 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { SkillReadEntry } from "./SkillReadEntry.js";++export const ListAvailableSkillsResponse: core.serialization.ObjectSchema<+ serializers.ListAvailableSkillsResponse.Raw,+ TrueHarness.ListAvailableSkillsResponse+> = core.serialization.object({+ data: core.serialization.list(SkillReadEntry),+});++export declare namespace ListAvailableSkillsResponse {+ export interface Raw {+ data: SkillReadEntry.Raw[];+ }+}diff --git a/packages/sdk/src/serialization/types/ListConfiguredMcpServersResponse.ts b/packages/sdk/src/serialization/types/ListConfiguredMcpServersResponse.tsnew file mode 100644index 000000000..0f94d56b3--- /dev/null+++ b/packages/sdk/src/serialization/types/ListConfiguredMcpServersResponse.ts@@ -0,0 +1,19 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { ConfiguredMcpServer } from "./ConfiguredMcpServer.js";++export const ListConfiguredMcpServersResponse: core.serialization.ObjectSchema<+ serializers.ListConfiguredMcpServersResponse.Raw,+ TrueHarness.ListConfiguredMcpServersResponse+> = core.serialization.object({+ data: core.serialization.list(ConfiguredMcpServer),+});++export declare namespace ListConfiguredMcpServersResponse {+ export interface Raw {+ data: ConfiguredMcpServer.Raw[];+ }+}diff --git a/packages/sdk/src/serialization/types/ListConfiguredSkillsResponse.ts b/packages/sdk/src/serialization/types/ListConfiguredSkillsResponse.tsnew file mode 100644index 000000000..9eb8c73e1--- /dev/null+++ b/packages/sdk/src/serialization/types/ListConfiguredSkillsResponse.ts@@ -0,0 +1,19 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { SkillManifest } from "./SkillManifest.js";++export const ListConfiguredSkillsResponse: core.serialization.ObjectSchema<+ serializers.ListConfiguredSkillsResponse.Raw,+ TrueHarness.ListConfiguredSkillsResponse+> = core.serialization.object({+ data: core.serialization.list(SkillManifest),+});++export declare namespace ListConfiguredSkillsResponse {+ export interface Raw {+ data: SkillManifest.Raw[];+ }+}diff --git a/packages/sdk/src/serialization/types/ListMcpServerToolsResponse.ts b/packages/sdk/src/serialization/types/ListMcpServerToolsResponse.tsnew file mode 100644index 000000000..085703d45--- /dev/null+++ b/packages/sdk/src/serialization/types/ListMcpServerToolsResponse.ts@@ -0,0 +1,18 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";++export const ListMcpServerToolsResponse: core.serialization.ObjectSchema<+ serializers.ListMcpServerToolsResponse.Raw,+ TrueHarness.ListMcpServerToolsResponse+> = core.serialization.object({+ data: core.serialization.list(core.serialization.record(core.serialization.string(), core.serialization.unknown())),+});++export declare namespace ListMcpServerToolsResponse {+ export interface Raw {+ data: Record<string, unknown>[];+ }+}diff --git a/packages/sdk/src/serialization/types/McpAuthStatus.ts b/packages/sdk/src/serialization/types/McpAuthStatus.tsnew file mode 100644index 000000000..a7f5a01cb--- /dev/null+++ b/packages/sdk/src/serialization/types/McpAuthStatus.ts@@ -0,0 +1,19 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { McpAuthStatusStatus } from "./McpAuthStatusStatus.js";++export const McpAuthStatus: core.serialization.ObjectSchema<serializers.McpAuthStatus.Raw, TrueHarness.McpAuthStatus> =+ core.serialization.object({+ authorizationUrl: core.serialization.property("authorization_url", core.serialization.string().optional()),+ status: McpAuthStatusStatus,+ });++export declare namespace McpAuthStatus {+ export interface Raw {+ authorization_url?: string | null;+ status: McpAuthStatusStatus.Raw;+ }+}diff --git a/packages/sdk/src/serialization/types/McpAuthStatusStatus.ts b/packages/sdk/src/serialization/types/McpAuthStatusStatus.tsnew file mode 100644index 000000000..fdd3f680c--- /dev/null+++ b/packages/sdk/src/serialization/types/McpAuthStatusStatus.ts@@ -0,0 +1,14 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";++export const McpAuthStatusStatus: core.serialization.Schema<+ serializers.McpAuthStatusStatus.Raw,+ TrueHarness.McpAuthStatusStatus+> = core.serialization.enum_(["authenticated", "auth_required"]);++export declare namespace McpAuthStatusStatus {+ export type Raw = "authenticated" | "auth_required";+}diff --git a/packages/sdk/src/serialization/types/McpServerDcrAuth.ts b/packages/sdk/src/serialization/types/McpServerDcrAuth.tsnew file mode 100644index 000000000..39e2f56f8--- /dev/null+++ b/packages/sdk/src/serialization/types/McpServerDcrAuth.ts@@ -0,0 +1,18 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";++export const McpServerDcrAuth: core.serialization.ObjectSchema<+ serializers.McpServerDcrAuth.Raw,+ TrueHarness.McpServerDcrAuth+> = core.serialization.object({+ type: core.serialization.stringLiteral("dcr"),+});++export declare namespace McpServerDcrAuth {+ export interface Raw {+ type: "dcr";+ }+}diff --git a/packages/sdk/src/serialization/types/McpServerHeaderAuth.ts b/packages/sdk/src/serialization/types/McpServerHeaderAuth.tsnew file mode 100644index 000000000..b601ad3dc--- /dev/null+++ b/packages/sdk/src/serialization/types/McpServerHeaderAuth.ts@@ -0,0 +1,20 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";++export const McpServerHeaderAuth: core.serialization.ObjectSchema<+ serializers.McpServerHeaderAuth.Raw,+ TrueHarness.McpServerHeaderAuth+> = core.serialization.object({+ headers: core.serialization.record(core.serialization.string(), core.serialization.string()),+ type: core.serialization.stringLiteral("header"),+});++export declare namespace McpServerHeaderAuth {+ export interface Raw {+ headers: Record<string, string>;+ type: "header";+ }+}diff --git a/packages/sdk/src/serialization/types/McpServerReadEntry.ts b/packages/sdk/src/serialization/types/McpServerReadEntry.tsnew file mode 100644index 000000000..dd6e596cc--- /dev/null+++ b/packages/sdk/src/serialization/types/McpServerReadEntry.ts@@ -0,0 +1,21 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { ResourceName } from "./ResourceName.js";++export const McpServerReadEntry: core.serialization.ObjectSchema<+ serializers.McpServerReadEntry.Raw,+ TrueHarness.McpServerReadEntry+> = core.serialization.object({+ name: ResourceName,+ url: core.serialization.string(),+});++export declare namespace McpServerReadEntry {+ export interface Raw {+ name: ResourceName.Raw;+ url: string;+ }+}diff --git a/packages/sdk/src/serialization/types/McpServerType.ts b/packages/sdk/src/serialization/types/McpServerType.tsnew file mode 100644index 000000000..1e917874e--- /dev/null+++ b/packages/sdk/src/serialization/types/McpServerType.ts@@ -0,0 +1,12 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";++export const McpServerType: core.serialization.Schema<serializers.McpServerType.Raw, TrueHarness.McpServerType> =+ core.serialization.stringLiteral("remote");++export declare namespace McpServerType {+ export type Raw = "remote";+}diff --git a/packages/sdk/src/serialization/types/PutMcpServerResponse.ts b/packages/sdk/src/serialization/types/PutMcpServerResponse.tsnew file mode 100644index 000000000..9fd383a16--- /dev/null+++ b/packages/sdk/src/serialization/types/PutMcpServerResponse.ts@@ -0,0 +1,19 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { ConfiguredMcpServer } from "./ConfiguredMcpServer.js";++export const PutMcpServerResponse: core.serialization.ObjectSchema<+ serializers.PutMcpServerResponse.Raw,+ TrueHarness.PutMcpServerResponse+> = core.serialization.object({+ data: ConfiguredMcpServer,+});++export declare namespace PutMcpServerResponse {+ export interface Raw {+ data: ConfiguredMcpServer.Raw;+ }+}diff --git a/packages/sdk/src/serialization/types/PutSkillResponse.ts b/packages/sdk/src/serialization/types/PutSkillResponse.tsnew file mode 100644index 000000000..95afe307f--- /dev/null+++ b/packages/sdk/src/serialization/types/PutSkillResponse.ts@@ -0,0 +1,19 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { SkillManifest } from "./SkillManifest.js";++export const PutSkillResponse: core.serialization.ObjectSchema<+ serializers.PutSkillResponse.Raw,+ TrueHarness.PutSkillResponse+> = core.serialization.object({+ data: SkillManifest,+});++export declare namespace PutSkillResponse {+ export interface Raw {+ data: SkillManifest.Raw;+ }+}diff --git a/packages/sdk/src/serialization/types/SkillManifest.ts b/packages/sdk/src/serialization/types/SkillManifest.tsnew file mode 100644index 000000000..662bb39d4--- /dev/null+++ b/packages/sdk/src/serialization/types/SkillManifest.ts@@ -0,0 +1,28 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { ResourceName } from "./ResourceName.js";+import { SkillType } from "./SkillType.js";++export const SkillManifest: core.serialization.ObjectSchema<serializers.SkillManifest.Raw, TrueHarness.SkillManifest> =+ core.serialization.object({+ description: core.serialization.string(),+ name: ResourceName,+ path: core.serialization.string().optional(),+ ref: core.serialization.string().optional(),+ type: SkillType,+ url: core.serialization.string(),+ });++export declare namespace SkillManifest {+ export interface Raw {+ description: string;+ name: ResourceName.Raw;+ path?: string | null;+ ref?: string | null;+ type: SkillType.Raw;+ url: string;+ }+}diff --git a/packages/sdk/src/serialization/types/SkillReadEntry.ts b/packages/sdk/src/serialization/types/SkillReadEntry.tsnew file mode 100644index 000000000..cd4aa0ec9--- /dev/null+++ b/packages/sdk/src/serialization/types/SkillReadEntry.ts@@ -0,0 +1,21 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";+import { ResourceName } from "./ResourceName.js";++export const SkillReadEntry: core.serialization.ObjectSchema<+ serializers.SkillReadEntry.Raw,+ TrueHarness.SkillReadEntry+> = core.serialization.object({+ description: core.serialization.string(),+ name: ResourceName,+});++export declare namespace SkillReadEntry {+ export interface Raw {+ description: string;+ name: ResourceName.Raw;+ }+}diff --git a/packages/sdk/src/serialization/types/SkillType.ts b/packages/sdk/src/serialization/types/SkillType.tsnew file mode 100644index 000000000..5b9dffdca--- /dev/null+++ b/packages/sdk/src/serialization/types/SkillType.ts@@ -0,0 +1,12 @@+// This file was auto-generated by Fern from our API Definition.++import type * as TrueHarness from "../../api/index.js";+import * as core from "../../core/index.js";+import type * as serializers from "../index.js";++export const SkillType: core.serialization.Schema<serializers.SkillType.Raw, TrueHarness.SkillType> =+ core.serialization.stringLiteral("git");++export declare namespace SkillType {+ export type Raw = "git";+}diff --git a/packages/sdk/src/serialization/types/index.ts b/packages/sdk/src/serialization/types/index.tsindex 60d425c9d..b82da2ff1 100644--- a/packages/sdk/src/serialization/types/index.ts+++ b/packages/sdk/src/serialization/types/index.ts@@ -11,14 +11,20 @@ export * from "./AskUserQuestionsConfig.js";export * from "./BaseMcpAuthRequiredEvent.js";export * from "./BaseThreadDoneEvent.js";export * from "./CancelSessionResponse.js";+export * from "./CatalogMcpServer.js";export * from "./CatalogProvider.js";export * from "./CatalogProviderType.js";+export * from "./CatalogSkill.js";export * from "./ChatCompletionChunkDeltaToolCall.js";export * from "./ChatCompletionChunkDeltaToolCallFunction.js";export * from "./ChatCompletionContentPartRefusal.js";export * from "./ChatCompletionContentPartText.js";export * from "./ChatCompletionMessageToolCall.js";export * from "./ChatCompletionMessageToolCallFunction.js";+export * from "./ConfiguredMcpAuthorizeResponse.js";+export * from "./ConfiguredMcpAuthorizeResponseStatus.js";+export * from "./ConfiguredMcpServer.js";+export * from "./ConfiguredMcpServerAuth.js";export * from "./ContextManagementConfig.js";export * from "./ContextManagementConfigCompaction.js";export * from "./DynamicSubAgentsConfig.js";@@ -29,13 +35,20 @@ export * from "./GenerativeUiConfig.js";export * from "./GetCapabilitiesResponse.js";export * from "./GetCapabilitiesResponseData.js";export * from "./GetCapabilitiesResponseDataSandbox.js";+export * from "./GetMcpServerCatalogResponse.js";export * from "./GetModelProviderCatalogResponse.js";export * from "./GetSessionResponse.js";+export * from "./GetSkillCatalogResponse.js";export * from "./GetTurnResponse.js";export * from "./LargeToolResponseConfig.js";+export * from "./ListAvailableMcpServersResponse.js";+export * from "./ListAvailableSkillsResponse.js";+export * from "./ListConfiguredMcpServersResponse.js";+export * from "./ListConfiguredSkillsResponse.js";export * from "./ListLegacyModelsResponse.js";export * from "./ListLegacyModelsResponseDataItem.js";export * from "./ListMcpServersResponse.js";+export * from "./ListMcpServerToolsResponse.js";export * from "./ListMcpToolsResponse.js";export * from "./ListModelProvidersResponse.js";export * from "./ListModelsResponse.js";@@ -49,18 +62,24 @@ export * from "./ListTurnsResponse.js";export * from "./McpAuthorizeResponse.js";export * from "./McpAuthorizeResponseStatus.js";export * from "./McpAuthRequiredEvent.js";+export * from "./McpAuthStatus.js";+export * from "./McpAuthStatusStatus.js";export * from "./McpInitializeEvent.js";export * from "./McpServer.js";export * from "./McpServerAuthInfo.js";export * from "./McpServerAuthSettings.js";+export * from "./McpServerDcrAuth.js";export * from "./McpServerDisableToolsItem.js";export * from "./McpServerEnableToolsItem.js";export * from "./McpServerEntry.js";export * from "./McpServerEntryAuthStatus.js";+export * from "./McpServerHeaderAuth.js";export * from "./McpServerInitInfo.js";export * from "./McpServerInitInfoTransportType.js";export * from "./McpServerPreloadToolsItem.js";+export * from "./McpServerReadEntry.js";export * from "./McpServerRequireApprovalForToolsItem.js";+export * from "./McpServerType.js";export * from "./McpToolInfo.js";export * from "./Model.js";export * from "./ModelEntry.js";@@ -76,7 +95,9 @@ export * from "./ModelProvider.js";export * from "./ModelProviderAuth.js";export * from "./PreviousTurnIdInput.js";export * from "./ProviderType.js";+export * from "./PutMcpServerResponse.js";export * from "./PutModelProviderResponse.js";+export * from "./PutSkillResponse.js";export * from "./RawToolCall.js";export * from "./RequestErrorResponse.js";export * from "./RequestErrorResponseError.js";@@ -97,7 +118,10 @@ export * from "./Session.js";export * from "./SessionEvent.js";export * from "./SessionEventItem.js";export * from "./SkillEntry.js";+export * from "./SkillManifest.js";export * from "./SkillMount.js";+export * from "./SkillReadEntry.js";+export * from "./SkillType.js";export * from "./TextContent.js";export * from "./ThreadCreatedEvent.js";export * from "./ThreadDoneEvent.js";diff --git a/packages/sdk/tests/wire/mcpServers.test.ts b/packages/sdk/tests/wire/mcpServers.test.tsnew file mode 100644index 000000000..f9aa97caf--- /dev/null+++ b/packages/sdk/tests/wire/mcpServers.test.ts@@ -0,0 +1,31 @@+// This file was auto-generated by Fern from our API Definition.++import { TrueHarness } from "../../src/Client";+import { mockServerPool } from "../mock-server/MockServerPool";++describe("McpServersClient", () => {+ test("list", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = { data: [{ name: "name", url: "url" }] };++ server+ .mockEndpoint()+ .get("/api/v1/mcp-servers")+ .respondWith()+ .statusCode(200)+ .jsonBody(rawResponseBody)+ .build();++ const response = await client.mcpServers.list();+ expect(response).toEqual({+ data: [+ {+ name: "name",+ url: "url",+ },+ ],+ });+ });+});diff --git a/packages/sdk/tests/wire/sessions.test.ts b/packages/sdk/tests/wire/sessions.test.tsindex 2224f8ee7..f75e47f03 100644--- a/packages/sdk/tests/wire/sessions.test.ts+++ b/packages/sdk/tests/wire/sessions.test.ts@@ -351,6 +351,16 @@ describe("SessionsClient", () => {}).rejects.toThrow(TrueHarnessTypes.NotFoundError);});+ test("delete", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ server.mockEndpoint().delete("/api/v1/sessions/sessionId").respondWith().statusCode(200).build();++ const response = await client.sessions.delete("sessionId");+ expect(response).toEqual(undefined);+ });+test("update (1)", async () => {const server = mockServerPool.createServer();const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });diff --git a/packages/sdk/tests/wire/settings/mcpServers.test.ts b/packages/sdk/tests/wire/settings/mcpServers.test.tsnew file mode 100644index 000000000..499d4391b--- /dev/null+++ b/packages/sdk/tests/wire/settings/mcpServers.test.ts@@ -0,0 +1,269 @@+// This file was auto-generated by Fern from our API Definition.++import * as TrueHarnessTypes from "../../../src/api/index";+import { TrueHarness } from "../../../src/Client";+import { mockServerPool } from "../../mock-server/MockServerPool";++describe("McpServersClient", () => {+ test("list", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = {+ data: [+ {+ auth: { type: "dcr" },+ auth_status: { status: "authenticated" },+ name: "name",+ type: "remote",+ url: "url",+ },+ ],+ };++ server+ .mockEndpoint()+ .get("/api/v1/settings/mcp-servers")+ .respondWith()+ .statusCode(200)+ .jsonBody(rawResponseBody)+ .build();++ const response = await client.settings.mcpServers.list();+ expect(response).toEqual({+ data: [+ {+ auth: {+ type: "dcr",+ },+ authStatus: {+ status: "authenticated",+ },+ name: "name",+ type: "remote",+ url: "url",+ },+ ],+ });+ });++ test("upsert (1)", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });+ const rawRequestBody = { name: "name", type: "remote", url: "url" };+ const rawResponseBody = {+ data: {+ auth: { type: "dcr" },+ auth_status: { authorization_url: "authorization_url", status: "authenticated" },+ name: "name",+ type: "remote",+ url: "url",+ },+ };++ server+ .mockEndpoint()+ .put("/api/v1/settings/mcp-servers")+ .jsonBody(rawRequestBody)+ .respondWith()+ .statusCode(200)+ .jsonBody(rawResponseBody)+ .build();++ const response = await client.settings.mcpServers.upsert({+ name: "name",+ url: "url",+ });+ expect(response).toEqual({+ data: {+ auth: {+ type: "dcr",+ },+ authStatus: {+ authorizationUrl: "authorization_url",+ status: "authenticated",+ },+ name: "name",+ type: "remote",+ url: "url",+ },+ });+ });++ test("upsert (2)", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });+ const rawRequestBody = { name: "xy", type: "remote", url: "url" };+ const rawResponseBody = { error: { message: "message" } };++ server+ .mockEndpoint()+ .put("/api/v1/settings/mcp-servers")+ .jsonBody(rawRequestBody)+ .respondWith()+ .statusCode(400)+ .jsonBody(rawResponseBody)+ .build();++ await expect(async () => {+ return await client.settings.mcpServers.upsert({+ name: "xy",+ url: "url",+ });+ }).rejects.toThrow(TrueHarnessTypes.BadRequestError);+ });++ test("catalog", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = { data: [{ auth: { type: "dcr" }, name: "name", type: "remote", url: "url" }] };++ server+ .mockEndpoint()+ .get("/api/v1/settings/mcp-servers/catalog")+ .respondWith()+ .statusCode(200)+ .jsonBody(rawResponseBody)+ .build();++ const response = await client.settings.mcpServers.catalog();+ expect(response).toEqual({+ data: [+ {+ auth: {+ type: "dcr",+ },+ name: "name",+ type: "remote",+ url: "url",+ },+ ],+ });+ });++ test("authorize (1)", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = { authorization_url: "authorization_url", status: "authenticated" };++ server+ .mockEndpoint()+ .get("/api/v1/settings/mcp-servers/name/authorize")+ .respondWith()+ .statusCode(200)+ .jsonBody(rawResponseBody)+ .build();++ const response = await client.settings.mcpServers.authorize("name", {+ redirectUrl: "redirect_url",+ });+ expect(response).toEqual({+ authorizationUrl: "authorization_url",+ status: "authenticated",+ });+ });++ test("authorize (2)", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = { error: { message: "message" } };++ server+ .mockEndpoint()+ .get("/api/v1/settings/mcp-servers/name/authorize")+ .respondWith()+ .statusCode(404)+ .jsonBody(rawResponseBody)+ .build();++ await expect(async () => {+ return await client.settings.mcpServers.authorize("name", {+ redirectUrl: "redirect_url",+ });+ }).rejects.toThrow(TrueHarnessTypes.NotFoundError);+ });++ test("list_tools (1)", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = { data: [{ key: "value" }] };++ server+ .mockEndpoint()+ .get("/api/v1/settings/mcp-servers/name/tools")+ .respondWith()+ .statusCode(200)+ .jsonBody(rawResponseBody)+ .build();++ const response = await client.settings.mcpServers.listTools("name");+ expect(response).toEqual({+ data: [+ {+ key: "value",+ },+ ],+ });+ });++ test("list_tools (2)", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = { error: { message: "message" } };++ server+ .mockEndpoint()+ .get("/api/v1/settings/mcp-servers/name/tools")+ .respondWith()+ .statusCode(401)+ .jsonBody(rawResponseBody)+ .build();++ await expect(async () => {+ return await client.settings.mcpServers.listTools("name");+ }).rejects.toThrow(TrueHarnessTypes.UnauthorizedError);+ });++ test("list_tools (3)", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = { error: { message: "message" } };++ server+ .mockEndpoint()+ .get("/api/v1/settings/mcp-servers/name/tools")+ .respondWith()+ .statusCode(404)+ .jsonBody(rawResponseBody)+ .build();++ await expect(async () => {+ return await client.settings.mcpServers.listTools("name");+ }).rejects.toThrow(TrueHarnessTypes.NotFoundError);+ });++ test("list_tools (4)", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = { error: { message: "message" } };++ server+ .mockEndpoint()+ .get("/api/v1/settings/mcp-servers/name/tools")+ .respondWith()+ .statusCode(502)+ .jsonBody(rawResponseBody)+ .build();++ await expect(async () => {+ return await client.settings.mcpServers.listTools("name");+ }).rejects.toThrow(TrueHarnessTypes.BadGatewayError);+ });+});diff --git a/packages/sdk/tests/wire/settings/skills.test.ts b/packages/sdk/tests/wire/settings/skills.test.tsnew file mode 100644index 000000000..6ae7cc40c--- /dev/null+++ b/packages/sdk/tests/wire/settings/skills.test.ts@@ -0,0 +1,129 @@+// This file was auto-generated by Fern from our API Definition.++import * as TrueHarnessTypes from "../../../src/api/index";+import { TrueHarness } from "../../../src/Client";+import { mockServerPool } from "../../mock-server/MockServerPool";++describe("SkillsClient", () => {+ test("list", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = {+ data: [{ description: "description", name: "name", path: "path", ref: "ref", type: "git", url: "url" }],+ };++ server+ .mockEndpoint()+ .get("/api/v1/settings/skills")+ .respondWith()+ .statusCode(200)+ .jsonBody(rawResponseBody)+ .build();++ const response = await client.settings.skills.list();+ expect(response).toEqual({+ data: [+ {+ description: "description",+ name: "name",+ path: "path",+ ref: "ref",+ type: "git",+ url: "url",+ },+ ],+ });+ });++ test("upsert (1)", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });+ const rawRequestBody = { description: "description", name: "name", type: "git", url: "url" };+ const rawResponseBody = {+ data: { description: "description", name: "name", path: "path", ref: "ref", type: "git", url: "url" },+ };++ server+ .mockEndpoint()+ .put("/api/v1/settings/skills")+ .jsonBody(rawRequestBody)+ .respondWith()+ .statusCode(200)+ .jsonBody(rawResponseBody)+ .build();++ const response = await client.settings.skills.upsert({+ description: "description",+ name: "name",+ type: "git",+ url: "url",+ });+ expect(response).toEqual({+ data: {+ description: "description",+ name: "name",+ path: "path",+ ref: "ref",+ type: "git",+ url: "url",+ },+ });+ });++ test("upsert (2)", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });+ const rawRequestBody = { description: "x", name: "xy", type: "git", url: "x" };+ const rawResponseBody = { error: { message: "message" } };++ server+ .mockEndpoint()+ .put("/api/v1/settings/skills")+ .jsonBody(rawRequestBody)+ .respondWith()+ .statusCode(400)+ .jsonBody(rawResponseBody)+ .build();++ await expect(async () => {+ return await client.settings.skills.upsert({+ description: "x",+ name: "xy",+ type: "git",+ url: "x",+ });+ }).rejects.toThrow(TrueHarnessTypes.BadRequestError);+ });++ test("catalog", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = {+ data: [{ description: "description", name: "name", path: "path", ref: "ref", type: "git", url: "url" }],+ };++ server+ .mockEndpoint()+ .get("/api/v1/settings/skills/catalog")+ .respondWith()+ .statusCode(200)+ .jsonBody(rawResponseBody)+ .build();++ const response = await client.settings.skills.catalog();+ expect(response).toEqual({+ data: [+ {+ description: "description",+ name: "name",+ path: "path",+ ref: "ref",+ type: "git",+ url: "url",+ },+ ],+ });+ });+});diff --git a/packages/sdk/tests/wire/skills.test.ts b/packages/sdk/tests/wire/skills.test.tsnew file mode 100644index 000000000..da0585887--- /dev/null+++ b/packages/sdk/tests/wire/skills.test.ts@@ -0,0 +1,25 @@+// This file was auto-generated by Fern from our API Definition.++import { TrueHarness } from "../../src/Client";+import { mockServerPool } from "../mock-server/MockServerPool";++describe("SkillsClient", () => {+ test("list", async () => {+ const server = mockServerPool.createServer();+ const client = new TrueHarness({ maxRetries: 0, environment: server.baseUrl });++ const rawResponseBody = { data: [{ description: "description", name: "name" }] };++ server.mockEndpoint().get("/api/v1/skills").respondWith().statusCode(200).jsonBody(rawResponseBody).build();++ const response = await client.skills.list();+ expect(response).toEqual({+ data: [+ {+ description: "description",+ name: "name",+ },+ ],+ });+ });+});diff --git a/packages/server/.env.example b/packages/server/.env.exampleindex 5f005b9b3..c2d4d6c20 100644--- a/packages/server/.env.example+++ b/packages/server/.env.example@@ -18,6 +18,14 @@ PORT=8790# When unset, the catalog inlined at build time (src/catalog/model-catalog.yaml) is used.# MODEL_CATALOG_PATH=/path/to/model-catalog.yaml+# Optional override for the MCP catalog YAML (GET /settings/mcp-servers/catalog).+# When unset, the catalog inlined at build time (src/catalog/mcp-catalog.yaml) is used.+# MCP_CATALOG_PATH=/path/to/mcp-catalog.yaml++# Optional override for the skill catalog YAML (GET /settings/skills/catalog).+# When unset, the catalog inlined at build time (src/catalog/skill-catalog.yaml) is used.+# SKILL_CATALOG_PATH=/path/to/skill-catalog.yaml+# Frontend build the server serves alongside the API. Optional, defaults to# ../frontend/dist relative to the working directory. With no build there the# server logs a warning and serves the API only.diff --git a/packages/server/package.json b/packages/server/package.jsonindex d0ee521ef..22d64e114 100644--- a/packages/server/package.json+++ b/packages/server/package.json@@ -8,7 +8,7 @@"type": "module","scripts": {"build:gen": "node scripts/generate-catalog.mjs",- "build:gen:watch": "node --watch-path=src/catalog/model-catalog.yaml 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 scripts/generate-catalog.mjs","build": "pnpm run build:gen && tsc --noEmit && tsup","predev": "pnpm --filter @truefoundry/utils build:gen && pnpm run build:gen","dev": "pnpm run --parallel catalog-watch dev:serve",diff --git a/packages/server/scripts/generate-catalog.mjs b/packages/server/scripts/generate-catalog.mjsindex 2068c969a..8f37b61b1 100644--- a/packages/server/scripts/generate-catalog.mjs+++ b/packages/server/scripts/generate-catalog.mjs@@ -1,19 +1,26 @@/**- * Inlines model-catalog.yaml into a generated TS module so ModelCatalog can- * load the shipped catalog with no loose YAML beside the bundle. A plain- * generated `.ts` file works unchanged across tsup and tsx — no loaders needed.+ * Inlines model-catalog.yaml, mcp-catalog.yaml, and skill-catalog.yaml into+ * generated TS modules so ModelCatalog / McpCatalog / SkillCatalog can load+ * shipped catalogs with no loose YAML beside the bundle. Plain generated `.ts`+ * files work unchanged across tsup and tsx.*- * Runs via the `build:gen` script before build/typecheck/test/dev. The- * generated output (src/catalog/modelCatalog.gen.ts) is gitignored.+ * Runs via the `build:gen` script before build/typecheck/test/dev. Generated+ * outputs under src/catalog/*.gen.ts are gitignored.*/import { readFileSync, writeFileSync } from 'node:fs';import { dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';const root = join(dirname(fileURLToPath(import.meta.url)), '..');-const yaml = readFileSync(join(root, 'src/catalog/model-catalog.yaml'), 'utf-8');-const out = `// AUTO-GENERATED by scripts/generate-catalog.mjs — do not edit.-export const shippedModelCatalogYaml = ${JSON.stringify(yaml)} as const;+function writeShippedCatalog(yamlFileName, exportName, outFileName) {+ const yaml = readFileSync(join(root, 'src/catalog', yamlFileName), 'utf-8');+ const out = `// AUTO-GENERATED by scripts/generate-catalog.mjs — do not edit.+export const ${exportName} = ${JSON.stringify(yaml)} as const;`;-writeFileSync(join(root, 'src/catalog/modelCatalog.gen.ts'), out);+ writeFileSync(join(root, 'src/catalog', outFileName), out);+}++writeShippedCatalog('model-catalog.yaml', 'shippedModelCatalogYaml', 'modelCatalog.gen.ts');+writeShippedCatalog('mcp-catalog.yaml', 'shippedMcpCatalogYaml', 'mcpCatalog.gen.ts');+writeShippedCatalog('skill-catalog.yaml', 'shippedSkillCatalogYaml', 'skillCatalog.gen.ts');diff --git a/packages/server/scripts/write-openapi.ts b/packages/server/scripts/write-openapi.tsindex 1a9bd8868..b67d9c574 100644--- a/packages/server/scripts/write-openapi.ts+++ b/packages/server/scripts/write-openapi.ts@@ -11,9 +11,13 @@ import { mkdirSync, writeFileSync } from 'node:fs';import path from 'node:path';import winston from 'winston';import { buildOpenApiDocument, createServerApp } from '../src/app';+import { McpCatalog } from '../src/catalog/McpCatalog';import { ModelCatalog } from '../src/catalog/ModelCatalog';+import { SkillCatalog } from '../src/catalog/SkillCatalog';import { createSqliteDb } from '../src/db/sqlite/client';+import { SqliteMcpServerStore } from '../src/db/sqlite/mcp-server-store/SqliteMcpServerStore';import { SqliteModelProviderStore } from '../src/db/sqlite/model-provider-store/SqliteModelProviderStore';+import { SqliteSkillStore } from '../src/db/sqlite/skill-store/SqliteSkillStore';import { McpStore } from '../src/legacy-registry-store/McpStore';import { ModelStore } from '../src/legacy-registry-store/ModelStore';import { SkillStore } from '../src/legacy-registry-store/SkillStore';@@ -40,12 +44,17 @@ function canonicalise(value: unknown): unknown {// Unconnected stand-ins suffice: route registration never reads a dependency.const sessionStore = new InMemorySessionStore();+const db = createSqliteDb(':memory:');const app = createServerApp({modelStore: ModelStore.load(),modelCatalog: ModelCatalog.load(),- modelProviderStore: new SqliteModelProviderStore(createSqliteDb(':memory:')),+ modelProviderStore: new SqliteModelProviderStore(db),+ mcpCatalog: McpCatalog.load(),+ mcpServerStore: new SqliteMcpServerStore(db),mcpStore: McpStore.load(),- skillStore: SkillStore.load(),+ skillCatalog: SkillCatalog.load(),+ skillStore: new SqliteSkillStore(db),+ legacySkillStore: SkillStore.load(),sessionStore,sessions: new Sessions({ sessionStore }),activeTurns: new ActiveTurnRegistry(),diff --git a/packages/server/src/apis/mcpServers.ts b/packages/server/src/apis/mcpServers.tsnew file mode 100644index 000000000..c310e0cfe--- /dev/null+++ b/packages/server/src/apis/mcpServers.ts@@ -0,0 +1,135 @@+import { OpenAPIHono, type RouteHandler } from '@hono/zod-openapi';+import { extractErrorLogFields, isAuthRequired, McpConnectionError, RemoteMCP } from '@truefoundry/utils/core';+import type { Logger } from 'winston';+import type { McpCatalog } from '../catalog/McpCatalog';+import type { IMcpServerStore, McpServerRecord } from '../db/mcpServerStore';+import {+ authorizeConfiguredMcpServerRoute,+ getMcpServerCatalogRoute,+ listAvailableMcpServersRoute,+ listConfiguredMcpServersRoute,+ listMcpServerToolsRoute,+ putMcpServerRoute,+} from '../routes/mcpServerRoutes';+import type { ConfiguredMcpServer, McpServerManifest } from '../schemas/mcpServer';+import { resolveConfiguredMcpRequestHeaders, toStubAuthStatus } from '../schemas/mcpServer';+import { TENANT_ID } from './sessions';++export interface McpServersRouterDeps {+ mcpCatalog: McpCatalog;+ mcpServerStore: IMcpServerStore;+ logger: Logger;+}++/** Omits keys whose value is `undefined` so wire objects satisfy JSONValue index signatures. */+function omitUndefinedEntries(obj: Record<string, unknown>): Record<string, unknown> {+ const out: Record<string, unknown> = {};+ for (const [key, value] of Object.entries(obj)) {+ if (value !== undefined) {+ out[key] = value;+ }+ }+ return out;+}++function toConfiguredMcpServer(record: McpServerRecord): ConfiguredMcpServer {+ return {+ ...record.manifest,+ auth_status: toStubAuthStatus(record.manifest),+ };+}++/** Admin/settings MCP CRUD (mounted at /api/v1/settings/mcp-servers). */+export function createMcpServersRouter(deps: McpServersRouterDeps) {+ const catalogHandler: RouteHandler<typeof getMcpServerCatalogRoute> = c => {+ return c.json({ data: [...deps.mcpCatalog.list()] }, 200);+ };++ const listConfiguredHandler: RouteHandler<typeof listConfiguredMcpServersRoute> = async c => {+ const records = await deps.mcpServerStore.listServers(TENANT_ID);+ return c.json({ data: records.map(toConfiguredMcpServer) }, 200);+ };++ const putHandler: RouteHandler<typeof putMcpServerRoute> = async c => {+ const manifest: McpServerManifest = c.req.valid('json');+ const record = await deps.mcpServerStore.upsertServer({+ tenant_id: TENANT_ID,+ name: manifest.name,+ manifest,+ });+ return c.json({ data: toConfiguredMcpServer(record) }, 200);+ };++ const listToolsHandler: RouteHandler<typeof listMcpServerToolsRoute> = async c => {+ const { name } = c.req.valid('param');+ const record = await deps.mcpServerStore.getServer({ tenant_id: TENANT_ID, name });+ if (!record) {+ return c.json({ error: { message: `MCP server not found: ${name}` } }, 404);+ }+ const remote = new RemoteMCP({+ id: name,+ name,+ url: record.manifest.url,+ headers: resolveConfiguredMcpRequestHeaders(record.manifest),+ logger: deps.logger,+ signal: c.req.raw.signal,+ });+ try {+ const response = await remote.listTools();+ if (isAuthRequired(response)) {+ return c.json({ error: { message: `MCP server "${name}" requires authentication` } }, 401);+ }+ const data = response.result.tools.map(tool => omitUndefinedEntries({ ...tool }));+ return c.json({ data }, 200);+ } catch (error) {+ if (error instanceof McpConnectionError) {+ deps.logger.warn(`MCP tools/list failed for "${name}"`, extractErrorLogFields(error));+ if (error.statusCode === 401) {+ return c.json({ error: { message: error.message } }, 401);+ }+ return c.json({ error: { message: error.message } }, 502);+ }+ throw error;+ }+ };++ const authorizeHandler: RouteHandler<typeof authorizeConfiguredMcpServerRoute> = async c => {+ const { name } = c.req.valid('param');+ const { redirect_url: redirectUrl } = c.req.valid('query');+ const record = await deps.mcpServerStore.getServer({ tenant_id: TENANT_ID, name });+ if (!record) {+ return c.json({ error: { message: `MCP server not found: ${name}` } }, 404);+ }+ // Header auth (and no auth): credentials already on the row — no browser flow.+ if (record.manifest.auth?.type !== 'dcr') {+ return c.json({ status: 'authenticated' as const }, 200);+ }+ // STUB: real DCR + authorize URL minting lands with the OAuth follow-up.+ const stubAuthUrl = `https://example-authorization-server.invalid/authorize?client_id=stub&redirect_uri=${encodeURIComponent(redirectUrl)}`;+ return c.json({ status: 'auth_required' as const, authorization_url: stubAuthUrl }, 200);+ };++ const router = new OpenAPIHono();+ // Static `/catalog` before `/{name}/…` so "catalog" is not captured as a name.+ router.openapi(getMcpServerCatalogRoute, catalogHandler);+ router.openapi(listConfiguredMcpServersRoute, listConfiguredHandler);+ router.openapi(putMcpServerRoute, putHandler);+ router.openapi(listMcpServerToolsRoute, listToolsHandler);+ router.openapi(authorizeConfiguredMcpServerRoute, authorizeHandler);+ return router;+}++/** Chat slim list (mounted at /api/v1/mcp-servers) — mirrors GET /api/v1/models. */+export function createAvailableMcpServersRouter(store: IMcpServerStore) {+ const router = new OpenAPIHono();+ router.openapi(listAvailableMcpServersRoute, async c => {+ const records = await store.listServers(TENANT_ID);+ return c.json(+ {+ data: records.map(record => ({ name: record.name, url: record.manifest.url })),+ },+ 200,+ );+ });+ return router;+}diff --git a/packages/server/src/apis/settings.ts b/packages/server/src/apis/settings.tsindex 2de72cc4e..de8048006 100644--- a/packages/server/src/apis/settings.ts+++ b/packages/server/src/apis/settings.ts@@ -1,16 +1,28 @@/*** Admin/settings API surface under /api/v1/settings.- * Sub-routers (model-providers today; mcp/skills/sandbox later) mount here so+ * Sub-routers (model-providers, mcp-servers, skills; sandbox later) mount here so* a single policy can wrap the whole tree later without touching each resource.*/import { OpenAPIHono } from '@hono/zod-openapi';+import type { Logger } from 'winston';+import type { McpCatalog } from '../catalog/McpCatalog';import type { ModelCatalog } from '../catalog/ModelCatalog';+import type { SkillCatalog } from '../catalog/SkillCatalog';+import type { IMcpServerStore } from '../db/mcpServerStore';import type { IModelProviderStore } from '../db/modelProviderStore';+import type { ISkillStore } from '../db/skillStore';+import { createMcpServersRouter } from './mcpServers';import { createModelProvidersRouter } from './modelProviders';+import { createSkillsRouter } from './skills';export interface SettingsRouterDeps {modelCatalog: ModelCatalog;modelProviderStore: IModelProviderStore;+ mcpCatalog: McpCatalog;+ mcpServerStore: IMcpServerStore;+ skillCatalog: SkillCatalog;+ skillStore: ISkillStore;+ logger: Logger;}export function createSettingsRouter(deps: SettingsRouterDeps) {@@ -22,5 +34,20 @@ export function createSettingsRouter(deps: SettingsRouterDeps) {modelProviderStore: deps.modelProviderStore,}),);+ router.route(+ '/mcp-servers',+ createMcpServersRouter({+ mcpCatalog: deps.mcpCatalog,+ mcpServerStore: deps.mcpServerStore,+ logger: deps.logger,+ }),+ );+ router.route(+ '/skills',+ createSkillsRouter({+ skillCatalog: deps.skillCatalog,+ skillStore: deps.skillStore,+ }),+ );return router;}diff --git a/packages/server/src/apis/skills.ts b/packages/server/src/apis/skills.tsnew file mode 100644index 000000000..8473b3fb6--- /dev/null+++ b/packages/server/src/apis/skills.ts@@ -0,0 +1,71 @@+import { OpenAPIHono, type RouteHandler } from '@hono/zod-openapi';+import type { SkillCatalog } from '../catalog/SkillCatalog';+import type { ISkillStore, SkillRecord } from '../db/skillStore';+import {+ getSkillCatalogRoute,+ listAvailableSkillsRoute,+ listConfiguredSkillsRoute,+ putSkillRoute,+} from '../routes/skillRoutes';+import type { ConfiguredSkill, SkillManifest } from '../schemas/skill';+import { TENANT_ID } from './sessions';++export interface SkillsRouterDeps {+ skillCatalog: SkillCatalog;+ skillStore: ISkillStore;+}++/** Wire view of a stored skill: identity `name` plus persisted manifest. */+function toConfiguredSkill(record: SkillRecord): ConfiguredSkill {+ return {+ ...record.manifest,+ name: record.name,+ };+}++/** Admin/settings skills CRUD (mounted at /api/v1/settings/skills). */+export function createSkillsRouter(deps: SkillsRouterDeps) {+ const catalogHandler: RouteHandler<typeof getSkillCatalogRoute> = c => {+ return c.json({ data: [...deps.skillCatalog.list()] }, 200);+ };++ const listConfiguredHandler: RouteHandler<typeof listConfiguredSkillsRoute> = async c => {+ const records = await deps.skillStore.listSkills(TENANT_ID);+ return c.json({ data: records.map(toConfiguredSkill) }, 200);+ };++ const putHandler: RouteHandler<typeof putSkillRoute> = async c => {+ const manifest: SkillManifest = c.req.valid('json');+ const record = await deps.skillStore.upsertSkill({+ tenant_id: TENANT_ID,+ name: manifest.name,+ manifest,+ });+ return c.json({ data: toConfiguredSkill(record) }, 200);+ };++ const router = new OpenAPIHono();+ // Static `/catalog` before `/` so path order matches model-providers / mcp-servers.+ router.openapi(getSkillCatalogRoute, catalogHandler);+ router.openapi(listConfiguredSkillsRoute, listConfiguredHandler);+ router.openapi(putSkillRoute, putHandler);+ return router;+}++/** Chat slim list (mounted at /api/v1/skills) — mirrors GET /api/v1/mcp-servers. */+export function createAvailableSkillsRouter(store: ISkillStore) {+ const router = new OpenAPIHono();+ router.openapi(listAvailableSkillsRoute, async c => {+ const records = await store.listSkills(TENANT_ID);+ return c.json(+ {+ data: records.map(record => ({+ name: record.name,+ description: record.manifest.description,+ })),+ },+ 200,+ );+ });+ return router;+}diff --git a/packages/server/src/app.ts b/packages/server/src/app.tsindex 627c52e1d..0b3effcc8 100644--- a/packages/server/src/app.ts+++ b/packages/server/src/app.ts@@ -12,12 +12,18 @@ import { createLegacyMcpRouter } from './apis/legacyMcp';import { createLegacyMcpOAuthRouter } from './apis/legacyMcpOAuth';import { createLegacyModelsRouter } from './apis/legacyModels';import { createLegacySkillsRouter } from './apis/legacySkills';+import { createAvailableMcpServersRouter } from './apis/mcpServers';import { createModelsRouter } from './apis/models';import { createSessionsRouter } from './apis/sessions';import { createSettingsRouter } from './apis/settings';+import { createAvailableSkillsRouter } from './apis/skills';import { createTurnsRouter } from './apis/turns';+import type { McpCatalog } from './catalog/McpCatalog';import type { ModelCatalog } from './catalog/ModelCatalog';+import type { SkillCatalog } from './catalog/SkillCatalog';+import type { IMcpServerStore } from './db/mcpServerStore';import type { IModelProviderStore } from './db/modelProviderStore';+import type { ISkillStore } from './db/skillStore';import type { McpStore } from './legacy-registry-store/McpStore';import type { ModelStore } from './legacy-registry-store/ModelStore';import type { SkillStore } from './legacy-registry-store/SkillStore';@@ -45,8 +51,12 @@ export interface ServerDeps {modelStore: ModelStore;modelCatalog: ModelCatalog;modelProviderStore: IModelProviderStore;+ mcpCatalog: McpCatalog;+ mcpServerStore: IMcpServerStore;mcpStore: McpStore;- skillStore: SkillStore;+ skillCatalog: SkillCatalog;+ skillStore: ISkillStore;+ legacySkillStore: SkillStore;sessionStore: ISessionStore;sessions: Sessions;activeTurns: ActiveTurnRegistry;@@ -66,15 +76,25 @@ export function createServerApp(deps: ServerDeps) {app.route('/api/v1/capabilities', createCapabilitiesRouter({ sandboxEnabled: deps.sandboxFactory !== undefined }));app.route('/api/v1/models', createModelsRouter(deps.modelProviderStore));+ app.route('/api/v1/mcp-servers', createAvailableMcpServersRouter(deps.mcpServerStore));+ app.route('/api/v1/skills', createAvailableSkillsRouter(deps.skillStore));app.route('/api/v1/settings',- createSettingsRouter({ modelCatalog: deps.modelCatalog, modelProviderStore: deps.modelProviderStore }),+ createSettingsRouter({+ modelCatalog: deps.modelCatalog,+ modelProviderStore: deps.modelProviderStore,+ mcpCatalog: deps.mcpCatalog,+ mcpServerStore: deps.mcpServerStore,+ skillCatalog: deps.skillCatalog,+ skillStore: deps.skillStore,+ logger: deps.logger,+ }),);- // YAML registry surfaces — non-legacy paths reserved for future DB-backed CRUD.+ // YAML registry surfaces — still used by sessions/turns and the legacy UI paths.app.route('/api/v1/legacy/models', createLegacyModelsRouter(deps.modelStore));app.route('/api/v1/legacy/mcp-servers', createLegacyMcpRouter({ mcpStore: deps.mcpStore, logger: deps.logger }));app.route('/api/v1/legacy/mcp-servers/oauth', createLegacyMcpOAuthRouter({ logger: deps.logger }));- app.route('/api/v1/legacy/skills', createLegacySkillsRouter(deps.skillStore));+ app.route('/api/v1/legacy/skills', createLegacySkillsRouter(deps.legacySkillStore));app.route('/api/v1/sessions',createSessionsRouter({diff --git a/packages/server/src/catalog/McpCatalog.ts b/packages/server/src/catalog/McpCatalog.tsnew file mode 100644index 000000000..8623007a8--- /dev/null+++ b/packages/server/src/catalog/McpCatalog.ts@@ -0,0 +1,34 @@+/**+ * Shipped MCP catalog (mcp-catalog.yaml): the discovery list of server+ * presets the settings UI copies into PUT /settings/mcp-servers bodies.+ * Never consulted on writes and never read by the runtime.+ *+ * Default: YAML inlined into `mcpCatalog.gen.ts` at build time. Optional+ * override: `MCP_CATALOG_PATH` (file on disk).+ */+import configuration from '../config';+import { McpCatalogFileSchema, type CatalogMcpServer } from '../schemas/mcpCatalog';+import { loadYamlAtPath, parseYamlString } from './loadYaml';+import { shippedMcpCatalogYaml } from './mcpCatalog.gen';++export class McpCatalog {+ private readonly mcpServers: readonly CatalogMcpServer[];++ constructor(mcpServers: readonly CatalogMcpServer[]) {+ this.mcpServers = mcpServers;+ }++ /** Loads and validates the catalog. Throws on any error. */+ static load(): McpCatalog {+ if (configuration.MCP_CATALOG_PATH !== undefined) {+ const file = loadYamlAtPath(configuration.MCP_CATALOG_PATH, McpCatalogFileSchema);+ return new McpCatalog(file.mcp_servers);+ }+ const file = parseYamlString(shippedMcpCatalogYaml, McpCatalogFileSchema, 'shipped mcp-catalog');+ return new McpCatalog(file.mcp_servers);+ }++ list(): readonly CatalogMcpServer[] {+ return this.mcpServers;+ }+}diff --git a/packages/server/src/catalog/SkillCatalog.ts b/packages/server/src/catalog/SkillCatalog.tsnew file mode 100644index 000000000..bd5c09132--- /dev/null+++ b/packages/server/src/catalog/SkillCatalog.ts@@ -0,0 +1,34 @@+/**+ * Shipped skill catalog (skill-catalog.yaml): the discovery list of skill+ * presets the settings UI copies into PUT /settings/skills bodies.+ * Never consulted on writes and never read by the runtime.+ *+ * Default: YAML inlined into `skillCatalog.gen.ts` at build time. Optional+ * override: `SKILL_CATALOG_PATH` (file on disk).+ */+import configuration from '../config';+import { SkillCatalogFileSchema, type CatalogSkill } from '../schemas/skillCatalog';+import { loadYamlAtPath, parseYamlString } from './loadYaml';+import { shippedSkillCatalogYaml } from './skillCatalog.gen';++export class SkillCatalog {+ private readonly skills: readonly CatalogSkill[];++ constructor(skills: readonly CatalogSkill[]) {+ this.skills = skills;+ }++ /** Loads and validates the catalog. Throws on any error. */+ static load(): SkillCatalog {+ if (configuration.SKILL_CATALOG_PATH !== undefined) {+ const file = loadYamlAtPath(configuration.SKILL_CATALOG_PATH, SkillCatalogFileSchema);+ return new SkillCatalog(file.skills);+ }+ const file = parseYamlString(shippedSkillCatalogYaml, SkillCatalogFileSchema, 'shipped skill-catalog');+ return new SkillCatalog(file.skills);+ }++ list(): readonly CatalogSkill[] {+ return this.skills;+ }+}diff --git a/packages/server/src/catalog/mcp-catalog.yaml b/packages/server/src/catalog/mcp-catalog.yamlnew file mode 100644index 000000000..5de8e40aa--- /dev/null+++ b/packages/server/src/catalog/mcp-catalog.yaml@@ -0,0 +1,12 @@+# Shipped MCP catalog: server presets offered by+# GET /api/v1/settings/mcp-servers/catalog for the settings UI to copy into+# PUT /api/v1/settings/mcp-servers bodies. Discovery-only — never executed against.+mcp_servers:+ - type: remote+ name: linear+ url: https://mcp.linear.app/mcp+ auth:+ type: dcr+ - type: remote+ name: deepwiki+ url: https://mcp.deepwiki.com/mcpdiff --git a/packages/server/src/catalog/model-catalog.yaml b/packages/server/src/catalog/model-catalog.yamlindex dfabdc9a2..d9c5977ca 100644--- a/packages/server/src/catalog/model-catalog.yaml+++ b/packages/server/src/catalog/model-catalog.yaml@@ -1,7 +1,6 @@# Shipped model catalog: provider/model presets offered by# GET /api/v1/settings/model-providers/catalog for the settings UI to copy into# PUT /api/v1/settings/model-providers bodies. Discovery-only — never executed against.-type: model-catalogproviders:- type: openainame: openaidiff --git a/packages/server/src/catalog/skill-catalog.yaml b/packages/server/src/catalog/skill-catalog.yamlnew file mode 100644index 000000000..327740b53--- /dev/null+++ b/packages/server/src/catalog/skill-catalog.yaml@@ -0,0 +1,10 @@+# Shipped skill catalog: skill presets offered by+# GET /api/v1/settings/skills/catalog for the settings UI to copy into+# PUT /api/v1/settings/skills bodies. Discovery-only — never executed against.+skills:+ - type: git+ name: algorithmic-art+ url: https://github.com/anthropics/skills+ path: skills/algorithmic-art+ ref: main+ description: Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration.diff --git a/packages/server/src/config.ts b/packages/server/src/config.tsindex 5b3fc239a..2cd970bf4 100644--- a/packages/server/src/config.ts+++ b/packages/server/src/config.ts@@ -232,6 +232,18 @@ export interface ServerConfiguration {* time is used. Separate from `REGISTRY_DIR`. Env: `MODEL_CATALOG_PATH`.*/MODEL_CATALOG_PATH: string | undefined;+ /**+ * Optional override for the MCP catalog YAML (discovery presets for+ * GET /settings/mcp-servers/catalog). When unset, the catalog inlined at build+ * time is used. Separate from `REGISTRY_DIR`. Env: `MCP_CATALOG_PATH`.+ */+ MCP_CATALOG_PATH: string | undefined;+ /**+ * Optional override for the skill catalog YAML (discovery presets for+ * GET /settings/skills/catalog). When unset, the catalog inlined at build+ * time is used. Separate from `REGISTRY_DIR`. Env: `SKILL_CATALOG_PATH`.+ */+ SKILL_CATALOG_PATH: string | undefined;/*** Frontend build served alongside the API; a missing directory leaves the server API-only.* Env: `FRONTEND_DIR`, defaults to `../frontend/dist` relative to the working directory.@@ -364,6 +376,14 @@ const configuration: ServerConfiguration = {const override = getEnv('MODEL_CATALOG_PATH');return override === undefined || override === '' ? undefined : path.resolve(override);})(),+ MCP_CATALOG_PATH: (() => {+ const override = getEnv('MCP_CATALOG_PATH');+ return override === undefined || override === '' ? undefined : path.resolve(override);+ })(),+ SKILL_CATALOG_PATH: (() => {+ const override = getEnv('SKILL_CATALOG_PATH');+ return override === undefined || override === '' ? undefined : path.resolve(override);+ })(),FRONTEND_DIR: path.resolve(getEnv('FRONTEND_DIR', { defaultValue: DEFAULT_FRONTEND_DIR }) ?? DEFAULT_FRONTEND_DIR),MODEL_API_KEY: getEnv('MODEL_API_KEY', { required: true }) ?? '',MODEL_API_KEY_BY_NAME: parseApiKeysByName(),diff --git a/packages/server/src/db/mcpServerStore.ts b/packages/server/src/db/mcpServerStore.tsnew file mode 100644index 000000000..33e5681b6--- /dev/null+++ b/packages/server/src/db/mcpServerStore.ts@@ -0,0 +1,39 @@+/**+ * DB-backed configured MCP servers: one row per server per tenant,+ * identity as columns plus a Zod-validated `McpServerManifest` jsonb document.+ * Implementations: PostgresMcpServerStore and SqliteMcpServerStore.+ */+import type { ResourceName } from '../schemas/common';+import type { McpServerManifest } from '../schemas/mcpServer';++export interface McpServerRecord {+ id: string;+ tenant_id: string;+ name: ResourceName;+ manifest: McpServerManifest;+ /** ISO-8601 UTC instant. */+ created_at: string;+ /** ISO-8601 UTC instant. */+ updated_at: string;+}++export interface GetMcpServerInput {+ tenant_id: string;+ name: string;+}++export interface UpsertMcpServerInput {+ tenant_id: string;+ name: ResourceName;+ manifest: McpServerManifest;+}++export interface IMcpServerStore {+ listServers(tenantId: string): Promise<McpServerRecord[]>;+ getServer(input: GetMcpServerInput): Promise<McpServerRecord | undefined>;+ /**+ * Creates the server or replaces `manifest` (+ `updated_at`) only.+ * Never overwrites `id`, `oauth_server`, or `oauth_client`.+ */+ upsertServer(input: UpsertMcpServerInput): Promise<McpServerRecord>;+}diff --git a/packages/server/src/db/postgres/mcp-server-store/PostgresMcpServerStore.ts b/packages/server/src/db/postgres/mcp-server-store/PostgresMcpServerStore.tsnew file mode 100644index 000000000..bab8ebbc8--- /dev/null+++ b/packages/server/src/db/postgres/mcp-server-store/PostgresMcpServerStore.ts@@ -0,0 +1,68 @@+import type { Kysely, Selectable } from 'kysely';+import { ulid } from 'ulid';+import type { GetMcpServerInput, IMcpServerStore, McpServerRecord, UpsertMcpServerInput } from '../../mcpServerStore';+import { json, now } from '../sqlExpressions';+import type { Database, McpServerTable } from '../types';++function toRecord(row: Selectable<McpServerTable>): McpServerRecord {+ return {+ id: row.id,+ tenant_id: row.tenant_id,+ name: row.name,+ manifest: row.manifest,+ created_at: row.created_at.toISOString(),+ updated_at: row.updated_at.toISOString(),+ };+}++export class PostgresMcpServerStore implements IMcpServerStore {+ readonly #db: Kysely<Database>;++ constructor(db: Kysely<Database>) {+ this.#db = db;+ }++ async listServers(tenantId: string): Promise<McpServerRecord[]> {+ const rows = await this.#db+ .selectFrom('mcp_server')+ .selectAll()+ .where('tenant_id', '=', tenantId)+ .orderBy('name')+ .execute();+ return rows.map(toRecord);+ }++ async getServer(input: GetMcpServerInput): Promise<McpServerRecord | undefined> {+ const row = await this.#db+ .selectFrom('mcp_server')+ .selectAll()+ .where('tenant_id', '=', input.tenant_id)+ .where('name', '=', input.name)+ .executeTakeFirst();+ return row === undefined ? undefined : toRecord(row);+ }++ async upsertServer(input: UpsertMcpServerInput): Promise<McpServerRecord> {+ const row = await this.#db+ .insertInto('mcp_server')+ .values({+ id: ulid(),+ tenant_id: input.tenant_id,+ name: input.name,+ manifest: json(input.manifest),+ oauth_server: null,+ oauth_client: null,+ created_at: now(),+ updated_at: now(),+ })+ .onConflict(oc =>+ oc.columns(['tenant_id', 'name']).doUpdateSet({+ manifest: json(input.manifest),+ updated_at: now(),+ }),+ )+ .returningAll()+ .executeTakeFirstOrThrow();+ return toRecord(row);+ }+}diff --git a/packages/server/src/db/postgres/migrations/20260808_000001_skill.ts b/packages/server/src/db/postgres/migrations/20260808_000001_skill.tsnew file mode 100644index 000000000..2dc58f6d3--- /dev/null+++ b/packages/server/src/db/postgres/migrations/20260808_000001_skill.ts@@ -0,0 +1,25 @@+import type { Kysely } from 'kysely';++/**+ * Configured skills (canonical DDL owner).+ *+ * Manifest pattern: identity as columns, everything else (type, url, path, ref,+ * description — and duplicated `name`) in one `manifest` jsonb validated by Zod+ * on every write. The PK is the only DB-level invariant — all others live at+ * the Zod layer — so future manifest fields are schema changes, not migrations.+ */+export async function up(db: Kysely<unknown>): Promise<void> {+ await db.schema+ .createTable('skill')+ .addColumn('tenant_id', 'text', col => col.notNull())+ .addColumn('name', 'text', col => col.notNull())+ .addColumn('manifest', 'jsonb', col => col.notNull())+ .addColumn('created_at', 'timestamptz', col => col.notNull())+ .addColumn('updated_at', 'timestamptz', col => col.notNull())+ .addPrimaryKeyConstraint('skill_pkey', ['tenant_id', 'name'])+ .execute();+}++export async function down(db: Kysely<unknown>): Promise<void> {+ await db.schema.dropTable('skill').ifExists().cascade().execute();+}diff --git a/packages/server/src/db/postgres/skill-store/PostgresSkillStore.ts b/packages/server/src/db/postgres/skill-store/PostgresSkillStore.tsnew file mode 100644index 000000000..2b95724ff--- /dev/null+++ b/packages/server/src/db/postgres/skill-store/PostgresSkillStore.ts@@ -0,0 +1,63 @@+import type { Kysely, Selectable } from 'kysely';+import { type GetSkillInput, type ISkillStore, type SkillRecord, type UpsertSkillInput } from '../../skillStore';+import { json, now } from '../sqlExpressions';+import type { Database, SkillTable } from '../types';++function toRecord(row: Selectable<SkillTable>): SkillRecord {+ return {+ tenant_id: row.tenant_id,+ name: row.name,+ manifest: row.manifest,+ created_at: row.created_at.toISOString(),+ updated_at: row.updated_at.toISOString(),+ };+}++export class PostgresSkillStore implements ISkillStore {+ readonly #db: Kysely<Database>;++ constructor(db: Kysely<Database>) {+ this.#db = db;+ }++ async listSkills(tenantId: string): Promise<SkillRecord[]> {+ const rows = await this.#db+ .selectFrom('skill')+ .selectAll()+ .where('tenant_id', '=', tenantId)+ .orderBy('name')+ .execute();+ return rows.map(toRecord);+ }++ async getSkill(input: GetSkillInput): Promise<SkillRecord | undefined> {+ const row = await this.#db+ .selectFrom('skill')+ .selectAll()+ .where('tenant_id', '=', input.tenant_id)+ .where('name', '=', input.name)+ .executeTakeFirst();+ return row === undefined ? undefined : toRecord(row);+ }++ async upsertSkill(input: UpsertSkillInput): Promise<SkillRecord> {+ const row = await this.#db+ .insertInto('skill')+ .values({+ tenant_id: input.tenant_id,+ name: input.name,+ manifest: json(input.manifest),+ created_at: now(),+ updated_at: now(),+ })+ .onConflict(oc =>+ oc.columns(['tenant_id', 'name']).doUpdateSet({+ manifest: json(input.manifest),+ updated_at: now(),+ }),+ )+ .returningAll()+ .executeTakeFirstOrThrow();+ return toRecord(row);+ }+}diff --git a/packages/server/src/db/postgres/types.ts b/packages/server/src/db/postgres/types.tsindex 6b5c81356..f75e5085f 100644--- a/packages/server/src/db/postgres/types.ts+++ b/packages/server/src/db/postgres/types.ts@@ -14,8 +14,9 @@ import type {} from '@truefoundry/utils/core';import type { CurrentContextUsage } from '@truefoundry/utils/core/runtime/contextUsage';import type { ColumnType, Generated, JSONColumnType } from 'kysely';-import type { McpServerManifest } from '../../legacy-registry-store/schemas';+import type { McpServerManifest } from '../../schemas/mcpServer';import type { ProviderManifest } from '../../schemas/modelProvider';+import type { SkillManifest } from '../../schemas/skill';import type { McpOAuthPendingAuthorizationData, McpOAuthToken, OAuthClient, OAuthServer } from '../mcpOAuthTypes';/**@@ -299,6 +300,21 @@ export interface ModelProviderTable {updated_at: Date;}+/**+ * Configured skills — mirrors the Postgres `skill` table.+ * PRIMARY KEY (tenant_id, name)+ */+export interface SkillTable {+ /** key */+ tenant_id: string;+ /** key: natural key within tenant; also duplicated inside `manifest` */+ name: string;+ /** SkillManifest document; replaced whole on every upsert */+ manifest: JSONColumnType<SkillManifest, SkillManifest, SkillManifest>;+ created_at: Date;+ updated_at: Date;+}+/*** PRIMARY KEY (id)* UNIQUE (tenant_id, name) — the natural lookup key.@@ -306,7 +322,7 @@ export interface ModelProviderTable {export interface McpServerTable {id: string;tenant_id: string;- /** the uniqueness target; also duplicated inside `manifest` (the full mcp.yaml entry) */+ /** the uniqueness target; also duplicated inside `manifest` */name: string;manifest: JSONColumnType<McpServerManifest, McpServerManifest, McpServerManifest>;/** OAuthServer — { authorizationEndpoint, tokenEndpoint, codeChallengeMethodsSupported? }.@@ -362,8 +378,9 @@ export interface OAuthPendingAuthorizationTable {* big ones (`agent_info`, `checkpoint`); `session`, `turn`, and* `thread_capability_state` take small bounded HOT-friendly updates; the two logs* are pure insert. Nothing ever rewrites a large value except the array concat- * itself — the documented, bounded cost of the raw-array model. `mcp_server` and the two- * `oauth_*` tables are low-write, low-volume (one row per tenant/server, or short-lived).+ * itself — the documented, bounded cost of the raw-array model. `model_provider`,+ * `skill`, `mcp_server`, and the two `oauth_*` tables are low-write, low-volume+ * (one row per tenant/resource, or short-lived).** Canonical Kysely database.*/@@ -375,6 +392,7 @@ export interface Database {thread_context_log: ThreadContextLogTable;thread_capability_state: ThreadCapabilityStateTable;model_provider: ModelProviderTable;+ skill: SkillTable;mcp_server: McpServerTable;oauth_token: OAuthTokenTable;oauth_pending_authorization: OAuthPendingAuthorizationTable;diff --git a/packages/server/src/db/skillStore.ts b/packages/server/src/db/skillStore.tsnew file mode 100644index 000000000..937b65115--- /dev/null+++ b/packages/server/src/db/skillStore.ts@@ -0,0 +1,35 @@+/**+ * DB-backed configured skills: one row per skill per tenant,+ * identity as columns plus a Zod-validated `SkillManifest` jsonb document.+ * Implementations: PostgresSkillStore and SqliteSkillStore.+ */+import type { ResourceName } from '../schemas/common';+import type { SkillManifest } from '../schemas/skill';++export interface SkillRecord {+ tenant_id: string;+ name: ResourceName;+ manifest: SkillManifest;+ /** ISO-8601 UTC instant. */+ created_at: string;+ /** ISO-8601 UTC instant. */+ updated_at: string;+}++export interface GetSkillInput {+ tenant_id: string;+ name: string;+}++export interface UpsertSkillInput {+ tenant_id: string;+ name: ResourceName;+ manifest: SkillManifest;+}++export interface ISkillStore {+ listSkills(tenantId: string): Promise<SkillRecord[]>;+ getSkill(input: GetSkillInput): Promise<SkillRecord | undefined>;+ /** Single-row write: creates the skill or replaces the whole manifest. */+ upsertSkill(input: UpsertSkillInput): Promise<SkillRecord>;+}diff --git a/packages/server/src/db/sqlite/mcp-server-store/SqliteMcpServerStore.ts b/packages/server/src/db/sqlite/mcp-server-store/SqliteMcpServerStore.tsnew file mode 100644index 000000000..383924f45--- /dev/null+++ b/packages/server/src/db/sqlite/mcp-server-store/SqliteMcpServerStore.ts@@ -0,0 +1,68 @@+import type { ExpressionBuilder, Kysely } from 'kysely';+import { ulid } from 'ulid';+import type { McpServerManifest } from '../../../schemas/mcpServer';+import type { GetMcpServerInput, IMcpServerStore, McpServerRecord, UpsertMcpServerInput } from '../../mcpServerStore';+import { jsonbBind, jsonText, nowIso } from '../sqlExpressions';+import type { Database } from '../types';++/** Column list projecting the JSONB manifest as parsed JSON (see JSON_RESULT_COLUMNS). */+function recordColumns(eb: ExpressionBuilder<Database, 'mcp_server'>) {+ return [+ 'id' as const,+ 'tenant_id' as const,+ 'name' as const,+ jsonText<McpServerManifest>(eb.ref('manifest')).as('manifest'),+ 'created_at' as const,+ 'updated_at' as const,+ ];+}++export class SqliteMcpServerStore implements IMcpServerStore {+ readonly #db: Kysely<Database>;++ constructor(db: Kysely<Database>) {+ this.#db = db;+ }++ async listServers(tenantId: string): Promise<McpServerRecord[]> {+ return await this.#db+ .selectFrom('mcp_server')+ .select(recordColumns)+ .where('tenant_id', '=', tenantId)+ .orderBy('name')+ .execute();+ }++ async getServer(input: GetMcpServerInput): Promise<McpServerRecord | undefined> {+ return await this.#db+ .selectFrom('mcp_server')+ .select(recordColumns)+ .where('tenant_id', '=', input.tenant_id)+ .where('name', '=', input.name)+ .executeTakeFirst();+ }++ async upsertServer(input: UpsertMcpServerInput): Promise<McpServerRecord> {+ const timestamp = nowIso();+ return await this.#db+ .insertInto('mcp_server')+ .values({+ id: ulid(),+ tenant_id: input.tenant_id,+ name: input.name,+ manifest: jsonbBind(input.manifest),+ oauth_server: null,+ oauth_client: null,+ created_at: timestamp,+ updated_at: timestamp,+ })+ .onConflict(oc =>+ oc.columns(['tenant_id', 'name']).doUpdateSet({+ manifest: jsonbBind(input.manifest),+ updated_at: timestamp,+ }),+ )+ .returning(recordColumns)+ .executeTakeFirstOrThrow();+ }+}diff --git a/packages/server/src/db/sqlite/migrations/20260808_000001_skill.ts b/packages/server/src/db/sqlite/migrations/20260808_000001_skill.tsnew file mode 100644index 000000000..c089872e1--- /dev/null+++ b/packages/server/src/db/sqlite/migrations/20260808_000001_skill.ts@@ -0,0 +1,23 @@+import { sql, type Kysely } from 'kysely';++/**+ * Configured skills for SQLite (canonical DDL owner).+ * Mirrors the Postgres `skill` table: manifest is BLOB SQLite JSONB+ * (via jsonb(...)), timestamps are ISO-8601 TEXT.+ */+export async function up(db: Kysely<unknown>): Promise<void> {+ await sql`+ CREATE TABLE skill (+ tenant_id TEXT NOT NULL,+ name TEXT NOT NULL,+ manifest BLOB NOT NULL,+ created_at TEXT NOT NULL,+ updated_at TEXT NOT NULL,+ PRIMARY KEY (tenant_id, name)+ ) STRICT+ `.execute(db);+}++export async function down(db: Kysely<unknown>): Promise<void> {+ await sql`DROP TABLE IF EXISTS skill`.execute(db);+}diff --git a/packages/server/src/db/sqlite/skill-store/SqliteSkillStore.ts b/packages/server/src/db/sqlite/skill-store/SqliteSkillStore.tsnew file mode 100644index 000000000..3395122bd--- /dev/null+++ b/packages/server/src/db/sqlite/skill-store/SqliteSkillStore.ts@@ -0,0 +1,63 @@+import type { ExpressionBuilder, Kysely } from 'kysely';+import type { SkillManifest } from '../../../schemas/skill';+import { type GetSkillInput, type ISkillStore, type SkillRecord, type UpsertSkillInput } from '../../skillStore';+import { jsonbBind, jsonText, nowIso } from '../sqlExpressions';+import type { Database } from '../types';++/** Column list projecting the JSONB manifest as parsed JSON (see JSON_RESULT_COLUMNS). */+function recordColumns(eb: ExpressionBuilder<Database, 'skill'>) {+ return [+ 'tenant_id' as const,+ 'name' as const,+ jsonText<SkillManifest>(eb.ref('manifest')).as('manifest'),+ 'created_at' as const,+ 'updated_at' as const,+ ];+}++export class SqliteSkillStore implements ISkillStore {+ readonly #db: Kysely<Database>;++ constructor(db: Kysely<Database>) {+ this.#db = db;+ }++ async listSkills(tenantId: string): Promise<SkillRecord[]> {+ return await this.#db+ .selectFrom('skill')+ .select(recordColumns)+ .where('tenant_id', '=', tenantId)+ .orderBy('name')+ .execute();+ }++ async getSkill(input: GetSkillInput): Promise<SkillRecord | undefined> {+ return await this.#db+ .selectFrom('skill')+ .select(recordColumns)+ .where('tenant_id', '=', input.tenant_id)+ .where('name', '=', input.name)+ .executeTakeFirst();+ }++ async upsertSkill(input: UpsertSkillInput): Promise<SkillRecord> {+ const timestamp = nowIso();+ return await this.#db+ .insertInto('skill')+ .values({+ tenant_id: input.tenant_id,+ name: input.name,+ manifest: jsonbBind(input.manifest),+ created_at: timestamp,+ updated_at: timestamp,+ })+ .onConflict(oc =>+ oc.columns(['tenant_id', 'name']).doUpdateSet({+ manifest: jsonbBind(input.manifest),+ updated_at: timestamp,+ }),+ )+ .returning(recordColumns)+ .executeTakeFirstOrThrow();+ }+}diff --git a/packages/server/src/db/sqlite/types.ts b/packages/server/src/db/sqlite/types.tsindex 2f2018510..e9712c27a 100644--- a/packages/server/src/db/sqlite/types.ts+++ b/packages/server/src/db/sqlite/types.ts@@ -17,8 +17,9 @@ import type {} from '@truefoundry/utils/core';import type { CurrentContextUsage } from '@truefoundry/utils/core/runtime/contextUsage';import type { ColumnType, Generated, JSONColumnType } from 'kysely';-import type { McpServerManifest } from '../../legacy-registry-store/schemas';+import type { McpServerManifest } from '../../schemas/mcpServer';import type { ProviderManifest } from '../../schemas/modelProvider';+import type { SkillManifest } from '../../schemas/skill';import type { McpOAuthPendingAuthorizationData, McpOAuthToken, OAuthClient, OAuthServer } from '../mcpOAuthTypes';/**@@ -153,6 +154,20 @@ export interface ModelProviderTable {updated_at: string;}+/**+ * Configured skills — mirrors the Postgres `skill` table.+ * PRIMARY KEY (tenant_id, name)+ */+export interface SkillTable {+ tenant_id: string;+ /** key: natural key within tenant; also duplicated inside `manifest` */+ name: string;+ /** SkillManifest document; replaced whole on every upsert */+ manifest: JsonbColumn<SkillManifest>;+ created_at: string;+ updated_at: string;+}+/*** PRIMARY KEY (id)* UNIQUE (tenant_id, name) — the natural lookup key;@@ -161,7 +176,7 @@ export interface McpServerTable {/** application-generated (ulid); FK target, never re-derived from tenant_id/name */id: string;tenant_id: string;- /** the uniqueness target; also duplicated inside `manifest` (the full mcp.yaml entry) */+ /** the uniqueness target; also duplicated inside `manifest` */name: string;manifest: JsonbColumn<McpServerManifest>;/**@@ -210,6 +225,7 @@ export interface Database {thread_context_log: ThreadContextLogTable;thread_capability_state: ThreadCapabilityStateTable;model_provider: ModelProviderTable;+ skill: SkillTable;mcp_server: McpServerTable;oauth_token: OAuthTokenTable;oauth_pending_authorization: OAuthPendingAuthorizationTable;diff --git a/packages/server/src/main.ts b/packages/server/src/main.tsindex 0e387417c..d73860f01 100644--- a/packages/server/src/main.ts+++ b/packages/server/src/main.ts@@ -26,6 +26,10 @@ try {{ PostgresSessionStore },{ ModelCatalog },{ PostgresModelProviderStore },+ { McpCatalog },+ { PostgresMcpServerStore },+ { SkillCatalog },+ { PostgresSkillStore },] = await Promise.all([import('./app'),import('./frontend'),@@ -43,6 +47,10 @@ try {import('./db/postgres/session-store/PostgresSessionStore'),import('./catalog/ModelCatalog'),import('./db/postgres/model-provider-store/PostgresModelProviderStore'),+ import('./catalog/McpCatalog'),+ import('./db/postgres/mcp-server-store/PostgresMcpServerStore'),+ import('./catalog/SkillCatalog'),+ import('./db/postgres/skill-store/PostgresSkillStore'),]);// Console logger shared by the server runtime (harness components require one).@@ -57,7 +65,7 @@ try {const sessionStore = new PostgresSessionStore(db);// Throws on malformed SANDBOX_SETTINGS; undefined when sandbox is not configured.- const skillStore = SkillStore.load();+ const legacySkillStore = SkillStore.load();const sandboxFactory = createServerSandboxFactory({ logger });const activeTurns = new ActiveTurnRegistry();@@ -74,8 +82,12 @@ try {modelStore: ModelStore.load(),modelCatalog: ModelCatalog.load(),modelProviderStore: new PostgresModelProviderStore(db),+ mcpCatalog: McpCatalog.load(),+ mcpServerStore: new PostgresMcpServerStore(db),mcpStore: McpStore.load(),- skillStore,+ skillCatalog: SkillCatalog.load(),+ skillStore: new PostgresSkillStore(db),+ legacySkillStore,sessionStore,sessions: new Sessions({ sessionStore }),activeTurns,diff --git a/packages/server/src/routes/mcpServerRoutes.ts b/packages/server/src/routes/mcpServerRoutes.tsnew file mode 100644index 000000000..63ad76d5b--- /dev/null+++ b/packages/server/src/routes/mcpServerRoutes.ts@@ -0,0 +1,176 @@+/**+ * DB-backed MCP server route definitions.+ * Admin routes mount at /api/v1/settings/mcp-servers; the chat list mounts at+ * /api/v1/mcp-servers. Legacy YAML stays under /api/v1/legacy/mcp-servers.+ */+import { createRoute, z } from '@hono/zod-openapi';+import { RequestErrorResponseSchema } from '../schemas/errors';+import { GetMcpServerCatalogResponseSchema } from '../schemas/mcpCatalog';+import {+ ListAvailableMcpServersResponseSchema,+ ListConfiguredMcpServersResponseSchema,+ PutMcpServerRequestSchema,+ PutMcpServerResponseSchema,+} from '../schemas/mcpServer';++const MCP_SERVERS_TAG = 'MCP Servers';++export const getMcpServerCatalogRoute = createRoute({+ method: 'get',+ path: '/catalog',+ tags: [MCP_SERVERS_TAG],+ summary: 'Get the MCP catalog',+ description:+ 'MCP server presets shipped with the server (mcp-catalog.yaml). Discovery-only: copy an entry ' ++ 'into PUT /settings/mcp-servers to configure it.',+ 'x-fern-sdk-group-name': ['settings', 'mcpServers'],+ 'x-fern-sdk-method-name': 'catalog',+ responses: {+ 200: {+ content: { 'application/json': { schema: GetMcpServerCatalogResponseSchema } },+ description: 'The shipped catalog, verbatim.',+ },+ },+});++/** Chat/composer read view — mounted at /api/v1/mcp-servers (not under settings). */+export const listAvailableMcpServersRoute = createRoute({+ method: 'get',+ path: '/',+ tags: [MCP_SERVERS_TAG],+ summary: 'List MCP servers for chat',+ description: 'Configured MCP servers as a slim name/url list for the composer. No auth or auth_status.',+ 'x-fern-sdk-group-name': ['mcpServers'],+ 'x-fern-sdk-method-name': 'list',+ responses: {+ 200: {+ content: { 'application/json': { schema: ListAvailableMcpServersResponseSchema } },+ description: 'All configured MCP servers (chat projection).',+ },+ },+});++export const listConfiguredMcpServersRoute = createRoute({+ method: 'get',+ path: '/',+ tags: [MCP_SERVERS_TAG],+ summary: 'List configured MCP servers',+ description: 'All configured MCP servers with nested auth_status (settings / admin projection).',+ 'x-fern-sdk-group-name': ['settings', 'mcpServers'],+ 'x-fern-sdk-method-name': 'list',+ responses: {+ 200: {+ content: { 'application/json': { schema: ListConfiguredMcpServersResponseSchema } },+ description: 'All configured MCP servers.',+ },+ },+});++export const putMcpServerRoute = createRoute({+ method: 'put',+ path: '/',+ tags: [MCP_SERVERS_TAG],+ summary: 'Create or replace an MCP server',+ description:+ 'Full upsert keyed by `name`: creates the server or replaces its manifest. Does not start DCR or ' ++ 'modify stored oauth_server / oauth_client columns.',+ 'x-fern-sdk-group-name': ['settings', 'mcpServers'],+ 'x-fern-sdk-method-name': 'upsert',+ request: {+ body: {+ content: { 'application/json': { schema: PutMcpServerRequestSchema } },+ required: true,+ },+ },+ responses: {+ 200: {+ content: { 'application/json': { schema: PutMcpServerResponseSchema } },+ description: 'The saved MCP server with stub auth_status.',+ },+ 400: {+ content: { 'application/json': { schema: RequestErrorResponseSchema } },+ description: 'Invalid request body.',+ },+ },+});++const ListMcpServerToolsResponseSchema = z+ .object({+ data: z+ .array(z.record(z.unknown()))+ .describe('MCP `tools/list` entries, passed through verbatim from the MCP server.'),+ })+ .openapi('ListMcpServerToolsResponse');++const McpServerNameParamsSchema = z.object({+ name: z.string().min(1).describe('Configured MCP server name.'),+});++export const listMcpServerToolsRoute = createRoute({+ method: 'get',+ path: '/{name}/tools',+ tags: [MCP_SERVERS_TAG],+ summary: 'List tools of a configured MCP server',+ 'x-fern-sdk-group-name': ['settings', 'mcpServers'],+ 'x-fern-sdk-method-name': 'list_tools',+ description:+ 'All tools exposed by the given configured MCP server (non-paginated), as returned by the MCP `tools/list` call.',+ request: {+ params: McpServerNameParamsSchema,+ },+ responses: {+ 200: {+ content: { 'application/json': { schema: ListMcpServerToolsResponseSchema } },+ description: 'All tools of the MCP server.',+ },+ 401: {+ content: { 'application/json': { schema: RequestErrorResponseSchema } },+ description: 'The MCP server requires authentication.',+ },+ 404: {+ content: { 'application/json': { schema: RequestErrorResponseSchema } },+ description: 'MCP server not found.',+ },+ 502: {+ content: { 'application/json': { schema: RequestErrorResponseSchema } },+ description: 'The MCP server could not be reached or returned an error.',+ },+ },+});++const McpAuthorizeQuerySchema = z.object({+ redirect_url: z.string().url().describe('Where to send the browser after OAuth completes.'),+});++const ConfiguredMcpAuthorizeResponseSchema = z+ .object({+ status: z.enum(['authenticated', 'auth_required']),+ authorization_url: z.string().url().optional().describe('Present only when status is auth_required.'),+ })+ .openapi('ConfiguredMcpAuthorizeResponse');++export const authorizeConfiguredMcpServerRoute = createRoute({+ method: 'get',+ path: '/{name}/authorize',+ tags: [MCP_SERVERS_TAG],+ summary: 'Start (or short-circuit) the auth flow for a configured MCP server',+ 'x-fern-sdk-group-name': ['settings', 'mcpServers'],+ 'x-fern-sdk-method-name': 'authorize',+ description:+ 'Stub: returns authenticated when the server has no auth or header credentials on the row; ' ++ 'auth_required with a placeholder authorization URL when auth.type is dcr. Real DCR lands in a follow-up.',+ request: {+ params: McpServerNameParamsSchema,+ query: McpAuthorizeQuerySchema,+ },+ responses: {+ 200: {+ content: { 'application/json': { schema: ConfiguredMcpAuthorizeResponseSchema } },+ description: 'Either already authenticated, or an authorization URL to redirect to.',+ },+ 404: {+ content: { 'application/json': { schema: RequestErrorResponseSchema } },+ description: 'MCP server not found.',+ },+ },+});diff --git a/packages/server/src/routes/skillRoutes.ts b/packages/server/src/routes/skillRoutes.tsnew file mode 100644index 000000000..01dd63ba6--- /dev/null+++ b/packages/server/src/routes/skillRoutes.ts@@ -0,0 +1,93 @@+/**+ * DB-backed skill route definitions.+ * Admin routes mount at /api/v1/settings/skills; the chat list mounts at+ * /api/v1/skills. Legacy YAML stays under /api/v1/legacy/skills.+ */+import { createRoute } from '@hono/zod-openapi';+import { RequestErrorResponseSchema } from '../schemas/errors';+import {+ ListAvailableSkillsResponseSchema,+ ListConfiguredSkillsResponseSchema,+ PutSkillRequestSchema,+ PutSkillResponseSchema,+} from '../schemas/skill';+import { GetSkillCatalogResponseSchema } from '../schemas/skillCatalog';++const SKILLS_TAG = 'Skills';++export const getSkillCatalogRoute = createRoute({+ method: 'get',+ path: '/catalog',+ tags: [SKILLS_TAG],+ summary: 'Get the skill catalog',+ description:+ 'Skill presets shipped with the server (skill-catalog.yaml). Discovery-only: copy an entry ' ++ 'into PUT /settings/skills to configure it.',+ 'x-fern-sdk-group-name': ['settings', 'skills'],+ 'x-fern-sdk-method-name': 'catalog',+ responses: {+ 200: {+ content: { 'application/json': { schema: GetSkillCatalogResponseSchema } },+ description: 'The shipped catalog, verbatim.',+ },+ },+});++/** Chat/composer read view — mounted at /api/v1/skills (not under settings). */+export const listAvailableSkillsRoute = createRoute({+ method: 'get',+ path: '/',+ tags: [SKILLS_TAG],+ summary: 'List skills for chat',+ description: 'Configured skills as a slim name/description list for the composer.',+ 'x-fern-sdk-group-name': ['skills'],+ 'x-fern-sdk-method-name': 'list',+ responses: {+ 200: {+ content: { 'application/json': { schema: ListAvailableSkillsResponseSchema } },+ description: 'All configured skills (chat projection).',+ },+ },+});++export const listConfiguredSkillsRoute = createRoute({+ method: 'get',+ path: '/',+ tags: [SKILLS_TAG],+ summary: 'List configured skills',+ description: 'All configured skills with full manifests (settings / admin projection).',+ 'x-fern-sdk-group-name': ['settings', 'skills'],+ 'x-fern-sdk-method-name': 'list',+ responses: {+ 200: {+ content: { 'application/json': { schema: ListConfiguredSkillsResponseSchema } },+ description: 'All configured skills.',+ },+ },+});++export const putSkillRoute = createRoute({+ method: 'put',+ path: '/',+ tags: [SKILLS_TAG],+ summary: 'Create or replace a skill',+ description: 'Full upsert keyed by `name`: creates the skill or replaces its entire manifest.',+ 'x-fern-sdk-group-name': ['settings', 'skills'],+ 'x-fern-sdk-method-name': 'upsert',+ request: {+ body: {+ content: { 'application/json': { schema: PutSkillRequestSchema } },+ required: true,+ },+ },+ responses: {+ 200: {+ content: { 'application/json': { schema: PutSkillResponseSchema } },+ description: 'The saved skill.',+ },+ 400: {+ content: { 'application/json': { schema: RequestErrorResponseSchema } },+ description: 'Invalid request body.',+ },+ },+});diff --git a/packages/server/src/schemas/mcpCatalog.ts b/packages/server/src/schemas/mcpCatalog.tsnew file mode 100644index 000000000..f2320c338--- /dev/null+++ b/packages/server/src/schemas/mcpCatalog.ts@@ -0,0 +1,36 @@+/**+ * Shipped mcp-catalog.yaml schemas (discovery presets). Separate from+ * configured MCP server manifests in mcpServer.ts.+ */+import { z } from '@hono/zod-openapi';+import { NameSchema, uniqueNames } from './common';+import { McpServerAuthSettingsSchema, McpServerTypeSchema } from './mcpServer';++/** Catalog entry — discovery preset the settings UI copies into a PUT body. */+export const CatalogMcpServerSchema = z+ .object({+ type: McpServerTypeSchema,+ name: NameSchema,+ url: z.string().url().describe('URL of the remote MCP server.'),+ auth: McpServerAuthSettingsSchema.optional(),+ })+ .strict()+ .openapi('CatalogMcpServer');++export const McpCatalogFileSchema = z+ .object({+ mcp_servers: z.array(CatalogMcpServerSchema),+ })+ .strict()+ .superRefine((file, ctx) => {+ uniqueNames(file.mcp_servers, ctx);+ });++export const GetMcpServerCatalogResponseSchema = z+ .object({+ data: z.array(CatalogMcpServerSchema),+ })+ .openapi('GetMcpServerCatalogResponse');++export type CatalogMcpServer = z.infer<typeof CatalogMcpServerSchema>;+export type McpCatalogFile = z.infer<typeof McpCatalogFileSchema>;diff --git a/packages/server/src/schemas/mcpServer.ts b/packages/server/src/schemas/mcpServer.tsnew file mode 100644index 000000000..74107073b--- /dev/null+++ b/packages/server/src/schemas/mcpServer.ts@@ -0,0 +1,119 @@+/**+ * Configured MCP server domain + wire schemas: the `mcp_server.manifest` JSONB+ * document, admin/chat list projections, and auth_status. Catalog file schemas+ * live in mcpCatalog.ts.+ *+ * Auth mirrors gateway MCP header/DCR shapes in reduced form: `header` stores+ * shared request headers on the row; `dcr` is the OAuth/DCR stub until real+ * token exchange lands. Legacy YAML still uses MCP_HEADERS /+ * MCP_{NAME}_HEADERS env vars — not this schema.+ */+import { z } from '@hono/zod-openapi';+import { NameSchema } from './common';++/** Transport/kind of MCP server. Extend when non-remote kinds ship. */+export const McpServerTypeSchema = z.enum(['remote']).openapi('McpServerType');++const McpServerHeaderAuthSchema = z+ .object({+ type: z.literal('header'),+ headers: z+ .record(z.string().min(1), z.string().min(1))+ .refine(headers => Object.keys(headers).length > 0, {+ message: 'must include at least one header',+ })+ .describe('HTTP headers sent on each request to this MCP server.'),+ })+ .strict()+ .openapi('McpServerHeaderAuth');++/** OAuth Dynamic Client Registration — stub until authorize/token exchange is wired. */+const McpServerDcrAuthSchema = z+ .object({+ type: z.literal('dcr'),+ })+ .strict()+ .openapi('McpServerDcrAuth');++export const McpServerAuthSettingsSchema = z+ .discriminatedUnion('type', [McpServerHeaderAuthSchema, McpServerDcrAuthSchema])+ .openapi('ConfiguredMcpServerAuth');++/** Configured MCP server document persisted as `mcp_server.manifest`. */+export const McpServerManifestObjectSchema = z+ .object({+ type: McpServerTypeSchema,+ name: NameSchema,+ url: z.string().url().describe('URL of the remote MCP server.'),+ auth: McpServerAuthSettingsSchema.optional(),+ })+ .strict();++export const McpServerManifestSchema = McpServerManifestObjectSchema.openapi('McpServerManifest');++export const McpAuthStatusSchema = z+ .object({+ status: z.enum(['authenticated', 'auth_required']),+ authorization_url: z+ .string()+ .url()+ .optional()+ .describe('Present only when status is auth_required and a live authorize flow produced a URL.'),+ })+ .strict()+ .openapi('McpAuthStatus');++/** Admin/settings wire view: manifest fields plus nested auth_status. */+export const ConfiguredMcpServerSchema = McpServerManifestObjectSchema.extend({+ auth_status: McpAuthStatusSchema,+}).openapi('ConfiguredMcpServer');++export const PutMcpServerRequestSchema = McpServerManifestSchema;+export const PutMcpServerResponseSchema = z.object({ data: ConfiguredMcpServerSchema }).openapi('PutMcpServerResponse');+export const ListConfiguredMcpServersResponseSchema = z+ .object({ data: z.array(ConfiguredMcpServerSchema) })+ .openapi('ListConfiguredMcpServersResponse');++/** Chat/composer read view — no auth or auth_status. */+export const McpServerReadEntrySchema = z+ .object({+ name: NameSchema,+ url: z.string().url(),+ })+ .strict()+ .openapi('McpServerReadEntry');++export const ListAvailableMcpServersResponseSchema = z+ .object({ data: z.array(McpServerReadEntrySchema) })+ .openapi('ListAvailableMcpServersResponse');++export type McpServerType = z.infer<typeof McpServerTypeSchema>;+export type McpServerAuthSettings = z.infer<typeof McpServerAuthSettingsSchema>;+export type McpServerManifest = z.infer<typeof McpServerManifestSchema>;+export type McpAuthStatus = z.infer<typeof McpAuthStatusSchema>;+export type ConfiguredMcpServer = z.infer<typeof ConfiguredMcpServerSchema>;+export type McpServerReadEntry = z.infer<typeof McpServerReadEntrySchema>;++/**+ * Headers for live MCP calls against a configured server.+ * Only `auth.type === 'header'` contributes; DCR uses tokens later, not env+ * MCP_HEADERS (those remain on the legacy YAML path).+ */+export function resolveConfiguredMcpRequestHeaders(manifest: McpServerManifest): Record<string, string> {+ if (manifest.auth?.type === 'header') {+ return { ...manifest.auth.headers };+ }+ return {};+}++/**+ * Stub auth_status until OAuth/token store backs a real check.+ * Header credentials are already on the row → authenticated.+ * DCR still needs a user authorize flow → auth_required.+ */+export function toStubAuthStatus(manifest: McpServerManifest): McpAuthStatus {+ if (manifest.auth?.type === 'dcr') {+ return { status: 'auth_required' };+ }+ return { status: 'authenticated' };+}diff --git a/packages/server/src/schemas/modelCatalog.ts b/packages/server/src/schemas/modelCatalog.tsindex c0f8e3a7c..7ef58feb1 100644--- a/packages/server/src/schemas/modelCatalog.ts+++ b/packages/server/src/schemas/modelCatalog.ts@@ -18,7 +18,6 @@ export const CatalogProviderSchema = zexport const ModelCatalogFileSchema = z.object({- type: z.literal('model-catalog'),providers: z.array(CatalogProviderSchema),}).strict()diff --git a/packages/server/src/schemas/skill.ts b/packages/server/src/schemas/skill.tsnew file mode 100644index 000000000..60b9ba1a4--- /dev/null+++ b/packages/server/src/schemas/skill.ts@@ -0,0 +1,101 @@+/**+ * Configured skill domain + wire schemas: the `skill.manifest` JSONB document+ * and admin/chat list projections. Catalog file schemas live in skillCatalog.ts.+ *+ * Git field rules mirror harness SkillMount (GitHub/GitLab HTTPS url, path/ref+ * constraints) so settings documents stay mount-compatible. Identity uses+ * NameSchema like model providers / MCP servers. Legacy YAML SkillEntry stays+ * on legacy-registry-store — not this schema.+ */+import { z } from '@hono/zod-openapi';+import { NameSchema } from './common';++/** Kind of skill. Extend when non-git kinds ship. */+export const SkillTypeSchema = z.enum(['git']).openapi('SkillType');++// GitHub is exactly owner/repo; GitLab allows subgroups (group[/subgroup...]/project, ≥2 segments).+const GIT_URL_REGEX =+ /^https:\/\/(github\.com\/[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+|gitlab\.com\/[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)+)(\/|\.git)?$/;+const GIT_REF_REGEX = /^[A-Za-z0-9._\-/]+$/;+const SKILL_PATH_REGEX = /^[A-Za-z0-9._\-/]+$/;+const hasParentTraversal = (value: string): boolean => value.split('/').includes('..');++/** Shared with catalog presets — GitHub/GitLab HTTPS only. */+export const SkillGitUrlSchema = z+ .string()+ .trim()+ .min(1)+ .regex(GIT_URL_REGEX, 'Must be a GitHub or GitLab HTTPS URL')+ .refine(v => !hasParentTraversal(v), 'URL must not contain ".." segments')+ .describe('Full HTTPS URL of a GitHub or GitLab repository.');++/** Shared with catalog presets. Omit to use the repository root. */+export const SkillGitPathSchema = z+ .string()+ .trim()+ .min(1)+ .regex(SKILL_PATH_REGEX, 'Path may only contain letters, numbers, ".", "_", "-", and "/"')+ .refine(v => !hasParentTraversal(v), 'Path must not contain ".." segments')+ .refine(v => !v.split('/').includes('.'), 'Path must not contain "." segments')+ .refine(v => v.replace(/^\/+|\/+$/g, '').length > 0, 'Path must reference a subdirectory, not only slashes')+ .describe('Path to the skill directory within the repository. Omit to use the repository root.');++/**+ * Shared with catalog presets. Optional on configured/catalog rows; composer+ * defaults omitted refs to HEAD when building a SkillMount.+ */+export const SkillGitRefSchema = z+ .string()+ .trim()+ .min(1)+ .regex(GIT_REF_REGEX, 'Ref may only contain letters, numbers, ".", "_", "-", and "/"')+ .refine(v => !hasParentTraversal(v), 'Ref must not contain ".." segments')+ .refine(v => v.replace(/^\/+|\/+$/g, '').length > 0, 'Ref must not consist only of slashes')+ .describe('Git ref — branch name, tag, or commit SHA.');++export const SkillDescriptionSchema = z+ .string()+ .trim()+ .min(1)+ .describe('Concise guidance for when the agent should use the skill.');++/** Configured skill document persisted as `skill.manifest`. */+export const SkillManifestObjectSchema = z+ .object({+ type: SkillTypeSchema,+ name: NameSchema,+ url: SkillGitUrlSchema,+ path: SkillGitPathSchema.optional(),+ ref: SkillGitRefSchema.optional(),+ description: SkillDescriptionSchema,+ })+ .strict();++export const SkillManifestSchema = SkillManifestObjectSchema.openapi('SkillManifest');++/** Admin/settings wire view — same fields as the stored manifest (no auth_status). */+export const ConfiguredSkillSchema = SkillManifestSchema;++export const PutSkillRequestSchema = SkillManifestSchema;+export const PutSkillResponseSchema = z.object({ data: ConfiguredSkillSchema }).openapi('PutSkillResponse');+export const ListConfiguredSkillsResponseSchema = z+ .object({ data: z.array(ConfiguredSkillSchema) })+ .openapi('ListConfiguredSkillsResponse');++/** Chat/composer read view — discovery fields only. */+export const SkillReadEntrySchema = z+ .object({+ name: NameSchema,+ description: SkillDescriptionSchema,+ })+ .strict()+ .openapi('SkillReadEntry');++export const ListAvailableSkillsResponseSchema = z+ .object({ data: z.array(SkillReadEntrySchema) })+ .openapi('ListAvailableSkillsResponse');++export type SkillType = z.infer<typeof SkillTypeSchema>;+export type SkillManifest = z.infer<typeof SkillManifestSchema>;+export type ConfiguredSkill = z.infer<typeof ConfiguredSkillSchema>;+export type SkillReadEntry = z.infer<typeof SkillReadEntrySchema>;diff --git a/packages/server/src/schemas/skillCatalog.ts b/packages/server/src/schemas/skillCatalog.tsnew file mode 100644index 000000000..24ac12363--- /dev/null+++ b/packages/server/src/schemas/skillCatalog.ts@@ -0,0 +1,44 @@+/**+ * Shipped skill-catalog.yaml schemas (discovery presets). Separate from+ * configured skill manifests in skill.ts.+ */+import { z } from '@hono/zod-openapi';+import { NameSchema, uniqueNames } from './common';+import {+ SkillDescriptionSchema,+ SkillGitPathSchema,+ SkillGitRefSchema,+ SkillGitUrlSchema,+ SkillTypeSchema,+} from './skill';++/** Catalog entry — discovery preset the settings UI copies into a PUT body. */+export const CatalogSkillSchema = z+ .object({+ type: SkillTypeSchema,+ name: NameSchema,+ url: SkillGitUrlSchema,+ path: SkillGitPathSchema.optional(),+ ref: SkillGitRefSchema.optional(),+ description: SkillDescriptionSchema,+ })+ .strict()+ .openapi('CatalogSkill');++export const SkillCatalogFileSchema = z+ .object({+ skills: z.array(CatalogSkillSchema),+ })+ .strict()+ .superRefine((file, ctx) => {+ uniqueNames(file.skills, ctx);+ });++export const GetSkillCatalogResponseSchema = z+ .object({+ data: z.array(CatalogSkillSchema),+ })+ .openapi('GetSkillCatalogResponse');++export type CatalogSkill = z.infer<typeof CatalogSkillSchema>;+export type SkillCatalogFile = z.infer<typeof SkillCatalogFileSchema>;diff --git a/packages/server/tests/db/mcpServerStoreContractSuite.ts b/packages/server/tests/db/mcpServerStoreContractSuite.tsnew file mode 100644index 000000000..ba4ac00d7--- /dev/null+++ b/packages/server/tests/db/mcpServerStoreContractSuite.ts@@ -0,0 +1,88 @@+/**+ * Backend-agnostic behavioural contract for IMcpServerStore.+ * Runs under jest against a fresh store per test (see backend test files).+ */+import type { IMcpServerStore } from '../../src/db/mcpServerStore';+import type { McpServerManifest } from '../../src/schemas/mcpServer';++const TENANT = 'default';++function manifest(overrides: Partial<McpServerManifest> = {}): McpServerManifest {+ return {+ type: 'remote',+ name: 'linear',+ url: 'https://mcp.linear.app/mcp',+ auth: { type: 'dcr' },+ ...overrides,+ };+}++const ISO_UTC = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;++export function runMcpServerStoreContractSuite(getStore: () => IMcpServerStore): void {+ it('upsert creates a server and round-trips the manifest', async () => {+ const store = getStore();+ const created = await store.upsertServer({+ tenant_id: TENANT,+ name: 'linear',+ manifest: manifest(),+ });++ expect(created.tenant_id).toBe(TENANT);+ expect(created.name).toBe('linear');+ expect(created.id.length).toBeGreaterThan(0);+ expect(created.manifest).toEqual(manifest());+ expect(created.created_at).toMatch(ISO_UTC);+ expect(created.updated_at).toBe(created.created_at);++ const fetched = await store.getServer({ tenant_id: TENANT, name: 'linear' });+ expect(fetched).toEqual(created);+ });++ it('getServer returns undefined for unknown servers', async () => {+ const store = getStore();+ expect(await store.getServer({ tenant_id: TENANT, name: 'missing' })).toBeUndefined();+ });++ it('upsert replaces the manifest, preserves id and created_at', async () => {+ const store = getStore();+ const created = await store.upsertServer({+ tenant_id: TENANT,+ name: 'linear',+ manifest: manifest(),+ });++ const replacement = manifest({+ name: 'linear',+ url: 'https://mcp.linear.app/mcp/v2',+ });+ const updated = await store.upsertServer({+ tenant_id: TENANT,+ name: 'linear',+ manifest: replacement,+ });++ expect(updated.id).toBe(created.id);+ expect(updated.manifest).toEqual(replacement);+ expect(updated.created_at).toBe(created.created_at);+ expect(Date.parse(updated.updated_at)).toBeGreaterThanOrEqual(Date.parse(created.updated_at));++ const servers = await store.listServers(TENANT);+ expect(servers).toEqual([updated]);+ });++ it('listServers returns only the tenant, ordered by name', async () => {+ const store = getStore();+ await store.upsertServer({ tenant_id: TENANT, name: 'linear', manifest: manifest() });+ await store.upsertServer({+ tenant_id: TENANT,+ name: 'deepwiki',+ manifest: manifest({ name: 'deepwiki', url: 'https://mcp.deepwiki.com/mcp' }),+ });+ await store.upsertServer({ tenant_id: 'other-tenant', name: 'linear', manifest: manifest() });++ const servers = await store.listServers(TENANT);+ expect(servers.map(server => server.name)).toEqual(['deepwiki', 'linear']);+ expect(servers.every(server => server.tenant_id === TENANT)).toBe(true);+ });+}diff --git a/packages/server/tests/db/postgres/mcp-server-store/contract.test.ts b/packages/server/tests/db/postgres/mcp-server-store/contract.test.tsnew file mode 100644index 000000000..f7006fa17--- /dev/null+++ b/packages/server/tests/db/postgres/mcp-server-store/contract.test.ts@@ -0,0 +1,35 @@+import { sql } from 'kysely';++import { PostgresMcpServerStore } from '../../../../src/db/postgres/mcp-server-store/PostgresMcpServerStore';+import { runMcpServerStoreContractSuite } from '../../mcpServerStoreContractSuite';+import { createPostgresTestDatabase, type PostgresTestDatabase } from '../testDatabase';++const describePg = process.env['PG_STORE_TESTS_ENABLED'] === '1' ? describe : describe.skip;++describePg('PostgresMcpServerStore (IMcpServerStore contract)', () => {+ let env: PostgresTestDatabase | undefined;++ beforeAll(async () => {+ env = await createPostgresTestDatabase();+ if (env === undefined) {+ throw new Error('Postgres test environment unavailable despite globalSetup probe');+ }+ }, 120_000);++ afterAll(async () => {+ await env?.teardown();+ });++ beforeEach(async () => {+ if (env !== undefined) {+ await sql`TRUNCATE TABLE mcp_server CASCADE`.execute(env.db);+ }+ });++ runMcpServerStoreContractSuite(() => {+ if (env === undefined) {+ throw new Error('Postgres test environment not initialized');+ }+ return new PostgresMcpServerStore(env.db);+ });+});diff --git a/packages/server/tests/db/postgres/skill-store/contract.test.ts b/packages/server/tests/db/postgres/skill-store/contract.test.tsnew file mode 100644index 000000000..546087787--- /dev/null+++ b/packages/server/tests/db/postgres/skill-store/contract.test.ts@@ -0,0 +1,35 @@+import { sql } from 'kysely';++import { PostgresSkillStore } from '../../../../src/db/postgres/skill-store/PostgresSkillStore';+import { runSkillStoreContractSuite } from '../../skillStoreContractSuite';+import { createPostgresTestDatabase, type PostgresTestDatabase } from '../testDatabase';++const describePg = process.env['PG_STORE_TESTS_ENABLED'] === '1' ? describe : describe.skip;++describePg('PostgresSkillStore (ISkillStore contract)', () => {+ let env: PostgresTestDatabase | undefined;++ beforeAll(async () => {+ env = await createPostgresTestDatabase();+ if (env === undefined) {+ throw new Error('Postgres test environment unavailable despite globalSetup probe');+ }+ }, 120_000);++ afterAll(async () => {+ await env?.teardown();+ });++ beforeEach(async () => {+ if (env !== undefined) {+ await sql`TRUNCATE TABLE skill`.execute(env.db);+ }+ });++ runSkillStoreContractSuite(() => {+ if (env === undefined) {+ throw new Error('Postgres test environment not initialized');+ }+ return new PostgresSkillStore(env.db);+ });+});diff --git a/packages/server/tests/db/skillStoreContractSuite.ts b/packages/server/tests/db/skillStoreContractSuite.tsnew file mode 100644index 000000000..fd3821313--- /dev/null+++ b/packages/server/tests/db/skillStoreContractSuite.ts@@ -0,0 +1,96 @@+/**+ * Backend-agnostic behavioural contract for ISkillStore.+ * Runs under jest against a fresh store per test (see backend test files).+ */+import type { ISkillStore } from '../../src/db/skillStore';+import type { SkillManifest } from '../../src/schemas/skill';++const TENANT = 'default';++function manifest(overrides: Partial<SkillManifest> = {}): SkillManifest {+ return {+ type: 'git',+ name: 'algorithmic-art',+ url: 'https://github.com/anthropics/skills',+ path: 'skills/algorithmic-art',+ ref: 'main',+ description: 'Creating algorithmic art using p5.js with seeded randomness.',+ ...overrides,+ };+}++const ISO_UTC = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;++export function runSkillStoreContractSuite(getStore: () => ISkillStore): void {+ it('upsert creates a skill and round-trips the manifest', async () => {+ const store = getStore();+ const created = await store.upsertSkill({+ tenant_id: TENANT,+ name: 'algorithmic-art',+ manifest: manifest(),+ });++ expect(created.tenant_id).toBe(TENANT);+ expect(created.name).toBe('algorithmic-art');+ expect(created.manifest).toEqual(manifest());+ expect(created.created_at).toMatch(ISO_UTC);+ expect(created.updated_at).toBe(created.created_at);++ const fetched = await store.getSkill({ tenant_id: TENANT, name: 'algorithmic-art' });+ expect(fetched).toEqual(created);+ });++ it('getSkill returns undefined for unknown skills', async () => {+ const store = getStore();+ expect(await store.getSkill({ tenant_id: TENANT, name: 'missing' })).toBeUndefined();+ });++ it('upsert replaces the whole manifest and preserves created_at', async () => {+ const store = getStore();+ const created = await store.upsertSkill({+ tenant_id: TENANT,+ name: 'algorithmic-art',+ manifest: manifest(),+ });++ const replacement = manifest({+ description: 'Updated description for algorithmic art.',+ ref: 'v2',+ });+ const updated = await store.upsertSkill({+ tenant_id: TENANT,+ name: 'algorithmic-art',+ manifest: replacement,+ });++ expect(updated.manifest).toEqual(replacement);+ expect(updated.created_at).toBe(created.created_at);+ expect(Date.parse(updated.updated_at)).toBeGreaterThanOrEqual(Date.parse(created.updated_at));++ const skills = await store.listSkills(TENANT);+ expect(skills).toEqual([updated]);+ });++ it('listSkills returns only the tenant, ordered by name', async () => {+ const store = getStore();+ await store.upsertSkill({+ tenant_id: TENANT,+ name: 'web-artifacts',+ manifest: manifest({+ name: 'web-artifacts',+ path: 'skills/web-artifacts-builder',+ description: 'Build web artifacts.',+ }),+ });+ await store.upsertSkill({ tenant_id: TENANT, name: 'algorithmic-art', manifest: manifest() });+ await store.upsertSkill({+ tenant_id: 'other-tenant',+ name: 'algorithmic-art',+ manifest: manifest(),+ });++ const skills = await store.listSkills(TENANT);+ expect(skills.map(skill => skill.name)).toEqual(['algorithmic-art', 'web-artifacts']);+ expect(skills.every(skill => skill.tenant_id === TENANT)).toBe(true);+ });+}diff --git a/packages/server/tests/db/sqlite/mcp-server-store/contract.test.ts b/packages/server/tests/db/sqlite/mcp-server-store/contract.test.tsnew file mode 100644index 000000000..71e81534e--- /dev/null+++ b/packages/server/tests/db/sqlite/mcp-server-store/contract.test.ts@@ -0,0 +1,17 @@+import { SqliteMcpServerStore } from '../../../../src/db/sqlite/mcp-server-store/SqliteMcpServerStore';+import { runMcpServerStoreContractSuite } from '../../mcpServerStoreContractSuite';+import { createSqliteTestDatabase, type SqliteTestDatabase } from '../testDatabase';++describe('SqliteMcpServerStore (IMcpServerStore contract)', () => {+ let env: SqliteTestDatabase;++ beforeEach(async () => {+ env = await createSqliteTestDatabase();+ }, 120_000);++ afterEach(async () => {+ await env?.teardown();+ });++ runMcpServerStoreContractSuite(() => new SqliteMcpServerStore(env.db));+});diff --git a/packages/server/tests/db/sqlite/skill-store/contract.test.ts b/packages/server/tests/db/sqlite/skill-store/contract.test.tsnew file mode 100644index 000000000..5b2d949fb--- /dev/null+++ b/packages/server/tests/db/sqlite/skill-store/contract.test.ts@@ -0,0 +1,17 @@+import { SqliteSkillStore } from '../../../../src/db/sqlite/skill-store/SqliteSkillStore';+import { runSkillStoreContractSuite } from '../../skillStoreContractSuite';+import { createSqliteTestDatabase, type SqliteTestDatabase } from '../testDatabase';++describe('SqliteSkillStore (ISkillStore contract)', () => {+ let env: SqliteTestDatabase;++ beforeEach(async () => {+ env = await createSqliteTestDatabase();+ }, 120_000);++ afterEach(async () => {+ await env?.teardown();+ });++ runSkillStoreContractSuite(() => new SqliteSkillStore(env.db));+});diff --git a/packages/server/tests/unit/apis/mcpServers.test.ts b/packages/server/tests/unit/apis/mcpServers.test.tsnew file mode 100644index 000000000..6766e220f--- /dev/null+++ b/packages/server/tests/unit/apis/mcpServers.test.ts@@ -0,0 +1,141 @@+import winston from 'winston';+import { createAvailableMcpServersRouter, createMcpServersRouter } from '../../../src/apis/mcpServers';+import { McpCatalog } from '../../../src/catalog/McpCatalog';+import { migrateSqliteToLatest } from '../../../src/db/migrateSqlite';+import { createSqliteDb } from '../../../src/db/sqlite/client';+import { SqliteMcpServerStore } from '../../../src/db/sqlite/mcp-server-store/SqliteMcpServerStore';++const putBody = {+ type: 'remote' as const,+ name: 'deepwiki',+ url: 'https://mcp.deepwiki.com/mcp',+};++const putBodyWithDcr = {+ type: 'remote' as const,+ name: 'linear',+ url: 'https://mcp.linear.app/mcp',+ auth: { type: 'dcr' as const },+};++const putBodyWithHeaderAuth = {+ type: 'remote' as const,+ name: 'private-mcp',+ url: 'https://mcp.example.com/mcp',+ auth: {+ type: 'header' as const,+ headers: { Authorization: 'Bearer test-token' },+ },+};++function putInit(body: unknown): RequestInit {+ return {+ method: 'PUT',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify(body),+ };+}++describe('mcp-servers routers', () => {+ let settingsRouter: ReturnType<typeof createMcpServersRouter>;+ let availableRouter: ReturnType<typeof createAvailableMcpServersRouter>;++ beforeAll(async () => {+ const db = createSqliteDb(':memory:');+ await migrateSqliteToLatest(db);+ const mcpServerStore = new SqliteMcpServerStore(db);+ settingsRouter = createMcpServersRouter({+ mcpCatalog: McpCatalog.load(),+ mcpServerStore,+ logger: winston.createLogger({ silent: true }),+ });+ availableRouter = createAvailableMcpServersRouter(mcpServerStore);+ });++ it('GET /catalog returns the shipped catalog verbatim', async () => {+ const response = await settingsRouter.request('/catalog');+ expect(response.status).toBe(200);+ const body = (await response.json()) as { data: { name: string }[] };+ expect(body.data.map(server => server.name)).toEqual(+ McpCatalog.load()+ .list()+ .map(server => server.name),+ );+ });++ it('PUT upserts a server and returns stub auth_status', async () => {+ const response = await settingsRouter.request('/', putInit(putBody));+ expect(response.status).toBe(200);+ expect(await response.json()).toEqual({+ data: { ...putBody, auth_status: { status: 'authenticated' } },+ });++ const list = await settingsRouter.request('/');+ expect(list.status).toBe(200);+ expect(await list.json()).toEqual({+ data: [{ ...putBody, auth_status: { status: 'authenticated' } }],+ });+ });++ it('PUT with DCR auth stubs auth_required without authorization_url', async () => {+ const response = await settingsRouter.request('/', putInit(putBodyWithDcr));+ expect(response.status).toBe(200);+ expect(await response.json()).toEqual({+ data: { ...putBodyWithDcr, auth_status: { status: 'auth_required' } },+ });+ });++ it('PUT with header auth stores headers and reports authenticated', async () => {+ const response = await settingsRouter.request('/', putInit(putBodyWithHeaderAuth));+ expect(response.status).toBe(200);+ expect(await response.json()).toEqual({+ data: { ...putBodyWithHeaderAuth, auth_status: { status: 'authenticated' } },+ });+ });++ it('GET / on the chat router returns the slim projection without auth fields', async () => {+ const response = await availableRouter.request('/');+ expect(response.status).toBe(200);+ const body = (await response.json()) as { data: { name: string; url: string }[] };+ expect(body.data.map(server => server.name).sort()).toEqual(['deepwiki', 'linear', 'private-mcp']);+ expect(body.data.every(server => Object.keys(server).sort().join(',') === 'name,url')).toBe(true);+ });++ it('PUT rejects invalid bodies at the Zod layer', async () => {+ const { url: _, ...withoutUrl } = putBody;+ const missingUrl = await settingsRouter.request('/', putInit(withoutUrl));+ expect(missingUrl.status).toBe(400);++ const badName = await settingsRouter.request('/', putInit({ ...putBody, name: 'Not A Slug' }));+ expect(badName.status).toBe(400);++ const emptyHeaders = await settingsRouter.request(+ '/',+ putInit({+ ...putBodyWithHeaderAuth,+ name: 'bad-empty-headers',+ auth: { type: 'header', headers: {} },+ }),+ );+ expect(emptyHeaders.status).toBe(400);+ });++ it('GET /{name}/authorize stubs auth for configured servers', async () => {+ const authenticated = await settingsRouter.request('/deepwiki/authorize?redirect_url=https://example.com/callback');+ expect(authenticated.status).toBe(200);+ expect(await authenticated.json()).toEqual({ status: 'authenticated' });++ const headerAuth = await settingsRouter.request('/private-mcp/authorize?redirect_url=https://example.com/callback');+ expect(headerAuth.status).toBe(200);+ expect(await headerAuth.json()).toEqual({ status: 'authenticated' });++ const required = await settingsRouter.request('/linear/authorize?redirect_url=https://example.com/callback');+ expect(required.status).toBe(200);+ const body = (await required.json()) as { status: string; authorization_url?: string };+ expect(body.status).toBe('auth_required');+ expect(body.authorization_url?.includes('redirect_uri=')).toBe(true);++ const missing = await settingsRouter.request('/missing/authorize?redirect_url=https://example.com/callback');+ expect(missing.status).toBe(404);+ });+});diff --git a/packages/server/tests/unit/apis/modelProviders.test.ts b/packages/server/tests/unit/apis/modelProviders.test.tsindex bd611f905..1e94f0d1c 100644--- a/packages/server/tests/unit/apis/modelProviders.test.ts+++ b/packages/server/tests/unit/apis/modelProviders.test.ts@@ -1,9 +1,14 @@+import winston from 'winston';import { createModelsRouter } from '../../../src/apis/models';import { createSettingsRouter } from '../../../src/apis/settings';+import { McpCatalog } from '../../../src/catalog/McpCatalog';import { ModelCatalog } from '../../../src/catalog/ModelCatalog';+import { SkillCatalog } from '../../../src/catalog/SkillCatalog';import { migrateSqliteToLatest } from '../../../src/db/migrateSqlite';import { createSqliteDb } from '../../../src/db/sqlite/client';+import { SqliteMcpServerStore } from '../../../src/db/sqlite/mcp-server-store/SqliteMcpServerStore';import { SqliteModelProviderStore } from '../../../src/db/sqlite/model-provider-store/SqliteModelProviderStore';+import { SqliteSkillStore } from '../../../src/db/sqlite/skill-store/SqliteSkillStore';const putBody = {type: 'anthropic',@@ -35,7 +40,15 @@ describe('settings model-providers and models routers', () => {const db = createSqliteDb(':memory:');await migrateSqliteToLatest(db);const modelProviderStore = new SqliteModelProviderStore(db);- settingsRouter = createSettingsRouter({ modelCatalog: ModelCatalog.load(), modelProviderStore });+ settingsRouter = createSettingsRouter({+ modelCatalog: ModelCatalog.load(),+ modelProviderStore,+ mcpCatalog: McpCatalog.load(),+ mcpServerStore: new SqliteMcpServerStore(db),+ skillCatalog: SkillCatalog.load(),+ skillStore: new SqliteSkillStore(db),+ logger: winston.createLogger({ silent: true }),+ });modelsRouter = createModelsRouter(modelProviderStore);});diff --git a/packages/server/tests/unit/apis/skills.test.ts b/packages/server/tests/unit/apis/skills.test.tsnew file mode 100644index 000000000..459d56eb1--- /dev/null+++ b/packages/server/tests/unit/apis/skills.test.ts@@ -0,0 +1,82 @@+import { createAvailableSkillsRouter, createSkillsRouter } from '../../../src/apis/skills';+import { SkillCatalog } from '../../../src/catalog/SkillCatalog';+import { migrateSqliteToLatest } from '../../../src/db/migrateSqlite';+import { createSqliteDb } from '../../../src/db/sqlite/client';+import { SqliteSkillStore } from '../../../src/db/sqlite/skill-store/SqliteSkillStore';++const putBody = {+ type: 'git' as const,+ name: 'algorithmic-art',+ url: 'https://github.com/anthropics/skills',+ path: 'skills/algorithmic-art',+ ref: 'main',+ description: 'Creating algorithmic art using p5.js with seeded randomness.',+};++function putInit(body: unknown): RequestInit {+ return {+ method: 'PUT',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify(body),+ };+}++describe('skills routers', () => {+ let settingsRouter: ReturnType<typeof createSkillsRouter>;+ let availableRouter: ReturnType<typeof createAvailableSkillsRouter>;++ beforeAll(async () => {+ const db = createSqliteDb(':memory:');+ await migrateSqliteToLatest(db);+ const skillStore = new SqliteSkillStore(db);+ settingsRouter = createSkillsRouter({+ skillCatalog: SkillCatalog.load(),+ skillStore,+ });+ availableRouter = createAvailableSkillsRouter(skillStore);+ });++ it('GET /catalog returns the shipped catalog verbatim', async () => {+ const response = await settingsRouter.request('/catalog');+ expect(response.status).toBe(200);+ const body = (await response.json()) as { data: { name: string }[] };+ expect(body.data.map(skill => skill.name)).toEqual(+ SkillCatalog.load()+ .list()+ .map(skill => skill.name),+ );+ });++ it('PUT upserts a skill and echoes the stored manifest', async () => {+ const response = await settingsRouter.request('/', putInit(putBody));+ expect(response.status).toBe(200);+ expect(await response.json()).toEqual({ data: putBody });++ const list = await settingsRouter.request('/');+ expect(list.status).toBe(200);+ expect(await list.json()).toEqual({ data: [putBody] });+ });++ it('GET / on the chat router returns the slim name/description projection', async () => {+ const response = await availableRouter.request('/');+ expect(response.status).toBe(200);+ expect(await response.json()).toEqual({+ data: [{ name: putBody.name, description: putBody.description }],+ });+ });++ it('PUT rejects invalid bodies at the Zod layer', async () => {+ const { url: _, ...withoutUrl } = putBody;+ const missingUrl = await settingsRouter.request('/', putInit(withoutUrl));+ expect(missingUrl.status).toBe(400);++ const badName = await settingsRouter.request('/', putInit({ ...putBody, name: 'Not A Slug' }));+ expect(badName.status).toBe(400);++ const badUrl = await settingsRouter.request(+ '/',+ putInit({ ...putBody, name: 'bad-url', url: 'https://example.com/repo' }),+ );+ expect(badUrl.status).toBe(400);+ });+});