@inferencesh/sdk 0.21.0 → 0.22.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 +47 -0
- package/dist/agent/api.d.ts +35 -1
- package/dist/agent/api.js +35 -1
- package/dist/agent/reducer.js +23 -7
- package/dist/agent/types.d.ts +29 -4
- package/dist/api/agents.d.ts +9 -3
- package/dist/api/agents.js +87 -63
- package/dist/api/api-keys.d.ts +2 -5
- package/dist/api/apps.d.ts +9 -2
- package/dist/api/apps.js +9 -1
- package/dist/api/chats.d.ts +13 -3
- package/dist/api/chats.js +13 -2
- package/dist/api/engines.d.ts +4 -2
- package/dist/api/engines.js +3 -2
- package/dist/api/flow-runs.d.ts +7 -2
- package/dist/api/flow-runs.js +7 -2
- package/dist/api/flows.d.ts +13 -2
- package/dist/api/flows.js +15 -1
- package/dist/api/knowledge.d.ts +7 -4
- package/dist/api/knowledge.js +6 -4
- package/dist/api/mcp-servers.d.ts +2 -1
- package/dist/api/projects.d.ts +5 -3
- package/dist/api/projects.js +3 -2
- package/dist/api/secrets.d.ts +2 -2
- package/dist/api/tasks.js +38 -56
- package/dist/api/teams.d.ts +4 -2
- package/dist/api/teams.js +3 -2
- package/dist/api/write-bodies.d.ts +110 -0
- package/dist/api/write-bodies.js +1 -0
- package/dist/http/client.d.ts +1 -1
- package/dist/http/client.js +2 -1
- package/dist/http/loopback.d.ts +8 -0
- package/dist/http/loopback.js +18 -0
- package/dist/http/stream-until-terminal.d.ts +55 -0
- package/dist/http/stream-until-terminal.js +88 -0
- package/dist/http/stream.d.ts +1 -0
- package/dist/http/stream.js +7 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/proxy/endpoints.json +156 -0
- package/dist/proxy/express.d.ts +5 -6
- package/dist/proxy/express.js +18 -2
- package/dist/proxy/hono.d.ts +5 -3
- package/dist/proxy/hono.js +4 -3
- package/dist/proxy/index.d.ts +165 -6
- package/dist/proxy/index.js +409 -25
- package/dist/proxy/nextjs.d.ts +29 -17
- package/dist/proxy/nextjs.js +72 -62
- package/dist/proxy/remix.d.ts +5 -3
- package/dist/proxy/remix.js +4 -3
- package/dist/proxy/svelte.d.ts +5 -4
- package/dist/proxy/svelte.js +4 -4
- package/dist/types.d.ts +423 -6
- package/dist/types.js +111 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +7 -0
- package/package.json +2 -1
package/dist/types.js
CHANGED
|
@@ -203,6 +203,12 @@ export const ScopeSecretsRead = "secrets:read";
|
|
|
203
203
|
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
204
204
|
*/
|
|
205
205
|
export const ScopeSecretsWrite = "secrets:write";
|
|
206
|
+
/**
|
|
207
|
+
* ScopeSecretsReveal reads a secret's plaintext value. A key holding
|
|
208
|
+
* secrets:read holds it too (keys revealed with secrets:read before it
|
|
209
|
+
* existed); an app's OAuth token or a bound session never does.
|
|
210
|
+
*/
|
|
211
|
+
export const ScopeSecretsReveal = "secrets:reveal";
|
|
206
212
|
/**
|
|
207
213
|
* Action-level scopes for credentials (connected accounts, vaults,
|
|
208
214
|
* auth schemes, MCP servers).
|
|
@@ -284,6 +290,32 @@ export const ScopeSettingsRead = "settings:read";
|
|
|
284
290
|
* Empty scopes = full access (for backwards compatibility with existing keys).
|
|
285
291
|
*/
|
|
286
292
|
export const ScopeSettingsWrite = "settings:write";
|
|
293
|
+
/**
|
|
294
|
+
* Approvals: answering a human-in-the-loop question (a tool approval, a
|
|
295
|
+
* gate, a widget or MCP input request, always-allow) and widening a
|
|
296
|
+
* chat's approval policy (allow every tool, skip hooks, allow rules).
|
|
297
|
+
* Held only by the account holder's own sign-in.
|
|
298
|
+
*/
|
|
299
|
+
export const ScopeApprovalsWrite = "approvals:write";
|
|
300
|
+
/**
|
|
301
|
+
* ScopeAdminRead views platform administration (/admin GET). Held
|
|
302
|
+
* only by an admin's own sign-in; the route's admin gate decides
|
|
303
|
+
* whether it carries power.
|
|
304
|
+
*/
|
|
305
|
+
export const ScopeAdminRead = "admin:read";
|
|
306
|
+
/**
|
|
307
|
+
* ScopeAdminWrite changes platform administration (/admin). Held only
|
|
308
|
+
* by an admin's own sign-in.
|
|
309
|
+
*/
|
|
310
|
+
export const ScopeAdminWrite = "admin:write";
|
|
311
|
+
/**
|
|
312
|
+
* ScopeAdminPricing reads and changes store pricing: a version's
|
|
313
|
+
* terms, its draft pricing (edit, evaluate, discard, publish, apply to
|
|
314
|
+
* the listing) and the sample tasks drafts are evaluated against. Held
|
|
315
|
+
* by an admin's own sign-in with platform power, and by a key of the
|
|
316
|
+
* platform's automation account (ScopeDefinition.Automation).
|
|
317
|
+
*/
|
|
318
|
+
export const ScopeAdminPricing = "admin:pricing";
|
|
287
319
|
export const ScopeGroupAgents = "agents";
|
|
288
320
|
export const ScopeGroupApps = "apps";
|
|
289
321
|
export const ScopeGroupConversations = "conversations";
|
|
@@ -302,6 +334,8 @@ export const ScopeGroupKnowledge = "knowledge";
|
|
|
302
334
|
export const ScopeGroupArtifacts = "artifacts";
|
|
303
335
|
export const ScopeGroupUser = "user";
|
|
304
336
|
export const ScopeGroupSettings = "settings";
|
|
337
|
+
export const ScopeGroupApprovals = "approvals";
|
|
338
|
+
export const ScopeGroupAdmin = "admin";
|
|
305
339
|
/**
|
|
306
340
|
* AlwaysAllowScopeExact: this call exactly (each piece of the command,
|
|
307
341
|
* the file, the domain).
|
|
@@ -379,6 +413,21 @@ export const ErrorCodeAccountBanned = "account_banned";
|
|
|
379
413
|
*/
|
|
380
414
|
export const ErrorCodePersonRequired = "person_required";
|
|
381
415
|
export const ErrorCodeOTPRequired = "otp_required";
|
|
416
|
+
/**
|
|
417
|
+
* ErrorCodeRequiresSignIn (403): the action needs a scope only the
|
|
418
|
+
* account holder's own sign-in holds (answering an approval, widening a
|
|
419
|
+
* chat's approval policy, the account, API keys, billing changes,
|
|
420
|
+
* admin), and the request carried an API key, an app's OAuth token or
|
|
421
|
+
* another delegated credential. Sign in on the web app or with `belt
|
|
422
|
+
* login` to do it.
|
|
423
|
+
*/
|
|
424
|
+
export const ErrorCodeRequiresSignIn = "requires_sign_in";
|
|
425
|
+
/**
|
|
426
|
+
* ErrorCodeInsufficientScope (403): the credential does not hold the
|
|
427
|
+
* scope the operation takes (an API key, an app's OAuth token or a
|
|
428
|
+
* narrowed login granted less). The detail names the scope.
|
|
429
|
+
*/
|
|
430
|
+
export const ErrorCodeInsufficientScope = "insufficient_scope";
|
|
382
431
|
/**
|
|
383
432
|
* ErrorCodeImpersonationReasonRequired (403): a platform admin named a
|
|
384
433
|
* team they are not a member of without a live impersonation grant.
|
|
@@ -386,6 +435,37 @@ export const ErrorCodeOTPRequired = "otp_required";
|
|
|
386
435
|
*/
|
|
387
436
|
export const ErrorCodeImpersonationReasonRequired = "impersonation_reason_required";
|
|
388
437
|
export const ErrorCodeMCPAuthExpired = "mcp_auth_expired";
|
|
438
|
+
/**
|
|
439
|
+
* Admin elevation ("belt admin elevate"). AdminSessionRequired (403): a
|
|
440
|
+
* platform admin's credential that carries no admin power reached an
|
|
441
|
+
* admin route; a CLI login gets it by elevating. CLISessionRequired
|
|
442
|
+
* (403): only a CLI login may ask to be elevated. AdminRequired (403):
|
|
443
|
+
* only a platform admin may ask for or grant one. SameAdminRequired
|
|
444
|
+
* (403): the elevation was asked for by another account.
|
|
445
|
+
* BrowserSessionRequired (403): only the admin's own browser sign-in
|
|
446
|
+
* grants one, and only the person's own browser sign-in changes how the
|
|
447
|
+
* account is signed into (authenticator enrollment, RequireBrowserSession).
|
|
448
|
+
* InvalidTTL (400): the elevation asked for a window outside
|
|
449
|
+
* models.AdminElevationMinTTL..AdminElevationMaxTTL.
|
|
450
|
+
* AdminScopesNotApproved (403): a platform admin's CLI login was approved
|
|
451
|
+
* with a scope list that does not name the admin scopes, so it can't be
|
|
452
|
+
* elevated: log in again approving them, then elevate.
|
|
453
|
+
*/
|
|
454
|
+
export const ErrorCodeAdminSessionRequired = "admin_session_required";
|
|
455
|
+
export const ErrorCodeAdminScopesNotApproved = "admin_scopes_not_approved";
|
|
456
|
+
export const ErrorCodeCLISessionRequired = "cli_session_required";
|
|
457
|
+
export const ErrorCodeAdminRequired = "admin_required";
|
|
458
|
+
export const ErrorCodeSameAdminRequired = "same_admin_required";
|
|
459
|
+
export const ErrorCodeBrowserSessionRequired = "browser_session_required";
|
|
460
|
+
export const ErrorCodeInvalidTTL = "invalid_ttl";
|
|
461
|
+
/**
|
|
462
|
+
* AdminAuthenticatorRequired (403): a platform admin without an
|
|
463
|
+
* authenticator app (TOTP) enrolled. Admin power needs one; until it is
|
|
464
|
+
* enrolled (POST /auth/totp/enroll, then /auth/totp/confirm) the admin
|
|
465
|
+
* works as an ordinary member. An admin who has one but whose session
|
|
466
|
+
* has not proved it gets otp_required instead: re-authenticate with it.
|
|
467
|
+
*/
|
|
468
|
+
export const ErrorCodeAdminAuthenticatorRequired = "admin_authenticator_required";
|
|
389
469
|
/**
|
|
390
470
|
* Entitlements. LimitExceeded (402) and FeatureNotAvailable (403) carry
|
|
391
471
|
* EntitlementErrorMeta. EntitlementUnavailable (500) means the plan could
|
|
@@ -418,6 +498,32 @@ export const ErrorCodeAlreadyClaimed = "already_claimed";
|
|
|
418
498
|
*/
|
|
419
499
|
export const ErrorCodeAlreadyEntitled = "already_entitled";
|
|
420
500
|
export const ErrorCodeRequestOpen = "request_open";
|
|
501
|
+
/**
|
|
502
|
+
* Authorization codes (device sign-in, admin elevation) (400): the code
|
|
503
|
+
* is unknown, already approved or denied, or past its expiry.
|
|
504
|
+
*/
|
|
505
|
+
export const ErrorCodeInvalidCode = "invalid_code";
|
|
506
|
+
export const ErrorCodeAlreadyProcessed = "already_processed";
|
|
507
|
+
export const ErrorCodeExpired = "expired";
|
|
508
|
+
/**
|
|
509
|
+
* Run-time refusals. AppRetired (410): the app no longer runs.
|
|
510
|
+
* AppMaintenance (503, Retry-After): the owner paused it; the message is
|
|
511
|
+
* theirs. InvalidTransition (409): the task already moved on.
|
|
512
|
+
*/
|
|
513
|
+
export const ErrorCodeAppRetired = "app_retired";
|
|
514
|
+
export const ErrorCodeAppMaintenance = "app_maintenance";
|
|
515
|
+
export const ErrorCodeInvalidTransition = "invalid_transition";
|
|
516
|
+
/**
|
|
517
|
+
* Session-bound runs. SessionNotFound (404), SessionExpired and
|
|
518
|
+
* SessionEnded (410), WorkerLeased, AppMismatch and VersionMismatch
|
|
519
|
+
* (409). The SDKs match these upper-case strings.
|
|
520
|
+
*/
|
|
521
|
+
export const ErrorCodeSessionNotFound = "SESSION_NOT_FOUND";
|
|
522
|
+
export const ErrorCodeSessionExpired = "SESSION_EXPIRED";
|
|
523
|
+
export const ErrorCodeSessionEnded = "SESSION_ENDED";
|
|
524
|
+
export const ErrorCodeWorkerLeased = "WORKER_LEASED";
|
|
525
|
+
export const ErrorCodeAppMismatch = "APP_MISMATCH";
|
|
526
|
+
export const ErrorCodeVersionMismatch = "VERSION_MISMATCH";
|
|
421
527
|
/**
|
|
422
528
|
* Remote harness refusals.
|
|
423
529
|
*/
|
|
@@ -1198,6 +1304,11 @@ export const PolicyKindFlow = "Flow";
|
|
|
1198
1304
|
* PolicyKindWebFetch: fetched domains.
|
|
1199
1305
|
*/
|
|
1200
1306
|
export const PolicyKindWebFetch = "WebFetch";
|
|
1307
|
+
/**
|
|
1308
|
+
* PolicyKindSecretSend: an agent of another team sending the runner's
|
|
1309
|
+
* secrets to a host.
|
|
1310
|
+
*/
|
|
1311
|
+
export const PolicyKindSecretSend = "SecretSend";
|
|
1201
1312
|
/**
|
|
1202
1313
|
* FunctionKindRun takes an input and returns an output (optionally
|
|
1203
1314
|
* yielding progress on the way). The zero value means this.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION: string;
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK version string, sent in the X-Client-Source header. Read from
|
|
3
|
+
* package.json so the version has one source; `../package.json` resolves from
|
|
4
|
+
* both src/ and dist/, and npm always ships package.json.
|
|
5
|
+
*/
|
|
6
|
+
import pkg from '../package.json' with { type: 'json' };
|
|
7
|
+
export const SDK_VERSION = pkg.version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inferencesh/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.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",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"./proxy": {
|
|
15
|
+
"inference-src": "./src/proxy/index.ts",
|
|
15
16
|
"types": "./dist/proxy/index.d.ts",
|
|
16
17
|
"default": "./dist/proxy/index.js"
|
|
17
18
|
},
|