@expandai/mcp-server 0.1.4 → 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.
- package/dist/Server.cjs +494 -139
- package/dist/Server.js +1 -1
- package/dist/{chunk-TUBB4OP4.js → chunk-GFNIR7HL.js} +494 -139
- package/dist/main.cjs +494 -139
- package/dist/main.js +1 -1
- package/package.json +13 -13
- package/src/Fetch.ts +52 -57
- package/src/Generated.ts +554 -108
package/src/Generated.ts
CHANGED
|
@@ -71,10 +71,14 @@ export class HttpApiDecodeError extends S.Class<HttpApiDecodeError>('HttpApiDeco
|
|
|
71
71
|
_tag: HttpApiDecodeErrorTag,
|
|
72
72
|
}) {}
|
|
73
73
|
|
|
74
|
-
export class
|
|
74
|
+
export class AuthFailedReason extends S.Literal('InvalidApiKey', 'InvalidToken', 'InvalidSession', 'InvalidTenant') {}
|
|
75
75
|
|
|
76
|
-
export class
|
|
77
|
-
|
|
76
|
+
export class AuthFailedTag extends S.Literal('AuthFailed') {}
|
|
77
|
+
|
|
78
|
+
export class AuthFailed extends S.Class<AuthFailed>('AuthFailed')({
|
|
79
|
+
reason: AuthFailedReason,
|
|
80
|
+
description: S.optionalWith(S.String, { nullable: true }),
|
|
81
|
+
_tag: AuthFailedTag,
|
|
78
82
|
}) {}
|
|
79
83
|
|
|
80
84
|
export class AssetNotFoundTag extends S.Literal('AssetNotFound') {}
|
|
@@ -117,7 +121,13 @@ export class AssetRetrievalError extends S.Class<AssetRetrievalError>('AssetRetr
|
|
|
117
121
|
_tag: AssetRetrievalErrorTag,
|
|
118
122
|
}) {}
|
|
119
123
|
|
|
120
|
-
export class
|
|
124
|
+
export class InternalErrorTag extends S.Literal('InternalError') {}
|
|
125
|
+
|
|
126
|
+
export class InternalError extends S.Class<InternalError>('InternalError')({
|
|
127
|
+
_tag: InternalErrorTag,
|
|
128
|
+
}) {}
|
|
129
|
+
|
|
130
|
+
export class AssetsGetByUrl500 extends S.Union(InternalError, AssetReadError, InvalidWaczFormat, AssetRetrievalError) {}
|
|
121
131
|
|
|
122
132
|
export class CurlErrorInputMethod extends S.Literal(
|
|
123
133
|
'GET',
|
|
@@ -131,6 +141,11 @@ export class CurlErrorInputMethod extends S.Literal(
|
|
|
131
141
|
'PATCH',
|
|
132
142
|
) {}
|
|
133
143
|
|
|
144
|
+
/**
|
|
145
|
+
* a string to be decoded into a URL
|
|
146
|
+
*/
|
|
147
|
+
export class URL extends S.String {}
|
|
148
|
+
|
|
134
149
|
export class CurlErrorTag extends S.Literal('CurlError') {}
|
|
135
150
|
|
|
136
151
|
export class CurlError extends S.Class<CurlError>('CurlError')({
|
|
@@ -141,11 +156,14 @@ export class CurlError extends S.Class<CurlError>('CurlError')({
|
|
|
141
156
|
body: S.optionalWith(S.String, { nullable: true }),
|
|
142
157
|
headers: S.optionalWith(S.Struct({}), { nullable: true }),
|
|
143
158
|
proxy: S.optionalWith(
|
|
144
|
-
S.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
159
|
+
S.Union(
|
|
160
|
+
S.Struct({
|
|
161
|
+
server: S.String,
|
|
162
|
+
username: S.optionalWith(S.String, { nullable: true }),
|
|
163
|
+
password: S.optionalWith(S.String, { nullable: true }),
|
|
164
|
+
}),
|
|
165
|
+
URL,
|
|
166
|
+
),
|
|
149
167
|
{ nullable: true },
|
|
150
168
|
),
|
|
151
169
|
timeout: S.optionalWith(S.Number, { nullable: true }),
|
|
@@ -165,12 +183,20 @@ export class AssetListResponse extends S.Class<AssetListResponse>('AssetListResp
|
|
|
165
183
|
assets: S.Array(AssetListItem),
|
|
166
184
|
}) {}
|
|
167
185
|
|
|
168
|
-
export class AssetsList500 extends S.Union(AssetReadError, InvalidWaczFormat) {}
|
|
186
|
+
export class AssetsList500 extends S.Union(InternalError, AssetReadError, InvalidWaczFormat) {}
|
|
169
187
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
188
|
+
export class AssetsGetWacz500 extends S.Union(InternalError, AssetReadError) {}
|
|
189
|
+
|
|
190
|
+
export class DatasetNotFoundTag extends S.Literal('DatasetNotFound') {}
|
|
191
|
+
|
|
192
|
+
export class DatasetNotFound extends S.Class<DatasetNotFound>('DatasetNotFound')({
|
|
193
|
+
path: S.String,
|
|
194
|
+
_tag: DatasetNotFoundTag,
|
|
195
|
+
}) {}
|
|
196
|
+
|
|
197
|
+
export class DatasetsGetDataset500 extends S.Union(InternalError, DatasetNotFound) {}
|
|
198
|
+
|
|
199
|
+
export class DatasetsGetFinetuneDataset500 extends S.Union(InternalError, DatasetNotFound) {}
|
|
174
200
|
|
|
175
201
|
/**
|
|
176
202
|
* Options for customizing HTML content extraction
|
|
@@ -294,6 +320,32 @@ export class FetchRequest extends S.Class<FetchRequest>('FetchRequest')({
|
|
|
294
320
|
}),
|
|
295
321
|
{ nullable: true },
|
|
296
322
|
),
|
|
323
|
+
links: S.optionalWith(
|
|
324
|
+
S.Union(
|
|
325
|
+
/**
|
|
326
|
+
* Set to true to extract links from the page
|
|
327
|
+
*/
|
|
328
|
+
S.Boolean,
|
|
329
|
+
/**
|
|
330
|
+
* Options for customizing link extraction from the page
|
|
331
|
+
*/
|
|
332
|
+
S.Struct({
|
|
333
|
+
/**
|
|
334
|
+
* Only include links from the same domain as the fetched URL
|
|
335
|
+
*/
|
|
336
|
+
sameDomainOnly: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
|
|
337
|
+
/**
|
|
338
|
+
* Regex patterns - only include links matching at least one pattern
|
|
339
|
+
*/
|
|
340
|
+
includePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
|
|
341
|
+
/**
|
|
342
|
+
* Regex patterns - exclude links matching any pattern
|
|
343
|
+
*/
|
|
344
|
+
excludePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
|
|
345
|
+
}),
|
|
346
|
+
),
|
|
347
|
+
{ nullable: true },
|
|
348
|
+
),
|
|
297
349
|
/**
|
|
298
350
|
* Include page metadata in the response
|
|
299
351
|
*/
|
|
@@ -310,6 +362,14 @@ export class FetchRequest extends S.Class<FetchRequest>('FetchRequest')({
|
|
|
310
362
|
}),
|
|
311
363
|
{ nullable: true },
|
|
312
364
|
),
|
|
365
|
+
/**
|
|
366
|
+
* Include pruned JSON in the response (opt-in)
|
|
367
|
+
*/
|
|
368
|
+
json: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
|
|
369
|
+
/**
|
|
370
|
+
* Set to true to include extracted links and sidebar content
|
|
371
|
+
*/
|
|
372
|
+
appendix: S.optionalWith(S.Boolean, { nullable: true }),
|
|
313
373
|
}),
|
|
314
374
|
{ nullable: true },
|
|
315
375
|
),
|
|
@@ -496,63 +556,80 @@ export class PageMeta extends S.Class<PageMeta>('PageMeta')({
|
|
|
496
556
|
}) {}
|
|
497
557
|
|
|
498
558
|
/**
|
|
499
|
-
*
|
|
559
|
+
* A link extracted from the page
|
|
500
560
|
*/
|
|
501
|
-
export class
|
|
502
|
-
response: ResponseInfo,
|
|
503
|
-
/**
|
|
504
|
-
* Page metadata extracted from HTML head (title, description, Open Graph, Twitter Card, icons)
|
|
505
|
-
*/
|
|
506
|
-
meta: S.optionalWith(PageMeta, { nullable: true }),
|
|
561
|
+
export class FetchLink extends S.Class<FetchLink>('FetchLink')({
|
|
507
562
|
/**
|
|
508
|
-
* The
|
|
563
|
+
* The URL of the link
|
|
509
564
|
*/
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* The markdown-formatted content extracted from the page
|
|
513
|
-
*/
|
|
514
|
-
markdown: S.optionalWith(S.String, { nullable: true }),
|
|
515
|
-
/**
|
|
516
|
-
* Base64-encoded data URI of the screenshot image
|
|
517
|
-
*/
|
|
518
|
-
screenshot: S.optionalWith(S.String, { nullable: true }),
|
|
519
|
-
/**
|
|
520
|
-
* AI-generated summary of the page content
|
|
521
|
-
*/
|
|
522
|
-
summary: S.optionalWith(S.String, { nullable: true }),
|
|
565
|
+
url: S.String,
|
|
523
566
|
/**
|
|
524
|
-
*
|
|
567
|
+
* The anchor text of the link
|
|
525
568
|
*/
|
|
526
|
-
|
|
527
|
-
S.Array(
|
|
528
|
-
S.Struct({
|
|
529
|
-
/**
|
|
530
|
-
* Type identifier for TextPart compatibility
|
|
531
|
-
*/
|
|
532
|
-
type: S.optionalWith(S.Literal('text'), { nullable: true, default: () => 'text' as const }),
|
|
533
|
-
/**
|
|
534
|
-
* The text content of the snippet
|
|
535
|
-
*/
|
|
536
|
-
text: S.String,
|
|
537
|
-
/**
|
|
538
|
-
* Relevance score from the reranker (0-1)
|
|
539
|
-
*/
|
|
540
|
-
score: S.Number,
|
|
541
|
-
/**
|
|
542
|
-
* Original chunk index
|
|
543
|
-
*/
|
|
544
|
-
index: S.Number,
|
|
545
|
-
}),
|
|
546
|
-
),
|
|
547
|
-
{ nullable: true },
|
|
548
|
-
),
|
|
569
|
+
text: S.optionalWith(S.String, { nullable: true }),
|
|
549
570
|
}) {}
|
|
550
571
|
|
|
551
572
|
/**
|
|
552
573
|
* Complete response from a fetch operation
|
|
553
574
|
*/
|
|
554
575
|
export class FetchResult extends S.Class<FetchResult>('FetchResult')({
|
|
555
|
-
|
|
576
|
+
/**
|
|
577
|
+
* Contains the extracted content in the formats specified by the select configuration
|
|
578
|
+
*/
|
|
579
|
+
data: S.Struct({
|
|
580
|
+
response: ResponseInfo,
|
|
581
|
+
meta: S.optionalWith(PageMeta, { nullable: true }),
|
|
582
|
+
/**
|
|
583
|
+
* The HTML content of the fetched page
|
|
584
|
+
*/
|
|
585
|
+
html: S.optionalWith(S.String, { nullable: true }),
|
|
586
|
+
/**
|
|
587
|
+
* The markdown-formatted content extracted from the page
|
|
588
|
+
*/
|
|
589
|
+
markdown: S.optionalWith(S.String, { nullable: true }),
|
|
590
|
+
/**
|
|
591
|
+
* Base64-encoded data URI of the screenshot image
|
|
592
|
+
*/
|
|
593
|
+
screenshot: S.optionalWith(S.String, { nullable: true }),
|
|
594
|
+
/**
|
|
595
|
+
* AI-generated summary of the page content
|
|
596
|
+
*/
|
|
597
|
+
summary: S.optionalWith(S.String, { nullable: true }),
|
|
598
|
+
/**
|
|
599
|
+
* Relevant snippets extracted from the page based on the search query
|
|
600
|
+
*/
|
|
601
|
+
snippets: S.optionalWith(
|
|
602
|
+
S.Array(
|
|
603
|
+
S.Struct({
|
|
604
|
+
/**
|
|
605
|
+
* Type identifier for TextPart compatibility
|
|
606
|
+
*/
|
|
607
|
+
type: S.optionalWith(S.Literal('text'), { nullable: true, default: () => 'text' as const }),
|
|
608
|
+
/**
|
|
609
|
+
* The text content of the snippet
|
|
610
|
+
*/
|
|
611
|
+
text: S.String,
|
|
612
|
+
/**
|
|
613
|
+
* Relevance score from the reranker (0-1)
|
|
614
|
+
*/
|
|
615
|
+
score: S.Number,
|
|
616
|
+
/**
|
|
617
|
+
* Original chunk index
|
|
618
|
+
*/
|
|
619
|
+
index: S.Number,
|
|
620
|
+
}),
|
|
621
|
+
),
|
|
622
|
+
{ nullable: true },
|
|
623
|
+
),
|
|
624
|
+
/**
|
|
625
|
+
* Links extracted from the page
|
|
626
|
+
*/
|
|
627
|
+
links: S.optionalWith(S.Array(FetchLink), { nullable: true }),
|
|
628
|
+
/**
|
|
629
|
+
* Extracted links and sidebar content
|
|
630
|
+
*/
|
|
631
|
+
appendix: S.optionalWith(S.String, { nullable: true }),
|
|
632
|
+
}),
|
|
556
633
|
}) {}
|
|
557
634
|
|
|
558
635
|
export class FetchErrorTag extends S.Literal('FetchError') {}
|
|
@@ -561,27 +638,7 @@ export class FetchError extends S.Class<FetchError>('FetchError')({
|
|
|
561
638
|
_tag: FetchErrorTag,
|
|
562
639
|
}) {}
|
|
563
640
|
|
|
564
|
-
|
|
565
|
-
* Request parameters for fetching and converting web page content to markdown format
|
|
566
|
-
*/
|
|
567
|
-
export class MarkdownRequest extends S.Class<MarkdownRequest>('MarkdownRequest')({
|
|
568
|
-
/**
|
|
569
|
-
* The URL to fetch markdown content from
|
|
570
|
-
*/
|
|
571
|
-
url: S.String,
|
|
572
|
-
/**
|
|
573
|
-
* Configuration options for browser behavior during the fetch
|
|
574
|
-
*/
|
|
575
|
-
browserConfig: S.optionalWith(
|
|
576
|
-
S.Struct({
|
|
577
|
-
/**
|
|
578
|
-
* Whether to scroll the entire page to capture lazy-loaded content
|
|
579
|
-
*/
|
|
580
|
-
scrollFullPage: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
|
|
581
|
-
}),
|
|
582
|
-
{ nullable: true },
|
|
583
|
-
),
|
|
584
|
-
}) {}
|
|
641
|
+
export class Fetch500 extends S.Union(InternalError, FetchError) {}
|
|
585
642
|
|
|
586
643
|
export class InvalidAssetHashTag extends S.Literal('InvalidAssetHash') {}
|
|
587
644
|
|
|
@@ -614,12 +671,242 @@ export class AssetFetchError extends S.Class<AssetFetchError>('AssetFetchError')
|
|
|
614
671
|
}) {}
|
|
615
672
|
|
|
616
673
|
export class LocalAssetsGetAsset500 extends S.Union(
|
|
674
|
+
InternalError,
|
|
617
675
|
InvalidAssetHash,
|
|
618
676
|
AssetNotFoundInHar,
|
|
619
677
|
HarNotFound,
|
|
620
678
|
AssetFetchError,
|
|
621
679
|
) {}
|
|
622
680
|
|
|
681
|
+
/**
|
|
682
|
+
* Request parameters for fetching and extracting content from a web page
|
|
683
|
+
*/
|
|
684
|
+
export class PlaygroundFetchRequest extends S.Class<PlaygroundFetchRequest>('PlaygroundFetchRequest')({
|
|
685
|
+
url: URL,
|
|
686
|
+
/**
|
|
687
|
+
* Specifies which content formats to include in the response
|
|
688
|
+
*/
|
|
689
|
+
select: S.optionalWith(
|
|
690
|
+
S.Struct({
|
|
691
|
+
html: S.optionalWith(
|
|
692
|
+
S.Union(
|
|
693
|
+
/**
|
|
694
|
+
* Set to true to include HTML
|
|
695
|
+
*/
|
|
696
|
+
S.Boolean,
|
|
697
|
+
SelectHtmlConfig,
|
|
698
|
+
),
|
|
699
|
+
{ nullable: true },
|
|
700
|
+
),
|
|
701
|
+
/**
|
|
702
|
+
* Include markdown-formatted content in the response
|
|
703
|
+
*/
|
|
704
|
+
markdown: S.optionalWith(
|
|
705
|
+
S.Union(
|
|
706
|
+
/**
|
|
707
|
+
* Set to true to include markdown
|
|
708
|
+
*/
|
|
709
|
+
S.Boolean,
|
|
710
|
+
SelectMarkdownConfig,
|
|
711
|
+
),
|
|
712
|
+
{ nullable: true },
|
|
713
|
+
),
|
|
714
|
+
screenshot: S.optionalWith(
|
|
715
|
+
S.Union(
|
|
716
|
+
/**
|
|
717
|
+
* Set to true to include a screenshot
|
|
718
|
+
*/
|
|
719
|
+
S.Boolean,
|
|
720
|
+
SelectScreenshotConfig,
|
|
721
|
+
),
|
|
722
|
+
{ nullable: true },
|
|
723
|
+
),
|
|
724
|
+
summary: S.optionalWith(
|
|
725
|
+
S.Union(
|
|
726
|
+
/**
|
|
727
|
+
* Set to true to generate an AI summary
|
|
728
|
+
*/
|
|
729
|
+
S.Boolean,
|
|
730
|
+
/**
|
|
731
|
+
* Options for AI-powered page summarization
|
|
732
|
+
*/
|
|
733
|
+
S.Struct({
|
|
734
|
+
/**
|
|
735
|
+
* Custom prompt for AI summarization (max 5000 characters)
|
|
736
|
+
*/
|
|
737
|
+
prompt: S.optionalWith(S.String.pipe(S.maxLength(5000)), {
|
|
738
|
+
nullable: true,
|
|
739
|
+
default: () =>
|
|
740
|
+
'You are a helpful assistant that summarizes web page content.\nGiven the markdown content of a web page, provide a clear and concise summary.\nFocus on the main points and key information.\nKeep the summary informative but brief.' as const,
|
|
741
|
+
}),
|
|
742
|
+
}),
|
|
743
|
+
),
|
|
744
|
+
{ nullable: true },
|
|
745
|
+
),
|
|
746
|
+
/**
|
|
747
|
+
* Options for extracting relevant snippets from page content using semantic search
|
|
748
|
+
*/
|
|
749
|
+
snippets: S.optionalWith(
|
|
750
|
+
S.Struct({
|
|
751
|
+
/**
|
|
752
|
+
* Query to find relevant content snippets from the page (required, non-empty)
|
|
753
|
+
*/
|
|
754
|
+
query: Trimmed,
|
|
755
|
+
/**
|
|
756
|
+
* Maximum number of snippets to return (1-50)
|
|
757
|
+
*/
|
|
758
|
+
maxSnippets: S.optionalWith(Int, { nullable: true, default: () => 5 as const }),
|
|
759
|
+
/**
|
|
760
|
+
* Minimum relevance score threshold (0-1). Snippets below this score are filtered out.
|
|
761
|
+
*/
|
|
762
|
+
minScore: S.optionalWith(S.Number.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(1)), {
|
|
763
|
+
nullable: true,
|
|
764
|
+
default: () => 0.5 as const,
|
|
765
|
+
}),
|
|
766
|
+
/**
|
|
767
|
+
* Target snippet size in characters (100-2000)
|
|
768
|
+
*/
|
|
769
|
+
targetSnippetSize: S.optionalWith(Int, { nullable: true, default: () => 384 as const }),
|
|
770
|
+
}),
|
|
771
|
+
{ nullable: true },
|
|
772
|
+
),
|
|
773
|
+
links: S.optionalWith(
|
|
774
|
+
S.Union(
|
|
775
|
+
/**
|
|
776
|
+
* Set to true to extract links from the page
|
|
777
|
+
*/
|
|
778
|
+
S.Boolean,
|
|
779
|
+
/**
|
|
780
|
+
* Options for customizing link extraction from the page
|
|
781
|
+
*/
|
|
782
|
+
S.Struct({
|
|
783
|
+
/**
|
|
784
|
+
* Only include links from the same domain as the fetched URL
|
|
785
|
+
*/
|
|
786
|
+
sameDomainOnly: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
|
|
787
|
+
/**
|
|
788
|
+
* Regex patterns - only include links matching at least one pattern
|
|
789
|
+
*/
|
|
790
|
+
includePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
|
|
791
|
+
/**
|
|
792
|
+
* Regex patterns - exclude links matching any pattern
|
|
793
|
+
*/
|
|
794
|
+
excludePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
|
|
795
|
+
}),
|
|
796
|
+
),
|
|
797
|
+
{ nullable: true },
|
|
798
|
+
),
|
|
799
|
+
/**
|
|
800
|
+
* Include page metadata in the response
|
|
801
|
+
*/
|
|
802
|
+
meta: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
|
|
803
|
+
/**
|
|
804
|
+
* Configure response info options (headers inclusion)
|
|
805
|
+
*/
|
|
806
|
+
response: S.optionalWith(
|
|
807
|
+
S.Struct({
|
|
808
|
+
/**
|
|
809
|
+
* Whether to include HTTP response headers
|
|
810
|
+
*/
|
|
811
|
+
includeHeaders: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
|
|
812
|
+
}),
|
|
813
|
+
{ nullable: true },
|
|
814
|
+
),
|
|
815
|
+
/**
|
|
816
|
+
* Include pruned JSON in the response (opt-in)
|
|
817
|
+
*/
|
|
818
|
+
json: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
|
|
819
|
+
/**
|
|
820
|
+
* Set to true to include extracted links and sidebar content
|
|
821
|
+
*/
|
|
822
|
+
appendix: S.optionalWith(S.Boolean, { nullable: true }),
|
|
823
|
+
}),
|
|
824
|
+
{ nullable: true },
|
|
825
|
+
),
|
|
826
|
+
/**
|
|
827
|
+
* Configuration options for browser behavior during the fetch
|
|
828
|
+
*/
|
|
829
|
+
browserConfig: S.optionalWith(
|
|
830
|
+
S.Struct({
|
|
831
|
+
/**
|
|
832
|
+
* Whether to scroll the entire page to capture lazy-loaded content
|
|
833
|
+
*/
|
|
834
|
+
scrollFullPage: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
|
|
835
|
+
}),
|
|
836
|
+
{ nullable: true },
|
|
837
|
+
),
|
|
838
|
+
}) {}
|
|
839
|
+
|
|
840
|
+
export class PlaygroundData extends S.Class<PlaygroundData>('PlaygroundData')({
|
|
841
|
+
response: ResponseInfo,
|
|
842
|
+
/**
|
|
843
|
+
* HTML with expand-id attributes on elements
|
|
844
|
+
*/
|
|
845
|
+
html: S.String,
|
|
846
|
+
browserSessionId: S.String,
|
|
847
|
+
}) {}
|
|
848
|
+
|
|
849
|
+
export class PlaygroundResult extends S.Class<PlaygroundResult>('PlaygroundResult')({
|
|
850
|
+
data: PlaygroundData,
|
|
851
|
+
}) {}
|
|
852
|
+
|
|
853
|
+
export class PlaygroundFetch500 extends S.Union(InternalError, FetchError) {}
|
|
854
|
+
|
|
855
|
+
export class PlaygroundGet500 extends S.Union(InternalError, FetchError) {}
|
|
856
|
+
|
|
857
|
+
export class PlaygroundGetBySession500 extends S.Union(InternalError, FetchError) {}
|
|
858
|
+
|
|
859
|
+
export class PlaygroundSearchRequest extends S.Class<PlaygroundSearchRequest>('PlaygroundSearchRequest')({
|
|
860
|
+
/**
|
|
861
|
+
* Search query to find relevant content chunks
|
|
862
|
+
*/
|
|
863
|
+
query: Trimmed,
|
|
864
|
+
/**
|
|
865
|
+
* Browser session ID from the playground fetch result
|
|
866
|
+
*/
|
|
867
|
+
browserSessionId: S.String,
|
|
868
|
+
/**
|
|
869
|
+
* Maximum number of results to return
|
|
870
|
+
*/
|
|
871
|
+
maxResults: S.optionalWith(S.Number, { nullable: true }),
|
|
872
|
+
/**
|
|
873
|
+
* Minimum relevance score threshold (0-1). A value of 0 disables filtering.
|
|
874
|
+
*/
|
|
875
|
+
minScore: S.optionalWith(S.Number, { nullable: true }),
|
|
876
|
+
}) {}
|
|
877
|
+
|
|
878
|
+
export class PlaygroundSearchChunk extends S.Class<PlaygroundSearchChunk>('PlaygroundSearchChunk')({
|
|
879
|
+
/**
|
|
880
|
+
* The chunk text content
|
|
881
|
+
*/
|
|
882
|
+
text: S.String,
|
|
883
|
+
/**
|
|
884
|
+
* Relevance score from 0-1
|
|
885
|
+
*/
|
|
886
|
+
score: S.Number,
|
|
887
|
+
/**
|
|
888
|
+
* Original chunk index
|
|
889
|
+
*/
|
|
890
|
+
index: S.Number,
|
|
891
|
+
/**
|
|
892
|
+
* MDAST originalNodeIds for highlighting in HTML/markdown views
|
|
893
|
+
*/
|
|
894
|
+
nodeIds: S.Array(S.Number),
|
|
895
|
+
}) {}
|
|
896
|
+
|
|
897
|
+
export class PlaygroundSearch200 extends S.Struct({
|
|
898
|
+
/**
|
|
899
|
+
* Scored and ranked content chunks
|
|
900
|
+
*/
|
|
901
|
+
chunks: S.Array(PlaygroundSearchChunk),
|
|
902
|
+
/**
|
|
903
|
+
* Duration of the search operation in milliseconds
|
|
904
|
+
*/
|
|
905
|
+
durationMs: S.optionalWith(S.Number, { nullable: true }),
|
|
906
|
+
}) {}
|
|
907
|
+
|
|
908
|
+
export class PlaygroundSearch500 extends S.Union(InternalError, FetchError) {}
|
|
909
|
+
|
|
623
910
|
export const make = (
|
|
624
911
|
httpClient: HttpClient.HttpClient,
|
|
625
912
|
options: {
|
|
@@ -666,52 +953,84 @@ export const make = (
|
|
|
666
953
|
withResponse(
|
|
667
954
|
HttpClientResponse.matchStatus({
|
|
668
955
|
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
669
|
-
'401': decodeError('
|
|
956
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
670
957
|
'404': decodeError('AssetsGetByUrl404', AssetsGetByUrl404),
|
|
671
958
|
'500': decodeError('AssetsGetByUrl500', AssetsGetByUrl500),
|
|
672
959
|
'502': decodeError('CurlError', CurlError),
|
|
673
960
|
'429': () => Effect.void,
|
|
961
|
+
'503': () => Effect.void,
|
|
674
962
|
orElse: unexpectedStatus,
|
|
675
963
|
}),
|
|
676
964
|
),
|
|
677
965
|
),
|
|
678
966
|
assetsList: (browserSessionId) =>
|
|
679
|
-
HttpClientRequest.get(`/v1/assets/${browserSessionId}`).pipe(
|
|
967
|
+
HttpClientRequest.get(`/v1/assets/${browserSessionId}/list`).pipe(
|
|
680
968
|
withResponse(
|
|
681
969
|
HttpClientResponse.matchStatus({
|
|
682
970
|
'2xx': decodeSuccess(AssetListResponse),
|
|
683
971
|
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
684
|
-
'401': decodeError('
|
|
972
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
685
973
|
'404': decodeError('AssetNotFound', AssetNotFound),
|
|
686
974
|
'500': decodeError('AssetsList500', AssetsList500),
|
|
687
975
|
'429': () => Effect.void,
|
|
976
|
+
'503': () => Effect.void,
|
|
688
977
|
orElse: unexpectedStatus,
|
|
689
978
|
}),
|
|
690
979
|
),
|
|
691
980
|
),
|
|
692
|
-
|
|
693
|
-
HttpClientRequest.
|
|
694
|
-
|
|
981
|
+
assetsGetWacz: (browserSessionId) =>
|
|
982
|
+
HttpClientRequest.get(`/v1/assets/${browserSessionId}`).pipe(
|
|
983
|
+
withResponse(
|
|
984
|
+
HttpClientResponse.matchStatus({
|
|
985
|
+
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
986
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
987
|
+
'404': decodeError('AssetNotFound', AssetNotFound),
|
|
988
|
+
'500': decodeError('AssetsGetWacz500', AssetsGetWacz500),
|
|
989
|
+
'429': () => Effect.void,
|
|
990
|
+
'503': () => Effect.void,
|
|
991
|
+
orElse: unexpectedStatus,
|
|
992
|
+
}),
|
|
993
|
+
),
|
|
994
|
+
),
|
|
995
|
+
datasetsGetDataset: () =>
|
|
996
|
+
HttpClientRequest.get(`/datasets/page-analysis`).pipe(
|
|
695
997
|
withResponse(
|
|
696
998
|
HttpClientResponse.matchStatus({
|
|
697
|
-
'2xx': decodeSuccess(FetchResult),
|
|
698
999
|
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
699
|
-
'401': decodeError('
|
|
700
|
-
'500': decodeError('
|
|
1000
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
1001
|
+
'500': decodeError('DatasetsGetDataset500', DatasetsGetDataset500),
|
|
1002
|
+
'204': () => Effect.void,
|
|
1003
|
+
'429': () => Effect.void,
|
|
1004
|
+
'503': () => Effect.void,
|
|
1005
|
+
orElse: unexpectedStatus,
|
|
1006
|
+
}),
|
|
1007
|
+
),
|
|
1008
|
+
),
|
|
1009
|
+
datasetsGetFinetuneDataset: () =>
|
|
1010
|
+
HttpClientRequest.get(`/datasets/finetune`).pipe(
|
|
1011
|
+
withResponse(
|
|
1012
|
+
HttpClientResponse.matchStatus({
|
|
1013
|
+
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
1014
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
1015
|
+
'500': decodeError('DatasetsGetFinetuneDataset500', DatasetsGetFinetuneDataset500),
|
|
1016
|
+
'204': () => Effect.void,
|
|
701
1017
|
'429': () => Effect.void,
|
|
1018
|
+
'503': () => Effect.void,
|
|
702
1019
|
orElse: unexpectedStatus,
|
|
703
1020
|
}),
|
|
704
1021
|
),
|
|
705
1022
|
),
|
|
706
|
-
|
|
707
|
-
HttpClientRequest.post(`/v1/fetch
|
|
1023
|
+
fetch: (options) =>
|
|
1024
|
+
HttpClientRequest.post(`/v1/fetch`).pipe(
|
|
708
1025
|
HttpClientRequest.bodyUnsafeJson(options),
|
|
709
1026
|
withResponse(
|
|
710
1027
|
HttpClientResponse.matchStatus({
|
|
1028
|
+
'2xx': decodeSuccess(FetchResult),
|
|
711
1029
|
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
712
|
-
'401': decodeError('
|
|
713
|
-
'500': decodeError('
|
|
1030
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
1031
|
+
'500': decodeError('Fetch500', Fetch500),
|
|
714
1032
|
'429': () => Effect.void,
|
|
1033
|
+
'503': () => Effect.void,
|
|
715
1034
|
orElse: unexpectedStatus,
|
|
716
1035
|
}),
|
|
717
1036
|
),
|
|
@@ -721,9 +1040,69 @@ export const make = (
|
|
|
721
1040
|
withResponse(
|
|
722
1041
|
HttpClientResponse.matchStatus({
|
|
723
1042
|
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
1043
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
724
1044
|
'500': decodeError('LocalAssetsGetAsset500', LocalAssetsGetAsset500),
|
|
725
1045
|
'204': () => Effect.void,
|
|
726
1046
|
'429': () => Effect.void,
|
|
1047
|
+
'503': () => Effect.void,
|
|
1048
|
+
orElse: unexpectedStatus,
|
|
1049
|
+
}),
|
|
1050
|
+
),
|
|
1051
|
+
),
|
|
1052
|
+
playgroundFetch: (options) =>
|
|
1053
|
+
HttpClientRequest.post(`/v1/playground/fetch`).pipe(
|
|
1054
|
+
HttpClientRequest.bodyUnsafeJson(options),
|
|
1055
|
+
withResponse(
|
|
1056
|
+
HttpClientResponse.matchStatus({
|
|
1057
|
+
'2xx': decodeSuccess(PlaygroundResult),
|
|
1058
|
+
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
1059
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
1060
|
+
'500': decodeError('PlaygroundFetch500', PlaygroundFetch500),
|
|
1061
|
+
'429': () => Effect.void,
|
|
1062
|
+
'503': () => Effect.void,
|
|
1063
|
+
orElse: unexpectedStatus,
|
|
1064
|
+
}),
|
|
1065
|
+
),
|
|
1066
|
+
),
|
|
1067
|
+
playgroundGet: (fetchRequestId) =>
|
|
1068
|
+
HttpClientRequest.get(`/v1/playground/get/${fetchRequestId}`).pipe(
|
|
1069
|
+
withResponse(
|
|
1070
|
+
HttpClientResponse.matchStatus({
|
|
1071
|
+
'2xx': decodeSuccess(PlaygroundResult),
|
|
1072
|
+
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
1073
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
1074
|
+
'500': decodeError('PlaygroundGet500', PlaygroundGet500),
|
|
1075
|
+
'429': () => Effect.void,
|
|
1076
|
+
'503': () => Effect.void,
|
|
1077
|
+
orElse: unexpectedStatus,
|
|
1078
|
+
}),
|
|
1079
|
+
),
|
|
1080
|
+
),
|
|
1081
|
+
playgroundGetBySession: (browserSessionId) =>
|
|
1082
|
+
HttpClientRequest.get(`/v1/playground/session/${browserSessionId}`).pipe(
|
|
1083
|
+
withResponse(
|
|
1084
|
+
HttpClientResponse.matchStatus({
|
|
1085
|
+
'2xx': decodeSuccess(PlaygroundResult),
|
|
1086
|
+
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
1087
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
1088
|
+
'500': decodeError('PlaygroundGetBySession500', PlaygroundGetBySession500),
|
|
1089
|
+
'429': () => Effect.void,
|
|
1090
|
+
'503': () => Effect.void,
|
|
1091
|
+
orElse: unexpectedStatus,
|
|
1092
|
+
}),
|
|
1093
|
+
),
|
|
1094
|
+
),
|
|
1095
|
+
playgroundSearch: (options) =>
|
|
1096
|
+
HttpClientRequest.post(`/v1/playground/search`).pipe(
|
|
1097
|
+
HttpClientRequest.bodyUnsafeJson(options),
|
|
1098
|
+
withResponse(
|
|
1099
|
+
HttpClientResponse.matchStatus({
|
|
1100
|
+
'2xx': decodeSuccess(PlaygroundSearch200),
|
|
1101
|
+
'400': decodeError('HttpApiDecodeError', HttpApiDecodeError),
|
|
1102
|
+
'401': decodeError('AuthFailed', AuthFailed),
|
|
1103
|
+
'500': decodeError('PlaygroundSearch500', PlaygroundSearch500),
|
|
1104
|
+
'429': () => Effect.void,
|
|
1105
|
+
'503': () => Effect.void,
|
|
727
1106
|
orElse: unexpectedStatus,
|
|
728
1107
|
}),
|
|
729
1108
|
),
|
|
@@ -741,7 +1120,7 @@ export interface Client {
|
|
|
741
1120
|
| HttpClientError.HttpClientError
|
|
742
1121
|
| ParseError
|
|
743
1122
|
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
744
|
-
| ClientError<'
|
|
1123
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
745
1124
|
| ClientError<'AssetsGetByUrl404', typeof AssetsGetByUrl404.Type>
|
|
746
1125
|
| ClientError<'AssetsGetByUrl500', typeof AssetsGetByUrl500.Type>
|
|
747
1126
|
| ClientError<'CurlError', typeof CurlError.Type>
|
|
@@ -753,10 +1132,37 @@ export interface Client {
|
|
|
753
1132
|
| HttpClientError.HttpClientError
|
|
754
1133
|
| ParseError
|
|
755
1134
|
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
756
|
-
| ClientError<'
|
|
1135
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
757
1136
|
| ClientError<'AssetNotFound', typeof AssetNotFound.Type>
|
|
758
1137
|
| ClientError<'AssetsList500', typeof AssetsList500.Type>
|
|
759
1138
|
>
|
|
1139
|
+
readonly assetsGetWacz: (
|
|
1140
|
+
browserSessionId: string,
|
|
1141
|
+
) => Effect.Effect<
|
|
1142
|
+
void,
|
|
1143
|
+
| HttpClientError.HttpClientError
|
|
1144
|
+
| ParseError
|
|
1145
|
+
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
1146
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
1147
|
+
| ClientError<'AssetNotFound', typeof AssetNotFound.Type>
|
|
1148
|
+
| ClientError<'AssetsGetWacz500', typeof AssetsGetWacz500.Type>
|
|
1149
|
+
>
|
|
1150
|
+
readonly datasetsGetDataset: () => Effect.Effect<
|
|
1151
|
+
void,
|
|
1152
|
+
| HttpClientError.HttpClientError
|
|
1153
|
+
| ParseError
|
|
1154
|
+
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
1155
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
1156
|
+
| ClientError<'DatasetsGetDataset500', typeof DatasetsGetDataset500.Type>
|
|
1157
|
+
>
|
|
1158
|
+
readonly datasetsGetFinetuneDataset: () => Effect.Effect<
|
|
1159
|
+
void,
|
|
1160
|
+
| HttpClientError.HttpClientError
|
|
1161
|
+
| ParseError
|
|
1162
|
+
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
1163
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
1164
|
+
| ClientError<'DatasetsGetFinetuneDataset500', typeof DatasetsGetFinetuneDataset500.Type>
|
|
1165
|
+
>
|
|
760
1166
|
/**
|
|
761
1167
|
* Extract content from a web page as HTML, markdown, and/or screenshots. Handles complex rendering and bot protection.
|
|
762
1168
|
*/
|
|
@@ -767,30 +1173,70 @@ export interface Client {
|
|
|
767
1173
|
| HttpClientError.HttpClientError
|
|
768
1174
|
| ParseError
|
|
769
1175
|
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
770
|
-
| ClientError<'
|
|
771
|
-
| ClientError<'
|
|
1176
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
1177
|
+
| ClientError<'Fetch500', typeof Fetch500.Type>
|
|
1178
|
+
>
|
|
1179
|
+
readonly localAssetsGetAsset: (
|
|
1180
|
+
assetHash: string,
|
|
1181
|
+
) => Effect.Effect<
|
|
1182
|
+
void,
|
|
1183
|
+
| HttpClientError.HttpClientError
|
|
1184
|
+
| ParseError
|
|
1185
|
+
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
1186
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
1187
|
+
| ClientError<'LocalAssetsGetAsset500', typeof LocalAssetsGetAsset500.Type>
|
|
772
1188
|
>
|
|
773
1189
|
/**
|
|
774
|
-
*
|
|
1190
|
+
* Returns HTML with expand-id attributes and mdast tree with originalNodeId references.
|
|
775
1191
|
*/
|
|
776
|
-
readonly
|
|
777
|
-
options: typeof
|
|
1192
|
+
readonly playgroundFetch: (
|
|
1193
|
+
options: typeof PlaygroundFetchRequest.Encoded,
|
|
778
1194
|
) => Effect.Effect<
|
|
779
|
-
|
|
1195
|
+
typeof PlaygroundResult.Type,
|
|
780
1196
|
| HttpClientError.HttpClientError
|
|
781
1197
|
| ParseError
|
|
782
1198
|
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
783
|
-
| ClientError<'
|
|
784
|
-
| ClientError<'
|
|
1199
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
1200
|
+
| ClientError<'PlaygroundFetch500', typeof PlaygroundFetch500.Type>
|
|
785
1201
|
>
|
|
786
|
-
|
|
787
|
-
|
|
1202
|
+
/**
|
|
1203
|
+
* Returns HTML with expand-id attributes and mdast tree with originalNodeId references.
|
|
1204
|
+
*/
|
|
1205
|
+
readonly playgroundGet: (
|
|
1206
|
+
fetchRequestId: string,
|
|
788
1207
|
) => Effect.Effect<
|
|
789
|
-
|
|
1208
|
+
typeof PlaygroundResult.Type,
|
|
790
1209
|
| HttpClientError.HttpClientError
|
|
791
1210
|
| ParseError
|
|
792
1211
|
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
793
|
-
| ClientError<'
|
|
1212
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
1213
|
+
| ClientError<'PlaygroundGet500', typeof PlaygroundGet500.Type>
|
|
1214
|
+
>
|
|
1215
|
+
/**
|
|
1216
|
+
* Returns HTML with expand-id attributes and mdast tree with originalNodeId references.
|
|
1217
|
+
*/
|
|
1218
|
+
readonly playgroundGetBySession: (
|
|
1219
|
+
browserSessionId: string,
|
|
1220
|
+
) => Effect.Effect<
|
|
1221
|
+
typeof PlaygroundResult.Type,
|
|
1222
|
+
| HttpClientError.HttpClientError
|
|
1223
|
+
| ParseError
|
|
1224
|
+
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
1225
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
1226
|
+
| ClientError<'PlaygroundGetBySession500', typeof PlaygroundGetBySession500.Type>
|
|
1227
|
+
>
|
|
1228
|
+
/**
|
|
1229
|
+
* Search within fetched page content using semantic search. Returns ranked chunks with nodeIds for highlighting.
|
|
1230
|
+
*/
|
|
1231
|
+
readonly playgroundSearch: (
|
|
1232
|
+
options: typeof PlaygroundSearchRequest.Encoded,
|
|
1233
|
+
) => Effect.Effect<
|
|
1234
|
+
typeof PlaygroundSearch200.Type,
|
|
1235
|
+
| HttpClientError.HttpClientError
|
|
1236
|
+
| ParseError
|
|
1237
|
+
| ClientError<'HttpApiDecodeError', typeof HttpApiDecodeError.Type>
|
|
1238
|
+
| ClientError<'AuthFailed', typeof AuthFailed.Type>
|
|
1239
|
+
| ClientError<'PlaygroundSearch500', typeof PlaygroundSearch500.Type>
|
|
794
1240
|
>
|
|
795
1241
|
}
|
|
796
1242
|
|