@witqq/agent-sdk 0.6.1 → 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/README.md +539 -6
- package/dist/{types-BvwNzZCj.d.cts → agent-CW9XbmG_.d.ts} +148 -95
- package/dist/{types-BvwNzZCj.d.ts → agent-DxY68NZL.d.cts} +148 -95
- package/dist/auth/index.cjs +260 -2
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +21 -138
- package/dist/auth/index.d.ts +21 -138
- package/dist/auth/index.js +260 -3
- package/dist/auth/index.js.map +1 -1
- package/dist/backends/claude.cjs +653 -140
- package/dist/backends/claude.cjs.map +1 -1
- package/dist/backends/claude.d.cts +4 -1
- package/dist/backends/claude.d.ts +4 -1
- package/dist/backends/claude.js +653 -140
- package/dist/backends/claude.js.map +1 -1
- package/dist/backends/copilot.cjs +428 -88
- package/dist/backends/copilot.cjs.map +1 -1
- package/dist/backends/copilot.d.cts +13 -4
- package/dist/backends/copilot.d.ts +13 -4
- package/dist/backends/copilot.js +428 -88
- package/dist/backends/copilot.js.map +1 -1
- package/dist/backends/vercel-ai.cjs +349 -77
- 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 +349 -77
- package/dist/backends/vercel-ai.js.map +1 -1
- package/dist/backends-BSrsBYFn.d.cts +39 -0
- package/dist/backends-BSrsBYFn.d.ts +39 -0
- package/dist/chat/accumulator.cjs +147 -0
- package/dist/chat/accumulator.cjs.map +1 -0
- package/dist/chat/accumulator.d.cts +64 -0
- package/dist/chat/accumulator.d.ts +64 -0
- package/dist/chat/accumulator.js +145 -0
- package/dist/chat/accumulator.js.map +1 -0
- package/dist/chat/backends.cjs +3524 -0
- package/dist/chat/backends.cjs.map +1 -0
- package/dist/chat/backends.d.cts +66 -0
- package/dist/chat/backends.d.ts +66 -0
- package/dist/chat/backends.js +3512 -0
- package/dist/chat/backends.js.map +1 -0
- package/dist/chat/context.cjs +280 -0
- package/dist/chat/context.cjs.map +1 -0
- package/dist/chat/context.d.cts +191 -0
- package/dist/chat/context.d.ts +191 -0
- package/dist/chat/context.js +277 -0
- package/dist/chat/context.js.map +1 -0
- package/dist/chat/core.cjs +305 -0
- package/dist/chat/core.cjs.map +1 -0
- package/dist/chat/core.d.cts +84 -0
- package/dist/chat/core.d.ts +84 -0
- package/dist/chat/core.js +282 -0
- package/dist/chat/core.js.map +1 -0
- package/dist/chat/errors.cjs +273 -0
- package/dist/chat/errors.cjs.map +1 -0
- package/dist/chat/errors.d.cts +97 -0
- package/dist/chat/errors.d.ts +97 -0
- package/dist/chat/errors.js +266 -0
- package/dist/chat/errors.js.map +1 -0
- package/dist/chat/events.cjs +203 -0
- package/dist/chat/events.cjs.map +1 -0
- package/dist/chat/events.d.cts +245 -0
- package/dist/chat/events.d.ts +245 -0
- package/dist/chat/events.js +196 -0
- package/dist/chat/events.js.map +1 -0
- package/dist/chat/index.cjs +5550 -0
- package/dist/chat/index.cjs.map +1 -0
- package/dist/chat/index.d.cts +77 -0
- package/dist/chat/index.d.ts +77 -0
- package/dist/chat/index.js +5505 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/react/theme.css +2517 -0
- package/dist/chat/react.cjs +3589 -0
- package/dist/chat/react.cjs.map +1 -0
- package/dist/chat/react.d.cts +1088 -0
- package/dist/chat/react.d.ts +1088 -0
- package/dist/chat/react.js +3547 -0
- package/dist/chat/react.js.map +1 -0
- package/dist/chat/runtime.cjs +1245 -0
- package/dist/chat/runtime.cjs.map +1 -0
- package/dist/chat/runtime.d.cts +182 -0
- package/dist/chat/runtime.d.ts +182 -0
- package/dist/chat/runtime.js +1243 -0
- package/dist/chat/runtime.js.map +1 -0
- package/dist/chat/server.cjs +2668 -0
- package/dist/chat/server.cjs.map +1 -0
- package/dist/chat/server.d.cts +648 -0
- package/dist/chat/server.d.ts +648 -0
- package/dist/chat/server.js +2628 -0
- package/dist/chat/server.js.map +1 -0
- package/dist/chat/sessions.cjs +380 -0
- package/dist/chat/sessions.cjs.map +1 -0
- package/dist/chat/sessions.d.cts +158 -0
- package/dist/chat/sessions.d.ts +158 -0
- package/dist/chat/sessions.js +376 -0
- package/dist/chat/sessions.js.map +1 -0
- package/dist/chat/sqlite.cjs +441 -0
- package/dist/chat/sqlite.cjs.map +1 -0
- package/dist/chat/sqlite.d.cts +128 -0
- package/dist/chat/sqlite.d.ts +128 -0
- package/dist/chat/sqlite.js +435 -0
- package/dist/chat/sqlite.js.map +1 -0
- package/dist/chat/state.cjs +190 -0
- package/dist/chat/state.cjs.map +1 -0
- package/dist/chat/state.d.cts +95 -0
- package/dist/chat/state.d.ts +95 -0
- package/dist/chat/state.js +180 -0
- package/dist/chat/state.js.map +1 -0
- package/dist/chat/storage.cjs +249 -0
- package/dist/chat/storage.cjs.map +1 -0
- package/dist/chat/storage.d.cts +197 -0
- package/dist/chat/storage.d.ts +197 -0
- package/dist/chat/storage.js +245 -0
- package/dist/chat/storage.js.map +1 -0
- 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-C1JnJGVR.d.ts +228 -0
- package/dist/in-process-transport-C7DSqPyX.d.cts +228 -0
- package/dist/index.cjs +365 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +322 -125
- package/dist/index.d.ts +322 -125
- package/dist/index.js +359 -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 +383 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +132 -0
- package/dist/testing.d.ts +132 -0
- package/dist/testing.js +377 -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-Cdh3M0tS.d.cts +68 -0
- package/dist/transport-Ciap4PWK.d.ts +68 -0
- package/dist/types-4vbcmPTp.d.cts +143 -0
- package/dist/types-BxggH0Yh.d.ts +143 -0
- package/dist/types-DRgd_9R7.d.cts +363 -0
- package/dist/types-ajANVzf7.d.ts +363 -0
- package/package.json +178 -6
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { a as ChatEvent } from '../types-DRgd_9R7.cjs';
|
|
2
|
+
export { B as BackendAdapterOptions, I as IChatBackend, d as IResumableBackend, i as isResumableBackend } from '../types-DRgd_9R7.cjs';
|
|
3
|
+
export { B as BaseBackendAdapter, C as ClaudeChatAdapter, a as ClaudeChatAdapterOptions, b as CopilotChatAdapter, c as CopilotChatAdapterOptions, I as InProcessChatTransport, V as VercelAIChatAdapter, d as VercelAIChatAdapterOptions, W as WS_READY_STATE, e as WebSocketLike, f as WsChatTransport, g as WsTransportOptions } from '../in-process-transport-C7DSqPyX.cjs';
|
|
4
|
+
import { I as IChatTransport } from '../transport-Cdh3M0tS.cjs';
|
|
5
|
+
export { C as CloseDetectable, S as SSEChatTransport, a as SSETransportOptions, W as WritableResponse, s as streamToTransport } from '../transport-Cdh3M0tS.cjs';
|
|
6
|
+
import '../agent-DxY68NZL.cjs';
|
|
7
|
+
import 'zod';
|
|
8
|
+
import '../errors-C-so0M4t.cjs';
|
|
9
|
+
import '../types-4vbcmPTp.cjs';
|
|
10
|
+
import '../errors-CmVvczxZ.cjs';
|
|
11
|
+
import '../backends-BSrsBYFn.cjs';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @witqq/agent-sdk - Transport Interceptors
|
|
15
|
+
*
|
|
16
|
+
* Composable hooks that wrap any IChatTransport to intercept events
|
|
17
|
+
* at the transport boundary. Use for logging, metrics, rate limiting,
|
|
18
|
+
* or event transformation without modifying the transport itself.
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { withInterceptors } from "@witqq/agent-sdk/chat/backends";
|
|
22
|
+
*
|
|
23
|
+
* const transport = withInterceptors(sseTransport, [
|
|
24
|
+
* loggingInterceptor(),
|
|
25
|
+
* metricsInterceptor(),
|
|
26
|
+
* ]);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** Context passed to interceptor hooks */
|
|
31
|
+
interface InterceptorContext {
|
|
32
|
+
/** The event being intercepted (mutable for beforeSend) */
|
|
33
|
+
event: ChatEvent;
|
|
34
|
+
/** The underlying transport being wrapped */
|
|
35
|
+
transport: IChatTransport;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Transport interceptor with lifecycle hooks.
|
|
39
|
+
* All hooks are optional — implement only what you need.
|
|
40
|
+
*/
|
|
41
|
+
interface TransportInterceptor {
|
|
42
|
+
/** Optional name for debugging */
|
|
43
|
+
name?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Called before each event is sent to the transport.
|
|
46
|
+
* Return the event to send, a modified event, or null to suppress.
|
|
47
|
+
*/
|
|
48
|
+
beforeSend?(event: ChatEvent, transport: IChatTransport): ChatEvent | null;
|
|
49
|
+
/** Called after each event is sent to the transport */
|
|
50
|
+
afterSend?(event: ChatEvent, transport: IChatTransport): void;
|
|
51
|
+
/** Called before the transport is closed */
|
|
52
|
+
beforeClose?(transport: IChatTransport): void;
|
|
53
|
+
/** Called when an error is signaled on the transport */
|
|
54
|
+
onError?(error: Error, transport: IChatTransport): void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Wrap a transport with one or more interceptors.
|
|
58
|
+
* Interceptors are applied in order: first interceptor's beforeSend runs first.
|
|
59
|
+
*
|
|
60
|
+
* @param transport - Base transport to wrap
|
|
61
|
+
* @param interceptors - Array of interceptors to apply
|
|
62
|
+
* @returns Wrapped transport with interceptor hooks
|
|
63
|
+
*/
|
|
64
|
+
declare function withInterceptors(transport: IChatTransport, interceptors: TransportInterceptor[]): IChatTransport;
|
|
65
|
+
|
|
66
|
+
export { IChatTransport, type InterceptorContext, type TransportInterceptor, withInterceptors };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { a as ChatEvent } from '../types-ajANVzf7.js';
|
|
2
|
+
export { B as BackendAdapterOptions, I as IChatBackend, d as IResumableBackend, i as isResumableBackend } from '../types-ajANVzf7.js';
|
|
3
|
+
export { B as BaseBackendAdapter, C as ClaudeChatAdapter, a as ClaudeChatAdapterOptions, b as CopilotChatAdapter, c as CopilotChatAdapterOptions, I as InProcessChatTransport, V as VercelAIChatAdapter, d as VercelAIChatAdapterOptions, W as WS_READY_STATE, e as WebSocketLike, f as WsChatTransport, g as WsTransportOptions } from '../in-process-transport-C1JnJGVR.js';
|
|
4
|
+
import { I as IChatTransport } from '../transport-Ciap4PWK.js';
|
|
5
|
+
export { C as CloseDetectable, S as SSEChatTransport, a as SSETransportOptions, W as WritableResponse, s as streamToTransport } from '../transport-Ciap4PWK.js';
|
|
6
|
+
import '../agent-CW9XbmG_.js';
|
|
7
|
+
import 'zod';
|
|
8
|
+
import '../errors-C-so0M4t.js';
|
|
9
|
+
import '../types-BxggH0Yh.js';
|
|
10
|
+
import '../errors-CmVvczxZ.js';
|
|
11
|
+
import '../backends-BSrsBYFn.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @witqq/agent-sdk - Transport Interceptors
|
|
15
|
+
*
|
|
16
|
+
* Composable hooks that wrap any IChatTransport to intercept events
|
|
17
|
+
* at the transport boundary. Use for logging, metrics, rate limiting,
|
|
18
|
+
* or event transformation without modifying the transport itself.
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { withInterceptors } from "@witqq/agent-sdk/chat/backends";
|
|
22
|
+
*
|
|
23
|
+
* const transport = withInterceptors(sseTransport, [
|
|
24
|
+
* loggingInterceptor(),
|
|
25
|
+
* metricsInterceptor(),
|
|
26
|
+
* ]);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** Context passed to interceptor hooks */
|
|
31
|
+
interface InterceptorContext {
|
|
32
|
+
/** The event being intercepted (mutable for beforeSend) */
|
|
33
|
+
event: ChatEvent;
|
|
34
|
+
/** The underlying transport being wrapped */
|
|
35
|
+
transport: IChatTransport;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Transport interceptor with lifecycle hooks.
|
|
39
|
+
* All hooks are optional — implement only what you need.
|
|
40
|
+
*/
|
|
41
|
+
interface TransportInterceptor {
|
|
42
|
+
/** Optional name for debugging */
|
|
43
|
+
name?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Called before each event is sent to the transport.
|
|
46
|
+
* Return the event to send, a modified event, or null to suppress.
|
|
47
|
+
*/
|
|
48
|
+
beforeSend?(event: ChatEvent, transport: IChatTransport): ChatEvent | null;
|
|
49
|
+
/** Called after each event is sent to the transport */
|
|
50
|
+
afterSend?(event: ChatEvent, transport: IChatTransport): void;
|
|
51
|
+
/** Called before the transport is closed */
|
|
52
|
+
beforeClose?(transport: IChatTransport): void;
|
|
53
|
+
/** Called when an error is signaled on the transport */
|
|
54
|
+
onError?(error: Error, transport: IChatTransport): void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Wrap a transport with one or more interceptors.
|
|
58
|
+
* Interceptors are applied in order: first interceptor's beforeSend runs first.
|
|
59
|
+
*
|
|
60
|
+
* @param transport - Base transport to wrap
|
|
61
|
+
* @param interceptors - Array of interceptors to apply
|
|
62
|
+
* @returns Wrapped transport with interceptor hooks
|
|
63
|
+
*/
|
|
64
|
+
declare function withInterceptors(transport: IChatTransport, interceptors: TransportInterceptor[]): IChatTransport;
|
|
65
|
+
|
|
66
|
+
export { IChatTransport, type InterceptorContext, type TransportInterceptor, withInterceptors };
|