@inferencesh/sdk 0.7.0 → 0.8.0

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.8.0] - 2026-09-24
11
+
12
+ ### Removed
13
+
14
+ - The integration-named aliases: `IntegrationsAPI`, `client.integrations`, the `Integration*` type aliases, and `httpTool().auth({ integration, integrationId })`. Use `CredentialsAPI`, `client.credentials`, the `Credential*` types and `auth({ credential, credentialId })`.
15
+
10
16
  ## [0.7.0] - 2026-09-23
11
17
 
12
18
  ### Changed
package/dist/index.d.ts CHANGED
@@ -21,14 +21,12 @@ export { TeamsAPI, type MeResponse } from './api/teams';
21
21
  export { SecretsAPI } from './api/secrets';
22
22
  export { ApiKeysAPI } from './api/api-keys';
23
23
  export { CredentialsAPI } from './api/credentials';
24
- /** @deprecated renamed CredentialsAPI */
25
- export { CredentialsAPI as IntegrationsAPI } from './api/credentials';
26
24
  export { SearchAPI } from './api/search';
27
25
  export { ProjectsAPI } from './api/projects';
28
26
  export { MCPServersAPI } from './api/mcp-servers';
29
27
  export { LiveSession, accessUrl } from './live/session';
30
28
  export type { LiveState, LiveEnd, LiveHandlers, LiveSessionOptions, WebSocketLike, WebSocketConstructor } from './live/session';
31
- export { STREAM_FORMAT, isLiveField, parseMediaType, pcmFormat, splitLiveSchema, binaryLiveField, alternativeLabel, } from './live/schema';
29
+ export { STREAM_FORMAT, CLEAR_KEY, isLiveField, parseMediaType, pcmFormat, splitLiveSchema, binaryLiveField, alternativeLabel, } from './live/schema';
32
30
  export type { JsonSchema, MediaType, PCMFormat, LiveField } from './live/schema';
33
31
  export { tool, appTool, agentTool, webhookTool, httpTool, callTool, mcpTool, internalTools, string, number, integer, boolean, enumOf, object, array, optional, } from './tool-builder';
34
32
  export type { ClientTool, ClientToolHandler } from './tool-builder';
@@ -39,7 +37,6 @@ export { parseStatus, isTerminalStatus, isChatBusy, pendingApprovals } from './u
39
37
  export type { PendingApproval } from './utils';
40
38
  export * from './types';
41
39
  export type { TaskDTO as Task } from './types';
42
- export type { CredentialDTO as IntegrationDTO, CredentialConfigDTO as IntegrationConfigDTO, CredentialConnectRequest as IntegrationConnectRequest, CredentialConnectResponse as IntegrationConnectResponse, CredentialCompleteOAuthRequest as IntegrationCompleteOAuthRequest, CredentialRequirement as IntegrationRequirement, CredentialStatus as IntegrationStatus, CredentialScope as IntegrationScope, CredentialGrant as IntegrationGrant, CredentialType as IntegrationAuthType, CredentialProvider as IntegrationProvider, } from './types';
43
40
  import { HttpClient, type HttpClientConfig } from './http/client';
44
41
  import { TasksAPI, RunOptions } from './api/tasks';
45
42
  import { SocketsAPI } from './api/sockets';
@@ -119,8 +116,6 @@ export declare class Inference {
119
116
  readonly projects: ProjectsAPI;
120
117
  readonly mcpServers: MCPServersAPI;
121
118
  readonly sockets: SocketsAPI;
122
- /** @deprecated renamed `credentials` */
123
- get integrations(): CredentialsAPI;
124
119
  constructor(config: InferenceConfig | HttpClientConfig);
125
120
  /** @internal */
126
121
  _request<T>(method: 'get' | 'post' | 'put' | 'delete', endpoint: string, options?: {
package/dist/index.js CHANGED
@@ -23,14 +23,12 @@ export { TeamsAPI } from './api/teams';
23
23
  export { SecretsAPI } from './api/secrets';
24
24
  export { ApiKeysAPI } from './api/api-keys';
25
25
  export { CredentialsAPI } from './api/credentials';
26
- /** @deprecated renamed CredentialsAPI */
27
- export { CredentialsAPI as IntegrationsAPI } from './api/credentials';
28
26
  export { SearchAPI } from './api/search';
29
27
  export { ProjectsAPI } from './api/projects';
30
28
  export { MCPServersAPI } from './api/mcp-servers';
31
29
  // Live: the socket of a stream task and the live fields of its schemas
32
30
  export { LiveSession, accessUrl } from './live/session';
33
- export { STREAM_FORMAT, isLiveField, parseMediaType, pcmFormat, splitLiveSchema, binaryLiveField, alternativeLabel, } from './live/schema';
31
+ export { STREAM_FORMAT, CLEAR_KEY, isLiveField, parseMediaType, pcmFormat, splitLiveSchema, binaryLiveField, alternativeLabel, } from './live/schema';
34
32
  // Tool Builder (fluent API)
35
33
  export { tool, appTool, agentTool, webhookTool, httpTool, callTool, mcpTool, internalTools, string, number, integer, boolean, enumOf, object, array, optional, } from './tool-builder';
36
34
  // Hook Builder (fluent API)
@@ -74,10 +72,6 @@ import { MCPServersAPI } from './api/mcp-servers';
74
72
  * ```
75
73
  */
76
74
  export class Inference {
77
- /** @deprecated renamed `credentials` */
78
- get integrations() {
79
- return this.credentials;
80
- }
81
75
  constructor(config) {
82
76
  // Handle both simple config and full HttpClientConfig
83
77
  this.http = new HttpClient({
@@ -17,6 +17,11 @@
17
17
  * JSON Schema type keeps it.
18
18
  */
19
19
  export declare const STREAM_FORMAT = "stream";
20
+ /**
21
+ * A control frame, `{"$clear": "audio"}`: drop what has been buffered of a
22
+ * live output field. Reserved keys start with `$`, which no field name can.
23
+ */
24
+ export declare const CLEAR_KEY = "$clear";
20
25
  /** The part of JSON Schema these helpers read. */
21
26
  export interface JsonSchema {
22
27
  $ref?: string;
@@ -17,6 +17,11 @@
17
17
  * JSON Schema type keeps it.
18
18
  */
19
19
  export const STREAM_FORMAT = 'stream';
20
+ /**
21
+ * A control frame, `{"$clear": "audio"}`: drop what has been buffered of a
22
+ * live output field. Reserved keys start with `$`, which no field name can.
23
+ */
24
+ export const CLEAR_KEY = '$clear';
20
25
  export function isLiveField(schema) {
21
26
  return !!schema && schema.format === STREAM_FORMAT;
22
27
  }
@@ -27,6 +27,12 @@ export interface LiveHandlers {
27
27
  onBinary?: (data: ArrayBuffer) => void;
28
28
  /** A partial output object keyed by field name. */
29
29
  onPatch?: (patch: Record<string, unknown>) => void;
30
+ /**
31
+ * Drop what you have buffered of this live output field: the app sends it
32
+ * when an answer is cut short, e.g. the user talked over it. Without this
33
+ * handler the control frame reaches onPatch as `{"$clear": field}`.
34
+ */
35
+ onClear?: (field: string) => void;
30
36
  }
31
37
  /**
32
38
  * Follows the task the socket belongs to. `done` settles when the task ends
@@ -1,3 +1,4 @@
1
+ import { CLEAR_KEY } from './schema';
1
2
  const WS_OPEN = 1;
2
3
  // 1012: the relay is restarting and closed an end that still waited for its
3
4
  // peer. 1013: the peer did not come in time. Both mean "dial again" while the
@@ -63,7 +64,15 @@ export class LiveSession {
63
64
  patch = { text: event.data };
64
65
  }
65
66
  if (patch && typeof patch === 'object' && !Array.isArray(patch)) {
66
- this.handlers.onPatch?.(patch);
67
+ const record = patch;
68
+ const clear = record[CLEAR_KEY];
69
+ if (this.handlers.onClear && typeof clear === 'string') {
70
+ this.handlers.onClear(clear);
71
+ delete record[CLEAR_KEY];
72
+ if (Object.keys(record).length === 0)
73
+ return;
74
+ }
75
+ this.handlers.onPatch?.(record);
67
76
  }
68
77
  }
69
78
  else {
@@ -94,8 +94,6 @@ declare class HTTPToolBuilder extends ToolBuilder {
94
94
  auth(config: {
95
95
  credential?: string;
96
96
  credentialId?: string;
97
- /** @deprecated renamed `credential` */ integration?: string;
98
- /** @deprecated renamed `credentialId` */ integrationId?: string;
99
97
  apiKey?: string;
100
98
  bearer?: string;
101
99
  header?: string;
@@ -189,9 +189,8 @@ class HTTPToolBuilder extends ToolBuilder {
189
189
  * send a vault secret.
190
190
  */
191
191
  auth(config) {
192
- const provider = config.credential ?? config.integration;
193
- if (provider) {
194
- this.authConfig = { type: ToolAuthTypeCredential, provider, credential_id: config.credentialId ?? config.integrationId };
192
+ if (config.credential) {
193
+ this.authConfig = { type: ToolAuthTypeCredential, provider: config.credential, credential_id: config.credentialId };
195
194
  }
196
195
  else if (config.apiKey) {
197
196
  this.authConfig = { type: ToolAuthTypeAPIKey, secret: config.apiKey, header: config.header || 'X-API-Key' };
package/dist/types.d.ts CHANGED
@@ -127,11 +127,6 @@ export interface ToolAuthConfig {
127
127
  type: ToolAuthType;
128
128
  provider?: string;
129
129
  credential_id?: string;
130
- /**
131
- * Deprecated: the credential id used to be called integration_id. Read
132
- * through CredentialRef(); never written.
133
- */
134
- integration_id?: string;
135
130
  secret?: string;
136
131
  header?: string;
137
132
  }
@@ -147,11 +142,6 @@ export interface HTTPToolConfig {
147
142
  }
148
143
  export interface MCPToolConfig {
149
144
  credential_id?: string;
150
- /**
151
- * Deprecated: the credential id used to be called integration_id. Read
152
- * through CredentialRef(); never written.
153
- */
154
- integration_id?: string;
155
145
  tool_name: string;
156
146
  }
157
147
  export interface AppToolConfigDTO {
@@ -855,7 +845,7 @@ export declare const ScopeSecretsRead: Scope;
855
845
  export declare const ScopeSecretsWrite: Scope;
856
846
  /**
857
847
  * Action-level scopes for credentials (connected accounts, vaults,
858
- * custom providers, MCP servers). Formerly integrations:read|write.
848
+ * custom providers, MCP servers).
859
849
  */
860
850
  export declare const ScopeCredentialsRead: Scope;
861
851
  /**
@@ -1093,13 +1083,28 @@ export interface SecretRequirement {
1093
1083
  optional?: boolean;
1094
1084
  }
1095
1085
  /**
1096
- * CredentialRequirement defines a credential that an app requires.
1097
- * Key is the provider slug (e.g. "bytedance", "google").
1098
- * Secrets lists the specific env var names to inject from this credential.
1099
- * Scopes lists OAuth scopes needed (for OAuth credentials).
1086
+ * CredentialRequirement is an entry under credentials: in inf.yml: keys an
1087
+ * app needs that belong to a provider. Provider names whose credential
1088
+ * supplies them; Secrets lists the keys to inject from it (an API key
1089
+ * credential), Scopes what to ask for (an OAuth one).
1090
+ * credentials:
1091
+ * - provider: acme
1092
+ * name: Acme CRM
1093
+ * website: acme.com
1094
+ * secrets: [ACME_API_KEY]
1095
+ * Key is a capability of a provider the platform defines ("x.tweet.read",
1096
+ * "google.sheets"): an OAuth grant with the scopes it implies. An entry sets
1097
+ * Provider, Key, or both; with both, Key decides how it is resolved.
1100
1098
  */
1101
1099
  export interface CredentialRequirement {
1102
- key: string;
1100
+ provider?: string;
1101
+ /**
1102
+ * Name and Website describe a provider the platform does not list: the
1103
+ * name its credential is shown under and the site its logo comes from.
1104
+ */
1105
+ name?: string;
1106
+ website?: string;
1107
+ key?: string;
1103
1108
  description?: string;
1104
1109
  optional?: boolean;
1105
1110
  secrets?: string[];
@@ -3193,6 +3198,16 @@ export interface SetupAction {
3193
3198
  scope_descriptions?: {
3194
3199
  [key: string]: string;
3195
3200
  };
3201
+ /**
3202
+ * Secrets are the keys to supply for an add_secret action on a
3203
+ * provider: saved against Provider, they become its credential.
3204
+ */
3205
+ secrets?: string[];
3206
+ /**
3207
+ * ProviderWebsite is where the logo of a provider the platform does not
3208
+ * list comes from; sent back when the keys are saved.
3209
+ */
3210
+ provider_website?: string;
3196
3211
  }
3197
3212
  /**
3198
3213
  * CheckRequirementsRequest is the request body for checking requirements
@@ -4418,7 +4433,7 @@ export type SecretScope = string;
4418
4433
  */
4419
4434
  export declare const SecretScopeTeam: SecretScope;
4420
4435
  /**
4421
- * SecretScopeInternal is an integration-managed secret, hidden from user lists
4436
+ * SecretScopeInternal is a credential-managed secret, hidden from user lists
4422
4437
  */
4423
4438
  export declare const SecretScopeInternal: SecretScope;
4424
4439
  /**
package/dist/types.js CHANGED
@@ -199,7 +199,7 @@ export const ScopeSecretsRead = "secrets:read";
199
199
  export const ScopeSecretsWrite = "secrets:write";
200
200
  /**
201
201
  * Action-level scopes for credentials (connected accounts, vaults,
202
- * custom providers, MCP servers). Formerly integrations:read|write.
202
+ * custom providers, MCP servers).
203
203
  */
204
204
  export const ScopeCredentialsRead = "credentials:read";
205
205
  /**
@@ -608,7 +608,7 @@ export const ResponseFormatTypeJSONSchema = "json_schema";
608
608
  */
609
609
  export const SecretScopeTeam = "team";
610
610
  /**
611
- * SecretScopeInternal is an integration-managed secret, hidden from user lists
611
+ * SecretScopeInternal is a credential-managed secret, hidden from user lists
612
612
  */
613
613
  export const SecretScopeInternal = "internal";
614
614
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
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",