@inferencesh/sdk 0.6.1 → 0.6.2

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.
@@ -1,6 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import { FilesAPI } from './files';
3
- import { ChatDTO, ChatMessageDTO, AgentConfig, AgentDTO, AgentVersionDTO, CreateAgentRequest, File, CursorListRequest, CursorListResponse } from '../types';
3
+ import { ChatDTO, ChatMessageDTO, AgentConfig, AgentDTO, AgentVersionDTO, CreateAgentRequest, FileDTO as File, CursorListRequest, CursorListResponse } from '../types';
4
4
  /** Internal tool definition returned by getInternalTools */
5
5
  export interface InternalToolDefinition {
6
6
  id: string;
@@ -1,5 +1,5 @@
1
1
  import { HttpClient } from '../http/client';
2
- import { AppDTO as App, AppVersionDTO, CursorListRequest, CursorListResponse, LicenseRecord } from '../types';
2
+ import { AppDTO as App, AppVersionDTO, CursorListRequest, CursorListResponse, LicenseRecordDTO } from '../types';
3
3
  /**
4
4
  * Apps API
5
5
  */
@@ -53,11 +53,11 @@ export declare class AppsAPI {
53
53
  /**
54
54
  * Get app license record
55
55
  */
56
- getLicense(appId: string): Promise<LicenseRecord>;
56
+ getLicense(appId: string): Promise<LicenseRecordDTO>;
57
57
  /**
58
58
  * Save app license
59
59
  */
60
- saveLicense(appId: string, license: string): Promise<LicenseRecord>;
60
+ saveLicense(appId: string, license: string): Promise<LicenseRecordDTO>;
61
61
  /**
62
62
  * Set the current (active) version of an app
63
63
  */
@@ -1,5 +1,5 @@
1
1
  import { HttpClient } from '../http/client';
2
- import { File, CursorListRequest, CursorListResponse } from '../types';
2
+ import { FileDTO as File, CursorListRequest, CursorListResponse } from '../types';
3
3
  export interface UploadFileOptions {
4
4
  filename?: string;
5
5
  contentType?: string;
@@ -2,7 +2,7 @@
2
2
  * Sessions API - namespaced session operations.
3
3
  */
4
4
  import { HttpClient } from '../http/client';
5
- import { AppSession } from '../types';
5
+ import { AppSessionDTO } from '../types';
6
6
  /**
7
7
  * Sessions API for managing stateful worker leases.
8
8
  *
@@ -34,13 +34,13 @@ export declare class SessionsAPI {
34
34
  * @returns Session information
35
35
  * @throws SessionNotFoundError if session doesn't exist
36
36
  */
37
- get(sessionId: string): Promise<AppSession>;
37
+ get(sessionId: string): Promise<AppSessionDTO>;
38
38
  /**
39
39
  * List all sessions for the current user/team.
40
40
  *
41
41
  * @returns List of session information
42
42
  */
43
- list(): Promise<AppSession[]>;
43
+ list(): Promise<AppSessionDTO[]>;
44
44
  /**
45
45
  * Extend session expiration time.
46
46
  *
@@ -52,7 +52,7 @@ export declare class SessionsAPI {
52
52
  * @throws SessionExpiredError if session has expired
53
53
  * @throws SessionEndedError if session was ended
54
54
  */
55
- keepalive(sessionId: string): Promise<AppSession>;
55
+ keepalive(sessionId: string): Promise<AppSessionDTO>;
56
56
  /**
57
57
  * End a session and release the worker.
58
58
  *
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ import { ChatsAPI } from './api/chats';
27
27
  import { FlowsAPI } from './api/flows';
28
28
  import { FlowRunsAPI } from './api/flow-runs';
29
29
  import { EnginesAPI } from './api/engines';
30
- import { ApiAppRunRequest, TaskDTO as Task, AgentConfig, File } from './types';
30
+ import { ApiAppRunRequest, TaskDTO as Task, AgentConfig, FileDTO as File } from './types';
31
31
  export interface InferenceConfig {
32
32
  /** Your inference.sh API key (required unless using proxyUrl) */
33
33
  apiKey?: string;
package/dist/types.d.ts CHANGED
@@ -289,7 +289,7 @@ export interface Agent extends BaseModel, PermissionModel {
289
289
  /**
290
290
  * AgentDTO for API responses
291
291
  */
292
- export interface AgentDTO extends BaseModel, PermissionModelDTO, ProjectModelDTO {
292
+ export interface AgentDTO extends BaseModelDTO, PermissionModelDTO, ProjectModelDTO {
293
293
  namespace: string;
294
294
  name: string;
295
295
  /**
@@ -382,7 +382,7 @@ export interface CoreAppConfigDTO {
382
382
  */
383
383
  input?: any;
384
384
  }
385
- export interface AgentVersionDTO extends BaseModel, PermissionModelDTO {
385
+ export interface AgentVersionDTO extends BaseModelDTO, PermissionModelDTO {
386
386
  description: string;
387
387
  system_prompt: string;
388
388
  example_prompts: string[];
@@ -632,7 +632,15 @@ export interface CreateFlowRunRequest {
632
632
  /**
633
633
  * CreateAppRequest is the request body for POST /apps
634
634
  */
635
- export interface CreateAppRequest extends App {
635
+ export interface CreateAppRequest {
636
+ id?: string;
637
+ namespace?: string;
638
+ name: string;
639
+ description?: string;
640
+ agent_description?: string;
641
+ category?: AppCategory;
642
+ images?: AppImages;
643
+ version?: AppVersion;
636
644
  /**
637
645
  * PreserveCurrentVersion prevents auto-promoting the new version to current.
638
646
  * Default false = new versions become current (what most users expect).
@@ -1106,12 +1114,12 @@ export interface AppVersion extends BaseModel {
1106
1114
  */
1107
1115
  checksum?: string;
1108
1116
  }
1109
- export interface LicenseRecord extends BaseModel {
1117
+ export interface LicenseRecordDTO extends BaseModelDTO {
1110
1118
  user_id: string;
1111
1119
  app_id: string;
1112
1120
  license: string;
1113
1121
  }
1114
- export interface AppDTO extends BaseModel, PermissionModelDTO {
1122
+ export interface AppDTO extends BaseModelDTO, PermissionModelDTO {
1115
1123
  namespace: string;
1116
1124
  name: string;
1117
1125
  description: string;
@@ -1121,7 +1129,7 @@ export interface AppDTO extends BaseModel, PermissionModelDTO {
1121
1129
  version_id: string;
1122
1130
  version?: AppVersionDTO;
1123
1131
  }
1124
- export interface AppVersionDTO extends BaseModel {
1132
+ export interface AppVersionDTO extends BaseModelDTO {
1125
1133
  metadata: {
1126
1134
  [key: string]: any;
1127
1135
  };
@@ -1157,37 +1165,20 @@ export type AppSessionStatus = string;
1157
1165
  export declare const AppSessionStatusActive: AppSessionStatus;
1158
1166
  export declare const AppSessionStatusEnded: AppSessionStatus;
1159
1167
  export declare const AppSessionStatusExpired: AppSessionStatus;
1160
- export interface AppSession extends BaseModel, PermissionModel {
1161
- /**
1162
- * Affinity binding
1163
- */
1168
+ /**
1169
+ * AppSessionDTO is the external representation
1170
+ */
1171
+ export interface AppSessionDTO extends BaseModelDTO, PermissionModelDTO {
1164
1172
  worker_id: string;
1165
1173
  app_id: string;
1166
1174
  app_version_id: string;
1167
- /**
1168
- * Lifecycle
1169
- */
1170
1175
  status: AppSessionStatus;
1171
1176
  expires_at: string;
1172
1177
  ended_at?: string;
1173
- /**
1174
- * Billing link
1175
- */
1176
1178
  task_id?: string;
1177
- /**
1178
- * Stats
1179
- */
1180
1179
  call_count: number;
1181
1180
  last_call_at?: string;
1182
- /**
1183
- * Custom idle timeout in seconds (nil = use default)
1184
- */
1185
1181
  idle_timeout?: number;
1186
- /**
1187
- * Relations
1188
- */
1189
- worker?: WorkerState;
1190
- task?: Task;
1191
1182
  }
1192
1183
  /**
1193
1184
  * PublicAppStoreDTO is a lean DTO for public app store display.
@@ -1213,6 +1204,17 @@ export interface BaseModel {
1213
1204
  updated_at: string;
1214
1205
  deleted_at?: string;
1215
1206
  }
1207
+ /**
1208
+ * BaseModelDTO is the contract-layer base embed — same fields, no gorm tags.
1209
+ * All DTOs should embed this instead of BaseModel.
1210
+ */
1211
+ export interface BaseModelDTO {
1212
+ id: string;
1213
+ short_id: string;
1214
+ created_at: string;
1215
+ updated_at: string;
1216
+ deleted_at?: string;
1217
+ }
1216
1218
  /**
1217
1219
  * Visibility represents the visibility level of a resource
1218
1220
  */
@@ -1370,7 +1372,7 @@ export interface ChatTaskContextMessage {
1370
1372
  tool_calls?: ToolCall[];
1371
1373
  tool_call_id?: string;
1372
1374
  }
1373
- export interface ChatDTO extends BaseModel, PermissionModelDTO {
1375
+ export interface ChatDTO extends BaseModelDTO, PermissionModelDTO {
1374
1376
  parent_id?: string;
1375
1377
  parent?: ChatDTO;
1376
1378
  children: (ChatDTO | undefined)[];
@@ -1391,7 +1393,7 @@ export interface ChatDTO extends BaseModel, PermissionModelDTO {
1391
1393
  chat_messages: ChatMessageDTO[];
1392
1394
  agent_data: ChatData;
1393
1395
  }
1394
- export interface ChatMessageDTO extends BaseModel, PermissionModelDTO {
1396
+ export interface ChatMessageDTO extends BaseModelDTO, PermissionModelDTO {
1395
1397
  chat_id: string;
1396
1398
  chat?: ChatDTO;
1397
1399
  order: number;
@@ -1500,18 +1502,7 @@ export declare const EngineStatusPending: EngineStatus;
1500
1502
  export declare const EngineStatusDraining: EngineStatus;
1501
1503
  export declare const EngineStatusStopping: EngineStatus;
1502
1504
  export declare const EngineStatusStopped: EngineStatus;
1503
- export interface EngineState extends BaseModel, PermissionModel {
1504
- instance?: Instance;
1505
- transaction_id: string;
1506
- config: EngineConfig;
1507
- public_key: string;
1508
- name: string;
1509
- api_url: string;
1510
- status: EngineStatus;
1511
- system_info?: SystemInfo;
1512
- workers: (WorkerState | undefined)[];
1513
- }
1514
- export interface EngineStateDTO extends BaseModel, PermissionModelDTO {
1505
+ export interface EngineStateDTO extends BaseModelDTO, PermissionModelDTO {
1515
1506
  instance?: Instance;
1516
1507
  config: EngineConfig;
1517
1508
  name: string;
@@ -1520,7 +1511,7 @@ export interface EngineStateDTO extends BaseModel, PermissionModelDTO {
1520
1511
  system_info?: SystemInfo;
1521
1512
  workers: (WorkerStateDTO | undefined)[];
1522
1513
  }
1523
- export interface EngineStateSummary extends BaseModel, PermissionModelDTO {
1514
+ export interface EngineStateSummary extends BaseModelDTO, PermissionModelDTO {
1524
1515
  instance?: Instance;
1525
1516
  name: string;
1526
1517
  status: EngineStatus;
@@ -1530,31 +1521,6 @@ export interface EngineStateSummary extends BaseModel, PermissionModelDTO {
1530
1521
  * Worker-related types
1531
1522
  */
1532
1523
  export type WorkerStatus = string;
1533
- export interface WorkerState extends BaseModel, PermissionModel {
1534
- index: number;
1535
- status: WorkerStatus;
1536
- status_updated_at?: string;
1537
- heartbeat_at?: string;
1538
- engine_id: string;
1539
- engine?: EngineState;
1540
- task_id?: string;
1541
- app_id: string;
1542
- app_version_id: string;
1543
- /**
1544
- * App session lease
1545
- */
1546
- active_session_id?: string;
1547
- active_session?: AppSession;
1548
- gpus: WorkerGPU[];
1549
- cpus: WorkerCPU[];
1550
- rams: WorkerRAM[];
1551
- /**
1552
- * WarmApps tracks app+version combos with warm containers for scheduling optimization.
1553
- * Format: "appID:versionID@setupHash" - managed by Engine, synced via heartbeat.
1554
- * Not persisted to DB - this is ephemeral runtime state.
1555
- */
1556
- warm_apps?: string[];
1557
- }
1558
1524
  export interface WorkerGPU {
1559
1525
  id: string;
1560
1526
  worker_id: string;
@@ -1578,7 +1544,7 @@ export interface WorkerRAM {
1578
1544
  worker_id: string;
1579
1545
  total: number;
1580
1546
  }
1581
- export interface WorkerStateDTO extends BaseModel {
1547
+ export interface WorkerStateDTO extends BaseModelDTO {
1582
1548
  user_id: string;
1583
1549
  team_id: string;
1584
1550
  index: number;
@@ -1622,19 +1588,7 @@ export interface FileMetadata {
1622
1588
  channels?: number;
1623
1589
  codec?: string;
1624
1590
  }
1625
- export interface File extends BaseModel, PermissionModel {
1626
- path: string;
1627
- remote_path: string;
1628
- upload_url: string;
1629
- uri: string;
1630
- content_type: string;
1631
- size: number;
1632
- filename: string;
1633
- category: string;
1634
- rating: ContentRating;
1635
- metadata?: FileMetadata;
1636
- }
1637
- export interface FileDTO extends BaseModel, PermissionModelDTO {
1591
+ export interface FileDTO extends BaseModelDTO, PermissionModelDTO {
1638
1592
  path: string;
1639
1593
  remote_path: string;
1640
1594
  upload_url: string;
@@ -1729,7 +1683,7 @@ export interface OutputFieldMapping {
1729
1683
  export type OutputMappings = {
1730
1684
  [key: string]: OutputFieldMapping;
1731
1685
  };
1732
- export interface FlowDTO extends BaseModel, PermissionModelDTO {
1686
+ export interface FlowDTO extends BaseModelDTO, PermissionModelDTO {
1733
1687
  name: string;
1734
1688
  description: string;
1735
1689
  card_image: string;
@@ -1755,7 +1709,7 @@ export interface FlowDTO extends BaseModel, PermissionModelDTO {
1755
1709
  edges: FlowEdge[];
1756
1710
  viewport?: FlowViewport;
1757
1711
  }
1758
- export interface FlowVersionDTO extends BaseModel {
1712
+ export interface FlowVersionDTO extends BaseModelDTO {
1759
1713
  graph_version: number;
1760
1714
  input_schema: any;
1761
1715
  input: FlowRunInputs;
@@ -1777,7 +1731,7 @@ export declare const FlowRunStatusRunning: FlowRunStatus;
1777
1731
  export declare const FlowRunStatusCompleted: FlowRunStatus;
1778
1732
  export declare const FlowRunStatusFailed: FlowRunStatus;
1779
1733
  export declare const FlowRunStatusCancelled: FlowRunStatus;
1780
- export interface FlowRunDTO extends BaseModel, PermissionModelDTO {
1734
+ export interface FlowRunDTO extends BaseModelDTO, PermissionModelDTO {
1781
1735
  flow_id: string;
1782
1736
  flow_version_id: string;
1783
1737
  flow_version?: FlowVersionDTO;
@@ -1847,7 +1801,7 @@ export declare const GraphEdgeTypeDuplicate: GraphEdgeType;
1847
1801
  /**
1848
1802
  * GraphNodeDTO is the API representation of a graph node
1849
1803
  */
1850
- export interface GraphNodeDTO extends BaseModel {
1804
+ export interface GraphNodeDTO extends BaseModelDTO {
1851
1805
  graph_id: string;
1852
1806
  type: GraphNodeType;
1853
1807
  label: string;
@@ -1863,7 +1817,7 @@ export interface GraphNodeDTO extends BaseModel {
1863
1817
  /**
1864
1818
  * GraphEdgeDTO is the API representation of a graph edge
1865
1819
  */
1866
- export interface GraphEdgeDTO extends BaseModel {
1820
+ export interface GraphEdgeDTO extends BaseModelDTO {
1867
1821
  type: GraphEdgeType;
1868
1822
  from_node: string;
1869
1823
  to_node: string;
@@ -1890,7 +1844,7 @@ export type StringSlice = string[];
1890
1844
  /**
1891
1845
  * IntegrationDTO for API responses (never exposes tokens)
1892
1846
  */
1893
- export interface IntegrationDTO extends BaseModel, PermissionModelDTO {
1847
+ export interface IntegrationDTO extends BaseModelDTO, PermissionModelDTO {
1894
1848
  provider: string;
1895
1849
  type: string;
1896
1850
  auth: string;
@@ -1955,7 +1909,7 @@ export type PageType = string;
1955
1909
  export declare const PageTypeDoc: PageType;
1956
1910
  export declare const PageTypeBlog: PageType;
1957
1911
  export declare const PageTypePage: PageType;
1958
- export interface PageDTO extends BaseModel, PermissionModelDTO {
1912
+ export interface PageDTO extends BaseModelDTO, PermissionModelDTO {
1959
1913
  is_featured: boolean;
1960
1914
  title: string;
1961
1915
  content: string;
@@ -1980,7 +1934,7 @@ export interface MenuItem {
1980
1934
  expanded?: boolean;
1981
1935
  children?: MenuItem[];
1982
1936
  }
1983
- export interface MenuDTO extends BaseModel, PermissionModelDTO {
1937
+ export interface MenuDTO extends BaseModelDTO, PermissionModelDTO {
1984
1938
  name: string;
1985
1939
  slug: string;
1986
1940
  description: string;
@@ -2024,7 +1978,7 @@ export interface Project extends BaseModel, PermissionModel {
2024
1978
  /**
2025
1979
  * ProjectDTO for API responses
2026
1980
  */
2027
- export interface ProjectDTO extends BaseModel, PermissionModelDTO {
1981
+ export interface ProjectDTO extends BaseModelDTO, PermissionModelDTO {
2028
1982
  name: string;
2029
1983
  description: string;
2030
1984
  type: ProjectType;
@@ -2089,14 +2043,6 @@ export interface SetupAction {
2089
2043
  provider?: string;
2090
2044
  scopes?: string[];
2091
2045
  }
2092
- /**
2093
- * SecretRef tracks which Secret record provided a value for a task (for billing)
2094
- */
2095
- export interface SecretRef {
2096
- key: string;
2097
- id: string;
2098
- team_id: string;
2099
- }
2100
2046
  export type InstanceCloudProvider = string;
2101
2047
  export declare const CloudAWS: InstanceCloudProvider;
2102
2048
  export declare const CloudAzure: InstanceCloudProvider;
@@ -2336,73 +2282,6 @@ export interface TaskAction {
2336
2282
  export interface TaskMetadata {
2337
2283
  action?: TaskAction;
2338
2284
  }
2339
- export interface Task extends BaseModel, PermissionModel {
2340
- is_featured: boolean;
2341
- status: TaskStatus;
2342
- /**
2343
- * Foreign keys
2344
- */
2345
- app_id: string;
2346
- app?: App;
2347
- version_id: string;
2348
- app_version?: AppVersion;
2349
- /**
2350
- * Deprecated: Will be removed in favor of Setup
2351
- */
2352
- variant: string;
2353
- /**
2354
- * Function is the specific function to call on multi-function apps.
2355
- * DEPRECATED: Standardizing on explicit function name.
2356
- * Defaults to "run" for legacy tasks (backfilled via migration).
2357
- */
2358
- function: string;
2359
- infra: Infra;
2360
- workers: string[];
2361
- engine_id?: string;
2362
- engine?: EngineState;
2363
- worker_id?: string;
2364
- worker?: WorkerState;
2365
- /**
2366
- * Belongs to:
2367
- */
2368
- flow_run_id?: string;
2369
- chat_id?: string;
2370
- /**
2371
- * Owns: (Can be replaced with graph execution edge/node)
2372
- */
2373
- sub_flow_run_id?: string;
2374
- webhook?: string;
2375
- metadata?: TaskMetadata;
2376
- setup?: any;
2377
- input: any;
2378
- output: any;
2379
- error?: string;
2380
- rating: ContentRating;
2381
- /**
2382
- * Relationships
2383
- */
2384
- events: TaskEvent[];
2385
- logs: TaskLog[];
2386
- usage_events: (UsageEvent | undefined)[];
2387
- /**
2388
- * Secret refs for billing (tracks ownership to determine partner fee)
2389
- */
2390
- secrets?: SecretRef[];
2391
- /**
2392
- * App session reference (for session calls)
2393
- * Special value "new" means scheduler should create session when dispatching.
2394
- */
2395
- session_id?: string;
2396
- session?: AppSession;
2397
- /**
2398
- * Session timeout in seconds (only used when session="new")
2399
- */
2400
- session_timeout?: number;
2401
- /**
2402
- * Scheduled execution time (UTC). Scheduler skips task until this time.
2403
- */
2404
- run_at?: string;
2405
- }
2406
2285
  export interface TaskEvent {
2407
2286
  id: string;
2408
2287
  created_at: string;
@@ -2424,7 +2303,7 @@ export interface TaskLog {
2424
2303
  log_type: TaskLogType;
2425
2304
  content: string;
2426
2305
  }
2427
- export interface TaskDTO extends BaseModel, PermissionModelDTO {
2306
+ export interface TaskDTO extends BaseModelDTO, PermissionModelDTO {
2428
2307
  graph_id?: string;
2429
2308
  user_public_key: string;
2430
2309
  engine_public_key: string;
@@ -2486,7 +2365,7 @@ export interface Team extends BaseModel {
2486
2365
  max_concurrency: number;
2487
2366
  status: TeamStatus;
2488
2367
  }
2489
- export interface TeamDTO extends BaseModel {
2368
+ export interface TeamDTO extends BaseModelDTO {
2490
2369
  type: TeamType;
2491
2370
  name: string;
2492
2371
  username: string;
@@ -2533,7 +2412,7 @@ export declare const ToolInvocationStatusCancelled: ToolInvocationStatus;
2533
2412
  /**
2534
2413
  * ToolInvocationDTO for API responses
2535
2414
  */
2536
- export interface ToolInvocationDTO extends BaseModel, PermissionModelDTO {
2415
+ export interface ToolInvocationDTO extends BaseModelDTO, PermissionModelDTO {
2537
2416
  chat_message_id: string;
2538
2417
  tool_invocation_id: string;
2539
2418
  type: ToolType;
@@ -2610,7 +2489,7 @@ export declare const RoleGuest: Role;
2610
2489
  export declare const RoleUser: Role;
2611
2490
  export declare const RoleAdmin: Role;
2612
2491
  export declare const RoleSystem: Role;
2613
- export interface UserDTO extends BaseModel {
2492
+ export interface UserDTO extends BaseModelDTO {
2614
2493
  default_team_id: string;
2615
2494
  role: Role;
2616
2495
  email: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
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",