@opentiny/next-sdk 0.1.15 → 0.2.1

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.
Files changed (42) hide show
  1. package/WebMcpClient.ts +17 -19
  2. package/WebMcpServer.ts +11 -8
  3. package/agent/AgentModelProvider.ts +495 -2
  4. package/agent/type.ts +9 -3
  5. package/agent/utils/generateReActPrompt.ts +55 -0
  6. package/agent/utils/parseReActAction.ts +34 -0
  7. package/dist/WebMcpClient.d.ts +176 -35
  8. package/dist/WebMcpServer.d.ts +43 -154
  9. package/dist/agent/AgentModelProvider.d.ts +35 -1
  10. package/dist/agent/type.d.ts +9 -2
  11. package/dist/agent/utils/generateReActPrompt.d.ts +9 -0
  12. package/dist/agent/utils/parseReActAction.d.ts +14 -0
  13. package/dist/index.es.dev.js +16154 -12116
  14. package/dist/index.es.js +22208 -19236
  15. package/dist/index.js +2411 -320
  16. package/dist/index.umd.dev.js +16147 -12109
  17. package/dist/index.umd.js +109 -67
  18. package/dist/{mcpsdk@1.23.0.dev.js → mcpsdk@1.25.2.dev.js} +8592 -6902
  19. package/dist/{mcpsdk@1.23.0.es.dev.js → mcpsdk@1.25.2.es.dev.js} +8601 -6911
  20. package/dist/mcpsdk@1.25.2.es.js +16796 -0
  21. package/dist/mcpsdk@1.25.2.js +43 -0
  22. package/dist/transport/ExtensionPageServerTransport.d.ts +1 -2
  23. package/dist/webagent.dev.js +15216 -11451
  24. package/dist/webagent.es.dev.js +15260 -11495
  25. package/dist/webagent.es.js +17923 -15160
  26. package/dist/webagent.js +96 -54
  27. package/dist/webmcp-full.dev.js +9872 -8168
  28. package/dist/webmcp-full.es.dev.js +9870 -8166
  29. package/dist/webmcp-full.es.js +10712 -9513
  30. package/dist/webmcp-full.js +31 -31
  31. package/dist/webmcp.dev.js +666 -640
  32. package/dist/webmcp.es.dev.js +664 -638
  33. package/dist/webmcp.es.js +651 -619
  34. package/dist/webmcp.js +1 -1
  35. package/dist/zod@3.25.76.dev.js +30 -32
  36. package/dist/zod@3.25.76.es.dev.js +28 -30
  37. package/dist/zod@3.25.76.es.js +143 -145
  38. package/dist/zod@3.25.76.js +1 -1
  39. package/package.json +10 -9
  40. package/transport/ExtensionPageServerTransport.ts +2 -4
  41. package/dist/mcpsdk@1.23.0.es.js +0 -15584
  42. package/dist/mcpsdk@1.23.0.js +0 -43
package/WebMcpClient.ts CHANGED
@@ -39,7 +39,15 @@ import type {
39
39
  ListPromptsRequest,
40
40
  ReadResourceRequest,
41
41
  ListResourcesRequest,
42
- ListResourceTemplatesRequest
42
+ ListResourceTemplatesRequest,
43
+ ElicitRequest,
44
+ CreateMessageRequest,
45
+ ListRootsRequest,
46
+ ToolListChangedNotification,
47
+ PromptListChangedNotification,
48
+ ResourceListChangedNotification,
49
+ ResourceUpdatedNotification,
50
+ LoggingMessageNotification
43
51
  } from '@modelcontextprotocol/sdk/types.js'
44
52
  import type { ProxyOptions } from '@opentiny/next'
45
53
  import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'
@@ -372,7 +380,7 @@ export class WebMcpClient {
372
380
  */
373
381
  onElicit(
374
382
  handler: (
375
- request: z.infer<typeof ElicitRequestSchema>,
383
+ request: ElicitRequest,
376
384
  extra: RequestHandlerExtra<SendRequestT, SendNotificationT>
377
385
  ) => SendResultT | Promise<SendResultT>
378
386
  ): void {
@@ -384,7 +392,7 @@ export class WebMcpClient {
384
392
  */
385
393
  onCreateMessage(
386
394
  handler: (
387
- request: z.infer<typeof CreateMessageRequestSchema>,
395
+ request: CreateMessageRequest,
388
396
  extra: RequestHandlerExtra<SendRequestT, SendNotificationT>
389
397
  ) => SendResultT | Promise<SendResultT>
390
398
  ): void {
@@ -396,7 +404,7 @@ export class WebMcpClient {
396
404
  */
397
405
  onListRoots(
398
406
  handler: (
399
- request: z.infer<typeof ListRootsRequestSchema>,
407
+ request: ListRootsRequest,
400
408
  extra: RequestHandlerExtra<SendRequestT, SendNotificationT>
401
409
  ) => SendResultT | Promise<SendResultT>
402
410
  ): void {
@@ -406,45 +414,35 @@ export class WebMcpClient {
406
414
  /**
407
415
  * Registers a handler for the tool list changed notification.
408
416
  */
409
- onToolListChanged(
410
- handler: (notification: z.infer<typeof ToolListChangedNotificationSchema>) => void | Promise<void>
411
- ): void {
417
+ onToolListChanged(handler: (notification: ToolListChangedNotification) => void | Promise<void>): void {
412
418
  this.client.setNotificationHandler(ToolListChangedNotificationSchema, handler)
413
419
  }
414
420
 
415
421
  /**
416
422
  * Registers a handler for the prompt list changed notification.
417
423
  */
418
- onPromptListChanged(
419
- handler: (notification: z.infer<typeof PromptListChangedNotificationSchema>) => void | Promise<void>
420
- ): void {
424
+ onPromptListChanged(handler: (notification: PromptListChangedNotification) => void | Promise<void>): void {
421
425
  this.client.setNotificationHandler(PromptListChangedNotificationSchema, handler)
422
426
  }
423
427
 
424
428
  /**
425
429
  * Registers a handler for the resource list changed notification.
426
430
  */
427
- onResourceListChanged(
428
- handler: (notification: z.infer<typeof ResourceListChangedNotificationSchema>) => void | Promise<void>
429
- ): void {
431
+ onResourceListChanged(handler: (notification: ResourceListChangedNotification) => void | Promise<void>): void {
430
432
  this.client.setNotificationHandler(ResourceListChangedNotificationSchema, handler)
431
433
  }
432
434
 
433
435
  /**
434
436
  * Registers a handler for the resource updated notification.
435
437
  */
436
- onResourceUpdated(
437
- handler: (notification: z.infer<typeof ResourceUpdatedNotificationSchema>) => void | Promise<void>
438
- ): void {
438
+ onResourceUpdated(handler: (notification: ResourceUpdatedNotification) => void | Promise<void>): void {
439
439
  this.client.setNotificationHandler(ResourceUpdatedNotificationSchema, handler)
440
440
  }
441
441
 
442
442
  /**
443
443
  * Registers a handler for the logging message notification.
444
444
  */
445
- onLoggingMessage(
446
- handler: (notification: z.infer<typeof LoggingMessageNotificationSchema>) => void | Promise<void>
447
- ): void {
445
+ onLoggingMessage(handler: (notification: LoggingMessageNotification) => void | Promise<void>): void {
448
446
  this.client.setNotificationHandler(LoggingMessageNotificationSchema, handler)
449
447
  }
450
448
 
package/WebMcpServer.ts CHANGED
@@ -33,7 +33,12 @@ import type {
33
33
  ListRootsRequest,
34
34
  CreateMessageRequest,
35
35
  LoggingMessageNotification,
36
- ResourceUpdatedNotification
36
+ ResourceUpdatedNotification,
37
+ SubscribeRequest,
38
+ UnsubscribeRequest,
39
+ SetLevelRequest,
40
+ ListResourcesRequest,
41
+ RootsListChangedNotification
37
42
  } from '@modelcontextprotocol/sdk/types.js'
38
43
  import type { ZodRawShape, ZodTypeDef } from 'zod'
39
44
  import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'
@@ -355,7 +360,7 @@ export class WebMcpServer {
355
360
  */
356
361
  onSubscribe(
357
362
  handler: (
358
- request: z.infer<typeof SubscribeRequestSchema>,
363
+ request: SubscribeRequest,
359
364
  extra: RequestHandlerExtra<SendRequestT, SendNotificationT>
360
365
  ) => SendResultT | Promise<SendResultT>
361
366
  ): void {
@@ -367,7 +372,7 @@ export class WebMcpServer {
367
372
  */
368
373
  onUnsubscribe(
369
374
  handler: (
370
- request: z.infer<typeof UnsubscribeRequestSchema>,
375
+ request: UnsubscribeRequest,
371
376
  extra: RequestHandlerExtra<SendRequestT, SendNotificationT>
372
377
  ) => SendResultT | Promise<SendResultT>
373
378
  ): void {
@@ -379,7 +384,7 @@ export class WebMcpServer {
379
384
  */
380
385
  onSetLogLevel(
381
386
  handler: (
382
- request: z.infer<typeof SetLevelRequestSchema>,
387
+ request: SetLevelRequest,
383
388
  extra: RequestHandlerExtra<SendRequestT, SendNotificationT>
384
389
  ) => SendResultT | Promise<SendResultT>
385
390
  ): void {
@@ -391,7 +396,7 @@ export class WebMcpServer {
391
396
  */
392
397
  onListResources(
393
398
  handler: (
394
- request: z.infer<typeof ListResourcesRequestSchema>,
399
+ request: ListResourcesRequest,
395
400
  extra: RequestHandlerExtra<SendRequestT, SendNotificationT>
396
401
  ) => SendResultT | Promise<SendResultT>
397
402
  ): void {
@@ -401,9 +406,7 @@ export class WebMcpServer {
401
406
  /**
402
407
  * Registers a handler for the roots list changed notification.
403
408
  */
404
- onRootsListChanged(
405
- handler: (notification: z.infer<typeof RootsListChangedNotificationSchema>) => void | Promise<void>
406
- ): void {
409
+ onRootsListChanged(handler: (notification: RootsListChangedNotification) => void | Promise<void>): void {
407
410
  this.server.server.setNotificationHandler(RootsListChangedNotificationSchema, handler)
408
411
  }
409
412