@inferencesh/sdk 0.36.2 → 0.38.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,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.38.0] - 2026-10-29
11
+
12
+ ### Changed
13
+ - Reading a chat's messages (`fetchMessages`, `fetchMessagesPage`, `fetchChat`, and the stream's resync after a dropped connection) sends `POST /chats/{id}/messages/list` with the limit and cursor in the body. It was `GET /chats/{id}/messages`.
14
+
15
+ ### Added
16
+ - The server proxy forwards `POST /chats/{id}/messages/list` (`conversations:read`). It still forwards `GET /chats/{id}/messages` for clients on 0.37.0 and older. A page on this version needs a proxy on this version or newer. `src/proxy/endpoints.json` is regenerated from the API.
17
+
18
+ ## [0.37.0] - 2026-10-29
19
+
20
+ ### Added
21
+ - `ChatDTO.origin` (`ChatOrigin`: ui, api, trigger, integration, openai_client, embed, hook, subagent, branch): how the chat came to be. `GET /chats` filters on it. `ChatData.client` names the app a chat was started from (X-Client-Source).
22
+
23
+ ### Changed
24
+ - `ChatDTO.origin` is required, so a `ChatDTO` object literal must set it.
25
+
10
26
  ## [0.36.2] - 2026-10-28
11
27
 
12
28
  ### Fixed
package/dist/agent/api.js CHANGED
@@ -95,12 +95,12 @@ export async function fetchMessages(client, chatId, options) {
95
95
  }
96
96
  export async function fetchMessagesPage(client, chatId, options) {
97
97
  try {
98
- const params = {};
98
+ const body = {};
99
99
  if (options?.limit !== undefined)
100
- params.limit = options.limit;
100
+ body.limit = options.limit;
101
101
  if (options?.cursor)
102
- params.cursor = options.cursor;
103
- const resp = await client.http.request('get', `/chats/${chatId}/messages`, { params });
102
+ body.cursor = options.cursor;
103
+ const resp = await client.http.request('post', `/chats/${chatId}/messages/list`, { data: body });
104
104
  return resp.data || { items: [], next_cursor: '', has_next: false };
105
105
  }
106
106
  catch (error) {
@@ -283,7 +283,7 @@ export class Agent {
283
283
  deltaAccums.clear();
284
284
  const [{ data: chat }, { data: page }] = await Promise.all([
285
285
  this.http.request('get', `/chats/${chatId}`),
286
- this.http.request('get', `/chats/${chatId}/messages`),
286
+ this.http.request('post', `/chats/${chatId}/messages/list`),
287
287
  ]);
288
288
  for (const message of page?.items ?? [])
289
289
  observeMessage(message);
@@ -174,6 +174,14 @@
174
174
  "conversations:read"
175
175
  ]
176
176
  },
177
+ {
178
+ "method": "POST",
179
+ "path": "/chats/{id}/messages/list",
180
+ "purpose": "list a chat's messages",
181
+ "scopes": [
182
+ "conversations:read"
183
+ ]
184
+ },
177
185
  {
178
186
  "method": "GET",
179
187
  "path": "/chats/{id}/stream",
package/dist/types.d.ts CHANGED
@@ -2373,6 +2373,12 @@ export interface ChatDTO extends BaseModelDTO, PermissionModelDTO, ProjectModelD
2373
2373
  * ForkedFromMessageID is the message this chat was branched at.
2374
2374
  */
2375
2375
  forked_from_message_id?: string;
2376
+ /**
2377
+ * Origin is how the chat came to be: "ui" for a person in one of our
2378
+ * apps, else api, trigger, integration, openai_client, embed, hook,
2379
+ * subagent or branch. GET /chats filters on it.
2380
+ */
2381
+ origin: ChatOrigin;
2376
2382
  }
2377
2383
  /**
2378
2384
  * ChatMessageDTO for API responses
@@ -6385,7 +6391,59 @@ export interface ChatData {
6385
6391
  * that reviews it.
6386
6392
  */
6387
6393
  disable_hooks?: boolean;
6394
+ /**
6395
+ * Client is the app the chat was started from (web, mac, ios, cli,
6396
+ * sdk-js), as the request named itself (X-Client-Source). Shown, never
6397
+ * trusted or filtered on: Chat.Origin is what a chat list filters.
6398
+ */
6399
+ client?: string;
6388
6400
  }
6401
+ /**
6402
+ * ChatOrigin is how a chat came to be. A chat list shows a person's own
6403
+ * sessions (ChatOriginUI) and keeps the rest, which nobody sat in front of,
6404
+ * out of the way.
6405
+ */
6406
+ export type ChatOrigin = "ui" | "api" | "trigger" | "integration" | "openai_client" | "embed" | "hook" | "subagent" | "branch";
6407
+ /**
6408
+ * ChatOriginUI is a person in one of our apps: web, mac, ios, watch or
6409
+ * the CLI.
6410
+ */
6411
+ export declare const ChatOriginUI: ChatOrigin;
6412
+ /**
6413
+ * ChatOriginAPI is anything else that called the API: a key, an SDK, A2A.
6414
+ */
6415
+ export declare const ChatOriginAPI: ChatOrigin;
6416
+ /**
6417
+ * ChatOriginTrigger is a trigger firing (Chat.TriggerID).
6418
+ */
6419
+ export declare const ChatOriginTrigger: ChatOrigin;
6420
+ /**
6421
+ * ChatOriginIntegration is a message on a messaging channel: Slack,
6422
+ * Telegram, Discord or Teams.
6423
+ */
6424
+ export declare const ChatOriginIntegration: ChatOrigin;
6425
+ /**
6426
+ * ChatOriginOpenAIClient is a client of the OpenAI-compatible agent route.
6427
+ */
6428
+ export declare const ChatOriginOpenAIClient: ChatOrigin;
6429
+ /**
6430
+ * ChatOriginEmbed is a visitor to an embedded agent.
6431
+ */
6432
+ export declare const ChatOriginEmbed: ChatOrigin;
6433
+ /**
6434
+ * ChatOriginHook is a lifecycle hook handing its event to an agent.
6435
+ */
6436
+ export declare const ChatOriginHook: ChatOrigin;
6437
+ /**
6438
+ * ChatOriginSubagent is a sub-agent's chat, started by a tool call
6439
+ * (Chat.ParentID).
6440
+ */
6441
+ export declare const ChatOriginSubagent: ChatOrigin;
6442
+ /**
6443
+ * ChatOriginBranch is a fork of another chat, a review branch among them
6444
+ * (Chat.ForkedFromMessageID).
6445
+ */
6446
+ export declare const ChatOriginBranch: ChatOrigin;
6389
6447
  /**
6390
6448
  * PlanStep represents a step in an agent's execution plan
6391
6449
  */
@@ -7397,6 +7455,10 @@ export declare const CredentialTypeWIF: CredentialType;
7397
7455
  * CredentialStatus represents the lifecycle state of a credential.
7398
7456
  */
7399
7457
  export type CredentialStatus = "pending" | "connected" | "disconnected" | "expired" | "error";
7458
+ /**
7459
+ * CredentialStatusPending is no longer written: a credential row exists
7460
+ * once it holds a key or a login. Rows soft-deleted before then carry it.
7461
+ */
7400
7462
  export declare const CredentialStatusPending: CredentialStatus;
7401
7463
  export declare const CredentialStatusConnected: CredentialStatus;
7402
7464
  export declare const CredentialStatusDisconnected: CredentialStatus;
package/dist/types.js CHANGED
@@ -927,6 +927,46 @@ export const ChannelTypeSlack = "slack";
927
927
  export const ChannelTypeDiscord = "discord";
928
928
  export const ChannelTypeTeams = "teams";
929
929
  export const ChannelTypeTelegram = "telegram";
930
+ /**
931
+ * ChatOriginUI is a person in one of our apps: web, mac, ios, watch or
932
+ * the CLI.
933
+ */
934
+ export const ChatOriginUI = "ui";
935
+ /**
936
+ * ChatOriginAPI is anything else that called the API: a key, an SDK, A2A.
937
+ */
938
+ export const ChatOriginAPI = "api";
939
+ /**
940
+ * ChatOriginTrigger is a trigger firing (Chat.TriggerID).
941
+ */
942
+ export const ChatOriginTrigger = "trigger";
943
+ /**
944
+ * ChatOriginIntegration is a message on a messaging channel: Slack,
945
+ * Telegram, Discord or Teams.
946
+ */
947
+ export const ChatOriginIntegration = "integration";
948
+ /**
949
+ * ChatOriginOpenAIClient is a client of the OpenAI-compatible agent route.
950
+ */
951
+ export const ChatOriginOpenAIClient = "openai_client";
952
+ /**
953
+ * ChatOriginEmbed is a visitor to an embedded agent.
954
+ */
955
+ export const ChatOriginEmbed = "embed";
956
+ /**
957
+ * ChatOriginHook is a lifecycle hook handing its event to an agent.
958
+ */
959
+ export const ChatOriginHook = "hook";
960
+ /**
961
+ * ChatOriginSubagent is a sub-agent's chat, started by a tool call
962
+ * (Chat.ParentID).
963
+ */
964
+ export const ChatOriginSubagent = "subagent";
965
+ /**
966
+ * ChatOriginBranch is a fork of another chat, a review branch among them
967
+ * (Chat.ForkedFromMessageID).
968
+ */
969
+ export const ChatOriginBranch = "branch";
930
970
  export const ChatEventTypeHook = "hook";
931
971
  /**
932
972
  * ChatEventTypeRunFailed marks the point a run ended in failure; the
@@ -1333,6 +1373,10 @@ export const CredentialTypeOAuth = "oauth";
1333
1373
  export const CredentialTypeAPIKey = "api_key";
1334
1374
  export const CredentialTypeServiceAccount = "service_account";
1335
1375
  export const CredentialTypeWIF = "wif";
1376
+ /**
1377
+ * CredentialStatusPending is no longer written: a credential row exists
1378
+ * once it holds a key or a login. Rows soft-deleted before then carry it.
1379
+ */
1336
1380
  export const CredentialStatusPending = "pending";
1337
1381
  export const CredentialStatusConnected = "connected";
1338
1382
  export const CredentialStatusDisconnected = "disconnected";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.36.2",
3
+ "version": "0.38.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",