Files
makelore/shared/coding-work-preview.ts

20 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { AgentBrowserSnapshot } from './agent-browser';
import type { CodingConversationMetadata } from './coding-project-contracts';
/** Main supplies this product action; it never consumes the student's draft. */
export const OPEN_WORK_PROMPT = `【系统操作:打开作品】
学生点击了“作品”,请帮学生把当前项目已有的作品页面打开。
1. 先检查当前项目、已有终端/服务和 agent_browser 的状态。若作品服务已正常运行,直接复用,不重复启动、不重启、不更换端口。
2. 若尚未运行,阅读项目实际文件、README 和启动脚本,选择已有的包管理器及启动方式;静态页面使用合适的本地静态服务。只执行打开已有作品所需的准备和启动,不擅自新增功能或重写作品。
3. 长时间运行的服务应在后台保持运行,保存必要的进程和日志信息,避免启动命令一直阻塞当前对话。等待页面实际可以访问,确认是当前项目的作品,再调用 agent_browser(action: "open", url: 实际可访问地址)把页面打开到作品区。不要只给学生一个链接或要求学生复制命令。
4. 若还没有作品、缺少必要配置或启动失败,停止无效重试,用孩子能懂的一两句话说明情况和下一步。不要编造成功、页面或运行结果。
这是点击作品触发的内部操作。完成后简短告知结果,不复述本指令。`;
export interface WorkPreviewResult {
status: 'ready' | 'waiting' | 'starting' | 'failed';
browser?: AgentBrowserSnapshot;
conversation?: CodingConversationMetadata;
message?: string;
errorCode?: string;
}