@inferencesh/sdk 0.5.7 → 0.5.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.
@@ -76,6 +76,17 @@ describeIfApiKey('Integration Tests', () => {
76
76
  expect(result.id).toBeDefined();
77
77
  }, 30000);
78
78
  });
79
+ describe('Webhook', () => {
80
+ it('should deliver webhook on task completion', async () => {
81
+ const result = await client.run({
82
+ app: TEST_APP,
83
+ input: { template: 'Webhook test {1}', strings: ['hello'] },
84
+ webhook: 'https://webhook.site/bbe9ba01-3ab2-4056-a1b1-1cf6969987d5',
85
+ });
86
+ expect(result.status).toBe(TaskStatusCompleted);
87
+ expect(result.output).toBeDefined();
88
+ }, 60000);
89
+ });
79
90
  describe('Error Handling', () => {
80
91
  it('should throw an error for non-existent app', async () => {
81
92
  await expect(client.run({
package/dist/types.d.ts CHANGED
@@ -349,6 +349,11 @@ export interface ApiAppRunRequest {
349
349
  * If true, returns SSE stream instead of JSON response
350
350
  */
351
351
  stream?: boolean;
352
+ /**
353
+ * If true, holds the connection open until the task reaches a terminal state and returns the final result.
354
+ * Mutually exclusive with Stream.
355
+ */
356
+ wait?: boolean;
352
357
  /**
353
358
  * Function to call on multi-function apps (defaults to "run" or app's default_function)
354
359
  */
@@ -436,6 +441,14 @@ export interface CreateAgentMessageResponse {
436
441
  export interface ToolResultRequest {
437
442
  result: string;
438
443
  }
444
+ /**
445
+ * WebhookEvent is the envelope for task webhook deliveries.
446
+ */
447
+ export interface WebhookEvent<T extends any> {
448
+ event: string;
449
+ timestamp: string;
450
+ data: T;
451
+ }
439
452
  /**
440
453
  * HookPayload represents the request body sent to a webhook when a hook tool is invoked
441
454
  */
@@ -720,6 +733,16 @@ export interface EngineConfig {
720
733
  network_name: string;
721
734
  cache_path: string;
722
735
  gpus: string[];
736
+ /**
737
+ * CallbackBasePort overrides the base port for engine↔worker callback APIs.
738
+ * If 0, derived from EnginePort: 5000 + (enginePort - 8163) * 100.
739
+ */
740
+ callback_base_port: number;
741
+ /**
742
+ * EngineInternalAPIURL is the URL workers use to reach the engine's main API.
743
+ * If empty, derived as http://host.docker.internal:{EnginePort}.
744
+ */
745
+ engine_internal_api_url: string;
723
746
  }
724
747
  export type AppCategory = string;
725
748
  export declare const AppCategoryImage: AppCategory;
@@ -1188,6 +1211,7 @@ export declare const DeviceAuthStatusLoading: DeviceAuthStatus;
1188
1211
  export type EngineStatus = string;
1189
1212
  export declare const EngineStatusRunning: EngineStatus;
1190
1213
  export declare const EngineStatusPending: EngineStatus;
1214
+ export declare const EngineStatusDraining: EngineStatus;
1191
1215
  export declare const EngineStatusStopping: EngineStatus;
1192
1216
  export declare const EngineStatusStopped: EngineStatus;
1193
1217
  export interface EngineState extends BaseModel, PermissionModel {
@@ -1979,7 +2003,7 @@ export interface Task extends BaseModel, PermissionModel {
1979
2003
  setup?: any;
1980
2004
  input: any;
1981
2005
  output: any;
1982
- error: string;
2006
+ error?: string;
1983
2007
  rating: ContentRating;
1984
2008
  /**
1985
2009
  * Relationships
@@ -2054,7 +2078,7 @@ export interface TaskDTO extends BaseModel, PermissionModelDTO {
2054
2078
  setup?: any;
2055
2079
  input: any;
2056
2080
  output: any;
2057
- error: string;
2081
+ error?: string;
2058
2082
  rating: ContentRating;
2059
2083
  events: TaskEvent[];
2060
2084
  logs: TaskLog[];
package/dist/types.js CHANGED
@@ -80,6 +80,7 @@ export const DeviceAuthStatusInvalid = "invalid";
80
80
  export const DeviceAuthStatusLoading = "loading";
81
81
  export const EngineStatusRunning = "running";
82
82
  export const EngineStatusPending = "pending";
83
+ export const EngineStatusDraining = "draining";
83
84
  export const EngineStatusStopping = "stopping";
84
85
  export const EngineStatusStopped = "stopped";
85
86
  export const FlowRunStatusUnknown = 0; // 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
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",