@inferencesh/sdk 0.4.27 → 0.5.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.
- package/README.md +62 -3
- package/dist/agent/api.js +1 -0
- package/dist/api/agents.js +1 -1
- package/dist/api/apps.d.ts +1 -11
- package/dist/sessions.integration.test.js +0 -2
- package/dist/types.d.ts +74 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
# @inferencesh/sdk
|
|
1
|
+
# @inferencesh/sdk — ai inference api for javascript & typescript
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@inferencesh/sdk)
|
|
4
4
|
[](https://www.npmjs.com/package/@inferencesh/sdk)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
official javascript/typescript sdk for [inference.sh](https://inference.sh) — the ai agent runtime for serverless ai inference.
|
|
9
|
+
|
|
10
|
+
run ai models, build ai agents, and deploy generative ai applications with a simple api. access 150+ models including flux, stable diffusion, llms (claude, gpt, gemini), video generation (veo, seedance), and more.
|
|
9
11
|
|
|
10
12
|
## Installation
|
|
11
13
|
|
|
@@ -149,6 +151,53 @@ const task = await client.tasks.run(
|
|
|
149
151
|
await client.tasks.cancel(task.id);
|
|
150
152
|
```
|
|
151
153
|
|
|
154
|
+
### Sessions (Stateful Execution)
|
|
155
|
+
|
|
156
|
+
Sessions allow you to maintain state across multiple task invocations. The worker stays warm between calls, preserving loaded models and in-memory state.
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
// Start a new session
|
|
160
|
+
const result = await client.tasks.run({
|
|
161
|
+
app: 'my-stateful-app',
|
|
162
|
+
input: { prompt: 'hello' },
|
|
163
|
+
session: 'new'
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const sessionId = result.session_id;
|
|
167
|
+
console.log('Session ID:', sessionId);
|
|
168
|
+
|
|
169
|
+
// Continue the session with another call
|
|
170
|
+
const result2 = await client.tasks.run({
|
|
171
|
+
app: 'my-stateful-app',
|
|
172
|
+
input: { prompt: 'remember what I said?' },
|
|
173
|
+
session: sessionId
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Custom Session Timeout
|
|
178
|
+
|
|
179
|
+
By default, sessions expire after 60 seconds of inactivity. You can customize this with `session_timeout` (1-3600 seconds):
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
// Create a session with 5-minute idle timeout
|
|
183
|
+
const result = await client.tasks.run({
|
|
184
|
+
app: 'my-stateful-app',
|
|
185
|
+
input: { prompt: 'hello' },
|
|
186
|
+
session: 'new',
|
|
187
|
+
session_timeout: 300 // 5 minutes
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// Session stays alive for 5 minutes after each call
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Notes:**
|
|
194
|
+
- `session_timeout` is only valid when `session: 'new'`
|
|
195
|
+
- Minimum timeout: 1 second
|
|
196
|
+
- Maximum timeout: 3600 seconds (1 hour)
|
|
197
|
+
- Each successful call resets the idle timer
|
|
198
|
+
|
|
199
|
+
For complete session documentation including error handling, best practices, and advanced patterns, see the [Sessions Developer Guide](https://inference.sh/docs/extend/sessions).
|
|
200
|
+
|
|
152
201
|
## Agent Chat
|
|
153
202
|
|
|
154
203
|
Chat with AI agents using `client.agents.create()`.
|
|
@@ -252,6 +301,8 @@ Runs a task on inference.sh.
|
|
|
252
301
|
| `params.setup` | `object` | No | Setup parameters (affects worker warmth/scheduling) |
|
|
253
302
|
| `params.infra` | `string` | No | Infrastructure: `'cloud'` or `'private'` |
|
|
254
303
|
| `params.variant` | `string` | No | App variant to use |
|
|
304
|
+
| `params.session` | `string` | No | Session ID or `'new'` to start a new session |
|
|
305
|
+
| `params.session_timeout` | `number` | No | Session timeout in seconds (1-3600, only with `session: 'new'`) |
|
|
255
306
|
|
|
256
307
|
**Options:**
|
|
257
308
|
|
|
@@ -331,6 +382,14 @@ import type { Task, ApiTaskRequest, RunOptions } from '@inferencesh/sdk';
|
|
|
331
382
|
- Node.js 18.0.0 or higher
|
|
332
383
|
- Modern browsers with `fetch` support
|
|
333
384
|
|
|
334
|
-
##
|
|
385
|
+
## resources
|
|
386
|
+
|
|
387
|
+
- [documentation](https://inference.sh/docs) — getting started guides and api reference
|
|
388
|
+
- [blog](https://inference.sh/blog) — tutorials on ai agents, image generation, and more
|
|
389
|
+
- [app store](https://app.inference.sh) — browse 150+ ai models
|
|
390
|
+
- [discord](https://discord.gg/RM77SWSbyT) — community support
|
|
391
|
+
- [github](https://github.com/inference-sh) — open source projects
|
|
392
|
+
|
|
393
|
+
## license
|
|
335
394
|
|
|
336
395
|
MIT © [inference.sh](https://inference.sh)
|
package/dist/agent/api.js
CHANGED
package/dist/api/agents.js
CHANGED
|
@@ -56,7 +56,7 @@ export class Agent {
|
|
|
56
56
|
: {
|
|
57
57
|
chat_id: this.chatId,
|
|
58
58
|
agent_config: this.config,
|
|
59
|
-
agent_name: this.agentName,
|
|
59
|
+
agent_name: this.agentName ?? this.config.name,
|
|
60
60
|
input: { text, images: imageUris, files: fileUris, role: 'user', context: [], system_prompt: '', context_size: 0 },
|
|
61
61
|
};
|
|
62
62
|
// For existing chats with callbacks: Start streaming BEFORE POST so we don't miss updates
|
package/dist/api/apps.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from '../http/client';
|
|
2
|
-
import { AppDTO as App, AppVersionDTO, CursorListRequest, CursorListResponse } from '../types';
|
|
3
|
-
interface LicenseRecord {
|
|
4
|
-
id: string;
|
|
5
|
-
created_at: string;
|
|
6
|
-
updated_at: string;
|
|
7
|
-
deleted_at?: string;
|
|
8
|
-
user_id: string;
|
|
9
|
-
app_id: string;
|
|
10
|
-
license: string;
|
|
11
|
-
}
|
|
2
|
+
import { AppDTO as App, AppVersionDTO, CursorListRequest, CursorListResponse, LicenseRecord } from '../types';
|
|
12
3
|
/**
|
|
13
4
|
* Apps API
|
|
14
5
|
*/
|
|
@@ -69,4 +60,3 @@ export declare class AppsAPI {
|
|
|
69
60
|
saveLicense(appId: string, license: string): Promise<LicenseRecord>;
|
|
70
61
|
}
|
|
71
62
|
export declare function createAppsAPI(http: HttpClient): AppsAPI;
|
|
72
|
-
export {};
|
|
@@ -39,7 +39,6 @@ describeIfApiKey('Sessions Integration Tests', () => {
|
|
|
39
39
|
expect(result.status).toBe(TaskStatusCompleted);
|
|
40
40
|
expect(result.session_id).toBeDefined();
|
|
41
41
|
expect(result.session_id).not.toBe('new');
|
|
42
|
-
expect(result.session_id).toMatch(/^sess_/);
|
|
43
42
|
}, 60000);
|
|
44
43
|
it('should return correct output data', async () => {
|
|
45
44
|
const result = await client.run({
|
|
@@ -69,7 +68,6 @@ describeIfApiKey('Sessions Integration Tests', () => {
|
|
|
69
68
|
});
|
|
70
69
|
expect(result1.status).toBe(TaskStatusCompleted);
|
|
71
70
|
const sessionId = result1.session_id;
|
|
72
|
-
expect(sessionId).toMatch(/^sess_/);
|
|
73
71
|
// Retrieve value from same session
|
|
74
72
|
const result2 = await client.run({
|
|
75
73
|
app: SESSION_TEST_APP,
|
package/dist/types.d.ts
CHANGED
|
@@ -170,7 +170,7 @@ export interface ClientToolConfigDTO {
|
|
|
170
170
|
*/
|
|
171
171
|
export interface CoreAppConfig {
|
|
172
172
|
id?: string;
|
|
173
|
-
|
|
173
|
+
version_id?: string;
|
|
174
174
|
/**
|
|
175
175
|
* CoreAppRef is the user-facing ref (namespace/name@shortid) - used in ad-hoc configs, resolved at creation
|
|
176
176
|
*/
|
|
@@ -192,9 +192,7 @@ export interface AgentImages {
|
|
|
192
192
|
thumbnail: string;
|
|
193
193
|
banner: string;
|
|
194
194
|
}
|
|
195
|
-
export interface Agent {
|
|
196
|
-
BaseModel: BaseModel;
|
|
197
|
-
PermissionModel: PermissionModel;
|
|
195
|
+
export interface Agent extends BaseModel, PermissionModel {
|
|
198
196
|
ProjectModel: ProjectModel;
|
|
199
197
|
/**
|
|
200
198
|
* Basic info
|
|
@@ -237,6 +235,11 @@ export interface SkillConfig {
|
|
|
237
235
|
* Using Go embedding flattens these fields in JSON serialization.
|
|
238
236
|
*/
|
|
239
237
|
export interface AgentConfig {
|
|
238
|
+
/**
|
|
239
|
+
* Optional name for the agent (used for adhoc agent deduplication — reuses existing agent by name).
|
|
240
|
+
* Not persisted as a DB column; only used in API requests.
|
|
241
|
+
*/
|
|
242
|
+
name?: string;
|
|
240
243
|
description?: string;
|
|
241
244
|
system_prompt?: string;
|
|
242
245
|
example_prompts?: string[];
|
|
@@ -261,14 +264,8 @@ export interface AgentConfig {
|
|
|
261
264
|
*/
|
|
262
265
|
output_schema?: any;
|
|
263
266
|
}
|
|
264
|
-
export interface AgentVersion {
|
|
265
|
-
BaseModel: BaseModel;
|
|
266
|
-
PermissionModel: PermissionModel;
|
|
267
|
+
export interface AgentVersion extends BaseModel, PermissionModel {
|
|
267
268
|
agent_id: string;
|
|
268
|
-
/**
|
|
269
|
-
* Short ID for human-readable version references (e.g., "abc123")
|
|
270
|
-
*/
|
|
271
|
-
short_id: string;
|
|
272
269
|
/**
|
|
273
270
|
* ConfigHash for deduplication - SHA256 of config content
|
|
274
271
|
*/
|
|
@@ -276,7 +273,7 @@ export interface AgentVersion {
|
|
|
276
273
|
}
|
|
277
274
|
export interface CoreAppConfigDTO {
|
|
278
275
|
id?: string;
|
|
279
|
-
|
|
276
|
+
version_id?: string;
|
|
280
277
|
ref?: string;
|
|
281
278
|
app?: AppDTO;
|
|
282
279
|
/**
|
|
@@ -338,7 +335,7 @@ export interface ApiAppRunRequest {
|
|
|
338
335
|
*/
|
|
339
336
|
app?: string;
|
|
340
337
|
/**
|
|
341
|
-
*
|
|
338
|
+
* Deprecated: use App ref instead. Direct ID bypasses ref routing.
|
|
342
339
|
*/
|
|
343
340
|
app_id?: string;
|
|
344
341
|
version_id?: string;
|
|
@@ -360,6 +357,10 @@ export interface ApiAppRunRequest {
|
|
|
360
357
|
* When using sessions, the worker is leased and state persists across calls
|
|
361
358
|
*/
|
|
362
359
|
session?: string;
|
|
360
|
+
/**
|
|
361
|
+
* Session timeout in seconds (1-3600). Only valid when session="new"
|
|
362
|
+
*/
|
|
363
|
+
session_timeout?: number;
|
|
363
364
|
}
|
|
364
365
|
/**
|
|
365
366
|
* ApiAgentRunRequest is the request body for /agents/run endpoint.
|
|
@@ -710,9 +711,7 @@ export interface AppImages {
|
|
|
710
711
|
thumbnail: string;
|
|
711
712
|
banner: string;
|
|
712
713
|
}
|
|
713
|
-
export interface App {
|
|
714
|
-
BaseModel: BaseModel;
|
|
715
|
-
PermissionModel: PermissionModel;
|
|
714
|
+
export interface App extends BaseModel, PermissionModel {
|
|
716
715
|
/**
|
|
717
716
|
* Namespace is copied from team.username at creation time and is IMMUTABLE.
|
|
718
717
|
* This ensures stable references like "namespace/name" even if team username changes.
|
|
@@ -767,13 +766,7 @@ export interface AppFunction {
|
|
|
767
766
|
input_schema: any;
|
|
768
767
|
output_schema: any;
|
|
769
768
|
}
|
|
770
|
-
export interface AppVersion {
|
|
771
|
-
BaseModel: BaseModel;
|
|
772
|
-
/**
|
|
773
|
-
* ShortID is a human-friendly version identifier (e.g., "abc123")
|
|
774
|
-
* Unique within the app, used in references like "namespace/app@abc123"
|
|
775
|
-
*/
|
|
776
|
-
short_id: string;
|
|
769
|
+
export interface AppVersion extends BaseModel {
|
|
777
770
|
app_id: string;
|
|
778
771
|
metadata: {
|
|
779
772
|
[key: string]: any;
|
|
@@ -811,6 +804,11 @@ export interface AppVersion {
|
|
|
811
804
|
*/
|
|
812
805
|
checksum?: string;
|
|
813
806
|
}
|
|
807
|
+
export interface LicenseRecord extends BaseModel {
|
|
808
|
+
user_id: string;
|
|
809
|
+
app_id: string;
|
|
810
|
+
license: string;
|
|
811
|
+
}
|
|
814
812
|
export interface AppDTO extends BaseModel, PermissionModelDTO {
|
|
815
813
|
namespace: string;
|
|
816
814
|
name: string;
|
|
@@ -822,7 +820,6 @@ export interface AppDTO extends BaseModel, PermissionModelDTO {
|
|
|
822
820
|
version?: AppVersionDTO;
|
|
823
821
|
}
|
|
824
822
|
export interface AppVersionDTO extends BaseModel {
|
|
825
|
-
short_id: string;
|
|
826
823
|
metadata: {
|
|
827
824
|
[key: string]: any;
|
|
828
825
|
};
|
|
@@ -858,9 +855,7 @@ export type AppSessionStatus = string;
|
|
|
858
855
|
export declare const AppSessionStatusActive: AppSessionStatus;
|
|
859
856
|
export declare const AppSessionStatusEnded: AppSessionStatus;
|
|
860
857
|
export declare const AppSessionStatusExpired: AppSessionStatus;
|
|
861
|
-
export interface AppSession {
|
|
862
|
-
BaseModel: BaseModel;
|
|
863
|
-
PermissionModel: PermissionModel;
|
|
858
|
+
export interface AppSession extends BaseModel, PermissionModel {
|
|
864
859
|
/**
|
|
865
860
|
* Affinity binding
|
|
866
861
|
*/
|
|
@@ -882,6 +877,10 @@ export interface AppSession {
|
|
|
882
877
|
*/
|
|
883
878
|
call_count: number;
|
|
884
879
|
last_call_at?: string;
|
|
880
|
+
/**
|
|
881
|
+
* Custom idle timeout in seconds (nil = use default)
|
|
882
|
+
*/
|
|
883
|
+
idle_timeout?: number;
|
|
885
884
|
/**
|
|
886
885
|
* Relations
|
|
887
886
|
*/
|
|
@@ -890,6 +889,7 @@ export interface AppSession {
|
|
|
890
889
|
}
|
|
891
890
|
export interface BaseModel {
|
|
892
891
|
id: string;
|
|
892
|
+
short_id: string;
|
|
893
893
|
created_at: string;
|
|
894
894
|
updated_at: string;
|
|
895
895
|
deleted_at?: string;
|
|
@@ -1150,9 +1150,7 @@ export declare const EngineStatusRunning: EngineStatus;
|
|
|
1150
1150
|
export declare const EngineStatusPending: EngineStatus;
|
|
1151
1151
|
export declare const EngineStatusStopping: EngineStatus;
|
|
1152
1152
|
export declare const EngineStatusStopped: EngineStatus;
|
|
1153
|
-
export interface EngineState {
|
|
1154
|
-
BaseModel: BaseModel;
|
|
1155
|
-
PermissionModel: PermissionModel;
|
|
1153
|
+
export interface EngineState extends BaseModel, PermissionModel {
|
|
1156
1154
|
instance?: Instance;
|
|
1157
1155
|
transaction_id: string;
|
|
1158
1156
|
config: EngineConfig;
|
|
@@ -1182,9 +1180,7 @@ export interface EngineStateSummary extends BaseModel, PermissionModelDTO {
|
|
|
1182
1180
|
* Worker-related types
|
|
1183
1181
|
*/
|
|
1184
1182
|
export type WorkerStatus = string;
|
|
1185
|
-
export interface WorkerState {
|
|
1186
|
-
BaseModel: BaseModel;
|
|
1187
|
-
PermissionModel: PermissionModel;
|
|
1183
|
+
export interface WorkerState extends BaseModel, PermissionModel {
|
|
1188
1184
|
index: number;
|
|
1189
1185
|
status: WorkerStatus;
|
|
1190
1186
|
status_updated_at?: string;
|
|
@@ -1262,9 +1258,20 @@ export interface WorkerStateSummary {
|
|
|
1262
1258
|
cpus: WorkerCPU[];
|
|
1263
1259
|
rams: WorkerRAM[];
|
|
1264
1260
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1261
|
+
/**
|
|
1262
|
+
* FileMetadata holds probed media metadata cached on File records.
|
|
1263
|
+
*/
|
|
1264
|
+
export interface FileMetadata {
|
|
1265
|
+
type?: string;
|
|
1266
|
+
width?: number;
|
|
1267
|
+
height?: number;
|
|
1268
|
+
duration?: number;
|
|
1269
|
+
fps?: number;
|
|
1270
|
+
sample_rate?: number;
|
|
1271
|
+
channels?: number;
|
|
1272
|
+
codec?: string;
|
|
1273
|
+
}
|
|
1274
|
+
export interface File extends BaseModel, PermissionModel {
|
|
1268
1275
|
path: string;
|
|
1269
1276
|
remote_path: string;
|
|
1270
1277
|
upload_url: string;
|
|
@@ -1273,6 +1280,7 @@ export interface File {
|
|
|
1273
1280
|
size: number;
|
|
1274
1281
|
filename: string;
|
|
1275
1282
|
rating: ContentRating;
|
|
1283
|
+
metadata?: FileMetadata;
|
|
1276
1284
|
}
|
|
1277
1285
|
export interface FileDTO extends BaseModel, PermissionModelDTO {
|
|
1278
1286
|
path: string;
|
|
@@ -1283,9 +1291,9 @@ export interface FileDTO extends BaseModel, PermissionModelDTO {
|
|
|
1283
1291
|
size: number;
|
|
1284
1292
|
filename: string;
|
|
1285
1293
|
rating: ContentRating;
|
|
1294
|
+
metadata?: FileMetadata;
|
|
1286
1295
|
}
|
|
1287
|
-
export interface FlowVersion {
|
|
1288
|
-
BaseModel: BaseModel;
|
|
1296
|
+
export interface FlowVersion extends BaseModel {
|
|
1289
1297
|
/**
|
|
1290
1298
|
* Permission fields - nullable for migration from existing data
|
|
1291
1299
|
* After migration these will be populated from parent Flow
|
|
@@ -1295,10 +1303,6 @@ export interface FlowVersion {
|
|
|
1295
1303
|
team_id: string;
|
|
1296
1304
|
team?: Team;
|
|
1297
1305
|
flow_id: string;
|
|
1298
|
-
/**
|
|
1299
|
-
* Short ID for human-readable version references (e.g., "abc123")
|
|
1300
|
-
*/
|
|
1301
|
-
short_id: string;
|
|
1302
1306
|
/**
|
|
1303
1307
|
* ConfigHash for deduplication - SHA256 of config content
|
|
1304
1308
|
*/
|
|
@@ -1395,7 +1399,6 @@ export interface FlowDTO extends BaseModel, PermissionModelDTO {
|
|
|
1395
1399
|
viewport?: FlowViewport;
|
|
1396
1400
|
}
|
|
1397
1401
|
export interface FlowVersionDTO extends BaseModel {
|
|
1398
|
-
short_id: string;
|
|
1399
1402
|
input_schema: any;
|
|
1400
1403
|
input: FlowRunInputs;
|
|
1401
1404
|
output_schema: any;
|
|
@@ -1564,9 +1567,7 @@ export interface ProjectModelDTO {
|
|
|
1564
1567
|
/**
|
|
1565
1568
|
* Project represents a container for organizing related resources
|
|
1566
1569
|
*/
|
|
1567
|
-
export interface Project {
|
|
1568
|
-
BaseModel: BaseModel;
|
|
1569
|
-
PermissionModel: PermissionModel;
|
|
1570
|
+
export interface Project extends BaseModel, PermissionModel {
|
|
1570
1571
|
name: string;
|
|
1571
1572
|
description: string;
|
|
1572
1573
|
type: ProjectType;
|
|
@@ -1673,9 +1674,7 @@ export type InstanceStatus = string;
|
|
|
1673
1674
|
export declare const InstanceStatusPending: InstanceStatus;
|
|
1674
1675
|
export declare const InstanceStatusActive: InstanceStatus;
|
|
1675
1676
|
export declare const InstanceStatusDeleted: InstanceStatus;
|
|
1676
|
-
export interface Instance {
|
|
1677
|
-
BaseModel: BaseModel;
|
|
1678
|
-
PermissionModel: PermissionModel;
|
|
1677
|
+
export interface Instance extends BaseModel, PermissionModel {
|
|
1679
1678
|
cloud: InstanceCloudProvider;
|
|
1680
1679
|
name: string;
|
|
1681
1680
|
region: string;
|
|
@@ -1891,9 +1890,7 @@ export type Infra = string;
|
|
|
1891
1890
|
export declare const InfraPrivate: Infra;
|
|
1892
1891
|
export declare const InfraCloud: Infra;
|
|
1893
1892
|
export declare const InfraPrivateFirst: Infra;
|
|
1894
|
-
export interface Task {
|
|
1895
|
-
BaseModel: BaseModel;
|
|
1896
|
-
PermissionModel: PermissionModel;
|
|
1893
|
+
export interface Task extends BaseModel, PermissionModel {
|
|
1897
1894
|
is_featured: boolean;
|
|
1898
1895
|
status: TaskStatus;
|
|
1899
1896
|
/**
|
|
@@ -1953,6 +1950,10 @@ export interface Task {
|
|
|
1953
1950
|
*/
|
|
1954
1951
|
session_id?: string;
|
|
1955
1952
|
session?: AppSession;
|
|
1953
|
+
/**
|
|
1954
|
+
* Session timeout in seconds (only used when session="new")
|
|
1955
|
+
*/
|
|
1956
|
+
session_timeout?: number;
|
|
1956
1957
|
}
|
|
1957
1958
|
export interface TaskEvent {
|
|
1958
1959
|
id: string;
|
|
@@ -2012,6 +2013,7 @@ export interface TaskDTO extends BaseModel, PermissionModelDTO {
|
|
|
2012
2013
|
transaction_id?: string;
|
|
2013
2014
|
transaction?: Transaction;
|
|
2014
2015
|
session_id?: string;
|
|
2016
|
+
session_timeout?: number;
|
|
2015
2017
|
}
|
|
2016
2018
|
export interface TimescaleTask {
|
|
2017
2019
|
id: string;
|
|
@@ -2029,8 +2031,7 @@ export type TeamType = string;
|
|
|
2029
2031
|
export declare const TeamTypePersonal: TeamType;
|
|
2030
2032
|
export declare const TeamTypeTeam: TeamType;
|
|
2031
2033
|
export declare const TeamTypeSystem: TeamType;
|
|
2032
|
-
export interface Team {
|
|
2033
|
-
BaseModel: BaseModel;
|
|
2034
|
+
export interface Team extends BaseModel {
|
|
2034
2035
|
type: TeamType;
|
|
2035
2036
|
username: string;
|
|
2036
2037
|
email: string;
|
|
@@ -2137,8 +2138,7 @@ export declare const TransactionTypeDebit: TransactionType;
|
|
|
2137
2138
|
/**
|
|
2138
2139
|
* Transaction represents a single credit transaction
|
|
2139
2140
|
*/
|
|
2140
|
-
export interface Transaction {
|
|
2141
|
-
BaseModel: BaseModel;
|
|
2141
|
+
export interface Transaction extends BaseModel {
|
|
2142
2142
|
PermissionModel: PermissionModel;
|
|
2143
2143
|
type: TransactionType;
|
|
2144
2144
|
amount: number;
|
|
@@ -2150,6 +2150,12 @@ export interface Transaction {
|
|
|
2150
2150
|
metadata: {
|
|
2151
2151
|
[key: string]: any;
|
|
2152
2152
|
};
|
|
2153
|
+
/**
|
|
2154
|
+
* SideEffectsProcessed tracks whether side effects (notifications, auto-recharge,
|
|
2155
|
+
* billing status changes) have been processed for this transaction.
|
|
2156
|
+
* Set to true via WithSkipTxSideEffects context to skip side effects (e.g. migrations).
|
|
2157
|
+
*/
|
|
2158
|
+
side_effects_processed: boolean;
|
|
2153
2159
|
}
|
|
2154
2160
|
/**
|
|
2155
2161
|
* PaymentRecordStatus represents the status of a payment
|
|
@@ -2168,12 +2174,11 @@ export declare const PaymentRecordTypeAutoRecharge: PaymentRecordType;
|
|
|
2168
2174
|
/**
|
|
2169
2175
|
* PaymentRecord stores Stripe payment details for both checkout sessions and direct charges
|
|
2170
2176
|
*/
|
|
2171
|
-
export interface PaymentRecord {
|
|
2172
|
-
BaseModel: BaseModel;
|
|
2173
|
-
PermissionModel: PermissionModel;
|
|
2177
|
+
export interface PaymentRecord extends BaseModel, PermissionModel {
|
|
2174
2178
|
type: PaymentRecordType;
|
|
2175
2179
|
status: PaymentRecordStatus;
|
|
2176
2180
|
amount: number;
|
|
2181
|
+
service_fee: number;
|
|
2177
2182
|
stripe_customer_id: string;
|
|
2178
2183
|
payment_intent_id: string;
|
|
2179
2184
|
receipt_url: string;
|
|
@@ -2248,9 +2253,7 @@ export interface OutputMeta {
|
|
|
2248
2253
|
inputs: MetaItem[];
|
|
2249
2254
|
outputs: MetaItem[];
|
|
2250
2255
|
}
|
|
2251
|
-
export interface UsageEvent {
|
|
2252
|
-
BaseModel: BaseModel;
|
|
2253
|
-
PermissionModel: PermissionModel;
|
|
2256
|
+
export interface UsageEvent extends BaseModel, PermissionModel {
|
|
2254
2257
|
usage_billing_record_id: string;
|
|
2255
2258
|
reference_id: string;
|
|
2256
2259
|
resource_id: string;
|
|
@@ -2263,9 +2266,14 @@ export interface UsageEvent {
|
|
|
2263
2266
|
quantity: number;
|
|
2264
2267
|
unit: string;
|
|
2265
2268
|
}
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
+
/**
|
|
2270
|
+
* DiscountItem represents a single discount applied to a billing record
|
|
2271
|
+
*/
|
|
2272
|
+
export interface DiscountItem {
|
|
2273
|
+
reason: string;
|
|
2274
|
+
amount: number;
|
|
2275
|
+
}
|
|
2276
|
+
export interface UsageBillingRecord extends BaseModel, PermissionModel {
|
|
2269
2277
|
/**
|
|
2270
2278
|
* Fee breakdown (all in microcents)
|
|
2271
2279
|
*/
|
|
@@ -2297,9 +2305,7 @@ export interface UsageBillingRecord {
|
|
|
2297
2305
|
partner_credit_transaction_id: string;
|
|
2298
2306
|
partner_credit_transaction?: Transaction;
|
|
2299
2307
|
}
|
|
2300
|
-
export interface UsageBillingRefund {
|
|
2301
|
-
BaseModel: BaseModel;
|
|
2302
|
-
PermissionModel: PermissionModel;
|
|
2308
|
+
export interface UsageBillingRefund extends BaseModel, PermissionModel {
|
|
2303
2309
|
usage_billing_record_id: string;
|
|
2304
2310
|
usage_billing_record?: UsageBillingRecord;
|
|
2305
2311
|
/**
|