@sinas/sdk 0.4.0 → 0.7.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/client.d.cts CHANGED
@@ -17,6 +17,63 @@ interface SinasConfig {
17
17
  };
18
18
  input: Record<string, unknown>;
19
19
  }
20
+ type AuthMode = 'otp' | 'password' | 'password+otp';
21
+ interface InfoResponse {
22
+ auth_mode: AuthMode;
23
+ version: string;
24
+ features: Record<string, boolean>;
25
+ }
26
+ interface LoginRequest {
27
+ email: string;
28
+ password?: string;
29
+ }
30
+ interface AuthUser {
31
+ id: string;
32
+ email: string;
33
+ last_login_at: string | null;
34
+ created_at: string;
35
+ roles: string[];
36
+ }
37
+ interface LoginResponse {
38
+ message: string;
39
+ /** Present when auth_mode includes "otp" — feed into verifyOTP. */
40
+ session_id?: string;
41
+ /** Present in password-only mode — login is complete. */
42
+ access_token?: string;
43
+ refresh_token?: string;
44
+ token_type?: string;
45
+ expires_in?: number;
46
+ user?: AuthUser;
47
+ }
48
+ interface OTPVerifyRequest {
49
+ session_id: string;
50
+ otp_code: string;
51
+ }
52
+ interface OTPVerifyResponse {
53
+ access_token: string;
54
+ refresh_token: string;
55
+ token_type: string;
56
+ expires_in: number;
57
+ user: AuthUser;
58
+ }
59
+ interface RefreshResponse {
60
+ access_token: string;
61
+ token_type: string;
62
+ expires_in: number;
63
+ }
64
+ interface PermissionCheckRequest {
65
+ permissions: string[];
66
+ logic?: 'AND' | 'OR';
67
+ }
68
+ interface PermissionCheckResult {
69
+ permission: string;
70
+ has_permission: boolean;
71
+ }
72
+ interface PermissionCheckResponse {
73
+ result: boolean;
74
+ logic: string;
75
+ checks: PermissionCheckResult[];
76
+ }
20
77
  interface QueryResult {
21
78
  success: boolean;
22
79
  operation: string;
@@ -165,19 +222,157 @@ declare global {
165
222
  __SINAS_AUTH_TOKEN__?: string | null;
166
223
  }
167
224
  }
225
+ interface SinasClientOptions {
226
+ /** Embedded-component config. Falls back to window.__SINAS_CONFIG__. */
227
+ config?: SinasConfig;
228
+ /** Workspace base URL for standalone use. Overrides config.apiBase for non-proxy calls. */
229
+ baseUrl?: string;
230
+ /** Returns the current access token, or null. Falls back to window.__SINAS_AUTH_TOKEN__. */
231
+ getAccessToken?: () => string | null;
232
+ /** Returns the current refresh token. Required for auto-refresh on 401. */
233
+ getRefreshToken?: () => string | null;
234
+ /** Called with the new access token after a successful /auth/refresh. */
235
+ onTokenRefresh?: (accessToken: string) => void;
236
+ /** Called when a request remains unauthenticated after a refresh attempt. */
237
+ onUnauthenticated?: () => void;
238
+ }
239
+ /**
240
+ * Auth namespace on SinasClient. Standalone counterparts live in client/auth.ts.
241
+ */
242
+ declare class SinasClientAuth {
243
+ private readonly client;
244
+ constructor(client: SinasClient);
245
+ getInfo(): Promise<InfoResponse>;
246
+ login(request: LoginRequest): Promise<LoginResponse>;
247
+ verifyOTP(request: OTPVerifyRequest): Promise<OTPVerifyResponse>;
248
+ refresh(refreshToken: string): Promise<RefreshResponse>;
249
+ logout(refreshToken: string): Promise<void>;
250
+ getMe(): Promise<AuthUser>;
251
+ checkPermissions(request: PermissionCheckRequest): Promise<PermissionCheckResponse>;
252
+ }
168
253
  declare class SinasClient {
169
- private configOverride?;
170
- constructor(config?: SinasConfig);
254
+ readonly auth: SinasClientAuth;
255
+ private readonly options;
256
+ private refreshInFlight;
257
+ constructor(options?: SinasClientOptions);
171
258
  getConfig(): SinasConfig;
172
259
  getInput(): Record<string, unknown>;
260
+ /** Workspace base URL (root of the Sinas instance). Throws if unset. */
261
+ requireBaseUrl(): string;
262
+ getBaseUrl(): string | null;
263
+ getAccessToken(): string | null;
264
+ private getRefreshToken;
265
+ private tryRefresh;
173
266
  getAuthHeaders(): Record<string, string>;
174
267
  getProxyBase(): string;
175
- fetch(url: string, options?: RequestInit): Promise<Response>;
268
+ fetch(url: string, options?: RequestInit, _retried?: boolean): Promise<Response>;
176
269
  }
177
270
 
178
271
  declare function executeQuery(client: SinasClient, ref: string, input?: Record<string, unknown>): Promise<QueryResult>;
179
272
 
180
273
  declare function executeFunction(client: SinasClient, ref: string, input?: Record<string, unknown>, timeout?: number): Promise<FunctionResult>;
274
+ interface EnqueueFunctionOptions {
275
+ /** App-supplied correlation id stored on the execution record. */
276
+ triggerId?: string;
277
+ /** Delay before the worker picks up the job, in seconds. */
278
+ delaySeconds?: number;
279
+ /**
280
+ * HTTPS URL Sinas will POST to once the execution terminates.
281
+ * Must match the instance's CALLBACK_URL_HOSTS allowlist.
282
+ */
283
+ callbackUrl?: string;
284
+ }
285
+ interface EnqueueFunctionResult {
286
+ executionId: string;
287
+ status: string;
288
+ }
289
+ /**
290
+ * Fire-and-forget function enqueue. Returns immediately with the
291
+ * execution_id. Poll `executions.get(id)` or rely on the callback URL
292
+ * if one was provided.
293
+ *
294
+ * Standalone-mode only — uses the SinasClient's baseUrl (set in the
295
+ * constructor). Embedded components should use `executeFunction` instead.
296
+ */
297
+ declare function enqueueFunction(client: SinasClient, ref: string, input?: Record<string, unknown>, options?: EnqueueFunctionOptions): Promise<EnqueueFunctionResult>;
298
+ interface SubmitFunctionBatchOptions {
299
+ triggerIdPrefix?: string;
300
+ delaySeconds?: number;
301
+ /** Fires once per execution. */
302
+ callbackUrl?: string;
303
+ /** Fires once when the entire batch terminates. */
304
+ batchCallbackUrl?: string;
305
+ }
306
+ interface SubmitFunctionBatchResult {
307
+ batchId: string;
308
+ executionIds: string[];
309
+ total: number;
310
+ status: string;
311
+ }
312
+ /** Submit N function executions as a single batch. */
313
+ declare function submitFunctionBatch(client: SinasClient, ref: string, inputs: Record<string, unknown>[], options?: SubmitFunctionBatchOptions): Promise<SubmitFunctionBatchResult>;
314
+ interface AgentBatchItem {
315
+ inputVariables?: Record<string, unknown>;
316
+ message: string;
317
+ }
318
+ interface SubmitAgentBatchOptions {
319
+ triggerIdPrefix?: string;
320
+ callbackUrl?: string;
321
+ batchCallbackUrl?: string;
322
+ }
323
+ interface SubmitAgentBatchResult {
324
+ batchId: string;
325
+ executionIds: string[];
326
+ chatIds: string[];
327
+ total: number;
328
+ status: string;
329
+ }
330
+ /** Submit N agent invocations as a single batch. */
331
+ declare function submitAgentBatch(client: SinasClient, ref: string, inputs: AgentBatchItem[], options?: SubmitAgentBatchOptions): Promise<SubmitAgentBatchResult>;
332
+ interface BatchStatus {
333
+ batchId: string;
334
+ kind: string;
335
+ target: {
336
+ namespace: string;
337
+ name: string;
338
+ };
339
+ userId: string;
340
+ total: number;
341
+ completed: number;
342
+ failed: number;
343
+ cancelled: number;
344
+ running: number;
345
+ queued: number;
346
+ status: string;
347
+ startedAt: string | null;
348
+ finishedAt: string | null;
349
+ triggerIdPrefix: string | null;
350
+ }
351
+ /** Get aggregate progress for a batch. */
352
+ declare function getBatch(client: SinasClient, batchId: string): Promise<BatchStatus>;
353
+ interface BatchExecutionItem {
354
+ executionId: string;
355
+ status: string;
356
+ functionName: string;
357
+ chatId: string | null;
358
+ triggerId: string;
359
+ startedAt: string | null;
360
+ completedAt: string | null;
361
+ durationMs: number | null;
362
+ error: string | null;
363
+ }
364
+ /** List child executions of a batch, optionally filtered by status. */
365
+ declare function listBatchExecutions(client: SinasClient, batchId: string, options?: {
366
+ status?: string;
367
+ limit?: number;
368
+ offset?: number;
369
+ }): Promise<BatchExecutionItem[]>;
370
+ /** Cancel any queued/pending children of a batch. */
371
+ declare function cancelBatch(client: SinasClient, batchId: string): Promise<{
372
+ batchId: string;
373
+ status: string;
374
+ cancelledChildren: number;
375
+ }>;
181
376
 
182
377
  declare function stateGet(client: SinasClient, ns: string, key: string): Promise<StateGetResult>;
183
378
  declare function stateSet(client: SinasClient, ns: string, key: string, value: unknown, visibility?: 'private' | 'shared'): Promise<void>;
@@ -196,6 +391,25 @@ declare function listFiles(client: SinasClient, namespace: string, collection: s
196
391
  declare function uploadFile(client: SinasClient, namespace: string, collection: string, data: FileUploadRequest): Promise<FileInfo>;
197
392
  declare function generateFileUrl(client: SinasClient, namespace: string, collection: string, filename: string, expiresIn?: number): Promise<FileUrlResult>;
198
393
 
394
+ /** Fetch unauthenticated instance info. Use before showing a login screen. */
395
+ declare function getInfo(baseUrl: string): Promise<InfoResponse>;
396
+ /**
397
+ * Start a login. Response shape depends on the workspace's auth_mode:
398
+ * - "password": access_token + refresh_token are set → done.
399
+ * - "otp" or "password+otp": session_id is set → call verifyOTP next.
400
+ */
401
+ declare function login(baseUrl: string, request: LoginRequest): Promise<LoginResponse>;
402
+ /** Second step for "otp" / "password+otp" modes. Returns final tokens. */
403
+ declare function verifyOTP(baseUrl: string, request: OTPVerifyRequest): Promise<OTPVerifyResponse>;
404
+ /** Exchange a refresh token for a new access token. */
405
+ declare function refresh(baseUrl: string, refreshToken: string): Promise<RefreshResponse>;
406
+ /** Revoke a refresh token. Best-effort; ignore 404. */
407
+ declare function logout(baseUrl: string, refreshToken: string): Promise<void>;
408
+ /** Return the authenticated user (id, email, roles). */
409
+ declare function getMe(baseUrl: string, accessToken: string): Promise<AuthUser>;
410
+ /** Check whether the authenticated user has the given permissions. */
411
+ declare function checkPermissions(baseUrl: string, accessToken: string, request: PermissionCheckRequest): Promise<PermissionCheckResponse>;
412
+
199
413
  declare class SinasError extends Error {
200
414
  readonly status: number;
201
415
  readonly detail: string;
@@ -214,4 +428,4 @@ declare class SinasTimeoutError extends SinasError {
214
428
  constructor(message?: string);
215
429
  }
216
430
 
217
- export { type ApprovalRequest, type ApprovalResult, type AudioContentPart, type ChatCreateResult, type ChatDetail, type ChatMessage, type ChatMessageFull, type Collection, type ComponentContentPart, type ContentPart, type FileContentPart, type FileInfo, type FileUploadRequest, type FileUrlResult, type FunctionResult, type ImageContentPart, type MessageContent, type QueryResult, type SSEChunk, SinasAuthError, SinasClient, type SinasConfig, SinasError, SinasNotFoundError, SinasPermissionError, SinasTimeoutError, type StateGetResult, type StateListResult, type TextContentPart, type ToolCallInfo, approveToolCall, createChat, executeFunction, executeQuery, generateFileUrl, getChat, listCollections, listFiles, sendMessage, stateDelete, stateGet, stateList, stateSet, streamFromChannel, streamMessage, uploadFile };
431
+ export { type AgentBatchItem, type ApprovalRequest, type ApprovalResult, type AudioContentPart, type AuthMode, type AuthUser, type BatchExecutionItem, type BatchStatus, type ChatCreateResult, type ChatDetail, type ChatMessage, type ChatMessageFull, type Collection, type ComponentContentPart, type ContentPart, type EnqueueFunctionOptions, type EnqueueFunctionResult, type FileContentPart, type FileInfo, type FileUploadRequest, type FileUrlResult, type FunctionResult, type ImageContentPart, type InfoResponse, type LoginRequest, type LoginResponse, type MessageContent, type OTPVerifyRequest, type OTPVerifyResponse, type PermissionCheckRequest, type PermissionCheckResponse, type PermissionCheckResult, type QueryResult, type RefreshResponse, type SSEChunk, SinasAuthError, SinasClient, SinasClientAuth, type SinasClientOptions, type SinasConfig, SinasError, SinasNotFoundError, SinasPermissionError, SinasTimeoutError, type StateGetResult, type StateListResult, type SubmitAgentBatchOptions, type SubmitAgentBatchResult, type SubmitFunctionBatchOptions, type SubmitFunctionBatchResult, type TextContentPart, type 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 };
package/dist/client.d.ts CHANGED
@@ -17,6 +17,63 @@ interface SinasConfig {
17
17
  };
18
18
  input: Record<string, unknown>;
19
19
  }
20
+ type AuthMode = 'otp' | 'password' | 'password+otp';
21
+ interface InfoResponse {
22
+ auth_mode: AuthMode;
23
+ version: string;
24
+ features: Record<string, boolean>;
25
+ }
26
+ interface LoginRequest {
27
+ email: string;
28
+ password?: string;
29
+ }
30
+ interface AuthUser {
31
+ id: string;
32
+ email: string;
33
+ last_login_at: string | null;
34
+ created_at: string;
35
+ roles: string[];
36
+ }
37
+ interface LoginResponse {
38
+ message: string;
39
+ /** Present when auth_mode includes "otp" — feed into verifyOTP. */
40
+ session_id?: string;
41
+ /** Present in password-only mode — login is complete. */
42
+ access_token?: string;
43
+ refresh_token?: string;
44
+ token_type?: string;
45
+ expires_in?: number;
46
+ user?: AuthUser;
47
+ }
48
+ interface OTPVerifyRequest {
49
+ session_id: string;
50
+ otp_code: string;
51
+ }
52
+ interface OTPVerifyResponse {
53
+ access_token: string;
54
+ refresh_token: string;
55
+ token_type: string;
56
+ expires_in: number;
57
+ user: AuthUser;
58
+ }
59
+ interface RefreshResponse {
60
+ access_token: string;
61
+ token_type: string;
62
+ expires_in: number;
63
+ }
64
+ interface PermissionCheckRequest {
65
+ permissions: string[];
66
+ logic?: 'AND' | 'OR';
67
+ }
68
+ interface PermissionCheckResult {
69
+ permission: string;
70
+ has_permission: boolean;
71
+ }
72
+ interface PermissionCheckResponse {
73
+ result: boolean;
74
+ logic: string;
75
+ checks: PermissionCheckResult[];
76
+ }
20
77
  interface QueryResult {
21
78
  success: boolean;
22
79
  operation: string;
@@ -165,19 +222,157 @@ declare global {
165
222
  __SINAS_AUTH_TOKEN__?: string | null;
166
223
  }
167
224
  }
225
+ interface SinasClientOptions {
226
+ /** Embedded-component config. Falls back to window.__SINAS_CONFIG__. */
227
+ config?: SinasConfig;
228
+ /** Workspace base URL for standalone use. Overrides config.apiBase for non-proxy calls. */
229
+ baseUrl?: string;
230
+ /** Returns the current access token, or null. Falls back to window.__SINAS_AUTH_TOKEN__. */
231
+ getAccessToken?: () => string | null;
232
+ /** Returns the current refresh token. Required for auto-refresh on 401. */
233
+ getRefreshToken?: () => string | null;
234
+ /** Called with the new access token after a successful /auth/refresh. */
235
+ onTokenRefresh?: (accessToken: string) => void;
236
+ /** Called when a request remains unauthenticated after a refresh attempt. */
237
+ onUnauthenticated?: () => void;
238
+ }
239
+ /**
240
+ * Auth namespace on SinasClient. Standalone counterparts live in client/auth.ts.
241
+ */
242
+ declare class SinasClientAuth {
243
+ private readonly client;
244
+ constructor(client: SinasClient);
245
+ getInfo(): Promise<InfoResponse>;
246
+ login(request: LoginRequest): Promise<LoginResponse>;
247
+ verifyOTP(request: OTPVerifyRequest): Promise<OTPVerifyResponse>;
248
+ refresh(refreshToken: string): Promise<RefreshResponse>;
249
+ logout(refreshToken: string): Promise<void>;
250
+ getMe(): Promise<AuthUser>;
251
+ checkPermissions(request: PermissionCheckRequest): Promise<PermissionCheckResponse>;
252
+ }
168
253
  declare class SinasClient {
169
- private configOverride?;
170
- constructor(config?: SinasConfig);
254
+ readonly auth: SinasClientAuth;
255
+ private readonly options;
256
+ private refreshInFlight;
257
+ constructor(options?: SinasClientOptions);
171
258
  getConfig(): SinasConfig;
172
259
  getInput(): Record<string, unknown>;
260
+ /** Workspace base URL (root of the Sinas instance). Throws if unset. */
261
+ requireBaseUrl(): string;
262
+ getBaseUrl(): string | null;
263
+ getAccessToken(): string | null;
264
+ private getRefreshToken;
265
+ private tryRefresh;
173
266
  getAuthHeaders(): Record<string, string>;
174
267
  getProxyBase(): string;
175
- fetch(url: string, options?: RequestInit): Promise<Response>;
268
+ fetch(url: string, options?: RequestInit, _retried?: boolean): Promise<Response>;
176
269
  }
177
270
 
178
271
  declare function executeQuery(client: SinasClient, ref: string, input?: Record<string, unknown>): Promise<QueryResult>;
179
272
 
180
273
  declare function executeFunction(client: SinasClient, ref: string, input?: Record<string, unknown>, timeout?: number): Promise<FunctionResult>;
274
+ interface EnqueueFunctionOptions {
275
+ /** App-supplied correlation id stored on the execution record. */
276
+ triggerId?: string;
277
+ /** Delay before the worker picks up the job, in seconds. */
278
+ delaySeconds?: number;
279
+ /**
280
+ * HTTPS URL Sinas will POST to once the execution terminates.
281
+ * Must match the instance's CALLBACK_URL_HOSTS allowlist.
282
+ */
283
+ callbackUrl?: string;
284
+ }
285
+ interface EnqueueFunctionResult {
286
+ executionId: string;
287
+ status: string;
288
+ }
289
+ /**
290
+ * Fire-and-forget function enqueue. Returns immediately with the
291
+ * execution_id. Poll `executions.get(id)` or rely on the callback URL
292
+ * if one was provided.
293
+ *
294
+ * Standalone-mode only — uses the SinasClient's baseUrl (set in the
295
+ * constructor). Embedded components should use `executeFunction` instead.
296
+ */
297
+ declare function enqueueFunction(client: SinasClient, ref: string, input?: Record<string, unknown>, options?: EnqueueFunctionOptions): Promise<EnqueueFunctionResult>;
298
+ interface SubmitFunctionBatchOptions {
299
+ triggerIdPrefix?: string;
300
+ delaySeconds?: number;
301
+ /** Fires once per execution. */
302
+ callbackUrl?: string;
303
+ /** Fires once when the entire batch terminates. */
304
+ batchCallbackUrl?: string;
305
+ }
306
+ interface SubmitFunctionBatchResult {
307
+ batchId: string;
308
+ executionIds: string[];
309
+ total: number;
310
+ status: string;
311
+ }
312
+ /** Submit N function executions as a single batch. */
313
+ declare function submitFunctionBatch(client: SinasClient, ref: string, inputs: Record<string, unknown>[], options?: SubmitFunctionBatchOptions): Promise<SubmitFunctionBatchResult>;
314
+ interface AgentBatchItem {
315
+ inputVariables?: Record<string, unknown>;
316
+ message: string;
317
+ }
318
+ interface SubmitAgentBatchOptions {
319
+ triggerIdPrefix?: string;
320
+ callbackUrl?: string;
321
+ batchCallbackUrl?: string;
322
+ }
323
+ interface SubmitAgentBatchResult {
324
+ batchId: string;
325
+ executionIds: string[];
326
+ chatIds: string[];
327
+ total: number;
328
+ status: string;
329
+ }
330
+ /** Submit N agent invocations as a single batch. */
331
+ declare function submitAgentBatch(client: SinasClient, ref: string, inputs: AgentBatchItem[], options?: SubmitAgentBatchOptions): Promise<SubmitAgentBatchResult>;
332
+ interface BatchStatus {
333
+ batchId: string;
334
+ kind: string;
335
+ target: {
336
+ namespace: string;
337
+ name: string;
338
+ };
339
+ userId: string;
340
+ total: number;
341
+ completed: number;
342
+ failed: number;
343
+ cancelled: number;
344
+ running: number;
345
+ queued: number;
346
+ status: string;
347
+ startedAt: string | null;
348
+ finishedAt: string | null;
349
+ triggerIdPrefix: string | null;
350
+ }
351
+ /** Get aggregate progress for a batch. */
352
+ declare function getBatch(client: SinasClient, batchId: string): Promise<BatchStatus>;
353
+ interface BatchExecutionItem {
354
+ executionId: string;
355
+ status: string;
356
+ functionName: string;
357
+ chatId: string | null;
358
+ triggerId: string;
359
+ startedAt: string | null;
360
+ completedAt: string | null;
361
+ durationMs: number | null;
362
+ error: string | null;
363
+ }
364
+ /** List child executions of a batch, optionally filtered by status. */
365
+ declare function listBatchExecutions(client: SinasClient, batchId: string, options?: {
366
+ status?: string;
367
+ limit?: number;
368
+ offset?: number;
369
+ }): Promise<BatchExecutionItem[]>;
370
+ /** Cancel any queued/pending children of a batch. */
371
+ declare function cancelBatch(client: SinasClient, batchId: string): Promise<{
372
+ batchId: string;
373
+ status: string;
374
+ cancelledChildren: number;
375
+ }>;
181
376
 
182
377
  declare function stateGet(client: SinasClient, ns: string, key: string): Promise<StateGetResult>;
183
378
  declare function stateSet(client: SinasClient, ns: string, key: string, value: unknown, visibility?: 'private' | 'shared'): Promise<void>;
@@ -196,6 +391,25 @@ declare function listFiles(client: SinasClient, namespace: string, collection: s
196
391
  declare function uploadFile(client: SinasClient, namespace: string, collection: string, data: FileUploadRequest): Promise<FileInfo>;
197
392
  declare function generateFileUrl(client: SinasClient, namespace: string, collection: string, filename: string, expiresIn?: number): Promise<FileUrlResult>;
198
393
 
394
+ /** Fetch unauthenticated instance info. Use before showing a login screen. */
395
+ declare function getInfo(baseUrl: string): Promise<InfoResponse>;
396
+ /**
397
+ * Start a login. Response shape depends on the workspace's auth_mode:
398
+ * - "password": access_token + refresh_token are set → done.
399
+ * - "otp" or "password+otp": session_id is set → call verifyOTP next.
400
+ */
401
+ declare function login(baseUrl: string, request: LoginRequest): Promise<LoginResponse>;
402
+ /** Second step for "otp" / "password+otp" modes. Returns final tokens. */
403
+ declare function verifyOTP(baseUrl: string, request: OTPVerifyRequest): Promise<OTPVerifyResponse>;
404
+ /** Exchange a refresh token for a new access token. */
405
+ declare function refresh(baseUrl: string, refreshToken: string): Promise<RefreshResponse>;
406
+ /** Revoke a refresh token. Best-effort; ignore 404. */
407
+ declare function logout(baseUrl: string, refreshToken: string): Promise<void>;
408
+ /** Return the authenticated user (id, email, roles). */
409
+ declare function getMe(baseUrl: string, accessToken: string): Promise<AuthUser>;
410
+ /** Check whether the authenticated user has the given permissions. */
411
+ declare function checkPermissions(baseUrl: string, accessToken: string, request: PermissionCheckRequest): Promise<PermissionCheckResponse>;
412
+
199
413
  declare class SinasError extends Error {
200
414
  readonly status: number;
201
415
  readonly detail: string;
@@ -214,4 +428,4 @@ declare class SinasTimeoutError extends SinasError {
214
428
  constructor(message?: string);
215
429
  }
216
430
 
217
- export { type ApprovalRequest, type ApprovalResult, type AudioContentPart, type ChatCreateResult, type ChatDetail, type ChatMessage, type ChatMessageFull, type Collection, type ComponentContentPart, type ContentPart, type FileContentPart, type FileInfo, type FileUploadRequest, type FileUrlResult, type FunctionResult, type ImageContentPart, type MessageContent, type QueryResult, type SSEChunk, SinasAuthError, SinasClient, type SinasConfig, SinasError, SinasNotFoundError, SinasPermissionError, SinasTimeoutError, type StateGetResult, type StateListResult, type TextContentPart, type ToolCallInfo, approveToolCall, createChat, executeFunction, executeQuery, generateFileUrl, getChat, listCollections, listFiles, sendMessage, stateDelete, stateGet, stateList, stateSet, streamFromChannel, streamMessage, uploadFile };
431
+ export { type AgentBatchItem, type ApprovalRequest, type ApprovalResult, type AudioContentPart, type AuthMode, type AuthUser, type BatchExecutionItem, type BatchStatus, type ChatCreateResult, type ChatDetail, type ChatMessage, type ChatMessageFull, type Collection, type ComponentContentPart, type ContentPart, type EnqueueFunctionOptions, type EnqueueFunctionResult, type FileContentPart, type FileInfo, type FileUploadRequest, type FileUrlResult, type FunctionResult, type ImageContentPart, type InfoResponse, type LoginRequest, type LoginResponse, type MessageContent, type OTPVerifyRequest, type OTPVerifyResponse, type PermissionCheckRequest, type PermissionCheckResponse, type PermissionCheckResult, type QueryResult, type RefreshResponse, type SSEChunk, SinasAuthError, SinasClient, SinasClientAuth, type SinasClientOptions, type SinasConfig, SinasError, SinasNotFoundError, SinasPermissionError, SinasTimeoutError, type StateGetResult, type StateListResult, type SubmitAgentBatchOptions, type SubmitAgentBatchResult, type SubmitFunctionBatchOptions, type SubmitFunctionBatchResult, type TextContentPart, type 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 };
package/dist/client.js CHANGED
@@ -1,18 +1,29 @@
1
1
  import {
2
2
  SinasAuthError,
3
3
  SinasClient,
4
+ SinasClientAuth,
4
5
  SinasError,
5
6
  SinasNotFoundError,
6
7
  SinasPermissionError,
7
8
  SinasTimeoutError,
8
9
  approveToolCall,
10
+ cancelBatch,
11
+ checkPermissions,
9
12
  createChat,
13
+ enqueueFunction,
10
14
  executeFunction,
11
15
  executeQuery,
12
16
  generateFileUrl,
17
+ getBatch,
13
18
  getChat,
19
+ getInfo,
20
+ getMe,
21
+ listBatchExecutions,
14
22
  listCollections,
15
23
  listFiles,
24
+ login,
25
+ logout,
26
+ refresh,
16
27
  sendMessage,
17
28
  stateDelete,
18
29
  stateGet,
@@ -20,23 +31,37 @@ import {
20
31
  stateSet,
21
32
  streamFromChannel,
22
33
  streamMessage,
23
- uploadFile
24
- } from "./chunk-Z6NVKMMG.js";
34
+ submitAgentBatch,
35
+ submitFunctionBatch,
36
+ uploadFile,
37
+ verifyOTP
38
+ } from "./chunk-QDIOYYBA.js";
25
39
  export {
26
40
  SinasAuthError,
27
41
  SinasClient,
42
+ SinasClientAuth,
28
43
  SinasError,
29
44
  SinasNotFoundError,
30
45
  SinasPermissionError,
31
46
  SinasTimeoutError,
32
47
  approveToolCall,
48
+ cancelBatch,
49
+ checkPermissions,
33
50
  createChat,
51
+ enqueueFunction,
34
52
  executeFunction,
35
53
  executeQuery,
36
54
  generateFileUrl,
55
+ getBatch,
37
56
  getChat,
57
+ getInfo,
58
+ getMe,
59
+ listBatchExecutions,
38
60
  listCollections,
39
61
  listFiles,
62
+ login,
63
+ logout,
64
+ refresh,
40
65
  sendMessage,
41
66
  stateDelete,
42
67
  stateGet,
@@ -44,6 +69,9 @@ export {
44
69
  stateSet,
45
70
  streamFromChannel,
46
71
  streamMessage,
47
- uploadFile
72
+ submitAgentBatch,
73
+ submitFunctionBatch,
74
+ uploadFile,
75
+ verifyOTP
48
76
  };
49
77
  //# sourceMappingURL=client.js.map