@opencode-ai/sdk 0.1.0-alpha.14 → 0.1.0-alpha.2
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/CHANGELOG.md +0 -113
- package/LICENSE +4 -198
- package/README.md +0 -18
- package/client.d.mts +48 -17
- package/client.d.mts.map +1 -1
- package/client.d.ts +48 -17
- package/client.d.ts.map +1 -1
- package/client.js +48 -15
- package/client.js.map +1 -1
- package/client.mjs +48 -15
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +0 -10
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +0 -10
- package/internal/parse.mjs.map +1 -1
- package/internal/request-options.d.mts +0 -2
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +0 -2
- package/internal/request-options.d.ts.map +1 -1
- package/internal/request-options.js.map +1 -1
- package/internal/request-options.mjs.map +1 -1
- package/internal/tslib.js +6 -6
- package/internal/types.d.mts +6 -8
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +6 -8
- package/internal/types.d.ts.map +1 -1
- package/internal/uploads.js +1 -1
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/log.js +1 -1
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +1 -1
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.d.mts.map +1 -1
- package/internal/utils/path.d.ts.map +1 -1
- package/internal/utils/path.js +5 -26
- package/internal/utils/path.js.map +1 -1
- package/internal/utils/path.mjs +5 -26
- package/internal/utils/path.mjs.map +1 -1
- package/package.json +3 -13
- package/resources/app-info.d.mts +31 -0
- package/resources/app-info.d.mts.map +1 -0
- package/resources/app-info.d.ts +31 -0
- package/resources/app-info.d.ts.map +1 -0
- package/resources/app-info.js +15 -0
- package/resources/app-info.js.map +1 -0
- package/resources/app-info.mjs +11 -0
- package/resources/app-info.mjs.map +1 -0
- package/resources/app-initialize.d.mts +14 -0
- package/resources/app-initialize.d.mts.map +1 -0
- package/resources/app-initialize.d.ts +14 -0
- package/resources/app-initialize.d.ts.map +1 -0
- package/resources/app-initialize.js +15 -0
- package/resources/app-initialize.js.map +1 -0
- package/resources/app-initialize.mjs +11 -0
- package/resources/app-initialize.mjs.map +1 -0
- package/resources/config-get.d.mts +236 -0
- package/resources/config-get.d.mts.map +1 -0
- package/resources/config-get.d.ts +236 -0
- package/resources/config-get.d.ts.map +1 -0
- package/resources/config-get.js +15 -0
- package/resources/config-get.js.map +1 -0
- package/resources/config-get.mjs +11 -0
- package/resources/config-get.mjs.map +1 -0
- package/resources/event.d.mts +27 -81
- package/resources/event.d.mts.map +1 -1
- package/resources/event.d.ts +27 -81
- package/resources/event.d.ts.map +1 -1
- package/resources/event.js +1 -1
- package/resources/event.js.map +1 -1
- package/resources/event.mjs +1 -1
- package/resources/event.mjs.map +1 -1
- package/resources/file-search.d.mts +17 -0
- package/resources/file-search.d.mts.map +1 -0
- package/resources/file-search.d.ts +17 -0
- package/resources/file-search.d.ts.map +1 -0
- package/resources/file-search.js +15 -0
- package/resources/file-search.js.map +1 -0
- package/resources/file-search.mjs +11 -0
- package/resources/file-search.mjs.map +1 -0
- package/resources/index.d.mts +16 -6
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +16 -6
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +33 -13
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +16 -6
- package/resources/index.mjs.map +1 -1
- package/resources/installation-info.d.mts +17 -0
- package/resources/installation-info.d.mts.map +1 -0
- package/resources/installation-info.d.ts +17 -0
- package/resources/installation-info.d.ts.map +1 -0
- package/resources/installation-info.js +15 -0
- package/resources/installation-info.js.map +1 -0
- package/resources/installation-info.mjs +11 -0
- package/resources/installation-info.mjs.map +1 -0
- package/resources/path-get.d.mts +19 -0
- package/resources/path-get.d.mts.map +1 -0
- package/resources/path-get.d.ts +19 -0
- package/resources/path-get.d.ts.map +1 -0
- package/resources/path-get.js +15 -0
- package/resources/path-get.js.map +1 -0
- package/resources/path-get.mjs +11 -0
- package/resources/path-get.mjs.map +1 -0
- package/resources/provider-list.d.mts +58 -0
- package/resources/provider-list.d.mts.map +1 -0
- package/resources/provider-list.d.ts +58 -0
- package/resources/provider-list.d.ts.map +1 -0
- package/resources/provider-list.js +15 -0
- package/resources/provider-list.js.map +1 -0
- package/resources/provider-list.mjs +11 -0
- package/resources/provider-list.mjs.map +1 -0
- package/resources/session-abort.d.mts +17 -0
- package/resources/session-abort.d.mts.map +1 -0
- package/resources/session-abort.d.ts +17 -0
- package/resources/session-abort.d.ts.map +1 -0
- package/resources/session-abort.js +15 -0
- package/resources/session-abort.js.map +1 -0
- package/resources/session-abort.mjs +11 -0
- package/resources/session-abort.mjs.map +1 -0
- package/resources/session-chat.d.mts +160 -0
- package/resources/session-chat.d.mts.map +1 -0
- package/resources/session-chat.d.ts +160 -0
- package/resources/session-chat.d.ts.map +1 -0
- package/resources/session-chat.js +15 -0
- package/resources/session-chat.js.map +1 -0
- package/resources/session-chat.mjs +11 -0
- package/resources/session-chat.mjs.map +1 -0
- package/resources/session-create.d.mts +30 -0
- package/resources/session-create.d.mts.map +1 -0
- package/resources/session-create.d.ts +30 -0
- package/resources/session-create.d.ts.map +1 -0
- package/resources/session-create.js +15 -0
- package/resources/session-create.js.map +1 -0
- package/resources/session-create.mjs +11 -0
- package/resources/session-create.mjs.map +1 -0
- package/resources/session-initialize.d.mts +19 -0
- package/resources/session-initialize.d.mts.map +1 -0
- package/resources/session-initialize.d.ts +19 -0
- package/resources/session-initialize.d.ts.map +1 -0
- package/resources/session-initialize.js +15 -0
- package/resources/session-initialize.js.map +1 -0
- package/resources/session-initialize.mjs +11 -0
- package/resources/session-initialize.mjs.map +1 -0
- package/resources/session-list.d.mts +15 -0
- package/resources/session-list.d.mts.map +1 -0
- package/resources/session-list.d.ts +15 -0
- package/resources/session-list.d.ts.map +1 -0
- package/resources/session-list.js +15 -0
- package/resources/session-list.js.map +1 -0
- package/resources/session-list.mjs +11 -0
- package/resources/session-list.mjs.map +1 -0
- package/resources/session-messages.d.mts +18 -0
- package/resources/session-messages.d.mts.map +1 -0
- package/resources/session-messages.d.ts +18 -0
- package/resources/session-messages.d.ts.map +1 -0
- package/resources/session-messages.js +15 -0
- package/resources/session-messages.js.map +1 -0
- package/resources/session-messages.mjs +11 -0
- package/resources/session-messages.mjs.map +1 -0
- package/resources/session-share.d.mts +17 -0
- package/resources/session-share.d.mts.map +1 -0
- package/resources/session-share.d.ts +17 -0
- package/resources/session-share.d.ts.map +1 -0
- package/resources/session-share.js +15 -0
- package/resources/session-share.js.map +1 -0
- package/resources/session-share.mjs +11 -0
- package/resources/session-share.mjs.map +1 -0
- package/resources/session-summarize.d.mts +19 -0
- package/resources/session-summarize.d.mts.map +1 -0
- package/resources/session-summarize.d.ts +19 -0
- package/resources/session-summarize.d.ts.map +1 -0
- package/resources/session-summarize.js +15 -0
- package/resources/session-summarize.js.map +1 -0
- package/resources/session-summarize.mjs +11 -0
- package/resources/session-summarize.mjs.map +1 -0
- package/resources/session-unshare.d.mts +17 -0
- package/resources/session-unshare.d.mts.map +1 -0
- package/resources/session-unshare.d.ts +17 -0
- package/resources/session-unshare.d.ts.map +1 -0
- package/resources/session-unshare.js +15 -0
- package/resources/session-unshare.js.map +1 -0
- package/resources/session-unshare.mjs +11 -0
- package/resources/session-unshare.mjs.map +1 -0
- package/src/client.ts +118 -96
- package/src/internal/parse.ts +0 -14
- package/src/internal/request-options.ts +0 -2
- package/src/internal/types.ts +6 -9
- package/src/internal/uploads.ts +1 -1
- package/src/internal/utils/log.ts +1 -1
- package/src/internal/utils/path.ts +7 -32
- package/src/resources/app-info.ts +46 -0
- package/src/resources/app-initialize.ts +20 -0
- package/src/resources/config-get.ts +294 -0
- package/src/resources/event.ts +37 -115
- package/src/resources/file-search.ts +27 -0
- package/src/resources/index.ts +33 -44
- package/src/resources/installation-info.ts +24 -0
- package/src/resources/path-get.ts +28 -0
- package/src/resources/provider-list.ts +80 -0
- package/src/resources/session-abort.ts +27 -0
- package/src/resources/session-chat.ts +250 -0
- package/src/resources/session-create.ts +44 -0
- package/src/resources/session-initialize.ts +34 -0
- package/src/resources/session-list.ts +21 -0
- package/src/resources/session-messages.ts +31 -0
- package/src/resources/session-share.ts +23 -0
- package/src/resources/session-summarize.ts +34 -0
- package/src/resources/session-unshare.ts +26 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/core/streaming.d.mts +0 -31
- package/core/streaming.d.mts.map +0 -1
- package/core/streaming.d.ts +0 -31
- package/core/streaming.d.ts.map +0 -1
- package/core/streaming.js +0 -257
- package/core/streaming.js.map +0 -1
- package/core/streaming.mjs +0 -252
- package/core/streaming.mjs.map +0 -1
- package/internal/decoders/line.d.mts +0 -17
- package/internal/decoders/line.d.mts.map +0 -1
- package/internal/decoders/line.d.ts +0 -17
- package/internal/decoders/line.d.ts.map +0 -1
- package/internal/decoders/line.js +0 -113
- package/internal/decoders/line.js.map +0 -1
- package/internal/decoders/line.mjs +0 -108
- package/internal/decoders/line.mjs.map +0 -1
- package/resources/app.d.mts +0 -37
- package/resources/app.d.mts.map +0 -1
- package/resources/app.d.ts +0 -37
- package/resources/app.d.ts.map +0 -1
- package/resources/app.js +0 -21
- package/resources/app.js.map +0 -1
- package/resources/app.mjs +0 -17
- package/resources/app.mjs.map +0 -1
- package/resources/config.d.mts +0 -318
- package/resources/config.d.mts.map +0 -1
- package/resources/config.d.ts +0 -318
- package/resources/config.d.ts.map +0 -1
- package/resources/config.js +0 -21
- package/resources/config.js.map +0 -1
- package/resources/config.mjs +0 -17
- package/resources/config.mjs.map +0 -1
- package/resources/file.d.mts +0 -33
- package/resources/file.d.mts.map +0 -1
- package/resources/file.d.ts +0 -33
- package/resources/file.d.ts.map +0 -1
- package/resources/file.js +0 -21
- package/resources/file.js.map +0 -1
- package/resources/file.mjs +0 -17
- package/resources/file.mjs.map +0 -1
- package/resources/find.d.mts +0 -60
- package/resources/find.d.mts.map +0 -1
- package/resources/find.d.ts +0 -60
- package/resources/find.d.ts.map +0 -1
- package/resources/find.js +0 -27
- package/resources/find.js.map +0 -1
- package/resources/find.mjs +0 -23
- package/resources/find.mjs.map +0 -1
- package/resources/session.d.mts +0 -215
- package/resources/session.d.mts.map +0 -1
- package/resources/session.d.ts +0 -215
- package/resources/session.d.ts.map +0 -1
- package/resources/session.js +0 -70
- package/resources/session.js.map +0 -1
- package/resources/session.mjs +0 -66
- package/resources/session.mjs.map +0 -1
- package/resources/shared.d.mts +0 -20
- package/resources/shared.d.mts.map +0 -1
- package/resources/shared.d.ts +0 -20
- package/resources/shared.d.ts.map +0 -1
- package/resources/shared.js +0 -4
- package/resources/shared.js.map +0 -1
- package/resources/shared.mjs +0 -3
- package/resources/shared.mjs.map +0 -1
- package/src/core/streaming.ts +0 -301
- package/src/internal/decoders/line.ts +0 -135
- package/src/resources/app.ts +0 -57
- package/src/resources/config.ts +0 -409
- package/src/resources/file.ts +0 -53
- package/src/resources/find.ts +0 -95
- package/src/resources/session.ts +0 -369
- package/src/resources/shared.ts +0 -27
- package/src/streaming.ts +0 -2
- package/streaming.d.mts +0 -2
- package/streaming.d.mts.map +0 -1
- package/streaming.d.ts +0 -2
- package/streaming.d.ts.map +0 -1
- package/streaming.js +0 -6
- package/streaming.js.map +0 -1
- package/streaming.mjs +0 -2
- package/streaming.mjs.map +0 -1
package/src/client.ts
CHANGED
|
@@ -16,52 +16,42 @@ import * as Errors from './core/error';
|
|
|
16
16
|
import * as Uploads from './core/uploads';
|
|
17
17
|
import * as API from './resources/index';
|
|
18
18
|
import { APIPromise } from './core/api-promise';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
ConfigProvidersResponse,
|
|
23
|
-
ConfigResource,
|
|
24
|
-
Keybinds,
|
|
25
|
-
McpLocal,
|
|
26
|
-
McpRemote,
|
|
27
|
-
Model,
|
|
28
|
-
Provider,
|
|
29
|
-
} from './resources/config';
|
|
19
|
+
import { AppInfo, AppInfoCreateResponse } from './resources/app-info';
|
|
20
|
+
import { AppInitialize, AppInitializeInitializeResponse } from './resources/app-initialize';
|
|
21
|
+
import { ConfigGet, ConfigGetRetrieveResponse } from './resources/config-get';
|
|
30
22
|
import { Event, EventListResponse } from './resources/event';
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
FindSymbolsParams,
|
|
37
|
-
FindSymbolsResponse,
|
|
38
|
-
FindTextParams,
|
|
39
|
-
FindTextResponse,
|
|
40
|
-
} from './resources/find';
|
|
23
|
+
import { FileSearch, FileSearchSearchParams, FileSearchSearchResponse } from './resources/file-search';
|
|
24
|
+
import { InstallationInfo, InstallationInfoCreateResponse } from './resources/installation-info';
|
|
25
|
+
import { PathGet, PathGetCreateResponse } from './resources/path-get';
|
|
26
|
+
import { ProviderList, ProviderListCreateResponse } from './resources/provider-list';
|
|
27
|
+
import { SessionAbort, SessionAbortAbortParams, SessionAbortAbortResponse } from './resources/session-abort';
|
|
41
28
|
import {
|
|
42
|
-
|
|
43
|
-
Message,
|
|
29
|
+
MessageInfo,
|
|
44
30
|
MessagePart,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
31
|
+
ProviderAuthError,
|
|
32
|
+
SessionChat,
|
|
33
|
+
SessionChatCreateParams,
|
|
34
|
+
UnknownError,
|
|
35
|
+
} from './resources/session-chat';
|
|
36
|
+
import { SessionCreate, SessionInfo } from './resources/session-create';
|
|
37
|
+
import {
|
|
38
|
+
SessionInitialize,
|
|
39
|
+
SessionInitializeCreateParams,
|
|
40
|
+
SessionInitializeCreateResponse,
|
|
41
|
+
} from './resources/session-initialize';
|
|
42
|
+
import { SessionList, SessionListCreateResponse } from './resources/session-list';
|
|
43
|
+
import {
|
|
44
|
+
SessionMessageCreateParams,
|
|
45
|
+
SessionMessageCreateResponse,
|
|
46
|
+
SessionMessages,
|
|
47
|
+
} from './resources/session-messages';
|
|
48
|
+
import { SessionShare, SessionShareCreateParams } from './resources/session-share';
|
|
49
|
+
import {
|
|
50
|
+
SessionSummarize,
|
|
51
|
+
SessionSummarizeSummarizeParams,
|
|
52
|
+
SessionSummarizeSummarizeResponse,
|
|
53
|
+
} from './resources/session-summarize';
|
|
54
|
+
import { SessionUnshare, SessionUnshareUnshareParams } from './resources/session-unshare';
|
|
65
55
|
import { type Fetch } from './internal/builtin-types';
|
|
66
56
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
67
57
|
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
@@ -728,78 +718,110 @@ export class Opencode {
|
|
|
728
718
|
static toFile = Uploads.toFile;
|
|
729
719
|
|
|
730
720
|
event: API.Event = new API.Event(this);
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
721
|
+
appInfo: API.AppInfo = new API.AppInfo(this);
|
|
722
|
+
configGet: API.ConfigGet = new API.ConfigGet(this);
|
|
723
|
+
appInitialize: API.AppInitialize = new API.AppInitialize(this);
|
|
724
|
+
sessionInitialize: API.SessionInitialize = new API.SessionInitialize(this);
|
|
725
|
+
pathGet: API.PathGet = new API.PathGet(this);
|
|
726
|
+
sessionCreate: API.SessionCreate = new API.SessionCreate(this);
|
|
727
|
+
sessionShare: API.SessionShare = new API.SessionShare(this);
|
|
728
|
+
sessionUnshare: API.SessionUnshare = new API.SessionUnshare(this);
|
|
729
|
+
sessionMessages: API.SessionMessages = new API.SessionMessages(this);
|
|
730
|
+
sessionList: API.SessionList = new API.SessionList(this);
|
|
731
|
+
sessionAbort: API.SessionAbort = new API.SessionAbort(this);
|
|
732
|
+
sessionSummarize: API.SessionSummarize = new API.SessionSummarize(this);
|
|
733
|
+
sessionChat: API.SessionChat = new API.SessionChat(this);
|
|
734
|
+
providerList: API.ProviderList = new API.ProviderList(this);
|
|
735
|
+
fileSearch: API.FileSearch = new API.FileSearch(this);
|
|
736
|
+
installationInfo: API.InstallationInfo = new API.InstallationInfo(this);
|
|
736
737
|
}
|
|
737
738
|
Opencode.Event = Event;
|
|
738
|
-
Opencode.
|
|
739
|
-
Opencode.
|
|
740
|
-
Opencode.
|
|
741
|
-
Opencode.
|
|
742
|
-
Opencode.
|
|
739
|
+
Opencode.AppInfo = AppInfo;
|
|
740
|
+
Opencode.ConfigGet = ConfigGet;
|
|
741
|
+
Opencode.AppInitialize = AppInitialize;
|
|
742
|
+
Opencode.SessionInitialize = SessionInitialize;
|
|
743
|
+
Opencode.PathGet = PathGet;
|
|
744
|
+
Opencode.SessionCreate = SessionCreate;
|
|
745
|
+
Opencode.SessionShare = SessionShare;
|
|
746
|
+
Opencode.SessionUnshare = SessionUnshare;
|
|
747
|
+
Opencode.SessionMessages = SessionMessages;
|
|
748
|
+
Opencode.SessionList = SessionList;
|
|
749
|
+
Opencode.SessionAbort = SessionAbort;
|
|
750
|
+
Opencode.SessionSummarize = SessionSummarize;
|
|
751
|
+
Opencode.SessionChat = SessionChat;
|
|
752
|
+
Opencode.ProviderList = ProviderList;
|
|
753
|
+
Opencode.FileSearch = FileSearch;
|
|
754
|
+
Opencode.InstallationInfo = InstallationInfo;
|
|
743
755
|
export declare namespace Opencode {
|
|
744
756
|
export type RequestOptions = Opts.RequestOptions;
|
|
745
757
|
|
|
746
758
|
export { Event as Event, type EventListResponse as EventListResponse };
|
|
747
759
|
|
|
748
|
-
export {
|
|
760
|
+
export { AppInfo as AppInfo, type AppInfoCreateResponse as AppInfoCreateResponse };
|
|
761
|
+
|
|
762
|
+
export { ConfigGet as ConfigGet, type ConfigGetRetrieveResponse as ConfigGetRetrieveResponse };
|
|
749
763
|
|
|
750
764
|
export {
|
|
751
|
-
|
|
752
|
-
type
|
|
753
|
-
type FindSymbolsResponse as FindSymbolsResponse,
|
|
754
|
-
type FindTextResponse as FindTextResponse,
|
|
755
|
-
type FindFilesParams as FindFilesParams,
|
|
756
|
-
type FindSymbolsParams as FindSymbolsParams,
|
|
757
|
-
type FindTextParams as FindTextParams,
|
|
765
|
+
AppInitialize as AppInitialize,
|
|
766
|
+
type AppInitializeInitializeResponse as AppInitializeInitializeResponse,
|
|
758
767
|
};
|
|
759
768
|
|
|
760
769
|
export {
|
|
761
|
-
|
|
762
|
-
type
|
|
763
|
-
type
|
|
764
|
-
|
|
770
|
+
SessionInitialize as SessionInitialize,
|
|
771
|
+
type SessionInitializeCreateResponse as SessionInitializeCreateResponse,
|
|
772
|
+
type SessionInitializeCreateParams as SessionInitializeCreateParams,
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
export { PathGet as PathGet, type PathGetCreateResponse as PathGetCreateResponse };
|
|
776
|
+
|
|
777
|
+
export { SessionCreate as SessionCreate, type SessionInfo as SessionInfo };
|
|
778
|
+
|
|
779
|
+
export { SessionShare as SessionShare, type SessionShareCreateParams as SessionShareCreateParams };
|
|
780
|
+
|
|
781
|
+
export {
|
|
782
|
+
SessionUnshare as SessionUnshare,
|
|
783
|
+
type SessionUnshareUnshareParams as SessionUnshareUnshareParams,
|
|
765
784
|
};
|
|
766
785
|
|
|
767
786
|
export {
|
|
768
|
-
|
|
769
|
-
type
|
|
770
|
-
type
|
|
771
|
-
type McpLocal as McpLocal,
|
|
772
|
-
type McpRemote as McpRemote,
|
|
773
|
-
type Model as Model,
|
|
774
|
-
type Provider as Provider,
|
|
775
|
-
type ConfigProvidersResponse as ConfigProvidersResponse,
|
|
787
|
+
SessionMessages as SessionMessages,
|
|
788
|
+
type SessionMessageCreateResponse as SessionMessageCreateResponse,
|
|
789
|
+
type SessionMessageCreateParams as SessionMessageCreateParams,
|
|
776
790
|
};
|
|
777
791
|
|
|
792
|
+
export { SessionList as SessionList, type SessionListCreateResponse as SessionListCreateResponse };
|
|
793
|
+
|
|
778
794
|
export {
|
|
779
|
-
|
|
780
|
-
type
|
|
781
|
-
type
|
|
795
|
+
SessionAbort as SessionAbort,
|
|
796
|
+
type SessionAbortAbortResponse as SessionAbortAbortResponse,
|
|
797
|
+
type SessionAbortAbortParams as SessionAbortAbortParams,
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
export {
|
|
801
|
+
SessionSummarize as SessionSummarize,
|
|
802
|
+
type SessionSummarizeSummarizeResponse as SessionSummarizeSummarizeResponse,
|
|
803
|
+
type SessionSummarizeSummarizeParams as SessionSummarizeSummarizeParams,
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
export {
|
|
807
|
+
SessionChat as SessionChat,
|
|
808
|
+
type MessageInfo as MessageInfo,
|
|
782
809
|
type MessagePart as MessagePart,
|
|
783
|
-
type
|
|
784
|
-
type
|
|
785
|
-
type
|
|
786
|
-
type StepStartPart as StepStartPart,
|
|
787
|
-
type TextPart as TextPart,
|
|
788
|
-
type ToolCall as ToolCall,
|
|
789
|
-
type ToolInvocationPart as ToolInvocationPart,
|
|
790
|
-
type ToolPartialCall as ToolPartialCall,
|
|
791
|
-
type ToolResult as ToolResult,
|
|
792
|
-
type SessionListResponse as SessionListResponse,
|
|
793
|
-
type SessionDeleteResponse as SessionDeleteResponse,
|
|
794
|
-
type SessionAbortResponse as SessionAbortResponse,
|
|
795
|
-
type SessionInitResponse as SessionInitResponse,
|
|
796
|
-
type SessionMessagesResponse as SessionMessagesResponse,
|
|
797
|
-
type SessionSummarizeResponse as SessionSummarizeResponse,
|
|
798
|
-
type SessionChatParams as SessionChatParams,
|
|
799
|
-
type SessionInitParams as SessionInitParams,
|
|
800
|
-
type SessionSummarizeParams as SessionSummarizeParams,
|
|
810
|
+
type ProviderAuthError as ProviderAuthError,
|
|
811
|
+
type UnknownError as UnknownError,
|
|
812
|
+
type SessionChatCreateParams as SessionChatCreateParams,
|
|
801
813
|
};
|
|
802
814
|
|
|
803
|
-
export type
|
|
804
|
-
|
|
815
|
+
export { ProviderList as ProviderList, type ProviderListCreateResponse as ProviderListCreateResponse };
|
|
816
|
+
|
|
817
|
+
export {
|
|
818
|
+
FileSearch as FileSearch,
|
|
819
|
+
type FileSearchSearchResponse as FileSearchSearchResponse,
|
|
820
|
+
type FileSearchSearchParams as FileSearchSearchParams,
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
export {
|
|
824
|
+
InstallationInfo as InstallationInfo,
|
|
825
|
+
type InstallationInfoCreateResponse as InstallationInfoCreateResponse,
|
|
826
|
+
};
|
|
805
827
|
}
|
package/src/internal/parse.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import type { FinalRequestOptions } from './request-options';
|
|
4
|
-
import { Stream } from '../core/streaming';
|
|
5
4
|
import { type Opencode } from '../client';
|
|
6
5
|
import { formatRequestDetails, loggerFor } from './utils/log';
|
|
7
6
|
|
|
@@ -17,19 +16,6 @@ export type APIResponseProps = {
|
|
|
17
16
|
export async function defaultParseResponse<T>(client: Opencode, props: APIResponseProps): Promise<T> {
|
|
18
17
|
const { response, requestLogID, retryOfRequestLogID, startTime } = props;
|
|
19
18
|
const body = await (async () => {
|
|
20
|
-
if (props.options.stream) {
|
|
21
|
-
loggerFor(client).debug('response', response.status, response.url, response.headers, response.body);
|
|
22
|
-
|
|
23
|
-
// Note: there is an invariant here that isn't represented in the type system
|
|
24
|
-
// that if you set `stream: true` the response type must also be `Stream<T>`
|
|
25
|
-
|
|
26
|
-
if (props.options.__streamClass) {
|
|
27
|
-
return props.options.__streamClass.fromSSEResponse(response, props.controller) as any;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return Stream.fromSSEResponse(response, props.controller) as any;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
19
|
// fetch refuses to read the body when the status code is 204.
|
|
34
20
|
if (response.status === 204) {
|
|
35
21
|
return null as T;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { NullableHeaders } from './headers';
|
|
4
4
|
|
|
5
5
|
import type { BodyInit } from './builtin-types';
|
|
6
|
-
import { Stream } from '../core/streaming';
|
|
7
6
|
import type { HTTPMethod, MergedRequestInit } from './types';
|
|
8
7
|
import { type HeadersLike } from './headers';
|
|
9
8
|
|
|
@@ -24,7 +23,6 @@ export type RequestOptions = {
|
|
|
24
23
|
defaultBaseURL?: string | undefined;
|
|
25
24
|
|
|
26
25
|
__binaryResponse?: boolean | undefined;
|
|
27
|
-
__streamClass?: typeof Stream;
|
|
28
26
|
};
|
|
29
27
|
|
|
30
28
|
export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit };
|
package/src/internal/types.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
|
|
7
7
|
|
|
8
8
|
export type FinalizedRequestInit = RequestInit & { headers: Headers };
|
|
9
9
|
|
|
10
|
-
type NotAny<T> = [
|
|
10
|
+
type NotAny<T> = [unknown] extends [T] ? never : T;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Some environments overload the global fetch function, and Parameters<T> only gets the last signature.
|
|
@@ -64,15 +64,13 @@ type OverloadedParameters<T> =
|
|
|
64
64
|
* [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
|
|
65
65
|
*/
|
|
66
66
|
/** @ts-ignore For users with \@types/node */
|
|
67
|
-
type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types
|
|
67
|
+
type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types').RequestInit> | NotAny<import('../../node_modules/undici-types').RequestInit> | NotAny<import('../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types').RequestInit>;
|
|
68
68
|
/** @ts-ignore For users with undici */
|
|
69
|
-
type UndiciRequestInit = NotAny<import('../node_modules/undici
|
|
69
|
+
type UndiciRequestInit = NotAny<import('../node_modules/undici').RequestInit> | NotAny<import('../../node_modules/undici').RequestInit> | NotAny<import('../../../node_modules/undici').RequestInit> | NotAny<import('../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici').RequestInit>;
|
|
70
70
|
/** @ts-ignore For users with \@types/bun */
|
|
71
71
|
type BunRequestInit = globalThis.FetchRequestInit;
|
|
72
|
-
/** @ts-ignore For users with node-fetch
|
|
73
|
-
type
|
|
74
|
-
/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
|
|
75
|
-
type NodeFetch3RequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
|
|
72
|
+
/** @ts-ignore For users with node-fetch */
|
|
73
|
+
type NodeFetchRequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
|
|
76
74
|
/** @ts-ignore For users who use Deno */
|
|
77
75
|
type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
|
|
78
76
|
/* eslint-enable */
|
|
@@ -81,8 +79,7 @@ type RequestInits =
|
|
|
81
79
|
| NotAny<UndiciTypesRequestInit>
|
|
82
80
|
| NotAny<UndiciRequestInit>
|
|
83
81
|
| NotAny<BunRequestInit>
|
|
84
|
-
| NotAny<
|
|
85
|
-
| NotAny<NodeFetch3RequestInit>
|
|
82
|
+
| NotAny<NodeFetchRequestInit>
|
|
86
83
|
| NotAny<RequestInit>
|
|
87
84
|
| NotAny<FetchRequestInit>;
|
|
88
85
|
|
package/src/internal/uploads.ts
CHANGED
|
@@ -90,7 +90,7 @@ export const multipartFormRequestOptions = async (
|
|
|
90
90
|
return { ...opts, body: await createForm(opts.body, fetch) };
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
const supportsFormDataMap =
|
|
93
|
+
const supportsFormDataMap = /** @__PURE__ */ new WeakMap<Fetch, Promise<boolean>>();
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* node-fetch doesn't support the global FormData object in recent node versions. Instead of sending
|
|
@@ -58,7 +58,7 @@ const noopLogger = {
|
|
|
58
58
|
debug: noop,
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
let cachedLoggers =
|
|
61
|
+
let cachedLoggers = /** @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();
|
|
62
62
|
|
|
63
63
|
export function loggerFor(client: Opencode): Logger {
|
|
64
64
|
const logger = client.logger;
|
|
@@ -12,43 +12,25 @@ export function encodeURIPath(str: string) {
|
|
|
12
12
|
return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
16
|
-
|
|
17
15
|
export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
|
|
18
16
|
function path(statics: readonly string[], ...params: readonly unknown[]): string {
|
|
19
17
|
// If there are no params, no processing is needed.
|
|
20
18
|
if (statics.length === 1) return statics[0]!;
|
|
21
19
|
|
|
22
20
|
let postPath = false;
|
|
23
|
-
const invalidSegments = [];
|
|
24
21
|
const path = statics.reduce((previousValue, currentValue, index) => {
|
|
25
22
|
if (/[?#]/.test(currentValue)) {
|
|
26
23
|
postPath = true;
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
index
|
|
32
|
-
|
|
33
|
-
(typeof value === 'object' &&
|
|
34
|
-
// handle values from other realms
|
|
35
|
-
value.toString ===
|
|
36
|
-
Object.getPrototypeOf(Object.getPrototypeOf((value as any).hasOwnProperty ?? EMPTY) ?? EMPTY)
|
|
37
|
-
?.toString))
|
|
38
|
-
) {
|
|
39
|
-
encoded = value + '';
|
|
40
|
-
invalidSegments.push({
|
|
41
|
-
start: previousValue.length + currentValue.length,
|
|
42
|
-
length: encoded.length,
|
|
43
|
-
error: `Value of type ${Object.prototype.toString
|
|
44
|
-
.call(value)
|
|
45
|
-
.slice(8, -1)} is not a valid path parameter`,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return previousValue + currentValue + (index === params.length ? '' : encoded);
|
|
25
|
+
return (
|
|
26
|
+
previousValue +
|
|
27
|
+
currentValue +
|
|
28
|
+
(index === params.length ? '' : (postPath ? encodeURIComponent : pathEncoder)(String(params[index])))
|
|
29
|
+
);
|
|
49
30
|
}, '');
|
|
50
31
|
|
|
51
32
|
const pathOnly = path.split(/[?#]/, 1)[0]!;
|
|
33
|
+
const invalidSegments = [];
|
|
52
34
|
const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
53
35
|
let match;
|
|
54
36
|
|
|
@@ -57,12 +39,9 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
|
|
|
57
39
|
invalidSegments.push({
|
|
58
40
|
start: match.index,
|
|
59
41
|
length: match[0].length,
|
|
60
|
-
error: `Value "${match[0]}" can\'t be safely passed as a path parameter`,
|
|
61
42
|
});
|
|
62
43
|
}
|
|
63
44
|
|
|
64
|
-
invalidSegments.sort((a, b) => a.start - b.start);
|
|
65
|
-
|
|
66
45
|
if (invalidSegments.length > 0) {
|
|
67
46
|
let lastEnd = 0;
|
|
68
47
|
const underline = invalidSegments.reduce((acc, segment) => {
|
|
@@ -72,11 +51,7 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
|
|
|
72
51
|
return acc + spaces + arrows;
|
|
73
52
|
}, '');
|
|
74
53
|
|
|
75
|
-
throw new OpencodeError(
|
|
76
|
-
`Path parameters result in path with invalid segments:\n${invalidSegments
|
|
77
|
-
.map((e) => e.error)
|
|
78
|
-
.join('\n')}\n${path}\n${underline}`,
|
|
79
|
-
);
|
|
54
|
+
throw new OpencodeError(`Path parameters result in path with invalid segments:\n${path}\n${underline}`);
|
|
80
55
|
}
|
|
81
56
|
|
|
82
57
|
return path;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
|
|
7
|
+
export class AppInfo extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Get app info
|
|
10
|
+
*/
|
|
11
|
+
create(options?: RequestOptions): APIPromise<AppInfoCreateResponse> {
|
|
12
|
+
return this._client.post('/app_info', options);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface AppInfoCreateResponse {
|
|
17
|
+
git: boolean;
|
|
18
|
+
|
|
19
|
+
path: AppInfoCreateResponse.Path;
|
|
20
|
+
|
|
21
|
+
time: AppInfoCreateResponse.Time;
|
|
22
|
+
|
|
23
|
+
user: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export namespace AppInfoCreateResponse {
|
|
27
|
+
export interface Path {
|
|
28
|
+
config: string;
|
|
29
|
+
|
|
30
|
+
cwd: string;
|
|
31
|
+
|
|
32
|
+
data: string;
|
|
33
|
+
|
|
34
|
+
root: string;
|
|
35
|
+
|
|
36
|
+
state: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface Time {
|
|
40
|
+
initialized?: number;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare namespace AppInfo {
|
|
45
|
+
export { type AppInfoCreateResponse as AppInfoCreateResponse };
|
|
46
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
|
|
7
|
+
export class AppInitialize extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Initialize the app
|
|
10
|
+
*/
|
|
11
|
+
initialize(options?: RequestOptions): APIPromise<AppInitializeInitializeResponse> {
|
|
12
|
+
return this._client.post('/app_initialize', options);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type AppInitializeInitializeResponse = boolean;
|
|
17
|
+
|
|
18
|
+
export declare namespace AppInitialize {
|
|
19
|
+
export { type AppInitializeInitializeResponse as AppInitializeInitializeResponse };
|
|
20
|
+
}
|