@meetsmore-oss/use-ai-server 1.16.0 → 1.17.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/agents/AISDKAgent.d.ts +123 -144
- package/dist/agents/AISDKAgent.d.ts.map +1 -1
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/testing/MockReasoningModel.d.ts +1 -1
- package/dist/agents/testing/MockReasoningModel.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +72 -55
- package/dist/plugins/FeedbackPlugin.d.ts +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/src/agents/AISDKAgent.d.ts +123 -144
- package/dist/src/agents/AISDKAgent.d.ts.map +1 -1
- package/dist/src/agents/index.d.ts +1 -1
- package/dist/src/agents/index.d.ts.map +1 -1
- package/dist/src/agents/testing/MockReasoningModel.d.ts +1 -1
- package/dist/src/agents/testing/MockReasoningModel.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/plugins/FeedbackPlugin.d.ts +1 -1
- package/dist/src/server.d.ts +2 -2
- package/dist/src/utils/toolFilters.d.ts +5 -5
- package/dist/test/integration-test-utils.d.ts +2 -1
- package/dist/test/integration-test-utils.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/toolFilters.d.ts +5 -5
- package/package.json +2 -2
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* import { createMockReasoningModel, AISDKAgent } from '@meetsmore-oss/use-ai-server';
|
|
15
15
|
*
|
|
16
16
|
* const agent = new AISDKAgent({
|
|
17
|
-
* model: createMockReasoningModel(),
|
|
18
17
|
* name: 'Mock (Reasoning)',
|
|
18
|
+
* hooks: { loadConfig: () => ({ model: createMockReasoningModel() }) },
|
|
19
19
|
* });
|
|
20
20
|
*
|
|
21
21
|
* Enable in server-app with: USE_AI_ENABLE_MOCK_AGENT=true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockReasoningModel.d.ts","sourceRoot":"","sources":["../../../../src/agents/testing/MockReasoningModel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"MockReasoningModel.d.ts","sourceRoot":"","sources":["../../../../src/agents/testing/MockReasoningModel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAwI9C;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,mBAAmB,CAqE9D"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { ClientSession } from './server';
|
|
|
4
4
|
export { resolveAttachmentParts } from './attachmentResolution';
|
|
5
5
|
export type { ResolveAttachments, ResolveAttachmentsContext, MultimodalContent } from './types';
|
|
6
6
|
export type { Agent, AgentInput, EventEmitter, AgentResult } from './agents';
|
|
7
|
-
export { AISDKAgent, type AISDKAgentConfig, type MessageWithCacheContext, type CacheTtl, type CacheBreakpointResult, type CacheBreakpointFn, createMockReasoningModel } from './agents';
|
|
7
|
+
export { AISDKAgent, type AISDKAgentConfig, type AISDKAgentHooks, type AISDKRunConfig, type MessageWithCacheContext, type CacheTtl, type CacheBreakpointResult, type CacheBreakpointFn, createMockReasoningModel } from './agents';
|
|
8
8
|
export type { UseAIServerPlugin, MessageHandler, BeforeRunAgentResult } from './plugins';
|
|
9
9
|
export { FeedbackPlugin } from './plugins';
|
|
10
10
|
export type { SpanProcessor } from './instrumentation';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU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iB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGzF,OAAO,EACL,uBAAuB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,yBAAyB,EACzB,KAAK,uBAAuB,GAC7B,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,wBAAwB,EACxB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,GAAG,EACH,EAAE,EACF,GAAG,GACJ,MAAM,SAAS,CAAC"}
|
|
@@ -17,7 +17,7 @@ import type { ClientSession } from '../agents/types';
|
|
|
17
17
|
* import { FeedbackPlugin } from '@meetsmore-oss/use-ai-server';
|
|
18
18
|
*
|
|
19
19
|
* const server = new UseAIServer({
|
|
20
|
-
* agents: { claude: new AISDKAgent({ model }) },
|
|
20
|
+
* agents: { claude: new AISDKAgent({ hooks: { loadConfig: () => ({ model }) } }) },
|
|
21
21
|
* defaultAgent: 'claude',
|
|
22
22
|
* plugins: [
|
|
23
23
|
* new FeedbackPlugin(),
|
package/dist/src/server.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type { ClientSession } from './agents/types';
|
|
|
26
26
|
* apiKey: process.env.ANTHROPIC_API_KEY,
|
|
27
27
|
* });
|
|
28
28
|
* const claudeAgent = new AISDKAgent({
|
|
29
|
-
* model: anthropic('claude-sonnet-4-20250514'),
|
|
29
|
+
* hooks: { loadConfig: () => ({ model: anthropic('claude-sonnet-4-20250514') }) },
|
|
30
30
|
* });
|
|
31
31
|
* const server = new UseAIServer({
|
|
32
32
|
* port: 8081,
|
|
@@ -36,7 +36,7 @@ export type { ClientSession } from './agents/types';
|
|
|
36
36
|
*
|
|
37
37
|
* // Multiple agents (Claude + OpenAI)
|
|
38
38
|
* const gptAgent = new AISDKAgent({
|
|
39
|
-
* model: openai('gpt-4-turbo'),
|
|
39
|
+
* hooks: { loadConfig: () => ({ model: openai('gpt-4-turbo') }) },
|
|
40
40
|
* });
|
|
41
41
|
* const multiServer = new UseAIServer({
|
|
42
42
|
* port: 8081,
|
|
@@ -41,7 +41,7 @@ export declare function isServerTool(tool: ToolDefinition): tool is ServerToolDe
|
|
|
41
41
|
* @example
|
|
42
42
|
* ```typescript
|
|
43
43
|
* const agent = new AISDKAgent({
|
|
44
|
-
* model: anthropic('claude-3-5-sonnet-20241022'),
|
|
44
|
+
* hooks: { loadConfig: () => ({ model: anthropic('claude-3-5-sonnet-20241022') }) },
|
|
45
45
|
* toolFilter: and(
|
|
46
46
|
* createMcpGlobAllowFilter(['db_*']),
|
|
47
47
|
* (tool) => tool.description.includes('read-only')
|
|
@@ -60,7 +60,7 @@ export declare function and(...filters: Array<(tool: ToolDefinition) => boolean>
|
|
|
60
60
|
* @example
|
|
61
61
|
* ```typescript
|
|
62
62
|
* const agent = new AISDKAgent({
|
|
63
|
-
* model: anthropic('claude-3-5-sonnet-20241022'),
|
|
63
|
+
* hooks: { loadConfig: () => ({ model: anthropic('claude-3-5-sonnet-20241022') }) },
|
|
64
64
|
* toolFilter: or(
|
|
65
65
|
* createMcpGlobAllowFilter(['db_*']),
|
|
66
66
|
* createMcpGlobAllowFilter(['file_*'])
|
|
@@ -79,7 +79,7 @@ export declare function or(...filters: Array<(tool: ToolDefinition) => boolean>)
|
|
|
79
79
|
* ```typescript
|
|
80
80
|
* // Block MCP tools matching delete patterns (equivalent to disallow filter)
|
|
81
81
|
* const agent = new AISDKAgent({
|
|
82
|
-
* model: anthropic('claude-3-5-sonnet-20241022'),
|
|
82
|
+
* hooks: { loadConfig: () => ({ model: anthropic('claude-3-5-sonnet-20241022') }) },
|
|
83
83
|
* toolFilter: and(
|
|
84
84
|
* or(not(isRemoteTool), createMcpGlobAllowFilter(['db_*'])),
|
|
85
85
|
* not(createMcpGlobAllowFilter(['*_delete']))
|
|
@@ -99,13 +99,13 @@ export declare function not(filter: (tool: ToolDefinition) => boolean): (tool: T
|
|
|
99
99
|
* ```typescript
|
|
100
100
|
* // Only allow database MCP tools (client tools always pass)
|
|
101
101
|
* const agent = new AISDKAgent({
|
|
102
|
-
* model: anthropic('claude-3-5-sonnet-20241022'),
|
|
102
|
+
* hooks: { loadConfig: () => ({ model: anthropic('claude-3-5-sonnet-20241022') }) },
|
|
103
103
|
* toolFilter: or(not(isRemoteTool), createGlobFilter(['db_*']))
|
|
104
104
|
* });
|
|
105
105
|
*
|
|
106
106
|
* // Allow db_* but exclude *_delete
|
|
107
107
|
* const agent = new AISDKAgent({
|
|
108
|
-
* model: anthropic('claude-3-5-sonnet-20241022'),
|
|
108
|
+
* hooks: { loadConfig: () => ({ model: anthropic('claude-3-5-sonnet-20241022') }) },
|
|
109
109
|
* toolFilter: and(
|
|
110
110
|
* or(not(isRemoteTool), createGlobFilter(['db_*'])),
|
|
111
111
|
* not(createGlobFilter(['*_delete']))
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Shared utilities for server integration tests to reduce code duplication.
|
|
5
5
|
*/
|
|
6
6
|
import type { Socket } from 'socket.io-client';
|
|
7
|
-
import { MockLanguageModelV3
|
|
7
|
+
import { MockLanguageModelV3 } from 'ai/test';
|
|
8
|
+
import { simulateReadableStream } from 'ai';
|
|
8
9
|
import { AISDKAgent } from '../src/agents/AISDKAgent';
|
|
9
10
|
import type { UseAIServerConfig } from '../src/types';
|
|
10
11
|
import { UseAIServer } from '../src/server';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-test-utils.d.ts","sourceRoot":"","sources":["../../test/integration-test-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"integration-test-utils.d.ts","sourceRoot":"","sources":["../../test/integration-test-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,IAAI,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C;;GAEG;AACH,iBAAS,sBAAsB,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAW3C;AAED;;GAEG;AACH,iBAAS,0BAA0B,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAalB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,MAAqB,GAAG,UAAU,CAgBvE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,MAAqB,EAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAC5C,iBAAiB,CAQnB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IACtC,MAAM,EAAE,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