@ptkl/sdk 1.17.0 → 1.17.1

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.
@@ -1795,17 +1795,33 @@ var ProtokolSDK010 = (function (exports, axios) {
1795
1795
  async injectMessage(conversationUUID, data) {
1796
1796
  return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/messages/inject`, data);
1797
1797
  }
1798
+ // ── Stateless chat ──
1799
+ // Stateless completion — no conversation is created and nothing is
1800
+ // persisted. The caller owns the message list.
1801
+ //
1802
+ // Always responds with an SSE stream (message_start, thinking_delta,
1803
+ // content_delta, message_complete, error). Tool calls are surfaced in
1804
+ // message_complete for client-side execution; post the results back as
1805
+ // messages with role 'tool' and the matching tool_call_id.
1806
+ //
1807
+ // Constraints enforced server-side: agent_uuid is required, the last
1808
+ // message must have role 'user', 'context' or 'tool', and no message
1809
+ // content may exceed 32000 bytes.
1810
+ //
1811
+ // Typed as a Node stream because that is what axios `responseType:
1812
+ // 'stream'` yields under Node, which is where this binding is used.
1813
+ // Browser callers should drive the endpoint with fetch directly rather
1814
+ // than through axios.
1815
+ async chat(data) {
1816
+ return await this.client.post(`${BASE$1}/chat`, data, {
1817
+ responseType: 'stream',
1818
+ timeout: 120000,
1819
+ });
1820
+ }
1798
1821
  // ── OCR ──
1799
1822
  async ocr(data) {
1800
1823
  return await this.client.post(`${BASE$1}/ocr`, data, { timeout: 120000 });
1801
1824
  }
1802
- // ── Workflow ──
1803
- async workflowComplete(data) {
1804
- return await this.client.post(`${BASE$1}/workflow/complete`, data);
1805
- }
1806
- async workflowOcr(data) {
1807
- return await this.client.post(`${BASE$1}/workflow/ocr`, data, { timeout: 120000 });
1808
- }
1809
1825
  // ── User Access ──
1810
1826
  async createUserAccess(data) {
1811
1827
  return await this.client.post(`${BASE$1}/user-access`, data);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",
@@ -1,7 +1,7 @@
1
1
  export type { PlatformFunctions, PlatformFunction, FunctionInput, FunctionOutput, FunctionCallParams, ComponentModels, ComponentFunctions, ComponentModel, ComponentFunctionInput, ComponentFunctionOutput, } from '../types/functions';
2
2
  export type { Settings, SettingsField, FieldRoles, FieldConstraints, Context, Preset, PresetContext, Filters, Extension, Policy, SetupData, Model, } from '../types/component';
3
3
  export type { WorkflowModel, WorkflowSettings, WorkflowNode, WorkflowNodeConnection, WorkflowCreatePayload, WorkflowUpdatePayload, WorkflowListResponse, } from '../types/workflow';
4
- export type { PagedResponse as KortexPagedResponse, PaginationParams as KortexPaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document as KortexDocument, Participant, TokenUsage, ToolCall, RAGSource, Message as KortexMessage, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KortexWorkflowMessage, KortexWorkflowPayload, KortexWorkflowResult, } from '../types/kortex';
4
+ export type { PagedResponse as KortexPagedResponse, PaginationParams as KortexPaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document as KortexDocument, Participant, TokenUsage, ToolCall, RAGSource, Message as KortexMessage, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KortexChatRole, KortexChatMessage, KortexChatPayload, } from '../types/kortex';
5
5
  export type { TimberActor, TimberActorType, TimberChanges, TimberEntry, TimberLevel, TimberQueryParams, TimberQueryResponse, TimberSource, TimberUsage, TimberWritePayload, TimberLogPayload, } from '../types/timber';
6
6
  export type { SatelliteAuthConfig, SatelliteAuthType, SatelliteCommandExecutePayload, SatelliteCommandExecuteResponse, SatelliteCreatePayload, SatelliteDeployPayload, SatelliteEnv, SatelliteJsonRpcCommand, SatelliteLocaleText, SatelliteLogsParams, SatellitePermission, SatellitePermissionExport, SatelliteSchemaPayload, SatelliteSchemaVersion, SatelliteTemplate, SatelliteTemplatePayload, SatelliteWorkflowNode, SatelliteWorkflowNodeField, } from '../types/satellites';
7
7
  export { default as Component } from './component';
@@ -1,6 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import PlatformBaseClient from "./platformBaseClient";
3
- import { PagedResponse, PaginationParams, Agent, AgentCreatePayload, AgentUpdatePayload, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, Message, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KnowledgeBaseSearchPayload, KnowledgeBaseSearchResult, KortexWorkflowPayload, KortexWorkflowResult } from '../types/kortex';
3
+ import { PagedResponse, PaginationParams, Agent, AgentCreatePayload, AgentUpdatePayload, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, Message, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KnowledgeBaseSearchPayload, KnowledgeBaseSearchResult, KortexChatPayload } from '../types/kortex';
4
4
  export default class Kortex extends PlatformBaseClient {
5
5
  createAgent(data: AgentCreatePayload): Promise<AxiosResponse<Agent>>;
6
6
  listAgents(params?: PaginationParams): Promise<AxiosResponse<PagedResponse<Agent>>>;
@@ -35,9 +35,8 @@ export default class Kortex extends PlatformBaseClient {
35
35
  streamMessage(conversationUUID: string, data: SendMessagePayload): Promise<AxiosResponse<ReadableStream>>;
36
36
  listMessages(conversationUUID: string, params?: PaginationParams): Promise<AxiosResponse<PagedResponse<Message>>>;
37
37
  injectMessage(conversationUUID: string, data: InjectMessagePayload): Promise<AxiosResponse<Message>>;
38
+ chat(data: KortexChatPayload): Promise<AxiosResponse<NodeJS.ReadableStream>>;
38
39
  ocr(data: OCRPayload): Promise<AxiosResponse<OCRResult>>;
39
- workflowComplete(data: KortexWorkflowPayload): Promise<AxiosResponse<KortexWorkflowResult>>;
40
- workflowOcr(data: OCRPayload): Promise<AxiosResponse<OCRResult>>;
41
40
  createUserAccess(data: UserAccessCreatePayload): Promise<AxiosResponse<UserAccess>>;
42
41
  listUserAccess(params?: PaginationParams): Promise<AxiosResponse<PagedResponse<UserAccess>>>;
43
42
  getUserAccess(uuid: string): Promise<AxiosResponse<UserAccess>>;
@@ -20761,17 +20761,33 @@ class Kortex extends PlatformBaseClient {
20761
20761
  async injectMessage(conversationUUID, data) {
20762
20762
  return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/messages/inject`, data);
20763
20763
  }
20764
+ // ── Stateless chat ──
20765
+ // Stateless completion — no conversation is created and nothing is
20766
+ // persisted. The caller owns the message list.
20767
+ //
20768
+ // Always responds with an SSE stream (message_start, thinking_delta,
20769
+ // content_delta, message_complete, error). Tool calls are surfaced in
20770
+ // message_complete for client-side execution; post the results back as
20771
+ // messages with role 'tool' and the matching tool_call_id.
20772
+ //
20773
+ // Constraints enforced server-side: agent_uuid is required, the last
20774
+ // message must have role 'user', 'context' or 'tool', and no message
20775
+ // content may exceed 32000 bytes.
20776
+ //
20777
+ // Typed as a Node stream because that is what axios `responseType:
20778
+ // 'stream'` yields under Node, which is where this binding is used.
20779
+ // Browser callers should drive the endpoint with fetch directly rather
20780
+ // than through axios.
20781
+ async chat(data) {
20782
+ return await this.client.post(`${BASE$1}/chat`, data, {
20783
+ responseType: 'stream',
20784
+ timeout: 120000,
20785
+ });
20786
+ }
20764
20787
  // ── OCR ──
20765
20788
  async ocr(data) {
20766
20789
  return await this.client.post(`${BASE$1}/ocr`, data, { timeout: 120000 });
20767
20790
  }
20768
- // ── Workflow ──
20769
- async workflowComplete(data) {
20770
- return await this.client.post(`${BASE$1}/workflow/complete`, data);
20771
- }
20772
- async workflowOcr(data) {
20773
- return await this.client.post(`${BASE$1}/workflow/ocr`, data, { timeout: 120000 });
20774
- }
20775
20791
  // ── User Access ──
20776
20792
  async createUserAccess(data) {
20777
20793
  return await this.client.post(`${BASE$1}/user-access`, data);
@@ -1794,17 +1794,33 @@ class Kortex extends PlatformBaseClient {
1794
1794
  async injectMessage(conversationUUID, data) {
1795
1795
  return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/messages/inject`, data);
1796
1796
  }
1797
+ // ── Stateless chat ──
1798
+ // Stateless completion — no conversation is created and nothing is
1799
+ // persisted. The caller owns the message list.
1800
+ //
1801
+ // Always responds with an SSE stream (message_start, thinking_delta,
1802
+ // content_delta, message_complete, error). Tool calls are surfaced in
1803
+ // message_complete for client-side execution; post the results back as
1804
+ // messages with role 'tool' and the matching tool_call_id.
1805
+ //
1806
+ // Constraints enforced server-side: agent_uuid is required, the last
1807
+ // message must have role 'user', 'context' or 'tool', and no message
1808
+ // content may exceed 32000 bytes.
1809
+ //
1810
+ // Typed as a Node stream because that is what axios `responseType:
1811
+ // 'stream'` yields under Node, which is where this binding is used.
1812
+ // Browser callers should drive the endpoint with fetch directly rather
1813
+ // than through axios.
1814
+ async chat(data) {
1815
+ return await this.client.post(`${BASE$1}/chat`, data, {
1816
+ responseType: 'stream',
1817
+ timeout: 120000,
1818
+ });
1819
+ }
1797
1820
  // ── OCR ──
1798
1821
  async ocr(data) {
1799
1822
  return await this.client.post(`${BASE$1}/ocr`, data, { timeout: 120000 });
1800
1823
  }
1801
- // ── Workflow ──
1802
- async workflowComplete(data) {
1803
- return await this.client.post(`${BASE$1}/workflow/complete`, data);
1804
- }
1805
- async workflowOcr(data) {
1806
- return await this.client.post(`${BASE$1}/workflow/ocr`, data, { timeout: 120000 });
1807
- }
1808
1824
  // ── User Access ──
1809
1825
  async createUserAccess(data) {
1810
1826
  return await this.client.post(`${BASE$1}/user-access`, data);
@@ -288,22 +288,16 @@ type KnowledgeBaseSearchChunk = {
288
288
  type KnowledgeBaseSearchResult = {
289
289
  chunks: KnowledgeBaseSearchChunk[];
290
290
  };
291
- type KortexWorkflowMessage = {
292
- role: string;
291
+ type KortexChatRole = 'user' | 'assistant' | 'context' | 'tool';
292
+ type KortexChatMessage = {
293
+ role: KortexChatRole;
293
294
  content: string;
295
+ tool_calls?: ToolCall[];
296
+ tool_call_id?: string;
294
297
  };
295
- type KortexWorkflowPayload = {
296
- agent_uuid?: string;
297
- system_prompt?: string;
298
- response_format?: string;
299
- messages: KortexWorkflowMessage[];
300
- stream?: boolean;
301
- temperature?: number;
302
- max_tokens?: number;
298
+ type KortexChatPayload = {
299
+ agent_uuid: string;
300
+ messages: KortexChatMessage[];
303
301
  tools?: Record<string, any>[];
304
302
  };
305
- type KortexWorkflowResult = {
306
- content: string;
307
- usage: TokenUsage;
308
- };
309
- export { PagedResponse, PaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Participant, TokenUsage, ToolCall, RAGSource, Message, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultApproval, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KnowledgeBaseSearchPayload, KnowledgeBaseSearchChunk, KnowledgeBaseSearchResult, KortexWorkflowMessage, KortexWorkflowPayload, KortexWorkflowResult, };
303
+ export { PagedResponse, PaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Participant, TokenUsage, ToolCall, RAGSource, Message, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultApproval, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KnowledgeBaseSearchPayload, KnowledgeBaseSearchChunk, KnowledgeBaseSearchResult, KortexChatRole, KortexChatMessage, KortexChatPayload, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",