@inferencesh/sdk 0.6.15 → 0.6.20

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.
Files changed (86) hide show
  1. package/dist/agent/provider.d.ts +2 -1
  2. package/dist/api/apps.d.ts +4 -0
  3. package/dist/api/apps.js +6 -0
  4. package/dist/api/index.d.ts +3 -3
  5. package/dist/http/index.d.ts +3 -3
  6. package/dist/index.d.ts +9 -9
  7. package/dist/proxy/index.js +11 -3
  8. package/dist/types.d.ts +30 -4
  9. package/dist/types.js +4 -0
  10. package/package.json +8 -5
  11. package/dist/agent/actions.test.d.ts +0 -1
  12. package/dist/agent/actions.test.js +0 -820
  13. package/dist/agent/api.test.d.ts +0 -1
  14. package/dist/agent/api.test.js +0 -246
  15. package/dist/agent/reducer.test.d.ts +0 -1
  16. package/dist/agent/reducer.test.js +0 -131
  17. package/dist/agent/types.test.d.ts +0 -1
  18. package/dist/agent/types.test.js +0 -75
  19. package/dist/api/agents.test.d.ts +0 -1
  20. package/dist/api/agents.test.js +0 -1014
  21. package/dist/api/api-keys.test.d.ts +0 -1
  22. package/dist/api/api-keys.test.js +0 -44
  23. package/dist/api/apps.test.d.ts +0 -1
  24. package/dist/api/apps.test.js +0 -135
  25. package/dist/api/chats.test.d.ts +0 -1
  26. package/dist/api/chats.test.js +0 -85
  27. package/dist/api/engines.test.d.ts +0 -1
  28. package/dist/api/engines.test.js +0 -133
  29. package/dist/api/files.test.d.ts +0 -1
  30. package/dist/api/files.test.js +0 -256
  31. package/dist/api/flow-runs.test.d.ts +0 -1
  32. package/dist/api/flow-runs.test.js +0 -97
  33. package/dist/api/flows.test.d.ts +0 -1
  34. package/dist/api/flows.test.js +0 -118
  35. package/dist/api/integrations.test.d.ts +0 -1
  36. package/dist/api/integrations.test.js +0 -109
  37. package/dist/api/knowledge.test.d.ts +0 -1
  38. package/dist/api/knowledge.test.js +0 -238
  39. package/dist/api/mcp-servers.test.d.ts +0 -1
  40. package/dist/api/mcp-servers.test.js +0 -98
  41. package/dist/api/projects.test.d.ts +0 -1
  42. package/dist/api/projects.test.js +0 -61
  43. package/dist/api/search.test.d.ts +0 -1
  44. package/dist/api/search.test.js +0 -50
  45. package/dist/api/secrets.test.d.ts +0 -1
  46. package/dist/api/secrets.test.js +0 -61
  47. package/dist/api/sessions.test.d.ts +0 -1
  48. package/dist/api/sessions.test.js +0 -61
  49. package/dist/api/tasks.test.d.ts +0 -1
  50. package/dist/api/tasks.test.js +0 -381
  51. package/dist/api/teams.test.d.ts +0 -1
  52. package/dist/api/teams.test.js +0 -139
  53. package/dist/client.test.d.ts +0 -1
  54. package/dist/client.test.js +0 -446
  55. package/dist/http/client.test.d.ts +0 -1
  56. package/dist/http/client.test.js +0 -435
  57. package/dist/http/errors.test.d.ts +0 -1
  58. package/dist/http/errors.test.js +0 -66
  59. package/dist/http/poll.test.d.ts +0 -1
  60. package/dist/http/poll.test.js +0 -146
  61. package/dist/http/streamable.test.d.ts +0 -4
  62. package/dist/http/streamable.test.js +0 -510
  63. package/dist/integration.test.d.ts +0 -9
  64. package/dist/integration.test.js +0 -107
  65. package/dist/proxy/express.test.d.ts +0 -1
  66. package/dist/proxy/express.test.js +0 -106
  67. package/dist/proxy/hono.test.d.ts +0 -1
  68. package/dist/proxy/hono.test.js +0 -90
  69. package/dist/proxy/index.test.d.ts +0 -1
  70. package/dist/proxy/index.test.js +0 -173
  71. package/dist/proxy/nextjs.test.d.ts +0 -1
  72. package/dist/proxy/nextjs.test.js +0 -125
  73. package/dist/proxy/remix.test.d.ts +0 -1
  74. package/dist/proxy/remix.test.js +0 -66
  75. package/dist/proxy/svelte.test.d.ts +0 -1
  76. package/dist/proxy/svelte.test.js +0 -69
  77. package/dist/sessions.integration.test.d.ts +0 -13
  78. package/dist/sessions.integration.test.js +0 -310
  79. package/dist/stream.test.d.ts +0 -1
  80. package/dist/stream.test.js +0 -363
  81. package/dist/streamable.integration.test.d.ts +0 -11
  82. package/dist/streamable.integration.test.js +0 -150
  83. package/dist/tool-builder.test.d.ts +0 -1
  84. package/dist/tool-builder.test.js +0 -407
  85. package/dist/utils.test.d.ts +0 -1
  86. package/dist/utils.test.js +0 -43
@@ -4,6 +4,7 @@
4
4
  * React provider for agent chat state management.
5
5
  * Uses React useReducer + Context pattern.
6
6
  */
7
+ import React from 'react';
7
8
  import type { AgentChatProviderProps } from './types';
8
9
  /**
9
10
  * AgentChatProvider - Provides chat state and actions to children
@@ -27,7 +28,7 @@ import type { AgentChatProviderProps } from './types';
27
28
  * }
28
29
  * ```
29
30
  */
30
- export declare function AgentChatProvider({ client, agentConfig, chatId, clientToolHandlers: extraHandlers, onChatCreated, onStatusChange, onError, onTurnEnd, stream, pollIntervalMs, children, }: AgentChatProviderProps): import("react/jsx-runtime").JSX.Element;
31
+ export declare function AgentChatProvider({ client, agentConfig, chatId, clientToolHandlers: extraHandlers, onChatCreated, onStatusChange, onError, onTurnEnd, stream, pollIntervalMs, children, }: AgentChatProviderProps): React.JSX.Element;
31
32
  export declare namespace AgentChatProvider {
32
33
  var displayName: string;
33
34
  }
@@ -46,6 +46,10 @@ export declare class AppsAPI {
46
46
  * Update app visibility
47
47
  */
48
48
  updateVisibility(appId: string, visibility: string): Promise<App>;
49
+ /**
50
+ * Update app lifecycle status
51
+ */
52
+ updateStatus(appId: string, status: string, message?: string): Promise<App>;
49
53
  /**
50
54
  * Get an app by namespace and name (e.g., "inference/claude-haiku")
51
55
  */
package/dist/api/apps.js CHANGED
@@ -65,6 +65,12 @@ export class AppsAPI {
65
65
  async updateVisibility(appId, visibility) {
66
66
  return this.http.request('post', `/apps/${appId}/visibility`, { data: { visibility } });
67
67
  }
68
+ /**
69
+ * Update app lifecycle status
70
+ */
71
+ async updateStatus(appId, status, message) {
72
+ return this.http.request('post', `/apps/${appId}/status`, { data: { status, message } });
73
+ }
68
74
  /**
69
75
  * Get an app by namespace and name (e.g., "inference/claude-haiku")
70
76
  */
@@ -1,4 +1,4 @@
1
- export { TasksAPI, createTasksAPI, RunOptions } from './tasks';
2
- export { FilesAPI, createFilesAPI, UploadFileOptions } from './files';
3
- export { AgentsAPI, createAgentsAPI, Agent, AgentOptions, SendMessageOptions, AgentRunOptions } from './agents';
1
+ export { TasksAPI, createTasksAPI, type RunOptions } from './tasks';
2
+ export { FilesAPI, createFilesAPI, type UploadFileOptions } from './files';
3
+ export { AgentsAPI, createAgentsAPI, Agent, type AgentOptions, type SendMessageOptions, type AgentRunOptions } from './agents';
4
4
  export { SessionsAPI, createSessionsAPI } from './sessions';
@@ -1,4 +1,4 @@
1
- export { HttpClient, HttpClientConfig, ErrorHandler, createHttpClient } from './client';
2
- export { StreamManager, StreamManagerOptions, PartialDataWrapper } from './stream';
3
- export { streamable, streamableRaw, StreamableManager, StreamableOptions, StreamableMessage, StreamableManagerOptions } from './streamable';
1
+ export { HttpClient, type HttpClientConfig, type ErrorHandler, createHttpClient } from './client';
2
+ export { StreamManager, type StreamManagerOptions, type PartialDataWrapper } from './stream';
3
+ export { streamable, streamableRaw, StreamableManager, type StreamableOptions, type StreamableMessage, type StreamableManagerOptions } from './streamable';
4
4
  export { InferenceError, RequirementsNotMetException } from './errors';
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { HttpClient, HttpClientConfig, ErrorHandler, createHttpClient } from './http/client';
2
- export { StreamManager, StreamManagerOptions, PartialDataWrapper } from './http/stream';
3
- export { StreamableManager, StreamableManagerOptions, StreamableMessage, streamable, streamableRaw } from './http/streamable';
4
- export { PollManager, PollManagerOptions } from './http/poll';
1
+ export { HttpClient, type HttpClientConfig, type ErrorHandler, createHttpClient } from './http/client';
2
+ export { StreamManager, type StreamManagerOptions, type PartialDataWrapper } from './http/stream';
3
+ export { StreamableManager, type StreamableManagerOptions, type StreamableMessage, streamable, streamableRaw } from './http/streamable';
4
+ export { PollManager, type PollManagerOptions } from './http/poll';
5
5
  export { InferenceError, RequirementsNotMetException, SessionError, SessionNotFoundError, SessionExpiredError, SessionEndedError, WorkerLostError, isRequirementsNotMetException, isInferenceError, isSessionError, } from './http/errors';
6
- export { TasksAPI, RunOptions } from './api/tasks';
7
- export { FilesAPI, UploadFileOptions } from './api/files';
8
- export { AgentsAPI, Agent, AgentOptions, SendMessageOptions, AgentRunOptions } from './api/agents';
6
+ export { TasksAPI, type RunOptions } from './api/tasks';
7
+ export { FilesAPI, type UploadFileOptions } from './api/files';
8
+ export { AgentsAPI, Agent, type AgentOptions, type SendMessageOptions, type AgentRunOptions } from './api/agents';
9
9
  export { SessionsAPI } from './api/sessions';
10
10
  export { AppsAPI } from './api/apps';
11
11
  export { ChatsAPI } from './api/chats';
@@ -13,7 +13,7 @@ export { FlowsAPI } from './api/flows';
13
13
  export { FlowRunsAPI } from './api/flow-runs';
14
14
  export { EnginesAPI } from './api/engines';
15
15
  export { KnowledgeAPI, SkillsAPI } from './api/knowledge';
16
- export { TeamsAPI, MeResponse } from './api/teams';
16
+ export { TeamsAPI, type MeResponse } from './api/teams';
17
17
  export { SecretsAPI } from './api/secrets';
18
18
  export { ApiKeysAPI } from './api/api-keys';
19
19
  export { IntegrationsAPI } from './api/integrations';
@@ -25,7 +25,7 @@ export type { ClientTool, ClientToolHandler } from './tool-builder';
25
25
  export { parseStatus, isTerminalStatus } from './utils';
26
26
  export * from './types';
27
27
  export type { TaskDTO as Task } from './types';
28
- import { HttpClient, HttpClientConfig } from './http/client';
28
+ import { HttpClient, type HttpClientConfig } from './http/client';
29
29
  import { TasksAPI, RunOptions } from './api/tasks';
30
30
  import { FilesAPI, UploadFileOptions } from './api/files';
31
31
  import { AgentsAPI, Agent, AgentOptions } from './api/agents';
@@ -95,14 +95,22 @@ export async function processProxyRequest(adapter, options) {
95
95
  error: "Missing INFERENCE_API_KEY environment variable",
96
96
  });
97
97
  }
98
- // 4. Collect x-inf-* headers to forward
98
+ // 4. Collect headers to forward upstream.
99
+ //
100
+ // x-inf-* plus the SDK's own headers. X-API-Version is load-bearing: the
101
+ // API returns bare DTOs when it sees "2" and the legacy {success, status,
102
+ // data} envelope otherwise, and this SDK only parses the former. Dropping
103
+ // it here made every proxied response unparseable — requests succeeded
104
+ // server-side while the client silently saw nothing.
105
+ const FORWARD_HEADERS = ["x-api-version", "x-client-source"];
99
106
  const forwardHeaders = {};
100
107
  const allHeaders = adapter.headers();
101
108
  for (const [key, value] of Object.entries(allHeaders)) {
102
- if (key.toLowerCase().startsWith("x-inf-")) {
109
+ const lower = key.toLowerCase();
110
+ if (lower.startsWith("x-inf-") || FORWARD_HEADERS.includes(lower)) {
103
111
  const v = firstValue(value);
104
112
  if (v)
105
- forwardHeaders[key.toLowerCase()] = v;
113
+ forwardHeaders[lower] = v;
106
114
  }
107
115
  }
108
116
  // 5. Build request headers
package/dist/types.d.ts CHANGED
@@ -411,6 +411,8 @@ export interface AuthResponse {
411
411
  */
412
412
  export interface DeviceAuthInitRequest {
413
413
  token_kind?: DeviceTokenKind;
414
+ code_challenge?: string;
415
+ code_challenge_method?: string;
414
416
  }
415
417
  export interface DeviceAuthResponse {
416
418
  user_code: string;
@@ -537,6 +539,10 @@ export interface EstimateCostResponse {
537
539
  * DependsOn lists post-execution variables the pricing needs (when not exact).
538
540
  */
539
541
  depends_on?: string[];
542
+ /**
543
+ * EstimateError is set when an estimate expression exists but failed to evaluate.
544
+ */
545
+ estimate_error?: string;
540
546
  /**
541
547
  * PricingDescription is the rendered human-readable pricing string.
542
548
  */
@@ -951,6 +957,9 @@ export interface AppDTO extends BaseModelDTO, PermissionModelDTO {
951
957
  images: AppImages;
952
958
  version_id: string;
953
959
  version?: AppVersionDTO;
960
+ status: AppStatus;
961
+ status_message?: string;
962
+ status_changed_at?: string;
954
963
  }
955
964
  /**
956
965
  * AppVersionDTO is the API response for an app version.
@@ -1617,6 +1626,8 @@ export interface SkillDTO extends BaseModelDTO, PermissionModelDTO {
1617
1626
  repo_url?: string;
1618
1627
  version_id: string;
1619
1628
  version?: SkillVersionDTO;
1629
+ uses: number;
1630
+ installs: number;
1620
1631
  }
1621
1632
  export interface SkillVersionDTO extends BaseModelDTO {
1622
1633
  skill_id: string;
@@ -1649,6 +1660,8 @@ export interface KnowledgeDTO extends BaseModelDTO, PermissionModelDTO {
1649
1660
  lifecycle: KnowledgeLifecycle;
1650
1661
  version_id: string;
1651
1662
  version?: KnowledgeVersionDTO;
1663
+ uses: number;
1664
+ installs: number;
1652
1665
  }
1653
1666
  export interface KnowledgeVersionDTO extends BaseModelDTO {
1654
1667
  knowledge_id: string;
@@ -1888,15 +1901,23 @@ export interface PlanDTO extends BaseModelDTO {
1888
1901
  active: boolean;
1889
1902
  self_serve?: boolean;
1890
1903
  plan_type: PlanType;
1891
- price_monthly?: number;
1892
- price_yearly?: number;
1893
1904
  credits_monthly: number;
1894
- provider_price_id_monthly?: string;
1895
- provider_price_id_yearly?: string;
1905
+ active_version?: PlanVersionDTO;
1896
1906
  required_plan_ids?: string[];
1897
1907
  required_plan_names?: string[];
1908
+ stackable: boolean;
1898
1909
  limits: PlanLimits;
1899
1910
  }
1911
+ export interface PlanVersionDTO extends BaseModelDTO {
1912
+ plan_id?: string;
1913
+ amount_monthly: number;
1914
+ amount_yearly: number;
1915
+ provider_price_id_monthly?: string;
1916
+ provider_price_id_yearly?: string;
1917
+ credits_monthly: number;
1918
+ limits?: PlanLimits;
1919
+ active: boolean;
1920
+ }
1900
1921
  /**
1901
1922
  * ProjectModelDTO provides optional project association for DTOs
1902
1923
  */
@@ -2672,6 +2693,11 @@ export declare const AppCategoryChat: AppCategory;
2672
2693
  export declare const AppCategory3D: AppCategory;
2673
2694
  export declare const AppCategoryOther: AppCategory;
2674
2695
  export declare const AppCategoryFlow: AppCategory;
2696
+ export type AppStatus = string;
2697
+ export declare const AppStatusActive: AppStatus;
2698
+ export declare const AppStatusMaintenance: AppStatus;
2699
+ export declare const AppStatusDeprecated: AppStatus;
2700
+ export declare const AppStatusRetired: AppStatus;
2675
2701
  export type GPUType = string;
2676
2702
  export declare const GPUTypeAny: GPUType;
2677
2703
  export declare const GPUTypeNone: GPUType;
package/dist/types.js CHANGED
@@ -269,6 +269,10 @@ export const AppCategoryChat = "chat";
269
269
  export const AppCategory3D = "3d";
270
270
  export const AppCategoryOther = "other";
271
271
  export const AppCategoryFlow = "flow";
272
+ export const AppStatusActive = "active";
273
+ export const AppStatusMaintenance = "maintenance";
274
+ export const AppStatusDeprecated = "deprecated";
275
+ export const AppStatusRetired = "retired";
272
276
  export const GPUTypeAny = "any";
273
277
  export const GPUTypeNone = "none";
274
278
  export const GPUTypeIntel = "intel";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.6.15",
3
+ "version": "0.6.20",
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",
@@ -8,6 +8,7 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
+ "inference-src": "./src/index.ts",
11
12
  "default": "./dist/index.js"
12
13
  },
13
14
  "./proxy": {
@@ -36,6 +37,7 @@
36
37
  },
37
38
  "./agent": {
38
39
  "types": "./dist/agent/index.d.ts",
40
+ "inference-src": "./src/agent/index.ts",
39
41
  "default": "./dist/agent/index.js"
40
42
  }
41
43
  },
@@ -90,10 +92,10 @@
90
92
  "svelte": "^5.55.7",
91
93
  "@types/express": "^5.0.0",
92
94
  "@types/jest": "^30.0.0",
93
- "@types/node": "^24.1.0",
95
+ "@types/node": "^26.1.1",
94
96
  "@types/react": "^19.1.12",
95
- "@typescript-eslint/eslint-plugin": "^8.38.0",
96
- "@typescript-eslint/parser": "^8.38.0",
97
+ "@typescript-eslint/eslint-plugin": "^8.65.0",
98
+ "@typescript-eslint/parser": "^8.65.0",
97
99
  "eslint": "^9.32.0",
98
100
  "eslint-config-prettier": "^10.1.8",
99
101
  "hono": "^4.0.0",
@@ -103,7 +105,7 @@
103
105
  "react": "^19.2.3",
104
106
  "rimraf": "^6.0.1",
105
107
  "ts-jest": "^29.2.5",
106
- "typescript": "^5.8.3"
108
+ "typescript": "~6.0.3"
107
109
  },
108
110
  "peerDependencies": {
109
111
  "@sveltejs/kit": ">=2.0.0",
@@ -131,6 +133,7 @@
131
133
  },
132
134
  "files": [
133
135
  "dist",
136
+ "!dist/**/*.test.*",
134
137
  "README.md",
135
138
  "LICENSE",
136
139
  "CHANGELOG.md"
@@ -1 +0,0 @@
1
- export {};