mirror of
https://github.com/sst/opencode.git
synced 2025-08-23 22:44:08 +00:00
wip: permissions
This commit is contained in:
parent
168350c981
commit
a2191ce6fb
11 changed files with 324 additions and 41 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@opencode-ai/sdk",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-202507312003",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./dist/index.js"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { Options as ClientOptions, TDataShape, Client } from './client';
|
||||
import type { EventSubscribeData, EventSubscribeResponses, AppGetData, AppGetResponses, AppInitData, AppInitResponses, ConfigGetData, ConfigGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionDeleteData, SessionDeleteResponses, SessionInitData, SessionInitResponses, SessionAbortData, SessionAbortResponses, SessionUnshareData, SessionUnshareResponses, SessionShareData, SessionShareResponses, SessionSummarizeData, SessionSummarizeResponses, SessionMessagesData, SessionMessagesResponses, SessionChatData, SessionChatResponses, SessionRevertData, SessionRevertResponses, SessionUnrevertData, SessionUnrevertResponses, ConfigProvidersData, ConfigProvidersResponses, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppModesData, AppModesResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiOpenHelpData, TuiOpenHelpResponses } from './types.gen';
|
||||
import type { EventSubscribeData, EventSubscribeResponses, AppGetData, AppGetResponses, AppInitData, AppInitResponses, ConfigGetData, ConfigGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionDeleteData, SessionDeleteResponses, SessionInitData, SessionInitResponses, SessionAbortData, SessionAbortResponses, SessionUnshareData, SessionUnshareResponses, SessionShareData, SessionShareResponses, SessionSummarizeData, SessionSummarizeResponses, SessionMessagesData, SessionMessagesResponses, SessionChatData, SessionChatResponses, SessionMessageData, SessionMessageResponses, SessionRevertData, SessionRevertResponses, SessionUnrevertData, SessionUnrevertResponses, PostSessionByIdPermissionsByPermissionIdData, PostSessionByIdPermissionsByPermissionIdResponses, ConfigProvidersData, ConfigProvidersResponses, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppModesData, AppModesResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses } from './types.gen';
|
||||
import { client as _heyApiClient } from './client.gen';
|
||||
|
||||
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
||||
|
@ -223,6 +223,16 @@ class Session extends _HeyApiClient {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a message from a session
|
||||
*/
|
||||
public message<ThrowOnError extends boolean = false>(options: Options<SessionMessageData, ThrowOnError>) {
|
||||
return (options.client ?? this._client).get<SessionMessageResponses, unknown, ThrowOnError>({
|
||||
url: '/session/{id}/message/{messageID}',
|
||||
...options
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert a message
|
||||
*/
|
||||
|
@ -326,9 +336,86 @@ class Tui extends _HeyApiClient {
|
|||
...options
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the session dialog
|
||||
*/
|
||||
public openSessions<ThrowOnError extends boolean = false>(options?: Options<TuiOpenSessionsData, ThrowOnError>) {
|
||||
return (options?.client ?? this._client).post<TuiOpenSessionsResponses, unknown, ThrowOnError>({
|
||||
url: '/tui/open-sessions',
|
||||
...options
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the theme dialog
|
||||
*/
|
||||
public openThemes<ThrowOnError extends boolean = false>(options?: Options<TuiOpenThemesData, ThrowOnError>) {
|
||||
return (options?.client ?? this._client).post<TuiOpenThemesResponses, unknown, ThrowOnError>({
|
||||
url: '/tui/open-themes',
|
||||
...options
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the model dialog
|
||||
*/
|
||||
public openModels<ThrowOnError extends boolean = false>(options?: Options<TuiOpenModelsData, ThrowOnError>) {
|
||||
return (options?.client ?? this._client).post<TuiOpenModelsResponses, unknown, ThrowOnError>({
|
||||
url: '/tui/open-models',
|
||||
...options
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the prompt
|
||||
*/
|
||||
public submitPrompt<ThrowOnError extends boolean = false>(options?: Options<TuiSubmitPromptData, ThrowOnError>) {
|
||||
return (options?.client ?? this._client).post<TuiSubmitPromptResponses, unknown, ThrowOnError>({
|
||||
url: '/tui/submit-prompt',
|
||||
...options
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the prompt
|
||||
*/
|
||||
public clearPrompt<ThrowOnError extends boolean = false>(options?: Options<TuiClearPromptData, ThrowOnError>) {
|
||||
return (options?.client ?? this._client).post<TuiClearPromptResponses, unknown, ThrowOnError>({
|
||||
url: '/tui/clear-prompt',
|
||||
...options
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a TUI command (e.g. switch_mode)
|
||||
*/
|
||||
public executeCommand<ThrowOnError extends boolean = false>(options?: Options<TuiExecuteCommandData, ThrowOnError>) {
|
||||
return (options?.client ?? this._client).post<TuiExecuteCommandResponses, unknown, ThrowOnError>({
|
||||
url: '/tui/execute-command',
|
||||
...options,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...options?.headers
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class OpencodeClient extends _HeyApiClient {
|
||||
/**
|
||||
* Respond to a permission request
|
||||
*/
|
||||
public postSessionByIdPermissionsByPermissionId<ThrowOnError extends boolean = false>(options: Options<PostSessionByIdPermissionsByPermissionIdData, ThrowOnError>) {
|
||||
return (options.client ?? this._client).post<PostSessionByIdPermissionsByPermissionIdResponses, unknown, ThrowOnError>({
|
||||
url: '/session/{id}/permissions/{permissionID}',
|
||||
...options,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...options.headers
|
||||
}
|
||||
});
|
||||
}
|
||||
event = new Event({ client: this._client });
|
||||
app = new App({ client: this._client });
|
||||
config = new Config({ client: this._client });
|
||||
|
|
|
@ -355,12 +355,16 @@ export type EventStorageWrite = {
|
|||
|
||||
export type EventPermissionUpdated = {
|
||||
type: string;
|
||||
properties: PermissionInfo;
|
||||
properties: Permission;
|
||||
};
|
||||
|
||||
export type PermissionInfo = {
|
||||
export type Permission = {
|
||||
id: string;
|
||||
type: string;
|
||||
pattern?: string;
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
callID?: string;
|
||||
title: string;
|
||||
metadata: {
|
||||
[key: string]: unknown;
|
||||
|
@ -1193,6 +1197,34 @@ export type SessionChatResponses = {
|
|||
|
||||
export type SessionChatResponse = SessionChatResponses[keyof SessionChatResponses];
|
||||
|
||||
export type SessionMessageData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Message ID
|
||||
*/
|
||||
messageID: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/session/{id}/message/{messageID}';
|
||||
};
|
||||
|
||||
export type SessionMessageResponses = {
|
||||
/**
|
||||
* Message
|
||||
*/
|
||||
200: {
|
||||
info: Message;
|
||||
parts: Array<Part>;
|
||||
};
|
||||
};
|
||||
|
||||
export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses];
|
||||
|
||||
export type SessionRevertData = {
|
||||
body?: {
|
||||
messageID: string;
|
||||
|
@ -1232,6 +1264,27 @@ export type SessionUnrevertResponses = {
|
|||
|
||||
export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses];
|
||||
|
||||
export type PostSessionByIdPermissionsByPermissionIdData = {
|
||||
body?: {
|
||||
response: 'once' | 'always' | 'reject';
|
||||
};
|
||||
path: {
|
||||
id: string;
|
||||
permissionID: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/session/{id}/permissions/{permissionID}';
|
||||
};
|
||||
|
||||
export type PostSessionByIdPermissionsByPermissionIdResponses = {
|
||||
/**
|
||||
* Permission processed successfully
|
||||
*/
|
||||
200: boolean;
|
||||
};
|
||||
|
||||
export type PostSessionByIdPermissionsByPermissionIdResponse = PostSessionByIdPermissionsByPermissionIdResponses[keyof PostSessionByIdPermissionsByPermissionIdResponses];
|
||||
|
||||
export type ConfigProvidersData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
|
@ -1445,6 +1498,104 @@ export type TuiOpenHelpResponses = {
|
|||
|
||||
export type TuiOpenHelpResponse = TuiOpenHelpResponses[keyof TuiOpenHelpResponses];
|
||||
|
||||
export type TuiOpenSessionsData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/tui/open-sessions';
|
||||
};
|
||||
|
||||
export type TuiOpenSessionsResponses = {
|
||||
/**
|
||||
* Session dialog opened successfully
|
||||
*/
|
||||
200: boolean;
|
||||
};
|
||||
|
||||
export type TuiOpenSessionsResponse = TuiOpenSessionsResponses[keyof TuiOpenSessionsResponses];
|
||||
|
||||
export type TuiOpenThemesData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/tui/open-themes';
|
||||
};
|
||||
|
||||
export type TuiOpenThemesResponses = {
|
||||
/**
|
||||
* Theme dialog opened successfully
|
||||
*/
|
||||
200: boolean;
|
||||
};
|
||||
|
||||
export type TuiOpenThemesResponse = TuiOpenThemesResponses[keyof TuiOpenThemesResponses];
|
||||
|
||||
export type TuiOpenModelsData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/tui/open-models';
|
||||
};
|
||||
|
||||
export type TuiOpenModelsResponses = {
|
||||
/**
|
||||
* Model dialog opened successfully
|
||||
*/
|
||||
200: boolean;
|
||||
};
|
||||
|
||||
export type TuiOpenModelsResponse = TuiOpenModelsResponses[keyof TuiOpenModelsResponses];
|
||||
|
||||
export type TuiSubmitPromptData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/tui/submit-prompt';
|
||||
};
|
||||
|
||||
export type TuiSubmitPromptResponses = {
|
||||
/**
|
||||
* Prompt submitted successfully
|
||||
*/
|
||||
200: boolean;
|
||||
};
|
||||
|
||||
export type TuiSubmitPromptResponse = TuiSubmitPromptResponses[keyof TuiSubmitPromptResponses];
|
||||
|
||||
export type TuiClearPromptData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/tui/clear-prompt';
|
||||
};
|
||||
|
||||
export type TuiClearPromptResponses = {
|
||||
/**
|
||||
* Prompt cleared successfully
|
||||
*/
|
||||
200: boolean;
|
||||
};
|
||||
|
||||
export type TuiClearPromptResponse = TuiClearPromptResponses[keyof TuiClearPromptResponses];
|
||||
|
||||
export type TuiExecuteCommandData = {
|
||||
body?: {
|
||||
command: string;
|
||||
};
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/tui/execute-command';
|
||||
};
|
||||
|
||||
export type TuiExecuteCommandResponses = {
|
||||
/**
|
||||
* Command executed successfully
|
||||
*/
|
||||
200: boolean;
|
||||
};
|
||||
|
||||
export type TuiExecuteCommandResponse = TuiExecuteCommandResponses[keyof TuiExecuteCommandResponses];
|
||||
|
||||
export type ClientOptions = {
|
||||
baseUrl: `${string}://${string}` | (string & {});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue