@inferencesh/sdk 0.12.0 → 0.14.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,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.14.0] - 2026-09-27
11
+
12
+ ### Fixed
13
+
14
+ - `tasks.create()` returns `TaskResultDTO`, what `POST /apps/run` sends (id, status, output, socket), instead of claiming a full `Task`. `run(..., { wait: false })` fetches the full task with `GET /tasks/{id}` before returning it.
15
+ - `teams.list()`, `get()`, `create()` and `update()` return `TeamDTO`, what the server sends, instead of `TeamRelationDTO`.
16
+ - `MeResponse` is the generated type (adds `org`, `team_view` and `diagnostics`; `team` is a `TeamDTO`) instead of a hand-written one.
17
+
10
18
  ## [0.8.0] - 2026-09-24
11
19
 
12
20
  ### Removed
@@ -1,6 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
- import { TaskDTO as Task, TaskLogsDTO, TaskTimingsDTO, ApiAppRunRequest, CursorListRequest, CursorListResponse } from '../types';
3
+ import { TaskDTO as Task, TaskLogsDTO, TaskTimingsDTO, ApiAppRunRequest, TaskResultDTO, CursorListRequest, CursorListResponse } from '../types';
4
4
  /** How to follow a task while it runs; see TasksAPI.watch. */
5
5
  export interface WatchOptions {
6
6
  /** Callback for real-time status updates */
@@ -44,9 +44,11 @@ export declare class TasksAPI {
44
44
  */
45
45
  get(taskId: string): Promise<Response<Task>>;
46
46
  /**
47
- * Create and run a task
47
+ * Create and run a task. POST /apps/run answers with the task result
48
+ * (id, status, output, and the socket for a stream function), not the
49
+ * full task; `get` fetches that.
48
50
  */
49
- create(data: ApiAppRunRequest): Promise<Response<Task>>;
51
+ create(data: ApiAppRunRequest): Promise<Response<TaskResultDTO>>;
50
52
  /**
51
53
  * Delete a task
52
54
  */
package/dist/api/tasks.js CHANGED
@@ -42,7 +42,9 @@ export class TasksAPI {
42
42
  return this.http.request('get', `/tasks/${taskId}`);
43
43
  }
44
44
  /**
45
- * Create and run a task
45
+ * Create and run a task. POST /apps/run answers with the task result
46
+ * (id, status, output, and the socket for a stream function), not the
47
+ * full task; `get` fetches that.
46
48
  */
47
49
  async create(data) {
48
50
  return this.http.request('post', '/apps/run', { data });
@@ -70,18 +72,14 @@ export class TasksAPI {
70
72
  */
71
73
  async run(params, processedInput, options = {}) {
72
74
  const { wait = true } = options;
73
- const resp = await this.http.request('post', '/apps/run', {
74
- data: {
75
- ...params,
76
- input: processedInput,
77
- },
78
- });
79
- const task = resp.data;
80
- // Return immediately if not waiting
75
+ const { data: created } = await this.create({ ...params, input: processedInput });
76
+ // POST /apps/run answers with a TaskResultDTO, not the full task:
77
+ // fetch that when returning now, or let the watch fill it in.
81
78
  if (!wait) {
79
+ const { data: task } = await this.get(created.id);
82
80
  return stripTask(task);
83
81
  }
84
- return this.watch(task, options).done;
82
+ return this.watch(created, options).done;
85
83
  }
86
84
  /**
87
85
  * Follows a task until it ends. `done` resolves with the task when it
@@ -1,10 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
- import { UserDTO, TeamRelationDTO, TeamMemberDTO, TeamInviteDTO, TeamCreateRequest, TeamMemberAddRequest, TeamInviteCreateRequest, AvailabilityResponse } from '../types';
4
- export interface MeResponse {
5
- user: UserDTO;
6
- team?: TeamRelationDTO;
7
- }
3
+ import { MeResponse, TeamDTO, TeamMemberDTO, TeamInviteDTO, TeamCreateRequest, TeamMemberAddRequest, TeamInviteCreateRequest, AvailabilityResponse } from '../types';
8
4
  /**
9
5
  * Teams API
10
6
  */
@@ -18,19 +14,19 @@ export declare class TeamsAPI {
18
14
  /**
19
15
  * List user's teams
20
16
  */
21
- list(): Promise<Response<TeamRelationDTO[]>>;
17
+ list(): Promise<Response<TeamDTO[]>>;
22
18
  /**
23
19
  * Get a team by ID
24
20
  */
25
- get(teamId: string): Promise<Response<TeamRelationDTO>>;
21
+ get(teamId: string): Promise<Response<TeamDTO>>;
26
22
  /**
27
23
  * Create a new team
28
24
  */
29
- create(data: TeamCreateRequest): Promise<Response<TeamRelationDTO>>;
25
+ create(data: TeamCreateRequest): Promise<Response<TeamDTO>>;
30
26
  /**
31
27
  * Update a team
32
28
  */
33
- update(teamId: string, data: Partial<TeamCreateRequest>): Promise<Response<TeamRelationDTO>>;
29
+ update(teamId: string, data: Partial<TeamCreateRequest>): Promise<Response<TeamDTO>>;
34
30
  /**
35
31
  * Delete a team
36
32
  */
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export { FlowRunsAPI } from './api/flow-runs';
17
17
  export { EnginesAPI } from './api/engines';
18
18
  export { KnowledgeAPI, SkillsAPI } from './api/knowledge';
19
19
  export { ArtifactsAPI } from './api/artifacts';
20
- export { TeamsAPI, type MeResponse } from './api/teams';
20
+ export { TeamsAPI } 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';
package/dist/types.d.ts CHANGED
@@ -524,6 +524,22 @@ export interface DeviceAuthPollResponse {
524
524
  session_token?: string;
525
525
  team_id?: string;
526
526
  }
527
+ export interface MeResponse {
528
+ user?: UserDTO;
529
+ team?: TeamDTO;
530
+ /**
531
+ * Org of the current team, when the team belongs to one. Team.Role and
532
+ * Org.IsAdmin are left unset: what the caller may do is TeamView.Can
533
+ * and TeamView.Org.Can.
534
+ */
535
+ org?: OrgDTO;
536
+ /**
537
+ * TeamView is the current team as the caller sees it in settings: kind,
538
+ * governance and capabilities (GET /teams/{id}/view).
539
+ */
540
+ team_view?: TeamViewDTO;
541
+ diagnostics?: DiagnosticsConfig;
542
+ }
527
543
  export interface TeamCreateRequest {
528
544
  name: string;
529
545
  username: string;
@@ -2936,6 +2952,24 @@ export interface UpdateNotificationPreferencesRequest {
2936
2952
  quiet_hours_end?: string;
2937
2953
  timezone?: string;
2938
2954
  }
2955
+ /**
2956
+ * OrgDTO is the API response for an org (enterprise layer above teams).
2957
+ */
2958
+ export interface OrgDTO extends BaseModelDTO {
2959
+ slug: string;
2960
+ name: string;
2961
+ avatar_url?: string;
2962
+ default_team_id?: string;
2963
+ /**
2964
+ * UsagePolicyID of the org's usage policy ('' = ungoverned, INF-808).
2965
+ */
2966
+ usage_policy_id?: string;
2967
+ /**
2968
+ * IsAdmin: whether the CALLER is on this org's admin grant list. Set on
2969
+ * caller-scoped responses.
2970
+ */
2971
+ is_admin?: boolean;
2972
+ }
2939
2973
  /**
2940
2974
  * PageMetadata holds metadata for a page
2941
2975
  */
@@ -3120,6 +3154,9 @@ export interface ProjectDTO extends BaseModelDTO, PermissionModelDTO {
3120
3154
  parent?: ProjectDTO;
3121
3155
  children: (ProjectDTO | undefined)[];
3122
3156
  }
3157
+ export interface DiagnosticsConfig {
3158
+ level: number;
3159
+ }
3123
3160
  /**
3124
3161
  * RefRouteDTO for API responses
3125
3162
  */
@@ -3714,6 +3751,34 @@ export interface TaskTimingsDTO {
3714
3751
  groups: TaskTimingGroup[];
3715
3752
  events: TaskTimingEvent[];
3716
3753
  }
3754
+ /**
3755
+ * TeamDTO is the API response for a full team.
3756
+ */
3757
+ export interface TeamDTO extends BaseModelDTO {
3758
+ type: TeamType;
3759
+ name: string;
3760
+ username: string;
3761
+ avatar_url: string;
3762
+ email: string;
3763
+ setup_completed: boolean;
3764
+ max_concurrency: number;
3765
+ status: TeamStatus;
3766
+ /**
3767
+ * Role is the CALLER's role on this team (owner/admin/member), set on
3768
+ * caller-scoped responses (/teams, /users/me). Empty when not applicable
3769
+ * (public team views, platform-admin impersonation).
3770
+ */
3771
+ role?: TeamRole;
3772
+ /**
3773
+ * OrgID of the org this team belongs to ('' = standalone team).
3774
+ */
3775
+ org_id?: string;
3776
+ /**
3777
+ * UsagePolicyID of the team's own usage policy ('' = inherit the org's,
3778
+ * or ungoverned when standalone, INF-808).
3779
+ */
3780
+ usage_policy_id?: string;
3781
+ }
3717
3782
  /**
3718
3783
  * TeamMemberDTO is the API response for a team member.
3719
3784
  */
@@ -3775,6 +3840,48 @@ export interface TeamInviteCreateRequest {
3775
3840
  email: string;
3776
3841
  role: TeamRole;
3777
3842
  }
3843
+ /**
3844
+ * GovernanceSource says who decides one aspect of a team. By is
3845
+ * shared.GovernedBySelf (the team itself) or shared.GovernedByOrg; TeamID is
3846
+ * the deciding team: the team itself, or the org's workspace.
3847
+ */
3848
+ export interface GovernanceSource {
3849
+ by: string;
3850
+ team_id: string;
3851
+ }
3852
+ /**
3853
+ * TeamGovernance is who decides a team's billing and usage policy.
3854
+ */
3855
+ export interface TeamGovernance {
3856
+ billing: GovernanceSource;
3857
+ policy: GovernanceSource;
3858
+ }
3859
+ /**
3860
+ * TeamViewOrg is the org a team belongs to, as the caller sees it.
3861
+ */
3862
+ export interface TeamViewOrg {
3863
+ id: string;
3864
+ name: string;
3865
+ slug: string;
3866
+ avatar_url: string;
3867
+ /**
3868
+ * Can is what the caller may do on the org's workspace, by the same
3869
+ * table as TeamViewDTO.Can: the org's settings and billing live there.
3870
+ */
3871
+ can: TeamCapability[];
3872
+ }
3873
+ /**
3874
+ * TeamViewDTO is a team as the caller sees it in settings: what kind of
3875
+ * workspace it is, who governs it, and what the caller may do there. Can is computed by the same table the API's route
3876
+ * gates evaluate, so clients read permissions instead of re-deriving them.
3877
+ */
3878
+ export interface TeamViewDTO {
3879
+ team_id: string;
3880
+ kind: TeamKind;
3881
+ org?: TeamViewOrg;
3882
+ governance: TeamGovernance;
3883
+ can: TeamCapability[];
3884
+ }
3778
3885
  export interface TelemetryReportDTO extends BaseModelDTO, PermissionModelDTO {
3779
3886
  ip: string;
3780
3887
  level: number;
@@ -5134,6 +5241,29 @@ export type TeamRole = "owner" | "admin" | "member";
5134
5241
  export declare const TeamRoleOwner: TeamRole;
5135
5242
  export declare const TeamRoleAdmin: TeamRole;
5136
5243
  export declare const TeamRoleMember: TeamRole;
5244
+ /**
5245
+ * TeamKind is what a team is from the caller's side of settings: the team
5246
+ * type plus whether it sits inside an org. Capabilities and governance key
5247
+ * on it (see team.Subject).
5248
+ */
5249
+ export type TeamKind = "personal" | "team" | "org_member" | "org";
5250
+ /**
5251
+ * TeamKindPersonal is an account's own workspace.
5252
+ */
5253
+ export declare const TeamKindPersonal: TeamKind;
5254
+ /**
5255
+ * TeamKindTeam is a shared workspace outside any org.
5256
+ */
5257
+ export declare const TeamKindTeam: TeamKind;
5258
+ /**
5259
+ * TeamKindOrgMember is a shared workspace inside an org: billed by the
5260
+ * org and governed by the org's usage policy.
5261
+ */
5262
+ export declare const TeamKindOrgMember: TeamKind;
5263
+ /**
5264
+ * TeamKindOrg is an org's own workspace (TeamTypeOrg).
5265
+ */
5266
+ export declare const TeamKindOrg: TeamKind;
5137
5267
  /**
5138
5268
  * TeamCapability is one thing a caller may do to a team's settings. The set is
5139
5269
  * closed; team.Subject.Can is the only place that grants them.
@@ -5634,7 +5764,25 @@ export type ToolParameterProperties = {
5634
5764
  [key: string]: ToolParameterProperty;
5635
5765
  };
5636
5766
  export interface ToolParameterProperty {
5637
- type: ToolParamType;
5767
+ /**
5768
+ * Type is the JSON Schema type of the value. Empty when AnyOf is set: the
5769
+ * value then has one of several shapes, and naming a single type would be
5770
+ * telling the model something untrue about what it may send.
5771
+ */
5772
+ type?: ToolParamType;
5773
+ /**
5774
+ * AnyOf lists the shapes a value may take, each described as a property of
5775
+ * its own. Anthropic and OpenAI both accept anyOf in tool schemas. Before
5776
+ * this field existed the converter picked one branch and dropped the rest,
5777
+ * so an app that accepted "401" or 401 could only tell the model about one.
5778
+ */
5779
+ anyOf?: ToolParameterProperty[];
5780
+ /**
5781
+ * Enum is the closed set of values a scalar may take, kept as data so a
5782
+ * consumer choosing arguments does not have to parse it back out of the
5783
+ * description.
5784
+ */
5785
+ enum?: any[];
5638
5786
  title: string;
5639
5787
  description: string;
5640
5788
  properties?: ToolParameterProperties;
package/dist/types.js CHANGED
@@ -1069,6 +1069,23 @@ export const TeamStatusTerminated = "terminated";
1069
1069
  export const TeamRoleOwner = "owner";
1070
1070
  export const TeamRoleAdmin = "admin";
1071
1071
  export const TeamRoleMember = "member";
1072
+ /**
1073
+ * TeamKindPersonal is an account's own workspace.
1074
+ */
1075
+ export const TeamKindPersonal = "personal";
1076
+ /**
1077
+ * TeamKindTeam is a shared workspace outside any org.
1078
+ */
1079
+ export const TeamKindTeam = "team";
1080
+ /**
1081
+ * TeamKindOrgMember is a shared workspace inside an org: billed by the
1082
+ * org and governed by the org's usage policy.
1083
+ */
1084
+ export const TeamKindOrgMember = "org_member";
1085
+ /**
1086
+ * TeamKindOrg is an org's own workspace (TeamTypeOrg).
1087
+ */
1088
+ export const TeamKindOrg = "org";
1072
1089
  export const TeamCapabilityEditProfile = "edit_profile";
1073
1090
  export const TeamCapabilityManageMembers = "manage_members";
1074
1091
  export const TeamCapabilityViewMembers = "view_members";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.12.0",
3
+ "version": "0.14.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",