@inferencesh/sdk 0.5.1 → 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/dist/agent/api.js CHANGED
@@ -24,6 +24,7 @@ export async function sendAdHocMessage(client, config, chatId, text, imageUris,
24
24
  system_prompt: config.system_prompt ?? '',
25
25
  tools: toolSchemas
26
26
  },
27
+ agent_name: config.name,
27
28
  input: {
28
29
  text,
29
30
  images: imageUris,
@@ -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
@@ -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
- version?: string;
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
  */
@@ -235,6 +235,11 @@ export interface SkillConfig {
235
235
  * Using Go embedding flattens these fields in JSON serialization.
236
236
  */
237
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;
238
243
  description?: string;
239
244
  system_prompt?: string;
240
245
  example_prompts?: string[];
@@ -268,7 +273,7 @@ export interface AgentVersion extends BaseModel, PermissionModel {
268
273
  }
269
274
  export interface CoreAppConfigDTO {
270
275
  id?: string;
271
- version?: string;
276
+ version_id?: string;
272
277
  ref?: string;
273
278
  app?: AppDTO;
274
279
  /**
@@ -330,7 +335,7 @@ export interface ApiAppRunRequest {
330
335
  */
331
336
  app?: string;
332
337
  /**
333
- * Alternative: specify app by ID (for internal use)
338
+ * Deprecated: use App ref instead. Direct ID bypasses ref routing.
334
339
  */
335
340
  app_id?: string;
336
341
  version_id?: string;
@@ -1253,6 +1258,19 @@ export interface WorkerStateSummary {
1253
1258
  cpus: WorkerCPU[];
1254
1259
  rams: WorkerRAM[];
1255
1260
  }
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
+ }
1256
1274
  export interface File extends BaseModel, PermissionModel {
1257
1275
  path: string;
1258
1276
  remote_path: string;
@@ -1262,6 +1280,7 @@ export interface File extends BaseModel, PermissionModel {
1262
1280
  size: number;
1263
1281
  filename: string;
1264
1282
  rating: ContentRating;
1283
+ metadata?: FileMetadata;
1265
1284
  }
1266
1285
  export interface FileDTO extends BaseModel, PermissionModelDTO {
1267
1286
  path: string;
@@ -1272,6 +1291,7 @@ export interface FileDTO extends BaseModel, PermissionModelDTO {
1272
1291
  size: number;
1273
1292
  filename: string;
1274
1293
  rating: ContentRating;
1294
+ metadata?: FileMetadata;
1275
1295
  }
1276
1296
  export interface FlowVersion extends BaseModel {
1277
1297
  /**
@@ -2130,6 +2150,12 @@ export interface Transaction extends BaseModel {
2130
2150
  metadata: {
2131
2151
  [key: string]: any;
2132
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;
2133
2159
  }
2134
2160
  /**
2135
2161
  * PaymentRecordStatus represents the status of a payment
@@ -2152,6 +2178,7 @@ export interface PaymentRecord extends BaseModel, PermissionModel {
2152
2178
  type: PaymentRecordType;
2153
2179
  status: PaymentRecordStatus;
2154
2180
  amount: number;
2181
+ service_fee: number;
2155
2182
  stripe_customer_id: string;
2156
2183
  payment_intent_id: string;
2157
2184
  receipt_url: string;
@@ -2239,6 +2266,13 @@ export interface UsageEvent extends BaseModel, PermissionModel {
2239
2266
  quantity: number;
2240
2267
  unit: string;
2241
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
+ }
2242
2276
  export interface UsageBillingRecord extends BaseModel, PermissionModel {
2243
2277
  /**
2244
2278
  * Fee breakdown (all in microcents)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.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",