@yushaw/sanqian-sdk 0.3.17 → 0.3.19
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/index.browser.d.mts +38 -3
- package/dist/index.browser.d.ts +1034 -0
- package/dist/index.browser.js +1709 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.browser.mjs +132 -23
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +37 -3
- package/dist/index.d.ts +37 -3
- package/dist/index.js +128 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +128 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.browser.d.mts
CHANGED
|
@@ -261,6 +261,14 @@ interface ChatResponse {
|
|
|
261
261
|
total_tokens: number;
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
+
/** Mention/load item types for dynamic capability/context activation */
|
|
265
|
+
type LoadItemType = "tool" | "skill" | "subagent" | "context";
|
|
266
|
+
type LoadItemAction = "load" | "unload";
|
|
267
|
+
interface LoadItem {
|
|
268
|
+
type: LoadItemType;
|
|
269
|
+
id: string;
|
|
270
|
+
action?: LoadItemAction;
|
|
271
|
+
}
|
|
264
272
|
interface ChatStreamEvent {
|
|
265
273
|
type: "start" | "text" | "thinking" | "tool_call" | "tool_args_chunk" | "tool_args" | "tool_result" | "done" | "error" | "interrupt" | "cancelled";
|
|
266
274
|
/** Text content (for "text" and "thinking" events) */
|
|
@@ -289,7 +297,7 @@ interface ChatStreamEvent {
|
|
|
289
297
|
interrupt_type?: HitlInterruptType;
|
|
290
298
|
/** Interrupt payload (for "interrupt" event) - HITL */
|
|
291
299
|
interrupt_payload?: HitlInterruptPayload;
|
|
292
|
-
/** Run ID (for "interrupt"
|
|
300
|
+
/** Run ID (for "start"/"interrupt"/"cancelled" events) */
|
|
293
301
|
run_id?: string;
|
|
294
302
|
}
|
|
295
303
|
/**
|
|
@@ -394,6 +402,12 @@ interface AgentConfig {
|
|
|
394
402
|
* - ["agent1", "agent2"]: Can only call specified agents
|
|
395
403
|
*/
|
|
396
404
|
subagents?: string[];
|
|
405
|
+
/**
|
|
406
|
+
* Enable memory system for this agent (default: false).
|
|
407
|
+
* When enabled, relevant memories are auto-recalled at each turn
|
|
408
|
+
* and new facts are automatically captured.
|
|
409
|
+
*/
|
|
410
|
+
memory_enabled?: boolean;
|
|
397
411
|
/**
|
|
398
412
|
* Whether this agent can be discovered via search_capability (default: true)
|
|
399
413
|
* Set to false if you want the agent to be usable but not discoverable by other agents
|
|
@@ -429,6 +443,8 @@ interface AgentInfo {
|
|
|
429
443
|
skills: string[];
|
|
430
444
|
/** Sub-agents this agent can call via task tool */
|
|
431
445
|
subagents?: string[] | null;
|
|
446
|
+
/** Whether memory system is enabled for this agent */
|
|
447
|
+
memory_enabled?: boolean;
|
|
432
448
|
/** Whether this agent can be discovered via search_capability */
|
|
433
449
|
searchable?: boolean;
|
|
434
450
|
created_at?: string;
|
|
@@ -497,6 +513,12 @@ interface AgentUpdateConfig {
|
|
|
497
513
|
* - ["agent1", "agent2"]: Can only call specified agents
|
|
498
514
|
*/
|
|
499
515
|
subagents?: string[] | null;
|
|
516
|
+
/**
|
|
517
|
+
* Enable memory system for this agent.
|
|
518
|
+
* - undefined: Keep existing value
|
|
519
|
+
* - true/false: Set explicitly
|
|
520
|
+
*/
|
|
521
|
+
memory_enabled?: boolean;
|
|
500
522
|
/**
|
|
501
523
|
* Whether this agent can be discovered via search_capability
|
|
502
524
|
* - undefined: Keep existing value
|
|
@@ -727,9 +749,14 @@ declare class SanqianSDK {
|
|
|
727
749
|
private sessionResources;
|
|
728
750
|
private contextProviders;
|
|
729
751
|
private runIdToMsgId;
|
|
730
|
-
private
|
|
752
|
+
private pendingStreamRequests;
|
|
753
|
+
private pendingCancelMsgIds;
|
|
754
|
+
private static readonly VALID_SECURITY_LEVELS;
|
|
731
755
|
private log;
|
|
732
756
|
private warn;
|
|
757
|
+
private normalizeRequestedSecurityLevel;
|
|
758
|
+
private sendRunCancel;
|
|
759
|
+
private requestStreamCancel;
|
|
733
760
|
constructor(config: SDKConfig);
|
|
734
761
|
/**
|
|
735
762
|
* Build WebSocket URL from connection info
|
|
@@ -809,6 +836,9 @@ declare class SanqianSDK {
|
|
|
809
836
|
autoDiscoverTools?: boolean;
|
|
810
837
|
autoDiscoverSubagents?: boolean;
|
|
811
838
|
persistHistory?: boolean;
|
|
839
|
+
filePaths?: string[];
|
|
840
|
+
loadItems?: LoadItem[];
|
|
841
|
+
mentionedTools?: string[];
|
|
812
842
|
}): Promise<ChatResponse>;
|
|
813
843
|
chatStream(agentId: string, messages: ChatMessage[], options?: {
|
|
814
844
|
conversationId?: string;
|
|
@@ -820,6 +850,10 @@ declare class SanqianSDK {
|
|
|
820
850
|
attachedContexts?: string[];
|
|
821
851
|
attachedResources?: string[];
|
|
822
852
|
sessionResources?: string[];
|
|
853
|
+
filePaths?: string[];
|
|
854
|
+
loadItems?: LoadItem[];
|
|
855
|
+
mentionedTools?: string[];
|
|
856
|
+
signal?: AbortSignal;
|
|
823
857
|
}): AsyncGenerator<ChatStreamEvent>;
|
|
824
858
|
/**
|
|
825
859
|
* Send HITL (Human-in-the-Loop) response to resume after interrupt
|
|
@@ -944,6 +978,7 @@ declare const SANQIAN_WEBSITE = "https://sanqian.io";
|
|
|
944
978
|
* Error codes for SDK errors
|
|
945
979
|
*/
|
|
946
980
|
declare enum SDKErrorCode {
|
|
981
|
+
INVALID_CONFIG = "INVALID_CONFIG",
|
|
947
982
|
NOT_INSTALLED = "NOT_INSTALLED",
|
|
948
983
|
NOT_RUNNING = "NOT_RUNNING",
|
|
949
984
|
CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT",
|
|
@@ -996,4 +1031,4 @@ declare class SanqianSDKError extends Error {
|
|
|
996
1031
|
*/
|
|
997
1032
|
declare function createSDKError(code: SDKErrorCode, details?: string): SanqianSDKError;
|
|
998
1033
|
|
|
999
|
-
export { type AgentCapability, type AgentConfig, type AgentInfo, type AgentUpdateConfig, type Capability, type CapabilitySearchResult, type CapabilityType, type ChatMessage, type ChatRequest, type ChatResponse, type ChatStreamEvent, type ConnectionInfo, type ConnectionState, type ContextData, type ContextListItem, type ContextProvider, Conversation, type ConversationDetail, type ConversationInfo, type ConversationMessage, type EmbeddingConfigResult, ErrorMessages, type HitlInterruptPayload, type HitlInterruptType, type HitlResponse, type HitlRiskLevel, type JSONSchema, type JSONSchemaProperty, type ListCapabilitiesOptions, type RemoteToolDefinition, type RerankConfigResult, SANQIAN_WEBSITE, type SDKConfig, SDKErrorCode, type SDKEventName, type SDKEvents, SanqianSDK, SanqianSDKError, type SearchCapabilitiesOptions, type SessionResource, type SkillCapability, type StoredSessionResource, type ToolCall, type ToolCapability, type ToolDefinition, createSDKError };
|
|
1034
|
+
export { type AgentCapability, type AgentConfig, type AgentInfo, type AgentUpdateConfig, type Capability, type CapabilitySearchResult, type CapabilityType, type ChatMessage, type ChatRequest, type ChatResponse, type ChatStreamEvent, type ConnectionInfo, type ConnectionState, type ContextData, type ContextListItem, type ContextProvider, Conversation, type ConversationDetail, type ConversationInfo, type ConversationMessage, type EmbeddingConfigResult, ErrorMessages, type HitlInterruptPayload, type HitlInterruptType, type HitlResponse, type HitlRiskLevel, type JSONSchema, type JSONSchemaProperty, type ListCapabilitiesOptions, type LoadItem, type LoadItemAction, type LoadItemType, type RemoteToolDefinition, type RerankConfigResult, SANQIAN_WEBSITE, type SDKConfig, SDKErrorCode, type SDKEventName, type SDKEvents, SanqianSDK, SanqianSDKError, type SearchCapabilitiesOptions, type SessionResource, type SkillCapability, type StoredSessionResource, type ToolCall, type ToolCapability, type ToolDefinition, createSDKError };
|