@dexto/server 1.13.5 → 1.14.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 (35) hide show
  1. package/dist/hono/index.cjs +3 -2
  2. package/dist/hono/index.d.ts.map +1 -1
  3. package/dist/hono/index.js +7 -3
  4. package/dist/hono/middleware/auth.cjs +42 -32
  5. package/dist/hono/middleware/auth.d.ts +15 -1
  6. package/dist/hono/middleware/auth.d.ts.map +1 -1
  7. package/dist/hono/middleware/auth.js +39 -31
  8. package/dist/hono/node/index.cjs +33 -22
  9. package/dist/hono/node/index.d.ts +1 -0
  10. package/dist/hono/node/index.d.ts.map +1 -1
  11. package/dist/hono/node/index.js +33 -22
  12. package/dist/hono/routes/agents.d.ts +14 -14
  13. package/dist/hono/routes/greeting.d.ts +13 -13
  14. package/dist/hono/routes/key.d.ts +4 -4
  15. package/dist/hono/routes/llm.d.ts +54 -54
  16. package/dist/hono/routes/memory.d.ts +10 -10
  17. package/dist/hono/routes/messages.d.ts +8 -8
  18. package/dist/hono/routes/models.d.ts +6 -6
  19. package/dist/hono/routes/openrouter.d.ts +6 -6
  20. package/dist/hono/routes/prompts.d.ts +2 -2
  21. package/dist/hono/routes/queue.d.ts +16 -16
  22. package/dist/hono/routes/resources.d.ts +2 -2
  23. package/dist/hono/routes/schedules.d.ts +12 -12
  24. package/dist/hono/routes/search.d.ts +4 -4
  25. package/dist/hono/routes/sessions.d.ts +24 -24
  26. package/dist/hono/routes/system-prompt.d.ts +2 -2
  27. package/dist/hono/routes/webhooks.d.ts +2 -2
  28. package/dist/hono/routes/workspaces.d.ts +2 -2
  29. package/dist/hono/types.d.ts +2 -0
  30. package/dist/hono/types.d.ts.map +1 -1
  31. package/dist/mcp/mcp-handler.cjs +32 -32
  32. package/dist/mcp/mcp-handler.d.ts +9 -3
  33. package/dist/mcp/mcp-handler.d.ts.map +1 -1
  34. package/dist/mcp/mcp-handler.js +32 -32
  35. package/package.json +15 -10
@@ -3764,7 +3764,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
3764
3764
  stack?: string | undefined;
3765
3765
  };
3766
3766
  outputFormat: "json";
3767
- status: 400;
3767
+ status: 500;
3768
3768
  } | {
3769
3769
  input: {
3770
3770
  param: {
@@ -3797,7 +3797,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
3797
3797
  stack?: string | undefined;
3798
3798
  };
3799
3799
  outputFormat: "json";
3800
- status: 500;
3800
+ status: 400;
3801
3801
  } | {
3802
3802
  input: {
3803
3803
  param: {
@@ -3940,7 +3940,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
3940
3940
  stack?: string | undefined;
3941
3941
  };
3942
3942
  outputFormat: "json";
3943
- status: 400;
3943
+ status: 500;
3944
3944
  } | {
3945
3945
  input: {
3946
3946
  param: {
@@ -3990,7 +3990,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
3990
3990
  stack?: string | undefined;
3991
3991
  };
3992
3992
  outputFormat: "json";
3993
- status: 500;
3993
+ status: 400;
3994
3994
  } | {
3995
3995
  input: {
3996
3996
  param: {
@@ -4108,7 +4108,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4108
4108
  stack?: string | undefined;
4109
4109
  };
4110
4110
  outputFormat: "json";
4111
- status: 400;
4111
+ status: 500;
4112
4112
  } | {
4113
4113
  input: {
4114
4114
  param: {
@@ -4142,7 +4142,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4142
4142
  stack?: string | undefined;
4143
4143
  };
4144
4144
  outputFormat: "json";
4145
- status: 500;
4145
+ status: 400;
4146
4146
  } | {
4147
4147
  input: {
4148
4148
  param: {
@@ -4226,7 +4226,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4226
4226
  stack?: string | undefined;
4227
4227
  };
4228
4228
  outputFormat: "json";
4229
- status: 400;
4229
+ status: 500;
4230
4230
  } | {
4231
4231
  input: {
4232
4232
  param: {
@@ -4259,7 +4259,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4259
4259
  stack?: string | undefined;
4260
4260
  };
4261
4261
  outputFormat: "json";
4262
- status: 500;
4262
+ status: 400;
4263
4263
  } | {
4264
4264
  input: {
4265
4265
  param: {
@@ -4341,7 +4341,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4341
4341
  stack?: string | undefined;
4342
4342
  };
4343
4343
  outputFormat: "json";
4344
- status: 400;
4344
+ status: 500;
4345
4345
  } | {
4346
4346
  input: {
4347
4347
  param: {
@@ -4374,7 +4374,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4374
4374
  stack?: string | undefined;
4375
4375
  };
4376
4376
  outputFormat: "json";
4377
- status: 500;
4377
+ status: 400;
4378
4378
  } | {
4379
4379
  input: {
4380
4380
  param: {
@@ -4517,7 +4517,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4517
4517
  stack?: string | undefined;
4518
4518
  };
4519
4519
  outputFormat: "json";
4520
- status: 400;
4520
+ status: 500;
4521
4521
  } | {
4522
4522
  input: {
4523
4523
  param: {
@@ -4567,7 +4567,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4567
4567
  stack?: string | undefined;
4568
4568
  };
4569
4569
  outputFormat: "json";
4570
- status: 500;
4570
+ status: 400;
4571
4571
  } | {
4572
4572
  input: {
4573
4573
  param: {
@@ -4685,7 +4685,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4685
4685
  stack?: string | undefined;
4686
4686
  };
4687
4687
  outputFormat: "json";
4688
- status: 400;
4688
+ status: 500;
4689
4689
  } | {
4690
4690
  input: {
4691
4691
  param: {
@@ -4719,7 +4719,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4719
4719
  stack?: string | undefined;
4720
4720
  };
4721
4721
  outputFormat: "json";
4722
- status: 500;
4722
+ status: 400;
4723
4723
  } | {
4724
4724
  input: {
4725
4725
  param: {
@@ -4803,7 +4803,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4803
4803
  stack?: string | undefined;
4804
4804
  };
4805
4805
  outputFormat: "json";
4806
- status: 400;
4806
+ status: 500;
4807
4807
  } | {
4808
4808
  input: {
4809
4809
  param: {
@@ -4836,7 +4836,7 @@ export declare function createQueueRouter(getAgent: GetAgentFn): OpenAPIHono<imp
4836
4836
  stack?: string | undefined;
4837
4837
  };
4838
4838
  outputFormat: "json";
4839
- status: 500;
4839
+ status: 400;
4840
4840
  } | {
4841
4841
  input: {
4842
4842
  param: {
@@ -818,7 +818,7 @@ export declare function createResourcesRouter(getAgent: GetAgentFn): OpenAPIHono
818
818
  stack?: string | undefined;
819
819
  };
820
820
  outputFormat: "json";
821
- status: 400;
821
+ status: 500;
822
822
  } | {
823
823
  input: {
824
824
  param: {
@@ -851,7 +851,7 @@ export declare function createResourcesRouter(getAgent: GetAgentFn): OpenAPIHono
851
851
  stack?: string | undefined;
852
852
  };
853
853
  outputFormat: "json";
854
- status: 500;
854
+ status: 400;
855
855
  } | {
856
856
  input: {
857
857
  param: {
@@ -1429,6 +1429,18 @@ declare const triggerRoute: {
1429
1429
  export declare function createSchedulesRouter(getAgent: GetAgentFn): OpenAPIHono<import("hono").Env, {
1430
1430
  "/schedules": {
1431
1431
  $get: {
1432
+ input: {};
1433
+ output: {
1434
+ ok: false;
1435
+ error: {
1436
+ message: string;
1437
+ code?: string | undefined;
1438
+ details?: any;
1439
+ };
1440
+ };
1441
+ outputFormat: "json";
1442
+ status: 500;
1443
+ } | {
1432
1444
  input: {};
1433
1445
  output: {
1434
1446
  schedules: {
@@ -1458,18 +1470,6 @@ export declare function createSchedulesRouter(getAgent: GetAgentFn): OpenAPIHono
1458
1470
  };
1459
1471
  outputFormat: "json";
1460
1472
  status: 200;
1461
- } | {
1462
- input: {};
1463
- output: {
1464
- ok: false;
1465
- error: {
1466
- message: string;
1467
- code?: string | undefined;
1468
- details?: any;
1469
- };
1470
- };
1471
- outputFormat: "json";
1472
- status: 500;
1473
1473
  } | {
1474
1474
  input: {};
1475
1475
  output: {
@@ -886,7 +886,7 @@ export declare function createSearchRouter(getAgent: GetAgentFn): OpenAPIHono<im
886
886
  stack?: string | undefined;
887
887
  };
888
888
  outputFormat: "json";
889
- status: 400;
889
+ status: 500;
890
890
  } | {
891
891
  input: {
892
892
  query: {
@@ -923,7 +923,7 @@ export declare function createSearchRouter(getAgent: GetAgentFn): OpenAPIHono<im
923
923
  stack?: string | undefined;
924
924
  };
925
925
  outputFormat: "json";
926
- status: 500;
926
+ status: 400;
927
927
  } | {
928
928
  input: {
929
929
  query: {
@@ -1050,7 +1050,7 @@ export declare function createSearchRouter(getAgent: GetAgentFn): OpenAPIHono<im
1050
1050
  stack?: string | undefined;
1051
1051
  };
1052
1052
  outputFormat: "json";
1053
- status: 400;
1053
+ status: 500;
1054
1054
  } | {
1055
1055
  input: {
1056
1056
  query: {
@@ -1083,7 +1083,7 @@ export declare function createSearchRouter(getAgent: GetAgentFn): OpenAPIHono<im
1083
1083
  stack?: string | undefined;
1084
1084
  };
1085
1085
  outputFormat: "json";
1086
- status: 500;
1086
+ status: 400;
1087
1087
  } | {
1088
1088
  input: {
1089
1089
  query: {
@@ -6460,7 +6460,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
6460
6460
  stack?: string | undefined;
6461
6461
  };
6462
6462
  outputFormat: "json";
6463
- status: 400;
6463
+ status: 500;
6464
6464
  } | {
6465
6465
  input: {
6466
6466
  json: {
@@ -6493,7 +6493,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
6493
6493
  stack?: string | undefined;
6494
6494
  };
6495
6495
  outputFormat: "json";
6496
- status: 500;
6496
+ status: 400;
6497
6497
  } | {
6498
6498
  input: {
6499
6499
  json: {
@@ -6577,7 +6577,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
6577
6577
  stack?: string | undefined;
6578
6578
  };
6579
6579
  outputFormat: "json";
6580
- status: 400;
6580
+ status: 500;
6581
6581
  } | {
6582
6582
  input: {
6583
6583
  param: {
@@ -6610,7 +6610,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
6610
6610
  stack?: string | undefined;
6611
6611
  };
6612
6612
  outputFormat: "json";
6613
- status: 500;
6613
+ status: 400;
6614
6614
  } | {
6615
6615
  input: {
6616
6616
  param: {
@@ -6727,7 +6727,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
6727
6727
  stack?: string | undefined;
6728
6728
  };
6729
6729
  outputFormat: "json";
6730
- status: 400;
6730
+ status: 500;
6731
6731
  } | {
6732
6732
  input: {
6733
6733
  param: {
@@ -6760,7 +6760,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
6760
6760
  stack?: string | undefined;
6761
6761
  };
6762
6762
  outputFormat: "json";
6763
- status: 500;
6763
+ status: 400;
6764
6764
  } | {
6765
6765
  input: {
6766
6766
  param: {
@@ -6878,7 +6878,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
6878
6878
  stack?: string | undefined;
6879
6879
  };
6880
6880
  outputFormat: "json";
6881
- status: 400;
6881
+ status: 500;
6882
6882
  } | {
6883
6883
  input: {
6884
6884
  param: {
@@ -6911,7 +6911,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
6911
6911
  stack?: string | undefined;
6912
6912
  };
6913
6913
  outputFormat: "json";
6914
- status: 500;
6914
+ status: 400;
6915
6915
  } | {
6916
6916
  input: {
6917
6917
  param: {
@@ -7150,7 +7150,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7150
7150
  stack?: string | undefined;
7151
7151
  };
7152
7152
  outputFormat: "json";
7153
- status: 400;
7153
+ status: 500;
7154
7154
  } | {
7155
7155
  input: {
7156
7156
  param: {
@@ -7190,7 +7190,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7190
7190
  stack?: string | undefined;
7191
7191
  };
7192
7192
  outputFormat: "json";
7193
- status: 500;
7193
+ status: 400;
7194
7194
  } | {
7195
7195
  input: {
7196
7196
  param: {
@@ -7291,7 +7291,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7291
7291
  stack?: string | undefined;
7292
7292
  };
7293
7293
  outputFormat: "json";
7294
- status: 400;
7294
+ status: 500;
7295
7295
  } | {
7296
7296
  input: {
7297
7297
  param: {
@@ -7324,7 +7324,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7324
7324
  stack?: string | undefined;
7325
7325
  };
7326
7326
  outputFormat: "json";
7327
- status: 500;
7327
+ status: 400;
7328
7328
  } | {
7329
7329
  input: {
7330
7330
  param: {
@@ -7410,7 +7410,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7410
7410
  stack?: string | undefined;
7411
7411
  };
7412
7412
  outputFormat: "json";
7413
- status: 400;
7413
+ status: 500;
7414
7414
  } | {
7415
7415
  input: {
7416
7416
  param: {
@@ -7447,7 +7447,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7447
7447
  stack?: string | undefined;
7448
7448
  };
7449
7449
  outputFormat: "json";
7450
- status: 500;
7450
+ status: 400;
7451
7451
  } | {
7452
7452
  input: {
7453
7453
  param: {
@@ -7585,7 +7585,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7585
7585
  stack?: string | undefined;
7586
7586
  };
7587
7587
  outputFormat: "json";
7588
- status: 400;
7588
+ status: 500;
7589
7589
  } | {
7590
7590
  input: {
7591
7591
  param: {
@@ -7618,7 +7618,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7618
7618
  stack?: string | undefined;
7619
7619
  };
7620
7620
  outputFormat: "json";
7621
- status: 500;
7621
+ status: 400;
7622
7622
  } | {
7623
7623
  input: {
7624
7624
  param: {
@@ -7721,7 +7721,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7721
7721
  stack?: string | undefined;
7722
7722
  };
7723
7723
  outputFormat: "json";
7724
- status: 400;
7724
+ status: 500;
7725
7725
  } | {
7726
7726
  input: {
7727
7727
  param: {
@@ -7754,7 +7754,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7754
7754
  stack?: string | undefined;
7755
7755
  };
7756
7756
  outputFormat: "json";
7757
- status: 500;
7757
+ status: 400;
7758
7758
  } | {
7759
7759
  input: {
7760
7760
  param: {
@@ -7926,7 +7926,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7926
7926
  stack?: string | undefined;
7927
7927
  };
7928
7928
  outputFormat: "json";
7929
- status: 400;
7929
+ status: 500;
7930
7930
  } | {
7931
7931
  input: {
7932
7932
  param: {
@@ -7959,7 +7959,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
7959
7959
  stack?: string | undefined;
7960
7960
  };
7961
7961
  outputFormat: "json";
7962
- status: 500;
7962
+ status: 400;
7963
7963
  } | {
7964
7964
  input: {
7965
7965
  param: {
@@ -8045,7 +8045,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
8045
8045
  stack?: string | undefined;
8046
8046
  };
8047
8047
  outputFormat: "json";
8048
- status: 400;
8048
+ status: 500;
8049
8049
  } | {
8050
8050
  input: {
8051
8051
  param: {
@@ -8082,7 +8082,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
8082
8082
  stack?: string | undefined;
8083
8083
  };
8084
8084
  outputFormat: "json";
8085
- status: 500;
8085
+ status: 400;
8086
8086
  } | {
8087
8087
  input: {
8088
8088
  param: {
@@ -8207,7 +8207,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
8207
8207
  stack?: string | undefined;
8208
8208
  };
8209
8209
  outputFormat: "json";
8210
- status: 400;
8210
+ status: 500;
8211
8211
  } | {
8212
8212
  input: {
8213
8213
  param: {
@@ -8240,7 +8240,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn, sessionSseSub
8240
8240
  stack?: string | undefined;
8241
8241
  };
8242
8242
  outputFormat: "json";
8243
- status: 500;
8243
+ status: 400;
8244
8244
  } | {
8245
8245
  input: {
8246
8246
  param: {
@@ -556,7 +556,7 @@ export declare function createSystemPromptRouter(getAgent: GetAgentFn): OpenAPIH
556
556
  stack?: string | undefined;
557
557
  };
558
558
  outputFormat: "json";
559
- status: 400;
559
+ status: 500;
560
560
  } | {
561
561
  input: {
562
562
  json: {
@@ -592,7 +592,7 @@ export declare function createSystemPromptRouter(getAgent: GetAgentFn): OpenAPIH
592
592
  stack?: string | undefined;
593
593
  };
594
594
  outputFormat: "json";
595
- status: 500;
595
+ status: 400;
596
596
  } | {
597
597
  input: {
598
598
  json: {
@@ -1001,7 +1001,7 @@ export declare function createWebhooksRouter(getAgent: GetAgentFn, webhookSubscr
1001
1001
  stack?: string | undefined;
1002
1002
  };
1003
1003
  outputFormat: "json";
1004
- status: 400;
1004
+ status: 500;
1005
1005
  } | {
1006
1006
  input: {
1007
1007
  json: {
@@ -1036,7 +1036,7 @@ export declare function createWebhooksRouter(getAgent: GetAgentFn, webhookSubscr
1036
1036
  stack?: string | undefined;
1037
1037
  };
1038
1038
  outputFormat: "json";
1039
- status: 500;
1039
+ status: 400;
1040
1040
  } | {
1041
1041
  input: {
1042
1042
  json: {
@@ -921,7 +921,7 @@ export declare function createWorkspacesRouter(getAgent: GetAgentFn): OpenAPIHon
921
921
  stack?: string | undefined;
922
922
  };
923
923
  outputFormat: "json";
924
- status: 400;
924
+ status: 500;
925
925
  } | {
926
926
  input: {
927
927
  json: {
@@ -955,7 +955,7 @@ export declare function createWorkspacesRouter(getAgent: GetAgentFn): OpenAPIHon
955
955
  stack?: string | undefined;
956
956
  };
957
957
  outputFormat: "json";
958
- status: 500;
958
+ status: 400;
959
959
  } | {
960
960
  input: {
961
961
  json: {
@@ -1,3 +1,4 @@
1
+ import type { HttpAuthorization } from './middleware/auth.js';
1
2
  import type { Context } from 'hono';
2
3
  import type { Hono } from 'hono';
3
4
  import type { RouteConfig, RouteConfigToTypedResponse } from '@hono/zod-openapi';
@@ -7,6 +8,7 @@ import type { Input, ToSchema } from 'hono/types';
7
8
  import type { WebhookEventSubscriber } from '../events/webhook-subscriber.js';
8
9
  export type DextoApp = OpenAPIHono & {
9
10
  webhookSubscriber?: WebhookEventSubscriber;
11
+ httpAuthorization?: HttpAuthorization;
10
12
  };
11
13
  export type GetAgentFn = (ctx: Context) => DextoAgent | Promise<DextoAgent>;
12
14
  export type GetAgentConfigPathFn = (ctx: Context) => string | undefined | Promise<string | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hono/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE9E,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG;IACjC,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE5E,MAAM,MAA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;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE5E,MAAM,MAAM,oBAAoB,GAAG,CAC/B,GAAG,EAAE,OAAO,KACX,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEtD,MAAM,MAAM,kBAAkB,CAC1B,CAAC,SAAS,WAAW,GAAG;IAAE,cAAc,IAAI,MAAM,CAAA;CAAE,EACpD,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,IACrB,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7F,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC"}
@@ -46,7 +46,7 @@ async function createMcpTransport(transportType = "http") {
46
46
  }
47
47
  }
48
48
  }
49
- async function initializeMcpServer(agent, agentCardData, mcpTransport) {
49
+ async function initializeMcpServer(agent, agentCardData, mcpTransport, context = { getAgent: () => agent, getAgentCard: () => agentCardData }) {
50
50
  const mcpServer = new import_mcp.McpServer(
51
51
  { name: agentCardData.name, version: agentCardData.version },
52
52
  {
@@ -57,36 +57,33 @@ async function initializeMcpServer(agent, agentCardData, mcpTransport) {
57
57
  );
58
58
  const toolName = "chat_with_agent";
59
59
  const toolDescription = "Allows you to chat with the an AI agent. Send a message to interact.";
60
- mcpServer.tool(
60
+ mcpServer.registerTool(
61
61
  toolName,
62
- toolDescription,
63
- { message: import_zod.z.string() },
62
+ { description: toolDescription, inputSchema: { message: import_zod.z.string() } },
64
63
  async ({ message }) => {
65
- agent.logger.info(
66
- `MCP tool '${toolName}' received message: ${message.substring(0, 100)}${message.length > 100 ? "..." : ""}`
67
- );
68
- const session = await agent.createSession(`mcp-${(0, import_crypto.randomUUID)()}`);
64
+ const agent2 = context.getAgent();
65
+ agent2.logger.info(`MCP tool '${toolName}' call started`);
66
+ const session = await agent2.createSession(`mcp-${(0, import_crypto.randomUUID)()}`);
69
67
  try {
70
- const text = await agent.run(message, void 0, void 0, session.id);
71
- agent.logger.info(
72
- `MCP tool '${toolName}' sending response: ${text?.substring(0, 100)}${(text?.length ?? 0) > 100 ? "..." : ""}`
73
- );
68
+ const text = await agent2.run(message, void 0, void 0, session.id);
69
+ agent2.logger.info(`MCP tool '${toolName}' call completed`);
74
70
  return { content: [{ type: "text", text: text ?? "" }] };
75
71
  } finally {
76
- await agent.deleteSession(session.id).catch(
77
- (err) => agent.logger.warn(`Failed to cleanup MCP session ${session.id}: ${err}`)
78
- );
72
+ await agent2.deleteSession(session.id).catch(() => agent2.logger.warn(`Failed to cleanup MCP session ${session.id}`));
79
73
  }
80
74
  }
81
75
  );
82
76
  agent.logger.info(`Registered MCP tool: '${toolName}'`);
83
- await initializeAgentCardResource(mcpServer, agentCardData, agent.logger);
77
+ await registerAgentCardResource(mcpServer, () => context.getAgentCard(), agent.logger);
84
78
  agent.logger.info(`Initializing MCP protocol server connection...`);
85
79
  await mcpServer.connect(mcpTransport);
86
80
  agent.logger.info(`\u2705 MCP server protocol connected via transport.`);
87
81
  return mcpServer;
88
82
  }
89
- async function initializeAgentCardResource(mcpServer, agentCardData, agentLogger) {
83
+ function initializeAgentCardResource(mcpServer, agentCardData, agentLogger) {
84
+ return registerAgentCardResource(mcpServer, () => agentCardData, agentLogger);
85
+ }
86
+ async function registerAgentCardResource(mcpServer, getAgentCard, agentLogger) {
90
87
  const agentCardResourceProgrammaticName = "agentCard";
91
88
  const agentCardResourceUri = "dexto://agent/card";
92
89
  try {
@@ -97,12 +94,17 @@ async function initializeAgentCardResource(mcpServer, agentCardData, agentLogger
97
94
  {
98
95
  uri: uri.href,
99
96
  type: "application/json",
100
- text: JSON.stringify(agentCardData, null, 2)
97
+ text: JSON.stringify(getAgentCard(), null, 2)
101
98
  }
102
99
  ]
103
100
  };
104
101
  };
105
- mcpServer.resource(agentCardResourceProgrammaticName, agentCardResourceUri, readCallback);
102
+ mcpServer.registerResource(
103
+ agentCardResourceProgrammaticName,
104
+ agentCardResourceUri,
105
+ {},
106
+ readCallback
107
+ );
106
108
  agentLogger.info(
107
109
  `Registered MCP Resource: '${agentCardResourceProgrammaticName}' at URI '${agentCardResourceUri}'`
108
110
  );
@@ -117,23 +119,21 @@ function createMcpHttpHandlers(mcpTransport) {
117
119
  import_core.logger.info("Non-HTTP transport detected. Skipping HTTP route setup.");
118
120
  return null;
119
121
  }
120
- const handlePost = async (req, res, body) => {
121
- import_core.logger.info(`MCP POST /mcp received request body: ${JSON.stringify(body)}`);
122
+ const handleRequest = async (req, res, body) => {
123
+ import_core.logger.info(`MCP ${req.method} request received`);
122
124
  try {
123
125
  await mcpTransport.handleRequest(req, res, body);
124
- } catch (err) {
125
- import_core.logger.error(`MCP POST error: ${JSON.stringify(err, null, 2)}`);
126
- }
127
- };
128
- const handleGet = async (req, res) => {
129
- import_core.logger.info("MCP GET /mcp received request, attempting to establish SSE connection.");
130
- try {
131
- await mcpTransport.handleRequest(req, res);
132
- } catch (err) {
133
- import_core.logger.error(`MCP GET error: ${JSON.stringify(err, null, 2)}`);
126
+ } catch {
127
+ import_core.logger.error("MCP HTTP request failed");
128
+ if (!res.headersSent) {
129
+ res.writeHead(500, { "Content-Type": "application/json" });
130
+ res.end(JSON.stringify({ error: "Internal Server Error" }));
131
+ } else if (!res.writableEnded) {
132
+ res.destroy();
133
+ }
134
134
  }
135
135
  };
136
- return { handlePost, handleGet };
136
+ return { handlePost: handleRequest, handleGet: handleRequest, handleDelete: handleRequest };
137
137
  }
138
138
  // Annotate the CommonJS export names for ESM import in node:
139
139
  0 && (module.exports = {
@@ -5,10 +5,16 @@ import type { AgentCard, Logger } from '@dexto/core';
5
5
  import type { DextoAgent } from '@dexto/core';
6
6
  export type McpTransportType = 'stdio' | 'sse' | 'http';
7
7
  export declare function createMcpTransport(transportType?: McpTransportType): Promise<Transport>;
8
- export declare function initializeMcpServer(agent: DextoAgent, agentCardData: AgentCard, mcpTransport: Transport): Promise<McpServer>;
8
+ export interface McpAgentContext {
9
+ getAgent(): DextoAgent;
10
+ getAgentCard(): AgentCard;
11
+ }
12
+ /** Static callers retain their agent/card; switching hosts can supply live getters. */
13
+ export declare function initializeMcpServer(agent: DextoAgent, agentCardData: AgentCard, mcpTransport: Transport, context?: McpAgentContext): Promise<McpServer>;
9
14
  export declare function initializeAgentCardResource(mcpServer: McpServer, agentCardData: AgentCard, agentLogger: Logger): Promise<void>;
10
15
  export declare function createMcpHttpHandlers(mcpTransport: Transport): {
11
- handlePost: (req: IncomingMessage, res: ServerResponse, body: unknown) => Promise<void>;
12
- handleGet: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
16
+ handlePost: (req: IncomingMessage, res: ServerResponse, body?: unknown) => Promise<void>;
17
+ handleGet: (req: IncomingMessage, res: ServerResponse, body?: unknown) => Promise<void>;
18
+ handleDelete: (req: IncomingMessage, res: ServerResponse, body?: unknown) => Promise<void>;
13
19
  } | null;
14
20
  //# sourceMappingURL=mcp-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-handler.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,MAAM,MAAM,gBAAgB,GAAG,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