@inferencesh/sdk 0.4.4 → 0.4.8
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/dist/client.d.ts +14 -6
- package/dist/client.js +40 -15
- package/dist/client.test.js +3 -3
- package/dist/index.d.ts +0 -1
- package/dist/proxy/express.d.ts +37 -0
- package/dist/proxy/express.js +84 -0
- package/dist/proxy/express.mjs +1 -0
- package/dist/proxy/hono.d.ts +59 -0
- package/dist/proxy/hono.js +84 -0
- package/dist/proxy/hono.mjs +1 -0
- package/dist/proxy/index.d.ts +55 -0
- package/dist/proxy/index.js +136 -0
- package/dist/proxy/index.mjs +1 -0
- package/dist/proxy/index.test.d.ts +1 -0
- package/dist/proxy/index.test.js +220 -0
- package/dist/proxy/index.test.mjs +1 -0
- package/dist/proxy/nextjs.d.ts +61 -0
- package/dist/proxy/nextjs.js +95 -0
- package/dist/proxy/nextjs.mjs +1 -0
- package/dist/proxy/remix.d.ts +47 -0
- package/dist/proxy/remix.js +61 -0
- package/dist/proxy/remix.mjs +1 -0
- package/dist/proxy/svelte.d.ts +46 -0
- package/dist/proxy/svelte.js +62 -0
- package/dist/proxy/svelte.mjs +1 -0
- package/dist/types.d.ts +171 -94
- package/dist/types.js +30 -5
- package/package.json +60 -3
- package/dist/agent.d.ts +0 -78
- package/dist/agent.js +0 -188
package/dist/types.d.ts
CHANGED
|
@@ -144,6 +144,14 @@ export interface CoreAppConfig {
|
|
|
144
144
|
id: string;
|
|
145
145
|
version_id: string;
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* AgentImages contains display images for an agent (like AppImages)
|
|
149
|
+
*/
|
|
150
|
+
export interface AgentImages {
|
|
151
|
+
card: string;
|
|
152
|
+
thumbnail: string;
|
|
153
|
+
banner: string;
|
|
154
|
+
}
|
|
147
155
|
export interface Agent {
|
|
148
156
|
BaseModel: BaseModel;
|
|
149
157
|
PermissionModel: PermissionModel;
|
|
@@ -153,6 +161,10 @@ export interface Agent {
|
|
|
153
161
|
*/
|
|
154
162
|
namespace: string;
|
|
155
163
|
name: string;
|
|
164
|
+
/**
|
|
165
|
+
* Display images (like App)
|
|
166
|
+
*/
|
|
167
|
+
images: AgentImages;
|
|
156
168
|
version_id: string;
|
|
157
169
|
version?: AgentVersion;
|
|
158
170
|
}
|
|
@@ -162,22 +174,33 @@ export interface Agent {
|
|
|
162
174
|
export interface AgentDTO extends BaseModel, PermissionModelDTO, ProjectModelDTO {
|
|
163
175
|
namespace: string;
|
|
164
176
|
name: string;
|
|
177
|
+
/**
|
|
178
|
+
* Display images (like AppDTO)
|
|
179
|
+
*/
|
|
180
|
+
images: AgentImages;
|
|
165
181
|
version_id: string;
|
|
166
182
|
version?: AgentVersionDTO;
|
|
167
183
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
184
|
+
/**
|
|
185
|
+
* AgentConfig contains the shared configuration fields for agent execution.
|
|
186
|
+
* This is embedded by both AgentVersion (DB model) and API request structs.
|
|
187
|
+
* Using Go embedding flattens these fields in JSON serialization.
|
|
188
|
+
*/
|
|
189
|
+
export interface AgentConfig {
|
|
190
|
+
description?: string;
|
|
191
|
+
system_prompt?: string;
|
|
192
|
+
example_prompts?: string[];
|
|
193
|
+
/**
|
|
194
|
+
* Core LLM configuration
|
|
195
|
+
* CoreAppRef is the user-facing ref (namespace/name@shortid) - used in ad-hoc configs, resolved at creation
|
|
196
|
+
*/
|
|
197
|
+
core_app_ref?: string;
|
|
175
198
|
core_app?: CoreAppConfig;
|
|
176
199
|
core_app_input?: any;
|
|
177
200
|
/**
|
|
178
|
-
*
|
|
201
|
+
* Tools (apps, agents, hooks, client tools)
|
|
179
202
|
*/
|
|
180
|
-
tools
|
|
203
|
+
tools?: (AgentTool | undefined)[];
|
|
181
204
|
/**
|
|
182
205
|
* Internal tools configuration (plan, memory, widget, finish)
|
|
183
206
|
*/
|
|
@@ -187,6 +210,19 @@ export interface AgentVersion {
|
|
|
187
210
|
*/
|
|
188
211
|
output_schema?: any;
|
|
189
212
|
}
|
|
213
|
+
export interface AgentVersion {
|
|
214
|
+
BaseModel: BaseModel;
|
|
215
|
+
PermissionModel: PermissionModel;
|
|
216
|
+
agent_id: string;
|
|
217
|
+
/**
|
|
218
|
+
* Short ID for human-readable version references (e.g., "abc123")
|
|
219
|
+
*/
|
|
220
|
+
short_id: string;
|
|
221
|
+
/**
|
|
222
|
+
* ConfigHash for deduplication - SHA256 of config content
|
|
223
|
+
*/
|
|
224
|
+
config_hash: string;
|
|
225
|
+
}
|
|
190
226
|
export interface CoreAppConfigDTO {
|
|
191
227
|
id: string;
|
|
192
228
|
version_id: string;
|
|
@@ -211,67 +247,6 @@ export interface AgentVersionDTO extends BaseModel, PermissionModelDTO {
|
|
|
211
247
|
*/
|
|
212
248
|
output_schema?: any;
|
|
213
249
|
}
|
|
214
|
-
/**
|
|
215
|
-
* AgentRuntimeConfig is a self-contained, flattened config for chat execution.
|
|
216
|
-
* This is either snapshotted from an Agent template or provided ad-hoc.
|
|
217
|
-
* It's portable and can be serialized to JSON or YAML.
|
|
218
|
-
*/
|
|
219
|
-
export interface AgentRuntimeConfig {
|
|
220
|
-
/**
|
|
221
|
-
* Origin tracking (optional, for lineage when snapshotted from template)
|
|
222
|
-
*/
|
|
223
|
-
agent_id?: string;
|
|
224
|
-
agent_version_id?: string;
|
|
225
|
-
/**
|
|
226
|
-
* Identity
|
|
227
|
-
*/
|
|
228
|
-
name: string;
|
|
229
|
-
namespace?: string;
|
|
230
|
-
description?: string;
|
|
231
|
-
/**
|
|
232
|
-
* Prompts
|
|
233
|
-
*/
|
|
234
|
-
system_prompt: string;
|
|
235
|
-
example_prompts?: string[];
|
|
236
|
-
/**
|
|
237
|
-
* Core LLM
|
|
238
|
-
* CoreAppRef is the user-facing ref (namespace/name@shortid) - used in ad-hoc configs
|
|
239
|
-
* CoreApp is the resolved config - populated by backend after resolving CoreAppRef
|
|
240
|
-
*/
|
|
241
|
-
core_app_ref?: string;
|
|
242
|
-
core_app?: CoreAppConfig;
|
|
243
|
-
core_app_input?: any;
|
|
244
|
-
/**
|
|
245
|
-
* Tools (apps, agents, hooks, client tools)
|
|
246
|
-
*/
|
|
247
|
-
tools?: (AgentTool | undefined)[];
|
|
248
|
-
/**
|
|
249
|
-
* Internal tools configuration (plan, memory, widget, finish)
|
|
250
|
-
*/
|
|
251
|
-
internal_tools?: InternalToolsConfig;
|
|
252
|
-
/**
|
|
253
|
-
* Output schema for custom finish tool (sub-agents only)
|
|
254
|
-
*/
|
|
255
|
-
output_schema?: any;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* AgentRuntimeConfigDTO for API responses
|
|
259
|
-
*/
|
|
260
|
-
export interface AgentRuntimeConfigDTO {
|
|
261
|
-
agent_id?: string;
|
|
262
|
-
agent_version_id?: string;
|
|
263
|
-
name: string;
|
|
264
|
-
namespace?: string;
|
|
265
|
-
description?: string;
|
|
266
|
-
system_prompt: string;
|
|
267
|
-
example_prompts?: string[];
|
|
268
|
-
core_app_ref?: string;
|
|
269
|
-
core_app?: CoreAppConfigDTO;
|
|
270
|
-
core_app_input?: any;
|
|
271
|
-
tools?: (AgentToolDTO | undefined)[];
|
|
272
|
-
internal_tools?: InternalToolsConfig;
|
|
273
|
-
output_schema?: any;
|
|
274
|
-
}
|
|
275
250
|
export interface APIRequest<T extends any> {
|
|
276
251
|
timestamp: string;
|
|
277
252
|
data: T;
|
|
@@ -331,7 +306,11 @@ export interface ApiAgentRunRequest {
|
|
|
331
306
|
* For ad-hoc agents, set core_app_ref to the LLM app reference
|
|
332
307
|
* Example: { "core_app_ref": "infsh/claude-sonnet-4@abc123", "system_prompt": "..." }
|
|
333
308
|
*/
|
|
334
|
-
agent_config?:
|
|
309
|
+
agent_config?: AgentConfig;
|
|
310
|
+
/**
|
|
311
|
+
* Optional name for the adhoc agent (used for deduplication and display)
|
|
312
|
+
*/
|
|
313
|
+
agent_name?: string;
|
|
335
314
|
/**
|
|
336
315
|
* The message to send
|
|
337
316
|
*/
|
|
@@ -353,7 +332,11 @@ export interface CreateAgentMessageRequest {
|
|
|
353
332
|
* Ad-hoc agent config - use this instead of Agent for embedded configs
|
|
354
333
|
* If provided, creates a chat with this config directly (no agent reference)
|
|
355
334
|
*/
|
|
356
|
-
agent_config?:
|
|
335
|
+
agent_config?: AgentConfig;
|
|
336
|
+
/**
|
|
337
|
+
* Optional name for the adhoc agent (used for deduplication and display)
|
|
338
|
+
*/
|
|
339
|
+
agent_name?: string;
|
|
357
340
|
}
|
|
358
341
|
export interface CreateAgentMessageResponse {
|
|
359
342
|
user_message?: ChatMessageDTO;
|
|
@@ -671,8 +654,8 @@ export interface AppVersion {
|
|
|
671
654
|
[key: string]: any;
|
|
672
655
|
};
|
|
673
656
|
repository: string;
|
|
674
|
-
|
|
675
|
-
|
|
657
|
+
flow_version_id?: string;
|
|
658
|
+
flow_version?: FlowVersion;
|
|
676
659
|
setup_schema: any;
|
|
677
660
|
input_schema: any;
|
|
678
661
|
output_schema: any;
|
|
@@ -715,7 +698,8 @@ export interface AppVersionDTO extends BaseModel {
|
|
|
715
698
|
[key: string]: any;
|
|
716
699
|
};
|
|
717
700
|
repository: string;
|
|
718
|
-
|
|
701
|
+
flow_version_id?: string;
|
|
702
|
+
flow_version?: FlowVersionDTO;
|
|
719
703
|
setup_schema: any;
|
|
720
704
|
input_schema: any;
|
|
721
705
|
output_schema: any;
|
|
@@ -882,7 +866,13 @@ export interface ChatDTO extends BaseModel, PermissionModelDTO {
|
|
|
882
866
|
parent?: ChatDTO;
|
|
883
867
|
children: (ChatDTO | undefined)[];
|
|
884
868
|
status: ChatStatus;
|
|
885
|
-
|
|
869
|
+
/**
|
|
870
|
+
* Agent version reference
|
|
871
|
+
*/
|
|
872
|
+
agent_id?: string;
|
|
873
|
+
agent?: AgentDTO;
|
|
874
|
+
agent_version_id?: string;
|
|
875
|
+
agent_version?: AgentVersionDTO;
|
|
886
876
|
name: string;
|
|
887
877
|
description: string;
|
|
888
878
|
chat_messages: ChatMessageDTO[];
|
|
@@ -988,14 +978,28 @@ export interface FileDTO extends BaseModel, PermissionModelDTO {
|
|
|
988
978
|
filename: string;
|
|
989
979
|
rating: ContentRating;
|
|
990
980
|
}
|
|
991
|
-
export interface
|
|
981
|
+
export interface FlowVersion {
|
|
992
982
|
BaseModel: BaseModel;
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
983
|
+
/**
|
|
984
|
+
* Permission fields - nullable for migration from existing data
|
|
985
|
+
* After migration these will be populated from parent Flow
|
|
986
|
+
*/
|
|
987
|
+
user_id: string;
|
|
988
|
+
user?: User;
|
|
989
|
+
team_id: string;
|
|
990
|
+
team?: Team;
|
|
991
|
+
flow_id: string;
|
|
992
|
+
/**
|
|
993
|
+
* Short ID for human-readable version references (e.g., "abc123")
|
|
994
|
+
*/
|
|
995
|
+
short_id: string;
|
|
996
|
+
/**
|
|
997
|
+
* ConfigHash for deduplication - SHA256 of config content
|
|
998
|
+
*/
|
|
999
|
+
config_hash: string;
|
|
1000
|
+
/**
|
|
1001
|
+
* Flow graph configuration
|
|
1002
|
+
*/
|
|
999
1003
|
input_schema: any;
|
|
1000
1004
|
input: FlowRunInputs;
|
|
1001
1005
|
output_schema: any;
|
|
@@ -1058,12 +1062,8 @@ export interface OutputFieldMapping {
|
|
|
1058
1062
|
export type OutputMappings = {
|
|
1059
1063
|
[key: string]: OutputFieldMapping;
|
|
1060
1064
|
};
|
|
1061
|
-
export interface
|
|
1062
|
-
|
|
1063
|
-
description: string;
|
|
1064
|
-
card_image: string;
|
|
1065
|
-
thumbnail: string;
|
|
1066
|
-
banner_image: string;
|
|
1065
|
+
export interface FlowVersionDTO extends BaseModel {
|
|
1066
|
+
short_id: string;
|
|
1067
1067
|
input_schema: any;
|
|
1068
1068
|
input: FlowRunInputs;
|
|
1069
1069
|
output_schema: any;
|
|
@@ -1423,10 +1423,9 @@ export interface TaskDTO extends BaseModel, PermissionModelDTO {
|
|
|
1423
1423
|
function: string;
|
|
1424
1424
|
infra: Infra;
|
|
1425
1425
|
workers: string[];
|
|
1426
|
-
flow_id?: string;
|
|
1427
1426
|
flow_run_id?: string;
|
|
1428
|
-
sub_flow_run_id?: string;
|
|
1429
1427
|
chat_id?: string;
|
|
1428
|
+
sub_flow_run_id?: string;
|
|
1430
1429
|
agent_id?: string;
|
|
1431
1430
|
agent_version_id?: string;
|
|
1432
1431
|
agent?: AgentDTO;
|
|
@@ -1704,6 +1703,7 @@ export interface UsageBillingRecord {
|
|
|
1704
1703
|
* Fee breakdown (all in microcents)
|
|
1705
1704
|
*/
|
|
1706
1705
|
total: number;
|
|
1706
|
+
discount: number;
|
|
1707
1707
|
/**
|
|
1708
1708
|
* User debit (total charged)
|
|
1709
1709
|
*/
|
|
@@ -1843,7 +1843,32 @@ export declare const WidgetNodeTypeCheckbox: WidgetNodeType;
|
|
|
1843
1843
|
export declare const WidgetNodeTypeRow: WidgetNodeType;
|
|
1844
1844
|
export declare const WidgetNodeTypeCol: WidgetNodeType;
|
|
1845
1845
|
/**
|
|
1846
|
-
*
|
|
1846
|
+
* Layout node types
|
|
1847
|
+
*/
|
|
1848
|
+
export declare const WidgetNodeTypeBox: WidgetNodeType;
|
|
1849
|
+
export declare const WidgetNodeTypeSpacer: WidgetNodeType;
|
|
1850
|
+
export declare const WidgetNodeTypeDivider: WidgetNodeType;
|
|
1851
|
+
export declare const WidgetNodeTypeForm: WidgetNodeType;
|
|
1852
|
+
/**
|
|
1853
|
+
* Typography node types
|
|
1854
|
+
*/
|
|
1855
|
+
export declare const WidgetNodeTypeTitle: WidgetNodeType;
|
|
1856
|
+
export declare const WidgetNodeTypeCaption: WidgetNodeType;
|
|
1857
|
+
export declare const WidgetNodeTypeLabel: WidgetNodeType;
|
|
1858
|
+
/**
|
|
1859
|
+
* Control node types
|
|
1860
|
+
*/
|
|
1861
|
+
export declare const WidgetNodeTypeTextarea: WidgetNodeType;
|
|
1862
|
+
export declare const WidgetNodeTypeRadioGroup: WidgetNodeType;
|
|
1863
|
+
export declare const WidgetNodeTypeDatePicker: WidgetNodeType;
|
|
1864
|
+
/**
|
|
1865
|
+
* Content node types
|
|
1866
|
+
*/
|
|
1867
|
+
export declare const WidgetNodeTypeIcon: WidgetNodeType;
|
|
1868
|
+
export declare const WidgetNodeTypeChart: WidgetNodeType;
|
|
1869
|
+
export declare const WidgetNodeTypeTransition: WidgetNodeType;
|
|
1870
|
+
/**
|
|
1871
|
+
* Data-bound node types (deprecated - use templates instead)
|
|
1847
1872
|
*/
|
|
1848
1873
|
export declare const WidgetNodeTypePlanList: WidgetNodeType;
|
|
1849
1874
|
export declare const WidgetNodeTypeKeyValue: WidgetNodeType;
|
|
@@ -1867,8 +1892,60 @@ export interface WidgetNode {
|
|
|
1867
1892
|
children?: WidgetNode[];
|
|
1868
1893
|
gap?: number;
|
|
1869
1894
|
/**
|
|
1870
|
-
*
|
|
1871
|
-
|
|
1895
|
+
* Layout props (Box, Row, Col, Form)
|
|
1896
|
+
*/
|
|
1897
|
+
align?: string;
|
|
1898
|
+
justify?: string;
|
|
1899
|
+
padding?: any;
|
|
1900
|
+
background?: any;
|
|
1901
|
+
radius?: string;
|
|
1902
|
+
direction?: string;
|
|
1903
|
+
wrap?: string;
|
|
1904
|
+
flex?: any;
|
|
1905
|
+
/**
|
|
1906
|
+
* Typography props (Text, Title, Caption, Label)
|
|
1907
|
+
*/
|
|
1908
|
+
size?: string;
|
|
1909
|
+
weight?: string;
|
|
1910
|
+
color?: any;
|
|
1911
|
+
textAlign?: string;
|
|
1912
|
+
truncate?: boolean;
|
|
1913
|
+
maxLines?: number;
|
|
1914
|
+
/**
|
|
1915
|
+
* Control props (Input, Textarea, Select, Checkbox, RadioGroup, DatePicker, Button)
|
|
1916
|
+
*/
|
|
1917
|
+
disabled?: boolean;
|
|
1918
|
+
required?: boolean;
|
|
1919
|
+
rows?: number;
|
|
1920
|
+
fieldName?: string;
|
|
1921
|
+
submit?: boolean;
|
|
1922
|
+
pattern?: string;
|
|
1923
|
+
min?: string;
|
|
1924
|
+
max?: string;
|
|
1925
|
+
clearable?: boolean;
|
|
1926
|
+
/**
|
|
1927
|
+
* Content props (Icon, Spacer, Divider, Chart)
|
|
1928
|
+
*/
|
|
1929
|
+
iconName?: string;
|
|
1930
|
+
spacing?: any;
|
|
1931
|
+
minSize?: any;
|
|
1932
|
+
height?: any;
|
|
1933
|
+
width?: any;
|
|
1934
|
+
/**
|
|
1935
|
+
* Chart specific props
|
|
1936
|
+
*/
|
|
1937
|
+
chartData?: any;
|
|
1938
|
+
chartSeries?: any;
|
|
1939
|
+
xAxis?: any;
|
|
1940
|
+
showYAxis?: boolean;
|
|
1941
|
+
showLegend?: boolean;
|
|
1942
|
+
showTooltip?: boolean;
|
|
1943
|
+
/**
|
|
1944
|
+
* Form-specific props
|
|
1945
|
+
*/
|
|
1946
|
+
onSubmitAction?: WidgetAction;
|
|
1947
|
+
/**
|
|
1948
|
+
* Data binding (deprecated - use templates instead)
|
|
1872
1949
|
*/
|
|
1873
1950
|
dataKey?: string;
|
|
1874
1951
|
}
|
package/dist/types.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.DeviceAuthStatusExpired = exports.DeviceAuthStatusApproved = exports.DeviceAuthStatusPending = exports.IntegrationTypeTelegram = exports.IntegrationTypeTeams = exports.IntegrationTypeDiscord = exports.IntegrationTypeSlack = exports.ChatMessageContentTypeTool = exports.ChatMessageContentTypeFile = exports.ChatMessageContentTypeImage = exports.ChatMessageContentTypeReasoning = exports.ChatMessageContentTypeText = exports.ChatMessageStatusCancelled = exports.ChatMessageStatusFailed = exports.ChatMessageStatusReady = exports.ChatMessageStatusPending = exports.ChatMessageRoleTool = exports.ChatMessageRoleAssistant = exports.ChatMessageRoleUser = exports.ChatMessageRoleSystem = exports.PlanStepStatusCancelled = exports.PlanStepStatusCompleted = exports.PlanStepStatusInProgress = exports.PlanStepStatusPending = exports.ChatStatusCompleted = exports.ChatStatusAwaitingInput = exports.ChatStatusIdle = exports.ChatStatusBusy = exports.VisibilityUnlisted = exports.VisibilityPublic = exports.VisibilityPrivate = exports.GPUTypeApple = exports.GPUTypeAMD = exports.GPUTypeNvidia = exports.GPUTypeIntel = exports.GPUTypeNone = exports.GPUTypeAny = exports.AppCategoryFlow = exports.AppCategoryOther = exports.AppCategory3D = exports.AppCategoryChat = exports.AppCategoryText = exports.AppCategoryAudio = exports.AppCategoryVideo = exports.AppCategoryImage = exports.ToolTypeInternal = exports.ToolTypeClient = exports.ToolTypeHook = exports.ToolTypeAgent = exports.ToolTypeApp = void 0;
|
|
5
5
|
exports.TaskStatusCancelled = exports.TaskStatusFailed = exports.TaskStatusCompleted = exports.TaskStatusUploading = exports.TaskStatusCancelling = exports.TaskStatusRunning = exports.TaskStatusSettingUp = exports.TaskStatusServing = exports.TaskStatusPreparing = exports.TaskStatusScheduled = exports.TaskStatusQueued = exports.TaskStatusReceived = exports.TaskStatusUnknown = exports.InstanceStatusDeleted = exports.InstanceStatusActive = exports.InstanceStatusPending = exports.CloudShade = exports.CloudVultr = exports.CloudMassedCompute = exports.CloudDatacrunch = exports.CloudPaperspace = exports.CloudOblivus = exports.CloudJarvisLabs = exports.CloudLatitude = exports.CloudRunPod = exports.CloudTensorDock = exports.CloudLambdaLabs = exports.CloudAzure = exports.CloudAWS = exports.ContentUnrated = exports.ContentSelfHarm = exports.ContentDrugs = exports.ContentGore = exports.ContentViolenceGraphic = exports.ContentViolenceNonGraphic = exports.ContentSexualExplicit = exports.ContentSexualSuggestive = exports.ContentSafe = exports.ProjectTypeOther = exports.ProjectTypeFlow = exports.ProjectTypeApp = exports.ProjectTypeAgent = exports.EngineStatusStopped = exports.EngineStatusStopping = exports.EngineStatusPending = exports.EngineStatusRunning = exports.DeviceAuthStatusLoading = exports.DeviceAuthStatusInvalid = exports.DeviceAuthStatusValid = exports.DeviceAuthStatusDenied = void 0;
|
|
6
6
|
exports.WidgetNodeTypeButton = exports.WidgetNodeTypeBadge = exports.WidgetNodeTypeImage = exports.WidgetNodeTypeMarkdown = exports.WidgetNodeTypeText = exports.RoleSystem = exports.RoleAdmin = exports.RoleUser = exports.RoleGuest = exports.VideoRes4K = exports.VideoRes1440P = exports.VideoRes1080P = exports.VideoRes720P = exports.VideoRes480P = exports.MetaItemTypeRaw = exports.MetaItemTypeAudio = exports.MetaItemTypeVideo = exports.MetaItemTypeImage = exports.MetaItemTypeText = exports.UsageEventResourceTierCloud = exports.UsageEventResourceTierPrivate = exports.PaymentRecordTypeAutoRecharge = exports.PaymentRecordTypeCheckout = exports.PaymentRecordStatusExpired = exports.PaymentRecordStatusFailed = exports.PaymentRecordStatusComplete = exports.PaymentRecordStatusPending = exports.TransactionTypeDebit = exports.TransactionTypeCredit = exports.ToolInvocationStatusCancelled = exports.ToolInvocationStatusFailed = exports.ToolInvocationStatusCompleted = exports.ToolInvocationStatusAwaitingApproval = exports.ToolInvocationStatusAwaitingInput = exports.ToolInvocationStatusInProgress = exports.ToolInvocationStatusPending = exports.TeamRoleMember = exports.TeamRoleAdmin = exports.TeamRoleOwner = exports.TeamTypeSystem = exports.TeamTypeTeam = exports.TeamTypePersonal = exports.TaskLogTypeTask = exports.TaskLogTypeSetup = exports.TaskLogTypeServe = exports.TaskLogTypeRun = exports.TaskLogTypeBuild = exports.InfraPrivateFirst = exports.InfraCloud = exports.InfraPrivate = void 0;
|
|
7
|
-
exports.WidgetNodeTypeStatusBadge = exports.WidgetNodeTypeKeyValue = exports.WidgetNodeTypePlanList = exports.WidgetNodeTypeCol = exports.WidgetNodeTypeRow = exports.WidgetNodeTypeCheckbox = exports.WidgetNodeTypeSelect = exports.WidgetNodeTypeInput = void 0;
|
|
7
|
+
exports.WidgetNodeTypeStatusBadge = exports.WidgetNodeTypeKeyValue = exports.WidgetNodeTypePlanList = exports.WidgetNodeTypeTransition = exports.WidgetNodeTypeChart = exports.WidgetNodeTypeIcon = exports.WidgetNodeTypeDatePicker = exports.WidgetNodeTypeRadioGroup = exports.WidgetNodeTypeTextarea = exports.WidgetNodeTypeLabel = exports.WidgetNodeTypeCaption = exports.WidgetNodeTypeTitle = exports.WidgetNodeTypeForm = exports.WidgetNodeTypeDivider = exports.WidgetNodeTypeSpacer = exports.WidgetNodeTypeBox = exports.WidgetNodeTypeCol = exports.WidgetNodeTypeRow = exports.WidgetNodeTypeCheckbox = exports.WidgetNodeTypeSelect = exports.WidgetNodeTypeInput = void 0;
|
|
8
8
|
exports.ToolTypeApp = "app"; // App tools - creates a Task
|
|
9
9
|
exports.ToolTypeAgent = "agent"; // Sub-agent tools - creates a sub-Chat
|
|
10
10
|
exports.ToolTypeHook = "hook"; // Webhook tools - HTTP POST to external URL
|
|
@@ -176,8 +176,33 @@ exports.WidgetNodeTypeCheckbox = "checkbox";
|
|
|
176
176
|
exports.WidgetNodeTypeRow = "row";
|
|
177
177
|
exports.WidgetNodeTypeCol = "col";
|
|
178
178
|
/**
|
|
179
|
-
*
|
|
179
|
+
* Layout node types
|
|
180
180
|
*/
|
|
181
|
-
exports.
|
|
182
|
-
exports.
|
|
183
|
-
exports.
|
|
181
|
+
exports.WidgetNodeTypeBox = "box";
|
|
182
|
+
exports.WidgetNodeTypeSpacer = "spacer";
|
|
183
|
+
exports.WidgetNodeTypeDivider = "divider";
|
|
184
|
+
exports.WidgetNodeTypeForm = "form";
|
|
185
|
+
/**
|
|
186
|
+
* Typography node types
|
|
187
|
+
*/
|
|
188
|
+
exports.WidgetNodeTypeTitle = "title";
|
|
189
|
+
exports.WidgetNodeTypeCaption = "caption";
|
|
190
|
+
exports.WidgetNodeTypeLabel = "label";
|
|
191
|
+
/**
|
|
192
|
+
* Control node types
|
|
193
|
+
*/
|
|
194
|
+
exports.WidgetNodeTypeTextarea = "textarea";
|
|
195
|
+
exports.WidgetNodeTypeRadioGroup = "radio-group";
|
|
196
|
+
exports.WidgetNodeTypeDatePicker = "date-picker";
|
|
197
|
+
/**
|
|
198
|
+
* Content node types
|
|
199
|
+
*/
|
|
200
|
+
exports.WidgetNodeTypeIcon = "icon";
|
|
201
|
+
exports.WidgetNodeTypeChart = "chart";
|
|
202
|
+
exports.WidgetNodeTypeTransition = "transition";
|
|
203
|
+
/**
|
|
204
|
+
* Data-bound node types (deprecated - use templates instead)
|
|
205
|
+
*/
|
|
206
|
+
exports.WidgetNodeTypePlanList = "plan-list";
|
|
207
|
+
exports.WidgetNodeTypeKeyValue = "key-value";
|
|
208
|
+
exports.WidgetNodeTypeStatusBadge = "status-badge";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inferencesh/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "Official JavaScript/TypeScript SDK for inference.sh - Run AI models with a simple API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -10,11 +10,41 @@
|
|
|
10
10
|
"import": "./dist/index.mjs",
|
|
11
11
|
"require": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./proxy": {
|
|
15
|
+
"import": "./dist/proxy/index.mjs",
|
|
16
|
+
"require": "./dist/proxy/index.js",
|
|
17
|
+
"types": "./dist/proxy/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./proxy/nextjs": {
|
|
20
|
+
"import": "./dist/proxy/nextjs.mjs",
|
|
21
|
+
"require": "./dist/proxy/nextjs.js",
|
|
22
|
+
"types": "./dist/proxy/nextjs.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./proxy/express": {
|
|
25
|
+
"import": "./dist/proxy/express.mjs",
|
|
26
|
+
"require": "./dist/proxy/express.js",
|
|
27
|
+
"types": "./dist/proxy/express.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./proxy/hono": {
|
|
30
|
+
"import": "./dist/proxy/hono.mjs",
|
|
31
|
+
"require": "./dist/proxy/hono.js",
|
|
32
|
+
"types": "./dist/proxy/hono.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./proxy/remix": {
|
|
35
|
+
"import": "./dist/proxy/remix.mjs",
|
|
36
|
+
"require": "./dist/proxy/remix.js",
|
|
37
|
+
"types": "./dist/proxy/remix.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./proxy/svelte": {
|
|
40
|
+
"import": "./dist/proxy/svelte.mjs",
|
|
41
|
+
"require": "./dist/proxy/svelte.js",
|
|
42
|
+
"types": "./dist/proxy/svelte.d.ts"
|
|
13
43
|
}
|
|
14
44
|
},
|
|
15
45
|
"scripts": {
|
|
16
46
|
"build": "tsc && npm run build:esm",
|
|
17
|
-
"build:esm": "echo 'export * from \"./index.js\";' > dist/index.mjs",
|
|
47
|
+
"build:esm": "echo 'export * from \"./index.js\";' > dist/index.mjs && mkdir -p dist/proxy && for f in dist/proxy/*.js; do echo \"export * from \\\"./$(basename $f)\\\";\" > \"${f%.js}.mjs\"; done",
|
|
18
48
|
"test": "jest --testPathIgnorePatterns=integration",
|
|
19
49
|
"test:integration": "jest --testPathPattern=integration --testTimeout=120000 --runInBand",
|
|
20
50
|
"test:all": "jest --testTimeout=120000 --runInBand",
|
|
@@ -39,7 +69,10 @@
|
|
|
39
69
|
"typescript",
|
|
40
70
|
"image-generation",
|
|
41
71
|
"llm",
|
|
42
|
-
"generative-ai"
|
|
72
|
+
"generative-ai",
|
|
73
|
+
"proxy",
|
|
74
|
+
"nextjs",
|
|
75
|
+
"express"
|
|
43
76
|
],
|
|
44
77
|
"author": "Okaris <hello@inference.sh>",
|
|
45
78
|
"license": "MIT",
|
|
@@ -58,18 +91,42 @@
|
|
|
58
91
|
"eventsource": "^4.0.0"
|
|
59
92
|
},
|
|
60
93
|
"devDependencies": {
|
|
94
|
+
"@sveltejs/kit": "^2.0.0",
|
|
95
|
+
"@types/express": "^5.0.0",
|
|
61
96
|
"@types/jest": "^29.5.12",
|
|
62
97
|
"@types/node": "^24.1.0",
|
|
63
98
|
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
64
99
|
"@typescript-eslint/parser": "^8.38.0",
|
|
65
100
|
"eslint": "^9.32.0",
|
|
66
101
|
"eslint-config-prettier": "^10.1.8",
|
|
102
|
+
"hono": "^4.0.0",
|
|
67
103
|
"jest": "^29.7.0",
|
|
104
|
+
"next": "^15.0.0",
|
|
68
105
|
"prettier": "^3.6.2",
|
|
69
106
|
"rimraf": "^6.0.1",
|
|
70
107
|
"ts-jest": "^29.2.5",
|
|
71
108
|
"typescript": "^5.8.3"
|
|
72
109
|
},
|
|
110
|
+
"peerDependencies": {
|
|
111
|
+
"@sveltejs/kit": ">=2.0.0",
|
|
112
|
+
"express": ">=4.0.0",
|
|
113
|
+
"hono": ">=4.0.0",
|
|
114
|
+
"next": ">=13.0.0"
|
|
115
|
+
},
|
|
116
|
+
"peerDependenciesMeta": {
|
|
117
|
+
"next": {
|
|
118
|
+
"optional": true
|
|
119
|
+
},
|
|
120
|
+
"express": {
|
|
121
|
+
"optional": true
|
|
122
|
+
},
|
|
123
|
+
"hono": {
|
|
124
|
+
"optional": true
|
|
125
|
+
},
|
|
126
|
+
"@sveltejs/kit": {
|
|
127
|
+
"optional": true
|
|
128
|
+
}
|
|
129
|
+
},
|
|
73
130
|
"files": [
|
|
74
131
|
"dist",
|
|
75
132
|
"README.md",
|
package/dist/agent.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Headless Agent SDK
|
|
3
|
-
*
|
|
4
|
-
* Chat with AI agents without UI dependencies.
|
|
5
|
-
*/
|
|
6
|
-
import { ChatDTO, ChatMessageDTO, AgentRuntimeConfig } from './types';
|
|
7
|
-
export interface AgentConfig {
|
|
8
|
-
apiKey: string;
|
|
9
|
-
baseUrl?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Ad-hoc agent configuration - extends AgentRuntimeConfig with core_app_ref required
|
|
13
|
-
* Uses Partial to make name/system_prompt optional for ad-hoc usage
|
|
14
|
-
*/
|
|
15
|
-
export type AdHocAgentOptions = Partial<AgentRuntimeConfig> & {
|
|
16
|
-
/** Core LLM app ref: namespace/name@shortid (required for ad-hoc agents) */
|
|
17
|
-
core_app_ref: string;
|
|
18
|
-
};
|
|
19
|
-
/** Template agent configuration */
|
|
20
|
-
export interface TemplateAgentOptions {
|
|
21
|
-
/** Agent reference: namespace/name@version (e.g., "my-org/assistant@abc123") */
|
|
22
|
-
agent: string;
|
|
23
|
-
}
|
|
24
|
-
export type AgentOptions = AdHocAgentOptions | TemplateAgentOptions;
|
|
25
|
-
export interface SendMessageOptions {
|
|
26
|
-
/** File attachments (Blob or base64 data URI) */
|
|
27
|
-
files?: (Blob | string)[];
|
|
28
|
-
/** Callback for message updates */
|
|
29
|
-
onMessage?: (message: ChatMessageDTO) => void;
|
|
30
|
-
/** Callback for chat updates */
|
|
31
|
-
onChat?: (chat: ChatDTO) => void;
|
|
32
|
-
/** Callback when a client tool needs execution */
|
|
33
|
-
onToolCall?: (invocation: {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
args: Record<string, unknown>;
|
|
37
|
-
}) => void;
|
|
38
|
-
}
|
|
39
|
-
export declare class Agent {
|
|
40
|
-
private readonly apiKey;
|
|
41
|
-
private readonly baseUrl;
|
|
42
|
-
private readonly options;
|
|
43
|
-
private chatId;
|
|
44
|
-
private stream;
|
|
45
|
-
constructor(config: AgentConfig, options: AgentOptions);
|
|
46
|
-
/** Get current chat ID */
|
|
47
|
-
get currentChatId(): string | null;
|
|
48
|
-
/** Send a message to the agent */
|
|
49
|
-
sendMessage(text: string, options?: SendMessageOptions): Promise<ChatMessageDTO>;
|
|
50
|
-
/** Get chat by ID */
|
|
51
|
-
getChat(chatId?: string): Promise<ChatDTO | null>;
|
|
52
|
-
/** Stop the current chat generation */
|
|
53
|
-
stopChat(): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Submit a tool result
|
|
56
|
-
* @param toolInvocationId - The tool invocation ID
|
|
57
|
-
* @param resultOrAction - Either a raw result string, or an object with action and optional form_data (will be JSON-serialized)
|
|
58
|
-
*/
|
|
59
|
-
submitToolResult(toolInvocationId: string, resultOrAction: string | {
|
|
60
|
-
action: {
|
|
61
|
-
type: string;
|
|
62
|
-
payload?: Record<string, unknown>;
|
|
63
|
-
};
|
|
64
|
-
form_data?: Record<string, unknown>;
|
|
65
|
-
}): Promise<void>;
|
|
66
|
-
/** Stop streaming and cleanup */
|
|
67
|
-
disconnect(): void;
|
|
68
|
-
/** Reset the agent (start fresh chat) */
|
|
69
|
-
reset(): void;
|
|
70
|
-
/** Upload a file and return the file object */
|
|
71
|
-
uploadFile(data: Blob | string): Promise<{
|
|
72
|
-
uri: string;
|
|
73
|
-
content_type?: string;
|
|
74
|
-
}>;
|
|
75
|
-
private startStreaming;
|
|
76
|
-
private createEventSource;
|
|
77
|
-
private request;
|
|
78
|
-
}
|