@inferencesh/sdk 0.2.1 → 0.4.1

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 CHANGED
@@ -77,10 +77,10 @@ export declare class Inference {
77
77
  * @param options - Run options for waiting, updates, and reconnection
78
78
  * @returns The completed task result
79
79
  *
80
- * App reference format: `namespace/name@shortid` (version is required)
80
+ * App reference format: `namespace/name@shortid` or `namespace/name@shortid:function`
81
81
  *
82
- * The short ID ensures your code always runs the same version,
83
- * protecting against breaking changes from app updates.
82
+ * The short ID ensures your code always runs the same version.
83
+ * You can optionally specify a function name to run a specific entry point.
84
84
  *
85
85
  * @example
86
86
  * ```typescript
package/dist/client.js CHANGED
@@ -82,7 +82,13 @@ class Inference {
82
82
  }
83
83
  const apiResponse = data;
84
84
  if (!apiResponse?.success) {
85
- throw new errors_1.InferenceError(response.status, apiResponse?.error?.message || 'Request failed', responseText);
85
+ // Build a helpful error message
86
+ let errorMessage = apiResponse?.error?.message;
87
+ if (!errorMessage) {
88
+ // No error message provided - show the response for debugging
89
+ errorMessage = `Request failed (success=false). Response: ${responseText.slice(0, 500)}`;
90
+ }
91
+ throw new errors_1.InferenceError(response.status, errorMessage, responseText);
86
92
  }
87
93
  return apiResponse.data;
88
94
  }
@@ -150,10 +156,10 @@ class Inference {
150
156
  * @param options - Run options for waiting, updates, and reconnection
151
157
  * @returns The completed task result
152
158
  *
153
- * App reference format: `namespace/name@shortid` (version is required)
159
+ * App reference format: `namespace/name@shortid` or `namespace/name@shortid:function`
154
160
  *
155
- * The short ID ensures your code always runs the same version,
156
- * protecting against breaking changes from app updates.
161
+ * The short ID ensures your code always runs the same version.
162
+ * You can optionally specify a function name to run a specific entry point.
157
163
  *
158
164
  * @example
159
165
  * ```typescript
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Integration tests for @inferencesh/sdk
3
+ *
4
+ * These tests hit the real API and require INFERENCE_API_KEY to be set.
5
+ * Run with: npm run test:integration
6
+ *
7
+ * @jest-environment node
8
+ */
9
+ export {};
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /**
3
+ * Integration tests for @inferencesh/sdk
4
+ *
5
+ * These tests hit the real API and require INFERENCE_API_KEY to be set.
6
+ * Run with: npm run test:integration
7
+ *
8
+ * @jest-environment node
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ const client_1 = require("./client");
12
+ const types_1 = require("./types");
13
+ // Skip all tests if no API key is set
14
+ const API_KEY = process.env.INFERENCE_API_KEY;
15
+ const BASE_URL = process.env.INFERENCE_BASE_URL || 'https://api.inference.sh';
16
+ // Use a pinned app version that's known to work
17
+ const TEST_APP = 'infsh/text-templating@53bk0yzk';
18
+ const describeIfApiKey = API_KEY ? describe : describe.skip;
19
+ describeIfApiKey('Integration Tests', () => {
20
+ let client;
21
+ beforeAll(() => {
22
+ client = new client_1.Inference({
23
+ apiKey: API_KEY,
24
+ baseUrl: BASE_URL,
25
+ });
26
+ });
27
+ describe('Basic Run', () => {
28
+ it('should run a simple task and wait for completion', async () => {
29
+ const result = await client.run({
30
+ app: TEST_APP,
31
+ input: { template: 'Hello {1}!', strings: ['Jest'] },
32
+ });
33
+ expect(result).toBeDefined();
34
+ expect(result.id).toBeDefined();
35
+ expect(result.status).toBe(types_1.TaskStatusCompleted);
36
+ expect(result.output).toBeDefined();
37
+ }, 60000); // 60 second timeout for API call
38
+ });
39
+ describe('Run with Updates', () => {
40
+ it('should receive status updates during task execution', async () => {
41
+ const updates = [];
42
+ const result = await client.run({
43
+ app: TEST_APP,
44
+ input: { template: 'Testing {1}', strings: ['SDK'] },
45
+ }, {
46
+ onUpdate: (update) => {
47
+ updates.push(update.status);
48
+ },
49
+ });
50
+ expect(result.status).toBe(types_1.TaskStatusCompleted);
51
+ expect(updates.length).toBeGreaterThan(0);
52
+ }, 60000);
53
+ });
54
+ describe('Fire and Forget', () => {
55
+ it('should submit a task without waiting for completion', async () => {
56
+ const result = await client.run({
57
+ app: TEST_APP,
58
+ input: { template: '{1}', strings: ['Fire and forget'] },
59
+ }, { wait: false });
60
+ expect(result).toBeDefined();
61
+ expect(result.id).toBeDefined();
62
+ // Status should NOT be completed yet (task was just submitted)
63
+ expect(result.status).not.toBe(types_1.TaskStatusCompleted);
64
+ expect(result.status).not.toBe(types_1.TaskStatusFailed);
65
+ }, 30000);
66
+ });
67
+ describe('Factory Function', () => {
68
+ it('should work with lowercase inference() factory', async () => {
69
+ const factoryClient = (0, client_1.inference)({
70
+ apiKey: API_KEY,
71
+ baseUrl: BASE_URL,
72
+ });
73
+ const result = await factoryClient.run({
74
+ app: TEST_APP,
75
+ input: { template: '{1}', strings: ['Factory test'] },
76
+ }, { wait: false });
77
+ expect(result).toBeDefined();
78
+ expect(result.id).toBeDefined();
79
+ }, 30000);
80
+ });
81
+ describe('Error Handling', () => {
82
+ it('should throw an error for non-existent app', async () => {
83
+ await expect(client.run({
84
+ app: 'non-existent/app-that-does-not-exist@xyz123',
85
+ input: {},
86
+ }, { wait: false })).rejects.toThrow();
87
+ }, 30000);
88
+ });
89
+ });
90
+ // Add a simple test that always runs to ensure Jest doesn't complain about no tests
91
+ describe('Integration Test Setup', () => {
92
+ it('should have API key check', () => {
93
+ if (!API_KEY) {
94
+ console.log('⚠️ Skipping integration tests - INFERENCE_API_KEY not set');
95
+ }
96
+ expect(true).toBe(true);
97
+ });
98
+ });
package/dist/types.d.ts CHANGED
@@ -143,7 +143,6 @@ export interface ClientToolConfigDTO {
143
143
  export interface CoreAppConfig {
144
144
  id: string;
145
145
  version_id: string;
146
- app?: App;
147
146
  }
148
147
  export interface Agent {
149
148
  BaseModel: BaseModel;
@@ -312,10 +311,6 @@ export interface ApiAppRunRequest {
312
311
  */
313
312
  stream?: boolean;
314
313
  }
315
- /**
316
- * ApiTaskRequest is an alias for ApiAppRunRequest (deprecated name)
317
- */
318
- export type ApiTaskRequest = ApiAppRunRequest;
319
314
  /**
320
315
  * ApiAgentRunRequest is the request body for /agents/run endpoint.
321
316
  * Supports both template agents and ad-hoc agents.
@@ -346,10 +341,6 @@ export interface ApiAgentRunRequest {
346
341
  */
347
342
  stream?: boolean;
348
343
  }
349
- /**
350
- * ApiAgentMessageRequest is an alias for ApiAgentRunRequest (deprecated name)
351
- */
352
- export type ApiAgentMessageRequest = ApiAgentRunRequest;
353
344
  export interface CreateAgentMessageRequest {
354
345
  chat_id?: string;
355
346
  agent_id?: string;
@@ -364,18 +355,10 @@ export interface CreateAgentMessageRequest {
364
355
  */
365
356
  agent_config?: AgentRuntimeConfig;
366
357
  }
367
- export interface CreateChatMessageResponse {
358
+ export interface CreateAgentMessageResponse {
368
359
  user_message?: ChatMessageDTO;
369
360
  assistant_message?: ChatMessageDTO;
370
361
  }
371
- /**
372
- * WidgetActionRequest represents a user's response to a widget
373
- * @deprecated Use ToolResultRequest with action field instead
374
- */
375
- export interface WidgetActionRequest {
376
- action: WidgetAction;
377
- form_data?: WidgetFormData;
378
- }
379
362
  /**
380
363
  * ToolResultRequest represents a tool result submission
381
364
  * For widget actions, clients should JSON-serialize { action, form_data } as the result string
@@ -425,6 +408,10 @@ export interface PartialFile {
425
408
  filename?: string;
426
409
  }
427
410
  export interface FileCreateRequest {
411
+ /**
412
+ * Category determines the storage path prefix: "uploads" (default), "inputs", "outputs", "repos"
413
+ */
414
+ category?: string;
428
415
  files: PartialFile[];
429
416
  }
430
417
  export interface CreateFlowRequest {
@@ -662,6 +649,16 @@ export interface AppVariant {
662
649
  };
663
650
  python: string;
664
651
  }
652
+ /**
653
+ * AppFunction represents a callable entry point within an app version.
654
+ * Each function has its own input/output schema while sharing the app's setup.
655
+ */
656
+ export interface AppFunction {
657
+ name: string;
658
+ description?: string;
659
+ input_schema: any;
660
+ output_schema: any;
661
+ }
665
662
  export interface AppVersion {
666
663
  BaseModel: BaseModel;
667
664
  /**
@@ -679,6 +676,15 @@ export interface AppVersion {
679
676
  setup_schema: any;
680
677
  input_schema: any;
681
678
  output_schema: any;
679
+ /**
680
+ * Functions contains the callable entry points for this app version.
681
+ * Each function has its own input/output schema. If nil/empty, the app uses legacy single-function mode
682
+ * with InputSchema/OutputSchema at the version level.
683
+ */
684
+ functions?: {
685
+ [key: string]: AppFunction;
686
+ };
687
+ default_function?: string;
682
688
  variants: {
683
689
  [key: string]: AppVariant;
684
690
  };
@@ -713,6 +719,10 @@ export interface AppVersionDTO extends BaseModel {
713
719
  setup_schema: any;
714
720
  input_schema: any;
715
721
  output_schema: any;
722
+ functions?: {
723
+ [key: string]: AppFunction;
724
+ };
725
+ default_function?: string;
716
726
  variants: {
717
727
  [key: string]: AppVariant;
718
728
  };
@@ -757,9 +767,7 @@ export interface PermissionModelDTO {
757
767
  export type ChatStatus = string;
758
768
  export declare const ChatStatusBusy: ChatStatus;
759
769
  export declare const ChatStatusIdle: ChatStatus;
760
- /**
761
- * ChatStatusWaitingInput ChatStatus = "waiting_input"
762
- */
770
+ export declare const ChatStatusAwaitingInput: ChatStatus;
763
771
  export declare const ChatStatusCompleted: ChatStatus;
764
772
  export interface IntegrationContext {
765
773
  integration_type?: IntegrationType;
@@ -771,6 +779,7 @@ export interface IntegrationContext {
771
779
  export interface ChatData {
772
780
  plan_steps: PlanStep[];
773
781
  memory: StringEncodedMap;
782
+ always_allowed_tools: string[];
774
783
  }
775
784
  /**
776
785
  * PlanStep represents a step in an agent's execution plan
@@ -1014,6 +1023,7 @@ export interface FlowNodeData {
1014
1023
  app?: AppDTO;
1015
1024
  app_id: string;
1016
1025
  app_version_id: string;
1026
+ function?: string;
1017
1027
  infra: Infra;
1018
1028
  workers: string[];
1019
1029
  setup?: any;
@@ -1347,6 +1357,19 @@ export interface GPU {
1347
1357
  memory_total: number;
1348
1358
  temperature: number;
1349
1359
  }
1360
+ /**
1361
+ * TaskStatus represents the state of a task in its lifecycle.
1362
+ * DESIGN NOTES:
1363
+ * - Stored as int in DB for compact storage and efficient equality checks.
1364
+ * - The int values are ordered to allow SQL range queries (status < ?) for performance.
1365
+ * - IMPORTANT: If you add new statuses in the MIDDLE of the sequence, you must:
1366
+ * 1. Write a migration to shift existing values
1367
+ * 2. Update SDKs and frontends
1368
+ * - ALTERNATIVE: Add new statuses at the END to avoid migrations, but then you
1369
+ * cannot use range comparisons (< >) and must use explicit checks (IN, NOT IN).
1370
+ * - Kubernetes/Temporal use strings and explicit checks for maximum flexibility.
1371
+ * Consider switching to strings if range comparisons become a maintenance burden.
1372
+ */
1350
1373
  export type TaskStatus = number;
1351
1374
  export declare const TaskStatusUnknown: TaskStatus;
1352
1375
  export declare const TaskStatusReceived: TaskStatus;
@@ -1356,6 +1379,7 @@ export declare const TaskStatusPreparing: TaskStatus;
1356
1379
  export declare const TaskStatusServing: TaskStatus;
1357
1380
  export declare const TaskStatusSettingUp: TaskStatus;
1358
1381
  export declare const TaskStatusRunning: TaskStatus;
1382
+ export declare const TaskStatusCancelling: TaskStatus;
1359
1383
  export declare const TaskStatusUploading: TaskStatus;
1360
1384
  export declare const TaskStatusCompleted: TaskStatus;
1361
1385
  export declare const TaskStatusFailed: TaskStatus;
@@ -1396,6 +1420,7 @@ export interface TaskDTO extends BaseModel, PermissionModelDTO {
1396
1420
  app_version_id: string;
1397
1421
  app_version?: AppVersionDTO;
1398
1422
  app_variant: string;
1423
+ function: string;
1399
1424
  infra: Infra;
1400
1425
  workers: string[];
1401
1426
  flow_id?: string;
@@ -1744,6 +1769,7 @@ export interface User {
1744
1769
  default_team_id: string;
1745
1770
  role: Role;
1746
1771
  email: string;
1772
+ email_verified: boolean;
1747
1773
  name: string;
1748
1774
  full_name: string;
1749
1775
  avatar_url: string;
@@ -1867,9 +1893,3 @@ export interface Widget {
1867
1893
  children?: WidgetNode[];
1868
1894
  actions?: WidgetActionButton[];
1869
1895
  }
1870
- /**
1871
- * WidgetFormData represents the form data collected from widget inputs
1872
- */
1873
- export type WidgetFormData = {
1874
- [key: string]: any;
1875
- };
package/dist/types.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  // Code generated by tygo. DO NOT EDIT.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.DeviceAuthStatusDenied = 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.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
- exports.InfraCloud = exports.InfraPrivate = exports.TaskStatusCancelled = exports.TaskStatusFailed = exports.TaskStatusCompleted = exports.TaskStatusUploading = 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 = void 0;
6
- exports.WidgetNodeTypeSelect = exports.WidgetNodeTypeInput = 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 = void 0;
7
- exports.WidgetNodeTypeStatusBadge = exports.WidgetNodeTypeKeyValue = exports.WidgetNodeTypePlanList = exports.WidgetNodeTypeCol = exports.WidgetNodeTypeRow = exports.WidgetNodeTypeCheckbox = void 0;
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
+ 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
+ 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;
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
@@ -29,9 +29,7 @@ exports.VisibilityPublic = "public";
29
29
  exports.VisibilityUnlisted = "unlisted";
30
30
  exports.ChatStatusBusy = "busy";
31
31
  exports.ChatStatusIdle = "idle";
32
- /**
33
- * ChatStatusWaitingInput ChatStatus = "waiting_input"
34
- */
32
+ exports.ChatStatusAwaitingInput = "awaiting_input";
35
33
  exports.ChatStatusCompleted = "completed";
36
34
  exports.PlanStepStatusPending = "pending";
37
35
  exports.PlanStepStatusInProgress = "in_progress";
@@ -114,10 +112,11 @@ exports.TaskStatusPreparing = 4; // 4
114
112
  exports.TaskStatusServing = 5; // 5
115
113
  exports.TaskStatusSettingUp = 6; // 6
116
114
  exports.TaskStatusRunning = 7; // 7
117
- exports.TaskStatusUploading = 8; // 8
118
- exports.TaskStatusCompleted = 9; // 9
119
- exports.TaskStatusFailed = 10; // 10
120
- exports.TaskStatusCancelled = 11; // 11
115
+ exports.TaskStatusCancelling = 8; // 8 - Graceful cancellation in progress
116
+ exports.TaskStatusUploading = 9; // 9
117
+ exports.TaskStatusCompleted = 10; // 10
118
+ exports.TaskStatusFailed = 11; // 11
119
+ exports.TaskStatusCancelled = 12; // 12
121
120
  exports.InfraPrivate = "private";
122
121
  exports.InfraCloud = "cloud";
123
122
  exports.InfraPrivateFirst = "private_first";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.2.1",
3
+ "version": "0.4.1",
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",
@@ -15,9 +15,11 @@
15
15
  "scripts": {
16
16
  "build": "tsc && npm run build:esm",
17
17
  "build:esm": "echo 'export * from \"./index.js\";' > dist/index.mjs",
18
- "test": "jest",
19
- "test:watch": "jest --watch",
20
- "test:coverage": "jest --coverage",
18
+ "test": "jest --testPathIgnorePatterns=integration",
19
+ "test:integration": "jest --testPathPattern=integration --testTimeout=120000 --runInBand",
20
+ "test:all": "jest --testTimeout=120000 --runInBand",
21
+ "test:watch": "jest --watch --testPathIgnorePatterns=integration",
22
+ "test:coverage": "jest --coverage --testPathIgnorePatterns=integration",
21
23
  "lint": "eslint src --ext .ts",
22
24
  "lint:fix": "eslint src --ext .ts --fix",
23
25
  "format": "prettier --write \"src/**/*.ts\"",