Skip to content

Commit efe5d7f

Browse files
feat(api): api update
1 parent fb92736 commit efe5d7f

6 files changed

Lines changed: 39 additions & 7 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 23
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-04eaffcca7fcec3eba3c34ba4e91ba830867173c552015a0abfd65e25084d9b5.yml
3-
openapi_spec_hash: 4dfbcc2ce25451592f610e372ecad0cb
1+
configured_endpoints: 24
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-d10809ab68e48a338167e5504d69db2a0a80739adf6ecd3f065644a4139bc374.yml
3+
openapi_spec_hash: 4875565ef8df3446dbab11f450e04c51
44
config_hash: 0032a76356d31c6b4c218b39fff635bb

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,10 @@ Methods:
129129

130130
Types:
131131

132+
- <code><a href="./src/resources/tui.ts">TuiOpenHelpResponse</a></code>
132133
- <code><a href="./src/resources/tui.ts">TuiPromptResponse</a></code>
133134

134135
Methods:
135136

137+
- <code title="post /tui/open-help">client.tui.<a href="./src/resources/tui.ts">openHelp</a>() -> TuiOpenHelpResponse</code>
136138
- <code title="post /tui/prompt">client.tui.<a href="./src/resources/tui.ts">prompt</a>({ ...params }) -> TuiPromptResponse</code>

src/client.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ import {
8282
ToolStateRunning,
8383
UserMessage,
8484
} from './resources/session';
85-
import { Tui, TuiPromptParams, TuiPromptResponse } from './resources/tui';
85+
import { Tui, TuiOpenHelpResponse, TuiPromptParams, TuiPromptResponse } from './resources/tui';
8686
import { type Fetch } from './internal/builtin-types';
8787
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
8888
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -849,7 +849,12 @@ export declare namespace Opencode {
849849
type SessionSummarizeParams as SessionSummarizeParams,
850850
};
851851

852-
export { Tui as Tui, type TuiPromptResponse as TuiPromptResponse, type TuiPromptParams as TuiPromptParams };
852+
export {
853+
Tui as Tui,
854+
type TuiOpenHelpResponse as TuiOpenHelpResponse,
855+
type TuiPromptResponse as TuiPromptResponse,
856+
type TuiPromptParams as TuiPromptParams,
857+
};
853858

854859
export type MessageAbortedError = API.MessageAbortedError;
855860
export type ProviderAuthError = API.ProviderAuthError;

src/resources/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ export {
7373
type SessionInitParams,
7474
type SessionSummarizeParams,
7575
} from './session';
76-
export { Tui, type TuiPromptResponse, type TuiPromptParams } from './tui';
76+
export { Tui, type TuiOpenHelpResponse, type TuiPromptResponse, type TuiPromptParams } from './tui';

src/resources/tui.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ import { APIPromise } from '../core/api-promise';
66
import { RequestOptions } from '../internal/request-options';
77

88
export class Tui extends APIResource {
9+
/**
10+
* Open the help dialog
11+
*/
12+
openHelp(options?: RequestOptions): APIPromise<TuiOpenHelpResponse> {
13+
return this._client.post('/tui/open-help', options);
14+
}
15+
916
/**
1017
* Send a prompt to the TUI
1118
*/
@@ -14,6 +21,8 @@ export class Tui extends APIResource {
1421
}
1522
}
1623

24+
export type TuiOpenHelpResponse = boolean;
25+
1726
export type TuiPromptResponse = boolean;
1827

1928
export interface TuiPromptParams {
@@ -23,5 +32,9 @@ export interface TuiPromptParams {
2332
}
2433

2534
export declare namespace Tui {
26-
export { type TuiPromptResponse as TuiPromptResponse, type TuiPromptParams as TuiPromptParams };
35+
export {
36+
type TuiOpenHelpResponse as TuiOpenHelpResponse,
37+
type TuiPromptResponse as TuiPromptResponse,
38+
type TuiPromptParams as TuiPromptParams,
39+
};
2740
}

tests/api-resources/tui.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ import Opencode from '@opencode-ai/sdk';
55
const client = new Opencode({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
66

77
describe('resource tui', () => {
8+
// skipped: tests are disabled for the time being
9+
test.skip('openHelp', async () => {
10+
const responsePromise = client.tui.openHelp();
11+
const rawResponse = await responsePromise.asResponse();
12+
expect(rawResponse).toBeInstanceOf(Response);
13+
const response = await responsePromise;
14+
expect(response).not.toBeInstanceOf(Response);
15+
const dataAndResponse = await responsePromise.withResponse();
16+
expect(dataAndResponse.data).toBe(response);
17+
expect(dataAndResponse.response).toBe(rawResponse);
18+
});
19+
820
// skipped: tests are disabled for the time being
921
test.skip('prompt: only required params', async () => {
1022
const responsePromise = client.tui.prompt({

0 commit comments

Comments
 (0)