Skip to content

Commit fb92736

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

File tree

6 files changed

+39
-11
lines changed

6 files changed

+39
-11
lines changed

.stats.yml

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

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ Types:
133133

134134
Methods:
135135

136-
- <code title="post /tui/prompt">client.tui.<a href="./src/resources/tui.ts">prompt</a>() -> TuiPromptResponse</code>
136+
- <code title="post /tui/prompt">client.tui.<a href="./src/resources/tui.ts">prompt</a>({ ...params }) -> TuiPromptResponse</code>

src/client.ts

Lines changed: 2 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, TuiPromptResponse } from './resources/tui';
85+
import { Tui, 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,7 @@ export declare namespace Opencode {
849849
type SessionSummarizeParams as SessionSummarizeParams,
850850
};
851851

852-
export { Tui as Tui, type TuiPromptResponse as TuiPromptResponse };
852+
export { Tui as Tui, type TuiPromptResponse as TuiPromptResponse, type TuiPromptParams as TuiPromptParams };
853853

854854
export type MessageAbortedError = API.MessageAbortedError;
855855
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 } from './tui';
76+
export { Tui, type TuiPromptResponse, type TuiPromptParams } from './tui';

src/resources/tui.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../core/resource';
4+
import * as SessionAPI from './session';
45
import { APIPromise } from '../core/api-promise';
56
import { RequestOptions } from '../internal/request-options';
67

78
export class Tui extends APIResource {
89
/**
910
* Send a prompt to the TUI
1011
*/
11-
prompt(options?: RequestOptions): APIPromise<TuiPromptResponse> {
12-
return this._client.post('/tui/prompt', options);
12+
prompt(body: TuiPromptParams, options?: RequestOptions): APIPromise<TuiPromptResponse> {
13+
return this._client.post('/tui/prompt', { body, ...options });
1314
}
1415
}
1516

1617
export type TuiPromptResponse = boolean;
1718

19+
export interface TuiPromptParams {
20+
parts: Array<SessionAPI.Part>;
21+
22+
text: string;
23+
}
24+
1825
export declare namespace Tui {
19-
export { type TuiPromptResponse as TuiPromptResponse };
26+
export { type TuiPromptResponse as TuiPromptResponse, type TuiPromptParams as TuiPromptParams };
2027
}

tests/api-resources/tui.test.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ const client = new Opencode({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http
66

77
describe('resource tui', () => {
88
// skipped: tests are disabled for the time being
9-
test.skip('prompt', async () => {
10-
const responsePromise = client.tui.prompt();
9+
test.skip('prompt: only required params', async () => {
10+
const responsePromise = client.tui.prompt({
11+
parts: [{ id: 'id', messageID: 'messageID', sessionID: 'sessionID', text: 'text', type: 'text' }],
12+
text: 'text',
13+
});
1114
const rawResponse = await responsePromise.asResponse();
1215
expect(rawResponse).toBeInstanceOf(Response);
1316
const response = await responsePromise;
@@ -16,4 +19,22 @@ describe('resource tui', () => {
1619
expect(dataAndResponse.data).toBe(response);
1720
expect(dataAndResponse.response).toBe(rawResponse);
1821
});
22+
23+
// skipped: tests are disabled for the time being
24+
test.skip('prompt: required and optional params', async () => {
25+
const response = await client.tui.prompt({
26+
parts: [
27+
{
28+
id: 'id',
29+
messageID: 'messageID',
30+
sessionID: 'sessionID',
31+
text: 'text',
32+
type: 'text',
33+
synthetic: true,
34+
time: { start: 0, end: 0 },
35+
},
36+
],
37+
text: 'text',
38+
});
39+
});
1940
});

0 commit comments

Comments
 (0)