@sinas/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/dist/{chunk-QDIOYYBA.js → chunk-RHQVV5O6.js} +220 -99
- package/dist/chunk-RHQVV5O6.js.map +1 -0
- package/dist/client.cjs +226 -98
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +228 -5
- package/dist/client.d.ts +228 -5
- package/dist/client.js +17 -1
- package/dist/index.cjs +494 -244
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -4
- package/dist/index.d.ts +62 -4
- package/dist/index.js +286 -147
- package/dist/index.js.map +1 -1
- package/dist/sinas-sdk.umd.js +486 -244
- package/dist/sinas-sdk.umd.js.map +1 -1
- package/package.json +6 -3
- package/dist/chunk-QDIOYYBA.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { QueryResult, FunctionResult, StateListResult, ChatMessageFull, ApprovalRequest, MessageContent, SinasConfig, SinasClient, AuthUser, InfoResponse, LoginResponse, OTPVerifyResponse, SinasClientOptions } from './client.cjs';
|
|
2
|
-
export { AgentBatchItem, ApprovalResult, AudioContentPart, AuthMode, BatchExecutionItem, BatchStatus, ChatCreateResult, ChatDetail, ChatMessage, Collection, ComponentContentPart, ContentPart, EnqueueFunctionOptions, EnqueueFunctionResult, FileContentPart, FileInfo, FileUploadRequest, FileUrlResult, ImageContentPart, LoginRequest, OTPVerifyRequest, PermissionCheckRequest, PermissionCheckResponse, PermissionCheckResult, RefreshResponse, SSEChunk, SinasAuthError, SinasClientAuth, SinasError, SinasNotFoundError, SinasPermissionError, SinasTimeoutError, StateGetResult, SubmitAgentBatchOptions, SubmitAgentBatchResult, SubmitFunctionBatchOptions, SubmitFunctionBatchResult, TextContentPart, ToolCallInfo, approveToolCall, cancelBatch, checkPermissions, createChat, enqueueFunction, executeFunction, executeQuery, generateFileUrl, getBatch, getChat, getInfo, getMe, listBatchExecutions, listCollections, listFiles, login, logout, refresh, sendMessage, stateDelete, stateGet, stateList, stateSet, streamFromChannel, streamMessage, submitAgentBatch, submitFunctionBatch, uploadFile, verifyOTP } from './client.cjs';
|
|
1
|
+
import { QueryResult, FunctionResult, StateListResult, ChatMessageFull, ApprovalRequest, PendingInput, MessageContent, SinasConfig, SinasClient, AuthUser, InfoResponse, LoginResponse, OTPVerifyResponse, SinasClientOptions } from './client.cjs';
|
|
2
|
+
export { AgentBatchItem, AnswerPendingInputOptions, ApprovalResult, ApprovalResume, ApproveToolCallOptions, AudioContentPart, AuthMode, BatchExecutionItem, BatchStatus, ChatCreateResult, ChatDetail, ChatMessage, Collection, ComponentContentPart, ContentPart, EnqueueFunctionOptions, EnqueueFunctionResult, FileContentPart, FileInfo, FileUploadRequest, FileUrlResult, ImageContentPart, InputRequiredEvent, InvokeOptions, InvokeResult, LoginRequest, MessageSendResult, OTPVerifyRequest, PendingInputAnswerAccepted, PendingInputAnswerResult, PermissionCheckRequest, PermissionCheckResponse, PermissionCheckResult, RefreshResponse, RoundSuspendedEvent, SSEChunk, SinasAuthError, SinasClientAuth, SinasError, SinasNotFoundError, SinasPermissionError, SinasTimeoutError, StateGetResult, StreamDone, StreamFromChannelOptions, StreamOptions, SubmitAgentBatchOptions, SubmitAgentBatchResult, SubmitFunctionBatchOptions, SubmitFunctionBatchResult, TextContentPart, ToolCallInfo, TurnState, TurnStatus, TurnUsage, answerPendingInput, answerResumeChannel, approvalResumeChannel, approveToolCall, cancelBatch, checkPermissions, createChat, enqueueFunction, executeFunction, executeQuery, generateFileUrl, getBatch, getChat, getInfo, getMe, invokeAgent, listBatchExecutions, listCollections, listFiles, listPendingInputs, login, logout, parsePendingInput, parsePendingInputs, pendingInputFromChunk, refresh, sendMessage, stateDelete, stateGet, stateList, stateSet, streamFromChannel, streamMessage, submitAgentBatch, submitFunctionBatch, uploadFile, verifyOTP } from './client.cjs';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
5
|
interface UseQueryOptions {
|
|
@@ -54,6 +54,28 @@ interface ToolStatus {
|
|
|
54
54
|
description: string;
|
|
55
55
|
status: 'running' | 'complete';
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The model's thinking during the current turn. Thinking isn't stored with
|
|
59
|
+
* the messages, so it is only known while (and after) streaming the turn;
|
|
60
|
+
* it resets when the next turn starts.
|
|
61
|
+
*/
|
|
62
|
+
interface ChatThinking {
|
|
63
|
+
/** The model is thinking right now (before its answer or next tool call). */
|
|
64
|
+
active: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The thinking text so far this turn; only sent with `includeThinking`
|
|
67
|
+
* (otherwise always ''). Thinking rounds are separated by a blank line.
|
|
68
|
+
*/
|
|
69
|
+
text: string;
|
|
70
|
+
}
|
|
71
|
+
interface ApproveOptions {
|
|
72
|
+
/** Approve this tool for the rest of the chat: it won't ask again (Sinas 0.5+). */
|
|
73
|
+
alwaysAllow?: boolean;
|
|
74
|
+
}
|
|
75
|
+
interface FollowOptions {
|
|
76
|
+
/** Last received stream entry id to resume after (default: from the start). */
|
|
77
|
+
lastId?: string;
|
|
78
|
+
}
|
|
57
79
|
interface UseChatResult {
|
|
58
80
|
chatId: string | null;
|
|
59
81
|
messages: ChatSessionMessage[];
|
|
@@ -61,16 +83,52 @@ interface UseChatResult {
|
|
|
61
83
|
streaming: boolean;
|
|
62
84
|
error: string | null;
|
|
63
85
|
pendingApprovals: ApprovalRequest[];
|
|
86
|
+
/**
|
|
87
|
+
* The ask_user questions the conversation waits on (Sinas 0.5+): from
|
|
88
|
+
* `input_required` stream events and from the chat as loaded. Answer with
|
|
89
|
+
* `answer`.
|
|
90
|
+
*/
|
|
91
|
+
pendingInputs: PendingInput[];
|
|
92
|
+
/** The model's thinking in the current turn (see `includeThinking`). */
|
|
93
|
+
thinking: ChatThinking;
|
|
64
94
|
toolStatus: ToolStatus[];
|
|
65
95
|
send: (content: MessageContent) => void;
|
|
66
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Approve a tool call. When other calls of the same round still wait for a
|
|
98
|
+
* decision, nothing streams until the last one is decided.
|
|
99
|
+
*/
|
|
100
|
+
approve: (toolCallId: string, options?: ApproveOptions) => void;
|
|
67
101
|
reject: (toolCallId: string) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Answer an ask_user question. Resolves true once the answer is recorded
|
|
104
|
+
* (the question is then removed from `pendingInputs`), false when it
|
|
105
|
+
* failed (see `error`). When it was the round's last open question, the
|
|
106
|
+
* resumed turn streams into `messages`.
|
|
107
|
+
*/
|
|
108
|
+
answer: (toolCallId: string, answer: string) => Promise<boolean>;
|
|
109
|
+
/**
|
|
110
|
+
* Stream a channel into this session: a turn that goes on elsewhere (an
|
|
111
|
+
* `in_progress` result, a reconnect to a running turn).
|
|
112
|
+
*/
|
|
113
|
+
follow: (channelId: string, options?: FollowOptions) => void;
|
|
68
114
|
stop: () => void;
|
|
69
115
|
clearError: () => void;
|
|
70
116
|
}
|
|
71
117
|
interface UseChatOptions {
|
|
72
118
|
chatId?: string;
|
|
73
119
|
input?: Record<string, unknown>;
|
|
120
|
+
/**
|
|
121
|
+
* Stream the model's thinking text into `thinking.text` (Sinas 0.5+).
|
|
122
|
+
* Without it, `thinking.active` still says when the model is thinking.
|
|
123
|
+
*/
|
|
124
|
+
includeThinking?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* While questions wait with no stream open, re-read the chat periodically
|
|
127
|
+
* and just after the earliest deadline, so an expired question (the round
|
|
128
|
+
* then resumes server-side) or one answered elsewhere shows up without a
|
|
129
|
+
* reload. Default true.
|
|
130
|
+
*/
|
|
131
|
+
pollPendingInputs?: boolean;
|
|
74
132
|
}
|
|
75
133
|
declare function useChat(agentRef: string, options?: UseChatOptions): UseChatResult;
|
|
76
134
|
|
|
@@ -129,4 +187,4 @@ interface SinasProviderProps {
|
|
|
129
187
|
declare function SinasProvider({ client, options, children }: SinasProviderProps): React.FunctionComponentElement<React.ProviderProps<SinasClient | null>>;
|
|
130
188
|
declare function useClient(): SinasClient;
|
|
131
189
|
|
|
132
|
-
export { ApprovalRequest, type AuthStatus, AuthUser, ChatMessageFull, type ChatSessionMessage, FunctionResult, InfoResponse, LoginResponse, MessageContent, OTPVerifyResponse, QueryResult, SinasClient, SinasClientOptions, SinasConfig, SinasProvider, type SinasProviderProps, StateListResult, type ToolResult, type ToolStatus, type UseAuthOptions, type UseAuthResult, type UseChatOptions, type UseChatResult, type UseExecuteResult, type UseQueryOptions, type UseQueryResult, type UseSinasResult, type UseStateStoreOptions, type UseStateStoreResult, useAuth, useChat, useClient, useExecute, useQuery, useSinas, useStateStore };
|
|
190
|
+
export { ApprovalRequest, type ApproveOptions, type AuthStatus, AuthUser, ChatMessageFull, type ChatSessionMessage, type ChatThinking, type FollowOptions, FunctionResult, InfoResponse, LoginResponse, MessageContent, OTPVerifyResponse, PendingInput, QueryResult, SinasClient, SinasClientOptions, SinasConfig, SinasProvider, type SinasProviderProps, StateListResult, type ToolResult, type ToolStatus, type UseAuthOptions, type UseAuthResult, type UseChatOptions, type UseChatResult, type UseExecuteResult, type UseQueryOptions, type UseQueryResult, type UseSinasResult, type UseStateStoreOptions, type UseStateStoreResult, useAuth, useChat, useClient, useExecute, useQuery, useSinas, useStateStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { QueryResult, FunctionResult, StateListResult, ChatMessageFull, ApprovalRequest, MessageContent, SinasConfig, SinasClient, AuthUser, InfoResponse, LoginResponse, OTPVerifyResponse, SinasClientOptions } from './client.js';
|
|
2
|
-
export { AgentBatchItem, ApprovalResult, AudioContentPart, AuthMode, BatchExecutionItem, BatchStatus, ChatCreateResult, ChatDetail, ChatMessage, Collection, ComponentContentPart, ContentPart, EnqueueFunctionOptions, EnqueueFunctionResult, FileContentPart, FileInfo, FileUploadRequest, FileUrlResult, ImageContentPart, LoginRequest, OTPVerifyRequest, PermissionCheckRequest, PermissionCheckResponse, PermissionCheckResult, RefreshResponse, SSEChunk, SinasAuthError, SinasClientAuth, SinasError, SinasNotFoundError, SinasPermissionError, SinasTimeoutError, StateGetResult, SubmitAgentBatchOptions, SubmitAgentBatchResult, SubmitFunctionBatchOptions, SubmitFunctionBatchResult, TextContentPart, ToolCallInfo, approveToolCall, cancelBatch, checkPermissions, createChat, enqueueFunction, executeFunction, executeQuery, generateFileUrl, getBatch, getChat, getInfo, getMe, listBatchExecutions, listCollections, listFiles, login, logout, refresh, sendMessage, stateDelete, stateGet, stateList, stateSet, streamFromChannel, streamMessage, submitAgentBatch, submitFunctionBatch, uploadFile, verifyOTP } from './client.js';
|
|
1
|
+
import { QueryResult, FunctionResult, StateListResult, ChatMessageFull, ApprovalRequest, PendingInput, MessageContent, SinasConfig, SinasClient, AuthUser, InfoResponse, LoginResponse, OTPVerifyResponse, SinasClientOptions } from './client.js';
|
|
2
|
+
export { AgentBatchItem, AnswerPendingInputOptions, ApprovalResult, ApprovalResume, ApproveToolCallOptions, AudioContentPart, AuthMode, BatchExecutionItem, BatchStatus, ChatCreateResult, ChatDetail, ChatMessage, Collection, ComponentContentPart, ContentPart, EnqueueFunctionOptions, EnqueueFunctionResult, FileContentPart, FileInfo, FileUploadRequest, FileUrlResult, ImageContentPart, InputRequiredEvent, InvokeOptions, InvokeResult, LoginRequest, MessageSendResult, OTPVerifyRequest, PendingInputAnswerAccepted, PendingInputAnswerResult, PermissionCheckRequest, PermissionCheckResponse, PermissionCheckResult, RefreshResponse, RoundSuspendedEvent, SSEChunk, SinasAuthError, SinasClientAuth, SinasError, SinasNotFoundError, SinasPermissionError, SinasTimeoutError, StateGetResult, StreamDone, StreamFromChannelOptions, StreamOptions, SubmitAgentBatchOptions, SubmitAgentBatchResult, SubmitFunctionBatchOptions, SubmitFunctionBatchResult, TextContentPart, ToolCallInfo, TurnState, TurnStatus, TurnUsage, answerPendingInput, answerResumeChannel, approvalResumeChannel, approveToolCall, cancelBatch, checkPermissions, createChat, enqueueFunction, executeFunction, executeQuery, generateFileUrl, getBatch, getChat, getInfo, getMe, invokeAgent, listBatchExecutions, listCollections, listFiles, listPendingInputs, login, logout, parsePendingInput, parsePendingInputs, pendingInputFromChunk, refresh, sendMessage, stateDelete, stateGet, stateList, stateSet, streamFromChannel, streamMessage, submitAgentBatch, submitFunctionBatch, uploadFile, verifyOTP } from './client.js';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
5
|
interface UseQueryOptions {
|
|
@@ -54,6 +54,28 @@ interface ToolStatus {
|
|
|
54
54
|
description: string;
|
|
55
55
|
status: 'running' | 'complete';
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The model's thinking during the current turn. Thinking isn't stored with
|
|
59
|
+
* the messages, so it is only known while (and after) streaming the turn;
|
|
60
|
+
* it resets when the next turn starts.
|
|
61
|
+
*/
|
|
62
|
+
interface ChatThinking {
|
|
63
|
+
/** The model is thinking right now (before its answer or next tool call). */
|
|
64
|
+
active: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The thinking text so far this turn; only sent with `includeThinking`
|
|
67
|
+
* (otherwise always ''). Thinking rounds are separated by a blank line.
|
|
68
|
+
*/
|
|
69
|
+
text: string;
|
|
70
|
+
}
|
|
71
|
+
interface ApproveOptions {
|
|
72
|
+
/** Approve this tool for the rest of the chat: it won't ask again (Sinas 0.5+). */
|
|
73
|
+
alwaysAllow?: boolean;
|
|
74
|
+
}
|
|
75
|
+
interface FollowOptions {
|
|
76
|
+
/** Last received stream entry id to resume after (default: from the start). */
|
|
77
|
+
lastId?: string;
|
|
78
|
+
}
|
|
57
79
|
interface UseChatResult {
|
|
58
80
|
chatId: string | null;
|
|
59
81
|
messages: ChatSessionMessage[];
|
|
@@ -61,16 +83,52 @@ interface UseChatResult {
|
|
|
61
83
|
streaming: boolean;
|
|
62
84
|
error: string | null;
|
|
63
85
|
pendingApprovals: ApprovalRequest[];
|
|
86
|
+
/**
|
|
87
|
+
* The ask_user questions the conversation waits on (Sinas 0.5+): from
|
|
88
|
+
* `input_required` stream events and from the chat as loaded. Answer with
|
|
89
|
+
* `answer`.
|
|
90
|
+
*/
|
|
91
|
+
pendingInputs: PendingInput[];
|
|
92
|
+
/** The model's thinking in the current turn (see `includeThinking`). */
|
|
93
|
+
thinking: ChatThinking;
|
|
64
94
|
toolStatus: ToolStatus[];
|
|
65
95
|
send: (content: MessageContent) => void;
|
|
66
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Approve a tool call. When other calls of the same round still wait for a
|
|
98
|
+
* decision, nothing streams until the last one is decided.
|
|
99
|
+
*/
|
|
100
|
+
approve: (toolCallId: string, options?: ApproveOptions) => void;
|
|
67
101
|
reject: (toolCallId: string) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Answer an ask_user question. Resolves true once the answer is recorded
|
|
104
|
+
* (the question is then removed from `pendingInputs`), false when it
|
|
105
|
+
* failed (see `error`). When it was the round's last open question, the
|
|
106
|
+
* resumed turn streams into `messages`.
|
|
107
|
+
*/
|
|
108
|
+
answer: (toolCallId: string, answer: string) => Promise<boolean>;
|
|
109
|
+
/**
|
|
110
|
+
* Stream a channel into this session: a turn that goes on elsewhere (an
|
|
111
|
+
* `in_progress` result, a reconnect to a running turn).
|
|
112
|
+
*/
|
|
113
|
+
follow: (channelId: string, options?: FollowOptions) => void;
|
|
68
114
|
stop: () => void;
|
|
69
115
|
clearError: () => void;
|
|
70
116
|
}
|
|
71
117
|
interface UseChatOptions {
|
|
72
118
|
chatId?: string;
|
|
73
119
|
input?: Record<string, unknown>;
|
|
120
|
+
/**
|
|
121
|
+
* Stream the model's thinking text into `thinking.text` (Sinas 0.5+).
|
|
122
|
+
* Without it, `thinking.active` still says when the model is thinking.
|
|
123
|
+
*/
|
|
124
|
+
includeThinking?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* While questions wait with no stream open, re-read the chat periodically
|
|
127
|
+
* and just after the earliest deadline, so an expired question (the round
|
|
128
|
+
* then resumes server-side) or one answered elsewhere shows up without a
|
|
129
|
+
* reload. Default true.
|
|
130
|
+
*/
|
|
131
|
+
pollPendingInputs?: boolean;
|
|
74
132
|
}
|
|
75
133
|
declare function useChat(agentRef: string, options?: UseChatOptions): UseChatResult;
|
|
76
134
|
|
|
@@ -129,4 +187,4 @@ interface SinasProviderProps {
|
|
|
129
187
|
declare function SinasProvider({ client, options, children }: SinasProviderProps): React.FunctionComponentElement<React.ProviderProps<SinasClient | null>>;
|
|
130
188
|
declare function useClient(): SinasClient;
|
|
131
189
|
|
|
132
|
-
export { ApprovalRequest, type AuthStatus, AuthUser, ChatMessageFull, type ChatSessionMessage, FunctionResult, InfoResponse, LoginResponse, MessageContent, OTPVerifyResponse, QueryResult, SinasClient, SinasClientOptions, SinasConfig, SinasProvider, type SinasProviderProps, StateListResult, type ToolResult, type ToolStatus, type UseAuthOptions, type UseAuthResult, type UseChatOptions, type UseChatResult, type UseExecuteResult, type UseQueryOptions, type UseQueryResult, type UseSinasResult, type UseStateStoreOptions, type UseStateStoreResult, useAuth, useChat, useClient, useExecute, useQuery, useSinas, useStateStore };
|
|
190
|
+
export { ApprovalRequest, type ApproveOptions, type AuthStatus, AuthUser, ChatMessageFull, type ChatSessionMessage, type ChatThinking, type FollowOptions, FunctionResult, InfoResponse, LoginResponse, MessageContent, OTPVerifyResponse, PendingInput, QueryResult, SinasClient, SinasClientOptions, SinasConfig, SinasProvider, type SinasProviderProps, StateListResult, type ToolResult, type ToolStatus, type UseAuthOptions, type UseAuthResult, type UseChatOptions, type UseChatResult, type UseExecuteResult, type UseQueryOptions, type UseQueryResult, type UseSinasResult, type UseStateStoreOptions, type UseStateStoreResult, useAuth, useChat, useClient, useExecute, useQuery, useSinas, useStateStore };
|