@opencode-ai/sdk 1.0.133 → 1.0.137
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/client.d.ts +1 -1
- package/dist/client.js +7 -6
- package/dist/gen/sdk.gen.d.ts +59 -7
- package/dist/gen/sdk.gen.js +139 -15
- package/dist/gen/types.gen.d.ts +389 -16
- package/dist/v2/client.d.ts +7 -0
- package/dist/v2/client.js +25 -0
- package/dist/v2/gen/client/client.gen.d.ts +2 -0
- package/dist/v2/gen/client/client.gen.js +225 -0
- package/dist/v2/gen/client/index.d.ts +8 -0
- package/dist/v2/gen/client/index.js +6 -0
- package/dist/v2/gen/client/types.gen.d.ts +117 -0
- package/dist/v2/gen/client/types.gen.js +2 -0
- package/dist/v2/gen/client/utils.gen.d.ts +33 -0
- package/dist/v2/gen/client/utils.gen.js +226 -0
- package/dist/v2/gen/client.gen.d.ts +12 -0
- package/dist/v2/gen/client.gen.js +3 -0
- package/dist/v2/gen/core/auth.gen.d.ts +18 -0
- package/dist/v2/gen/core/auth.gen.js +14 -0
- package/dist/v2/gen/core/bodySerializer.gen.d.ts +25 -0
- package/dist/v2/gen/core/bodySerializer.gen.js +57 -0
- package/dist/v2/gen/core/params.gen.d.ts +43 -0
- package/dist/v2/gen/core/params.gen.js +102 -0
- package/dist/v2/gen/core/pathSerializer.gen.d.ts +33 -0
- package/dist/v2/gen/core/pathSerializer.gen.js +106 -0
- package/dist/v2/gen/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/v2/gen/core/queryKeySerializer.gen.js +93 -0
- package/dist/v2/gen/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/v2/gen/core/serverSentEvents.gen.js +131 -0
- package/dist/v2/gen/core/types.gen.d.ts +78 -0
- package/dist/v2/gen/core/types.gen.js +2 -0
- package/dist/v2/gen/core/utils.gen.d.ts +19 -0
- package/dist/v2/gen/core/utils.gen.js +87 -0
- package/dist/v2/gen/sdk.gen.d.ts +850 -0
- package/dist/v2/gen/sdk.gen.js +1626 -0
- package/dist/v2/gen/types.gen.d.ts +3356 -0
- package/dist/v2/gen/types.gen.js +2 -0
- package/dist/v2/index.d.ts +10 -0
- package/dist/v2/index.js +16 -0
- package/dist/v2/server.d.ts +23 -0
- package/dist/v2/server.js +91 -0
- package/package.json +15 -3
package/dist/gen/types.gen.d.ts
CHANGED
|
@@ -559,13 +559,47 @@ export type EventTuiToastShow = {
|
|
|
559
559
|
duration?: number;
|
|
560
560
|
};
|
|
561
561
|
};
|
|
562
|
+
export type Pty = {
|
|
563
|
+
id: string;
|
|
564
|
+
title: string;
|
|
565
|
+
command: string;
|
|
566
|
+
args: Array<string>;
|
|
567
|
+
cwd: string;
|
|
568
|
+
status: "running" | "exited";
|
|
569
|
+
pid: number;
|
|
570
|
+
};
|
|
571
|
+
export type EventPtyCreated = {
|
|
572
|
+
type: "pty.created";
|
|
573
|
+
properties: {
|
|
574
|
+
info: Pty;
|
|
575
|
+
};
|
|
576
|
+
};
|
|
577
|
+
export type EventPtyUpdated = {
|
|
578
|
+
type: "pty.updated";
|
|
579
|
+
properties: {
|
|
580
|
+
info: Pty;
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
export type EventPtyExited = {
|
|
584
|
+
type: "pty.exited";
|
|
585
|
+
properties: {
|
|
586
|
+
id: string;
|
|
587
|
+
exitCode: number;
|
|
588
|
+
};
|
|
589
|
+
};
|
|
590
|
+
export type EventPtyDeleted = {
|
|
591
|
+
type: "pty.deleted";
|
|
592
|
+
properties: {
|
|
593
|
+
id: string;
|
|
594
|
+
};
|
|
595
|
+
};
|
|
562
596
|
export type EventServerConnected = {
|
|
563
597
|
type: "server.connected";
|
|
564
598
|
properties: {
|
|
565
599
|
[key: string]: unknown;
|
|
566
600
|
};
|
|
567
601
|
};
|
|
568
|
-
export type Event = EventServerInstanceDisposed | EventInstallationUpdated | EventInstallationUpdateAvailable | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionUpdated | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventServerConnected;
|
|
602
|
+
export type Event = EventServerInstanceDisposed | EventInstallationUpdated | EventInstallationUpdateAvailable | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionUpdated | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected;
|
|
569
603
|
export type GlobalEvent = {
|
|
570
604
|
directory: string;
|
|
571
605
|
payload: Event;
|
|
@@ -580,6 +614,19 @@ export type Project = {
|
|
|
580
614
|
initialized?: number;
|
|
581
615
|
};
|
|
582
616
|
};
|
|
617
|
+
export type BadRequestError = {
|
|
618
|
+
data: unknown;
|
|
619
|
+
errors: Array<{
|
|
620
|
+
[key: string]: unknown;
|
|
621
|
+
}>;
|
|
622
|
+
success: false;
|
|
623
|
+
};
|
|
624
|
+
export type NotFoundError = {
|
|
625
|
+
name: "NotFoundError";
|
|
626
|
+
data: {
|
|
627
|
+
message: string;
|
|
628
|
+
};
|
|
629
|
+
};
|
|
583
630
|
/**
|
|
584
631
|
* Custom keybind configurations
|
|
585
632
|
*/
|
|
@@ -604,6 +651,10 @@ export type KeybindsConfig = {
|
|
|
604
651
|
* Toggle sidebar
|
|
605
652
|
*/
|
|
606
653
|
sidebar_toggle?: string;
|
|
654
|
+
/**
|
|
655
|
+
* Toggle session scrollbar
|
|
656
|
+
*/
|
|
657
|
+
scrollbar_toggle?: string;
|
|
607
658
|
/**
|
|
608
659
|
* Toggle username visibility
|
|
609
660
|
*/
|
|
@@ -779,6 +830,10 @@ export type AgentConfig = {
|
|
|
779
830
|
* Hex color code for the agent (e.g., #FF5733)
|
|
780
831
|
*/
|
|
781
832
|
color?: string;
|
|
833
|
+
/**
|
|
834
|
+
* Maximum number of agentic iterations before forcing text-only response
|
|
835
|
+
*/
|
|
836
|
+
maxSteps?: number;
|
|
782
837
|
permission?: {
|
|
783
838
|
edit?: "ask" | "allow" | "deny";
|
|
784
839
|
bash?: ("ask" | "allow" | "deny") | {
|
|
@@ -790,7 +845,7 @@ export type AgentConfig = {
|
|
|
790
845
|
};
|
|
791
846
|
[key: string]: unknown | string | number | {
|
|
792
847
|
[key: string]: boolean;
|
|
793
|
-
} | boolean | ("subagent" | "primary" | "all") | {
|
|
848
|
+
} | boolean | ("subagent" | "primary" | "all") | number | {
|
|
794
849
|
edit?: "ask" | "allow" | "deny";
|
|
795
850
|
bash?: ("ask" | "allow" | "deny") | {
|
|
796
851
|
[key: string]: "ask" | "allow" | "deny";
|
|
@@ -892,6 +947,20 @@ export type McpLocalConfig = {
|
|
|
892
947
|
*/
|
|
893
948
|
timeout?: number;
|
|
894
949
|
};
|
|
950
|
+
export type McpOAuthConfig = {
|
|
951
|
+
/**
|
|
952
|
+
* OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted.
|
|
953
|
+
*/
|
|
954
|
+
clientId?: string;
|
|
955
|
+
/**
|
|
956
|
+
* OAuth client secret (if required by the authorization server)
|
|
957
|
+
*/
|
|
958
|
+
clientSecret?: string;
|
|
959
|
+
/**
|
|
960
|
+
* OAuth scopes to request during authorization
|
|
961
|
+
*/
|
|
962
|
+
scope?: string;
|
|
963
|
+
};
|
|
895
964
|
export type McpRemoteConfig = {
|
|
896
965
|
/**
|
|
897
966
|
* Type of MCP server connection
|
|
@@ -911,6 +980,10 @@ export type McpRemoteConfig = {
|
|
|
911
980
|
headers?: {
|
|
912
981
|
[key: string]: string;
|
|
913
982
|
};
|
|
983
|
+
/**
|
|
984
|
+
* OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection.
|
|
985
|
+
*/
|
|
986
|
+
oauth?: McpOAuthConfig | false;
|
|
914
987
|
/**
|
|
915
988
|
* Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified.
|
|
916
989
|
*/
|
|
@@ -1105,19 +1178,16 @@ export type Config = {
|
|
|
1105
1178
|
* Enable the batch tool
|
|
1106
1179
|
*/
|
|
1107
1180
|
batch_tool?: boolean;
|
|
1181
|
+
/**
|
|
1182
|
+
* Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)
|
|
1183
|
+
*/
|
|
1184
|
+
openTelemetry?: boolean;
|
|
1108
1185
|
/**
|
|
1109
1186
|
* Tools that should only be available to primary agents.
|
|
1110
1187
|
*/
|
|
1111
1188
|
primary_tools?: Array<string>;
|
|
1112
1189
|
};
|
|
1113
1190
|
};
|
|
1114
|
-
export type BadRequestError = {
|
|
1115
|
-
data: unknown;
|
|
1116
|
-
errors: Array<{
|
|
1117
|
-
[key: string]: unknown;
|
|
1118
|
-
}>;
|
|
1119
|
-
success: false;
|
|
1120
|
-
};
|
|
1121
1191
|
export type ToolIds = Array<string>;
|
|
1122
1192
|
export type ToolListItem = {
|
|
1123
1193
|
id: string;
|
|
@@ -1134,12 +1204,6 @@ export type Path = {
|
|
|
1134
1204
|
export type VcsInfo = {
|
|
1135
1205
|
branch: string;
|
|
1136
1206
|
};
|
|
1137
|
-
export type NotFoundError = {
|
|
1138
|
-
name: "NotFoundError";
|
|
1139
|
-
data: {
|
|
1140
|
-
message: string;
|
|
1141
|
-
};
|
|
1142
|
-
};
|
|
1143
1207
|
export type TextPartInput = {
|
|
1144
1208
|
id?: string;
|
|
1145
1209
|
type: "text";
|
|
@@ -1336,6 +1400,7 @@ export type Agent = {
|
|
|
1336
1400
|
options: {
|
|
1337
1401
|
[key: string]: unknown;
|
|
1338
1402
|
};
|
|
1403
|
+
maxSteps?: number;
|
|
1339
1404
|
};
|
|
1340
1405
|
export type McpStatusConnected = {
|
|
1341
1406
|
status: "connected";
|
|
@@ -1347,7 +1412,14 @@ export type McpStatusFailed = {
|
|
|
1347
1412
|
status: "failed";
|
|
1348
1413
|
error: string;
|
|
1349
1414
|
};
|
|
1350
|
-
export type
|
|
1415
|
+
export type McpStatusNeedsAuth = {
|
|
1416
|
+
status: "needs_auth";
|
|
1417
|
+
};
|
|
1418
|
+
export type McpStatusNeedsClientRegistration = {
|
|
1419
|
+
status: "needs_client_registration";
|
|
1420
|
+
error: string;
|
|
1421
|
+
};
|
|
1422
|
+
export type McpStatus = McpStatusConnected | McpStatusDisabled | McpStatusFailed | McpStatusNeedsAuth | McpStatusNeedsClientRegistration;
|
|
1351
1423
|
export type LspStatus = {
|
|
1352
1424
|
id: string;
|
|
1353
1425
|
name: string;
|
|
@@ -1419,6 +1491,153 @@ export type ProjectCurrentResponses = {
|
|
|
1419
1491
|
200: Project;
|
|
1420
1492
|
};
|
|
1421
1493
|
export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses];
|
|
1494
|
+
export type PtyListData = {
|
|
1495
|
+
body?: never;
|
|
1496
|
+
path?: never;
|
|
1497
|
+
query?: {
|
|
1498
|
+
directory?: string;
|
|
1499
|
+
};
|
|
1500
|
+
url: "/pty";
|
|
1501
|
+
};
|
|
1502
|
+
export type PtyListResponses = {
|
|
1503
|
+
/**
|
|
1504
|
+
* List of sessions
|
|
1505
|
+
*/
|
|
1506
|
+
200: Array<Pty>;
|
|
1507
|
+
};
|
|
1508
|
+
export type PtyListResponse = PtyListResponses[keyof PtyListResponses];
|
|
1509
|
+
export type PtyCreateData = {
|
|
1510
|
+
body?: {
|
|
1511
|
+
command?: string;
|
|
1512
|
+
args?: Array<string>;
|
|
1513
|
+
cwd?: string;
|
|
1514
|
+
title?: string;
|
|
1515
|
+
env?: {
|
|
1516
|
+
[key: string]: string;
|
|
1517
|
+
};
|
|
1518
|
+
};
|
|
1519
|
+
path?: never;
|
|
1520
|
+
query?: {
|
|
1521
|
+
directory?: string;
|
|
1522
|
+
};
|
|
1523
|
+
url: "/pty";
|
|
1524
|
+
};
|
|
1525
|
+
export type PtyCreateErrors = {
|
|
1526
|
+
/**
|
|
1527
|
+
* Bad request
|
|
1528
|
+
*/
|
|
1529
|
+
400: BadRequestError;
|
|
1530
|
+
};
|
|
1531
|
+
export type PtyCreateError = PtyCreateErrors[keyof PtyCreateErrors];
|
|
1532
|
+
export type PtyCreateResponses = {
|
|
1533
|
+
/**
|
|
1534
|
+
* Created session
|
|
1535
|
+
*/
|
|
1536
|
+
200: Pty;
|
|
1537
|
+
};
|
|
1538
|
+
export type PtyCreateResponse = PtyCreateResponses[keyof PtyCreateResponses];
|
|
1539
|
+
export type PtyRemoveData = {
|
|
1540
|
+
body?: never;
|
|
1541
|
+
path: {
|
|
1542
|
+
id: string;
|
|
1543
|
+
};
|
|
1544
|
+
query?: {
|
|
1545
|
+
directory?: string;
|
|
1546
|
+
};
|
|
1547
|
+
url: "/pty/{id}";
|
|
1548
|
+
};
|
|
1549
|
+
export type PtyRemoveErrors = {
|
|
1550
|
+
/**
|
|
1551
|
+
* Not found
|
|
1552
|
+
*/
|
|
1553
|
+
404: NotFoundError;
|
|
1554
|
+
};
|
|
1555
|
+
export type PtyRemoveError = PtyRemoveErrors[keyof PtyRemoveErrors];
|
|
1556
|
+
export type PtyRemoveResponses = {
|
|
1557
|
+
/**
|
|
1558
|
+
* Session removed
|
|
1559
|
+
*/
|
|
1560
|
+
200: boolean;
|
|
1561
|
+
};
|
|
1562
|
+
export type PtyRemoveResponse = PtyRemoveResponses[keyof PtyRemoveResponses];
|
|
1563
|
+
export type PtyGetData = {
|
|
1564
|
+
body?: never;
|
|
1565
|
+
path: {
|
|
1566
|
+
id: string;
|
|
1567
|
+
};
|
|
1568
|
+
query?: {
|
|
1569
|
+
directory?: string;
|
|
1570
|
+
};
|
|
1571
|
+
url: "/pty/{id}";
|
|
1572
|
+
};
|
|
1573
|
+
export type PtyGetErrors = {
|
|
1574
|
+
/**
|
|
1575
|
+
* Not found
|
|
1576
|
+
*/
|
|
1577
|
+
404: NotFoundError;
|
|
1578
|
+
};
|
|
1579
|
+
export type PtyGetError = PtyGetErrors[keyof PtyGetErrors];
|
|
1580
|
+
export type PtyGetResponses = {
|
|
1581
|
+
/**
|
|
1582
|
+
* Session info
|
|
1583
|
+
*/
|
|
1584
|
+
200: Pty;
|
|
1585
|
+
};
|
|
1586
|
+
export type PtyGetResponse = PtyGetResponses[keyof PtyGetResponses];
|
|
1587
|
+
export type PtyUpdateData = {
|
|
1588
|
+
body?: {
|
|
1589
|
+
title?: string;
|
|
1590
|
+
size?: {
|
|
1591
|
+
rows: number;
|
|
1592
|
+
cols: number;
|
|
1593
|
+
};
|
|
1594
|
+
};
|
|
1595
|
+
path: {
|
|
1596
|
+
id: string;
|
|
1597
|
+
};
|
|
1598
|
+
query?: {
|
|
1599
|
+
directory?: string;
|
|
1600
|
+
};
|
|
1601
|
+
url: "/pty/{id}";
|
|
1602
|
+
};
|
|
1603
|
+
export type PtyUpdateErrors = {
|
|
1604
|
+
/**
|
|
1605
|
+
* Bad request
|
|
1606
|
+
*/
|
|
1607
|
+
400: BadRequestError;
|
|
1608
|
+
};
|
|
1609
|
+
export type PtyUpdateError = PtyUpdateErrors[keyof PtyUpdateErrors];
|
|
1610
|
+
export type PtyUpdateResponses = {
|
|
1611
|
+
/**
|
|
1612
|
+
* Updated session
|
|
1613
|
+
*/
|
|
1614
|
+
200: Pty;
|
|
1615
|
+
};
|
|
1616
|
+
export type PtyUpdateResponse = PtyUpdateResponses[keyof PtyUpdateResponses];
|
|
1617
|
+
export type PtyConnectData = {
|
|
1618
|
+
body?: never;
|
|
1619
|
+
path: {
|
|
1620
|
+
id: string;
|
|
1621
|
+
};
|
|
1622
|
+
query?: {
|
|
1623
|
+
directory?: string;
|
|
1624
|
+
};
|
|
1625
|
+
url: "/pty/{id}/connect";
|
|
1626
|
+
};
|
|
1627
|
+
export type PtyConnectErrors = {
|
|
1628
|
+
/**
|
|
1629
|
+
* Not found
|
|
1630
|
+
*/
|
|
1631
|
+
404: NotFoundError;
|
|
1632
|
+
};
|
|
1633
|
+
export type PtyConnectError = PtyConnectErrors[keyof PtyConnectErrors];
|
|
1634
|
+
export type PtyConnectResponses = {
|
|
1635
|
+
/**
|
|
1636
|
+
* Connected session
|
|
1637
|
+
*/
|
|
1638
|
+
200: boolean;
|
|
1639
|
+
};
|
|
1640
|
+
export type PtyConnectResponse = PtyConnectResponses[keyof PtyConnectResponses];
|
|
1422
1641
|
export type ConfigGetData = {
|
|
1423
1642
|
body?: never;
|
|
1424
1643
|
path?: never;
|
|
@@ -2693,6 +2912,160 @@ export type McpAddResponses = {
|
|
|
2693
2912
|
};
|
|
2694
2913
|
};
|
|
2695
2914
|
export type McpAddResponse = McpAddResponses[keyof McpAddResponses];
|
|
2915
|
+
export type McpAuthRemoveData = {
|
|
2916
|
+
body?: never;
|
|
2917
|
+
path: {
|
|
2918
|
+
name: string;
|
|
2919
|
+
};
|
|
2920
|
+
query?: {
|
|
2921
|
+
directory?: string;
|
|
2922
|
+
};
|
|
2923
|
+
url: "/mcp/{name}/auth";
|
|
2924
|
+
};
|
|
2925
|
+
export type McpAuthRemoveErrors = {
|
|
2926
|
+
/**
|
|
2927
|
+
* Not found
|
|
2928
|
+
*/
|
|
2929
|
+
404: NotFoundError;
|
|
2930
|
+
};
|
|
2931
|
+
export type McpAuthRemoveError = McpAuthRemoveErrors[keyof McpAuthRemoveErrors];
|
|
2932
|
+
export type McpAuthRemoveResponses = {
|
|
2933
|
+
/**
|
|
2934
|
+
* OAuth credentials removed
|
|
2935
|
+
*/
|
|
2936
|
+
200: {
|
|
2937
|
+
success: true;
|
|
2938
|
+
};
|
|
2939
|
+
};
|
|
2940
|
+
export type McpAuthRemoveResponse = McpAuthRemoveResponses[keyof McpAuthRemoveResponses];
|
|
2941
|
+
export type McpAuthStartData = {
|
|
2942
|
+
body?: never;
|
|
2943
|
+
path: {
|
|
2944
|
+
name: string;
|
|
2945
|
+
};
|
|
2946
|
+
query?: {
|
|
2947
|
+
directory?: string;
|
|
2948
|
+
};
|
|
2949
|
+
url: "/mcp/{name}/auth";
|
|
2950
|
+
};
|
|
2951
|
+
export type McpAuthStartErrors = {
|
|
2952
|
+
/**
|
|
2953
|
+
* Bad request
|
|
2954
|
+
*/
|
|
2955
|
+
400: BadRequestError;
|
|
2956
|
+
/**
|
|
2957
|
+
* Not found
|
|
2958
|
+
*/
|
|
2959
|
+
404: NotFoundError;
|
|
2960
|
+
};
|
|
2961
|
+
export type McpAuthStartError = McpAuthStartErrors[keyof McpAuthStartErrors];
|
|
2962
|
+
export type McpAuthStartResponses = {
|
|
2963
|
+
/**
|
|
2964
|
+
* OAuth flow started
|
|
2965
|
+
*/
|
|
2966
|
+
200: {
|
|
2967
|
+
/**
|
|
2968
|
+
* URL to open in browser for authorization
|
|
2969
|
+
*/
|
|
2970
|
+
authorizationUrl: string;
|
|
2971
|
+
};
|
|
2972
|
+
};
|
|
2973
|
+
export type McpAuthStartResponse = McpAuthStartResponses[keyof McpAuthStartResponses];
|
|
2974
|
+
export type McpAuthCallbackData = {
|
|
2975
|
+
body?: {
|
|
2976
|
+
/**
|
|
2977
|
+
* Authorization code from OAuth callback
|
|
2978
|
+
*/
|
|
2979
|
+
code: string;
|
|
2980
|
+
};
|
|
2981
|
+
path: {
|
|
2982
|
+
name: string;
|
|
2983
|
+
};
|
|
2984
|
+
query?: {
|
|
2985
|
+
directory?: string;
|
|
2986
|
+
};
|
|
2987
|
+
url: "/mcp/{name}/auth/callback";
|
|
2988
|
+
};
|
|
2989
|
+
export type McpAuthCallbackErrors = {
|
|
2990
|
+
/**
|
|
2991
|
+
* Bad request
|
|
2992
|
+
*/
|
|
2993
|
+
400: BadRequestError;
|
|
2994
|
+
/**
|
|
2995
|
+
* Not found
|
|
2996
|
+
*/
|
|
2997
|
+
404: NotFoundError;
|
|
2998
|
+
};
|
|
2999
|
+
export type McpAuthCallbackError = McpAuthCallbackErrors[keyof McpAuthCallbackErrors];
|
|
3000
|
+
export type McpAuthCallbackResponses = {
|
|
3001
|
+
/**
|
|
3002
|
+
* OAuth authentication completed
|
|
3003
|
+
*/
|
|
3004
|
+
200: McpStatus;
|
|
3005
|
+
};
|
|
3006
|
+
export type McpAuthCallbackResponse = McpAuthCallbackResponses[keyof McpAuthCallbackResponses];
|
|
3007
|
+
export type McpAuthAuthenticateData = {
|
|
3008
|
+
body?: never;
|
|
3009
|
+
path: {
|
|
3010
|
+
name: string;
|
|
3011
|
+
};
|
|
3012
|
+
query?: {
|
|
3013
|
+
directory?: string;
|
|
3014
|
+
};
|
|
3015
|
+
url: "/mcp/{name}/auth/authenticate";
|
|
3016
|
+
};
|
|
3017
|
+
export type McpAuthAuthenticateErrors = {
|
|
3018
|
+
/**
|
|
3019
|
+
* Bad request
|
|
3020
|
+
*/
|
|
3021
|
+
400: BadRequestError;
|
|
3022
|
+
/**
|
|
3023
|
+
* Not found
|
|
3024
|
+
*/
|
|
3025
|
+
404: NotFoundError;
|
|
3026
|
+
};
|
|
3027
|
+
export type McpAuthAuthenticateError = McpAuthAuthenticateErrors[keyof McpAuthAuthenticateErrors];
|
|
3028
|
+
export type McpAuthAuthenticateResponses = {
|
|
3029
|
+
/**
|
|
3030
|
+
* OAuth authentication completed
|
|
3031
|
+
*/
|
|
3032
|
+
200: McpStatus;
|
|
3033
|
+
};
|
|
3034
|
+
export type McpAuthAuthenticateResponse = McpAuthAuthenticateResponses[keyof McpAuthAuthenticateResponses];
|
|
3035
|
+
export type McpConnectData = {
|
|
3036
|
+
body?: never;
|
|
3037
|
+
path: {
|
|
3038
|
+
name: string;
|
|
3039
|
+
};
|
|
3040
|
+
query?: {
|
|
3041
|
+
directory?: string;
|
|
3042
|
+
};
|
|
3043
|
+
url: "/mcp/{name}/connect";
|
|
3044
|
+
};
|
|
3045
|
+
export type McpConnectResponses = {
|
|
3046
|
+
/**
|
|
3047
|
+
* MCP server connected successfully
|
|
3048
|
+
*/
|
|
3049
|
+
200: boolean;
|
|
3050
|
+
};
|
|
3051
|
+
export type McpConnectResponse = McpConnectResponses[keyof McpConnectResponses];
|
|
3052
|
+
export type McpDisconnectData = {
|
|
3053
|
+
body?: never;
|
|
3054
|
+
path: {
|
|
3055
|
+
name: string;
|
|
3056
|
+
};
|
|
3057
|
+
query?: {
|
|
3058
|
+
directory?: string;
|
|
3059
|
+
};
|
|
3060
|
+
url: "/mcp/{name}/disconnect";
|
|
3061
|
+
};
|
|
3062
|
+
export type McpDisconnectResponses = {
|
|
3063
|
+
/**
|
|
3064
|
+
* MCP server disconnected successfully
|
|
3065
|
+
*/
|
|
3066
|
+
200: boolean;
|
|
3067
|
+
};
|
|
3068
|
+
export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses];
|
|
2696
3069
|
export type LspStatusData = {
|
|
2697
3070
|
body?: never;
|
|
2698
3071
|
path?: never;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./gen/types.gen.js";
|
|
2
|
+
import { type Config } from "./gen/client/types.gen.js";
|
|
3
|
+
import { OpencodeClient } from "./gen/sdk.gen.js";
|
|
4
|
+
export { type Config as OpencodeClientConfig, OpencodeClient };
|
|
5
|
+
export declare function createOpencodeClient(config?: Config & {
|
|
6
|
+
directory?: string;
|
|
7
|
+
}): OpencodeClient;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from "./gen/types.gen.js";
|
|
2
|
+
import { createClient } from "./gen/client/client.gen.js";
|
|
3
|
+
import { OpencodeClient } from "./gen/sdk.gen.js";
|
|
4
|
+
export { OpencodeClient };
|
|
5
|
+
export function createOpencodeClient(config) {
|
|
6
|
+
if (!config?.fetch) {
|
|
7
|
+
const customFetch = (req) => {
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
req.timeout = false;
|
|
10
|
+
return fetch(req);
|
|
11
|
+
};
|
|
12
|
+
config = {
|
|
13
|
+
...config,
|
|
14
|
+
fetch: customFetch,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (config?.directory) {
|
|
18
|
+
config.headers = {
|
|
19
|
+
...config.headers,
|
|
20
|
+
"x-opencode-directory": config.directory,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const client = createClient(config);
|
|
24
|
+
return new OpencodeClient({ client });
|
|
25
|
+
}
|