@witqq/agent-sdk 0.7.0 → 0.9.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/{types-CqvUAYxt.d.ts → agent-C6H2CgJA.d.cts} +139 -102
- package/dist/{types-CqvUAYxt.d.cts → agent-F7oB6eKp.d.ts} +139 -102
- package/dist/auth/index.cjs +72 -1
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +21 -154
- package/dist/auth/index.d.ts +21 -154
- package/dist/auth/index.js +72 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/backends/claude.cjs +480 -261
- package/dist/backends/claude.cjs.map +1 -1
- package/dist/backends/claude.d.cts +3 -1
- package/dist/backends/claude.d.ts +3 -1
- package/dist/backends/claude.js +480 -261
- package/dist/backends/claude.js.map +1 -1
- package/dist/backends/copilot.cjs +337 -112
- package/dist/backends/copilot.cjs.map +1 -1
- package/dist/backends/copilot.d.cts +12 -4
- package/dist/backends/copilot.d.ts +12 -4
- package/dist/backends/copilot.js +337 -112
- package/dist/backends/copilot.js.map +1 -1
- package/dist/backends/mock-llm.cjs +719 -0
- package/dist/backends/mock-llm.cjs.map +1 -0
- package/dist/backends/mock-llm.d.cts +37 -0
- package/dist/backends/mock-llm.d.ts +37 -0
- package/dist/backends/mock-llm.js +717 -0
- package/dist/backends/mock-llm.js.map +1 -0
- package/dist/backends/vercel-ai.cjs +301 -61
- package/dist/backends/vercel-ai.cjs.map +1 -1
- package/dist/backends/vercel-ai.d.cts +3 -1
- package/dist/backends/vercel-ai.d.ts +3 -1
- package/dist/backends/vercel-ai.js +301 -61
- package/dist/backends/vercel-ai.js.map +1 -1
- package/dist/backends-Cno0gZjy.d.cts +114 -0
- package/dist/backends-Cno0gZjy.d.ts +114 -0
- package/dist/chat/accumulator.cjs +1 -1
- package/dist/chat/accumulator.cjs.map +1 -1
- package/dist/chat/accumulator.d.cts +5 -2
- package/dist/chat/accumulator.d.ts +5 -2
- package/dist/chat/accumulator.js +1 -1
- package/dist/chat/accumulator.js.map +1 -1
- package/dist/chat/backends.cjs +1084 -821
- package/dist/chat/backends.cjs.map +1 -1
- package/dist/chat/backends.d.cts +10 -6
- package/dist/chat/backends.d.ts +10 -6
- package/dist/chat/backends.js +1082 -800
- package/dist/chat/backends.js.map +1 -1
- package/dist/chat/context.cjs +50 -0
- package/dist/chat/context.cjs.map +1 -1
- package/dist/chat/context.d.cts +27 -3
- package/dist/chat/context.d.ts +27 -3
- package/dist/chat/context.js +50 -0
- package/dist/chat/context.js.map +1 -1
- package/dist/chat/core.cjs +60 -27
- package/dist/chat/core.cjs.map +1 -1
- package/dist/chat/core.d.cts +41 -382
- package/dist/chat/core.d.ts +41 -382
- package/dist/chat/core.js +58 -28
- package/dist/chat/core.js.map +1 -1
- package/dist/chat/errors.cjs +48 -26
- package/dist/chat/errors.cjs.map +1 -1
- package/dist/chat/errors.d.cts +6 -31
- package/dist/chat/errors.d.ts +6 -31
- package/dist/chat/errors.js +48 -25
- package/dist/chat/errors.js.map +1 -1
- package/dist/chat/events.cjs.map +1 -1
- package/dist/chat/events.d.cts +6 -2
- package/dist/chat/events.d.ts +6 -2
- package/dist/chat/events.js.map +1 -1
- package/dist/chat/index.cjs +1612 -1125
- package/dist/chat/index.cjs.map +1 -1
- package/dist/chat/index.d.cts +35 -10
- package/dist/chat/index.d.ts +35 -10
- package/dist/chat/index.js +1600 -1097
- package/dist/chat/index.js.map +1 -1
- package/dist/chat/react/theme.css +2517 -0
- package/dist/chat/react.cjs +2212 -1158
- package/dist/chat/react.cjs.map +1 -1
- package/dist/chat/react.d.cts +665 -122
- package/dist/chat/react.d.ts +665 -122
- package/dist/chat/react.js +2191 -1156
- package/dist/chat/react.js.map +1 -1
- package/dist/chat/runtime.cjs +405 -186
- package/dist/chat/runtime.cjs.map +1 -1
- package/dist/chat/runtime.d.cts +92 -28
- package/dist/chat/runtime.d.ts +92 -28
- package/dist/chat/runtime.js +405 -186
- package/dist/chat/runtime.js.map +1 -1
- package/dist/chat/server.cjs +2247 -212
- package/dist/chat/server.cjs.map +1 -1
- package/dist/chat/server.d.cts +451 -90
- package/dist/chat/server.d.ts +451 -90
- package/dist/chat/server.js +2234 -213
- package/dist/chat/server.js.map +1 -1
- package/dist/chat/sessions.cjs +64 -66
- package/dist/chat/sessions.cjs.map +1 -1
- package/dist/chat/sessions.d.cts +37 -118
- package/dist/chat/sessions.d.ts +37 -118
- package/dist/chat/sessions.js +65 -67
- package/dist/chat/sessions.js.map +1 -1
- package/dist/chat/sqlite.cjs +536 -0
- package/dist/chat/sqlite.cjs.map +1 -0
- package/dist/chat/sqlite.d.cts +164 -0
- package/dist/chat/sqlite.d.ts +164 -0
- package/dist/chat/sqlite.js +527 -0
- package/dist/chat/sqlite.js.map +1 -0
- package/dist/chat/state.cjs +14 -1
- package/dist/chat/state.cjs.map +1 -1
- package/dist/chat/state.d.cts +5 -2
- package/dist/chat/state.d.ts +5 -2
- package/dist/chat/state.js +14 -1
- package/dist/chat/state.js.map +1 -1
- package/dist/chat/storage.cjs +58 -33
- package/dist/chat/storage.cjs.map +1 -1
- package/dist/chat/storage.d.cts +18 -8
- package/dist/chat/storage.d.ts +18 -8
- package/dist/chat/storage.js +59 -34
- package/dist/chat/storage.js.map +1 -1
- package/dist/errors-C-so0M4t.d.cts +33 -0
- package/dist/errors-C-so0M4t.d.ts +33 -0
- package/dist/errors-CmVvczxZ.d.cts +28 -0
- package/dist/errors-CmVvczxZ.d.ts +28 -0
- package/dist/{in-process-transport-C2oPTYs6.d.ts → in-process-transport-7EIit9Xk.d.ts} +72 -33
- package/dist/{in-process-transport-DG-w5G6k.d.cts → in-process-transport-Ct9YcX8I.d.cts} +72 -33
- package/dist/index.cjs +354 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +294 -123
- package/dist/index.d.ts +294 -123
- package/dist/index.js +347 -60
- package/dist/index.js.map +1 -1
- package/dist/provider-types-PTSlRPNB.d.cts +39 -0
- package/dist/provider-types-PTSlRPNB.d.ts +39 -0
- package/dist/refresh-manager-B81PpYBr.d.cts +153 -0
- package/dist/refresh-manager-Dlv_iNZi.d.ts +153 -0
- package/dist/testing.cjs +1107 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +144 -0
- package/dist/testing.d.ts +144 -0
- package/dist/testing.js +1101 -0
- package/dist/testing.js.map +1 -0
- package/dist/token-store-CSUBgYwn.d.ts +48 -0
- package/dist/token-store-CuC4hB9Z.d.cts +48 -0
- package/dist/{transport-DX1Nhm4N.d.cts → transport-DLWCN18G.d.cts} +5 -4
- package/dist/{transport-D1OaUgRk.d.ts → transport-DsuS-GeM.d.ts} +5 -4
- package/dist/{types-CGF7AEX1.d.cts → types-4vbcmPTp.d.cts} +4 -2
- package/dist/{types-Bh5AhqD-.d.ts → types-BxggH0Yh.d.ts} +4 -2
- package/dist/types-DgtI1hzh.d.ts +364 -0
- package/dist/types-DkSXALKg.d.cts +364 -0
- package/package.json +41 -5
- package/LICENSE +0 -21
- package/README.md +0 -948
- package/dist/errors-BDLbNu9w.d.cts +0 -13
- package/dist/errors-BDLbNu9w.d.ts +0 -13
- package/dist/types-DLZzlJxt.d.ts +0 -39
- package/dist/types-tE0CXwBl.d.cts +0 -39
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { I as
|
|
4
|
-
import { I as IChatTransport } from './transport-
|
|
1
|
+
import { F as FullAgentConfig, I as IAgentService, c as IAgent, d as Message, M as ModelInfo } from './agent-C6H2CgJA.cjs';
|
|
2
|
+
import { C as CopilotBackendOptions, a as ClaudeBackendOptions, V as VercelAIBackendOptions, M as MockLLMBackendOptions } from './backends-Cno0gZjy.cjs';
|
|
3
|
+
import { I as IChatBackend, B as BackendAdapterOptions, g as ChatSession, S as SendMessageOptions, c as ChatMessage, a as ChatEvent, d as IResumableBackend } from './types-DkSXALKg.cjs';
|
|
4
|
+
import { I as IChatTransport } from './transport-DLWCN18G.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @witqq/agent-sdk/chat/backends/base
|
|
@@ -11,23 +11,28 @@ import { I as IChatTransport } from './transport-DX1Nhm4N.cjs';
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Abstract base for backend adapters.
|
|
15
|
-
* Subclasses implement createService()
|
|
14
|
+
* Abstract base for backend adapters implementing IChatBackend (core only).
|
|
15
|
+
* Subclasses implement createService() for backend-specific service creation.
|
|
16
|
+
* Resume support is NOT required — subclasses can implement IResumableBackend separately.
|
|
16
17
|
*/
|
|
17
|
-
declare abstract class BaseBackendAdapter implements
|
|
18
|
+
declare abstract class BaseBackendAdapter implements IChatBackend {
|
|
18
19
|
readonly name: string;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
protected readonly _agentConfig:
|
|
23
|
-
private
|
|
20
|
+
private _agentService;
|
|
21
|
+
private _agentServiceFactory;
|
|
22
|
+
private _disposed;
|
|
23
|
+
protected readonly _agentConfig: FullAgentConfig;
|
|
24
|
+
private _ownsService;
|
|
25
|
+
private _currentAgent;
|
|
24
26
|
constructor(name: string, options: BackendAdapterOptions);
|
|
25
27
|
/** Subclasses create their specific IAgentService */
|
|
26
28
|
protected abstract createService(): IAgentService;
|
|
27
29
|
get agentService(): IAgentService;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
get currentModel(): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated No-op. Tools are passed per-call via SendMessageOptions.tools.
|
|
33
|
+
* Kept for backward compatibility with code that calls setTools() directly.
|
|
34
|
+
*/
|
|
35
|
+
setTools(): void;
|
|
31
36
|
sendMessage(session: ChatSession, message: string, options?: SendMessageOptions): Promise<ChatMessage>;
|
|
32
37
|
streamMessage(session: ChatSession, message: string, options?: SendMessageOptions): AsyncIterable<ChatEvent>;
|
|
33
38
|
/**
|
|
@@ -41,13 +46,37 @@ declare abstract class BaseBackendAdapter implements IBackendAdapter {
|
|
|
41
46
|
errors: string[];
|
|
42
47
|
}>;
|
|
43
48
|
dispose(): Promise<void>;
|
|
44
|
-
/** Get or create an agent
|
|
49
|
+
/** Get or create an agent. Model is passed per-call via RunOptions.
|
|
50
|
+
* Tools are passed per-call via SendMessageOptions — not baked into config.
|
|
51
|
+
* For persistent sessions, reuses agent when model matches. */
|
|
45
52
|
protected getOrCreateAgent(options?: SendMessageOptions): IAgent;
|
|
46
53
|
/** Subclasses capture backend session ID from agent after streaming */
|
|
47
54
|
protected abstract captureSessionId(agent: IAgent): void;
|
|
48
55
|
protected assertNotDisposed(): void;
|
|
49
56
|
}
|
|
50
57
|
|
|
58
|
+
/**
|
|
59
|
+
* @witqq/agent-sdk/chat/backends/resumable
|
|
60
|
+
*
|
|
61
|
+
* Abstract base for CLI-backed adapters with session resume support.
|
|
62
|
+
* Shared by CopilotChatAdapter and ClaudeChatAdapter — the only
|
|
63
|
+
* difference between them is createService() and constructor options.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Abstract base for backend adapters that support session resume.
|
|
68
|
+
* Handles backendSessionId tracking, canResume(), resume(), captureSessionId().
|
|
69
|
+
* Subclasses only define constructor (with backend-specific options) and createService().
|
|
70
|
+
*/
|
|
71
|
+
declare abstract class ResumableChatAdapter extends BaseBackendAdapter implements IResumableBackend {
|
|
72
|
+
private _backendSessionId;
|
|
73
|
+
constructor(name: string, options: BackendAdapterOptions);
|
|
74
|
+
get backendSessionId(): string | null;
|
|
75
|
+
canResume(): boolean;
|
|
76
|
+
resume(session: ChatSession, backendSessionId: string, options?: SendMessageOptions): AsyncIterable<ChatEvent>;
|
|
77
|
+
protected captureSessionId(agent: IAgent): void;
|
|
78
|
+
}
|
|
79
|
+
|
|
51
80
|
/**
|
|
52
81
|
* @witqq/agent-sdk/chat/backends/copilot
|
|
53
82
|
*
|
|
@@ -64,15 +93,10 @@ interface CopilotChatAdapterOptions extends BackendAdapterOptions {
|
|
|
64
93
|
* Backend adapter for GitHub Copilot CLI.
|
|
65
94
|
* Uses persistent session mode for session resume via CLI session ID.
|
|
66
95
|
*/
|
|
67
|
-
declare class CopilotChatAdapter extends
|
|
68
|
-
private _backendSessionId;
|
|
96
|
+
declare class CopilotChatAdapter extends ResumableChatAdapter {
|
|
69
97
|
private readonly _copilotOptions?;
|
|
70
98
|
constructor(options: CopilotChatAdapterOptions);
|
|
71
99
|
protected createService(): IAgentService;
|
|
72
|
-
get backendSessionId(): string | null;
|
|
73
|
-
canResume(): boolean;
|
|
74
|
-
resume(session: ChatSession, backendSessionId: string, options?: SendMessageOptions): AsyncIterable<ChatEvent>;
|
|
75
|
-
protected captureSessionId(agent: IAgent): void;
|
|
76
100
|
}
|
|
77
101
|
|
|
78
102
|
/**
|
|
@@ -91,22 +115,17 @@ interface ClaudeChatAdapterOptions extends BackendAdapterOptions {
|
|
|
91
115
|
* Backend adapter for Claude CLI.
|
|
92
116
|
* Uses persistent session mode for session resume via Claude's session_id.
|
|
93
117
|
*/
|
|
94
|
-
declare class ClaudeChatAdapter extends
|
|
95
|
-
private _backendSessionId;
|
|
118
|
+
declare class ClaudeChatAdapter extends ResumableChatAdapter {
|
|
96
119
|
private readonly _claudeOptions?;
|
|
97
120
|
constructor(options: ClaudeChatAdapterOptions);
|
|
98
121
|
protected createService(): IAgentService;
|
|
99
|
-
get backendSessionId(): string | null;
|
|
100
|
-
canResume(): boolean;
|
|
101
|
-
resume(session: ChatSession, backendSessionId: string, options?: SendMessageOptions): AsyncIterable<ChatEvent>;
|
|
102
|
-
protected captureSessionId(agent: IAgent): void;
|
|
103
122
|
}
|
|
104
123
|
|
|
105
124
|
/**
|
|
106
125
|
* @witqq/agent-sdk/chat/backends/vercel-ai
|
|
107
126
|
*
|
|
108
127
|
* VercelAIChatAdapter wraps VercelAIAgentService for chat use.
|
|
109
|
-
* Stateless adapter —
|
|
128
|
+
* Stateless adapter — implements IChatBackend only (no resume support).
|
|
110
129
|
* Each streamMessage/sendMessage creates a fresh agent (per-call session mode).
|
|
111
130
|
*/
|
|
112
131
|
|
|
@@ -118,14 +137,34 @@ interface VercelAIChatAdapterOptions extends BackendAdapterOptions {
|
|
|
118
137
|
/**
|
|
119
138
|
* Backend adapter for Vercel AI SDK (API-based).
|
|
120
139
|
* Stateless — each call creates a fresh agent. Does not support resume.
|
|
140
|
+
* Implements IChatBackend only (no IResumableBackend).
|
|
121
141
|
*/
|
|
122
142
|
declare class VercelAIChatAdapter extends BaseBackendAdapter {
|
|
123
143
|
private readonly _vercelOptions?;
|
|
124
144
|
constructor(options: VercelAIChatAdapterOptions);
|
|
125
145
|
protected createService(): IAgentService;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
146
|
+
protected captureSessionId(_agent: IAgent): void;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @witqq/agent-sdk/chat/backends/mock-llm
|
|
151
|
+
*
|
|
152
|
+
* MockLLMChatAdapter wraps MockLLMService for chat use.
|
|
153
|
+
* No auth, no credentials — fully deterministic testing backend.
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
/** Options for creating a MockLLMChatAdapter */
|
|
157
|
+
interface MockLLMChatAdapterOptions extends BackendAdapterOptions {
|
|
158
|
+
/** MockLLM backend options (mode, latency, streaming, etc.) */
|
|
159
|
+
mockOptions?: MockLLMBackendOptions;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Backend adapter for Mock LLM.
|
|
163
|
+
* Zero-auth, deterministic, fully configurable for E2E testing.
|
|
164
|
+
*/
|
|
165
|
+
declare class MockLLMChatAdapter extends BaseBackendAdapter {
|
|
166
|
+
constructor(options: MockLLMChatAdapterOptions);
|
|
167
|
+
protected createService(): IAgentService;
|
|
129
168
|
protected captureSessionId(_agent: IAgent): void;
|
|
130
169
|
}
|
|
131
170
|
|
|
@@ -220,4 +259,4 @@ declare class InProcessChatTransport implements IChatTransport {
|
|
|
220
259
|
[Symbol.asyncIterator](): AsyncIterator<ChatEvent>;
|
|
221
260
|
}
|
|
222
261
|
|
|
223
|
-
export { BaseBackendAdapter as B, ClaudeChatAdapter as C, InProcessChatTransport as I, VercelAIChatAdapter as V,
|
|
262
|
+
export { BaseBackendAdapter as B, ClaudeChatAdapter as C, InProcessChatTransport as I, MockLLMChatAdapter as M, ResumableChatAdapter as R, VercelAIChatAdapter as V, WS_READY_STATE as W, type ClaudeChatAdapterOptions as a, CopilotChatAdapter as b, type CopilotChatAdapterOptions as c, type MockLLMChatAdapterOptions as d, type VercelAIChatAdapterOptions as e, type WebSocketLike as f, WsChatTransport as g, type WsTransportOptions as h };
|