Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions web/host/web-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,11 @@ export class WebHost {
}
if (url.pathname === "/api/models")
return this.json(response, 200, { models: this.runtime.listModels() });
if (url.pathname === "/api/thinking")
return this.json(response, 200, {
sessionId: this.runtime.sessionManager.getSessionId(),
...(this.runtime.getThinkingState?.() ?? { level: "unknown", available: [] }),
});
if (url.pathname === "/api/snapshot") {
const cursor = this.sequence;
const projection = await this.adapter.getSnapshot(
Expand Down
5 changes: 5 additions & 0 deletions web/runtime/pi-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ export class PiWebRuntime implements WebRuntimeController {
return () => this.listeners.delete(listener);
}

getThinkingState() {
const session = this.runtime.session;
return { level: session.thinkingLevel, available: session.getAvailableThinkingLevels() };
}

async sendPrompt(content: string, options?: WebPromptOptions) {
this.assertActive();
this.assertWorkspaceSelected();
Expand Down
1 change: 1 addition & 0 deletions web/runtime/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export interface WebRuntimeController {
): Promise<WebSessionCreationResult>;
switchSession(sessionPath: string): Promise<{ cancelled: boolean }>;
listModels(): WebModelSummary[];
getThinkingState?(): { level: string; available: readonly string[] };
setModel(
provider: string,
modelId: string,
Expand Down
Loading