feat(initial): scaffold @push.rocks/smartchat with core, CLI, and web layers
Three-layer architecture built on @push.rocks/smartagent: - ts/ — ChatSession wrapping runAgent() with conversation state management - ts_cli/ — ink-based terminal chat TUI (React.createElement, no JSX) - ts_web/ — Lit web components (smartchat-window, smartchat-message, smartchat-input)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { React, h, render } from './plugins.js';
|
||||
import type { LanguageModelV3, ToolSet } from './plugins.js';
|
||||
import { ChatApp } from './components.chatapp.js';
|
||||
|
||||
export interface IStartChatOptions {
|
||||
/** The language model to use */
|
||||
model: LanguageModelV3;
|
||||
/** System prompt for the agent */
|
||||
system?: string;
|
||||
/** Tools available to the agent */
|
||||
tools?: ToolSet;
|
||||
/** Maximum agentic steps per turn */
|
||||
maxSteps?: number;
|
||||
/** Display name for the model (shown in header/status) */
|
||||
modelName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start an interactive chat TUI in the terminal.
|
||||
* Returns a promise that resolves when the user exits.
|
||||
*/
|
||||
export async function startChat(options: IStartChatOptions): Promise<void> {
|
||||
const instance = render(
|
||||
h(ChatApp, {
|
||||
model: options.model,
|
||||
system: options.system,
|
||||
tools: options.tools,
|
||||
maxSteps: options.maxSteps,
|
||||
modelName: options.modelName,
|
||||
}),
|
||||
);
|
||||
|
||||
await instance.waitUntilExit();
|
||||
}
|
||||
Reference in New Issue
Block a user