@inferencesh/sdk 0.26.2 → 0.27.0
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 +13 -0
- package/dist/agent/types.d.ts +3 -13
- package/dist/api/agents.js +5 -9
- package/dist/index.d.ts +1 -1
- package/dist/tool-builder.d.ts +15 -2
- package/dist/types.d.ts +33 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.27.0] - 2026-10-13
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `client.agent(...).sendMessage(text, { files })` sends the files as `MessageInput.attachments` (FileRefs with filename and content type) instead of the deprecated `images` / `files` URI lists.
|
|
15
|
+
- A `tool(...).handler()` handler may return `{ result, attachments }` (`ClientToolResult`, now exported from the package root) like a `clientToolHandlers` handler: the result text plus files uploaded with `client.files.upload`.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Generated types follow the API: `MCPServerDTO.connection` (`ConnectionInfo` with `MCPConnectionFacts`); `connection_status` is deprecated.
|
|
20
|
+
|
|
21
|
+
## [0.26.2] - 2026-10-13
|
|
22
|
+
|
|
10
23
|
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
24
|
|
|
12
25
|
### Changed
|
package/dist/agent/types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { Dispatch } from 'react';
|
|
7
7
|
import type { AgentRunDTO, AgentVersionDTO, AlwaysAllowOptionsDTO, AlwaysAllowResultDTO, ToolExplanationDTO, ChatAgentDTO, ChatDTO, ChatMessageDTO, ChatSettingsDTO, ChatSettingsRequest, AgentTool, AgentConfigInput as GeneratedAgentConfig, CoreAppConfigInput as CoreAppConfig, FileRef, ElicitResult } from '../types.js';
|
|
8
8
|
import type { HttpClient } from '../http/client.js';
|
|
9
|
+
import type { ClientToolResult } from '../tool-builder.js';
|
|
9
10
|
import type { StreamableManager } from '../http/streamable.js';
|
|
10
11
|
import type { PollManager } from '../http/poll.js';
|
|
11
12
|
export type { FileRef } from '../types.js';
|
|
@@ -221,19 +222,8 @@ export interface AgentChatProviderProps {
|
|
|
221
222
|
/** Children */
|
|
222
223
|
children: React.ReactNode;
|
|
223
224
|
}
|
|
224
|
-
/**
|
|
225
|
-
|
|
226
|
-
*
|
|
227
|
-
* `attachments` are files already uploaded with POST /files (for example with
|
|
228
|
-
* `client.files.upload(dataUrlOrBlob)` or the chat's `uploadFile`), passed as
|
|
229
|
-
* `FileRef`s, the same as message attachments. An image attachment reaches the
|
|
230
|
-
* model as image input when the model supports images; other files are listed
|
|
231
|
-
* on the tool message.
|
|
232
|
-
*/
|
|
233
|
-
export type ClientToolResult = string | {
|
|
234
|
-
result: string;
|
|
235
|
-
attachments?: FileRef[];
|
|
236
|
-
};
|
|
225
|
+
/** What a client tool handler returns (defined with the tool builder). */
|
|
226
|
+
export type { ClientToolResult } from '../tool-builder.js';
|
|
237
227
|
/**
|
|
238
228
|
* Client tool handler function - takes args and returns a result (sync or async)
|
|
239
229
|
*/
|
package/dist/api/agents.js
CHANGED
|
@@ -63,8 +63,7 @@ export class Agent {
|
|
|
63
63
|
const isTemplate = typeof this.config === 'string';
|
|
64
64
|
const hasCallbacks = !!(options.onMessage || options.onChat || options.onToolCall || options.onDelta);
|
|
65
65
|
// Process files - either already uploaded (FileDTO with uri) or needs upload (Blob)
|
|
66
|
-
let
|
|
67
|
-
let fileUris;
|
|
66
|
+
let attachments;
|
|
68
67
|
if (options.files && options.files.length > 0) {
|
|
69
68
|
const toUpload = [];
|
|
70
69
|
const alreadyUploaded = [];
|
|
@@ -78,14 +77,11 @@ export class Agent {
|
|
|
78
77
|
}
|
|
79
78
|
const uploadedFiles = toUpload.length > 0 ? await Promise.all(toUpload.map((blob) => this.files.upload(blob))) : [];
|
|
80
79
|
const allFiles = [...alreadyUploaded, ...uploadedFiles];
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
imageUris = images.map((f) => f.uri);
|
|
85
|
-
if (others.length > 0)
|
|
86
|
-
fileUris = others.map((f) => f.uri);
|
|
80
|
+
if (allFiles.length > 0) {
|
|
81
|
+
attachments = allFiles.map(({ id, uri, filename, content_type, size }) => ({ id, uri, filename, content_type, size }));
|
|
82
|
+
}
|
|
87
83
|
}
|
|
88
|
-
const input = { text,
|
|
84
|
+
const input = attachments ? { text, attachments } : { text };
|
|
89
85
|
const body = {
|
|
90
86
|
chat_id: this.chatId ?? undefined,
|
|
91
87
|
context: this.context,
|
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export { STREAM_FORMAT, CLEAR_KEY, ERROR_KEY, REDIAL_CODES } from './live/protoc
|
|
|
32
32
|
export { isLiveField, parseMediaType, pcmFormat, splitLiveSchema, binaryLiveField, alternativeLabel, alternativeTag, } from './live/schema.js';
|
|
33
33
|
export type { JsonSchema, MediaType, PCMFormat, LiveField } from './live/schema.js';
|
|
34
34
|
export { tool, appTool, agentTool, webhookTool, httpTool, callTool, mcpTool, internalTools, string, number, integer, boolean, enumOf, object, array, optional, } from './tool-builder.js';
|
|
35
|
-
export type { ClientTool, ClientToolHandler } from './tool-builder.js';
|
|
35
|
+
export type { ClientTool, ClientToolHandler, ClientToolResult } from './tool-builder.js';
|
|
36
36
|
export { lifecycleHook, learningHooks } from './hook-builder.js';
|
|
37
37
|
export type { LifecycleHookBuilder } from './hook-builder.js';
|
|
38
38
|
export { DeltaAccumulator, createLLMDeltaAccumulator, type DeltaEvent, type FieldTags, type FieldTagsRegistry } from './delta.js';
|
package/dist/tool-builder.d.ts
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool Builder - Fluent API for defining agent tools
|
|
3
3
|
*/
|
|
4
|
-
import { AgentTool, InternalToolsConfig } from './types.js';
|
|
4
|
+
import { AgentTool, FileRef, InternalToolsConfig } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* What a client tool handler returns: the result text, or the text plus files.
|
|
7
|
+
*
|
|
8
|
+
* `attachments` are files already uploaded with POST /files (for example with
|
|
9
|
+
* `client.files.upload(dataUrlOrBlob)` or the chat's `uploadFile`), passed as
|
|
10
|
+
* `FileRef`s, the same as message attachments. An image attachment reaches the
|
|
11
|
+
* model as image input when the model supports images; other files are listed
|
|
12
|
+
* on the tool message.
|
|
13
|
+
*/
|
|
14
|
+
export type ClientToolResult = string | {
|
|
15
|
+
result: string;
|
|
16
|
+
attachments?: FileRef[];
|
|
17
|
+
};
|
|
5
18
|
/** Handler function for client tools (executed in browser/Node) */
|
|
6
|
-
export type ClientToolHandler = (args: Record<string, unknown>) => Promise<
|
|
19
|
+
export type ClientToolHandler = (args: Record<string, unknown>) => Promise<ClientToolResult> | ClientToolResult;
|
|
7
20
|
/** Client tool with schema and handler bundled together */
|
|
8
21
|
export interface ClientTool {
|
|
9
22
|
/** Tool schema (sent to server, describes the tool to the LLM) */
|
package/dist/types.d.ts
CHANGED
|
@@ -4046,12 +4046,44 @@ export interface MCPServerDTO {
|
|
|
4046
4046
|
*/
|
|
4047
4047
|
credentials?: CredentialRequirements;
|
|
4048
4048
|
credential_slug?: string;
|
|
4049
|
+
/**
|
|
4050
|
+
* Deprecated: Connection.Status. Kept for clients reading it.
|
|
4051
|
+
*/
|
|
4049
4052
|
connection_status?: string;
|
|
4050
4053
|
/**
|
|
4051
|
-
* ConnectionScope is who the caller's connection to this server belongs
|
|
4054
|
+
* Deprecated: Connection.Scope. ConnectionScope is who the caller's connection to this server belongs
|
|
4052
4055
|
* to (user, team, org, platform); empty when not connected.
|
|
4053
4056
|
*/
|
|
4054
4057
|
connection_scope?: CredentialScope;
|
|
4058
|
+
/**
|
|
4059
|
+
* Connection is the whole of it: the login's status and scope above,
|
|
4060
|
+
* and what the connection made with that login holds.
|
|
4061
|
+
*/
|
|
4062
|
+
connection?: ConnectionInfo;
|
|
4063
|
+
}
|
|
4064
|
+
/**
|
|
4065
|
+
* ConnectionInfo is the caller's standing with a server: their login's
|
|
4066
|
+
* status (connected, expired, error; "" when they hold none) and whose it
|
|
4067
|
+
* is, and what the connection made with that login holds.
|
|
4068
|
+
*/
|
|
4069
|
+
export interface ConnectionInfo extends MCPConnectionFacts {
|
|
4070
|
+
/**
|
|
4071
|
+
* Status and Scope are the caller's login's for the server: whether
|
|
4072
|
+
* they can call it, and whose the login is.
|
|
4073
|
+
*/
|
|
4074
|
+
status?: string;
|
|
4075
|
+
scope?: CredentialScope;
|
|
4076
|
+
}
|
|
4077
|
+
/**
|
|
4078
|
+
* MCPConnectionFacts is what an MCP connection (a server reached through
|
|
4079
|
+
* one login) has recorded: the catalogue it listed, its last call.
|
|
4080
|
+
*/
|
|
4081
|
+
export interface MCPConnectionFacts {
|
|
4082
|
+
connection_id?: string;
|
|
4083
|
+
tool_count?: number;
|
|
4084
|
+
tools_listed_at?: string;
|
|
4085
|
+
last_called_at?: string;
|
|
4086
|
+
last_error?: string;
|
|
4055
4087
|
}
|
|
4056
4088
|
/**
|
|
4057
4089
|
* MCPServerSetup is what a server's directory entry knows about setting the
|