Skip to content

Commit 8980631

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

File tree

7 files changed

+48
-49
lines changed

7 files changed

+48
-49
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 24
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-d10809ab68e48a338167e5504d69db2a0a80739adf6ecd3f065644a4139bc374.yml
3-
openapi_spec_hash: 4875565ef8df3446dbab11f450e04c51
4-
config_hash: 0032a76356d31c6b4c218b39fff635bb
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-7f559270c87d0cbb6779d0edd57a2efcb4d60932674cea4444c40cd4e7b72569.yml
3+
openapi_spec_hash: 531acdc4f16185743ec56b3e07857cde
4+
config_hash: 6d92d798d44906c9e43c6dee06615360

api.md

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

130130
Types:
131131

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

135135
Methods:
136136

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

src/client.ts

Lines changed: 3 additions & 3 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, TuiOpenHelpResponse, TuiPromptParams, TuiPromptResponse } from './resources/tui';
85+
import { Tui, TuiAppendPromptParams, TuiAppendPromptResponse, TuiOpenHelpResponse } 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';
@@ -851,9 +851,9 @@ export declare namespace Opencode {
851851

852852
export {
853853
Tui as Tui,
854+
type TuiAppendPromptResponse as TuiAppendPromptResponse,
854855
type TuiOpenHelpResponse as TuiOpenHelpResponse,
855-
type TuiPromptResponse as TuiPromptResponse,
856-
type TuiPromptParams as TuiPromptParams,
856+
type TuiAppendPromptParams as TuiAppendPromptParams,
857857
};
858858

859859
export type MessageAbortedError = API.MessageAbortedError;

src/resources/event.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export type EventListResponse =
2929
| EventListResponse.EventSessionDeleted
3030
| EventListResponse.EventSessionIdle
3131
| EventListResponse.EventSessionError
32-
| EventListResponse.EventFileWatcherUpdated;
32+
| EventListResponse.EventFileWatcherUpdated
33+
| EventListResponse.EventIdeInstalled;
3334

3435
export namespace EventListResponse {
3536
export interface EventLspClientDiagnostics {
@@ -223,6 +224,18 @@ export namespace EventListResponse {
223224
file: string;
224225
}
225226
}
227+
228+
export interface EventIdeInstalled {
229+
properties: EventIdeInstalled.Properties;
230+
231+
type: 'ide.installed';
232+
}
233+
234+
export namespace EventIdeInstalled {
235+
export interface Properties {
236+
ide: string;
237+
}
238+
}
226239
}
227240

228241
export declare namespace Event {

src/resources/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,9 @@ export {
7373
type SessionInitParams,
7474
type SessionSummarizeParams,
7575
} from './session';
76-
export { Tui, type TuiOpenHelpResponse, type TuiPromptResponse, type TuiPromptParams } from './tui';
76+
export {
77+
Tui,
78+
type TuiAppendPromptResponse,
79+
type TuiOpenHelpResponse,
80+
type TuiAppendPromptParams,
81+
} from './tui';

src/resources/tui.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
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';
54
import { APIPromise } from '../core/api-promise';
65
import { RequestOptions } from '../internal/request-options';
76

87
export class Tui extends APIResource {
98
/**
10-
* Open the help dialog
9+
* Append prompt to the TUI
1110
*/
12-
openHelp(options?: RequestOptions): APIPromise<TuiOpenHelpResponse> {
13-
return this._client.post('/tui/open-help', options);
11+
appendPrompt(body: TuiAppendPromptParams, options?: RequestOptions): APIPromise<TuiAppendPromptResponse> {
12+
return this._client.post('/tui/append-prompt', { body, ...options });
1413
}
1514

1615
/**
17-
* Send a prompt to the TUI
16+
* Open the help dialog
1817
*/
19-
prompt(body: TuiPromptParams, options?: RequestOptions): APIPromise<TuiPromptResponse> {
20-
return this._client.post('/tui/prompt', { body, ...options });
18+
openHelp(options?: RequestOptions): APIPromise<TuiOpenHelpResponse> {
19+
return this._client.post('/tui/open-help', options);
2120
}
2221
}
2322

24-
export type TuiOpenHelpResponse = boolean;
25-
26-
export type TuiPromptResponse = boolean;
23+
export type TuiAppendPromptResponse = boolean;
2724

28-
export interface TuiPromptParams {
29-
parts: Array<SessionAPI.Part>;
25+
export type TuiOpenHelpResponse = boolean;
3026

27+
export interface TuiAppendPromptParams {
3128
text: string;
3229
}
3330

3431
export declare namespace Tui {
3532
export {
33+
type TuiAppendPromptResponse as TuiAppendPromptResponse,
3634
type TuiOpenHelpResponse as TuiOpenHelpResponse,
37-
type TuiPromptResponse as TuiPromptResponse,
38-
type TuiPromptParams as TuiPromptParams,
35+
type TuiAppendPromptParams as TuiAppendPromptParams,
3936
};
4037
}

tests/api-resources/tui.test.ts

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ 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('openHelp', async () => {
10-
const responsePromise = client.tui.openHelp();
9+
test.skip('appendPrompt: only required params', async () => {
10+
const responsePromise = client.tui.appendPrompt({ text: 'text' });
1111
const rawResponse = await responsePromise.asResponse();
1212
expect(rawResponse).toBeInstanceOf(Response);
1313
const response = await responsePromise;
@@ -18,11 +18,13 @@ describe('resource tui', () => {
1818
});
1919

2020
// skipped: tests are disabled for the time being
21-
test.skip('prompt: only required params', async () => {
22-
const responsePromise = client.tui.prompt({
23-
parts: [{ id: 'id', messageID: 'messageID', sessionID: 'sessionID', text: 'text', type: 'text' }],
24-
text: 'text',
25-
});
21+
test.skip('appendPrompt: required and optional params', async () => {
22+
const response = await client.tui.appendPrompt({ text: 'text' });
23+
});
24+
25+
// skipped: tests are disabled for the time being
26+
test.skip('openHelp', async () => {
27+
const responsePromise = client.tui.openHelp();
2628
const rawResponse = await responsePromise.asResponse();
2729
expect(rawResponse).toBeInstanceOf(Response);
2830
const response = await responsePromise;
@@ -31,22 +33,4 @@ describe('resource tui', () => {
3133
expect(dataAndResponse.data).toBe(response);
3234
expect(dataAndResponse.response).toBe(rawResponse);
3335
});
34-
35-
// skipped: tests are disabled for the time being
36-
test.skip('prompt: required and optional params', async () => {
37-
const response = await client.tui.prompt({
38-
parts: [
39-
{
40-
id: 'id',
41-
messageID: 'messageID',
42-
sessionID: 'sessionID',
43-
text: 'text',
44-
type: 'text',
45-
synthetic: true,
46-
time: { start: 0, end: 0 },
47-
},
48-
],
49-
text: 'text',
50-
});
51-
});
5236
});

0 commit comments

Comments
 (0)