@inferencesh/sdk 0.6.28 → 0.6.30

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.
@@ -142,6 +142,13 @@ export function createActions(ctx) {
142
142
  manager.addEventListener('chat_messages', (message) => {
143
143
  updateMessage(message);
144
144
  });
145
+ // Listen for AgentRun updates (state transitions, output)
146
+ manager.addEventListener('agent_runs', (run) => {
147
+ dispatch({ type: 'UPDATE_ACTIVE_RUN', payload: run });
148
+ const asChat = { active_run: run };
149
+ callbacks.onStatusChange?.(isChatBusy(asChat) ? 'streaming' : 'idle');
150
+ checkTurnEnd(asChat);
151
+ });
145
152
  setStreamManager(manager);
146
153
  manager.start();
147
154
  };
@@ -29,12 +29,17 @@ export function chatReducer(state, action) {
29
29
  return { ...state, chat, messages };
30
30
  }
31
31
  case 'UPDATE_CHAT': {
32
- // Update chat metadata (e.g. status) without replacing messages
32
+ // Update chat metadata without replacing messages
33
33
  const chat = action.payload;
34
34
  if (!chat)
35
35
  return state;
36
36
  return { ...state, chat };
37
37
  }
38
+ case 'UPDATE_ACTIVE_RUN': {
39
+ if (!state.chat)
40
+ return state;
41
+ return { ...state, chat: { ...state.chat, active_run: action.payload } };
42
+ }
38
43
  case 'SET_MESSAGES':
39
44
  return { ...state, messages: action.payload };
40
45
  case 'UPDATE_MESSAGE': {
@@ -4,7 +4,7 @@
4
4
  * Public types for the Agent chat module.
5
5
  */
6
6
  import type { Dispatch } from 'react';
7
- import type { ChatDTO, ChatMessageDTO, AgentTool, AgentConfigInput as GeneratedAgentConfig, CoreAppConfigInput as CoreAppConfig, FileRef } from '../types';
7
+ import type { AgentRunDTO, ChatDTO, ChatMessageDTO, AgentTool, AgentConfigInput as GeneratedAgentConfig, CoreAppConfigInput as CoreAppConfig, FileRef } from '../types';
8
8
  import type { HttpClient } from '../http/client';
9
9
  import type { StreamableManager } from '../http/streamable';
10
10
  import type { PollManager } from '../http/poll';
@@ -187,6 +187,9 @@ export type ChatAction = {
187
187
  } | {
188
188
  type: 'UPDATE_CHAT';
189
189
  payload: ChatDTO | null;
190
+ } | {
191
+ type: 'UPDATE_ACTIVE_RUN';
192
+ payload: AgentRunDTO;
190
193
  } | {
191
194
  type: 'SET_MESSAGES';
192
195
  payload: ChatMessageDTO[];
@@ -163,6 +163,13 @@ export class Agent {
163
163
  resolve();
164
164
  }
165
165
  });
166
+ this.stream.addEventListener('agent_runs', (run) => {
167
+ const asChat = { active_run: run };
168
+ options.onChat?.(asChat);
169
+ if (!isChatBusy(asChat)) {
170
+ resolve();
171
+ }
172
+ });
166
173
  this.stream.addEventListener('chat_messages', (message) => {
167
174
  options.onMessage?.(message);
168
175
  if (message.tool_invocations && options.onToolCall) {
package/dist/types.d.ts CHANGED
@@ -249,6 +249,7 @@ export interface AgentRunDTO extends BaseModelDTO, PermissionModelDTO {
249
249
  user_message_id?: string;
250
250
  state: AgentRunState;
251
251
  error?: string;
252
+ output?: any;
252
253
  interrupt_reason?: InterruptReason;
253
254
  interrupt_tool_id?: string;
254
255
  interrupt_meta?: any;
@@ -1429,6 +1430,7 @@ export type FlowNodeDataMap = {
1429
1430
  * FlowDTO for API responses
1430
1431
  */
1431
1432
  export interface FlowDTO extends BaseModelDTO, PermissionModelDTO {
1433
+ namespace: string;
1432
1434
  name: string;
1433
1435
  description: string;
1434
1436
  card_image: string;
@@ -1784,6 +1786,162 @@ export interface SkillStoreListingDTO {
1784
1786
  uses: number;
1785
1787
  tags?: string[];
1786
1788
  }
1789
+ /**
1790
+ * ElicitationCapability advertises which elicitation modes the client handles.
1791
+ * An empty struct is equivalent to form-only for backward compatibility.
1792
+ */
1793
+ export interface ElicitationCapability {
1794
+ form?: {};
1795
+ url?: {};
1796
+ }
1797
+ /**
1798
+ * ClientCapabilities advertises what a client can do.
1799
+ */
1800
+ export interface ClientCapabilities {
1801
+ elicitation?: ElicitationCapability;
1802
+ }
1803
+ /**
1804
+ * InputRequest is a single server-to-client request inside an InputRequiredResult.
1805
+ */
1806
+ export interface InputRequest {
1807
+ method: string;
1808
+ params: any;
1809
+ }
1810
+ /**
1811
+ * ElicitAction is the user's response to an elicitation request.
1812
+ */
1813
+ export type ElicitAction = string;
1814
+ export declare const ElicitActionAccept: ElicitAction;
1815
+ export declare const ElicitActionDecline: ElicitAction;
1816
+ export declare const ElicitActionCancel: ElicitAction;
1817
+ /**
1818
+ * ElicitResult is the client's response to an elicitation/create request.
1819
+ */
1820
+ export interface ElicitResult {
1821
+ action: ElicitAction;
1822
+ content?: {
1823
+ [key: string]: any;
1824
+ };
1825
+ }
1826
+ /**
1827
+ * ResultType is the kind of result a response carries, required on every result
1828
+ * from 2026-07-28 onward.
1829
+ */
1830
+ export type ResultType = string;
1831
+ /**
1832
+ * ResultTypeComplete marks an ordinary, finished result.
1833
+ */
1834
+ export declare const ResultTypeComplete: ResultType;
1835
+ /**
1836
+ * ResultTypeInputRequired marks a Multi Round-Trip Request interim result.
1837
+ * Recognised so the outbound client never mistakes one for tool output.
1838
+ */
1839
+ export declare const ResultTypeInputRequired: ResultType;
1840
+ /**
1841
+ * CacheScope says who may reuse a cached result, per MCP 2026-07-28 (SEP-2549).
1842
+ * Analogous to HTTP Cache-Control public/private; the spec defines exactly these.
1843
+ */
1844
+ export type CacheScope = string;
1845
+ /**
1846
+ * CacheScopePublic marks a response as free of user-specific data, so any
1847
+ * client or shared intermediary may cache it across authorization contexts.
1848
+ */
1849
+ export declare const CacheScopePublic: CacheScope;
1850
+ /**
1851
+ * CacheScopePrivate restricts reuse to the same authorization context.
1852
+ */
1853
+ export declare const CacheScopePrivate: CacheScope;
1854
+ /**
1855
+ * ServerInfo represents information about the server
1856
+ */
1857
+ export interface ServerInfo {
1858
+ name: string;
1859
+ title: string;
1860
+ version: string;
1861
+ }
1862
+ /**
1863
+ * ResultMeta is the _meta object attached to results. Servers SHOULD identify
1864
+ * themselves in every result from 2026-07-28 onward (SEP-2575).
1865
+ * The struct tag is the single definition of the key — Go tags cannot reference
1866
+ * a constant, so there is deliberately no MetaServerInfo const to drift from it.
1867
+ */
1868
+ export interface ResultMeta {
1869
+ 'io.modelcontextprotocol/serverInfo'?: ServerInfo;
1870
+ /**
1871
+ * TTLMs and CacheScope are read-only legacy fields: servers older than
1872
+ * 2026-07-28 nested the caching signals here instead of on the result. They
1873
+ * live on this type rather than a separate one so a single decode of the
1874
+ * _meta object yields both them and serverInfo.
1875
+ */
1876
+ ttlMs?: number;
1877
+ cacheScope?: CacheScope;
1878
+ }
1879
+ /**
1880
+ * ResourceContent represents resource content
1881
+ */
1882
+ export interface ResourceContent {
1883
+ uri: string;
1884
+ name: string;
1885
+ title?: string;
1886
+ mimeType?: string;
1887
+ text?: string;
1888
+ blob?: string;
1889
+ }
1890
+ /**
1891
+ * ToolCallRequest represents a request to call a tool.
1892
+ * InputResponses and RequestState are present on MRTR retries: the client is
1893
+ * echoing back responses to the server's InputRequiredResult.
1894
+ */
1895
+ export interface ToolCallRequest {
1896
+ name: string;
1897
+ arguments: {
1898
+ [key: string]: any;
1899
+ };
1900
+ inputResponses?: {
1901
+ [key: string]: any;
1902
+ };
1903
+ requestState?: string;
1904
+ }
1905
+ /**
1906
+ * ToolCallResponse represents a response from a tool call.
1907
+ * ResultType is read as well as written: an inbound response carrying
1908
+ * ResultTypeInputRequired is a Multi Round-Trip Request asking for more input,
1909
+ * not tool output, and callers must not treat it as a result. Servers older than
1910
+ * 2026-07-28 omit the field, which clients MUST read as "complete".
1911
+ */
1912
+ export interface ToolCallResponse {
1913
+ resultType?: ResultType;
1914
+ content: ToolContent[];
1915
+ structuredContent?: any;
1916
+ isError: boolean;
1917
+ _meta?: ResultMeta;
1918
+ /**
1919
+ * MRTR fields — present when ResultType == ResultTypeInputRequired.
1920
+ */
1921
+ inputRequests?: {
1922
+ [key: string]: InputRequest;
1923
+ };
1924
+ requestState?: string;
1925
+ }
1926
+ /**
1927
+ * ToolContentType is the kind of a content block. The spec defines exactly these.
1928
+ */
1929
+ export type ToolContentType = string;
1930
+ export declare const ToolContentTypeText: ToolContentType;
1931
+ export declare const ToolContentTypeImage: ToolContentType;
1932
+ export declare const ToolContentTypeAudio: ToolContentType;
1933
+ export declare const ToolContentTypeResourceLink: ToolContentType;
1934
+ export declare const ToolContentTypeResource: ToolContentType;
1935
+ /**
1936
+ * ToolContent represents content in a tool response
1937
+ */
1938
+ export interface ToolContent {
1939
+ type: ToolContentType;
1940
+ text?: string;
1941
+ data?: string;
1942
+ mimeType?: string;
1943
+ resource?: ResourceContent;
1944
+ }
1787
1945
  /**
1788
1946
  * StringSlice is a custom type for storing string slices
1789
1947
  */
package/dist/types.js CHANGED
@@ -246,6 +246,32 @@ export const ScopeGroupEngines = "engines";
246
246
  export const ScopeGroupApiKeys = "apikeys";
247
247
  export const ScopeGroupUser = "user";
248
248
  export const ScopeGroupSettings = "settings";
249
+ export const ElicitActionAccept = "accept";
250
+ export const ElicitActionDecline = "decline";
251
+ export const ElicitActionCancel = "cancel";
252
+ /**
253
+ * ResultTypeComplete marks an ordinary, finished result.
254
+ */
255
+ export const ResultTypeComplete = "complete";
256
+ /**
257
+ * ResultTypeInputRequired marks a Multi Round-Trip Request interim result.
258
+ * Recognised so the outbound client never mistakes one for tool output.
259
+ */
260
+ export const ResultTypeInputRequired = "input_required";
261
+ /**
262
+ * CacheScopePublic marks a response as free of user-specific data, so any
263
+ * client or shared intermediary may cache it across authorization contexts.
264
+ */
265
+ export const CacheScopePublic = "public";
266
+ /**
267
+ * CacheScopePrivate restricts reuse to the same authorization context.
268
+ */
269
+ export const CacheScopePrivate = "private";
270
+ export const ToolContentTypeText = "text";
271
+ export const ToolContentTypeImage = "image";
272
+ export const ToolContentTypeAudio = "audio";
273
+ export const ToolContentTypeResourceLink = "resource_link";
274
+ export const ToolContentTypeResource = "resource";
249
275
  /**
250
276
  * Requirement error types
251
277
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.6.28",
3
+ "version": "0.6.30",
4
4
  "description": "Official JavaScript/TypeScript SDK for inference.sh - Run AI models with a simple API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",