@inferencesh/sdk 0.26.1 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +5 -4
- package/dist/api/write-bodies.d.ts +8 -7
- package/dist/tool-builder.d.ts +22 -6
- package/dist/tool-builder.js +22 -7
- package/dist/types.d.ts +34 -10
- package/dist/types.js +0 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
Added: `mcpTool(name, { server, toolName, credentialId? })` names the MCP server by its slug (the API's model: a server declares the provider it signs in through); `credentialId` pins one connection. The old `mcpTool(name, credentialId, toolName)` still works (deprecated): the API saves such a tool with the server the connection's provider is declared by. `MCPServerUpdateBody` gains `credentials`; its `auth_type`, `oauth_client_id` and `oauth_secret_key` are no longer read by the API (the provider's OAuth app is set through `PUT /credentials/{slug}/app`). Generated types: `MCPToolConfig.server`; `MCPServerDTO.oauth_client_id`, `CredentialProviderMCP` and `CredentialTypeMCP` are gone from the API.
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Generated types follow the API: `MCPToolConfig` is `{ server, tool_name, credential_id? }`; `MCPServerDTO` loses `oauth_client_id`; `CredentialProviderMCP` and `CredentialTypeMCP` are gone (a credential of an MCP provider has type `oauth` or `api_key` and the provider slug the server declares in `credential_slug`).
|
|
15
|
+
|
|
10
16
|
## [0.26.1] - 2026-10-12
|
|
11
17
|
|
|
12
18
|
### Added
|
package/README.md
CHANGED
|
@@ -377,7 +377,7 @@ Use the fluent builders to define `AgentTool` schemas. Client tools (`tool`) run
|
|
|
377
377
|
| `agentTool(name, agentRef)` | Server | Delegate to a sub-agent |
|
|
378
378
|
| `httpTool(name, url)` / `callTool(name, url)` | Server | HTTP request with credential injection (preferred over `webhookTool`) |
|
|
379
379
|
| `webhookTool(name, url)` | Server | Unsigned webhook (legacy; use `httpTool` for new tools) |
|
|
380
|
-
| `mcpTool(name,
|
|
380
|
+
| `mcpTool(name, { server, toolName, credentialId? })` | Server | Call a tool on an MCP server (by slug), signed in through the server's provider; `credentialId` pins one connection. `mcpTool(name, credentialId, toolName)` still works and is saved with the connection's server |
|
|
381
381
|
| `internalTools()` | Server | Built-in tools: plan, memory, widget, finish, skills, meta, remote, knowledge, artifact, agent |
|
|
382
382
|
|
|
383
383
|
```typescript
|
|
@@ -420,7 +420,8 @@ const imageGen = appTool('generate_image', 'infsh/flux-schnell@abc123')
|
|
|
420
420
|
.requireApproval()
|
|
421
421
|
.build();
|
|
422
422
|
|
|
423
|
-
|
|
423
|
+
// MCP server by slug; the runner's connection to its provider signs the call
|
|
424
|
+
const mcpSearch = mcpTool('notion_search', { server: 'notion', toolName: 'search' })
|
|
424
425
|
.describe('Search Notion pages')
|
|
425
426
|
.param('query', string('Search query'))
|
|
426
427
|
.build();
|
|
@@ -689,8 +690,8 @@ try {
|
|
|
689
690
|
|
|
690
691
|
| Constant group | Values |
|
|
691
692
|
|----------------|--------|
|
|
692
|
-
| `CredentialProvider*` | `google`, `slack`, `notion`, `github`, `x`, `microsoft`, `salesforce`, `discord`, `gcp`, `
|
|
693
|
-
| `CredentialType*` | `service_account`, `oauth`, `api_key`, `wif
|
|
693
|
+
| `CredentialProvider*` | `google`, `google-sa`, `slack`, `notion`, `github`, `x`, `microsoft`, `salesforce`, `discord`, `gcp`, `reddit` |
|
|
694
|
+
| `CredentialType*` | `service_account`, `oauth`, `api_key`, `wif` |
|
|
694
695
|
| `CredentialStatus*` | `connected`, `disconnected`, `expired`, `error` |
|
|
695
696
|
|
|
696
697
|
## Instance Status Constants
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* chats, engines and teams send PATCH; apps.patch and flows.patch are the
|
|
13
13
|
* partial siblings of the POST updates that also edit a version.
|
|
14
14
|
*/
|
|
15
|
-
import type { AgentConfigInput, AgentImages, AppDTO, ChatDTO, EngineDTO, FlowDTO, FlowVersionDTO, KnowledgeDTO,
|
|
15
|
+
import type { AgentConfigInput, AgentImages, AppDTO, ChatDTO, CredentialRequirements, EngineDTO, FlowDTO, FlowVersionDTO, KnowledgeDTO, ProjectDTO, TeamDTO, Visibility } from '../types.js';
|
|
16
16
|
/**
|
|
17
17
|
* POST /agents/{id}. Visibility and images, and a new version when
|
|
18
18
|
* `version` is set. Name, title, harness, placement: set at creation.
|
|
@@ -88,9 +88,12 @@ export type TeamUpdateBody = Partial<Pick<TeamDTO, 'name' | 'email' | 'avatar_ur
|
|
|
88
88
|
/**
|
|
89
89
|
* PUT /mcp-servers/{id}. A field left out keeps its value. Title,
|
|
90
90
|
* description, icon URL and documentation URL take what is sent, and ""
|
|
91
|
-
* clears them; slug, name
|
|
92
|
-
*
|
|
93
|
-
*
|
|
91
|
+
* clears them; slug, name and server URL change only to a non-empty value.
|
|
92
|
+
* Headers sent replace the set ({} clears it); default scopes sent replace
|
|
93
|
+
* the list; `credentials` sent replace the declaration of the provider the
|
|
94
|
+
* server signs in through ([] clears it). Auth type is the server's own
|
|
95
|
+
* report. The provider's OAuth app: `PUT /credentials/{slug}/app`.
|
|
96
|
+
* Visibility: `POST /mcp-servers/{id}/visibility`.
|
|
94
97
|
*/
|
|
95
98
|
export interface MCPServerUpdateBody {
|
|
96
99
|
slug?: string;
|
|
@@ -99,12 +102,10 @@ export interface MCPServerUpdateBody {
|
|
|
99
102
|
description?: string;
|
|
100
103
|
icon_url?: string;
|
|
101
104
|
server_url?: string;
|
|
102
|
-
auth_type?: MCPServerAuthType;
|
|
103
|
-
oauth_client_id?: string;
|
|
104
|
-
oauth_secret_key?: string;
|
|
105
105
|
default_scopes?: string[];
|
|
106
106
|
headers?: {
|
|
107
107
|
[key: string]: string;
|
|
108
108
|
};
|
|
109
109
|
documentation_url?: string;
|
|
110
|
+
credentials?: CredentialRequirements;
|
|
110
111
|
}
|
package/dist/tool-builder.d.ts
CHANGED
|
@@ -113,13 +113,29 @@ export declare const webhookTool: (name: string, url: string) => WebhookToolBuil
|
|
|
113
113
|
export declare const httpTool: (name: string, url: string) => HTTPToolBuilder;
|
|
114
114
|
/** Create a call tool — makes authenticated HTTP requests. Preferred name for httpTool. */
|
|
115
115
|
export declare const callTool: (name: string, url: string) => HTTPToolBuilder;
|
|
116
|
-
/**
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
/** What an MCP tool calls: a tool on a server, named by the server's slug. */
|
|
117
|
+
export interface MCPToolTarget {
|
|
118
|
+
/** The MCP server's slug (a workspace registration or a directory entry). */
|
|
119
|
+
server: string;
|
|
120
|
+
toolName: string;
|
|
121
|
+
/** Pins one connection to the server's provider; by default the runner's own is used. */
|
|
122
|
+
credentialId?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Create an MCP tool: `toolName` on the MCP server `target.server` (its slug).
|
|
126
|
+
* The call signs in with the runner's connection to the server's provider;
|
|
127
|
+
* `credentialId` pins one connection instead.
|
|
128
|
+
*
|
|
129
|
+
* The older form `mcpTool(name, credentialId, toolName)` (a string second
|
|
130
|
+
* argument) still works: a tool naming only a connection is saved with the
|
|
131
|
+
* server that connection's provider is declared by.
|
|
132
|
+
*/
|
|
133
|
+
export declare function mcpTool(name: string, target: MCPToolTarget | string, toolName?: string): MCPToolBuilder;
|
|
119
134
|
declare class MCPToolBuilder extends ToolBuilder {
|
|
120
|
-
private
|
|
121
|
-
|
|
122
|
-
|
|
135
|
+
private target;
|
|
136
|
+
constructor(name: string, target: Partial<MCPToolTarget> & {
|
|
137
|
+
toolName: string;
|
|
138
|
+
});
|
|
123
139
|
build(): AgentTool;
|
|
124
140
|
}
|
|
125
141
|
declare class InternalToolsBuilder {
|
package/dist/tool-builder.js
CHANGED
|
@@ -236,14 +236,25 @@ export const webhookTool = (name, url) => new WebhookToolBuilder(name, url);
|
|
|
236
236
|
export const httpTool = (name, url) => new HTTPToolBuilder(name, url);
|
|
237
237
|
/** Create a call tool — makes authenticated HTTP requests. Preferred name for httpTool. */
|
|
238
238
|
export const callTool = (name, url) => new HTTPToolBuilder(name, url);
|
|
239
|
-
/**
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Create an MCP tool: `toolName` on the MCP server `target.server` (its slug).
|
|
241
|
+
* The call signs in with the runner's connection to the server's provider;
|
|
242
|
+
* `credentialId` pins one connection instead.
|
|
243
|
+
*
|
|
244
|
+
* The older form `mcpTool(name, credentialId, toolName)` (a string second
|
|
245
|
+
* argument) still works: a tool naming only a connection is saved with the
|
|
246
|
+
* server that connection's provider is declared by.
|
|
247
|
+
*/
|
|
248
|
+
export function mcpTool(name, target, toolName) {
|
|
249
|
+
if (typeof target === 'string') {
|
|
250
|
+
return new MCPToolBuilder(name, { toolName: toolName ?? '', credentialId: target });
|
|
251
|
+
}
|
|
252
|
+
return new MCPToolBuilder(name, target);
|
|
253
|
+
}
|
|
242
254
|
class MCPToolBuilder extends ToolBuilder {
|
|
243
|
-
constructor(name,
|
|
255
|
+
constructor(name, target) {
|
|
244
256
|
super(name);
|
|
245
|
-
this.
|
|
246
|
-
this.toolName = toolName;
|
|
257
|
+
this.target = target;
|
|
247
258
|
}
|
|
248
259
|
build() {
|
|
249
260
|
return {
|
|
@@ -252,7 +263,11 @@ class MCPToolBuilder extends ToolBuilder {
|
|
|
252
263
|
description: this.desc,
|
|
253
264
|
type: ToolTypeMCP,
|
|
254
265
|
require_approval: this.approval || undefined,
|
|
255
|
-
mcp: {
|
|
266
|
+
mcp: {
|
|
267
|
+
tool_name: this.target.toolName,
|
|
268
|
+
...(this.target.server ? { server: this.target.server } : {}),
|
|
269
|
+
...(this.target.credentialId ? { credential_id: this.target.credentialId } : {}),
|
|
270
|
+
},
|
|
256
271
|
};
|
|
257
272
|
}
|
|
258
273
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -200,9 +200,18 @@ export interface HTTPToolConfig {
|
|
|
200
200
|
input_schema?: any;
|
|
201
201
|
output_schema?: any;
|
|
202
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* MCPToolConfig is a tool of an MCP server: the server by its slug (the
|
|
205
|
+
* agent's team's registration, its org's or the directory's) and the tool
|
|
206
|
+
* to call. CredentialID pins the connection the call signs in with; without
|
|
207
|
+
* it the runner's connection to the server's provider is used. A tool
|
|
208
|
+
* written with only a connection is saved with the server that
|
|
209
|
+
* connection's provider is declared by.
|
|
210
|
+
*/
|
|
203
211
|
export interface MCPToolConfig {
|
|
204
|
-
|
|
212
|
+
server?: string;
|
|
205
213
|
tool_name: string;
|
|
214
|
+
credential_id?: string;
|
|
206
215
|
}
|
|
207
216
|
export interface AppToolConfigDTO {
|
|
208
217
|
ref: string;
|
|
@@ -253,8 +262,9 @@ export interface HTTPToolConfigDTO {
|
|
|
253
262
|
output_schema?: any;
|
|
254
263
|
}
|
|
255
264
|
export interface MCPToolConfigDTO {
|
|
256
|
-
|
|
265
|
+
server: string;
|
|
257
266
|
tool_name: string;
|
|
267
|
+
credential_id?: string;
|
|
258
268
|
}
|
|
259
269
|
/**
|
|
260
270
|
* AgentImages contains display images for an agent
|
|
@@ -4016,7 +4026,6 @@ export interface MCPServerDTO {
|
|
|
4016
4026
|
icon_url: string;
|
|
4017
4027
|
server_url: string;
|
|
4018
4028
|
auth_type: MCPServerAuthType;
|
|
4019
|
-
oauth_client_id?: string;
|
|
4020
4029
|
default_scopes: StringSlice;
|
|
4021
4030
|
/**
|
|
4022
4031
|
* Headers are static HTTP headers sent on every request to the server,
|
|
@@ -6464,9 +6473,24 @@ export interface StreamDelta {
|
|
|
6464
6473
|
export interface LLMOutput {
|
|
6465
6474
|
response: string;
|
|
6466
6475
|
reasoning?: string;
|
|
6476
|
+
reasoning_state?: ReasoningState;
|
|
6467
6477
|
tool_calls?: ToolCall[];
|
|
6468
6478
|
usage?: LLMUsage;
|
|
6469
6479
|
}
|
|
6480
|
+
/**
|
|
6481
|
+
* ReasoningState is the opaque state a model hands back with a response for
|
|
6482
|
+
* the next request to carry: a signature over its reasoning (Anthropic
|
|
6483
|
+
* thinking, Gemini thought_signature) or the reasoning itself encrypted
|
|
6484
|
+
* (OpenAI). The platform never reads it. An app writes its own entry under
|
|
6485
|
+
* its own key and, replaying a conversation, places only the entries it
|
|
6486
|
+
* wrote: another provider's signature in its request is refused. The agent
|
|
6487
|
+
* loop stores every assistant message's state and sends all of it back, so a
|
|
6488
|
+
* conversation that moves between models keeps each one's state for it.
|
|
6489
|
+
* Not on LLMDelta: the state is whole only on the final output.
|
|
6490
|
+
*/
|
|
6491
|
+
export type ReasoningState = {
|
|
6492
|
+
[key: string]: any;
|
|
6493
|
+
};
|
|
6470
6494
|
/**
|
|
6471
6495
|
* LLMDelta is a streaming delta for LLMOutput.
|
|
6472
6496
|
*/
|
|
@@ -6612,6 +6636,11 @@ export interface LLMContextMessage {
|
|
|
6612
6636
|
role: ChatMessageRole;
|
|
6613
6637
|
text?: string;
|
|
6614
6638
|
reasoning?: string;
|
|
6639
|
+
/**
|
|
6640
|
+
* ReasoningState is what the model's output carried, on an assistant
|
|
6641
|
+
* message: see ReasoningState.
|
|
6642
|
+
*/
|
|
6643
|
+
reasoning_state?: ReasoningState;
|
|
6615
6644
|
images?: string[];
|
|
6616
6645
|
files?: string[];
|
|
6617
6646
|
tools?: Tool[];
|
|
@@ -6876,7 +6905,7 @@ export declare const ContentUnrated: ContentRating;
|
|
|
6876
6905
|
/**
|
|
6877
6906
|
* CredentialProvider names the external service a credential is for.
|
|
6878
6907
|
*/
|
|
6879
|
-
export type CredentialProvider = "google" | "google-sa" | "slack" | "notion" | "github" | "x" | "microsoft" | "salesforce" | "discord" | "gcp" | "
|
|
6908
|
+
export type CredentialProvider = "google" | "google-sa" | "slack" | "notion" | "github" | "x" | "microsoft" | "salesforce" | "discord" | "gcp" | "reddit";
|
|
6880
6909
|
/**
|
|
6881
6910
|
* Credential.Provider is a plain string; cast with string(...) when assigning.
|
|
6882
6911
|
*/
|
|
@@ -6917,10 +6946,6 @@ export declare const CredentialProviderDiscord: CredentialProvider;
|
|
|
6917
6946
|
* Credential.Provider is a plain string; cast with string(...) when assigning.
|
|
6918
6947
|
*/
|
|
6919
6948
|
export declare const CredentialProviderGCP: CredentialProvider;
|
|
6920
|
-
/**
|
|
6921
|
-
* Credential.Provider is a plain string; cast with string(...) when assigning.
|
|
6922
|
-
*/
|
|
6923
|
-
export declare const CredentialProviderMCP: CredentialProvider;
|
|
6924
6949
|
/**
|
|
6925
6950
|
* Credential.Provider is a plain string; cast with string(...) when assigning.
|
|
6926
6951
|
*/
|
|
@@ -6928,10 +6953,9 @@ export declare const CredentialProviderReddit: CredentialProvider;
|
|
|
6928
6953
|
/**
|
|
6929
6954
|
* CredentialType describes the credential category.
|
|
6930
6955
|
*/
|
|
6931
|
-
export type CredentialType = "oauth" | "api_key" | "
|
|
6956
|
+
export type CredentialType = "oauth" | "api_key" | "service_account" | "wif";
|
|
6932
6957
|
export declare const CredentialTypeOAuth: CredentialType;
|
|
6933
6958
|
export declare const CredentialTypeAPIKey: CredentialType;
|
|
6934
|
-
export declare const CredentialTypeMCP: CredentialType;
|
|
6935
6959
|
export declare const CredentialTypeServiceAccount: CredentialType;
|
|
6936
6960
|
export declare const CredentialTypeWIF: CredentialType;
|
|
6937
6961
|
/**
|
package/dist/types.js
CHANGED
|
@@ -1238,17 +1238,12 @@ export const CredentialProviderDiscord = "discord";
|
|
|
1238
1238
|
* Credential.Provider is a plain string; cast with string(...) when assigning.
|
|
1239
1239
|
*/
|
|
1240
1240
|
export const CredentialProviderGCP = "gcp";
|
|
1241
|
-
/**
|
|
1242
|
-
* Credential.Provider is a plain string; cast with string(...) when assigning.
|
|
1243
|
-
*/
|
|
1244
|
-
export const CredentialProviderMCP = "mcp";
|
|
1245
1241
|
/**
|
|
1246
1242
|
* Credential.Provider is a plain string; cast with string(...) when assigning.
|
|
1247
1243
|
*/
|
|
1248
1244
|
export const CredentialProviderReddit = "reddit";
|
|
1249
1245
|
export const CredentialTypeOAuth = "oauth";
|
|
1250
1246
|
export const CredentialTypeAPIKey = "api_key";
|
|
1251
|
-
export const CredentialTypeMCP = "mcp";
|
|
1252
1247
|
export const CredentialTypeServiceAccount = "service_account";
|
|
1253
1248
|
export const CredentialTypeWIF = "wif";
|
|
1254
1249
|
export const CredentialStatusPending = "pending";
|